gooee 0.51.1 → 1.0.0
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 +7 -5
- 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 +11 -8
- package/src/components/DropdownMenu/DropdownMenu.vue +24 -27
- 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 +15 -8
- 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 +30 -17
- package/src/components/Select/Select.vue +62 -57
- 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 +20 -9
- 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
|
@@ -7,29 +7,26 @@ import styles from './Switch.module.css'
|
|
|
7
7
|
// Other attributes, such as aria-label or a click listener, go to the switch button.
|
|
8
8
|
defineOptions({ inheritAttrs: false })
|
|
9
9
|
|
|
10
|
-
const
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
}>(),
|
|
23
|
-
{ labelPosition: 'end' },
|
|
24
|
-
)
|
|
10
|
+
const { description, labelPosition = 'end', id } = defineProps<{
|
|
11
|
+
/** Visible text next to the switch, also its accessible name. The label slot replaces it. */
|
|
12
|
+
label?: string
|
|
13
|
+
/** Extra text under the label, also read by screen readers. The description slot replaces it. */
|
|
14
|
+
description?: string
|
|
15
|
+
/** Puts the label before the switch, like a settings row. */
|
|
16
|
+
labelPosition?: 'start' | 'end'
|
|
17
|
+
/** Form field name. The form gets "on" while the switch is on, and nothing while it is off. */
|
|
18
|
+
name?: string
|
|
19
|
+
disabled?: boolean
|
|
20
|
+
id?: string
|
|
21
|
+
}>()
|
|
25
22
|
|
|
26
|
-
/** Whether the switch is on. Use v-model
|
|
27
|
-
const checked = defineModel<boolean>(
|
|
23
|
+
/** Whether the switch is on. Use v-model, or leave it out and the switch keeps its own state. */
|
|
24
|
+
const checked = defineModel<boolean>({ default: false })
|
|
28
25
|
const slots = defineSlots<{ label?: () => unknown; description?: () => unknown }>()
|
|
29
26
|
|
|
30
27
|
const auto = useId()
|
|
31
|
-
const switchId = computed(() =>
|
|
32
|
-
const hasDescription = computed(() => !!(
|
|
28
|
+
const switchId = computed(() => id ?? auto)
|
|
29
|
+
const hasDescription = computed(() => !!(description || slots.description))
|
|
33
30
|
const attrs = useAttrs()
|
|
34
31
|
const describedBy = computed(() => [hasDescription.value && `${switchId.value}-desc`, attrs['aria-describedby']].filter(Boolean).join(' ') || undefined)
|
|
35
32
|
|
|
@@ -41,7 +38,7 @@ onBeforeUnmount(thumb.destroy)
|
|
|
41
38
|
</script>
|
|
42
39
|
|
|
43
40
|
<template>
|
|
44
|
-
<div :class="[styles.root, labelPosition === 'start' && styles.start]" :data-disabled="disabled || undefined">
|
|
41
|
+
<div :class="[styles.root, labelPosition === 'start' && styles.start]" data-slot="switch" :data-state="checked ? 'checked' : 'unchecked'" :data-disabled="disabled || undefined">
|
|
45
42
|
<button
|
|
46
43
|
v-bind="$attrs"
|
|
47
44
|
:id="switchId"
|
|
@@ -50,15 +47,16 @@ onBeforeUnmount(thumb.destroy)
|
|
|
50
47
|
:aria-checked="checked"
|
|
51
48
|
:aria-describedby="describedBy"
|
|
52
49
|
:class="styles.track"
|
|
53
|
-
|
|
50
|
+
data-slot="switch-track"
|
|
51
|
+
:data-state="checked ? 'checked' : 'unchecked'"
|
|
54
52
|
:disabled="disabled"
|
|
55
53
|
@click="checked = !checked"
|
|
56
54
|
>
|
|
57
|
-
<span ref="thumbEl" :class="styles.thumb" aria-hidden="true" />
|
|
55
|
+
<span ref="thumbEl" :class="styles.thumb" data-slot="switch-thumb" aria-hidden="true" />
|
|
58
56
|
</button>
|
|
59
57
|
<span :class="styles.text">
|
|
60
|
-
<label :for="switchId" :class="styles.label"><slot name="label">{{ label }}</slot></label>
|
|
61
|
-
<span v-if="hasDescription" :id="`${switchId}-desc`" :class="styles.description"><slot name="description">{{ description }}</slot></span>
|
|
58
|
+
<label :for="switchId" :class="styles.label" data-slot="field-label"><slot name="label">{{ label }}</slot></label>
|
|
59
|
+
<span v-if="hasDescription" :id="`${switchId}-desc`" :class="styles.description" data-slot="switch-description"><slot name="description">{{ description }}</slot></span>
|
|
62
60
|
</span>
|
|
63
61
|
<!-- Submits like a checkbox: "on" when on, nothing when off -->
|
|
64
62
|
<input v-if="name && checked" type="hidden" :name="name" value="on" />
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
@layer gooee.components {
|
|
1
2
|
/* layout="scroll" (default): narrow screens scroll the table sideways. layout="stack": a
|
|
2
3
|
container query turns rows into cards in narrow columns. */
|
|
3
4
|
.root {
|
|
@@ -29,7 +30,7 @@
|
|
|
29
30
|
overscroll-behavior-x: contain;
|
|
30
31
|
}
|
|
31
32
|
|
|
32
|
-
.scroll:focus-visible { outline: none; box-shadow: inset 0 0 0 var(--gooee-
|
|
33
|
+
.scroll:focus-visible { outline: none; box-shadow: inset 0 0 0 var(--gooee-focus-width) var(--gooee-color-fg); }
|
|
33
34
|
|
|
34
35
|
.table {
|
|
35
36
|
width: 100%;
|
|
@@ -82,17 +83,17 @@
|
|
|
82
83
|
text-transform: inherit;
|
|
83
84
|
cursor: pointer;
|
|
84
85
|
transition:
|
|
85
|
-
background-color var(--gooee-motion-fast) var(--gooee-ease-
|
|
86
|
-
color var(--gooee-motion-fast) var(--gooee-ease-
|
|
86
|
+
background-color var(--gooee-motion-fast) var(--gooee-ease-morph),
|
|
87
|
+
color var(--gooee-motion-fast) var(--gooee-ease-morph);
|
|
87
88
|
}
|
|
88
89
|
|
|
89
90
|
.th[data-align="end"] .sortButton { flex-direction: row-reverse; }
|
|
90
91
|
@media (hover: hover) {
|
|
91
92
|
.sortButton:hover:not(:disabled) { background: var(--gooee-color-surface-hover); color: var(--gooee-color-fg); }
|
|
92
93
|
}
|
|
93
|
-
.sortButton[data-active] { color: var(--gooee-color-fg); }
|
|
94
|
+
.sortButton[data-state="active"] { color: var(--gooee-color-fg); }
|
|
94
95
|
.sortButton:disabled { cursor: default; }
|
|
95
|
-
.sortButton:focus-visible { outline: none; box-shadow: inset 0 0 0 var(--gooee-
|
|
96
|
+
.sortButton:focus-visible { outline: none; box-shadow: inset 0 0 0 var(--gooee-focus-width) var(--gooee-color-fg); }
|
|
96
97
|
|
|
97
98
|
.sortIcon {
|
|
98
99
|
width: var(--gooee-icon-sm);
|
|
@@ -105,8 +106,8 @@
|
|
|
105
106
|
opacity: 0;
|
|
106
107
|
transform: translateY(var(--gooee-space-1));
|
|
107
108
|
transition:
|
|
108
|
-
transform var(--gooee-motion-slow) var(--gooee-ease-
|
|
109
|
-
opacity var(--gooee-motion-base) var(--gooee-ease-
|
|
109
|
+
transform var(--gooee-motion-slow) var(--gooee-ease-morph),
|
|
110
|
+
opacity var(--gooee-motion-base) var(--gooee-ease-morph);
|
|
110
111
|
}
|
|
111
112
|
|
|
112
113
|
@media (hover: hover) {
|
|
@@ -117,7 +118,7 @@
|
|
|
117
118
|
.sortIcon[data-dir="descending"] { transform: rotate(180deg); }
|
|
118
119
|
|
|
119
120
|
.row {
|
|
120
|
-
transition: background-color var(--gooee-motion-fast) var(--gooee-ease-
|
|
121
|
+
transition: background-color var(--gooee-motion-fast) var(--gooee-ease-morph);
|
|
121
122
|
}
|
|
122
123
|
|
|
123
124
|
@media (hover: hover) {
|
|
@@ -167,7 +168,7 @@
|
|
|
167
168
|
}
|
|
168
169
|
|
|
169
170
|
/* A new group's header settles in while its rows glide into place below it. */
|
|
170
|
-
.groupRow { animation: groupIn var(--gooee-motion-slow) var(--gooee-ease-
|
|
171
|
+
.groupRow { animation: groupIn var(--gooee-motion-slow) var(--gooee-ease-morph) both; }
|
|
171
172
|
|
|
172
173
|
@keyframes groupIn {
|
|
173
174
|
from { opacity: 0; transform: translateY(calc(var(--gooee-shift-sm) * -1)); }
|
|
@@ -189,7 +190,7 @@
|
|
|
189
190
|
place-items: center;
|
|
190
191
|
width: var(--gooee-hit-min);
|
|
191
192
|
height: var(--gooee-hit-min);
|
|
192
|
-
margin: calc((var(--gooee-hit-min) - var(--gooee-table-check)) / -2);
|
|
193
|
+
margin: calc((var(--gooee-hit-min) - var(--gooee-table-check, 18px)) / -2);
|
|
193
194
|
}
|
|
194
195
|
|
|
195
196
|
.checkInput {
|
|
@@ -203,17 +204,17 @@
|
|
|
203
204
|
.checkBox {
|
|
204
205
|
display: grid;
|
|
205
206
|
place-items: center;
|
|
206
|
-
width: var(--gooee-table-check);
|
|
207
|
-
height: var(--gooee-table-check);
|
|
207
|
+
width: var(--gooee-table-check, 18px);
|
|
208
|
+
height: var(--gooee-table-check, 18px);
|
|
208
209
|
border: var(--gooee-line-thick) solid var(--gooee-color-border-strong);
|
|
209
210
|
border-radius: var(--gooee-radius-xs);
|
|
210
211
|
background: var(--gooee-color-surface);
|
|
211
212
|
color: var(--gooee-color-accent-fg);
|
|
212
213
|
pointer-events: none;
|
|
213
214
|
transition:
|
|
214
|
-
background-color var(--gooee-motion-fast) var(--gooee-ease-
|
|
215
|
-
border-color var(--gooee-motion-fast) var(--gooee-ease-
|
|
216
|
-
transform var(--gooee-motion-slow) var(--gooee-ease-
|
|
215
|
+
background-color var(--gooee-motion-fast) var(--gooee-ease-morph),
|
|
216
|
+
border-color var(--gooee-motion-fast) var(--gooee-ease-morph),
|
|
217
|
+
transform var(--gooee-motion-slow) var(--gooee-ease-morph);
|
|
217
218
|
}
|
|
218
219
|
|
|
219
220
|
.checkBox svg {
|
|
@@ -226,8 +227,8 @@
|
|
|
226
227
|
stroke-linejoin: round;
|
|
227
228
|
}
|
|
228
229
|
|
|
229
|
-
.checkBox[data-state="
|
|
230
|
-
.checkBox[data-state="
|
|
230
|
+
.checkBox[data-state="checked"],
|
|
231
|
+
.checkBox[data-state="indeterminate"] {
|
|
231
232
|
border-color: var(--gooee-color-accent);
|
|
232
233
|
background: var(--gooee-color-accent);
|
|
233
234
|
}
|
|
@@ -240,11 +241,11 @@
|
|
|
240
241
|
/* Hidden just before the path starts. A zero-length dash would leave its round ends as a dot in Safari. */
|
|
241
242
|
stroke-dasharray: 1 2;
|
|
242
243
|
stroke-dashoffset: 1.01;
|
|
243
|
-
transition: stroke-dashoffset var(--gooee-motion-base) var(--gooee-ease-
|
|
244
|
+
transition: stroke-dashoffset var(--gooee-motion-base) var(--gooee-ease-morph);
|
|
244
245
|
}
|
|
245
246
|
|
|
246
|
-
.checkBox[data-state="
|
|
247
|
-
.checkBox[data-state="
|
|
247
|
+
.checkBox[data-state="checked"] .tick,
|
|
248
|
+
.checkBox[data-state="indeterminate"] .dash { stroke-dashoffset: 0; }
|
|
248
249
|
|
|
249
250
|
.srOnly {
|
|
250
251
|
position: absolute;
|
|
@@ -333,7 +334,7 @@
|
|
|
333
334
|
}
|
|
334
335
|
|
|
335
336
|
[data-layout="scroll"] .td {
|
|
336
|
-
max-width: var(--gooee-table-cell-max);
|
|
337
|
+
max-width: var(--gooee-table-cell-max, 320px);
|
|
337
338
|
}
|
|
338
339
|
|
|
339
340
|
/* The first column stays in place while the rest scrolls, so each row keeps its name. */
|
|
@@ -374,7 +375,8 @@
|
|
|
374
375
|
background: linear-gradient(to right, transparent, var(--gooee-color-surface));
|
|
375
376
|
opacity: 0;
|
|
376
377
|
pointer-events: none;
|
|
377
|
-
transition: opacity var(--gooee-motion-fast) var(--gooee-ease-
|
|
378
|
+
transition: opacity var(--gooee-motion-fast) var(--gooee-ease-morph);
|
|
378
379
|
}
|
|
379
380
|
|
|
380
381
|
[data-layout="scroll"][data-more-end]::after { opacity: 1; }
|
|
382
|
+
}
|
|
@@ -100,9 +100,9 @@ function Check({ checked, mixed, label, disabled, onChange }: { checked: boolean
|
|
|
100
100
|
if (ref.current) ref.current.indeterminate = Boolean(mixed)
|
|
101
101
|
}, [mixed])
|
|
102
102
|
return (
|
|
103
|
-
<span className={styles.check}>
|
|
104
|
-
<input ref={ref} type="checkbox" aria-label={label} checked={checked} disabled={disabled} onChange={(e) => onChange(e.target.checked)} className={styles.checkInput} />
|
|
105
|
-
<span className={styles.checkBox} data-state={mixed ? '
|
|
103
|
+
<span className={styles.check} data-slot="table-checkbox">
|
|
104
|
+
<input ref={ref} type="checkbox" data-slot="table-checkbox-input" aria-label={label} checked={checked} disabled={disabled} onChange={(e) => onChange(e.target.checked)} className={styles.checkInput} />
|
|
105
|
+
<span className={styles.checkBox} data-slot="table-checkbox-indicator" data-state={mixed ? 'indeterminate' : checked ? 'checked' : 'unchecked'} aria-hidden="true">
|
|
106
106
|
<svg viewBox="0 0 16 16">
|
|
107
107
|
<path className={styles.tick} d="M3.5 8.5l3 3 6-7" pathLength="1" />
|
|
108
108
|
<path className={styles.dash} d="M4 8h8" pathLength="1" />
|
|
@@ -162,22 +162,18 @@ export function Table<T>({
|
|
|
162
162
|
const [announce, setAnnounce] = useState('')
|
|
163
163
|
const tableRef = useRef<HTMLTableElement>(null)
|
|
164
164
|
const lastTops = useRef(new Map<string, number>())
|
|
165
|
-
const lastShape = useRef('')
|
|
166
165
|
const groupOrder = useRef<string[]>([])
|
|
167
166
|
|
|
168
167
|
const sorted = useMemo(() => sortRows(rows, columns, sort), [rows, columns, sort])
|
|
169
168
|
|
|
170
169
|
const groups = groupBy ? groupRows(rows, sorted, groupBy, groupOrder.current) : null
|
|
171
|
-
const shape = groups ? groups.map((g) => g.key).join('|') : ''
|
|
172
170
|
const order = groups ? groups.map((g) => `${g.key}:${g.rows.map(getRowId).join(',')}`).join('|') : sorted.map(getRowId).join('|')
|
|
173
171
|
|
|
174
|
-
// FLIP: rows glide to their new place after a sort
|
|
175
|
-
// there with the spring, so the table visibly splits apart and closes up again.
|
|
172
|
+
// FLIP: rows glide to their new place after a sort or a regroup.
|
|
176
173
|
useLayoutEffect(() => {
|
|
177
174
|
const table = tableRef.current
|
|
178
175
|
if (!table) return
|
|
179
|
-
lastTops.current = flipRows(table, lastTops.current
|
|
180
|
-
lastShape.current = shape
|
|
176
|
+
lastTops.current = flipRows(table, lastTops.current)
|
|
181
177
|
}, [order])
|
|
182
178
|
|
|
183
179
|
const labelOf = (c: TableColumn<T>) => c.label ?? (typeof c.header === 'string' ? c.header : c.key)
|
|
@@ -205,14 +201,14 @@ export function Table<T>({
|
|
|
205
201
|
const rid = getRowId(row)
|
|
206
202
|
const on = selectedSet.has(rid)
|
|
207
203
|
return (
|
|
208
|
-
<tr key={rid} role="row" data-row-id={rid} className={styles.row} data-selected={on || undefined} style={{ ['--i' as string]: Math.min(ri, 12) }}>
|
|
204
|
+
<tr key={rid} role="row" data-row-id={rid} className={styles.row} data-slot="table-row" data-selected={on || undefined} style={{ ['--i' as string]: Math.min(ri, 12) }}>
|
|
209
205
|
{selectable && (
|
|
210
|
-
<td role="cell" className={styles.checkCell}>
|
|
206
|
+
<td role="cell" className={styles.checkCell} data-slot="table-cell">
|
|
211
207
|
<Check checked={on} label={labels.selectRow(nameOf(row))} onChange={(v) => setSelected(v ? [...selected, rid] : selected.filter((s) => s !== rid))} />
|
|
212
208
|
</td>
|
|
213
209
|
)}
|
|
214
210
|
{columns.map((c) => (
|
|
215
|
-
<td key={c.key} role="cell" className={styles.td} data-align={c.align ?? 'start'} data-label={labelOf(c)}>
|
|
211
|
+
<td key={c.key} role="cell" className={styles.td} data-slot="table-cell" data-align={c.align ?? 'start'} data-label={labelOf(c)}>
|
|
216
212
|
{/* One wrapper, so the card layout always gets a label and a value */}
|
|
217
213
|
<span>{c.cell ? c.cell(row) : String(read(row, c.key) ?? '')}</span>
|
|
218
214
|
</td>
|
|
@@ -222,17 +218,17 @@ export function Table<T>({
|
|
|
222
218
|
}
|
|
223
219
|
|
|
224
220
|
return (
|
|
225
|
-
<div className={cx(styles.root, className)} data-layout={layout} data-more-start={more.start || undefined} data-more-end={more.end || undefined}>
|
|
226
|
-
<div ref={scrollRef} onScroll={measure} onFocus={reveal} className={styles.scroll} style={{ maxHeight }} tabIndex={scrollable ? 0 : undefined} role={scrollable ? 'region' : undefined} aria-labelledby={scrollable ? `${id}-cap` : undefined}>
|
|
221
|
+
<div className={cx(styles.root, className)} data-slot="table" data-layout={layout} data-more-start={more.start || undefined} data-more-end={more.end || undefined}>
|
|
222
|
+
<div ref={scrollRef} onScroll={measure} onFocus={reveal} className={styles.scroll} data-slot="table-container" style={{ maxHeight }} tabIndex={scrollable ? 0 : undefined} role={scrollable ? 'region' : undefined} aria-labelledby={scrollable ? `${id}-cap` : undefined}>
|
|
227
223
|
{/* Explicit roles keep table semantics when rows restyle as cards (layout="stack") */}
|
|
228
|
-
<table ref={tableRef} role="table" className={styles.table} aria-labelledby={`${id}-cap`} aria-busy={loading || undefined}>
|
|
229
|
-
<caption id={`${id}-cap`} className={cx(styles.caption, hideCaption && styles.srOnly)}>
|
|
224
|
+
<table ref={tableRef} role="table" className={styles.table} data-slot="table-element" aria-labelledby={`${id}-cap`} aria-busy={loading || undefined}>
|
|
225
|
+
<caption id={`${id}-cap`} className={cx(styles.caption, hideCaption && styles.srOnly)} data-slot="table-caption">
|
|
230
226
|
{caption}
|
|
231
227
|
</caption>
|
|
232
|
-
<thead role="rowgroup" className={styles.head}>
|
|
228
|
+
<thead role="rowgroup" className={styles.head} data-slot="table-header">
|
|
233
229
|
<tr role="row">
|
|
234
230
|
{selectable && (
|
|
235
|
-
<th role="columnheader" scope="col" className={styles.checkCell}>
|
|
231
|
+
<th role="columnheader" scope="col" className={styles.checkCell} data-slot="table-head">
|
|
236
232
|
<Check
|
|
237
233
|
checked={allOn}
|
|
238
234
|
mixed={someOn}
|
|
@@ -252,14 +248,15 @@ export function Table<T>({
|
|
|
252
248
|
scope="col"
|
|
253
249
|
aria-sort={c.sortable ? (dir ?? 'none') : undefined}
|
|
254
250
|
className={styles.th}
|
|
251
|
+
data-slot="table-head"
|
|
255
252
|
data-align={c.align ?? 'start'}
|
|
256
253
|
data-sortable={c.sortable || undefined}
|
|
257
254
|
style={{ width: c.width }}
|
|
258
255
|
>
|
|
259
256
|
{c.sortable ? (
|
|
260
|
-
<button type="button" className={styles.sortButton} disabled={loading} data-
|
|
257
|
+
<button type="button" className={styles.sortButton} data-slot="table-sort" disabled={loading} data-state={active ? 'active' : 'inactive'} onClick={() => toggleSort(c.key)}>
|
|
261
258
|
<span>{c.header}</span>
|
|
262
|
-
<svg viewBox="0 0 16 16" className={styles.sortIcon} data-dir={dir} aria-hidden="true">
|
|
259
|
+
<svg viewBox="0 0 16 16" className={styles.sortIcon} data-slot="table-sort-icon" data-dir={dir} aria-hidden="true">
|
|
263
260
|
<path d="M8 12.5v-9M4.5 7L8 3.5 11.5 7" />
|
|
264
261
|
</svg>
|
|
265
262
|
</button>
|
|
@@ -272,12 +269,12 @@ export function Table<T>({
|
|
|
272
269
|
</tr>
|
|
273
270
|
</thead>
|
|
274
271
|
{loading ? (
|
|
275
|
-
<tbody role="rowgroup">
|
|
272
|
+
<tbody role="rowgroup" data-slot="table-body">
|
|
276
273
|
{Array.from({ length: loadingRows }, (_, r) => (
|
|
277
|
-
<tr key={r} aria-hidden="true" className={cx(styles.row, styles.loadingRow)}>
|
|
278
|
-
{selectable && <td className={styles.checkCell} />}
|
|
274
|
+
<tr key={r} aria-hidden="true" className={cx(styles.row, styles.loadingRow)} data-slot="table-row">
|
|
275
|
+
{selectable && <td className={styles.checkCell} data-slot="table-cell" />}
|
|
279
276
|
{columns.map((c, i) => (
|
|
280
|
-
<td key={c.key} className={styles.td} data-align={c.align ?? 'start'} data-label={labelOf(c)}>
|
|
277
|
+
<td key={c.key} className={styles.td} data-slot="table-cell" data-align={c.align ?? 'start'} data-label={labelOf(c)}>
|
|
281
278
|
<Skeleton shape="text" width={`${[72, 56, 84][(r + i) % 3]}%`} />
|
|
282
279
|
</td>
|
|
283
280
|
))}
|
|
@@ -286,22 +283,22 @@ export function Table<T>({
|
|
|
286
283
|
</tbody>
|
|
287
284
|
) : groups && groups.length > 0 ? (
|
|
288
285
|
groups.map((g) => (
|
|
289
|
-
<tbody key={g.key} role="rowgroup" className={styles.group}>
|
|
290
|
-
<tr role="row" data-row-id={`group:${g.key}`} className={styles.groupRow}>
|
|
291
|
-
<th role="rowheader" scope="rowgroup" colSpan={colCount} className={styles.groupHead}>
|
|
286
|
+
<tbody key={g.key} role="rowgroup" className={styles.group} data-slot="table-body">
|
|
287
|
+
<tr role="row" data-row-id={`group:${g.key}`} className={styles.groupRow} data-slot="table-group-row">
|
|
288
|
+
<th role="rowheader" scope="rowgroup" colSpan={colCount} className={styles.groupHead} data-slot="table-group-head">
|
|
292
289
|
<span>{g.key}</span>{' '}
|
|
293
|
-
<span className={styles.groupCount}>{labels.groupCount(g.rows.length)}</span>
|
|
290
|
+
<span className={styles.groupCount} data-slot="table-group-count">{labels.groupCount(g.rows.length)}</span>
|
|
294
291
|
</th>
|
|
295
292
|
</tr>
|
|
296
293
|
{g.rows.map(renderRow)}
|
|
297
294
|
</tbody>
|
|
298
295
|
))
|
|
299
296
|
) : (
|
|
300
|
-
<tbody role="rowgroup">
|
|
297
|
+
<tbody role="rowgroup" data-slot="table-body">
|
|
301
298
|
{sorted.map(renderRow)}
|
|
302
299
|
{sorted.length === 0 && (
|
|
303
300
|
<tr role="row">
|
|
304
|
-
<td role="cell" colSpan={colCount} className={styles.empty}>
|
|
301
|
+
<td role="cell" colSpan={colCount} className={styles.empty} data-slot="table-empty">
|
|
305
302
|
{emptyText}
|
|
306
303
|
</td>
|
|
307
304
|
</tr>
|