@leavepulse/ui 0.78.1 → 0.78.2

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.
Files changed (146) hide show
  1. package/dist/chunks/{DropzoneLinkField-CLLhd3WB.js → DropzoneLinkField-CyE7TJ5f.js} +1 -1
  2. package/dist/chunks/LpAddressInput-ft8fQOGx.js +401 -0
  3. package/dist/chunks/{LpAppShell-BKbYCHkx.js → LpAppShell-DkvU6IBB.js} +1 -1
  4. package/dist/chunks/LpAutocomplete-CrZbd0uv.js +310 -0
  5. package/dist/chunks/LpCheckbox-CCWCwD0y.js +129 -0
  6. package/dist/chunks/{LpCodeDisplay-D3BUAhV1.js → LpCodeDisplay-D59uPwRb.js} +1 -1
  7. package/dist/chunks/LpColorPicker-BONURBFN.js +574 -0
  8. package/dist/chunks/LpDatePicker-C2AOtxgF.js +171 -0
  9. package/dist/chunks/{LpDateRangePicker-CNQXdTVv.js → LpDateRangePicker-CiXdIAyh.js} +43 -35
  10. package/dist/chunks/{LpFileTree-C-rJKzEQ.js → LpFileTree-CpNurwZp.js} +2 -2
  11. package/dist/chunks/{LpFileTreeNode-BgYn4U1J.js → LpFileTreeNode-DdF8Cq-s.js} +1 -1
  12. package/dist/chunks/{LpInput-D0O6dpuA.js → LpInput-CbI7z5fQ.js} +3 -4
  13. package/dist/chunks/{LpLogInspector-BdQlX6S-.js → LpLogInspector-CcSJSGan.js} +1 -1
  14. package/dist/chunks/{LpLogViewer-umCZBapN.js → LpLogViewer-CWu49Dko.js} +2 -2
  15. package/dist/chunks/{LpModalNav-gOi1Giz1.js → LpModalNav-DI3BW5ff.js} +1 -1
  16. package/dist/chunks/LpNumberField-C8LfUz_R.js +154 -0
  17. package/dist/chunks/LpOtpInput-B1X9l9no.js +140 -0
  18. package/dist/chunks/{LpPaletteTheme-BIXpZLGe.js → LpPaletteTheme-B-xuZiKK.js} +2 -2
  19. package/dist/chunks/{LpPasswordInput-D4HPhqfV.js → LpPasswordInput-Duc_3wPv.js} +1 -1
  20. package/dist/chunks/{LpPhoneInput-BSL7NX4z.js → LpPhoneInput-CctcRK9K.js} +124 -118
  21. package/dist/chunks/LpRadioGroup-DTM0nd9G.js +103 -0
  22. package/dist/chunks/LpRangeSlider-DJsEZXad.js +97 -0
  23. package/dist/chunks/LpRepeater-Czib3rmv.js +193 -0
  24. package/dist/chunks/{LpSecretField-B2roc4Iz.js → LpSecretField-BtlCk3IH.js} +1 -1
  25. package/dist/chunks/LpSegmented-sskrJKJJ.js +128 -0
  26. package/dist/chunks/LpSelect-JFZehOkd.js +515 -0
  27. package/dist/chunks/{LpSidebar-DDNJzb69.js → LpSidebar-CvRvVBTt.js} +1 -1
  28. package/dist/chunks/LpSlider-C4ilCtZX.js +76 -0
  29. package/dist/chunks/LpSwitch-DyAYTchz.js +122 -0
  30. package/dist/chunks/{LpTableFilter-B_XMOeAh.js → LpTableFilter-CJg5eIcV.js} +2 -2
  31. package/dist/chunks/{LpTagsInput-Dt0mteSj.js → LpTagsInput-CkNxpNYa.js} +4 -3
  32. package/dist/chunks/{LpTextarea-Co0b9PVx.js → LpTextarea-CFK_5QB8.js} +3 -2
  33. package/dist/chunks/{LpThemeStudio-ChU0_Ga8.js → LpThemeStudio-R-wohbCY.js} +2 -2
  34. package/dist/chunks/{LpThemeSwitcher-DmCZ21P_.js → LpThemeSwitcher-Bzy15MCP.js} +1 -1
  35. package/dist/chunks/LpTimeField-B5n0m8m0.js +115 -0
  36. package/dist/chunks/{LpTopologyCanvas-jqz1KCq2.js → LpTopologyCanvas-BNgw9RyZ.js} +2 -2
  37. package/dist/chunks/{LpWorkspaceSwitcher-BeNHCLd5.js → LpWorkspaceSwitcher-ugv-fyig.js} +1 -1
  38. package/dist/components/DropzoneLinkField.vue.js +1 -1
  39. package/dist/components/LpAddressInput.vue.d.ts +4 -0
  40. package/dist/components/LpAddressInput.vue.js +1 -1
  41. package/dist/components/LpAlert.vue.d.ts +3 -3
  42. package/dist/components/LpAppShell.vue.d.ts +1 -1
  43. package/dist/components/LpAppShell.vue.js +1 -1
  44. package/dist/components/LpAutocomplete.vue.d.ts +4 -0
  45. package/dist/components/LpAutocomplete.vue.js +1 -1
  46. package/dist/components/LpBadge.vue.d.ts +2 -2
  47. package/dist/components/LpChart.vue.d.ts +1 -1
  48. package/dist/components/LpCheckbox.vue.d.ts +4 -0
  49. package/dist/components/LpCheckbox.vue.js +1 -1
  50. package/dist/components/LpCodeDisplay.vue.js +1 -1
  51. package/dist/components/LpCollapse.vue.d.ts +1 -1
  52. package/dist/components/LpColorPicker.vue.d.ts +5 -3
  53. package/dist/components/LpColorPicker.vue.js +1 -1
  54. package/dist/components/LpDatePicker.vue.js +1 -1
  55. package/dist/components/LpDateRangePicker.vue.js +1 -1
  56. package/dist/components/LpDropzone.vue.js +1 -1
  57. package/dist/components/LpFileTree.vue.js +1 -1
  58. package/dist/components/LpFileTreeNode.vue.js +1 -1
  59. package/dist/components/LpImageEditor.vue.d.ts +1 -1
  60. package/dist/components/LpInput.vue.js +1 -1
  61. package/dist/components/LpLogInspector.vue.js +1 -1
  62. package/dist/components/LpLogViewer.vue.js +1 -1
  63. package/dist/components/LpModalNav.vue.js +1 -1
  64. package/dist/components/LpNumberField.vue.d.ts +4 -0
  65. package/dist/components/LpNumberField.vue.js +1 -1
  66. package/dist/components/LpOtpInput.vue.d.ts +4 -0
  67. package/dist/components/LpOtpInput.vue.js +1 -1
  68. package/dist/components/LpPaletteTheme.vue.js +1 -1
  69. package/dist/components/LpPasswordInput.vue.js +1 -1
  70. package/dist/components/LpPhoneInput.vue.d.ts +4 -0
  71. package/dist/components/LpPhoneInput.vue.js +1 -1
  72. package/dist/components/LpRadioGroup.vue.d.ts +4 -0
  73. package/dist/components/LpRadioGroup.vue.js +1 -1
  74. package/dist/components/LpRangeSlider.vue.d.ts +4 -0
  75. package/dist/components/LpRangeSlider.vue.js +1 -1
  76. package/dist/components/LpRepeater.vue.d.ts +2 -0
  77. package/dist/components/LpRepeater.vue.js +1 -1
  78. package/dist/components/LpScrollArea.vue.d.ts +1 -1
  79. package/dist/components/LpSecretField.vue.js +1 -1
  80. package/dist/components/LpSegmented.vue.d.ts +4 -0
  81. package/dist/components/LpSegmented.vue.js +1 -1
  82. package/dist/components/LpSelect.vue.d.ts +2 -0
  83. package/dist/components/LpSelect.vue.js +1 -1
  84. package/dist/components/LpShinyText.vue.d.ts +1 -1
  85. package/dist/components/LpSidebar.vue.d.ts +1 -1
  86. package/dist/components/LpSidebar.vue.js +1 -1
  87. package/dist/components/LpSlider.vue.d.ts +4 -0
  88. package/dist/components/LpSlider.vue.js +1 -1
  89. package/dist/components/LpSwitch.vue.d.ts +4 -0
  90. package/dist/components/LpSwitch.vue.js +1 -1
  91. package/dist/components/LpTable.vue.js +2 -2
  92. package/dist/components/LpTableFilter.vue.js +1 -1
  93. package/dist/components/LpTabs.vue.d.ts +1 -1
  94. package/dist/components/LpTagsInput.vue.js +1 -1
  95. package/dist/components/LpTextarea.vue.js +1 -1
  96. package/dist/components/LpThemeStudio.vue.js +1 -1
  97. package/dist/components/LpThemeSwitcher.vue.js +1 -1
  98. package/dist/components/LpTimeField.vue.d.ts +4 -0
  99. package/dist/components/LpTimeField.vue.js +1 -1
  100. package/dist/components/LpTopologyCanvas.vue.js +1 -1
  101. package/dist/components/LpWorkspaceSwitcher.vue.js +1 -1
  102. package/dist/components/calendar.d.ts +2 -0
  103. package/dist/composables/useField.d.ts +50 -0
  104. package/dist/composables/useField.js +31 -2
  105. package/dist/composables/useMergedClass.d.ts +6 -2
  106. package/dist/composables/useMergedClass.js +6 -6
  107. package/dist/index.js +34 -34
  108. package/package.json +1 -1
  109. package/src/components/LpAddressInput.vue +8 -4
  110. package/src/components/LpAutocomplete.vue +11 -5
  111. package/src/components/LpCheckbox.vue +8 -6
  112. package/src/components/LpColorPicker.vue +7 -4
  113. package/src/components/LpDatePicker.vue +8 -4
  114. package/src/components/LpDateRangePicker.vue +8 -4
  115. package/src/components/LpInput.vue +3 -4
  116. package/src/components/LpNumberField.vue +11 -6
  117. package/src/components/LpOtpInput.vue +8 -6
  118. package/src/components/LpPhoneInput.vue +11 -6
  119. package/src/components/LpRadioGroup.vue +9 -5
  120. package/src/components/LpRangeSlider.vue +8 -4
  121. package/src/components/LpRepeater.vue +16 -4
  122. package/src/components/LpSegmented.vue +8 -4
  123. package/src/components/LpSelect.vue +8 -7
  124. package/src/components/LpSlider.vue +8 -4
  125. package/src/components/LpSwitch.vue +8 -5
  126. package/src/components/LpTagsInput.vue +4 -3
  127. package/src/components/LpTextarea.vue +3 -2
  128. package/src/components/LpTimeField.vue +8 -6
  129. package/src/components/calendar.ts +2 -0
  130. package/src/composables/useField.ts +52 -0
  131. package/src/composables/useMergedClass.ts +11 -5
  132. package/dist/chunks/LpAddressInput-BSS49jpm.js +0 -393
  133. package/dist/chunks/LpAutocomplete-DkY6CSyD.js +0 -302
  134. package/dist/chunks/LpCheckbox-D6RuDW4X.js +0 -124
  135. package/dist/chunks/LpColorPicker-COHzV68R.js +0 -567
  136. package/dist/chunks/LpDatePicker-DwSDY0mt.js +0 -163
  137. package/dist/chunks/LpNumberField-Csg-1Zh_.js +0 -148
  138. package/dist/chunks/LpOtpInput-BRpLBbOD.js +0 -132
  139. package/dist/chunks/LpRadioGroup-BrazjLY_.js +0 -95
  140. package/dist/chunks/LpRangeSlider-fz61tzc-.js +0 -89
  141. package/dist/chunks/LpRepeater-BkJHSPI1.js +0 -180
  142. package/dist/chunks/LpSegmented-DbEJhbv-.js +0 -123
  143. package/dist/chunks/LpSelect-Y-iuSymW.js +0 -512
  144. package/dist/chunks/LpSlider-A4ixovgS.js +0 -68
  145. package/dist/chunks/LpSwitch-DnC2-0aV.js +0 -115
  146. package/dist/chunks/LpTimeField-DeOcKWJq.js +0 -110
@@ -0,0 +1,193 @@
1
+ import { defineComponent, useModel, ref, openBlock, createBlock, normalizeProps, guardReactiveProps, unref, withCtx, createElementVNode, mergeProps, createElementBlock, toDisplayString, createCommentVNode, createVNode, createTextVNode, TransitionGroup, Fragment, renderList, renderSlot, mergeModels, nextTick } from "vue";
2
+ import { _ as _sfc_main$1 } from "./FieldWrapper-DnuMTrqW.js";
3
+ import { useOwnField, mergeDescribedBy } from "../composables/useField.js";
4
+ import { useLabels } from "../composables/useLpConfig.js";
5
+ import { useMergedAttrs } from "../composables/useMergedClass.js";
6
+ import { useRepeater } from "../composables/useRepeater.js";
7
+ import { usePrefersReducedMotion } from "../composables/useReducedMotion.js";
8
+ import { _ as _sfc_main$2 } from "./LpButton-DSHioIfD.js";
9
+ import { _ as _sfc_main$3 } from "./LpIcon-C6JpQ5td.js";
10
+ import { _ as _sfc_main$4 } from "./LpShift-DAgS_d2x.js";
11
+ import '../assets/LpRepeater-C1Cw27hj.css';const _hoisted_1 = ["aria-label", "aria-describedby"];
12
+ const _hoisted_2 = { class: "flex items-center justify-between gap-2" };
13
+ const _hoisted_3 = {
14
+ key: 0,
15
+ class: "text-sm font-medium text-ink"
16
+ };
17
+ const _hoisted_4 = { class: "min-w-0 flex-1" };
18
+ const _hoisted_5 = {
19
+ key: "empty",
20
+ class: "text-xs text-muted"
21
+ };
22
+ const focusable = 'input:not([type="hidden"]):not([disabled]), textarea:not([disabled]), select:not([disabled]), button:not([disabled]), [tabindex="0"], [contenteditable="true"]';
23
+ const _sfc_main = /* @__PURE__ */ defineComponent({
24
+ ...{ inheritAttrs: false },
25
+ __name: "LpRepeater",
26
+ props: /* @__PURE__ */ mergeModels({
27
+ createItem: { type: Function },
28
+ itemKey: { type: Function },
29
+ label: {},
30
+ disabled: { type: Boolean },
31
+ error: {},
32
+ labels: {}
33
+ }, {
34
+ "modelValue": { default: () => [] },
35
+ "modelModifiers": {}
36
+ }),
37
+ emits: ["update:modelValue"],
38
+ setup(__props, { expose: __expose }) {
39
+ const props = __props;
40
+ const model = useModel(__props, "modelValue");
41
+ const { field, wrapper, ownAttrs } = useOwnField(() => ({ error: props.error, disabled: props.disabled }));
42
+ const text = useLabels("repeater", { add: "Add item", remove: "Remove item {index}", empty: "No items" }, () => props.labels);
43
+ const list = useRepeater({
44
+ value: () => model.value,
45
+ set: (items) => {
46
+ model.value = items;
47
+ },
48
+ createItem: () => props.createItem(),
49
+ itemKey: () => props.itemKey,
50
+ disabled: () => field.value.disabled
51
+ });
52
+ const { rows } = list;
53
+ const rowsHost = ref(null);
54
+ const reducedMotion = usePrefersReducedMotion();
55
+ const addButton = ref(null);
56
+ function focusRow(index) {
57
+ rowAt(index)?.querySelector(focusable)?.focus({ preventScroll: true });
58
+ }
59
+ function rowAt(index) {
60
+ return Array.from(rowsHost.value?.children ?? []).filter(
61
+ (node) => node.hasAttribute("data-lp-repeater-row") && !node.hasAttribute("inert")
62
+ )[index];
63
+ }
64
+ function beforeLeave(el) {
65
+ const row = el;
66
+ row.style.width = `${row.offsetWidth}px`;
67
+ row.style.top = `${row.offsetTop}px`;
68
+ row.setAttribute("inert", "");
69
+ row.setAttribute("aria-hidden", "true");
70
+ }
71
+ function beforeEnter(el) {
72
+ const row = el;
73
+ row.removeAttribute("inert");
74
+ row.removeAttribute("aria-hidden");
75
+ row.style.removeProperty("top");
76
+ row.style.removeProperty("width");
77
+ }
78
+ async function add() {
79
+ if (field.value.disabled) return;
80
+ list.add();
81
+ await nextTick();
82
+ focusRow(model.value.length - 1);
83
+ }
84
+ async function remove(index) {
85
+ if (field.value.disabled) return;
86
+ const row = rowAt(index);
87
+ const restore = row?.contains(row.ownerDocument.activeElement);
88
+ list.remove(index);
89
+ if (!restore) return;
90
+ await nextTick();
91
+ if (model.value.length) focusRow(Math.min(index, model.value.length - 1));
92
+ else addButton.value?.$el?.focus({ preventScroll: true });
93
+ }
94
+ __expose({ add, remove, update: list.update });
95
+ const { class: rootClass, attrs: rest } = useMergedAttrs("flex min-w-0 flex-col gap-2", () => ownAttrs());
96
+ return (_ctx, _cache) => {
97
+ return openBlock(), createBlock(_sfc_main$1, normalizeProps(guardReactiveProps(unref(wrapper))), {
98
+ default: withCtx(() => [
99
+ createElementVNode("div", mergeProps(unref(rest), {
100
+ role: "group",
101
+ "aria-label": __props.label || void 0,
102
+ "aria-describedby": unref(mergeDescribedBy)(unref(rest)["aria-describedby"], unref(field).describedBy),
103
+ class: unref(rootClass)
104
+ }), [
105
+ createElementVNode("div", _hoisted_2, [
106
+ __props.label ? (openBlock(), createElementBlock("span", _hoisted_3, toDisplayString(__props.label), 1)) : createCommentVNode("", true),
107
+ createVNode(_sfc_main$2, {
108
+ ref_key: "addButton",
109
+ ref: addButton,
110
+ size: "xs",
111
+ variant: "ghost",
112
+ disabled: unref(field).disabled,
113
+ onClick: add
114
+ }, {
115
+ default: withCtx(() => [
116
+ createVNode(_sfc_main$3, {
117
+ name: "lucide:plus",
118
+ size: 14
119
+ }),
120
+ createTextVNode(toDisplayString(unref(text).add), 1)
121
+ ]),
122
+ _: 1
123
+ }, 8, ["disabled"])
124
+ ]),
125
+ createVNode(_sfc_main$4, { axis: "height" }, {
126
+ default: withCtx(() => [
127
+ createElementVNode("div", {
128
+ ref_key: "rowsHost",
129
+ ref: rowsHost,
130
+ class: "relative flex min-w-0 flex-col gap-2"
131
+ }, [
132
+ createVNode(TransitionGroup, {
133
+ name: "lp-repeater",
134
+ css: !unref(reducedMotion),
135
+ onBeforeEnter: beforeEnter,
136
+ onBeforeLeave: beforeLeave
137
+ }, {
138
+ default: withCtx(() => [
139
+ (openBlock(true), createElementBlock(Fragment, null, renderList(unref(rows), ({ item, key }, index) => {
140
+ return openBlock(), createElementBlock("div", {
141
+ key,
142
+ "data-lp-repeater-row": "",
143
+ class: "flex min-w-0 items-start gap-2"
144
+ }, [
145
+ createElementVNode("div", _hoisted_4, [
146
+ renderSlot(_ctx.$slots, "default", {
147
+ item,
148
+ index,
149
+ disabled: unref(field).disabled,
150
+ update: (next) => unref(list).update(index, next),
151
+ remove: () => remove(index)
152
+ })
153
+ ]),
154
+ createVNode(_sfc_main$2, {
155
+ variant: "ghost",
156
+ size: "sm",
157
+ square: "",
158
+ disabled: unref(field).disabled,
159
+ "aria-label": unref(text).remove.replace("{index}", String(index + 1)),
160
+ onClick: ($event) => remove(index)
161
+ }, {
162
+ default: withCtx(() => [
163
+ createVNode(_sfc_main$3, {
164
+ name: "lucide:x",
165
+ size: 14
166
+ })
167
+ ]),
168
+ _: 1
169
+ }, 8, ["disabled", "aria-label", "onClick"])
170
+ ]);
171
+ }), 128)),
172
+ !unref(rows).length ? (openBlock(), createElementBlock("div", _hoisted_5, [
173
+ renderSlot(_ctx.$slots, "empty", {}, () => [
174
+ createTextVNode(toDisplayString(unref(text).empty), 1)
175
+ ])
176
+ ])) : createCommentVNode("", true)
177
+ ]),
178
+ _: 3
179
+ }, 8, ["css"])
180
+ ], 512)
181
+ ]),
182
+ _: 3
183
+ })
184
+ ], 16, _hoisted_1)
185
+ ]),
186
+ _: 3
187
+ }, 16);
188
+ };
189
+ }
190
+ });
191
+ export {
192
+ _sfc_main as _
193
+ };
@@ -10,7 +10,7 @@ import { _ as _sfc_main$5 } from "./FieldWrapper-DnuMTrqW.js";
10
10
  import { _ as _sfc_main$3 } from "./LpButton-DSHioIfD.js";
11
11
  import { _ as _sfc_main$2 } from "./LpCopyButton-sAMvWeLP.js";
12
12
  import { _ as _sfc_main$4 } from "./LpIcon-C6JpQ5td.js";
13
- import { _ as _sfc_main$1 } from "./LpPasswordInput-D4HPhqfV.js";
13
+ import { _ as _sfc_main$1 } from "./LpPasswordInput-Duc_3wPv.js";
14
14
  import { _ as _sfc_main$6 } from "./LpShift-DAgS_d2x.js";
15
15
  import { _ as _sfc_main$8 } from "./LpTooltip-Bz_rrq5S.js";
16
16
  import { _ as _sfc_main$7 } from "./RevealToggle-D_iyrB8d.js";
@@ -0,0 +1,128 @@
1
+ import { defineComponent, useId, ref, openBlock, createBlock, normalizeProps, guardReactiveProps, unref, withCtx, createVNode, mergeProps, createElementBlock, Fragment, renderList, normalizeClass, createCommentVNode, toDisplayString } from "vue";
2
+ import { _ as _sfc_main$1 } from "./FieldWrapper-DnuMTrqW.js";
3
+ import { CONTROL_SIZE } from "../components/controlSize.js";
4
+ import { isHTMLElement } from "../composables/realm.js";
5
+ import { usePaletteControl } from "../composables/usePaletteCommands.js";
6
+ import { Motion } from "motion-v";
7
+ import { ToggleGroupRoot, ToggleGroupItem } from "reka-ui";
8
+ import { useOwnField, mergeDescribedBy } from "../composables/useField.js";
9
+ import { useMergedAttrs } from "../composables/useMergedClass.js";
10
+ import { usePillTransition } from "../composables/usePillTransition.js";
11
+ import { _ as _sfc_main$3 } from "./AttentionDot-DCBf4aWg.js";
12
+ import { _ as _sfc_main$2 } from "./LpIcon-C6JpQ5td.js";
13
+ const _hoisted_1 = {
14
+ key: 1,
15
+ class: "relative z-10 inline-flex shrink-0"
16
+ };
17
+ const _hoisted_2 = {
18
+ key: 2,
19
+ class: "relative z-10"
20
+ };
21
+ const __default__ = { inheritAttrs: false };
22
+ const _sfc_main = /* @__PURE__ */ defineComponent({
23
+ ...__default__,
24
+ __name: "LpSegmented",
25
+ props: {
26
+ palette: { type: [Boolean, Object], default: void 0 },
27
+ modelValue: {},
28
+ options: {},
29
+ size: { default: "md" },
30
+ block: { type: Boolean, default: false },
31
+ disabled: { type: Boolean },
32
+ error: {},
33
+ hoverFollow: { type: Boolean, default: true }
34
+ },
35
+ emits: ["update:modelValue"],
36
+ setup(__props, { emit: __emit }) {
37
+ const props = __props;
38
+ const emit = __emit;
39
+ function onChange(v) {
40
+ if (typeof v === "string" && v) emit("update:modelValue", v);
41
+ }
42
+ const sizeCls = CONTROL_SIZE;
43
+ const { class: rootClass, attrs: rest } = useMergedAttrs(() => [
44
+ "inline-flex items-center gap-1 rounded-control border border-line bg-surface-soft p-1",
45
+ sizeCls[props.size],
46
+ // `w-fit`, not left to the parent: in a column a flex item stretches, and
47
+ // the options sat on the left of an empty bar (the theme studio met it).
48
+ props.block ? "flex w-full" : "w-fit"
49
+ ].join(" "), () => ownAttrs());
50
+ const { field, wrapper, ownAttrs } = useOwnField(() => ({ error: props.error, disabled: props.disabled }));
51
+ const pillId = `lp-segmented-${useId()}`;
52
+ const pillTransition = usePillTransition();
53
+ const hovered = ref(null);
54
+ function onEnter(opt) {
55
+ if (props.hoverFollow && !opt.disabled && !field.value.disabled) hovered.value = opt.value;
56
+ }
57
+ function pillUnder(value) {
58
+ return hovered.value ? hovered.value === value : value === props.modelValue;
59
+ }
60
+ function releaseFocusAfterPointer(event) {
61
+ const target = event.currentTarget;
62
+ if (isHTMLElement(target)) target.blur();
63
+ }
64
+ usePaletteControl({ disabled: () => field.value.disabled });
65
+ return (_ctx, _cache) => {
66
+ return openBlock(), createBlock(_sfc_main$1, normalizeProps(guardReactiveProps(unref(wrapper))), {
67
+ default: withCtx(() => [
68
+ createVNode(unref(ToggleGroupRoot), mergeProps({
69
+ "model-value": __props.modelValue,
70
+ type: "single",
71
+ disabled: unref(field).disabled,
72
+ "aria-labelledby": unref(field).labelId,
73
+ rovingFocus: true,
74
+ class: unref(rootClass)
75
+ }, unref(rest), {
76
+ "aria-describedby": unref(mergeDescribedBy)(unref(rest)["aria-describedby"], unref(field).describedBy),
77
+ "onUpdate:modelValue": onChange,
78
+ onPointerleave: _cache[0] || (_cache[0] = ($event) => hovered.value = null)
79
+ }), {
80
+ default: withCtx(() => [
81
+ (openBlock(true), createElementBlock(Fragment, null, renderList(__props.options, (opt) => {
82
+ return openBlock(), createBlock(unref(ToggleGroupItem), {
83
+ key: opt.value,
84
+ value: opt.value,
85
+ disabled: opt.disabled,
86
+ "aria-label": opt.ariaLabel ?? (opt.label ? void 0 : opt.value),
87
+ class: normalizeClass(["relative inline-flex h-full items-center justify-center gap-1.5 rounded-inner font-medium outline-none transition-colors duration-[var(--duration-fast)] ease-[var(--ease-emphasized)] focus-visible:ring-2 focus-visible:ring-ring data-[state=on]:text-ink data-[state=off]:text-muted data-[state=off]:hover:text-ink disabled:cursor-not-allowed disabled:opacity-55", [__props.block ? "flex-1" : "", __props.size === "lg" ? "px-4" : "px-3", hovered.value === opt.value ? "text-ink" : ""]]),
88
+ onPointerenter: ($event) => onEnter(opt),
89
+ onPointerup: releaseFocusAfterPointer
90
+ }, {
91
+ default: withCtx(() => [
92
+ pillUnder(opt.value) ? (openBlock(), createBlock(unref(Motion), {
93
+ key: 0,
94
+ "layout-id": pillId,
95
+ transition: unref(pillTransition),
96
+ class: "absolute inset-0 z-0 rounded-inner border border-line bg-surface-raised shadow-sm"
97
+ }, null, 8, ["transition"])) : createCommentVNode("", true),
98
+ opt.icon ? (openBlock(), createElementBlock("span", _hoisted_1, [
99
+ createVNode(_sfc_main$2, {
100
+ name: opt.icon,
101
+ size: __props.size === "lg" ? 16 : 14
102
+ }, null, 8, ["name", "size"]),
103
+ opt.dot && !opt.label ? (openBlock(), createBlock(_sfc_main$3, {
104
+ key: 0,
105
+ corner: ""
106
+ })) : createCommentVNode("", true)
107
+ ])) : createCommentVNode("", true),
108
+ opt.label ? (openBlock(), createElementBlock("span", _hoisted_2, toDisplayString(opt.label), 1)) : createCommentVNode("", true),
109
+ opt.dot && opt.label ? (openBlock(), createBlock(_sfc_main$3, {
110
+ key: 3,
111
+ class: "mt-1.5"
112
+ })) : createCommentVNode("", true)
113
+ ]),
114
+ _: 2
115
+ }, 1032, ["value", "disabled", "aria-label", "class", "onPointerenter"]);
116
+ }), 128))
117
+ ]),
118
+ _: 1
119
+ }, 16, ["model-value", "disabled", "aria-labelledby", "class", "aria-describedby"])
120
+ ]),
121
+ _: 1
122
+ }, 16);
123
+ };
124
+ }
125
+ });
126
+ export {
127
+ _sfc_main as _
128
+ };