@indielayer/ui 1.0.0-alpha.8 → 1.0.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 +6 -3
- package/lib/common/icons.d.ts +15 -0
- package/lib/common/utils.d.ts +32 -0
- package/lib/components/alert/Alert.theme.d.ts +8 -0
- package/lib/components/alert/Alert.vue.d.ts +1 -12
- package/lib/components/alert/__tests__/Alert.spec.d.ts +1 -0
- package/lib/components/avatar/Avatar.theme.d.ts +8 -0
- package/lib/components/avatar/Avatar.vue.d.ts +5 -8
- package/lib/components/avatar/__tests__/Avatar.spec.d.ts +1 -0
- package/lib/components/badge/Badge.theme.d.ts +8 -0
- package/lib/components/badge/Badge.vue.d.ts +5 -6
- package/lib/components/badge/__tests__/Badge.spec.d.ts +1 -0
- package/lib/components/breadcrumbs/Breadcrumbs.theme.d.ts +8 -0
- package/lib/components/breadcrumbs/Breadcrumbs.vue.d.ts +19 -8
- package/lib/components/breadcrumbs/__tests__/Breadcrumbs.spec.d.ts +1 -0
- package/lib/components/button/Button.theme.d.ts +10 -0
- package/lib/components/button/Button.vue.d.ts +10 -16
- package/lib/components/button/ButtonGroup.theme.d.ts +6 -0
- package/lib/components/button/ButtonGroup.vue.d.ts +5 -2
- package/lib/components/button/__tests__/ Button.spec.d.ts +1 -0
- package/lib/components/button/__tests__/ ButtonGroup.spec.d.ts +1 -0
- package/lib/components/card/Card.theme.d.ts +7 -0
- package/lib/components/card/Card.vue.d.ts +2 -2
- package/lib/components/card/__tests__/Card.spec.d.ts +1 -0
- package/lib/components/checkbox/Checkbox.theme.d.ts +11 -0
- package/lib/components/checkbox/Checkbox.vue.d.ts +10 -14
- package/lib/components/checkbox/__tests__/Checkbox.spec.d.ts +1 -0
- package/lib/components/collapse/Collapse.theme.d.ts +9 -0
- package/lib/components/collapse/Collapse.vue.d.ts +12 -19
- package/lib/components/collapse/__tests__/Collapse.spec.d.ts +1 -0
- package/lib/components/container/Container.theme.d.ts +6 -0
- package/lib/components/container/Container.vue.d.ts +1 -1
- package/lib/components/container/__tests__/Container.spec.d.ts +1 -0
- package/lib/components/divider/Divider.theme.d.ts +9 -0
- package/lib/components/divider/Divider.vue.d.ts +1 -1
- package/lib/components/divider/__tests__/Divider.spec.d.ts +1 -0
- package/lib/components/drawer/Drawer.theme.d.ts +7 -0
- package/lib/components/drawer/Drawer.vue.d.ts +3 -15
- package/lib/components/drawer/__tests__/Drawer.spec.d.ts +1 -0
- package/lib/components/form/Form.theme.d.ts +6 -0
- package/lib/components/form/Form.vue.d.ts +9 -7
- package/lib/components/form/__tests__/Form.spec.d.ts +1 -0
- package/lib/components/helpers/InputError.d.ts +8 -0
- package/lib/components/icon/Icon.theme.d.ts +7 -0
- package/lib/components/icon/Icon.vue.d.ts +4 -8
- package/lib/components/icon/__tests__/Icon.spec.d.ts +1 -0
- package/lib/components/image/Image.theme.d.ts +6 -0
- package/lib/components/image/Image.vue.d.ts +1 -3
- package/lib/components/image/__tests__/Image.spec.d.ts +1 -0
- package/lib/components/index.d.ts +3 -3
- package/lib/components/input/Input.theme.d.ts +11 -0
- package/lib/components/input/Input.vue.d.ts +27 -25
- package/lib/components/input/__tests__/Input.spec.d.ts +1 -0
- package/lib/components/link/Link.theme.d.ts +8 -0
- package/lib/components/link/Link.vue.d.ts +3 -5
- package/lib/components/link/__tests__/Link.spec.d.ts +1 -0
- package/lib/components/menu/Menu.theme.d.ts +6 -0
- package/lib/components/menu/Menu.vue.d.ts +6 -3
- package/lib/components/menu/MenuItem.theme.d.ts +8 -0
- package/lib/components/menu/MenuItem.vue.d.ts +5 -30
- package/lib/components/menu/__tests__/Menu.spec.d.ts +1 -0
- package/lib/components/menu/__tests__/MenuItem.spec.d.ts +1 -0
- package/lib/components/modal/Modal.theme.d.ts +13 -0
- package/lib/components/modal/Modal.vue.d.ts +1 -6
- package/lib/components/modal/__tests__/Modal.spec.d.ts +1 -0
- package/lib/components/notifications/Notifications.theme.d.ts +8 -0
- package/lib/components/notifications/Notifications.vue.d.ts +11 -24
- package/lib/components/notifications/__tests__/Notifications.spec.d.ts +1 -0
- package/lib/components/pagination/Pagination.theme.d.ts +9 -0
- package/lib/components/pagination/Pagination.vue.d.ts +7 -16
- package/lib/components/pagination/PaginationItem.theme.d.ts +7 -0
- package/lib/components/pagination/PaginationItem.vue.d.ts +4 -3
- package/lib/components/pagination/__tests__/Pagination.spec.d.ts +1 -0
- package/lib/components/pagination/__tests__/PaginationItem.spec.d.ts +1 -0
- package/lib/components/popover/Popover.theme.d.ts +7 -0
- package/lib/components/popover/Popover.vue.d.ts +13 -13
- package/lib/components/popover/PopoverContainer.theme.d.ts +6 -0
- package/lib/components/popover/PopoverContainer.vue.d.ts +1 -1
- package/lib/components/popover/__tests__/Popover.spec.d.ts +1 -0
- package/lib/components/popover/__tests__/PopoverContainer.spec.d.ts +1 -0
- package/lib/components/progress/Progress.theme.d.ts +10 -0
- package/lib/components/progress/Progress.vue.d.ts +1 -3
- package/lib/components/progress/__tests__/Progress.spec.d.ts +1 -0
- package/lib/components/radio/Radio.theme.d.ts +12 -0
- package/lib/components/radio/Radio.vue.d.ts +12 -13
- package/lib/components/radio/__tests__/Radio.spec.d.ts +1 -0
- package/lib/components/scroll/Scroll.theme.d.ts +6 -0
- package/lib/components/scroll/Scroll.vue.d.ts +1 -7
- package/lib/components/scroll/__tests__/Scroll.spec.d.ts +1 -0
- package/lib/components/select/Select.theme.d.ts +13 -0
- package/lib/components/select/Select.vue.d.ts +8 -28
- package/lib/components/select/__tests__/Select.spec.d.ts +1 -0
- package/lib/components/skeleton/Skeleton.theme.d.ts +6 -0
- package/lib/components/skeleton/Skeleton.vue.d.ts +1 -1
- package/lib/components/skeleton/__tests__/Skeleton.spec.d.ts +1 -0
- package/lib/components/slider/Slider.theme.d.ts +10 -0
- package/lib/components/slider/Slider.vue.d.ts +8 -17
- package/lib/components/slider/__tests__/Slider.spec.d.ts +1 -0
- package/lib/components/spacer/Spacer.d.ts +2 -0
- package/lib/components/spacer/__tests__/Spacer.spec.d.ts +1 -0
- package/lib/components/spinner/Spinner.vue.d.ts +15 -6
- package/lib/components/spinner/__tests__/Spinner.spec.d.ts +1 -0
- package/lib/components/tab/Tab.theme.d.ts +9 -0
- package/lib/components/tab/Tab.vue.d.ts +4 -13
- package/lib/components/tab/TabGroup.theme.d.ts +10 -0
- package/lib/components/tab/TabGroup.vue.d.ts +4 -8
- package/lib/components/tab/__tests__/Tab.spec.d.ts +1 -0
- package/lib/components/tab/__tests__/TabGroup.spec.d.ts +1 -0
- package/lib/components/table/Table.theme.d.ts +8 -0
- package/lib/components/table/Table.vue.d.ts +6 -10
- package/lib/components/table/TableBody.d.ts +2 -0
- package/lib/components/table/TableCell.theme.d.ts +7 -0
- package/lib/components/table/TableCell.vue.d.ts +1 -1
- package/lib/components/table/TableHead.d.ts +2 -0
- package/lib/components/table/TableHeader.vue.d.ts +2 -2
- package/lib/components/table/TableRow.vue.d.ts +1 -1
- package/lib/components/table/__tests__/Table.spec.d.ts +1 -0
- package/lib/components/tag/Tag.theme.d.ts +9 -0
- package/lib/components/tag/Tag.vue.d.ts +5 -5
- package/lib/components/tag/__tests__/Tag.spec.d.ts +1 -0
- package/lib/components/textarea/Textarea.theme.d.ts +10 -0
- package/lib/components/textarea/Textarea.vue.d.ts +18 -24
- package/lib/components/textarea/__tests__/Textarea.spec.d.ts +1 -0
- package/lib/components/toggle/Toggle.theme.d.ts +11 -0
- package/lib/components/toggle/Toggle.vue.d.ts +10 -11
- package/lib/components/toggle/__tests__/Toggle.spec.d.ts +1 -0
- package/lib/components/tooltip/Tooltip.theme.d.ts +11 -0
- package/lib/components/tooltip/__tests__/Tooltip.spec.d.ts +1 -0
- package/lib/composables/colors-utils.d.ts +0 -1
- package/lib/composables/colors.d.ts +8 -4
- package/lib/composables/common.d.ts +1 -0
- package/lib/composables/css.d.ts +6 -5
- package/lib/composables/index.d.ts +1 -1
- package/lib/composables/inputtable.d.ts +1 -1
- package/lib/composables/interactive.d.ts +7 -2
- package/lib/composables/keys.d.ts +1 -0
- package/lib/composables/notifications.d.ts +1 -0
- package/lib/composables/theme.d.ts +20 -0
- package/lib/create.d.ts +3 -2
- package/lib/index.cjs.js +1 -15
- package/lib/index.es.js +4451 -3649
- package/lib/nuxt.js +2 -1
- package/lib/version.d.ts +1 -1
- package/package.json +16 -6
- package/src/common/icons.ts +15 -0
- package/src/common/utils.ts +68 -0
- package/src/components/alert/Alert.theme.ts +57 -0
- package/src/components/alert/Alert.vue +51 -127
- package/src/components/alert/__tests__/Alert.spec.ts +14 -0
- package/src/components/avatar/Avatar.theme.ts +39 -0
- package/src/components/avatar/Avatar.vue +58 -96
- package/src/components/avatar/__tests__/Avatar.spec.ts +11 -0
- package/src/components/badge/Badge.theme.ts +13 -0
- package/src/components/badge/Badge.vue +58 -65
- package/src/components/badge/__tests__/Badge.spec.ts +11 -0
- package/src/components/breadcrumbs/Breadcrumbs.theme.ts +9 -0
- package/src/components/breadcrumbs/Breadcrumbs.vue +34 -24
- package/src/components/breadcrumbs/__tests__/Breadcrumbs.spec.ts +11 -0
- package/src/components/button/Button.theme.ts +234 -0
- package/src/components/button/Button.vue +94 -356
- package/src/components/button/ButtonGroup.theme.ts +5 -0
- package/src/components/button/ButtonGroup.vue +30 -29
- package/src/components/button/__tests__/ Button.spec.ts +11 -0
- package/src/components/button/__tests__/ ButtonGroup.spec.ts +11 -0
- package/src/components/card/Card.theme.ts +7 -0
- package/src/components/card/Card.vue +18 -11
- package/src/components/card/__tests__/Card.spec.ts +11 -0
- package/src/components/checkbox/Checkbox.theme.ts +92 -0
- package/src/components/checkbox/Checkbox.vue +69 -156
- package/src/components/checkbox/__tests__/Checkbox.spec.ts +11 -0
- package/src/components/collapse/Collapse.theme.ts +11 -0
- package/src/components/collapse/Collapse.vue +99 -118
- package/src/components/collapse/__tests__/Collapse.spec.ts +11 -0
- package/src/components/container/Container.theme.ts +7 -0
- package/src/components/container/Container.vue +17 -9
- package/src/components/container/__tests__/Container.spec.ts +11 -0
- package/src/components/divider/Divider.theme.ts +11 -0
- package/src/components/divider/Divider.vue +22 -18
- package/src/components/divider/__tests__/Divider.spec.ts +11 -0
- package/src/components/drawer/Drawer.theme.ts +9 -0
- package/src/components/drawer/Drawer.vue +160 -177
- package/src/components/drawer/__tests__/Drawer.spec.ts +11 -0
- package/src/components/form/Form.theme.ts +7 -0
- package/src/components/form/Form.vue +90 -73
- package/src/components/form/__tests__/Form.spec.ts +11 -0
- package/src/components/helpers/InputError.tsx +14 -0
- package/src/components/icon/Icon.theme.ts +16 -0
- package/src/components/icon/Icon.vue +72 -88
- package/src/components/icon/__tests__/Icon.spec.ts +11 -0
- package/src/components/image/Image.theme.ts +7 -0
- package/src/components/image/Image.vue +22 -23
- package/src/components/image/__tests__/Image.spec.ts +11 -0
- package/src/components/index.ts +3 -3
- package/src/components/input/Input.theme.ts +44 -0
- package/src/components/input/Input.vue +97 -130
- package/src/components/input/__tests__/Input.spec.ts +11 -0
- package/src/components/link/Link.theme.ts +26 -0
- package/src/components/link/Link.vue +41 -66
- package/src/components/link/__tests__/Link.spec.ts +11 -0
- package/src/components/menu/Menu.theme.ts +7 -0
- package/src/components/menu/Menu.vue +54 -45
- package/src/components/menu/MenuItem.theme.ts +107 -0
- package/src/components/menu/MenuItem.vue +97 -199
- package/src/components/menu/__tests__/Menu.spec.ts +11 -0
- package/src/components/menu/__tests__/MenuItem.spec.ts +11 -0
- package/src/components/modal/Modal.theme.ts +29 -0
- package/src/components/modal/Modal.vue +78 -101
- package/src/components/modal/__tests__/Modal.spec.ts +11 -0
- package/src/components/notifications/Notifications.theme.ts +11 -0
- package/src/components/notifications/Notifications.vue +233 -247
- package/src/components/notifications/__tests__/Notifications.spec.ts +11 -0
- package/src/components/pagination/Pagination.theme.ts +27 -0
- package/src/components/pagination/Pagination.vue +142 -164
- package/src/components/pagination/PaginationItem.theme.ts +14 -0
- package/src/components/pagination/PaginationItem.vue +26 -33
- package/src/components/pagination/__tests__/Pagination.spec.ts +11 -0
- package/src/components/pagination/__tests__/PaginationItem.spec.ts +11 -0
- package/src/components/popover/Popover.theme.ts +9 -0
- package/src/components/popover/Popover.vue +153 -101
- package/src/components/popover/PopoverContainer.theme.ts +7 -0
- package/src/components/popover/PopoverContainer.vue +17 -9
- package/src/components/popover/__tests__/Popover.spec.ts +11 -0
- package/src/components/popover/__tests__/PopoverContainer.spec.ts +11 -0
- package/src/components/progress/Progress.theme.ts +26 -0
- package/src/components/progress/Progress.vue +29 -53
- package/src/components/progress/__tests__/Progress.spec.ts +11 -0
- package/src/components/radio/Radio.theme.ts +121 -0
- package/src/components/radio/Radio.vue +81 -158
- package/src/components/radio/__tests__/Radio.spec.ts +11 -0
- package/src/components/scroll/Scroll.theme.ts +7 -0
- package/src/components/scroll/Scroll.vue +34 -36
- package/src/components/scroll/__tests__/Scroll.spec.ts +11 -0
- package/src/components/select/Select.theme.ts +54 -0
- package/src/components/select/Select.vue +219 -273
- package/src/components/select/__tests__/Select.spec.ts +11 -0
- package/src/components/skeleton/Skeleton.theme.ts +7 -0
- package/src/components/skeleton/Skeleton.vue +17 -9
- package/src/components/skeleton/__tests__/Skeleton.spec.ts +11 -0
- package/src/components/slider/Slider.theme.ts +30 -0
- package/src/components/slider/Slider.vue +135 -168
- package/src/components/slider/__tests__/Slider.spec.ts +11 -0
- package/src/components/spacer/{Spacer.vue → Spacer.tsx} +3 -6
- package/src/components/spacer/__tests__/Spacer.spec.ts +11 -0
- package/src/components/spinner/Spinner.vue +10 -34
- package/src/components/spinner/__tests__/Spinner.spec.ts +11 -0
- package/src/components/tab/Tab.theme.ts +22 -0
- package/src/components/tab/Tab.vue +89 -93
- package/src/components/tab/TabGroup.theme.ts +43 -0
- package/src/components/tab/TabGroup.vue +94 -127
- package/src/components/tab/__tests__/Tab.spec.ts +11 -0
- package/src/components/tab/__tests__/TabGroup.spec.ts +11 -0
- package/src/components/table/Table.theme.ts +19 -0
- package/src/components/table/Table.vue +136 -147
- package/src/components/table/{TableBody.vue → TableBody.tsx} +3 -8
- package/src/components/table/TableCell.theme.ts +27 -0
- package/src/components/table/TableCell.vue +30 -58
- package/src/components/table/TableHead.tsx +14 -0
- package/src/components/table/TableHeader.vue +18 -20
- package/src/components/table/TableRow.vue +23 -20
- package/src/components/table/__tests__/Table.spec.ts +11 -0
- package/src/components/tag/Tag.theme.ts +32 -0
- package/src/components/tag/Tag.vue +40 -68
- package/src/components/tag/__tests__/Tag.spec.ts +11 -0
- package/src/components/textarea/Textarea.theme.ts +62 -0
- package/src/components/textarea/Textarea.vue +100 -115
- package/src/components/textarea/__tests__/Textarea.spec.ts +11 -0
- package/src/components/toggle/Toggle.theme.ts +51 -0
- package/src/components/toggle/Toggle.vue +51 -81
- package/src/components/toggle/__tests__/Toggle.spec.ts +11 -0
- package/src/components/tooltip/Tooltip.theme.ts +51 -0
- package/src/components/tooltip/Tooltip.vue +9 -14
- package/src/components/tooltip/__tests__/Tooltip.spec.ts +11 -0
- package/src/composables/colors-utils.ts +68 -68
- package/src/composables/colors.ts +18 -6
- package/src/composables/common.ts +1 -0
- package/src/composables/css.ts +7 -2
- package/src/composables/index.ts +1 -1
- package/src/composables/inputtable.ts +1 -1
- package/src/composables/interactive.ts +8 -4
- package/src/composables/keys.ts +1 -0
- package/src/composables/notifications.ts +10 -0
- package/src/composables/theme.ts +88 -0
- package/src/create.ts +8 -3
- package/src/exports/nuxt.js +2 -1
- package/src/version.ts +1 -1
- package/volar.d.ts +1 -0
- package/lib/components/spacer/Spacer.vue.d.ts +0 -2
- package/lib/components/table/TableBody.vue.d.ts +0 -2
- package/lib/components/table/TableHead.vue.d.ts +0 -2
- package/lib/composables/notification.d.ts +0 -1
- package/lib/style.css +0 -1
- package/src/components/table/TableHead.vue +0 -15
- package/src/composables/notification.ts +0 -10
package/lib/nuxt.js
CHANGED
|
@@ -6,7 +6,7 @@ export default defineNuxtModule({
|
|
|
6
6
|
name: '@indielayer/ui',
|
|
7
7
|
configKey: 'indielayer',
|
|
8
8
|
compatibility: {
|
|
9
|
-
nuxt: '^3.0.0',
|
|
9
|
+
nuxt: '^3.0.0-rc.1',
|
|
10
10
|
},
|
|
11
11
|
},
|
|
12
12
|
defaults: {
|
|
@@ -25,6 +25,7 @@ export default defineNuxtModule({
|
|
|
25
25
|
nuxt.hook('components:dirs', (dirs) => {
|
|
26
26
|
dirs.push({
|
|
27
27
|
path: fileURLToPath(new URL('../src/components', import.meta.url)),
|
|
28
|
+
extensions: ['vue', 'tsx'],
|
|
28
29
|
prefix: options?.prefix ? options?.prefix : 'X',
|
|
29
30
|
})
|
|
30
31
|
})
|
package/lib/version.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
declare const _default: "1.0.
|
|
1
|
+
declare const _default: "1.0.1";
|
|
2
2
|
export default _default;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@indielayer/ui",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.1",
|
|
4
4
|
"description": "Indielayer UI Components with Tailwind CSS build for Vue 3",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "João Teixeira",
|
|
@@ -41,16 +41,19 @@
|
|
|
41
41
|
},
|
|
42
42
|
"sideEffects": false,
|
|
43
43
|
"scripts": {
|
|
44
|
-
"dev": "
|
|
45
|
-
"dev2": "
|
|
44
|
+
"dev": "vite build --watch",
|
|
45
|
+
"dev2": "pnpm build-only && chokidar \"./src/**\" -c \"pnpm build-only\"",
|
|
46
46
|
"build": "pnpm generate && vite build",
|
|
47
47
|
"build-prod": "pnpm build && pnpm gen-types",
|
|
48
|
-
"typecheck": "vue-tsc --noEmit",
|
|
49
48
|
"build-only": "vite build",
|
|
50
49
|
"generate": "pnpm gen-version",
|
|
51
|
-
"gen-types": "vue-tsc --declaration --emitDeclarationOnly",
|
|
50
|
+
"gen-types": "vue-tsc --declaration --emitDeclarationOnly -p tsconfig.vitest.json --composite false",
|
|
52
51
|
"gen-version": "node .scripts/gen-version.js",
|
|
53
|
-
"test": "
|
|
52
|
+
"test": "pnpm test:unit",
|
|
53
|
+
"test:unit": "vitest --environment jsdom",
|
|
54
|
+
"test:e2e": "start-server-and-test preview http://127.0.0.1:5050/ 'cypress open'",
|
|
55
|
+
"test:e2e:ci": "start-server-and-test preview http://127.0.0.1:5050/ 'cypress run'",
|
|
56
|
+
"typecheck": "vue-tsc --noEmit -p tsconfig.vitest.json --composite false"
|
|
54
57
|
},
|
|
55
58
|
"peerDependencies": {
|
|
56
59
|
"tailwindcss": "^3.0.0",
|
|
@@ -60,22 +63,29 @@
|
|
|
60
63
|
"@cypress/vite-dev-server": "^2.2.2",
|
|
61
64
|
"@cypress/vue": "^3.1.1",
|
|
62
65
|
"@rushstack/eslint-patch": "^1.1.3",
|
|
66
|
+
"@types/jsdom": "^16.2.14",
|
|
63
67
|
"@types/node": "^17.0.30",
|
|
68
|
+
"@types/ramda": "^0.28.15",
|
|
64
69
|
"@vitejs/plugin-vue": "^2.3.1",
|
|
65
70
|
"@vitejs/plugin-vue-jsx": "^1.3.10",
|
|
71
|
+
"@vue/test-utils": "^2.0.0-rc.20",
|
|
66
72
|
"@vue/tsconfig": "^0.1.3",
|
|
67
73
|
"@vueuse/core": "^8.4.2",
|
|
68
74
|
"autoprefixer": "^10.4.0",
|
|
75
|
+
"c8": "^7.12.0",
|
|
69
76
|
"chokidar-cli": "^3.0.0",
|
|
70
77
|
"clean-css": "^5.3.0",
|
|
71
78
|
"cypress": "^9.6.0",
|
|
72
79
|
"eslint": "^8.16.0",
|
|
73
80
|
"eslint-plugin-cypress": "^2.12.1",
|
|
81
|
+
"jsdom": "^19.0.0",
|
|
74
82
|
"postcss": "^8.4.4",
|
|
83
|
+
"ramda": "^0.28.0",
|
|
75
84
|
"start-server-and-test": "^1.14.0",
|
|
76
85
|
"tailwindcss": "^3.0.0",
|
|
77
86
|
"typescript": "~4.6.3",
|
|
78
87
|
"vite": "^2.9.5",
|
|
88
|
+
"vitest": "^0.9.3",
|
|
79
89
|
"vue": "^3.2.33",
|
|
80
90
|
"vue-tsc": "^0.34.15"
|
|
81
91
|
},
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export const infoIcon = '<path d="M13 16h-1v-4h-1m1-4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z" />'
|
|
2
|
+
export const successIcon = '<path d="M9 12l2 2 4-4m6 2a9 9 0 11-18 0 9 9 0 0118 0z" />'
|
|
3
|
+
export const errorIcon = '<path d="M12 8v4m0 4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z" />'
|
|
4
|
+
export const warningIcon = '<path d="M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z" />'
|
|
5
|
+
export const closeIcon = '<path d="M6 18L18 6M6 6l12 12" />'
|
|
6
|
+
export const avatarIcon = '<path d="M16 7a4 4 0 11-8 0 4 4 0 018 0zM12 14a7 7 0 00-7 7h14a7 7 0 00-7-7z" />'
|
|
7
|
+
export const arrowRightIcon = '<path d="M13 7l5 5m0 0l-5 5m5-5H6" />'
|
|
8
|
+
export const eyeIcon = '<path d="M15 12a3 3 0 11-6 0 3 3 0 016 0z" /><path d="M2.458 12C3.732 7.943 7.523 5 12 5c4.478 0 8.268 2.943 9.542 7-1.274 4.057-5.064 7-9.542 7-4.477 0-8.268-2.943-9.542-7z" />'
|
|
9
|
+
export const eyeVisibleIcon = '<path d="M13.875 18.825A10.05 10.05 0 0112 19c-4.478 0-8.268-2.943-9.543-7a9.97 9.97 0 011.563-3.029m5.858.908a3 3 0 114.243 4.243M9.878 9.878l4.242 4.242M9.88 9.88l-3.29-3.29m7.532 7.532l3.29 3.29M3 3l3.59 3.59m0 0A9.953 9.953 0 0112 5c4.478 0 8.268 2.943 9.543 7a10.025 10.025 0 01-4.132 5.411m0 0L21 21" />'
|
|
10
|
+
export const dotsIcon = '<path d="M5 12h.01M12 12h.01M19 12h.01M6 12a1 1 0 11-2 0 1 1 0 012 0zm7 0a1 1 0 11-2 0 1 1 0 012 0zm7 0a1 1 0 11-2 0 1 1 0 012 0z" />'
|
|
11
|
+
export const prevIcon = '<path d="M15 19l-7-7 7-7" />'
|
|
12
|
+
export const nextIcon = '<path d="M9 5l7 7-7 7" />'
|
|
13
|
+
export const checkIcon = '<path d="M5 13l4 4L19 7" />'
|
|
14
|
+
export const chevronDownIcon = '<path d="M8 9l4-4 4 4m0 6l-4 4-4-4" />'
|
|
15
|
+
export const externalIcon = '<line x1="7" y1="17" x2="17" y2="7" /><polyline points="7 7 17 7 17 17" />'
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { unref, isRef } from 'vue'
|
|
2
|
+
|
|
3
|
+
const isObject = (val: any) => val !== null && typeof val === 'object'
|
|
4
|
+
const isArray = Array.isArray
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Deeply unref a value, recursing into objects and arrays.
|
|
8
|
+
*
|
|
9
|
+
* @param {Mixed} val - The value to deeply unref.
|
|
10
|
+
*
|
|
11
|
+
* @return {Mixed}
|
|
12
|
+
*/
|
|
13
|
+
export const deepUnref = (val: any) => {
|
|
14
|
+
const checkedVal = isRef(val) ? unref(val) : val
|
|
15
|
+
|
|
16
|
+
if (!isObject(checkedVal)) {
|
|
17
|
+
return checkedVal
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
if (isArray(checkedVal)) {
|
|
21
|
+
return unrefArray(checkedVal)
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
return unrefObject(checkedVal)
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* Unref a value, recursing into it if it's an object.
|
|
29
|
+
*
|
|
30
|
+
* @param {Mixed} val - The value to unref.
|
|
31
|
+
*
|
|
32
|
+
* @return {Mixed}
|
|
33
|
+
*/
|
|
34
|
+
export const smartUnref = (val: any) => {
|
|
35
|
+
// Non-ref object? Go deeper!
|
|
36
|
+
if (val !== null && !isRef(val) && typeof val === 'object') {
|
|
37
|
+
return deepUnref(val)
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
return unref(val)
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* Unref an array, recursively.
|
|
45
|
+
*
|
|
46
|
+
* @param {Array} arr - The array to unref.
|
|
47
|
+
*
|
|
48
|
+
* @return {Array}
|
|
49
|
+
*/
|
|
50
|
+
export const unrefArray: any = (arr: []) => arr.map(smartUnref)
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* Unref an object, recursively.
|
|
54
|
+
*
|
|
55
|
+
* @param {Object} obj - The object to unref.
|
|
56
|
+
*
|
|
57
|
+
* @return {Object}
|
|
58
|
+
*/
|
|
59
|
+
export const unrefObject = (obj: any) => {
|
|
60
|
+
const unreffed: any = {}
|
|
61
|
+
|
|
62
|
+
// Object? un-ref it!
|
|
63
|
+
Object.keys(obj).forEach((key) => {
|
|
64
|
+
unreffed[key] = smartUnref(obj[key])
|
|
65
|
+
})
|
|
66
|
+
|
|
67
|
+
return unreffed
|
|
68
|
+
}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import type { ThemeParams } from '../../composables/theme'
|
|
2
|
+
|
|
3
|
+
export default {
|
|
4
|
+
classes: {
|
|
5
|
+
/*tw*/
|
|
6
|
+
wrapper: 'flex rounded-md space-x-2 px-4 py-2 border items-center',
|
|
7
|
+
},
|
|
8
|
+
styles: ({ props, colors, css }: ThemeParams) => {
|
|
9
|
+
const color = colors.getPalette(props.color)
|
|
10
|
+
const vars: (object | string)[] = []
|
|
11
|
+
|
|
12
|
+
if (props.glow) vars.push(css.get('glow', colors.getColorOpacity(color[500], 0.5)))
|
|
13
|
+
|
|
14
|
+
if (props.color) {
|
|
15
|
+
if (props.light) {
|
|
16
|
+
vars.push(css.variables({
|
|
17
|
+
bg: color[50],
|
|
18
|
+
text: color[600],
|
|
19
|
+
icon: color[600],
|
|
20
|
+
border: props.outlined ? color[600] : color[50],
|
|
21
|
+
dark: {
|
|
22
|
+
bg: color[200],
|
|
23
|
+
text: color[800],
|
|
24
|
+
icon: color[600],
|
|
25
|
+
border: props.outlined ? color[500] : color[200],
|
|
26
|
+
},
|
|
27
|
+
}))
|
|
28
|
+
} else {
|
|
29
|
+
vars.push(css.variables({
|
|
30
|
+
bg: props.outlined ? 'transparent' : color[600],
|
|
31
|
+
text: props.outlined ? color[600] : color[50],
|
|
32
|
+
icon: props.outlined ? color[600] : color[50],
|
|
33
|
+
border: color[600],
|
|
34
|
+
dark: {
|
|
35
|
+
border: color[400],
|
|
36
|
+
text: props.outlined ? color[400] : color[50],
|
|
37
|
+
},
|
|
38
|
+
}))
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
return vars
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
vars.push(css.variables({
|
|
45
|
+
bg: 'transparent',
|
|
46
|
+
text: color[500],
|
|
47
|
+
border: color[300],
|
|
48
|
+
dark: {
|
|
49
|
+
bg: 'transparent',
|
|
50
|
+
text: color[300],
|
|
51
|
+
border: color[500],
|
|
52
|
+
},
|
|
53
|
+
}))
|
|
54
|
+
|
|
55
|
+
return vars
|
|
56
|
+
},
|
|
57
|
+
}
|
|
@@ -1,151 +1,75 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
import { useCSS } from '../../composables/css'
|
|
5
|
-
|
|
6
|
-
export default defineComponent({
|
|
7
|
-
name: 'XAlert',
|
|
8
|
-
|
|
9
|
-
props: {
|
|
10
|
-
...useColors.props(),
|
|
11
|
-
tag: {
|
|
12
|
-
type: String,
|
|
13
|
-
default: 'div',
|
|
14
|
-
},
|
|
15
|
-
type: String as PropType<'info' | 'success' | 'error' | 'warning' | undefined>,
|
|
16
|
-
glow: Boolean,
|
|
17
|
-
light: Boolean,
|
|
18
|
-
outlined: Boolean,
|
|
19
|
-
removable: Boolean,
|
|
20
|
-
},
|
|
21
|
-
|
|
22
|
-
emits: ['remove'],
|
|
2
|
+
export default { name: 'XAlert' }
|
|
3
|
+
</script>
|
|
23
4
|
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
const color = colors.getPalette(props.color)
|
|
30
|
-
const vars: (object | string)[] = []
|
|
5
|
+
<script setup lang="ts">
|
|
6
|
+
import { computed, type PropType } from 'vue'
|
|
7
|
+
import { useColors } from '../../composables/colors'
|
|
8
|
+
import { useTheme } from '../../composables/theme'
|
|
9
|
+
import { closeIcon, successIcon, errorIcon, warningIcon, infoIcon } from '../../common/icons'
|
|
31
10
|
|
|
32
|
-
|
|
11
|
+
import XIcon from '../icon/Icon.vue'
|
|
33
12
|
|
|
34
|
-
|
|
35
|
-
if (props.light) {
|
|
36
|
-
vars.push(css.variables({
|
|
37
|
-
bg: color[50],
|
|
38
|
-
text: color[600],
|
|
39
|
-
icon: color[600],
|
|
40
|
-
border: props.outlined ? color[600] : color[50],
|
|
41
|
-
dark: {
|
|
42
|
-
bg: color[200],
|
|
43
|
-
text: color[800],
|
|
44
|
-
icon: color[600],
|
|
45
|
-
border: props.outlined ? color[500] : color[200],
|
|
46
|
-
},
|
|
47
|
-
}))
|
|
48
|
-
} else {
|
|
49
|
-
vars.push(css.variables({
|
|
50
|
-
bg: props.outlined ? 'transparent' : color[600],
|
|
51
|
-
text: props.outlined ? color[600] : color[50],
|
|
52
|
-
icon: props.outlined ? color[600] : color[50],
|
|
53
|
-
border: color[600],
|
|
54
|
-
dark: {
|
|
55
|
-
border: color[400],
|
|
56
|
-
text: props.outlined ? color[400] : color[50],
|
|
57
|
-
},
|
|
58
|
-
}))
|
|
59
|
-
}
|
|
13
|
+
import theme from './Alert.theme'
|
|
60
14
|
|
|
61
|
-
|
|
62
|
-
|
|
15
|
+
const props = defineProps({
|
|
16
|
+
...useColors.props(),
|
|
17
|
+
type: String as PropType<'info' | 'success' | 'error' | 'warning' | undefined>,
|
|
18
|
+
glow: Boolean,
|
|
19
|
+
light: Boolean,
|
|
20
|
+
outlined: Boolean,
|
|
21
|
+
removable: Boolean,
|
|
22
|
+
})
|
|
63
23
|
|
|
64
|
-
|
|
65
|
-
bg: 'transparent',
|
|
66
|
-
text: color[500],
|
|
67
|
-
border: color[300],
|
|
68
|
-
dark: {
|
|
69
|
-
bg: 'transparent',
|
|
70
|
-
text: color[300],
|
|
71
|
-
border: color[500],
|
|
72
|
-
},
|
|
73
|
-
}))
|
|
24
|
+
defineEmits(['remove'])
|
|
74
25
|
|
|
75
|
-
|
|
76
|
-
|
|
26
|
+
const icon = computed(() => {
|
|
27
|
+
if (props.type === 'info') return infoIcon
|
|
28
|
+
else if (props.type === 'success') return successIcon
|
|
29
|
+
else if (props.type === 'error') return errorIcon
|
|
30
|
+
else if (props.type === 'warning') return warningIcon
|
|
77
31
|
|
|
78
|
-
|
|
79
|
-
styles,
|
|
80
|
-
}
|
|
81
|
-
},
|
|
32
|
+
return ''
|
|
82
33
|
})
|
|
34
|
+
|
|
35
|
+
const { styles, classes, className } = useTheme('alert', theme, props)
|
|
83
36
|
</script>
|
|
84
37
|
|
|
85
38
|
<template>
|
|
86
|
-
<
|
|
87
|
-
:
|
|
88
|
-
class="flex rounded-md px-4 py-2 border items-center"
|
|
39
|
+
<div
|
|
40
|
+
:style="styles"
|
|
89
41
|
:class="[
|
|
42
|
+
className,
|
|
90
43
|
$style['alert'],
|
|
91
44
|
glow ? $style['alert--glow'] : '',
|
|
45
|
+
classes.wrapper,
|
|
92
46
|
]"
|
|
93
|
-
:style="styles"
|
|
94
47
|
>
|
|
95
|
-
<div v-if="$slots.icon" class="flex-none pr-2">
|
|
96
|
-
<slot name="icon"></slot>
|
|
97
|
-
</div>
|
|
98
|
-
<svg
|
|
99
|
-
v-else-if="type"
|
|
100
|
-
width="24"
|
|
101
|
-
height="24"
|
|
102
|
-
viewBox="0 0 24 24"
|
|
103
|
-
stroke="currentColor"
|
|
104
|
-
stroke-linejoin="round"
|
|
105
|
-
stroke-linecap="round"
|
|
106
|
-
fill="none"
|
|
107
|
-
role="presentation"
|
|
108
|
-
class="flex-none stroke-2 w-5 h-5 mr-2 text-[color:var(--x-alert-icon)] dark:text-[color:var(--x-dark-alert-icon)]"
|
|
109
|
-
>
|
|
110
|
-
<template v-if="type === 'info'">
|
|
111
|
-
<path d="M13 16h-1v-4h-1m1-4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z" />
|
|
112
|
-
</template>
|
|
113
|
-
|
|
114
|
-
<template v-if="type === 'success'">
|
|
115
|
-
<path d="M9 12l2 2 4-4m6 2a9 9 0 11-18 0 9 9 0 0118 0z" />
|
|
116
|
-
</template>
|
|
117
48
|
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
</
|
|
49
|
+
<slot name="icon">
|
|
50
|
+
<x-icon
|
|
51
|
+
v-if="type"
|
|
52
|
+
:icon="icon"
|
|
53
|
+
class="text-[color:var(--x-alert-icon)] dark:text-[color:var(--x-alert-dark-icon)]"
|
|
54
|
+
/>
|
|
55
|
+
</slot>
|
|
125
56
|
|
|
126
|
-
<
|
|
57
|
+
<div>
|
|
58
|
+
<slot></slot>
|
|
59
|
+
</div>
|
|
127
60
|
|
|
128
61
|
<template v-if="removable">
|
|
129
62
|
<div class="flex-grow"></div>
|
|
130
|
-
<
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
stroke-linejoin="round"
|
|
136
|
-
stroke-linecap="round"
|
|
137
|
-
fill="none"
|
|
138
|
-
role="presentation"
|
|
139
|
-
class="stroke-2 w-5 h-5 ml-1 cursor-pointer shrink-0"
|
|
140
|
-
@click="(e) => $emit('remove', e)"
|
|
141
|
-
>
|
|
142
|
-
<path d="M6 18L18 6M6 6l12 12" />
|
|
143
|
-
</svg>
|
|
63
|
+
<span class="flex items-center cursor-pointer shrink-0" @click="(e) => $emit('remove', e)">
|
|
64
|
+
<slot name="removeIcon">
|
|
65
|
+
<x-icon :icon="closeIcon"/>
|
|
66
|
+
</slot>
|
|
67
|
+
</span>
|
|
144
68
|
</template>
|
|
145
|
-
</
|
|
69
|
+
</div>
|
|
146
70
|
</template>
|
|
147
71
|
|
|
148
|
-
<style lang="postcss" module
|
|
72
|
+
<style lang="postcss" module>
|
|
149
73
|
.alert {
|
|
150
74
|
color: var(--x-alert-text);
|
|
151
75
|
background-color: var(--x-alert-bg);
|
|
@@ -155,10 +79,10 @@ export default defineComponent({
|
|
|
155
79
|
box-shadow: 0 0 #000, 0 0 #000, 0 10px 15px -3px var(--x-alert-glow), 0 4px 6px -4px var(--x-alert-glow);
|
|
156
80
|
}
|
|
157
81
|
|
|
158
|
-
:global(.dark)
|
|
159
|
-
color: var(--x-dark-
|
|
160
|
-
background-color: var(--x-dark-
|
|
161
|
-
border-color: var(--x-dark-
|
|
82
|
+
:global(.dark) &, &:global(.dark) {
|
|
83
|
+
color: var(--x-alert-dark-text, var(--x-alert-text));
|
|
84
|
+
background-color: var(--x-alert-dark-bg, var(--x-alert-bg));
|
|
85
|
+
border-color: var(--x-alert-dark-border, var(--x-alert-border));
|
|
162
86
|
}
|
|
163
87
|
}
|
|
164
88
|
</style>
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { describe, it, expect } from 'vitest'
|
|
2
|
+
import { mount } from '@vue/test-utils'
|
|
3
|
+
import Alert from '../Alert.vue'
|
|
4
|
+
|
|
5
|
+
describe('Alert', () => {
|
|
6
|
+
it('renders properly', () => {
|
|
7
|
+
const wrapper = mount(Alert)
|
|
8
|
+
|
|
9
|
+
expect(wrapper.vm).toBeTruthy()
|
|
10
|
+
// expect(wrapper.isVueInstance()).toBeTruthy()
|
|
11
|
+
|
|
12
|
+
// expect(wrapper.text()).toContain('Hi there!')
|
|
13
|
+
})
|
|
14
|
+
})
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import type { ThemeParams } from '../../composables/theme'
|
|
2
|
+
|
|
3
|
+
export default {
|
|
4
|
+
classes: {
|
|
5
|
+
wrapper({ props }: ThemeParams) {
|
|
6
|
+
const classes = ['relative inline-flex items-center justify-center overflow-hidden align-middle border box-content']
|
|
7
|
+
|
|
8
|
+
// radius
|
|
9
|
+
classes.push(props.rounded ? 'rounded-full' : 'rounded-md')
|
|
10
|
+
|
|
11
|
+
// size
|
|
12
|
+
if (props.size === 'xs') classes.push('h-6 w-6 text-xs')
|
|
13
|
+
else if (props.size === 'sm') classes.push('h-9 w-9 text-sm')
|
|
14
|
+
else if (props.size === 'lg') classes.push('h-12 w-12 text-lg')
|
|
15
|
+
else if (props.size === 'xl') classes.push('h-[3.75rem] w-[3.75rem] text-xl')
|
|
16
|
+
else classes.push('h-10 w-10')
|
|
17
|
+
|
|
18
|
+
return classes
|
|
19
|
+
},
|
|
20
|
+
},
|
|
21
|
+
|
|
22
|
+
styles({ props, colors, css, data }: ThemeParams) {
|
|
23
|
+
const color = colors.getPalette(props.color)
|
|
24
|
+
|
|
25
|
+
if (data.source) return css.variables({
|
|
26
|
+
bg: 'transparent',
|
|
27
|
+
border: props.outlined ? color[500] : 'transparent',
|
|
28
|
+
})
|
|
29
|
+
|
|
30
|
+
return css.variables({
|
|
31
|
+
bg: color[100],
|
|
32
|
+
text: color[500],
|
|
33
|
+
border: props.outlined ? color[500] : 'transparent',
|
|
34
|
+
dark: {
|
|
35
|
+
bg: color[900],
|
|
36
|
+
},
|
|
37
|
+
})
|
|
38
|
+
},
|
|
39
|
+
}
|