@nuxt/ui 3.0.0-alpha.8 → 3.0.0-beta.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/.nuxt/ui/accordion.ts +2 -2
- package/.nuxt/ui/alert.ts +122 -95
- package/.nuxt/ui/avatar-group.ts +14 -2
- package/.nuxt/ui/avatar.ts +16 -4
- package/.nuxt/ui/badge.ts +139 -93
- package/.nuxt/ui/breadcrumb.ts +5 -5
- package/.nuxt/ui/button-group.ts +13 -0
- package/.nuxt/ui/button.ts +167 -136
- package/.nuxt/ui/calendar.ts +103 -0
- package/.nuxt/ui/card.ts +27 -1
- package/.nuxt/ui/carousel.ts +9 -7
- package/.nuxt/ui/checkbox.ts +45 -27
- package/.nuxt/ui/chip.ts +44 -15
- package/.nuxt/ui/color-picker.ts +47 -0
- package/.nuxt/ui/command-palette.ts +28 -18
- package/.nuxt/ui/container.ts +1 -1
- package/.nuxt/ui/context-menu.ts +64 -46
- package/.nuxt/ui/drawer.ts +83 -15
- package/.nuxt/ui/dropdown-menu.ts +65 -47
- package/.nuxt/ui/form-field.ts +15 -7
- package/.nuxt/ui/index.ts +7 -1
- package/.nuxt/ui/input-menu.ts +150 -116
- package/.nuxt/ui/input-number.ts +235 -0
- package/.nuxt/ui/input.ts +111 -76
- package/.nuxt/ui/kbd.ts +18 -6
- package/.nuxt/ui/link.ts +3 -3
- package/.nuxt/ui/modal.ts +8 -7
- package/.nuxt/ui/navigation-menu.ts +244 -131
- package/.nuxt/ui/pin-input.ts +171 -0
- package/.nuxt/ui/popover.ts +2 -2
- package/.nuxt/ui/progress.ts +111 -72
- package/.nuxt/ui/radio-group.ts +45 -22
- package/.nuxt/ui/select-menu.ts +127 -96
- package/.nuxt/ui/select.ts +120 -84
- package/.nuxt/ui/separator.ts +60 -31
- package/.nuxt/ui/skeleton.ts +1 -1
- package/.nuxt/ui/slideover.ts +17 -9
- package/.nuxt/ui/slider.ts +61 -38
- package/.nuxt/ui/stepper.ts +202 -0
- package/.nuxt/ui/switch.ts +40 -22
- package/.nuxt/ui/table.ts +49 -31
- package/.nuxt/ui/tabs.ts +101 -73
- package/.nuxt/ui/textarea.ts +111 -76
- package/.nuxt/ui/toast.ts +53 -33
- package/.nuxt/ui/toaster.ts +31 -15
- package/.nuxt/ui/tooltip.ts +2 -2
- package/.nuxt/ui/tree.ts +154 -0
- package/.nuxt/ui.css +92 -0
- package/README.md +69 -18
- package/cli/commands/{init.mjs → make/component.mjs} +16 -4
- package/cli/commands/make/index.mjs +14 -0
- package/cli/commands/make/locale.mjs +64 -0
- package/cli/index.mjs +2 -2
- package/cli/package.json +2 -2
- package/cli/templates.mjs +62 -12
- package/cli/utils.mjs +14 -0
- package/dist/module.cjs +9 -170
- package/dist/module.d.cts +5 -15
- package/dist/module.d.mts +5 -15
- package/dist/module.d.ts +5 -15
- package/dist/module.json +2 -2
- package/dist/module.mjs +12 -167
- package/dist/runtime/components/Accordion.vue +8 -39
- package/dist/runtime/components/Alert.vue +25 -21
- package/dist/runtime/components/App.vue +15 -15
- package/dist/runtime/components/Avatar.vue +33 -21
- package/dist/runtime/components/AvatarGroup.vue +5 -7
- package/dist/runtime/components/Badge.vue +10 -8
- package/dist/runtime/components/Breadcrumb.vue +13 -34
- package/dist/runtime/components/Button.vue +5 -8
- package/dist/runtime/components/ButtonGroup.vue +5 -7
- package/dist/runtime/components/Calendar.vue +194 -0
- package/dist/runtime/components/Card.vue +10 -9
- package/dist/runtime/components/Carousel.vue +26 -17
- package/dist/runtime/components/Checkbox.vue +32 -38
- package/dist/runtime/components/Chip.vue +6 -8
- package/dist/runtime/components/Collapsible.vue +10 -11
- package/dist/runtime/components/ColorPicker.vue +297 -0
- package/dist/runtime/components/CommandPalette.vue +114 -98
- package/dist/runtime/components/Container.vue +4 -7
- package/dist/runtime/components/ContextMenu.vue +16 -69
- package/dist/runtime/components/ContextMenuContent.vue +14 -10
- package/dist/runtime/components/Drawer.vue +23 -12
- package/dist/runtime/components/DropdownMenu.vue +18 -59
- package/dist/runtime/components/DropdownMenuContent.vue +14 -10
- package/dist/runtime/components/Form.vue +78 -49
- package/dist/runtime/components/FormField.vue +28 -15
- package/dist/runtime/components/Icon.vue +1 -1
- package/dist/runtime/components/Input.vue +15 -7
- package/dist/runtime/components/InputMenu.vue +133 -66
- package/dist/runtime/components/InputNumber.vue +197 -0
- package/dist/runtime/components/Kbd.vue +5 -6
- package/dist/runtime/components/Link.vue +24 -13
- package/dist/runtime/components/LinkBase.vue +1 -1
- package/dist/runtime/components/Modal.vue +56 -34
- package/dist/runtime/components/NavigationMenu.vue +129 -112
- package/dist/runtime/components/OverlayProvider.vue +28 -0
- package/dist/runtime/components/Pagination.vue +18 -14
- package/dist/runtime/components/PinInput.vue +95 -0
- package/dist/runtime/components/Popover.vue +28 -14
- package/dist/runtime/components/Progress.vue +28 -12
- package/dist/runtime/components/RadioGroup.vue +9 -12
- package/dist/runtime/components/Select.vue +61 -35
- package/dist/runtime/components/SelectMenu.vue +201 -130
- package/dist/runtime/components/Separator.vue +6 -5
- package/dist/runtime/components/Skeleton.vue +4 -7
- package/dist/runtime/components/Slideover.vue +56 -33
- package/dist/runtime/components/Slider.vue +8 -7
- package/dist/runtime/components/Stepper.vue +170 -0
- package/dist/runtime/components/Switch.vue +19 -23
- package/dist/runtime/components/Table.vue +157 -32
- package/dist/runtime/components/Tabs.vue +12 -31
- package/dist/runtime/components/Textarea.vue +18 -9
- package/dist/runtime/components/Toast.vue +39 -25
- package/dist/runtime/components/Toaster.vue +31 -24
- package/dist/runtime/components/Tooltip.vue +9 -12
- package/dist/runtime/components/Tree.vue +196 -0
- package/dist/runtime/composables/defineLocale.d.ts +9 -0
- package/dist/runtime/composables/defineLocale.js +4 -0
- package/dist/runtime/composables/defineShortcuts.d.ts +1 -1
- package/dist/runtime/composables/defineShortcuts.js +2 -2
- package/dist/runtime/composables/useFormField.d.ts +11 -4
- package/dist/runtime/composables/useFormField.js +19 -9
- package/dist/runtime/composables/useLocale.d.ts +4 -0
- package/dist/runtime/composables/useLocale.js +10 -0
- package/dist/runtime/composables/useOverlay.d.ts +30 -0
- package/dist/runtime/composables/useOverlay.js +70 -0
- package/dist/runtime/composables/useToast.d.ts +4 -3
- package/dist/runtime/composables/useToast.js +20 -6
- package/dist/runtime/index.css +1 -1
- package/dist/runtime/keyframes.css +1 -1
- package/dist/runtime/locale/ar.d.ts +2 -0
- package/dist/runtime/locale/ar.js +55 -0
- package/dist/runtime/locale/az.d.ts +2 -0
- package/dist/runtime/locale/az.js +54 -0
- package/dist/runtime/locale/bn.d.ts +2 -0
- package/dist/runtime/locale/bn.js +54 -0
- package/dist/runtime/locale/cs.d.ts +2 -0
- package/dist/runtime/locale/cs.js +54 -0
- package/dist/runtime/locale/da.d.ts +2 -0
- package/dist/runtime/locale/da.js +54 -0
- package/dist/runtime/locale/de.d.ts +2 -0
- package/dist/runtime/locale/de.js +54 -0
- package/dist/runtime/locale/el.d.ts +2 -0
- package/dist/runtime/locale/el.js +54 -0
- package/dist/runtime/locale/en.d.ts +2 -0
- package/dist/runtime/locale/en.js +54 -0
- package/dist/runtime/locale/es.d.ts +2 -0
- package/dist/runtime/locale/es.js +54 -0
- package/dist/runtime/locale/et.d.ts +2 -0
- package/dist/runtime/locale/et.js +54 -0
- package/dist/runtime/locale/fa_ir.d.ts +2 -0
- package/dist/runtime/locale/fa_ir.js +55 -0
- package/dist/runtime/locale/fi.d.ts +2 -0
- package/dist/runtime/locale/fi.js +54 -0
- package/dist/runtime/locale/fr.d.ts +2 -0
- package/dist/runtime/locale/fr.js +54 -0
- package/dist/runtime/locale/he.d.ts +2 -0
- package/dist/runtime/locale/he.js +53 -0
- package/dist/runtime/locale/hi.d.ts +2 -0
- package/dist/runtime/locale/hi.js +54 -0
- package/dist/runtime/locale/hu.d.ts +2 -0
- package/dist/runtime/locale/hu.js +54 -0
- package/dist/runtime/locale/id.d.ts +2 -0
- package/dist/runtime/locale/id.js +54 -0
- package/dist/runtime/locale/index.d.ts +34 -0
- package/dist/runtime/locale/index.js +34 -0
- package/dist/runtime/locale/it.d.ts +2 -0
- package/dist/runtime/locale/it.js +54 -0
- package/dist/runtime/locale/ja.d.ts +2 -0
- package/dist/runtime/locale/ja.js +54 -0
- package/dist/runtime/locale/km.d.ts +2 -0
- package/dist/runtime/locale/km.js +54 -0
- package/dist/runtime/locale/ko.d.ts +2 -0
- package/dist/runtime/locale/ko.js +54 -0
- package/dist/runtime/locale/nb_no.d.ts +2 -0
- package/dist/runtime/locale/nb_no.js +54 -0
- package/dist/runtime/locale/nl.d.ts +2 -0
- package/dist/runtime/locale/nl.js +54 -0
- package/dist/runtime/locale/pl.d.ts +2 -0
- package/dist/runtime/locale/pl.js +54 -0
- package/dist/runtime/locale/pt.d.ts +2 -0
- package/dist/runtime/locale/pt.js +54 -0
- package/dist/runtime/locale/pt_br.d.ts +2 -0
- package/dist/runtime/locale/pt_br.js +54 -0
- package/dist/runtime/locale/ru.d.ts +2 -0
- package/dist/runtime/locale/ru.js +54 -0
- package/dist/runtime/locale/sk.d.ts +2 -0
- package/dist/runtime/locale/sk.js +54 -0
- package/dist/runtime/locale/sv.d.ts +2 -0
- package/dist/runtime/locale/sv.js +54 -0
- package/dist/runtime/locale/th.d.ts +2 -0
- package/dist/runtime/locale/th.js +54 -0
- package/dist/runtime/locale/tr.d.ts +2 -0
- package/dist/runtime/locale/tr.js +54 -0
- package/dist/runtime/locale/uk.d.ts +2 -0
- package/dist/runtime/locale/uk.js +54 -0
- package/dist/runtime/locale/vi.d.ts +2 -0
- package/dist/runtime/locale/vi.js +54 -0
- package/dist/runtime/locale/zh_cn.d.ts +2 -0
- package/dist/runtime/locale/zh_cn.js +54 -0
- package/dist/runtime/locale/zh_tw.d.ts +2 -0
- package/dist/runtime/locale/zh_tw.js +54 -0
- package/dist/runtime/plugins/colors.js +8 -5
- package/dist/runtime/types/form.d.ts +29 -15
- package/dist/runtime/types/form.js +2 -2
- package/dist/runtime/types/index.d.ts +8 -0
- package/dist/runtime/types/index.js +8 -0
- package/dist/runtime/types/locale.d.ts +56 -0
- package/dist/runtime/types/locale.js +0 -0
- package/dist/runtime/types/utils.d.ts +7 -3
- package/dist/runtime/utils/form.d.ts +5 -9
- package/dist/runtime/utils/form.js +113 -50
- package/dist/runtime/utils/index.d.ts +1 -1
- package/dist/runtime/utils/index.js +15 -2
- package/dist/runtime/utils/link.d.ts +1 -1
- package/dist/runtime/utils/locale.d.ts +15 -0
- package/dist/runtime/utils/locale.js +25 -0
- package/dist/runtime/utils/tv.d.ts +1 -0
- package/dist/runtime/utils/tv.js +4 -0
- package/dist/runtime/vue/components/Icon.vue +2 -2
- package/dist/runtime/vue/components/Link.vue +87 -23
- package/dist/runtime/vue/composables/useAppConfig.d.ts +1 -0
- package/dist/runtime/vue/composables/useAppConfig.js +2 -0
- package/dist/runtime/vue/plugins/head.d.ts +1 -1
- package/dist/runtime/vue/plugins/head.js +3 -3
- package/dist/runtime/vue/stubs.d.ts +19 -0
- package/dist/runtime/vue/stubs.js +37 -0
- package/dist/shared/{ui.BufKhDiD.mjs → ui.DSPu6Y8j.mjs} +1071 -409
- package/dist/shared/{ui.BU7wzH0D.cjs → ui.DfK2RX6G.cjs} +1074 -409
- package/dist/unplugin.cjs +62 -26
- package/dist/unplugin.d.cts +17 -3
- package/dist/unplugin.d.mts +17 -3
- package/dist/unplugin.d.ts +17 -3
- package/dist/unplugin.mjs +61 -25
- package/dist/vite.cjs +3 -2
- package/dist/vite.d.cts +2 -0
- package/dist/vite.d.mts +2 -0
- package/dist/vite.d.ts +2 -0
- package/dist/vite.mjs +3 -2
- package/package.json +110 -67
- package/dist/chunks/component-meta.cjs +0 -73264
- package/dist/chunks/component-meta.mjs +0 -73262
- package/dist/client/devtools/200.html +0 -1
- package/dist/client/devtools/404.html +0 -1
- package/dist/client/devtools/_fonts/rP2Wp2ywxg089UriCZaSExd86J3t9jz86MvyyKK58UfivUw4aw-SK92LTmKP0.woff2 +0 -0
- package/dist/client/devtools/_fonts/rP2Wp2ywxg089UriCZaSExd86J3t9jz86MvyyKy58UfivUw-9uYm8d48E4.woff2 +0 -0
- package/dist/client/devtools/_fonts/rP2Yp2ywxg089UriI5-g4vlH9VoD8Cmcqbu0-K6z9mXg-VNw7NHvqnp.woff2 +0 -0
- package/dist/client/devtools/_fonts/rP2Yp2ywxg089UriI5-g4vlH9VoD8Cmcqbu6-K6z9mXgjU0-EkYdMs3MAX.woff2 +0 -0
- package/dist/client/devtools/_fonts/rP2rp2ywxg089UriCZaSExd86J3t9jz86Mvy4qCRAL19DksVat-7DW3w-R7n06NbhGy.woff +0 -0
- package/dist/client/devtools/_fonts/rP2rp2ywxg089UriCZaSExd86J3t9jz86Mvy4qCRAL19DksVat-JDG3w-leGNfkTmsj.woff +0 -0
- package/dist/client/devtools/_fonts/rP2rp2ywxg089UriCZaSExd86J3t9jz86Mvy4qCRAL19DksVat-JDW3w-ciElMF03ku.woff +0 -0
- package/dist/client/devtools/_fonts/rP2rp2ywxg089UriCZaSExd86J3t9jz86Mvy4qCRAL19DksVat8JCm3w-sB722Uoa0f.woff +0 -0
- package/dist/client/devtools/_fonts/rP2rp2ywxg089UriCZaSExd86J3t9jz86Mvy4qCRAL19DksVat8JDW3w-PBDI1JDjwV.woff +0 -0
- package/dist/client/devtools/_fonts/rP2rp2ywxg089UriCZaSExd86J3t9jz86Mvy4qCRAL19DksVat8gCm3w-0q1hqVn09O.woff +0 -0
- package/dist/client/devtools/_fonts/rP2rp2ywxg089UriCZaSExd86J3t9jz86Mvy4qCRAL19DksVat9XCm3w-ByvzuLy2fa.woff +0 -0
- package/dist/client/devtools/_fonts/rP2rp2ywxg089UriCZaSExd86J3t9jz86Mvy4qCRAL19DksVat9uCm3w-5TKCIs6EEw.woff +0 -0
- package/dist/client/devtools/_fonts/rP2rp2ywxg089UriCZaSExd86J3t9jz86Mvy4qCRAL19DksVat_XDW3w-r2swRDGfn2.woff +0 -0
- package/dist/client/devtools/_fonts/rP2tp2ywxg089UriI5-g4vlH9VoD8CmcqZG40F9JadbnoEwAC5thTQ-ldB60l5U8r.woff +0 -0
- package/dist/client/devtools/_fonts/rP2tp2ywxg089UriI5-g4vlH9VoD8CmcqZG40F9JadbnoEwAIpthTQ-wbFKGFDrgo.woff +0 -0
- package/dist/client/devtools/_fonts/rP2tp2ywxg089UriI5-g4vlH9VoD8CmcqZG40F9JadbnoEwAIpxhTQ-LLUBv5jskj.woff +0 -0
- package/dist/client/devtools/_fonts/rP2tp2ywxg089UriI5-g4vlH9VoD8CmcqZG40F9JadbnoEwARZthTQ-F71RdTRbNg.woff +0 -0
- package/dist/client/devtools/_fonts/rP2tp2ywxg089UriI5-g4vlH9VoD8CmcqZG40F9JadbnoEwA_JxhTQ-6nh65gZkc0.woff +0 -0
- package/dist/client/devtools/_fonts/rP2tp2ywxg089UriI5-g4vlH9VoD8CmcqZG40F9JadbnoEwAfJthTQ-aMoWEJLmTt.woff +0 -0
- package/dist/client/devtools/_fonts/rP2tp2ywxg089UriI5-g4vlH9VoD8CmcqZG40F9JadbnoEwAkJxhTQ-WMBvmLOgKm.woff +0 -0
- package/dist/client/devtools/_fonts/rP2tp2ywxg089UriI5-g4vlH9VoD8CmcqZG40F9JadbnoEwAop1hTQ-utGC2hnWq2.woff +0 -0
- package/dist/client/devtools/_fonts/rP2tp2ywxg089UriI5-g4vlH9VoD8CmcqZG40F9JadbnoEwAopxhTQ-YpyTieVa5B.woff +0 -0
- package/dist/client/devtools/_nuxt/Bj9hdafK.js +0 -1
- package/dist/client/devtools/_nuxt/DM3_wAgz.js +0 -62
- package/dist/client/devtools/_nuxt/builds/latest.json +0 -1
- package/dist/client/devtools/_nuxt/builds/meta/e6b425f7-b919-4014-915b-0ea07c316790.json +0 -1
- package/dist/client/devtools/_nuxt/entry.DaJP-ZMB.css +0 -24
- package/dist/client/devtools/_nuxt/error-404.B0Nmv3fV.css +0 -1
- package/dist/client/devtools/_nuxt/error-500.C8fgTxVz.css +0 -1
- package/dist/client/devtools/_nuxt/hKiujHsR.js +0 -1
- package/dist/client/devtools/favicon.svg +0 -1
- package/dist/client/devtools/index.html +0 -1
- package/dist/devtools/runtime/DevtoolsRenderer.vue +0 -53
- package/dist/devtools/runtime/examples/AvatarGroupExample.vue +0 -7
- package/dist/devtools/runtime/examples/ButtonGroupExample.vue +0 -8
- package/dist/devtools/runtime/examples/CardExample.vue +0 -13
- package/dist/devtools/runtime/examples/CarouselExample.vue +0 -13
- package/dist/devtools/runtime/examples/ChipExample.vue +0 -5
- package/dist/devtools/runtime/examples/CollapsibleExample.vue +0 -8
- package/dist/devtools/runtime/examples/CommandPaletteExample.vue +0 -29
- package/dist/devtools/runtime/examples/ContainerExample.vue +0 -5
- package/dist/devtools/runtime/examples/ContextMenuExample.vue +0 -5
- package/dist/devtools/runtime/examples/DrawerExample.vue +0 -8
- package/dist/devtools/runtime/examples/DropdownMenuExample.vue +0 -5
- package/dist/devtools/runtime/examples/FormExample.vue +0 -30
- package/dist/devtools/runtime/examples/FormFieldExample.vue +0 -5
- package/dist/devtools/runtime/examples/LinkExample.vue +0 -5
- package/dist/devtools/runtime/examples/ModalExample.vue +0 -8
- package/dist/devtools/runtime/examples/PopoverExample.vue +0 -8
- package/dist/devtools/runtime/examples/SkeletonExample.vue +0 -3
- package/dist/devtools/runtime/examples/SlideoverExample.vue +0 -8
- package/dist/devtools/runtime/examples/ToasterExample.vue +0 -11
- package/dist/devtools/runtime/examples/TooltipExample.vue +0 -5
- package/dist/runtime/components/ModalProvider.vue +0 -12
- package/dist/runtime/components/SlideoverProvider.vue +0 -12
- package/dist/runtime/composables/extendDevtoolsMeta.d.ts +0 -7
- package/dist/runtime/composables/extendDevtoolsMeta.js +0 -2
- package/dist/runtime/composables/useModal.d.ts +0 -17
- package/dist/runtime/composables/useModal.js +0 -46
- package/dist/runtime/composables/useSlideover.d.ts +0 -17
- package/dist/runtime/composables/useSlideover.js +0 -46
- package/dist/runtime/plugins/modal.d.ts +0 -2
- package/dist/runtime/plugins/modal.js +0 -10
- package/dist/runtime/plugins/slideover.d.ts +0 -2
- package/dist/runtime/plugins/slideover.js +0 -10
|
@@ -1,18 +1,23 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
-
import {
|
|
3
|
-
import type { CheckboxRootProps } from '
|
|
2
|
+
import type { VariantProps } from 'tailwind-variants'
|
|
3
|
+
import type { CheckboxRootProps } from 'reka-ui'
|
|
4
4
|
import type { AppConfig } from '@nuxt/schema'
|
|
5
5
|
import _appConfig from '#build/app.config'
|
|
6
6
|
import theme from '#build/ui/checkbox'
|
|
7
|
-
import {
|
|
7
|
+
import { tv } from '../utils/tv'
|
|
8
8
|
|
|
9
|
-
const
|
|
9
|
+
const appConfigCheckbox = _appConfig as AppConfig & { ui: { checkbox: Partial<typeof theme> } }
|
|
10
10
|
|
|
11
|
-
const checkbox = tv({ extend: tv(theme), ...(
|
|
11
|
+
const checkbox = tv({ extend: tv(theme), ...(appConfigCheckbox.ui?.checkbox || {}) })
|
|
12
12
|
|
|
13
13
|
type CheckboxVariants = VariantProps<typeof checkbox>
|
|
14
14
|
|
|
15
|
-
export interface CheckboxProps extends Pick<CheckboxRootProps, 'disabled' | 'required' | 'name' | 'value' | 'id'> {
|
|
15
|
+
export interface CheckboxProps extends Pick<CheckboxRootProps, 'disabled' | 'required' | 'name' | 'value' | 'id' | 'defaultValue'> {
|
|
16
|
+
/**
|
|
17
|
+
* The element or component this component should render as.
|
|
18
|
+
* @defaultValue 'div'
|
|
19
|
+
*/
|
|
20
|
+
as?: any
|
|
16
21
|
label?: string
|
|
17
22
|
description?: string
|
|
18
23
|
color?: CheckboxVariants['color']
|
|
@@ -22,66 +27,53 @@ export interface CheckboxProps extends Pick<CheckboxRootProps, 'disabled' | 'req
|
|
|
22
27
|
* @defaultValue appConfig.ui.icons.check
|
|
23
28
|
*/
|
|
24
29
|
icon?: string
|
|
25
|
-
indeterminate?: boolean
|
|
26
30
|
/**
|
|
27
31
|
* The icon displayed when the checkbox is indeterminate.
|
|
28
32
|
* @defaultValue appConfig.ui.icons.minus
|
|
29
33
|
*/
|
|
30
34
|
indeterminateIcon?: string
|
|
31
|
-
/** The checked state of the checkbox when it is initially rendered. Use when you do not need to control its checked state. */
|
|
32
|
-
defaultValue?: boolean
|
|
33
35
|
class?: any
|
|
34
36
|
ui?: Partial<typeof checkbox.slots>
|
|
35
37
|
}
|
|
36
38
|
|
|
37
|
-
export
|
|
38
|
-
|
|
39
|
-
(e: 'change', payload: Event): void
|
|
39
|
+
export type CheckboxEmits = {
|
|
40
|
+
change: [payload: Event]
|
|
40
41
|
}
|
|
41
42
|
|
|
42
43
|
export interface CheckboxSlots {
|
|
43
44
|
label(props: { label?: string }): any
|
|
44
45
|
description(props: { description?: string }): any
|
|
45
46
|
}
|
|
46
|
-
|
|
47
|
-
extendDevtoolsMeta({ defaultProps: { label: 'Check me!' } })
|
|
48
47
|
</script>
|
|
49
48
|
|
|
50
49
|
<script setup lang="ts">
|
|
51
50
|
import { computed, useId } from 'vue'
|
|
52
|
-
import { CheckboxRoot, CheckboxIndicator, Label, useForwardProps } from '
|
|
51
|
+
import { Primitive, CheckboxRoot, CheckboxIndicator, Label, useForwardProps } from 'reka-ui'
|
|
53
52
|
import { reactivePick } from '@vueuse/core'
|
|
54
53
|
import { useAppConfig } from '#imports'
|
|
55
54
|
import { useFormField } from '../composables/useFormField'
|
|
56
55
|
import UIcon from './Icon.vue'
|
|
57
56
|
|
|
57
|
+
defineOptions({ inheritAttrs: false })
|
|
58
|
+
|
|
58
59
|
const props = defineProps<CheckboxProps>()
|
|
59
60
|
const slots = defineSlots<CheckboxSlots>()
|
|
60
61
|
const emits = defineEmits<CheckboxEmits>()
|
|
61
62
|
|
|
62
|
-
const modelValue = defineModel<boolean |
|
|
63
|
+
const modelValue = defineModel<boolean | 'indeterminate'>({ default: undefined })
|
|
63
64
|
|
|
64
|
-
const rootProps = useForwardProps(reactivePick(props, 'required', 'value'))
|
|
65
|
+
const rootProps = useForwardProps(reactivePick(props, 'required', 'value', 'defaultValue'))
|
|
65
66
|
|
|
66
67
|
const appConfig = useAppConfig()
|
|
67
|
-
const { id: _id, emitFormChange, emitFormInput, size, color, name, disabled } = useFormField<CheckboxProps>(props)
|
|
68
|
+
const { id: _id, emitFormChange, emitFormInput, size, color, name, disabled, ariaAttrs } = useFormField<CheckboxProps>(props)
|
|
68
69
|
const id = _id.value ?? useId()
|
|
69
70
|
|
|
70
|
-
const checked = computed({
|
|
71
|
-
get() {
|
|
72
|
-
return props.indeterminate ? 'indeterminate' : modelValue.value
|
|
73
|
-
},
|
|
74
|
-
set(value) {
|
|
75
|
-
modelValue.value = value === 'indeterminate' ? undefined : value
|
|
76
|
-
}
|
|
77
|
-
})
|
|
78
|
-
|
|
79
71
|
const ui = computed(() => checkbox({
|
|
80
72
|
size: size.value,
|
|
81
73
|
color: color.value,
|
|
82
74
|
required: props.required,
|
|
83
75
|
disabled: disabled.value,
|
|
84
|
-
checked: (modelValue.value ?? props.defaultValue)
|
|
76
|
+
checked: Boolean(modelValue.value ?? props.defaultValue)
|
|
85
77
|
}))
|
|
86
78
|
|
|
87
79
|
function onUpdate(value: any) {
|
|
@@ -93,23 +85,25 @@ function onUpdate(value: any) {
|
|
|
93
85
|
}
|
|
94
86
|
</script>
|
|
95
87
|
|
|
88
|
+
<!-- eslint-disable vue/no-template-shadow -->
|
|
96
89
|
<template>
|
|
97
|
-
<
|
|
90
|
+
<Primitive :as="as" :class="ui.root({ class: [props.class, props.ui?.root] })">
|
|
98
91
|
<div :class="ui.container({ class: props.ui?.container })">
|
|
99
92
|
<CheckboxRoot
|
|
100
93
|
:id="id"
|
|
101
|
-
v-
|
|
102
|
-
|
|
103
|
-
v-bind="rootProps"
|
|
94
|
+
v-bind="{ ...rootProps, ...$attrs, ...ariaAttrs }"
|
|
95
|
+
v-model="modelValue"
|
|
104
96
|
:name="name"
|
|
105
97
|
:disabled="disabled"
|
|
106
98
|
:class="ui.base({ class: props.ui?.base })"
|
|
107
|
-
@update:
|
|
99
|
+
@update:model-value="onUpdate"
|
|
108
100
|
>
|
|
109
|
-
<
|
|
110
|
-
<
|
|
111
|
-
|
|
112
|
-
|
|
101
|
+
<template #default="{ modelValue }">
|
|
102
|
+
<CheckboxIndicator as-child>
|
|
103
|
+
<UIcon v-if="modelValue === 'indeterminate'" :name="indeterminateIcon || appConfig.ui.icons.minus" :class="ui.icon({ class: props.ui?.icon })" />
|
|
104
|
+
<UIcon v-else :name="icon || appConfig.ui.icons.check" :class="ui.icon({ class: props.ui?.icon })" />
|
|
105
|
+
</CheckboxIndicator>
|
|
106
|
+
</template>
|
|
113
107
|
</CheckboxRoot>
|
|
114
108
|
</div>
|
|
115
109
|
|
|
@@ -125,5 +119,5 @@ function onUpdate(value: any) {
|
|
|
125
119
|
</slot>
|
|
126
120
|
</p>
|
|
127
121
|
</div>
|
|
128
|
-
</
|
|
122
|
+
</Primitive>
|
|
129
123
|
</template>
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
-
import {
|
|
2
|
+
import type { VariantProps } from 'tailwind-variants'
|
|
3
3
|
import type { AppConfig } from '@nuxt/schema'
|
|
4
4
|
import _appConfig from '#build/app.config'
|
|
5
5
|
import theme from '#build/ui/chip'
|
|
6
|
-
import {
|
|
6
|
+
import { tv } from '../utils/tv'
|
|
7
7
|
|
|
8
|
-
const
|
|
8
|
+
const appConfigChip = _appConfig as AppConfig & { ui: { chip: Partial<typeof theme> } }
|
|
9
9
|
|
|
10
|
-
const chip = tv({ extend: tv(theme), ...(
|
|
10
|
+
const chip = tv({ extend: tv(theme), ...(appConfigChip.ui?.chip || {}) })
|
|
11
11
|
|
|
12
12
|
type ChipVariants = VariantProps<typeof chip>
|
|
13
13
|
|
|
@@ -22,7 +22,7 @@ export interface ChipProps {
|
|
|
22
22
|
color?: ChipVariants['color']
|
|
23
23
|
size?: ChipVariants['size']
|
|
24
24
|
position?: ChipVariants['position']
|
|
25
|
-
/** When `true`,
|
|
25
|
+
/** When `true`, keep the chip inside the component for rounded elements. */
|
|
26
26
|
inset?: boolean
|
|
27
27
|
/** When `true`, render the chip relatively to the parent. */
|
|
28
28
|
standalone?: boolean
|
|
@@ -38,13 +38,11 @@ export interface ChipSlots {
|
|
|
38
38
|
default(props?: {}): any
|
|
39
39
|
content(props?: {}): any
|
|
40
40
|
}
|
|
41
|
-
|
|
42
|
-
extendDevtoolsMeta({ example: 'ChipExample' })
|
|
43
41
|
</script>
|
|
44
42
|
|
|
45
43
|
<script setup lang="ts">
|
|
46
44
|
import { computed } from 'vue'
|
|
47
|
-
import { Primitive, Slot } from '
|
|
45
|
+
import { Primitive, Slot } from 'reka-ui'
|
|
48
46
|
import { useAvatarGroup } from '../composables/useAvatarGroup'
|
|
49
47
|
|
|
50
48
|
defineOptions({ inheritAttrs: false })
|
|
@@ -1,16 +1,15 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
-
import {
|
|
3
|
-
import type { CollapsibleRootProps, CollapsibleRootEmits } from 'radix-vue'
|
|
2
|
+
import type { CollapsibleRootProps, CollapsibleRootEmits } from 'reka-ui'
|
|
4
3
|
import type { AppConfig } from '@nuxt/schema'
|
|
5
4
|
import _appConfig from '#build/app.config'
|
|
6
5
|
import theme from '#build/ui/collapsible'
|
|
7
|
-
import {
|
|
6
|
+
import { tv } from '../utils/tv'
|
|
8
7
|
|
|
9
|
-
const
|
|
8
|
+
const appConfigCollapsible = _appConfig as AppConfig & { ui: { collapsible: Partial<typeof theme> } }
|
|
10
9
|
|
|
11
|
-
const collapsible = tv({ extend: tv(theme), ...(
|
|
10
|
+
const collapsible = tv({ extend: tv(theme), ...(appConfigCollapsible.ui?.collapsible || {}) })
|
|
12
11
|
|
|
13
|
-
export interface CollapsibleProps extends Pick<CollapsibleRootProps, 'defaultOpen' | 'open' | 'disabled'> {
|
|
12
|
+
export interface CollapsibleProps extends Pick<CollapsibleRootProps, 'defaultOpen' | 'open' | 'disabled' | 'unmountOnHide'> {
|
|
14
13
|
/**
|
|
15
14
|
* The element or component this component should render as.
|
|
16
15
|
* @defaultValue 'div'
|
|
@@ -26,19 +25,19 @@ export interface CollapsibleSlots {
|
|
|
26
25
|
default(props: { open: boolean }): any
|
|
27
26
|
content(props?: {}): any
|
|
28
27
|
}
|
|
29
|
-
|
|
30
|
-
extendDevtoolsMeta({ example: 'CollapsibleExample' })
|
|
31
28
|
</script>
|
|
32
29
|
|
|
33
30
|
<script setup lang="ts">
|
|
34
|
-
import { CollapsibleRoot, CollapsibleTrigger, CollapsibleContent, useForwardPropsEmits } from '
|
|
31
|
+
import { CollapsibleRoot, CollapsibleTrigger, CollapsibleContent, useForwardPropsEmits } from 'reka-ui'
|
|
35
32
|
import { reactivePick } from '@vueuse/core'
|
|
36
33
|
|
|
37
|
-
const props = defineProps<CollapsibleProps>()
|
|
34
|
+
const props = withDefaults(defineProps<CollapsibleProps>(), {
|
|
35
|
+
unmountOnHide: true
|
|
36
|
+
})
|
|
38
37
|
const emits = defineEmits<CollapsibleEmits>()
|
|
39
38
|
const slots = defineSlots<CollapsibleSlots>()
|
|
40
39
|
|
|
41
|
-
const rootProps = useForwardPropsEmits(reactivePick(props, 'as', 'defaultOpen', 'open', 'disabled'), emits)
|
|
40
|
+
const rootProps = useForwardPropsEmits(reactivePick(props, 'as', 'defaultOpen', 'open', 'disabled', 'unmountOnHide'), emits)
|
|
42
41
|
|
|
43
42
|
// eslint-disable-next-line vue/no-dupe-keys
|
|
44
43
|
const ui = collapsible()
|
|
@@ -0,0 +1,297 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import type { VariantProps } from 'tailwind-variants'
|
|
3
|
+
import type { MaybeRefOrGetter } from '@vueuse/shared'
|
|
4
|
+
import type { AppConfig } from '@nuxt/schema'
|
|
5
|
+
import _appConfig from '#build/app.config'
|
|
6
|
+
import theme from '#build/ui/color-picker'
|
|
7
|
+
import { tv } from '../utils/tv'
|
|
8
|
+
import type { HSLObject } from 'colortranslator'
|
|
9
|
+
|
|
10
|
+
const appConfigColorPicker = _appConfig as AppConfig & { ui: { colorPicker: Partial<typeof theme> } }
|
|
11
|
+
|
|
12
|
+
const colorPicker = tv({ extend: tv(theme), ...(appConfigColorPicker.ui?.colorPicker || {}) })
|
|
13
|
+
|
|
14
|
+
type ColorPickerVariants = VariantProps<typeof colorPicker>
|
|
15
|
+
|
|
16
|
+
type HSVColor = {
|
|
17
|
+
h: number
|
|
18
|
+
s: number
|
|
19
|
+
v: number
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
function HSLtoHSV(hsl: HSLObject): HSVColor {
|
|
23
|
+
const x = hsl.S * (hsl.L < 50 ? hsl.L : 100 - hsl.L)
|
|
24
|
+
const v = hsl.L + (x / 100)
|
|
25
|
+
|
|
26
|
+
return {
|
|
27
|
+
h: hsl.H,
|
|
28
|
+
s: hsl.L === 0 ? hsl.S : 2 * x / v,
|
|
29
|
+
v
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
function HSVtoHSL(hsv: HSVColor): HSLObject {
|
|
34
|
+
const x = (200 - hsv.s) * hsv.v / 100
|
|
35
|
+
|
|
36
|
+
return {
|
|
37
|
+
H: hsv.h,
|
|
38
|
+
S: x === 0 || x === 200 ? 0 : Math.round(hsv.s * hsv.v / (x <= 100 ? x : 200 - x)),
|
|
39
|
+
L: Math.round(x / 2)
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
export type ColorPickerProps = {
|
|
44
|
+
/**
|
|
45
|
+
* The element or component this component should render as.
|
|
46
|
+
* @defaultValue 'div'
|
|
47
|
+
*/
|
|
48
|
+
as?: any
|
|
49
|
+
/**
|
|
50
|
+
* Throttle time in ms for the color picker
|
|
51
|
+
*/
|
|
52
|
+
throttle?: number
|
|
53
|
+
/**
|
|
54
|
+
* Disable the color picker
|
|
55
|
+
*/
|
|
56
|
+
disabled?: boolean
|
|
57
|
+
/**
|
|
58
|
+
* The default value of the color picker
|
|
59
|
+
*/
|
|
60
|
+
defaultValue?: string
|
|
61
|
+
/**
|
|
62
|
+
* Format of the color
|
|
63
|
+
* @defaultValue 'hex'
|
|
64
|
+
*/
|
|
65
|
+
format?: 'hex' | 'rgb' | 'hsl' | 'cmyk' | 'lab'
|
|
66
|
+
size?: ColorPickerVariants['size']
|
|
67
|
+
class?: any
|
|
68
|
+
ui?: Partial<typeof colorPicker.slots>
|
|
69
|
+
}
|
|
70
|
+
</script>
|
|
71
|
+
|
|
72
|
+
<script setup lang="ts">
|
|
73
|
+
import { ref, nextTick, computed, toValue } from 'vue'
|
|
74
|
+
import { Primitive } from 'reka-ui'
|
|
75
|
+
import { useEventListener, useElementBounding, watchThrottled, watchPausable } from '@vueuse/core'
|
|
76
|
+
import { isClient } from '@vueuse/shared'
|
|
77
|
+
import { ColorTranslator } from 'colortranslator'
|
|
78
|
+
|
|
79
|
+
const props = withDefaults(defineProps<ColorPickerProps>(), {
|
|
80
|
+
format: 'hex',
|
|
81
|
+
throttle: 50,
|
|
82
|
+
defaultValue: '#FFFFFF'
|
|
83
|
+
})
|
|
84
|
+
const modelValue = defineModel<string>(undefined)
|
|
85
|
+
|
|
86
|
+
const pickedColor = computed<HSVColor>({
|
|
87
|
+
get() {
|
|
88
|
+
try {
|
|
89
|
+
const color = new ColorTranslator(modelValue.value || props.defaultValue)
|
|
90
|
+
|
|
91
|
+
return HSLtoHSV(color.HSLObject)
|
|
92
|
+
} catch (_) {
|
|
93
|
+
return { h: 0, s: 0, v: 100 }
|
|
94
|
+
}
|
|
95
|
+
},
|
|
96
|
+
set(value) {
|
|
97
|
+
const color = new ColorTranslator(HSVtoHSL(value), {
|
|
98
|
+
decimals: 2,
|
|
99
|
+
labUnit: 'percent',
|
|
100
|
+
cmykUnit: 'percent',
|
|
101
|
+
cmykFunction: 'cmyk'
|
|
102
|
+
})
|
|
103
|
+
|
|
104
|
+
switch (props.format) {
|
|
105
|
+
case 'rgb':
|
|
106
|
+
modelValue.value = color.RGB
|
|
107
|
+
break
|
|
108
|
+
case 'hsl':
|
|
109
|
+
modelValue.value = color.HSL
|
|
110
|
+
break
|
|
111
|
+
case 'cmyk':
|
|
112
|
+
modelValue.value = color.CMYK
|
|
113
|
+
break
|
|
114
|
+
case 'lab':
|
|
115
|
+
modelValue.value = color.CIELab
|
|
116
|
+
break
|
|
117
|
+
case 'hex':
|
|
118
|
+
default:
|
|
119
|
+
modelValue.value = color.HEX
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
})
|
|
123
|
+
|
|
124
|
+
function useColorDraggable(targetElement: MaybeRefOrGetter<HTMLElement | null>,
|
|
125
|
+
containerElement: MaybeRefOrGetter<HTMLElement | null>,
|
|
126
|
+
axis: 'x' | 'y' | 'both' = 'both',
|
|
127
|
+
initialPosition = { x: 0, y: 0 },
|
|
128
|
+
disabled?: MaybeRefOrGetter<boolean | undefined>
|
|
129
|
+
) {
|
|
130
|
+
const position = ref<{ x: number, y: number }>(initialPosition)
|
|
131
|
+
const pressedDelta = ref<{ x: number, y: number }>()
|
|
132
|
+
const targetRect = useElementBounding(targetElement)
|
|
133
|
+
const containerRect = useElementBounding(containerElement)
|
|
134
|
+
|
|
135
|
+
function start(event: PointerEvent) {
|
|
136
|
+
if (toValue(disabled)) return event.preventDefault()
|
|
137
|
+
|
|
138
|
+
const container = toValue(containerElement)
|
|
139
|
+
|
|
140
|
+
pressedDelta.value = {
|
|
141
|
+
x: event.clientX - (container ? event.clientX - containerRect.left.value + container.scrollLeft : targetRect.left.value),
|
|
142
|
+
y: event.clientY - (container ? event.clientY - containerRect.top.value + container.scrollTop : targetRect.top.value)
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
move(event)
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
function move(event: PointerEvent) {
|
|
149
|
+
if (!pressedDelta.value) return
|
|
150
|
+
|
|
151
|
+
const container = toValue(containerElement)
|
|
152
|
+
let { x, y } = position.value
|
|
153
|
+
|
|
154
|
+
if (container && (axis === 'x' || axis === 'both')) {
|
|
155
|
+
x = Math.min(Math.max(0, (event.clientX - pressedDelta.value.x) / container.scrollWidth * 100), 100)
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
if (container && (axis === 'y' || axis === 'both')) {
|
|
159
|
+
y = Math.min(Math.max(0, (event.clientY - pressedDelta.value.y) / container.scrollHeight * 100), 100)
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
position.value = { x, y }
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
function end() {
|
|
166
|
+
if (!pressedDelta.value) {
|
|
167
|
+
return
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
pressedDelta.value = undefined
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
if (isClient) {
|
|
174
|
+
useEventListener(containerElement, 'pointerdown', start)
|
|
175
|
+
useEventListener(window, 'pointermove', move)
|
|
176
|
+
useEventListener(window, 'pointerup', end)
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
return {
|
|
180
|
+
position
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
function normalizeHue(hue: number, dir: 'left' | 'right' = 'left'): number {
|
|
185
|
+
if (dir === 'right') {
|
|
186
|
+
return (hue * 100) / 360
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
return (hue / 100) * 360
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
function normalizeBrightness(brightness: number): number {
|
|
193
|
+
return 100 - brightness
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
const selectorRef = ref<HTMLDivElement | null>(null)
|
|
197
|
+
const selectorThumbRef = ref<HTMLDivElement | null>(null)
|
|
198
|
+
const trackRef = ref<HTMLDivElement | null>(null)
|
|
199
|
+
const trackThumbRef = ref<HTMLDivElement | null>(null)
|
|
200
|
+
|
|
201
|
+
const disabled = computed(() => props.disabled)
|
|
202
|
+
|
|
203
|
+
const { position: selectorThumbPosition } = useColorDraggable(selectorThumbRef, selectorRef, 'both', {
|
|
204
|
+
x: pickedColor.value.s,
|
|
205
|
+
y: normalizeBrightness(pickedColor.value.v)
|
|
206
|
+
}, disabled)
|
|
207
|
+
|
|
208
|
+
const { position: trackThumbPosition } = useColorDraggable(trackThumbRef, trackRef, 'y', {
|
|
209
|
+
x: 0,
|
|
210
|
+
y: normalizeHue(pickedColor.value.h, 'right')
|
|
211
|
+
}, disabled)
|
|
212
|
+
|
|
213
|
+
const { pause: pauseWatchColor, resume: resumeWatchColor } = watchPausable(pickedColor, (hsb) => {
|
|
214
|
+
selectorThumbPosition.value = {
|
|
215
|
+
x: hsb.s,
|
|
216
|
+
y: normalizeBrightness(hsb.v)
|
|
217
|
+
}
|
|
218
|
+
trackThumbPosition.value = {
|
|
219
|
+
x: 0,
|
|
220
|
+
y: normalizeHue(hsb.h, 'right')
|
|
221
|
+
}
|
|
222
|
+
})
|
|
223
|
+
|
|
224
|
+
watchThrottled([selectorThumbPosition, trackThumbPosition], () => {
|
|
225
|
+
pauseWatchColor()
|
|
226
|
+
|
|
227
|
+
pickedColor.value = {
|
|
228
|
+
h: normalizeHue(trackThumbPosition.value.y),
|
|
229
|
+
s: selectorThumbPosition.value.x,
|
|
230
|
+
v: normalizeBrightness(selectorThumbPosition.value.y)
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
nextTick(resumeWatchColor)
|
|
234
|
+
}, { throttle: () => props.throttle })
|
|
235
|
+
|
|
236
|
+
const trackThumbColor = computed(() => new ColorTranslator(HSVtoHSL({
|
|
237
|
+
h: normalizeHue(trackThumbPosition.value.y),
|
|
238
|
+
s: 100,
|
|
239
|
+
v: 100
|
|
240
|
+
})).HEX)
|
|
241
|
+
|
|
242
|
+
const selectorStyle = computed(() => ({
|
|
243
|
+
backgroundColor: trackThumbColor.value
|
|
244
|
+
}))
|
|
245
|
+
|
|
246
|
+
const selectorThumbStyle = computed(() => ({
|
|
247
|
+
backgroundColor: new ColorTranslator(modelValue.value || props.defaultValue).HEX,
|
|
248
|
+
left: `${selectorThumbPosition.value.x}%`,
|
|
249
|
+
top: `${selectorThumbPosition.value.y}%`
|
|
250
|
+
}))
|
|
251
|
+
|
|
252
|
+
const trackThumbStyle = computed(() => ({
|
|
253
|
+
backgroundColor: trackThumbColor.value,
|
|
254
|
+
top: `${trackThumbPosition.value.y}%`
|
|
255
|
+
}))
|
|
256
|
+
|
|
257
|
+
const ui = computed(() => colorPicker({
|
|
258
|
+
size: props.size
|
|
259
|
+
}))
|
|
260
|
+
</script>
|
|
261
|
+
|
|
262
|
+
<template>
|
|
263
|
+
<Primitive :as="as" :class="ui.root({ class: [props.class, props.ui?.root] })" :data-disabled="disabled ? true : undefined">
|
|
264
|
+
<div :class="ui.picker({ class: props.ui?.picker })">
|
|
265
|
+
<div
|
|
266
|
+
ref="selectorRef"
|
|
267
|
+
:class="ui.selector({ class: props.ui?.selector })"
|
|
268
|
+
:style="selectorStyle"
|
|
269
|
+
>
|
|
270
|
+
<div :class="ui.selectorBackground({ class: props.ui?.selectorBackground })" data-color-picker-background>
|
|
271
|
+
<div
|
|
272
|
+
ref="selectorThumbRef"
|
|
273
|
+
:class="ui.selectorThumb({ class: props.ui?.selectorThumb })"
|
|
274
|
+
:style="selectorThumbStyle"
|
|
275
|
+
:data-disabled="disabled ? true : undefined"
|
|
276
|
+
/>
|
|
277
|
+
</div>
|
|
278
|
+
</div>
|
|
279
|
+
<div
|
|
280
|
+
ref="trackRef"
|
|
281
|
+
:class="ui.track({ class: props.ui?.track })"
|
|
282
|
+
data-color-picker-track
|
|
283
|
+
>
|
|
284
|
+
<div
|
|
285
|
+
ref="trackThumbRef"
|
|
286
|
+
:class="ui.trackThumb({ class: props.ui?.trackThumb })"
|
|
287
|
+
:style="trackThumbStyle"
|
|
288
|
+
:data-disabled="disabled ? true : undefined"
|
|
289
|
+
/>
|
|
290
|
+
</div>
|
|
291
|
+
</div>
|
|
292
|
+
</Primitive>
|
|
293
|
+
</template>
|
|
294
|
+
|
|
295
|
+
<style scoped>
|
|
296
|
+
[data-color-picker-background]{background-image:linear-gradient(0deg,#000 0,transparent),linear-gradient(90deg,#fff 0,hsla(0,0%,100%,0))}[data-color-picker-track]{background-image:linear-gradient(0deg,red,#f0f 17%,#00f 33%,#0ff 50%,#0f0 67%,#ff0 83%,red)}
|
|
297
|
+
</style>
|