@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
package/package.json
CHANGED
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@witchcraft/ui",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.1.1",
|
|
4
4
|
"description": "Vue component library.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/runtime/main.lib.js",
|
|
7
|
-
"types": "./types/index.d.ts",
|
|
8
7
|
"sideEffects": false,
|
|
9
8
|
"exports": {
|
|
10
9
|
".": {
|
|
@@ -13,7 +12,7 @@
|
|
|
13
12
|
},
|
|
14
13
|
"./*": {
|
|
15
14
|
"import": "./dist/runtime/*",
|
|
16
|
-
"types": "./dist/runtime
|
|
15
|
+
"types": "./dist/runtime/*.d.ts"
|
|
17
16
|
},
|
|
18
17
|
"./components": {
|
|
19
18
|
"types": "./dist/runtime/components/index.d.ts",
|
|
@@ -51,11 +50,11 @@
|
|
|
51
50
|
"types": "./dist/runtime/build/*.d.ts",
|
|
52
51
|
"import": "./dist/runtime/build/*"
|
|
53
52
|
},
|
|
54
|
-
"./
|
|
53
|
+
"./utils.css": "./src/runtime/assets/utils.css",
|
|
55
54
|
"./base.css": "./src/runtime/assets/base.css",
|
|
56
55
|
"./nuxt": {
|
|
57
|
-
"
|
|
58
|
-
"
|
|
56
|
+
"types": "./dist/types.d.mts",
|
|
57
|
+
"import": "./dist/module.mjs"
|
|
59
58
|
},
|
|
60
59
|
"./types": {
|
|
61
60
|
"types": "./dist/runtime/types/index.d.ts",
|
|
@@ -68,20 +67,18 @@
|
|
|
68
67
|
"scripts": {
|
|
69
68
|
"//prepare": "echo Needed so that if we pull the package from git it will get built and installed properly.",
|
|
70
69
|
"prepare": "husky && pnpm gen:theme && pnpm build",
|
|
71
|
-
"build": "nuxt-module-build prepare && nuxt-module-build build &&
|
|
72
|
-
"build:playground": "cd playground && pnpm link:module && pnpm generate",
|
|
70
|
+
"build": "nuxt-module-build prepare && nuxt-module-build build && nuxi generate playground",
|
|
73
71
|
"dev:prepare": "nuxt-module-build build --stub && nuxt-module-build prepare && nuxi prepare playground",
|
|
74
72
|
"dev": "nuxi dev playground",
|
|
75
73
|
"storybook": "BROWSER=none storybook dev -p 6006",
|
|
76
74
|
"storybook:clear-cache": "BROWSER=none storybook dev -p 6006 --no-manager-cache",
|
|
77
75
|
"storybook:build": "pnpm nuxt prepare && storybook build -o docs/storybook",
|
|
78
76
|
"storybook:test": "pnpm storybook:build && pnpm concurrently -k -s first -n \"SB,TEST\" -c \"magenta,blue\" \"pnpm http-server docs/storybook --port 6006 --silent\" \"pnpm wait-on tcp:6006 && pnpm test-storybook\"",
|
|
79
|
-
"test": "pnpm storybook:test",
|
|
80
|
-
"test:types": "vue-tsc --noEmit --pretty --project tsconfig.types.json",
|
|
77
|
+
"test": "pnpm storybook:test && pnpm lint:types",
|
|
81
78
|
"doc": "pnpm test && pnpm storybook:build",
|
|
82
79
|
"doc:dev": "pnpm storybook",
|
|
83
|
-
"lint:eslint": "eslint \"
|
|
84
|
-
"lint:types": "
|
|
80
|
+
"lint:eslint": "eslint \"src/**/*.{js,ts,vue,cjs}\" \"*.{js,ts}\" --max-warnings=5 --report-unused-disable-directives",
|
|
81
|
+
"lint:types": "vue-tsc --noEmit --pretty --project tsconfig.types.json",
|
|
85
82
|
"lint:commits": "commitlint --from $(git rev-list --max-parents=0 HEAD) --to HEAD --verbose",
|
|
86
83
|
"lint:imports": "madge --circular --extensions ts ./src",
|
|
87
84
|
"lint": "pnpm lint:types && pnpm lint:eslint",
|
|
@@ -103,19 +100,20 @@
|
|
|
103
100
|
}
|
|
104
101
|
},
|
|
105
102
|
"dependencies": {
|
|
106
|
-
"@alanscodelog/utils": "^5.
|
|
103
|
+
"@alanscodelog/utils": "^5.1.0",
|
|
107
104
|
"@egoist/vue-to-react": "^1.2.0",
|
|
108
105
|
"@iconify/json": "^2.2.323",
|
|
109
|
-
"@nuxt/kit": "^
|
|
110
|
-
"@nuxt/schema": "^
|
|
106
|
+
"@nuxt/kit": "^4.0.1",
|
|
107
|
+
"@nuxt/schema": "^4.0.1",
|
|
111
108
|
"@nuxt/types": "^2.17.3",
|
|
112
109
|
"@tailwindcss/vite": "^4.1.0",
|
|
113
|
-
"@witchcraft/nuxt-utils": "^0.0
|
|
110
|
+
"@witchcraft/nuxt-utils": "^0.1.0",
|
|
114
111
|
"colord": "^2.9.3",
|
|
115
112
|
"colorjs.io": "0.6.0-alpha.1",
|
|
116
113
|
"defu": "^6.1.4",
|
|
117
114
|
"fast-glob": "^3.3.2",
|
|
118
115
|
"metamorphosis": "^0.4.1",
|
|
116
|
+
"reka-ui": "^2.2.1",
|
|
119
117
|
"tailwind-merge": "^3.1.0",
|
|
120
118
|
"unplugin-icons": "^22.1.0",
|
|
121
119
|
"unplugin-vue-components": "^28.4.1",
|
|
@@ -124,15 +122,16 @@
|
|
|
124
122
|
"devDependencies": {
|
|
125
123
|
"@alanscodelog/commitlint-config": "^3.0.2",
|
|
126
124
|
"@alanscodelog/eslint-config": "^5.0.0",
|
|
127
|
-
"@alanscodelog/semantic-release-config": "^5.0.
|
|
128
|
-
"@alanscodelog/tsconfigs": "^
|
|
125
|
+
"@alanscodelog/semantic-release-config": "^5.0.4",
|
|
126
|
+
"@alanscodelog/tsconfigs": "^6.0.0",
|
|
129
127
|
"@alanscodelog/vite-config": "^0.0.5",
|
|
130
128
|
"@chromatic-com/storybook": "^3.2.6",
|
|
131
129
|
"@commitlint/cli": "^19.3.0",
|
|
132
130
|
"@internationalized/date": "^3.1.0",
|
|
133
131
|
"@nuxt/eslint-config": "^1.3.0",
|
|
134
|
-
"@nuxt/module-builder": "^0.
|
|
132
|
+
"@nuxt/module-builder": "^1.0.2",
|
|
135
133
|
"@nuxtjs/i18n": "^9.5.3",
|
|
134
|
+
"@playwright/test": "=1.50.0",
|
|
136
135
|
"@rollup/plugin-node-resolve": "^16.0.1",
|
|
137
136
|
"@storybook/addon-a11y": "^8.6.12",
|
|
138
137
|
"@storybook/addon-actions": "^8.6.12",
|
|
@@ -146,25 +145,25 @@
|
|
|
146
145
|
"@storybook/test-runner": "^0.22.0",
|
|
147
146
|
"@storybook/vue3": "^8.6.12",
|
|
148
147
|
"@storybook/vue3-vite": "^8.6.12",
|
|
148
|
+
"@tailwindcss/cli": "^4.1.4",
|
|
149
149
|
"@tailwindcss/postcss": "^4.1.2",
|
|
150
|
-
"@types/node": "^
|
|
151
|
-
"@vitejs/plugin-vue": "^
|
|
150
|
+
"@types/node": "^24.1.0",
|
|
151
|
+
"@vitejs/plugin-vue": "^6.0.0",
|
|
152
152
|
"@vue/runtime-core": "^3.4.27",
|
|
153
|
-
"@playwright/test": "=1.50.0",
|
|
154
|
-
"playwright": "=1.50.0",
|
|
155
153
|
"@vue/runtime-dom": "^3.4.27",
|
|
156
154
|
"@vueuse/components": "^13.0.0",
|
|
157
155
|
"@vueuse/core": "^13.0.0",
|
|
158
156
|
"autoprefixer": "^10.4.19",
|
|
159
157
|
"concurrently": "^9.1.2",
|
|
160
|
-
"eslint": "
|
|
158
|
+
"eslint": "^9.32.0",
|
|
161
159
|
"eslint-plugin-jsdoc": "^48.0.0",
|
|
162
160
|
"http-server": "^14.1.1",
|
|
163
161
|
"husky": "^9.0.11",
|
|
164
162
|
"indexit": "2.1.0-beta.3",
|
|
165
163
|
"madge": "^7.0.0",
|
|
166
|
-
"nuxt": "^
|
|
167
|
-
"
|
|
164
|
+
"nuxt": "^4.0.1",
|
|
165
|
+
"playwright": "=1.50.0",
|
|
166
|
+
"playwright-core": "=1.50.0",
|
|
168
167
|
"semantic-release": "^24.1.2",
|
|
169
168
|
"storybook": "^8.6.12",
|
|
170
169
|
"storybook-dark-mode": "^4.0.2",
|
|
@@ -172,12 +171,11 @@
|
|
|
172
171
|
"ts-node": "^10.9.2",
|
|
173
172
|
"typescript": "~5.8.2",
|
|
174
173
|
"unbuild": "^3.5.0",
|
|
175
|
-
"vite": "^
|
|
174
|
+
"vite": "^7.0.6",
|
|
176
175
|
"vite-plugin-externalize-deps": "^0.9.0",
|
|
177
176
|
"vite-tsconfig-paths": "^5.0.1",
|
|
178
|
-
"playwright-core": "=1.50.0",
|
|
179
177
|
"vue": "^3.5.13",
|
|
180
|
-
"vue-tsc": "
|
|
178
|
+
"vue-tsc": "3.0.4",
|
|
181
179
|
"wait-on": "^8.0.3"
|
|
182
180
|
},
|
|
183
181
|
"author": "Alan <alanscodelog@gmail.com>",
|
package/src/module.ts
CHANGED
|
@@ -23,10 +23,15 @@ const knownDirectives = ["vExtractRootEl", "vResizableCols", "vResizeObserver",
|
|
|
23
23
|
|
|
24
24
|
const { resolve, resolvePath } = createResolver(import.meta.url)
|
|
25
25
|
|
|
26
|
-
const componentsInfo: {
|
|
26
|
+
const componentsInfo: {
|
|
27
|
+
name: string
|
|
28
|
+
originalName: string
|
|
29
|
+
filepath: string
|
|
30
|
+
}[] = globFiles([
|
|
27
31
|
`${resolve("./runtime/components")}/**/*.vue*`,
|
|
28
32
|
`!**/Template/**.vue`,
|
|
29
33
|
],[], (filepath: string, name: string) => ({
|
|
34
|
+
originalName: name,
|
|
30
35
|
name: name.startsWith("Lib") ? name.replace("Lib", "PREFIX") : `PREFIX${name}`,
|
|
31
36
|
filepath,
|
|
32
37
|
}))
|
|
@@ -56,9 +61,11 @@ export interface ModuleOptions {
|
|
|
56
61
|
componentPrefix: string
|
|
57
62
|
debug?: boolean
|
|
58
63
|
/**
|
|
59
|
-
* @default "~/assets/css/tailwind.css"
|
|
64
|
+
* @default "~/assets/css/tailwind.css" if it exists.
|
|
60
65
|
*/
|
|
61
66
|
mainCssFile?: string
|
|
67
|
+
/** @internal */
|
|
68
|
+
_playgroundWorkaround?: boolean
|
|
62
69
|
}
|
|
63
70
|
|
|
64
71
|
export default defineNuxtModule<ModuleOptions>({
|
|
@@ -75,6 +82,7 @@ export default defineNuxtModule<ModuleOptions>({
|
|
|
75
82
|
componentPrefix: "W",
|
|
76
83
|
debug: true,
|
|
77
84
|
mainCssFile: "~/assets/css/tailwind.css",
|
|
85
|
+
_playgroundWorkaround: false,
|
|
78
86
|
},
|
|
79
87
|
async setup(options, nuxt) {
|
|
80
88
|
const moduleName = "@witchcraft/ui"
|
|
@@ -102,18 +110,22 @@ export default defineNuxtModule<ModuleOptions>({
|
|
|
102
110
|
)
|
|
103
111
|
|
|
104
112
|
|
|
105
|
-
const contents = [
|
|
106
|
-
...componentsInfo.map(_ => _.filepath)
|
|
107
|
-
]
|
|
108
113
|
addTemplate({
|
|
109
114
|
filename: "witchcraft-ui.css",
|
|
110
115
|
write: true,
|
|
111
|
-
getContents: () =>
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
116
|
+
getContents: () => options._playgroundWorkaround
|
|
117
|
+
? crop`
|
|
118
|
+
${indent(themeAsTailwindCss(theme, themeConvertionOpts), 5)}
|
|
119
|
+
@import "${resolve("runtime/assets/base.css")}";
|
|
120
|
+
@import "${resolve("runtime/assets/utils.css")}";
|
|
121
|
+
${indent(filteredComponentsInfo.map(_ => `@source "${_.filepath}";`).join("\n"), 5)}
|
|
122
|
+
`
|
|
123
|
+
: crop`
|
|
124
|
+
${indent(themeAsTailwindCss(theme, themeConvertionOpts), 5)}
|
|
125
|
+
@import "@witchcraft/ui/base.css";
|
|
126
|
+
@import "@witchcraft/ui/utils.css";
|
|
127
|
+
${indent(filteredComponentsInfo.map(_ => `@source "${_.filepath}";`).join("\n"), 5)}
|
|
128
|
+
`
|
|
117
129
|
})
|
|
118
130
|
|
|
119
131
|
|
|
@@ -160,9 +172,16 @@ export default defineNuxtModule<ModuleOptions>({
|
|
|
160
172
|
]
|
|
161
173
|
}
|
|
162
174
|
})
|
|
163
|
-
|
|
175
|
+
const mainCssFile = await resolvePath(options.mainCssFile!, nuxt.options.alias)
|
|
176
|
+
|
|
177
|
+
const exists = fs.existsSync(mainCssFile)
|
|
178
|
+
if (exists) {
|
|
179
|
+
nuxt.options.css.push(mainCssFile)
|
|
180
|
+
}
|
|
181
|
+
|
|
164
182
|
// we need to hook in first before it does, otherwise the plugins don't load correctly
|
|
165
183
|
await installModule("unplugin-icons/nuxt")
|
|
184
|
+
await installModule("reka-ui/nuxt")
|
|
166
185
|
|
|
167
186
|
// todo make names more specific
|
|
168
187
|
// addImportsDir(resolve("helpers"))
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
.list-enter-from,
|
|
19
19
|
.list-leave-to {
|
|
20
20
|
opacity: 0;
|
|
21
|
-
transform: translateX(
|
|
21
|
+
transform: translateX(100%);
|
|
22
22
|
}
|
|
23
23
|
|
|
24
24
|
/* ensure leaving items are taken out of layout flow so that moving
|
|
@@ -65,3 +65,12 @@ animations can be calculated correctly. */
|
|
|
65
65
|
a {
|
|
66
66
|
@apply link-like;
|
|
67
67
|
}
|
|
68
|
+
|
|
69
|
+
* {
|
|
70
|
+
@apply styled-scrollbar;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
textarea {
|
|
74
|
+
@apply styled-resizer;
|
|
75
|
+
}
|
|
76
|
+
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
"file-input.compact-choose-file-plural": "Choose Files",
|
|
6
6
|
"file-input.non-compact-choose-file": "Drag & Drop File",
|
|
7
7
|
"file-input.non-compact-choose-file-plural": "Drag & Drop Files",
|
|
8
|
-
"color-
|
|
8
|
+
"color-input.aria-and-title-prefix": "Click to Open Color Picker, Current Color: ",
|
|
9
9
|
"cancel": "Cancel",
|
|
10
10
|
"save": "Save",
|
|
11
11
|
"copy": "Copy",
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
"color-picker.aria.value": "Value",
|
|
16
16
|
"color-picker.aria.hue-slider": "Hue Slider",
|
|
17
17
|
"color-picker.aria.alpha-slider": "Alpha Slider",
|
|
18
|
-
"color-picker.aria.description": "Use the arrow keys to move the handle, or use shift to move in 10 pixel increments.",
|
|
18
|
+
"color-picker.aria.description": "Use the arrow keys to move the handle, or use shift to move in 10 pixel increments. Press enter to save value.",
|
|
19
19
|
"dark-mode-switcher.title": "Switch dark mode type, current: ",
|
|
20
20
|
"dark-mode-switcher.system": "System",
|
|
21
21
|
"dark-mode-switcher.dark": "Dark",
|
|
@@ -37,17 +37,17 @@
|
|
|
37
37
|
}
|
|
38
38
|
|
|
39
39
|
@utility focus-outline-within {
|
|
40
|
-
@apply outlined-within:outline-
|
|
40
|
+
@apply outlined-within:outline-2 outlined-within:outline-accent-500 outlined-within:outline-offset-2;
|
|
41
41
|
}
|
|
42
42
|
|
|
43
43
|
@utility focus-outline {
|
|
44
|
-
@apply outlined:outline-
|
|
44
|
+
@apply outlined:outline-2 outlined:outline-accent-500 outlined:outline-offset-2;
|
|
45
45
|
}
|
|
46
46
|
@utility focus-outline-no-offset {
|
|
47
|
-
@apply outlined:outline-
|
|
47
|
+
@apply outlined:outline-2 outlined:outline-accent-500;
|
|
48
48
|
}
|
|
49
49
|
@utility focus-outline-hidden {
|
|
50
|
-
@apply outlined:outline-
|
|
50
|
+
@apply outlined:outline-none;
|
|
51
51
|
}
|
|
52
52
|
|
|
53
53
|
/* .bg-squares-gradient { */
|
|
@@ -125,6 +125,88 @@
|
|
|
125
125
|
display: none;
|
|
126
126
|
}
|
|
127
127
|
}
|
|
128
|
+
@utility styled-scrollbar {
|
|
129
|
+
/* local defaults */
|
|
130
|
+
--_scrollbar_width: var(--scrollbar-width, calc(3 * var(--spacing)));
|
|
131
|
+
--_scrollbar_border_width: var(--scrollbar-border-width, calc(var(--spacing)/2));
|
|
132
|
+
--_scrollbar_color: var(--scrollbar-color, --alpha(var(--color-accent-500) / 40%));
|
|
133
|
+
--_scrollbar_hover_color: var(--scrollbar-hover-color, --alpha(var(--color-accent-500) / 80%));
|
|
134
|
+
--_scrollbar_bg_color: var(--scrollbar-bg-color, var(--color-bg));
|
|
135
|
+
|
|
136
|
+
.dark & {
|
|
137
|
+
--_scrollbar_bg_color: var(--scrollbar-bg-color, var(--color-fg));
|
|
138
|
+
}
|
|
139
|
+
/* Chrome, Edge and Safari */
|
|
140
|
+
&::-webkit-scrollbar {
|
|
141
|
+
width: var(--_scrollbar_width);
|
|
142
|
+
height: var(--_scrollbar_width);
|
|
143
|
+
}
|
|
144
|
+
&::-webkit-scrollbar-corner {
|
|
145
|
+
background-color: transparent;
|
|
146
|
+
}
|
|
147
|
+
&::-webkit-scrollbar-track {
|
|
148
|
+
border-radius: var(--_scrollbar_width);
|
|
149
|
+
background-color: transparent;
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
&::-webkit-scrollbar-thumb {
|
|
153
|
+
border-radius: var(--_scrollbar_width);
|
|
154
|
+
background-color: var(--_scrollbar_color);
|
|
155
|
+
border: var(--_scrollbar_border_width) solid var(--_scrollbar_bg_color);
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
&::-webkit-scrollbar-thumb:hover {
|
|
159
|
+
border-radius: var(--_scrollbar_width);
|
|
160
|
+
background-color: var(--_scrollbar_hover_color);
|
|
161
|
+
cursor: pointer;
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
&::-webkit-scrollbar-thumb:active {
|
|
165
|
+
border-radius: var(--_scrollbar_width);
|
|
166
|
+
background-color: var(--_scrollbar_hover_color);
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
@utility styled-scrollbar-w-* {
|
|
171
|
+
--scrollbar-width: --value(integer);
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
@utility styled-scrollbar-border-w-* {
|
|
175
|
+
--scrollbar-border-width: --value(integer);
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
@utility styled-scrollbar-* {
|
|
179
|
+
--scrollbar-color: --value(--color-*);
|
|
180
|
+
}
|
|
181
|
+
@utility styled-scrollbar-bg-* {
|
|
182
|
+
--scrollbar-bg-color: --value(--color-*);
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
/** only for textareas */
|
|
186
|
+
@utility styled-resizer {
|
|
187
|
+
--_resizer_width: var(--resizer-width, 8px);
|
|
188
|
+
--_resizer_color: var(--resizer-color, var(--color-neutral-300));
|
|
189
|
+
.dark & {
|
|
190
|
+
--_resizer_color: var(--resizer-color, var(--color-neutral-700));
|
|
191
|
+
}
|
|
192
|
+
&::-webkit-resizer {
|
|
193
|
+
border-width: var(--_resizer_width);
|
|
194
|
+
border-style: solid;
|
|
195
|
+
border-top-color: transparent;
|
|
196
|
+
border-right-color: var(--_resizer_color);
|
|
197
|
+
border-bottom-color: var(--_resizer_color);
|
|
198
|
+
border-left-color: transparent;
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
@utility styled-resizer-w-* {
|
|
203
|
+
--resizer-width: --value(integer);
|
|
204
|
+
}
|
|
205
|
+
@utility styled-resizer-color-* {
|
|
206
|
+
--resizer-color: --value(--color-*);
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
|
|
128
210
|
@utility content-vertical-holder {
|
|
129
211
|
--tw-content: "\200b";
|
|
130
212
|
content: var(--tw-content);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { type ComponentResolver } from "unplugin-vue-components"
|
|
2
2
|
|
|
3
|
-
const prefixless = ["Icon", "Aria"
|
|
3
|
+
const prefixless = ["Icon", "Aria"]
|
|
4
4
|
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
5
5
|
export const WitchcraftUiResolver = (
|
|
6
6
|
{
|
|
@@ -24,13 +24,14 @@ const template = `
|
|
|
24
24
|
<div class="outline-hidden focus:border-danger-500 border border-accent-600" tabindex="0">Has Manual Focus Classes</div>
|
|
25
25
|
`
|
|
26
26
|
export default meta
|
|
27
|
-
|
|
27
|
+
// eslint-disable-next-line @typescript-eslint/no-empty-object-type
|
|
28
|
+
type Story = StoryObj<{}>
|
|
28
29
|
|
|
29
30
|
export const Primary: Story = {
|
|
30
31
|
render: args => ({
|
|
31
32
|
components,
|
|
32
33
|
setup: () => {
|
|
33
|
-
const el = ref<HTMLElement>(null)
|
|
34
|
+
const el = ref<HTMLElement | null>(null)
|
|
34
35
|
onMounted(() => {
|
|
35
36
|
// el.value.focus()
|
|
36
37
|
})
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<div
|
|
3
|
-
class="icon inline-block"
|
|
3
|
+
:class="twMerge('icon inline-block', $attrs?.class)"
|
|
4
4
|
v-bind="{...$attrs, class:undefined}"
|
|
5
5
|
>
|
|
6
6
|
<slot/>
|
|
@@ -10,9 +10,16 @@
|
|
|
10
10
|
<script setup lang="ts">
|
|
11
11
|
import { computed, type HTMLAttributes,useAttrs } from "vue"
|
|
12
12
|
|
|
13
|
-
|
|
13
|
+
import { twMerge } from "../../utils/twMerge.js"
|
|
14
|
+
|
|
15
|
+
defineOptions({
|
|
16
|
+
name: "icon",
|
|
17
|
+
inheritAttrs: false,
|
|
18
|
+
})
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
const $attrs = useAttrs() as any
|
|
14
22
|
|
|
15
|
-
// eslint-disable-next-line no-use-before-define
|
|
16
23
|
const props = defineProps<Props>()
|
|
17
24
|
|
|
18
25
|
|
|
@@ -26,9 +33,6 @@ const props = defineProps<Props>()
|
|
|
26
33
|
* <icon><i-...></icon>
|
|
27
34
|
* ``
|
|
28
35
|
*/
|
|
29
|
-
export default {
|
|
30
|
-
name: "icon",
|
|
31
|
-
}
|
|
32
36
|
|
|
33
37
|
interface Props
|
|
34
38
|
extends
|
|
@@ -2,26 +2,26 @@
|
|
|
2
2
|
<button
|
|
3
3
|
:id="id ?? fallbackId"
|
|
4
4
|
:class="!($attrs as any).unstyle && twMerge(`
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
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
25
|
!color && `active:text-neutral-800` /* todo for colors */,
|
|
26
26
|
border && `
|
|
27
27
|
transition-all
|
|
@@ -31,11 +31,11 @@
|
|
|
31
31
|
shadow-neutral-950/20
|
|
32
32
|
hover:shadow-[0_1px_3px_0]
|
|
33
33
|
hover:shadow-neutral-950/30
|
|
34
|
-
hover:border-neutral-
|
|
35
|
-
|
|
34
|
+
hover:border-neutral-200
|
|
35
|
+
dark:hover:border-neutral-800
|
|
36
36
|
relative
|
|
37
37
|
after:absolute
|
|
38
|
-
after:rounded-
|
|
38
|
+
after:rounded-xs
|
|
39
39
|
after:inset-0
|
|
40
40
|
after:content
|
|
41
41
|
after:shadow-[0_1px_0_0_inset]
|
|
@@ -45,15 +45,13 @@
|
|
|
45
45
|
dark:hover:after:shadow-bg/50
|
|
46
46
|
after:pointer-events-none
|
|
47
47
|
after:mix-blend-overlay
|
|
48
|
-
|
|
49
|
-
active:shadow-inner
|
|
48
|
+
active:inset-shadow
|
|
50
49
|
active:shadow-fg/20
|
|
51
50
|
active:border-transparent
|
|
52
51
|
border
|
|
53
|
-
border-neutral-
|
|
52
|
+
border-neutral-300
|
|
54
53
|
disabled:border-neutral-200
|
|
55
54
|
disabled:bg-neutral-50
|
|
56
|
-
|
|
57
55
|
dark:hover:shadow-accent-950/30
|
|
58
56
|
dark:active:shadow-fg/40
|
|
59
57
|
dark:active:border-neutral-900
|
|
@@ -156,7 +154,7 @@
|
|
|
156
154
|
`,
|
|
157
155
|
($attrs as any)?.class
|
|
158
156
|
)"
|
|
159
|
-
:type="$attrs.type as any
|
|
157
|
+
:type="$attrs.type as any"
|
|
160
158
|
:tabindex="0"
|
|
161
159
|
:disabled="disabled"
|
|
162
160
|
:data-border="border"
|
|
@@ -169,17 +167,19 @@
|
|
|
169
167
|
...ariaLabel,
|
|
170
168
|
}"
|
|
171
169
|
>
|
|
172
|
-
<label
|
|
173
|
-
<
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
170
|
+
<slot name="label" v-bind="{id:`label-${id ?? fallbackId}`, classes:'button--label pointer-events-none flex flex-1 items-center justify-center gap-1'}">
|
|
171
|
+
<label :id="`label-${id ?? fallbackId}`" class="button--label pointer-events-none flex flex-1 items-center justify-center gap-1">
|
|
172
|
+
<slot name="icon"/>
|
|
173
|
+
<slot
|
|
174
|
+
v-bind="{ label}"
|
|
175
|
+
>
|
|
176
|
+
<span v-if="label && !isBlank(label!)">
|
|
177
|
+
{{ label }}
|
|
178
|
+
</span>
|
|
179
|
+
</slot>
|
|
180
|
+
<slot name="icon-after"/>
|
|
181
|
+
</label>
|
|
182
|
+
</slot>
|
|
183
183
|
</button>
|
|
184
184
|
</template>
|
|
185
185
|
|
|
@@ -193,7 +193,7 @@ import { type ButtonHTMLAttributes,computed, type HTMLAttributes, type PropType,
|
|
|
193
193
|
import { useAriaLabel } from "../../composables/useAriaLabel.js"
|
|
194
194
|
import { useDivideAttrs } from "../../composables/useDivideAttrs.js"
|
|
195
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"
|
|
196
|
+
import { type BaseInteractiveProps, baseInteractiveProps, baseInteractivePropsDefaults, type ButtonProps,getFallbackId, type LabelProps, type LinkableByIdProps, type TailwindClassProp, type WrapperProps } from "../shared/props.js"
|
|
197
197
|
|
|
198
198
|
|
|
199
199
|
const $attrs = useAttrs()
|
|
@@ -205,7 +205,6 @@ defineOptions({
|
|
|
205
205
|
|
|
206
206
|
const fallbackId = getFallbackId()
|
|
207
207
|
|
|
208
|
-
// eslint-disable-next-line no-use-before-define
|
|
209
208
|
const props = withDefaults(defineProps<Props>(), {
|
|
210
209
|
color: false,
|
|
211
210
|
label: "",
|
|
@@ -227,12 +226,7 @@ type RealProps =
|
|
|
227
226
|
& LinkableByIdProps
|
|
228
227
|
& LabelProps
|
|
229
228
|
& BaseInteractiveProps
|
|
230
|
-
&
|
|
231
|
-
border?: boolean
|
|
232
|
-
color?: "warning" | "ok" | "danger" | "primary" | "secondary" | false
|
|
233
|
-
label?: string
|
|
234
|
-
autoTitleFromAria?: boolean
|
|
235
|
-
}
|
|
229
|
+
& ButtonProps
|
|
236
230
|
|
|
237
231
|
interface Props
|
|
238
232
|
extends
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<div
|
|
3
3
|
:class="twMerge(`
|
|
4
|
+
checkbox--wrapper
|
|
4
5
|
flex
|
|
5
6
|
items-center
|
|
6
7
|
gap-1
|
|
@@ -12,8 +13,8 @@
|
|
|
12
13
|
>
|
|
13
14
|
<slot name="left"/>
|
|
14
15
|
<label
|
|
15
|
-
class="flex items-center gap-1"
|
|
16
16
|
:class="twMerge(`
|
|
17
|
+
checkbox--label
|
|
17
18
|
flex
|
|
18
19
|
items-center
|
|
19
20
|
gap-1
|
|
@@ -26,6 +27,7 @@
|
|
|
26
27
|
<input
|
|
27
28
|
:id="id ?? fallbackId"
|
|
28
29
|
:class="!($attrs as any).unstyle && twMerge(`
|
|
30
|
+
checkbox
|
|
29
31
|
focus-outline-no-offset
|
|
30
32
|
m-0
|
|
31
33
|
p-[0.4em]
|
|
@@ -33,7 +35,8 @@
|
|
|
33
35
|
dark:bg-fg
|
|
34
36
|
appearance-none
|
|
35
37
|
border
|
|
36
|
-
border-
|
|
38
|
+
border-neutral-500
|
|
39
|
+
focus:border-accent-600
|
|
37
40
|
rounded-sm
|
|
38
41
|
aspect-square
|
|
39
42
|
relative
|
|
@@ -71,6 +74,7 @@ import type { MakeRequired } from "@alanscodelog/utils/types"
|
|
|
71
74
|
import { computed, type HTMLAttributes, type InputHTMLAttributes,type PropType, ref, useAttrs, useSlots } from "vue"
|
|
72
75
|
|
|
73
76
|
import { useDivideAttrs } from "../../composables/useDivideAttrs.js"
|
|
77
|
+
import { usePreHydrationValue } from "../../composables/usePreHydrationValue.js"
|
|
74
78
|
import { twMerge } from "../../utils/twMerge.js"
|
|
75
79
|
import { type BaseInteractiveProps, baseInteractivePropsDefaults, getFallbackId,type LabelProps, type LinkableByIdProps, type TailwindClassProp, type WrapperProps } from "../shared/props.js"
|
|
76
80
|
|
|
@@ -84,7 +88,6 @@ const $slots = useSlots()
|
|
|
84
88
|
/* todo multi states */
|
|
85
89
|
|
|
86
90
|
const fallbackId = getFallbackId()
|
|
87
|
-
// eslint-disable-next-line no-use-before-define
|
|
88
91
|
const props = withDefaults(defineProps<Props>(), {
|
|
89
92
|
...baseInteractivePropsDefaults,
|
|
90
93
|
})
|
|
@@ -99,7 +102,7 @@ const el = ref<null | HTMLElement>(null)
|
|
|
99
102
|
const inputEl = ref<null | HTMLElement>(null)
|
|
100
103
|
const $value = defineModel<boolean>("modelValue", { default: false })
|
|
101
104
|
|
|
102
|
-
|
|
105
|
+
usePreHydrationValue(props.id ?? fallbackId, $value)
|
|
103
106
|
</script>
|
|
104
107
|
|
|
105
108
|
<script lang="ts">
|