gooee 0.52.0 → 1.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +10 -3
- package/package.json +6 -2
- package/scripts/add.js +181 -42
- package/src/base.css +3 -1
- package/src/components/Accordion/Accordion.module.css +7 -5
- package/src/components/Accordion/Accordion.tsx +13 -11
- package/src/components/Accordion/Accordion.vue +16 -15
- package/src/components/Accordion/AccordionItem.vue +8 -7
- package/src/components/Alert/Alert.module.css +9 -7
- package/src/components/Alert/Alert.tsx +25 -16
- package/src/components/Alert/Alert.vue +31 -27
- package/src/components/AlertDialog/AlertDialog.module.css +2 -0
- package/src/components/AlertDialog/AlertDialog.tsx +8 -7
- package/src/components/AlertDialog/AlertDialog.vue +25 -23
- package/src/components/AnimatedNumber/AnimatedNumber.module.css +5 -3
- package/src/components/AnimatedNumber/AnimatedNumber.tsx +6 -6
- package/src/components/AnimatedNumber/AnimatedNumber.vue +5 -5
- package/src/components/AspectRatio/AspectRatio.module.css +2 -0
- package/src/components/AspectRatio/AspectRatio.tsx +3 -3
- package/src/components/AspectRatio/AspectRatio.vue +5 -8
- package/src/components/Avatar/Avatar.module.css +10 -8
- package/src/components/Avatar/Avatar.tsx +4 -3
- package/src/components/Avatar/Avatar.vue +17 -19
- package/src/components/Avatar/index.ts +0 -2
- package/src/components/AvatarGroup/AvatarGroup.module.css +11 -9
- package/src/components/AvatarGroup/AvatarGroup.tsx +4 -4
- package/src/components/AvatarGroup/AvatarGroup.vue +13 -16
- package/src/components/Badge/Badge.module.css +6 -4
- package/src/components/Badge/Badge.tsx +3 -3
- package/src/components/Badge/Badge.vue +15 -14
- package/src/components/Breadcrumb/Breadcrumb.module.css +5 -3
- package/src/components/Breadcrumb/Breadcrumb.tsx +20 -12
- package/src/components/Breadcrumb/Breadcrumb.vue +33 -25
- package/src/components/Button/Button.module.css +16 -14
- package/src/components/Button/Button.tsx +6 -4
- package/src/components/Button/Button.vue +42 -33
- package/src/components/ButtonGroup/ButtonGroup.module.css +2 -0
- package/src/components/ButtonGroup/ButtonGroup.tsx +1 -1
- package/src/components/ButtonGroup/ButtonGroup.vue +9 -12
- package/src/components/Card/Card.module.css +6 -4
- package/src/components/Card/Card.tsx +6 -6
- package/src/components/Card/Card.vue +18 -21
- package/src/components/Center/Center.module.css +2 -0
- package/src/components/Center/Center.tsx +1 -1
- package/src/components/Center/Center.vue +18 -15
- package/src/components/Checkbox/Checkbox.module.css +10 -8
- package/src/components/Checkbox/Checkbox.tsx +15 -9
- package/src/components/Checkbox/Checkbox.vue +29 -31
- package/src/components/CheckboxGroup/CheckboxGroup.module.css +3 -1
- package/src/components/CheckboxGroup/CheckboxGroup.tsx +4 -4
- package/src/components/CheckboxGroup/CheckboxGroup.vue +33 -30
- package/src/components/Cluster/Cluster.module.css +2 -0
- package/src/components/Cluster/Cluster.tsx +1 -1
- package/src/components/Cluster/Cluster.vue +21 -17
- package/src/components/CodeBlock/CodeBlock.module.css +12 -10
- package/src/components/CodeBlock/CodeBlock.tsx +18 -10
- package/src/components/CodeBlock/CodeBlock.vue +30 -27
- package/src/components/CodeBlock/highlight.ts +1 -1
- package/src/components/Collapsible/Collapsible.module.css +7 -5
- package/src/components/Collapsible/Collapsible.tsx +7 -6
- package/src/components/Collapsible/Collapsible.vue +30 -26
- package/src/components/Container/Container.module.css +2 -0
- package/src/components/Container/Container.tsx +1 -1
- package/src/components/Container/Container.vue +13 -12
- package/src/components/CopyButton/CopyButton.module.css +20 -18
- package/src/components/CopyButton/CopyButton.tsx +21 -14
- package/src/components/CopyButton/CopyButton.vue +41 -31
- package/src/components/Dial/Dial.module.css +26 -11
- package/src/components/Dial/Dial.tsx +18 -18
- package/src/components/Dial/Dial.vue +57 -60
- package/src/components/Dialog/Dialog.module.css +4 -2
- package/src/components/Dialog/Dialog.tsx +22 -13
- package/src/components/Dialog/Dialog.vue +34 -30
- package/src/components/Divider/Divider.module.css +5 -3
- package/src/components/Divider/Divider.tsx +6 -4
- package/src/components/Divider/Divider.vue +13 -16
- package/src/components/DropdownMenu/DropdownMenu.module.css +8 -6
- package/src/components/DropdownMenu/DropdownMenu.tsx +12 -9
- package/src/components/DropdownMenu/DropdownMenu.vue +25 -28
- package/src/components/EmptyState/EmptyState.module.css +6 -4
- package/src/components/EmptyState/EmptyState.tsx +6 -6
- package/src/components/EmptyState/EmptyState.vue +14 -17
- package/src/components/Fab/Fab.module.css +19 -17
- package/src/components/Fab/Fab.tsx +11 -9
- package/src/components/Fab/Fab.vue +29 -26
- package/src/components/Fieldset/Fieldset.module.css +2 -0
- package/src/components/Fieldset/Fieldset.tsx +4 -3
- package/src/components/Fieldset/Fieldset.vue +4 -4
- package/src/components/FormField/FormField.module.css +5 -3
- package/src/components/FormField/FormField.tsx +7 -7
- package/src/components/FormField/FormField.vue +4 -4
- package/src/components/Grid/Grid.module.css +2 -0
- package/src/components/Grid/Grid.tsx +1 -1
- package/src/components/Grid/Grid.vue +25 -22
- package/src/components/HoldToConfirm/HoldToConfirm.module.css +13 -11
- package/src/components/HoldToConfirm/HoldToConfirm.tsx +11 -9
- package/src/components/HoldToConfirm/HoldToConfirm.vue +37 -32
- package/src/components/IconButton/IconButton.module.css +7 -5
- package/src/components/IconButton/IconButton.tsx +2 -1
- package/src/components/IconButton/IconButton.vue +15 -14
- package/src/components/Input/Input.module.css +12 -10
- package/src/components/Input/Input.tsx +9 -7
- package/src/components/Input/Input.vue +45 -35
- package/src/components/InputGroup/InputGroup.module.css +8 -6
- package/src/components/InputGroup/InputGroup.tsx +5 -4
- package/src/components/InputGroup/InputGroup.vue +41 -36
- package/src/components/Kbd/Kbd.module.css +9 -7
- package/src/components/Kbd/Kbd.tsx +1 -1
- package/src/components/Kbd/Kbd.vue +1 -1
- package/src/components/Link/Link.module.css +4 -2
- package/src/components/Link/Link.tsx +4 -3
- package/src/components/Link/Link.vue +13 -16
- package/src/components/LivePill/LivePill.module.css +39 -37
- package/src/components/LivePill/LivePill.tsx +11 -10
- package/src/components/LivePill/LivePill.vue +38 -40
- package/src/components/Meter/Meter.module.css +5 -3
- package/src/components/Meter/Meter.tsx +9 -8
- package/src/components/Meter/Meter.vue +52 -43
- package/src/components/MorphButton/MorphButton.module.css +11 -9
- package/src/components/MorphButton/MorphButton.tsx +20 -10
- package/src/components/MorphButton/MorphButton.vue +29 -25
- package/src/components/NumberInput/NumberInput.module.css +7 -5
- package/src/components/NumberInput/NumberInput.tsx +11 -8
- package/src/components/NumberInput/NumberInput.vue +69 -57
- package/src/components/Pagination/Pagination.module.css +147 -5
- package/src/components/Pagination/Pagination.tsx +216 -41
- package/src/components/Pagination/Pagination.vue +201 -36
- package/src/components/Pagination/labels.ts +38 -0
- package/src/components/PasswordInput/PasswordInput.module.css +10 -8
- package/src/components/PasswordInput/PasswordInput.tsx +15 -7
- package/src/components/PasswordInput/PasswordInput.vue +20 -16
- package/src/components/PasswordInput/index.ts +1 -1
- package/src/components/PickerWheel/DateWheel.vue +20 -12
- package/src/components/PickerWheel/PickerWheel.module.css +15 -6
- package/src/components/PickerWheel/PickerWheel.tsx +70 -44
- package/src/components/PickerWheel/PickerWheel.vue +39 -38
- package/src/components/PickerWheel/TimeWheel.vue +23 -21
- package/src/components/PickerWheel/WheelColumn.vue +7 -5
- package/src/components/Popover/Popover.module.css +5 -3
- package/src/components/Popover/Popover.tsx +17 -8
- package/src/components/Popover/Popover.vue +26 -25
- package/src/components/ProgressBar/ProgressBar.module.css +4 -2
- package/src/components/ProgressBar/ProgressBar.tsx +6 -5
- package/src/components/ProgressBar/ProgressBar.vue +28 -25
- package/src/components/Prose/Prose.module.css +5 -3
- package/src/components/Prose/Prose.tsx +1 -1
- package/src/components/Prose/Prose.vue +5 -8
- package/src/components/Radio/Radio.module.css +10 -8
- package/src/components/Radio/Radio.tsx +10 -8
- package/src/components/Radio/Radio.vue +8 -8
- package/src/components/Radio/RadioGroup.vue +33 -35
- package/src/components/Radio/radioContext.ts +12 -0
- package/src/components/Retime/Retime.vue +25 -22
- package/src/components/RulerScrubber/RulerScrubber.module.css +11 -2
- package/src/components/RulerScrubber/RulerScrubber.tsx +19 -18
- package/src/components/RulerScrubber/RulerScrubber.vue +50 -54
- package/src/components/ScrollArea/ScrollArea.module.css +17 -15
- package/src/components/ScrollArea/ScrollArea.tsx +5 -4
- package/src/components/ScrollArea/ScrollArea.vue +15 -17
- package/src/components/SearchInput/SearchInput.module.css +6 -4
- package/src/components/SearchInput/SearchInput.tsx +22 -10
- package/src/components/SearchInput/SearchInput.vue +20 -17
- package/src/components/SearchInput/index.ts +1 -1
- package/src/components/SegmentedControl/SegmentedControl.module.css +7 -5
- package/src/components/SegmentedControl/SegmentedControl.tsx +9 -5
- package/src/components/SegmentedControl/SegmentedControl.vue +25 -29
- package/src/components/Select/Select.module.css +19 -17
- package/src/components/Select/Select.tsx +31 -18
- package/src/components/Select/Select.vue +63 -58
- package/src/components/Sheet/Sheet.module.css +6 -4
- package/src/components/Sheet/Sheet.tsx +39 -29
- package/src/components/Sheet/Sheet.vue +46 -40
- package/src/components/Skeleton/Skeleton.module.css +4 -2
- package/src/components/Skeleton/Skeleton.tsx +3 -2
- package/src/components/Skeleton/Skeleton.vue +16 -18
- package/src/components/Slider/Slider.module.css +14 -12
- package/src/components/Slider/Slider.tsx +27 -11
- package/src/components/Slider/Slider.vue +47 -37
- package/src/components/Spinner/Spinner.module.css +2 -0
- package/src/components/Spinner/Spinner.tsx +3 -3
- package/src/components/Spinner/Spinner.vue +9 -12
- package/src/components/Split/Split.module.css +2 -0
- package/src/components/Split/Split.tsx +3 -3
- package/src/components/Split/Split.vue +19 -17
- package/src/components/SplitFlap/SplitFlap.module.css +9 -7
- package/src/components/SplitFlap/SplitFlap.tsx +2 -2
- package/src/components/SplitFlap/SplitFlap.vue +24 -21
- package/src/components/Stack/Stack.module.css +2 -0
- package/src/components/Stack/Stack.tsx +1 -1
- package/src/components/Stack/Stack.vue +13 -12
- package/src/components/SwipeDeck/SwipeDeck.module.css +13 -11
- package/src/components/SwipeDeck/SwipeDeck.tsx +23 -28
- package/src/components/SwipeDeck/SwipeDeck.vue +32 -38
- package/src/components/Switch/Switch.module.css +10 -8
- package/src/components/Switch/Switch.tsx +6 -5
- package/src/components/Switch/Switch.vue +22 -24
- package/src/components/Table/Table.module.css +24 -22
- package/src/components/Table/Table.tsx +27 -30
- package/src/components/Table/Table.vue +93 -79
- package/src/components/TableOfContents/TableOfContents.module.css +9 -7
- package/src/components/TableOfContents/TableOfContents.tsx +8 -8
- package/src/components/TableOfContents/TableOfContents.vue +20 -23
- package/src/components/Tabs/Tab.vue +3 -0
- package/src/components/Tabs/TabList.vue +2 -2
- package/src/components/Tabs/TabPanel.vue +2 -0
- package/src/components/Tabs/Tabs.module.css +4 -2
- package/src/components/Tabs/Tabs.tsx +10 -5
- package/src/components/Tabs/Tabs.vue +1 -1
- package/src/components/Tag/Tag.module.css +12 -10
- package/src/components/Tag/Tag.tsx +13 -15
- package/src/components/Tag/Tag.vue +12 -14
- package/src/components/Textarea/Textarea.module.css +8 -6
- package/src/components/Textarea/Textarea.tsx +4 -3
- package/src/components/Textarea/Textarea.vue +32 -34
- package/src/components/ThemeToggle/ThemeToggle.module.css +2 -0
- package/src/components/ThemeToggle/ThemeToggle.tsx +7 -7
- package/src/components/ThemeToggle/ThemeToggle.vue +24 -22
- package/src/components/Toast/Toast.module.css +17 -15
- package/src/components/Toast/Toast.tsx +51 -34
- package/src/components/Toast/Toast.vue +35 -24
- package/src/components/Toast/ToastItem.vue +17 -16
- package/src/components/Toggle/Toggle.module.css +11 -9
- package/src/components/Toggle/Toggle.tsx +3 -2
- package/src/components/Toggle/Toggle.vue +13 -15
- package/src/components/Tooltip/Tooltip.module.css +5 -3
- package/src/components/Tooltip/Tooltip.tsx +1 -0
- package/src/components/Tooltip/Tooltip.vue +13 -18
- package/src/components/VisuallyHidden/VisuallyHidden.module.css +2 -0
- package/src/components/VisuallyHidden/VisuallyHidden.tsx +1 -1
- package/src/components/VisuallyHidden/VisuallyHidden.vue +5 -8
- package/src/{internal → icons}/icons.module.css +4 -2
- package/src/{internal → icons}/icons.tsx +15 -16
- package/src/internal/FieldMessage.module.css +5 -3
- package/src/internal/FieldMessage.tsx +2 -2
- package/src/internal/FieldMessage.vue +2 -2
- package/src/internal/Roll.module.css +5 -3
- package/src/internal/feel.ts +12 -10
- package/src/internal/fling.ts +3 -3
- package/src/internal/liquid.ts +12 -10
- package/src/internal/liquidMatter.ts +1 -1
- package/src/internal/liquidMore.ts +7 -7
- package/src/internal/motion/checkbox.ts +4 -4
- package/src/internal/motion/fling.ts +19 -9
- package/src/internal/motion/holdToConfirm.ts +3 -3
- package/src/internal/motion/index.ts +8 -6
- package/src/internal/motion/liquid.ts +16 -4
- package/src/internal/motion/liquidMatter.ts +8 -6
- package/src/internal/motion/liquidMore.ts +44 -25
- package/src/internal/motion/livePill.ts +1 -1
- package/src/internal/motion/numberInput.ts +2 -2
- package/src/internal/motion/pickerWheel.ts +7 -4
- package/src/internal/motion/ruler.ts +1 -1
- package/src/internal/motion/scrollArea.ts +3 -3
- package/src/internal/motion/scrollFrame.ts +9 -7
- package/src/internal/motion/scrubber.ts +39 -20
- package/src/internal/motion/slider.ts +38 -4
- package/src/internal/motion/softPress.ts +10 -9
- package/src/internal/motion/splitFlap.ts +4 -4
- package/src/internal/motion/swipeDeck.ts +38 -7
- package/src/internal/motion/table.ts +3 -6
- package/src/internal/motion/themeIcon.ts +1 -1
- package/src/internal/motion/themeReveal.ts +1 -1
- package/src/internal/motion/toast.ts +3 -3
- package/src/internal/motion.ts +7 -8
- package/src/internal/scrollFrame.ts +3 -3
- package/src/internal/useScrub.ts +1 -15
- package/src/internal/vue/useScrub.ts +2 -6
- package/src/tokens.css +81 -421
- package/src/{internal/vueIcons.ts → icons/vue.ts} +5 -5
|
@@ -8,27 +8,34 @@ import styles from './Button.module.css'
|
|
|
8
8
|
// Other attributes and listeners go to the button (or the link, with href).
|
|
9
9
|
defineOptions({ inheritAttrs: false })
|
|
10
10
|
|
|
11
|
-
const
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
11
|
+
const {
|
|
12
|
+
variant = 'primary',
|
|
13
|
+
size = 'md',
|
|
14
|
+
loading = false,
|
|
15
|
+
loadingLabel = 'Loading',
|
|
16
|
+
fullWidth,
|
|
17
|
+
disabled,
|
|
18
|
+
disabledReason,
|
|
19
|
+
href,
|
|
20
|
+
type = 'button',
|
|
21
|
+
} = defineProps<{
|
|
22
|
+
/** Visual weight. Use one primary per view and danger for destructive actions. */
|
|
23
|
+
variant?: 'primary' | 'secondary' | 'ghost' | 'danger'
|
|
24
|
+
/** Height and text size. */
|
|
25
|
+
size?: 'sm' | 'md' | 'lg'
|
|
26
|
+
/** Shows a spinner and ignores clicks, but keeps focus on the button. */
|
|
27
|
+
loading?: boolean
|
|
28
|
+
/** Spoken while loading, for example "Saving". */
|
|
29
|
+
loadingLabel?: string
|
|
30
|
+
/** Stretches the button to fill its container. */
|
|
31
|
+
fullWidth?: boolean
|
|
32
|
+
disabled?: boolean
|
|
33
|
+
/** Why the button is disabled. Read by screen readers and shown as a tooltip while it is disabled. */
|
|
34
|
+
disabledReason?: string
|
|
35
|
+
/** Renders a link with the same look, for navigation. */
|
|
36
|
+
href?: string
|
|
37
|
+
type?: 'button' | 'submit' | 'reset'
|
|
38
|
+
}>()
|
|
32
39
|
// The rendered button or link, for a parent that moves focus to it (React's forwarded ref).
|
|
33
40
|
const el = ref<HTMLButtonElement | HTMLAnchorElement | null>(null)
|
|
34
41
|
defineExpose({ el })
|
|
@@ -37,15 +44,15 @@ const attrs = useAttrs()
|
|
|
37
44
|
|
|
38
45
|
const reasonId = useId()
|
|
39
46
|
const ariaDisabled = computed(() => attrs['aria-disabled'] === true || attrs['aria-disabled'] === 'true')
|
|
40
|
-
const inert = computed(() =>
|
|
41
|
-
const reason = computed(() => (
|
|
47
|
+
const inert = computed(() => loading || disabled || ariaDisabled.value)
|
|
48
|
+
const reason = computed(() => (disabled || ariaDisabled.value ? disabledReason : undefined))
|
|
42
49
|
const describedBy = computed(() => [attrs['aria-describedby'], reason.value ? reasonId : undefined].filter(Boolean).join(' ') || undefined)
|
|
43
50
|
|
|
44
51
|
// The edge is soft: it dents where pressed and springs back (motion/softPress.ts).
|
|
45
52
|
const soft = createSoftPress({
|
|
46
53
|
look: { layer: styles.soft, fill: styles.softFill, ring: styles.softRing, wet: styles.wet },
|
|
47
54
|
get keys() {
|
|
48
|
-
return
|
|
55
|
+
return href === undefined ? [' ', 'Enter'] : ['Enter']
|
|
49
56
|
},
|
|
50
57
|
get inert() {
|
|
51
58
|
return inert.value
|
|
@@ -71,9 +78,11 @@ const shared = computed(() => ({
|
|
|
71
78
|
'aria-describedby': describedBy.value,
|
|
72
79
|
title: (attrs.title as string | undefined) ?? reason.value,
|
|
73
80
|
// The caller's class joins ours, as React's className does.
|
|
74
|
-
class: [styles.root, styles[
|
|
75
|
-
'data-
|
|
76
|
-
'
|
|
81
|
+
class: [styles.root, styles[variant], styles[size], fullWidth && styles.full, attrs.class],
|
|
82
|
+
'data-slot': 'button',
|
|
83
|
+
'data-status': loading ? 'loading' : undefined,
|
|
84
|
+
'data-disabled': disabled || undefined,
|
|
85
|
+
'aria-busy': loading || undefined,
|
|
77
86
|
'aria-disabled': inert.value || undefined,
|
|
78
87
|
}))
|
|
79
88
|
</script>
|
|
@@ -95,9 +104,9 @@ const shared = computed(() => ({
|
|
|
95
104
|
@blur="soft.blur"
|
|
96
105
|
>
|
|
97
106
|
<span :class="styles.content">
|
|
98
|
-
<span v-if="slots.leading" :class="styles.icon"><slot name="leading" /></span>
|
|
99
|
-
<span :class="styles.label"><slot /></span>
|
|
100
|
-
<span v-if="slots.trailing" :class="styles.icon"><slot name="trailing" /></span>
|
|
107
|
+
<span v-if="slots.leading" data-slot="button-icon" :class="styles.icon"><slot name="leading" /></span>
|
|
108
|
+
<span data-slot="button-label" :class="styles.label"><slot /></span>
|
|
109
|
+
<span v-if="slots.trailing" data-slot="button-icon" :class="styles.icon"><slot name="trailing" /></span>
|
|
101
110
|
</span>
|
|
102
111
|
<span :class="styles.spinner" aria-hidden="true"><Spinner v-if="loading" size="sm" :label="null" /></span>
|
|
103
112
|
<span :class="styles.srOnly" role="status">{{ loading ? loadingLabel : null }}</span>
|
|
@@ -119,9 +128,9 @@ const shared = computed(() => ({
|
|
|
119
128
|
@blur="soft.blur"
|
|
120
129
|
>
|
|
121
130
|
<span :class="styles.content">
|
|
122
|
-
<span v-if="slots.leading" :class="styles.icon"><slot name="leading" /></span>
|
|
123
|
-
<span :class="styles.label"><slot /></span>
|
|
124
|
-
<span v-if="slots.trailing" :class="styles.icon"><slot name="trailing" /></span>
|
|
131
|
+
<span v-if="slots.leading" data-slot="button-icon" :class="styles.icon"><slot name="leading" /></span>
|
|
132
|
+
<span data-slot="button-label" :class="styles.label"><slot /></span>
|
|
133
|
+
<span v-if="slots.trailing" data-slot="button-icon" :class="styles.icon"><slot name="trailing" /></span>
|
|
125
134
|
</span>
|
|
126
135
|
<span :class="styles.spinner" aria-hidden="true"><Spinner v-if="loading" size="sm" :label="null" /></span>
|
|
127
136
|
<span :class="styles.srOnly" role="status">{{ loading ? loadingLabel : null }}</span>
|
|
@@ -21,7 +21,7 @@ export function ButtonGroup({ label, children, orientation = 'horizontal', class
|
|
|
21
21
|
return markRows(own.current)
|
|
22
22
|
}, [orientation])
|
|
23
23
|
return (
|
|
24
|
-
<div {...rest} ref={mergeRefs(own, ref)} role="group" aria-label={label} className={cx(styles.root, styles[orientation], className)} data-orientation={orientation}>
|
|
24
|
+
<div {...rest} ref={mergeRefs(own, ref)} role="group" aria-label={label} data-slot="button-group" className={cx(styles.root, styles[orientation], className)} data-orientation={orientation}>
|
|
25
25
|
{children}
|
|
26
26
|
</div>
|
|
27
27
|
)
|
|
@@ -4,30 +4,27 @@ import { markRows } from '../../internal/motion/buttonGroup'
|
|
|
4
4
|
import styles from './ButtonGroup.module.css'
|
|
5
5
|
|
|
6
6
|
// The Vue ButtonGroup: the same look (ButtonGroup.module.css) as the React one. The buttons go in the default slot.
|
|
7
|
-
const
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
}>(),
|
|
14
|
-
{ orientation: 'horizontal' },
|
|
15
|
-
)
|
|
7
|
+
const { orientation = 'horizontal' } = defineProps<{
|
|
8
|
+
/** Accessible name for the group, such as "Text alignment". */
|
|
9
|
+
label: string
|
|
10
|
+
/** A row, or a column where each button takes the full width. */
|
|
11
|
+
orientation?: 'horizontal' | 'vertical'
|
|
12
|
+
}>()
|
|
16
13
|
|
|
17
14
|
const root = ref<HTMLElement | null>(null)
|
|
18
15
|
let stop: (() => void) | undefined
|
|
19
16
|
// Each wrapped row keeps round ends of its own (motion/buttonGroup.ts).
|
|
20
17
|
const watchRows = () => {
|
|
21
18
|
stop?.()
|
|
22
|
-
stop = root.value &&
|
|
19
|
+
stop = root.value && orientation === 'horizontal' ? markRows(root.value) : undefined
|
|
23
20
|
}
|
|
24
21
|
onMounted(watchRows)
|
|
25
|
-
watch(() =>
|
|
22
|
+
watch(() => orientation, watchRows, { flush: 'post' })
|
|
26
23
|
onBeforeUnmount(() => stop?.())
|
|
27
24
|
</script>
|
|
28
25
|
|
|
29
26
|
<template>
|
|
30
|
-
<div ref="root" role="group" :aria-label="label" :class="[styles.root, styles[orientation]]" :data-orientation="orientation">
|
|
27
|
+
<div ref="root" role="group" :aria-label="label" data-slot="button-group" :class="[styles.root, styles[orientation]]" :data-orientation="orientation">
|
|
31
28
|
<slot />
|
|
32
29
|
</div>
|
|
33
30
|
</template>
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
@layer gooee.components {
|
|
1
2
|
.root {
|
|
2
3
|
position: relative;
|
|
3
4
|
display: flex;
|
|
@@ -10,9 +11,9 @@
|
|
|
10
11
|
background: var(--gooee-color-surface);
|
|
11
12
|
box-shadow: var(--gooee-shadow-1);
|
|
12
13
|
transition:
|
|
13
|
-
transform var(--gooee-motion-slow) var(--gooee-ease-
|
|
14
|
-
box-shadow var(--gooee-motion-slow) var(--gooee-ease-
|
|
15
|
-
outline-color var(--gooee-motion-base) var(--gooee-ease-
|
|
14
|
+
transform var(--gooee-motion-slow) var(--gooee-ease-morph),
|
|
15
|
+
box-shadow var(--gooee-motion-slow) var(--gooee-ease-morph),
|
|
16
|
+
outline-color var(--gooee-motion-base) var(--gooee-ease-morph);
|
|
16
17
|
}
|
|
17
18
|
|
|
18
19
|
@media (hover: hover) {
|
|
@@ -40,7 +41,7 @@
|
|
|
40
41
|
border-radius: var(--gooee-radius-panel) var(--gooee-radius-panel) 0 0;
|
|
41
42
|
}
|
|
42
43
|
|
|
43
|
-
.media > * { transition: transform var(--gooee-motion-slower) var(--gooee-ease-
|
|
44
|
+
.media > * { transition: transform var(--gooee-motion-slower) var(--gooee-ease-morph); }
|
|
44
45
|
@media (hover: hover) {
|
|
45
46
|
.interactive:hover .media > * { transform: scale(1.03); }
|
|
46
47
|
}
|
|
@@ -82,3 +83,4 @@
|
|
|
82
83
|
padding: calc(var(--gooee-space-4) - var(--gooee-line)) var(--gooee-space-6) var(--gooee-space-4) var(--gooee-space-6);
|
|
83
84
|
border-top: var(--gooee-line) solid var(--gooee-color-border);
|
|
84
85
|
}
|
|
86
|
+
}
|
|
@@ -21,14 +21,14 @@ export type CardProps = Omit<ComponentPropsWithRef<'div'>, 'title'> & {
|
|
|
21
21
|
|
|
22
22
|
export function Card({ title, description, media, footer, interactive, padding = 'md', fill, className, children, ...rest }: CardProps) {
|
|
23
23
|
return (
|
|
24
|
-
<div className={cx(styles.root, interactive && styles.interactive, styles[padding], fill && styles.fill, className)} {...rest}>
|
|
25
|
-
{media && <div className={styles.media}>{media}</div>}
|
|
26
|
-
<div className={styles.body}>
|
|
27
|
-
{title && <h3 className={styles.title}>{title}</h3>}
|
|
28
|
-
{description && <p className={styles.description}>{description}</p>}
|
|
24
|
+
<div data-slot="card" className={cx(styles.root, interactive && styles.interactive, styles[padding], fill && styles.fill, className)} {...rest}>
|
|
25
|
+
{media && <div data-slot="card-media" className={styles.media}>{media}</div>}
|
|
26
|
+
<div data-slot="card-body" className={styles.body}>
|
|
27
|
+
{title && <h3 data-slot="card-title" className={styles.title}>{title}</h3>}
|
|
28
|
+
{description && <p data-slot="card-description" className={styles.description}>{description}</p>}
|
|
29
29
|
{children}
|
|
30
30
|
</div>
|
|
31
|
-
{footer && <div className={styles.footer}>{footer}</div>}
|
|
31
|
+
{footer && <div data-slot="card-footer" className={styles.footer}>{footer}</div>}
|
|
32
32
|
</div>
|
|
33
33
|
)
|
|
34
34
|
}
|
|
@@ -2,33 +2,30 @@
|
|
|
2
2
|
import styles from './Card.module.css'
|
|
3
3
|
|
|
4
4
|
// The Vue Card: the same look (Card.module.css) as the React one. Other attributes go to the root.
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
}>(),
|
|
18
|
-
{ padding: 'md' },
|
|
19
|
-
)
|
|
5
|
+
const { padding = 'md' } = defineProps<{
|
|
6
|
+
/** Heading at the top of the body, rendered as an h3. The title slot replaces it. */
|
|
7
|
+
title?: string
|
|
8
|
+
/** Muted text under the title. The description slot replaces it. */
|
|
9
|
+
description?: string
|
|
10
|
+
/** Lifts on hover. Use when the card holds a link or button that covers it. */
|
|
11
|
+
interactive?: boolean
|
|
12
|
+
/** Space inside the card. */
|
|
13
|
+
padding?: 'md' | 'lg'
|
|
14
|
+
/** Lets the body grow when the card is stretched (a grid cell or flex row), so the footer or a last button sits at the bottom. */
|
|
15
|
+
fill?: boolean
|
|
16
|
+
}>()
|
|
20
17
|
/** media: shown above the body, edge to edge. footer: a row under the body, set apart by a border, such as actions. */
|
|
21
18
|
const slots = defineSlots<{ default?: () => unknown; title?: () => unknown; description?: () => unknown; media?: () => unknown; footer?: () => unknown }>()
|
|
22
19
|
</script>
|
|
23
20
|
|
|
24
21
|
<template>
|
|
25
|
-
<div :class="[styles.root, interactive && styles.interactive, styles[padding], fill && styles.fill]">
|
|
26
|
-
<div v-if="slots.media" :class="styles.media"><slot name="media" /></div>
|
|
27
|
-
<div :class="styles.body">
|
|
28
|
-
<h3 v-if="title || slots.title" :class="styles.title"><slot name="title">{{ title }}</slot></h3>
|
|
29
|
-
<p v-if="description || slots.description" :class="styles.description"><slot name="description">{{ description }}</slot></p>
|
|
22
|
+
<div data-slot="card" :class="[styles.root, interactive && styles.interactive, styles[padding], fill && styles.fill]">
|
|
23
|
+
<div v-if="slots.media" data-slot="card-media" :class="styles.media"><slot name="media" /></div>
|
|
24
|
+
<div data-slot="card-body" :class="styles.body">
|
|
25
|
+
<h3 v-if="title || slots.title" data-slot="card-title" :class="styles.title"><slot name="title">{{ title }}</slot></h3>
|
|
26
|
+
<p v-if="description || slots.description" data-slot="card-description" :class="styles.description"><slot name="description">{{ description }}</slot></p>
|
|
30
27
|
<slot />
|
|
31
28
|
</div>
|
|
32
|
-
<div v-if="slots.footer" :class="styles.footer"><slot name="footer" /></div>
|
|
29
|
+
<div v-if="slots.footer" data-slot="card-footer" :class="styles.footer"><slot name="footer" /></div>
|
|
33
30
|
</div>
|
|
34
31
|
</template>
|
|
@@ -24,5 +24,5 @@ export function Center({ axis = 'both', minHeight, centerText = true, gap = 4, a
|
|
|
24
24
|
'--center-min-h': minHeight ? `var(--gooee-center-h-${minHeight})` : undefined,
|
|
25
25
|
...style,
|
|
26
26
|
} as CSSProperties
|
|
27
|
-
return <Tag className={cx(styles.root, axis === 'both' && styles.both, centerText && styles.text, className)} style={vars} {...rest} />
|
|
27
|
+
return <Tag data-slot="center" className={cx(styles.root, axis === 'both' && styles.both, centerText && styles.text, className)} style={vars} {...rest} />
|
|
28
28
|
}
|
|
@@ -3,27 +3,30 @@ import { space, type Space } from '../../internal/space'
|
|
|
3
3
|
import styles from './Center.module.css'
|
|
4
4
|
|
|
5
5
|
// The Vue Center: the same look (Center.module.css) as the React one. Other attributes go to the element.
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
6
|
+
const {
|
|
7
|
+
axis = 'both',
|
|
8
|
+
centerText = true,
|
|
9
|
+
gap = 4,
|
|
10
|
+
as = 'div',
|
|
11
|
+
} = defineProps<{
|
|
12
|
+
/** "both" centres across and down; "inline" only across, and content starts at the top. */
|
|
13
|
+
axis?: 'both' | 'inline'
|
|
14
|
+
/** Least height of the box, from the --gooee-center-h-* tokens. "screen" fills the visible screen. Down centring needs a height to work in. */
|
|
15
|
+
minHeight?: 'sm' | 'md' | 'lg' | 'screen'
|
|
16
|
+
/** Centres each line of text too. Turn off for long text that reads better from the left. */
|
|
17
|
+
centerText?: boolean
|
|
18
|
+
/** Space between the items, as a step of the space scale. */
|
|
19
|
+
gap?: Space
|
|
20
|
+
/** Element to render, such as main for a full page error. */
|
|
21
|
+
as?: 'div' | 'section' | 'main' | 'article'
|
|
22
|
+
}>()
|
|
21
23
|
defineSlots<{ default?: () => unknown }>()
|
|
22
24
|
</script>
|
|
23
25
|
|
|
24
26
|
<template>
|
|
25
27
|
<component
|
|
26
28
|
:is="as"
|
|
29
|
+
data-slot="center"
|
|
27
30
|
:class="[styles.root, axis === 'both' && styles.both, centerText && styles.text]"
|
|
28
31
|
:style="{ '--center-gap': space(gap), '--center-min-h': minHeight ? `var(--gooee-center-h-${minHeight})` : undefined }"
|
|
29
32
|
>
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
@layer gooee.components {
|
|
1
2
|
.root {
|
|
2
3
|
display: flex;
|
|
3
4
|
align-items: flex-start;
|
|
@@ -40,15 +41,15 @@
|
|
|
40
41
|
background: var(--gooee-color-surface);
|
|
41
42
|
color: var(--gooee-color-accent-fg);
|
|
42
43
|
transition:
|
|
43
|
-
border-color var(--gooee-motion-fast) var(--gooee-ease-
|
|
44
|
-
box-shadow var(--gooee-motion-fast) var(--gooee-ease-
|
|
44
|
+
border-color var(--gooee-motion-fast) var(--gooee-ease-morph),
|
|
45
|
+
box-shadow var(--gooee-motion-fast) var(--gooee-ease-morph);
|
|
45
46
|
}
|
|
46
47
|
|
|
47
48
|
@media (hover: hover) {
|
|
48
49
|
.input:hover:not(:disabled) + .box { border-color: var(--gooee-color-fg); }
|
|
49
50
|
}
|
|
50
51
|
.input:focus-visible + .box { box-shadow: var(--gooee-focus-ring); }
|
|
51
|
-
.root[data-invalid] .box[data-state="
|
|
52
|
+
.root[data-invalid] .box[data-state="unchecked"] { border-color: var(--gooee-color-danger); }
|
|
52
53
|
|
|
53
54
|
/* The checked fill covers the border too. Ink pours into it in Checkbox.tsx (internal/liquidMore.ts);
|
|
54
55
|
here it only holds the end state, so reduced motion lands on it at once. */
|
|
@@ -60,8 +61,8 @@
|
|
|
60
61
|
clip-path: circle(0 at 50% 50%);
|
|
61
62
|
}
|
|
62
63
|
|
|
63
|
-
.box[data-state="
|
|
64
|
-
.box[data-state="
|
|
64
|
+
.box[data-state="checked"] .fill,
|
|
65
|
+
.box[data-state="indeterminate"] .fill { clip-path: none; }
|
|
65
66
|
|
|
66
67
|
.pour {
|
|
67
68
|
position: absolute;
|
|
@@ -88,15 +89,15 @@
|
|
|
88
89
|
/* Hidden just before the path starts. A zero-length dash would leave its round ends as a dot in Safari. */
|
|
89
90
|
stroke-dasharray: 1 2;
|
|
90
91
|
stroke-dashoffset: 1.01;
|
|
91
|
-
transition: stroke-dashoffset var(--gooee-motion-base) var(--gooee-ease-
|
|
92
|
+
transition: stroke-dashoffset var(--gooee-motion-base) var(--gooee-ease-morph);
|
|
92
93
|
}
|
|
93
94
|
|
|
94
|
-
.box[data-state="
|
|
95
|
+
.box[data-state="checked"] .tick {
|
|
95
96
|
stroke-dashoffset: 0;
|
|
96
97
|
transition-delay: var(--gooee-motion-instant);
|
|
97
98
|
}
|
|
98
99
|
|
|
99
|
-
.box[data-state="
|
|
100
|
+
.box[data-state="indeterminate"] .dash { stroke-dashoffset: 0; }
|
|
100
101
|
|
|
101
102
|
.text {
|
|
102
103
|
display: flex;
|
|
@@ -118,3 +119,4 @@
|
|
|
118
119
|
color: var(--gooee-color-fg-muted);
|
|
119
120
|
line-height: var(--gooee-leading-snug);
|
|
120
121
|
}
|
|
122
|
+
}
|
|
@@ -47,6 +47,8 @@ export function Checkbox({
|
|
|
47
47
|
const errorId = `${inputId}-error`
|
|
48
48
|
const describedBy = [description ? `${inputId}-desc` : null, error ? errorId : null, describedByProp].filter(Boolean).join(' ')
|
|
49
49
|
const [checked, setChecked] = useControllable(checkedProp, defaultChecked, onCheckedChange)
|
|
50
|
+
// A form library's onChange, such as react-hook-form's register, runs after the box updates instead of replacing it.
|
|
51
|
+
const { onChange, ...inputRest } = rest as typeof rest & Pick<ComponentPropsWithRef<'input'>, 'onChange'>
|
|
50
52
|
const inner = useRef<HTMLInputElement>(null)
|
|
51
53
|
// Like a native checkbox, a click clears the mixed look until the prop sets it again.
|
|
52
54
|
const [mixed, setMixed] = useState(indeterminate)
|
|
@@ -60,7 +62,7 @@ export function Checkbox({
|
|
|
60
62
|
if (inner.current) inner.current.indeterminate = mixed
|
|
61
63
|
}, [mixed])
|
|
62
64
|
|
|
63
|
-
const state = mixed ? '
|
|
65
|
+
const state = mixed ? 'indeterminate' : checked ? 'checked' : 'unchecked'
|
|
64
66
|
|
|
65
67
|
// Ink pours in from the side that was pressed, levels, and then the mark draws (motion/checkbox.ts).
|
|
66
68
|
const boxRef = useRef<HTMLSpanElement>(null)
|
|
@@ -71,6 +73,7 @@ export function Checkbox({
|
|
|
71
73
|
|
|
72
74
|
return (
|
|
73
75
|
<div
|
|
76
|
+
data-slot="checkbox"
|
|
74
77
|
className={cx(styles.root, className)}
|
|
75
78
|
data-disabled={disabled || undefined}
|
|
76
79
|
data-invalid={error ? true : undefined}
|
|
@@ -81,34 +84,37 @@ export function Checkbox({
|
|
|
81
84
|
ref={mergeRefs(inner, ref)}
|
|
82
85
|
id={inputId}
|
|
83
86
|
type="checkbox"
|
|
87
|
+
data-slot="checkbox-input"
|
|
84
88
|
className={styles.input}
|
|
85
89
|
checked={checked}
|
|
86
90
|
disabled={disabled}
|
|
87
91
|
aria-invalid={error ? true : undefined}
|
|
88
92
|
aria-describedby={describedBy || undefined}
|
|
89
93
|
onChange={(e) => {
|
|
90
|
-
if (
|
|
91
|
-
|
|
92
|
-
|
|
94
|
+
if (mixed) {
|
|
95
|
+
setMixed(false)
|
|
96
|
+
setChecked(true)
|
|
97
|
+
} else setChecked(e.target.checked)
|
|
98
|
+
onChange?.(e)
|
|
93
99
|
}}
|
|
94
100
|
onPointerDown={onPointerDown}
|
|
95
101
|
onKeyDown={(e) => {
|
|
96
102
|
cup.current!.key()
|
|
97
103
|
onKeyDown?.(e)
|
|
98
104
|
}}
|
|
99
|
-
{...
|
|
105
|
+
{...inputRest}
|
|
100
106
|
/>
|
|
101
|
-
<span ref={boxRef} className={styles.box} data-state={state} aria-hidden="true">
|
|
107
|
+
<span ref={boxRef} data-slot="checkbox-box" className={styles.box} data-state={state} aria-hidden="true">
|
|
102
108
|
<span className={styles.fill} data-pour-fill />
|
|
103
|
-
<svg viewBox="0 0 16 16" className={styles.mark}>
|
|
109
|
+
<svg viewBox="0 0 16 16" data-slot="checkbox-indicator" className={styles.mark}>
|
|
104
110
|
<path className={styles.tick} d="M3.5 8.5l3 3 6-7" pathLength="1" data-mark="tick" />
|
|
105
111
|
<path className={styles.dash} d="M4 8h8" pathLength="1" data-mark="dash" />
|
|
106
112
|
</svg>
|
|
107
113
|
</span>
|
|
108
114
|
</span>
|
|
109
115
|
<span className={styles.text}>
|
|
110
|
-
<label htmlFor={inputId} className={styles.label}>{label}</label>
|
|
111
|
-
{description && <span id={`${inputId}-desc`} className={styles.description}>{description}</span>}
|
|
116
|
+
<label htmlFor={inputId} data-slot="field-label" className={styles.label}>{label}</label>
|
|
117
|
+
{description && <span id={`${inputId}-desc`} data-slot="checkbox-description" className={styles.description}>{description}</span>}
|
|
112
118
|
<FieldMessage helpId={`${inputId}-help`} errorId={errorId} error={error} />
|
|
113
119
|
</span>
|
|
114
120
|
</div>
|
|
@@ -8,27 +8,24 @@ import styles from './Checkbox.module.css'
|
|
|
8
8
|
// Other attributes, such as name or aria-required, go to the input. A class goes to the root, as in React.
|
|
9
9
|
defineOptions({ inheritAttrs: false })
|
|
10
10
|
|
|
11
|
-
const
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
}>(),
|
|
26
|
-
{ defaultChecked: false, indeterminate: false },
|
|
27
|
-
)
|
|
11
|
+
const { description, defaultChecked = false, indeterminate = false, error, id } = defineProps<{
|
|
12
|
+
/** Visible text next to the box. Clicking it toggles the box. The label slot replaces it. */
|
|
13
|
+
label?: string
|
|
14
|
+
/** Muted text under the label, linked with aria-describedby. The description slot replaces it. */
|
|
15
|
+
description?: string
|
|
16
|
+
/** Starting checked state when there is no v-model. */
|
|
17
|
+
defaultChecked?: boolean
|
|
18
|
+
/** Shows a dash. A click clears the dash and checks the box. */
|
|
19
|
+
indeterminate?: boolean
|
|
20
|
+
/** Error message under the label. Marks the box invalid. */
|
|
21
|
+
error?: string
|
|
22
|
+
disabled?: boolean
|
|
23
|
+
id?: string
|
|
24
|
+
}>()
|
|
28
25
|
|
|
29
|
-
/** Whether the box is ticked. Use v-model
|
|
30
|
-
const model = defineModel<boolean | undefined>(
|
|
31
|
-
const local = ref(
|
|
26
|
+
/** Whether the box is ticked. Use v-model, or leave it out and the box keeps its own state. */
|
|
27
|
+
const model = defineModel<boolean | undefined>({ default: undefined })
|
|
28
|
+
const local = ref(defaultChecked)
|
|
32
29
|
const checked = computed({
|
|
33
30
|
get: () => model.value ?? local.value,
|
|
34
31
|
set: (next: boolean) => {
|
|
@@ -44,18 +41,18 @@ const inputAttrs = computed(() => {
|
|
|
44
41
|
})
|
|
45
42
|
|
|
46
43
|
const auto = useId()
|
|
47
|
-
const inputId = computed(() =>
|
|
44
|
+
const inputId = computed(() => id ?? auto)
|
|
48
45
|
const errorId = computed(() => `${inputId.value}-error`)
|
|
49
|
-
const hasDescription = computed(() => !!(
|
|
50
|
-
const describedBy = computed(() => [hasDescription.value ? `${inputId.value}-desc` : null,
|
|
46
|
+
const hasDescription = computed(() => !!(description || slots.description))
|
|
47
|
+
const describedBy = computed(() => [hasDescription.value ? `${inputId.value}-desc` : null, error ? errorId.value : null, attrs['aria-describedby']].filter(Boolean).join(' ') || undefined)
|
|
51
48
|
|
|
52
49
|
// Like a native checkbox, a click clears the mixed look until the prop sets it again.
|
|
53
|
-
const mixed = ref(
|
|
50
|
+
const mixed = ref(indeterminate)
|
|
54
51
|
watch(
|
|
55
|
-
() =>
|
|
52
|
+
() => indeterminate,
|
|
56
53
|
(now) => (mixed.value = now),
|
|
57
54
|
)
|
|
58
|
-
const state = computed(() => (mixed.value ? '
|
|
55
|
+
const state = computed(() => (mixed.value ? 'indeterminate' : checked.value ? 'checked' : 'unchecked'))
|
|
59
56
|
|
|
60
57
|
const onChange = (e: Event) => {
|
|
61
58
|
const input = e.target as HTMLInputElement
|
|
@@ -76,12 +73,13 @@ onBeforeUnmount(cup.destroy)
|
|
|
76
73
|
</script>
|
|
77
74
|
|
|
78
75
|
<template>
|
|
79
|
-
<div :class="[styles.root, attrs.class]" :data-disabled="disabled || undefined" :data-invalid="error ? true : undefined" @pointerdown="cup.press($event.clientX)">
|
|
76
|
+
<div data-slot="checkbox" :class="[styles.root, attrs.class]" :data-disabled="disabled || undefined" :data-invalid="error ? true : undefined" @pointerdown="cup.press($event.clientX)">
|
|
80
77
|
<span :class="styles.boxWrap">
|
|
81
78
|
<input
|
|
82
79
|
v-bind="inputAttrs"
|
|
83
80
|
:id="inputId"
|
|
84
81
|
type="checkbox"
|
|
82
|
+
data-slot="checkbox-input"
|
|
85
83
|
:class="styles.input"
|
|
86
84
|
:checked="checked"
|
|
87
85
|
:indeterminate="mixed"
|
|
@@ -91,17 +89,17 @@ onBeforeUnmount(cup.destroy)
|
|
|
91
89
|
@change="onChange"
|
|
92
90
|
@keydown="cup.key()"
|
|
93
91
|
/>
|
|
94
|
-
<span ref="box" :class="styles.box" :data-state="state" aria-hidden="true">
|
|
92
|
+
<span ref="box" data-slot="checkbox-box" :class="styles.box" :data-state="state" aria-hidden="true">
|
|
95
93
|
<span :class="styles.fill" :data-pour-fill="true" />
|
|
96
|
-
<svg viewBox="0 0 16 16" :class="styles.mark">
|
|
94
|
+
<svg viewBox="0 0 16 16" data-slot="checkbox-indicator" :class="styles.mark">
|
|
97
95
|
<path :class="styles.tick" d="M3.5 8.5l3 3 6-7" pathLength="1" data-mark="tick" />
|
|
98
96
|
<path :class="styles.dash" d="M4 8h8" pathLength="1" data-mark="dash" />
|
|
99
97
|
</svg>
|
|
100
98
|
</span>
|
|
101
99
|
</span>
|
|
102
100
|
<span :class="styles.text">
|
|
103
|
-
<label :for="inputId" :class="styles.label"><slot name="label">{{ label }}</slot></label>
|
|
104
|
-
<span v-if="hasDescription" :id="`${inputId}-desc`" :class="styles.description"><slot name="description">{{ description }}</slot></span>
|
|
101
|
+
<label :for="inputId" data-slot="field-label" :class="styles.label"><slot name="label">{{ label }}</slot></label>
|
|
102
|
+
<span v-if="hasDescription" :id="`${inputId}-desc`" data-slot="checkbox-description" :class="styles.description"><slot name="description">{{ description }}</slot></span>
|
|
105
103
|
<FieldMessage :help-id="`${inputId}-help`" :error-id="errorId" :error="error" />
|
|
106
104
|
</span>
|
|
107
105
|
</div>
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
@layer gooee.components {
|
|
1
2
|
.group {
|
|
2
3
|
min-width: 0;
|
|
3
4
|
margin: 0;
|
|
@@ -27,4 +28,5 @@
|
|
|
27
28
|
.group[data-disabled] > :is(.legend, .description) { opacity: var(--gooee-disabled-opacity); }
|
|
28
29
|
|
|
29
30
|
/* Each Checkbox's drawn box: red edges on the empty ones, like a RadioGroup with an error. */
|
|
30
|
-
.group[data-invalid] [data-state="
|
|
31
|
+
.group[data-invalid] [data-state="unchecked"] { border-color: var(--gooee-color-danger); }
|
|
32
|
+
}
|
|
@@ -64,10 +64,10 @@ export function CheckboxGroup({
|
|
|
64
64
|
setValue(options.map((o) => o.value).filter((x) => next.has(x)))
|
|
65
65
|
}
|
|
66
66
|
return (
|
|
67
|
-
<fieldset className={cx(styles.group, className)} disabled={disabled} aria-describedby={describedBy || undefined} data-disabled={disabled || undefined} data-invalid={error ? true : undefined}>
|
|
68
|
-
<legend className={styles.legend}>{label}</legend>
|
|
69
|
-
{description && <p id={descId} className={styles.description}>{description}</p>}
|
|
70
|
-
<div className={cx(styles.items, styles[orientation])}>
|
|
67
|
+
<fieldset data-slot="checkbox-group" className={cx(styles.group, className)} disabled={disabled} aria-describedby={describedBy || undefined} data-disabled={disabled || undefined} data-invalid={error ? true : undefined} data-orientation={orientation}>
|
|
68
|
+
<legend data-slot="field-label" className={styles.legend}>{label}</legend>
|
|
69
|
+
{description && <p id={descId} data-slot="checkbox-group-description" className={styles.description}>{description}</p>}
|
|
70
|
+
<div data-slot="checkbox-group-items" className={cx(styles.items, styles[orientation])}>
|
|
71
71
|
{options.map((o) => (
|
|
72
72
|
<Checkbox
|
|
73
73
|
key={o.value}
|