@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.
- package/README.md +18 -28
- package/dist/module.d.mts +3 -1
- package/dist/module.json +3 -3
- package/dist/module.mjs +21 -12
- package/dist/runtime/assets/base.css +1 -1
- package/dist/runtime/assets/locales/en.json +2 -2
- package/dist/runtime/assets/tailwind.css +1 -1
- package/dist/runtime/assets/utils.css +1 -0
- package/dist/runtime/build/WitchcraftUiResolver.js +1 -1
- package/dist/runtime/components/Aria/Aria.vue +5 -9
- package/dist/runtime/components/Aria/Aria.vue.d.ts +5 -0
- package/dist/runtime/components/Icon/Icon.vue +12 -28
- package/dist/runtime/components/Icon/Icon.vue.d.ts +21 -0
- package/dist/runtime/components/LibButton/LibButton.vue +93 -117
- package/dist/runtime/components/LibButton/LibButton.vue.d.ts +36 -0
- package/dist/runtime/components/LibCheckbox/LibCheckbox.vue +53 -76
- package/dist/runtime/components/LibCheckbox/LibCheckbox.vue.d.ts +42 -0
- package/dist/runtime/components/LibColorInput/LibColorInput.vue +131 -101
- package/dist/runtime/components/LibColorInput/LibColorInput.vue.d.ts +63 -0
- package/dist/runtime/components/LibColorPicker/LibColorPicker.vue +326 -296
- package/dist/runtime/components/LibColorPicker/LibColorPicker.vue.d.ts +61 -0
- package/dist/runtime/components/LibColorPicker/utils/safeConvertToHsva.d.ts +2 -0
- package/dist/runtime/components/LibColorPicker/utils/safeConvertToHsva.js +18 -0
- package/dist/runtime/components/LibColorPicker/utils/safeConvertToRgba.d.ts +2 -0
- package/dist/runtime/components/LibColorPicker/utils/safeConvertToRgba.js +17 -0
- package/dist/runtime/components/LibColorPicker/utils/toLowPrecisionRgbaString.d.ts +2 -0
- package/dist/runtime/components/LibColorPicker/utils/toLowPrecisionRgbaString.js +8 -0
- package/dist/runtime/components/LibColorPicker/utils/truncate.d.ts +1 -0
- package/dist/runtime/components/LibColorPicker/utils/truncate.js +5 -0
- package/dist/runtime/components/LibDarkModeSwitcher/LibDarkModeSwitcher.vue +42 -64
- package/dist/runtime/components/LibDarkModeSwitcher/LibDarkModeSwitcher.vue.d.ts +22 -0
- package/dist/runtime/components/LibDatePicker/LibDatePicker.vue +20 -54
- package/dist/runtime/components/LibDatePicker/LibDatePicker.vue.d.ts +40 -0
- package/dist/runtime/components/LibDatePicker/LibRangeDatePicker.vue +205 -173
- package/dist/runtime/components/LibDatePicker/LibRangeDatePicker.vue.d.ts +34 -0
- package/dist/runtime/components/LibDatePicker/LibSingleDatePicker.vue +215 -164
- package/dist/runtime/components/LibDatePicker/LibSingleDatePicker.vue.d.ts +34 -0
- package/dist/runtime/components/LibDatePicker/LibTimeZonePicker.vue +9 -10
- package/dist/runtime/components/LibDatePicker/LibTimeZonePicker.vue.d.ts +22 -0
- package/dist/runtime/components/LibDebug/LibDebug.vue +47 -65
- package/dist/runtime/components/LibDebug/LibDebug.vue.d.ts +32 -0
- package/dist/runtime/components/LibDevOnly/LibDevOnly.vue +19 -34
- package/dist/runtime/components/LibDevOnly/LibDevOnly.vue.d.ts +22 -0
- package/dist/runtime/components/LibFileInput/LibFileInput.vue +155 -173
- package/dist/runtime/components/LibFileInput/LibFileInput.vue.d.ts +43 -0
- package/dist/runtime/components/LibInputDeprecated/LibInputDeprecated.vue +352 -0
- package/dist/runtime/components/LibInputDeprecated/LibInputDeprecated.vue.d.ts +165 -0
- package/dist/runtime/components/LibLabel/LibLabel.vue +30 -46
- package/dist/runtime/components/LibLabel/LibLabel.vue.d.ts +27 -0
- package/dist/runtime/components/LibMultiValues/LibMultiValues.vue +50 -66
- package/dist/runtime/components/LibMultiValues/LibMultiValues.vue.d.ts +29 -0
- package/dist/runtime/components/LibNotifications/LibNotification.vue +48 -56
- package/dist/runtime/components/LibNotifications/LibNotification.vue.d.ts +17 -0
- package/dist/runtime/components/LibNotifications/LibNotifications.vue +71 -83
- package/dist/runtime/components/LibNotifications/LibNotifications.vue.d.ts +13 -0
- package/dist/runtime/components/LibPagination/LibPagination.vue +86 -131
- package/dist/runtime/components/LibPagination/LibPagination.vue.d.ts +104 -0
- package/dist/runtime/components/LibPalette/LibPalette.vue +23 -26
- package/dist/runtime/components/LibPalette/LibPalette.vue.d.ts +14 -0
- package/dist/runtime/components/LibPopup/LibPopup.vue +326 -400
- package/dist/runtime/components/LibPopup/LibPopup.vue.d.ts +46 -0
- package/dist/runtime/components/LibProgressBar/LibProgressBar.vue +73 -93
- package/dist/runtime/components/LibProgressBar/LibProgressBar.vue.d.ts +41 -0
- package/dist/runtime/components/LibRecorder/LibRecorder.vue +134 -179
- package/dist/runtime/components/LibRecorder/LibRecorder.vue.d.ts +77 -0
- package/dist/runtime/components/LibRoot/LibRoot.vue +75 -89
- package/dist/runtime/components/LibRoot/LibRoot.vue.d.ts +41 -0
- package/dist/runtime/components/LibSimpleInput/LibSimpleInput.vue +51 -82
- package/dist/runtime/components/LibSimpleInput/LibSimpleInput.vue.d.ts +35 -0
- package/dist/runtime/components/LibSuggestions/LibSuggestions.vue +147 -164
- package/dist/runtime/components/LibSuggestions/LibSuggestions.vue.d.ts +94 -0
- package/dist/runtime/components/LibTable/LibTable.vue +69 -106
- package/dist/runtime/components/LibTable/LibTable.vue.d.ts +45 -0
- package/dist/runtime/components/Template/NAME.vue +15 -36
- package/dist/runtime/components/Template/NAME.vue.d.ts +17 -0
- package/dist/runtime/components/TestControls/TestControls.vue +7 -10
- package/dist/runtime/components/TestControls/TestControls.vue.d.ts +5 -0
- package/dist/runtime/components/index.d.ts +12 -11
- package/dist/runtime/components/index.js +12 -11
- package/dist/runtime/components/shared/props.d.ts +81 -16
- package/dist/runtime/components/shared/storyHelpers/playInput.js +5 -5
- package/dist/runtime/components/shared/storyHelpers/playSuggestions.js +15 -11
- package/dist/runtime/composables/index.d.ts +5 -0
- package/dist/runtime/composables/index.js +5 -0
- package/dist/runtime/composables/useDivideAttrs.js +1 -0
- package/dist/runtime/composables/useDragWithThreshold.d.ts +71 -0
- package/dist/runtime/composables/useDragWithThreshold.js +40 -0
- package/dist/runtime/composables/usePreHydrationValue.d.ts +12 -0
- package/dist/runtime/composables/usePreHydrationValue.js +15 -0
- package/dist/runtime/composables/useSetupI18n.d.ts +2 -0
- package/dist/runtime/composables/useSetupI18n.js +5 -1
- package/dist/runtime/composables/useSuggestions.d.ts +7 -5
- package/dist/runtime/composables/useSuggestions.js +94 -57
- package/dist/runtime/directives/vResizableCols.js +92 -84
- package/dist/runtime/helpers/NotificationHandler.d.ts +5 -0
- package/dist/runtime/helpers/index.d.ts +3 -1
- package/dist/runtime/helpers/index.js +3 -1
- package/dist/runtime/types/index.d.ts +6 -0
- package/dist/runtime/utils/notifyIfError.d.ts +14 -0
- package/dist/runtime/utils/notifyIfError.js +29 -0
- package/dist/types.d.mts +2 -6
- package/package.json +27 -29
- package/src/module.ts +31 -12
- package/src/runtime/assets/base.css +10 -1
- package/src/runtime/assets/locales/en.json +2 -2
- package/src/runtime/assets/tailwind.css +1 -1
- package/src/runtime/assets/{style.css → utils.css} +86 -4
- package/src/runtime/build/WitchcraftUiResolver.ts +1 -1
- package/src/runtime/components/Focus.stories.ts +3 -2
- package/src/runtime/components/Icon/Icon.vue +10 -6
- package/src/runtime/components/LibButton/LibButton.vue +41 -47
- package/src/runtime/components/LibCheckbox/LibCheckbox.vue +7 -4
- package/src/runtime/components/LibColorInput/LibColorInput.vue +111 -37
- package/src/runtime/components/LibColorPicker/LibColorPicker.stories.ts +25 -4
- package/src/runtime/components/LibColorPicker/LibColorPicker.vue +242 -131
- package/src/runtime/components/LibColorPicker/utils/safeConvertToHsva.ts +24 -0
- package/src/runtime/components/LibColorPicker/utils/safeConvertToRgba.ts +23 -0
- package/src/runtime/components/LibColorPicker/utils/toLowPrecisionRgbaString.ts +13 -0
- package/src/runtime/components/LibColorPicker/utils/truncate.ts +6 -0
- package/src/runtime/components/LibDarkModeSwitcher/LibDarkModeSwitcher.stories.ts +1 -1
- package/src/runtime/components/LibDarkModeSwitcher/LibDarkModeSwitcher.vue +11 -9
- package/src/runtime/components/LibDatePicker/LibDatePicker.vue +4 -17
- package/src/runtime/components/LibDatePicker/LibRangeDatePicker.vue +192 -131
- package/src/runtime/components/LibDatePicker/LibSingleDatePicker.vue +183 -115
- package/src/runtime/components/LibDatePicker/LibTimeZonePicker.vue +3 -3
- package/src/runtime/components/LibDebug/LibDebug.vue +15 -5
- package/src/runtime/components/LibDevOnly/LibDevOnly.vue +1 -3
- package/src/runtime/components/LibFileInput/LibFileInput.vue +54 -29
- package/src/runtime/components/{LibInput/LibInput.stories.ts → LibInputDeprecated/LibInputDeprecated.stories.ts} +64 -19
- package/{dist/runtime/components/LibInput/LibInput.vue → src/runtime/components/LibInputDeprecated/LibInputDeprecated.vue} +40 -34
- package/src/runtime/components/LibLabel/LibLabel.vue +2 -2
- package/src/runtime/components/LibMultiValues/LibMultiValues.stories.ts +5 -4
- package/src/runtime/components/LibMultiValues/LibMultiValues.vue +11 -13
- package/src/runtime/components/LibNotifications/LibNotification.vue +19 -11
- package/src/runtime/components/LibNotifications/LibNotifications.stories.ts +2 -2
- package/src/runtime/components/LibNotifications/LibNotifications.vue +20 -12
- package/src/runtime/components/LibPagination/LibPagination.stories.ts +2 -2
- package/src/runtime/components/LibPagination/LibPagination.vue +19 -20
- package/src/runtime/components/LibPalette/LibPalette.vue +3 -3
- package/src/runtime/components/LibPopup/LibPopup.stories.ts +2 -2
- package/src/runtime/components/LibPopup/LibPopup.vue +30 -67
- package/src/runtime/components/LibProgressBar/LibProgressBar.vue +3 -2
- package/src/runtime/components/LibRecorder/LibRecorder.vue +2 -3
- package/src/runtime/components/LibRoot/LibRoot.vue +14 -1
- package/src/runtime/components/LibSimpleInput/LibSimpleInput.stories.ts +1 -1
- package/src/runtime/components/LibSimpleInput/LibSimpleInput.vue +5 -8
- package/src/runtime/components/LibSuggestions/LibSuggestions.vue +42 -26
- package/src/runtime/components/LibTable/LibTable.vue +8 -9
- package/src/runtime/components/Scrolling.stories.ts +58 -0
- package/src/runtime/components/Template/NAME.vue +1 -1
- package/src/runtime/components/TestControls/TestControls.vue +1 -1
- package/src/runtime/components/index.ts +12 -12
- package/src/runtime/components/shared/props.ts +82 -19
- package/src/runtime/components/shared/storyHelpers/playInput.ts +6 -5
- package/src/runtime/components/shared/storyHelpers/playSuggestions.ts +25 -11
- package/src/runtime/composables/index.ts +5 -0
- package/src/runtime/composables/useDarkMode.ts +2 -2
- package/src/runtime/composables/useDivideAttrs.ts +1 -0
- package/src/runtime/composables/useDragWithThreshold.ts +108 -0
- package/src/runtime/composables/usePreHydrationValue.ts +30 -0
- package/src/runtime/composables/useSetupI18n.ts +8 -2
- package/src/runtime/composables/useSuggestions.ts +92 -45
- package/src/runtime/directives/vResizableCols.ts +82 -74
- package/src/runtime/helpers/NotificationHandler.ts +5 -0
- package/src/runtime/helpers/index.ts +3 -1
- package/src/runtime/types/index.ts +5 -0
- package/src/runtime/utils/notifyIfError.ts +45 -0
- package/dist/module.cjs +0 -5
- package/dist/module.d.ts +0 -34
- package/dist/runtime/assets/style.css +0 -1
- package/dist/runtime/components/Focus.stories.d.ts +0 -11
- package/dist/runtime/components/Focus.stories.js +0 -53
- package/dist/runtime/components/LibButton/LibButton.stories.d.ts +0 -12
- package/dist/runtime/components/LibButton/LibButton.stories.js +0 -94
- package/dist/runtime/components/LibCheckbox/LibCheckbox.stories.d.ts +0 -14
- package/dist/runtime/components/LibCheckbox/LibCheckbox.stories.js +0 -29
- package/dist/runtime/components/LibColorInput/LibColorInput.stories.d.ts +0 -7
- package/dist/runtime/components/LibColorInput/LibColorInput.stories.js +0 -58
- package/dist/runtime/components/LibColorPicker/LibColorPicker.stories.d.ts +0 -7
- package/dist/runtime/components/LibColorPicker/LibColorPicker.stories.js +0 -51
- package/dist/runtime/components/LibDarkModeSwitcher/LibDarkModeSwitcher.stories.d.ts +0 -7
- package/dist/runtime/components/LibDarkModeSwitcher/LibDarkModeSwitcher.stories.js +0 -36
- package/dist/runtime/components/LibDatePicker/LibDatePicker.stories.d.ts +0 -11
- package/dist/runtime/components/LibDatePicker/LibDatePicker.stories.js +0 -98
- package/dist/runtime/components/LibDebug/LibDebug.stories.d.ts +0 -9
- package/dist/runtime/components/LibDebug/LibDebug.stories.js +0 -46
- package/dist/runtime/components/LibFileInput/LibFileInput.stories.d.ts +0 -10
- package/dist/runtime/components/LibFileInput/LibFileInput.stories.js +0 -63
- package/dist/runtime/components/LibInput/LibInput.stories.d.ts +0 -33
- package/dist/runtime/components/LibInput/LibInput.stories.js +0 -339
- package/dist/runtime/components/LibLabel/LibLabel.stories.d.ts +0 -6
- package/dist/runtime/components/LibLabel/LibLabel.stories.js +0 -25
- package/dist/runtime/components/LibMultiValues/LibMultiValues.stories.d.ts +0 -23
- package/dist/runtime/components/LibMultiValues/LibMultiValues.stories.js +0 -60
- package/dist/runtime/components/LibNotifications/LibNotification.stories.d.ts +0 -15
- package/dist/runtime/components/LibNotifications/LibNotification.stories.js +0 -126
- package/dist/runtime/components/LibNotifications/LibNotifications.stories.d.ts +0 -6
- package/dist/runtime/components/LibNotifications/LibNotifications.stories.js +0 -109
- package/dist/runtime/components/LibPagination/LibPagination.stories.d.ts +0 -6
- package/dist/runtime/components/LibPagination/LibPagination.stories.js +0 -40
- package/dist/runtime/components/LibPalette/LibPalette.stories.d.ts +0 -6
- package/dist/runtime/components/LibPalette/LibPalette.stories.js +0 -20
- package/dist/runtime/components/LibPopup/LibPopup.stories.d.ts +0 -14
- package/dist/runtime/components/LibPopup/LibPopup.stories.js +0 -147
- package/dist/runtime/components/LibProgressBar/LibProgressBar.stories.d.ts +0 -10
- package/dist/runtime/components/LibProgressBar/LibProgressBar.stories.js +0 -81
- package/dist/runtime/components/LibRecorder/LibRecorder.stories.d.ts +0 -19
- package/dist/runtime/components/LibRecorder/LibRecorder.stories.js +0 -63
- package/dist/runtime/components/LibSimpleInput/LibSimpleInput.stories.d.ts +0 -26
- package/dist/runtime/components/LibSimpleInput/LibSimpleInput.stories.js +0 -78
- package/dist/runtime/components/LibSuggestions/LibSuggestions.stories.d.ts +0 -27
- package/dist/runtime/components/LibSuggestions/LibSuggestions.stories.js +0 -112
- package/dist/runtime/components/LibTable/LibTable.stories.d.ts +0 -16
- package/dist/runtime/components/LibTable/LibTable.stories.js +0 -156
- package/dist/runtime/components/reset.stories.d.ts +0 -5
- package/dist/runtime/components/reset.stories.js +0 -19
- package/dist/runtime/composables/useScrollNearContainerEdges.stories.d.ts +0 -7
- package/dist/runtime/composables/useScrollNearContainerEdges.stories.js +0 -85
- package/dist/runtime/helpers/addValue.d.ts +0 -1
- package/dist/runtime/helpers/addValue.js +0 -8
- package/dist/types.d.ts +0 -7
- package/src/runtime/components/LibInput/LibInput.vue +0 -372
- package/src/runtime/helpers/addValue.ts +0 -10
- /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="
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
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-
|
|
35
|
-
|
|
35
|
+
hover:border-neutral-200
|
|
36
|
+
dark:hover:border-neutral-800
|
|
36
37
|
relative
|
|
37
38
|
after:absolute
|
|
38
|
-
after:rounded-
|
|
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-
|
|
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
|
-
|
|
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
|
-
|
|
70
|
+
!border && color === `primary` && `
|
|
72
71
|
font-bold
|
|
73
72
|
hover:text-accent-50
|
|
74
73
|
`,
|
|
75
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
137
|
+
border && color === `secondary` && `
|
|
139
138
|
text-accent-800
|
|
140
139
|
dark:text-accent-400
|
|
141
140
|
`,
|
|
142
|
-
|
|
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
|
-
|
|
158
|
-
|
|
159
|
-
:type="$attrs.type
|
|
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
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
165
|
+
...autoTitle,
|
|
166
|
+
...$attrs,
|
|
167
|
+
class: void 0,
|
|
168
|
+
...ariaLabel
|
|
169
|
+
}"
|
|
171
170
|
>
|
|
172
|
-
<label
|
|
173
|
-
<
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
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
|
|
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
|
|
191
|
-
import {
|
|
192
|
-
|
|
193
|
-
import {
|
|
194
|
-
import {
|
|
195
|
-
|
|
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
|
-
|
|
204
|
-
})
|
|
205
|
-
|
|
206
|
-
const
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
}
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
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
|
-
|
|
219
|
-
|
|
220
|
-
: undefined,
|
|
221
|
-
}))
|
|
222
|
-
|
|
217
|
+
title: props.autoTitleFromAria ? $attrs["aria-label"] ?? props.label : void 0
|
|
218
|
+
}));
|
|
223
219
|
</script>
|
|
224
220
|
|
|
225
|
-
<script
|
|
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
|
-
|
|
9
|
-
|
|
10
|
-
v-bind="{ ...$.wrapperAttrs, class:
|
|
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="
|
|
16
|
-
|
|
17
|
+
:class="twMerge(
|
|
18
|
+
`
|
|
19
|
+
checkbox--label
|
|
17
20
|
flex
|
|
18
21
|
items-center
|
|
19
22
|
gap-1
|
|
20
23
|
`,
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
v-bind="{ ...$.labelAttrs, class:
|
|
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="
|
|
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-
|
|
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
|
-
`,
|
|
54
|
-
|
|
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:
|
|
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
|
-
|
|
79
|
-
|
|
80
|
-
})
|
|
81
|
-
|
|
82
|
-
const $ =
|
|
83
|
-
const
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
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
|
|
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
|
+
};
|