Compare commits

...

305 Commits

Author SHA1 Message Date
8178fa9d39 value in StandardInput is nullable 2023-03-05 18:50:59 +06:00
1eb14becde now StandardInput uses callback with input receiver 2023-03-05 18:15:12 +06:00
6502e0923e DefaultInput -> StandardInput 2023-03-05 14:41:30 +06:00
443043cff5 update dependencies 2023-03-05 14:37:57 +06:00
1765214c97 remove redundant settings fromm gradle.properties 2023-03-05 14:36:16 +06:00
dcc6495030 start 0.6.1 2023-03-05 14:35:56 +06:00
1c16fb4ed7 Merge pull request #78 from InsanusMokrassar/0.6.0
0.6.0
2023-02-28 12:42:40 +06:00
a60fb67ad3 update compose 2023-02-28 12:35:34 +06:00
f8402b24d1 update dependencies 2023-02-28 12:21:43 +06:00
f70f4674ed start 0.6.0 2023-02-28 12:20:49 +06:00
7c81cea8af Merge pull request #77 from InsanusMokrassar/0.5.2
0.5.2
2023-01-26 22:44:37 +06:00
2aca51d742 Update CHANGELOG.md 2023-01-26 22:44:07 +06:00
d8be33d4f6 add inline support 2023-01-24 18:06:16 +06:00
1d6c0db692 add badge support 2023-01-24 13:44:01 +06:00
264bcae65e fixes in dialogs 2023-01-23 12:50:50 +06:00
ce5281c52d start 0.5.2 2023-01-23 12:50:03 +06:00
1349d253d7 Merge pull request #76 from InsanusMokrassar/0.5.1
0.5.1
2023-01-13 13:36:26 +06:00
dbf9efa8f5 fill changelog 2023-01-13 13:25:14 +06:00
c483bb67d8 potential fix of modals composition cancelling 2023-01-13 13:21:45 +06:00
7c5a9ecc3d start 0.5.1 2023-01-13 12:49:25 +06:00
05816f9a57 Merge pull request #75 from InsanusMokrassar/0.5.0
0.5.0
2023-01-12 14:51:06 +06:00
402af2445f temporarily remove UIKitConstants 2023-01-12 14:50:23 +06:00
71ccc74c94 fixes 2023-01-12 14:31:38 +06:00
0b8017a164 small improvement in dialogs 2023-01-11 21:57:43 +06:00
46a897e629 total rework of dialogs 2023-01-11 21:55:47 +06:00
0e1be72219 start 0.5.0 2023-01-11 21:35:30 +06:00
0feafdae4b Merge pull request #74 from InsanusMokrassar/0.4.3
0.4.3
2023-01-04 20:25:13 +06:00
fad48715b4 add gitea to the target repositories 2023-01-03 18:40:53 +06:00
f6bfef4b89 update github workflows 2023-01-03 18:38:33 +06:00
432a5744b3 add opportunity to now show dialog automatically 2023-01-03 18:37:01 +06:00
5dff8d69f2 start 0.4.3 2023-01-03 18:33:50 +06:00
e6ebc70578 Merge pull request #73 from InsanusMokrassar/0.4.2
0.4.2
2022-12-18 10:10:57 +06:00
0eba5d10f7 Update CHANGELOG.md 2022-12-18 10:07:51 +06:00
ffb7f41328 Update libs.versions.toml 2022-12-18 10:07:07 +06:00
77dabb5553 0.4.2 2022-12-18 10:06:45 +06:00
8c086eb3eb Merge pull request #71 from InsanusMokrassar/0.4.1
0.4.1
2022-11-16 00:57:42 +06:00
0d55505e09 fill changelog 2022-11-16 00:57:11 +06:00
eefdb5fda1 list may accept any iterable 2022-11-16 00:45:10 +06:00
0c281aa653 fixes for build 2022-11-16 00:17:03 +06:00
17ae0b119b StandardInput improvements 2022-11-15 21:50:15 +06:00
36214aeba5 start 0.4.1 2022-11-15 21:46:29 +06:00
19f3a59a79 Merge pull request #70 from InsanusMokrassar/0.4.0
0.4.0
2022-11-08 07:56:31 +06:00
5cfee9c4cc Update CHANGELOG.md 2022-11-08 07:54:53 +06:00
c9a17fa92a Update gradle-wrapper.properties 2022-11-08 07:53:42 +06:00
c36e8c58f4 Update libs.versions.toml 2022-11-08 07:52:33 +06:00
67f083610a start 0.4.0 2022-11-08 07:51:48 +06:00
636280a982 Merge pull request #69 from InsanusMokrassar/0.3.0
0.3.0
2022-09-19 20:54:03 +06:00
415549b251 Update libs.versions.toml 2022-09-17 00:55:20 +06:00
0d2672b679 start 0.3.0 2022-09-17 00:53:59 +06:00
a511def014 Merge pull request #68 from InsanusMokrassar/0.2.2
0.2.2
2022-09-14 14:07:24 +06:00
d783834aa4 Drop component and Navbar improvements 2022-09-14 13:54:48 +06:00
cf2b823765 start 0.2.2 2022-09-14 13:01:31 +06:00
0f6e2c9805 Merge pull request #67 from InsanusMokrassar/0.2.1
0.2.1
2022-08-20 18:24:02 +06:00
7b2810b206 add Tab support 2022-08-20 17:43:44 +06:00
0dff161ce6 start 0.2.1 2022-08-20 16:54:54 +06:00
0648ceed18 Merge pull request #66 from InsanusMokrassar/0.2.0
0.2.0
2022-08-04 17:33:45 +06:00
190b3ac53e remove deprecations 2022-08-04 17:31:07 +06:00
aa5015d079 update workflows 2022-08-04 17:22:33 +06:00
752bf5bfcd Update CHANGELOG.md 2022-08-04 16:53:10 +06:00
8d05f7e020 Update gradle.properties 2022-08-04 16:52:32 +06:00
5589d42f6d Update libs.versions.toml 2022-08-04 16:52:12 +06:00
32d26a8e56 Merge pull request #65 from InsanusMokrassar/0.1.10
0.1.10
2022-08-02 18:41:55 +06:00
2f521a4584 improve grid attributes 2022-08-02 18:40:17 +06:00
c47a140719 start 0.1.10 2022-08-02 18:32:53 +06:00
fbb4fb16d7 Merge pull request #64 from InsanusMokrassar/0.1.9
0.1.9
2022-07-31 15:08:35 +06:00
8c5dca73fa Grid support improvement; Article, Iconnav and Leader support 2022-07-31 15:04:27 +06:00
429d3d4e77 start 0.1.9 2022-07-31 14:57:40 +06:00
fed53cd8cd Update github_release.gradle 2022-07-24 12:09:59 +06:00
b72937e907 Merge pull request #63 from InsanusMokrassar/0.1.8
0.1.8
2022-07-24 12:07:34 +06:00
c88138a8ed update compose version 2022-07-24 12:05:31 +06:00
214fb07362 start 0.1.8 2022-07-24 12:04:22 +06:00
589fc62364 Merge pull request #62 from InsanusMokrassar/0.1.7
0.1.7
2022-05-29 10:45:29 +06:00
767f5291a8 add Toggle builder 2022-05-29 09:43:23 +06:00
38819eba21 start 0.1.7 2022-05-29 09:43:14 +06:00
e5223f8408 Merge pull request #61 from InsanusMokrassar/0.1.6
0.1.6
2022-05-23 16:52:35 +06:00
854bc9f8ca Add support of size and group in UIKitButton 2022-05-23 16:51:09 +06:00
36f5d5661b start 0.1.6 2022-05-23 16:50:50 +06:00
2af001a4f1 Merge pull request #60 from InsanusMokrassar/0.1.5
0.1.5
2022-05-23 13:09:15 +06:00
68f1879114 Update CHANGELOG.md 2022-05-23 13:08:35 +06:00
f16c93cf0d Update gradle.properties 2022-05-23 13:04:55 +06:00
63dd8f1bf6 Update UIKitSticky.kt 2022-05-23 13:03:29 +06:00
fafb7e7e04 Merge pull request #59 from InsanusMokrassar/0.1.4
0.1.4
2022-05-22 23:46:13 +06:00
5afa92ef37 UIKitSticky 2022-05-22 23:45:21 +06:00
4377ec3969 improvements 2022-05-22 23:21:25 +06:00
674fbbd4d5 start 0.1.4 2022-05-22 23:21:10 +06:00
efd9cb80e1 Merge pull request #58 from InsanusMokrassar/0.1.3
0.1.3
2022-05-19 10:38:33 -04:00
53b020ab8d improve AttrsWithContentBuilder functions 2022-05-19 18:56:52 +06:00
67a6998f02 add new variant of NavbarNav 2022-05-19 18:50:43 +06:00
abe44fe1c6 fixes in signature of NavbarNav fun 2022-05-19 18:50:06 +06:00
b028b12103 small fixes in UIKitNav 2022-05-19 18:47:03 +06:00
816f341729 fixes in UIKitNavbar invoke 2022-05-19 18:44:19 +06:00
6a652249c0 improvements and fixes in Navbar and NavbarNav parts 2022-05-19 18:43:41 +06:00
ec584798ad Update Navbar.kt 2022-05-19 15:23:04 +06:00
faf238cf07 fix in navbar 2022-05-19 14:38:35 +06:00
d78acce3c5 add several builders for AttrsWithContentBuilder 2022-05-19 14:16:30 +06:00
3afe6c2815 add support of sections 2022-05-19 13:42:21 +06:00
29efe4b5cd Improve support of navbars 2022-05-19 13:21:39 +06:00
990bd6385f start 0.1.3 2022-05-19 13:21:29 +06:00
deb30957ac Merge pull request #57 from InsanusMokrassar/0.1.2
0.1.2
2022-05-19 02:13:29 -04:00
276eaddcac Remove redundant DList and other + add AttrsWithContentBuilder 2022-05-19 12:13:13 +06:00
9b992cbda0 start 0.1.2 2022-05-19 12:10:49 +06:00
e227d3c88e Merge pull request #56 from InsanusMokrassar/0.1.1
0.1.1
2022-05-17 02:33:50 -04:00
fc4f937cc1 Update CHANGELOG.md 2022-05-17 12:30:38 +06:00
1ee9b8c4de Update libs.versions.toml 2022-05-17 12:29:51 +06:00
90e27d0cab start 0.1.1 2022-05-17 12:29:18 +06:00
400724c918 Merge pull request #55 from InsanusMokrassar/0.1.0
0.1.0
2022-05-16 00:00:24 +06:00
ea59ba1446 Update CHANGELOG.md 2022-05-15 23:58:58 +06:00
a97898fe69 Update libs.versions.toml 2022-05-15 23:58:00 +06:00
21d2ccf208 Update CHANGELOG.md 2022-05-10 15:05:06 +06:00
fd6a122b40 Update libs.versions.toml 2022-05-10 15:04:54 +06:00
6b4e141cd2 update release version 2022-05-07 01:46:31 +06:00
fb5e0ade11 update compose dependency 2022-05-07 01:43:57 +06:00
353314dd26 add dev compose maven 2022-04-29 17:34:10 +06:00
57ffe32b9f Update of dependencies 2022-04-29 17:29:37 +06:00
c6bacffdb3 start 0.1.0 2022-04-29 17:28:52 +06:00
3e2aa22076 Merge pull request #54 from InsanusMokrassar/0.0.53
0.0.53
2022-04-27 16:29:24 +06:00
5842da03d0 new function ListWithTitle 2022-04-27 16:24:57 +06:00
6daa57fe8f improve support of List 2022-04-27 16:13:58 +06:00
8adbe8a1ca Add support of UIKit lists 2022-04-27 16:07:07 +06:00
468f167ac6 Improvements in UIKitPadding 2022-04-27 15:44:06 +06:00
c41e2b8495 start 0.0.53 2022-04-27 15:43:55 +06:00
7cdd12e81e Merge pull request #53 from InsanusMokrassar/0.0.52
0.0.52
2022-04-26 15:09:19 +06:00
f3ce0f6b6b Improve work with UIKitModifiers 2022-04-26 14:54:26 +06:00
d24edcbaf7 start 0.0.52 2022-04-26 14:54:19 +06:00
fdd98bab13 Merge pull request #52 from InsanusMokrassar/0.0.51
0.0.51
2022-04-15 13:21:20 +06:00
ed6582c98d now it is impossible to pass null in hide fun of dropdown 2022-04-15 13:20:30 +06:00
4b697938ac a little fix in hide of dropdown 2022-04-15 13:12:04 +06:00
ebb350c688 Improvements in Dropdowns and new attribute in NavItemElement 2022-04-15 13:06:14 +06:00
8c2ce7b75d start 0.0.51 2022-04-15 13:05:20 +06:00
2d62f9847a Merge pull request #51 from InsanusMokrassar/0.0.50
0.0.50
2022-04-04 00:57:44 +06:00
3746b614cf rename new property 2022-04-04 00:07:33 +06:00
2ece25ef4e add opportunity to customize default header content of nav 2022-04-03 23:58:08 +06:00
18ffabf76d start 0.0.50 2022-04-03 23:57:39 +06:00
c5ef64ebe4 Merge pull request #50 from InsanusMokrassar/0.0.49
0.0.49
2022-04-03 18:36:34 +06:00
ee1bea8ee1 in navs now titles are optional 2022-04-03 16:03:13 +06:00
4a7b125abe start 0.0.49 2022-04-03 16:02:55 +06:00
a756bab2a6 Merge pull request #49 from InsanusMokrassar/0.0.48
0.0.48
2022-03-31 13:32:41 +06:00
be4d63f0e0 improvements in UIKitModifier tools 2022-03-31 09:12:01 +06:00
b177760c73 add UIKDropdown#Mode for none and hover and click 2022-03-30 21:08:29 +06:00
82f00fa23b All attribute values now will print their name as result of toString 2022-03-30 20:48:38 +06:00
33b1a7af65 fixes in dropdown position 2022-03-30 20:33:19 +06:00
e6b0ca580a support of breadcrumb 2022-03-30 16:41:07 +06:00
d5045bdba7 start 0.0.48 2022-03-30 16:40:51 +06:00
186eff482d Merge pull request #48 from InsanusMokrassar/0.0.47
0.0.47
2022-03-25 21:01:54 +06:00
4a204f8971 fixes in icons 2022-03-25 19:27:02 +06:00
fa41022df5 use iterables in navs 2022-03-25 17:13:50 +06:00
04a94cfabe add onClick callback into Close#drawAsButton 2022-03-25 16:56:39 +06:00
c337dd2b2d add composable annotations to close functions 2022-03-25 16:46:14 +06:00
b4a0ff6ece add support of close element 2022-03-25 16:45:30 +06:00
061b55b164 start 0.0.47 2022-03-25 16:44:50 +06:00
d93517bf83 Merge pull request #47 from InsanusMokrassar/0.0.46
0.0.46
2022-03-24 18:17:00 +06:00
8497739c10 add support of UIKitInverse and UIKitOverlay 2022-03-24 17:23:52 +06:00
7fb24d1999 start 0.0.46 2022-03-24 17:23:24 +06:00
bdd955d6e9 Update CHANGELOG.md 2022-03-16 16:28:32 +06:00
6144ee5723 Merge pull request #46 from InsanusMokrassar/0.0.45
0.0.45
2022-03-16 16:04:17 +06:00
1f44f27fbb add container support 2022-03-16 16:03:35 +06:00
c59c442a36 start 0.0.45 2022-03-16 16:03:08 +06:00
e61f420dc4 Merge pull request #45 from InsanusMokrassar/0.0.44
0.0.44
2022-03-13 16:46:46 +06:00
e0052950e9 Update CHANGELOG.md 2022-03-13 14:04:50 +06:00
47eab8821d Update libs.versions.toml 2022-03-13 14:03:13 +06:00
b89df98459 start 0.0.44 2022-03-13 14:02:46 +06:00
f90055fa59 Merge pull request #44 from InsanusMokrassar/0.0.43
0.0.43
2022-03-12 01:45:19 +06:00
38a884cc16 add defaults in content builders of Grid and GridColumn 2022-03-12 00:16:57 +06:00
43e3ed742d update gradle wrapper 2022-03-12 00:07:32 +06:00
3ddb22341c additions in UIKitScreenSizeModifier and support of Tile 2022-03-12 00:06:47 +06:00
475afeb78b start 0.0.43 2022-03-12 00:05:54 +06:00
af289b3194 Merge pull request #43 from InsanusMokrassar/0.0.42
0.0.42
2022-03-06 16:23:38 +06:00
7bd5b26a1b migration to compose 1.1.0 and replaces according to it 2022-03-06 16:18:21 +06:00
4e22cfce1a start 0.0.42 2022-03-06 16:18:01 +06:00
60816700ea Merge pull request #42 from InsanusMokrassar/0.0.41
0.0.41
2022-03-03 00:59:28 +06:00
33fbd2c0be now it is possible to include nullable modifiers in attrs 2022-03-02 21:57:55 +06:00
b836fe744e DescriptionList 2022-03-02 20:27:23 +06:00
f77c21ac51 fixes in DropAre and new type of attrs 2022-03-02 18:40:07 +06:00
c720973bfc UIKitForm#Custom now will also include class uk-form-custom 2022-03-02 18:06:41 +06:00
0b11e2c1b9 add UIKitUtility#Link 2022-03-02 17:59:52 +06:00
556ab4e090 add DropAre, UIKitPlaceholder and UIKitForm#Custom now have nullable target 2022-03-02 16:52:58 +06:00
a596516c79 start 0.0.41 2022-03-02 16:52:24 +06:00
8eeabc4b5d Merge pull request #41 from InsanusMokrassar/0.0.40
0.0.40
2022-03-01 22:29:14 +06:00
2a3f14593b use iterables for data in default tables 2022-03-01 13:26:04 +06:00
bfd6790014 start 0.0.40 2022-03-01 13:25:37 +06:00
27ad91be74 Merge pull request #40 from InsanusMokrassar/0.0.39
0.0.39
2022-03-01 01:21:19 +06:00
3c7f17523b refactor invoke functions 2022-03-01 00:49:19 +06:00
c81c1125a0 add UIKitDialog 2022-03-01 00:14:17 +06:00
2e28334b41 add support of notifications 2022-02-28 23:55:09 +06:00
7c33efa121 start 0.0.39 2022-02-28 23:54:59 +06:00
7b6a8c81b4 Merge pull request #39 from InsanusMokrassar/0.0.38
0.0.38
2022-02-25 00:36:19 +06:00
031d07d97a AttributesCollection#plus 2022-02-25 00:22:17 +06:00
a2eda2726b add UIKitToggle 2022-02-25 00:12:20 +06:00
eb15ce9281 start 0.0.38 2022-02-25 00:12:02 +06:00
3b3319c8aa Merge pull request #38 from InsanusMokrassar/0.0.37
0.0.37
2022-02-24 14:44:23 +06:00
0b40c3acf0 remove auto margin from dialog 2022-02-24 14:42:45 +06:00
ebbfac6763 fix in Accordion and UIKitAccordion.Companion 2022-02-23 23:10:19 +06:00
6f913c0a83 Accordion 2022-02-23 20:25:27 +06:00
528f6652e0 start 0.0.37 2022-02-23 20:25:13 +06:00
e3ba921018 Merge pull request #37 from InsanusMokrassar/0.0.36
0.0.36
2022-02-18 15:18:00 +06:00
44c35c6778 support of UIKitForm 2022-02-17 19:31:31 +06:00
7b06e0ecb1 add UIKitCustom 2022-02-17 17:46:15 +06:00
366971bcf5 add afterHeaderBuilder and beforeFooterBuilder in Dialog 2022-02-17 17:28:42 +06:00
d4d0adf020 vertical and horizontal in margins 2022-02-17 15:16:30 +06:00
fc2fb24fce reorder comment arguments 2022-02-17 14:57:09 +06:00
687c3ab065 start 0.0.36 2022-02-17 14:56:47 +06:00
70f1abd527 Merge pull request #36 from InsanusMokrassar/0.0.35
0.0.35
2022-02-17 14:09:11 +06:00
1785e2158e improve work with modal dialogs 2022-02-16 19:54:07 +06:00
23ec737a05 start 0.0.35 2022-02-16 19:53:28 +06:00
f7eecc01e3 Merge pull request #35 from InsanusMokrassar/0.0.34
0.0.34
2022-02-09 16:10:11 +06:00
e4c2622115 fix of class in Alert 2022-02-09 15:47:02 +06:00
1a655810bd fixes in AlertCloseButton 2022-02-09 15:28:47 +06:00
dcc8646f18 add AlertCloseButton 2022-02-09 13:53:56 +06:00
53c728d7bc make Alert#attrs to be optional 2022-02-09 13:48:06 +06:00
01349d2fac add Alert and several things in animation 2022-02-09 13:43:56 +06:00
5ac4242b68 start 0.0.34 2022-02-09 13:43:11 +06:00
c1c1f847a9 Merge pull request #34 from InsanusMokrassar/0.0.33
attribute builder now may skip nullable values
2022-02-09 01:27:47 +06:00
1f8298f626 attribute builder now may skip nullable values 2022-02-09 01:26:33 +06:00
94698a0468 Merge pull request #33 from InsanusMokrassar/0.0.33
0.0.33
2022-02-09 01:19:14 +06:00
ca8f927304 updates and attributes buildings and fixes 2022-02-09 01:18:51 +06:00
a856545471 start 0.0.33 2022-02-09 01:18:34 +06:00
41b8063c72 Merge pull request #32 from InsanusMokrassar/0.0.32
0.0.32
2022-02-08 22:09:00 +06:00
6f4f1776c4 fix in UIKitWidth#Fixed 2022-02-08 19:12:24 +06:00
e10bbdeaa0 support of UIKitHeight, AttributesBuilder and Percents/Pixels abstractions 2022-02-08 18:48:49 +06:00
9dd486090a start 0.0.32 2022-02-08 18:48:20 +06:00
4479d9b0f9 Merge pull request #31 from InsanusMokrassar/0.0.31
0.0.31
2022-01-28 14:14:42 +06:00
cef131b1d0 UIKitVisibility 2022-01-28 14:14:27 +06:00
15340eadb1 start 0.0.31 2022-01-28 14:14:14 +06:00
36ab3fe52e Merge pull request #30 from InsanusMokrassar/0.0.30
0.0.30
2022-01-28 14:01:31 +06:00
029a7804ad add UIKitComment, Comment element, upfill UIKitSubNav 2022-01-28 14:01:06 +06:00
7edea7bf74 start 0.0.30 2022-01-28 14:00:34 +06:00
b1ea6d3a61 Merge pull request #29 from InsanusMokrassar/0.0.29
0.0.29
2022-01-26 13:38:46 +06:00
a304dcf5df fixes for build 2022-01-26 13:37:59 +06:00
a88562d3c4 upfill UIKitText 2022-01-26 13:37:03 +06:00
d9a01a8ab8 start 0.0.29 2022-01-26 13:36:49 +06:00
56b1268172 Merge pull request #28 from InsanusMokrassar/0.0.28
0.0.28
2022-01-26 13:20:44 +06:00
a3c8cdcc96 Fixes in UIKitWidth 2022-01-26 13:20:14 +06:00
68d1ba6a37 start 0.0.28 2022-01-26 13:19:51 +06:00
1cf9655575 Merge pull request #27 from InsanusMokrassar/0.0.27
0.0.27
2022-01-26 00:51:54 +06:00
4a7101697a TextField -> StandardInput + fixes in it 2022-01-26 00:51:26 +06:00
17badd4724 start 0.0.27 2022-01-26 00:50:55 +06:00
39e54e8ca3 Merge pull request #26 from InsanusMokrassar/0.0.26
0.0.26
2022-01-25 23:44:43 +06:00
ed31eb01e5 add UIKitColumn 2022-01-25 23:44:22 +06:00
9d06725221 start 0.0.26 2022-01-25 23:44:15 +06:00
d8d4a7fcf1 Merge pull request #25 from InsanusMokrassar/0.0.25
0.0.25
2022-01-25 20:29:04 +06:00
252fe4a295 extend divider 2022-01-25 20:28:50 +06:00
6dbff07692 start 0.0.25 2022-01-25 20:28:34 +06:00
e94585fc7e Merge pull request #24 from InsanusMokrassar/0.0.24
0.0.24
2022-01-25 20:22:41 +06:00
b449caae13 add opportunity to fill space between header and body of table 2022-01-25 20:22:17 +06:00
95edaf1cfe start 0.0.24 2022-01-25 20:22:10 +06:00
cb2fbe9f42 Merge pull request #23 from InsanusMokrassar/0.0.23
0.0.23
2022-01-25 20:13:22 +06:00
598e481f75 add headerCustomizer to table 2022-01-25 20:13:03 +06:00
2a76519843 start 0.0.23 2022-01-25 20:12:48 +06:00
8e9ff07b71 Merge pull request #22 from InsanusMokrassar/0.0.22
0.0.22
2022-01-25 19:35:25 +06:00
13556a293c add opportunity to customize table header cells 2022-01-25 19:35:08 +06:00
a4d4ec3db8 start 0.0.22 2022-01-25 19:34:59 +06:00
6f095de81d Merge pull request #21 from InsanusMokrassar/0.0.21
0.0.21
2022-01-25 13:15:51 +06:00
6b60d22e1e upfill UIKitWidth 2022-01-25 13:15:37 +06:00
4e0cc3621c start 0.0.21 2022-01-25 13:15:04 +06:00
4943490910 Merge pull request #20 from InsanusMokrassar/0.0.20
0.0.20
2022-01-25 12:54:38 +06:00
b60a3bc279 fixes in buttons 2022-01-25 12:54:19 +06:00
228138757d start 0.0.20 2022-01-25 12:53:47 +06:00
f1dedf1e09 Merge pull request #19 from InsanusMokrassar/0.0.19
0.0.19
2022-01-25 12:39:35 +06:00
936bb2d6fd create cards implementation and upgrade labels 2022-01-25 12:39:09 +06:00
0da87743e8 start 0.0.19 2022-01-25 12:38:37 +06:00
36eeb012c6 Merge pull request #18 from InsanusMokrassar/0.0.18
0.0.18
2022-01-25 11:25:47 +06:00
58f8f99e10 add uk-flex to UIKitFlex base class 2022-01-25 11:24:58 +06:00
d1c03e5c48 start 0.0.18 2022-01-25 11:22:36 +06:00
bd19572d78 Merge pull request #17 from InsanusMokrassar/0.0.17
0.0.17
2022-01-25 00:02:49 +06:00
9449eccec1 headingCustomizer -> headerCellCustomizer + add index and title parameters for it 2022-01-25 00:02:29 +06:00
f518933195 start 0.0.17 2022-01-25 00:00:42 +06:00
23f3ecb0d4 Merge pull request #16 from InsanusMokrassar/0.0.16
0.0.16
2022-01-24 21:46:41 +06:00
c6023d3075 add opportunity to customize NavDivider 2022-01-24 21:39:47 +06:00
7b72f99f66 start 0.0.16 2022-01-24 21:39:40 +06:00
66c3f97f65 Merge pull request #15 from InsanusMokrassar/0.0.15
0.0.15
2022-01-21 22:41:49 +06:00
40c3c0f437 add support of link icons type 2022-01-21 22:41:26 +06:00
e46b2e0ddd start 0.0.15 2022-01-21 22:41:18 +06:00
2db4e48571 Merge pull request #14 from InsanusMokrassar/0.0.14
0.0.14
2022-01-21 22:20:16 +06:00
e13a2fd241 add DefaultTable parameter cellAttributes 2022-01-21 22:20:02 +06:00
b3b19ed2b7 start 0.0.14 2022-01-21 22:16:03 +06:00
d590762d28 Merge pull request #13 from InsanusMokrassar/0.0.13
0.0.13
2022-01-21 21:37:39 +06:00
65703d1c22 add Icon#Custom 2022-01-21 21:37:16 +06:00
814045a43f start 0.0.13 2022-01-21 21:37:07 +06:00
1f36657857 Merge pull request #12 from InsanusMokrassar/0.0.12
0.0.12
2022-01-21 20:29:00 +06:00
a2830e5e85 add rowAttributes customizer for tables 2022-01-21 20:28:19 +06:00
484564e323 start 0.0.12 2022-01-21 20:27:31 +06:00
b5e93bc829 Merge pull request #11 from InsanusMokrassar/0.0.11
0.0.11
2022-01-21 11:32:00 +06:00
4282165d79 upfill navs 2022-01-21 11:31:00 +06:00
1e452c78d1 start 0.0.11 2022-01-21 11:30:47 +06:00
5fa388c169 Merge pull request #10 from InsanusMokrassar/0.0.10
0.0.10
2022-01-21 10:57:06 +06:00
763e1fa5ac upfill utilities 2022-01-21 10:55:14 +06:00
150efa1719 start 0.0.10 2022-01-21 10:55:01 +06:00
20bf43b8a1 Merge pull request #9 from InsanusMokrassar/0.0.9
0.0.9
2022-01-20 20:06:36 +06:00
93dd63c6b1 nav support improving 2022-01-20 19:56:46 +06:00
eb06ff80a1 start 0.0.9 2022-01-20 19:46:30 +06:00
25ba9188e3 Update README.md 2022-01-14 23:32:06 +06:00
19ca960b35 Update README.md 2022-01-14 00:45:09 +06:00
ef3b711e2b Merge pull request #8 from InsanusMokrassar/0.0.8
0.0.8
2022-01-13 21:38:04 +06:00
6bebb8b8d4 removing of redundant things 2022-01-13 21:36:39 +06:00
c013a978d4 start 0.0.8 2022-01-13 21:36:28 +06:00
9f342f428a Merge pull request #7 from InsanusMokrassar/0.0.7
0.0.7
2022-01-13 19:59:17 +06:00
0beb781e2c now project is multiplatform and correctly working 2022-01-13 19:56:39 +06:00
5880db3db1 start 0.0.7 2022-01-13 19:56:09 +06:00
b7e08af54a Merge pull request #6 from InsanusMokrassar/0.0.6
0.0.6
2022-01-13 13:51:14 +06:00
461b1e845c fixes in several signatures 2022-01-13 13:49:58 +06:00
a7f8c6f068 start 0.0.6 2022-01-13 13:49:41 +06:00
6309656fac Merge pull request #5 from InsanusMokrassar/0.0.5
0.0.5
2022-01-13 12:00:03 +06:00
0beda0b6ef add attributes customizers lambdas to all elements and temporarily change signatures with modifiers from varargs to arrays 2022-01-13 11:58:21 +06:00
ccf1daa2b5 start 0.0.5 2022-01-13 11:54:20 +06:00
4a70299db8 Merge pull request #4 from InsanusMokrassar/0.0.4
0.0.4
2022-01-12 20:00:06 +06:00
143 changed files with 4357 additions and 987 deletions

View File

@@ -1,19 +0,0 @@
name: Build
on: [push]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up JDK 1.8
uses: actions/setup-java@v1
with:
java-version: 1.8
- name: Fix android 31.0.0 dx
continue-on-error: true
run: cd /usr/local/lib/android/sdk/build-tools/31.0.0/ && mv d8 dx && cd lib && mv d8.jar dx.jar
- name: Build with Gradle
run: ./gradlew build

26
.github/workflows/build_and_publish.yml vendored Normal file
View File

@@ -0,0 +1,26 @@
name: Build
on: [push]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up JDK 11
uses: actions/setup-java@v1
with:
java-version: 11
- name: Rewrite version
run: |
branch="`echo "${{ github.ref }}" | grep -o "[^/]*$"`"
cat gradle.properties | sed -e "s/^version=\([0-9\.]*\)/version=\1-branch_$branch-build${{ github.run_number }}/" > gradle.properties.tmp
rm gradle.properties
mv gradle.properties.tmp gradle.properties
- name: Build with Gradle
run: ./gradlew build
- name: Publish
continue-on-error: true
run: ./gradlew publishAllPublicationsToGiteaRepository
env:
GITEA_TOKEN: ${{ secrets.GITEA_TOKEN }}

1
.gitignore vendored
View File

@@ -11,6 +11,7 @@ out/
secret.gradle
local.properties
local.*
kotlin-js-store/

View File

@@ -1,3 +1,339 @@
# Changelog
## 0.6.1
* `DefaultInput` has been renamed to `StandardInput`
* `Compose`: `1.3.1-rc02`
## 0.6.0
* `Kotlin`: `1.8.10`
* `Compose`: `1.3.1-rc01`
## 0.5.2
* More fixes in Dialogs
* Badge supported
* Inline creation support
## 0.5.1
* Fixes in new `Dialog`s
## 0.5.0
* Fully rework `Dialog` elements
## 0.4.3
* Add opportunity to now show dialog automatically
## 0.4.2
* `Compose`: `1.2.2`
## 0.4.1
* Now it is possible to use `StandardInput` with simple `T` types instead of states
* `List` may accept any `Iterable`
## 0.4.0
* `Kotlin`: `1.7.20`
* `Compose`: `1.2.1`
## 0.2.2
* Add support of `Drop` component
* Improve support of `Navbar`s
## 0.2.1
* `Tab` elements become supported
## 0.2.0
**ALL DEPRECATIONS HAVE BEEN REMOVED**
* `Kotlin`: `1.7.0`
* `Compose`: `1.2.0-alpha01-dev753`
## 0.1.10
* `Grid` support improvements
## 0.1.9
* `Artile` elements become supported
* `Iconnav` elements become supported
* `Leader` elements become supported
* `Grid` support improvements
## 0.1.8
* `Compose`: `1.2.0-alpha01-dev731`
## 0.1.7
Add Toggle builder
## 0.1.6
* Add support of UIKitButton size and group
## 0.1.5
* Fix access to `UIKitSticky`
## 0.1.4
* Improvements in `UIKitGrid`
* Add support of `UIKitSticky`
## 0.1.3
* Add support of sections
* Improve support of navbars
## 0.1.2
* New typealias `AttrsWithContentBuilder`
* Old `DList` and related composable functions removed (they are built-in in compose)
## 0.1.1
* `Compose`: `1.2.0-alpha01-dev686`
## 0.1.0
* `Kotlin` = `1.6.21`
* `Compose`: `1.2.0-alpha01-dev683`
## 0.0.53
* Improvements in `UIKitPadding`
* Add support of UIKit lists
## 0.0.52
* Improve work with UIKitModifiers
## 0.0.51
* New interface `Dropdown` which will be used to create (or retrieve) dropdown for an element
* New attribute in `NavItemElement` for configuration of `A` element
## 0.0.50
* Add opportunity to customize content in title of `Nav` after text
## 0.0.49
* Now it is possible to use optional title in navs builders
## 0.0.48
* Added support of `Breadcrumb`
* Add opportunity to summarize `UIKitModifier`
* Add opportunity to simply create attributes builder using `UIKitModifier` of array of them
## 0.0.47
* Add support of `Close` element
## 0.0.46
* Add support of `UIKitOverlay`
* Add support of `UIKitInverse`
## 0.0.45
* Add support of containers in `UIKitContainer` modifiers and `Container` function
## 0.0.44
* `Versions`:
* `Compose`: `1.1.0` -> `1.1.1`
## 0.0.43
* Several new extensions for `UIKitModifier` like `UIKitModifier#onSmallScreen`
* Support of `Tile`
## 0.0.42
* Migration to compose 1.1.0
* Replaces according to it
## 0.0.41
* Add `DropArea`
* Add `UIKitPlaceholder`
* `UIKitForm#Custom` now have nullable param target
* Add `UIKitUtility#Link`
* Add `DescriptionList` and several support composable functions
## 0.0.40
* All `DefaultTable` functions now use `Iterable` as data type
## 0.0.39
* Add support of `Notifications`
## 0.0.38
* Add support of `Toggle`
* Attributes collection now can be concatenated
## 0.0.37
* `Dialog` now do not add auto margin by default
* Support of `Accordion` element
## 0.0.36
* Reorder arguments in `DefaultComment` fun
* Add `Vertical` and `Horizontal` members in margins
* Add `afterHeaderBuilder` and `beforeFooterBuilder` properties in `Dialog` fun
* Add `UIKitCustom` to be able for simple creating of custom modifiers
* Add support of `UIKitForm`
## 0.0.35
* Add `UIKitModal`
* Improve work with dialogs
## 0.0.34
* Add `Alert`
* Add `Animation#KenBurns`
## 0.0.33
* Fixes in attributes building and related things
## 0.0.32
* Support of `UIKitHeight`
* New builder `AttributesBuilder`
* New `Percents`/`Pixels` abstractions
* Fixes in `UIKitWidth#Fixed` classnames
## 0.0.31
* Support of `UIKitVisibility`
## 0.0.30
* Add `UIKitComment`
* Including of `Comment` element
* Upfill `UIKitSubNav`
## 0.0.29
* Unfilling of `UIKitText`
## 0.0.28
* Fixes in `UIKitWidth`
## 0.0.27
* `TextField` has been renamed to `StandardInput`
* `StandardInput` now will look for changes in state
## 0.0.26
* Add UIKitColumn
## 0.0.25
* Full including of divider
## 0.0.24
* Add opportunity to fill space between header and body of table
## 0.0.23
* New parameter of tables `headerCustomizer`
## 0.0.22
* Add opportunity to customize table header cells
## 0.0.21
* Upfill `UIKitWidth`
* New extension `UIKitModifier#applyWhenScreenSizeIs`
## 0.0.20
* Remove type of button from `DefaultButton` and add companion to `UIKitButton` to be able to use `uk-button` class
## 0.0.19
* Create `Card`s implementation
* Upgrade `Label` composable draw and create `UIKitLabel` modifiers
## 0.0.18
* Add base companion for `UIKitFlex` with result class `uk-flex`
## 0.0.17
* In `DefaultTable` `headingCustomizer` has been renamed to `headerCellCustomizer`
* Add index and title parameters for `headerCellCustomizer` in `DefaultTable`
## 0.0.16
* Add opportunity to customize `NavDivider`
## 0.0.15
* Add support of link icons
## 0.0.14
* Add DefaultTable parameter cellCustomizer
## 0.0.13
* Add `Icon#Custom`
## 0.0.12
* Add `rowAttributes` to table fun
## 0.0.11
* Upfill `Nav` and `UIKitNav`
## 0.0.10
* Filling of `UIKitUtility`
## 0.0.9
* Improving of `Nav` support
## 0.0.8
Removing of redundant non standard things
## 0.0.7
Rewrite project onto multiplatform paradigm and return back varargs instead of most `Array<UIKitModifier>`
## 0.0.6
Changes in signatures of text field and list
## 0.0.5
All elements has changed their signatures: they all will accept an additional lambda for attributes configuration
## 0.0.4
__Migrate modifers to modifiers__

View File

@@ -1,8 +1,5 @@
# JSUIKit Kotlin
**IMPORTANT NOTICE**: ___Currently it is possible that you will have issues with `vararg` arguments passing to the functions.
Use `arrayOf(...)` instead___
Hello :) This library is a wrapper for JavaScript/CSS [UIKit](https://getuikit.com) framework. It uses the same
structure as in [UIKit Docs](https://getuikit.com/docs/introduction) and in most cases you may use it.
@@ -11,10 +8,10 @@ for you in case you are using it too.
## How to include
Last version: [![Maven Central](https://maven-badges.herokuapp.com/maven-central/dev.inmo/jsuikitkotlin/badge.svg)](https://maven-badges.herokuapp.com/maven-central/dev.inmo/jsuikitkotlin)
Last version: [![Maven Central](https://maven-badges.herokuapp.com/maven-central/dev.inmo/kjsuikit/badge.svg)](https://maven-badges.herokuapp.com/maven-central/dev.inmo/kjsuikit)
```groovy
implementation "dev.inmo:jsuikitkotlin:$jsuikitkotlin_version"
implementation "dev.inmo:kjsuikit:$kjsuikit_version"
```
**THIS LIBRARY DO NOT ADD ANY JS OR CSS**. So, you must download and include UIKit js/css by yourself. See

View File

@@ -15,35 +15,45 @@ buildscript {
}
plugins {
alias(libs.plugins.kt.js)
alias(libs.plugins.kt.multiplatform)
alias(libs.plugins.jb.compose)
}
project.version = "$version"
project.group = "$group"
allprojects {
repositories {
mavenLocal()
mavenCentral()
google()
}
repositories {
mavenLocal()
mavenCentral()
google()
maven { url "https://maven.pkg.jetbrains.space/public/p/compose/dev" }
}
kotlin {
js(IR) {
browser()
binaries.executable()
}
}
sourceSets {
commonMain {
dependencies {
implementation libs.kt.stdlib
implementation compose.runtime
}
}
jsMain {
dependencies {
implementation compose.web.core
}
}
dependencies {
implementation libs.kt.stdlib
implementation compose.web.core
implementation compose.runtime
testImplementation libs.kt.test.js
testImplementation libs.kt.test.junit
jsTest {
dependencies {
implementation libs.kt.test.js
implementation libs.kt.test.junit
}
}
}
}
apply from: "./github_release.gradle"

View File

@@ -21,7 +21,7 @@ if (new File(projectDir, "secret.gradle").exists()) {
owner "InsanusMokrassar"
repo "JSUIKitKBindings"
tagName "${project.version}"
tagName "v${project.version}"
releaseName "${project.version}"
targetCommitish "${project.version}"

View File

@@ -3,11 +3,8 @@ org.gradle.parallel=true
kotlin.js.generate.externals=true
kotlin.incremental=true
kotlin.incremental.js=true
android.useAndroidX=true
android.enableJetifier=true
# Project data
group=dev.inmo
version=0.0.4
version=0.6.1

View File

@@ -1,9 +1,9 @@
[versions]
kt = "1.6.10"
jb-compose = "1.0.1"
jb-dokka = "1.6.10"
gh-release = "2.2.12"
kt = "1.8.10"
jb-compose = "1.3.1-rc02"
jb-dokka = "1.8.10"
gh-release = "2.4.1"
[libraries]
@@ -18,5 +18,5 @@ buildscript-gh-release = { module = "com.github.breadmoirai:github-release", ver
[plugins]
kt-js = { id = "org.jetbrains.kotlin.js", version.ref = "kt" }
kt-multiplatform = { id = "org.jetbrains.kotlin.multiplatform", version.ref = "kt" }
jb-compose = { id = "org.jetbrains.compose", version.ref = "jb-compose" }

View File

@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.3.3-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-7.6.1-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists

1
local.make_version.sh Executable file
View File

@@ -0,0 +1 @@
git add -A && git stash && git checkout master && git pull && git checkout -b "$1" && nano gradle.properties CHANGELOG.md && git add -A && git commit -m "start $1" && git stash pop && git add -A && nano CHANGELOG.md && git add -A && git commit -m "$2" && git push --set-upstream origin "$1" && ./gradlew clean && ./gradlew publishToMavenLocal

View File

@@ -1,72 +1,75 @@
apply plugin: 'maven-publish'
task javadocJar(type: Jar) {
task javadocsJar(type: Jar) {
classifier = 'javadoc'
}
task sourcesJar(type: Jar) {
kotlin.sourceSets.all {
from(kotlin)
}
classifier = 'sources'
}
publishing {
publications {
maven(MavenPublication) {
kotlin.js().components.forEach {
from(it)
publications.all {
artifact javadocsJar
pom {
description = "${project.name}"
name = "${project.name}"
url = "https://github.com/InsanusMokrassar/JSUIKitKBindings"
scm {
developerConnection = "scm:git:[fetch=]https://github.com/InsanusMokrassar/JSUIKitKBindings.git[push=]https://github.com/InsanusMokrassar/JSUIKitKBindings.git"
url = "https://github.com/InsanusMokrassar/JSUIKitKBindings.git"
}
artifact javadocJar
artifact sourcesJar
pom {
resolveStrategy = Closure.DELEGATE_FIRST
description = "${project.name}"
name = "${project.name}"
url = "https://github.com/InsanusMokrassar/JSUIKitKBindings"
scm {
developerConnection = "scm:git:[fetch=]https://github.com/InsanusMokrassar/JSUIKitKBindings.git[push=]https://github.com/InsanusMokrassar/JSUIKitKBindings.git"
url = "https://github.com/InsanusMokrassar/JSUIKitKBindings.git"
}
developers {
developer {
id = "InsanusMokrassar"
name = "Ovsiannikov Aleksei"
email = "ovsyannikov.alexey95@gmail.com"
}
}
licenses {
license {
name = "Apache Software License 2.0"
url = "https://opensource.org/licenses/Apache-2.0"
}
}
}
repositories {
if ((project.hasProperty('SONATYPE_USER') || System.getenv('SONATYPE_USER') != null) && (project.hasProperty('SONATYPE_PASSWORD') || System.getenv('SONATYPE_PASSWORD') != null)) {
maven {
name = "sonatype"
url = uri("https://oss.sonatype.org/service/local/staging/deploy/maven2/")
credentials {
username = project.hasProperty('SONATYPE_USER') ? project.property('SONATYPE_USER') : System.getenv('SONATYPE_USER')
password = project.hasProperty('SONATYPE_PASSWORD') ? project.property('SONATYPE_PASSWORD') : System.getenv('SONATYPE_PASSWORD')
}
developers {
developer {
id = "InsanusMokrassar"
name = "Ovsiannikov Aleksei"
email = "ovsyannikov.alexey95@gmail.com"
}
}
licenses {
license {
name = "Apache Software License 2.0"
url = "https://opensource.org/licenses/Apache-2.0"
}
}
}
repositories {
if (project.hasProperty('GITEA_TOKEN') || System.getenv('GITEA_TOKEN') != null) {
maven {
name = "GITEA"
url = uri("https://git.inmo.dev/api/packages/InsanusMokrassar/maven")
credentials(HttpHeaderCredentials) {
name = "Authorization"
value = project.hasProperty('GITEA_TOKEN') ? project.property('GITEA_TOKEN') : System.getenv('GITEA_TOKEN')
}
authentication {
header(HttpHeaderAuthentication)
}
}
}
if ((project.hasProperty('SONATYPE_USER') || System.getenv('SONATYPE_USER') != null) && (project.hasProperty('SONATYPE_PASSWORD') || System.getenv('SONATYPE_PASSWORD') != null)) {
maven {
name = "sonatype"
url = uri("https://oss.sonatype.org/service/local/staging/deploy/maven2/")
credentials {
username = project.hasProperty('SONATYPE_USER') ? project.property('SONATYPE_USER') : System.getenv('SONATYPE_USER')
password = project.hasProperty('SONATYPE_PASSWORD') ? project.property('SONATYPE_PASSWORD') : System.getenv('SONATYPE_PASSWORD')
}
}
}
}
}
}
if (project.hasProperty("signing.gnupg.keyName")) {
apply plugin: 'signing'

View File

@@ -1 +1 @@
{"licenses":[{"id":"Apache-2.0","title":"Apache Software License 2.0","url":"https://opensource.org/licenses/Apache-2.0"}],"mavenConfig":{"name":"${project.name}","description":"${project.name}","url":"https://github.com/InsanusMokrassar/JSUIKitKBindings","vcsUrl":"https://github.com/InsanusMokrassar/JSUIKitKBindings.git","developers":[{"id":"InsanusMokrassar","name":"Ovsiannikov Aleksei","eMail":"ovsyannikov.alexey95@gmail.com"}],"repositories":[{"name":"sonatype","url":"https://oss.sonatype.org/service/local/staging/deploy/maven2/"}],"gpgSigning":{"type":"dev.inmo.kmppscriptbuilder.core.models.GpgSigning.Optional"}},"type":"JS"}
{"licenses":[{"id":"Apache-2.0","title":"Apache Software License 2.0","url":"https://opensource.org/licenses/Apache-2.0"}],"mavenConfig":{"name":"${project.name}","description":"${project.name}","url":"https://github.com/InsanusMokrassar/JSUIKitKBindings","vcsUrl":"https://github.com/InsanusMokrassar/JSUIKitKBindings.git","developers":[{"id":"InsanusMokrassar","name":"Ovsiannikov Aleksei","eMail":"ovsyannikov.alexey95@gmail.com"}],"repositories":[{"name":"GITEA","url":"https://git.inmo.dev/api/packages/InsanusMokrassar/maven","credsType":{"type":"dev.inmo.kmppscriptbuilder.core.models.MavenPublishingRepository.CredentialsType.HttpHeaderCredentials","headerName":"Authorization","headerValueProperty":"GITEA_TOKEN"}},{"name":"sonatype","url":"https://oss.sonatype.org/service/local/staging/deploy/maven2/"}],"gpgSigning":{"type":"dev.inmo.kmppscriptbuilder.core.models.GpgSigning.Optional"}}}

View File

@@ -0,0 +1,14 @@
package dev.inmo.jsuikit
import dev.inmo.jsuikit.utils.*
import org.jetbrains.compose.web.attributes.AttrsScope
fun AttrsScope<*>.buildAndAddAttribute(
attributeName: String,
skipNullValues: Boolean = true,
block: ParametersBuilder.() -> Unit
) {
buildAttribute(attributeName, skipNullValues, block).let {
attr(it.first, it.second)
}
}

View File

@@ -0,0 +1,89 @@
package dev.inmo.jsuikit.elements
import androidx.compose.runtime.Composable
import dev.inmo.jsuikit.modifiers.UIKitAccordion
import dev.inmo.jsuikit.modifiers.include
import dev.inmo.jsuikit.utils.Attrs
import org.jetbrains.compose.web.attributes.AttrsScope
import org.jetbrains.compose.web.dom.*
import org.w3c.dom.*
@Composable
fun <T> Accordion(
data: Iterable<T>,
attrs: Attrs<HTMLUListElement> = Attrs.empty(),
itemAttrsBuilder: AttrsScope<HTMLLIElement>.(Int, T) -> Unit = { _, _ -> },
itemContentBuilder: @Composable ElementScope<HTMLLIElement>.(Int, T) -> Unit
) {
Ul(
{
include(UIKitAccordion)
attrs.builder(this)
}
) {
data.forEachIndexed { i, t ->
Li({ itemAttrsBuilder(i, t) }) {
itemContentBuilder(i, t)
}
}
}
}
@Composable
fun <T> DefaultAccordion(
data: Iterable<T>,
attrs: Attrs<HTMLUListElement> = Attrs.empty(),
itemAttrsBuilder: AttrsScope<HTMLLIElement>.(Int, T) -> Unit = { _, _ -> },
titleAttrsBuilder: AttrsScope<HTMLAnchorElement>.(Int, T) -> Unit = { _, _ -> },
titleContentBuilder: @Composable ElementScope<HTMLAnchorElement>.(Int, T) -> Unit = { _, _ -> },
beforeTitleContentBuilder: @Composable ElementScope<HTMLLIElement>.(Int, T) -> Unit = { _, _ -> },
afterTitleContentBuilder: @Composable ElementScope<HTMLLIElement>.(Int, T) -> Unit = { _, _ -> },
afterContentContentBuilder: @Composable ElementScope<HTMLLIElement>.(Int, T) -> Unit = { _, _ -> },
contentAttrsBuilder: AttrsScope<HTMLDivElement>.(Int, T) -> Unit = { _, _ -> },
contentContentBuilder: @Composable ElementScope<HTMLDivElement>.(Int, T) -> Unit
) = Accordion(
data,
attrs,
itemAttrsBuilder
) { i, t ->
beforeTitleContentBuilder(i, t)
A(
attrs = {
include(UIKitAccordion.Title)
titleAttrsBuilder(i, t)
}
) {
titleContentBuilder(i, t)
}
afterTitleContentBuilder(i, t)
Div(
{
include(UIKitAccordion.Content)
contentAttrsBuilder(i, t)
}
) {
contentContentBuilder(i, t)
}
afterContentContentBuilder(i, t)
}
@Composable
fun <T> DefaultAccordion(
data: Iterable<T>,
titleResolver: (Int, T) -> String,
attrs: Attrs<HTMLUListElement> = Attrs.empty(),
itemAttrsBuilder: AttrsScope<HTMLLIElement>.(Int, T) -> Unit = { _, _ -> },
titleAttrsBuilder: AttrsScope<HTMLAnchorElement>.(Int, T) -> Unit = { _, _ -> },
contentAttrsBuilder: AttrsScope<HTMLDivElement>.(Int, T) -> Unit = { _, _ -> },
contentContentBuilder: @Composable ElementScope<HTMLDivElement>.(Int, T) -> Unit
) = DefaultAccordion(
data,
attrs,
itemAttrsBuilder,
titleAttrsBuilder,
{ i, t ->
org.jetbrains.compose.web.dom.Text(titleResolver(i, t))
},
contentAttrsBuilder = contentAttrsBuilder,
contentContentBuilder = contentContentBuilder
)

View File

@@ -0,0 +1,49 @@
package dev.inmo.jsuikit.elements
import androidx.compose.runtime.Composable
import dev.inmo.jsuikit.buildAndAddAttribute
import dev.inmo.jsuikit.modifiers.*
import dev.inmo.jsuikit.utils.Attrs
import dev.inmo.jsuikit.utils.Milliseconds
import org.jetbrains.compose.web.dom.*
import org.w3c.dom.HTMLAnchorElement
import org.w3c.dom.HTMLDivElement
@Composable
fun Alert(
attrs: Attrs<HTMLDivElement> = Attrs.empty(),
animation: UIKitAnimation? = UIKitAnimation.Fade,
duration: Milliseconds? = null,
selClose: String? = null,
content: ContentBuilder<HTMLDivElement>
) = Div(
{
attrs.builder(this)
include(UIKitAlert)
buildAndAddAttribute("uk-alert") {
"animation" to animation ?.classes ?.firstOrNull()
"duration" to duration
"sel-close" to selClose
}
},
content
)
@Composable
fun AlertCloseButton(
attrs: Attrs<HTMLAnchorElement> = Attrs.empty(),
content: ContentBuilder<HTMLAnchorElement> = @Composable {}
) {
A(
null,
{
include(UIKitAlert.Close, UIKitIcon)
attr("uk-close", "")
classes("uk-close")
attrs.builder(this)
},
content
)
}

View File

@@ -0,0 +1,57 @@
package dev.inmo.jsuikit.elements
import androidx.compose.runtime.Composable
import dev.inmo.jsuikit.modifiers.UIKitArticle
import dev.inmo.jsuikit.modifiers.include
import dev.inmo.jsuikit.utils.Attrs
import dev.inmo.jsuikit.utils.optionallyDraw
import org.jetbrains.compose.web.dom.*
import org.jetbrains.compose.web.dom.Text
import org.w3c.dom.*
@Composable
fun UIKitArticleElement (
headerBuilder: ContentBuilder<HTMLHeadingElement>,
headerAttrs: Attrs<HTMLHeadingElement> = Attrs.empty(),
metaBuilder: ContentBuilder<HTMLParagraphElement>? = null,
metaAttrs: Attrs<HTMLParagraphElement>? = null,
otherContentBuilder: ContentBuilder<HTMLElement>
) = Article(
{
include(UIKitArticle)
}
) {
H1(
{
include(UIKitArticle.Title)
headerAttrs.builder(this)
},
headerBuilder
)
optionallyDraw(metaAttrs, metaBuilder) {
P(
{
include(UIKitArticle.Meta)
metaAttrs ?.builder ?.invoke(this)
},
metaBuilder ?: {}
)
}
otherContentBuilder()
}
@Composable
fun UIKitArticleElement (
header: String,
meta: String? = null,
otherContentBuilder: ContentBuilder<HTMLElement>
) = UIKitArticleElement(
{ Text(header) },
metaBuilder = meta ?.let {
{
Text(meta)
}
},
otherContentBuilder = otherContentBuilder
)

View File

@@ -0,0 +1,25 @@
package dev.inmo.jsuikit.elements
import androidx.compose.runtime.Composable
import dev.inmo.jsuikit.modifiers.UIKitBadge
import dev.inmo.jsuikit.modifiers.include
import org.jetbrains.compose.web.dom.AttrBuilderContext
import org.jetbrains.compose.web.dom.ContentBuilder
import org.jetbrains.compose.web.dom.Span
import org.jetbrains.compose.web.dom.Text
import org.w3c.dom.HTMLSpanElement
@Composable
fun Badge(
text: String,
onAfterText: ContentBuilder<HTMLSpanElement>? = null,
onBeforeText: ContentBuilder<HTMLSpanElement>? = null,
attrs: AttrBuilderContext<HTMLSpanElement>? = null
) = Span({
include(UIKitBadge)
attrs ?.invoke(this)
}) {
onAfterText ?.invoke(this)
Text(text)
onBeforeText ?.invoke(this)
}

View File

@@ -0,0 +1,50 @@
package dev.inmo.jsuikit.elements
import androidx.compose.runtime.Composable
import dev.inmo.jsuikit.modifiers.UIKitBreadcrumb
import dev.inmo.jsuikit.modifiers.include
import dev.inmo.jsuikit.utils.Attrs
import org.jetbrains.compose.web.dom.*
import org.w3c.dom.*
@Composable
fun <T> Breadcrumb(
data: Iterable<T>,
rootAttrs: Attrs<HTMLUListElement> = Attrs.empty(),
elementAttrs: Attrs<HTMLLIElement> = Attrs.empty(),
elementContent: @Composable ElementScope<HTMLLIElement>.(T) -> Unit = {},
) {
Ul(
{
include(UIKitBreadcrumb)
rootAttrs.builder(this)
}
) {
data.forEach {
Li({ elementAttrs.builder(this) }) {
elementContent(it)
}
}
}
}
@Composable
fun BreadcrumbActiveElement(
href: String? = "#",
elementAttrs: Attrs<HTMLAnchorElement> = Attrs.empty(),
elementContent: @Composable ElementScope<HTMLAnchorElement>.() -> Unit = {},
) {
A(href, { elementAttrs.builder(this) }) {
elementContent()
}
}
@Composable
fun BreadcrumbInactiveElement(
elementAttrs: Attrs<HTMLSpanElement> = Attrs.empty(),
elementContent: @Composable ElementScope<HTMLSpanElement>.() -> Unit = {},
) {
Span({ elementAttrs.builder(this) }) {
elementContent()
}
}

View File

@@ -7,24 +7,25 @@ import org.jetbrains.compose.web.attributes.InputType
import org.jetbrains.compose.web.attributes.disabled
import org.jetbrains.compose.web.dom.*
import org.w3c.dom.HTMLButtonElement
import org.w3c.dom.HTMLDivElement
import org.w3c.dom.events.Event
@Composable
fun DefaultButton(
vararg modifiers: UIKitModifier,
disabled: Boolean = false,
buttonType: UIKitButton.Type = UIKitButton.Type.Default,
onClick: ((SyntheticMouseEvent) -> Unit)? = null,
attributesCustomizer: AttrBuilderContext<HTMLButtonElement> = {},
contentAllocator: ContentBuilder<HTMLButtonElement>
) {
Button(
{
onClick ?.let { onClick(it) }
classes("uk-button")
include(*modifiers, buttonType)
include(UIKitButton, *modifiers)
if (disabled) {
disabled()
}
attributesCustomizer()
}
) {
contentAllocator()
@@ -36,11 +37,11 @@ fun DefaultButton(
text: String,
vararg modifiers: UIKitModifier,
disabled: Boolean = false,
buttonType: UIKitButton.Type = UIKitButton.Type.Default,
preTextContentAllocator: ContentBuilder<HTMLButtonElement>? = null,
afterTextContentAllocator: ContentBuilder<HTMLButtonElement>? = null,
attributesCustomizer: AttrBuilderContext<HTMLButtonElement> = {},
onClick: ((SyntheticMouseEvent) -> Unit)? = null
) = DefaultButton(*modifiers, disabled = disabled, buttonType = buttonType, onClick = onClick) {
) = DefaultButton(*modifiers, disabled = disabled, onClick = onClick, attributesCustomizer = attributesCustomizer) {
preTextContentAllocator ?.apply { preTextContentAllocator() }
Text(text)
afterTextContentAllocator ?.apply { afterTextContentAllocator() }
@@ -53,6 +54,7 @@ fun UploadButton(
containerModifiers: Array<UIKitModifier> = emptyArray(),
disabled: Boolean = false,
buttonType: UIKitButton.Type = UIKitButton.Type.Default,
attributesCustomizer: AttrBuilderContext<HTMLDivElement> = {},
onChange: (Event) -> Unit
) {
Div(
@@ -60,6 +62,7 @@ fun UploadButton(
classes("js-upload", "uk-form-custom")
attr("uk-form-custom", "")
include(*containerModifiers)
attributesCustomizer()
}
) {
Input(InputType.File) { onChange { onChange(it.nativeEvent) } }

View File

@@ -0,0 +1,80 @@
package dev.inmo.jsuikit.elements
import androidx.compose.runtime.Composable
import dev.inmo.jsuikit.modifiers.*
import dev.inmo.jsuikit.utils.Attrs
import org.jetbrains.compose.web.dom.*
import org.w3c.dom.HTMLDivElement
import org.w3c.dom.HTMLHeadingElement
@Composable
fun Card(
cardAttrs: Attrs<HTMLDivElement> = Attrs.empty(),
headerAttrs: Attrs<HTMLDivElement> = Attrs.empty(),
header: ContentBuilder<HTMLDivElement>? = null,
footerAttrs: Attrs<HTMLDivElement> = Attrs.empty(),
footer: ContentBuilder<HTMLDivElement>? = null,
bodyAttrs: Attrs<HTMLDivElement> = Attrs.empty(),
body: ContentBuilder<HTMLDivElement>
) {
Div(
{
include(UIKitCard)
cardAttrs.builder(this)
}
) {
header ?.let {
Div(
{
include(UIKitCard.Parts.Header)
headerAttrs.builder(this)
},
header
)
}
Div(
{
include(UIKitCard.Parts.Body)
bodyAttrs.builder(this)
},
body
)
footer ?.let {
Div(
{
include(UIKitCard.Parts.Footer)
footerAttrs.builder(this)
},
footer
)
}
}
}
@Composable
fun CardTitle(
titleAttrs: Attrs<HTMLHeadingElement> = Attrs.empty(),
title: ContentBuilder<HTMLHeadingElement>
) {
H3(
{
include(UIKitCard.Title)
titleAttrs.builder(this)
},
title
)
}
@Composable
fun CardBadge(
badgeAttrs: Attrs<HTMLDivElement> = Attrs.empty(),
badge: ContentBuilder<HTMLDivElement>
) {
Div(
{
include(UIKitCard.Badge, UIKitLabel)
badgeAttrs.builder(this)
},
badge
)
}

View File

@@ -0,0 +1,45 @@
package dev.inmo.jsuikit.elements
import androidx.compose.runtime.Composable
import androidx.compose.web.events.SyntheticMouseEvent
import dev.inmo.jsuikit.modifiers.UIKitClose
import dev.inmo.jsuikit.modifiers.include
import dev.inmo.jsuikit.utils.Attrs
import org.jetbrains.compose.web.attributes.ButtonType
import org.jetbrains.compose.web.attributes.type
import org.jetbrains.compose.web.dom.*
import org.w3c.dom.HTMLAnchorElement
import org.w3c.dom.HTMLButtonElement
object Close {
@Composable
fun drawAsLink(
href: String = "#",
attrs: Attrs<HTMLAnchorElement> = Attrs.empty(),
contentBuilder: ContentBuilder<HTMLAnchorElement> = {}
) = A(
href,
{
include(UIKitClose)
attrs.builder(this)
},
contentBuilder
)
@Composable
fun drawAsButton(
attrs: Attrs<HTMLButtonElement> = Attrs.empty(),
contentBuilder: ContentBuilder<HTMLButtonElement> = {},
onClick: ((SyntheticMouseEvent) -> Unit)? = null
) = Button(
{
type(ButtonType.Button)
include(UIKitClose)
attrs.builder(this)
onClick ?.let {
onClick(onClick)
}
},
contentBuilder
)
}

View File

@@ -0,0 +1,106 @@
package dev.inmo.jsuikit.elements
import androidx.compose.runtime.Composable
import dev.inmo.jsuikit.modifiers.*
import dev.inmo.jsuikit.utils.*
import org.jetbrains.compose.web.dom.*
import org.w3c.dom.*
@Composable
fun Comment(
rootAttrs: Attrs<HTMLElement> = Attrs.empty(),
headerAttrs: Attrs<HTMLElement>? = null,
headerContent: ContentBuilder<HTMLElement>? = null,
bodyAttrs: Attrs<HTMLDivElement>? = null,
bodyContent: ContentBuilder<HTMLDivElement>? = null,
) {
Article(
{
include(UIKitComment)
rootAttrs.builder(this)
}
) {
if (headerAttrs != null || headerContent != null) {
Header (
{
include(UIKitComment.Header)
headerAttrs ?.builder ?.invoke(this)
}
) {
headerContent ?.let { it(this) }
}
}
if (bodyAttrs != null || bodyContent != null) {
Div(
{
include(UIKitComment.Body)
bodyAttrs ?.builder ?.invoke(this)
}
) {
bodyContent ?.let { it(this) }
}
}
}
}
@Composable
fun DefaultComment(
rootAttrs: Attrs<HTMLElement> = Attrs.empty(),
headerGridAttrs: Attrs<HTMLDivElement>? = null,
headerAttrs: Attrs<HTMLElement>? = null,
additionalHeaderContent: ContentBuilder<HTMLElement>? = null,
avatarUrl: String? = null,
avatarAttrs: Attrs<HTMLImageElement>? = null,
titleAttrs: Attrs<HTMLHeadingElement>? = null,
titleContent: ContentBuilder<HTMLHeadingElement>? = null,
metaAttrs: Attrs<HTMLUListElement>? = null,
metaContent: ContentBuilder<HTMLUListElement>? = null,
bodyAttrs: Attrs<HTMLDivElement>? = null,
bodyContent: ContentBuilder<HTMLDivElement>? = null,
) {
Comment(
rootAttrs = rootAttrs,
headerAttrs = headerAttrs,
headerContent = {
if (arrayOf(headerGridAttrs, avatarUrl, avatarAttrs, titleAttrs, titleContent, metaAttrs, metaContent).anyNotNull()) {
Grid(
UIKitGrid.Gap.Medium, UIKitFlex.Alignment.Vertical.Middle,
attributesCustomizer = headerGridAttrs ?.builder ?: {}
) {
if (avatarUrl != null) {
Div({ include(UIKitWidth.Auto) }) {
Img(avatarUrl, attrs = avatarAttrs ?.builder)
}
}
if (arrayOf(titleAttrs, titleContent, metaAttrs, metaContent).anyNotNull()) {
Div({ include(UIKitWidth.Expand) }) {
optionallyDraw(titleAttrs, titleContent) {
H4(
{
include(UIKitComment.Title, UIKitMargin.Remove)
titleAttrs ?.builder ?.invoke(this)
}
) {
titleContent ?.invoke(this)
}
}
optionallyDraw(metaAttrs, metaContent) {
Ul (
{
include(UIKitComment.Meta, UIKitSubNav, UIKitSubNav.Divider, UIKitMargin.Remove.Top)
metaAttrs ?.builder ?.invoke(this)
}
) {
metaContent ?.invoke(this)
}
}
}
}
}
}
additionalHeaderContent ?.let { it(this) }
},
bodyAttrs = bodyAttrs,
bodyContent = bodyContent
)
}

View File

@@ -0,0 +1,21 @@
package dev.inmo.jsuikit.elements
import androidx.compose.runtime.Composable
import dev.inmo.jsuikit.modifiers.UIKitContainer
import dev.inmo.jsuikit.modifiers.include
import dev.inmo.jsuikit.utils.Attrs
import org.jetbrains.compose.web.dom.ContentBuilder
import org.jetbrains.compose.web.dom.Div
import org.w3c.dom.HTMLDivElement
@Composable
fun Container(
attrs: Attrs<HTMLDivElement> = Attrs.empty(),
contentBuilder: ContentBuilder<HTMLDivElement> = {}
) = Div(
{
include(UIKitContainer)
attrs.builder.invoke(this)
},
contentBuilder
)

View File

@@ -0,0 +1,56 @@
package dev.inmo.jsuikit.elements
import androidx.compose.runtime.Composable
import dev.inmo.jsuikit.modifiers.UIKitDescriptionList
import dev.inmo.jsuikit.modifiers.include
import dev.inmo.jsuikit.utils.*
import org.jetbrains.compose.web.dom.*
import org.w3c.dom.HTMLDListElement
import org.w3c.dom.HTMLElement
@Composable
fun DescriptionList(
attrs: Attrs<HTMLDListElement>,
contentBuilder: ContentBuilder<HTMLDListElement>
) {
DList(
{
include(UIKitDescriptionList)
attrs.builder(this)
},
contentBuilder
)
}
@Composable
fun <T> DescriptionList(
data: Iterable<T>,
attrs: Attrs<HTMLDListElement>,
beforeTermContent: (@Composable ElementScope<HTMLElement>.(Int, T) -> Unit)? = null,
itemTermAttrs: ((Int, T) -> Attrs<HTMLElement>?)? = null,
itemTermContent: (@Composable ElementScope<HTMLElement>.(Int, T) -> Unit)? = null,
betweenTermAndDescriptionContent: (@Composable ElementScope<HTMLElement>.(Int, T) -> Unit)? = null,
afterDescriptionContent: (@Composable ElementScope<HTMLElement>.(Int, T) -> Unit)? = null,
itemDescriptionAttrs: ((Int, T) -> Attrs<HTMLElement>?)? = null,
itemDescriptionContent: (@Composable ElementScope<HTMLElement>.(Int, T) -> Unit)? = null
) {
DescriptionList(attrs) {
data.forEachIndexed { i, t ->
beforeTermContent ?.invoke(this, i, t)
if (itemTermAttrs != null || itemTermContent != null) {
DTerm(
itemTermAttrs ?.let { { it(i, t) } },
itemTermContent ?.let { { it(i, t) } },
)
}
betweenTermAndDescriptionContent ?.invoke(this, i, t)
if (itemDescriptionAttrs != null || itemDescriptionContent != null) {
DDescription(
itemDescriptionAttrs ?.let { { it(i, t) } },
itemDescriptionContent ?.let { { it(i, t) } },
)
}
afterDescriptionContent ?.invoke(this, i, t)
}
}
}

View File

@@ -0,0 +1,172 @@
package dev.inmo.jsuikit.elements
import androidx.compose.runtime.Composable
import androidx.compose.runtime.DisposableEffect
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
import dev.inmo.jsuikit.modifiers.*
import org.jetbrains.compose.web.dom.*
import org.jetbrains.compose.web.renderComposableInBody
import org.w3c.dom.HTMLDivElement
import kotlin.random.Random
import kotlin.random.nextUInt
@Composable
fun Dialog(
vararg modifiers: UIKitModifier,
attributesCustomizer: AttrBuilderContext<HTMLDivElement> = {},
onHidden: ((HTMLDivElement) -> Unit)? = null,
onShown: ((HTMLDivElement) -> Unit)? = null,
dialogAttrsBuilder: AttrBuilderContext<HTMLDivElement>? = null,
headerAttrsBuilder: AttrBuilderContext<HTMLDivElement>? = null,
headerBuilder: ContentBuilder<HTMLDivElement>? = null,
afterHeaderBuilder: ContentBuilder<HTMLDivElement>? = null,
beforeFooterBuilder: ContentBuilder<HTMLDivElement>? = null,
footerAttrsBuilder: AttrBuilderContext<HTMLDivElement>? = null,
footerBuilder: ContentBuilder<HTMLDivElement>? = null,
bodyAttrsBuilder: AttrBuilderContext<HTMLDivElement>? = null,
autoShow: Boolean = true,
removeOnHide: Boolean = true,
bodyBuilder: ContentBuilder<HTMLDivElement> = {}
) {
val draw = remember { mutableStateOf(true) }
remember {
renderComposableInBody {
if (draw.value) {
Div(
{
if (modifiers.none { it is UIKitModal.WithCustomAttributes }) {
include(UIKitModal)
}
id("dialog${Random.nextUInt()}")
include(*modifiers)
attributesCustomizer()
}
) {
DisposableEffect(true) {
val htmlElement = scopeElement
if (autoShow) {
UIKit.modal(htmlElement).show()
}
if (onHidden != null || removeOnHide) {
htmlElement.addEventListener("hidden", {
if (it.target != htmlElement) return@addEventListener
onHidden ?.invoke(htmlElement)
if (removeOnHide) {
htmlElement.remove()
}
})
}
onShown ?.let {
htmlElement.addEventListener("shown", {
if (it.target != htmlElement) return@addEventListener
onShown(htmlElement)
})
}
onDispose {
draw.value = false
}
}
Div(
{
include(UIKitModal.Dialog)
dialogAttrsBuilder ?.let { it() } ?: include(UIKitMargin.Auto.Vertical)
}
) {
headerBuilder ?.let {
Div(
{
include(UIKitModal.Header)
headerAttrsBuilder ?.let { it() }
}
) {
it()
}
}
afterHeaderBuilder ?.let { it() }
Div(
{
include(UIKitModal.Body)
bodyAttrsBuilder ?.let { it() }
}
) {
bodyBuilder()
}
beforeFooterBuilder ?.let { it() }
footerBuilder ?.let {
Div(
{
include(UIKitModal.Footer)
footerAttrsBuilder ?.let { it() } ?: include(UIKitText.Alignment.Horizontal.Right)
}
) {
it()
}
}
}
}
}
}
}
Div({
hidden()
ref {
onDispose {
draw.value = false
}
}
})
}
@Composable
fun Dialog(
title: String,
vararg modifiers: UIKitModifier,
attributesCustomizer: AttrBuilderContext<HTMLDivElement> = {},
onHidden: ((HTMLDivElement) -> Unit)? = null,
onShown: ((HTMLDivElement) -> Unit)? = null,
dialogAttrsBuilder: AttrBuilderContext<HTMLDivElement>? = null,
headerAttrsBuilder: AttrBuilderContext<HTMLDivElement>? = null,
headerBuilder: ContentBuilder<HTMLDivElement>? = null,
afterHeaderBuilder: ContentBuilder<HTMLDivElement>? = null,
beforeFooterBuilder: ContentBuilder<HTMLDivElement>? = null,
footerAttrsBuilder: AttrBuilderContext<HTMLDivElement>? = null,
footerBuilder: ContentBuilder<HTMLDivElement>? = null,
bodyAttrsBuilder: AttrBuilderContext<HTMLDivElement>? = null,
autoShow: Boolean = true,
removeOnHide: Boolean = true,
bodyBuilder: ContentBuilder<HTMLDivElement> = {}
) = Dialog(
modifiers = modifiers,
attributesCustomizer = attributesCustomizer,
onHidden = onHidden,
onShown = onShown,
dialogAttrsBuilder = dialogAttrsBuilder,
headerAttrsBuilder = headerAttrsBuilder,
headerBuilder = {
H2({ include(UIKitModal.Title) }) {
Text(title)
}
headerBuilder ?.invoke(this)
},
afterHeaderBuilder = afterHeaderBuilder,
beforeFooterBuilder = beforeFooterBuilder,
footerAttrsBuilder = footerAttrsBuilder,
footerBuilder = footerBuilder,
bodyAttrsBuilder = bodyAttrsBuilder,
autoShow = autoShow,
removeOnHide = removeOnHide,
bodyBuilder = bodyBuilder
)

View File

@@ -0,0 +1,40 @@
package dev.inmo.jsuikit.elements
import androidx.compose.runtime.Composable
import dev.inmo.jsuikit.modifiers.*
import org.jetbrains.compose.web.dom.AttrBuilderContext
import org.jetbrains.compose.web.dom.Hr
import org.w3c.dom.HTMLHRElement
object Divider {
@Composable
fun Common(
vararg modifiers: UIKitModifier,
attributesCustomizer: AttrBuilderContext<HTMLHRElement> = {}
) = Hr {
include(*modifiers)
attributesCustomizer()
}
@Composable
fun Icon(
vararg modifiers: UIKitModifier,
attributesCustomizer: AttrBuilderContext<HTMLHRElement> = {}
) = Common(
*(modifiers + UIKitDivider.Icon), attributesCustomizer = attributesCustomizer
)
@Composable
fun Small(
vararg modifiers: UIKitModifier,
attributesCustomizer: AttrBuilderContext<HTMLHRElement> = {}
) = Common(
*(modifiers + UIKitDivider.Small), attributesCustomizer = attributesCustomizer
)
@Composable
fun Vertical(
vararg modifiers: UIKitModifier,
attributesCustomizer: AttrBuilderContext<HTMLHRElement> = {}
) = Common(
*(modifiers + UIKitDivider.Vertical), attributesCustomizer = attributesCustomizer
)
}

View File

@@ -0,0 +1,24 @@
package dev.inmo.jsuikit.elements
import androidx.compose.runtime.Composable
import dev.inmo.jsuikit.modifiers.UIKitDrop
import dev.inmo.jsuikit.modifiers.attrsBuilder
import dev.inmo.jsuikit.utils.*
import org.jetbrains.compose.web.dom.Div
import org.w3c.dom.HTMLButtonElement
import org.w3c.dom.HTMLDivElement
@Composable
fun Drop(
buttonBuilder: AttrsWithContentBuilder<HTMLButtonElement>,
dropBuilder: AttrsWithContentBuilder<HTMLDivElement>
) {
DefaultButton(
attributesCustomizer = buttonBuilder.attributesBuilderContext,
contentAllocator = buttonBuilder.builder
)
Div(
(Attrs<HTMLDivElement>(UIKitDrop.Custom()) + dropBuilder.attrs).builder,
dropBuilder.builder
)
}

View File

@@ -0,0 +1,25 @@
package dev.inmo.jsuikit.elements
import androidx.compose.runtime.Composable
import dev.inmo.jsuikit.modifiers.*
import dev.inmo.jsuikit.utils.Attrs
import dev.inmo.jsuikit.utils.InputAttrs
import org.jetbrains.compose.web.dom.*
import org.w3c.dom.HTMLDivElement
@Composable
fun DropArea(
attrs: Attrs<HTMLDivElement> = Attrs.empty(),
inputAttrs: InputAttrs<String> = InputAttrs.empty(),
contentBuilder: ContentBuilder<HTMLDivElement> = {}
) = Div(
{
include(UIKitPlaceholder, UIKitForm.Custom())
attrs.builder(this)
}
) {
FileInput {
inputAttrs.builder.invoke(this)
}
contentBuilder(this)
}

View File

@@ -0,0 +1,67 @@
package dev.inmo.jsuikit.elements
import androidx.compose.runtime.Composable
import dev.inmo.jsuikit.buildAndAddAttribute
import dev.inmo.jsuikit.modifiers.*
import dev.inmo.jsuikit.types.DropdownOptions
import dev.inmo.jsuikit.utils.Milliseconds
import org.jetbrains.compose.web.dom.*
import org.w3c.dom.HTMLDivElement
@Composable
fun Dropdown(
vararg modifiers: UIKitModifier,
dropdownOptions: DropdownOptions,
attributesCustomizer: AttrBuilderContext<HTMLDivElement> = {},
contentBuilder: ContentBuilder<HTMLDivElement>
) {
Div(
{
include(UIKitDropdown(dropdownOptions), *modifiers)
attributesCustomizer()
},
contentBuilder
)
}
@Composable
fun Dropdown(
vararg modifiers: UIKitModifier,
toggle: String? = null,
pos: UIKitDropdown.Position? = null,
mode: UIKitDropdown.Mode? = null,
delayShow: Milliseconds? = null,
delayHide: Milliseconds? = null,
boundary: String? = null,
boundaryAlign: Boolean? = null,
flip: UIKitDropdown.Flip? = null,
offset: Int? = null,
animation: UIKitAnimation? = null,
duration: Milliseconds? = null,
attributesCustomizer: AttrBuilderContext<HTMLDivElement> = {},
contentBuilder: ContentBuilder<HTMLDivElement>
) {
Div(
{
include(
UIKitDropdown(
DropdownOptions(
toggle = toggle,
pos = pos,
mode = mode,
delayShow = delayShow,
delayHide = delayHide,
boundary = boundary,
boundaryAlign = boundaryAlign,
flip = flip,
offset = offset,
animation = animation,
duration = duration
)
),
*modifiers
)
attributesCustomizer()
},
contentBuilder
)
}

View File

@@ -3,19 +3,20 @@ package dev.inmo.jsuikit.elements
import androidx.compose.runtime.Composable
import dev.inmo.jsuikit.modifiers.UIKitModifier
import dev.inmo.jsuikit.modifiers.include
import org.jetbrains.compose.web.dom.Div
import org.jetbrains.compose.web.dom.ElementScope
import org.jetbrains.compose.web.dom.*
import org.w3c.dom.HTMLDivElement
@Composable
fun Flex(
vararg modifiers: UIKitModifier,
attributesCustomizer: AttrBuilderContext<HTMLDivElement> = {},
filler: @Composable ElementScope<HTMLDivElement>.() -> Unit
) {
Div(
{
classes("uk-flex")
include(*modifiers)
attributesCustomizer()
}
) {
filler()

View File

@@ -0,0 +1,46 @@
package dev.inmo.jsuikit.elements
import androidx.compose.runtime.Composable
import dev.inmo.jsuikit.modifiers.*
import dev.inmo.jsuikit.utils.buildAttribute
import org.jetbrains.compose.web.dom.*
import org.w3c.dom.HTMLDivElement
@Composable
fun GridColumn(
vararg modifiers: UIKitModifier,
attributesCustomizer: AttrBuilderContext<HTMLDivElement> = {},
builder: @Composable ElementScope<HTMLDivElement>.() -> Unit = {}
) {
Div(
{
include(*modifiers)
attributesCustomizer()
}
) {
builder()
}
}
@Composable
fun Grid(
vararg modifiers: UIKitModifier,
masonry: Boolean = false,
parallax: UInt? = null,
marginClass: UIKitMargin? = null,
firstColumnClass: String? = null,
attributesCustomizer: AttrBuilderContext<HTMLDivElement> = {},
builder: ContentBuilder<HTMLDivElement> = {}
) {
Div(
{
include(
UIKitGrid.invoke(marginClass, firstColumnClass, masonry, parallax),
*modifiers
)
attributesCustomizer()
}
) {
builder()
}
}

View File

@@ -2,8 +2,8 @@ package dev.inmo.jsuikit.elements
import androidx.compose.runtime.Composable
import dev.inmo.jsuikit.modifiers.*
import org.jetbrains.compose.web.dom.Button
import org.jetbrains.compose.web.dom.Span
import org.jetbrains.compose.web.dom.*
import org.w3c.dom.*
import org.w3c.dom.events.Event
sealed class Icon(val name: String) {
@@ -77,15 +77,15 @@ sealed class Icon(val name: String) {
object Grid : App("grid")
sealed class More(iconName: String) : App("more${iconName.takeIf { it.isNotEmpty() } ?.let { "-$it" } ?: "" }") {
object Vertical : More("vertical")
companion object : More("more")
companion object : More("")
}
sealed class Plus(iconName: String) : App("plus${iconName.takeIf { it.isNotEmpty() } ?.let { "-$it" } ?: "" }") {
object Circle : Plus("circle")
companion object : Plus("plus")
companion object : Plus("")
}
sealed class Minus(iconName: String) : App("minus${iconName.takeIf { it.isNotEmpty() } ?.let { "-$it" } ?: "" }") {
object Circle : Minus("circle")
companion object : Minus("minus")
companion object : Minus("")
}
object Close : App("close")
object Check : App("check")
@@ -93,7 +93,7 @@ sealed class Icon(val name: String) {
object Refresh : App("refresh")
sealed class Play(iconName: String) : App("play${iconName.takeIf { it.isNotEmpty() } ?.let { "-$it" } ?: "" }") {
object Circle : Play("circle")
companion object : Play("play")
companion object : Play("")
}
}
sealed class Devices(iconName: String) : Icon(iconName) {
@@ -102,11 +102,11 @@ sealed class Icon(val name: String) {
object Laptop : Devices("laptop")
sealed class Tablet(iconName: String) : Devices("tablet${iconName.takeIf { it.isNotEmpty() } ?.let { "-$it" } ?: "" }") {
object Landscape : Tablet("landscape")
companion object : Tablet("tablet")
companion object : Tablet("")
}
sealed class Phone(iconName: String) : Devices("phone${iconName.takeIf { it.isNotEmpty() } ?.let { "-$it" } ?: "" }") {
object Landscape : Phone("landscape")
companion object : Phone("phone")
companion object : Phone("")
}
}
sealed class Storage(iconName: String) : Icon(iconName) {
@@ -114,7 +114,7 @@ sealed class Icon(val name: String) {
object Text : File("text")
object Pdf : File("pdf")
object Edit : File("edit")
companion object : File("file")
companion object : File("")
}
object Copy : Storage("copy")
object Folder : Storage("folder")
@@ -177,7 +177,7 @@ sealed class Icon(val name: String) {
object Foursquare : Brands("foursquare")
sealed class Github(iconName: String) : Brands("github${iconName.takeIf { it.isNotEmpty() } ?.let { "-$it" } ?: "" }") {
object Alt : Github("alt")
companion object : Github("github")
companion object : Github("")
}
object Gitter : Brands("gitter")
object Google : Brands("google")
@@ -202,49 +202,62 @@ sealed class Icon(val name: String) {
object Youtube : Brands("youtube")
}
@Composable
operator fun invoke(
vararg modifier: UIKitModifier,
type: UIKitIconType = UIKitIconType.Default,
ratio: Float? = null,
onClick: ((Event) -> Unit)? = null
) {
if (type == UIKitIconType.Button) {
Button(
{
classes("uk-icon")
include(*modifier, type)
attr("uk-icon", "icon: $name${if (ratio != null) { "; ratio: $ratio" } else ""}")
onClick ?.let { _ ->
onClick { onClick(it.nativeEvent) }
}
}
)
} else {
Span(
{
classes("uk-icon")
include(*modifier, type)
attr("uk-icon", "icon: $name${if (ratio != null) { "; ratio: $ratio" } else ""}")
onClick ?.let { _ ->
onClick { onClick(it.nativeEvent) }
}
}
)
}
class Custom(name: String) : Icon(name)
companion object {
}
@Composable
fun drawAsButton(
vararg modifier: UIKitModifier,
ratio: Float? = null,
onClick: ((Event) -> Unit)? = null
) = invoke(*modifier, type = UIKitIconType.Button, ratio = ratio, onClick = onClick)
@Composable
fun drawAsIcon(
vararg modifier: UIKitModifier,
ratio: Float? = null,
onClick: ((Event) -> Unit)? = null
) = invoke(*modifier, type = UIKitIconType.Default, ratio = ratio, onClick = onClick)
}
@Composable
operator fun Icon.invoke(
vararg modifiers: UIKitModifier,
type: UIKitIconType = UIKitIconType.Default,
ratio: Float? = null,
attributesCustomizer: AttrBuilderContext<out HTMLElement> = {},
onClick: ((Event) -> Unit)? = null
) {
val configurer: AttrBuilderContext<out HTMLElement> = {
include(*modifiers, type, UIKitIcon)
attr("uk-icon", "icon: $name${if (ratio != null) { "; ratio: $ratio" } else ""}")
onClick ?.let { _ ->
onClick { onClick(it.nativeEvent) }
}
attributesCustomizer()
}
when (type) {
UIKitIconType.Default -> Span(configurer)
UIKitIconType.Link -> A(href = "#", configurer)
UIKitIconType.Button -> Button(configurer)
}
}
@Composable
fun Icon.drawAsButton(
vararg modifiers: UIKitModifier,
ratio: Float? = null,
attributesCustomizer: AttrBuilderContext<out HTMLElement> = {},
onClick: ((Event) -> Unit)? = null
) = invoke(*modifiers, type = UIKitIconType.Button, ratio = ratio, onClick = onClick, attributesCustomizer = attributesCustomizer)
@Composable
fun Icon.drawAsIcon(
vararg modifiers: UIKitModifier,
ratio: Float? = null,
attributesCustomizer: AttrBuilderContext<out HTMLElement> = {},
onClick: ((Event) -> Unit)? = null
) = invoke(*modifiers, type = UIKitIconType.Default, ratio = ratio, onClick = onClick, attributesCustomizer = attributesCustomizer)
@Composable
fun Icon.drawAsLink(
vararg modifiers: UIKitModifier,
ratio: Float? = null,
attributesCustomizer: AttrBuilderContext<out HTMLElement> = {},
onClick: ((Event) -> Unit)? = null
) = invoke(*modifiers, type = UIKitIconType.Link, ratio = ratio, onClick = onClick, attributesCustomizer = attributesCustomizer)
@Composable
fun Icon.drawAsFormInputPart(
vararg modifiers: UIKitModifier,
ratio: Float? = null,
attributesCustomizer: AttrBuilderContext<out HTMLElement> = {},
onClick: ((Event) -> Unit)? = null
) = invoke(*modifiers, UIKitForm.Icon, ratio = ratio, onClick = onClick, attributesCustomizer = attributesCustomizer)

View File

@@ -0,0 +1,41 @@
package dev.inmo.jsuikit.elements
import androidx.compose.runtime.Composable
import dev.inmo.jsuikit.modifiers.UIKitIconnav
import dev.inmo.jsuikit.modifiers.include
import dev.inmo.jsuikit.utils.Attrs
import org.jetbrains.compose.web.attributes.AttrsScope
import org.jetbrains.compose.web.dom.*
import org.w3c.dom.HTMLLIElement
import org.w3c.dom.HTMLUListElement
@Composable
fun <T> IconNav(
data: Iterable<T>,
listAttrs: Attrs<HTMLUListElement> = Attrs.empty(),
elementAttrsBuilder: AttrsScope<HTMLLIElement>.(T) -> Unit = {},
elementBuilder: @Composable ElementScope<HTMLLIElement>.(T) -> Unit
) {
Ul(
{
include(UIKitIconnav)
listAttrs.builder(this)
}
) {
data.forEach {
Li(
{
elementAttrsBuilder.invoke(this, it)
}
) { elementBuilder(this, it) }
}
}
}
@Composable
fun <T> Iconnav(
data: Iterable<T>,
listAttrs: Attrs<HTMLUListElement> = Attrs.empty(),
elementAttrsBuilder: AttrsScope<HTMLLIElement>.(T) -> Unit = {},
elementBuilder: @Composable ElementScope<HTMLLIElement>.(T) -> Unit
) = IconNav(data, listAttrs, elementAttrsBuilder, elementBuilder)

View File

@@ -0,0 +1,18 @@
package dev.inmo.jsuikit.elements
import androidx.compose.runtime.Composable
import dev.inmo.jsuikit.modifiers.UIKitUtility
import dev.inmo.jsuikit.modifiers.include
import org.jetbrains.compose.web.dom.AttrBuilderContext
import org.jetbrains.compose.web.dom.ContentBuilder
import org.jetbrains.compose.web.dom.Div
import org.w3c.dom.HTMLDivElement
@Composable
fun Inline(
attrBuilderContext: AttrBuilderContext<HTMLDivElement>? = null,
contentBuilder: ContentBuilder<HTMLDivElement>
) = Div({
include(UIKitUtility.Inline)
attrBuilderContext ?.invoke(this)
}, contentBuilder)

View File

@@ -0,0 +1,22 @@
package dev.inmo.jsuikit.elements
import androidx.compose.runtime.Composable
import dev.inmo.jsuikit.modifiers.UIKitLabel
import dev.inmo.jsuikit.modifiers.include
import dev.inmo.jsuikit.utils.Attrs
import org.jetbrains.compose.web.dom.Span
import org.jetbrains.compose.web.dom.Text
import org.w3c.dom.HTMLSpanElement
@Composable
fun Label(
text: String,
attrs: Attrs<HTMLSpanElement>
) = Span(
{
include(UIKitLabel)
attrs.builder(this)
}
) {
Text(text)
}

View File

@@ -0,0 +1,45 @@
package dev.inmo.jsuikit.elements
import androidx.compose.runtime.Composable
import androidx.compose.runtime.snapshots.SnapshotStateList
import dev.inmo.jsuikit.modifiers.*
import dev.inmo.jsuikit.utils.Attrs
import org.jetbrains.compose.web.dom.*
import org.w3c.dom.HTMLHeadingElement
import org.w3c.dom.HTMLUListElement
@Composable
fun <T> List(
data: Iterable<T>,
ukAttrs: Attrs<HTMLUListElement> = Attrs.empty(),
elementAllocator: @Composable ElementScope<HTMLUListElement>.(T) -> Unit
) {
Ul(
{
include(UIKitList)
ukAttrs.builder(this)
}
) {
data.forEach {
elementAllocator(it)
}
}
}
@Composable
fun <T> ListWithTitle(
title: String,
data: Iterable<T>,
vararg titleModifiers: UIKitModifier,
ulModifiers: Array<UIKitModifier> = emptyArray(),
besidesTitleAndList: (@Composable () -> Unit)? = null,
titleCustomizer: AttrBuilderContext<HTMLHeadingElement> = {},
ulCustomizer: AttrBuilderContext<HTMLUListElement> = {},
elementAllocator: @Composable ElementScope<HTMLUListElement>.(T) -> Unit
) {
H4({ include(*titleModifiers); titleCustomizer() }) {
Text(title)
}
besidesTitleAndList ?.invoke()
List(data, Attrs(*ulModifiers) { ulCustomizer(this) }, elementAllocator)
}

View File

@@ -0,0 +1,289 @@
package dev.inmo.jsuikit.elements
import androidx.compose.runtime.Composable
import dev.inmo.jsuikit.buildAndAddAttribute
import dev.inmo.jsuikit.modifiers.*
import dev.inmo.jsuikit.utils.Milliseconds
import org.jetbrains.compose.web.dom.*
import org.jetbrains.compose.web.dom.Text
import org.w3c.dom.*
@Composable
fun Nav(
vararg modifiers: UIKitModifier,
multiple: Boolean? = null,
collapsible: Boolean? = null,
animation: UIKitAnimation? = null,
duration: Milliseconds? = null,
attributesCustomizer: AttrBuilderContext<HTMLUListElement> = {},
dataAllocator: ContentBuilder<HTMLUListElement>
) {
Ul(
{
buildAndAddAttribute("uk-nav") {
"multiple" to multiple ?.toString()
"collapsible" to collapsible ?.toString()
"animation" to animation
"duration" to duration ?.toString()
}
include(*modifiers, UIKitNav)
attributesCustomizer()
}
) {
dataAllocator()
}
}
@Composable
fun DefaultNav(
vararg modifiers: UIKitModifier,
multiple: Boolean? = null,
collapsible: Boolean? = null,
animation: UIKitAnimation? = null,
duration: Milliseconds? = null,
attributesCustomizer: AttrBuilderContext<HTMLUListElement> = {},
dataAllocator: ContentBuilder<HTMLUListElement>
) = Nav(
modifiers = modifiers + UIKitNav.Default,
multiple,
collapsible,
animation,
duration,
attributesCustomizer,
dataAllocator
)
@Composable
fun PrimaryNav(
vararg modifiers: UIKitModifier,
multiple: Boolean? = null,
collapsible: Boolean? = null,
animation: UIKitAnimation? = null,
duration: Milliseconds? = null,
attributesCustomizer: AttrBuilderContext<HTMLUListElement> = {},
dataAllocator: ContentBuilder<HTMLUListElement>
) = Nav(
modifiers = modifiers + UIKitNav.Primary,
multiple,
collapsible,
animation,
duration,
attributesCustomizer,
dataAllocator
)
@Composable
fun SubNav(
vararg modifiers: UIKitModifier,
multiple: Boolean? = null,
collapsible: Boolean? = null,
animation: UIKitAnimation? = null,
duration: Milliseconds? = null,
attributesCustomizer: AttrBuilderContext<HTMLUListElement> = {},
dataAllocator: ContentBuilder<HTMLUListElement>
) = Nav(
modifiers = modifiers + UIKitNav.SubNav,
multiple,
collapsible,
animation,
duration,
attributesCustomizer,
dataAllocator
)
@Composable
fun <T> Nav(
title: String?,
data: Iterable<T>,
vararg ulModifiers: UIKitModifier,
titleModifiers: Array<UIKitModifier> = emptyArray(),
multiple: Boolean? = null,
collapsible: Boolean? = null,
animation: UIKitAnimation? = null,
duration: Milliseconds? = null,
besidesTitleAndList: ContentBuilder<HTMLUListElement>? = null,
titleCustomizer: AttrBuilderContext<HTMLLIElement> = {},
afterTitleContentBuilder: ContentBuilder<HTMLLIElement> = {},
ulCustomizer: AttrBuilderContext<HTMLUListElement> = {},
elementAllocator: @Composable ElementScope<HTMLUListElement>.(T) -> Unit
) {
Ul(
{
buildAndAddAttribute("uk-nav") {
"multiple" to multiple ?.toString()
"collapsible" to collapsible ?.toString()
"animation" to animation
"duration" to duration ?.toString()
}
include(*ulModifiers, UIKitNav)
ulCustomizer()
}
) {
title ?.let {
NavHeader(
title,
*titleModifiers,
attributesCustomizer = titleCustomizer,
afterTitleContentBuilder = afterTitleContentBuilder
)
}
besidesTitleAndList ?.let { it() }
data.forEach {
elementAllocator(it)
}
}
}
@Composable
fun <T> DefaultNav(
title: String?,
data: Iterable<T>,
vararg ulModifiers: UIKitModifier,
titleModifiers: Array<UIKitModifier> = emptyArray(),
multiple: Boolean? = null,
collapsible: Boolean? = null,
animation: UIKitAnimation? = null,
duration: Milliseconds? = null,
besidesTitleAndList: ContentBuilder<HTMLUListElement>? = null,
titleCustomizer: AttrBuilderContext<HTMLLIElement> = {},
afterTitleContentBuilder: ContentBuilder<HTMLLIElement> = {},
ulCustomizer: AttrBuilderContext<HTMLUListElement> = {},
elementAllocator: @Composable ElementScope<HTMLUListElement>.(T) -> Unit
) = Nav(
title,
data,
ulModifiers = ulModifiers + UIKitNav.Default,
titleModifiers,
multiple,
collapsible,
animation,
duration,
besidesTitleAndList,
titleCustomizer,
afterTitleContentBuilder,
ulCustomizer,
elementAllocator
)
@Composable
fun <T> PrimaryNav(
title: String?,
data: Iterable<T>,
vararg ulModifiers: UIKitModifier,
titleModifiers: Array<UIKitModifier> = emptyArray(),
multiple: Boolean? = null,
collapsible: Boolean? = null,
animation: UIKitAnimation? = null,
duration: Milliseconds? = null,
besidesTitleAndList: ContentBuilder<HTMLUListElement>? = null,
titleCustomizer: AttrBuilderContext<HTMLLIElement> = {},
afterTitleContentBuilder: ContentBuilder<HTMLLIElement> = {},
ulCustomizer: AttrBuilderContext<HTMLUListElement> = {},
elementAllocator: @Composable ElementScope<HTMLUListElement>.(T) -> Unit
) = Nav(
title,
data,
ulModifiers = ulModifiers + UIKitNav.Primary,
titleModifiers,
multiple,
collapsible,
animation,
duration,
besidesTitleAndList,
titleCustomizer,
afterTitleContentBuilder,
ulCustomizer,
elementAllocator
)
@Composable
fun <T> SubNav(
title: String?,
data: Iterable<T>,
vararg ulModifiers: UIKitModifier,
titleModifiers: Array<UIKitModifier> = emptyArray(),
multiple: Boolean? = null,
collapsible: Boolean? = null,
animation: UIKitAnimation? = null,
duration: Milliseconds? = null,
besidesTitleAndList: ContentBuilder<HTMLUListElement>? = null,
titleCustomizer: AttrBuilderContext<HTMLLIElement> = {},
afterTitleContentBuilder: ContentBuilder<HTMLLIElement> = {},
ulCustomizer: AttrBuilderContext<HTMLUListElement> = {},
elementAllocator: @Composable ElementScope<HTMLUListElement>.(T) -> Unit
) = Nav(
title,
data,
ulModifiers = ulModifiers + UIKitNav.SubNav,
titleModifiers,
multiple,
collapsible,
animation,
duration,
besidesTitleAndList,
titleCustomizer,
afterTitleContentBuilder,
ulCustomizer,
elementAllocator
)
@Composable
fun NavHeader(
text: String,
vararg modifiers: UIKitModifier,
attributesCustomizer: AttrBuilderContext<HTMLLIElement> = {},
afterTitleContentBuilder: ContentBuilder<HTMLLIElement> = {}
) {
Li(
{
include(*modifiers, UIKitNav.Header)
attributesCustomizer()
}
) {
Text(text)
afterTitleContentBuilder()
}
}
@Composable
fun NavItemElement(
vararg modifiers: UIKitModifier,
attributesCustomizer: AttrBuilderContext<HTMLLIElement> = {},
anchorAttributesCustomizer: AttrBuilderContext<HTMLAnchorElement> = {},
contentAllocator: ContentBuilder<HTMLAnchorElement>
) {
Li(
{
include(*modifiers)
attributesCustomizer()
}
) {
A("#", attrs = anchorAttributesCustomizer) {
contentAllocator()
}
}
}
@Composable
fun NavElement(
vararg modifiers: UIKitModifier,
attributesCustomizer: AttrBuilderContext<HTMLLIElement> = {},
contentAllocator: ContentBuilder<HTMLLIElement>
) {
Li(
{
include(*modifiers)
attributesCustomizer()
}
) {
contentAllocator()
}
}
@Composable
fun NavDivider(
vararg modifiers: UIKitModifier,
attributesCustomizer: AttrBuilderContext<HTMLLIElement> = {},
) {
Li({ include(UIKitNav.Divider, *modifiers);attributesCustomizer() })
}

View File

@@ -0,0 +1,49 @@
package dev.inmo.jsuikit.elements
import androidx.compose.runtime.Composable
import dev.inmo.jsuikit.modifiers.*
import dev.inmo.jsuikit.utils.*
import org.jetbrains.compose.web.dom.*
import org.w3c.dom.HTMLDivElement
import org.w3c.dom.HTMLElement
@Composable
fun Navbar(
attributesCustomizer: AttrBuilderContext<HTMLElement> = {},
contentBuilder: ContentBuilder<HTMLElement>
) {
Nav(
{
include(UIKitNavbar, UIKitNavbar(), UIKitNavbar.Container)
attributesCustomizer()
}
) {
contentBuilder()
}
}
@Composable
fun Navbar(
leftBuilder: AttrsWithContentBuilder<HTMLDivElement>? = null,
centerBuilder: AttrsWithContentBuilder<HTMLDivElement>? = null,
rightBuilder: AttrsWithContentBuilder<HTMLDivElement>? = null,
vararg navModifiers: UIKitModifier,
attributesCustomizer: AttrBuilderContext<HTMLElement> = {},
) {
Navbar(
attributesCustomizer = {
include(*navModifiers)
attributesCustomizer()
}
) {
leftBuilder ?.let {
Div({ include(UIKitNavbar.Alignment.Left);leftBuilder.attributesBuilderContext(this) }, leftBuilder.builder)
}
centerBuilder ?.let {
Div({ include(UIKitNavbar.Alignment.Center);centerBuilder.attributesBuilderContext(this) }, centerBuilder.builder)
}
rightBuilder ?.let {
Div({ include(UIKitNavbar.Alignment.Right);rightBuilder.attributesBuilderContext(this) }, rightBuilder.builder)
}
}
}

View File

@@ -0,0 +1,45 @@
package dev.inmo.jsuikit.elements
import androidx.compose.runtime.Composable
import dev.inmo.jsuikit.modifiers.*
import dev.inmo.jsuikit.utils.*
import org.jetbrains.compose.web.attributes.AttrsScope
import org.jetbrains.compose.web.dom.*
import org.w3c.dom.*
@Composable
fun NavbarNav(
elements: List<AttrsWithContentBuilder<HTMLLIElement>>,
attrs: Attrs<HTMLUListElement> = Attrs.empty()
) {
Ul(
{
include(UIKitNavbar.Nav)
attrs.builder(this)
}
) {
elements.forEach { element ->
Li(element.attributesBuilderContext, element.builder)
}
}
}
@Composable
fun NavbarNav(
vararg elements: AttrsWithContentBuilder<HTMLLIElement>,
attrs: Attrs<HTMLUListElement> = Attrs.empty()
) = NavbarNav(elements.toList(), attrs)
fun NavbarNavBuilder(
elements: List<AttrsWithContentBuilder<HTMLLIElement>>,
attrs: Attrs<HTMLUListElement> = Attrs.empty(),
containerAttrs: Attrs<HTMLDivElement> = Attrs.empty()
) = AttrsWithContentBuilder<HTMLDivElement>(containerAttrs) {
NavbarNav(elements, attrs)
}
fun NavbarNavBuilder(
vararg elements: AttrsWithContentBuilder<HTMLLIElement>,
attrs: Attrs<HTMLUListElement> = Attrs.empty(),
containerAttrs: Attrs<HTMLDivElement> = Attrs.empty()
) = NavbarNavBuilder(elements.toList(), attrs, containerAttrs)

View File

@@ -0,0 +1,13 @@
package dev.inmo.jsuikit.elements
import dev.inmo.jsuikit.modifiers.UIKit
import dev.inmo.jsuikit.types.*
import dev.inmo.jsuikit.utils.Milliseconds
fun Notification(
message: String,
status: UIKitNotificationParameter.Style? = null,
timeout: Milliseconds? = null,
group: NotificationsGroup? = null,
position: UIKitNotificationParameter.Position? = null
) = UIKit.notification.invoke(message, status, timeout, group, position)

View File

@@ -3,13 +3,16 @@ package dev.inmo.jsuikit.elements
import androidx.compose.runtime.Composable
import dev.inmo.jsuikit.modifiers.UIKitModifier
import dev.inmo.jsuikit.modifiers.include
import org.jetbrains.compose.web.dom.AttrBuilderContext
import org.jetbrains.compose.web.dom.Progress
import org.w3c.dom.HTMLProgressElement
@Composable
fun Progress(
value: Int,
vararg modifiers: UIKitModifier,
max: Int = 100
max: Int = 100,
attributesCustomizer: AttrBuilderContext<HTMLProgressElement> = {}
) {
Progress(
{
@@ -17,6 +20,7 @@ fun Progress(
include(*modifiers)
attr("max", max.toString())
attr("value", value.toString())
attributesCustomizer()
}
)
}

View File

@@ -2,21 +2,25 @@ package dev.inmo.jsuikit.elements
import androidx.compose.runtime.Composable
import dev.inmo.jsuikit.modifiers.*
import org.jetbrains.compose.web.dom.AttrBuilderContext
import org.jetbrains.compose.web.dom.Div
import org.w3c.dom.HTMLDivElement
@Composable
fun Spinner(
vararg modifier: UIKitModifier,
ratio: Float? = null
vararg modifiers: UIKitModifier,
ratio: Float? = null,
attributesCustomizer: AttrBuilderContext<HTMLDivElement> = {}
) {
Div(
{
attr("uk-spinner", ratio ?.let { "ratio: $it" } ?: "")
classes("uk-icon", "uk-spinner")
include(*modifier)
include(*modifiers)
attributesCustomizer()
}
)
}
@Composable
fun DefaultSpinner() = Spinner(UIKitAlign.Center, UIKitMargin.Small, UIKitText.Alignment.Center)
fun DefaultSpinner() = Spinner(UIKitAlign.Center, UIKitMargin.Small, UIKitText.Alignment.Horizontal.Center, UIKitText.Alignment.Vertical.Middle)

View File

@@ -0,0 +1,75 @@
package dev.inmo.jsuikit.elements
import androidx.compose.runtime.*
import dev.inmo.jsuikit.modifiers.UIKitModifier
import dev.inmo.jsuikit.modifiers.include
import org.jetbrains.compose.web.attributes.*
import org.jetbrains.compose.web.dom.AttrBuilderContext
import org.jetbrains.compose.web.dom.Input
import org.w3c.dom.HTMLInputElement
@Composable
fun <T> StandardInput(
type: InputType<T>,
value: T? = null,
vararg modifiers: UIKitModifier,
disabled: Boolean = false,
placeholder: String? = null,
attributesCustomizer: AttrBuilderContext<HTMLInputElement> = {},
onChange: HTMLInputElement.(T) -> Unit
) {
Input(type) {
classes("uk-input")
include(*modifiers)
placeholder ?.let(::placeholder)
value ?.let {
when (it) {
is String -> value(it)
is Number -> value(it)
else -> {}
}
}
onInput { event -> event.target.onChange(event.value) }
if (disabled) {
disabled()
}
attributesCustomizer()
}
}
@Deprecated("Renamed", ReplaceWith("StandardInput(type, value, *modifiers, disabled, placeholder, attributesCustomizer, onChange)"))
@Composable
fun <T> DefaultInput(
type: InputType<T>,
value: T,
disabled: Boolean = false,
placeholder: String? = null,
vararg modifiers: UIKitModifier,
attributesCustomizer: AttrBuilderContext<HTMLInputElement> = {},
onChange: (T) -> Unit
) = StandardInput(type, value, modifiers = modifiers, disabled, placeholder, attributesCustomizer) {
onChange(it)
}
@Composable
fun <T> StandardInput(
type: InputType<T>,
state: MutableState<T>,
disabledState: State<Boolean>? = null,
placeholder: String? = null,
vararg modifiers: UIKitModifier,
attributesCustomizer: AttrBuilderContext<HTMLInputElement> = {},
) = StandardInput(
type,
state.value,
modifiers = modifiers,
disabledState ?.value == true,
placeholder,
attributesCustomizer = attributesCustomizer
) {
state.value = it
}

View File

@@ -0,0 +1,104 @@
package dev.inmo.jsuikit.elements
import androidx.compose.runtime.Composable
import dev.inmo.jsuikit.modifiers.UIKitModifier
import dev.inmo.jsuikit.modifiers.include
import org.jetbrains.compose.web.attributes.AttrsScope
import org.jetbrains.compose.web.dom.*
import org.jetbrains.compose.web.dom.Text
import org.w3c.dom.*
@Composable
fun <T> DefaultTable(
headerBuilders: List<ContentBuilder<HTMLTableCellElement>>,
dataList: Iterable<T>,
vararg tableModifiers: UIKitModifier,
attributesCustomizer: AttrBuilderContext<HTMLTableElement> = {},
headerCustomizer: AttrBuilderContext<HTMLTableSectionElement> = {},
headerCellCustomizer: AttrsScope<HTMLTableCellElement>.(i: Int) -> Unit = {},
rowAttributes: AttrsScope<HTMLTableRowElement>.(t: T) -> Unit = {},
cellCustomizer: AttrsScope<HTMLTableCellElement>.(i: Int, t: T) -> Unit = { _, _ -> },
betweenHeaderAndBodyFiller: ContentBuilder<HTMLTableElement> = {},
cellFiller: @Composable ElementScope<HTMLTableCellElement>.(i: Int, t: T) -> Unit
) {
val headingIndexes = headerBuilders.indices
Table(
{
classes("uk-table")
include(*tableModifiers)
attributesCustomizer()
}
) {
Thead(headerCustomizer) {
Tr {
headerBuilders.forEachIndexed { i, t ->
Th(
{
headerCellCustomizer(i)
}
) {
t()
}
}
}
}
betweenHeaderAndBodyFiller()
Tbody {
dataList.forEach {
Tr(
{
rowAttributes(it)
}
) {
headingIndexes.forEach { i ->
Td(
{
cellCustomizer(i, it)
}
) {
cellFiller(i, it)
}
}
}
}
}
}
}
@Composable
fun <T> DefaultTable(
heading: List<String>,
dataList: Iterable<T>,
vararg tableModifiers: UIKitModifier,
attributesCustomizer: AttrBuilderContext<HTMLTableElement> = {},
headerCustomizer: AttrBuilderContext<HTMLTableSectionElement> = {},
headerCellCustomizer: AttrsScope<HTMLTableCellElement>.(i: Int, title: String) -> Unit = { _, _ -> },
rowAttributes: AttrsScope<HTMLTableRowElement>.(t: T) -> Unit = {},
cellCustomizer: AttrsScope<HTMLTableCellElement>.(i: Int, t: T) -> Unit = { _, _ -> },
betweenHeaderAndBodyFiller: ContentBuilder<HTMLTableElement> = {},
cellFiller: @Composable ElementScope<HTMLTableCellElement>.(i: Int, t: T) -> Unit
) {
val headersByIndex = heading.mapIndexed { index, s -> index to s }.toMap()
val headerCellCustomizer: AttrsScope<HTMLTableCellElement>.(i: Int) -> Unit = { i ->
val header = headersByIndex[i]
if (header != null) {
headerCellCustomizer(i, header)
}
}
inline fun headerFactory(header: String): ContentBuilder<HTMLTableCellElement> = {
Text(header)
}
val headerBuilders = heading.map(::headerFactory)
return DefaultTable(
headerBuilders,
dataList,
tableModifiers = tableModifiers,
attributesCustomizer,
headerCustomizer,
headerCellCustomizer,
rowAttributes,
cellCustomizer,
betweenHeaderAndBodyFiller,
cellFiller
)
}

View File

@@ -0,0 +1,46 @@
package dev.inmo.jsuikit.elements
import androidx.compose.runtime.Composable
import dev.inmo.jsuikit.modifiers.UIKitTab
import dev.inmo.jsuikit.modifiers.include
import dev.inmo.jsuikit.utils.optionallyDraw
import org.jetbrains.compose.web.attributes.AttrsScope
import org.jetbrains.compose.web.dom.*
import org.w3c.dom.HTMLLIElement
import org.w3c.dom.HTMLUListElement
@Composable
fun <T> Tabs(
data: Iterable<T>,
tabsItemBuilder: @Composable ElementScope<HTMLLIElement>.(i: Int, data: T) -> Unit,
tabsItemAttrs: AttrsScope<HTMLLIElement>.(i: Int, data: T) -> Unit = { _, _ -> },
tabsContainerAttrs: AttrsScope<HTMLUListElement>.() -> Unit = {},
contentContainerAttrs: (AttrsScope<HTMLUListElement>.() -> Unit)? = null,
contentItemAttrs: (AttrsScope<HTMLLIElement>.(i: Int, data: T) -> Unit)? = null,
contentItemBuilder: (@Composable ElementScope<HTMLLIElement>.(i: Int, data: T) -> Unit)? = null
) {
Ul({
include(UIKitTab);
tabsContainerAttrs()
}) {
data.forEachIndexed { i, data ->
Li({ tabsItemAttrs(i, data) }) {
tabsItemBuilder(i, data)
}
}
}
optionallyDraw(contentItemAttrs != null, contentItemBuilder != null, contentContainerAttrs != null) {
Ul({
contentContainerAttrs ?.invoke(this)
}) {
optionallyDraw(contentItemAttrs != null, contentItemBuilder != null) {
data.forEachIndexed { i, data ->
Li({ contentItemAttrs ?.invoke(this, i, data) }) {
contentItemBuilder ?.invoke(this, i, data)
}
}
}
}
}
}

View File

@@ -0,0 +1,21 @@
package dev.inmo.jsuikit.elements
import androidx.compose.runtime.Composable
import dev.inmo.jsuikit.modifiers.UIKitTile
import dev.inmo.jsuikit.modifiers.include
import dev.inmo.jsuikit.utils.Attrs
import org.jetbrains.compose.web.dom.ContentBuilder
import org.jetbrains.compose.web.dom.Div
import org.w3c.dom.HTMLDivElement
@Composable
fun Tile(
attrs: Attrs<HTMLDivElement> = Attrs.empty(),
contentBuilder: ContentBuilder<HTMLDivElement>
) = Div(
{
include(UIKitTile)
attrs.builder(this)
},
contentBuilder
)

View File

@@ -0,0 +1,26 @@
package dev.inmo.jsuikit.elements
import androidx.compose.runtime.Composable
import dev.inmo.jsuikit.modifiers.UIKitToggle
import dev.inmo.jsuikit.modifiers.include
import dev.inmo.jsuikit.utils.Attrs
import org.jetbrains.compose.web.attributes.ButtonType
import org.jetbrains.compose.web.attributes.type
import org.jetbrains.compose.web.dom.Button
import org.jetbrains.compose.web.dom.ContentBuilder
import org.w3c.dom.HTMLButtonElement
@Composable
fun Toggle(
attrs: Attrs<HTMLButtonElement>,
contentBuilder: ContentBuilder<HTMLButtonElement>
) {
Button(
{
include(UIKitToggle)
type(ButtonType.Button)
attrs.builder(this)
},
contentBuilder
)
}

View File

@@ -0,0 +1,5 @@
package dev.inmo.jsuikit.modifiers
sealed class AttributeValue(val name: String) {
override fun toString(): String = name
}

View File

@@ -0,0 +1,6 @@
package dev.inmo.jsuikit.modifiers
import dev.inmo.jsuikit.types.UIKit
inline val UIKit: UIKit
get() = js("UIkit").unsafeCast<UIKit>()

View File

@@ -0,0 +1,52 @@
package dev.inmo.jsuikit.modifiers
import dev.inmo.jsuikit.utils.Milliseconds
import dev.inmo.jsuikit.utils.buildAttribute
import org.w3c.dom.PageTransitionEvent
sealed class UIKitAccordion(
vararg classnames: String,
override val otherAttrs: Map<String, String> = emptyMap()
) : UIKitModifier {
@Suppress("UNCHECKED_CAST")
override val classes: Array<String> = classnames as Array<String>
object Title : UIKitAccordion("uk-accordion-title")
object Content : UIKitAccordion("uk-accordion-content")
class Custom internal constructor(
otherAttrs: Map<String, String> = emptyMap()
) : UIKitAccordion (otherAttrs = otherAttrs)
companion object : UIKitAccordion("uk-accordion", otherAttrs = mapOf("uk-accordion" to "")) {
val Open = UIKitUtility.Open
operator fun invoke(
activeItemIndex: Int? = null,
animation: Boolean? = null,
collapsible: Boolean? = null,
contentSelector: String? = null,
animationDuration: Milliseconds? = null,
multiple: Boolean? = null,
targetsSelector: String? = null,
toggleSelector: String? = null,
transition: PageTransitionEvent? = null,
offsetTopPixels: Int? = null,
) = Custom(
mapOf(
buildAttribute("uk-accordion") {
"active" to activeItemIndex
"animation" to animation
"collapsible" to collapsible
"content" to contentSelector
"duration" to animationDuration
"multiple" to multiple
"targets" to targetsSelector
"toggle" to toggleSelector
"transition" to transition
"offset" to offsetTopPixels
}
)
)
}
}

View File

@@ -0,0 +1,18 @@
package dev.inmo.jsuikit.modifiers
sealed class UIKitAlert(classname: String) : UIKitModifier {
override val classes: Array<String> = arrayOf(classname)
sealed class Style(classname: String) : UIKitAlert(classname) {
object Primary : Style("uk-alert-primary")
object Success : Style("uk-alert-success")
object Warning : Style("uk-alert-warning")
object Danger : Style("uk-alert-danger")
}
object Close : UIKitAlert("uk-alert-close")
companion object : UIKitAlert("uk-alert")
}

View File

@@ -60,4 +60,9 @@ sealed class UIKitAnimation (name: String) : UIKitModifier, AttributeValue(name)
object Fast : UIKitAnimation("fast")
object KenBurns : UIKitAnimation("kenburns")
override fun toString(): String {
return classes.joinToString(" ")
}
}

View File

@@ -0,0 +1,12 @@
package dev.inmo.jsuikit.modifiers
sealed class UIKitArticle(
override val classes: Array<String>
) : UIKitModifier {
object Title : UIKitArticle(arrayOf("uk-article-title"))
object Meta : UIKitArticle(arrayOf("uk-article-meta"))
companion object : UIKitArticle(arrayOf("uk-article"))
}

View File

@@ -0,0 +1,7 @@
package dev.inmo.jsuikit.modifiers
sealed class UIKitBadge(classname: String) : UIKitModifier {
override val classes: Array<String> = arrayOf(classname)
companion object : UIKitBadge("uk-badge")
}

View File

@@ -0,0 +1,14 @@
package dev.inmo.jsuikit.modifiers
sealed class UIKitBase(classname: String) : UIKitModifier {
override val classes: Array<String> = arrayOf(classname)
sealed class Heading(suffix: String) : UIKitBase("uk-h$suffix") {
object H1 : Heading("1")
object H2 : Heading("2")
object H3 : Heading("3")
object H4 : Heading("4")
object H5 : Heading("5")
object H6 : Heading("6")
}
}

View File

@@ -0,0 +1,8 @@
package dev.inmo.jsuikit.modifiers
sealed class UIKitBreadcrumb(
override val classes: Array<String> = emptyArray(),
override val otherAttrs: Map<String, String> = emptyMap()
) : UIKitModifier {
companion object : UIKitBreadcrumb(arrayOf("uk-breadcrumb"))
}

View File

@@ -0,0 +1,23 @@
package dev.inmo.jsuikit.modifiers
sealed class UIKitButton(suffix: String?) : UIKitModifier {
override val classes: Array<String> = arrayOf("uk-button${suffix?.let { "-$it" } ?: ""}")
sealed class Type(suffix: String) : UIKitButton(suffix) {
object Default : Type("default")
object Primary : Type("primary")
object Secondary : Type("secondary")
object Danger : Type("danger")
object Text : Type("text")
object Link : Type("link")
}
sealed class Size(suffix: String) : UIKitButton(suffix) {
object Small : Size("small")
object Large : Size("large")
}
object Group : UIKitButton("group")
companion object : UIKitButton(null)
}

View File

@@ -0,0 +1,35 @@
package dev.inmo.jsuikit.modifiers
sealed class UIKitCard(suffix: String?) : UIKitModifier {
override val classes: Array<String> = arrayOf("uk-card${suffix ?.let { "-$it" } ?: ""}")
object Title : UIKitCard("title")
object Hover : UIKitCard("hover")
object Badge : Parts("badge")
sealed class Parts(suffix: String) : UIKitCard(suffix) {
object Header : Parts("header")
object Body : Parts("body")
object Footer : Parts("footer")
}
sealed class Style(suffix: String) : UIKitCard(suffix) {
object Default : Style("default")
object Primary : Style("primary")
object Secondary : Style("secondary")
}
sealed class Size(suffix: String) : UIKitCard(suffix) {
object Small : Size("small")
object Large : Size("large")
}
sealed class Media(suffix: String) : UIKitCard("media-$suffix") {
object Top : Media("top")
object Right : Media("right")
object Bottom : Media("bottom")
object Left : Media("left")
}
companion object : UIKitCard(null)
}

View File

@@ -0,0 +1,17 @@
package dev.inmo.jsuikit.modifiers
sealed class UIKitClose(
override val classes: Array<String> = emptyArray(),
override val otherAttrs: Map<String, String> = emptyMap()
) : UIKitModifier {
object Large : UIKitClose(
arrayOf("uk-close-large")
)
companion object : UIKitClose(
arrayOf("uk-close"),
mapOf("uk-close" to "")
)
}

View File

@@ -0,0 +1,15 @@
package dev.inmo.jsuikit.modifiers
sealed class UIKitColumn(classname: String) : UIKitModifier {
override val classes: Array<String> = arrayOf(classname)
object Two : UIKitColumn("uk-column-1-2")
object Three : UIKitColumn("uk-column-1-3")
object Four : UIKitColumn("uk-column-1-4")
object Five : UIKitColumn("uk-column-1-5")
object Six : UIKitColumn("uk-column-1-6")
object Divider : UIKitColumn("uk-column-divider")
object Span : UIKitColumn("uk-column-span")
}

View File

@@ -0,0 +1,17 @@
package dev.inmo.jsuikit.modifiers
sealed class UIKitComment(suffix: String?) : UIKitModifier {
override val classes: Array<String> = arrayOf("uk-comment${suffix ?.let { "-$it" } ?: ""}")
object Body : UIKitComment("body")
object Header : UIKitComment("header")
object Title : UIKitComment("title")
object Meta : UIKitComment("meta")
object Avatar : UIKitComment("avatar")
object Primary : UIKitComment("primary")
object List : UIKitComment("list")
companion object : UIKitComment(null)
}

View File

@@ -0,0 +1,19 @@
package dev.inmo.jsuikit.modifiers
sealed class UIKitContainer(
override val classes: Array<String> = emptyArray(),
override val otherAttrs: Map<String, String> = emptyMap()
) : UIKitModifier {
sealed class Size(size: String) : UIKitContainer(arrayOf("uk-container-$size")) {
object XSmall : Size("xsmall")
object Small : Size("small")
object Large : Size("large")
object XLarge : Size("xlarge")
object Expand : Size("expand")
}
companion object : UIKitContainer(
arrayOf("uk-container")
)
}

View File

@@ -0,0 +1,6 @@
package dev.inmo.jsuikit.modifiers
class UIKitCustom(
override val classes: Array<String> = emptyArray(),
override val otherAttrs: Map<String, String> = emptyMap()
) : UIKitModifier

View File

@@ -0,0 +1,11 @@
package dev.inmo.jsuikit.modifiers
sealed class UIKitDescriptionList(
override val classes: Array<String>
) : UIKitModifier {
object Divider : UIKitDescriptionList(arrayOf("uk-description-list-divider"))
companion object : UIKitDescriptionList(arrayOf("uk-description-list"))
}

View File

@@ -0,0 +1,10 @@
package dev.inmo.jsuikit.modifiers
sealed class UIKitDivider(classname: String) : UIKitModifier {
override val classes: Array<String> = arrayOf(classname)
object Icon : UIKitDivider("uk-divider-icon")
object Small : UIKitDivider("uk-divider-small")
object Vertical : UIKitDivider("uk-divider-vertical")
}

View File

@@ -0,0 +1,122 @@
package dev.inmo.jsuikit.modifiers
import dev.inmo.jsuikit.utils.*
import org.jetbrains.compose.web.css.selectors.CSSSelector
sealed class UIKitDrop(
override val classes: Array<String> = emptyArray(),
override val otherAttrs: Map<String, String> = emptyMap()
) : UIKitModifier {
sealed class Position(name: String) : AttributeValue(name) {
sealed class Bottom(name: String) : Position("bottom-$name") {
object Left : Bottom("left")
object Center : Bottom("center")
object Right : Bottom("right")
object Justify : Bottom("justify")
}
sealed class Top(name: String) : Position("top-$name") {
object Left : Top("left")
object Center : Top("center")
object Right : Top("right")
object Justify : Top("justify")
}
sealed class Left(name: String) : Position("left-$name") {
object Top : Left("top")
object Center : Left("center")
object Bottom : Left("bottom")
}
sealed class Right(name: String) : Position("right-$name") {
object Top : Right("top")
object Center : Right("center")
object Bottom : Right("bottom")
}
}
sealed class Stretch(name: String) : AttributeValue(name) {
object True : Stretch("true")
object X : Stretch("x")
object Y : Stretch("y")
}
sealed class Mode(name: String) : AttributeValue(name) {
object Click : Mode("click")
object Hover : Mode("hover")
object None : Mode("")
object HoverAndClick : Mode("$Hover, $Click")
}
class Custom internal constructor(
classes: Array<String> = emptyArray(),
otherAttrs: Map<String, String> = emptyMap()
) : UIKitDrop(classes, otherAttrs)
companion object {
operator fun invoke(
toggle: CSSSelector? = null,
position: Position? = null,
stretch: Stretch? = null,
mode: Mode? = null,
delayShow: Milliseconds? = null,
delayHide: Milliseconds? = null,
autoUpdate: Boolean? = null,
boundary: CSSSelector? = null,
boundaryX: CSSSelector? = null,
boundaryY: CSSSelector? = null,
target: CSSSelector? = null,
targetX: CSSSelector? = null,
targetY: CSSSelector? = null,
inset: Boolean? = null,
flip: Boolean? = null,
shift: Boolean? = null,
offset: Pixels? = null,
animation: UIKitAnimation? = null,
animationOut: Boolean? = null,
bgScroll: Boolean? = null,
duration: Milliseconds? = null,
container: Boolean? = null
) = Custom(
arrayOf("uk-drop"),
mapOf(
buildAttribute("uk-drop") {
"toggle" to toggle
"position" to position
"stretch" to stretch
"mode" to mode
"delay-show" to delayShow
"delay-hide" to delayHide
"auto-update" to autoUpdate
"boundary" to boundary
"boundary-x" to boundaryX
"boundary-y" to boundaryY
"target" to target
"target-x" to targetX
"target-y" to targetY
"inset" to inset
"flip" to flip
"shift" to shift
"offset" to offset
"animation" to animation
"animation-out" to animationOut
"bg-scroll" to bgScroll
"duration" to duration
"container" to container
}
)
)
}
}

View File

@@ -0,0 +1,115 @@
package dev.inmo.jsuikit.modifiers
import dev.inmo.jsuikit.types.DropdownOptions
import dev.inmo.jsuikit.utils.Milliseconds
import dev.inmo.jsuikit.utils.buildAttribute
sealed class UIKitDropdown(classname: String) : UIKitModifier {
override val classes: Array<String> = arrayOf(classname)
object Nav : UIKitDropdown("uk-dropdown-nav")
object Grid : UIKitDropdown("uk-dropdown-grid")
sealed class Position(name: String) : AttributeValue(name) {
sealed class Bottom(name: String) : Position("bottom-$name") {
object Left : Bottom("left")
object Center : Bottom("center")
object Right : Bottom("right")
object Justify : Bottom("justify")
}
sealed class Top(name: String) : Position("top-$name") {
object Left : Top("left")
object Center : Top("center")
object Right : Top("right")
object Justify : Top("justify")
}
sealed class Left(name: String) : Position("left-$name") {
object Top : Left("top")
object Center : Left("center")
object Bottom : Left("bottom")
}
sealed class Right(name: String) : Position("right-$name") {
object Top : Right("top")
object Center : Right("center")
object Bottom : Right("bottom")
}
}
sealed class Mode(name: String) : AttributeValue(name) {
object Click : Mode("click")
object Hover : Mode("hover")
object None : Mode("")
object HoverAndClick : Mode("$Hover, $Click")
}
sealed class Flip(name: String) : AttributeValue(name) {
object True : Flip("true")
object False : Flip("false")
object X : Flip("x")
object Y : Flip("y")
}
class Custom(
dropdownOptions: DropdownOptions
) : UIKitDropdown("uk-dropdown") {
override val otherAttrs: Map<String, String> = mapOf(
buildAttribute(
"uk-dropdown"
) {
dropdownOptions.includeParameters(this)
}
)
}
companion object {
operator fun invoke(
dropdownOptions: DropdownOptions
) = Custom(dropdownOptions)
operator fun invoke(
toggle: String? = null,
pos: Position? = null,
mode: Mode? = null,
delayShow: Milliseconds? = null,
delayHide: Milliseconds? = null,
boundary: String? = null,
boundaryAlign: Boolean? = null,
flip: Flip? = null,
offset: Int? = null,
animation: UIKitAnimation? = null,
duration: Milliseconds? = null,
) = Custom(
DropdownOptions(
toggle = toggle,
pos = pos,
mode = mode,
delayShow = delayShow,
delayHide = delayHide,
boundary = boundary,
boundaryAlign = boundaryAlign,
flip = flip,
offset = offset,
animation = animation,
duration = duration
)
)
}
}

View File

@@ -1,7 +1,7 @@
package dev.inmo.jsuikit.modifiers
sealed class UIKitFlex(suffix: String) : UIKitModifier {
override val classes: Array<String> = arrayOf("uk-flex-$suffix")
sealed class UIKitFlex(suffix: String?) : UIKitModifier {
override val classes: Array<String> = arrayOf("uk-flex${suffix ?.let { "-$it" } ?: ""}")
object Inline : UIKitFlex("inline")
@@ -76,4 +76,6 @@ sealed class UIKitFlex(suffix: String) : UIKitModifier {
object NoWrap : UIKitFlex("nowrap")
companion object : UIKitFlex(null)
}

View File

@@ -0,0 +1,59 @@
package dev.inmo.jsuikit.modifiers
import dev.inmo.jsuikit.utils.buildAttribute
sealed class UIKitForm(
vararg classnames: String,
override val otherAttrs: Map<String, String> = emptyMap()
) : UIKitModifier {
@Suppress("UNCHECKED_CAST")
override val classes: Array<String> = classnames as Array<String>
object Fieldset : UIKitForm("uk-fieldset")
object Legend : UIKitForm("uk-legend")
object Input : UIKitForm("uk-input")
object Select : UIKitForm("uk-select")
object TextArea : UIKitForm("uk-textarea")
object Radio : UIKitForm("uk-radio", otherAttrs = mapOf("type" to "radio"))
object Checkbox : UIKitForm("uk-checkbox", otherAttrs = mapOf("type" to "checkbox"))
object Range : UIKitForm("uk-range", otherAttrs = mapOf("type" to "range"))
sealed class State(vararg classnames: String) : UIKitForm(*classnames) {
object Danger : State("uk-form-danger")
object Success : State("uk-form-success")
}
sealed class Size(vararg classnames: String) : UIKitForm(*classnames) {
object Large : Size("uk-form-large")
object Default : Size() // :)
object Small : Size("uk-form-small")
}
sealed class Width(vararg classnames: String) : UIKitForm(*classnames) {
object Large : Width("uk-form-width-large")
object Medium : Width("uk-form-width-medium")
object Small : Width("uk-form-width-small")
object XSmall : Width("uk-form-width-xsmall")
}
object Blank : UIKitForm("uk-form-blank")
sealed class Layout(vararg classnames: String) : UIKitForm(*classnames) {
object Stacked : Layout("uk-form-stacked")
object Horizontal : Layout("uk-form-horizontal")
object Label : Layout("uk-form-label")
object Controls : Layout("uk-form-controls")
}
object Icon : UIKitForm("uk-form-icon")
class Custom(
target: String? = null
) : UIKitForm(
"uk-form-custom",
otherAttrs = mapOf(
buildAttribute("uk-form-custom") {
"target" to target
}
)
)
}

View File

@@ -0,0 +1,59 @@
package dev.inmo.jsuikit.modifiers
import dev.inmo.jsuikit.utils.buildAttribute
sealed class UIKitGrid(vararg classnames: String) : UIKitModifier {
override val classes: Array<String> = classnames as Array<String>
sealed class Gap(classname: String) : UIKitGrid(classname) {
object Small : Gap("uk-grid-small")
object Medium : Gap("uk-grid-medium")
object Large : Gap("uk-grid-large")
object Collapse : Gap("uk-grid-collapse")
}
sealed class Column(classname: String) : UIKitGrid(classname) {
object Small : Column("uk-grid-column-small")
object Medium : Column("uk-grid-column-medium")
object Large : Column("uk-grid-column-large")
object Collapse : Column("uk-grid-column-collapse")
}
sealed class Row(classname: String) : UIKitGrid(classname) {
object Small : Row("uk-grid-row-small")
object Medium : Row("uk-grid-row-medium")
object Large : Row("uk-grid-row-large")
object Collapse : Row("uk-grid-row-collapse")
}
object Divider : UIKitGrid("uk-grid-divider")
object MatchHeight : UIKitGrid("uk-grid-match")
object ItemMatchHeight : UIKitGrid("uk-grid-item-match")
class Custom internal constructor(override val otherAttrs: Map<String, String>) : UIKitGrid("uk-grid")
companion object : UIKitGrid("uk-grid") {
operator fun invoke(
margin: UIKitMargin? = null,
firstColumnClass: String? = null,
masonry: Boolean? = null,
parallax: UInt? = null
) = Custom(
mapOf(
buildAttribute("uk-grid") {
margin to margin ?.classes ?.joinToString(" ")
"first-column" to firstColumnClass
"masonry" to masonry
"parallax" to parallax
}
)
)
}
}

View File

@@ -0,0 +1,79 @@
package dev.inmo.jsuikit.modifiers
import dev.inmo.jsuikit.utils.*
sealed class UIKitHeight(
classname: String?,
override val otherAttrs: Map<String, String> = emptyMap()
) : UIKitModifier {
override val classes: Array<String> = classname ?.let { arrayOf(it) } ?: emptyArray()
object Full : UIKitHeight("uk-height-1-1")
sealed class Size(classname: String) : UIKitHeight(classname) {
sealed class Small(classname: String = "uk-height-small") : Size(classname) {
object Max : Small("uk-height-max-small")
companion object : Small()
}
sealed class Medium(classname: String = "uk-height-medium") : Size(classname) {
object Max : Medium("uk-height-max-medium")
companion object : Medium()
}
sealed class Large(classname: String = "uk-height-large") : Size(classname) {
object Max : Large("uk-height-max-large")
companion object : Large()
}
}
class Viewport(offsetTop: Boolean? = null, offsetBottom: String? = null, expand: Boolean? = null, minHeight: Int? = null) : UIKitHeight(
null,
mapOf(
buildAttribute("uk-height-viewport") {
offsetTop ?.let { "offset-top" to it.toString() }
offsetBottom ?.let { "offset-bottom" to it }
expand ?.let { "expand" to it.toString() }
minHeight ?.let { "min-height" to it.toString() }
}
)
)
fun Viewport(
offsetTop: Boolean? = null,
offsetBottom: Boolean,
expand: Boolean? = null,
minHeight: Int? = null
) = Viewport(offsetTop, offsetBottom.toString(), expand, minHeight)
fun Viewport(
offsetTop: Boolean? = null,
offsetBottom: Pixels,
expand: Boolean? = null,
minHeight: Int? = null
) = Viewport(offsetTop, offsetBottom.toString(), expand, minHeight)
fun Viewport(
offsetTop: Boolean? = null,
offsetBottom: Percents,
expand: Boolean? = null,
minHeight: Int? = null
) = Viewport(offsetTop, offsetBottom.toString(), expand, minHeight)
class Match(target: String? = null, row: Boolean? = null) : UIKitHeight(
null,
mapOf(
buildAttribute("uk-height-match") {
target ?.let { "target" to it }
row ?.let { "row" to it.toString() }
}
)
)
}

View File

@@ -0,0 +1,7 @@
package dev.inmo.jsuikit.modifiers
sealed class UIKitIcon(classname: String) : UIKitModifier {
override val classes: Array<String> = arrayOf(classname)
companion object : UIKitIcon("uk-icon")
}

View File

@@ -0,0 +1,11 @@
package dev.inmo.jsuikit.modifiers
sealed class UIKitIconnav(
override val classes: Array<String>
) : UIKitModifier {
object Vertical : UIKitIconnav(arrayOf("uk-iconnav-vertical"))
companion object : UIKitIconnav(arrayOf("uk-iconnav"))
}

View File

@@ -0,0 +1,8 @@
package dev.inmo.jsuikit.modifiers
sealed class UIKitInverse(classname: String) : UIKitModifier {
override val classes: Array<String> = arrayOf(classname)
object Light : UIKitInverse("uk-light")
object Dark : UIKitInverse("uk-dark")
}

View File

@@ -0,0 +1,11 @@
package dev.inmo.jsuikit.modifiers
sealed class UIKitLabel(suffix: String?) : UIKitModifier {
override val classes: Array<String> = arrayOf("uk-label${suffix?.let { "-$it" } ?: ""}")
object Success : UIKitLabel("success")
object Warning : UIKitLabel("warning")
object Error : UIKitLabel("danger")
companion object : UIKitLabel(null)
}

View File

@@ -0,0 +1,28 @@
package dev.inmo.jsuikit.modifiers
import dev.inmo.jsuikit.utils.buildAttribute
sealed class UIKitLeader(
override val classes: Array<String>,
override val otherAttrs: Map<String, String>
) : UIKitModifier {
class Custom(
otherAttrs: Map<String, String>
) : UIKitLeader(arrayOf("uk-leader"), otherAttrs)
companion object : UIKitLeader(arrayOf("uk-leader"), emptyMap()) {
operator fun invoke(
media: String? = null,
fill: String? = null
) = Custom(
mapOf(
buildAttribute("uk-leader") {
"fill" to fill
"media" to media
}
)
)
}
}

View File

@@ -0,0 +1,46 @@
package dev.inmo.jsuikit.modifiers
sealed class UIKitList(
vararg classes: String,
override val otherAttrs: Map<String, String> = emptyMap()
) : UIKitModifier {
@Suppress("UNCHECKED_CAST")
override val classes: Array<String> = classes as Array<String>
sealed class Style(vararg classes: String) : UIKitList(*classes) {
object Disc : Style("uk-list-disc")
object Circle : Style("uk-list-circle")
object Square : Style("uk-list-square")
object Decimal : Style("uk-list-decimal")
object Hyphen : Style("uk-list-hyphen")
}
sealed class Size(vararg classes: String) : UIKitList(*classes) {
object Large : Size("uk-list-large")
object Collapse : Size("uk-list-collapse")
}
sealed class Color(vararg classes: String) : UIKitList(*classes) {
object Muted : Color("uk-list-muted")
object Emphasis : Color("uk-list-emphasis")
object Primary : Color("uk-list-primary")
object Secondary : Color("uk-list-secondary")
companion object {
val Bullet = UIKitList.Bullet
}
}
object Bullet: UIKitList("uk-list-bullet")
object Divider: UIKitList("uk-list-divider")
object Striped: UIKitList("uk-list-striped")
companion object : UIKitList("uk-list")
}

View File

@@ -0,0 +1,91 @@
package dev.inmo.jsuikit.modifiers
sealed class UIKitMargin(vararg classnames: String) : UIKitModifier {
@Suppress("UNCHECKED_CAST")
override val classes: Array<String> = classnames as Array<String>
object Top : UIKitMargin("uk-margin-top")
object Bottom : UIKitMargin("uk-margin-bottom")
object Left : UIKitMargin("uk-margin-left")
object Right : UIKitMargin("uk-margin-right")
object Vertical : UIKitMargin() { override val classes: Array<String> = Top.classes + Bottom.classes }
object Horizontal : UIKitMargin() { override val classes: Array<String> = Left.classes + Right.classes }
companion object : Small("uk-margin")
sealed class Small(vararg classnames: String) : UIKitMargin(*classnames) {
object Top : Small("uk-margin-small-top")
object Bottom : Small("uk-margin-small-bottom")
object Left : Small("uk-margin-small-left")
object Right : Small("uk-margin-small-right")
object Vertical : Small() {
override val classes: Array<String> = Top.classes + Bottom.classes
}
object Horizontal : Small() {
override val classes: Array<String> = Left.classes + Right.classes
}
companion object : Small("uk-margin-small")
}
sealed class Medium(vararg classnames: String) : UIKitMargin(*classnames) {
object Top : Medium("uk-margin-medium-top")
object Bottom : Medium("uk-margin-medium-bottom")
object Left : Medium("uk-margin-medium-left")
object Right : Medium("uk-margin-medium-right")
object Vertical : Medium() { override val classes: Array<String> = Top.classes + Bottom.classes }
object Horizontal : Medium() { override val classes: Array<String> = Left.classes + Right.classes }
companion object : Medium("uk-margin-medium")
}
sealed class Large(vararg classnames: String) : UIKitMargin(*classnames) {
object Top : Large("uk-margin-large-top")
object Bottom : Large("uk-margin-large-bottom")
object Left : Large("uk-margin-large-left")
object Right : Large("uk-margin-large-right")
object Vertical : Large() { override val classes: Array<String> = Top.classes + Bottom.classes }
object Horizontal : Large() { override val classes: Array<String> = Left.classes + Right.classes }
companion object : Large("uk-margin-large")
}
sealed class XLarge(vararg classnames: String) : UIKitMargin(*classnames) {
object Top : XLarge("uk-margin-xlarge-top")
object Bottom : XLarge("uk-margin-xlarge-bottom")
object Left : XLarge("uk-margin-xlarge-left")
object Right : XLarge("uk-margin-xlarge-right")
object Vertical : XLarge() { override val classes: Array<String> = Top.classes + Bottom.classes }
object Horizontal : XLarge() { override val classes: Array<String> = Left.classes + Right.classes }
companion object : XLarge("uk-margin-xlarge")
}
sealed class Auto(vararg classnames: String) : UIKitMargin(*classnames) {
object Top : Auto("uk-margin-auto-top")
object Bottom : Auto("uk-margin-auto-bottom")
object Left : Auto("uk-margin-auto-left")
object Right : Auto("uk-margin-auto-right")
object Vertical : Auto("uk-margin-auto-vertical")
object Horizontal : Auto() { override val classes: Array<String> = Left.classes + Right.classes }
companion object : Auto("uk-margin-auto")
}
sealed class Remove(vararg classnames: String) : UIKitMargin(*classnames) {
object Top : Remove("uk-margin-remove-top")
object Bottom : Remove("uk-margin-remove-bottom")
object Left : Remove("uk-margin-remove-left")
object Right : Remove("uk-margin-remove-right")
object Vertical : Remove("uk-margin-remove-vertical")
object Horizontal : Remove() { override val classes: Array<String> = Left.classes + Right.classes }
object Adjacent : Remove("uk-margin-remove-adjacent")
object FirstChild : Remove("uk-margin-remove-first-child")
object LastChild : Remove("uk-margin-remove-last-child")
companion object : Remove("uk-margin-remove")
}
}

View File

@@ -0,0 +1,58 @@
package dev.inmo.jsuikit.modifiers
import dev.inmo.jsuikit.utils.buildAttribute
sealed class UIKitModal(
classname: String,
override val otherAttrs: Map<String, String> = emptyMap()
) : UIKitModifier {
override val classes: Array<String> = arrayOf(classname)
object Dialog : UIKitModal("uk-modal-dialog")
object Title : UIKitModal("uk-modal-title")
object Header : UIKitModal("uk-modal-header")
object Body : UIKitModal("uk-modal-body")
object Footer : UIKitModal("uk-modal-footer")
object Container : UIKitModal("uk-modal-container")
object Full : UIKitModal("uk-modal-full")
object Page : UIKitModal("uk-modal-page")
sealed class Close(classname: String) : UIKitModal(classname) {
object Default : Close("uk-modal-close-default")
object Outside : Close("uk-modal-close-outside")
object Full : Close("uk-modal-close-full")
companion object : Close("uk-modal-close")
}
internal class WithCustomAttributes(
otherAttrs: Map<String, String> = emptyMap()
) : UIKitModal("uk-modal", otherAttrs)
companion object : UIKitModal("uk-modal", mapOf("uk-modal" to "")) {
operator fun invoke(
escClose: Boolean? = null,
backgroundClose: Boolean? = null,
stack: Boolean? = null,
container: Boolean? = null,
classPage: String? = null,
classPanel: String? = null,
closingSelection: String? = null,
): UIKitModal = WithCustomAttributes(
mapOf(
buildAttribute("uk-modal") {
"esc-close" to escClose
"bg-close" to backgroundClose
"stack" to stack
"container" to container
"cls-page" to classPage
"cls-panel" to classPanel
"sel-close" to closingSelection
}
)
)
}
}

View File

@@ -0,0 +1,33 @@
package dev.inmo.jsuikit.modifiers
import dev.inmo.jsuikit.utils.Attrs
import org.jetbrains.compose.web.attributes.AttrsScope
import org.jetbrains.compose.web.dom.AttrBuilderContext
import org.w3c.dom.Element
interface UIKitModifier {
val classes: Array<String>
get() = emptyArray()
val otherAttrs: Map<String, String>
get() = emptyMap()
}
fun AttrsScope<*>.include(vararg container: UIKitModifier?) {
container.forEach {
it ?.classes ?.let { newClasses -> classes(*newClasses) }
it ?.otherAttrs ?.let { attrs -> attrs.forEach { (k, v) -> attr(k, v) } }
}
}
fun <T : Element> UIKitModifier.asAttributesBuilder(): AttrBuilderContext<T> = {
include(this@asAttributesBuilder)
}
operator fun UIKitModifier.plus(other: UIKitModifier): UIKitModifier = UIKitCustom(
classes + other.classes,
otherAttrs + other.otherAttrs
)
fun <T: Element> UIKitModifier?.builder() = Attrs<T>(this).builder
fun <T: Element> Array<out UIKitModifier?>.builder() = Attrs<T>(*this).builder
inline fun <T: Element> attrsBuilder(vararg modifiers: UIKitModifier?) = modifiers.builder<T>()
@JsName("plusBuilder")
operator fun <T: Element> UIKitModifier?.plus(other: UIKitModifier?): AttrBuilderContext<T> = Attrs<T>(this@plus, other).builder

View File

@@ -3,8 +3,7 @@ package dev.inmo.jsuikit.modifiers
sealed class UIKitNav(classname: String) : UIKitModifier {
override val classes: Array<String> = arrayOf(classname)
object Accordion : UIKitNav("uk-nav-parent-icon")
object Subnav : UIKitNav("uk-nav-sub")
object ParentIcon : UIKitNav("uk-nav-parent-icon")
object Header : UIKitNav("uk-nav-header")
object Divider : UIKitNav("uk-nav-divider")
@@ -14,4 +13,10 @@ sealed class UIKitNav(classname: String) : UIKitModifier {
object Primary : UIKitNav("uk-nav-primary")
object Center : UIKitNav("uk-nav-center")
object Sub : UIKitNav("uk-nav-sub")
companion object : UIKitNav("uk-nav") {
val SubNav = UIKitSubNav
}
}

View File

@@ -0,0 +1,86 @@
package dev.inmo.jsuikit.modifiers
import dev.inmo.jsuikit.types.Dropdown
import dev.inmo.jsuikit.utils.*
sealed class UIKitNavbar(vararg classes: String) : UIKitModifier {
override val classes: Array<String> = classes as Array<String>
object Transparent : UIKitNavbar("uk-navbar-transparent")
object Container : UIKitNavbar("uk-navbar-container")
sealed class Dropdown(suffix: String?) : UIKitNavbar("uk-navbar-dropdown${suffix ?.let { "-$it" } ?: ""}") {
object Nav : Dropdown("nav")
sealed class Width(suffix: String) : Dropdown(suffix) {
object Two : Width("width-2")
object Three : Width("width-3")
object Four : Width("width-4")
object Five : Width("width-5")
}
companion object : Dropdown(null)
}
sealed class Alignment(val suffix: String) : UIKitNavbar("uk-navbar-$suffix") {
object Left : Alignment("left")
sealed class Center(suffix: String) : Alignment(suffix) {
object Left : Center("center-left")
object Right : Center("center-right")
companion object : Center("center")
}
object Right : Alignment("right")
}
object Item : UIKitNavbar("uk-navbar-item")
object Nav : UIKitNavbar("uk-navbar-nav")
object Subtitle : UIKitNavbar("uk-navbar-subtitle")
object Toggle : UIKitNavbar("uk-navbar-toggle")
object Sticky : UIKitNavbar("uk-navbar-sticky")
class Component internal constructor(
override val otherAttrs: Map<String, String>
) : UIKitNavbar(*UIKitNavbar.classes)
companion object : UIKitNavbar("uk-navbar") {
val Logo = UIKitUtility.Logo
operator fun invoke(
align: String?,
mode: String? = null,
delayShow: Milliseconds? = null,
delayHide: Milliseconds? = null,
boundary: String? = null,
boundaryAlign: Boolean? = null,
offset: Pixels? = null,
dropbar: Boolean? = null,
duration: Milliseconds? = null
): Component {
return Component(
mapOf(
buildAttribute(UIKitNavbar.classes.first()) {
"align" to align
"mode" to mode
"delay-show" to delayShow
"delay-hide" to delayHide
"boundary" to boundary
"boundary-align" to boundaryAlign
"offset" to offset
"dropbar" to dropbar
"duration" to duration
}
)
)
}
operator fun invoke(
align: Alignment? = null,
mode: UIKitDropdown.Mode? = null,
delayShow: Milliseconds? = null,
delayHide: Milliseconds? = null,
boundary: String? = null,
boundaryAlign: Boolean? = null,
offset: Pixels? = null,
dropbar: Boolean? = null,
duration: Milliseconds? = null
): Component = invoke(align ?.suffix, mode ?.name, delayShow, delayHide, boundary, boundaryAlign, offset, dropbar, duration)
}
}

View File

@@ -0,0 +1,16 @@
package dev.inmo.jsuikit.modifiers
sealed class UIKitOverlay(
override val classes: Array<String> = emptyArray(),
override val otherAttrs: Map<String, String> = emptyMap()
) : UIKitModifier {
object Default : UIKitOverlay(arrayOf("uk-overlay-default"))
object Primary : UIKitOverlay(arrayOf("uk-overlay-primary"))
object Icon : UIKitOverlay(arrayOf("uk-overlay-icon"))
companion object : UIKitOverlay(
arrayOf("uk-overlay")
)
}

View File

@@ -8,7 +8,10 @@ sealed class UIKitPadding(suffix: String?) : UIKitModifier {
object Small : Size("small")
object Large : Size("large")
companion object : Size(null)
companion object : Size(null) {
val Default
get() = this
}
}
@@ -25,5 +28,6 @@ sealed class UIKitPadding(suffix: String?) : UIKitModifier {
}
companion object : Size(null)
}

View File

@@ -0,0 +1,5 @@
package dev.inmo.jsuikit.modifiers
object UIKitPlaceholder : UIKitModifier {
override val classes: Array<String> = arrayOf("uk-placeholder")
}

View File

@@ -18,3 +18,14 @@ sealed class UIKitScreenSizeModifier(val name: String) {
modifier
)
}
fun UIKitModifier.applyWhenScreenSizeIs(size: UIKitScreenSizeModifier) = size.modify(this)
val UIKitModifier.onSmallScreens
get() = applyWhenScreenSizeIs(UIKitScreenSizeModifier.Small)
val UIKitModifier.onMediumScreens
get() = applyWhenScreenSizeIs(UIKitScreenSizeModifier.Medium)
val UIKitModifier.onLargeScreens
get() = applyWhenScreenSizeIs(UIKitScreenSizeModifier.Large)
val UIKitModifier.onXLargeScreens
get() = applyWhenScreenSizeIs(UIKitScreenSizeModifier.XLarge)

View File

@@ -0,0 +1,23 @@
package dev.inmo.jsuikit.modifiers
sealed class UIKitSection(vararg classes: String) : UIKitModifier {
override val classes: Array<String> = classes as Array<String>
sealed class Style(suffix: String) : UIKitSection("uk-section-$suffix") {
object Default : Style("default")
object Muted : Style("muted")
object Primary : Style("primary")
object Secondary : Style("secondary")
}
sealed class Size(suffix: String) : UIKitSection("uk-section-$suffix") {
object XSmall : Size("xsmall")
object Small : Size("small")
object Large : Size("large")
object XLarge : Size("xlarge")
}
object Overlap : UIKitSection("uk-section-overlap")
companion object : UIKitSection("uk-section")
}

View File

@@ -0,0 +1,47 @@
package dev.inmo.jsuikit.modifiers
import dev.inmo.jsuikit.utils.buildAttribute
import org.jetbrains.compose.web.css.CSSUnitLengthOrPercentage
import org.jetbrains.compose.web.css.CSSUnitValueTyped
class UIKitSticky(
position: Position? = null,
start: String? = null,
end: String? = null,
offset: CSSUnitValueTyped<CSSUnitLengthOrPercentage>? = null,
overflowFlip: Boolean? = null,
animation: UIKitAnimation? = null,
classForActiveItems: String? = null,
classForInactiveItems: String? = null,
showOnUp: Boolean? = null,
media: String? = null,
targetOffset: CSSUnitValueTyped<CSSUnitLengthOrPercentage>? = null
) : UIKitModifier {
override val otherAttrs: Map<String, String> = mapOf(
buildAttribute("uk-sticky") {
"position" to position ?.name
"start" to start
"end" to end
"offset" to offset ?.toString()
"overflow-flip" to overflowFlip
"animation" to animation
"cls-active" to classForActiveItems
"cls-inactive" to classForInactiveItems
"show-on-up" to showOnUp
"media" to media
"target-offset" to targetOffset ?.toString()
}
)
sealed interface Position {
val name: String
object Top : Position {
override val name: String
get() = "top"
}
object Bottom : Position {
override val name: String
get() = "bottom"
}
}
}

View File

@@ -0,0 +1,10 @@
package dev.inmo.jsuikit.modifiers
sealed class UIKitSubNav(classname: String) : UIKitModifier {
override val classes: Array<String> = arrayOf(classname)
object Divider : UIKitSubNav("uk-subnav-divider")
object Pill : UIKitSubNav("uk-subnav-pill")
companion object : UIKitSubNav("uk-subnav")
}

View File

@@ -0,0 +1,51 @@
package dev.inmo.jsuikit.modifiers
import dev.inmo.jsuikit.utils.buildAttribute
import org.jetbrains.compose.web.css.selectors.CSSSelector
import kotlin.time.Duration
sealed class UIKitTab(
override val classes: Array<String> = emptyArray(),
override val otherAttrs: Map<String, String> = emptyMap()
) : UIKitModifier {
sealed class Position(
classes: Array<String> = emptyArray(),
otherAttrs: Map<String, String> = emptyMap()
) : UIKitTab(classes, otherAttrs) {
object Bottom : Position(arrayOf("uk-tab-bottom"))
object Left : Position(arrayOf("uk-tab-left"))
object Right : Position(arrayOf("uk-tab-right"))
}
class Custom(
connect: CSSSelector? = null,
toggle: CSSSelector? = null,
active: Int? = null,
animationsIn: Array<UIKitAnimation>? = null,
animationsOut: Array<UIKitAnimation>? = null,
animationDuration: Duration? = null,
swiping: Boolean? = null,
media: String? = null
) : UIKitTab(
arrayOf("uk-tab"),
mapOf(
buildAttribute("uk-tab") {
"connect" to connect
"toggle" to toggle
"active" to active
"animation" to (
(animationsIn ?.let {
it.joinToString(" ") { it.name }
} ?: "") + (animationsOut ?.let {
it.joinToString(" ", ",") { it.name }
} ?: "")
).takeIf { it.isNotBlank() }
"duration" to animationDuration
"swiping" to swiping
"media" to media
}
)
)
companion object : UIKitTab(arrayOf("uk-tab"), mapOf("uk-tab" to ""))
}

View File

@@ -0,0 +1,71 @@
package dev.inmo.jsuikit.modifiers
sealed class UIKitText(suffix: String) : UIKitModifier {
override val classes: Array<String> = arrayOf("uk-text-$suffix")
sealed class Style(suffix: String) : UIKitText(suffix) {
object Lead : Style("lead")
object Meta : Style("meta")
object Italic : Style("italic")
}
sealed class Size(suffix: String) : UIKitText(suffix) {
object Small : Size("small")
object Default : Size("default")
object Large : Size("large")
}
sealed class Weight(suffix: String) : UIKitText(suffix) {
object Light : Weight("light")
object Normal : Weight("normal")
object Bold : Weight("bold")
object Lighter : Weight("lighter")
object Bolder : Weight("bolder")
}
sealed class Transform(suffix: String) : UIKitText(suffix) {
object Capitalize : Transform("capitalize")
object Uppercase : Transform("uppercase")
object Lowercase : Transform("lowercase")
}
object DecorationNone : UIKitText("decoration-none")
sealed class Color(suffix: String) : UIKitText(suffix) {
object Muted : Color("muted")
object Emphasis : Color("emphasis")
object Primary : Color("primary")
object Secondary : Color("secondary")
object Success : Color("success")
object Warning : Color("warning")
object Danger : Color("danger")
}
object Background : UIKitText("background")
sealed class Alignment(suffix: String) : UIKitText(suffix) {
sealed class Horizontal(suffix: String) : Alignment(suffix) {
object Left : Horizontal("left")
object Right : Horizontal("right")
object Center : Horizontal("center")
object Justify : Horizontal("justify")
}
sealed class Vertical(suffix: String) : Alignment(suffix) {
object Top : Vertical("top")
object Middle : Vertical("middle")
object Bottom : Vertical("bottom")
object Baseline : Vertical("baseline")
}
}
sealed class Wrapping(suffix: String) : UIKitText(suffix) {
object Truncate : Wrapping("truncate")
object Break : Wrapping("break")
object NoWrap : Wrapping("nowrap")
}
}

View File

@@ -0,0 +1,15 @@
package dev.inmo.jsuikit.modifiers
sealed class UIKitTile(
override val classes: Array<String> = emptyArray(),
override val otherAttrs: Map<String, String> = emptyMap()
) : UIKitModifier {
object Default : UIKitTile(arrayOf("uk-tile-default"))
object Muted : UIKitTile(arrayOf("uk-tile-muted"))
object Primary : UIKitTile(arrayOf("uk-tile-primary"))
object Secondary : UIKitTile(arrayOf("uk-tile-secondary"))
companion object : UIKitTile(arrayOf("uk-tile"))
}

View File

@@ -0,0 +1,64 @@
package dev.inmo.jsuikit.modifiers
import dev.inmo.jsuikit.utils.Milliseconds
import dev.inmo.jsuikit.utils.buildAttribute
sealed class UIKitToggle(
vararg classnames: String,
override val otherAttrs: Map<String, String>
) : UIKitModifier {
@Suppress("UNCHECKED_CAST")
override val classes: Array<String> = classnames as Array<String>
sealed class Mode {
abstract val mode: String
object Click : Mode() {
override val mode: String
get() = "click"
}
object Hover : Mode() {
override val mode: String
get() = "hover"
}
object ClickAndHover : Mode() {
override val mode: String
get() = "${Click.mode}, ${Hover.mode}"
}
object Media : Mode() {
override val mode: String
get() = "media"
}
override fun toString(): String = mode
}
class Custom internal constructor(otherAttrs: Map<String, String>) : UIKitToggle(otherAttrs = otherAttrs)
companion object : UIKitToggle(otherAttrs = mapOf("uk-toggle" to "")) {
operator fun invoke(
target: String? = null,
mode: Mode? = null,
classesToApplyOnToggle: String? = null,
media: String? = null,
animation: UIKitAnimation? = null,
duration: Milliseconds? = null,
queued: Boolean? = null
) = Custom(
mapOf(
buildAttribute("uk-toggle") {
"target" to target
"mode" to mode
"cls" to classesToApplyOnToggle
"media" to media
"animation" to animation
"duration" to duration
"queued" to queued
}
)
)
}
}

View File

@@ -1,5 +1,7 @@
package dev.inmo.jsuikit.modifiers
import dev.inmo.jsuikit.utils.buildAttribute
class UIKitTooltipModifier(
text: String,
align: Align? = null,
@@ -8,16 +10,15 @@ class UIKitTooltipModifier(
duration: Int? = null,
animation: UIKitAnimation? = null
) : UIKitModifier {
private val parametersMap = listOfNotNull(
"title" to text,
align ?.let { it.k to it.v },
delay ?.let { "delay" to it.toString() },
offset ?.let { "offset" to it.toString() },
duration ?.let { "duration" to it.toString() },
animation ?.let { "animation" to it.name },
)
override val otherAttrs: Map<String, String> = mapOf(
"uk-tooltip" to parametersMap.joinToString(";") { (k, v) -> "$k: $v" }
buildAttribute("uk-tooltip") {
"title" to text
align ?.let { it.k to it.v }
delay ?.let { "delay" to it.toString() }
offset ?.let { "offset" to it.toString() }
duration ?.let { "duration" to it.toString() }
animation ?.let { "animation" to it.name }
}
)
sealed class Align(name: String) {

Some files were not shown because too many files have changed in this diff Show More