@sparklingopinions/sparkling-ui 0.2.2 → 0.4.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 +1 -1
- package/dist/aliases.d.ts +47 -10
- package/dist/components/Avatar/Avatar.vue.d.ts +1 -1
- package/dist/components/Calendar/Calendar.js.map +1 -1
- package/dist/components/Calendar/Calendar.vue.d.ts +2 -2
- package/dist/components/Calendar/Calendar.vue_vue_type_script_setup_true_lang.js +6 -14
- package/dist/components/Calendar/Calendar.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/Dialog/Dialog.js.map +1 -1
- package/dist/components/Dialog/Dialog.vue_vue_type_script_setup_true_lang.js +26 -29
- package/dist/components/Dialog/Dialog.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/DropdownMenu/DropdownMenu.js.map +1 -1
- package/dist/components/DropdownMenu/DropdownMenu.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/components/DropdownMenu/DropdownMenu.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/Filters/FilterChip.js.map +1 -1
- package/dist/components/Filters/FilterChip.vue_vue_type_script_setup_true_lang.js +2 -2
- package/dist/components/Filters/FilterChip.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/Filters/FilterMenu.js.map +1 -1
- package/dist/components/Filters/FilterMenu.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/components/Filters/FilterMenu.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/Filters/SortMenu.js.map +1 -1
- package/dist/components/Filters/SortMenu.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/components/Filters/SortMenu.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/Icon/iconSet.js +92 -2
- package/dist/components/Icon/iconSet.js.map +1 -1
- package/dist/components/Input/Input.js.map +1 -1
- package/dist/components/Input/Input.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/components/Input/Input.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/Popover/Popover.js.map +1 -1
- package/dist/components/Popover/Popover.vue.d.ts +3 -0
- package/dist/components/Popover/Popover.vue_vue_type_script_setup_true_lang.js +38 -30
- package/dist/components/Popover/Popover.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/PropertyList/Editable.js.map +1 -1
- package/dist/components/PropertyList/Editable.vue_vue_type_script_setup_true_lang.js +6 -4
- package/dist/components/PropertyList/Editable.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/PropertyList/PropertyList.js.map +1 -1
- package/dist/components/PropertyList/PropertyList.vue.d.ts +17 -2
- package/dist/components/PropertyList/PropertyList.vue_vue_type_script_setup_true_lang.js +19 -14
- package/dist/components/PropertyList/PropertyList.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/PropertyRow/Collapsible.js.map +1 -1
- package/dist/components/PropertyRow/Collapsible.vue.d.ts +1 -1
- package/dist/components/PropertyRow/Collapsible.vue_vue_type_script_setup_true_lang.js +12 -12
- package/dist/components/PropertyRow/Collapsible.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/Radio/Radio.js.map +1 -1
- package/dist/components/Radio/Radio.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/components/Radio/Radio.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/Select/Select.js.map +1 -1
- package/dist/components/Select/Select.vue.d.ts +10 -1
- package/dist/components/Select/Select.vue_vue_type_script_setup_true_lang.js +125 -101
- package/dist/components/Select/Select.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/Textarea/Textarea.js.map +1 -1
- package/dist/components/Textarea/Textarea.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/components/Textarea/Textarea.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/package.json +1 -1
- package/src/styles/tailwind.css +4 -2
|
@@ -10,70 +10,78 @@ var _ = /*@__PURE__*/ n({
|
|
|
10
10
|
closeOnEscape: {
|
|
11
11
|
type: Boolean,
|
|
12
12
|
default: !0
|
|
13
|
-
}
|
|
13
|
+
},
|
|
14
|
+
width: { default: "16rem" }
|
|
14
15
|
},
|
|
15
16
|
emits: ["show", "hide"],
|
|
16
17
|
setup(n, { expose: _, emit: v }) {
|
|
17
|
-
let y = n, b = v, x = l(), S = o(!1), C = o(), w = o(), T = o();
|
|
18
|
-
function
|
|
19
|
-
w.value = e.currentTarget, C.value = t ?? w.value, T.value = x["aria-label"] ?? w.value?.getAttribute("aria-label") ?? w.value?.textContent?.trim(), S.value = !0;
|
|
18
|
+
let y = n, b = v, x = l(), S = o(!1), C = o(), w = o(), T = o(), E = !1;
|
|
19
|
+
function D(e, t) {
|
|
20
|
+
w.value = e.currentTarget, C.value = t ?? w.value, T.value = x["aria-label"] ?? w.value?.getAttribute("aria-label") ?? w.value?.textContent?.trim(), E = !1, S.value = !0;
|
|
20
21
|
}
|
|
21
|
-
function
|
|
22
|
+
function O() {
|
|
22
23
|
S.value = !1;
|
|
23
24
|
}
|
|
24
|
-
function
|
|
25
|
-
S.value ?
|
|
25
|
+
function k(e, t) {
|
|
26
|
+
S.value ? O() : D(e, t);
|
|
26
27
|
}
|
|
27
28
|
_({
|
|
28
|
-
show:
|
|
29
|
-
hide:
|
|
30
|
-
toggle:
|
|
29
|
+
show: D,
|
|
30
|
+
hide: O,
|
|
31
|
+
toggle: k
|
|
31
32
|
});
|
|
32
|
-
function k(e) {
|
|
33
|
-
return e instanceof Node && [C.value, w.value].some((t) => t?.contains(e));
|
|
34
|
-
}
|
|
35
33
|
function A(e) {
|
|
36
|
-
|
|
34
|
+
return e instanceof Node && [C.value, w.value].some((t) => t?.contains(e));
|
|
37
35
|
}
|
|
38
36
|
function j(e) {
|
|
39
|
-
|
|
40
|
-
C.value?.focus();
|
|
37
|
+
A(e.detail.originalEvent.target) ? e.preventDefault() : E = !0;
|
|
41
38
|
}
|
|
42
39
|
function M(e) {
|
|
43
|
-
|
|
40
|
+
y.closeOnEscape || e.preventDefault();
|
|
44
41
|
}
|
|
45
42
|
function N(e) {
|
|
46
|
-
e.
|
|
43
|
+
e.preventDefault();
|
|
44
|
+
let t = document.activeElement;
|
|
45
|
+
(!t || t === document.body || e.target.contains(t)) && !E && C.value?.focus();
|
|
46
|
+
}
|
|
47
|
+
function P(e) {
|
|
48
|
+
e.preventDefault();
|
|
49
|
+
let t = e.target?.querySelector("[role=\"dialog\"]");
|
|
50
|
+
(t?.querySelector("[autofocus]") ?? t)?.focus();
|
|
51
|
+
}
|
|
52
|
+
function F(e) {
|
|
53
|
+
e.target instanceof Node && e.target.contains(C.value ?? null) && O();
|
|
47
54
|
}
|
|
48
55
|
return u(S, (e) => {
|
|
49
|
-
e ? (window.addEventListener("scroll",
|
|
56
|
+
e ? (window.addEventListener("scroll", F, !0), window.addEventListener("resize", O), b("show")) : (window.removeEventListener("scroll", F, !0), window.removeEventListener("resize", O), b("hide"));
|
|
50
57
|
}), i(() => {
|
|
51
|
-
window.removeEventListener("scroll",
|
|
58
|
+
window.removeEventListener("scroll", F, !0), window.removeEventListener("resize", O);
|
|
52
59
|
}), (i, o) => (a(), e(c(g), {
|
|
53
60
|
open: S.value,
|
|
54
|
-
"onUpdate:open": o[
|
|
61
|
+
"onUpdate:open": o[1] ||= (e) => S.value = e
|
|
55
62
|
}, {
|
|
56
63
|
default: d(() => [t(c(p), { reference: C.value }, null, 8, ["reference"]), t(c(h), null, {
|
|
57
64
|
default: d(() => [t(c(m), r(i.$attrs, {
|
|
58
65
|
align: "start",
|
|
59
66
|
"align-offset": n.alignOffset,
|
|
60
67
|
"aria-label": T.value,
|
|
61
|
-
class: "z-[
|
|
68
|
+
class: "z-[1100] block origin-center rounded-lg border border-sui-line-subtle bg-sui-surface text-sui-ink shadow-xl data-[state=closed]:animate-sui-overlay-out data-[state=open]:animate-sui-overlay-in",
|
|
62
69
|
side: "bottom",
|
|
63
70
|
"side-offset": n.offset,
|
|
64
|
-
|
|
65
|
-
onCloseAutoFocus:
|
|
66
|
-
onEscapeKeyDown:
|
|
67
|
-
onFocusOutside: o[
|
|
68
|
-
onOpenAutoFocus:
|
|
69
|
-
onPointerDownOutside:
|
|
71
|
+
style: { width: n.width },
|
|
72
|
+
onCloseAutoFocus: N,
|
|
73
|
+
onEscapeKeyDown: M,
|
|
74
|
+
onFocusOutside: o[0] ||= f(() => {}, ["prevent"]),
|
|
75
|
+
onOpenAutoFocus: P,
|
|
76
|
+
onPointerDownOutside: j
|
|
70
77
|
}), {
|
|
71
|
-
default: d(() => [s(i.$slots, "default", { hide:
|
|
78
|
+
default: d(() => [s(i.$slots, "default", { hide: O })]),
|
|
72
79
|
_: 3
|
|
73
80
|
}, 16, [
|
|
74
81
|
"align-offset",
|
|
75
82
|
"aria-label",
|
|
76
|
-
"side-offset"
|
|
83
|
+
"side-offset",
|
|
84
|
+
"style"
|
|
77
85
|
])]),
|
|
78
86
|
_: 3
|
|
79
87
|
})]),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Popover.vue_vue_type_script_setup_true_lang.js","names":["$attrs","_openBlock","_createBlock","_unref","_withCtx","_createVNode","_mergeProps","_withModifiers","_renderSlot","Popover_vue_vue_type_script_setup_true_lang_default","__expose","__emit","props","__props","emit","attrs","useAttrs","open","ref","anchor","opener","label","show","event","target","hide","toggle","isOnAnchor","el","onPointerDownOutside","onEscape","onOpenAutoFocus","onScroll","watch","isOpen","onBeforeUnmount","openBlock","createBlock","unref","PopoverRoot","_cache","$event","withCtx","createVNode","PopoverAnchor","PopoverPortal","PopoverContent","mergeProps","_ctx","withModifiers","renderSlot"],"sources":["../../../src/components/Popover/Popover.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { onBeforeUnmount, ref, useAttrs, watch } from 'vue'\n\nimport { PopoverAnchor, PopoverContent, PopoverPortal, PopoverRoot } from 'reka-ui'\n\nexport interface PopoverProps {\n /** The gap to the anchor, in px; negative overlaps it. */\n offset?: number\n /** Shifts it along the anchor's edge, in px. */\n alignOffset?: number\n closeOnEscape?: boolean\n}\n\n// Root is Reka's renderless PopoverRoot: class and attributes belong on the panel.\ndefineOptions({ inheritAttrs: false })\n\nconst props = withDefaults(defineProps<PopoverProps>(), {
|
|
1
|
+
{"version":3,"file":"Popover.vue_vue_type_script_setup_true_lang.js","names":["$attrs","_openBlock","_createBlock","_unref","_withCtx","_createVNode","_mergeProps","_withModifiers","_renderSlot","Popover_vue_vue_type_script_setup_true_lang_default","__expose","__emit","props","__props","emit","attrs","useAttrs","open","ref","anchor","opener","label","pressedOutside","show","event","target","hide","toggle","isOnAnchor","el","onPointerDownOutside","onEscape","onCloseAutoFocus","active","onOpenAutoFocus","panel","onScroll","watch","isOpen","onBeforeUnmount","openBlock","createBlock","unref","PopoverRoot","_cache","$event","withCtx","createVNode","PopoverAnchor","PopoverPortal","PopoverContent","mergeProps","_ctx","withModifiers","renderSlot"],"sources":["../../../src/components/Popover/Popover.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { onBeforeUnmount, ref, useAttrs, watch } from 'vue'\n\nimport { PopoverAnchor, PopoverContent, PopoverPortal, PopoverRoot } from 'reka-ui'\n\nexport interface PopoverProps {\n /** The gap to the anchor, in px; negative overlaps it. */\n offset?: number\n /** Shifts it along the anchor's edge, in px. */\n alignOffset?: number\n closeOnEscape?: boolean\n /** The panel's width, e.g. `20rem`. */\n width?: string\n}\n\n// Root is Reka's renderless PopoverRoot: class and attributes belong on the panel.\ndefineOptions({ inheritAttrs: false })\n\nconst props = withDefaults(defineProps<PopoverProps>(), {\n offset: 4,\n alignOffset: 0,\n closeOnEscape: true,\n width: '16rem'\n})\n\nconst emit = defineEmits<{ show: []; hide: [] }>()\n\nconst attrs = useAttrs()\n\nconst open = ref(false)\nconst anchor = ref<HTMLElement>()\n// What was clicked to open it; clicks on it toggle the popover rather than counting as outside.\nconst opener = ref<HTMLElement>()\nconst label = ref<string>()\n// A press outside closes it and leaves focus to what was pressed.\nlet pressedOutside = false\n\n/** Opens below the event's element, or below `target` when given. */\nfunction show(event: Event, target?: HTMLElement) {\n opener.value = event.currentTarget as HTMLElement\n anchor.value = target ?? opener.value\n // A dialog needs a name: an aria-label given to the popover, or else the name of the element it opened from.\n label.value =\n (attrs['aria-label'] as string | undefined) ??\n opener.value?.getAttribute('aria-label') ??\n opener.value?.textContent?.trim()\n pressedOutside = false\n open.value = true\n}\n\nfunction hide() {\n open.value = false\n}\n\nfunction toggle(event: Event, target?: HTMLElement) {\n if (open.value) hide()\n else show(event, target)\n}\n\ndefineExpose({ show, hide, toggle })\n\nfunction isOnAnchor(target: EventTarget | null) {\n return target instanceof Node && [anchor.value, opener.value].some((el) => el?.contains(target))\n}\n\nfunction onPointerDownOutside(event: CustomEvent<{ originalEvent: PointerEvent }>) {\n if (isOnAnchor(event.detail.originalEvent.target)) event.preventDefault()\n else pressedOutside = true\n}\n\nfunction onEscape(event: KeyboardEvent) {\n if (!props.closeOnEscape) event.preventDefault()\n}\n\n// Otherwise focus left in the panel goes back to the anchor.\nfunction onCloseAutoFocus(event: Event) {\n event.preventDefault()\n const active = document.activeElement\n const inPanel = !active || active === document.body || (event.target as HTMLElement).contains(active)\n if (inPanel && !pressedOutside) anchor.value?.focus()\n}\n\n// Focus goes to an [autofocus] element inside, or else the panel, so Tab moves through it and Escape works at once.\n// The event comes from Reka's positioning wrapper around the panel.\nfunction onOpenAutoFocus(event: Event) {\n event.preventDefault()\n const wrapper = event.target as HTMLElement | null\n const panel = wrapper?.querySelector<HTMLElement>('[role=\"dialog\"]')\n ;(panel?.querySelector<HTMLElement>('[autofocus]') ?? panel)?.focus()\n}\n\n// It closes when the page moves under it: a scrolling ancestor of the anchor, or a resized window.\nfunction onScroll(event: Event) {\n if (event.target instanceof Node && event.target.contains(anchor.value ?? null)) hide()\n}\n\nwatch(open, (isOpen) => {\n if (isOpen) {\n window.addEventListener('scroll', onScroll, true)\n window.addEventListener('resize', hide)\n emit('show')\n } else {\n window.removeEventListener('scroll', onScroll, true)\n window.removeEventListener('resize', hide)\n emit('hide')\n }\n})\n\nonBeforeUnmount(() => {\n window.removeEventListener('scroll', onScroll, true)\n window.removeEventListener('resize', hide)\n})\n</script>\n\n<template>\n <PopoverRoot v-model:open=\"open\">\n <PopoverAnchor :reference=\"anchor\" />\n <PopoverPortal>\n <PopoverContent\n v-bind=\"$attrs\"\n align=\"start\"\n :align-offset=\"alignOffset\"\n :aria-label=\"label\"\n class=\"z-[1100] block origin-center rounded-lg border border-sui-line-subtle bg-sui-surface text-sui-ink shadow-xl data-[state=closed]:animate-sui-overlay-out data-[state=open]:animate-sui-overlay-in\"\n side=\"bottom\"\n :side-offset=\"offset\"\n :style=\"{ width }\"\n @close-auto-focus=\"onCloseAutoFocus\"\n @escape-key-down=\"onEscape\"\n @focus-outside.prevent\n @open-auto-focus=\"onOpenAutoFocus\"\n @pointer-down-outside=\"onPointerDownOutside\"\n >\n <slot :hide=\"hide\" />\n </PopoverContent>\n </PopoverPortal>\n </PopoverRoot>\n</template>\n"],"mappings":"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"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Editable.js","names":["_sfc_main","Editable_vue_vue_type_script_setup_true_lang_default","Editable_default"],"sources":["../../../src/components/PropertyList/Editable.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { computed, nextTick, ref, toRaw, useAttrs, useTemplateRef, watch } from 'vue'\n\nimport Select from '../Select/Select.vue'\nimport type { SelectOption, SelectValue } from '../Select/types'\nimport Tag from '../Tag/Tag.vue'\nimport Textarea from '../Textarea/Textarea.vue'\n\nexport interface EditableProps {\n /** `text` (one line), `multiline` (Shift+Enter for a new line), `select` (an outline Tag, picked from `options`) or `title`\n * (a record's 18px name). */\n variant?: 'text' | 'multiline' | 'select' | 'title'\n placeholder?: string\n /** For `select`. */\n options?: SelectOption[]\n disabled?: boolean\n}\n\ndefineOptions({ inheritAttrs: false })\n\nconst props = withDefaults(defineProps<EditableProps>(), {\n variant: 'text',\n placeholder: undefined,\n options: () => []\n})\n\nconst emit = defineEmits<{ blur: [] }>()\n\nconst model = defineModel<string | SelectValue | null>({ default: null })\n\n//
|
|
1
|
+
{"version":3,"file":"Editable.js","names":["_sfc_main","Editable_vue_vue_type_script_setup_true_lang_default","Editable_default"],"sources":["../../../src/components/PropertyList/Editable.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { computed, nextTick, ref, toRaw, useAttrs, useTemplateRef, watch } from 'vue'\n\nimport Select from '../Select/Select.vue'\nimport type { SelectOption, SelectValue } from '../Select/types'\nimport Tag from '../Tag/Tag.vue'\nimport Textarea from '../Textarea/Textarea.vue'\n\nexport interface EditableProps {\n /** `text` (one line), `multiline` (Shift+Enter for a new line), `select` (an outline Tag, picked from `options`) or `title`\n * (a record's 18px name). */\n variant?: 'text' | 'multiline' | 'select' | 'title'\n placeholder?: string\n /** For `select`. */\n options?: SelectOption[]\n disabled?: boolean\n}\n\ndefineOptions({ inheritAttrs: false })\n\nconst props = withDefaults(defineProps<EditableProps>(), {\n variant: 'text',\n placeholder: undefined,\n options: () => []\n})\n\nconst emit = defineEmits<{ blur: [] }>()\n\nconst model = defineModel<string | SelectValue | null>({ default: null })\n\n// Only the id, class and data- and aria- attributes go on the root. The name is said before the value, not as an\n// aria-label, which would hide the value from it.\nconst attrs = useAttrs()\nconst rootAttrs = computed(() =>\n Object.fromEntries(\n Object.entries(attrs).filter(\n ([key]) => key !== 'aria-label' && (key === 'id' || key === 'class' || /^(data|aria)-/.test(key))\n )\n )\n)\nconst name = computed(() => (attrs['aria-label'] as string | undefined) ?? props.placeholder)\n\nconst title = computed(() => props.variant === 'title')\nconst multiline = computed(() => props.variant === 'multiline')\n\nconst local = ref(toRaw(model.value) as string | null)\nconst original = ref(local.value)\nconst editing = ref(false)\nconst wrapper = useTemplateRef<HTMLElement>('wrapper')\n\n// Follows the value from outside (a failed save rolled back, a refetch) unless it's being edited.\nwatch(model, (value) => {\n if (editing.value) return\n local.value = toRaw(value) as string | null\n original.value = local.value\n})\n\nconst rows = computed(() => (title.value ? 1 : Math.max(1, Math.ceil((local.value?.length ?? 0) / 34))))\n\nasync function edit() {\n if (props.disabled) return\n editing.value = true\n await nextTick()\n wrapper.value?.querySelector('textarea')?.focus()\n}\n\nfunction save() {\n editing.value = false\n const value = toRaw(local.value) || null\n // Leaving it untouched isn't a change: an empty value stays as it came, '' or null.\n if (value !== (toRaw(model.value) || null)) model.value = value\n original.value = local.value\n emit('blur')\n}\n\nfunction revert(event: KeyboardEvent) {\n event.preventDefault()\n event.stopPropagation()\n local.value = original.value\n editing.value = false\n}\n\nfunction onEnter(event: KeyboardEvent) {\n if (multiline.value && event.shiftKey) return\n event.preventDefault()\n ;(event.target as HTMLElement).blur()\n}\n\nconst field =\n 'block w-full rounded-lg border border-transparent px-[0.6875rem] py-1.25 text-left text-sui-ink transition-[background-color,border-color,box-shadow] outline-hidden focus-visible:border-sui-accent focus-visible:sui-ring-field'\n</script>\n\n<!-- One value shown as plain text and edited where it is: click or Enter to edit, Enter or leaving to save, Escape to\n undo. A `select` opens its list under the value instead. -->\n<template>\n <Select\n v-if=\"variant === 'select'\"\n v-model=\"model as SelectValue | null\"\n :aria-label=\"name\"\n :disabled=\"disabled\"\n :options=\"options\"\n @update:model-value=\"emit('blur')\"\n >\n <template #trigger=\"{ open, toggle, selected }\">\n <button\n v-bind=\"rootAttrs\"\n :aria-expanded=\"open\"\n aria-haspopup=\"listbox\"\n :class=\"[\n field,\n 'max-w-[16rem] text-sm leading-5',\n disabled ? 'cursor-auto' : 'cursor-pointer hover:bg-sui-sunken'\n ]\"\n :disabled=\"disabled\"\n type=\"button\"\n @click=\"toggle\"\n >\n <span v-if=\"name\" class=\"sr-only\">{{ name }}: </span>\n <Tag v-if=\"selected[0]\" :name=\"selected[0].label\" variant=\"outline\" />\n <span v-else class=\"text-sui-ink-muted\">{{ placeholder }}</span>\n </button>\n </template>\n </Select>\n <div\n v-else\n v-bind=\"rootAttrs\"\n ref=\"wrapper\"\n class=\"relative\"\n :class=\"[\n field,\n title\n ? 'min-h-10 min-w-4 text-lg leading-7 font-semibold [&_textarea]:min-h-10 [&_textarea]:text-lg [&_textarea]:leading-7 [&_textarea]:font-semibold [&_textarea]:whitespace-nowrap [&_textarea]:placeholder:text-lg [&_textarea]:placeholder:font-semibold'\n : 'max-w-[16rem] text-sm leading-5 [&_textarea]:placeholder:text-sm [&_textarea]:placeholder:leading-5',\n disabled ? 'cursor-auto' : 'cursor-pointer hover:bg-sui-sunken',\n '[&_textarea]:bg-sui-surface [&_textarea]:placeholder:text-sui-ink-muted'\n ]\"\n role=\"button\"\n :tabindex=\"disabled ? -1 : 0\"\n @click=\"edit\"\n @keydown.enter=\"!editing && ($event.preventDefault(), edit())\"\n >\n <div>\n <span v-if=\"name\" class=\"sr-only\">{{ name }}: </span>\n <span v-if=\"!local\" class=\"text-sui-ink-muted\">{{ placeholder }}</span>\n <span v-else :class=\"{ 'whitespace-pre-wrap': multiline }\">{{ local }}</span>\n </div>\n <div v-if=\"editing\" class=\"absolute inset-0 z-10\" :class=\"{ '-mt-px': title }\">\n <Textarea\n v-model=\"local\"\n :aria-label=\"name\"\n :auto-resize=\"!title\"\n class=\"resize-none\"\n :class=\"title && 'h-full px-3 py-1.5'\"\n :placeholder=\"placeholder\"\n :rows=\"rows\"\n @blur=\"save\"\n @keydown.enter.stop=\"onEnter\"\n @keydown.esc.stop=\"revert\"\n />\n </div>\n </div>\n</template>\n"],"mappings":""}
|
|
@@ -19,7 +19,7 @@ var T = [
|
|
|
19
19
|
}, A = {
|
|
20
20
|
key: 1,
|
|
21
21
|
class: "text-sui-ink-muted"
|
|
22
|
-
}, j = "block w-full rounded-lg px-
|
|
22
|
+
}, j = "block w-full rounded-lg border border-transparent px-[0.6875rem] py-1.25 text-left text-sui-ink transition-[background-color,border-color,box-shadow] outline-hidden focus-visible:border-sui-accent focus-visible:sui-ring-field", M = /*@__PURE__*/ l({
|
|
23
23
|
inheritAttrs: !1,
|
|
24
24
|
__name: "Editable",
|
|
25
25
|
props: /*@__PURE__*/ u({
|
|
@@ -33,7 +33,7 @@ var T = [
|
|
|
33
33
|
}),
|
|
34
34
|
emits: /*@__PURE__*/ u(["blur"], ["update:modelValue"]),
|
|
35
35
|
setup(l, { emit: u }) {
|
|
36
|
-
let M = l, N = u, P = y(l, "modelValue"), F = v(), I = r(() => Object.fromEntries(Object.entries(F).filter(([e]) => e !== "aria-label" && (e === "id" || /^(data|aria)-/.test(e))))), L = r(() => F["aria-label"] ?? M.placeholder), R = r(() => M.variant === "title"), z = r(() => M.variant === "multiline"), B = h(_(P.value)), V = h(B.value), H = h(!1), U = b("wrapper");
|
|
36
|
+
let M = l, N = u, P = y(l, "modelValue"), F = v(), I = r(() => Object.fromEntries(Object.entries(F).filter(([e]) => e !== "aria-label" && (e === "id" || e === "class" || /^(data|aria)-/.test(e))))), L = r(() => F["aria-label"] ?? M.placeholder), R = r(() => M.variant === "title"), z = r(() => M.variant === "multiline"), B = h(_(P.value)), V = h(B.value), H = h(!1), U = b("wrapper");
|
|
37
37
|
x(P, (e) => {
|
|
38
38
|
H.value || (B.value = _(e), V.value = B.value);
|
|
39
39
|
});
|
|
@@ -42,7 +42,9 @@ var T = [
|
|
|
42
42
|
M.disabled || (H.value = !0, await f(), U.value?.querySelector("textarea")?.focus());
|
|
43
43
|
}
|
|
44
44
|
function K() {
|
|
45
|
-
H.value = !1
|
|
45
|
+
H.value = !1;
|
|
46
|
+
let e = _(B.value) || null;
|
|
47
|
+
e !== (_(P.value) || null) && (P.value = e), V.value = B.value, N("blur");
|
|
46
48
|
}
|
|
47
49
|
function q(e) {
|
|
48
50
|
e.preventDefault(), e.stopPropagation(), B.value = V.value, H.value = !1;
|
|
@@ -104,7 +106,7 @@ var T = [
|
|
|
104
106
|
"onUpdate:modelValue": u[2] ||= (e) => B.value = e,
|
|
105
107
|
"aria-label": L.value,
|
|
106
108
|
"auto-resize": !R.value,
|
|
107
|
-
class: p(["resize-none",
|
|
109
|
+
class: p(["resize-none", R.value && "h-full px-3 py-1.5"]),
|
|
108
110
|
placeholder: l.placeholder,
|
|
109
111
|
rows: W.value,
|
|
110
112
|
onBlur: K,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Editable.vue_vue_type_script_setup_true_lang.js","names":["
|
|
1
|
+
{"version":3,"file":"Editable.vue_vue_type_script_setup_true_lang.js","names":["_useModel","_openBlock","_createBlock","Select","_withCtx","_createElementVNode","_mergeProps","_createElementBlock","_toDisplayString","_createCommentVNode","Tag","_withKeys","_normalizeClass","_createVNode","Textarea","_withModifiers","Tag_default","Select_default","Textarea_default","_hoisted_1","_hoisted_2","_hoisted_3","_hoisted_4","_hoisted_5","_hoisted_6","field","Editable_vue_vue_type_script_setup_true_lang_default","\"modelValue\"","\"modelModifiers\"","__emit","props","__props","emit","model","useModel","attrs","useAttrs","rootAttrs","computed","key","name","title","multiline","local","ref","toRaw","original","editing","wrapper","useTemplateRef","value","rows","edit","nextTick","save","revert","event","onEnter","openBlock","createBlock","_cache","$event","withCtx","createElementVNode","mergeProps","open","toggle","createElementBlock","toDisplayString","createCommentVNode","selected","withKeys","normalizeClass","createVNode","withModifiers"],"sources":["../../../src/components/PropertyList/Editable.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { computed, nextTick, ref, toRaw, useAttrs, useTemplateRef, watch } from 'vue'\n\nimport Select from '../Select/Select.vue'\nimport type { SelectOption, SelectValue } from '../Select/types'\nimport Tag from '../Tag/Tag.vue'\nimport Textarea from '../Textarea/Textarea.vue'\n\nexport interface EditableProps {\n /** `text` (one line), `multiline` (Shift+Enter for a new line), `select` (an outline Tag, picked from `options`) or `title`\n * (a record's 18px name). */\n variant?: 'text' | 'multiline' | 'select' | 'title'\n placeholder?: string\n /** For `select`. */\n options?: SelectOption[]\n disabled?: boolean\n}\n\ndefineOptions({ inheritAttrs: false })\n\nconst props = withDefaults(defineProps<EditableProps>(), {\n variant: 'text',\n placeholder: undefined,\n options: () => []\n})\n\nconst emit = defineEmits<{ blur: [] }>()\n\nconst model = defineModel<string | SelectValue | null>({ default: null })\n\n// Only the id, class and data- and aria- attributes go on the root. The name is said before the value, not as an\n// aria-label, which would hide the value from it.\nconst attrs = useAttrs()\nconst rootAttrs = computed(() =>\n Object.fromEntries(\n Object.entries(attrs).filter(\n ([key]) => key !== 'aria-label' && (key === 'id' || key === 'class' || /^(data|aria)-/.test(key))\n )\n )\n)\nconst name = computed(() => (attrs['aria-label'] as string | undefined) ?? props.placeholder)\n\nconst title = computed(() => props.variant === 'title')\nconst multiline = computed(() => props.variant === 'multiline')\n\nconst local = ref(toRaw(model.value) as string | null)\nconst original = ref(local.value)\nconst editing = ref(false)\nconst wrapper = useTemplateRef<HTMLElement>('wrapper')\n\n// Follows the value from outside (a failed save rolled back, a refetch) unless it's being edited.\nwatch(model, (value) => {\n if (editing.value) return\n local.value = toRaw(value) as string | null\n original.value = local.value\n})\n\nconst rows = computed(() => (title.value ? 1 : Math.max(1, Math.ceil((local.value?.length ?? 0) / 34))))\n\nasync function edit() {\n if (props.disabled) return\n editing.value = true\n await nextTick()\n wrapper.value?.querySelector('textarea')?.focus()\n}\n\nfunction save() {\n editing.value = false\n const value = toRaw(local.value) || null\n // Leaving it untouched isn't a change: an empty value stays as it came, '' or null.\n if (value !== (toRaw(model.value) || null)) model.value = value\n original.value = local.value\n emit('blur')\n}\n\nfunction revert(event: KeyboardEvent) {\n event.preventDefault()\n event.stopPropagation()\n local.value = original.value\n editing.value = false\n}\n\nfunction onEnter(event: KeyboardEvent) {\n if (multiline.value && event.shiftKey) return\n event.preventDefault()\n ;(event.target as HTMLElement).blur()\n}\n\nconst field =\n 'block w-full rounded-lg border border-transparent px-[0.6875rem] py-1.25 text-left text-sui-ink transition-[background-color,border-color,box-shadow] outline-hidden focus-visible:border-sui-accent focus-visible:sui-ring-field'\n</script>\n\n<!-- One value shown as plain text and edited where it is: click or Enter to edit, Enter or leaving to save, Escape to\n undo. A `select` opens its list under the value instead. -->\n<template>\n <Select\n v-if=\"variant === 'select'\"\n v-model=\"model as SelectValue | null\"\n :aria-label=\"name\"\n :disabled=\"disabled\"\n :options=\"options\"\n @update:model-value=\"emit('blur')\"\n >\n <template #trigger=\"{ open, toggle, selected }\">\n <button\n v-bind=\"rootAttrs\"\n :aria-expanded=\"open\"\n aria-haspopup=\"listbox\"\n :class=\"[\n field,\n 'max-w-[16rem] text-sm leading-5',\n disabled ? 'cursor-auto' : 'cursor-pointer hover:bg-sui-sunken'\n ]\"\n :disabled=\"disabled\"\n type=\"button\"\n @click=\"toggle\"\n >\n <span v-if=\"name\" class=\"sr-only\">{{ name }}: </span>\n <Tag v-if=\"selected[0]\" :name=\"selected[0].label\" variant=\"outline\" />\n <span v-else class=\"text-sui-ink-muted\">{{ placeholder }}</span>\n </button>\n </template>\n </Select>\n <div\n v-else\n v-bind=\"rootAttrs\"\n ref=\"wrapper\"\n class=\"relative\"\n :class=\"[\n field,\n title\n ? 'min-h-10 min-w-4 text-lg leading-7 font-semibold [&_textarea]:min-h-10 [&_textarea]:text-lg [&_textarea]:leading-7 [&_textarea]:font-semibold [&_textarea]:whitespace-nowrap [&_textarea]:placeholder:text-lg [&_textarea]:placeholder:font-semibold'\n : 'max-w-[16rem] text-sm leading-5 [&_textarea]:placeholder:text-sm [&_textarea]:placeholder:leading-5',\n disabled ? 'cursor-auto' : 'cursor-pointer hover:bg-sui-sunken',\n '[&_textarea]:bg-sui-surface [&_textarea]:placeholder:text-sui-ink-muted'\n ]\"\n role=\"button\"\n :tabindex=\"disabled ? -1 : 0\"\n @click=\"edit\"\n @keydown.enter=\"!editing && ($event.preventDefault(), edit())\"\n >\n <div>\n <span v-if=\"name\" class=\"sr-only\">{{ name }}: </span>\n <span v-if=\"!local\" class=\"text-sui-ink-muted\">{{ placeholder }}</span>\n <span v-else :class=\"{ 'whitespace-pre-wrap': multiline }\">{{ local }}</span>\n </div>\n <div v-if=\"editing\" class=\"absolute inset-0 z-10\" :class=\"{ '-mt-px': title }\">\n <Textarea\n v-model=\"local\"\n :aria-label=\"name\"\n :auto-resize=\"!title\"\n class=\"resize-none\"\n :class=\"title && 'h-full px-3 py-1.5'\"\n :placeholder=\"placeholder\"\n :rows=\"rows\"\n @blur=\"save\"\n @keydown.enter.stop=\"onEnter\"\n @keydown.esc.stop=\"revert\"\n />\n </div>\n </div>\n</template>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;A,GAwFMyB,IACJ,qO;;;;;;;;;;;;;;EArEF,IAAMK,IAAQC,GAMRC,IAAOH,GAEPI,IAAQjC,EAAwC+B,GAAA,YAAkB,GAIlEI,IAAQC,EAAS,GACjBC,IAAYC,QAChB,OAAO,YACL,OAAO,QAAQH,CAAK,CAAC,CAAC,QACnB,CAACI,OAASA,MAAQ,iBAAiBA,MAAQ,QAAQA,MAAQ,WAAW,gBAAgB,KAAKA,CAAG,EACjG,CACF,CACF,GACMC,IAAOF,QAAgBH,EAAM,iBAAwCL,EAAM,WAAW,GAEtFW,IAAQH,QAAeR,EAAM,YAAY,OAAO,GAChDY,IAAYJ,QAAeR,EAAM,YAAY,WAAW,GAExDa,IAAQC,EAAIC,EAAMZ,EAAM,KAAK,CAAkB,GAC/Ca,IAAWF,EAAID,EAAM,KAAK,GAC1BI,IAAUH,EAAI,EAAK,GACnBI,IAAUC,EAA4B,SAAS;EAGrD,EAAMhB,IAAQ,MAAU;GACtB,AAAIc,EAAQ,UACZ,EAAM,QAAQF,EAAMK,CAAK,GACzB,EAAS,QAAQP,EAAM;EACzB,CAAC;EAED,IAAMQ,IAAOb,QAAgBG,EAAM,QAAQ,IAAI,KAAK,IAAI,GAAG,KAAK,MAAME,EAAM,OAAO,UAAU,KAAK,EAAE,CAAC,CAAE;EAEvG,eAAeS,IAAO;GACpB,AAAItB,EAAM,aACV,EAAQ,QAAQ,IAChB,MAAMuB,EAAS,GACfL,EAAQ,OAAO,cAAc,UAAU,CAAC,EAAE,MAAM;EAClD;EAEA,SAASM,IAAO;GACd,EAAQ,QAAQ;GAChB,IAAMJ,IAAQL,EAAMF,EAAM,KAAK,KAAK;GAIpC,AAFIO,OAAWL,EAAMZ,EAAM,KAAK,KAAK,UAAO,EAAM,QAAQiB,IAC1D,EAAS,QAAQP,EAAM,OACvBX,EAAK,MAAM;EACb;EAEA,SAASuB,EAAO,GAAsB;GAIpC,AAHAC,EAAM,eAAe,GACrBA,EAAM,gBAAgB,GACtB,EAAM,QAAQV,EAAS,OACvB,EAAQ,QAAQ;EAClB;EAEA,SAASW,EAAQ,GAAsB;GACrC,AAAIf,EAAU,SAASc,EAAM,aAC7BA,EAAM,eAAe,GACpBA,EAAO,OAAuB,KAAK;EACtC;E,iBAUUzB,EAAA,YAAO,YADf9B,EAAA,GAAAC,EA2BSC,GAAA;;GAzBE,YAAA8B,EAAA;G,wBAAA,AAAA2B,EAAA,QAAA,MAAA,EAAA,QAAKC,GAIO,AAAAD,EAAA,QAAA,MAAA5B,EAAI,MAAA,C;GAHxB,cAAYQ,EAAA;GACZ,UAAUT,EAAA;GACV,SAASA,EAAA;;GAGC,SAAO3B,GAiBP,EAjBW,SAAM,WAAQ,kBAAQ,CAC1CC,EAgBS,UAhBTC,EACU+B,EAeD,OAfU;IAChB,iBAAe4B;IAChB,iBAAc;IACb,OAAK;KAAcxC;;KAA8DM,EAAA,WAAQ,gBAAA;;IAKzF,UAAUA,EAAA;IACX,MAAK;IACJ,SAAOmC;G,KAEI1B,EAAA,SAAZvC,EAAA,GAAAM,EAAqD,QAArDa,GAAqDZ,EAAhBgC,EAAA,KAAI,IAAG,MAAE,CAAA,K,WACnC8B,EAAQ,MAAnBrE,EAAA,GAAAC,EAAsEQ,GAAA;;IAA7C,MAAM4D,EAAQ,EAAA,CAAI;IAAO,SAAQ;G,0BAC1DrE,EAAA,GAAAM,EAAgE,QAAhEc,GAAgEb,EAArBuB,EAAA,WAAW,GAAA,CAAA,E;;;;;;;E,OAI5D9B,EAAA,GAAAM,EAqCM,OArCND,EAqCM,EAAA,KAAA,EAAA,GAnCI+B,EAAA,OAAS;GACb,SAAA;GAAJ,KAAIW;GACJ,OAAK,CAAC,YAAU;IACAvB;IAAagB,EAAA,Q;IAA8XV,EAAA,WAAQ,gBAAA;;;GAQna,MAAK;GACJ,UAAUA,EAAA,WAAQ,KAAA;GAClB,SAAOqB;GACP,WAAO,AAAAQ,EAAA,OAAAjD,GAAA,MAAA,CAASoC,EAAA,UAAYc,EAAO,eAAc,GAAIT,EAAI,IAAA,CAAA,OAAA,CAAA;E,KAE1D/C,EAIM,OAAA,MAAA,CAHQmC,EAAA,SAAZvC,EAAA,GAAAM,EAAqD,QAArDgB,GAAqDf,EAAhBgC,EAAA,KAAI,IAAG,MAAE,CAAA,K,WACjCG,EAAA,SACb1C,EAAA,GAAAM,EAA6E,QAAA;;GAA/D,OAAKK,EAAA,EAAA,uBAA2B8B,EAAA,MAAS,CAAA;EAAO,GAAAlC,EAAAmC,EAAA,KAAK,GAAA,CAAA,MADnE1C,EAAA,GAAAM,EAAuE,QAAvEiB,GAAuEhB,EAArBuB,EAAA,WAAW,GAAA,CAAA,E,IAGpDgB,EAAA,SAAX9C,EAAA,GAAAM,EAaM,OAAA;;GAbc,OAAKK,EAAA,CAAC,yBAAuB,EAAA,UAAqB6B,EAAA,MAAK,CAAA,CAAA;E,IACzE5B,EAWEC,GAAA;GAVS,YAAA6B,EAAA;GAAA,uBAAA,AAAAiB,EAAA,QAAA,MAAA,EAAK,QAAAC;GACb,cAAYrB,EAAA;GACZ,eAAW,CAAGC,EAAA;GACf,OAAK7B,EAAA,CAAC,eACE6B,EAAA,SAAK,oBAAA,CAAA;GACZ,aAAaV,EAAA;GACb,MAAMoB,EAAA;GACN,QAAMG;GACN,WAAO,CAAa3C,EAAAI,EAAA0C,GAAO,CAAA,MAAA,CAAA,GAAA,CAAA,OAAA,CAAA,GACT9C,EAAAI,EAAAwC,GAAM,CAAA,MAAA,CAAA,GAAA,CAAA,KAAA,CAAA,C"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PropertyList.js","names":["_sfc_main","PropertyList_vue_vue_type_script_setup_true_lang_default","PropertyList_default"],"sources":["../../../src/components/PropertyList/PropertyList.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport type { SelectOption, SelectValue } from '../Select/types'\nimport Editable from './Editable.vue'\n\nexport interface PropertyListField {\n id: string\n label?: string\n /** How the value is edited: one line, several, or picked from `options`. */\n type?: 'text' | 'multiline' | 'select'\n placeholder?: string\n options?: SelectOption[]\n disabled?: boolean\n}\n\ndefineProps<{ fields: PropertyListField[] }>()\n\nconst model = defineModel<Record<string, unknown>>({ required: true })\n\n// `change` names the one field that changed, for hosts that save field by field.\nconst emit = defineEmits<{ submit: []; change: [id: string, value: unknown] }>()\n\nconst valueOf = (id: string) => (model.value[id] ?? null) as SelectValue | null\n\nfunction update(id: string, value: unknown) {\n model.value = { ...model.value, [id]: value }\n emit('change', id, value)\n}\n</script>\n\n<!-- A record's details: a quiet label beside each value, every value an Editable edited where it is. -->\n<template>\n <form class=\"relative flex flex-col\" @submit.prevent=\"emit('submit')\">\n <div v-for=\"field of fields\" :key=\"field.id\" class=\"mb-1.5 flex items-start gap-2\">\n <label\n v-if=\"field.label\"\n class=\"block w-22 shrink-0 pt-1.5 text-sm font-normal text-sui-ink-muted\"\n :for=\"field.id\"\n >\n {{ field.label }}\n </label>\n <
|
|
1
|
+
{"version":3,"file":"PropertyList.js","names":["_sfc_main","PropertyList_vue_vue_type_script_setup_true_lang_default","PropertyList_default"],"sources":["../../../src/components/PropertyList/PropertyList.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport type { SelectOption, SelectValue } from '../Select/types'\nimport Editable from './Editable.vue'\n\nexport interface PropertyListField {\n id: string\n label?: string\n /** How the value is edited: one line, several, or picked from `options`. A `field-<id>` slot replaces it. */\n type?: 'text' | 'multiline' | 'select'\n placeholder?: string\n options?: SelectOption[]\n disabled?: boolean\n}\n\ndefineProps<{ fields: PropertyListField[] }>()\n\nconst model = defineModel<Record<string, unknown>>({ required: true })\n\n// `change` names the one field that changed, for hosts that save field by field.\nconst emit = defineEmits<{ submit: []; change: [id: string, value: unknown] }>()\n\nconst valueOf = (id: string) => (model.value[id] ?? null) as SelectValue | null\n\nfunction update(id: string, value: unknown) {\n model.value = { ...model.value, [id]: value }\n emit('change', id, value)\n}\n</script>\n\n<!-- A record's details: a quiet label beside each value, every value an Editable edited where it is. A `field-<id>` slot\n draws a field of its own and gets `id` (for its label), `value` and `update(value)`. -->\n<template>\n <form class=\"relative flex flex-col\" @submit.prevent=\"emit('submit')\">\n <div v-for=\"field of fields\" :key=\"field.id\" class=\"mb-1.5 flex items-start gap-2\">\n <label\n v-if=\"field.label\"\n class=\"block w-22 shrink-0 pt-1.5 text-sm font-normal text-sui-ink-muted\"\n :for=\"field.id\"\n >\n {{ field.label }}\n </label>\n <slot\n :id=\"field.id\"\n :field=\"field\"\n :name=\"`field-${field.id}`\"\n :update=\"(value: unknown) => update(field.id, value)\"\n :value=\"model[field.id]\"\n >\n <Editable\n :id=\"field.id\"\n :aria-label=\"field.label\"\n :disabled=\"field.disabled\"\n :model-value=\"valueOf(field.id)\"\n :options=\"field.options\"\n :placeholder=\"field.placeholder\"\n :variant=\"field.type ?? 'text'\"\n @update:model-value=\"(value) => update(field.id, value)\"\n />\n </slot>\n </div>\n </form>\n</template>\n"],"mappings":""}
|
|
@@ -2,7 +2,7 @@ import type { SelectOption } from '../Select/types';
|
|
|
2
2
|
export interface PropertyListField {
|
|
3
3
|
id: string;
|
|
4
4
|
label?: string;
|
|
5
|
-
/** How the value is edited: one line, several, or picked from `options`. */
|
|
5
|
+
/** How the value is edited: one line, several, or picked from `options`. A `field-<id>` slot replaces it. */
|
|
6
6
|
type?: 'text' | 'multiline' | 'select';
|
|
7
7
|
placeholder?: string;
|
|
8
8
|
options?: SelectOption[];
|
|
@@ -15,7 +15,16 @@ type __VLS_ModelProps = {
|
|
|
15
15
|
modelValue: Record<string, unknown>;
|
|
16
16
|
};
|
|
17
17
|
type __VLS_PublicProps = __VLS_Props & __VLS_ModelProps;
|
|
18
|
-
declare
|
|
18
|
+
declare var __VLS_3: `field-${string}`, __VLS_4: {
|
|
19
|
+
id: string;
|
|
20
|
+
field: PropertyListField;
|
|
21
|
+
update: (value: unknown) => void;
|
|
22
|
+
value: unknown;
|
|
23
|
+
};
|
|
24
|
+
type __VLS_Slots = {} & {
|
|
25
|
+
[K in NonNullable<typeof __VLS_3>]?: (props: typeof __VLS_4) => any;
|
|
26
|
+
};
|
|
27
|
+
declare const __VLS_base: import("vue").DefineComponent<__VLS_PublicProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
19
28
|
change: (id: string, value: unknown) => any;
|
|
20
29
|
submit: () => any;
|
|
21
30
|
"update:modelValue": (value: Record<string, unknown>) => any;
|
|
@@ -24,5 +33,11 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_PublicProps, {},
|
|
|
24
33
|
onSubmit?: (() => any) | undefined;
|
|
25
34
|
"onUpdate:modelValue"?: ((value: Record<string, unknown>) => any) | undefined;
|
|
26
35
|
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
36
|
+
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
27
37
|
declare const _default: typeof __VLS_export;
|
|
28
38
|
export default _default;
|
|
39
|
+
type __VLS_WithSlots<T, S> = T & {
|
|
40
|
+
new (): {
|
|
41
|
+
$slots: S;
|
|
42
|
+
};
|
|
43
|
+
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import e from "./Editable.js";
|
|
2
|
-
import { Fragment as t, createCommentVNode as n, createElementBlock as r, createVNode as i, defineComponent as a, mergeModels as o, openBlock as s, renderList as c,
|
|
2
|
+
import { Fragment as t, createCommentVNode as n, createElementBlock as r, createVNode as i, defineComponent as a, mergeModels as o, openBlock as s, renderList as c, renderSlot as l, toDisplayString as u, useModel as d, withModifiers as f } from "vue";
|
|
3
3
|
//#region src/components/PropertyList/PropertyList.vue?vue&type=script&setup=true&lang.ts
|
|
4
|
-
var
|
|
4
|
+
var p = ["for"], m = /*@__PURE__*/ a({
|
|
5
5
|
__name: "PropertyList",
|
|
6
6
|
props: /*@__PURE__*/ o({ fields: {} }, {
|
|
7
7
|
modelValue: { required: !0 },
|
|
@@ -9,16 +9,16 @@ var f = ["for"], p = /*@__PURE__*/ a({
|
|
|
9
9
|
}),
|
|
10
10
|
emits: /*@__PURE__*/ o(["submit", "change"], ["update:modelValue"]),
|
|
11
11
|
setup(a, { emit: o }) {
|
|
12
|
-
let
|
|
13
|
-
function
|
|
14
|
-
|
|
15
|
-
...
|
|
12
|
+
let m = d(a, "modelValue"), h = o, g = (e) => m.value[e] ?? null;
|
|
13
|
+
function _(e, t) {
|
|
14
|
+
m.value = {
|
|
15
|
+
...m.value,
|
|
16
16
|
[e]: t
|
|
17
|
-
},
|
|
17
|
+
}, h("change", e, t);
|
|
18
18
|
}
|
|
19
|
-
return (o,
|
|
19
|
+
return (o, d) => (s(), r("form", {
|
|
20
20
|
class: "relative flex flex-col",
|
|
21
|
-
onSubmit:
|
|
21
|
+
onSubmit: d[0] ||= f((e) => h("submit"), ["prevent"])
|
|
22
22
|
}, [(s(!0), r(t, null, c(a.fields, (t) => (s(), r("div", {
|
|
23
23
|
key: t.id,
|
|
24
24
|
class: "mb-1.5 flex items-start gap-2"
|
|
@@ -26,15 +26,20 @@ var f = ["for"], p = /*@__PURE__*/ a({
|
|
|
26
26
|
key: 0,
|
|
27
27
|
class: "block w-22 shrink-0 pt-1.5 text-sm font-normal text-sui-ink-muted",
|
|
28
28
|
for: t.id
|
|
29
|
-
},
|
|
29
|
+
}, u(t.label), 9, p)) : n("", !0), l(o.$slots, `field-${t.id}`, {
|
|
30
|
+
id: t.id,
|
|
31
|
+
field: t,
|
|
32
|
+
update: (e) => _(t.id, e),
|
|
33
|
+
value: m.value[t.id]
|
|
34
|
+
}, () => [i(e, {
|
|
30
35
|
id: t.id,
|
|
31
36
|
"aria-label": t.label,
|
|
32
37
|
disabled: t.disabled,
|
|
33
|
-
"model-value":
|
|
38
|
+
"model-value": g(t.id),
|
|
34
39
|
options: t.options,
|
|
35
40
|
placeholder: t.placeholder,
|
|
36
41
|
variant: t.type ?? "text",
|
|
37
|
-
"onUpdate:modelValue": (e) =>
|
|
42
|
+
"onUpdate:modelValue": (e) => _(t.id, e)
|
|
38
43
|
}, null, 8, [
|
|
39
44
|
"id",
|
|
40
45
|
"aria-label",
|
|
@@ -44,10 +49,10 @@ var f = ["for"], p = /*@__PURE__*/ a({
|
|
|
44
49
|
"placeholder",
|
|
45
50
|
"variant",
|
|
46
51
|
"onUpdate:modelValue"
|
|
47
|
-
])]))), 128))], 32));
|
|
52
|
+
])])]))), 128))], 32));
|
|
48
53
|
}
|
|
49
54
|
});
|
|
50
55
|
//#endregion
|
|
51
|
-
export {
|
|
56
|
+
export { m as default };
|
|
52
57
|
|
|
53
58
|
//# sourceMappingURL=PropertyList.vue_vue_type_script_setup_true_lang.js.map
|
package/dist/components/PropertyList/PropertyList.vue_vue_type_script_setup_true_lang.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PropertyList.vue_vue_type_script_setup_true_lang.js","names":["_useModel","_openBlock","_createElementBlock","_withModifiers","_Fragment","_renderList","_toDisplayString","_createCommentVNode","_createVNode","Editable","Editable_default","_hoisted_1","PropertyList_vue_vue_type_script_setup_true_lang_default","\"modelValue\"","\"modelModifiers\"","__emit","model","useModel","__props","emit","valueOf","id","update","value","openBlock","createElementBlock","_cache","withModifiers","Fragment","renderList","field","toDisplayString","createCommentVNode","createVNode"],"sources":["../../../src/components/PropertyList/PropertyList.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport type { SelectOption, SelectValue } from '../Select/types'\nimport Editable from './Editable.vue'\n\nexport interface PropertyListField {\n id: string\n label?: string\n /** How the value is edited: one line, several, or picked from `options`. */\n type?: 'text' | 'multiline' | 'select'\n placeholder?: string\n options?: SelectOption[]\n disabled?: boolean\n}\n\ndefineProps<{ fields: PropertyListField[] }>()\n\nconst model = defineModel<Record<string, unknown>>({ required: true })\n\n// `change` names the one field that changed, for hosts that save field by field.\nconst emit = defineEmits<{ submit: []; change: [id: string, value: unknown] }>()\n\nconst valueOf = (id: string) => (model.value[id] ?? null) as SelectValue | null\n\nfunction update(id: string, value: unknown) {\n model.value = { ...model.value, [id]: value }\n emit('change', id, value)\n}\n</script>\n\n<!-- A record's details: a quiet label beside each value, every value an Editable edited where it is. -->\n<template>\n <form class=\"relative flex flex-col\" @submit.prevent=\"emit('submit')\">\n <div v-for=\"field of fields\" :key=\"field.id\" class=\"mb-1.5 flex items-start gap-2\">\n <label\n v-if=\"field.label\"\n class=\"block w-22 shrink-0 pt-1.5 text-sm font-normal text-sui-ink-muted\"\n :for=\"field.id\"\n >\n {{ field.label }}\n </label>\n <
|
|
1
|
+
{"version":3,"file":"PropertyList.vue_vue_type_script_setup_true_lang.js","names":["_useModel","_openBlock","_createElementBlock","_withModifiers","_Fragment","_renderList","_toDisplayString","_createCommentVNode","_renderSlot","_createVNode","Editable","Editable_default","_hoisted_1","PropertyList_vue_vue_type_script_setup_true_lang_default","\"modelValue\"","\"modelModifiers\"","__emit","model","useModel","__props","emit","valueOf","id","update","value","openBlock","createElementBlock","_cache","withModifiers","Fragment","renderList","field","toDisplayString","createCommentVNode","renderSlot","_ctx","createVNode"],"sources":["../../../src/components/PropertyList/PropertyList.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport type { SelectOption, SelectValue } from '../Select/types'\nimport Editable from './Editable.vue'\n\nexport interface PropertyListField {\n id: string\n label?: string\n /** How the value is edited: one line, several, or picked from `options`. A `field-<id>` slot replaces it. */\n type?: 'text' | 'multiline' | 'select'\n placeholder?: string\n options?: SelectOption[]\n disabled?: boolean\n}\n\ndefineProps<{ fields: PropertyListField[] }>()\n\nconst model = defineModel<Record<string, unknown>>({ required: true })\n\n// `change` names the one field that changed, for hosts that save field by field.\nconst emit = defineEmits<{ submit: []; change: [id: string, value: unknown] }>()\n\nconst valueOf = (id: string) => (model.value[id] ?? null) as SelectValue | null\n\nfunction update(id: string, value: unknown) {\n model.value = { ...model.value, [id]: value }\n emit('change', id, value)\n}\n</script>\n\n<!-- A record's details: a quiet label beside each value, every value an Editable edited where it is. A `field-<id>` slot\n draws a field of its own and gets `id` (for its label), `value` and `update(value)`. -->\n<template>\n <form class=\"relative flex flex-col\" @submit.prevent=\"emit('submit')\">\n <div v-for=\"field of fields\" :key=\"field.id\" class=\"mb-1.5 flex items-start gap-2\">\n <label\n v-if=\"field.label\"\n class=\"block w-22 shrink-0 pt-1.5 text-sm font-normal text-sui-ink-muted\"\n :for=\"field.id\"\n >\n {{ field.label }}\n </label>\n <slot\n :id=\"field.id\"\n :field=\"field\"\n :name=\"`field-${field.id}`\"\n :update=\"(value: unknown) => update(field.id, value)\"\n :value=\"model[field.id]\"\n >\n <Editable\n :id=\"field.id\"\n :aria-label=\"field.label\"\n :disabled=\"field.disabled\"\n :model-value=\"valueOf(field.id)\"\n :options=\"field.options\"\n :placeholder=\"field.placeholder\"\n :variant=\"field.type ?? 'text'\"\n @update:model-value=\"(value) => update(field.id, value)\"\n />\n </slot>\n </div>\n </form>\n</template>\n"],"mappings":";;;;;;;;;;;EAgBA,IAAMiB,IAAQjB,EAAoCmB,GAAA,YAAmB,GAG/DC,IAAOJ,GAEPK,KAAW,MAAgBJ,EAAM,MAAMK,MAAO;EAEpD,SAASC,EAAO,GAAY,GAAgB;GAE1C,AADA,EAAM,QAAQ;IAAE,GAAGN,EAAM;KAAQK,IAAKE;GAAM,GAC5CJ,EAAK,UAAUE,GAAIE,CAAK;EAC1B;E,kBAMEvB,EAAA,GAAAC,EA4BO,QAAA;GA5BD,OAAM;GAA0B,UAAM,AAAAyB,EAAA,OAAAxB,GAAA,MAAUiB,EAAI,QAAA,GAAA,CAAA,SAAA,CAAA;E,KACxDnB,EAAA,EAAA,GAAAC,EA0BME,GAAA,MAAAC,EA1Bec,EAAA,SAAT,OAAZlB,EAAA,GAAAC,EA0BM,OAAA;GA1BwB,KAAK6B,EAAM;GAAI,OAAM;E,IAEzCA,EAAM,SADd9B,EAAA,GAAAC,EAMQ,SAAA;;GAJN,OAAM;GACL,KAAK6B,EAAM;EAET,GAAAzB,EAAAyB,EAAM,KAAK,GAAA,GAAAnB,CAAA,K,WAEhBJ,EAiBO2B,EAAA,QAAA,SAdWJ,EAAM,MAAE;GAFvB,IAAIA,EAAM;GACH;GAEP,SAAS,MAAmBR,EAAOQ,EAAM,IAAIP,CAAK;GAClD,OAAOP,EAAA,MAAMc,EAAM;EALtB,SAiBO,CAVLtB,EASEC,GAAA;GARC,IAAIqB,EAAM;GACV,cAAYA,EAAM;GAClB,UAAUA,EAAM;GAChB,eAAaV,EAAQU,EAAM,EAAE;GAC7B,SAASA,EAAM;GACf,aAAaA,EAAM;GACnB,SAASA,EAAM,QAAI;GACnB,wBAAqB,MAAUR,EAAOQ,EAAM,IAAIP,CAAK"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Collapsible.js","names":["_sfc_main","Collapsible_vue_vue_type_script_setup_true_lang_default","Collapsible_default"],"sources":["../../../src/components/PropertyRow/Collapsible.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport {
|
|
1
|
+
{"version":3,"file":"Collapsible.js","names":["_sfc_main","Collapsible_vue_vue_type_script_setup_true_lang_default","Collapsible_default"],"sources":["../../../src/components/PropertyRow/Collapsible.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { ref, watch } from 'vue'\n\nimport ChevronIcon from '../internal/ChevronIcon.vue'\n\nexport interface CollapsibleProps {\n /** What's folded away, shown beside the label while closed, e.g. \"Phone, birthday\". */\n summary: string\n /** Opens it when any of its fields holds a value; it can still be folded. */\n filled?: boolean\n label?: string\n}\n\nconst props = withDefaults(defineProps<CollapsibleProps>(), { label: 'More details' })\n\nconst isOpen = ref(props.filled)\nwatch(\n () => props.filled,\n (filled) => filled && (isOpen.value = true)\n)\n</script>\n\n<!-- Rarely used fields, folded away. -->\n<template>\n <div>\n <button\n :aria-expanded=\"isOpen\"\n class=\"flex h-10.5 w-full items-center gap-1.5 bg-transparent p-0 text-13 font-medium text-sui-ink-body focus-visible:sui-ring\"\n type=\"button\"\n @click=\"isOpen = !isOpen\"\n >\n <ChevronIcon\n class=\"h-4 w-4 fill-sui-ink-body stroke-sui-ink-body transition-transform duration-150\"\n :class=\"{ 'rotate-90': isOpen }\"\n direction=\"right\"\n />\n {{ label }}\n <span v-if=\"!isOpen\" class=\"font-normal text-sui-ink-muted\">{{ summary }}</span>\n </button>\n <div v-if=\"isOpen\" class=\"-mt-1.5 pb-1\">\n <slot />\n </div>\n </div>\n</template>\n"],"mappings":""}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export interface CollapsibleProps {
|
|
2
2
|
/** What's folded away, shown beside the label while closed, e.g. "Phone, birthday". */
|
|
3
3
|
summary: string;
|
|
4
|
-
/** Opens it
|
|
4
|
+
/** Opens it when any of its fields holds a value; it can still be folded. */
|
|
5
5
|
filled?: boolean;
|
|
6
6
|
label?: string;
|
|
7
7
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import e from "../internal/ChevronIcon.js";
|
|
2
|
-
import {
|
|
2
|
+
import { createCommentVNode as t, createElementBlock as n, createElementVNode as r, createTextVNode as i, createVNode as a, defineComponent as o, normalizeClass as s, openBlock as c, ref as l, renderSlot as u, toDisplayString as d, watch as f } from "vue";
|
|
3
3
|
//#region src/components/PropertyRow/Collapsible.vue?vue&type=script&setup=true&lang.ts
|
|
4
4
|
var p = ["aria-expanded"], m = {
|
|
5
5
|
key: 0,
|
|
@@ -7,28 +7,28 @@ var p = ["aria-expanded"], m = {
|
|
|
7
7
|
}, h = {
|
|
8
8
|
key: 0,
|
|
9
9
|
class: "-mt-1.5 pb-1"
|
|
10
|
-
}, g = /*@__PURE__*/
|
|
10
|
+
}, g = /*@__PURE__*/ o({
|
|
11
11
|
__name: "Collapsible",
|
|
12
12
|
props: {
|
|
13
13
|
summary: {},
|
|
14
14
|
filled: { type: Boolean },
|
|
15
15
|
label: { default: "More details" }
|
|
16
16
|
},
|
|
17
|
-
setup(
|
|
18
|
-
let g =
|
|
19
|
-
return (
|
|
20
|
-
"aria-expanded":
|
|
17
|
+
setup(o) {
|
|
18
|
+
let g = o, _ = l(g.filled);
|
|
19
|
+
return f(() => g.filled, (e) => e && (_.value = !0)), (l, f) => (c(), n("div", null, [r("button", {
|
|
20
|
+
"aria-expanded": _.value,
|
|
21
21
|
class: "flex h-10.5 w-full items-center gap-1.5 bg-transparent p-0 text-13 font-medium text-sui-ink-body focus-visible:sui-ring",
|
|
22
22
|
type: "button",
|
|
23
|
-
onClick:
|
|
23
|
+
onClick: f[0] ||= (e) => _.value = !_.value
|
|
24
24
|
}, [
|
|
25
|
-
|
|
26
|
-
class:
|
|
25
|
+
a(e, {
|
|
26
|
+
class: s(["h-4 w-4 fill-sui-ink-body stroke-sui-ink-body transition-transform duration-150", { "rotate-90": _.value }]),
|
|
27
27
|
direction: "right"
|
|
28
28
|
}, null, 8, ["class"]),
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
], 8, p),
|
|
29
|
+
i(" " + d(o.label) + " ", 1),
|
|
30
|
+
_.value ? t("", !0) : (c(), n("span", m, d(o.summary), 1))
|
|
31
|
+
], 8, p), _.value ? (c(), n("div", h, [u(l.$slots, "default")])) : t("", !0)]));
|
|
32
32
|
}
|
|
33
33
|
});
|
|
34
34
|
//#endregion
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Collapsible.vue_vue_type_script_setup_true_lang.js","names":["_openBlock","_createElementBlock","_createElementVNode","_createVNode","ChevronIcon","_normalizeClass","_createTextVNode","_toDisplayString","_createCommentVNode","_renderSlot","ChevronIcon_default","_hoisted_1","_hoisted_2","_hoisted_3","Collapsible_vue_vue_type_script_setup_true_lang_default","props","__props","
|
|
1
|
+
{"version":3,"file":"Collapsible.vue_vue_type_script_setup_true_lang.js","names":["_openBlock","_createElementBlock","_createElementVNode","_createVNode","ChevronIcon","_normalizeClass","_createTextVNode","_toDisplayString","_createCommentVNode","_renderSlot","ChevronIcon_default","_hoisted_1","_hoisted_2","_hoisted_3","Collapsible_vue_vue_type_script_setup_true_lang_default","props","__props","isOpen","ref","watch","filled","openBlock","createElementBlock","createElementVNode","_cache","createVNode","normalizeClass","createTextVNode","toDisplayString","createCommentVNode","renderSlot","_ctx"],"sources":["../../../src/components/PropertyRow/Collapsible.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { ref, watch } from 'vue'\n\nimport ChevronIcon from '../internal/ChevronIcon.vue'\n\nexport interface CollapsibleProps {\n /** What's folded away, shown beside the label while closed, e.g. \"Phone, birthday\". */\n summary: string\n /** Opens it when any of its fields holds a value; it can still be folded. */\n filled?: boolean\n label?: string\n}\n\nconst props = withDefaults(defineProps<CollapsibleProps>(), { label: 'More details' })\n\nconst isOpen = ref(props.filled)\nwatch(\n () => props.filled,\n (filled) => filled && (isOpen.value = true)\n)\n</script>\n\n<!-- Rarely used fields, folded away. -->\n<template>\n <div>\n <button\n :aria-expanded=\"isOpen\"\n class=\"flex h-10.5 w-full items-center gap-1.5 bg-transparent p-0 text-13 font-medium text-sui-ink-body focus-visible:sui-ring\"\n type=\"button\"\n @click=\"isOpen = !isOpen\"\n >\n <ChevronIcon\n class=\"h-4 w-4 fill-sui-ink-body stroke-sui-ink-body transition-transform duration-150\"\n :class=\"{ 'rotate-90': isOpen }\"\n direction=\"right\"\n />\n {{ label }}\n <span v-if=\"!isOpen\" class=\"font-normal text-sui-ink-muted\">{{ summary }}</span>\n </button>\n <div v-if=\"isOpen\" class=\"-mt-1.5 pb-1\">\n <slot />\n </div>\n </div>\n</template>\n"],"mappings":";;;;;;;;;;;;;;;;;EAaA,IAAMe,IAAQC,GAERC,IAASC,EAAIH,EAAM,MAAM;E,OAC/BI,QACQJ,EAAM,SACX,MAAWK,MAAW,EAAO,QAAQ,GACxC,I,UAKEpB,EAAA,GAAAC,EAkBM,OAAA,MAAA,CAjBJC,EAaS,UAAA;GAZN,iBAAee,EAAA;GAChB,OAAM;GACN,MAAK;GACJ,SAAK,AAAAO,EAAA,QAAA,MAAE,EAAA,QAAM,CAAIP,EAAA;;GAElBd,EAIEC,GAAA;IAHA,OAAKC,EAAA,CAAC,mFAAiF,EAAA,aAChEY,EAAA,MAAM,CAAA,CAAA;IAC7B,WAAU;;GACVX,EAAA,MACFC,EAAGS,EAAA,KAAK,IAAG,KACX,CAAA;GAAaC,EAAA,Q,aAAbjB,EAAA,GAAAC,EAAgF,QAAhFW,GAAgFL,EAAjBS,EAAA,OAAO,GAAA,CAAA;E,UAE7DC,EAAA,SAAXjB,EAAA,GAAAC,EAEM,OAFNY,GAEM,CADJJ,EAAQsB,EAAA,QAAA,SAAA,C"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Radio.js","names":["_sfc_main","Radio_vue_vue_type_script_setup_true_lang_default","Radio_default"],"sources":["../../../src/components/Radio/Radio.vue"],"sourcesContent":["<script setup lang=\"ts\" generic=\"T\">\nimport { computed, useAttrs } from 'vue'\n\nexport interface RadioProps<T> {\n /** The value the group's v-model takes when this radio is chosen. */\n value: T\n invalid?: boolean\n disabled?: boolean\n}\n\ndefineOptions({ inheritAttrs: false })\n\nconst props = defineProps<RadioProps<T>>()\n\nconst model = defineModel<T>()\n\nconst checked = computed(() => model.value === props.value)\n\n// Class and style size the control; everything else (id, name, aria-label) belongs on the input.\nconst attrs = useAttrs()\nconst inputAttrs = computed(() => {\n const { class: _class, style: _style, ...rest } = attrs\n return rest\n})\n\nconst box = computed(() => [\n checked.value && !props.disabled && 'border-sui-accent-solid bg-sui-accent-solid',\n !checked.value && (props.invalid ? 'border-sui-danger-mid' : 'border-sui-line-control'),\n props.disabled\n ? 'pointer-events-none cursor-default border-sui-accent-line bg-sui-surface select-none [&>*:first-child]:bg-sui-accent-soft'\n : [
|
|
1
|
+
{"version":3,"file":"Radio.js","names":["_sfc_main","Radio_vue_vue_type_script_setup_true_lang_default","Radio_default"],"sources":["../../../src/components/Radio/Radio.vue"],"sourcesContent":["<script setup lang=\"ts\" generic=\"T\">\nimport { computed, useAttrs } from 'vue'\n\nexport interface RadioProps<T> {\n /** The value the group's v-model takes when this radio is chosen. */\n value: T\n invalid?: boolean\n disabled?: boolean\n}\n\ndefineOptions({ inheritAttrs: false })\n\nconst props = defineProps<RadioProps<T>>()\n\nconst model = defineModel<T>()\n\nconst checked = computed(() => model.value === props.value)\n\n// Class and style size the control; everything else (id, name, aria-label) belongs on the input.\nconst attrs = useAttrs()\nconst inputAttrs = computed(() => {\n const { class: _class, style: _style, ...rest } = attrs\n return rest\n})\n\nconst box = computed(() => [\n checked.value && !props.disabled && 'border-sui-accent-solid bg-sui-accent-solid',\n !checked.value && (props.invalid ? 'border-sui-danger-mid' : 'border-sui-line-control'),\n props.disabled\n ? 'pointer-events-none cursor-default border-sui-accent-line bg-sui-surface select-none [&>*:first-child]:bg-sui-accent-soft'\n : [!checked.value && !props.invalid && 'peer-hover:border-sui-accent-solid', 'peer-focus-visible:sui-ring']\n])\n</script>\n\n<template>\n <div\n class=\"relative inline-flex h-4 w-4 cursor-pointer align-bottom select-none\"\n :class=\"attrs.class\"\n :style=\"attrs.style as string\"\n >\n <input\n v-bind=\"inputAttrs\"\n :aria-invalid=\"invalid ? 'true' : undefined\"\n :checked=\"checked\"\n class=\"peer absolute top-0 left-0 z-10 m-0 h-full w-full cursor-pointer appearance-none p-0 opacity-0 outline-hidden\"\n :disabled=\"disabled\"\n type=\"radio\"\n :value=\"value\"\n @change=\"model = value\"\n />\n <div\n class=\"flex h-4 w-4 items-center justify-center rounded-full border transition duration-200 ease-in-out\"\n :class=\"box\"\n >\n <div\n class=\"block h-1.5 w-1.5 rounded-full transition duration-200\"\n :class=\"checked ? 'visible scale-[1,1] bg-sui-surface' : 'invisible scale-[0.1]'\"\n />\n </div>\n </div>\n</template>\n"],"mappings":""}
|
|
@@ -24,7 +24,7 @@ var f = [
|
|
|
24
24
|
}), _ = e(() => [
|
|
25
25
|
m.value && !i.disabled && "border-sui-accent-solid bg-sui-accent-solid",
|
|
26
26
|
!m.value && (i.invalid ? "border-sui-danger-mid" : "border-sui-line-control"),
|
|
27
|
-
i.disabled ? "pointer-events-none cursor-default border-sui-accent-line bg-sui-surface select-none [&>*:first-child]:bg-sui-accent-soft" : [!m.value && "peer-hover:border-sui-accent-
|
|
27
|
+
i.disabled ? "pointer-events-none cursor-default border-sui-accent-line bg-sui-surface select-none [&>*:first-child]:bg-sui-accent-soft" : [!m.value && !i.invalid && "peer-hover:border-sui-accent-solid", "peer-focus-visible:sui-ring"]
|
|
28
28
|
]);
|
|
29
29
|
return (e, i) => (c(), t("div", {
|
|
30
30
|
class: o(["relative inline-flex h-4 w-4 cursor-pointer align-bottom select-none", l(h).class]),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Radio.vue_vue_type_script_setup_true_lang.js","names":["_useModel","_openBlock","_createElementBlock","_normalizeClass","_unref","_normalizeStyle","_createElementVNode","_mergeProps","_hoisted_1","Radio_vue_vue_type_script_setup_true_lang_default","\"modelValue\"","\"modelModifiers\"","props","__props","model","useModel","checked","computed","attrs","useAttrs","inputAttrs","_class","_style","rest","box","openBlock","createElementBlock","normalizeClass","unref","normalizeStyle","createElementVNode","mergeProps","_cache"],"sources":["../../../src/components/Radio/Radio.vue"],"sourcesContent":["<script setup lang=\"ts\" generic=\"T\">\nimport { computed, useAttrs } from 'vue'\n\nexport interface RadioProps<T> {\n /** The value the group's v-model takes when this radio is chosen. */\n value: T\n invalid?: boolean\n disabled?: boolean\n}\n\ndefineOptions({ inheritAttrs: false })\n\nconst props = defineProps<RadioProps<T>>()\n\nconst model = defineModel<T>()\n\nconst checked = computed(() => model.value === props.value)\n\n// Class and style size the control; everything else (id, name, aria-label) belongs on the input.\nconst attrs = useAttrs()\nconst inputAttrs = computed(() => {\n const { class: _class, style: _style, ...rest } = attrs\n return rest\n})\n\nconst box = computed(() => [\n checked.value && !props.disabled && 'border-sui-accent-solid bg-sui-accent-solid',\n !checked.value && (props.invalid ? 'border-sui-danger-mid' : 'border-sui-line-control'),\n props.disabled\n ? 'pointer-events-none cursor-default border-sui-accent-line bg-sui-surface select-none [&>*:first-child]:bg-sui-accent-soft'\n : [
|
|
1
|
+
{"version":3,"file":"Radio.vue_vue_type_script_setup_true_lang.js","names":["_useModel","_openBlock","_createElementBlock","_normalizeClass","_unref","_normalizeStyle","_createElementVNode","_mergeProps","_hoisted_1","Radio_vue_vue_type_script_setup_true_lang_default","\"modelValue\"","\"modelModifiers\"","props","__props","model","useModel","checked","computed","attrs","useAttrs","inputAttrs","_class","_style","rest","box","openBlock","createElementBlock","normalizeClass","unref","normalizeStyle","createElementVNode","mergeProps","_cache"],"sources":["../../../src/components/Radio/Radio.vue"],"sourcesContent":["<script setup lang=\"ts\" generic=\"T\">\nimport { computed, useAttrs } from 'vue'\n\nexport interface RadioProps<T> {\n /** The value the group's v-model takes when this radio is chosen. */\n value: T\n invalid?: boolean\n disabled?: boolean\n}\n\ndefineOptions({ inheritAttrs: false })\n\nconst props = defineProps<RadioProps<T>>()\n\nconst model = defineModel<T>()\n\nconst checked = computed(() => model.value === props.value)\n\n// Class and style size the control; everything else (id, name, aria-label) belongs on the input.\nconst attrs = useAttrs()\nconst inputAttrs = computed(() => {\n const { class: _class, style: _style, ...rest } = attrs\n return rest\n})\n\nconst box = computed(() => [\n checked.value && !props.disabled && 'border-sui-accent-solid bg-sui-accent-solid',\n !checked.value && (props.invalid ? 'border-sui-danger-mid' : 'border-sui-line-control'),\n props.disabled\n ? 'pointer-events-none cursor-default border-sui-accent-line bg-sui-surface select-none [&>*:first-child]:bg-sui-accent-soft'\n : [!checked.value && !props.invalid && 'peer-hover:border-sui-accent-solid', 'peer-focus-visible:sui-ring']\n])\n</script>\n\n<template>\n <div\n class=\"relative inline-flex h-4 w-4 cursor-pointer align-bottom select-none\"\n :class=\"attrs.class\"\n :style=\"attrs.style as string\"\n >\n <input\n v-bind=\"inputAttrs\"\n :aria-invalid=\"invalid ? 'true' : undefined\"\n :checked=\"checked\"\n class=\"peer absolute top-0 left-0 z-10 m-0 h-full w-full cursor-pointer appearance-none p-0 opacity-0 outline-hidden\"\n :disabled=\"disabled\"\n type=\"radio\"\n :value=\"value\"\n @change=\"model = value\"\n />\n <div\n class=\"flex h-4 w-4 items-center justify-center rounded-full border transition duration-200 ease-in-out\"\n :class=\"box\"\n >\n <div\n class=\"block h-1.5 w-1.5 rounded-full transition duration-200\"\n :class=\"checked ? 'visible scale-[1,1] bg-sui-surface' : 'invisible scale-[0.1]'\"\n />\n </div>\n </div>\n</template>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;EAYA,IAAMY,IAAQC,GAERC,IAAQd,EAAca,GAAA,YAAC,GAEvBG,IAAUC,QAAeH,EAAM,UAAUF,EAAM,KAAK,GAGpDM,IAAQC,EAAS,GACjBC,IAAaH,QAAe;GAChC,IAAM,EAAE,OAAOI,GAAQ,OAAOC,GAAQ,GAAGC,MAASL;GAClD,OAAOK;EACT,CAAC,GAEKC,IAAMP,QAAe;GACzBD,EAAQ,SAAS,CAACJ,EAAM,YAAY;GACpC,CAACI,EAAQ,UAAUJ,EAAM,UAAU,0BAA0B;GAC7DA,EAAM,WACF,8HACA,CAAC,CAACI,EAAQ,SAAS,CAACJ,EAAM,WAAW,sCAAsC,6BAA6B;EAC9G,CAAC;E,kBAICX,EAAA,GAAAC,EAwBM,OAAA;GAvBJ,OAAKC,EAAA,CAAC,wEACEC,EAAAc,CAAA,CAAK,CAAC,KAAK,CAAA;GAClB,OAAKb,EAAED,EAAAc,CAAA,CAAK,CAAC,KAAK;E,IAEnBZ,EASE,SATFC,EACUa,EAQR,OARkB;GACjB,gBAAcP,EAAA,UAAO,SAAY,KAAA;GACjC,SAASG,EAAA;GACV,OAAM;GACL,UAAUH,EAAA;GACX,MAAK;GACJ,OAAOA,EAAA;GACP,UAAM,AAAAmB,EAAA,QAAA,MAAE,EAAA,QAAQnB,EAAA;E,kBAEnBP,EAQM,OAAA,EAPJ,OAAKH,EAAA,CAAC,oGACEqB,EAAA,KAAG,CAAA,E,IAEXlB,EAGE,OAAA,EAFA,OAAKH,EAAA,CAAC,0DACEa,EAAA,QAAO,uCAAA,uBAAA,CAAA,E"}
|