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
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
@layer gooee.components {
|
|
1
2
|
.root {
|
|
2
3
|
display: flex;
|
|
3
4
|
flex-direction: column;
|
|
@@ -37,8 +38,8 @@
|
|
|
37
38
|
background: var(--gooee-color-surface);
|
|
38
39
|
font-size: var(--gooee-text-md);
|
|
39
40
|
transition:
|
|
40
|
-
border-color var(--gooee-motion-fast) var(--gooee-ease-
|
|
41
|
-
box-shadow var(--gooee-motion-base) var(--gooee-ease-
|
|
41
|
+
border-color var(--gooee-motion-fast) var(--gooee-ease-morph),
|
|
42
|
+
box-shadow var(--gooee-motion-base) var(--gooee-ease-morph);
|
|
42
43
|
}
|
|
43
44
|
|
|
44
45
|
/* Safari draws a native select at its own height and ignores the 44px; without its native look it takes
|
|
@@ -72,7 +73,7 @@
|
|
|
72
73
|
.root[data-invalid] .control > :is(input, select, textarea) {
|
|
73
74
|
border-color: var(--gooee-color-danger);
|
|
74
75
|
--edge: var(--gooee-line-thick);
|
|
75
|
-
animation: nudge var(--gooee-motion-slow) var(--gooee-ease-
|
|
76
|
+
animation: nudge var(--gooee-motion-slow) var(--gooee-ease-morph);
|
|
76
77
|
}
|
|
77
78
|
|
|
78
79
|
@keyframes nudge {
|
|
@@ -80,3 +81,4 @@
|
|
|
80
81
|
25% { transform: translateX(calc(var(--gooee-shift-sm) * -1)); }
|
|
81
82
|
60% { transform: translateX(var(--gooee-shift-sm)); }
|
|
82
83
|
}
|
|
84
|
+
}
|
|
@@ -61,16 +61,16 @@ export function FormField({ label, children, help, error, required, optional, di
|
|
|
61
61
|
}
|
|
62
62
|
|
|
63
63
|
return (
|
|
64
|
-
<Ctx
|
|
65
|
-
<div className={cx(styles.root, className)} data-invalid={error ? true : undefined} data-disabled={disabled || undefined}>
|
|
66
|
-
<label id={labelId} htmlFor={controlId} className={styles.label}>
|
|
64
|
+
<Ctx value={{ controlProps, labelId }}>
|
|
65
|
+
<div data-slot="form-field" className={cx(styles.root, className)} data-invalid={error ? true : undefined} data-disabled={disabled || undefined}>
|
|
66
|
+
<label id={labelId} htmlFor={controlId} data-slot="field-label" className={styles.label}>
|
|
67
67
|
{label}
|
|
68
|
-
{required && <span className={styles.required} aria-hidden="true"> *</span>}
|
|
69
|
-
{optional && !required && <span className={styles.optional}> {labels.optional}</span>}
|
|
68
|
+
{required && <span data-slot="form-field-required" className={styles.required} aria-hidden="true"> *</span>}
|
|
69
|
+
{optional && !required && <span data-slot="form-field-optional" className={styles.optional}> {labels.optional}</span>}
|
|
70
70
|
</label>
|
|
71
|
-
<div className={styles.control}>{typeof children === 'function' ? children(controlProps) : children}</div>
|
|
71
|
+
<div data-slot="form-field-control" className={styles.control}>{typeof children === 'function' ? children(controlProps) : children}</div>
|
|
72
72
|
<FieldMessage helpId={helpId} errorId={errorId} help={help} error={error} />
|
|
73
73
|
</div>
|
|
74
|
-
</Ctx
|
|
74
|
+
</Ctx>
|
|
75
75
|
)
|
|
76
76
|
}
|
|
@@ -54,11 +54,11 @@ provide(key, controlProps)
|
|
|
54
54
|
</script>
|
|
55
55
|
|
|
56
56
|
<template>
|
|
57
|
-
<div :class="styles.root" :data-invalid="error ? true : undefined" :data-disabled="disabled || undefined">
|
|
58
|
-
<label :id="labelId" :for="controlId" :class="styles.label">
|
|
59
|
-
<slot name="label">{{ label }}</slot><span v-if="required" :class="styles.required" aria-hidden="true"> *</span><span v-if="optional && !required" :class="styles.optional">{{ ` ${labels?.optional ?? '(optional)'}` }}</span>
|
|
57
|
+
<div data-slot="form-field" :class="styles.root" :data-invalid="error ? true : undefined" :data-disabled="disabled || undefined">
|
|
58
|
+
<label :id="labelId" :for="controlId" data-slot="field-label" :class="styles.label">
|
|
59
|
+
<slot name="label">{{ label }}</slot><span v-if="required" data-slot="form-field-required" :class="styles.required" aria-hidden="true"> *</span><span v-if="optional && !required" data-slot="form-field-optional" :class="styles.optional">{{ ` ${labels?.optional ?? '(optional)'}` }}</span>
|
|
60
60
|
</label>
|
|
61
|
-
<div :class="styles.control"><slot v-bind="controlProps" /></div>
|
|
61
|
+
<div data-slot="form-field-control" :class="styles.control"><slot v-bind="controlProps" /></div>
|
|
62
62
|
<FieldMessage :help-id="helpId" :error-id="errorId" :help="help" :error="error" />
|
|
63
63
|
</div>
|
|
64
64
|
</template>
|
|
@@ -31,5 +31,5 @@ export function Grid({ columns, min, gap = 5, as = 'div', steps = 'all', classNa
|
|
|
31
31
|
...style,
|
|
32
32
|
} as CSSProperties
|
|
33
33
|
const fitClass = !columns ? styles.fit : steps === 'halves' ? styles.halves : styles.capped
|
|
34
|
-
return <Tag className={cx(styles.root, fit ? fitClass : styles.fixed, className)} style={vars} {...rest} />
|
|
34
|
+
return <Tag data-slot="grid" className={cx(styles.root, fit ? fitClass : styles.fixed, className)} style={vars} {...rest} />
|
|
35
35
|
}
|
|
@@ -4,40 +4,43 @@ import { space, type Space } from '../../internal/space'
|
|
|
4
4
|
import styles from './Grid.module.css'
|
|
5
5
|
|
|
6
6
|
// The Vue Grid: the same look (Grid.module.css) as the React one. Other attributes go to the element.
|
|
7
|
-
const
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
7
|
+
const {
|
|
8
|
+
columns,
|
|
9
|
+
min: minProp,
|
|
10
|
+
gap = 5,
|
|
11
|
+
as = 'div',
|
|
12
|
+
steps = 'all',
|
|
13
|
+
} = defineProps<{
|
|
14
|
+
/** Fixed number of columns. With min, it becomes the most columns the grid may show. */
|
|
15
|
+
columns?: number
|
|
16
|
+
/** Narrowest a cell may get before a column drops: a token size or any CSS length. Defaults to "md" when columns is not set. */
|
|
17
|
+
min?: 'xs' | 'sm' | 'md' | 'lg' | (string & {})
|
|
18
|
+
/** Space between cells, as a step of the space scale (0 to 12, read as --gooee-space-N). */
|
|
19
|
+
gap?: Space
|
|
20
|
+
/** Element to render, so a set of cards can be a list. */
|
|
21
|
+
as?: 'div' | 'section' | 'ul' | 'ol'
|
|
22
|
+
/** With columns and min: "halves" steps from columns to half of it, then to one (4, 2, 1), so no card is left alone on a row. */
|
|
23
|
+
steps?: 'all' | 'halves'
|
|
24
|
+
}>()
|
|
22
25
|
defineSlots<{ default?: () => unknown }>()
|
|
23
26
|
|
|
24
27
|
const tokenSizes = ['xs', 'sm', 'md', 'lg']
|
|
25
28
|
const vars = computed(() => {
|
|
26
|
-
const min =
|
|
29
|
+
const min = minProp ?? 'md'
|
|
27
30
|
return {
|
|
28
|
-
'--grid-gap': space(
|
|
29
|
-
'--grid-cols':
|
|
30
|
-
'--grid-half':
|
|
31
|
+
'--grid-gap': space(gap),
|
|
32
|
+
'--grid-cols': columns,
|
|
33
|
+
'--grid-half': columns ? Math.max(1, Math.floor(columns / 2)) : undefined,
|
|
31
34
|
'--grid-min': tokenSizes.includes(min) ? `var(--gooee-grid-min-${min})` : min,
|
|
32
35
|
}
|
|
33
36
|
})
|
|
34
37
|
const kind = computed(() => {
|
|
35
|
-
const fit =
|
|
38
|
+
const fit = minProp !== undefined || columns === undefined
|
|
36
39
|
if (!fit) return styles.fixed
|
|
37
|
-
return !
|
|
40
|
+
return !columns ? styles.fit : steps === 'halves' ? styles.halves : styles.capped
|
|
38
41
|
})
|
|
39
42
|
</script>
|
|
40
43
|
|
|
41
44
|
<template>
|
|
42
|
-
<component :is="as" :class="[styles.root, kind]" :style="vars"><slot /></component>
|
|
45
|
+
<component :is="as" data-slot="grid" :class="[styles.root, kind]" :style="vars"><slot /></component>
|
|
43
46
|
</template>
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
@layer gooee.components {
|
|
1
2
|
.root {
|
|
2
3
|
display: flex;
|
|
3
4
|
flex-direction: column;
|
|
@@ -32,24 +33,24 @@
|
|
|
32
33
|
}
|
|
33
34
|
|
|
34
35
|
/* The confirm step: the button itself turns red in place and confirms on the next press. Its words stay. */
|
|
35
|
-
.shell[data-
|
|
36
|
+
.shell[data-status="step"] {
|
|
36
37
|
background: var(--gooee-color-danger-solid);
|
|
37
38
|
box-shadow: none;
|
|
38
39
|
transition:
|
|
39
40
|
background-color var(--gooee-motion-base) var(--gooee-ease-morph),
|
|
40
41
|
box-shadow var(--gooee-motion-fast) var(--gooee-ease-morph);
|
|
41
42
|
}
|
|
42
|
-
.shell[data-
|
|
43
|
+
.shell[data-status="step"] .main { color: var(--gooee-color-danger-fg); }
|
|
43
44
|
@media (hover: hover) {
|
|
44
|
-
.shell[data-
|
|
45
|
+
.shell[data-status="step"]:hover { background: var(--gooee-color-danger-solid-hover); }
|
|
45
46
|
}
|
|
46
|
-
.shell[data-
|
|
47
|
+
.shell[data-status="step"]:has(.main:focus-visible) { box-shadow: var(--gooee-focus-ring); }
|
|
47
48
|
|
|
48
49
|
.shell:has(.main:focus-visible) {
|
|
49
50
|
box-shadow: inset 0 0 0 var(--gooee-line-thick) var(--gooee-color-border-strong), var(--gooee-focus-ring);
|
|
50
51
|
}
|
|
51
52
|
|
|
52
|
-
.shell[data-
|
|
53
|
+
.shell[data-status="done"] { box-shadow: inset 0 0 0 var(--gooee-hold-to-confirm-stroke, 2px) var(--gooee-color-fg); }
|
|
53
54
|
.shell[data-disabled] { opacity: var(--gooee-disabled-opacity); }
|
|
54
55
|
|
|
55
56
|
.main {
|
|
@@ -73,7 +74,7 @@
|
|
|
73
74
|
outline: none;
|
|
74
75
|
}
|
|
75
76
|
|
|
76
|
-
.shell[data-
|
|
77
|
+
.shell[data-status="done"] .main { cursor: default; }
|
|
77
78
|
.shell[data-disabled] .main { cursor: not-allowed; }
|
|
78
79
|
|
|
79
80
|
.faces { display: grid; }
|
|
@@ -84,7 +85,7 @@
|
|
|
84
85
|
align-items: center;
|
|
85
86
|
justify-content: center;
|
|
86
87
|
gap: var(--gooee-space-3);
|
|
87
|
-
transition: opacity var(--gooee-motion-fast) var(--gooee-ease-
|
|
88
|
+
transition: opacity var(--gooee-motion-fast) var(--gooee-ease-morph);
|
|
88
89
|
}
|
|
89
90
|
|
|
90
91
|
.face svg {
|
|
@@ -93,8 +94,8 @@
|
|
|
93
94
|
}
|
|
94
95
|
|
|
95
96
|
.face[data-face="done"],
|
|
96
|
-
.shell[data-
|
|
97
|
-
.shell[data-
|
|
97
|
+
.shell[data-status="done"] .face[data-face="idle"] { opacity: 0; }
|
|
98
|
+
.shell[data-status="done"] .face[data-face="done"] { opacity: 1; }
|
|
98
99
|
|
|
99
100
|
.fuse {
|
|
100
101
|
position: absolute;
|
|
@@ -106,7 +107,7 @@
|
|
|
106
107
|
.run {
|
|
107
108
|
fill: none;
|
|
108
109
|
stroke: var(--gooee-color-fg);
|
|
109
|
-
stroke-width: var(--gooee-hold-stroke);
|
|
110
|
+
stroke-width: var(--gooee-hold-to-confirm-stroke, 2px);
|
|
110
111
|
stroke-dasharray: 0 1;
|
|
111
112
|
opacity: 0;
|
|
112
113
|
}
|
|
@@ -129,7 +130,7 @@
|
|
|
129
130
|
color: var(--gooee-color-fg);
|
|
130
131
|
cursor: pointer;
|
|
131
132
|
outline: none;
|
|
132
|
-
transition: background-color var(--gooee-motion-fast) var(--gooee-ease-
|
|
133
|
+
transition: background-color var(--gooee-motion-fast) var(--gooee-ease-morph);
|
|
133
134
|
}
|
|
134
135
|
.cancel svg { width: var(--gooee-icon-md); height: var(--gooee-icon-md); }
|
|
135
136
|
/* Closed it takes no room, but stays on its open spot, so the drop flows back from where it was. */
|
|
@@ -158,3 +159,4 @@
|
|
|
158
159
|
clip-path: inset(50%);
|
|
159
160
|
white-space: nowrap;
|
|
160
161
|
}
|
|
162
|
+
}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
import { useEffect, useId, useLayoutEffect, useRef, useState, type KeyboardEvent, type MouseEvent, type PointerEvent, type ReactNode } from 'react'
|
|
4
4
|
import { cx } from '../../internal/cx'
|
|
5
|
-
import { CheckIcon, XIcon } from '../../
|
|
5
|
+
import { CheckIcon, XIcon } from '../../icons/icons'
|
|
6
6
|
import { prefersReducedMotion } from '../../internal/motion'
|
|
7
7
|
import { bud, createFuse, cssMs, DONE_FOR, GUARD, HINT_AFTER, LEAVE, outline, TAP } from '../../internal/motion/holdToConfirm'
|
|
8
8
|
import styles from './HoldToConfirm.module.css'
|
|
@@ -75,7 +75,7 @@ export function HoldToConfirm({
|
|
|
75
75
|
const measure = () => {
|
|
76
76
|
const w = main.offsetWidth
|
|
77
77
|
const h = main.offsetHeight
|
|
78
|
-
const inset = parseFloat(getComputedStyle(root).getPropertyValue('--gooee-hold-stroke')) / 2 || 1
|
|
78
|
+
const inset = parseFloat(getComputedStyle(root).getPropertyValue('--gooee-hold-to-confirm-stroke')) / 2 || 1
|
|
79
79
|
setSize({ w, h, inset })
|
|
80
80
|
setPath(outline(w, h, inset, w / 2))
|
|
81
81
|
}
|
|
@@ -101,7 +101,7 @@ export function HoldToConfirm({
|
|
|
101
101
|
}
|
|
102
102
|
|
|
103
103
|
// Forward at an even speed, and back fast on the morph curve.
|
|
104
|
-
const run = () => fuse.current!.forward(cssMs(shellRef.current, '--gooee-hold-
|
|
104
|
+
const run = () => fuse.current!.forward(cssMs(shellRef.current, '--gooee-delay-hold-to-confirm', 1500), (now) => press.current && now - press.current.t0 > HINT_AFTER && setKeep(true), finish)
|
|
105
105
|
const rewind = () => fuse.current!.rewind()
|
|
106
106
|
|
|
107
107
|
const openStep = () => {
|
|
@@ -231,12 +231,13 @@ export function HoldToConfirm({
|
|
|
231
231
|
const line = open ? (stepHint ?? `Press it again to ${confirmLabel.toLowerCase()}, or ${cancelLabel}.`) : phase === 'done' ? '' : keep ? 'Keep holding' : hint
|
|
232
232
|
|
|
233
233
|
return (
|
|
234
|
-
<div ref={rootRef} className={cx(styles.root, className)}>
|
|
234
|
+
<div ref={rootRef} data-slot="hold-to-confirm" className={cx(styles.root, className)}>
|
|
235
235
|
<div ref={rowRef} className={styles.row}>
|
|
236
|
-
<div ref={shellRef} className={styles.shell} data-
|
|
236
|
+
<div ref={shellRef} data-slot="hold-to-confirm-shell" className={styles.shell} data-status={phase} data-disabled={disabled || undefined}>
|
|
237
237
|
<button
|
|
238
238
|
ref={mainRef}
|
|
239
239
|
type="button"
|
|
240
|
+
data-slot="hold-to-confirm-button"
|
|
240
241
|
className={styles.main}
|
|
241
242
|
aria-describedby={`${id}-hint`}
|
|
242
243
|
aria-expanded={open}
|
|
@@ -253,15 +254,15 @@ export function HoldToConfirm({
|
|
|
253
254
|
onClick={onClick}
|
|
254
255
|
>
|
|
255
256
|
<span className={styles.faces}>
|
|
256
|
-
<span className={styles.face} data-face="idle" aria-hidden={phase === 'done' || undefined}>
|
|
257
|
+
<span data-slot="hold-to-confirm-label" className={styles.face} data-face="idle" aria-hidden={phase === 'done' || undefined}>
|
|
257
258
|
{children}
|
|
258
259
|
</span>
|
|
259
|
-
<span className={styles.face} data-face="done" aria-hidden={phase !== 'done' || undefined}>
|
|
260
|
+
<span data-slot="hold-to-confirm-done-label" className={styles.face} data-face="done" aria-hidden={phase !== 'done' || undefined}>
|
|
260
261
|
<CheckIcon />
|
|
261
262
|
{doneLabel}
|
|
262
263
|
</span>
|
|
263
264
|
</span>
|
|
264
|
-
<svg className={styles.fuse} width={size.w} height={size.h} aria-hidden="true">
|
|
265
|
+
<svg data-slot="hold-to-confirm-fuse" className={styles.fuse} width={size.w} height={size.h} aria-hidden="true">
|
|
265
266
|
<path ref={runRef} d={path} className={styles.run} pathLength={1} />
|
|
266
267
|
</svg>
|
|
267
268
|
</button>
|
|
@@ -270,6 +271,7 @@ export function HoldToConfirm({
|
|
|
270
271
|
ref={cancelRef}
|
|
271
272
|
id={`${id}-step`}
|
|
272
273
|
type="button"
|
|
274
|
+
data-slot="hold-to-confirm-cancel"
|
|
273
275
|
className={styles.cancel}
|
|
274
276
|
aria-label={cancelLabel}
|
|
275
277
|
aria-describedby={`${id}-hint`}
|
|
@@ -280,7 +282,7 @@ export function HoldToConfirm({
|
|
|
280
282
|
<XIcon />
|
|
281
283
|
</button>
|
|
282
284
|
</div>
|
|
283
|
-
<p id={`${id}-hint`} className={styles.hint}>
|
|
285
|
+
<p id={`${id}-hint`} data-slot="hold-to-confirm-hint" className={styles.hint}>
|
|
284
286
|
{line}
|
|
285
287
|
</p>
|
|
286
288
|
<p className={styles.srOnly} aria-live="polite">
|
|
@@ -2,31 +2,34 @@
|
|
|
2
2
|
import { computed, onBeforeUnmount, onMounted, ref, useId, watch } from 'vue'
|
|
3
3
|
import { prefersReducedMotion } from '../../internal/motion'
|
|
4
4
|
import { bud, createFuse, cssMs, DONE_FOR, GUARD, HINT_AFTER, LEAVE, outline, TAP } from '../../internal/motion/holdToConfirm'
|
|
5
|
-
import { CheckIcon, XIcon } from '../../
|
|
5
|
+
import { CheckIcon, XIcon } from '../../icons/vue'
|
|
6
6
|
import styles from './HoldToConfirm.module.css'
|
|
7
7
|
|
|
8
8
|
// The Vue HoldToConfirm: the same look (HoldToConfirm.module.css), hold, confirm step and motion as the
|
|
9
9
|
// React one. The action's label goes in the default slot.
|
|
10
|
-
const
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
10
|
+
const {
|
|
11
|
+
confirmLabel = 'Confirm',
|
|
12
|
+
cancelLabel = 'Cancel',
|
|
13
|
+
doneLabel = 'Done',
|
|
14
|
+
hint = 'Hold to confirm, or tap for a confirm step.',
|
|
15
|
+
disabled = false,
|
|
16
|
+
} = defineProps<{
|
|
17
|
+
/** The action as a verb for the confirm step's line, such as "Delete": "Press it again to delete, or Cancel." */
|
|
18
|
+
confirmLabel?: string
|
|
19
|
+
/** The name of the round cancel button that buds out beside it in the confirm step. */
|
|
20
|
+
cancelLabel?: string
|
|
21
|
+
/** Shown in place of the label once it is done, such as "Workspace deleted". The doneLabel slot replaces it. */
|
|
22
|
+
doneLabel?: string
|
|
23
|
+
/** The line under the button. Defaults to how to use it. The hint slot replaces it. */
|
|
24
|
+
hint?: string
|
|
25
|
+
/** The line under the button while the confirm step is open. The stepHint slot replaces it. */
|
|
26
|
+
stepHint?: string
|
|
27
|
+
/** Blocks the button. Say why in the hint. */
|
|
28
|
+
disabled?: boolean
|
|
29
|
+
}>()
|
|
27
30
|
/** confirm: once the hold runs to the end, or the button is pressed again in the confirm step. cancel: a hold let go early, or the step cancelled. */
|
|
28
31
|
const emit = defineEmits<{ confirm: []; cancel: [] }>()
|
|
29
|
-
defineSlots<{ default?: () => unknown;
|
|
32
|
+
defineSlots<{ default?: () => unknown; doneLabel?: () => unknown; hint?: () => unknown; stepHint?: () => unknown }>()
|
|
30
33
|
|
|
31
34
|
type Phase = 'idle' | 'step' | 'done'
|
|
32
35
|
|
|
@@ -57,7 +60,7 @@ onMounted(() => {
|
|
|
57
60
|
const measure = () => {
|
|
58
61
|
const w = main.offsetWidth
|
|
59
62
|
const h = main.offsetHeight
|
|
60
|
-
const inset = parseFloat(getComputedStyle(root).getPropertyValue('--gooee-hold-stroke')) / 2 || 1
|
|
63
|
+
const inset = parseFloat(getComputedStyle(root).getPropertyValue('--gooee-hold-to-confirm-stroke')) / 2 || 1
|
|
61
64
|
size.value = { w, h, inset }
|
|
62
65
|
path.value = outline(w, h, inset, w / 2)
|
|
63
66
|
}
|
|
@@ -74,7 +77,7 @@ const finish = () => {
|
|
|
74
77
|
// From the step, focus goes back to the button: the step closes under it. Safari never focused Confirm.
|
|
75
78
|
if (phase.value === 'step') mainEl.value?.focus({ preventScroll: true })
|
|
76
79
|
phase.value = 'done'
|
|
77
|
-
said.value =
|
|
80
|
+
said.value = doneLabel
|
|
78
81
|
if (!prefersReducedMotion()) navigator.vibrate?.(12)
|
|
79
82
|
emit('confirm')
|
|
80
83
|
}
|
|
@@ -82,7 +85,7 @@ const finish = () => {
|
|
|
82
85
|
// Forward at an even speed, and back fast on the morph curve.
|
|
83
86
|
const run = () =>
|
|
84
87
|
fuse.forward(
|
|
85
|
-
cssMs(shellEl.value, '--gooee-hold-
|
|
88
|
+
cssMs(shellEl.value, '--gooee-delay-hold-to-confirm', 1500),
|
|
86
89
|
(now) => {
|
|
87
90
|
if (press && now - press.t0 > HINT_AFTER) keep.value = true
|
|
88
91
|
},
|
|
@@ -166,7 +169,7 @@ const letGo = (tapAllowed: boolean) => {
|
|
|
166
169
|
}
|
|
167
170
|
|
|
168
171
|
const onPointerDown = (e: PointerEvent) => {
|
|
169
|
-
if (
|
|
172
|
+
if (disabled || phase.value !== 'idle' || press || (e.pointerType === 'mouse' && e.button !== 0)) return
|
|
170
173
|
const el = e.currentTarget as HTMLElement
|
|
171
174
|
el.setPointerCapture?.(e.pointerId)
|
|
172
175
|
start(e.pointerId, e.clientX - el.getBoundingClientRect().left)
|
|
@@ -192,7 +195,7 @@ const onKeyDown = (e: KeyboardEvent) => {
|
|
|
192
195
|
}
|
|
193
196
|
if (e.key !== 'Enter' && e.key !== ' ') return
|
|
194
197
|
e.preventDefault()
|
|
195
|
-
if (e.repeat ||
|
|
198
|
+
if (e.repeat || disabled || phase.value !== 'idle' || press) return
|
|
196
199
|
start('key', size.value.w / 2, e.key)
|
|
197
200
|
}
|
|
198
201
|
|
|
@@ -209,7 +212,7 @@ const onClick = (e: MouseEvent) => {
|
|
|
209
212
|
if (e.detail === 0 || performance.now() - stepAt > GUARD) finish()
|
|
210
213
|
return
|
|
211
214
|
}
|
|
212
|
-
if (
|
|
215
|
+
if (disabled || phase.value !== 'idle' || press) return
|
|
213
216
|
if (e.detail === 0 || tapTimer) openStep()
|
|
214
217
|
}
|
|
215
218
|
|
|
@@ -223,12 +226,13 @@ const open = computed(() => phase.value === 'step')
|
|
|
223
226
|
</script>
|
|
224
227
|
|
|
225
228
|
<template>
|
|
226
|
-
<div ref="rootEl" :class="styles.root">
|
|
229
|
+
<div ref="rootEl" data-slot="hold-to-confirm" :class="styles.root">
|
|
227
230
|
<div ref="rowEl" :class="styles.row">
|
|
228
|
-
<div ref="shellEl" :class="styles.shell" :data-
|
|
231
|
+
<div ref="shellEl" data-slot="hold-to-confirm-shell" :class="styles.shell" :data-status="phase" :data-disabled="disabled || undefined">
|
|
229
232
|
<button
|
|
230
233
|
ref="mainEl"
|
|
231
234
|
type="button"
|
|
235
|
+
data-slot="hold-to-confirm-button"
|
|
232
236
|
:class="styles.main"
|
|
233
237
|
:aria-describedby="`${id}-hint`"
|
|
234
238
|
:aria-expanded="open"
|
|
@@ -245,13 +249,13 @@ const open = computed(() => phase.value === 'step')
|
|
|
245
249
|
@click="onClick"
|
|
246
250
|
>
|
|
247
251
|
<span :class="styles.faces">
|
|
248
|
-
<span :class="styles.face" data-face="idle" :aria-hidden="phase === 'done' || undefined"><slot /></span>
|
|
249
|
-
<span :class="styles.face" data-face="done" :aria-hidden="phase !== 'done' || undefined">
|
|
252
|
+
<span data-slot="hold-to-confirm-label" :class="styles.face" data-face="idle" :aria-hidden="phase === 'done' || undefined"><slot /></span>
|
|
253
|
+
<span data-slot="hold-to-confirm-done-label" :class="styles.face" data-face="done" :aria-hidden="phase !== 'done' || undefined">
|
|
250
254
|
<CheckIcon />
|
|
251
|
-
<slot name="
|
|
255
|
+
<slot name="doneLabel">{{ doneLabel }}</slot>
|
|
252
256
|
</span>
|
|
253
257
|
</span>
|
|
254
|
-
<svg :class="styles.fuse" :width="size.w" :height="size.h" aria-hidden="true">
|
|
258
|
+
<svg data-slot="hold-to-confirm-fuse" :class="styles.fuse" :width="size.w" :height="size.h" aria-hidden="true">
|
|
255
259
|
<path ref="runEl" :d="path" :class="styles.run" :pathLength="1" />
|
|
256
260
|
</svg>
|
|
257
261
|
</button>
|
|
@@ -260,6 +264,7 @@ const open = computed(() => phase.value === 'step')
|
|
|
260
264
|
:id="`${id}-step`"
|
|
261
265
|
ref="cancelEl"
|
|
262
266
|
type="button"
|
|
267
|
+
data-slot="hold-to-confirm-cancel"
|
|
263
268
|
:class="styles.cancel"
|
|
264
269
|
:aria-label="cancelLabel"
|
|
265
270
|
:aria-describedby="`${id}-hint`"
|
|
@@ -270,7 +275,7 @@ const open = computed(() => phase.value === 'step')
|
|
|
270
275
|
<XIcon />
|
|
271
276
|
</button>
|
|
272
277
|
</div>
|
|
273
|
-
<p :id="`${id}-hint`" :class="styles.hint">
|
|
278
|
+
<p :id="`${id}-hint`" data-slot="hold-to-confirm-hint" :class="styles.hint">
|
|
274
279
|
<slot v-if="open" name="stepHint">{{ stepHint ?? `Press it again to ${confirmLabel.toLowerCase()}, or ${cancelLabel}.` }}</slot>
|
|
275
280
|
<template v-else-if="phase === 'done'" />
|
|
276
281
|
<template v-else-if="keep">Keep holding</template>
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
@layer gooee.components {
|
|
1
2
|
.root {
|
|
2
3
|
--s: var(--gooee-control-h-md);
|
|
3
4
|
position: relative;
|
|
@@ -14,10 +15,10 @@
|
|
|
14
15
|
cursor: pointer;
|
|
15
16
|
-webkit-tap-highlight-color: transparent;
|
|
16
17
|
transition:
|
|
17
|
-
background-color var(--gooee-motion-fast) var(--gooee-ease-
|
|
18
|
-
border-color var(--gooee-motion-fast) var(--gooee-ease-
|
|
19
|
-
box-shadow var(--gooee-motion-fast) var(--gooee-ease-
|
|
20
|
-
transform var(--gooee-motion-slow) var(--gooee-ease-
|
|
18
|
+
background-color var(--gooee-motion-fast) var(--gooee-ease-morph),
|
|
19
|
+
border-color var(--gooee-motion-fast) var(--gooee-ease-morph),
|
|
20
|
+
box-shadow var(--gooee-motion-fast) var(--gooee-ease-morph),
|
|
21
|
+
transform var(--gooee-motion-slow) var(--gooee-ease-morph);
|
|
21
22
|
}
|
|
22
23
|
|
|
23
24
|
.root::after {
|
|
@@ -48,7 +49,7 @@
|
|
|
48
49
|
.icon {
|
|
49
50
|
display: inline-flex;
|
|
50
51
|
font-size: var(--gooee-icon-lg);
|
|
51
|
-
transition: transform var(--gooee-motion-slow) var(--gooee-ease-
|
|
52
|
+
transition: transform var(--gooee-motion-slow) var(--gooee-ease-morph);
|
|
52
53
|
}
|
|
53
54
|
.sm .icon { font-size: var(--gooee-icon-md); }
|
|
54
55
|
|
|
@@ -76,3 +77,4 @@
|
|
|
76
77
|
@media (hover: hover) {
|
|
77
78
|
.primary:hover:not(:disabled) { background: var(--gooee-color-accent-hover); }
|
|
78
79
|
}
|
|
80
|
+
}
|
|
@@ -26,10 +26,11 @@ export function IconButton({
|
|
|
26
26
|
<button
|
|
27
27
|
type={type}
|
|
28
28
|
aria-label={label}
|
|
29
|
+
data-slot="icon-button"
|
|
29
30
|
className={cx(styles.root, styles[variant], styles[size], className)}
|
|
30
31
|
{...rest}
|
|
31
32
|
>
|
|
32
|
-
<span className={styles.icon}>{icon}</span>
|
|
33
|
+
<span data-slot="icon-button-icon" className={styles.icon}>{icon}</span>
|
|
33
34
|
</button>
|
|
34
35
|
)
|
|
35
36
|
}
|
|
@@ -3,23 +3,24 @@ import styles from './IconButton.module.css'
|
|
|
3
3
|
|
|
4
4
|
// The Vue IconButton: the same look (IconButton.module.css) as the React one. The icon goes in the icon slot;
|
|
5
5
|
// other attributes and listeners, such as aria-pressed or a click listener, go to the button.
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
6
|
+
const {
|
|
7
|
+
variant = 'ghost',
|
|
8
|
+
size = 'md',
|
|
9
|
+
type = 'button',
|
|
10
|
+
} = defineProps<{
|
|
11
|
+
/** Required: the accessible name, since the button has no visible text. */
|
|
12
|
+
label: string
|
|
13
|
+
/** Visual weight. Ghost has no fill until hover. */
|
|
14
|
+
variant?: 'primary' | 'secondary' | 'ghost'
|
|
15
|
+
/** Size of the button. */
|
|
16
|
+
size?: 'sm' | 'md' | 'lg'
|
|
17
|
+
type?: 'button' | 'submit' | 'reset'
|
|
18
|
+
}>()
|
|
18
19
|
defineSlots<{ icon?: () => unknown }>()
|
|
19
20
|
</script>
|
|
20
21
|
|
|
21
22
|
<template>
|
|
22
|
-
<button :type="type" :aria-label="label" :class="[styles.root, styles[variant], styles[size]]">
|
|
23
|
-
<span :class="styles.icon"><slot name="icon" /></span>
|
|
23
|
+
<button :type="type" :aria-label="label" data-slot="icon-button" :class="[styles.root, styles[variant], styles[size]]">
|
|
24
|
+
<span data-slot="icon-button-icon" :class="styles.icon"><slot name="icon" /></span>
|
|
24
25
|
</button>
|
|
25
26
|
</template>
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
@layer gooee.components {
|
|
1
2
|
.root {
|
|
2
3
|
display: flex;
|
|
3
4
|
flex-direction: column;
|
|
@@ -32,9 +33,9 @@
|
|
|
32
33
|
cursor: text;
|
|
33
34
|
--gooee-flow-edge: var(--gooee-color-fg);
|
|
34
35
|
transition:
|
|
35
|
-
border-color var(--gooee-motion-fast) var(--gooee-ease-
|
|
36
|
-
box-shadow var(--gooee-motion-fast) var(--gooee-ease-
|
|
37
|
-
background-color var(--gooee-motion-fast) var(--gooee-ease-
|
|
36
|
+
border-color var(--gooee-motion-fast) var(--gooee-ease-morph),
|
|
37
|
+
box-shadow var(--gooee-motion-fast) var(--gooee-ease-morph),
|
|
38
|
+
background-color var(--gooee-motion-fast) var(--gooee-ease-morph);
|
|
38
39
|
}
|
|
39
40
|
|
|
40
41
|
.sm { --h: var(--gooee-control-h-sm); gap: var(--gooee-space-2); padding: 0 calc(var(--gooee-space-4) - var(--edge)); }
|
|
@@ -57,12 +58,12 @@
|
|
|
57
58
|
at once; a blur fades it. */
|
|
58
59
|
.field[data-edge] {
|
|
59
60
|
border-color: var(--gooee-flow-edge);
|
|
60
|
-
box-shadow: inset 0 0 0 calc(var(--gooee-
|
|
61
|
-
transition: background-color var(--gooee-motion-fast) var(--gooee-ease-
|
|
61
|
+
box-shadow: inset 0 0 0 calc(var(--gooee-focus-width) - var(--gooee-line)) var(--gooee-flow-edge);
|
|
62
|
+
transition: background-color var(--gooee-motion-fast) var(--gooee-ease-morph);
|
|
62
63
|
}
|
|
63
64
|
|
|
64
65
|
.field[data-invalid] { --gooee-flow-edge: var(--gooee-color-danger); }
|
|
65
|
-
.field[data-invalid][data-edge] { box-shadow: inset 0 0 0 calc(var(--gooee-
|
|
66
|
+
.field[data-invalid][data-edge] { box-shadow: inset 0 0 0 calc(var(--gooee-focus-width) - var(--gooee-line-thick)) var(--gooee-flow-edge); }
|
|
66
67
|
|
|
67
68
|
.edge {
|
|
68
69
|
position: absolute;
|
|
@@ -74,7 +75,7 @@
|
|
|
74
75
|
.field[data-invalid] {
|
|
75
76
|
border-color: var(--gooee-color-danger);
|
|
76
77
|
--edge: var(--gooee-line-thick);
|
|
77
|
-
animation: nudge var(--gooee-motion-slow) var(--gooee-ease-
|
|
78
|
+
animation: nudge var(--gooee-motion-slow) var(--gooee-ease-morph);
|
|
78
79
|
}
|
|
79
80
|
|
|
80
81
|
/* Also when a disabled fieldset turns it off, so it looks off like the controls beside it. */
|
|
@@ -117,7 +118,7 @@
|
|
|
117
118
|
|
|
118
119
|
.input::placeholder {
|
|
119
120
|
color: var(--gooee-color-fg-subtle);
|
|
120
|
-
transition: opacity var(--gooee-motion-base) var(--gooee-ease-
|
|
121
|
+
transition: opacity var(--gooee-motion-base) var(--gooee-ease-morph);
|
|
121
122
|
}
|
|
122
123
|
|
|
123
124
|
.floating .input {
|
|
@@ -142,8 +143,8 @@
|
|
|
142
143
|
transform: translateY(-50%);
|
|
143
144
|
pointer-events: none;
|
|
144
145
|
transition:
|
|
145
|
-
transform var(--gooee-motion-base) var(--gooee-ease-
|
|
146
|
-
color var(--gooee-motion-base) var(--gooee-ease-
|
|
146
|
+
transform var(--gooee-motion-base) var(--gooee-ease-morph),
|
|
147
|
+
color var(--gooee-motion-base) var(--gooee-ease-morph);
|
|
147
148
|
}
|
|
148
149
|
|
|
149
150
|
.floating:focus-within .floatLabel,
|
|
@@ -157,3 +158,4 @@
|
|
|
157
158
|
25% { transform: translateX(calc(var(--gooee-shift-sm) * -1)); }
|
|
158
159
|
60% { transform: translateX(var(--gooee-shift-sm)); }
|
|
159
160
|
}
|
|
161
|
+
}
|