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
|
@@ -2,49 +2,52 @@
|
|
|
2
2
|
import { computed, nextTick, onBeforeUnmount, onMounted, ref, useId, watch } from 'vue'
|
|
3
3
|
import FieldMessage from '../../internal/FieldMessage.vue'
|
|
4
4
|
import { dismissable } from '../../internal/motion/layers'
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
5
|
+
import { createMorph } from '../../internal/motion/liquid'
|
|
6
|
+
import { createEdgeFlow } from '../../internal/motion/liquidMore'
|
|
7
7
|
import { createListbox } from '../../internal/motion/listbox'
|
|
8
8
|
import { useFloating } from '../../internal/vue/useFloating'
|
|
9
9
|
import { usePresence } from '../../internal/vue/usePresence'
|
|
10
|
-
import { CheckIcon, ChevronDownIcon } from '../../
|
|
10
|
+
import { CheckIcon, ChevronDownIcon } from '../../icons/vue'
|
|
11
11
|
import styles from './Select.module.css'
|
|
12
12
|
|
|
13
13
|
// The Vue Select: the same look (Select.module.css), list morph, focus edge and keys as the React one.
|
|
14
14
|
|
|
15
15
|
export type SelectOption = { value: string; label: string; disabled?: boolean; hint?: string }
|
|
16
16
|
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
17
|
+
export type SelectLabels = {
|
|
18
|
+
/** Shown in the open list when there are no options. */
|
|
19
|
+
empty: string
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
const { hideLabel = false, options, defaultValue = null, placeholder = 'Choose one', help, error, labels: labelsProp, disabled, id } = defineProps<{
|
|
23
|
+
/** Visible name of the field, also read by screen readers. */
|
|
24
|
+
label: string
|
|
25
|
+
/** Keeps the label for screen readers only, for a list where a column heading already names the field. */
|
|
26
|
+
hideLabel?: boolean
|
|
27
|
+
/** Choices in the list, in order. */
|
|
28
|
+
options: SelectOption[]
|
|
29
|
+
/** Starting value when there is no v-model. */
|
|
30
|
+
defaultValue?: string | null
|
|
31
|
+
/** Shown when nothing is chosen yet. */
|
|
32
|
+
placeholder?: string
|
|
33
|
+
/** Hint under the field. Hidden while an error shows. */
|
|
34
|
+
help?: string
|
|
35
|
+
/** Error message under the field. Also marks the field invalid. */
|
|
36
|
+
error?: string
|
|
37
|
+
/** Text in the open list, so you can translate it. Missing keys use the English defaults. */
|
|
38
|
+
labels?: Partial<SelectLabels>
|
|
39
|
+
/** Stops the list from opening. */
|
|
40
|
+
disabled?: boolean
|
|
41
|
+
/** Submits the selected value in a hidden field with this name. */
|
|
42
|
+
name?: string
|
|
43
|
+
/** Id of the button, so a label's `for` can point at it. Inner ids add a suffix to it. */
|
|
44
|
+
id?: string
|
|
45
|
+
}>()
|
|
46
|
+
const labels = computed<SelectLabels>(() => ({ empty: 'No options', ...labelsProp }))
|
|
44
47
|
|
|
45
48
|
/** The selected value. Use v-model, or leave it out and the field keeps its own. Null means nothing is chosen. */
|
|
46
49
|
const model = defineModel<string | null>()
|
|
47
|
-
const local = ref(
|
|
50
|
+
const local = ref(defaultValue)
|
|
48
51
|
const value = computed({
|
|
49
52
|
get: () => (model.value === undefined ? local.value : model.value),
|
|
50
53
|
set: (next: string | null) => {
|
|
@@ -54,13 +57,13 @@ const value = computed({
|
|
|
54
57
|
})
|
|
55
58
|
|
|
56
59
|
const auto = useId()
|
|
57
|
-
const baseId = computed(() =>
|
|
60
|
+
const baseId = computed(() => id ?? auto)
|
|
58
61
|
const labelId = computed(() => `${baseId.value}-label`)
|
|
59
62
|
const listId = computed(() => `${baseId.value}-list`)
|
|
60
63
|
const helpId = computed(() => `${baseId.value}-help`)
|
|
61
64
|
const errorId = computed(() => `${baseId.value}-error`)
|
|
62
65
|
const emptyId = computed(() => `${baseId.value}-empty`)
|
|
63
|
-
const triggerId = computed(() =>
|
|
66
|
+
const triggerId = computed(() => id ?? `${auto}-trigger`)
|
|
64
67
|
|
|
65
68
|
const open = ref(false)
|
|
66
69
|
const active = ref(-1)
|
|
@@ -70,15 +73,15 @@ const optionEls: Array<HTMLElement | null> = []
|
|
|
70
73
|
const { mounted, state } = usePresence(open, 'morph-out')
|
|
71
74
|
const { style, side, ready } = useFloating(trigger, listEl, mounted, { side: 'bottom', align: 'start', offset: 6, matchWidth: true })
|
|
72
75
|
// Vue, unlike React, adds no px to a number in a style.
|
|
73
|
-
const selectedIndex = computed(() =>
|
|
74
|
-
const selected = computed(() => (selectedIndex.value >= 0 ?
|
|
76
|
+
const selectedIndex = computed(() => options.findIndex((o) => o.value === value.value))
|
|
77
|
+
const selected = computed(() => (selectedIndex.value >= 0 ? options[selectedIndex.value] : null))
|
|
75
78
|
|
|
76
79
|
// Arrows, Home, End, Enter, Space, Tab and type-ahead (motion/listbox.ts).
|
|
77
|
-
const list = createListbox(() =>
|
|
80
|
+
const list = createListbox(() => options)
|
|
78
81
|
const { enabled, first } = list
|
|
79
82
|
|
|
80
83
|
const openList = (at?: number) => {
|
|
81
|
-
if (
|
|
84
|
+
if (disabled) return
|
|
82
85
|
open.value = true
|
|
83
86
|
active.value = at ?? (enabled(selectedIndex.value) ? selectedIndex.value : first())
|
|
84
87
|
}
|
|
@@ -88,7 +91,7 @@ const close = (focusTrigger = true) => {
|
|
|
88
91
|
}
|
|
89
92
|
const choose = (i: number) => {
|
|
90
93
|
if (!enabled(i)) return
|
|
91
|
-
value.value =
|
|
94
|
+
value.value = options[i].value
|
|
92
95
|
close()
|
|
93
96
|
}
|
|
94
97
|
|
|
@@ -100,16 +103,13 @@ const onKeyDown = (e: KeyboardEvent) => {
|
|
|
100
103
|
else if (r.active !== undefined) active.value = r.active
|
|
101
104
|
if (r.choose) choose(active.value)
|
|
102
105
|
if (r.tab) {
|
|
103
|
-
if (enabled(active.value)) value.value =
|
|
106
|
+
if (enabled(active.value)) value.value = options[active.value].value
|
|
104
107
|
open.value = false
|
|
105
108
|
}
|
|
106
109
|
}
|
|
107
110
|
|
|
108
111
|
// The list grows out of the field and folds back into it (motion/liquid.ts).
|
|
109
|
-
const liquid =
|
|
110
|
-
() => listEl.value,
|
|
111
|
-
() => trigger.value,
|
|
112
|
-
)
|
|
112
|
+
const liquid = createMorph(() => listEl.value, { origin: () => trigger.value })
|
|
113
113
|
// Waits for the render that puts the list in its place, so the grow starts from the right shape.
|
|
114
114
|
watch(
|
|
115
115
|
[state, ready],
|
|
@@ -149,7 +149,7 @@ watch(
|
|
|
149
149
|
// Open or keyboard focused, the field's dark edge flows round it from where it was pressed (motion/liquidMore.ts).
|
|
150
150
|
let stopEdge = () => {}
|
|
151
151
|
onMounted(() => {
|
|
152
|
-
if (trigger.value) stopEdge =
|
|
152
|
+
if (trigger.value) stopEdge = createEdgeFlow(trigger.value, { when: ':is([data-state="open"], :focus-visible)', className: styles.edge }).destroy
|
|
153
153
|
})
|
|
154
154
|
onBeforeUnmount(() => {
|
|
155
155
|
stopEdge()
|
|
@@ -157,15 +157,15 @@ onBeforeUnmount(() => {
|
|
|
157
157
|
liquid.destroy()
|
|
158
158
|
})
|
|
159
159
|
|
|
160
|
-
const empty = computed(() =>
|
|
160
|
+
const empty = computed(() => options.length === 0)
|
|
161
161
|
const describedBy = computed(
|
|
162
|
-
() => [
|
|
162
|
+
() => [help && !error ? helpId.value : null, error ? errorId.value : null, open.value && empty.value ? emptyId.value : null].filter(Boolean).join(' ') || undefined,
|
|
163
163
|
)
|
|
164
164
|
</script>
|
|
165
165
|
|
|
166
166
|
<template>
|
|
167
|
-
<div :class="styles.root">
|
|
168
|
-
<span :id="labelId" :class="[styles.label, hideLabel && styles.hiddenLabel]" @click="trigger?.focus()">
|
|
167
|
+
<div :class="styles.root" data-slot="select">
|
|
168
|
+
<span :id="labelId" :class="[styles.label, hideLabel && styles.hiddenLabel]" data-slot="field-label" @click="trigger?.focus()">
|
|
169
169
|
{{ label }}
|
|
170
170
|
</span>
|
|
171
171
|
<button
|
|
@@ -174,7 +174,8 @@ const describedBy = computed(
|
|
|
174
174
|
type="button"
|
|
175
175
|
role="combobox"
|
|
176
176
|
:class="styles.trigger"
|
|
177
|
-
|
|
177
|
+
data-slot="select-trigger"
|
|
178
|
+
:data-state="open ? 'open' : 'closed'"
|
|
178
179
|
:data-invalid="error ? true : undefined"
|
|
179
180
|
:aria-labelledby="`${labelId} ${triggerId}`"
|
|
180
181
|
aria-haspopup="listbox"
|
|
@@ -187,12 +188,12 @@ const describedBy = computed(
|
|
|
187
188
|
@click="open ? close() : openList()"
|
|
188
189
|
@keydown="onKeyDown"
|
|
189
190
|
>
|
|
190
|
-
<span :class="[styles.value, !selected && styles.placeholder]">
|
|
191
|
+
<span :class="[styles.value, !selected && styles.placeholder]" data-slot="select-value">
|
|
191
192
|
<span :key="selected?.value ?? 'none'" :class="styles.valueText" :title="selected ? selected.label : placeholder">
|
|
192
193
|
{{ selected ? selected.label : placeholder }}
|
|
193
194
|
</span>
|
|
194
195
|
</span>
|
|
195
|
-
<ChevronDownIcon :class="styles.chevron" />
|
|
196
|
+
<ChevronDownIcon :class="styles.chevron" data-slot="select-icon" />
|
|
196
197
|
</button>
|
|
197
198
|
<input v-if="name" type="hidden" :name="name" :value="value ?? ''" />
|
|
198
199
|
<FieldMessage :help-id="helpId" :error-id="errorId" :help="help" :error="error" />
|
|
@@ -204,12 +205,13 @@ const describedBy = computed(
|
|
|
204
205
|
:aria-labelledby="labelId"
|
|
205
206
|
tabindex="-1"
|
|
206
207
|
:class="styles.list"
|
|
208
|
+
data-slot="select-list"
|
|
207
209
|
:data-state="state"
|
|
208
210
|
:data-side="side"
|
|
209
211
|
:style="style"
|
|
210
212
|
@mousedown.prevent
|
|
211
213
|
>
|
|
212
|
-
<span v-if="hl" :class="styles.highlight" :style="{ transform: `translateY(${hl.top}px)`, height: `${hl.height}px` }" aria-hidden="true" />
|
|
214
|
+
<span v-if="hl" :class="styles.highlight" data-slot="select-highlight" :style="{ transform: `translateY(${hl.top}px)`, height: `${hl.height}px` }" aria-hidden="true" />
|
|
213
215
|
<div
|
|
214
216
|
v-for="(o, i) in options"
|
|
215
217
|
:id="`${baseId}-opt-${i}`"
|
|
@@ -219,16 +221,19 @@ const describedBy = computed(
|
|
|
219
221
|
:aria-selected="o.value === value"
|
|
220
222
|
:aria-disabled="o.disabled || undefined"
|
|
221
223
|
:class="styles.option"
|
|
222
|
-
|
|
224
|
+
data-slot="select-option"
|
|
225
|
+
:data-highlighted="i === active || undefined"
|
|
226
|
+
:data-selected="o.value === value || undefined"
|
|
227
|
+
:data-disabled="o.disabled || undefined"
|
|
223
228
|
:style="{ '--i': i }"
|
|
224
229
|
@pointermove="enabled(i) && active !== i && (active = i)"
|
|
225
230
|
@click="choose(i)"
|
|
226
231
|
>
|
|
227
|
-
<span :class="styles.optionText">{{ o.label }}<span v-if="o.hint" :class="styles.hint">{{ o.hint }}</span></span>
|
|
228
|
-
<CheckIcon :class="styles.check"
|
|
232
|
+
<span :class="styles.optionText" data-slot="select-option-text">{{ o.label }}<span v-if="o.hint" :class="styles.hint" data-slot="select-option-hint">{{ o.hint }}</span></span>
|
|
233
|
+
<CheckIcon :class="styles.check" data-slot="select-option-indicator" />
|
|
229
234
|
</div>
|
|
230
|
-
<div v-if="empty" :id="emptyId" :class="styles.empty">
|
|
231
|
-
{{
|
|
235
|
+
<div v-if="empty" :id="emptyId" :class="styles.empty" data-slot="select-empty">
|
|
236
|
+
{{ labels.empty }}
|
|
232
237
|
</div>
|
|
233
238
|
</div>
|
|
234
239
|
</Teleport>
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
@layer gooee.components {
|
|
1
2
|
.overlay {
|
|
2
3
|
position: fixed;
|
|
3
4
|
inset: 0;
|
|
@@ -76,7 +77,7 @@
|
|
|
76
77
|
margin: var(--gooee-space-3) auto 0;
|
|
77
78
|
border-radius: var(--gooee-radius-full);
|
|
78
79
|
background: var(--gooee-color-border-strong);
|
|
79
|
-
transition: width var(--gooee-motion-base) var(--gooee-ease-
|
|
80
|
+
transition: width var(--gooee-motion-base) var(--gooee-ease-morph);
|
|
80
81
|
}
|
|
81
82
|
|
|
82
83
|
.sheet[data-dragging] .handle { width: var(--gooee-handle-w-active); }
|
|
@@ -131,7 +132,7 @@
|
|
|
131
132
|
color: var(--gooee-color-fg-muted);
|
|
132
133
|
font-size: var(--gooee-icon-lg);
|
|
133
134
|
cursor: pointer;
|
|
134
|
-
transition: background-color var(--gooee-motion-fast) var(--gooee-ease-
|
|
135
|
+
transition: background-color var(--gooee-motion-fast) var(--gooee-ease-morph);
|
|
135
136
|
}
|
|
136
137
|
|
|
137
138
|
/* Looks 32px, keeps a 44px touch area. */
|
|
@@ -211,8 +212,8 @@
|
|
|
211
212
|
border-radius: var(--gooee-radius-full);
|
|
212
213
|
background: var(--gooee-color-border-strong);
|
|
213
214
|
transition:
|
|
214
|
-
width var(--gooee-motion-base) var(--gooee-ease-
|
|
215
|
-
background-color var(--gooee-motion-fast) var(--gooee-ease-
|
|
215
|
+
width var(--gooee-motion-base) var(--gooee-ease-morph),
|
|
216
|
+
background-color var(--gooee-motion-fast) var(--gooee-ease-morph);
|
|
216
217
|
}
|
|
217
218
|
|
|
218
219
|
.grabber[data-detent="peek"] .pill { width: var(--gooee-handle-w-short); }
|
|
@@ -233,3 +234,4 @@
|
|
|
233
234
|
clip-path: inset(50%);
|
|
234
235
|
white-space: nowrap;
|
|
235
236
|
}
|
|
237
|
+
}
|
|
@@ -4,7 +4,7 @@ import { useEffect, useId, useLayoutEffect, useRef, useState, type ReactNode, ty
|
|
|
4
4
|
import { cx } from '../../internal/cx'
|
|
5
5
|
import { useDragClose } from '../../internal/fling'
|
|
6
6
|
import { useFocusTrap } from '../../internal/focus'
|
|
7
|
-
import { XIcon } from '../../
|
|
7
|
+
import { XIcon } from '../../icons/icons'
|
|
8
8
|
import { createDetentSheet, DETENT_NAME, detentHeights, detentOrder, type SheetDetent } from '../../internal/motion/sheetDetents'
|
|
9
9
|
import { useDismiss, useScrollLock } from '../../internal/layers'
|
|
10
10
|
import { Portal } from '../../internal/Portal'
|
|
@@ -26,8 +26,6 @@ export type SheetProps = {
|
|
|
26
26
|
children?: ReactNode
|
|
27
27
|
/** Sticky actions at the bottom of the sheet. */
|
|
28
28
|
footer?: ReactNode
|
|
29
|
-
/** Screen reader name for the close button. */
|
|
30
|
-
closeLabel?: string
|
|
31
29
|
/** Element to focus first. Defaults to the first focusable element in the content. */
|
|
32
30
|
initialFocus?: RefObject<HTMLElement | null>
|
|
33
31
|
/** Extra class for the panel. */
|
|
@@ -40,11 +38,20 @@ export type SheetProps = {
|
|
|
40
38
|
defaultDetent?: SheetDetent
|
|
41
39
|
/** Called with the new height after a drag, a tap or a key on the grabber, or Esc. */
|
|
42
40
|
onDetentChange?: (detent: SheetDetent) => void
|
|
41
|
+
/** Text for the sheet's controls, so you can translate it. Missing keys use the English defaults. */
|
|
42
|
+
labels?: Partial<SheetLabels>
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
export type SheetLabels = {
|
|
46
|
+
/** Screen reader name for the close button. */
|
|
47
|
+
close: string
|
|
43
48
|
/** Screen reader name for the grabber, which sets the height. */
|
|
44
|
-
|
|
49
|
+
height: string
|
|
45
50
|
}
|
|
46
51
|
|
|
47
|
-
|
|
52
|
+
const defaultLabels: SheetLabels = { close: 'Close', height: 'Sheet height' }
|
|
53
|
+
|
|
54
|
+
type BaseProps = Omit<SheetProps, 'detents' | 'detent' | 'defaultDetent' | 'onDetentChange' | 'labels'> & { labels: SheetLabels }
|
|
48
55
|
|
|
49
56
|
/** With detents, the grabber becomes a control for the height, and the sheet is modal only at its highest. */
|
|
50
57
|
export function Sheet({
|
|
@@ -54,21 +61,21 @@ export function Sheet({
|
|
|
54
61
|
description,
|
|
55
62
|
children,
|
|
56
63
|
footer,
|
|
57
|
-
closeLabel = 'Close',
|
|
58
64
|
initialFocus,
|
|
59
65
|
className,
|
|
60
66
|
detents,
|
|
61
67
|
detent,
|
|
62
68
|
defaultDetent,
|
|
63
69
|
onDetentChange,
|
|
64
|
-
|
|
70
|
+
labels: labelsProp,
|
|
65
71
|
}: SheetProps) {
|
|
66
|
-
const
|
|
72
|
+
const labels = { ...defaultLabels, ...labelsProp }
|
|
73
|
+
const base = { open, onOpenChange, title, description, children, footer, labels, initialFocus, className }
|
|
67
74
|
if (!detents?.length) return <PlainSheet {...base} />
|
|
68
|
-
return <DetentSheet {...base} detents={detents} detent={detent} defaultDetent={defaultDetent} onDetentChange={onDetentChange}
|
|
75
|
+
return <DetentSheet {...base} detents={detents} detent={detent} defaultDetent={defaultDetent} onDetentChange={onDetentChange} />
|
|
69
76
|
}
|
|
70
77
|
|
|
71
|
-
function PlainSheet({ open, onOpenChange, title, description, children, footer,
|
|
78
|
+
function PlainSheet({ open, onOpenChange, title, description, children, footer, labels, initialFocus, className }: BaseProps) {
|
|
72
79
|
const id = useId()
|
|
73
80
|
const panelRef = useRef<HTMLDivElement>(null)
|
|
74
81
|
const { mounted, state } = usePresence(open, 'morph-out')
|
|
@@ -81,7 +88,7 @@ function PlainSheet({ open, onOpenChange, title, description, children, footer,
|
|
|
81
88
|
if (!mounted) return null
|
|
82
89
|
return (
|
|
83
90
|
<Portal>
|
|
84
|
-
<div className={styles.overlay} data-state={state} aria-hidden="true" />
|
|
91
|
+
<div className={styles.overlay} data-slot="sheet-overlay" data-state={state} aria-hidden="true" />
|
|
85
92
|
<div
|
|
86
93
|
ref={panelRef}
|
|
87
94
|
role="dialog"
|
|
@@ -90,6 +97,7 @@ function PlainSheet({ open, onOpenChange, title, description, children, footer,
|
|
|
90
97
|
aria-describedby={description ? `${id}-desc` : undefined}
|
|
91
98
|
tabIndex={-1}
|
|
92
99
|
className={cx(styles.sheet, className)}
|
|
100
|
+
data-slot="sheet-content"
|
|
93
101
|
data-state={state}
|
|
94
102
|
onAnimationEnd={(e) => {
|
|
95
103
|
if (e.target === panelRef.current && state === 'open') panelRef.current.style.transform = ''
|
|
@@ -99,27 +107,27 @@ function PlainSheet({ open, onOpenChange, title, description, children, footer,
|
|
|
99
107
|
className={styles.grab}
|
|
100
108
|
{...grab}
|
|
101
109
|
>
|
|
102
|
-
<span className={styles.handle} aria-hidden="true" />
|
|
103
|
-
<header className={styles.header}>
|
|
110
|
+
<span className={styles.handle} data-slot="sheet-handle" aria-hidden="true" />
|
|
111
|
+
<header className={styles.header} data-slot="sheet-header">
|
|
104
112
|
<div className={styles.titles}>
|
|
105
|
-
<h2 id={`${id}-title`} className={styles.title}>{title}</h2>
|
|
106
|
-
{description && <p id={`${id}-desc`} className={styles.description}>{description}</p>}
|
|
113
|
+
<h2 id={`${id}-title`} className={styles.title} data-slot="sheet-title">{title}</h2>
|
|
114
|
+
{description && <p id={`${id}-desc`} className={styles.description} data-slot="sheet-description">{description}</p>}
|
|
107
115
|
</div>
|
|
108
|
-
<button type="button" className={styles.close} aria-label={
|
|
116
|
+
<button type="button" className={styles.close} data-slot="sheet-close" aria-label={labels.close} data-skip-initial-focus onClick={() => onOpenChange(false)}>
|
|
109
117
|
<XIcon />
|
|
110
118
|
</button>
|
|
111
119
|
</header>
|
|
112
120
|
</div>
|
|
113
|
-
{children && <div className={styles.body}>{children}</div>}
|
|
114
|
-
{footer && <footer className={styles.footer}>{footer}</footer>}
|
|
121
|
+
{children && <div className={styles.body} data-slot="sheet-body">{children}</div>}
|
|
122
|
+
{footer && <footer className={styles.footer} data-slot="sheet-footer">{footer}</footer>}
|
|
115
123
|
</div>
|
|
116
124
|
</Portal>
|
|
117
125
|
)
|
|
118
126
|
}
|
|
119
127
|
|
|
120
|
-
type DetentProps = BaseProps & Required<Pick<SheetProps, 'detents'
|
|
128
|
+
type DetentProps = BaseProps & Required<Pick<SheetProps, 'detents'>> & Pick<SheetProps, 'detent' | 'defaultDetent' | 'onDetentChange'>
|
|
121
129
|
|
|
122
|
-
function DetentSheet({ open, onOpenChange, title, description, children, footer,
|
|
130
|
+
function DetentSheet({ open, onOpenChange, title, description, children, footer, labels, initialFocus, className, detents, detent, defaultDetent, onDetentChange }: DetentProps) {
|
|
123
131
|
const id = useId()
|
|
124
132
|
const order = detentOrder(detents)
|
|
125
133
|
const top = order.length - 1
|
|
@@ -216,7 +224,7 @@ function DetentSheet({ open, onOpenChange, title, description, children, footer,
|
|
|
216
224
|
const shown = order[dragging ? target : index]
|
|
217
225
|
return (
|
|
218
226
|
<Portal>
|
|
219
|
-
<div ref={overlayRef} className={styles.overlay} data-state={state} data-detents data-top={atTop || undefined} aria-hidden="true" />
|
|
227
|
+
<div ref={overlayRef} className={styles.overlay} data-slot="sheet-overlay" data-state={state} data-detents data-top={atTop || undefined} aria-hidden="true" />
|
|
220
228
|
<div
|
|
221
229
|
ref={panelRef}
|
|
222
230
|
role="dialog"
|
|
@@ -226,6 +234,7 @@ function DetentSheet({ open, onOpenChange, title, description, children, footer,
|
|
|
226
234
|
tabIndex={-1}
|
|
227
235
|
id={`${id}-sheet`}
|
|
228
236
|
className={cx(styles.sheet, className)}
|
|
237
|
+
data-slot="sheet-content"
|
|
229
238
|
data-state={state}
|
|
230
239
|
data-detents
|
|
231
240
|
data-top={atTop || undefined}
|
|
@@ -237,9 +246,10 @@ function DetentSheet({ open, onOpenChange, title, description, children, footer,
|
|
|
237
246
|
<div
|
|
238
247
|
ref={grabRef}
|
|
239
248
|
className={styles.grabber}
|
|
249
|
+
data-slot="sheet-grabber"
|
|
240
250
|
role="slider"
|
|
241
251
|
tabIndex={0}
|
|
242
|
-
aria-label={
|
|
252
|
+
aria-label={labels.height}
|
|
243
253
|
aria-orientation="vertical"
|
|
244
254
|
aria-valuemin={0}
|
|
245
255
|
aria-valuemax={top}
|
|
@@ -250,19 +260,19 @@ function DetentSheet({ open, onOpenChange, title, description, children, footer,
|
|
|
250
260
|
onKeyDown={sheet.grabKey}
|
|
251
261
|
onClick={sheet.grabClick}
|
|
252
262
|
>
|
|
253
|
-
<span className={styles.pill} />
|
|
263
|
+
<span className={styles.pill} data-slot="sheet-handle" />
|
|
254
264
|
</div>
|
|
255
|
-
<header className={styles.header}>
|
|
265
|
+
<header className={styles.header} data-slot="sheet-header">
|
|
256
266
|
<div className={styles.titles}>
|
|
257
|
-
<h2 id={`${id}-title`} className={styles.title}>{title}</h2>
|
|
258
|
-
{description && <p id={`${id}-desc`} className={styles.description}>{description}</p>}
|
|
267
|
+
<h2 id={`${id}-title`} className={styles.title} data-slot="sheet-title">{title}</h2>
|
|
268
|
+
{description && <p id={`${id}-desc`} className={styles.description} data-slot="sheet-description">{description}</p>}
|
|
259
269
|
</div>
|
|
260
|
-
<button type="button" className={styles.close} aria-label={
|
|
270
|
+
<button type="button" className={styles.close} data-slot="sheet-close" aria-label={labels.close} data-skip-initial-focus onClick={() => onOpenChange(false)}>
|
|
261
271
|
<XIcon />
|
|
262
272
|
</button>
|
|
263
273
|
</header>
|
|
264
|
-
{children && <div ref={bodyRef} className={styles.body}>{children}</div>}
|
|
265
|
-
{footer && <footer className={styles.footer}>{footer}</footer>}
|
|
274
|
+
{children && <div ref={bodyRef} className={styles.body} data-slot="sheet-body">{children}</div>}
|
|
275
|
+
{footer && <footer className={styles.footer} data-slot="sheet-footer">{footer}</footer>}
|
|
266
276
|
<p className={styles.srOnly} aria-live="polite">{said}</p>
|
|
267
277
|
</div>
|
|
268
278
|
</Portal>
|
|
@@ -5,7 +5,7 @@ import { trapFocus } from '../../internal/motion/focus'
|
|
|
5
5
|
import { dismissable, lockScroll } from '../../internal/motion/layers'
|
|
6
6
|
import { createDetentSheet, DETENT_NAME, detentHeights, detentOrder, type SheetDetent } from '../../internal/motion/sheetDetents'
|
|
7
7
|
import { usePresence } from '../../internal/vue/usePresence'
|
|
8
|
-
import { XIcon } from '../../
|
|
8
|
+
import { XIcon } from '../../icons/vue'
|
|
9
9
|
import styles from './Sheet.module.css'
|
|
10
10
|
|
|
11
11
|
// The Vue Sheet: the same look (Sheet.module.css), drag, heights and focus as the React one.
|
|
@@ -13,27 +13,30 @@ import styles from './Sheet.module.css'
|
|
|
13
13
|
// Other attributes, such as class, go to the panel.
|
|
14
14
|
defineOptions({ inheritAttrs: false })
|
|
15
15
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
16
|
+
export type SheetLabels = {
|
|
17
|
+
/** Screen reader name for the close button. */
|
|
18
|
+
close: string
|
|
19
|
+
/** Screen reader name for the grabber, which sets the height. */
|
|
20
|
+
height: string
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
const props = defineProps<{
|
|
24
|
+
/** Visible heading, also the dialog's accessible name. The title slot replaces it. */
|
|
25
|
+
title?: string
|
|
26
|
+
/** Text under the title, also read as the dialog's description. The description slot replaces it. */
|
|
27
|
+
description?: string
|
|
28
|
+
/** Element to focus first. Defaults to the first focusable element in the content. */
|
|
29
|
+
initialFocus?: HTMLElement | null
|
|
30
|
+
/** Heights the sheet rests at, such as ['peek', 'half', 'full']. Below the highest one it is not modal: the page behind stays usable. */
|
|
31
|
+
detents?: SheetDetent[]
|
|
32
|
+
/** The height it rests at. Use v-model:detent to control it. */
|
|
33
|
+
detent?: SheetDetent
|
|
34
|
+
/** The height it opens at when you do not control it. Defaults to the lowest. */
|
|
35
|
+
defaultDetent?: SheetDetent
|
|
36
|
+
/** Text for the sheet's controls, so you can translate it. Missing keys use the English defaults. */
|
|
37
|
+
labels?: Partial<SheetLabels>
|
|
38
|
+
}>()
|
|
39
|
+
const labels = computed<SheetLabels>(() => ({ close: 'Close', height: 'Sheet height', ...props.labels }))
|
|
37
40
|
/** Whether the sheet is open. Use v-model:open; Esc, an outside tap, a drag or the close button set it false. */
|
|
38
41
|
const open = defineModel<boolean>('open', { required: true })
|
|
39
42
|
const emit = defineEmits<{ 'update:detent': [detent: SheetDetent] }>()
|
|
@@ -155,7 +158,7 @@ watch(mounted, () => hold('touch', withDetents.value && !!body.value && (() => s
|
|
|
155
158
|
|
|
156
159
|
onBeforeUnmount(() => {
|
|
157
160
|
Object.values(releases).forEach((r) => r())
|
|
158
|
-
drag.
|
|
161
|
+
drag.destroy()
|
|
159
162
|
sheet.destroy()
|
|
160
163
|
if (!server) window.removeEventListener('resize', onResize)
|
|
161
164
|
})
|
|
@@ -164,7 +167,7 @@ onBeforeUnmount(() => {
|
|
|
164
167
|
<template>
|
|
165
168
|
<Teleport v-if="mounted" to="body">
|
|
166
169
|
<template v-if="!withDetents">
|
|
167
|
-
<div :class="styles.overlay" :data-state="state" aria-hidden="true" />
|
|
170
|
+
<div :class="styles.overlay" data-slot="sheet-overlay" :data-state="state" aria-hidden="true" />
|
|
168
171
|
<div
|
|
169
172
|
v-bind="$attrs"
|
|
170
173
|
ref="panel"
|
|
@@ -174,27 +177,28 @@ onBeforeUnmount(() => {
|
|
|
174
177
|
:aria-describedby="hasDescription ? `${id}-desc` : undefined"
|
|
175
178
|
tabindex="-1"
|
|
176
179
|
:class="styles.sheet"
|
|
180
|
+
data-slot="sheet-content"
|
|
177
181
|
:data-state="state"
|
|
178
182
|
@animationend="onAnimationEnd"
|
|
179
183
|
>
|
|
180
184
|
<div :class="styles.grab" @pointerdown="drag.down" @pointermove="drag.move" @pointerup="drag.up" @pointercancel="drag.up">
|
|
181
|
-
<span :class="styles.handle" aria-hidden="true" />
|
|
182
|
-
<header :class="styles.header">
|
|
185
|
+
<span :class="styles.handle" data-slot="sheet-handle" aria-hidden="true" />
|
|
186
|
+
<header :class="styles.header" data-slot="sheet-header">
|
|
183
187
|
<div :class="styles.titles">
|
|
184
|
-
<h2 :id="`${id}-title`" :class="styles.title"><slot name="title">{{ title }}</slot></h2>
|
|
185
|
-
<p v-if="hasDescription" :id="`${id}-desc`" :class="styles.description"><slot name="description">{{ description }}</slot></p>
|
|
188
|
+
<h2 :id="`${id}-title`" :class="styles.title" data-slot="sheet-title"><slot name="title">{{ title }}</slot></h2>
|
|
189
|
+
<p v-if="hasDescription" :id="`${id}-desc`" :class="styles.description" data-slot="sheet-description"><slot name="description">{{ description }}</slot></p>
|
|
186
190
|
</div>
|
|
187
|
-
<button type="button" :class="styles.close" :aria-label="
|
|
191
|
+
<button type="button" :class="styles.close" data-slot="sheet-close" :aria-label="labels.close" data-skip-initial-focus="true" @click="close">
|
|
188
192
|
<XIcon />
|
|
189
193
|
</button>
|
|
190
194
|
</header>
|
|
191
195
|
</div>
|
|
192
|
-
<div v-if="slots.default" :class="styles.body"><slot /></div>
|
|
193
|
-
<footer v-if="slots.footer" :class="styles.footer"><slot name="footer" /></footer>
|
|
196
|
+
<div v-if="slots.default" :class="styles.body" data-slot="sheet-body"><slot /></div>
|
|
197
|
+
<footer v-if="slots.footer" :class="styles.footer" data-slot="sheet-footer"><slot name="footer" /></footer>
|
|
194
198
|
</div>
|
|
195
199
|
</template>
|
|
196
200
|
<template v-else>
|
|
197
|
-
<div ref="overlay" :class="styles.overlay" :data-state="state" data-detents="true" :data-top="atTop || undefined" aria-hidden="true" />
|
|
201
|
+
<div ref="overlay" :class="styles.overlay" data-slot="sheet-overlay" :data-state="state" data-detents="true" :data-top="atTop || undefined" aria-hidden="true" />
|
|
198
202
|
<div
|
|
199
203
|
v-bind="$attrs"
|
|
200
204
|
:id="`${id}-sheet`"
|
|
@@ -205,6 +209,7 @@ onBeforeUnmount(() => {
|
|
|
205
209
|
:aria-describedby="hasDescription ? `${id}-desc` : undefined"
|
|
206
210
|
tabindex="-1"
|
|
207
211
|
:class="styles.sheet"
|
|
212
|
+
data-slot="sheet-content"
|
|
208
213
|
:data-state="state"
|
|
209
214
|
data-detents="true"
|
|
210
215
|
:data-top="atTop || undefined"
|
|
@@ -216,9 +221,10 @@ onBeforeUnmount(() => {
|
|
|
216
221
|
<div
|
|
217
222
|
ref="grabber"
|
|
218
223
|
:class="styles.grabber"
|
|
224
|
+
data-slot="sheet-grabber"
|
|
219
225
|
role="slider"
|
|
220
226
|
tabindex="0"
|
|
221
|
-
:aria-label="
|
|
227
|
+
:aria-label="labels.height"
|
|
222
228
|
aria-orientation="vertical"
|
|
223
229
|
aria-valuemin="0"
|
|
224
230
|
:aria-valuemax="top"
|
|
@@ -229,19 +235,19 @@ onBeforeUnmount(() => {
|
|
|
229
235
|
@keydown="sheet.grabKey"
|
|
230
236
|
@click="sheet.grabClick"
|
|
231
237
|
>
|
|
232
|
-
<span :class="styles.pill" />
|
|
238
|
+
<span :class="styles.pill" data-slot="sheet-handle" />
|
|
233
239
|
</div>
|
|
234
|
-
<header :class="styles.header">
|
|
240
|
+
<header :class="styles.header" data-slot="sheet-header">
|
|
235
241
|
<div :class="styles.titles">
|
|
236
|
-
<h2 :id="`${id}-title`" :class="styles.title"><slot name="title">{{ title }}</slot></h2>
|
|
237
|
-
<p v-if="hasDescription" :id="`${id}-desc`" :class="styles.description"><slot name="description">{{ description }}</slot></p>
|
|
242
|
+
<h2 :id="`${id}-title`" :class="styles.title" data-slot="sheet-title"><slot name="title">{{ title }}</slot></h2>
|
|
243
|
+
<p v-if="hasDescription" :id="`${id}-desc`" :class="styles.description" data-slot="sheet-description"><slot name="description">{{ description }}</slot></p>
|
|
238
244
|
</div>
|
|
239
|
-
<button type="button" :class="styles.close" :aria-label="
|
|
245
|
+
<button type="button" :class="styles.close" data-slot="sheet-close" :aria-label="labels.close" data-skip-initial-focus="true" @click="close">
|
|
240
246
|
<XIcon />
|
|
241
247
|
</button>
|
|
242
248
|
</header>
|
|
243
|
-
<div v-if="slots.default" ref="body" :class="styles.body"><slot /></div>
|
|
244
|
-
<footer v-if="slots.footer" :class="styles.footer"><slot name="footer" /></footer>
|
|
249
|
+
<div v-if="slots.default" ref="body" :class="styles.body" data-slot="sheet-body"><slot /></div>
|
|
250
|
+
<footer v-if="slots.footer" :class="styles.footer" data-slot="sheet-footer"><slot name="footer" /></footer>
|
|
245
251
|
<p :class="styles.srOnly" aria-live="polite">{{ said }}</p>
|
|
246
252
|
</div>
|
|
247
253
|
</template>
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
@layer gooee.components {
|
|
1
2
|
.lines {
|
|
2
3
|
display: flex;
|
|
3
4
|
flex-direction: column;
|
|
@@ -23,8 +24,8 @@
|
|
|
23
24
|
}
|
|
24
25
|
|
|
25
26
|
.text { height: 0.8em; height: round(nearest, 0.8em, 4px); border-radius: var(--gooee-radius-xs); }
|
|
26
|
-
.rect { width: 100%; height: var(--gooee-skeleton-block); border-radius: var(--gooee-radius-md); }
|
|
27
|
-
.circle { width: var(--gooee-skeleton-avatar); height: var(--gooee-skeleton-avatar); border-radius: var(--gooee-radius-full); }
|
|
27
|
+
.rect { width: 100%; height: var(--gooee-skeleton-block, 120px); border-radius: var(--gooee-radius-md); }
|
|
28
|
+
.circle { width: var(--gooee-skeleton-avatar, 40px); height: var(--gooee-skeleton-avatar, 40px); border-radius: var(--gooee-radius-full); }
|
|
28
29
|
|
|
29
30
|
/* A sketch: the shapes as dashed pencil outlines, no fill. Text becomes dashed baselines. The lines
|
|
30
31
|
themselves fade gently instead of a shimmer, which would light up the empty box behind them. */
|
|
@@ -54,3 +55,4 @@
|
|
|
54
55
|
.bone::after { animation: none; display: none; }
|
|
55
56
|
.sketch { animation: none; }
|
|
56
57
|
}
|
|
58
|
+
}
|