@kuina-ui/vue 0.6.0 → 0.7.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/dist/blocks/pagination/Pagination.js +4 -0
- package/dist/blocks/pagination/Pagination.vue.d.ts +39 -0
- package/dist/blocks/pagination/Pagination.vue_vue_type_script_setup_true_lang.js +151 -0
- package/dist/blocks/pagination/index.d.ts +2 -0
- package/dist/blocks/pagination/pagination.theme.d.ts +12 -0
- package/dist/blocks/pagination/pagination.theme.js +12 -0
- package/dist/blocks/table/Table.js +4 -0
- package/dist/blocks/table/Table.vue.d.ts +149 -0
- package/dist/blocks/table/Table.vue_vue_type_script_setup_true_lang.js +933 -0
- package/dist/blocks/table/TableCellText.js +4 -0
- package/dist/blocks/table/TableCellText.vue.d.ts +8 -0
- package/dist/blocks/table/TableCellText.vue_vue_type_script_setup_true_lang.js +30 -0
- package/dist/blocks/table/index.d.ts +2 -0
- package/dist/blocks/table/table.theme.d.ts +286 -0
- package/dist/blocks/table/table.theme.js +391 -0
- package/dist/blocks/table/useLoadMoreTrigger.d.ts +11 -0
- package/dist/blocks/table/useLoadMoreTrigger.js +31 -0
- package/dist/blocks/table/usePinnedColumnOffsets.d.ts +10 -0
- package/dist/blocks/table/usePinnedColumnOffsets.js +63 -0
- package/dist/blocks/table/useRowReorder.d.ts +18 -0
- package/dist/blocks/table/useRowReorder.js +92 -0
- package/dist/blocks/table/useRowVirtualizer.d.ts +17 -0
- package/dist/blocks/table/useRowVirtualizer.js +45 -0
- package/dist/blocks/table/useTableSections.d.ts +46 -0
- package/dist/blocks/table/useTableSections.js +86 -0
- package/dist/components/alert/Alert.js +4 -0
- package/dist/components/alert/Alert.vue.d.ts +2 -2
- package/dist/components/alert/Alert.vue_vue_type_script_setup_true_lang.js +87 -0
- package/dist/components/alert/alert.theme.js +93 -0
- package/dist/components/avatar-group/AvatarGroup.js +4 -0
- package/dist/components/avatar-group/AvatarGroup.vue.d.ts +1 -1
- package/dist/components/avatar-group/AvatarGroup.vue_vue_type_script_setup_true_lang.js +42 -0
- package/dist/components/avatar-group/avatar-group.theme.js +22 -0
- package/dist/components/date-picker/DateCalendar.js +4 -0
- package/dist/components/date-picker/DateCalendar.vue_vue_type_script_setup_true_lang.js +194 -0
- package/dist/components/date-picker/DateCalendarMonth.js +4 -0
- package/dist/components/date-picker/DateCalendarMonth.vue_vue_type_script_setup_true_lang.js +106 -0
- package/dist/components/date-picker/DateCalendarPopover.js +4 -0
- package/dist/components/date-picker/DateCalendarPopover.vue_vue_type_script_setup_true_lang.js +161 -0
- package/dist/components/date-picker/DatePicker.js +4 -0
- package/dist/components/date-picker/DatePicker.vue.d.ts +6 -6
- package/dist/components/date-picker/DatePicker.vue_vue_type_script_setup_true_lang.js +224 -0
- package/dist/components/date-picker/DatePickerField.js +4 -0
- package/dist/components/date-picker/DatePickerField.vue.d.ts +6 -6
- package/dist/components/date-picker/DatePickerField.vue_vue_type_script_setup_true_lang.js +241 -0
- package/dist/components/date-picker/DatePickerPanel.js +4 -0
- package/dist/components/date-picker/DatePickerPanel.vue_vue_type_script_setup_true_lang.js +55 -0
- package/dist/components/date-picker/DateRangePicker.js +4 -0
- package/dist/components/date-picker/DateRangePicker.vue.d.ts +6 -6
- package/dist/components/date-picker/DateRangePicker.vue_vue_type_script_setup_true_lang.js +212 -0
- package/dist/components/date-picker/DateRangePickerField.js +4 -0
- package/dist/components/date-picker/DateRangePickerField.vue.d.ts +7 -7
- package/dist/components/date-picker/DateRangePickerField.vue_vue_type_script_setup_true_lang.js +228 -0
- package/dist/components/date-picker/date-calendar.theme.js +46 -0
- package/dist/components/date-picker/date-picker.theme.js +16 -0
- package/dist/components/date-picker/useDatePickerControl.js +47 -0
- package/dist/components/date-picker/useDatePickerPopover.js +39 -0
- package/dist/components/date-picker/useDateRangeSelection.js +50 -0
- package/dist/components/date-picker/useDateRangeTyping.js +59 -0
- package/dist/components/date-picker/useDateTypingFocus.js +37 -0
- package/dist/components/date-picker/useSingleDateSelection.js +11 -0
- package/dist/components/date-picker/useSingleDateTyping.js +31 -0
- package/dist/components/date-picker/useTypedDateInput.js +39 -0
- package/dist/components/menu/Menu.js +4 -0
- package/dist/components/menu/Menu.vue.d.ts +3 -2
- package/dist/components/menu/Menu.vue_vue_type_script_setup_true_lang.js +137 -0
- package/dist/components/menu/MenuItemRow.js +4 -0
- package/dist/components/menu/MenuItemRow.vue_vue_type_script_setup_true_lang.js +117 -0
- package/dist/components/menu/MenuPanel.js +4 -0
- package/dist/components/menu/MenuPanel.vue.d.ts +2 -1
- package/dist/components/menu/MenuPanel.vue_vue_type_script_setup_true_lang.js +249 -0
- package/dist/components/menu/menu.theme.d.ts +5 -0
- package/dist/components/menu/menu.theme.js +174 -0
- package/dist/components/menu/menuContext.js +9 -0
- package/dist/components/menu/menuEntries.js +25 -0
- package/dist/components/select/Select.js +4 -0
- package/dist/components/select/Select.vue.d.ts +2 -2
- package/dist/components/select/Select.vue_vue_type_script_setup_true_lang.js +262 -0
- package/dist/components/select/SelectField.js +4 -0
- package/dist/components/select/SelectField.vue.d.ts +2 -2
- package/dist/components/select/SelectField.vue_vue_type_script_setup_true_lang.js +271 -0
- package/dist/components/select/SelectOptionRow.js +4 -0
- package/dist/components/select/SelectOptionRow.vue_vue_type_script_setup_true_lang.js +55 -0
- package/dist/components/select/SelectPanel.js +4 -0
- package/dist/components/select/SelectPanel.vue_vue_type_script_setup_true_lang.js +169 -0
- package/dist/components/select/select-panel.theme.js +44 -0
- package/dist/components/select/selectOptions.d.ts +0 -2
- package/dist/components/select/selectOptions.js +66 -0
- package/dist/components/select/useSelectControl.d.ts +3 -3
- package/dist/components/select/useSelectControl.js +62 -0
- package/dist/components/select/useSelectListbox.js +169 -0
- package/dist/components/slider/RangeSlider.js +4 -0
- package/dist/components/slider/RangeSlider.vue_vue_type_script_setup_true_lang.js +214 -0
- package/dist/components/slider/Slider.js +4 -0
- package/dist/components/slider/Slider.vue_vue_type_script_setup_true_lang.js +151 -0
- package/dist/components/slider/SliderHeader.js +4 -0
- package/dist/components/slider/SliderHeader.vue_vue_type_script_setup_true_lang.js +61 -0
- package/dist/components/slider/slider.theme.js +34 -0
- package/dist/components/text-field/TextField.js +4 -0
- package/dist/components/text-field/TextField.vue.d.ts +2 -2
- package/dist/components/text-field/TextField.vue_vue_type_script_setup_true_lang.js +122 -0
- package/dist/components/text-field/text-field.theme.js +379 -0
- package/dist/components/textarea/Textarea.js +4 -0
- package/dist/components/textarea/Textarea.vue.d.ts +1 -1
- package/dist/components/textarea/Textarea.vue_vue_type_script_setup_true_lang.js +93 -0
- package/dist/components/textarea/textarea.theme.js +222 -0
- package/dist/elements/avatar/Avatar.js +4 -0
- package/dist/elements/avatar/Avatar.vue.d.ts +3 -3
- package/dist/elements/avatar/Avatar.vue_vue_type_script_setup_true_lang.js +71 -0
- package/dist/elements/avatar/avatar.theme.js +141 -0
- package/dist/elements/badge/Badge.js +4 -0
- package/dist/elements/badge/Badge.vue.d.ts +2 -2
- package/dist/elements/badge/Badge.vue_vue_type_script_setup_true_lang.js +49 -0
- package/dist/elements/badge/badge.theme.js +111 -0
- package/dist/elements/button/Button.js +4 -0
- package/dist/elements/button/Button.vue.d.ts +3 -3
- package/dist/elements/button/Button.vue_vue_type_script_setup_true_lang.js +83 -0
- package/dist/elements/button/button.theme.js +424 -0
- package/dist/elements/checkbox/Checkbox.js +4 -0
- package/dist/elements/checkbox/Checkbox.vue.d.ts +3 -1
- package/dist/elements/checkbox/Checkbox.vue_vue_type_script_setup_true_lang.js +69 -0
- package/dist/elements/checkbox/checkbox.theme.d.ts +1 -0
- package/dist/elements/checkbox/checkbox.theme.js +22 -0
- package/dist/elements/circular-progress/CircularProgress.js +4 -0
- package/dist/elements/circular-progress/CircularProgress.vue_vue_type_script_setup_true_lang.js +44 -0
- package/dist/elements/circular-progress/circular-progress.theme.js +8 -0
- package/dist/elements/input/Input.js +4 -0
- package/dist/elements/input/Input.vue.d.ts +62 -0
- package/dist/elements/input/Input.vue_vue_type_script_setup_true_lang.js +138 -0
- package/dist/elements/input/focusInputFromContainer.d.ts +2 -0
- package/dist/elements/input/focusInputFromContainer.js +28 -0
- package/dist/elements/input/index.d.ts +2 -0
- package/dist/elements/input/input.theme.d.ts +81 -0
- package/dist/elements/input/input.theme.js +391 -0
- package/dist/elements/loading-dots/LoadingDots.js +4 -0
- package/dist/elements/loading-dots/LoadingDots.vue_vue_type_script_setup_true_lang.js +26 -0
- package/dist/elements/loading-dots/loading-dots.theme.js +4 -0
- package/dist/elements/loading-indicator/LoadingIndicator.js +4 -0
- package/dist/elements/loading-indicator/LoadingIndicator.vue_vue_type_script_setup_true_lang.js +26 -0
- package/dist/elements/loading-indicator/loading-indicator.theme.js +4 -0
- package/dist/elements/popover/Popover.js +4 -0
- package/dist/elements/popover/Popover.vue.d.ts +60 -0
- package/dist/elements/popover/Popover.vue_vue_type_script_setup_true_lang.js +218 -0
- package/dist/elements/popover/index.d.ts +2 -0
- package/dist/elements/popover/popover.theme.d.ts +20 -0
- package/dist/elements/popover/popover.theme.js +17 -0
- package/dist/elements/popover/popoverLayers.d.ts +5 -0
- package/dist/elements/popover/popoverLayers.js +22 -0
- package/dist/elements/radio-group/RadioGroup.js +4 -0
- package/dist/elements/radio-group/RadioGroup.vue.d.ts +1 -1
- package/dist/elements/radio-group/RadioGroup.vue_vue_type_script_setup_true_lang.js +105 -0
- package/dist/elements/radio-group/radio-group.theme.js +126 -0
- package/dist/elements/segmented-control/SegmentedControl.js +4 -0
- package/dist/elements/segmented-control/SegmentedControl.vue.d.ts +1 -1
- package/dist/elements/segmented-control/SegmentedControl.vue_vue_type_script_setup_true_lang.js +98 -0
- package/dist/elements/segmented-control/segmented-control.theme.js +201 -0
- package/dist/elements/select-control/SelectControl.js +4 -0
- package/dist/elements/select-control/SelectControl.vue.d.ts +1 -1
- package/dist/elements/select-control/SelectControl.vue_vue_type_script_setup_true_lang.js +105 -0
- package/dist/elements/select-control/select-control.theme.js +360 -0
- package/dist/elements/select-field-control/SelectFieldControl.js +4 -0
- package/dist/elements/select-field-control/SelectFieldControl.vue.d.ts +1 -1
- package/dist/elements/select-field-control/SelectFieldControl.vue_vue_type_script_setup_true_lang.js +123 -0
- package/dist/elements/select-field-control/select-field-control.theme.js +299 -0
- package/dist/elements/slider-control/SliderControl.js +4 -0
- package/dist/elements/slider-control/SliderControl.vue_vue_type_script_setup_true_lang.js +228 -0
- package/dist/elements/slider-control/slider-control.theme.js +35 -0
- package/dist/elements/slider-control/useSliderMarksLayout.js +25 -0
- package/dist/elements/switch/Switch.js +4 -0
- package/dist/elements/switch/Switch.vue.d.ts +1 -1
- package/dist/elements/switch/Switch.vue_vue_type_script_setup_true_lang.js +71 -0
- package/dist/elements/switch/switch.theme.js +37 -0
- package/dist/elements/text-link/TextLink.js +4 -0
- package/dist/elements/text-link/TextLink.vue_vue_type_script_setup_true_lang.js +64 -0
- package/dist/elements/text-link/text-link.theme.js +25 -0
- package/dist/elements/tooltip/Tooltip.js +4 -0
- package/dist/elements/tooltip/Tooltip.vue_vue_type_script_setup_true_lang.js +161 -0
- package/dist/elements/tooltip/tooltip.theme.js +46 -0
- package/dist/elements/tooltip/useTooltipOpenState.js +57 -0
- package/dist/index.d.ts +17 -0
- package/dist/index.js +38 -1
- package/dist/nuxt.js +12 -13
- package/dist/shared/composables/useApplePlatform.js +10 -0
- package/dist/shared/composables/useCalendarLabels.js +13 -0
- package/dist/shared/composables/useCustomColor.js +10 -0
- package/dist/shared/composables/useDismissOnOutsidePointerDown.d.ts +1 -1
- package/dist/shared/composables/useDismissOnOutsidePointerDown.js +14 -0
- package/dist/shared/composables/useFieldDescription.js +16 -0
- package/dist/shared/composables/useFloatingPosition.d.ts +3 -2
- package/dist/shared/composables/useFloatingPosition.js +113 -0
- package/dist/shared/composables/useMask.js +32 -0
- package/dist/shared/composables/useMaskedFieldModel.d.ts +7 -0
- package/dist/shared/composables/useMaskedFieldModel.js +19 -0
- package/dist/shared/composables/useNumberFieldTyping.js +70 -0
- package/dist/shared/composables/usePointerGraceArea.js +40 -0
- package/dist/shared/composables/useRowSelection.d.ts +17 -0
- package/dist/shared/composables/useRowSelection.js +40 -0
- package/dist/shared/composables/useShortcuts.js +21 -0
- package/dist/shared/composables/useSlidingThumb.js +65 -0
- package/dist/shared/composables/useTableRows.d.ts +26 -0
- package/dist/shared/composables/useTableRows.js +41 -0
- package/dist/shared/types/floating-position.d.ts +9 -0
- package/dist/shared/types/table.d.ts +59 -0
- package/dist/shared/types/value-path.d.ts +6 -0
- package/dist/shared/utils/calendarMonth.js +23 -0
- package/dist/shared/utils/computeFloatingPosition.js +32 -0
- package/dist/shared/utils/createDateFormatters.js +31 -0
- package/dist/shared/utils/createDateInputMask.js +103 -0
- package/dist/shared/utils/createDebouncedCallback.js +17 -0
- package/dist/shared/utils/createMask.js +65 -0
- package/dist/shared/utils/createShortcutHandler.js +60 -0
- package/dist/shared/utils/createTypeaheadSearch.js +16 -0
- package/dist/shared/utils/editableFieldGuard.js +11 -0
- package/dist/shared/utils/findFirstRenderedVNode.js +14 -0
- package/dist/shared/utils/flipFloatingPosition.js +28 -0
- package/dist/shared/utils/floatingPanelTransition.js +25 -0
- package/dist/shared/utils/formatShortcut.js +86 -0
- package/dist/shared/utils/isApplePlatform.js +5 -0
- package/dist/shared/utils/isExternalUrl.js +5 -0
- package/dist/shared/utils/isoDate.js +50 -0
- package/dist/shared/utils/normalizeSearchText.d.ts +2 -0
- package/dist/shared/utils/normalizeSearchText.js +6 -0
- package/dist/shared/utils/parseShortcut.js +48 -0
- package/dist/shared/utils/pointerGraceArea.js +92 -0
- package/dist/shared/utils/readValueAtPath.d.ts +2 -0
- package/dist/shared/utils/readValueAtPath.js +7 -0
- package/dist/shared/utils/resolveFloatingAnchor.d.ts +4 -0
- package/dist/shared/utils/resolveFloatingAnchor.js +15 -0
- package/dist/shared/utils/resolvePressScale.js +5 -0
- package/dist/shared/utils/shiftFloatingPosition.js +21 -0
- package/dist/shared/utils/sliderPosition.js +27 -0
- package/dist/shared/utils/sliderThumbs.js +16 -0
- package/dist/shared/utils/steppedValue.js +21 -0
- package/dist/shared/utils/tableColumnTypes.d.ts +21 -0
- package/dist/shared/utils/tableColumnTypes.js +77 -0
- package/dist/shared/utils/tableColumns.d.ts +20 -0
- package/dist/shared/utils/tableColumns.js +77 -0
- package/dist/shared/utils/tableGroups.d.ts +10 -0
- package/dist/shared/utils/tableGroups.js +34 -0
- package/dist/shared/utils/tableRows.d.ts +25 -0
- package/dist/shared/utils/tableRows.js +80 -0
- package/dist/shared/utils/tableTree.d.ts +15 -0
- package/dist/shared/utils/tableTree.js +22 -0
- package/dist/shared/utils/toggleColumnSort.d.ts +5 -0
- package/dist/shared/utils/toggleColumnSort.js +27 -0
- package/dist/shared/utils/tv.js +1 -0
- package/dist/shared/utils/warnInDevelopment.d.ts +3 -0
- package/dist/shared/utils/warnInDevelopment.js +13 -0
- package/package.json +1 -1
- package/src/index.css +1 -0
- package/src/shared/styles/utilities/shake.css +21 -0
- package/dist/src-Rouj5r7z.js +0 -9111
|
@@ -0,0 +1,218 @@
|
|
|
1
|
+
import { useDismissOnOutsidePointerDown as e } from "../../shared/composables/useDismissOnOutsidePointerDown.js";
|
|
2
|
+
import { useFloatingPosition as t } from "../../shared/composables/useFloatingPosition.js";
|
|
3
|
+
import { usePointerGraceArea as n } from "../../shared/composables/usePointerGraceArea.js";
|
|
4
|
+
import { useShortcuts as r } from "../../shared/composables/useShortcuts.js";
|
|
5
|
+
import { createShortcutHandler as ee } from "../../shared/utils/createShortcutHandler.js";
|
|
6
|
+
import { findFirstRenderedVNode as i } from "../../shared/utils/findFirstRenderedVNode.js";
|
|
7
|
+
import { flipFloatingPosition as a } from "../../shared/utils/flipFloatingPosition.js";
|
|
8
|
+
import { isFloatingPoint as o, resolveFloatingAnchor as s } from "../../shared/utils/resolveFloatingAnchor.js";
|
|
9
|
+
import { shiftFloatingPosition as c } from "../../shared/utils/shiftFloatingPosition.js";
|
|
10
|
+
import { popoverTheme as l } from "./popover.theme.js";
|
|
11
|
+
import { isInFloatingLayerAbove as te, isTopmostOpenPopover as ne, registerOpenPopover as re, unregisterOpenPopover as u } from "./popoverLayers.js";
|
|
12
|
+
import { Fragment as ie, Teleport as ae, cloneVNode as d, computed as f, createBlock as p, createCommentVNode as m, createElementBlock as h, defineComponent as g, mergeModels as _, normalizeClass as v, normalizeStyle as y, onBeforeUnmount as b, onMounted as x, openBlock as S, renderSlot as oe, resolveDynamicComponent as se, shallowRef as C, unref as w, useAttrs as ce, useId as le, useModel as ue, useSlots as de, useTemplateRef as fe, watch as T } from "vue";
|
|
13
|
+
// src/elements/popover/Popover.vue?vue&type=script&setup=true&lang.ts
|
|
14
|
+
var pe = ["id", "aria-label"], E = /*@__PURE__*/ g({
|
|
15
|
+
inheritAttrs: !1,
|
|
16
|
+
__name: "Popover",
|
|
17
|
+
props: /*@__PURE__*/ _({
|
|
18
|
+
label: {},
|
|
19
|
+
anchor: {},
|
|
20
|
+
showOnHover: { type: Boolean },
|
|
21
|
+
hoverOpenDelay: { default: 150 },
|
|
22
|
+
side: { default: "bottom" },
|
|
23
|
+
align: { default: "center" },
|
|
24
|
+
sideOffset: {},
|
|
25
|
+
alignOffset: {},
|
|
26
|
+
width: { default: "auto" },
|
|
27
|
+
minWidth: { default: 300 },
|
|
28
|
+
maxWidth: { default: 700 },
|
|
29
|
+
translucent: { type: Boolean },
|
|
30
|
+
autoFocus: {
|
|
31
|
+
type: Boolean,
|
|
32
|
+
default: !0
|
|
33
|
+
},
|
|
34
|
+
avoidCollisions: {
|
|
35
|
+
type: Boolean,
|
|
36
|
+
default: !0
|
|
37
|
+
},
|
|
38
|
+
strategy: { default: "absolute" },
|
|
39
|
+
ui: {},
|
|
40
|
+
class: { type: [
|
|
41
|
+
Array,
|
|
42
|
+
String,
|
|
43
|
+
null,
|
|
44
|
+
Number,
|
|
45
|
+
Boolean
|
|
46
|
+
] }
|
|
47
|
+
}, {
|
|
48
|
+
open: {
|
|
49
|
+
type: Boolean,
|
|
50
|
+
default: !1
|
|
51
|
+
},
|
|
52
|
+
openModifiers: {}
|
|
53
|
+
}),
|
|
54
|
+
emits: ["update:open"],
|
|
55
|
+
setup(g, { expose: _ }) {
|
|
56
|
+
let E = g, D = ue(g, "open"), me = de(), O = ce(), k = le(), A = Symbol("popover"), j = C(), M = fe("popoverPanel"), N = C(!1), P, F, I = !1, L = !1, R = !1, z, B = f(() => !!(E.anchor && o(E.anchor))), he = f(() => E.anchor ? s(E.anchor) : j.value), ge = f(() => V() ?? j.value), _e = f(() => E.sideOffset ?? (B.value ? 0 : 8)), ve = f(() => E.alignOffset ?? (B.value || E.align === "center" ? 0 : -5));
|
|
57
|
+
function V() {
|
|
58
|
+
return E.anchor instanceof HTMLElement ? E.anchor : void 0;
|
|
59
|
+
}
|
|
60
|
+
let { floatingStyles: ye, isPositioned: be } = t(he, M, {
|
|
61
|
+
open: D,
|
|
62
|
+
side: () => E.side,
|
|
63
|
+
align: () => E.align,
|
|
64
|
+
sideOffset: _e,
|
|
65
|
+
alignOffset: ve,
|
|
66
|
+
strategy: () => E.strategy,
|
|
67
|
+
positionModifiers: () => E.avoidCollisions ? [a(20), c(20)] : []
|
|
68
|
+
}), xe = f(() => l({
|
|
69
|
+
translucent: E.translucent,
|
|
70
|
+
shaking: N.value
|
|
71
|
+
})), Se = f(() => ({
|
|
72
|
+
...ye.value,
|
|
73
|
+
width: E.width === "auto" ? void 0 : `${E.width}px`,
|
|
74
|
+
minWidth: E.minWidth === "auto" ? void 0 : `${E.minWidth}px`,
|
|
75
|
+
maxWidth: `min(${E.maxWidth}px, calc(100vw - 40px))`
|
|
76
|
+
}));
|
|
77
|
+
function H(e) {
|
|
78
|
+
clearTimeout(F), I = e && E.showOnHover, I && (F = setTimeout(() => {
|
|
79
|
+
I = !1;
|
|
80
|
+
}, 500));
|
|
81
|
+
}
|
|
82
|
+
function U() {
|
|
83
|
+
clearTimeout(P), D.value || (D.value = !0, H(!0));
|
|
84
|
+
}
|
|
85
|
+
function W({ restoreFocus: e }) {
|
|
86
|
+
if (clearTimeout(P), !D.value) return;
|
|
87
|
+
let t = E.showOnHover ? R : e, n = j.value ?? z;
|
|
88
|
+
N.value = !1, R = !1, D.value = !1, H(!1), t && n?.focus();
|
|
89
|
+
}
|
|
90
|
+
function G() {
|
|
91
|
+
W({ restoreFocus: !0 });
|
|
92
|
+
}
|
|
93
|
+
function K() {
|
|
94
|
+
N.value = !1, requestAnimationFrame(() => {
|
|
95
|
+
N.value = !0;
|
|
96
|
+
});
|
|
97
|
+
}
|
|
98
|
+
function q(e) {
|
|
99
|
+
return [...e.querySelectorAll("a[href], button:not([disabled]), input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex=\"-1\"])")];
|
|
100
|
+
}
|
|
101
|
+
function J(e) {
|
|
102
|
+
let t = M.value;
|
|
103
|
+
return !!j.value?.contains(e) || !!t?.contains(e) || !!(t && te(t, e));
|
|
104
|
+
}
|
|
105
|
+
function Ce(e) {
|
|
106
|
+
!e.defaultPrevented && ne(A) && (e.preventDefault(), W({ restoreFocus: !0 }));
|
|
107
|
+
}
|
|
108
|
+
function we(e) {
|
|
109
|
+
let t = M.value;
|
|
110
|
+
if (!t || document.activeElement && t.contains(document.activeElement)) return;
|
|
111
|
+
let [n] = q(t);
|
|
112
|
+
n && (e.preventDefault(), n.focus(), R = !0);
|
|
113
|
+
}
|
|
114
|
+
r({ escape: {
|
|
115
|
+
handler: Ce,
|
|
116
|
+
preventDefault: !1,
|
|
117
|
+
allowInEditable: !0
|
|
118
|
+
} }, { enabled: D }), r({ tab: {
|
|
119
|
+
handler: we,
|
|
120
|
+
preventDefault: !1,
|
|
121
|
+
allowInEditable: !0
|
|
122
|
+
} }, { enabled: () => D.value && E.showOnHover });
|
|
123
|
+
let { isPointerInTransit: Te } = n(ge, M, {
|
|
124
|
+
active: () => E.showOnHover && D.value,
|
|
125
|
+
onPointerLeaveArea: () => W({ restoreFocus: !1 })
|
|
126
|
+
});
|
|
127
|
+
e([j, M], {
|
|
128
|
+
active: D,
|
|
129
|
+
onDismiss: (e) => {
|
|
130
|
+
e.target instanceof Node && J(e.target) || W({ restoreFocus: !1 });
|
|
131
|
+
}
|
|
132
|
+
});
|
|
133
|
+
let Y = ee({ "shift+tab": {
|
|
134
|
+
handler: (e) => {
|
|
135
|
+
let t = M.value;
|
|
136
|
+
t && e.target === t && (e.preventDefault(), q(t).at(-1)?.focus());
|
|
137
|
+
},
|
|
138
|
+
preventDefault: !1
|
|
139
|
+
} });
|
|
140
|
+
function Ee(e) {
|
|
141
|
+
let t = e.relatedTarget;
|
|
142
|
+
t instanceof Node && !J(t) && W({ restoreFocus: !1 });
|
|
143
|
+
}
|
|
144
|
+
function X(e) {
|
|
145
|
+
e.defaultPrevented || I || (D.value ? W({ restoreFocus: !1 }) : U());
|
|
146
|
+
}
|
|
147
|
+
function Z(e) {
|
|
148
|
+
e.pointerType === "touch" || L || Te.value || (L = !0, P = setTimeout(U, E.hoverOpenDelay));
|
|
149
|
+
}
|
|
150
|
+
function Q() {
|
|
151
|
+
clearTimeout(P), L = !1;
|
|
152
|
+
}
|
|
153
|
+
function $() {
|
|
154
|
+
setTimeout(() => {
|
|
155
|
+
let e = document.activeElement;
|
|
156
|
+
e && M.value?.contains(e) || W({ restoreFocus: !1 });
|
|
157
|
+
}, 50);
|
|
158
|
+
}
|
|
159
|
+
function De(e) {
|
|
160
|
+
let t = e instanceof Element ? e : e?.$el;
|
|
161
|
+
j.value = t instanceof HTMLElement ? t : void 0;
|
|
162
|
+
}
|
|
163
|
+
function Oe() {
|
|
164
|
+
return E.showOnHover ? {
|
|
165
|
+
onPointermove: Z,
|
|
166
|
+
onPointerleave: Q,
|
|
167
|
+
onFocusin: U,
|
|
168
|
+
onFocusout: $
|
|
169
|
+
} : {};
|
|
170
|
+
}
|
|
171
|
+
function ke() {
|
|
172
|
+
let e = i(me.default?.() ?? []);
|
|
173
|
+
return e ? d(e, {
|
|
174
|
+
...O,
|
|
175
|
+
ref: De,
|
|
176
|
+
"aria-haspopup": "dialog",
|
|
177
|
+
"aria-expanded": D.value,
|
|
178
|
+
"aria-controls": D.value ? k : void 0,
|
|
179
|
+
"data-state": D.value ? "open" : "closed",
|
|
180
|
+
onClick: X,
|
|
181
|
+
...Oe()
|
|
182
|
+
}, !0) : m("");
|
|
183
|
+
}
|
|
184
|
+
return x(() => {
|
|
185
|
+
T(D, (e) => {
|
|
186
|
+
e ? (re(A), z = document.activeElement instanceof HTMLElement ? document.activeElement : void 0) : u(A);
|
|
187
|
+
}, { immediate: !0 }), T(() => [E.showOnHover, V()], ([e, t], n, r) => {
|
|
188
|
+
e && t && (t.addEventListener("pointermove", Z), t.addEventListener("pointerleave", Q), t.addEventListener("focusin", U), t.addEventListener("focusout", $), r(() => {
|
|
189
|
+
t.removeEventListener("pointermove", Z), t.removeEventListener("pointerleave", Q), t.removeEventListener("focusin", U), t.removeEventListener("focusout", $);
|
|
190
|
+
}));
|
|
191
|
+
}, { immediate: !0 }), T([M, be], ([e, t]) => {
|
|
192
|
+
e && t && E.autoFocus && !E.showOnHover && (document.activeElement && e.contains(document.activeElement) || e.focus({ preventScroll: !0 }));
|
|
193
|
+
}, { flush: "post" });
|
|
194
|
+
}), b(() => {
|
|
195
|
+
clearTimeout(P), clearTimeout(F), u(A);
|
|
196
|
+
}), _({
|
|
197
|
+
close: G,
|
|
198
|
+
shake: K
|
|
199
|
+
}), (e, t) => (S(), h(ie, null, [(S(), p(se(ke()))), (S(), p(ae, { to: "body" }, [D.value ? (S(), h("div", {
|
|
200
|
+
key: 0,
|
|
201
|
+
id: w(k),
|
|
202
|
+
ref_key: "popoverPanel",
|
|
203
|
+
ref: M,
|
|
204
|
+
role: "dialog",
|
|
205
|
+
"aria-label": g.label,
|
|
206
|
+
tabindex: "-1",
|
|
207
|
+
"data-state": "open",
|
|
208
|
+
style: y(Se.value),
|
|
209
|
+
class: v(xe.value.base({ class: [g.ui?.base, E.class] })),
|
|
210
|
+
onKeydown: t[0] ||= (...e) => w(Y) && w(Y)(...e),
|
|
211
|
+
onFocusout: Ee
|
|
212
|
+
}, [oe(e.$slots, "content", {
|
|
213
|
+
close: G,
|
|
214
|
+
shake: K
|
|
215
|
+
})], 46, pe)) : m("", !0)]))], 64));
|
|
216
|
+
}
|
|
217
|
+
});
|
|
218
|
+
export { E as default };
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { type VariantProps } from '../../shared/utils/tv';
|
|
2
|
+
export declare const popoverTheme: import("tailwind-variants").TVReturnType<{
|
|
3
|
+
translucent: {
|
|
4
|
+
true: {
|
|
5
|
+
base: string;
|
|
6
|
+
};
|
|
7
|
+
false: {
|
|
8
|
+
base: string;
|
|
9
|
+
};
|
|
10
|
+
};
|
|
11
|
+
shaking: {
|
|
12
|
+
true: {
|
|
13
|
+
base: string;
|
|
14
|
+
};
|
|
15
|
+
};
|
|
16
|
+
}, {
|
|
17
|
+
base: string;
|
|
18
|
+
}, undefined, undefined, undefined, undefined>;
|
|
19
|
+
export type PopoverThemeVariants = VariantProps<typeof popoverTheme>;
|
|
20
|
+
export type PopoverSlotName = keyof ReturnType<typeof popoverTheme>;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { tv as e } from "../../shared/utils/tv.js";
|
|
2
|
+
// src/elements/popover/popover.theme.ts
|
|
3
|
+
var t = e({
|
|
4
|
+
slots: { base: "z-10 max-h-[calc(100vh-40px)] overflow-auto rounded-xl border border-line text-start text-sm font-normal shadow-lg outline-none" },
|
|
5
|
+
variants: {
|
|
6
|
+
translucent: {
|
|
7
|
+
true: { base: "bg-linear-to-t backdrop-blur-[16px] light:from-stone-50/50 light:to-stone-50 dark:from-stone-600/25 dark:to-stone-600/49" },
|
|
8
|
+
false: { base: "bg-widget" }
|
|
9
|
+
},
|
|
10
|
+
shaking: { true: { base: "shake" } }
|
|
11
|
+
},
|
|
12
|
+
defaultVariants: {
|
|
13
|
+
translucent: !1,
|
|
14
|
+
shaking: !1
|
|
15
|
+
}
|
|
16
|
+
});
|
|
17
|
+
export { t as popoverTheme };
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export declare function registerOpenPopover(popoverKey: symbol): void;
|
|
2
|
+
export declare function unregisterOpenPopover(popoverKey: symbol): void;
|
|
3
|
+
export declare function isTopmostOpenPopover(popoverKey: symbol): boolean;
|
|
4
|
+
/** Tell whether a node sits in a floating layer opened after the panel, like a nested popover, menu or select list. */
|
|
5
|
+
export declare function isInFloatingLayerAbove(panelElement: HTMLElement, pageNode: Node): boolean;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
// src/elements/popover/popoverLayers.ts
|
|
2
|
+
var e = [];
|
|
3
|
+
function t(t) {
|
|
4
|
+
e.includes(t) || e.push(t);
|
|
5
|
+
}
|
|
6
|
+
function n(t) {
|
|
7
|
+
let n = e.indexOf(t);
|
|
8
|
+
n !== -1 && e.splice(n, 1);
|
|
9
|
+
}
|
|
10
|
+
function r(t) {
|
|
11
|
+
return e.at(-1) === t;
|
|
12
|
+
}
|
|
13
|
+
function i(e) {
|
|
14
|
+
let t = e;
|
|
15
|
+
for (; t.parentNode && t.parentNode !== document.body;) t = t.parentNode;
|
|
16
|
+
return t.parentNode === document.body ? t : void 0;
|
|
17
|
+
}
|
|
18
|
+
function a(e, t) {
|
|
19
|
+
let n = i(e), r = i(t);
|
|
20
|
+
return !n || !r || n === r ? !1 : !!(n.compareDocumentPosition(r) & Node.DOCUMENT_POSITION_FOLLOWING);
|
|
21
|
+
}
|
|
22
|
+
export { a as isInFloatingLayerAbove, r as isTopmostOpenPopover, t as registerOpenPopover, n as unregisterOpenPopover };
|
|
@@ -31,6 +31,6 @@ declare const __VLS_export: import("vue").DefineComponent<RadioGroupProps & {
|
|
|
31
31
|
"onUpdate:modelValue"?: ((value: string | undefined) => any) | undefined;
|
|
32
32
|
}>, {
|
|
33
33
|
variant: "default" | "card";
|
|
34
|
-
color: "primary" | "secondary" |
|
|
34
|
+
color: "primary" | "secondary" | (string & {}) | "neutral";
|
|
35
35
|
direction: "col" | "row";
|
|
36
36
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
import { useCustomColor as e } from "../../shared/composables/useCustomColor.js";
|
|
2
|
+
import { radioGroupTheme as t } from "./radio-group.theme.js";
|
|
3
|
+
import { Fragment as n, computed as r, createCommentVNode as i, createElementBlock as a, createElementVNode as o, createTextVNode as s, createVNode as c, defineComponent as l, mergeModels as u, normalizeClass as d, normalizeStyle as f, openBlock as p, renderList as m, toDisplayString as h, unref as g, useId as _, useModel as v, vModelRadio as y, withDirectives as b } from "vue";
|
|
4
|
+
import { CircleAlert as x } from "lucide-vue-next";
|
|
5
|
+
// src/elements/radio-group/RadioGroup.vue?vue&type=script&setup=true&lang.ts
|
|
6
|
+
var S = [
|
|
7
|
+
"disabled",
|
|
8
|
+
"aria-invalid",
|
|
9
|
+
"aria-describedby"
|
|
10
|
+
], C = [
|
|
11
|
+
"name",
|
|
12
|
+
"value",
|
|
13
|
+
"disabled",
|
|
14
|
+
"aria-labelledby",
|
|
15
|
+
"aria-describedby"
|
|
16
|
+
], w = ["id"], T = ["id"], E = /*@__PURE__*/ l({
|
|
17
|
+
__name: "RadioGroup",
|
|
18
|
+
props: /*@__PURE__*/ u({
|
|
19
|
+
label: {},
|
|
20
|
+
options: {},
|
|
21
|
+
name: {},
|
|
22
|
+
direction: { default: "row" },
|
|
23
|
+
variant: { default: "default" },
|
|
24
|
+
color: { default: "neutral" },
|
|
25
|
+
hideLabel: { type: Boolean },
|
|
26
|
+
disabled: { type: Boolean },
|
|
27
|
+
errorMessage: {},
|
|
28
|
+
ui: {},
|
|
29
|
+
class: { type: [
|
|
30
|
+
Array,
|
|
31
|
+
String,
|
|
32
|
+
null,
|
|
33
|
+
Number,
|
|
34
|
+
Boolean
|
|
35
|
+
] }
|
|
36
|
+
}, {
|
|
37
|
+
modelValue: {},
|
|
38
|
+
modelModifiers: {}
|
|
39
|
+
}),
|
|
40
|
+
emits: ["update:modelValue"],
|
|
41
|
+
setup(l) {
|
|
42
|
+
let u = l, E = v(l, "modelValue"), { themeColor: D, customColorVariable: O } = e(() => u.color, t.variants.color), k = _(), A = `${k}-error`, j = r(() => u.name ?? k), M = r(() => t({
|
|
43
|
+
variant: u.variant,
|
|
44
|
+
direction: u.direction,
|
|
45
|
+
color: D.value,
|
|
46
|
+
hideLabel: u.hideLabel,
|
|
47
|
+
hasDescriptions: u.options.some((e) => e.description),
|
|
48
|
+
invalid: !!u.errorMessage
|
|
49
|
+
}));
|
|
50
|
+
function N(e) {
|
|
51
|
+
return `${k}-option-${e}`;
|
|
52
|
+
}
|
|
53
|
+
function P(e) {
|
|
54
|
+
return u.disabled || !!e.disabled;
|
|
55
|
+
}
|
|
56
|
+
return (e, t) => (p(), a("fieldset", {
|
|
57
|
+
role: "radiogroup",
|
|
58
|
+
disabled: l.disabled,
|
|
59
|
+
"aria-invalid": l.errorMessage ? "true" : void 0,
|
|
60
|
+
"aria-describedby": l.errorMessage ? A : void 0,
|
|
61
|
+
class: d(M.value.root({ class: [l.ui?.root, u.class] })),
|
|
62
|
+
style: f(g(O))
|
|
63
|
+
}, [
|
|
64
|
+
o("legend", { class: d(M.value.legend({ class: l.ui?.legend })) }, h(l.label), 3),
|
|
65
|
+
o("div", { class: d(M.value.optionList({ class: l.ui?.optionList })) }, [(p(!0), a(n, null, m(l.options, (e, r) => (p(), a("label", {
|
|
66
|
+
key: e.value,
|
|
67
|
+
class: d(M.value.option({
|
|
68
|
+
optionDisabled: P(e),
|
|
69
|
+
optionHasDescription: !!e.description,
|
|
70
|
+
class: l.ui?.option
|
|
71
|
+
}))
|
|
72
|
+
}, [o("span", { class: d(M.value.container({ class: l.ui?.container })) }, [o("span", { class: d(M.value.base({
|
|
73
|
+
optionDisabled: P(e),
|
|
74
|
+
class: l.ui?.base
|
|
75
|
+
})) }, [b(o("input", {
|
|
76
|
+
"onUpdate:modelValue": t[0] ||= (e) => E.value = e,
|
|
77
|
+
type: "radio",
|
|
78
|
+
name: j.value,
|
|
79
|
+
value: e.value,
|
|
80
|
+
disabled: e.disabled,
|
|
81
|
+
"aria-labelledby": e.description ? `${N(r)}-label` : void 0,
|
|
82
|
+
"aria-describedby": e.description ? `${N(r)}-description` : void 0,
|
|
83
|
+
class: "peer sr-only"
|
|
84
|
+
}, null, 8, C), [[y, E.value]]), o("span", {
|
|
85
|
+
"aria-hidden": "true",
|
|
86
|
+
class: d(M.value.indicator({ class: l.ui?.indicator }))
|
|
87
|
+
}, null, 2)], 2)], 2), e.description ? (p(), a("span", {
|
|
88
|
+
key: 0,
|
|
89
|
+
class: d(M.value.wrapper({ class: l.ui?.wrapper }))
|
|
90
|
+
}, [o("span", {
|
|
91
|
+
id: `${N(r)}-label`,
|
|
92
|
+
class: d(M.value.label({ class: l.ui?.label }))
|
|
93
|
+
}, h(e.label), 11, w), o("span", {
|
|
94
|
+
id: `${N(r)}-description`,
|
|
95
|
+
class: d(M.value.description({ class: l.ui?.description }))
|
|
96
|
+
}, h(e.description), 11, T)], 2)) : (p(), a(n, { key: 1 }, [s(h(e.label), 1)], 64))], 2))), 128))], 2),
|
|
97
|
+
l.errorMessage ? (p(), a("p", {
|
|
98
|
+
key: 0,
|
|
99
|
+
id: A,
|
|
100
|
+
class: d(M.value.errorMessage({ class: l.ui?.errorMessage }))
|
|
101
|
+
}, [c(g(x), { class: d(M.value.errorIcon({ class: l.ui?.errorIcon })) }, null, 8, ["class"]), s(" " + h(l.errorMessage), 1)], 2)) : i("", !0)
|
|
102
|
+
], 14, S));
|
|
103
|
+
}
|
|
104
|
+
});
|
|
105
|
+
export { E as default };
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
import { tv as e } from "../../shared/utils/tv.js";
|
|
2
|
+
// src/elements/radio-group/radio-group.theme.ts
|
|
3
|
+
var t = e({
|
|
4
|
+
slots: {
|
|
5
|
+
root: "min-w-0",
|
|
6
|
+
legend: "",
|
|
7
|
+
optionList: "",
|
|
8
|
+
option: "items-start text-sm leading-5",
|
|
9
|
+
container: "flex h-5 shrink-0 items-center",
|
|
10
|
+
base: "relative flex size-4 items-center justify-center rounded-full border outline-primary transition-colors has-focus-visible:outline-2 has-focus-visible:outline-offset-2",
|
|
11
|
+
indicator: "hidden size-1.5 rounded-full transition-transform duration-600 ease-[cubic-bezier(0.19,1,0.22,1)] peer-checked:block starting:scale-0 light:bg-white dark:bg-stone-950",
|
|
12
|
+
wrapper: "",
|
|
13
|
+
label: "block font-medium",
|
|
14
|
+
description: "mt-0.5 block text-muted",
|
|
15
|
+
errorMessage: "mt-3 flex items-start gap-x-1.5 text-xs light:text-red-600 dark:text-red-400",
|
|
16
|
+
errorIcon: "mt-px size-3.5 shrink-0"
|
|
17
|
+
},
|
|
18
|
+
variants: {
|
|
19
|
+
variant: {
|
|
20
|
+
default: { option: "inline-flex" },
|
|
21
|
+
card: { option: "flex w-full gap-x-2.5 rounded-2xl border p-4 transition-colors" }
|
|
22
|
+
},
|
|
23
|
+
direction: {
|
|
24
|
+
row: "",
|
|
25
|
+
col: ""
|
|
26
|
+
},
|
|
27
|
+
color: {
|
|
28
|
+
primary: { base: "has-checked:border-primary has-checked:bg-primary" },
|
|
29
|
+
secondary: { base: "has-checked:border-secondary has-checked:bg-secondary" },
|
|
30
|
+
neutral: { base: "light:has-checked:border-neutral-900 light:has-checked:bg-neutral-900 dark:has-checked:border-stone-200 dark:has-checked:bg-stone-200" }
|
|
31
|
+
},
|
|
32
|
+
hideLabel: {
|
|
33
|
+
true: { legend: "sr-only" },
|
|
34
|
+
false: { legend: "mb-3 text-sm font-semibold" }
|
|
35
|
+
},
|
|
36
|
+
hasDescriptions: { true: "" },
|
|
37
|
+
invalid: { true: { base: "light:border-red-600 dark:border-red-500" } },
|
|
38
|
+
optionDisabled: {
|
|
39
|
+
true: { option: "cursor-not-allowed opacity-50" },
|
|
40
|
+
false: { option: "cursor-pointer" }
|
|
41
|
+
},
|
|
42
|
+
optionHasDescription: { true: "" }
|
|
43
|
+
},
|
|
44
|
+
compoundVariants: [
|
|
45
|
+
{
|
|
46
|
+
variant: "card",
|
|
47
|
+
direction: "row",
|
|
48
|
+
class: { optionList: "grid gap-3 sm:auto-cols-fr sm:grid-flow-col" }
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
variant: "card",
|
|
52
|
+
direction: "col",
|
|
53
|
+
class: { optionList: "flex flex-col gap-y-3" }
|
|
54
|
+
},
|
|
55
|
+
{
|
|
56
|
+
variant: "default",
|
|
57
|
+
direction: "row",
|
|
58
|
+
class: { optionList: "flex flex-wrap gap-x-5 gap-y-2.5" }
|
|
59
|
+
},
|
|
60
|
+
{
|
|
61
|
+
variant: "default",
|
|
62
|
+
direction: "col",
|
|
63
|
+
hasDescriptions: !0,
|
|
64
|
+
class: { optionList: "flex flex-col items-start gap-y-4" }
|
|
65
|
+
},
|
|
66
|
+
{
|
|
67
|
+
variant: "default",
|
|
68
|
+
direction: "col",
|
|
69
|
+
hasDescriptions: !1,
|
|
70
|
+
class: { optionList: "flex flex-col items-start gap-y-2.5" }
|
|
71
|
+
},
|
|
72
|
+
{
|
|
73
|
+
variant: "default",
|
|
74
|
+
optionHasDescription: !0,
|
|
75
|
+
class: { option: "gap-x-2.5" }
|
|
76
|
+
},
|
|
77
|
+
{
|
|
78
|
+
variant: "default",
|
|
79
|
+
optionHasDescription: !1,
|
|
80
|
+
class: { option: "gap-x-1.5" }
|
|
81
|
+
},
|
|
82
|
+
{
|
|
83
|
+
variant: "card",
|
|
84
|
+
color: "primary",
|
|
85
|
+
class: { option: "has-checked:border-primary" }
|
|
86
|
+
},
|
|
87
|
+
{
|
|
88
|
+
variant: "card",
|
|
89
|
+
color: "secondary",
|
|
90
|
+
class: { option: "has-checked:border-secondary" }
|
|
91
|
+
},
|
|
92
|
+
{
|
|
93
|
+
variant: "card",
|
|
94
|
+
color: "neutral",
|
|
95
|
+
class: { option: "light:has-checked:border-neutral-900 dark:has-checked:border-stone-200" }
|
|
96
|
+
},
|
|
97
|
+
{
|
|
98
|
+
variant: "card",
|
|
99
|
+
invalid: !0,
|
|
100
|
+
class: { option: "light:border-red-600 dark:border-red-500" }
|
|
101
|
+
},
|
|
102
|
+
{
|
|
103
|
+
variant: "card",
|
|
104
|
+
invalid: !1,
|
|
105
|
+
optionDisabled: !0,
|
|
106
|
+
class: { option: "border-line" }
|
|
107
|
+
},
|
|
108
|
+
{
|
|
109
|
+
variant: "card",
|
|
110
|
+
invalid: !1,
|
|
111
|
+
optionDisabled: !1,
|
|
112
|
+
class: { option: "border-line light:not-has-checked:hover:border-stone-950/20 dark:not-has-checked:hover:border-white/20" }
|
|
113
|
+
},
|
|
114
|
+
{
|
|
115
|
+
invalid: !1,
|
|
116
|
+
optionDisabled: !0,
|
|
117
|
+
class: { base: "light:border-stone-300 dark:border-stone-600" }
|
|
118
|
+
},
|
|
119
|
+
{
|
|
120
|
+
invalid: !1,
|
|
121
|
+
optionDisabled: !1,
|
|
122
|
+
class: { base: "light:border-stone-300 light:not-has-checked:hover:border-stone-400 dark:border-stone-600 dark:not-has-checked:hover:border-stone-500" }
|
|
123
|
+
}
|
|
124
|
+
]
|
|
125
|
+
});
|
|
126
|
+
export { t as radioGroupTheme };
|
|
@@ -30,6 +30,6 @@ declare const __VLS_export: import("vue").DefineComponent<SegmentedControlProps
|
|
|
30
30
|
}> & Readonly<{
|
|
31
31
|
"onUpdate:modelValue"?: ((value: string | undefined) => any) | undefined;
|
|
32
32
|
}>, {
|
|
33
|
-
pill: boolean;
|
|
34
33
|
size: "3xs" | "2xs" | "xs" | "sm" | "md" | "lg" | "xl" | "2xl" | "3xl" | "4xl";
|
|
34
|
+
pill: boolean;
|
|
35
35
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
package/dist/elements/segmented-control/SegmentedControl.vue_vue_type_script_setup_true_lang.js
ADDED
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import { useSlidingThumb as e } from "../../shared/composables/useSlidingThumb.js";
|
|
2
|
+
import { resolvePressScale as t } from "../../shared/utils/resolvePressScale.js";
|
|
3
|
+
import { segmentedControlTheme as n } from "./segmented-control.theme.js";
|
|
4
|
+
import { Fragment as r, computed as i, createBlock as a, createCommentVNode as o, createElementBlock as s, createElementVNode as c, createTextVNode as l, defineComponent as u, mergeModels as d, normalizeClass as f, normalizeStyle as p, openBlock as m, renderList as h, resolveDynamicComponent as g, toDisplayString as _, unref as v, useId as y, useModel as b, useTemplateRef as x, vModelRadio as S, vShow as C, withDirectives as w } from "vue";
|
|
5
|
+
// src/elements/segmented-control/SegmentedControl.vue?vue&type=script&setup=true&lang.ts
|
|
6
|
+
var T = ["aria-label"], E = ["data-selected"], D = [
|
|
7
|
+
"name",
|
|
8
|
+
"value",
|
|
9
|
+
"disabled",
|
|
10
|
+
"aria-label"
|
|
11
|
+
], O = /*@__PURE__*/ u({
|
|
12
|
+
__name: "SegmentedControl",
|
|
13
|
+
props: /*@__PURE__*/ d({
|
|
14
|
+
ariaLabel: {},
|
|
15
|
+
options: {},
|
|
16
|
+
name: {},
|
|
17
|
+
size: { default: "md" },
|
|
18
|
+
pill: {
|
|
19
|
+
type: Boolean,
|
|
20
|
+
default: !0
|
|
21
|
+
},
|
|
22
|
+
block: { type: Boolean },
|
|
23
|
+
square: { type: Boolean },
|
|
24
|
+
disabled: { type: Boolean },
|
|
25
|
+
ui: {},
|
|
26
|
+
class: { type: [
|
|
27
|
+
Array,
|
|
28
|
+
String,
|
|
29
|
+
null,
|
|
30
|
+
Number,
|
|
31
|
+
Boolean
|
|
32
|
+
] }
|
|
33
|
+
}, {
|
|
34
|
+
modelValue: {},
|
|
35
|
+
modelModifiers: {}
|
|
36
|
+
}),
|
|
37
|
+
emits: ["update:modelValue"],
|
|
38
|
+
setup(u) {
|
|
39
|
+
let d = u, O = b(u, "modelValue"), k = y(), A = i(() => d.name ?? k), j = x("trackElement"), M = i(() => d.options.some((e) => e.value === O.value)), { thumbStyle: N, isThumbPlaced: P, animatesThumb: F } = e({
|
|
40
|
+
trackElement: j,
|
|
41
|
+
findSelectedElement: () => j.value?.querySelector("[data-selected]"),
|
|
42
|
+
placementSources: [
|
|
43
|
+
O,
|
|
44
|
+
() => d.options,
|
|
45
|
+
() => d.size,
|
|
46
|
+
() => d.pill,
|
|
47
|
+
() => d.block,
|
|
48
|
+
() => d.square
|
|
49
|
+
]
|
|
50
|
+
}), I = i(() => n({
|
|
51
|
+
size: d.size,
|
|
52
|
+
pill: d.pill,
|
|
53
|
+
block: d.block,
|
|
54
|
+
square: d.square,
|
|
55
|
+
disabled: d.disabled,
|
|
56
|
+
isThumbPlaced: P.value,
|
|
57
|
+
animatesThumb: F.value
|
|
58
|
+
}));
|
|
59
|
+
function L(e) {
|
|
60
|
+
return d.disabled || !!e.disabled;
|
|
61
|
+
}
|
|
62
|
+
function R(e) {
|
|
63
|
+
let n = e.currentTarget;
|
|
64
|
+
n.style.setProperty("--press-scale-x", String(t(n.offsetWidth)));
|
|
65
|
+
}
|
|
66
|
+
return (e, t) => (m(), s("div", {
|
|
67
|
+
ref_key: "trackElement",
|
|
68
|
+
ref: j,
|
|
69
|
+
role: "radiogroup",
|
|
70
|
+
"aria-label": u.ariaLabel,
|
|
71
|
+
class: f(I.value.root({ class: [u.ui?.root, d.class] }))
|
|
72
|
+
}, [w(c("div", {
|
|
73
|
+
"aria-hidden": "true",
|
|
74
|
+
style: p(v(N)),
|
|
75
|
+
class: f(I.value.thumb({ class: u.ui?.thumb }))
|
|
76
|
+
}, null, 6), [[C, M.value]]), (m(!0), s(r, null, h(u.options, (e) => (m(), s("label", {
|
|
77
|
+
key: e.value,
|
|
78
|
+
"data-selected": e.value === O.value ? "" : void 0,
|
|
79
|
+
class: f(I.value.option({
|
|
80
|
+
optionDisabled: L(e),
|
|
81
|
+
class: u.ui?.option
|
|
82
|
+
})),
|
|
83
|
+
onPointerenter: R
|
|
84
|
+
}, [w(c("input", {
|
|
85
|
+
"onUpdate:modelValue": t[0] ||= (e) => O.value = e,
|
|
86
|
+
type: "radio",
|
|
87
|
+
name: A.value,
|
|
88
|
+
value: e.value,
|
|
89
|
+
disabled: L(e),
|
|
90
|
+
"aria-label": u.square ? e.label : void 0,
|
|
91
|
+
class: f(I.value.input({ class: u.ui?.input }))
|
|
92
|
+
}, null, 10, D), [[S, O.value]]), c("span", { class: f(I.value.content({ class: u.ui?.content })) }, [e.icon ? (m(), a(g(e.icon), {
|
|
93
|
+
key: 0,
|
|
94
|
+
class: f(I.value.icon({ class: u.ui?.icon }))
|
|
95
|
+
}, null, 8, ["class"])) : o("", !0), u.square ? o("", !0) : (m(), s(r, { key: 1 }, [l(_(e.label), 1)], 64))], 2)], 42, E))), 128))], 10, T));
|
|
96
|
+
}
|
|
97
|
+
});
|
|
98
|
+
export { O as default };
|