gooee 0.52.0 → 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
|
@@ -3,28 +3,25 @@ import { computed, ref, watch } from 'vue'
|
|
|
3
3
|
import styles from './Avatar.module.css'
|
|
4
4
|
|
|
5
5
|
// The Vue Avatar: the same look (Avatar.module.css) as the React one.
|
|
6
|
-
const
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
}>(),
|
|
17
|
-
{ size: 'md' },
|
|
18
|
-
)
|
|
6
|
+
const { name, src, size = 'md' } = defineProps<{
|
|
7
|
+
/** Used for the alt text and the initials fallback. */
|
|
8
|
+
name: string
|
|
9
|
+
/** Image URL. Initials show while it loads and if it fails. */
|
|
10
|
+
src?: string
|
|
11
|
+
/** Diameter of the avatar. */
|
|
12
|
+
size?: 'sm' | 'md' | 'lg' | 'xl'
|
|
13
|
+
/** Shows a status dot and adds the status to the spoken name. */
|
|
14
|
+
status?: 'online' | 'away' | 'offline'
|
|
15
|
+
}>()
|
|
19
16
|
|
|
20
|
-
const state = ref<'loading' | 'loaded' | 'error'>(
|
|
17
|
+
const state = ref<'loading' | 'loaded' | 'error'>(src ? 'loading' : 'error')
|
|
21
18
|
watch(
|
|
22
|
-
() =>
|
|
19
|
+
() => src,
|
|
23
20
|
(src) => (state.value = src ? 'loading' : 'error'),
|
|
24
21
|
)
|
|
25
22
|
|
|
26
23
|
const initials = computed(() =>
|
|
27
|
-
|
|
24
|
+
name
|
|
28
25
|
.trim()
|
|
29
26
|
.split(/\s+/)
|
|
30
27
|
.slice(0, 2)
|
|
@@ -39,11 +36,12 @@ const seen = (img: unknown) => {
|
|
|
39
36
|
</script>
|
|
40
37
|
|
|
41
38
|
<template>
|
|
42
|
-
<span :class="[styles.root, styles[size]]" role="img" :aria-label="status ? `${name}, ${status}` : name">
|
|
43
|
-
<span :class="styles.fallback" aria-hidden="true">{{ initials }}</span>
|
|
39
|
+
<span data-slot="avatar" :class="[styles.root, styles[size]]" role="img" :aria-label="status ? `${name}, ${status}` : name">
|
|
40
|
+
<span data-slot="avatar-fallback" :class="styles.fallback" aria-hidden="true">{{ initials }}</span>
|
|
44
41
|
<img
|
|
45
42
|
v-if="src && state !== 'error'"
|
|
46
43
|
:ref="seen"
|
|
44
|
+
data-slot="avatar-image"
|
|
47
45
|
:class="styles.img"
|
|
48
46
|
:src="src"
|
|
49
47
|
alt=""
|
|
@@ -51,6 +49,6 @@ const seen = (img: unknown) => {
|
|
|
51
49
|
@load="state = 'loaded'"
|
|
52
50
|
@error="state = 'error'"
|
|
53
51
|
/>
|
|
54
|
-
<span v-if="status" :class="styles.status" :data-status="status" aria-hidden="true" />
|
|
52
|
+
<span v-if="status" data-slot="avatar-status" :class="styles.status" :data-status="status" aria-hidden="true" />
|
|
55
53
|
</span>
|
|
56
54
|
</template>
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
@layer gooee.components {
|
|
1
2
|
.root {
|
|
2
3
|
display: inline-flex;
|
|
3
4
|
align-items: center;
|
|
@@ -10,16 +11,16 @@
|
|
|
10
11
|
display: inline-flex;
|
|
11
12
|
margin-left: calc(var(--gooee-space-3) * -1);
|
|
12
13
|
border-radius: var(--gooee-radius-full);
|
|
13
|
-
animation: slotIn var(--gooee-motion-slow) var(--gooee-ease-
|
|
14
|
+
animation: slotIn var(--gooee-motion-slow) var(--gooee-ease-morph) backwards;
|
|
14
15
|
animation-delay: calc(var(--i) * var(--gooee-motion-stagger) * 2);
|
|
15
|
-
transition: margin var(--gooee-motion-slow) var(--gooee-ease-
|
|
16
|
+
transition: margin var(--gooee-motion-slow) var(--gooee-ease-morph);
|
|
16
17
|
}
|
|
17
18
|
|
|
18
19
|
.face {
|
|
19
20
|
display: inline-flex;
|
|
20
21
|
border-radius: var(--gooee-radius-full);
|
|
21
|
-
box-shadow: 0 0 0 var(--gooee-
|
|
22
|
-
transition: transform var(--gooee-motion-base) var(--gooee-ease-
|
|
22
|
+
box-shadow: 0 0 0 var(--gooee-focus-width) var(--gooee-color-bg);
|
|
23
|
+
transition: transform var(--gooee-motion-base) var(--gooee-ease-morph);
|
|
23
24
|
}
|
|
24
25
|
|
|
25
26
|
@media (hover: hover) {
|
|
@@ -28,14 +29,14 @@
|
|
|
28
29
|
}
|
|
29
30
|
|
|
30
31
|
.more {
|
|
31
|
-
--size: var(--gooee-avatar-md);
|
|
32
|
+
--size: var(--gooee-avatar-md, 36px);
|
|
32
33
|
display: inline-grid;
|
|
33
34
|
place-items: center;
|
|
34
35
|
width: var(--size);
|
|
35
36
|
height: var(--size);
|
|
36
37
|
border-radius: var(--gooee-radius-full);
|
|
37
38
|
background: var(--gooee-color-surface);
|
|
38
|
-
box-shadow: inset 0 0 0 var(--gooee-line) var(--gooee-color-border-strong), 0 0 0 var(--gooee-
|
|
39
|
+
box-shadow: inset 0 0 0 var(--gooee-line) var(--gooee-color-border-strong), 0 0 0 var(--gooee-focus-width) var(--gooee-color-bg);
|
|
39
40
|
color: var(--gooee-color-fg);
|
|
40
41
|
font-size: calc(var(--size) * 0.32);
|
|
41
42
|
font-weight: var(--gooee-weight-medium);
|
|
@@ -44,10 +45,11 @@
|
|
|
44
45
|
user-select: none;
|
|
45
46
|
}
|
|
46
47
|
|
|
47
|
-
.sm { --size: var(--gooee-avatar-sm); }
|
|
48
|
-
.lg { --size: var(--gooee-avatar-lg); }
|
|
49
|
-
.xl { --size: var(--gooee-avatar-xl); }
|
|
48
|
+
.sm { --size: var(--gooee-avatar-sm, 28px); }
|
|
49
|
+
.lg { --size: var(--gooee-avatar-lg, 48px); }
|
|
50
|
+
.xl { --size: var(--gooee-avatar-xl, 72px); }
|
|
50
51
|
|
|
51
52
|
@keyframes slotIn {
|
|
52
53
|
from { opacity: 0; transform: translateX(calc(var(--gooee-shift-md) * -1)) scale(0.8); }
|
|
53
54
|
}
|
|
55
|
+
}
|
|
@@ -25,15 +25,15 @@ export function AvatarGroup({ children, max = 4, size = 'md', label, className }
|
|
|
25
25
|
// The names of the hidden people too, so a screen reader hears everyone the "+N" stands for.
|
|
26
26
|
const everyone = list(all.map((a) => a.props.name))
|
|
27
27
|
return (
|
|
28
|
-
<div className={cx(styles.root, className)} role="group" aria-label={label ? `${label}: ${everyone}` : everyone}>
|
|
28
|
+
<div data-slot="avatar-group" className={cx(styles.root, className)} role="group" aria-label={label ? `${label}: ${everyone}` : everyone}>
|
|
29
29
|
{shown.map((child, i) => (
|
|
30
|
-
<span key={child.key ?? i} className={styles.slot} style={{ ['--i' as string]: i }}>
|
|
30
|
+
<span key={child.key ?? i} data-slot="avatar-group-item" className={styles.slot} style={{ ['--i' as string]: i }}>
|
|
31
31
|
<span className={styles.face}>{child}</span>
|
|
32
32
|
</span>
|
|
33
33
|
))}
|
|
34
34
|
{extra > 0 && (
|
|
35
|
-
<span className={styles.slot} style={{ ['--i' as string]: shown.length }}>
|
|
36
|
-
<span className={cx(styles.face, styles.more, styles[size])} role="img" aria-label={`${extra} more`} title={list(all.slice(max).map((a) => a.props.name))}>
|
|
35
|
+
<span data-slot="avatar-group-item" className={styles.slot} style={{ ['--i' as string]: shown.length }}>
|
|
36
|
+
<span data-slot="avatar-group-more" className={cx(styles.face, styles.more, styles[size])} role="img" aria-label={`${extra} more`} title={list(all.slice(max).map((a) => a.props.name))}>
|
|
37
37
|
<span aria-hidden="true">+{extra}</span>
|
|
38
38
|
</span>
|
|
39
39
|
</span>
|
|
@@ -3,17 +3,14 @@ import { Fragment, computed, isVNode, type VNode } from 'vue'
|
|
|
3
3
|
import styles from './AvatarGroup.module.css'
|
|
4
4
|
|
|
5
5
|
// The Vue AvatarGroup: the same look (AvatarGroup.module.css) as the React one. The default slot holds the Avatars.
|
|
6
|
-
const
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
}>(),
|
|
15
|
-
{ max: 4, size: 'md' },
|
|
16
|
-
)
|
|
6
|
+
const { max = 4, size = 'md' } = defineProps<{
|
|
7
|
+
/** Avatars shown before the "+N" counter. */
|
|
8
|
+
max?: number
|
|
9
|
+
/** Size of the "+N" counter. Set it to match the avatars inside. */
|
|
10
|
+
size?: 'sm' | 'md' | 'lg' | 'xl'
|
|
11
|
+
/** What the people are, such as "Project members". Screen readers hear it with every name. */
|
|
12
|
+
label?: string
|
|
13
|
+
}>()
|
|
17
14
|
const slots = defineSlots<{ default?: () => VNode[] }>()
|
|
18
15
|
|
|
19
16
|
const list = (names: string[]) => (names.length < 2 ? names.join('') : `${names.slice(0, -1).join(', ')} and ${names[names.length - 1]}`)
|
|
@@ -21,7 +18,7 @@ const list = (names: string[]) => (names.length < 2 ? names.join('') : `${names.
|
|
|
21
18
|
const flat = (nodes: unknown[]): VNode[] => nodes.flatMap((n) => (!isVNode(n) ? [] : n.type === Fragment ? flat(n.children as unknown[]) : typeof n.type === 'object' || typeof n.type === 'function' ? [n] : []))
|
|
22
19
|
|
|
23
20
|
const all = computed(() => flat(slots.default?.() ?? []))
|
|
24
|
-
const shown = computed(() => all.value.slice(0,
|
|
21
|
+
const shown = computed(() => all.value.slice(0, max))
|
|
25
22
|
const extra = computed(() => all.value.length - shown.value.length)
|
|
26
23
|
const nameOf = (n: VNode) => String((n.props as { name?: string } | null)?.name ?? '')
|
|
27
24
|
// The names of the hidden people too, so a screen reader hears everyone the "+N" stands for.
|
|
@@ -29,12 +26,12 @@ const everyone = computed(() => list(all.value.map(nameOf)))
|
|
|
29
26
|
</script>
|
|
30
27
|
|
|
31
28
|
<template>
|
|
32
|
-
<div :class="styles.root" role="group" :aria-label="label ? `${label}: ${everyone}` : everyone">
|
|
33
|
-
<span v-for="(child, i) in shown" :key="child.key ?? i" :class="styles.slot" :style="{ '--i': i }">
|
|
29
|
+
<div data-slot="avatar-group" :class="styles.root" role="group" :aria-label="label ? `${label}: ${everyone}` : everyone">
|
|
30
|
+
<span v-for="(child, i) in shown" :key="child.key ?? i" data-slot="avatar-group-item" :class="styles.slot" :style="{ '--i': i }">
|
|
34
31
|
<span :class="styles.face"><component :is="child" /></span>
|
|
35
32
|
</span>
|
|
36
|
-
<span v-if="extra > 0" :class="styles.slot" :style="{ '--i': shown.length }">
|
|
37
|
-
<span :class="[styles.face, styles.more, styles[size]]" role="img" :aria-label="`${extra} more`" :title="list(all.slice(max).map(nameOf))">
|
|
33
|
+
<span v-if="extra > 0" data-slot="avatar-group-item" :class="styles.slot" :style="{ '--i': shown.length }">
|
|
34
|
+
<span data-slot="avatar-group-more" :class="[styles.face, styles.more, styles[size]]" role="img" :aria-label="`${extra} more`" :title="list(all.slice(max).map(nameOf))">
|
|
38
35
|
<span aria-hidden="true">+{{ extra }}</span>
|
|
39
36
|
</span>
|
|
40
37
|
</span>
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
+
@layer gooee.components {
|
|
1
2
|
.root {
|
|
2
3
|
display: inline-flex;
|
|
3
4
|
width: fit-content;
|
|
4
5
|
align-items: center;
|
|
5
6
|
gap: var(--gooee-space-2);
|
|
6
7
|
max-width: 100%;
|
|
7
|
-
height: var(--gooee-badge-h);
|
|
8
|
+
height: var(--gooee-badge-h, 24px);
|
|
8
9
|
padding: 0 calc(var(--gooee-space-3) - var(--gooee-line));
|
|
9
10
|
border: var(--gooee-line) solid transparent;
|
|
10
11
|
border-radius: var(--gooee-radius-full);
|
|
@@ -22,7 +23,7 @@
|
|
|
22
23
|
.root[data-tone="success"] { --tone: var(--gooee-color-success); --tone-soft: var(--gooee-color-success-soft); --tone-fill: var(--gooee-color-success); --tone-on: var(--gooee-color-inverse-fg); }
|
|
23
24
|
.root[data-tone="warning"] { --tone: var(--gooee-color-warning); --tone-soft: var(--gooee-color-warning-soft); --tone-fill: var(--gooee-color-warning); --tone-on: var(--gooee-color-inverse-fg); }
|
|
24
25
|
/* Danger fills with the solid red, because the dark theme's text red is too light for white text. */
|
|
25
|
-
.root[data-tone="danger"] { --tone: var(--gooee-color-danger); --tone-soft: var(--gooee-color-danger-soft); --tone-fill: var(--gooee-color-danger-solid); --tone-on: var(--gooee-color-
|
|
26
|
+
.root[data-tone="danger"] { --tone: var(--gooee-color-danger); --tone-soft: var(--gooee-color-danger-soft); --tone-fill: var(--gooee-color-danger-solid); --tone-on: var(--gooee-color-danger-fg); }
|
|
26
27
|
|
|
27
28
|
.solid[data-tone] { background: var(--tone-fill); color: var(--tone-on); }
|
|
28
29
|
.outline[data-tone] { border-color: var(--tone); color: var(--tone); }
|
|
@@ -34,7 +35,7 @@
|
|
|
34
35
|
min-width: 0;
|
|
35
36
|
overflow-x: clip;
|
|
36
37
|
text-overflow: ellipsis;
|
|
37
|
-
animation: pop var(--gooee-motion-slow) var(--gooee-ease-
|
|
38
|
+
animation: pop var(--gooee-motion-slow) var(--gooee-ease-morph);
|
|
38
39
|
}
|
|
39
40
|
|
|
40
41
|
.dot {
|
|
@@ -52,7 +53,7 @@
|
|
|
52
53
|
inset: 0;
|
|
53
54
|
border-radius: inherit;
|
|
54
55
|
background: currentColor;
|
|
55
|
-
animation: pulse calc(var(--gooee-motion-slower) * 3) var(--gooee-ease-
|
|
56
|
+
animation: pulse calc(var(--gooee-motion-slower) * 3) var(--gooee-ease-morph) infinite;
|
|
56
57
|
}
|
|
57
58
|
|
|
58
59
|
@keyframes pop {
|
|
@@ -67,3 +68,4 @@
|
|
|
67
68
|
@media (prefers-reduced-motion: reduce) {
|
|
68
69
|
.dot[data-pulse]::after { animation: none; }
|
|
69
70
|
}
|
|
71
|
+
}
|
|
@@ -14,10 +14,10 @@ export type BadgeProps = ComponentPropsWithRef<'span'> & {
|
|
|
14
14
|
export function Badge({ variant = 'subtle', tone = 'neutral', dot, className, children, ...rest }: BadgeProps) {
|
|
15
15
|
const plain = typeof children === 'string' || typeof children === 'number'
|
|
16
16
|
return (
|
|
17
|
-
<span className={cx(styles.root, styles[variant], className)} data-tone={tone === 'neutral' ? undefined : tone} {...rest}>
|
|
18
|
-
{dot && <span className={styles.dot} data-pulse={dot === 'pulse' || undefined} aria-hidden="true" />}
|
|
17
|
+
<span data-slot="badge" className={cx(styles.root, styles[variant], className)} data-tone={tone === 'neutral' ? undefined : tone} {...rest}>
|
|
18
|
+
{dot && <span data-slot="badge-dot" className={styles.dot} data-pulse={dot === 'pulse' || undefined} aria-hidden="true" />}
|
|
19
19
|
{/* Keyed on content, so a new value pops in instead of swapping silently. */}
|
|
20
|
-
<span key={plain ? String(children) : undefined} className={styles.text} title={plain && !rest.title ? String(children) : undefined}>
|
|
20
|
+
<span key={plain ? String(children) : undefined} data-slot="badge-text" className={styles.text} title={plain && !rest.title ? String(children) : undefined}>
|
|
21
21
|
{children}
|
|
22
22
|
</span>
|
|
23
23
|
</span>
|
|
@@ -3,17 +3,18 @@ import { Comment, Text, useAttrs, type VNode } from 'vue'
|
|
|
3
3
|
import styles from './Badge.module.css'
|
|
4
4
|
|
|
5
5
|
// The Vue Badge: the same look (Badge.module.css) as the React one. Other attributes go to the root.
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
6
|
+
const {
|
|
7
|
+
variant = 'subtle',
|
|
8
|
+
tone = 'neutral',
|
|
9
|
+
dot = false,
|
|
10
|
+
} = defineProps<{
|
|
11
|
+
/** Visual weight: filled, outlined or a soft tint. */
|
|
12
|
+
variant?: 'solid' | 'outline' | 'subtle'
|
|
13
|
+
/** Status colour. Use it only for a real status, and keep a word in the badge. */
|
|
14
|
+
tone?: 'neutral' | 'success' | 'warning' | 'danger'
|
|
15
|
+
/** A small dot before the text. "pulse" makes it breathe, for live states. */
|
|
16
|
+
dot?: boolean | 'pulse'
|
|
17
|
+
}>()
|
|
17
18
|
const slots = defineSlots<{ default?: () => VNode[] }>()
|
|
18
19
|
const attrs = useAttrs()
|
|
19
20
|
|
|
@@ -24,9 +25,9 @@ const plain = () => {
|
|
|
24
25
|
</script>
|
|
25
26
|
|
|
26
27
|
<template>
|
|
27
|
-
<span :class="[styles.root, styles[variant]]" :data-tone="tone === 'neutral' ? undefined : tone">
|
|
28
|
-
<span v-if="dot" :class="styles.dot" :data-pulse="dot === 'pulse' || undefined" aria-hidden="true" />
|
|
28
|
+
<span data-slot="badge" :class="[styles.root, styles[variant]]" :data-tone="tone === 'neutral' ? undefined : tone">
|
|
29
|
+
<span v-if="dot" data-slot="badge-dot" :class="styles.dot" :data-pulse="dot === 'pulse' || undefined" aria-hidden="true" />
|
|
29
30
|
<!-- Keyed on content, so a new value pops in instead of swapping silently. -->
|
|
30
|
-
<span :key="plain()" :class="styles.text" :title="attrs.title ? undefined : plain()"><slot /></span>
|
|
31
|
+
<span :key="plain()" data-slot="badge-text" :class="styles.text" :title="attrs.title ? undefined : plain()"><slot /></span>
|
|
31
32
|
</span>
|
|
32
33
|
</template>
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
@layer gooee.components {
|
|
1
2
|
.root { min-width: 0; }
|
|
2
3
|
|
|
3
4
|
.list {
|
|
@@ -17,7 +18,7 @@
|
|
|
17
18
|
}
|
|
18
19
|
|
|
19
20
|
.item[data-revealed] {
|
|
20
|
-
animation: reveal var(--gooee-motion-slow) var(--gooee-ease-
|
|
21
|
+
animation: reveal var(--gooee-motion-slow) var(--gooee-ease-morph) backwards;
|
|
21
22
|
animation-delay: calc(var(--i) * var(--gooee-motion-stagger));
|
|
22
23
|
}
|
|
23
24
|
|
|
@@ -31,7 +32,7 @@
|
|
|
31
32
|
border-radius: var(--gooee-radius-sm);
|
|
32
33
|
color: var(--gooee-color-fg-muted);
|
|
33
34
|
text-decoration: none;
|
|
34
|
-
transition: color var(--gooee-motion-fast) var(--gooee-ease-
|
|
35
|
+
transition: color var(--gooee-motion-fast) var(--gooee-ease-morph);
|
|
35
36
|
}
|
|
36
37
|
|
|
37
38
|
.link::after {
|
|
@@ -44,7 +45,7 @@
|
|
|
44
45
|
background: currentColor;
|
|
45
46
|
transform: scaleX(0);
|
|
46
47
|
transform-origin: left;
|
|
47
|
-
transition: transform var(--gooee-motion-base) var(--gooee-ease-
|
|
48
|
+
transition: transform var(--gooee-motion-base) var(--gooee-ease-morph);
|
|
48
49
|
}
|
|
49
50
|
|
|
50
51
|
@media (hover: hover) {
|
|
@@ -102,3 +103,4 @@
|
|
|
102
103
|
@keyframes reveal {
|
|
103
104
|
from { opacity: 0; transform: translateX(calc(var(--gooee-shift-sm) * -1)); }
|
|
104
105
|
}
|
|
106
|
+
}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
import { Fragment, useLayoutEffect, useRef, useState, type MouseEvent } from 'react'
|
|
4
4
|
import { cx } from '../../internal/cx'
|
|
5
|
-
import { ChevronRightIcon } from '../../
|
|
5
|
+
import { ChevronRightIcon } from '../../icons/icons'
|
|
6
6
|
import styles from './Breadcrumb.module.css'
|
|
7
7
|
|
|
8
8
|
export type BreadcrumbItem = {
|
|
@@ -14,6 +14,13 @@ export type BreadcrumbItem = {
|
|
|
14
14
|
onClick?: (event: MouseEvent<HTMLAnchorElement | HTMLButtonElement>) => void
|
|
15
15
|
}
|
|
16
16
|
|
|
17
|
+
export type BreadcrumbLabels = {
|
|
18
|
+
/** Name of the "…" button. */
|
|
19
|
+
expand: string
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
const defaultLabels: BreadcrumbLabels = { expand: 'Show full path' }
|
|
23
|
+
|
|
17
24
|
export type BreadcrumbProps = {
|
|
18
25
|
/** Path from the top level down. The last item is the current page. */
|
|
19
26
|
items: BreadcrumbItem[]
|
|
@@ -21,13 +28,14 @@ export type BreadcrumbProps = {
|
|
|
21
28
|
maxItems?: number
|
|
22
29
|
/** Name of the nav landmark. */
|
|
23
30
|
label?: string
|
|
24
|
-
/** Screen reader
|
|
25
|
-
|
|
31
|
+
/** Screen reader text, so you can translate it. Missing keys use the English defaults. */
|
|
32
|
+
labels?: Partial<BreadcrumbLabels>
|
|
26
33
|
/** Extra class for the nav element. */
|
|
27
34
|
className?: string
|
|
28
35
|
}
|
|
29
36
|
|
|
30
|
-
export function Breadcrumb({ items, maxItems = 4, label = 'Breadcrumb',
|
|
37
|
+
export function Breadcrumb({ items, maxItems = 4, label = 'Breadcrumb', labels: labelsProp, className }: BreadcrumbProps) {
|
|
38
|
+
const labels = { ...defaultLabels, ...labelsProp }
|
|
31
39
|
const [expanded, setExpanded] = useState(false)
|
|
32
40
|
const listRef = useRef<HTMLOListElement>(null)
|
|
33
41
|
const collapse = !expanded && items.length > maxItems
|
|
@@ -43,29 +51,29 @@ export function Breadcrumb({ items, maxItems = 4, label = 'Breadcrumb', expandLa
|
|
|
43
51
|
}, [expanded, head])
|
|
44
52
|
|
|
45
53
|
return (
|
|
46
|
-
<nav aria-label={label} className={cx(styles.root, className)}>
|
|
47
|
-
<ol ref={listRef} className={styles.list}>
|
|
54
|
+
<nav aria-label={label} data-slot="breadcrumb" className={cx(styles.root, className)}>
|
|
55
|
+
<ol ref={listRef} data-slot="breadcrumb-list" className={styles.list}>
|
|
48
56
|
{visible.map((item, i) => {
|
|
49
57
|
const last = i === visible.length - 1
|
|
50
58
|
return (
|
|
51
59
|
<Fragment key={item ? `${item.label}-${i}` : 'more'}>
|
|
52
|
-
<li className={styles.item} style={{ ['--i' as string]: i }} data-revealed={expanded || undefined}>
|
|
60
|
+
<li data-slot="breadcrumb-item" className={styles.item} style={{ ['--i' as string]: i }} data-revealed={expanded || undefined}>
|
|
53
61
|
{item === null ? (
|
|
54
|
-
<button type="button" className={styles.more} aria-label={
|
|
62
|
+
<button type="button" data-slot="breadcrumb-more" className={styles.more} aria-label={labels.expand} onClick={() => setExpanded(true)}>
|
|
55
63
|
…
|
|
56
64
|
</button>
|
|
57
65
|
) : last ? (
|
|
58
|
-
<span className={styles.current} aria-current="page" title={item.label}>{item.label}</span>
|
|
66
|
+
<span data-slot="breadcrumb-current" className={styles.current} aria-current="page" title={item.label}>{item.label}</span>
|
|
59
67
|
) : item.href === undefined ? (
|
|
60
|
-
<button type="button" className={cx(styles.link, styles.button)} title={item.label} onClick={item.onClick}>
|
|
68
|
+
<button type="button" data-slot="breadcrumb-link" className={cx(styles.link, styles.button)} title={item.label} onClick={item.onClick}>
|
|
61
69
|
{item.label}
|
|
62
70
|
</button>
|
|
63
71
|
) : (
|
|
64
|
-
<a className={styles.link} href={item.href} title={item.label} onClick={item.onClick}>
|
|
72
|
+
<a data-slot="breadcrumb-link" className={styles.link} href={item.href} title={item.label} onClick={item.onClick}>
|
|
65
73
|
{item.label}
|
|
66
74
|
</a>
|
|
67
75
|
)}
|
|
68
|
-
{!last && <ChevronRightIcon className={styles.sep} />}
|
|
76
|
+
{!last && <ChevronRightIcon data-slot="breadcrumb-separator" className={styles.sep} />}
|
|
69
77
|
</li>
|
|
70
78
|
</Fragment>
|
|
71
79
|
)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
2
|
import { computed, nextTick, ref, watch } from 'vue'
|
|
3
|
-
import { ChevronRightIcon } from '../../
|
|
3
|
+
import { ChevronRightIcon } from '../../icons/vue'
|
|
4
4
|
import styles from './Breadcrumb.module.css'
|
|
5
5
|
|
|
6
6
|
// The Vue Breadcrumb: the same look (Breadcrumb.module.css) and unfold as the React one.
|
|
@@ -14,27 +14,35 @@ export type BreadcrumbItem = {
|
|
|
14
14
|
onClick?: (event: MouseEvent) => void
|
|
15
15
|
}
|
|
16
16
|
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
17
|
+
export type BreadcrumbLabels = {
|
|
18
|
+
/** Name of the "…" button. */
|
|
19
|
+
expand: string
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
const {
|
|
23
|
+
items,
|
|
24
|
+
maxItems = 4,
|
|
25
|
+
label = 'Breadcrumb',
|
|
26
|
+
labels,
|
|
27
|
+
} = defineProps<{
|
|
28
|
+
/** Path from the top level down. The last item is the current page. */
|
|
29
|
+
items: BreadcrumbItem[]
|
|
30
|
+
/** Above this many items, the middle collapses into a "…" button. With 2 or less, only "…" and the current page show. */
|
|
31
|
+
maxItems?: number
|
|
32
|
+
/** Name of the nav landmark. */
|
|
33
|
+
label?: string
|
|
34
|
+
/** Screen reader text, so you can translate it. Missing keys use the English defaults. */
|
|
35
|
+
labels?: Partial<BreadcrumbLabels>
|
|
36
|
+
}>()
|
|
37
|
+
const text = computed(() => ({ expand: 'Show full path', ...labels }))
|
|
30
38
|
|
|
31
39
|
const expanded = ref(false)
|
|
32
40
|
const list = ref<HTMLOListElement | null>(null)
|
|
33
41
|
// Under 3 there is no room for the first item, so only "…" and the current page stay.
|
|
34
|
-
const head = computed(() => (
|
|
42
|
+
const head = computed(() => (maxItems < 3 ? 0 : 1))
|
|
35
43
|
const visible = computed(() => {
|
|
36
|
-
const tail = Math.max(1,
|
|
37
|
-
return !expanded.value &&
|
|
44
|
+
const tail = Math.max(1, maxItems - head.value - 1)
|
|
45
|
+
return !expanded.value && items.length > maxItems ? [...items.slice(0, head.value), null, ...items.slice(-tail)] : items
|
|
38
46
|
})
|
|
39
47
|
|
|
40
48
|
// The "…" button is gone after expanding, so focus moves to the first link it revealed.
|
|
@@ -44,14 +52,14 @@ watch(expanded, (on) => {
|
|
|
44
52
|
</script>
|
|
45
53
|
|
|
46
54
|
<template>
|
|
47
|
-
<nav :aria-label="label" :class="styles.root">
|
|
48
|
-
<ol ref="list" :class="styles.list">
|
|
49
|
-
<li v-for="(item, i) in visible" :key="item ? `${item.label}-${i}` : 'more'" :class="styles.item" :style="{ '--i': i }" :data-revealed="expanded || undefined">
|
|
50
|
-
<button v-if="item === null" type="button" :class="styles.more" :aria-label="
|
|
51
|
-
<span v-else-if="i === visible.length - 1" :class="styles.current" aria-current="page" :title="item.label">{{ item.label }}</span>
|
|
52
|
-
<button v-else-if="item.href === undefined" type="button" :class="[styles.link, styles.button]" :title="item.label" @click="item.onClick?.($event)">{{ item.label }}</button>
|
|
53
|
-
<a v-else :class="styles.link" :href="item.href" :title="item.label" @click="item.onClick?.($event)">{{ item.label }}</a>
|
|
54
|
-
<ChevronRightIcon v-if="i !== visible.length - 1" :class="styles.sep" />
|
|
55
|
+
<nav :aria-label="label" data-slot="breadcrumb" :class="styles.root">
|
|
56
|
+
<ol ref="list" data-slot="breadcrumb-list" :class="styles.list">
|
|
57
|
+
<li v-for="(item, i) in visible" :key="item ? `${item.label}-${i}` : 'more'" data-slot="breadcrumb-item" :class="styles.item" :style="{ '--i': i }" :data-revealed="expanded || undefined">
|
|
58
|
+
<button v-if="item === null" type="button" data-slot="breadcrumb-more" :class="styles.more" :aria-label="text.expand" @click="expanded = true">…</button>
|
|
59
|
+
<span v-else-if="i === visible.length - 1" data-slot="breadcrumb-current" :class="styles.current" aria-current="page" :title="item.label">{{ item.label }}</span>
|
|
60
|
+
<button v-else-if="item.href === undefined" type="button" data-slot="breadcrumb-link" :class="[styles.link, styles.button]" :title="item.label" @click="item.onClick?.($event)">{{ item.label }}</button>
|
|
61
|
+
<a v-else data-slot="breadcrumb-link" :class="styles.link" :href="item.href" :title="item.label" @click="item.onClick?.($event)">{{ item.label }}</a>
|
|
62
|
+
<ChevronRightIcon v-if="i !== visible.length - 1" data-slot="breadcrumb-separator" :class="styles.sep" />
|
|
55
63
|
</li>
|
|
56
64
|
</ol>
|
|
57
65
|
</nav>
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
@layer gooee.components {
|
|
1
2
|
.root {
|
|
2
3
|
--h: var(--gooee-control-h-md);
|
|
3
4
|
position: relative;
|
|
@@ -23,10 +24,10 @@
|
|
|
23
24
|
user-select: none;
|
|
24
25
|
-webkit-tap-highlight-color: transparent;
|
|
25
26
|
transition:
|
|
26
|
-
background-color var(--gooee-motion-fast) var(--gooee-ease-
|
|
27
|
-
border-color var(--gooee-motion-fast) var(--gooee-ease-
|
|
28
|
-
color var(--gooee-motion-fast) var(--gooee-ease-
|
|
29
|
-
box-shadow var(--gooee-motion-fast) var(--gooee-ease-
|
|
27
|
+
background-color var(--gooee-motion-fast) var(--gooee-ease-morph),
|
|
28
|
+
border-color var(--gooee-motion-fast) var(--gooee-ease-morph),
|
|
29
|
+
color var(--gooee-motion-fast) var(--gooee-ease-morph),
|
|
30
|
+
box-shadow var(--gooee-motion-fast) var(--gooee-ease-morph);
|
|
30
31
|
}
|
|
31
32
|
|
|
32
33
|
/* The soft edge (internal/softPress.ts): while pressed, hovered by a mouse or letting go, an SVG draws
|
|
@@ -36,7 +37,7 @@
|
|
|
36
37
|
background: transparent;
|
|
37
38
|
border-color: transparent;
|
|
38
39
|
box-shadow: none;
|
|
39
|
-
transition: color var(--gooee-motion-fast) var(--gooee-ease-
|
|
40
|
+
transition: color var(--gooee-motion-fast) var(--gooee-ease-morph);
|
|
40
41
|
}
|
|
41
42
|
|
|
42
43
|
.root[data-soft]:focus-visible { box-shadow: var(--gooee-focus-ring); }
|
|
@@ -51,7 +52,7 @@
|
|
|
51
52
|
|
|
52
53
|
.softFill {
|
|
53
54
|
fill: var(--bg);
|
|
54
|
-
transition: fill var(--gooee-motion-fast) var(--gooee-ease-
|
|
55
|
+
transition: fill var(--gooee-motion-fast) var(--gooee-ease-morph);
|
|
55
56
|
}
|
|
56
57
|
|
|
57
58
|
.softRing { fill: var(--line); }
|
|
@@ -82,12 +83,12 @@
|
|
|
82
83
|
|
|
83
84
|
/* aria-disabled looks the same as disabled but stays focusable, so focus is not lost and the reason it points to stays readable. */
|
|
84
85
|
.root:disabled,
|
|
85
|
-
.root[aria-disabled="true"]:not([data-loading]) {
|
|
86
|
+
.root[aria-disabled="true"]:not([data-status="loading"]) {
|
|
86
87
|
cursor: not-allowed;
|
|
87
88
|
opacity: var(--gooee-disabled-opacity);
|
|
88
89
|
}
|
|
89
90
|
|
|
90
|
-
.root[data-loading] {
|
|
91
|
+
.root[data-status="loading"] {
|
|
91
92
|
cursor: progress;
|
|
92
93
|
}
|
|
93
94
|
|
|
@@ -124,7 +125,7 @@
|
|
|
124
125
|
|
|
125
126
|
.danger {
|
|
126
127
|
--bg: var(--gooee-color-danger-solid);
|
|
127
|
-
color: var(--gooee-color-
|
|
128
|
+
color: var(--gooee-color-danger-fg);
|
|
128
129
|
font-weight: var(--gooee-weight-semibold);
|
|
129
130
|
box-shadow: var(--gooee-shadow-1);
|
|
130
131
|
}
|
|
@@ -144,9 +145,9 @@
|
|
|
144
145
|
justify-content: center;
|
|
145
146
|
gap: var(--gooee-space-3);
|
|
146
147
|
transition:
|
|
147
|
-
opacity var(--gooee-motion-base) var(--gooee-ease-
|
|
148
|
-
transform var(--gooee-motion-slow) var(--gooee-ease-
|
|
149
|
-
filter var(--gooee-motion-base) var(--gooee-ease-
|
|
148
|
+
opacity var(--gooee-motion-base) var(--gooee-ease-morph),
|
|
149
|
+
transform var(--gooee-motion-slow) var(--gooee-ease-morph),
|
|
150
|
+
filter var(--gooee-motion-base) var(--gooee-ease-morph);
|
|
150
151
|
}
|
|
151
152
|
|
|
152
153
|
.content { max-width: 100%; }
|
|
@@ -179,13 +180,14 @@
|
|
|
179
180
|
transform: translateY(var(--gooee-shift-md)) scale(0.6);
|
|
180
181
|
}
|
|
181
182
|
|
|
182
|
-
.root[data-loading] .content {
|
|
183
|
+
.root[data-status="loading"] .content {
|
|
183
184
|
opacity: 0;
|
|
184
185
|
transform: translateY(calc(var(--gooee-shift-md) * -1)) scale(0.92);
|
|
185
186
|
filter: blur(2px);
|
|
186
187
|
}
|
|
187
188
|
|
|
188
|
-
.root[data-loading] .spinner {
|
|
189
|
+
.root[data-status="loading"] .spinner {
|
|
189
190
|
opacity: 1;
|
|
190
191
|
transform: none;
|
|
191
192
|
}
|
|
193
|
+
}
|
|
@@ -64,7 +64,9 @@ export function Button({
|
|
|
64
64
|
'aria-describedby': describedBy,
|
|
65
65
|
title: rest.title ?? reason,
|
|
66
66
|
className: cx(styles.root, styles[variant], styles[size], fullWidth && styles.full, className),
|
|
67
|
-
'data-
|
|
67
|
+
'data-slot': 'button',
|
|
68
|
+
'data-status': loading ? 'loading' : undefined,
|
|
69
|
+
'data-disabled': Boolean(rest.disabled) || undefined,
|
|
68
70
|
'aria-busy': loading || undefined,
|
|
69
71
|
'aria-disabled': inert || undefined,
|
|
70
72
|
onClick: (e: MouseEvent<HTMLButtonElement>) => {
|
|
@@ -103,9 +105,9 @@ export function Button({
|
|
|
103
105
|
const inner = (
|
|
104
106
|
<>
|
|
105
107
|
<span className={styles.content}>
|
|
106
|
-
{leadingIcon && <span className={styles.icon}>{leadingIcon}</span>}
|
|
107
|
-
<span className={styles.label}>{children}</span>
|
|
108
|
-
{trailingIcon && <span className={styles.icon}>{trailingIcon}</span>}
|
|
108
|
+
{leadingIcon && <span data-slot="button-icon" className={styles.icon}>{leadingIcon}</span>}
|
|
109
|
+
<span data-slot="button-label" className={styles.label}>{children}</span>
|
|
110
|
+
{trailingIcon && <span data-slot="button-icon" className={styles.icon}>{trailingIcon}</span>}
|
|
109
111
|
</span>
|
|
110
112
|
<span className={styles.spinner} aria-hidden="true">
|
|
111
113
|
{loading && <Spinner size="sm" label={null} />}
|