@witchcraft/ui 0.0.1 → 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (224) hide show
  1. package/README.md +18 -28
  2. package/dist/module.d.mts +3 -1
  3. package/dist/module.json +3 -3
  4. package/dist/module.mjs +21 -12
  5. package/dist/runtime/assets/base.css +1 -1
  6. package/dist/runtime/assets/locales/en.json +2 -2
  7. package/dist/runtime/assets/tailwind.css +1 -1
  8. package/dist/runtime/assets/utils.css +1 -0
  9. package/dist/runtime/build/WitchcraftUiResolver.js +1 -1
  10. package/dist/runtime/components/Aria/Aria.vue +5 -9
  11. package/dist/runtime/components/Aria/Aria.vue.d.ts +5 -0
  12. package/dist/runtime/components/Icon/Icon.vue +12 -28
  13. package/dist/runtime/components/Icon/Icon.vue.d.ts +21 -0
  14. package/dist/runtime/components/LibButton/LibButton.vue +93 -117
  15. package/dist/runtime/components/LibButton/LibButton.vue.d.ts +36 -0
  16. package/dist/runtime/components/LibCheckbox/LibCheckbox.vue +53 -76
  17. package/dist/runtime/components/LibCheckbox/LibCheckbox.vue.d.ts +42 -0
  18. package/dist/runtime/components/LibColorInput/LibColorInput.vue +131 -101
  19. package/dist/runtime/components/LibColorInput/LibColorInput.vue.d.ts +63 -0
  20. package/dist/runtime/components/LibColorPicker/LibColorPicker.vue +326 -296
  21. package/dist/runtime/components/LibColorPicker/LibColorPicker.vue.d.ts +61 -0
  22. package/dist/runtime/components/LibColorPicker/utils/safeConvertToHsva.d.ts +2 -0
  23. package/dist/runtime/components/LibColorPicker/utils/safeConvertToHsva.js +18 -0
  24. package/dist/runtime/components/LibColorPicker/utils/safeConvertToRgba.d.ts +2 -0
  25. package/dist/runtime/components/LibColorPicker/utils/safeConvertToRgba.js +17 -0
  26. package/dist/runtime/components/LibColorPicker/utils/toLowPrecisionRgbaString.d.ts +2 -0
  27. package/dist/runtime/components/LibColorPicker/utils/toLowPrecisionRgbaString.js +8 -0
  28. package/dist/runtime/components/LibColorPicker/utils/truncate.d.ts +1 -0
  29. package/dist/runtime/components/LibColorPicker/utils/truncate.js +5 -0
  30. package/dist/runtime/components/LibDarkModeSwitcher/LibDarkModeSwitcher.vue +42 -64
  31. package/dist/runtime/components/LibDarkModeSwitcher/LibDarkModeSwitcher.vue.d.ts +22 -0
  32. package/dist/runtime/components/LibDatePicker/LibDatePicker.vue +20 -54
  33. package/dist/runtime/components/LibDatePicker/LibDatePicker.vue.d.ts +40 -0
  34. package/dist/runtime/components/LibDatePicker/LibRangeDatePicker.vue +205 -173
  35. package/dist/runtime/components/LibDatePicker/LibRangeDatePicker.vue.d.ts +34 -0
  36. package/dist/runtime/components/LibDatePicker/LibSingleDatePicker.vue +215 -164
  37. package/dist/runtime/components/LibDatePicker/LibSingleDatePicker.vue.d.ts +34 -0
  38. package/dist/runtime/components/LibDatePicker/LibTimeZonePicker.vue +9 -10
  39. package/dist/runtime/components/LibDatePicker/LibTimeZonePicker.vue.d.ts +22 -0
  40. package/dist/runtime/components/LibDebug/LibDebug.vue +47 -65
  41. package/dist/runtime/components/LibDebug/LibDebug.vue.d.ts +32 -0
  42. package/dist/runtime/components/LibDevOnly/LibDevOnly.vue +19 -34
  43. package/dist/runtime/components/LibDevOnly/LibDevOnly.vue.d.ts +22 -0
  44. package/dist/runtime/components/LibFileInput/LibFileInput.vue +155 -173
  45. package/dist/runtime/components/LibFileInput/LibFileInput.vue.d.ts +43 -0
  46. package/dist/runtime/components/LibInputDeprecated/LibInputDeprecated.vue +352 -0
  47. package/dist/runtime/components/LibInputDeprecated/LibInputDeprecated.vue.d.ts +165 -0
  48. package/dist/runtime/components/LibLabel/LibLabel.vue +30 -46
  49. package/dist/runtime/components/LibLabel/LibLabel.vue.d.ts +27 -0
  50. package/dist/runtime/components/LibMultiValues/LibMultiValues.vue +50 -66
  51. package/dist/runtime/components/LibMultiValues/LibMultiValues.vue.d.ts +29 -0
  52. package/dist/runtime/components/LibNotifications/LibNotification.vue +48 -56
  53. package/dist/runtime/components/LibNotifications/LibNotification.vue.d.ts +17 -0
  54. package/dist/runtime/components/LibNotifications/LibNotifications.vue +71 -83
  55. package/dist/runtime/components/LibNotifications/LibNotifications.vue.d.ts +13 -0
  56. package/dist/runtime/components/LibPagination/LibPagination.vue +86 -131
  57. package/dist/runtime/components/LibPagination/LibPagination.vue.d.ts +104 -0
  58. package/dist/runtime/components/LibPalette/LibPalette.vue +23 -26
  59. package/dist/runtime/components/LibPalette/LibPalette.vue.d.ts +14 -0
  60. package/dist/runtime/components/LibPopup/LibPopup.vue +326 -400
  61. package/dist/runtime/components/LibPopup/LibPopup.vue.d.ts +46 -0
  62. package/dist/runtime/components/LibProgressBar/LibProgressBar.vue +73 -93
  63. package/dist/runtime/components/LibProgressBar/LibProgressBar.vue.d.ts +41 -0
  64. package/dist/runtime/components/LibRecorder/LibRecorder.vue +134 -179
  65. package/dist/runtime/components/LibRecorder/LibRecorder.vue.d.ts +77 -0
  66. package/dist/runtime/components/LibRoot/LibRoot.vue +75 -89
  67. package/dist/runtime/components/LibRoot/LibRoot.vue.d.ts +41 -0
  68. package/dist/runtime/components/LibSimpleInput/LibSimpleInput.vue +51 -82
  69. package/dist/runtime/components/LibSimpleInput/LibSimpleInput.vue.d.ts +35 -0
  70. package/dist/runtime/components/LibSuggestions/LibSuggestions.vue +147 -164
  71. package/dist/runtime/components/LibSuggestions/LibSuggestions.vue.d.ts +94 -0
  72. package/dist/runtime/components/LibTable/LibTable.vue +69 -106
  73. package/dist/runtime/components/LibTable/LibTable.vue.d.ts +45 -0
  74. package/dist/runtime/components/Template/NAME.vue +15 -36
  75. package/dist/runtime/components/Template/NAME.vue.d.ts +17 -0
  76. package/dist/runtime/components/TestControls/TestControls.vue +7 -10
  77. package/dist/runtime/components/TestControls/TestControls.vue.d.ts +5 -0
  78. package/dist/runtime/components/index.d.ts +12 -11
  79. package/dist/runtime/components/index.js +12 -11
  80. package/dist/runtime/components/shared/props.d.ts +81 -16
  81. package/dist/runtime/components/shared/storyHelpers/playInput.js +5 -5
  82. package/dist/runtime/components/shared/storyHelpers/playSuggestions.js +15 -11
  83. package/dist/runtime/composables/index.d.ts +5 -0
  84. package/dist/runtime/composables/index.js +5 -0
  85. package/dist/runtime/composables/useDivideAttrs.js +1 -0
  86. package/dist/runtime/composables/useDragWithThreshold.d.ts +71 -0
  87. package/dist/runtime/composables/useDragWithThreshold.js +40 -0
  88. package/dist/runtime/composables/usePreHydrationValue.d.ts +12 -0
  89. package/dist/runtime/composables/usePreHydrationValue.js +15 -0
  90. package/dist/runtime/composables/useSetupI18n.d.ts +2 -0
  91. package/dist/runtime/composables/useSetupI18n.js +5 -1
  92. package/dist/runtime/composables/useSuggestions.d.ts +7 -5
  93. package/dist/runtime/composables/useSuggestions.js +94 -57
  94. package/dist/runtime/directives/vResizableCols.js +92 -84
  95. package/dist/runtime/helpers/NotificationHandler.d.ts +5 -0
  96. package/dist/runtime/helpers/index.d.ts +3 -1
  97. package/dist/runtime/helpers/index.js +3 -1
  98. package/dist/runtime/types/index.d.ts +6 -0
  99. package/dist/runtime/utils/notifyIfError.d.ts +14 -0
  100. package/dist/runtime/utils/notifyIfError.js +29 -0
  101. package/dist/types.d.mts +2 -6
  102. package/package.json +27 -29
  103. package/src/module.ts +31 -12
  104. package/src/runtime/assets/base.css +10 -1
  105. package/src/runtime/assets/locales/en.json +2 -2
  106. package/src/runtime/assets/tailwind.css +1 -1
  107. package/src/runtime/assets/{style.css → utils.css} +86 -4
  108. package/src/runtime/build/WitchcraftUiResolver.ts +1 -1
  109. package/src/runtime/components/Focus.stories.ts +3 -2
  110. package/src/runtime/components/Icon/Icon.vue +10 -6
  111. package/src/runtime/components/LibButton/LibButton.vue +41 -47
  112. package/src/runtime/components/LibCheckbox/LibCheckbox.vue +7 -4
  113. package/src/runtime/components/LibColorInput/LibColorInput.vue +111 -37
  114. package/src/runtime/components/LibColorPicker/LibColorPicker.stories.ts +25 -4
  115. package/src/runtime/components/LibColorPicker/LibColorPicker.vue +242 -131
  116. package/src/runtime/components/LibColorPicker/utils/safeConvertToHsva.ts +24 -0
  117. package/src/runtime/components/LibColorPicker/utils/safeConvertToRgba.ts +23 -0
  118. package/src/runtime/components/LibColorPicker/utils/toLowPrecisionRgbaString.ts +13 -0
  119. package/src/runtime/components/LibColorPicker/utils/truncate.ts +6 -0
  120. package/src/runtime/components/LibDarkModeSwitcher/LibDarkModeSwitcher.stories.ts +1 -1
  121. package/src/runtime/components/LibDarkModeSwitcher/LibDarkModeSwitcher.vue +11 -9
  122. package/src/runtime/components/LibDatePicker/LibDatePicker.vue +4 -17
  123. package/src/runtime/components/LibDatePicker/LibRangeDatePicker.vue +192 -131
  124. package/src/runtime/components/LibDatePicker/LibSingleDatePicker.vue +183 -115
  125. package/src/runtime/components/LibDatePicker/LibTimeZonePicker.vue +3 -3
  126. package/src/runtime/components/LibDebug/LibDebug.vue +15 -5
  127. package/src/runtime/components/LibDevOnly/LibDevOnly.vue +1 -3
  128. package/src/runtime/components/LibFileInput/LibFileInput.vue +54 -29
  129. package/src/runtime/components/{LibInput/LibInput.stories.ts → LibInputDeprecated/LibInputDeprecated.stories.ts} +64 -19
  130. package/{dist/runtime/components/LibInput/LibInput.vue → src/runtime/components/LibInputDeprecated/LibInputDeprecated.vue} +40 -34
  131. package/src/runtime/components/LibLabel/LibLabel.vue +2 -2
  132. package/src/runtime/components/LibMultiValues/LibMultiValues.stories.ts +5 -4
  133. package/src/runtime/components/LibMultiValues/LibMultiValues.vue +11 -13
  134. package/src/runtime/components/LibNotifications/LibNotification.vue +19 -11
  135. package/src/runtime/components/LibNotifications/LibNotifications.stories.ts +2 -2
  136. package/src/runtime/components/LibNotifications/LibNotifications.vue +20 -12
  137. package/src/runtime/components/LibPagination/LibPagination.stories.ts +2 -2
  138. package/src/runtime/components/LibPagination/LibPagination.vue +19 -20
  139. package/src/runtime/components/LibPalette/LibPalette.vue +3 -3
  140. package/src/runtime/components/LibPopup/LibPopup.stories.ts +2 -2
  141. package/src/runtime/components/LibPopup/LibPopup.vue +30 -67
  142. package/src/runtime/components/LibProgressBar/LibProgressBar.vue +3 -2
  143. package/src/runtime/components/LibRecorder/LibRecorder.vue +2 -3
  144. package/src/runtime/components/LibRoot/LibRoot.vue +14 -1
  145. package/src/runtime/components/LibSimpleInput/LibSimpleInput.stories.ts +1 -1
  146. package/src/runtime/components/LibSimpleInput/LibSimpleInput.vue +5 -8
  147. package/src/runtime/components/LibSuggestions/LibSuggestions.vue +42 -26
  148. package/src/runtime/components/LibTable/LibTable.vue +8 -9
  149. package/src/runtime/components/Scrolling.stories.ts +58 -0
  150. package/src/runtime/components/Template/NAME.vue +1 -1
  151. package/src/runtime/components/TestControls/TestControls.vue +1 -1
  152. package/src/runtime/components/index.ts +12 -12
  153. package/src/runtime/components/shared/props.ts +82 -19
  154. package/src/runtime/components/shared/storyHelpers/playInput.ts +6 -5
  155. package/src/runtime/components/shared/storyHelpers/playSuggestions.ts +25 -11
  156. package/src/runtime/composables/index.ts +5 -0
  157. package/src/runtime/composables/useDarkMode.ts +2 -2
  158. package/src/runtime/composables/useDivideAttrs.ts +1 -0
  159. package/src/runtime/composables/useDragWithThreshold.ts +108 -0
  160. package/src/runtime/composables/usePreHydrationValue.ts +30 -0
  161. package/src/runtime/composables/useSetupI18n.ts +8 -2
  162. package/src/runtime/composables/useSuggestions.ts +92 -45
  163. package/src/runtime/directives/vResizableCols.ts +82 -74
  164. package/src/runtime/helpers/NotificationHandler.ts +5 -0
  165. package/src/runtime/helpers/index.ts +3 -1
  166. package/src/runtime/types/index.ts +5 -0
  167. package/src/runtime/utils/notifyIfError.ts +45 -0
  168. package/dist/module.cjs +0 -5
  169. package/dist/module.d.ts +0 -34
  170. package/dist/runtime/assets/style.css +0 -1
  171. package/dist/runtime/components/Focus.stories.d.ts +0 -11
  172. package/dist/runtime/components/Focus.stories.js +0 -53
  173. package/dist/runtime/components/LibButton/LibButton.stories.d.ts +0 -12
  174. package/dist/runtime/components/LibButton/LibButton.stories.js +0 -94
  175. package/dist/runtime/components/LibCheckbox/LibCheckbox.stories.d.ts +0 -14
  176. package/dist/runtime/components/LibCheckbox/LibCheckbox.stories.js +0 -29
  177. package/dist/runtime/components/LibColorInput/LibColorInput.stories.d.ts +0 -7
  178. package/dist/runtime/components/LibColorInput/LibColorInput.stories.js +0 -58
  179. package/dist/runtime/components/LibColorPicker/LibColorPicker.stories.d.ts +0 -7
  180. package/dist/runtime/components/LibColorPicker/LibColorPicker.stories.js +0 -51
  181. package/dist/runtime/components/LibDarkModeSwitcher/LibDarkModeSwitcher.stories.d.ts +0 -7
  182. package/dist/runtime/components/LibDarkModeSwitcher/LibDarkModeSwitcher.stories.js +0 -36
  183. package/dist/runtime/components/LibDatePicker/LibDatePicker.stories.d.ts +0 -11
  184. package/dist/runtime/components/LibDatePicker/LibDatePicker.stories.js +0 -98
  185. package/dist/runtime/components/LibDebug/LibDebug.stories.d.ts +0 -9
  186. package/dist/runtime/components/LibDebug/LibDebug.stories.js +0 -46
  187. package/dist/runtime/components/LibFileInput/LibFileInput.stories.d.ts +0 -10
  188. package/dist/runtime/components/LibFileInput/LibFileInput.stories.js +0 -63
  189. package/dist/runtime/components/LibInput/LibInput.stories.d.ts +0 -33
  190. package/dist/runtime/components/LibInput/LibInput.stories.js +0 -339
  191. package/dist/runtime/components/LibLabel/LibLabel.stories.d.ts +0 -6
  192. package/dist/runtime/components/LibLabel/LibLabel.stories.js +0 -25
  193. package/dist/runtime/components/LibMultiValues/LibMultiValues.stories.d.ts +0 -23
  194. package/dist/runtime/components/LibMultiValues/LibMultiValues.stories.js +0 -60
  195. package/dist/runtime/components/LibNotifications/LibNotification.stories.d.ts +0 -15
  196. package/dist/runtime/components/LibNotifications/LibNotification.stories.js +0 -126
  197. package/dist/runtime/components/LibNotifications/LibNotifications.stories.d.ts +0 -6
  198. package/dist/runtime/components/LibNotifications/LibNotifications.stories.js +0 -109
  199. package/dist/runtime/components/LibPagination/LibPagination.stories.d.ts +0 -6
  200. package/dist/runtime/components/LibPagination/LibPagination.stories.js +0 -40
  201. package/dist/runtime/components/LibPalette/LibPalette.stories.d.ts +0 -6
  202. package/dist/runtime/components/LibPalette/LibPalette.stories.js +0 -20
  203. package/dist/runtime/components/LibPopup/LibPopup.stories.d.ts +0 -14
  204. package/dist/runtime/components/LibPopup/LibPopup.stories.js +0 -147
  205. package/dist/runtime/components/LibProgressBar/LibProgressBar.stories.d.ts +0 -10
  206. package/dist/runtime/components/LibProgressBar/LibProgressBar.stories.js +0 -81
  207. package/dist/runtime/components/LibRecorder/LibRecorder.stories.d.ts +0 -19
  208. package/dist/runtime/components/LibRecorder/LibRecorder.stories.js +0 -63
  209. package/dist/runtime/components/LibSimpleInput/LibSimpleInput.stories.d.ts +0 -26
  210. package/dist/runtime/components/LibSimpleInput/LibSimpleInput.stories.js +0 -78
  211. package/dist/runtime/components/LibSuggestions/LibSuggestions.stories.d.ts +0 -27
  212. package/dist/runtime/components/LibSuggestions/LibSuggestions.stories.js +0 -112
  213. package/dist/runtime/components/LibTable/LibTable.stories.d.ts +0 -16
  214. package/dist/runtime/components/LibTable/LibTable.stories.js +0 -156
  215. package/dist/runtime/components/reset.stories.d.ts +0 -5
  216. package/dist/runtime/components/reset.stories.js +0 -19
  217. package/dist/runtime/composables/useScrollNearContainerEdges.stories.d.ts +0 -7
  218. package/dist/runtime/composables/useScrollNearContainerEdges.stories.js +0 -85
  219. package/dist/runtime/helpers/addValue.d.ts +0 -1
  220. package/dist/runtime/helpers/addValue.js +0 -8
  221. package/dist/types.d.ts +0 -7
  222. package/src/runtime/components/LibInput/LibInput.vue +0 -372
  223. package/src/runtime/helpers/addValue.ts +0 -10
  224. /package/src/runtime/components/{reset.stories.ts → Reset.stories.ts} +0 -0
@@ -1,29 +1,30 @@
1
1
  <template>
2
2
  <button
3
3
  :id="id ?? fallbackId"
4
- :class="!($attrs as any).unstyle && twMerge(`
5
- button
6
- flex
7
- cursor-pointer
8
- items-center
9
- justify-center
10
- rounded-sm
11
- px-1
12
- hover:cursor-pointer
13
- [&:hover_*]:cursor-pointer
14
- focus-outline
15
- disabled:shadow-none
16
- disabled:text-neutral-500
17
- disabled:cursor-default
18
- text-fg
19
- hover:text-accent-700
20
- dark:text-bg
21
- dark:hover:text-accent-500
22
- dark:disabled:text-neutral-500
23
- dark:disabled:hover:text-neutral-500
24
- `,
25
- !color && `active:text-neutral-800` /* todo for colors */,
26
- border && `
4
+ :class="!$attrs.unstyle && twMerge(
5
+ `
6
+ button
7
+ flex
8
+ cursor-pointer
9
+ items-center
10
+ justify-center
11
+ rounded-sm
12
+ px-1
13
+ hover:cursor-pointer
14
+ [&:hover_*]:cursor-pointer
15
+ focus-outline
16
+ disabled:shadow-none
17
+ disabled:text-neutral-500
18
+ disabled:cursor-default
19
+ text-fg
20
+ hover:text-accent-700
21
+ dark:text-bg
22
+ dark:hover:text-accent-500
23
+ dark:disabled:text-neutral-500
24
+ dark:disabled:hover:text-neutral-500
25
+ `,
26
+ !color && `active:text-neutral-800`,
27
+ border && `
27
28
  transition-all
28
29
  bg-neutral-100
29
30
  dark:bg-neutral-900
@@ -31,11 +32,11 @@
31
32
  shadow-neutral-950/20
32
33
  hover:shadow-[0_1px_3px_0]
33
34
  hover:shadow-neutral-950/30
34
- hover:border-neutral-300
35
-
35
+ hover:border-neutral-200
36
+ dark:hover:border-neutral-800
36
37
  relative
37
38
  after:absolute
38
- after:rounded-sm
39
+ after:rounded-xs
39
40
  after:inset-0
40
41
  after:content
41
42
  after:shadow-[0_1px_0_0_inset]
@@ -45,15 +46,13 @@
45
46
  dark:hover:after:shadow-bg/50
46
47
  after:pointer-events-none
47
48
  after:mix-blend-overlay
48
-
49
- active:shadow-inner
49
+ active:inset-shadow
50
50
  active:shadow-fg/20
51
51
  active:border-transparent
52
52
  border
53
- border-neutral-400
53
+ border-neutral-300
54
54
  disabled:border-neutral-200
55
55
  disabled:bg-neutral-50
56
-
57
56
  dark:hover:shadow-accent-950/30
58
57
  dark:active:shadow-fg/40
59
58
  dark:active:border-neutral-900
@@ -62,37 +61,37 @@
62
61
  dark:disabled:border-neutral-800
63
62
  dark:disabled:bg-neutral-900
64
63
  `,
65
- border && ( !color || color === `secondary` ) && `
64
+ border && (!color || color === `secondary`) && `
66
65
  after:shadow-bg/90
67
66
  hover:after:shadow-bg
68
67
  dark:after:shadow-bg/20
69
68
  dark:hover:after:shadow-bg/90
70
69
  `,
71
- !border && color === `primary` && `
70
+ !border && color === `primary` && `
72
71
  font-bold
73
72
  hover:text-accent-50
74
73
  `,
75
- !border && color === `ok` && `
74
+ !border && color === `ok` && `
76
75
  text-ok-600 hover:text-ok-500
77
76
  dark:text-ok-600 dark:hover:text-ok-500
78
77
  `,
79
- !border && color === `warning` && `
78
+ !border && color === `warning` && `
80
79
  text-warning-500 hover:text-warning-300
81
80
  dark:text-warning-600 dark:hover:text-warning-400
82
81
  `,
83
- !border && color === `danger` && `
82
+ !border && color === `danger` && `
84
83
  text-danger-500 hover:text-danger-300
85
84
  dark:text-danger-600 dark:hover:text-danger-400
86
85
  `,
87
- !border && color === `secondary` && `
86
+ !border && color === `secondary` && `
88
87
  text-accent-700 hover:text-accent-500
89
88
  dark:text-accent-600 dark:hover:text-accent-400
90
89
  `,
91
- !border && color === `primary` && `
90
+ !border && color === `primary` && `
92
91
  text-accent-700 hover:text-accent-500
93
92
  dark:text-accent-600 dark:hover:text-accent-400
94
93
  `,
95
- border && color === `ok` && `
94
+ border && color === `ok` && `
96
95
  text-ok-950
97
96
  hover:text-ok-800
98
97
  bg-ok-400
@@ -107,7 +106,7 @@
107
106
  dark:hover:border-ok-900
108
107
  dark:hover:shadow-ok-900/30
109
108
  `,
110
- border && color === `warning` && `
109
+ border && color === `warning` && `
111
110
  text-warning-950
112
111
  hover:text-warning-900
113
112
  bg-warning-300
@@ -121,7 +120,7 @@
121
120
  dark:border-warning-700
122
121
  dark:hover:shadow-warning-900/25
123
122
  `,
124
- border && color === `danger` && `
123
+ border && color === `danger` && `
125
124
  text-danger-950
126
125
  hover:text-danger-900
127
126
  bg-danger-400
@@ -135,11 +134,11 @@
135
134
  dark:border-danger-950
136
135
  dark:hover:shadow-ranger-500/10
137
136
  `,
138
- border && color === `secondary` && `
137
+ border && color === `secondary` && `
139
138
  text-accent-800
140
139
  dark:text-accent-400
141
140
  `,
142
- border && color === `primary` && `
141
+ border && color === `primary` && `
143
142
  text-bg
144
143
  hover:text-bg
145
144
  bg-accent-600
@@ -154,94 +153,71 @@
154
153
  dark:hover:border-accent-700
155
154
  dark:hover:shadow-accent-900/50
156
155
  `,
157
- ($attrs as any)?.class
158
- )"
159
- :type="$attrs.type as any ?? 'submit'"
156
+ $attrs?.class
157
+ )"
158
+ :type="$attrs.type"
160
159
  :tabindex="0"
161
160
  :disabled="disabled"
162
161
  :data-border="border"
163
162
  :data-color="color"
164
163
  :aria-disabled="disabled"
165
164
  v-bind="{
166
- ...autoTitle,
167
- ...$attrs,
168
- class: undefined,
169
- ...ariaLabel,
170
- }"
165
+ ...autoTitle,
166
+ ...$attrs,
167
+ class: void 0,
168
+ ...ariaLabel
169
+ }"
171
170
  >
172
- <label :id="`label-${id ?? fallbackId}`" class="label pointer-events-none flex flex-1 items-center justify-center gap-1">
173
- <slot name="icon"/>
174
- <slot
175
- v-bind="{ label}"
176
- >
177
- <span v-if="label && !isBlank(label!)">
178
- {{ label }}
179
- </span>
180
- </slot>
181
- <slot name="icon-after"/>
182
- </label>
171
+ <slot name="label" v-bind="{ id: `label-${id ?? fallbackId}`, classes: 'button--label pointer-events-none flex flex-1 items-center justify-center gap-1' }">
172
+ <label :id="`label-${id ?? fallbackId}`" class="button--label pointer-events-none flex flex-1 items-center justify-center gap-1">
173
+ <slot name="icon"/>
174
+ <slot
175
+ v-bind="{ label }"
176
+ >
177
+ <span v-if="label && !isBlank(label)">
178
+ {{ label }}
179
+ </span>
180
+ </slot>
181
+ <slot name="icon-after"/>
182
+ </label>
183
+ </slot>
183
184
  </button>
184
185
  </template>
185
186
 
186
- <script setup lang="ts">
187
- import { isBlank } from "@alanscodelog/utils/isBlank.js"
188
- import { keys } from "@alanscodelog/utils/keys.js"
189
- import { pick } from "@alanscodelog/utils/pick.js"
190
- import type { MakeRequired } from "@alanscodelog/utils/types"
191
- import { type ButtonHTMLAttributes,computed, type HTMLAttributes, type PropType,useAttrs } from "vue"
192
-
193
- import { useAriaLabel } from "../../composables/useAriaLabel.js"
194
- import { useDivideAttrs } from "../../composables/useDivideAttrs.js"
195
- import { twMerge } from "../../utils/twMerge.js"
196
- import { type BaseInteractiveProps, baseInteractiveProps, baseInteractivePropsDefaults, getFallbackId,type LabelProps, type LinkableByIdProps, type TailwindClassProp, type WrapperProps } from "../shared/props.js"
197
-
198
-
199
- const $attrs = useAttrs()
200
-
201
-
187
+ <script setup>
188
+ import { isBlank } from "@alanscodelog/utils/isBlank.js";
189
+ import { keys } from "@alanscodelog/utils/keys.js";
190
+ import { pick } from "@alanscodelog/utils/pick.js";
191
+ import { computed, useAttrs } from "vue";
192
+ import { useAriaLabel } from "../../composables/useAriaLabel.js";
193
+ import { useDivideAttrs } from "../../composables/useDivideAttrs.js";
194
+ import { twMerge } from "../../utils/twMerge.js";
195
+ import { baseInteractiveProps, baseInteractivePropsDefaults, getFallbackId } from "../shared/props.js";
196
+ const $attrs = useAttrs();
202
197
  defineOptions({
203
- name: "lib-button",
204
- })
205
-
206
- const fallbackId = getFallbackId()
207
-
208
- // eslint-disable-next-line no-use-before-define
209
- const props = withDefaults(defineProps<Props>(), {
210
- color: false,
211
- label: "",
212
- ...baseInteractivePropsDefaults
213
- })
214
-
215
-
216
- const ariaLabel = useAriaLabel(props, fallbackId)
198
+ name: "lib-button"
199
+ });
200
+ const fallbackId = getFallbackId();
201
+ const props = defineProps(/* @__PURE__ */ _mergeDefaults({
202
+ id: { type: String, required: false },
203
+ label: { type: String, required: false },
204
+ disabled: { type: Boolean, required: false },
205
+ readonly: { type: Boolean, required: false },
206
+ border: { type: Boolean, required: false },
207
+ unstyle: { type: Boolean, required: false },
208
+ color: { type: [String, Boolean], required: false },
209
+ autoTitleFromAria: { type: Boolean, required: false }
210
+ }, {
211
+ color: false,
212
+ label: "",
213
+ ...baseInteractivePropsDefaults
214
+ }));
215
+ const ariaLabel = useAriaLabel(props, fallbackId);
217
216
  const autoTitle = computed(() => ({
218
- title: props.autoTitleFromAria
219
- ? ($attrs["aria-label"] ?? props.label) as string
220
- : undefined,
221
- }))
222
-
217
+ title: props.autoTitleFromAria ? $attrs["aria-label"] ?? props.label : void 0
218
+ }));
223
219
  </script>
224
220
 
225
- <script lang="ts">
226
- type RealProps =
227
- & LinkableByIdProps
228
- & LabelProps
229
- & BaseInteractiveProps
230
- & {
231
- border?: boolean
232
- color?: "warning" | "ok" | "danger" | "primary" | "secondary" | false
233
- label?: string
234
- autoTitleFromAria?: boolean
235
- }
221
+ <script>
236
222
 
237
- interface Props
238
- extends
239
- /** @vue-ignore */
240
- Partial<Omit<ButtonHTMLAttributes,"class" | "color" | "disabled">
241
- & TailwindClassProp
242
- & {
243
- // why is this not already a part of button?
244
- "aria-label": string
245
- }>,
246
- RealProps {}
247
223
  </script>
@@ -0,0 +1,36 @@
1
+ import { type ButtonHTMLAttributes } from "vue";
2
+ import { type BaseInteractiveProps, type ButtonProps, type LabelProps, type LinkableByIdProps, type TailwindClassProp } from "../shared/props.js.js";
3
+ type RealProps = LinkableByIdProps & LabelProps & BaseInteractiveProps & ButtonProps;
4
+ interface Props extends
5
+ /** @vue-ignore */
6
+ Partial<Omit<ButtonHTMLAttributes, "class" | "color" | "disabled"> & TailwindClassProp & {
7
+ "aria-label": string;
8
+ }>, RealProps {
9
+ }
10
+ declare const _default: __VLS_WithSlots<import("vue").DefineComponent<Props, void, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<Props> & Readonly<{}>, {
11
+ color: "warning" | "ok" | "danger" | "primary" | "secondary" | false;
12
+ label: string;
13
+ disabled: boolean;
14
+ readonly: boolean;
15
+ border: boolean;
16
+ unstyle: boolean;
17
+ }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>, {
18
+ label?: (props: {
19
+ id: string;
20
+ classes: string;
21
+ }) => any;
22
+ } & {
23
+ icon?: (props: {}) => any;
24
+ } & {
25
+ default?: (props: {
26
+ label: any;
27
+ }) => any;
28
+ } & {
29
+ 'icon-after'?: (props: {}) => any;
30
+ }>;
31
+ export default _default;
32
+ type __VLS_WithSlots<T, S> = T & {
33
+ new (): {
34
+ $slots: S;
35
+ };
36
+ };
@@ -1,31 +1,36 @@
1
1
  <template>
2
2
  <div
3
- :class="twMerge(`
3
+ :class="twMerge(
4
+ `
5
+ checkbox--wrapper
4
6
  flex
5
7
  items-center
6
8
  gap-1
7
9
  `,
8
- ($.wrapperAttrs as any)?.class
9
- )"
10
- v-bind="{ ...$.wrapperAttrs, class: undefined }"
10
+ $.wrapperAttrs?.class
11
+ )"
12
+ v-bind="{ ...$.wrapperAttrs, class: void 0 }"
11
13
  ref="el"
12
14
  >
13
15
  <slot name="left"/>
14
16
  <label
15
- class="flex items-center gap-1"
16
- :class="twMerge(`
17
+ :class="twMerge(
18
+ `
19
+ checkbox--label
17
20
  flex
18
21
  items-center
19
22
  gap-1
20
23
  `,
21
- ($.labelAttrs as any)?.class
22
- )"
23
- v-bind="{ ...$.labelAttrs, class: undefined }"
24
+ $.labelAttrs?.class
25
+ )"
26
+ v-bind="{ ...$.labelAttrs, class: void 0 }"
24
27
  :for="id ?? fallbackId"
25
28
  >
26
29
  <input
27
30
  :id="id ?? fallbackId"
28
- :class="!($attrs as any).unstyle && twMerge(`
31
+ :class="!$attrs.unstyle && twMerge(
32
+ `
33
+ checkbox
29
34
  focus-outline-no-offset
30
35
  m-0
31
36
  p-[0.4em]
@@ -33,7 +38,8 @@
33
38
  dark:bg-fg
34
39
  appearance-none
35
40
  border
36
- border-accent-600
41
+ border-neutral-500
42
+ focus:border-accent-600
37
43
  rounded-sm
38
44
  aspect-square
39
45
  relative
@@ -50,83 +56,54 @@
50
56
  checked:after:bg-accent-700
51
57
  disabled:border-neutral-500
52
58
  disabled:checked:after:bg-neutral-700
53
- `, !disabled && `cursor-pointer`,
54
- ($.attrs as any).class
55
- )"
59
+ `,
60
+ !disabled && `cursor-pointer`,
61
+ $.attrs.class
62
+ )"
56
63
  type="checkbox"
57
64
  :disabled="disabled"
58
65
  ref="inputEl"
59
66
  v-model="$value"
60
- v-bind="{...$.attrs, class: undefined}"
67
+ v-bind="{ ...$.attrs, class: void 0 }"
61
68
  >
62
69
  <slot/> {{ label }}
63
70
  </label>
64
71
  </div>
65
72
  </template>
66
- <script setup lang="ts">
67
- import { keys } from "@alanscodelog/utils/keys.js"
68
- import { omit } from "@alanscodelog/utils/omit.js"
69
- import { pick } from "@alanscodelog/utils/pick.js"
70
- import type { MakeRequired } from "@alanscodelog/utils/types"
71
- import { computed, type HTMLAttributes, type InputHTMLAttributes,type PropType, ref, useAttrs, useSlots } from "vue"
72
-
73
- import { useDivideAttrs } from "../../composables/useDivideAttrs.js"
74
- import { twMerge } from "../../utils/twMerge.js"
75
- import { type BaseInteractiveProps, baseInteractivePropsDefaults, getFallbackId,type LabelProps, type LinkableByIdProps, type TailwindClassProp, type WrapperProps } from "../shared/props.js"
76
73
 
74
+ <script setup>
75
+ import { keys } from "@alanscodelog/utils/keys.js";
76
+ import { omit } from "@alanscodelog/utils/omit.js";
77
+ import { pick } from "@alanscodelog/utils/pick.js";
78
+ import { computed, ref, useAttrs, useSlots } from "vue";
79
+ import { useDivideAttrs } from "../../composables/useDivideAttrs.js";
80
+ import { usePreHydrationValue } from "../../composables/usePreHydrationValue.js";
81
+ import { twMerge } from "../../utils/twMerge.js";
82
+ import { baseInteractivePropsDefaults, getFallbackId } from "../shared/props.js";
77
83
  defineOptions({
78
- name: "lib-checkbox",
79
- inheritAttrs: false,
80
- })
81
-
82
- const $ = useDivideAttrs(["label", "wrapper"])
83
- const $slots = useSlots()
84
- /* todo multi states */
85
-
86
- const fallbackId = getFallbackId()
87
- // eslint-disable-next-line no-use-before-define
88
- const props = withDefaults(defineProps<Props>(), {
89
- ...baseInteractivePropsDefaults,
90
- })
91
-
92
-
93
- const emits = defineEmits<{
94
- /* User presses enter.*/
95
- (e: "submit", val: boolean): void
96
- }>()
97
-
98
- const el = ref<null | HTMLElement>(null)
99
- const inputEl = ref<null | HTMLElement>(null)
100
- const $value = defineModel<boolean>("modelValue", { default: false })
101
-
102
-
84
+ name: "lib-checkbox",
85
+ inheritAttrs: false
86
+ });
87
+ const $ = useDivideAttrs(["label", "wrapper"]);
88
+ const $slots = useSlots();
89
+ const fallbackId = getFallbackId();
90
+ const props = defineProps(/* @__PURE__ */ _mergeDefaults({
91
+ id: { type: String, required: false },
92
+ label: { type: String, required: false },
93
+ disabled: { type: Boolean, required: false },
94
+ readonly: { type: Boolean, required: false },
95
+ border: { type: Boolean, required: false },
96
+ unstyle: { type: Boolean, required: false }
97
+ }, {
98
+ ...baseInteractivePropsDefaults
99
+ }));
100
+ const emits = defineEmits(["submit"]);
101
+ const el = ref(null);
102
+ const inputEl = ref(null);
103
+ const $value = defineModel("modelValue", { type: Boolean, ...{ default: false } });
104
+ usePreHydrationValue(props.id ?? fallbackId, $value);
103
105
  </script>
104
106
 
105
- <script lang="ts">
106
-
107
- type WrapperTypes = Partial<WrapperProps<"label",HTMLAttributes, {
108
- /** Tailwind classes. */
109
- class?: string
110
- }>>
111
-
112
- type RealProps =
113
-
114
- & LinkableByIdProps
115
- & LabelProps
116
- & BaseInteractiveProps
117
- & {
118
- unstyle?: boolean
119
- }
107
+ <script>
120
108
 
121
- interface Props
122
- extends
123
- /** @vue-ignore */
124
- Partial<Omit<
125
- InputHTMLAttributes,
126
- "class" | "readonly" | "disabled" | "onSumbit"
127
- > & TailwindClassProp>,
128
- /** @vue-ignore */
129
- WrapperTypes,
130
- RealProps
131
- {}
132
109
  </script>
@@ -0,0 +1,42 @@
1
+ import { type HTMLAttributes, type InputHTMLAttributes } from "vue";
2
+ import { type BaseInteractiveProps, type LabelProps, type LinkableByIdProps, type TailwindClassProp, type WrapperProps } from "../shared/props.js.js";
3
+ type WrapperTypes = Partial<WrapperProps<"label", HTMLAttributes, {
4
+ /** Tailwind classes. */
5
+ class?: string;
6
+ }>>;
7
+ type RealProps = LinkableByIdProps & LabelProps & BaseInteractiveProps & {
8
+ unstyle?: boolean;
9
+ };
10
+ interface Props extends
11
+ /** @vue-ignore */
12
+ Partial<Omit<InputHTMLAttributes, "class" | "readonly" | "disabled" | "onSumbit"> & TailwindClassProp>,
13
+ /** @vue-ignore */
14
+ WrapperTypes, RealProps {
15
+ }
16
+ declare const _default: __VLS_WithSlots<import("vue").DefineComponent<Props & {
17
+ modelValue?: boolean;
18
+ }, void, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
19
+ "update:modelValue": (value: boolean) => any;
20
+ } & {
21
+ submit: (val: boolean) => any;
22
+ }, string, import("vue").PublicProps, Readonly<Props & {
23
+ modelValue?: boolean;
24
+ }> & Readonly<{
25
+ onSubmit?: ((val: boolean) => any) | undefined;
26
+ "onUpdate:modelValue"?: ((value: boolean) => any) | undefined;
27
+ }>, {
28
+ disabled: boolean;
29
+ readonly: boolean;
30
+ border: boolean;
31
+ unstyle: boolean;
32
+ }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>, {
33
+ left?: (props: {}) => any;
34
+ } & {
35
+ default?: (props: {}) => any;
36
+ }>;
37
+ export default _default;
38
+ type __VLS_WithSlots<T, S> = T & {
39
+ new (): {
40
+ $slots: S;
41
+ };
42
+ };