@byyuurin/ui 0.0.5 → 0.0.7
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 +15 -11
- package/dist/module.cjs +5 -0
- package/dist/module.json +12 -0
- package/dist/{nuxt.mjs → module.mjs} +7 -6
- package/dist/module.mjs.map +1 -0
- package/dist/runtime/components/Accordion.vue +20 -31
- package/dist/runtime/components/Alert.vue +1 -1
- package/dist/runtime/components/App.vue +1 -1
- package/dist/runtime/components/Badge.vue +0 -1
- package/dist/runtime/components/Button.vue +14 -12
- package/dist/runtime/components/ButtonGroup.vue +47 -0
- package/dist/runtime/components/Card.vue +9 -6
- package/dist/runtime/components/Carousel.vue +310 -0
- package/dist/runtime/components/Checkbox.vue +3 -4
- package/dist/runtime/components/Chip.vue +9 -4
- package/dist/runtime/components/Collapsible.vue +56 -0
- package/dist/runtime/components/Drawer.vue +4 -2
- package/dist/runtime/components/Input.vue +12 -8
- package/dist/runtime/components/InputNumber.vue +167 -0
- package/dist/runtime/components/Link.vue +301 -72
- package/dist/runtime/components/LinkBase.vue +88 -0
- package/dist/runtime/components/Modal.vue +2 -4
- package/dist/runtime/components/Pagination.vue +167 -0
- package/dist/runtime/components/PinInput.vue +0 -1
- package/dist/runtime/components/RadioGroup.vue +0 -1
- package/dist/runtime/components/ScrollArea.vue +1 -1
- package/dist/runtime/components/Select.vue +9 -5
- package/dist/runtime/components/Separator.vue +63 -0
- package/dist/runtime/components/Slider.vue +0 -1
- package/dist/runtime/components/Switch.vue +4 -6
- package/dist/runtime/components/Table.vue +292 -0
- package/dist/runtime/components/Tabs.vue +17 -18
- package/dist/runtime/components/Textarea.vue +0 -1
- package/dist/runtime/components/Toast.vue +21 -10
- package/dist/runtime/components/Toaster.vue +4 -39
- package/dist/runtime/composables/useButtonGroup.d.ts +13 -0
- package/dist/runtime/composables/useButtonGroup.js +14 -0
- package/dist/runtime/composables/{useComponentIcons.mjs → useComponentIcons.js} +1 -1
- package/dist/runtime/composables/useModal.d.ts +1 -1
- package/dist/runtime/composables/{useModal.mjs → useModal.js} +1 -1
- package/dist/runtime/composables/useTheme.d.ts +4 -4
- package/dist/runtime/composables/{useTheme.mjs → useTheme.js} +4 -4
- package/dist/runtime/composables/useToast.d.ts +4 -4
- package/dist/runtime/composables/{useToast.mjs → useToast.js} +19 -6
- package/dist/runtime/index.d.ts +34 -0
- package/dist/runtime/index.js +34 -0
- package/dist/runtime/theme/accordion.d.ts +22 -5
- package/dist/runtime/theme/{accordion.mjs → accordion.js} +2 -2
- package/dist/runtime/theme/alert.d.ts +41 -1
- package/dist/runtime/theme/{alert.mjs → alert.js} +4 -4
- package/dist/runtime/theme/app.d.ts +8 -0
- package/dist/runtime/theme/app.js +18 -0
- package/dist/runtime/theme/badge.d.ts +48 -21
- package/dist/runtime/theme/{badge.mjs → badge.js} +5 -2
- package/dist/runtime/theme/button-group.d.ts +66 -0
- package/dist/runtime/theme/button-group.js +42 -0
- package/dist/runtime/theme/button.d.ts +68 -111
- package/dist/runtime/theme/button.js +164 -0
- package/dist/runtime/theme/card.d.ts +38 -19
- package/dist/runtime/theme/card.js +37 -0
- package/dist/runtime/theme/carousel.d.ts +113 -0
- package/dist/runtime/theme/carousel.js +43 -0
- package/dist/runtime/theme/checkbox.d.ts +4 -1
- package/dist/runtime/theme/{checkbox.mjs → checkbox.js} +7 -4
- package/dist/runtime/theme/chip.d.ts +56 -12
- package/dist/runtime/theme/{chip.mjs → chip.js} +10 -7
- package/dist/runtime/theme/collapsible.d.ts +38 -0
- package/dist/runtime/theme/collapsible.js +10 -0
- package/dist/runtime/theme/drawer.d.ts +71 -33
- package/dist/runtime/theme/{drawer.mjs → drawer.js} +33 -22
- package/dist/runtime/theme/index.d.ts +31 -24
- package/dist/runtime/theme/index.js +31 -0
- package/dist/runtime/theme/input-number.d.ts +135 -0
- package/dist/runtime/theme/input-number.js +92 -0
- package/dist/runtime/theme/input.d.ts +94 -111
- package/dist/runtime/theme/input.js +151 -0
- package/dist/runtime/theme/link.d.ts +14 -1
- package/dist/runtime/theme/{link.mjs → link.js} +1 -1
- package/dist/runtime/theme/modal.d.ts +33 -7
- package/dist/runtime/theme/{modal.mjs → modal.js} +8 -10
- package/dist/runtime/theme/pagination.d.ts +56 -0
- package/dist/runtime/theme/pagination.js +13 -0
- package/dist/runtime/theme/pinInput.d.ts +45 -42
- package/dist/runtime/theme/{pinInput.mjs → pinInput.js} +14 -11
- package/dist/runtime/theme/popover.d.ts +16 -5
- package/dist/runtime/theme/{radioGroup.d.ts → radio-group.d.ts} +4 -1
- package/dist/runtime/theme/{radioGroup.mjs → radio-group.js} +3 -0
- package/dist/runtime/theme/scroll-area.d.ts +73 -0
- package/dist/runtime/theme/{scrollArea.mjs → scroll-area.js} +2 -2
- package/dist/runtime/theme/select.d.ts +95 -99
- package/dist/runtime/theme/{select.mjs → select.js} +22 -17
- package/dist/runtime/theme/separator.d.ts +95 -0
- package/dist/runtime/theme/separator.js +53 -0
- package/dist/runtime/theme/slider.d.ts +4 -1
- package/dist/runtime/theme/{slider.mjs → slider.js} +6 -3
- package/dist/runtime/theme/switch.d.ts +4 -1
- package/dist/runtime/theme/{switch.mjs → switch.js} +5 -2
- package/dist/runtime/theme/table.d.ts +89 -0
- package/dist/runtime/theme/table.js +35 -0
- package/dist/runtime/theme/tabs.d.ts +72 -52
- package/dist/runtime/theme/{tabs.mjs → tabs.js} +15 -12
- package/dist/runtime/theme/textarea.d.ts +46 -37
- package/dist/runtime/theme/{textarea.mjs → textarea.js} +14 -11
- package/dist/runtime/theme/toast.d.ts +45 -7
- package/dist/runtime/theme/{toast.mjs → toast.js} +12 -7
- package/dist/runtime/theme/toaster.d.ts +89 -25
- package/dist/runtime/theme/{toaster.mjs → toaster.js} +5 -0
- package/dist/runtime/theme/tooltip.d.ts +20 -7
- package/dist/runtime/theme/{tooltip.mjs → tooltip.js} +2 -2
- package/dist/runtime/types/components.d.ts +7 -1
- package/dist/runtime/types/index.d.ts +4 -4
- package/dist/runtime/types/index.js +2 -0
- package/dist/runtime/types/utils.d.ts +1 -1
- package/dist/runtime/utils/index.d.ts +3 -3
- package/dist/runtime/utils/{index.mjs → index.js} +3 -3
- package/dist/runtime/utils/link.d.ts +22 -7
- package/dist/runtime/utils/link.js +30 -0
- package/dist/runtime/utils/styler.d.ts +2 -2
- package/dist/runtime/vue/stubs.d.ts +9 -0
- package/dist/runtime/vue/stubs.js +16 -0
- package/dist/shared/ui.d1728164.mjs +4 -0
- package/dist/shared/ui.d1728164.mjs.map +1 -0
- package/dist/types.d.mts +1 -0
- package/dist/types.d.ts +1 -0
- package/dist/{unocss-preset.d.ts → unocss.d.mts} +10 -15
- package/dist/{unocss-preset.d.mts → unocss.d.ts} +10 -15
- package/dist/{unocss-preset.mjs → unocss.mjs} +53 -21
- package/dist/unocss.mjs.map +1 -0
- package/dist/unplugin.d.mts +4 -3
- package/dist/unplugin.d.ts +4 -3
- package/dist/unplugin.mjs +49 -5
- package/dist/unplugin.mjs.map +1 -1
- package/dist/vite.d.mts +1 -1
- package/dist/vite.d.ts +1 -1
- package/dist/vite.mjs +7 -5
- package/dist/vite.mjs.map +1 -1
- package/package.json +59 -45
- package/dist/index.d.ts +0 -26
- package/dist/index.mjs +0 -26
- package/dist/nuxt.mjs.map +0 -1
- package/dist/runtime/theme/app.mjs +0 -10
- package/dist/runtime/theme/button.mjs +0 -143
- package/dist/runtime/theme/card.mjs +0 -14
- package/dist/runtime/theme/index.mjs +0 -24
- package/dist/runtime/theme/input.mjs +0 -146
- package/dist/runtime/theme/scrollArea.d.ts +0 -51
- package/dist/runtime/types/index.mjs +0 -2
- package/dist/runtime/utils/link.mjs +0 -4
- package/dist/shared/ui.CzDyI29e.mjs +0 -8
- package/dist/shared/ui.CzDyI29e.mjs.map +0 -1
- package/dist/unocss-preset.mjs.map +0 -1
- /package/{LICENSE.md → LICENSE} +0 -0
- /package/dist/{nuxt.d.mts → module.d.mts} +0 -0
- /package/dist/{nuxt.d.ts → module.d.ts} +0 -0
- /package/dist/runtime/composables/{defineInjection.mjs → defineInjection.js} +0 -0
- /package/dist/runtime/theme/{popover.mjs → popover.js} +0 -0
- /package/dist/runtime/types/{components.mjs → components.js} +0 -0
- /package/dist/runtime/types/{utils.mjs → utils.js} +0 -0
- /package/dist/runtime/utils/{extend-theme.mjs → extend-theme.js} +0 -0
- /package/dist/runtime/utils/{styler.mjs → styler.js} +0 -0
package/README.md
CHANGED
|
@@ -5,7 +5,6 @@ A collection of Vue.js components for my projects.
|
|
|
5
5
|
[![npm version][npm-version-src]][npm-version-href]
|
|
6
6
|
[![npm downloads][npm-downloads-src]][npm-downloads-href]
|
|
7
7
|
[![bundle][bundle-src]][bundle-href]
|
|
8
|
-
[![JSDocs][jsdocs-src]][jsdocs-href]
|
|
9
8
|
[![License][license-src]][license-href]
|
|
10
9
|
|
|
11
10
|
## Preview
|
|
@@ -30,7 +29,7 @@ pnpm i -D @iconify-json/[the-collection-you-want]
|
|
|
30
29
|
|
|
31
30
|
```ts
|
|
32
31
|
// uno.config.ts
|
|
33
|
-
import ui from '@byyuurin/ui/unocss
|
|
32
|
+
import { preset as ui } from '@byyuurin/ui/unocss'
|
|
34
33
|
import { defineConfig, presetIcons, presetUno } from 'unocss'
|
|
35
34
|
|
|
36
35
|
export default defineConfig({
|
|
@@ -43,16 +42,24 @@ export default defineConfig({
|
|
|
43
42
|
radius: '0rem', // optional
|
|
44
43
|
radiusBox: '0rem', // optional
|
|
45
44
|
radiusButton: '0rem', // optional
|
|
45
|
+
radiusCheckbox: '0rem', // optional
|
|
46
|
+
radiusRadio: '0rem', // optional
|
|
47
|
+
radiusSwitch: '0rem', // optional
|
|
46
48
|
radiusTabs: '0rem', // optional
|
|
47
49
|
cb: '#1f2937', // optional
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
c3: '#e5e6e6', // optional
|
|
50
|
+
cp: '#1f2937', // optional
|
|
51
|
+
cx: '#ffffff', // optional
|
|
51
52
|
}),
|
|
52
53
|
],
|
|
53
54
|
})
|
|
54
55
|
```
|
|
55
56
|
|
|
57
|
+
New Rules
|
|
58
|
+
|
|
59
|
+
- `ui-[color]`
|
|
60
|
+
- `bg-soft-[color]`
|
|
61
|
+
- `bg-soft-[color]/[mix-ratio]`
|
|
62
|
+
|
|
56
63
|
### Vite
|
|
57
64
|
|
|
58
65
|
```ts
|
|
@@ -62,7 +69,6 @@ import UI from '@byyuurin/ui/vite'
|
|
|
62
69
|
import Vue from '@vitejs/plugin-vue'
|
|
63
70
|
import UnoCSS from 'unocss/vite'
|
|
64
71
|
import { defineConfig } from 'vite'
|
|
65
|
-
import Inspect from 'vite-plugin-inspect'
|
|
66
72
|
|
|
67
73
|
export default defineConfig({
|
|
68
74
|
plugins: [
|
|
@@ -111,7 +117,7 @@ export default defineNuxtConfig({
|
|
|
111
117
|
|
|
112
118
|
## License
|
|
113
119
|
|
|
114
|
-
[MIT](./LICENSE) License © 2024-PRESENT [Yuurin](https://github.com/
|
|
120
|
+
[MIT](./LICENSE) License © 2024-PRESENT [Yuurin](https://github.com/byyuurin)
|
|
115
121
|
|
|
116
122
|
<!-- Badges -->
|
|
117
123
|
|
|
@@ -121,7 +127,5 @@ export default defineNuxtConfig({
|
|
|
121
127
|
[npm-downloads-href]: https://npmjs.com/package/@byyuurin/ui
|
|
122
128
|
[bundle-src]: https://img.shields.io/bundlephobia/minzip/@byyuurin/ui?style=flat&colorA=080f12&colorB=1fa669&label=minzip
|
|
123
129
|
[bundle-href]: https://bundlephobia.com/result?p=@byyuurin/ui
|
|
124
|
-
[license-src]: https://img.shields.io/github/license/byyuurin
|
|
125
|
-
[license-href]: https://github.com/byyuurin
|
|
126
|
-
[jsdocs-src]: https://img.shields.io/badge/jsdocs-reference-080f12?style=flat&colorA=080f12&colorB=1fa669
|
|
127
|
-
[jsdocs-href]: https://www.jsdocs.io/package/@byyuurin/ui
|
|
130
|
+
[license-src]: https://img.shields.io/github/license/byyuurin/ui.svg?style=flat&colorA=080f12&colorB=1fa669
|
|
131
|
+
[license-href]: https://github.com/byyuurin/ui/blob/main/LICENSE
|
package/dist/module.cjs
ADDED
package/dist/module.json
ADDED
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
import { defineNuxtModule, useLogger, createResolver, addComponentsDir, addImportsDir } from '@nuxt/kit';
|
|
2
|
-
import { p as packageName } from './shared/ui.
|
|
3
|
-
import 'node:url';
|
|
4
|
-
import 'pathe';
|
|
2
|
+
import { p as packageName } from './shared/ui.d1728164.mjs';
|
|
5
3
|
|
|
6
|
-
const
|
|
4
|
+
const module = defineNuxtModule({
|
|
7
5
|
meta: {
|
|
8
6
|
name: packageName,
|
|
9
7
|
configKey: "ui",
|
|
@@ -21,6 +19,9 @@ const nuxt = defineNuxtModule({
|
|
|
21
19
|
logger.error(`\`${packageName}\` requires the \`@unocss/nuxt\` module to be installed.`);
|
|
22
20
|
return;
|
|
23
21
|
}
|
|
22
|
+
nuxt.options.vite.optimizeDeps ??= {};
|
|
23
|
+
nuxt.options.vite.optimizeDeps.include ??= [];
|
|
24
|
+
nuxt.options.vite.optimizeDeps.include.push(`${packageName}/unocss`);
|
|
24
25
|
nuxt.options.alias["#ui"] = resolve("./runtime");
|
|
25
26
|
addComponentsDir({
|
|
26
27
|
path: resolve("./runtime/components"),
|
|
@@ -31,5 +32,5 @@ const nuxt = defineNuxtModule({
|
|
|
31
32
|
}
|
|
32
33
|
});
|
|
33
34
|
|
|
34
|
-
export {
|
|
35
|
-
//# sourceMappingURL=
|
|
35
|
+
export { module as default };
|
|
36
|
+
//# sourceMappingURL=module.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"module.mjs","sources":["../src/module.ts"],"sourcesContent":["import { addComponentsDir, addImportsDir, createResolver, defineNuxtModule, useLogger } from '@nuxt/kit'\nimport { packageName } from './shared'\n\nexport interface ModuleOptions {\n /**\n * prefix for components used in templates\n *\n * @default \"U\"\n */\n prefix?: string\n}\n\nexport default defineNuxtModule<ModuleOptions>({\n meta: {\n name: packageName,\n configKey: 'ui',\n compatibility: {\n nuxt: '>=3.13.1',\n },\n },\n defaults: {\n prefix: 'U',\n },\n setup(options, nuxt) {\n const logger = useLogger(packageName)\n const { resolve } = createResolver(import.meta.url)\n\n // Make sure the UnoCSS Nuxt module is installed\n if (!nuxt.options.modules.includes('@unocss/nuxt')) {\n logger.error(`\\`${packageName}\\` requires the \\`@unocss/nuxt\\` module to be installed.`)\n return\n }\n\n nuxt.options.vite.optimizeDeps ??= {}\n nuxt.options.vite.optimizeDeps.include ??= []\n nuxt.options.vite.optimizeDeps.include.push(`${packageName}/unocss`)\n\n nuxt.options.alias['#ui'] = resolve('./runtime')\n\n addComponentsDir({\n path: resolve('./runtime/components'),\n prefix: options.prefix,\n pathPrefix: false,\n })\n\n addImportsDir(resolve('./runtime/composables'))\n },\n})\n"],"names":[],"mappings":";;;AAYA,eAAe,gBAAgC,CAAA;AAAA,EAC7C,IAAM,EAAA;AAAA,IACJ,IAAM,EAAA,WAAA;AAAA,IACN,SAAW,EAAA,IAAA;AAAA,IACX,aAAe,EAAA;AAAA,MACb,IAAM,EAAA,UAAA;AAAA,KACR;AAAA,GACF;AAAA,EACA,QAAU,EAAA;AAAA,IACR,MAAQ,EAAA,GAAA;AAAA,GACV;AAAA,EACA,KAAA,CAAM,SAAS,IAAM,EAAA;AACnB,IAAM,MAAA,MAAA,GAAS,UAAU,WAAW,CAAA,CAAA;AACpC,IAAA,MAAM,EAAE,OAAA,EAAY,GAAA,cAAA,CAAe,YAAY,GAAG,CAAA,CAAA;AAGlD,IAAA,IAAI,CAAC,IAAK,CAAA,OAAA,CAAQ,OAAQ,CAAA,QAAA,CAAS,cAAc,CAAG,EAAA;AAClD,MAAO,MAAA,CAAA,KAAA,CAAM,CAAK,EAAA,EAAA,WAAW,CAA0D,wDAAA,CAAA,CAAA,CAAA;AACvF,MAAA,OAAA;AAAA,KACF;AAEA,IAAK,IAAA,CAAA,OAAA,CAAQ,IAAK,CAAA,YAAA,KAAiB,EAAC,CAAA;AACpC,IAAA,IAAA,CAAK,OAAQ,CAAA,IAAA,CAAK,YAAa,CAAA,OAAA,KAAY,EAAC,CAAA;AAC5C,IAAA,IAAA,CAAK,QAAQ,IAAK,CAAA,YAAA,CAAa,QAAQ,IAAK,CAAA,CAAA,EAAG,WAAW,CAAS,OAAA,CAAA,CAAA,CAAA;AAEnE,IAAA,IAAA,CAAK,OAAQ,CAAA,KAAA,CAAM,KAAK,CAAA,GAAI,QAAQ,WAAW,CAAA,CAAA;AAE/C,IAAiB,gBAAA,CAAA;AAAA,MACf,IAAA,EAAM,QAAQ,sBAAsB,CAAA;AAAA,MACpC,QAAQ,OAAQ,CAAA,MAAA;AAAA,MAChB,UAAY,EAAA,KAAA;AAAA,KACb,CAAA,CAAA;AAED,IAAc,aAAA,CAAA,OAAA,CAAQ,uBAAuB,CAAC,CAAA,CAAA;AAAA,GAChD;AACF,CAAC,CAAA;;;;"}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
-
import type { AccordionRootEmits, AccordionRootProps
|
|
2
|
+
import type { AccordionRootEmits, AccordionRootProps } from 'reka-ui'
|
|
3
3
|
import type { accordion } from '../theme'
|
|
4
|
-
import type { ComponentAttrs
|
|
4
|
+
import type { ComponentAttrs } from '../types'
|
|
5
5
|
|
|
6
6
|
export interface AccordionItem {
|
|
7
7
|
label?: string
|
|
8
8
|
icon?: string
|
|
9
|
-
|
|
9
|
+
suffixIcon?: string
|
|
10
10
|
slot?: string
|
|
11
11
|
content?: string
|
|
12
12
|
/** A unique value for the accordion item. Defaults to the index. */
|
|
@@ -20,14 +20,19 @@ type SlotProps<T> = (props: { item: T, index: number, open: boolean }) => any
|
|
|
20
20
|
|
|
21
21
|
export type AccordionSlots<T extends { slot?: string }> = {
|
|
22
22
|
default?: SlotProps<T>
|
|
23
|
-
|
|
23
|
+
prefix?: SlotProps<T>
|
|
24
|
+
suffix?: SlotProps<T>
|
|
24
25
|
content?: SlotProps<T>
|
|
25
26
|
body?: SlotProps<T>
|
|
26
|
-
} &
|
|
27
|
+
} & Record<string, SlotProps<T>>
|
|
27
28
|
|
|
28
|
-
export interface AccordionProps<T> extends ComponentAttrs<typeof accordion>, Pick<AccordionRootProps, 'collapsible' | 'defaultValue' | 'modelValue' | 'type' | 'disabled' | 'unmountOnHide'> {
|
|
29
|
-
as?: PrimitiveProps['as']
|
|
29
|
+
export interface AccordionProps<T> extends ComponentAttrs<typeof accordion>, Pick<AccordionRootProps, 'as' | 'collapsible' | 'defaultValue' | 'modelValue' | 'type' | 'disabled' | 'unmountOnHide'> {
|
|
30
30
|
items?: T[]
|
|
31
|
+
/**
|
|
32
|
+
* The icon displayed on the right side of the trigger.
|
|
33
|
+
* @default app.icons.down
|
|
34
|
+
*/
|
|
35
|
+
suffixIcon?: string
|
|
31
36
|
labelKey?: string
|
|
32
37
|
}
|
|
33
38
|
</script>
|
|
@@ -44,11 +49,11 @@ const props = withDefaults(defineProps<AccordionProps<T>>(), {
|
|
|
44
49
|
collapsible: true,
|
|
45
50
|
unmountOnHide: true,
|
|
46
51
|
labelKey: 'label',
|
|
47
|
-
items: () => [],
|
|
48
52
|
})
|
|
49
|
-
const slots = defineSlots<AccordionSlots<T>>()
|
|
50
53
|
|
|
51
|
-
const
|
|
54
|
+
const emit = defineEmits<AccordionEmits>()
|
|
55
|
+
const slots = defineSlots<AccordionSlots<T>>()
|
|
56
|
+
const rootProps = useForwardPropsEmits(reactivePick(props, 'as', 'collapsible', 'defaultValue', 'disabled', 'modelValue', 'type', 'unmountOnHide'), emit)
|
|
52
57
|
|
|
53
58
|
const { theme, createStyler } = useTheme()
|
|
54
59
|
const style = computed(() => {
|
|
@@ -69,16 +74,16 @@ const style = computed(() => {
|
|
|
69
74
|
>
|
|
70
75
|
<AccordionHeader :class="style.header({ class: props.ui?.header })">
|
|
71
76
|
<AccordionTrigger :class="style.trigger({ class: props.ui?.trigger, disabled: item.disabled })">
|
|
72
|
-
<slot name="
|
|
73
|
-
<
|
|
77
|
+
<slot name="prefix" v-bind="{ item, index, open }">
|
|
78
|
+
<span v-if="item.icon" :class="style.prefixIcon({ class: [item.icon, props.ui?.prefixIcon] })"></span>
|
|
74
79
|
</slot>
|
|
75
80
|
|
|
76
81
|
<span v-if="get(item, props.labelKey) || slots.default" :class="style.label({ class: props.ui?.label })">
|
|
77
82
|
<slot v-bind="{ item, index, open }">{{ get(item, props.labelKey) }}</slot>
|
|
78
83
|
</span>
|
|
79
84
|
|
|
80
|
-
<slot name="
|
|
81
|
-
<
|
|
85
|
+
<slot name="suffix" v-bind="{ item, index, open }">
|
|
86
|
+
<span :class="style.suffixIcon({ class: [item.suffixIcon || props.suffixIcon || theme.app.icons.down, props.ui?.suffixIcon] })"></span>
|
|
82
87
|
</slot>
|
|
83
88
|
</AccordionTrigger>
|
|
84
89
|
</AccordionHeader>
|
|
@@ -100,21 +105,5 @@ const style = computed(() => {
|
|
|
100
105
|
</template>
|
|
101
106
|
|
|
102
107
|
<style>
|
|
103
|
-
@keyframes accordion-up {
|
|
104
|
-
from {
|
|
105
|
-
height: var(--reka-accordion-content-height);
|
|
106
|
-
}
|
|
107
|
-
to {
|
|
108
|
-
height: 0;
|
|
109
|
-
}
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
@keyframes accordion-down {
|
|
113
|
-
from {
|
|
114
|
-
height: 0;
|
|
115
|
-
}
|
|
116
|
-
to {
|
|
117
|
-
height: var(--reka-accordion-content-height);
|
|
118
|
-
}
|
|
119
|
-
}
|
|
108
|
+
@keyframes accordion-up{0%{height:var(--reka-accordion-content-height)}to{height:0}}@keyframes accordion-down{0%{height:0}to{height:var(--reka-accordion-content-height)}}
|
|
120
109
|
</style>
|
|
@@ -74,7 +74,7 @@ const style = computed(() => {
|
|
|
74
74
|
:class="style.root({ class: [props.class, props.ui?.root] })"
|
|
75
75
|
>
|
|
76
76
|
<slot name="prepend">
|
|
77
|
-
<
|
|
77
|
+
<span v-if="props.icon" :class="style.icon({ class: [props.icon, props.ui?.icon] })"></span>
|
|
78
78
|
</slot>
|
|
79
79
|
|
|
80
80
|
<div :class="style.wrapper({ class: props.ui?.wrapper })">
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
+
import type { UserConfig } from '@unocss/core'
|
|
2
3
|
import type { ConfigProviderProps, TooltipProviderProps } from 'reka-ui'
|
|
3
|
-
import type { UserConfig } from 'unocss'
|
|
4
4
|
import type { ThemeExtension, ToasterProps } from '../types'
|
|
5
5
|
|
|
6
6
|
export interface AppProps extends Omit<ConfigProviderProps, 'useId' | 'dir' | 'locale'> {
|
|
@@ -12,9 +12,8 @@ export interface ButtonSlots {
|
|
|
12
12
|
}
|
|
13
13
|
|
|
14
14
|
type ButtonVariants = VariantProps<typeof button>
|
|
15
|
-
type UIOptions = ComponentAttrs<typeof button>['ui'] & LinkProps['ui']
|
|
16
15
|
|
|
17
|
-
export interface ButtonProps extends
|
|
16
|
+
export interface ButtonProps extends ComponentAttrs<typeof button>, UseComponentIconsProps, Omit<LinkProps, 'raw' | 'custom'> {
|
|
18
17
|
icon?: string
|
|
19
18
|
label?: string
|
|
20
19
|
variant?: ButtonVariants['variant']
|
|
@@ -22,12 +21,13 @@ export interface ButtonProps extends Omit<ComponentAttrs<typeof button>, 'ui'>,
|
|
|
22
21
|
loading?: boolean
|
|
23
22
|
active?: boolean
|
|
24
23
|
disabled?: boolean
|
|
25
|
-
ui?: UIOptions
|
|
26
24
|
}
|
|
27
25
|
</script>
|
|
28
26
|
|
|
29
27
|
<script lang="ts" setup>
|
|
28
|
+
import { useForwardProps } from 'reka-ui'
|
|
30
29
|
import { computed } from 'vue'
|
|
30
|
+
import { useButtonGroup } from '../composables/useButtonGroup'
|
|
31
31
|
import { useComponentIcons } from '../composables/useComponentIcons'
|
|
32
32
|
import { useTheme } from '../composables/useTheme'
|
|
33
33
|
import { omit, pickLinkProps } from '../utils'
|
|
@@ -35,16 +35,16 @@ import Link from './Link.vue'
|
|
|
35
35
|
|
|
36
36
|
const props = withDefaults(defineProps<ButtonProps>(), {
|
|
37
37
|
variant: 'solid',
|
|
38
|
-
size: 'md',
|
|
39
38
|
})
|
|
40
39
|
|
|
41
40
|
const slots = defineSlots<ButtonSlots>()
|
|
42
41
|
|
|
42
|
+
const { size, orientation } = useButtonGroup(props)
|
|
43
43
|
const { isPrefix, isSuffix, prefixIconName, suffixIconName } = useComponentIcons(
|
|
44
44
|
computed(() => ({ ...props, loading: props.loading })),
|
|
45
45
|
)
|
|
46
46
|
|
|
47
|
-
const linkProps = pickLinkProps(props)
|
|
47
|
+
const linkProps = useForwardProps(pickLinkProps(props))
|
|
48
48
|
|
|
49
49
|
const { theme, createStyler } = useTheme()
|
|
50
50
|
|
|
@@ -52,12 +52,14 @@ const style = computed(() => {
|
|
|
52
52
|
const styler = createStyler(theme.value.button)
|
|
53
53
|
return styler({
|
|
54
54
|
...props,
|
|
55
|
+
size: size.value,
|
|
56
|
+
groupOrientation: orientation.value,
|
|
55
57
|
prefix: isPrefix.value,
|
|
56
58
|
suffix: isSuffix.value,
|
|
57
59
|
class: [
|
|
58
60
|
props.class,
|
|
59
|
-
props.active ? props.
|
|
60
|
-
props.disabled ? props.
|
|
61
|
+
props.active ? props.activeClass : props.inactiveClass,
|
|
62
|
+
props.disabled ? props.disableClass : undefined,
|
|
61
63
|
],
|
|
62
64
|
})
|
|
63
65
|
})
|
|
@@ -68,14 +70,14 @@ const style = computed(() => {
|
|
|
68
70
|
:class="style.base({ class: [props.class, props.ui?.base] })"
|
|
69
71
|
:type="props.type"
|
|
70
72
|
:disabled="props.disabled || props.loading"
|
|
71
|
-
v-bind="omit(linkProps, ['type', 'disabled'])"
|
|
73
|
+
v-bind="omit(linkProps, ['type', 'disabled', 'activeClass', 'inactiveClass', 'disableClass'])"
|
|
72
74
|
raw
|
|
73
75
|
>
|
|
74
76
|
<slot name="prefix">
|
|
75
|
-
<
|
|
77
|
+
<span
|
|
76
78
|
v-if="isPrefix && prefixIconName"
|
|
77
79
|
:class="style.prefixIcon({ class: [prefixIconName, props.ui?.prefixIcon] })"
|
|
78
|
-
></
|
|
80
|
+
></span>
|
|
79
81
|
</slot>
|
|
80
82
|
<span
|
|
81
83
|
v-if="props.label || slots.default"
|
|
@@ -84,10 +86,10 @@ const style = computed(() => {
|
|
|
84
86
|
<slot>{{ label }}</slot>
|
|
85
87
|
</span>
|
|
86
88
|
<slot name="suffix">
|
|
87
|
-
<
|
|
89
|
+
<span
|
|
88
90
|
v-if="isSuffix && suffixIconName"
|
|
89
91
|
:class="style.suffixIcon({ class: [suffixIconName, props.ui?.suffixIcon] })"
|
|
90
|
-
></
|
|
92
|
+
></span>
|
|
91
93
|
</slot>
|
|
92
94
|
</Link>
|
|
93
95
|
</template>
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import type { VariantProps } from '@byyuurin/ui-kit'
|
|
3
|
+
import type { PrimitiveProps } from 'reka-ui'
|
|
4
|
+
import type { buttonGroup } from '../theme'
|
|
5
|
+
import type { ComponentAttrs } from '../types'
|
|
6
|
+
|
|
7
|
+
type ButtonGroupVariant = VariantProps<typeof buttonGroup>
|
|
8
|
+
|
|
9
|
+
export interface ButtonGroupProps extends Omit<ComponentAttrs<typeof buttonGroup>, 'ui'>, Pick<PrimitiveProps, 'as'> {
|
|
10
|
+
size?: ButtonGroupVariant['size']
|
|
11
|
+
orientation?: ButtonGroupVariant['orientation']
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export interface ButtonGroupSlots {
|
|
15
|
+
default?: (props?: any) => any
|
|
16
|
+
}
|
|
17
|
+
</script>
|
|
18
|
+
|
|
19
|
+
<script setup lang="ts">
|
|
20
|
+
import { Primitive } from 'reka-ui'
|
|
21
|
+
import { computed } from 'vue'
|
|
22
|
+
import { provideButtonGroup } from '../composables/useButtonGroup'
|
|
23
|
+
import { useTheme } from '../composables/useTheme'
|
|
24
|
+
|
|
25
|
+
const props = withDefaults(defineProps<ButtonGroupProps>(), {
|
|
26
|
+
orientation: 'horizontal',
|
|
27
|
+
})
|
|
28
|
+
|
|
29
|
+
defineSlots<ButtonGroupSlots>()
|
|
30
|
+
|
|
31
|
+
provideButtonGroup(computed(() => ({
|
|
32
|
+
size: props.size,
|
|
33
|
+
orientation: props.orientation,
|
|
34
|
+
})))
|
|
35
|
+
|
|
36
|
+
const { theme, createStyler } = useTheme()
|
|
37
|
+
const style = computed(() => {
|
|
38
|
+
const styler = createStyler(theme.value.buttonGroup)
|
|
39
|
+
return styler(props)
|
|
40
|
+
})
|
|
41
|
+
</script>
|
|
42
|
+
|
|
43
|
+
<template>
|
|
44
|
+
<Primitive :as="props.as" :class="style">
|
|
45
|
+
<slot></slot>
|
|
46
|
+
</Primitive>
|
|
47
|
+
</template>
|
|
@@ -1,14 +1,9 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
+
import type { VariantProps } from '@byyuurin/ui-kit'
|
|
2
3
|
import type { PrimitiveProps } from 'reka-ui'
|
|
3
4
|
import type { card } from '../theme'
|
|
4
5
|
import type { ComponentAttrs } from '../types'
|
|
5
6
|
|
|
6
|
-
export interface CardProps extends ComponentAttrs<typeof card> {
|
|
7
|
-
as?: PrimitiveProps['as']
|
|
8
|
-
title?: string
|
|
9
|
-
description?: string
|
|
10
|
-
}
|
|
11
|
-
|
|
12
7
|
export interface CardSlots {
|
|
13
8
|
default?: (props?: {}) => any
|
|
14
9
|
content?: (props?: {}) => any
|
|
@@ -17,6 +12,14 @@ export interface CardSlots {
|
|
|
17
12
|
description?: (props?: any) => any
|
|
18
13
|
footer?: (props?: {}) => any
|
|
19
14
|
}
|
|
15
|
+
|
|
16
|
+
type CardVariants = VariantProps<typeof card>
|
|
17
|
+
export interface CardProps extends ComponentAttrs<typeof card> {
|
|
18
|
+
as?: PrimitiveProps['as']
|
|
19
|
+
variant?: CardVariants['variant']
|
|
20
|
+
title?: string
|
|
21
|
+
description?: string
|
|
22
|
+
}
|
|
20
23
|
</script>
|
|
21
24
|
|
|
22
25
|
<script setup lang="ts">
|