@indielayer/ui 1.0.0-alpha.0 → 1.0.0-alpha.2
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 +26 -10
- package/lib/components/avatar/Avatar.vue.d.ts +2 -2
- package/lib/components/badge/Badge.vue.d.ts +2 -2
- package/lib/components/button/Button.vue.d.ts +2 -2
- package/lib/components/button/ButtonGroup.vue.d.ts +2 -2
- package/lib/components/checkbox/Checkbox.vue.d.ts +5 -4
- package/lib/components/drawer/Drawer.vue.d.ts +1 -1
- package/lib/components/icon/Icon.vue.d.ts +2 -2
- package/lib/components/index.d.ts +2 -2
- package/lib/components/input/Input.vue.d.ts +4 -3
- package/lib/components/menu/Menu.vue.d.ts +2 -2
- package/lib/components/menu/MenuItem.vue.d.ts +3 -3
- package/lib/components/notifications/Notifications.vue.d.ts +2 -2
- package/lib/components/pagination/Pagination.vue.d.ts +3 -2
- package/lib/components/pagination/PaginationItem.vue.d.ts +2 -2
- package/lib/components/radio/Radio.vue.d.ts +3 -3
- package/lib/components/select/Select.vue.d.ts +4 -3
- package/lib/components/slider/Slider.vue.d.ts +3 -3
- package/lib/components/spacer/Spacer.vue.d.ts +1 -1
- package/lib/components/spinner/Spinner.vue.d.ts +2 -2
- package/lib/components/{tabs → tab}/Tab.vue.d.ts +2 -2
- package/lib/components/{tabs/Tabs.vue.d.ts → tab/TabGroup.vue.d.ts} +0 -0
- package/lib/components/table/TableBody.vue.d.ts +1 -1
- package/lib/components/table/TableHead.vue.d.ts +1 -1
- package/lib/components/tag/Tag.vue.d.ts +2 -2
- package/lib/components/textarea/Textarea.vue.d.ts +4 -12
- package/lib/components/toggle/Toggle.vue.d.ts +3 -3
- package/lib/composables/colors.d.ts +1 -1
- package/lib/composables/css.d.ts +4 -4
- package/lib/composables/keys.d.ts +1 -0
- package/lib/create.d.ts +11 -0
- package/lib/index.cjs.js +2 -2
- package/lib/index.d.ts +2 -0
- package/lib/index.es.js +183 -107
- package/lib/install.d.ts +4 -6
- package/lib/nuxt.js +15 -16
- package/lib/nuxt.plugin.js +8 -0
- package/lib/style.css +1 -1
- package/lib/version.d.ts +1 -1
- package/package.json +19 -15
- package/src/components/alert/Alert.vue +164 -0
- package/src/components/avatar/Avatar.vue +137 -0
- package/src/components/badge/Badge.vue +107 -0
- package/src/components/breadcrumbs/Breadcrumbs.vue +60 -0
- package/src/components/button/Button.vue +433 -0
- package/src/components/button/ButtonGroup.vue +73 -0
- package/src/components/card/Card.vue +25 -0
- package/src/components/checkbox/Checkbox.vue +205 -0
- package/src/components/collapse/Collapse.vue +181 -0
- package/src/components/container/Container.vue +23 -0
- package/src/components/divider/Divider.vue +52 -0
- package/src/components/drawer/Drawer.vue +244 -0
- package/src/components/form/Form.vue +111 -0
- package/src/components/icon/Icon.vue +56 -0
- package/src/components/image/Image.vue +36 -0
- package/src/components/index.ts +45 -0
- package/src/components/input/Input.vue +198 -0
- package/src/components/link/Link.vue +110 -0
- package/src/components/menu/Menu.vue +118 -0
- package/src/components/menu/MenuItem.vue +277 -0
- package/src/components/modal/Modal.vue +175 -0
- package/src/components/notifications/Notifications.vue +318 -0
- package/src/components/pagination/Pagination.vue +181 -0
- package/src/components/pagination/PaginationItem.vue +58 -0
- package/src/components/popover/Popover.vue +194 -0
- package/src/components/popover/PopoverContainer.vue +23 -0
- package/src/components/progress/Progress.vue +86 -0
- package/src/components/radio/Radio.vue +220 -0
- package/src/components/scroll/Scroll.vue +143 -0
- package/src/components/select/Select.vue +408 -0
- package/src/components/skeleton/Skeleton.vue +23 -0
- package/src/components/slider/Slider.vue +240 -0
- package/src/components/spacer/Spacer.vue +11 -0
- package/src/components/spinner/Spinner.vue +45 -0
- package/src/components/tab/Tab.vue +100 -0
- package/src/components/tab/TabGroup.vue +151 -0
- package/src/components/table/Table.vue +172 -0
- package/src/components/table/TableBody.vue +13 -0
- package/src/components/table/TableCell.vue +78 -0
- package/src/components/table/TableHead.vue +15 -0
- package/src/components/table/TableHeader.vue +94 -0
- package/src/components/table/TableRow.vue +43 -0
- package/src/components/tag/Tag.vue +98 -0
- package/src/components/textarea/Textarea.vue +156 -0
- package/src/components/toggle/Toggle.vue +144 -0
- package/src/components/tooltip/Tooltip.vue +26 -0
- package/src/composables/colors-utils.ts +378 -0
- package/src/composables/colors.ts +82 -0
- package/src/composables/common.ts +20 -0
- package/src/composables/css.ts +45 -0
- package/src/composables/index.ts +7 -0
- package/src/composables/inputtable.ts +128 -0
- package/src/composables/interactive.ts +16 -0
- package/src/composables/keys.ts +8 -0
- package/src/composables/notification.ts +10 -0
- package/src/create.ts +36 -0
- package/src/exports/nuxt.js +32 -0
- package/src/exports/nuxt.plugin.js +8 -0
- package/src/exports/tailwind.preset.js +55 -0
- package/src/index.ts +8 -0
- package/src/install.ts +8 -0
- package/src/shims-vue.d.ts +6 -0
- package/src/version.ts +1 -0
package/lib/install.d.ts
CHANGED
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
declare const install: (app: App, options?: IndielayerUIOptions) => void;
|
|
6
|
-
export default install;
|
|
1
|
+
declare const _default: {
|
|
2
|
+
install: (app: import("vue").App<any>, installOptions?: import("./create").IndielayerUIOptions) => void;
|
|
3
|
+
};
|
|
4
|
+
export default _default;
|
package/lib/nuxt.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { defineNuxtModule } from '@nuxt/kit'
|
|
2
|
-
import
|
|
1
|
+
import { defineNuxtModule, addPlugin, createResolver } from '@nuxt/kit'
|
|
2
|
+
import { fileURLToPath } from 'node:url'
|
|
3
3
|
|
|
4
4
|
export default defineNuxtModule({
|
|
5
5
|
meta: {
|
|
@@ -12,22 +12,21 @@ export default defineNuxtModule({
|
|
|
12
12
|
defaults: {
|
|
13
13
|
prefix: 'X',
|
|
14
14
|
},
|
|
15
|
-
async setup(
|
|
15
|
+
async setup(options, nuxt) {
|
|
16
|
+
// Create resolver to resolve relative paths
|
|
17
|
+
const { resolve } = createResolver(import.meta.url)
|
|
18
|
+
|
|
19
|
+
nuxt.options.runtimeConfig.public.indielayerOptions = options
|
|
20
|
+
|
|
16
21
|
// plugin install
|
|
17
|
-
nuxt.
|
|
22
|
+
addPlugin(resolve('./nuxt.plugin.js'))
|
|
18
23
|
|
|
19
24
|
// nuxt install
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
// // temp import XTab - would be XTabsTab
|
|
27
|
-
// dirs.push({
|
|
28
|
-
// path: join(__dirname, 'components/tabs'),
|
|
29
|
-
// prefix: options?.prefix ? options?.prefix : 'X',
|
|
30
|
-
// })
|
|
31
|
-
// })
|
|
25
|
+
nuxt.hook('components:dirs', (dirs) => {
|
|
26
|
+
dirs.push({
|
|
27
|
+
path: fileURLToPath(new URL('../src/components', import.meta.url)),
|
|
28
|
+
prefix: options?.prefix ? options?.prefix : 'X',
|
|
29
|
+
})
|
|
30
|
+
})
|
|
32
31
|
},
|
|
33
32
|
})
|
package/lib/style.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
._alert_1sdha_2[data-v-
|
|
1
|
+
._alert_1sdha_2[data-v-35ce54d8]{color:var(--x-alert-text);background-color:var(--x-alert-bg);border-color:var(--x-alert-border)}._alert--glow_1sdha_1[data-v-35ce54d8]{box-shadow:0 0 #000,0 0 #000,0 10px 15px -3px var(--x-alert-glow),0 4px 6px -4px var(--x-alert-glow)}.dark ._alert_1sdha_2[data-v-35ce54d8]{color:var(--x-dark-alert-text, var(--x-alert-text));background-color:var(--x-dark-alert-bg, var(--x-alert-bg));border-color:var(--x-dark-alert-border, var(--x-alert-border))}._avatar_v7jzc_2[data-v-243016db]{color:var(--x-avatar-text);background-color:var(--x-avatar-bg);border-color:var(--x-avatar-border)}.dark ._avatar_v7jzc_2[data-v-243016db]{color:var(--x-dark-avatar-text, var(--x-avatar-text));background-color:var(--x-dark-avatar-bg, var(--x-avatar-bg));border-color:var(--x-dark-avatar-border, var(--x-avatar-border))}._button_1sbr9_2[data-v-d8eeb328]{color:var(--x-button-text);background-color:var(--x-button-bg);border-color:var(--x-button-border)}._button--glow_1sbr9_1[data-v-d8eeb328]{box-shadow:0 0 #000,0 0 #000,0 10px 15px -3px var(--x-button-glow),0 4px 6px -4px var(--x-button-glow)}._button_1sbr9_2[data-v-d8eeb328]:hover{color:var(--x-button-text-hover, var(--x-button-text));background-color:var(--x-button-bg-hover, var(--x-button-bg));border-color:var(--x-button-border-hover, var(--x-button-border))}._button_1sbr9_2[data-v-d8eeb328]:active{color:var(--x-button-text-active, var(--x-button-text));background-color:var(--x-button-bg-active, var(--x-button-bg));border-color:var(--x-button-border-active, var(--x-button-border))}.dark ._button_1sbr9_2[data-v-d8eeb328]{color:var(--x-dark-button-text, var(--x-button-text));background-color:var(--x-dark-button-bg, var(--x-button-bg));border-color:var(--x-dark-button-border, var(--x-button-border))}.dark ._button_1sbr9_2[data-v-d8eeb328]:hover{color:var(--x-dark-button-text-hover, var(--x-dark-button-text, var(--x-button-text)));background-color:var(--x-dark-button-bg-hover, var(--x-dark-button-bg, var(--x-button-bg)));border-color:var(--x-dark-button-border-hover, var(--x-dark-button-border, var(--x-button-border)))}.dark ._button_1sbr9_2[data-v-d8eeb328]:active{color:var(--x-dark-button-text-active, var(--x-dark-button-text));background-color:var(--x-dark-button-bg-active, var(--x-dark-button-bg, var(--x-button-bg)));border-color:var(--x-dark-button-border-active, var(--x-dark-button-border, var(--x-button-border)))}._button-group_s7fyl_2:not(._button-group--rounded_s7fyl_1)>:first-child{border-top-left-radius:.375rem;border-bottom-left-radius:.375rem;border-left-width:1px}._button-group_s7fyl_2:not(._button-group--rounded_s7fyl_1)>:last-child{border-top-right-radius:.375rem;border-bottom-right-radius:.375rem}._button-group--rounded_s7fyl_1>:first-of-type{border-top-left-radius:9999px;border-bottom-left-radius:9999px;border-left-width:1px}._button-group--rounded_s7fyl_1>:last-child{border-top-right-radius:9999px;border-bottom-right-radius:9999px}._checkbox--glow_1dz66_1[data-v-54fce636]{box-shadow:0 0 #000,0 0 #000,0 10px 15px -3px var(--x-glow),0 4px 6px -4px var(--x-glow)}._scrollWrap_1k3q9_2[data-v-ff88aa62]:before,._scrollWrap_1k3q9_2[data-v-ff88aa62]:after{content:"";pointer-events:none;position:absolute;z-index:1;transition:box-shadow .2s}._scrollWrap_1k3q9_2._horizontal_1k3q9_11[data-v-ff88aa62]:before,._scrollWrap_1k3q9_2._horizontal_1k3q9_11[data-v-ff88aa62]:after{top:0;bottom:0;width:20px}._scrollWrap_1k3q9_2._vertical_1k3q9_17[data-v-ff88aa62]:before,._scrollWrap_1k3q9_2._vertical_1k3q9_17[data-v-ff88aa62]:after{right:0;left:0;height:20px}._scrollWrap_1k3q9_2._horizontal_1k3q9_11[data-v-ff88aa62]:before{left:0}._scrollWrap_1k3q9_2._horizontal_1k3q9_11[data-v-ff88aa62]:after{right:0}._scrollWrap_1k3q9_2._vertical_1k3q9_17[data-v-ff88aa62]:before{top:0}._scrollWrap_1k3q9_2._vertical_1k3q9_17[data-v-ff88aa62]:after{bottom:0}._scrollWrap_1k3q9_2._shadow-left_1k3q9_36[data-v-ff88aa62]:before{box-shadow:inset 12px 0 10px -10px #00000012}._scrollWrap_1k3q9_2._shadow-right_1k3q9_40[data-v-ff88aa62]:after{box-shadow:inset -12px 0 10px -10px #00000012}._scrollWrap_1k3q9_2._shadow-top_1k3q9_44[data-v-ff88aa62]:before{box-shadow:inset 0 12px 10px -10px #00000012}._scrollWrap_1k3q9_2._shadow-bottom_1k3q9_48[data-v-ff88aa62]:after{box-shadow:inset 0 -12px 10px -10px #00000012}._hideScroll_1k3q9_53[data-v-ff88aa62]{-ms-overflow-style:auto;scrollbar-width:none}._hideScroll_1k3q9_53[data-v-ff88aa62]::-webkit-scrollbar{display:none}._link--shadow_1tilo_1[data-v-b6c57c10]{box-shadow:inset 0 -.315em 0 0 var(--x-shadow)}._link--shadow_1tilo_1[data-v-b6c57c10]:hover{box-shadow:inset 0 -1.125em 0 0 var(--x-shadow)}.dark ._link--shadow_1tilo_1[data-v-b6c57c10]{box-shadow:inset 0 -.315em 0 0 var(--x-dark-shadow)}.dark ._link--shadow_1tilo_1[data-v-b6c57c10]:hover{box-shadow:inset 0 -1.125em 0 0 var(--x-dark-shadow)}._menu-item_1v1kj_2[data-v-2c7185df]{color:var(--x-text);background-color:var(--x-bg)}._menu-item_1v1kj_2[data-v-2c7185df]:before{content:"";position:absolute;left:-1px;height:100%;width:1px;background-color:transparent}._menu-item_1v1kj_2[data-v-2c7185df]:hover{color:var(--x-text-hover, var(--x-text));background-color:var(--x-bg-hover, var(--x-bg))}.dark ._menu-item_1v1kj_2[data-v-2c7185df]{color:var(--x-dark-text);background:var(--x-dark-bg)}.dark ._menu-item_1v1kj_2[data-v-2c7185df]:hover{color:var(--x-dark-text-hover, var(--x-dark-text));background-color:var(--x-dark-bg-hover, var(--x-dark-bg))}.x-menu-inner ._menu-item_1v1kj_2[data-v-2c7185df]:hover:before,.x-menu-inner ._menu-item--active_1v1kj_1[data-v-2c7185df]:before{background-color:var(--x-border-hover)}._popover_2vipi_2 ._popoverContent_2vipi_3{visibility:hidden;transition-duration:.1s;transition-timing-function:cubic-bezier(.4,0,1,1)}._popover_2vipi_2 ._popoverTop_2vipi_8{--tw-translate-y: .5rem}._popover_2vipi_2 ._popoverRight_2vipi_11{--tw-translate-x: -.5rem}._popover_2vipi_2 ._popoverBottom_2vipi_14{--tw-translate-y: -.25rem}._popover_2vipi_2 ._popoverLeft_2vipi_17{--tw-translate-x: .5rem}._popover_2vipi_2._hover_2vipi_21:hover ._popoverContent_2vipi_3,._popover_2vipi_2._is-open_2vipi_22 ._popoverContent_2vipi_3{visibility:visible;transition-duration:.15s;transition-timing-function:cubic-bezier(0,0,.2,1)}._popover_2vipi_2._hover_2vipi_21:hover ._popoverTop_2vipi_8,._popover_2vipi_2._is-open_2vipi_22 ._popoverTop_2vipi_8{--tw-translate-y: .25rem}._popover_2vipi_2._hover_2vipi_21:hover ._popoverRight_2vipi_11,._popover_2vipi_2._is-open_2vipi_22 ._popoverRight_2vipi_11{--tw-translate-x: 0px}._popover_2vipi_2._hover_2vipi_21:hover ._popoverBottom_2vipi_14,._popover_2vipi_2._is-open_2vipi_22 ._popoverBottom_2vipi_14{--tw-translate-y: .25rem}._popover_2vipi_2._hover_2vipi_21:hover ._popoverLeft_2vipi_17,._popover_2vipi_2._is-open_2vipi_22 ._popoverLeft_2vipi_17{--tw-translate-x: 0px}._radio--glow_14rlz_1[data-v-857bd200]{box-shadow:0 0 #000,0 0 #000,0 10px 15px -3px var(--x-glow),0 4px 6px -4px var(--x-glow)}
|
package/lib/version.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
declare const _default: "0.
|
|
1
|
+
declare const _default: "1.0.0-alpha.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.0-alpha.
|
|
3
|
+
"version": "1.0.0-alpha.2",
|
|
4
4
|
"description": "Indielayer UI Components with Tailwind CSS build for Vue 3",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "João Teixeira",
|
|
@@ -19,6 +19,7 @@
|
|
|
19
19
|
],
|
|
20
20
|
"files": [
|
|
21
21
|
"lib",
|
|
22
|
+
"src",
|
|
22
23
|
"*.d.ts",
|
|
23
24
|
"README.md"
|
|
24
25
|
],
|
|
@@ -31,23 +32,14 @@
|
|
|
31
32
|
"require": "./lib/index.cjs.js"
|
|
32
33
|
},
|
|
33
34
|
"./nuxt": "./lib/nuxt.js",
|
|
35
|
+
"./style": "./lib/style.css",
|
|
34
36
|
"./styles": "./lib/style.css",
|
|
37
|
+
"./nuxt.plugin": "./lib/nuxt.plugin.js",
|
|
38
|
+
"./nuxt.plugin.js": "./lib/nuxt.plugin.js",
|
|
35
39
|
"./tailwind.preset": "./lib/tailwind.preset.js",
|
|
36
40
|
"./tailwind.preset.js": "./lib/tailwind.preset.js"
|
|
37
41
|
},
|
|
38
42
|
"sideEffects": false,
|
|
39
|
-
"scripts": {
|
|
40
|
-
"dev": "yarn build-only && chokidar \"./src/**\" -c \"yarn build-only\"",
|
|
41
|
-
"dev2": "vite build --watch",
|
|
42
|
-
"build": "yarn generate && vite build",
|
|
43
|
-
"build-prod": "yarn build && yarn gen-types",
|
|
44
|
-
"typecheck": "vue-tsc --noEmit",
|
|
45
|
-
"build-only": "vite build",
|
|
46
|
-
"generate": "yarn gen-version",
|
|
47
|
-
"gen-types": "vue-tsc --declaration --emitDeclarationOnly",
|
|
48
|
-
"gen-version": "node .scripts/gen-version.js",
|
|
49
|
-
"test": "echo \"Error: no test specified\" && exit 1"
|
|
50
|
-
},
|
|
51
43
|
"peerDependencies": {
|
|
52
44
|
"tailwindcss": "^3.0.0",
|
|
53
45
|
"vue": "^3.0.0"
|
|
@@ -68,6 +60,7 @@
|
|
|
68
60
|
"postcss": "^8.4.4",
|
|
69
61
|
"start-server-and-test": "^1.14.0",
|
|
70
62
|
"tailwindcss": "^3.0.0",
|
|
63
|
+
"typescript": "^4.7.2",
|
|
71
64
|
"vite": "^2.9.5",
|
|
72
65
|
"vue": "^3.2.33",
|
|
73
66
|
"vue-tsc": "^0.34.15"
|
|
@@ -89,5 +82,16 @@
|
|
|
89
82
|
"publishConfig": {
|
|
90
83
|
"access": "public"
|
|
91
84
|
},
|
|
92
|
-
"
|
|
93
|
-
|
|
85
|
+
"scripts": {
|
|
86
|
+
"dev": "pnpm build-only && chokidar \"./src/**\" -c \"pnpm build-only\"",
|
|
87
|
+
"dev2": "vite build --watch",
|
|
88
|
+
"build": "pnpm generate && vite build",
|
|
89
|
+
"build-prod": "pnpm build && pnpm gen-types",
|
|
90
|
+
"typecheck": "vue-tsc --noEmit",
|
|
91
|
+
"build-only": "vite build",
|
|
92
|
+
"generate": "pnpm gen-version",
|
|
93
|
+
"gen-types": "vue-tsc --declaration --emitDeclarationOnly",
|
|
94
|
+
"gen-version": "node .scripts/gen-version.js",
|
|
95
|
+
"test": "echo \"Error: no test specified\" && exit 1"
|
|
96
|
+
}
|
|
97
|
+
}
|
|
@@ -0,0 +1,164 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { computed, defineComponent, type PropType } from 'vue'
|
|
3
|
+
import { useColors } from '../../composables/colors'
|
|
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'],
|
|
23
|
+
|
|
24
|
+
setup(props) {
|
|
25
|
+
const css = useCSS('alert')
|
|
26
|
+
const colors = useColors()
|
|
27
|
+
const gray = colors.getPalette('gray')
|
|
28
|
+
const styles = computed(() => {
|
|
29
|
+
const color = colors.getPalette(props.color)
|
|
30
|
+
const vars: (object | string)[] = []
|
|
31
|
+
|
|
32
|
+
if (props.glow) vars.push(css.get('glow', colors.getColorOpacity(color[500], 0.5)))
|
|
33
|
+
|
|
34
|
+
if (props.color) {
|
|
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
|
+
}
|
|
60
|
+
|
|
61
|
+
return vars
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
vars.push(css.variables({
|
|
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
|
+
}))
|
|
74
|
+
|
|
75
|
+
return vars
|
|
76
|
+
})
|
|
77
|
+
|
|
78
|
+
return {
|
|
79
|
+
styles,
|
|
80
|
+
}
|
|
81
|
+
},
|
|
82
|
+
})
|
|
83
|
+
</script>
|
|
84
|
+
|
|
85
|
+
<template>
|
|
86
|
+
<component
|
|
87
|
+
:is="tag"
|
|
88
|
+
class="flex rounded-md px-4 py-2 border items-center"
|
|
89
|
+
:class="[
|
|
90
|
+
$style['alert'],
|
|
91
|
+
glow ? $style['alert--glow'] : '',
|
|
92
|
+
]"
|
|
93
|
+
:style="styles"
|
|
94
|
+
>
|
|
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
|
+
|
|
118
|
+
<template v-if="type === 'error'">
|
|
119
|
+
<path d="M12 8v4m0 4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z" />
|
|
120
|
+
</template>
|
|
121
|
+
<template v-if="type === 'warning'">
|
|
122
|
+
<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" />
|
|
123
|
+
</template>
|
|
124
|
+
</svg>
|
|
125
|
+
|
|
126
|
+
<slot></slot>
|
|
127
|
+
|
|
128
|
+
<template v-if="removable">
|
|
129
|
+
<div class="flex-grow"></div>
|
|
130
|
+
<svg
|
|
131
|
+
width="24"
|
|
132
|
+
height="24"
|
|
133
|
+
viewBox="0 0 24 24"
|
|
134
|
+
stroke="currentColor"
|
|
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>
|
|
144
|
+
</template>
|
|
145
|
+
</component>
|
|
146
|
+
</template>
|
|
147
|
+
|
|
148
|
+
<style lang="postcss" module scoped>
|
|
149
|
+
.alert {
|
|
150
|
+
color: var(--x-alert-text);
|
|
151
|
+
background-color: var(--x-alert-bg);
|
|
152
|
+
border-color: var(--x-alert-border);
|
|
153
|
+
|
|
154
|
+
&--glow {
|
|
155
|
+
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
|
+
}
|
|
157
|
+
|
|
158
|
+
:global(.dark) & {
|
|
159
|
+
color: var(--x-dark-alert-text, var(--x-alert-text));
|
|
160
|
+
background-color: var(--x-dark-alert-bg, var(--x-alert-bg));
|
|
161
|
+
border-color: var(--x-dark-alert-border, var(--x-alert-border));
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
</style>
|
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { computed, defineComponent, ref, watch } from 'vue'
|
|
3
|
+
import { useCommon } from '../../composables/common'
|
|
4
|
+
import { useColors } from '../../composables/colors'
|
|
5
|
+
import { useCSS } from '../../composables/css'
|
|
6
|
+
|
|
7
|
+
import XIcon from '../../components/icon/Icon.vue'
|
|
8
|
+
|
|
9
|
+
export default defineComponent({
|
|
10
|
+
name: 'XAvatar',
|
|
11
|
+
|
|
12
|
+
components: {
|
|
13
|
+
XIcon,
|
|
14
|
+
},
|
|
15
|
+
|
|
16
|
+
validators: {
|
|
17
|
+
...useCommon.validators(),
|
|
18
|
+
},
|
|
19
|
+
|
|
20
|
+
props: {
|
|
21
|
+
...useCommon.props(),
|
|
22
|
+
...useColors.props('primary'),
|
|
23
|
+
tag: {
|
|
24
|
+
type: String,
|
|
25
|
+
default: 'div',
|
|
26
|
+
},
|
|
27
|
+
name: String,
|
|
28
|
+
alt: String,
|
|
29
|
+
image: String,
|
|
30
|
+
outlined: Boolean,
|
|
31
|
+
rounded: Boolean,
|
|
32
|
+
},
|
|
33
|
+
|
|
34
|
+
setup(props) {
|
|
35
|
+
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" />'
|
|
36
|
+
const source = ref<string>()
|
|
37
|
+
const initials = computed(() => {
|
|
38
|
+
if (props.name) {
|
|
39
|
+
const initials = props.name.match(/\b\w/g) || []
|
|
40
|
+
|
|
41
|
+
return ((initials.shift() || '') + (initials.pop() || '')).toUpperCase()
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
return ''
|
|
45
|
+
})
|
|
46
|
+
|
|
47
|
+
watch(() => props.image, (src) => {
|
|
48
|
+
if (!src) return
|
|
49
|
+
const img = new Image()
|
|
50
|
+
|
|
51
|
+
img.onload = () => { source.value = props.image }
|
|
52
|
+
img.onerror = () => { }
|
|
53
|
+
img.src = src
|
|
54
|
+
}, {
|
|
55
|
+
immediate: true,
|
|
56
|
+
})
|
|
57
|
+
|
|
58
|
+
const sizeClasses = computed(() => {
|
|
59
|
+
if (props.size === 'xs') return 'h-6 w-6 text-xs'
|
|
60
|
+
else if (props.size === 'sm') return 'h-9 w-9 text-sm'
|
|
61
|
+
else if (props.size === 'lg') return 'h-12 w-12 text-lg'
|
|
62
|
+
else if (props.size === 'xl') return 'h-[3.75rem] w-[3.75rem] text-xl'
|
|
63
|
+
|
|
64
|
+
return 'h-10 w-10'
|
|
65
|
+
})
|
|
66
|
+
|
|
67
|
+
const css = useCSS('avatar')
|
|
68
|
+
const colors = useColors()
|
|
69
|
+
const styles = computed(() => {
|
|
70
|
+
const color = colors.getPalette(props.color)
|
|
71
|
+
|
|
72
|
+
if (source.value) return css.variables({
|
|
73
|
+
bg: 'transparent',
|
|
74
|
+
border: props.outlined ? color[500] : 'transparent',
|
|
75
|
+
})
|
|
76
|
+
|
|
77
|
+
return css.variables({
|
|
78
|
+
bg: color[100],
|
|
79
|
+
text: color[500],
|
|
80
|
+
border: props.outlined ? color[500] : 'transparent',
|
|
81
|
+
dark: {
|
|
82
|
+
bg: color[200],
|
|
83
|
+
},
|
|
84
|
+
})
|
|
85
|
+
})
|
|
86
|
+
|
|
87
|
+
return {
|
|
88
|
+
avatarIcon,
|
|
89
|
+
source,
|
|
90
|
+
initials,
|
|
91
|
+
sizeClasses,
|
|
92
|
+
styles,
|
|
93
|
+
}
|
|
94
|
+
},
|
|
95
|
+
})
|
|
96
|
+
</script>
|
|
97
|
+
|
|
98
|
+
<template>
|
|
99
|
+
<component
|
|
100
|
+
:is="tag"
|
|
101
|
+
class="relative inline-flex items-center justify-center overflow-hidden align-middle border box-content"
|
|
102
|
+
:style="styles"
|
|
103
|
+
:class="[
|
|
104
|
+
$style.avatar,
|
|
105
|
+
sizeClasses,
|
|
106
|
+
rounded ? 'rounded-full' : 'rounded-md'
|
|
107
|
+
]"
|
|
108
|
+
>
|
|
109
|
+
<span
|
|
110
|
+
v-if="!source && name"
|
|
111
|
+
class="leading-none"
|
|
112
|
+
>{{ initials }}</span>
|
|
113
|
+
<slot v-else>
|
|
114
|
+
<x-icon :size="size" :icon="avatarIcon"/>
|
|
115
|
+
</slot>
|
|
116
|
+
<img
|
|
117
|
+
v-if="source"
|
|
118
|
+
:alt="alt"
|
|
119
|
+
:src="image"
|
|
120
|
+
class="h-full w-full"
|
|
121
|
+
/>
|
|
122
|
+
</component>
|
|
123
|
+
</template>
|
|
124
|
+
|
|
125
|
+
<style lang="postcss" module scoped>
|
|
126
|
+
.avatar {
|
|
127
|
+
color: var(--x-avatar-text);
|
|
128
|
+
background-color: var(--x-avatar-bg);
|
|
129
|
+
border-color: var(--x-avatar-border);
|
|
130
|
+
|
|
131
|
+
:global(.dark) & {
|
|
132
|
+
color: var(--x-dark-avatar-text, var(--x-avatar-text));
|
|
133
|
+
background-color: var(--x-dark-avatar-bg, var(--x-avatar-bg));
|
|
134
|
+
border-color: var(--x-dark-avatar-border, var(--x-avatar-border));
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
</style>
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { computed, defineComponent, type PropType } from 'vue'
|
|
3
|
+
import { useCSS } from '../../composables/css'
|
|
4
|
+
import { useCommon } from '../../composables/common'
|
|
5
|
+
import { useColors } from '../../composables/colors'
|
|
6
|
+
|
|
7
|
+
export default defineComponent({
|
|
8
|
+
name: 'XBadge',
|
|
9
|
+
|
|
10
|
+
props: {
|
|
11
|
+
...useCommon.props(),
|
|
12
|
+
...useColors.props('primary'),
|
|
13
|
+
tag: {
|
|
14
|
+
type: String,
|
|
15
|
+
default: 'div',
|
|
16
|
+
},
|
|
17
|
+
position: {
|
|
18
|
+
type: String as PropType<'top' | 'bottom'>,
|
|
19
|
+
default: 'top',
|
|
20
|
+
},
|
|
21
|
+
align: {
|
|
22
|
+
type: String as PropType<'left' | 'right'>,
|
|
23
|
+
default: 'right',
|
|
24
|
+
},
|
|
25
|
+
animated: Boolean,
|
|
26
|
+
outlined: Boolean,
|
|
27
|
+
icon: String,
|
|
28
|
+
show: {
|
|
29
|
+
type: Boolean,
|
|
30
|
+
default: true,
|
|
31
|
+
},
|
|
32
|
+
},
|
|
33
|
+
|
|
34
|
+
setup(props, { slots }) {
|
|
35
|
+
const css = useCSS('badge')
|
|
36
|
+
const colors = useColors()
|
|
37
|
+
const styles = computed(() => {
|
|
38
|
+
const color = colors.getPalette(props.color)
|
|
39
|
+
|
|
40
|
+
return css.get('bg', color[500])
|
|
41
|
+
})
|
|
42
|
+
|
|
43
|
+
const positionClasses = computed(() => {
|
|
44
|
+
const classes = []
|
|
45
|
+
|
|
46
|
+
if (props.position === 'top') classes.push('top-0')
|
|
47
|
+
if (props.position === 'bottom') classes.push('bottom-0')
|
|
48
|
+
if (props.align === 'left') classes.push('left-0')
|
|
49
|
+
if (props.align === 'right') classes.push('right-0')
|
|
50
|
+
if (slots.content) classes.push('-m-[7.5%]')
|
|
51
|
+
else if (props.outlined) {
|
|
52
|
+
classes.push('-m-[5%]')
|
|
53
|
+
} else {
|
|
54
|
+
classes.push('-m-[3.5%]')
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
return classes
|
|
58
|
+
})
|
|
59
|
+
|
|
60
|
+
return {
|
|
61
|
+
styles,
|
|
62
|
+
positionClasses,
|
|
63
|
+
}
|
|
64
|
+
},
|
|
65
|
+
})
|
|
66
|
+
</script>
|
|
67
|
+
|
|
68
|
+
<template>
|
|
69
|
+
<component
|
|
70
|
+
:is="tag"
|
|
71
|
+
class="inline-block"
|
|
72
|
+
:style="styles"
|
|
73
|
+
>
|
|
74
|
+
<div class="relative inline-block">
|
|
75
|
+
<slot></slot>
|
|
76
|
+
<div
|
|
77
|
+
v-if="show"
|
|
78
|
+
class="absolute rounded-full z-10 bg-[color:var(--x-badge-bg)]"
|
|
79
|
+
:class="[
|
|
80
|
+
positionClasses,
|
|
81
|
+
{
|
|
82
|
+
'border-2 border-gray-50 dark:border-gray-900': outlined,
|
|
83
|
+
}
|
|
84
|
+
]"
|
|
85
|
+
>
|
|
86
|
+
<div
|
|
87
|
+
v-if="animated"
|
|
88
|
+
class="animate-ping opacity-75 absolute top-0 left-0 rounded-full h-full w-full z-10 bg-[color:var(--x-badge-bg)]"
|
|
89
|
+
></div>
|
|
90
|
+
<div
|
|
91
|
+
class="text-xs text-white overflow-hidden"
|
|
92
|
+
:class="[
|
|
93
|
+
$slots.content ? 'flex items-center justify-center min-w-[1.25rem] h-5 px-0.5' : {
|
|
94
|
+
'p-1': size === 'xs',
|
|
95
|
+
'p-[0.312rem]': size === 'sm',
|
|
96
|
+
'p-1.5': !size || !['xs', 'sm', 'lg', 'xl'].includes(size),
|
|
97
|
+
'p-2': size === 'lg',
|
|
98
|
+
'p-2.5': size === 'xl',
|
|
99
|
+
}
|
|
100
|
+
]"
|
|
101
|
+
>
|
|
102
|
+
<slot name="content"></slot>
|
|
103
|
+
</div>
|
|
104
|
+
</div>
|
|
105
|
+
</div>
|
|
106
|
+
</component>
|
|
107
|
+
</template>
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { computed, defineComponent, type PropType } from 'vue'
|
|
3
|
+
|
|
4
|
+
export type BreadcrumbItem = {
|
|
5
|
+
label: string,
|
|
6
|
+
to?: string | object,
|
|
7
|
+
href?: string,
|
|
8
|
+
color?: string,
|
|
9
|
+
icon?: string,
|
|
10
|
+
shadow?: boolean,
|
|
11
|
+
underline?: boolean
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export default defineComponent({
|
|
15
|
+
name: 'XBreadcrumbs',
|
|
16
|
+
|
|
17
|
+
props: {
|
|
18
|
+
items: Array as PropType<Array<BreadcrumbItem>>,
|
|
19
|
+
icon: String,
|
|
20
|
+
color: String,
|
|
21
|
+
shadow: Boolean,
|
|
22
|
+
underline: Boolean,
|
|
23
|
+
},
|
|
24
|
+
|
|
25
|
+
setup(props) {
|
|
26
|
+
const arrowIcon = '<path d="M13 7l5 5m0 0l-5 5m5-5H6" />'
|
|
27
|
+
const lastItem = computed(() => props.items && props.items.length > 0 ? props.items[props.items.length - 1] : undefined)
|
|
28
|
+
|
|
29
|
+
return {
|
|
30
|
+
arrowIcon,
|
|
31
|
+
lastItem,
|
|
32
|
+
}
|
|
33
|
+
},
|
|
34
|
+
})
|
|
35
|
+
</script>
|
|
36
|
+
|
|
37
|
+
<template>
|
|
38
|
+
<nav v-if="items && items.length > 0" aria-label="Breadcrumb">
|
|
39
|
+
<ul class="flex items-center flex-wrap">
|
|
40
|
+
<li v-for="(item, index) in items?.slice(0,-1)" :key="index" class="flex items-center">
|
|
41
|
+
<x-link
|
|
42
|
+
:to="item.to"
|
|
43
|
+
:href="item.href"
|
|
44
|
+
:color="item.color || color"
|
|
45
|
+
:shadow="item.shadow || shadow"
|
|
46
|
+
:underline="item.underline|| underline"
|
|
47
|
+
class="flex items-center"
|
|
48
|
+
>
|
|
49
|
+
<x-icon v-if="item.icon" :icon="item.icon" class="mr-1.5"/>
|
|
50
|
+
{{ item.label }}
|
|
51
|
+
</x-link>
|
|
52
|
+
<x-icon :icon="icon || arrowIcon" class="text-gray-400 mx-1.5 shrink-0" size="sm" />
|
|
53
|
+
</li>
|
|
54
|
+
<li v-if="lastItem" class="font-semibold">
|
|
55
|
+
<x-icon v-if="lastItem.icon" :icon="lastItem.icon" class="mr-1"/>
|
|
56
|
+
{{ lastItem.label }}
|
|
57
|
+
</li>
|
|
58
|
+
</ul>
|
|
59
|
+
</nav>
|
|
60
|
+
</template>
|