@kazee-ds/vue 0.0.0-stage → 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/dist/index.js +4882 -0
- package/dist/index.js.map +1 -0
- package/dist/types/Alert.vue.d.ts +28 -0
- package/dist/types/Badge.vue.d.ts +19 -0
- package/dist/types/Breadcrumb.vue.d.ts +14 -0
- package/dist/types/Button.vue.d.ts +54 -0
- package/dist/types/ButtonGroup.d.ts +65 -0
- package/dist/types/ButtonGroupSeparator.d.ts +4 -0
- package/dist/types/Card.vue.d.ts +25 -0
- package/dist/types/Chart.vue.d.ts +27 -0
- package/dist/types/CheckIcon.vue.d.ts +3 -0
- package/dist/types/Checkbox.vue.d.ts +35 -0
- package/dist/types/ChevronIcon.vue.d.ts +3 -0
- package/dist/types/CloseIcon.vue.d.ts +3 -0
- package/dist/types/Combobox.vue.d.ts +39 -0
- package/dist/types/DataTable.vue.d.ts +44 -0
- package/dist/types/DateRangePanel.vue.d.ts +21 -0
- package/dist/types/DateRangePicker.vue.d.ts +47 -0
- package/dist/types/Dialog.vue.d.ts +58 -0
- package/dist/types/DropdownMenu.vue.d.ts +52 -0
- package/dist/types/DropdownMenuBranch.vue.d.ts +30 -0
- package/dist/types/Empty.vue.d.ts +25 -0
- package/dist/types/Field.vue.d.ts +34 -0
- package/dist/types/FieldFeedback.vue.d.ts +12 -0
- package/dist/types/Form.vue.d.ts +35 -0
- package/dist/types/Input.vue.d.ts +89 -0
- package/dist/types/Label.vue.d.ts +20 -0
- package/dist/types/Listbox.vue.d.ts +35 -0
- package/dist/types/MenuItemContent.vue.d.ts +19 -0
- package/dist/types/NumberField.vue.d.ts +47 -0
- package/dist/types/Pagination.vue.d.ts +33 -0
- package/dist/types/Popover.vue.d.ts +34 -0
- package/dist/types/RadioGroup.vue.d.ts +37 -0
- package/dist/types/Select.vue.d.ts +53 -0
- package/dist/types/SelectGroup.d.ts +56 -0
- package/dist/types/SelectionValidation.vue.d.ts +14 -0
- package/dist/types/Separator.vue.d.ts +10 -0
- package/dist/types/Sidebar.vue.d.ts +25 -0
- package/dist/types/Skeleton.vue.d.ts +10 -0
- package/dist/types/Spinner.vue.d.ts +15 -0
- package/dist/types/Switch.vue.d.ts +31 -0
- package/dist/types/Table.vue.d.ts +16 -0
- package/dist/types/Tabs.vue.d.ts +58 -0
- package/dist/types/TabsListView.vue.d.ts +22 -0
- package/dist/types/Textarea.vue.d.ts +47 -0
- package/dist/types/ToggleButton.vue.d.ts +36 -0
- package/dist/types/ToggleButtonGroup.vue.d.ts +35 -0
- package/dist/types/ToggleGroup.vue.d.ts +39 -0
- package/dist/types/Tooltip.vue.d.ts +36 -0
- package/dist/types/button-family-context.d.ts +8 -0
- package/dist/types/chart-model.d.ts +12 -0
- package/dist/types/dashboard-types.d.ts +27 -0
- package/dist/types/data-table-types.d.ts +13 -0
- package/dist/types/date-range-model.d.ts +69 -0
- package/dist/types/form-context.d.ts +3 -0
- package/dist/types/index.d.ts +56 -0
- package/dist/types/listbox-selection.d.ts +8 -0
- package/dist/types/overlay-model.d.ts +14 -0
- package/dist/types/pagination-model.d.ts +5 -0
- package/dist/types/selection-options.d.ts +8 -0
- package/dist/types/tabs-indicator.d.ts +1 -0
- package/dist/types/toggle-group-model.d.ts +9 -0
- package/dist/types/types.d.ts +43 -0
- package/dist/types/useDisclosure.d.ts +7 -0
- package/dist/types/useFeedback.d.ts +10 -0
- package/package.json +50 -3
- package/README.md +0 -3
package/dist/index.js
ADDED
|
@@ -0,0 +1,4882 @@
|
|
|
1
|
+
import { Fragment, cloneVNode, computed, createBlock, createCommentVNode, createElementBlock, createElementVNode, createSlots, createTextVNode, createVNode, defineComponent, getCurrentInstance, guardReactiveProps, h, inject, mergeModels, mergeProps, normalizeClass, normalizeProps, onBeforeUnmount, onMounted, openBlock, provide, ref, renderList, renderSlot, resolveComponent, resolveDynamicComponent, shallowRef, toDisplayString, unref, useModel, watch, withCtx, withModifiers } from "vue";
|
|
2
|
+
import { CheckboxRoot, ComboboxAnchor, ComboboxContent, ComboboxInput, ComboboxItem, ComboboxPortal, ComboboxRoot, ComboboxTrigger, ComboboxViewport, DialogClose, DialogContent, DialogDescription, DialogOverlay, DialogPortal, DialogRoot, DialogTitle, DialogTrigger, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuPortal, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuRoot, DropdownMenuSeparator, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger, Label, ListboxContent, ListboxItem, ListboxRoot, NumberFieldDecrement, NumberFieldIncrement, NumberFieldInput, NumberFieldRoot, PopoverClose, PopoverContent, PopoverPortal, PopoverRoot, PopoverTrigger, RadioGroupItem, RadioGroupRoot, RangeCalendarCell, RangeCalendarCellTrigger, RangeCalendarGrid, RangeCalendarGridBody, RangeCalendarGridHead, RangeCalendarGridRow, RangeCalendarHeadCell, RangeCalendarNext, RangeCalendarPrev, RangeCalendarRoot, SelectContent, SelectItem, SelectItemText, SelectPortal, SelectRoot, SelectTrigger, SelectValue, SelectViewport, SwitchRoot, TabsContent, TabsList, TabsRoot, TabsTrigger, Toggle, ToggleGroupItem, ToggleGroupRoot, TooltipContent, TooltipPortal, TooltipProvider, TooltipRoot, TooltipTrigger, useId } from "reka-ui";
|
|
3
|
+
import { endOfMonth, getLocalTimeZone, parseDate, startOfMonth, startOfWeek, today } from "@internationalized/date";
|
|
4
|
+
//#region src/Button.vue?vue&type=script&setup=true&lang.ts
|
|
5
|
+
var _hoisted_1$38 = [
|
|
6
|
+
"aria-label",
|
|
7
|
+
"aria-labelledby",
|
|
8
|
+
"type",
|
|
9
|
+
"disabled",
|
|
10
|
+
"aria-disabled",
|
|
11
|
+
"data-pending"
|
|
12
|
+
];
|
|
13
|
+
//#endregion
|
|
14
|
+
//#region src/Button.vue
|
|
15
|
+
var Button_default = /* @__PURE__ */ defineComponent({
|
|
16
|
+
__name: "Button",
|
|
17
|
+
props: {
|
|
18
|
+
variant: { default: "primary" },
|
|
19
|
+
ariaLabel: { default: void 0 },
|
|
20
|
+
ariaLabelledby: { default: void 0 },
|
|
21
|
+
size: { default: "md" },
|
|
22
|
+
fullWidth: {
|
|
23
|
+
type: Boolean,
|
|
24
|
+
default: false
|
|
25
|
+
},
|
|
26
|
+
type: { default: "button" },
|
|
27
|
+
disabled: {
|
|
28
|
+
type: Boolean,
|
|
29
|
+
default: false
|
|
30
|
+
},
|
|
31
|
+
iconOnly: {
|
|
32
|
+
type: Boolean,
|
|
33
|
+
default: false
|
|
34
|
+
},
|
|
35
|
+
pending: {
|
|
36
|
+
type: Boolean,
|
|
37
|
+
default: false
|
|
38
|
+
}
|
|
39
|
+
},
|
|
40
|
+
emits: ["press"],
|
|
41
|
+
setup(__props, { emit: __emit }) {
|
|
42
|
+
const props = __props;
|
|
43
|
+
const hovered = ref(false), pressed = ref(false), focused = ref(false), focusVisible = ref(false);
|
|
44
|
+
watch(() => [props.disabled, props.pending], ([disabled, pending]) => {
|
|
45
|
+
if (disabled || pending) {
|
|
46
|
+
hovered.value = false;
|
|
47
|
+
pressed.value = false;
|
|
48
|
+
}
|
|
49
|
+
if (props.disabled) {
|
|
50
|
+
focused.value = false;
|
|
51
|
+
focusVisible.value = false;
|
|
52
|
+
}
|
|
53
|
+
});
|
|
54
|
+
function hover(event) {
|
|
55
|
+
if (!props.disabled && !props.pending && event.pointerType !== "touch") hovered.value = true;
|
|
56
|
+
}
|
|
57
|
+
function pointerdown(event) {
|
|
58
|
+
focusVisible.value = false;
|
|
59
|
+
if (!props.disabled && !props.pending && event.button === 0) pressed.value = true;
|
|
60
|
+
}
|
|
61
|
+
function leave() {
|
|
62
|
+
hovered.value = false;
|
|
63
|
+
pressed.value = false;
|
|
64
|
+
}
|
|
65
|
+
function focus(event) {
|
|
66
|
+
focused.value = true;
|
|
67
|
+
focusVisible.value = event.target.matches(":focus-visible");
|
|
68
|
+
}
|
|
69
|
+
function blur() {
|
|
70
|
+
focused.value = false;
|
|
71
|
+
focusVisible.value = false;
|
|
72
|
+
pressed.value = false;
|
|
73
|
+
}
|
|
74
|
+
const emit = __emit;
|
|
75
|
+
const classes = computed(() => [
|
|
76
|
+
"button",
|
|
77
|
+
`button--${props.variant}`,
|
|
78
|
+
props.size !== "md" && `button--${props.size}`,
|
|
79
|
+
props.iconOnly && "button--icon-only",
|
|
80
|
+
props.fullWidth && !props.iconOnly && "button--full-width"
|
|
81
|
+
]);
|
|
82
|
+
function press(event) {
|
|
83
|
+
if (props.disabled || props.pending) {
|
|
84
|
+
event.preventDefault();
|
|
85
|
+
event.stopImmediatePropagation();
|
|
86
|
+
return;
|
|
87
|
+
}
|
|
88
|
+
emit("press", event);
|
|
89
|
+
}
|
|
90
|
+
function keydown(event) {
|
|
91
|
+
if (focused.value) focusVisible.value = true;
|
|
92
|
+
if (props.pending && (event.key === "Enter" || event.key === " ")) {
|
|
93
|
+
event.preventDefault();
|
|
94
|
+
event.stopImmediatePropagation();
|
|
95
|
+
return;
|
|
96
|
+
}
|
|
97
|
+
if (!props.disabled && (event.key === "Enter" || event.key === " ")) pressed.value = true;
|
|
98
|
+
}
|
|
99
|
+
return (_ctx, _cache) => {
|
|
100
|
+
return openBlock(), createElementBlock("button", {
|
|
101
|
+
class: normalizeClass(classes.value),
|
|
102
|
+
"aria-label": __props.ariaLabel,
|
|
103
|
+
"aria-labelledby": __props.ariaLabelledby,
|
|
104
|
+
type: __props.pending ? "button" : __props.type,
|
|
105
|
+
disabled: __props.disabled,
|
|
106
|
+
"aria-disabled": __props.pending || void 0,
|
|
107
|
+
"data-pending": __props.pending || void 0,
|
|
108
|
+
onClick: press,
|
|
109
|
+
onKeydown: keydown,
|
|
110
|
+
onKeyup: _cache[0] || (_cache[0] = ($event) => pressed.value = false),
|
|
111
|
+
onPointerenter: hover,
|
|
112
|
+
onPointerleave: leave,
|
|
113
|
+
onPointerdown: pointerdown,
|
|
114
|
+
onPointerup: _cache[1] || (_cache[1] = ($event) => pressed.value = false),
|
|
115
|
+
onPointercancel: _cache[2] || (_cache[2] = ($event) => pressed.value = false),
|
|
116
|
+
onFocus: focus,
|
|
117
|
+
onBlur: blur
|
|
118
|
+
}, [renderSlot(_ctx.$slots, "default", {
|
|
119
|
+
pending: __props.pending,
|
|
120
|
+
disabled: __props.disabled,
|
|
121
|
+
hovered: hovered.value,
|
|
122
|
+
pressed: pressed.value,
|
|
123
|
+
focused: focused.value,
|
|
124
|
+
focusVisible: focusVisible.value
|
|
125
|
+
})], 42, _hoisted_1$38);
|
|
126
|
+
};
|
|
127
|
+
}
|
|
128
|
+
});
|
|
129
|
+
//#endregion
|
|
130
|
+
//#region src/ButtonGroup.ts
|
|
131
|
+
var ButtonGroup_default = /* @__PURE__ */ defineComponent({
|
|
132
|
+
name: "ButtonGroup",
|
|
133
|
+
inheritAttrs: false,
|
|
134
|
+
props: {
|
|
135
|
+
label: {
|
|
136
|
+
type: String,
|
|
137
|
+
required: true
|
|
138
|
+
},
|
|
139
|
+
variant: {
|
|
140
|
+
type: String,
|
|
141
|
+
default: void 0
|
|
142
|
+
},
|
|
143
|
+
size: {
|
|
144
|
+
type: String,
|
|
145
|
+
default: void 0
|
|
146
|
+
},
|
|
147
|
+
disabled: {
|
|
148
|
+
type: Boolean,
|
|
149
|
+
default: void 0
|
|
150
|
+
},
|
|
151
|
+
fullWidth: Boolean,
|
|
152
|
+
orientation: {
|
|
153
|
+
type: String,
|
|
154
|
+
default: "horizontal"
|
|
155
|
+
},
|
|
156
|
+
dir: {
|
|
157
|
+
type: String,
|
|
158
|
+
default: void 0
|
|
159
|
+
}
|
|
160
|
+
},
|
|
161
|
+
setup(props, { slots, attrs }) {
|
|
162
|
+
function defaults(nodes) {
|
|
163
|
+
return nodes.map((child) => {
|
|
164
|
+
if (child.type === Fragment && Array.isArray(child.children)) {
|
|
165
|
+
const fragment = cloneVNode(child);
|
|
166
|
+
fragment.children = defaults(child.children);
|
|
167
|
+
return fragment;
|
|
168
|
+
}
|
|
169
|
+
if (child.type !== Button_default) return child;
|
|
170
|
+
return cloneVNode(child, {
|
|
171
|
+
variant: child.props?.variant ?? props.variant,
|
|
172
|
+
size: child.props?.size ?? props.size,
|
|
173
|
+
disabled: child.props?.disabled ?? props.disabled
|
|
174
|
+
});
|
|
175
|
+
});
|
|
176
|
+
}
|
|
177
|
+
return () => h("div", {
|
|
178
|
+
...attrs,
|
|
179
|
+
role: "group",
|
|
180
|
+
"aria-label": props.label,
|
|
181
|
+
dir: props.dir,
|
|
182
|
+
"data-orientation": props.orientation,
|
|
183
|
+
class: ["button-group", props.fullWidth && "button-group--full-width"]
|
|
184
|
+
}, defaults(slots.default?.() ?? []));
|
|
185
|
+
}
|
|
186
|
+
});
|
|
187
|
+
//#endregion
|
|
188
|
+
//#region src/ButtonGroupSeparator.ts
|
|
189
|
+
var ButtonGroupSeparator_default = /* @__PURE__ */ defineComponent({
|
|
190
|
+
name: "ButtonGroupSeparator",
|
|
191
|
+
setup: () => () => h("span", {
|
|
192
|
+
class: "button-group__separator",
|
|
193
|
+
"aria-hidden": "true"
|
|
194
|
+
})
|
|
195
|
+
});
|
|
196
|
+
//#endregion
|
|
197
|
+
//#region src/button-family-context.ts
|
|
198
|
+
var toggleButtonGroupKey = Symbol("KazeeToggleButtonGroup");
|
|
199
|
+
//#endregion
|
|
200
|
+
//#region src/ToggleButton.vue
|
|
201
|
+
var ToggleButton_default = /* @__PURE__ */ defineComponent({
|
|
202
|
+
inheritAttrs: false,
|
|
203
|
+
__name: "ToggleButton",
|
|
204
|
+
props: {
|
|
205
|
+
id: { default: void 0 },
|
|
206
|
+
variant: { default: "default" },
|
|
207
|
+
size: { default: void 0 },
|
|
208
|
+
iconOnly: { type: Boolean },
|
|
209
|
+
modelValue: {
|
|
210
|
+
type: Boolean,
|
|
211
|
+
default: void 0
|
|
212
|
+
},
|
|
213
|
+
defaultSelected: { type: Boolean },
|
|
214
|
+
disabled: { type: Boolean }
|
|
215
|
+
},
|
|
216
|
+
emits: ["update:modelValue", "press"],
|
|
217
|
+
setup(__props, { emit: __emit }) {
|
|
218
|
+
const props = __props;
|
|
219
|
+
const emit = __emit;
|
|
220
|
+
const group = inject(toggleButtonGroupKey, void 0);
|
|
221
|
+
if (group && !props.id) throw new Error("A grouped ToggleButton requires a unique nonempty id.");
|
|
222
|
+
const instance = getCurrentInstance();
|
|
223
|
+
const local = ref(props.defaultSelected ?? false);
|
|
224
|
+
const controlled = () => Object.prototype.hasOwnProperty.call(instance?.vnode.props ?? {}, "modelValue");
|
|
225
|
+
const selected = computed(() => controlled() ? !!props.modelValue : local.value);
|
|
226
|
+
const classes = computed(() => {
|
|
227
|
+
const size = props.size ?? group?.value.size ?? "md";
|
|
228
|
+
return [
|
|
229
|
+
"button",
|
|
230
|
+
"toggle-button",
|
|
231
|
+
`toggle-button--${props.variant}`,
|
|
232
|
+
size !== "md" && `button--${size}`,
|
|
233
|
+
props.iconOnly && "button--icon-only"
|
|
234
|
+
];
|
|
235
|
+
});
|
|
236
|
+
function update(value) {
|
|
237
|
+
if (props.disabled) return;
|
|
238
|
+
if (!controlled()) local.value = value;
|
|
239
|
+
emit("update:modelValue", value);
|
|
240
|
+
}
|
|
241
|
+
function press(event) {
|
|
242
|
+
if (!props.disabled && !group?.value.disabled) emit("press", event);
|
|
243
|
+
}
|
|
244
|
+
return (_ctx, _cache) => {
|
|
245
|
+
return unref(group) ? (openBlock(), createBlock(unref(ToggleGroupItem), mergeProps({ key: 0 }, _ctx.$attrs, {
|
|
246
|
+
id: __props.id,
|
|
247
|
+
value: __props.id ?? "",
|
|
248
|
+
class: classes.value,
|
|
249
|
+
disabled: __props.disabled,
|
|
250
|
+
role: unref(group).radio ? "radio" : void 0,
|
|
251
|
+
"aria-checked": unref(group).radio ? unref(group).selectedIds.includes(__props.id ?? "") : void 0,
|
|
252
|
+
"aria-pressed": unref(group).radio ? void 0 : unref(group).selectedIds.includes(__props.id ?? ""),
|
|
253
|
+
onClick: press
|
|
254
|
+
}), {
|
|
255
|
+
default: withCtx((state) => [renderSlot(_ctx.$slots, "default", {
|
|
256
|
+
selected: !!state.modelValue,
|
|
257
|
+
disabled: state.disabled
|
|
258
|
+
})]),
|
|
259
|
+
_: 3
|
|
260
|
+
}, 16, [
|
|
261
|
+
"id",
|
|
262
|
+
"value",
|
|
263
|
+
"class",
|
|
264
|
+
"disabled",
|
|
265
|
+
"role",
|
|
266
|
+
"aria-checked",
|
|
267
|
+
"aria-pressed"
|
|
268
|
+
])) : (openBlock(), createBlock(unref(Toggle), mergeProps({ key: 1 }, _ctx.$attrs, {
|
|
269
|
+
id: __props.id,
|
|
270
|
+
class: classes.value,
|
|
271
|
+
"model-value": selected.value,
|
|
272
|
+
disabled: __props.disabled,
|
|
273
|
+
"onUpdate:modelValue": update,
|
|
274
|
+
onClick: press
|
|
275
|
+
}), {
|
|
276
|
+
default: withCtx(() => [renderSlot(_ctx.$slots, "default", {
|
|
277
|
+
selected: selected.value,
|
|
278
|
+
disabled: !!__props.disabled
|
|
279
|
+
})]),
|
|
280
|
+
_: 3
|
|
281
|
+
}, 16, [
|
|
282
|
+
"id",
|
|
283
|
+
"class",
|
|
284
|
+
"model-value",
|
|
285
|
+
"disabled"
|
|
286
|
+
]));
|
|
287
|
+
};
|
|
288
|
+
}
|
|
289
|
+
});
|
|
290
|
+
//#endregion
|
|
291
|
+
//#region src/ToggleButtonGroup.vue?vue&type=script&setup=true&lang.ts
|
|
292
|
+
var _hoisted_1$37 = ["role"];
|
|
293
|
+
//#endregion
|
|
294
|
+
//#region src/ToggleButtonGroup.vue
|
|
295
|
+
var ToggleButtonGroup_default = /* @__PURE__ */ defineComponent({
|
|
296
|
+
__name: "ToggleButtonGroup",
|
|
297
|
+
props: {
|
|
298
|
+
label: {},
|
|
299
|
+
selectionMode: {},
|
|
300
|
+
modelValue: {},
|
|
301
|
+
defaultValue: {},
|
|
302
|
+
disabled: { type: Boolean },
|
|
303
|
+
detached: { type: Boolean },
|
|
304
|
+
fullWidth: { type: Boolean },
|
|
305
|
+
size: {},
|
|
306
|
+
orientation: {},
|
|
307
|
+
dir: {},
|
|
308
|
+
disallowEmptySelection: { type: Boolean }
|
|
309
|
+
},
|
|
310
|
+
emits: ["update:modelValue"],
|
|
311
|
+
setup(__props, { emit: __emit }) {
|
|
312
|
+
const props = __props;
|
|
313
|
+
const emit = __emit;
|
|
314
|
+
const instance = getCurrentInstance();
|
|
315
|
+
const controlled = () => Object.prototype.hasOwnProperty.call(instance?.vnode.props ?? {}, "modelValue");
|
|
316
|
+
const local = ref(props.defaultValue);
|
|
317
|
+
const multiple = computed(() => props.selectionMode === "multiple");
|
|
318
|
+
const ids = computed(() => {
|
|
319
|
+
const value = controlled() ? props.modelValue : local.value;
|
|
320
|
+
return Array.isArray(value) ? value : typeof value === "string" && value ? [value] : [];
|
|
321
|
+
});
|
|
322
|
+
function update(value) {
|
|
323
|
+
if (props.disabled) return;
|
|
324
|
+
const next = Array.isArray(value) ? value : typeof value === "string" && value ? [value] : [];
|
|
325
|
+
if (next.length === ids.value.length && next.every((id, index) => id === ids.value[index])) return;
|
|
326
|
+
if (props.disallowEmptySelection && ids.value.length && !next.length) return;
|
|
327
|
+
const result = multiple.value ? next : next[0] ?? null;
|
|
328
|
+
if (!controlled()) local.value = result;
|
|
329
|
+
emit("update:modelValue", result);
|
|
330
|
+
}
|
|
331
|
+
const radio = computed(() => !multiple.value);
|
|
332
|
+
provide(toggleButtonGroupKey, computed(() => ({
|
|
333
|
+
size: props.size ?? "md",
|
|
334
|
+
radio: radio.value,
|
|
335
|
+
selectedIds: ids.value,
|
|
336
|
+
disabled: !!props.disabled
|
|
337
|
+
})));
|
|
338
|
+
return (_ctx, _cache) => {
|
|
339
|
+
return openBlock(), createBlock(unref(ToggleGroupRoot), {
|
|
340
|
+
"as-child": "",
|
|
341
|
+
class: normalizeClass(["button-group toggle-button-group", {
|
|
342
|
+
"button-group--detached": __props.detached,
|
|
343
|
+
"button-group--full-width": __props.fullWidth
|
|
344
|
+
}]),
|
|
345
|
+
"aria-label": __props.label,
|
|
346
|
+
"aria-orientation": __props.orientation ?? "horizontal",
|
|
347
|
+
"aria-disabled": __props.disabled || void 0,
|
|
348
|
+
type: multiple.value ? "multiple" : "single",
|
|
349
|
+
"model-value": multiple.value ? ids.value : ids.value[0] ?? "",
|
|
350
|
+
disabled: __props.disabled,
|
|
351
|
+
orientation: __props.orientation ?? "horizontal",
|
|
352
|
+
"data-orientation": __props.orientation ?? "horizontal",
|
|
353
|
+
dir: __props.dir,
|
|
354
|
+
"onUpdate:modelValue": update
|
|
355
|
+
}, {
|
|
356
|
+
default: withCtx(() => [createElementVNode("div", { role: radio.value ? "radiogroup" : "toolbar" }, [renderSlot(_ctx.$slots, "default")], 8, _hoisted_1$37)]),
|
|
357
|
+
_: 3
|
|
358
|
+
}, 8, [
|
|
359
|
+
"class",
|
|
360
|
+
"aria-label",
|
|
361
|
+
"aria-orientation",
|
|
362
|
+
"aria-disabled",
|
|
363
|
+
"type",
|
|
364
|
+
"model-value",
|
|
365
|
+
"disabled",
|
|
366
|
+
"orientation",
|
|
367
|
+
"data-orientation",
|
|
368
|
+
"dir"
|
|
369
|
+
]);
|
|
370
|
+
};
|
|
371
|
+
}
|
|
372
|
+
});
|
|
373
|
+
//#endregion
|
|
374
|
+
//#region \0plugin-vue:export-helper
|
|
375
|
+
var _plugin_vue_export_helper_default = (sfc, props) => {
|
|
376
|
+
const target = sfc.__vccOpts || sfc;
|
|
377
|
+
for (const [key, val] of props) target[key] = val;
|
|
378
|
+
return target;
|
|
379
|
+
};
|
|
380
|
+
//#endregion
|
|
381
|
+
//#region src/CheckIcon.vue
|
|
382
|
+
var _sfc_main$2 = {};
|
|
383
|
+
var _hoisted_1$36 = {
|
|
384
|
+
viewBox: "0 0 16 16",
|
|
385
|
+
fill: "none",
|
|
386
|
+
stroke: "currentColor",
|
|
387
|
+
"stroke-width": "1.5",
|
|
388
|
+
"stroke-linecap": "round",
|
|
389
|
+
"stroke-linejoin": "round",
|
|
390
|
+
"aria-hidden": "true"
|
|
391
|
+
};
|
|
392
|
+
function _sfc_render$2(_ctx, _cache) {
|
|
393
|
+
return openBlock(), createElementBlock("svg", _hoisted_1$36, [..._cache[0] || (_cache[0] = [createElementVNode("path", { d: "M3.5 8.5l3 3 6-6.5" }, null, -1)])]);
|
|
394
|
+
}
|
|
395
|
+
var CheckIcon_default = /*#__PURE__*/ _plugin_vue_export_helper_default(_sfc_main$2, [["render", _sfc_render$2]]);
|
|
396
|
+
//#endregion
|
|
397
|
+
//#region src/ChevronIcon.vue
|
|
398
|
+
var _sfc_main$1 = {};
|
|
399
|
+
var _hoisted_1$35 = {
|
|
400
|
+
viewBox: "0 0 16 16",
|
|
401
|
+
fill: "none",
|
|
402
|
+
stroke: "currentColor",
|
|
403
|
+
"stroke-width": "1.5",
|
|
404
|
+
"stroke-linecap": "round",
|
|
405
|
+
"stroke-linejoin": "round",
|
|
406
|
+
"aria-hidden": "true"
|
|
407
|
+
};
|
|
408
|
+
function _sfc_render$1(_ctx, _cache) {
|
|
409
|
+
return openBlock(), createElementBlock("svg", _hoisted_1$35, [..._cache[0] || (_cache[0] = [createElementVNode("path", { d: "M4 6l4 4 4-4" }, null, -1)])]);
|
|
410
|
+
}
|
|
411
|
+
var ChevronIcon_default = /*#__PURE__*/ _plugin_vue_export_helper_default(_sfc_main$1, [["render", _sfc_render$1]]);
|
|
412
|
+
//#endregion
|
|
413
|
+
//#region src/CloseIcon.vue
|
|
414
|
+
var _sfc_main = {};
|
|
415
|
+
var _hoisted_1$34 = {
|
|
416
|
+
viewBox: "0 0 16 16",
|
|
417
|
+
fill: "none",
|
|
418
|
+
stroke: "currentColor",
|
|
419
|
+
"stroke-width": "1.5",
|
|
420
|
+
"stroke-linecap": "round",
|
|
421
|
+
"stroke-linejoin": "round",
|
|
422
|
+
"aria-hidden": "true"
|
|
423
|
+
};
|
|
424
|
+
function _sfc_render(_ctx, _cache) {
|
|
425
|
+
return openBlock(), createElementBlock("svg", _hoisted_1$34, [..._cache[0] || (_cache[0] = [createElementVNode("path", { d: "M4 4l8 8M12 4l-8 8" }, null, -1)])]);
|
|
426
|
+
}
|
|
427
|
+
var CloseIcon_default = /*#__PURE__*/ _plugin_vue_export_helper_default(_sfc_main, [["render", _sfc_render]]);
|
|
428
|
+
//#endregion
|
|
429
|
+
//#region src/FieldFeedback.vue?vue&type=script&setup=true&lang.ts
|
|
430
|
+
var _hoisted_1$33 = {
|
|
431
|
+
key: 0,
|
|
432
|
+
class: "field-feedback"
|
|
433
|
+
};
|
|
434
|
+
var _hoisted_2$27 = ["id"];
|
|
435
|
+
var _hoisted_3$23 = ["id"];
|
|
436
|
+
//#endregion
|
|
437
|
+
//#region src/FieldFeedback.vue
|
|
438
|
+
var FieldFeedback_default = /* @__PURE__ */ defineComponent({
|
|
439
|
+
__name: "FieldFeedback",
|
|
440
|
+
props: {
|
|
441
|
+
controlId: {},
|
|
442
|
+
description: { default: void 0 },
|
|
443
|
+
errorMessage: { default: void 0 },
|
|
444
|
+
showError: { type: Boolean }
|
|
445
|
+
},
|
|
446
|
+
setup(__props) {
|
|
447
|
+
return (_ctx, _cache) => {
|
|
448
|
+
return __props.description || __props.showError ? (openBlock(), createElementBlock("div", _hoisted_1$33, [__props.description ? (openBlock(), createElementBlock("span", {
|
|
449
|
+
key: 0,
|
|
450
|
+
id: `${__props.controlId}-description`,
|
|
451
|
+
class: "input__description"
|
|
452
|
+
}, toDisplayString(__props.description), 9, _hoisted_2$27)) : createCommentVNode("", true), __props.showError ? (openBlock(), createElementBlock("span", {
|
|
453
|
+
key: 1,
|
|
454
|
+
id: `${__props.controlId}-error`,
|
|
455
|
+
class: "input__error"
|
|
456
|
+
}, toDisplayString(__props.errorMessage), 9, _hoisted_3$23)) : createCommentVNode("", true)])) : createCommentVNode("", true);
|
|
457
|
+
};
|
|
458
|
+
}
|
|
459
|
+
});
|
|
460
|
+
//#endregion
|
|
461
|
+
//#region src/SelectionValidation.vue?vue&type=script&setup=true&lang.ts
|
|
462
|
+
var _hoisted_1$32 = [
|
|
463
|
+
"required",
|
|
464
|
+
"disabled",
|
|
465
|
+
"value"
|
|
466
|
+
];
|
|
467
|
+
//#endregion
|
|
468
|
+
//#region src/SelectionValidation.vue
|
|
469
|
+
var SelectionValidation_default = /* @__PURE__ */ defineComponent({
|
|
470
|
+
__name: "SelectionValidation",
|
|
471
|
+
props: {
|
|
472
|
+
hasValue: { type: Boolean },
|
|
473
|
+
required: { type: Boolean },
|
|
474
|
+
disabled: { type: Boolean }
|
|
475
|
+
},
|
|
476
|
+
emits: ["invalid", "reset"],
|
|
477
|
+
setup(__props, { emit: __emit }) {
|
|
478
|
+
const emit = __emit;
|
|
479
|
+
const input = ref();
|
|
480
|
+
let form;
|
|
481
|
+
const reset = (event) => setTimeout(() => emit("reset", event.defaultPrevented), 0);
|
|
482
|
+
onMounted(() => {
|
|
483
|
+
form = input.value?.form;
|
|
484
|
+
form?.addEventListener("reset", reset);
|
|
485
|
+
});
|
|
486
|
+
onBeforeUnmount(() => form?.removeEventListener("reset", reset));
|
|
487
|
+
return (_ctx, _cache) => {
|
|
488
|
+
return openBlock(), createElementBlock("input", {
|
|
489
|
+
ref_key: "input",
|
|
490
|
+
ref: input,
|
|
491
|
+
class: "selection__validation",
|
|
492
|
+
type: "text",
|
|
493
|
+
tabindex: "-1",
|
|
494
|
+
"aria-hidden": "true",
|
|
495
|
+
autocomplete: "off",
|
|
496
|
+
required: __props.required,
|
|
497
|
+
disabled: __props.disabled,
|
|
498
|
+
value: __props.hasValue ? "selected" : "",
|
|
499
|
+
onInvalid: _cache[0] || (_cache[0] = withModifiers(($event) => emit("invalid"), ["prevent"]))
|
|
500
|
+
}, null, 40, _hoisted_1$32);
|
|
501
|
+
};
|
|
502
|
+
}
|
|
503
|
+
});
|
|
504
|
+
//#endregion
|
|
505
|
+
//#region src/useFeedback.ts
|
|
506
|
+
function useFeedback(props) {
|
|
507
|
+
const generated = useId();
|
|
508
|
+
const controlId = computed(() => props.id ?? generated);
|
|
509
|
+
const showError = computed(() => !!(props.invalid && props.errorMessage));
|
|
510
|
+
return {
|
|
511
|
+
controlId,
|
|
512
|
+
showError,
|
|
513
|
+
describedBy: computed(() => [props.description && `${controlId.value}-description`, showError.value && `${controlId.value}-error`].filter(Boolean).join(" ") || void 0)
|
|
514
|
+
};
|
|
515
|
+
}
|
|
516
|
+
//#endregion
|
|
517
|
+
//#region src/selection-options.ts
|
|
518
|
+
function selectionIds(value, options, multiple) {
|
|
519
|
+
const requested = new Set(Array.isArray(value) ? value : typeof value === "string" ? [value] : []);
|
|
520
|
+
const ids = [...new Set(options.filter((o) => o.id !== "" && requested.has(o.id)).map((o) => o.id))];
|
|
521
|
+
return multiple ? ids : ids.slice(0, 1);
|
|
522
|
+
}
|
|
523
|
+
function filterOptions(options, query) {
|
|
524
|
+
const fold = (text) => text.normalize("NFD").replace(/\p{M}/gu, "").toLowerCase();
|
|
525
|
+
const search = fold(query.trim());
|
|
526
|
+
return options.filter((o) => fold(`${o.label} ${o.description ?? ""}`).includes(search));
|
|
527
|
+
}
|
|
528
|
+
//#endregion
|
|
529
|
+
//#region src/Select.vue?vue&type=script&setup=true&lang.ts
|
|
530
|
+
var _hoisted_1$31 = ["data-multiple", "dir"];
|
|
531
|
+
var _hoisted_2$26 = ["for"];
|
|
532
|
+
var _hoisted_3$22 = {
|
|
533
|
+
key: 0,
|
|
534
|
+
class: "selection__required",
|
|
535
|
+
"aria-hidden": "true"
|
|
536
|
+
};
|
|
537
|
+
var _hoisted_4$18 = ["data-clearable"];
|
|
538
|
+
var _hoisted_5$12 = {
|
|
539
|
+
key: 0,
|
|
540
|
+
class: "selection__leading",
|
|
541
|
+
"aria-hidden": "true"
|
|
542
|
+
};
|
|
543
|
+
var _hoisted_6$9 = [
|
|
544
|
+
"data-empty",
|
|
545
|
+
"aria-hidden",
|
|
546
|
+
"tabindex",
|
|
547
|
+
"aria-label",
|
|
548
|
+
"disabled"
|
|
549
|
+
];
|
|
550
|
+
var _hoisted_7$8 = {
|
|
551
|
+
key: 0,
|
|
552
|
+
class: "selection__description"
|
|
553
|
+
};
|
|
554
|
+
var _hoisted_8$8 = [
|
|
555
|
+
"name",
|
|
556
|
+
"value",
|
|
557
|
+
"disabled"
|
|
558
|
+
];
|
|
559
|
+
//#endregion
|
|
560
|
+
//#region src/Select.vue
|
|
561
|
+
var Select_default = /* @__PURE__ */ defineComponent({
|
|
562
|
+
__name: "Select",
|
|
563
|
+
props: {
|
|
564
|
+
label: {},
|
|
565
|
+
options: {},
|
|
566
|
+
size: { default: "md" },
|
|
567
|
+
variant: { default: "primary" },
|
|
568
|
+
hideLabel: { type: Boolean },
|
|
569
|
+
fullWidth: {
|
|
570
|
+
type: Boolean,
|
|
571
|
+
default: true
|
|
572
|
+
},
|
|
573
|
+
placeholder: { default: void 0 },
|
|
574
|
+
selectionMode: { default: void 0 },
|
|
575
|
+
modelValue: { default: void 0 },
|
|
576
|
+
defaultValue: { default: void 0 },
|
|
577
|
+
disabled: { type: Boolean },
|
|
578
|
+
required: { type: Boolean },
|
|
579
|
+
invalid: { type: Boolean },
|
|
580
|
+
description: { default: void 0 },
|
|
581
|
+
errorMessage: { default: void 0 },
|
|
582
|
+
requiredMessage: { default: void 0 },
|
|
583
|
+
name: { default: void 0 },
|
|
584
|
+
dir: { default: void 0 },
|
|
585
|
+
clearable: { type: Boolean },
|
|
586
|
+
clearLabel: { default: void 0 }
|
|
587
|
+
},
|
|
588
|
+
emits: [
|
|
589
|
+
"update:modelValue",
|
|
590
|
+
"clear",
|
|
591
|
+
"close"
|
|
592
|
+
],
|
|
593
|
+
setup(__props, { emit: __emit }) {
|
|
594
|
+
const props = __props;
|
|
595
|
+
const emit = __emit;
|
|
596
|
+
function afterClose() {
|
|
597
|
+
queueMicrotask(() => emit("close"));
|
|
598
|
+
}
|
|
599
|
+
const instance = getCurrentInstance();
|
|
600
|
+
const controlled = () => Object.prototype.hasOwnProperty.call(instance?.vnode.props ?? {}, "modelValue");
|
|
601
|
+
const local = ref(props.defaultValue);
|
|
602
|
+
const tried = ref(false);
|
|
603
|
+
const wrapper = ref();
|
|
604
|
+
const multiple = computed(() => props.selectionMode === "multiple");
|
|
605
|
+
const ids = computed(() => selectionIds(controlled() ? props.modelValue : local.value, props.options, multiple.value));
|
|
606
|
+
const selected = computed(() => props.options.filter((o) => ids.value.includes(o.id)));
|
|
607
|
+
const invalid = computed(() => props.invalid || tried.value && props.required && ids.value.length === 0);
|
|
608
|
+
const error = computed(() => props.errorMessage ?? (props.required && ids.value.length === 0 ? props.requiredMessage ?? "Pilihan wajib diisi." : void 0));
|
|
609
|
+
const { controlId, describedBy, showError } = useFeedback({
|
|
610
|
+
get description() {
|
|
611
|
+
return props.description;
|
|
612
|
+
},
|
|
613
|
+
get invalid() {
|
|
614
|
+
return invalid.value;
|
|
615
|
+
},
|
|
616
|
+
get errorMessage() {
|
|
617
|
+
return error.value;
|
|
618
|
+
}
|
|
619
|
+
});
|
|
620
|
+
function focus() {
|
|
621
|
+
wrapper.value?.querySelector(".select__trigger")?.focus();
|
|
622
|
+
}
|
|
623
|
+
function update(value) {
|
|
624
|
+
if (props.disabled) return;
|
|
625
|
+
const next = selectionIds(value, props.options, multiple.value);
|
|
626
|
+
const result = multiple.value ? next : next[0];
|
|
627
|
+
local.value = result;
|
|
628
|
+
emit("update:modelValue", result);
|
|
629
|
+
}
|
|
630
|
+
function clear() {
|
|
631
|
+
update(multiple.value ? [] : void 0);
|
|
632
|
+
emit("clear");
|
|
633
|
+
focus();
|
|
634
|
+
}
|
|
635
|
+
function reset(cancelled) {
|
|
636
|
+
if (!cancelled) {
|
|
637
|
+
tried.value = false;
|
|
638
|
+
if (!controlled()) local.value = props.defaultValue;
|
|
639
|
+
}
|
|
640
|
+
}
|
|
641
|
+
return (_ctx, _cache) => {
|
|
642
|
+
return openBlock(), createElementBlock("div", {
|
|
643
|
+
ref_key: "wrapper",
|
|
644
|
+
ref: wrapper,
|
|
645
|
+
class: normalizeClass([
|
|
646
|
+
"select",
|
|
647
|
+
`select--${__props.size ?? "md"}`,
|
|
648
|
+
`select--${__props.variant ?? "primary"}`,
|
|
649
|
+
__props.hideLabel && "select--label-hidden",
|
|
650
|
+
__props.fullWidth === false && "select--fit"
|
|
651
|
+
]),
|
|
652
|
+
"data-multiple": multiple.value || void 0,
|
|
653
|
+
dir: __props.dir
|
|
654
|
+
}, [
|
|
655
|
+
createElementVNode("label", {
|
|
656
|
+
class: "select__label",
|
|
657
|
+
for: unref(controlId)
|
|
658
|
+
}, [createTextVNode(toDisplayString(__props.label), 1), __props.required ? (openBlock(), createElementBlock("span", _hoisted_3$22, " *")) : createCommentVNode("", true)], 8, _hoisted_2$26),
|
|
659
|
+
createVNode(unref(SelectRoot), {
|
|
660
|
+
"model-value": multiple.value ? ids.value : ids.value[0] ?? "",
|
|
661
|
+
multiple: multiple.value,
|
|
662
|
+
disabled: __props.disabled,
|
|
663
|
+
dir: __props.dir,
|
|
664
|
+
"onUpdate:modelValue": update
|
|
665
|
+
}, {
|
|
666
|
+
default: withCtx(() => [createElementVNode("div", {
|
|
667
|
+
class: "select__control",
|
|
668
|
+
"data-clearable": __props.clearable || void 0
|
|
669
|
+
}, [createVNode(unref(SelectTrigger), {
|
|
670
|
+
id: unref(controlId),
|
|
671
|
+
class: "select__trigger",
|
|
672
|
+
"aria-required": __props.required || void 0,
|
|
673
|
+
"aria-invalid": invalid.value || void 0,
|
|
674
|
+
"aria-describedby": unref(describedBy)
|
|
675
|
+
}, {
|
|
676
|
+
default: withCtx(() => [
|
|
677
|
+
_ctx.$slots.start ? (openBlock(), createElementBlock("span", _hoisted_5$12, [renderSlot(_ctx.$slots, "start")])) : createCommentVNode("", true),
|
|
678
|
+
createVNode(unref(SelectValue), {
|
|
679
|
+
class: "select__value",
|
|
680
|
+
placeholder: __props.placeholder
|
|
681
|
+
}, {
|
|
682
|
+
default: withCtx(() => [selected.value.length ? renderSlot(_ctx.$slots, "value", { selected: selected.value }, () => [createTextVNode(toDisplayString(selected.value.map((o) => o.label).join(", ")), 1)], void 0, 0) : (openBlock(), createElementBlock(Fragment, { key: 1 }, [createTextVNode(toDisplayString(__props.placeholder), 1)], 64))]),
|
|
683
|
+
_: 3
|
|
684
|
+
}, 8, ["placeholder"]),
|
|
685
|
+
createVNode(ChevronIcon_default, { class: "select__icon" })
|
|
686
|
+
]),
|
|
687
|
+
_: 3
|
|
688
|
+
}, 8, [
|
|
689
|
+
"id",
|
|
690
|
+
"aria-required",
|
|
691
|
+
"aria-invalid",
|
|
692
|
+
"aria-describedby"
|
|
693
|
+
]), __props.clearable ? (openBlock(), createElementBlock("button", {
|
|
694
|
+
key: 0,
|
|
695
|
+
type: "button",
|
|
696
|
+
class: "selection__clear",
|
|
697
|
+
"data-empty": ids.value.length === 0 || void 0,
|
|
698
|
+
"aria-hidden": ids.value.length === 0 || void 0,
|
|
699
|
+
tabindex: ids.value.length === 0 ? -1 : void 0,
|
|
700
|
+
"aria-label": __props.clearLabel ?? "Hapus pilihan",
|
|
701
|
+
disabled: __props.disabled || ids.value.length === 0,
|
|
702
|
+
onClick: clear
|
|
703
|
+
}, [createVNode(CloseIcon_default, { class: "selection__close-icon" })], 8, _hoisted_6$9)) : createCommentVNode("", true)], 8, _hoisted_4$18), createVNode(unref(SelectPortal), null, {
|
|
704
|
+
default: withCtx(() => [createVNode(unref(SelectContent), {
|
|
705
|
+
class: "select__popover",
|
|
706
|
+
position: "popper",
|
|
707
|
+
"side-offset": 4,
|
|
708
|
+
onCloseAutoFocus: afterClose
|
|
709
|
+
}, {
|
|
710
|
+
default: withCtx(() => [createVNode(unref(SelectViewport), { class: "select__list" }, {
|
|
711
|
+
default: withCtx(() => [(openBlock(true), createElementBlock(Fragment, null, renderList(__props.options, (option) => {
|
|
712
|
+
return openBlock(), createBlock(unref(SelectItem), {
|
|
713
|
+
key: option.id,
|
|
714
|
+
value: option.id,
|
|
715
|
+
"text-value": option.label,
|
|
716
|
+
disabled: option.isDisabled,
|
|
717
|
+
class: "select__item"
|
|
718
|
+
}, {
|
|
719
|
+
default: withCtx(() => [createVNode(unref(SelectItemText), { class: "select__item-label" }, {
|
|
720
|
+
default: withCtx(() => [renderSlot(_ctx.$slots, "option", { option }, () => [createTextVNode(toDisplayString(option.label), 1), option.description ? (openBlock(), createElementBlock("span", _hoisted_7$8, toDisplayString(option.description), 1)) : createCommentVNode("", true)])]),
|
|
721
|
+
_: 2
|
|
722
|
+
}, 1024), createVNode(CheckIcon_default, { class: "select__check" })]),
|
|
723
|
+
_: 2
|
|
724
|
+
}, 1032, [
|
|
725
|
+
"value",
|
|
726
|
+
"text-value",
|
|
727
|
+
"disabled"
|
|
728
|
+
]);
|
|
729
|
+
}), 128))]),
|
|
730
|
+
_: 3
|
|
731
|
+
})]),
|
|
732
|
+
_: 3
|
|
733
|
+
})]),
|
|
734
|
+
_: 3
|
|
735
|
+
})]),
|
|
736
|
+
_: 3
|
|
737
|
+
}, 8, [
|
|
738
|
+
"model-value",
|
|
739
|
+
"multiple",
|
|
740
|
+
"disabled",
|
|
741
|
+
"dir"
|
|
742
|
+
]),
|
|
743
|
+
createVNode(FieldFeedback_default, {
|
|
744
|
+
"control-id": unref(controlId),
|
|
745
|
+
description: __props.description,
|
|
746
|
+
"error-message": error.value,
|
|
747
|
+
"show-error": unref(showError)
|
|
748
|
+
}, null, 8, [
|
|
749
|
+
"control-id",
|
|
750
|
+
"description",
|
|
751
|
+
"error-message",
|
|
752
|
+
"show-error"
|
|
753
|
+
]),
|
|
754
|
+
__props.name ? (openBlock(true), createElementBlock(Fragment, { key: 0 }, renderList(multiple.value ? ids.value : [ids.value[0] ?? ""], (id, i) => {
|
|
755
|
+
return openBlock(), createElementBlock("input", {
|
|
756
|
+
key: i,
|
|
757
|
+
type: "hidden",
|
|
758
|
+
name: __props.name,
|
|
759
|
+
value: id,
|
|
760
|
+
disabled: __props.disabled
|
|
761
|
+
}, null, 8, _hoisted_8$8);
|
|
762
|
+
}), 128)) : createCommentVNode("", true),
|
|
763
|
+
createVNode(SelectionValidation_default, {
|
|
764
|
+
"has-value": ids.value.length > 0,
|
|
765
|
+
required: __props.required,
|
|
766
|
+
disabled: __props.disabled,
|
|
767
|
+
onInvalid: _cache[0] || (_cache[0] = ($event) => {
|
|
768
|
+
tried.value = true;
|
|
769
|
+
focus();
|
|
770
|
+
}),
|
|
771
|
+
onReset: reset
|
|
772
|
+
}, null, 8, [
|
|
773
|
+
"has-value",
|
|
774
|
+
"required",
|
|
775
|
+
"disabled"
|
|
776
|
+
])
|
|
777
|
+
], 10, _hoisted_1$31);
|
|
778
|
+
};
|
|
779
|
+
}
|
|
780
|
+
});
|
|
781
|
+
//#endregion
|
|
782
|
+
//#region src/SelectGroup.ts
|
|
783
|
+
var SelectGroup_default = /* @__PURE__ */ defineComponent({
|
|
784
|
+
name: "SelectGroup",
|
|
785
|
+
inheritAttrs: false,
|
|
786
|
+
props: {
|
|
787
|
+
label: {
|
|
788
|
+
type: String,
|
|
789
|
+
required: true
|
|
790
|
+
},
|
|
791
|
+
size: {
|
|
792
|
+
type: String,
|
|
793
|
+
default: void 0
|
|
794
|
+
},
|
|
795
|
+
variant: {
|
|
796
|
+
type: String,
|
|
797
|
+
default: void 0
|
|
798
|
+
},
|
|
799
|
+
fullWidth: {
|
|
800
|
+
type: Boolean,
|
|
801
|
+
default: true
|
|
802
|
+
},
|
|
803
|
+
disabled: Boolean,
|
|
804
|
+
dir: {
|
|
805
|
+
type: String,
|
|
806
|
+
default: void 0
|
|
807
|
+
}
|
|
808
|
+
},
|
|
809
|
+
setup(props, { slots }) {
|
|
810
|
+
function defaults(nodes) {
|
|
811
|
+
return nodes.map((child) => {
|
|
812
|
+
if (child.type === Fragment && Array.isArray(child.children)) {
|
|
813
|
+
const fragment = cloneVNode(child);
|
|
814
|
+
fragment.children = defaults(child.children);
|
|
815
|
+
return fragment;
|
|
816
|
+
}
|
|
817
|
+
if (child.type !== Select_default) return child;
|
|
818
|
+
return cloneVNode(child, {
|
|
819
|
+
size: child.props?.size ?? props.size,
|
|
820
|
+
variant: child.props?.variant ?? props.variant,
|
|
821
|
+
hideLabel: child.props?.hideLabel ?? child.props?.["hide-label"] ?? true,
|
|
822
|
+
fullWidth: child.props?.fullWidth ?? child.props?.["full-width"] ?? props.fullWidth,
|
|
823
|
+
disabled: props.disabled || child.props?.disabled,
|
|
824
|
+
dir: child.props?.dir ?? props.dir
|
|
825
|
+
});
|
|
826
|
+
});
|
|
827
|
+
}
|
|
828
|
+
return () => h("fieldset", {
|
|
829
|
+
class: ["select-group", !props.fullWidth && "select-group--fit"],
|
|
830
|
+
disabled: props.disabled,
|
|
831
|
+
dir: props.dir
|
|
832
|
+
}, [h("legend", { class: "select-group__legend" }, props.label), h("div", { class: "select-group__controls" }, defaults(slots.default?.() ?? []))]);
|
|
833
|
+
}
|
|
834
|
+
});
|
|
835
|
+
//#endregion
|
|
836
|
+
//#region src/Input.vue?vue&type=script&setup=true&lang.ts
|
|
837
|
+
var _hoisted_1$30 = ["dir"];
|
|
838
|
+
var _hoisted_2$25 = ["disabled"];
|
|
839
|
+
var _hoisted_3$21 = ["data-invalid", "data-readonly"];
|
|
840
|
+
var _hoisted_4$17 = {
|
|
841
|
+
key: 0,
|
|
842
|
+
class: "input__prefix"
|
|
843
|
+
};
|
|
844
|
+
var _hoisted_5$11 = [
|
|
845
|
+
"id",
|
|
846
|
+
"type",
|
|
847
|
+
"name",
|
|
848
|
+
"value",
|
|
849
|
+
"placeholder",
|
|
850
|
+
"disabled",
|
|
851
|
+
"readonly",
|
|
852
|
+
"required",
|
|
853
|
+
"aria-required",
|
|
854
|
+
"aria-invalid",
|
|
855
|
+
"aria-describedby",
|
|
856
|
+
"autocomplete",
|
|
857
|
+
"maxlength",
|
|
858
|
+
"minlength",
|
|
859
|
+
"pattern",
|
|
860
|
+
"inputmode",
|
|
861
|
+
"enterkeyhint",
|
|
862
|
+
"autofocus",
|
|
863
|
+
"spellcheck",
|
|
864
|
+
"form"
|
|
865
|
+
];
|
|
866
|
+
var _hoisted_6$8 = {
|
|
867
|
+
key: 1,
|
|
868
|
+
class: "input__suffix"
|
|
869
|
+
};
|
|
870
|
+
var _hoisted_7$7 = ["id"];
|
|
871
|
+
var _hoisted_8$7 = ["id"];
|
|
872
|
+
//#endregion
|
|
873
|
+
//#region src/Input.vue
|
|
874
|
+
var Input_default = /* @__PURE__ */ defineComponent({
|
|
875
|
+
inheritAttrs: false,
|
|
876
|
+
__name: "Input",
|
|
877
|
+
props: /*@__PURE__*/ mergeModels({
|
|
878
|
+
label: {},
|
|
879
|
+
defaultValue: { default: "" },
|
|
880
|
+
description: { default: void 0 },
|
|
881
|
+
errorMessage: { default: void 0 },
|
|
882
|
+
invalid: {
|
|
883
|
+
type: Boolean,
|
|
884
|
+
default: false
|
|
885
|
+
},
|
|
886
|
+
disabled: {
|
|
887
|
+
type: Boolean,
|
|
888
|
+
default: false
|
|
889
|
+
},
|
|
890
|
+
readonly: {
|
|
891
|
+
type: Boolean,
|
|
892
|
+
default: false
|
|
893
|
+
},
|
|
894
|
+
required: {
|
|
895
|
+
type: Boolean,
|
|
896
|
+
default: false
|
|
897
|
+
},
|
|
898
|
+
placeholder: { default: void 0 },
|
|
899
|
+
type: { default: "text" },
|
|
900
|
+
size: { default: "md" },
|
|
901
|
+
variant: { default: "primary" },
|
|
902
|
+
fullWidth: {
|
|
903
|
+
type: Boolean,
|
|
904
|
+
default: true
|
|
905
|
+
},
|
|
906
|
+
name: { default: void 0 },
|
|
907
|
+
id: { default: void 0 },
|
|
908
|
+
autoComplete: { default: void 0 },
|
|
909
|
+
maxLength: { default: void 0 },
|
|
910
|
+
minLength: { default: void 0 },
|
|
911
|
+
pattern: { default: void 0 },
|
|
912
|
+
inputMode: { default: void 0 },
|
|
913
|
+
enterKeyHint: { default: void 0 },
|
|
914
|
+
autoFocus: { type: Boolean },
|
|
915
|
+
spellCheck: {
|
|
916
|
+
type: Boolean,
|
|
917
|
+
default: void 0
|
|
918
|
+
},
|
|
919
|
+
form: { default: void 0 },
|
|
920
|
+
dir: { default: void 0 }
|
|
921
|
+
}, {
|
|
922
|
+
"modelValue": {},
|
|
923
|
+
"modelModifiers": {}
|
|
924
|
+
}),
|
|
925
|
+
emits: /*@__PURE__*/ mergeModels([
|
|
926
|
+
"focus",
|
|
927
|
+
"blur",
|
|
928
|
+
"keydown",
|
|
929
|
+
"keyup"
|
|
930
|
+
], ["update:modelValue"]),
|
|
931
|
+
setup(__props, { expose: __expose, emit: __emit }) {
|
|
932
|
+
const props = __props;
|
|
933
|
+
const emit = __emit;
|
|
934
|
+
const control = ref();
|
|
935
|
+
function focus() {
|
|
936
|
+
if (!props.disabled) control.value?.focus();
|
|
937
|
+
}
|
|
938
|
+
function select() {
|
|
939
|
+
if (!props.disabled) control.value?.select();
|
|
940
|
+
}
|
|
941
|
+
__expose({
|
|
942
|
+
focus,
|
|
943
|
+
select,
|
|
944
|
+
element: control
|
|
945
|
+
});
|
|
946
|
+
onMounted(() => {
|
|
947
|
+
if (props.autoFocus) focus();
|
|
948
|
+
});
|
|
949
|
+
function pointerdown(event) {
|
|
950
|
+
if (!props.disabled && !event.target.closest("input,button,a,select,textarea,[tabindex],[contenteditable]")) {
|
|
951
|
+
event.preventDefault();
|
|
952
|
+
focus();
|
|
953
|
+
}
|
|
954
|
+
}
|
|
955
|
+
/** Controlled v-model values are strings; clear with an empty string. */
|
|
956
|
+
const model = useModel(__props, "modelValue");
|
|
957
|
+
const local = ref(props.defaultValue ?? "");
|
|
958
|
+
const value = computed(() => model.value ?? local.value);
|
|
959
|
+
const generatedId = useId();
|
|
960
|
+
const controlId = computed(() => props.id ?? generatedId);
|
|
961
|
+
const showError = computed(() => props.invalid && !!props.errorMessage);
|
|
962
|
+
const describedBy = computed(() => [props.description && `${controlId.value}-description`, showError.value && `${controlId.value}-error`].filter(Boolean).join(" ") || void 0);
|
|
963
|
+
function onInput(event) {
|
|
964
|
+
if (props.disabled || props.readonly) return;
|
|
965
|
+
const next = event.target.value;
|
|
966
|
+
local.value = next;
|
|
967
|
+
model.value = next;
|
|
968
|
+
}
|
|
969
|
+
return (_ctx, _cache) => {
|
|
970
|
+
return openBlock(), createElementBlock("div", {
|
|
971
|
+
class: normalizeClass([
|
|
972
|
+
"input",
|
|
973
|
+
`input--${__props.size}`,
|
|
974
|
+
`input--${__props.variant}`,
|
|
975
|
+
!__props.fullWidth && "input--fit"
|
|
976
|
+
]),
|
|
977
|
+
dir: __props.dir
|
|
978
|
+
}, [
|
|
979
|
+
createVNode(unref(Label), {
|
|
980
|
+
class: "input__label",
|
|
981
|
+
for: controlId.value
|
|
982
|
+
}, {
|
|
983
|
+
default: withCtx(() => [createTextVNode(toDisplayString(__props.label), 1)]),
|
|
984
|
+
_: 1
|
|
985
|
+
}, 8, ["for"]),
|
|
986
|
+
createElementVNode("fieldset", {
|
|
987
|
+
class: "input__boundary",
|
|
988
|
+
role: "presentation",
|
|
989
|
+
disabled: __props.disabled
|
|
990
|
+
}, [createElementVNode("div", {
|
|
991
|
+
class: normalizeClass(_ctx.$slots.prefix || _ctx.$slots.suffix ? "input__group" : "input__plain"),
|
|
992
|
+
"data-invalid": __props.invalid || void 0,
|
|
993
|
+
"data-readonly": __props.readonly || void 0,
|
|
994
|
+
onPointerdown: pointerdown
|
|
995
|
+
}, [
|
|
996
|
+
_ctx.$slots.prefix ? (openBlock(), createElementBlock("span", _hoisted_4$17, [renderSlot(_ctx.$slots, "prefix")])) : createCommentVNode("", true),
|
|
997
|
+
createElementVNode("input", {
|
|
998
|
+
id: controlId.value,
|
|
999
|
+
ref_key: "control",
|
|
1000
|
+
ref: control,
|
|
1001
|
+
class: "input__control",
|
|
1002
|
+
type: __props.type,
|
|
1003
|
+
name: __props.name,
|
|
1004
|
+
value: value.value,
|
|
1005
|
+
placeholder: __props.placeholder,
|
|
1006
|
+
disabled: __props.disabled,
|
|
1007
|
+
readonly: __props.readonly,
|
|
1008
|
+
required: __props.required,
|
|
1009
|
+
"aria-required": __props.required || void 0,
|
|
1010
|
+
"aria-invalid": __props.invalid || void 0,
|
|
1011
|
+
"aria-describedby": describedBy.value,
|
|
1012
|
+
autocomplete: __props.autoComplete,
|
|
1013
|
+
maxlength: __props.maxLength,
|
|
1014
|
+
minlength: __props.minLength,
|
|
1015
|
+
pattern: __props.pattern,
|
|
1016
|
+
inputmode: __props.inputMode,
|
|
1017
|
+
enterkeyhint: __props.enterKeyHint,
|
|
1018
|
+
autofocus: __props.autoFocus,
|
|
1019
|
+
spellcheck: __props.spellCheck,
|
|
1020
|
+
form: __props.form,
|
|
1021
|
+
onInput,
|
|
1022
|
+
onFocus: _cache[0] || (_cache[0] = ($event) => emit("focus", $event)),
|
|
1023
|
+
onBlur: _cache[1] || (_cache[1] = ($event) => emit("blur", $event)),
|
|
1024
|
+
onKeydown: _cache[2] || (_cache[2] = ($event) => emit("keydown", $event)),
|
|
1025
|
+
onKeyup: _cache[3] || (_cache[3] = ($event) => emit("keyup", $event))
|
|
1026
|
+
}, null, 40, _hoisted_5$11),
|
|
1027
|
+
_ctx.$slots.suffix ? (openBlock(), createElementBlock("span", _hoisted_6$8, [renderSlot(_ctx.$slots, "suffix")])) : createCommentVNode("", true)
|
|
1028
|
+
], 42, _hoisted_3$21)], 8, _hoisted_2$25),
|
|
1029
|
+
__props.description ? (openBlock(), createElementBlock("span", {
|
|
1030
|
+
key: 0,
|
|
1031
|
+
id: `${controlId.value}-description`,
|
|
1032
|
+
class: "input__description"
|
|
1033
|
+
}, toDisplayString(__props.description), 9, _hoisted_7$7)) : createCommentVNode("", true),
|
|
1034
|
+
showError.value ? (openBlock(), createElementBlock("div", {
|
|
1035
|
+
key: 1,
|
|
1036
|
+
id: `${controlId.value}-error`,
|
|
1037
|
+
class: "input__error"
|
|
1038
|
+
}, toDisplayString(__props.errorMessage), 9, _hoisted_8$7)) : createCommentVNode("", true)
|
|
1039
|
+
], 10, _hoisted_1$30);
|
|
1040
|
+
};
|
|
1041
|
+
}
|
|
1042
|
+
});
|
|
1043
|
+
//#endregion
|
|
1044
|
+
//#region src/Textarea.vue?vue&type=script&setup=true&lang.ts
|
|
1045
|
+
var _hoisted_1$29 = ["data-resize", "dir"];
|
|
1046
|
+
var _hoisted_2$24 = [
|
|
1047
|
+
"id",
|
|
1048
|
+
"rows",
|
|
1049
|
+
"name",
|
|
1050
|
+
"value",
|
|
1051
|
+
"placeholder",
|
|
1052
|
+
"disabled",
|
|
1053
|
+
"readonly",
|
|
1054
|
+
"required",
|
|
1055
|
+
"aria-required",
|
|
1056
|
+
"aria-invalid",
|
|
1057
|
+
"aria-describedby",
|
|
1058
|
+
"autocomplete",
|
|
1059
|
+
"maxlength"
|
|
1060
|
+
];
|
|
1061
|
+
var _hoisted_3$20 = ["id"];
|
|
1062
|
+
var _hoisted_4$16 = ["id"];
|
|
1063
|
+
//#endregion
|
|
1064
|
+
//#region src/Textarea.vue
|
|
1065
|
+
var Textarea_default = /* @__PURE__ */ defineComponent({
|
|
1066
|
+
inheritAttrs: false,
|
|
1067
|
+
__name: "Textarea",
|
|
1068
|
+
props: /*@__PURE__*/ mergeModels({
|
|
1069
|
+
label: {},
|
|
1070
|
+
defaultValue: { default: "" },
|
|
1071
|
+
description: { default: void 0 },
|
|
1072
|
+
errorMessage: { default: void 0 },
|
|
1073
|
+
invalid: {
|
|
1074
|
+
type: Boolean,
|
|
1075
|
+
default: false
|
|
1076
|
+
},
|
|
1077
|
+
disabled: {
|
|
1078
|
+
type: Boolean,
|
|
1079
|
+
default: false
|
|
1080
|
+
},
|
|
1081
|
+
readonly: {
|
|
1082
|
+
type: Boolean,
|
|
1083
|
+
default: false
|
|
1084
|
+
},
|
|
1085
|
+
required: {
|
|
1086
|
+
type: Boolean,
|
|
1087
|
+
default: false
|
|
1088
|
+
},
|
|
1089
|
+
placeholder: { default: void 0 },
|
|
1090
|
+
rows: { default: 3 },
|
|
1091
|
+
resize: { default: "vertical" },
|
|
1092
|
+
name: { default: void 0 },
|
|
1093
|
+
id: { default: void 0 },
|
|
1094
|
+
autoComplete: { default: void 0 },
|
|
1095
|
+
maxLength: { default: void 0 },
|
|
1096
|
+
dir: { default: void 0 }
|
|
1097
|
+
}, {
|
|
1098
|
+
"modelValue": {},
|
|
1099
|
+
"modelModifiers": {}
|
|
1100
|
+
}),
|
|
1101
|
+
emits: ["update:modelValue"],
|
|
1102
|
+
setup(__props) {
|
|
1103
|
+
const props = __props;
|
|
1104
|
+
/** Controlled v-model values are strings; clear with an empty string. */
|
|
1105
|
+
const model = useModel(__props, "modelValue");
|
|
1106
|
+
const local = ref(props.defaultValue ?? "");
|
|
1107
|
+
const value = computed(() => model.value ?? local.value);
|
|
1108
|
+
const generatedId = useId();
|
|
1109
|
+
const controlId = computed(() => props.id ?? generatedId);
|
|
1110
|
+
const showError = computed(() => props.invalid && !!props.errorMessage);
|
|
1111
|
+
const describedBy = computed(() => [props.description && `${controlId.value}-description`, showError.value && `${controlId.value}-error`].filter(Boolean).join(" ") || void 0);
|
|
1112
|
+
function onInput(event) {
|
|
1113
|
+
if (props.disabled || props.readonly) return;
|
|
1114
|
+
const next = event.target.value;
|
|
1115
|
+
local.value = next;
|
|
1116
|
+
model.value = next;
|
|
1117
|
+
}
|
|
1118
|
+
return (_ctx, _cache) => {
|
|
1119
|
+
return openBlock(), createElementBlock("div", {
|
|
1120
|
+
class: "input textarea",
|
|
1121
|
+
"data-resize": __props.resize,
|
|
1122
|
+
dir: __props.dir
|
|
1123
|
+
}, [
|
|
1124
|
+
createVNode(unref(Label), {
|
|
1125
|
+
class: "input__label",
|
|
1126
|
+
for: controlId.value
|
|
1127
|
+
}, {
|
|
1128
|
+
default: withCtx(() => [createTextVNode(toDisplayString(__props.label), 1)]),
|
|
1129
|
+
_: 1
|
|
1130
|
+
}, 8, ["for"]),
|
|
1131
|
+
createElementVNode("textarea", {
|
|
1132
|
+
id: controlId.value,
|
|
1133
|
+
class: "input__control textarea__control",
|
|
1134
|
+
rows: __props.rows,
|
|
1135
|
+
name: __props.name,
|
|
1136
|
+
value: value.value,
|
|
1137
|
+
placeholder: __props.placeholder,
|
|
1138
|
+
disabled: __props.disabled,
|
|
1139
|
+
readonly: __props.readonly,
|
|
1140
|
+
required: __props.required,
|
|
1141
|
+
"aria-required": __props.required || void 0,
|
|
1142
|
+
"aria-invalid": __props.invalid || void 0,
|
|
1143
|
+
"aria-describedby": describedBy.value,
|
|
1144
|
+
autocomplete: __props.autoComplete,
|
|
1145
|
+
maxlength: __props.maxLength,
|
|
1146
|
+
onInput
|
|
1147
|
+
}, null, 40, _hoisted_2$24),
|
|
1148
|
+
__props.description ? (openBlock(), createElementBlock("span", {
|
|
1149
|
+
key: 0,
|
|
1150
|
+
id: `${controlId.value}-description`,
|
|
1151
|
+
class: "input__description"
|
|
1152
|
+
}, toDisplayString(__props.description), 9, _hoisted_3$20)) : createCommentVNode("", true),
|
|
1153
|
+
showError.value ? (openBlock(), createElementBlock("div", {
|
|
1154
|
+
key: 1,
|
|
1155
|
+
id: `${controlId.value}-error`,
|
|
1156
|
+
class: "input__error"
|
|
1157
|
+
}, toDisplayString(__props.errorMessage), 9, _hoisted_4$16)) : createCommentVNode("", true)
|
|
1158
|
+
], 8, _hoisted_1$29);
|
|
1159
|
+
};
|
|
1160
|
+
}
|
|
1161
|
+
});
|
|
1162
|
+
//#endregion
|
|
1163
|
+
//#region src/Label.vue
|
|
1164
|
+
var Label_default = /* @__PURE__ */ defineComponent({
|
|
1165
|
+
inheritAttrs: false,
|
|
1166
|
+
__name: "Label",
|
|
1167
|
+
props: {
|
|
1168
|
+
for: { default: void 0 },
|
|
1169
|
+
id: { default: void 0 }
|
|
1170
|
+
},
|
|
1171
|
+
setup(__props) {
|
|
1172
|
+
const props = __props;
|
|
1173
|
+
return (_ctx, _cache) => {
|
|
1174
|
+
return openBlock(), createBlock(unref(Label), {
|
|
1175
|
+
id: __props.id,
|
|
1176
|
+
class: "label",
|
|
1177
|
+
for: props.for
|
|
1178
|
+
}, {
|
|
1179
|
+
default: withCtx(() => [renderSlot(_ctx.$slots, "default")]),
|
|
1180
|
+
_: 3
|
|
1181
|
+
}, 8, ["id", "for"]);
|
|
1182
|
+
};
|
|
1183
|
+
}
|
|
1184
|
+
});
|
|
1185
|
+
//#endregion
|
|
1186
|
+
//#region src/Checkbox.vue?vue&type=script&setup=true&lang.ts
|
|
1187
|
+
var _hoisted_1$28 = ["dir"];
|
|
1188
|
+
var _hoisted_2$23 = ["data-disabled"];
|
|
1189
|
+
var _hoisted_3$19 = ["name", "value"];
|
|
1190
|
+
//#endregion
|
|
1191
|
+
//#region src/Checkbox.vue
|
|
1192
|
+
var Checkbox_default = /* @__PURE__ */ defineComponent({
|
|
1193
|
+
inheritAttrs: false,
|
|
1194
|
+
__name: "Checkbox",
|
|
1195
|
+
props: {
|
|
1196
|
+
label: {},
|
|
1197
|
+
modelValue: {
|
|
1198
|
+
type: Boolean,
|
|
1199
|
+
default: void 0
|
|
1200
|
+
},
|
|
1201
|
+
defaultValue: {
|
|
1202
|
+
type: Boolean,
|
|
1203
|
+
default: false
|
|
1204
|
+
},
|
|
1205
|
+
indeterminate: {
|
|
1206
|
+
type: Boolean,
|
|
1207
|
+
default: false
|
|
1208
|
+
},
|
|
1209
|
+
disabled: {
|
|
1210
|
+
type: Boolean,
|
|
1211
|
+
default: false
|
|
1212
|
+
},
|
|
1213
|
+
required: {
|
|
1214
|
+
type: Boolean,
|
|
1215
|
+
default: false
|
|
1216
|
+
},
|
|
1217
|
+
invalid: {
|
|
1218
|
+
type: Boolean,
|
|
1219
|
+
default: false
|
|
1220
|
+
},
|
|
1221
|
+
description: { default: void 0 },
|
|
1222
|
+
errorMessage: { default: void 0 },
|
|
1223
|
+
name: { default: void 0 },
|
|
1224
|
+
value: { default: "on" },
|
|
1225
|
+
id: { default: void 0 },
|
|
1226
|
+
dir: { default: void 0 }
|
|
1227
|
+
},
|
|
1228
|
+
emits: ["update:modelValue"],
|
|
1229
|
+
setup(__props, { emit: __emit }) {
|
|
1230
|
+
const props = __props;
|
|
1231
|
+
const emit = __emit;
|
|
1232
|
+
const local = ref(props.defaultValue);
|
|
1233
|
+
const selected = computed(() => props.modelValue ?? local.value);
|
|
1234
|
+
const state = computed(() => props.indeterminate ? "indeterminate" : selected.value);
|
|
1235
|
+
const { controlId, showError, describedBy } = useFeedback(props);
|
|
1236
|
+
function update(value) {
|
|
1237
|
+
if (props.disabled) return;
|
|
1238
|
+
const next = props.indeterminate ? !selected.value : value === true;
|
|
1239
|
+
local.value = next;
|
|
1240
|
+
emit("update:modelValue", next);
|
|
1241
|
+
}
|
|
1242
|
+
return (_ctx, _cache) => {
|
|
1243
|
+
return openBlock(), createElementBlock("div", {
|
|
1244
|
+
class: "input",
|
|
1245
|
+
dir: __props.dir
|
|
1246
|
+
}, [
|
|
1247
|
+
createElementVNode("div", {
|
|
1248
|
+
class: "choice",
|
|
1249
|
+
"data-disabled": __props.disabled || void 0
|
|
1250
|
+
}, [createVNode(unref(CheckboxRoot), {
|
|
1251
|
+
id: unref(controlId),
|
|
1252
|
+
class: "checkbox__control",
|
|
1253
|
+
"model-value": state.value,
|
|
1254
|
+
disabled: __props.disabled,
|
|
1255
|
+
required: __props.required,
|
|
1256
|
+
name: __props.indeterminate ? void 0 : __props.name,
|
|
1257
|
+
value: __props.value,
|
|
1258
|
+
"aria-describedby": unref(describedBy),
|
|
1259
|
+
"aria-invalid": __props.invalid || void 0,
|
|
1260
|
+
"data-invalid": __props.invalid || void 0,
|
|
1261
|
+
"onUpdate:modelValue": update
|
|
1262
|
+
}, {
|
|
1263
|
+
default: withCtx(() => [createVNode(CheckIcon_default, { class: "checkbox__check" }), _cache[0] || (_cache[0] = createElementVNode("span", { class: "checkbox__dash" }, null, -1))]),
|
|
1264
|
+
_: 1
|
|
1265
|
+
}, 8, [
|
|
1266
|
+
"id",
|
|
1267
|
+
"model-value",
|
|
1268
|
+
"disabled",
|
|
1269
|
+
"required",
|
|
1270
|
+
"name",
|
|
1271
|
+
"value",
|
|
1272
|
+
"aria-describedby",
|
|
1273
|
+
"aria-invalid",
|
|
1274
|
+
"data-invalid"
|
|
1275
|
+
]), createVNode(unref(Label), {
|
|
1276
|
+
class: "choice__label",
|
|
1277
|
+
for: unref(controlId)
|
|
1278
|
+
}, {
|
|
1279
|
+
default: withCtx(() => [createTextVNode(toDisplayString(__props.label), 1)]),
|
|
1280
|
+
_: 1
|
|
1281
|
+
}, 8, ["for"])], 8, _hoisted_2$23),
|
|
1282
|
+
__props.indeterminate && selected.value && __props.name && !__props.disabled ? (openBlock(), createElementBlock("input", {
|
|
1283
|
+
key: 0,
|
|
1284
|
+
type: "hidden",
|
|
1285
|
+
name: __props.name,
|
|
1286
|
+
value: __props.value
|
|
1287
|
+
}, null, 8, _hoisted_3$19)) : createCommentVNode("", true),
|
|
1288
|
+
createVNode(FieldFeedback_default, {
|
|
1289
|
+
"control-id": unref(controlId),
|
|
1290
|
+
description: __props.description,
|
|
1291
|
+
"error-message": __props.errorMessage,
|
|
1292
|
+
"show-error": unref(showError)
|
|
1293
|
+
}, null, 8, [
|
|
1294
|
+
"control-id",
|
|
1295
|
+
"description",
|
|
1296
|
+
"error-message",
|
|
1297
|
+
"show-error"
|
|
1298
|
+
])
|
|
1299
|
+
], 8, _hoisted_1$28);
|
|
1300
|
+
};
|
|
1301
|
+
}
|
|
1302
|
+
});
|
|
1303
|
+
//#endregion
|
|
1304
|
+
//#region src/RadioGroup.vue?vue&type=script&setup=true&lang.ts
|
|
1305
|
+
var _hoisted_1$27 = ["id"];
|
|
1306
|
+
var _hoisted_2$22 = ["data-orientation"];
|
|
1307
|
+
var _hoisted_3$18 = ["data-disabled"];
|
|
1308
|
+
//#endregion
|
|
1309
|
+
//#region src/RadioGroup.vue
|
|
1310
|
+
var RadioGroup_default = /* @__PURE__ */ defineComponent({
|
|
1311
|
+
inheritAttrs: false,
|
|
1312
|
+
__name: "RadioGroup",
|
|
1313
|
+
props: /*@__PURE__*/ mergeModels({
|
|
1314
|
+
label: {},
|
|
1315
|
+
options: {},
|
|
1316
|
+
defaultValue: { default: "" },
|
|
1317
|
+
disabled: {
|
|
1318
|
+
type: Boolean,
|
|
1319
|
+
default: false
|
|
1320
|
+
},
|
|
1321
|
+
required: {
|
|
1322
|
+
type: Boolean,
|
|
1323
|
+
default: false
|
|
1324
|
+
},
|
|
1325
|
+
invalid: {
|
|
1326
|
+
type: Boolean,
|
|
1327
|
+
default: false
|
|
1328
|
+
},
|
|
1329
|
+
description: { default: void 0 },
|
|
1330
|
+
errorMessage: { default: void 0 },
|
|
1331
|
+
name: { default: void 0 },
|
|
1332
|
+
id: { default: void 0 },
|
|
1333
|
+
orientation: { default: "vertical" },
|
|
1334
|
+
dir: { default: void 0 }
|
|
1335
|
+
}, {
|
|
1336
|
+
"modelValue": {},
|
|
1337
|
+
"modelModifiers": {}
|
|
1338
|
+
}),
|
|
1339
|
+
emits: ["update:modelValue"],
|
|
1340
|
+
setup(__props) {
|
|
1341
|
+
const props = __props;
|
|
1342
|
+
const model = useModel(__props, "modelValue");
|
|
1343
|
+
const local = ref(props.defaultValue);
|
|
1344
|
+
const value = computed(() => model.value ?? local.value);
|
|
1345
|
+
const { controlId, describedBy, showError } = useFeedback(props);
|
|
1346
|
+
function update(next) {
|
|
1347
|
+
if (props.disabled || typeof next !== "string") return;
|
|
1348
|
+
local.value = next;
|
|
1349
|
+
model.value = next;
|
|
1350
|
+
}
|
|
1351
|
+
return (_ctx, _cache) => {
|
|
1352
|
+
return openBlock(), createBlock(unref(RadioGroupRoot), {
|
|
1353
|
+
id: unref(controlId),
|
|
1354
|
+
class: "input radio-group",
|
|
1355
|
+
"model-value": value.value,
|
|
1356
|
+
disabled: __props.disabled,
|
|
1357
|
+
required: __props.required,
|
|
1358
|
+
name: __props.name,
|
|
1359
|
+
orientation: __props.orientation,
|
|
1360
|
+
dir: __props.dir,
|
|
1361
|
+
"aria-labelledby": `${unref(controlId)}-label`,
|
|
1362
|
+
"aria-describedby": unref(describedBy),
|
|
1363
|
+
"aria-invalid": __props.invalid || void 0,
|
|
1364
|
+
"onUpdate:modelValue": update
|
|
1365
|
+
}, {
|
|
1366
|
+
default: withCtx(() => [
|
|
1367
|
+
createElementVNode("span", {
|
|
1368
|
+
id: `${unref(controlId)}-label`,
|
|
1369
|
+
class: "label"
|
|
1370
|
+
}, toDisplayString(__props.label), 9, _hoisted_1$27),
|
|
1371
|
+
createElementVNode("div", {
|
|
1372
|
+
class: "radio-group__items",
|
|
1373
|
+
"data-orientation": __props.orientation
|
|
1374
|
+
}, [(openBlock(true), createElementBlock(Fragment, null, renderList(__props.options, (option, index) => {
|
|
1375
|
+
return openBlock(), createElementBlock("div", {
|
|
1376
|
+
key: option.id,
|
|
1377
|
+
class: "choice",
|
|
1378
|
+
"data-disabled": __props.disabled || option.isDisabled || void 0
|
|
1379
|
+
}, [createVNode(unref(RadioGroupItem), {
|
|
1380
|
+
id: `${unref(controlId)}-option-${index}`,
|
|
1381
|
+
class: "radio__control",
|
|
1382
|
+
value: option.id,
|
|
1383
|
+
disabled: option.isDisabled,
|
|
1384
|
+
"data-invalid": __props.invalid || void 0
|
|
1385
|
+
}, {
|
|
1386
|
+
default: withCtx(() => [..._cache[0] || (_cache[0] = [createElementVNode("span", { class: "radio__dot" }, null, -1)])]),
|
|
1387
|
+
_: 1
|
|
1388
|
+
}, 8, [
|
|
1389
|
+
"id",
|
|
1390
|
+
"value",
|
|
1391
|
+
"disabled",
|
|
1392
|
+
"data-invalid"
|
|
1393
|
+
]), createVNode(unref(Label), {
|
|
1394
|
+
class: "choice__label",
|
|
1395
|
+
for: `${unref(controlId)}-option-${index}`
|
|
1396
|
+
}, {
|
|
1397
|
+
default: withCtx(() => [createTextVNode(toDisplayString(option.label), 1)]),
|
|
1398
|
+
_: 2
|
|
1399
|
+
}, 1032, ["for"])], 8, _hoisted_3$18);
|
|
1400
|
+
}), 128))], 8, _hoisted_2$22),
|
|
1401
|
+
createVNode(FieldFeedback_default, {
|
|
1402
|
+
"control-id": unref(controlId),
|
|
1403
|
+
description: __props.description,
|
|
1404
|
+
"error-message": __props.errorMessage,
|
|
1405
|
+
"show-error": unref(showError)
|
|
1406
|
+
}, null, 8, [
|
|
1407
|
+
"control-id",
|
|
1408
|
+
"description",
|
|
1409
|
+
"error-message",
|
|
1410
|
+
"show-error"
|
|
1411
|
+
])
|
|
1412
|
+
]),
|
|
1413
|
+
_: 1
|
|
1414
|
+
}, 8, [
|
|
1415
|
+
"id",
|
|
1416
|
+
"model-value",
|
|
1417
|
+
"disabled",
|
|
1418
|
+
"required",
|
|
1419
|
+
"name",
|
|
1420
|
+
"orientation",
|
|
1421
|
+
"dir",
|
|
1422
|
+
"aria-labelledby",
|
|
1423
|
+
"aria-describedby",
|
|
1424
|
+
"aria-invalid"
|
|
1425
|
+
]);
|
|
1426
|
+
};
|
|
1427
|
+
}
|
|
1428
|
+
});
|
|
1429
|
+
//#endregion
|
|
1430
|
+
//#region src/Switch.vue?vue&type=script&setup=true&lang.ts
|
|
1431
|
+
var _hoisted_1$26 = ["dir"];
|
|
1432
|
+
var _hoisted_2$21 = ["data-disabled"];
|
|
1433
|
+
//#endregion
|
|
1434
|
+
//#region src/Switch.vue
|
|
1435
|
+
var Switch_default = /* @__PURE__ */ defineComponent({
|
|
1436
|
+
inheritAttrs: false,
|
|
1437
|
+
__name: "Switch",
|
|
1438
|
+
props: {
|
|
1439
|
+
label: {},
|
|
1440
|
+
modelValue: {
|
|
1441
|
+
type: Boolean,
|
|
1442
|
+
default: void 0
|
|
1443
|
+
},
|
|
1444
|
+
defaultValue: {
|
|
1445
|
+
type: Boolean,
|
|
1446
|
+
default: false
|
|
1447
|
+
},
|
|
1448
|
+
disabled: {
|
|
1449
|
+
type: Boolean,
|
|
1450
|
+
default: false
|
|
1451
|
+
},
|
|
1452
|
+
invalid: {
|
|
1453
|
+
type: Boolean,
|
|
1454
|
+
default: false
|
|
1455
|
+
},
|
|
1456
|
+
description: { default: void 0 },
|
|
1457
|
+
errorMessage: { default: void 0 },
|
|
1458
|
+
name: { default: void 0 },
|
|
1459
|
+
value: { default: "on" },
|
|
1460
|
+
id: { default: void 0 },
|
|
1461
|
+
dir: { default: void 0 }
|
|
1462
|
+
},
|
|
1463
|
+
emits: ["update:modelValue"],
|
|
1464
|
+
setup(__props, { emit: __emit }) {
|
|
1465
|
+
const props = __props;
|
|
1466
|
+
const emit = __emit;
|
|
1467
|
+
const local = ref(props.defaultValue);
|
|
1468
|
+
const selected = computed(() => props.modelValue ?? local.value);
|
|
1469
|
+
const state = computed(() => selected.value);
|
|
1470
|
+
const { controlId, showError, describedBy } = useFeedback(props);
|
|
1471
|
+
function update(value) {
|
|
1472
|
+
if (props.disabled) return;
|
|
1473
|
+
const next = value;
|
|
1474
|
+
local.value = next;
|
|
1475
|
+
emit("update:modelValue", next);
|
|
1476
|
+
}
|
|
1477
|
+
return (_ctx, _cache) => {
|
|
1478
|
+
return openBlock(), createElementBlock("div", {
|
|
1479
|
+
class: "input",
|
|
1480
|
+
dir: __props.dir
|
|
1481
|
+
}, [createElementVNode("div", {
|
|
1482
|
+
class: "choice",
|
|
1483
|
+
"data-disabled": __props.disabled || void 0
|
|
1484
|
+
}, [createVNode(unref(SwitchRoot), {
|
|
1485
|
+
id: unref(controlId),
|
|
1486
|
+
class: "switch__control",
|
|
1487
|
+
"model-value": state.value,
|
|
1488
|
+
disabled: __props.disabled,
|
|
1489
|
+
name: __props.name,
|
|
1490
|
+
value: __props.value,
|
|
1491
|
+
"aria-describedby": unref(describedBy),
|
|
1492
|
+
"aria-invalid": __props.invalid || void 0,
|
|
1493
|
+
"data-invalid": __props.invalid || void 0,
|
|
1494
|
+
"onUpdate:modelValue": update
|
|
1495
|
+
}, {
|
|
1496
|
+
default: withCtx(() => [..._cache[0] || (_cache[0] = [createElementVNode("span", { class: "switch__thumb" }, null, -1)])]),
|
|
1497
|
+
_: 1
|
|
1498
|
+
}, 8, [
|
|
1499
|
+
"id",
|
|
1500
|
+
"model-value",
|
|
1501
|
+
"disabled",
|
|
1502
|
+
"name",
|
|
1503
|
+
"value",
|
|
1504
|
+
"aria-describedby",
|
|
1505
|
+
"aria-invalid",
|
|
1506
|
+
"data-invalid"
|
|
1507
|
+
]), createVNode(unref(Label), {
|
|
1508
|
+
class: "choice__label",
|
|
1509
|
+
for: unref(controlId)
|
|
1510
|
+
}, {
|
|
1511
|
+
default: withCtx(() => [createTextVNode(toDisplayString(__props.label), 1)]),
|
|
1512
|
+
_: 1
|
|
1513
|
+
}, 8, ["for"])], 8, _hoisted_2$21), createVNode(FieldFeedback_default, {
|
|
1514
|
+
"control-id": unref(controlId),
|
|
1515
|
+
description: __props.description,
|
|
1516
|
+
"error-message": __props.errorMessage,
|
|
1517
|
+
"show-error": unref(showError)
|
|
1518
|
+
}, null, 8, [
|
|
1519
|
+
"control-id",
|
|
1520
|
+
"description",
|
|
1521
|
+
"error-message",
|
|
1522
|
+
"show-error"
|
|
1523
|
+
])], 8, _hoisted_1$26);
|
|
1524
|
+
};
|
|
1525
|
+
}
|
|
1526
|
+
});
|
|
1527
|
+
//#endregion
|
|
1528
|
+
//#region src/form-context.ts
|
|
1529
|
+
var formErrorsKey = /* @__PURE__ */ Symbol("KazeeFormErrors");
|
|
1530
|
+
//#endregion
|
|
1531
|
+
//#region src/Field.vue?vue&type=script&setup=true&lang.ts
|
|
1532
|
+
var _hoisted_1$25 = ["dir"];
|
|
1533
|
+
//#endregion
|
|
1534
|
+
//#region src/Field.vue
|
|
1535
|
+
var Field_default = /* @__PURE__ */ defineComponent({
|
|
1536
|
+
inheritAttrs: false,
|
|
1537
|
+
__name: "Field",
|
|
1538
|
+
props: {
|
|
1539
|
+
label: {},
|
|
1540
|
+
name: {},
|
|
1541
|
+
id: { default: void 0 },
|
|
1542
|
+
description: { default: void 0 },
|
|
1543
|
+
errorMessage: { default: void 0 },
|
|
1544
|
+
invalid: {
|
|
1545
|
+
type: Boolean,
|
|
1546
|
+
default: false
|
|
1547
|
+
},
|
|
1548
|
+
disabled: {
|
|
1549
|
+
type: Boolean,
|
|
1550
|
+
default: false
|
|
1551
|
+
},
|
|
1552
|
+
readonly: {
|
|
1553
|
+
type: Boolean,
|
|
1554
|
+
default: false
|
|
1555
|
+
},
|
|
1556
|
+
required: {
|
|
1557
|
+
type: Boolean,
|
|
1558
|
+
default: false
|
|
1559
|
+
},
|
|
1560
|
+
dir: { default: void 0 }
|
|
1561
|
+
},
|
|
1562
|
+
setup(__props) {
|
|
1563
|
+
const props = __props;
|
|
1564
|
+
const errors = inject(formErrorsKey, computed(() => ({})));
|
|
1565
|
+
const error = computed(() => {
|
|
1566
|
+
const map = errors.value;
|
|
1567
|
+
return Object.hasOwn(map, props.name) && typeof map[props.name] === "string" ? map[props.name] || void 0 : void 0;
|
|
1568
|
+
});
|
|
1569
|
+
const invalidState = computed(() => props.invalid || !!error.value);
|
|
1570
|
+
const message = computed(() => props.invalid && props.errorMessage || error.value || void 0);
|
|
1571
|
+
const { controlId, showError, describedBy } = useFeedback({
|
|
1572
|
+
get id() {
|
|
1573
|
+
return props.id;
|
|
1574
|
+
},
|
|
1575
|
+
get description() {
|
|
1576
|
+
return props.description;
|
|
1577
|
+
},
|
|
1578
|
+
get invalid() {
|
|
1579
|
+
return invalidState.value;
|
|
1580
|
+
},
|
|
1581
|
+
get errorMessage() {
|
|
1582
|
+
return message.value;
|
|
1583
|
+
}
|
|
1584
|
+
});
|
|
1585
|
+
const controlProps = computed(() => ({
|
|
1586
|
+
id: controlId.value,
|
|
1587
|
+
name: props.name,
|
|
1588
|
+
class: "input__control field__control",
|
|
1589
|
+
disabled: props.disabled,
|
|
1590
|
+
readonly: props.readonly,
|
|
1591
|
+
required: props.required,
|
|
1592
|
+
"aria-required": props.required || void 0,
|
|
1593
|
+
"aria-invalid": invalidState.value || void 0,
|
|
1594
|
+
"aria-describedby": describedBy.value
|
|
1595
|
+
}));
|
|
1596
|
+
return (_ctx, _cache) => {
|
|
1597
|
+
return openBlock(), createElementBlock("div", {
|
|
1598
|
+
class: "input field",
|
|
1599
|
+
dir: __props.dir
|
|
1600
|
+
}, [
|
|
1601
|
+
createVNode(unref(Label), {
|
|
1602
|
+
class: "label",
|
|
1603
|
+
for: unref(controlId)
|
|
1604
|
+
}, {
|
|
1605
|
+
default: withCtx(() => [createTextVNode(toDisplayString(__props.label), 1)]),
|
|
1606
|
+
_: 1
|
|
1607
|
+
}, 8, ["for"]),
|
|
1608
|
+
renderSlot(_ctx.$slots, "default", {
|
|
1609
|
+
controlProps: controlProps.value,
|
|
1610
|
+
invalid: invalidState.value,
|
|
1611
|
+
errorMessage: message.value
|
|
1612
|
+
}),
|
|
1613
|
+
createVNode(FieldFeedback_default, {
|
|
1614
|
+
"control-id": unref(controlId),
|
|
1615
|
+
description: __props.description,
|
|
1616
|
+
"error-message": message.value,
|
|
1617
|
+
"show-error": unref(showError)
|
|
1618
|
+
}, null, 8, [
|
|
1619
|
+
"control-id",
|
|
1620
|
+
"description",
|
|
1621
|
+
"error-message",
|
|
1622
|
+
"show-error"
|
|
1623
|
+
])
|
|
1624
|
+
], 8, _hoisted_1$25);
|
|
1625
|
+
};
|
|
1626
|
+
}
|
|
1627
|
+
});
|
|
1628
|
+
//#endregion
|
|
1629
|
+
//#region src/Form.vue?vue&type=script&setup=true&lang.ts
|
|
1630
|
+
var _hoisted_1$24 = [
|
|
1631
|
+
"id",
|
|
1632
|
+
"dir",
|
|
1633
|
+
"aria-label",
|
|
1634
|
+
"aria-labelledby",
|
|
1635
|
+
"novalidate"
|
|
1636
|
+
];
|
|
1637
|
+
//#endregion
|
|
1638
|
+
//#region src/Form.vue
|
|
1639
|
+
var Form_default = /* @__PURE__ */ defineComponent({
|
|
1640
|
+
inheritAttrs: false,
|
|
1641
|
+
__name: "Form",
|
|
1642
|
+
props: {
|
|
1643
|
+
validationErrors: { default: () => ({}) },
|
|
1644
|
+
noValidate: {
|
|
1645
|
+
type: Boolean,
|
|
1646
|
+
default: false
|
|
1647
|
+
},
|
|
1648
|
+
id: { default: void 0 },
|
|
1649
|
+
ariaLabel: { default: void 0 },
|
|
1650
|
+
ariaLabelledby: { default: void 0 },
|
|
1651
|
+
dir: { default: void 0 }
|
|
1652
|
+
},
|
|
1653
|
+
emits: ["submit", "reset"],
|
|
1654
|
+
setup(__props, { emit: __emit }) {
|
|
1655
|
+
const props = __props;
|
|
1656
|
+
const emit = __emit;
|
|
1657
|
+
provide(formErrorsKey, computed(() => props.validationErrors));
|
|
1658
|
+
function submit(event) {
|
|
1659
|
+
event.preventDefault();
|
|
1660
|
+
const form = event.currentTarget;
|
|
1661
|
+
if (!props.noValidate && !form.checkValidity()) {
|
|
1662
|
+
form.reportValidity();
|
|
1663
|
+
return;
|
|
1664
|
+
}
|
|
1665
|
+
for (const element of form.querySelectorAll("[aria-invalid=\"true\"]")) {
|
|
1666
|
+
const selector = "input:not([type=\"hidden\"]), textarea, select, button, [role=\"listbox\"]";
|
|
1667
|
+
const invalid = (element.matches(selector) ? [element] : [...element.querySelectorAll(selector)]).find((control) => !control.matches(":disabled, [aria-disabled=\"true\"]"));
|
|
1668
|
+
if (invalid) {
|
|
1669
|
+
invalid.focus();
|
|
1670
|
+
return;
|
|
1671
|
+
}
|
|
1672
|
+
}
|
|
1673
|
+
emit("submit", new FormData(form, event.submitter), event);
|
|
1674
|
+
}
|
|
1675
|
+
return (_ctx, _cache) => {
|
|
1676
|
+
return openBlock(), createElementBlock("form", {
|
|
1677
|
+
id: __props.id,
|
|
1678
|
+
class: "form",
|
|
1679
|
+
dir: __props.dir,
|
|
1680
|
+
"aria-label": __props.ariaLabel,
|
|
1681
|
+
"aria-labelledby": __props.ariaLabelledby,
|
|
1682
|
+
novalidate: __props.noValidate,
|
|
1683
|
+
onSubmit: submit,
|
|
1684
|
+
onReset: _cache[0] || (_cache[0] = ($event) => emit("reset", $event))
|
|
1685
|
+
}, [renderSlot(_ctx.$slots, "default")], 40, _hoisted_1$24);
|
|
1686
|
+
};
|
|
1687
|
+
}
|
|
1688
|
+
});
|
|
1689
|
+
//#endregion
|
|
1690
|
+
//#region src/listbox-selection.ts
|
|
1691
|
+
/** Stable option order, unique enabled IDs, and at most one ID in single mode. */
|
|
1692
|
+
function listboxSelection(value, options, mode) {
|
|
1693
|
+
const requested = new Set(value);
|
|
1694
|
+
const seen = /* @__PURE__ */ new Set();
|
|
1695
|
+
const result = [];
|
|
1696
|
+
for (const option of options) if (option.id && !option.isDisabled && requested.has(option.id) && !seen.has(option.id)) {
|
|
1697
|
+
seen.add(option.id);
|
|
1698
|
+
result.push(option.id);
|
|
1699
|
+
if (mode === "single") break;
|
|
1700
|
+
}
|
|
1701
|
+
return result;
|
|
1702
|
+
}
|
|
1703
|
+
//#endregion
|
|
1704
|
+
//#region src/Listbox.vue?vue&type=script&setup=true&lang.ts
|
|
1705
|
+
var _hoisted_1$23 = ["dir"];
|
|
1706
|
+
var _hoisted_2$20 = ["id"];
|
|
1707
|
+
var _hoisted_3$17 = { class: "listbox__text" };
|
|
1708
|
+
var _hoisted_4$15 = {
|
|
1709
|
+
key: 0,
|
|
1710
|
+
class: "listbox__empty",
|
|
1711
|
+
role: "option",
|
|
1712
|
+
"aria-disabled": "true",
|
|
1713
|
+
"aria-selected": "false"
|
|
1714
|
+
};
|
|
1715
|
+
var _hoisted_5$10 = [
|
|
1716
|
+
"name",
|
|
1717
|
+
"value",
|
|
1718
|
+
"disabled"
|
|
1719
|
+
];
|
|
1720
|
+
//#endregion
|
|
1721
|
+
//#region src/Listbox.vue
|
|
1722
|
+
var Listbox_default = /* @__PURE__ */ defineComponent({
|
|
1723
|
+
inheritAttrs: false,
|
|
1724
|
+
__name: "Listbox",
|
|
1725
|
+
props: {
|
|
1726
|
+
label: {},
|
|
1727
|
+
options: {},
|
|
1728
|
+
modelValue: { default: void 0 },
|
|
1729
|
+
defaultValue: { default: () => [] },
|
|
1730
|
+
selectionMode: { default: "single" },
|
|
1731
|
+
disabled: {
|
|
1732
|
+
type: Boolean,
|
|
1733
|
+
default: false
|
|
1734
|
+
},
|
|
1735
|
+
description: { default: void 0 },
|
|
1736
|
+
errorMessage: { default: void 0 },
|
|
1737
|
+
invalid: {
|
|
1738
|
+
type: Boolean,
|
|
1739
|
+
default: false
|
|
1740
|
+
},
|
|
1741
|
+
name: { default: void 0 },
|
|
1742
|
+
id: { default: void 0 },
|
|
1743
|
+
dir: { default: void 0 },
|
|
1744
|
+
emptyMessage: { default: "Tidak ada pilihan." }
|
|
1745
|
+
},
|
|
1746
|
+
emits: ["update:modelValue"],
|
|
1747
|
+
setup(__props, { emit: __emit }) {
|
|
1748
|
+
const props = __props;
|
|
1749
|
+
const emit = __emit;
|
|
1750
|
+
const local = ref(props.defaultValue);
|
|
1751
|
+
const selected = computed(() => listboxSelection(props.modelValue ?? local.value, props.options, props.selectionMode));
|
|
1752
|
+
const model = computed(() => props.selectionMode === "multiple" ? selected.value : selected.value[0] ?? null);
|
|
1753
|
+
const generated = useId();
|
|
1754
|
+
const labelId = computed(() => `${props.id ?? generated}-label`);
|
|
1755
|
+
const { controlId, showError, describedBy } = useFeedback(props);
|
|
1756
|
+
function update(value) {
|
|
1757
|
+
if (props.disabled) return;
|
|
1758
|
+
const next = listboxSelection(Array.isArray(value) ? value.filter((id) => typeof id === "string") : typeof value === "string" ? [value] : [], props.options, props.selectionMode);
|
|
1759
|
+
if (next.length === selected.value.length && next.every((key, index) => key === selected.value[index])) return;
|
|
1760
|
+
local.value = next;
|
|
1761
|
+
emit("update:modelValue", next);
|
|
1762
|
+
}
|
|
1763
|
+
return (_ctx, _cache) => {
|
|
1764
|
+
return openBlock(), createElementBlock("div", {
|
|
1765
|
+
class: "input listbox",
|
|
1766
|
+
dir: __props.dir
|
|
1767
|
+
}, [
|
|
1768
|
+
createElementVNode("span", {
|
|
1769
|
+
id: labelId.value,
|
|
1770
|
+
class: "label"
|
|
1771
|
+
}, toDisplayString(__props.label), 9, _hoisted_2$20),
|
|
1772
|
+
createVNode(unref(ListboxRoot), {
|
|
1773
|
+
"model-value": model.value,
|
|
1774
|
+
multiple: __props.selectionMode === "multiple",
|
|
1775
|
+
disabled: __props.disabled,
|
|
1776
|
+
dir: __props.dir,
|
|
1777
|
+
"selection-behavior": __props.selectionMode === "single" ? "replace" : "toggle",
|
|
1778
|
+
"highlight-on-hover": "",
|
|
1779
|
+
"onUpdate:modelValue": update
|
|
1780
|
+
}, {
|
|
1781
|
+
default: withCtx(() => [createVNode(unref(ListboxContent), {
|
|
1782
|
+
id: __props.id,
|
|
1783
|
+
class: "listbox__list",
|
|
1784
|
+
"aria-labelledby": labelId.value,
|
|
1785
|
+
"aria-describedby": unref(describedBy),
|
|
1786
|
+
"aria-invalid": __props.invalid || void 0,
|
|
1787
|
+
"aria-disabled": __props.disabled || void 0,
|
|
1788
|
+
tabindex: __props.disabled ? -1 : void 0
|
|
1789
|
+
}, {
|
|
1790
|
+
default: withCtx(() => [(openBlock(true), createElementBlock(Fragment, null, renderList(__props.options, (option) => {
|
|
1791
|
+
return openBlock(), createBlock(unref(ListboxItem), {
|
|
1792
|
+
key: option.id,
|
|
1793
|
+
value: option.id,
|
|
1794
|
+
disabled: __props.disabled || option.isDisabled,
|
|
1795
|
+
"aria-disabled": __props.disabled || option.isDisabled || void 0,
|
|
1796
|
+
class: "listbox__item"
|
|
1797
|
+
}, {
|
|
1798
|
+
default: withCtx(() => [createElementVNode("span", _hoisted_3$17, toDisplayString(option.label), 1), createVNode(CheckIcon_default, { class: "listbox__check" })]),
|
|
1799
|
+
_: 2
|
|
1800
|
+
}, 1032, [
|
|
1801
|
+
"value",
|
|
1802
|
+
"disabled",
|
|
1803
|
+
"aria-disabled"
|
|
1804
|
+
]);
|
|
1805
|
+
}), 128)), !__props.options.length ? (openBlock(), createElementBlock("span", _hoisted_4$15, toDisplayString(__props.emptyMessage), 1)) : createCommentVNode("", true)]),
|
|
1806
|
+
_: 1
|
|
1807
|
+
}, 8, [
|
|
1808
|
+
"id",
|
|
1809
|
+
"aria-labelledby",
|
|
1810
|
+
"aria-describedby",
|
|
1811
|
+
"aria-invalid",
|
|
1812
|
+
"aria-disabled",
|
|
1813
|
+
"tabindex"
|
|
1814
|
+
])]),
|
|
1815
|
+
_: 1
|
|
1816
|
+
}, 8, [
|
|
1817
|
+
"model-value",
|
|
1818
|
+
"multiple",
|
|
1819
|
+
"disabled",
|
|
1820
|
+
"dir",
|
|
1821
|
+
"selection-behavior"
|
|
1822
|
+
]),
|
|
1823
|
+
createVNode(FieldFeedback_default, {
|
|
1824
|
+
"control-id": unref(controlId),
|
|
1825
|
+
description: __props.description,
|
|
1826
|
+
"error-message": __props.errorMessage,
|
|
1827
|
+
"show-error": unref(showError)
|
|
1828
|
+
}, null, 8, [
|
|
1829
|
+
"control-id",
|
|
1830
|
+
"description",
|
|
1831
|
+
"error-message",
|
|
1832
|
+
"show-error"
|
|
1833
|
+
]),
|
|
1834
|
+
__props.name ? (openBlock(true), createElementBlock(Fragment, { key: 0 }, renderList(selected.value, (key) => {
|
|
1835
|
+
return openBlock(), createElementBlock("input", {
|
|
1836
|
+
key,
|
|
1837
|
+
type: "hidden",
|
|
1838
|
+
name: __props.name,
|
|
1839
|
+
value: key,
|
|
1840
|
+
disabled: __props.disabled
|
|
1841
|
+
}, null, 8, _hoisted_5$10);
|
|
1842
|
+
}), 128)) : createCommentVNode("", true)
|
|
1843
|
+
], 8, _hoisted_1$23);
|
|
1844
|
+
};
|
|
1845
|
+
}
|
|
1846
|
+
});
|
|
1847
|
+
//#endregion
|
|
1848
|
+
//#region src/NumberField.vue?vue&type=script&setup=true&lang.ts
|
|
1849
|
+
var _hoisted_1$22 = ["dir"];
|
|
1850
|
+
var _hoisted_2$19 = { class: "number-field__group" };
|
|
1851
|
+
var _hoisted_3$16 = [
|
|
1852
|
+
"name",
|
|
1853
|
+
"value",
|
|
1854
|
+
"disabled"
|
|
1855
|
+
];
|
|
1856
|
+
//#endregion
|
|
1857
|
+
//#region src/NumberField.vue
|
|
1858
|
+
var NumberField_default = /* @__PURE__ */ defineComponent({
|
|
1859
|
+
inheritAttrs: false,
|
|
1860
|
+
__name: "NumberField",
|
|
1861
|
+
props: {
|
|
1862
|
+
label: {},
|
|
1863
|
+
modelValue: { default: void 0 },
|
|
1864
|
+
defaultValue: { default: null },
|
|
1865
|
+
min: { default: void 0 },
|
|
1866
|
+
max: { default: void 0 },
|
|
1867
|
+
step: { default: 1 },
|
|
1868
|
+
locale: { default: "id-ID" },
|
|
1869
|
+
formatOptions: { default: void 0 },
|
|
1870
|
+
description: { default: void 0 },
|
|
1871
|
+
errorMessage: { default: void 0 },
|
|
1872
|
+
invalid: {
|
|
1873
|
+
type: Boolean,
|
|
1874
|
+
default: false
|
|
1875
|
+
},
|
|
1876
|
+
disabled: {
|
|
1877
|
+
type: Boolean,
|
|
1878
|
+
default: false
|
|
1879
|
+
},
|
|
1880
|
+
readonly: {
|
|
1881
|
+
type: Boolean,
|
|
1882
|
+
default: false
|
|
1883
|
+
},
|
|
1884
|
+
required: {
|
|
1885
|
+
type: Boolean,
|
|
1886
|
+
default: false
|
|
1887
|
+
},
|
|
1888
|
+
name: { default: void 0 },
|
|
1889
|
+
id: { default: void 0 },
|
|
1890
|
+
dir: { default: void 0 },
|
|
1891
|
+
incrementLabel: { default: void 0 },
|
|
1892
|
+
decrementLabel: { default: void 0 }
|
|
1893
|
+
},
|
|
1894
|
+
emits: ["update:modelValue"],
|
|
1895
|
+
setup(__props, { emit: __emit }) {
|
|
1896
|
+
const props = __props;
|
|
1897
|
+
const emit = __emit;
|
|
1898
|
+
function finite(value) {
|
|
1899
|
+
return typeof value === "number" && Number.isFinite(value) ? value : null;
|
|
1900
|
+
}
|
|
1901
|
+
const local = ref(finite(props.defaultValue));
|
|
1902
|
+
const selected = computed(() => finite(props.modelValue === void 0 ? local.value : props.modelValue));
|
|
1903
|
+
const { controlId, showError, describedBy } = useFeedback(props);
|
|
1904
|
+
function update(value) {
|
|
1905
|
+
if (props.disabled || props.readonly) return;
|
|
1906
|
+
const next = finite(value);
|
|
1907
|
+
local.value = next;
|
|
1908
|
+
emit("update:modelValue", next);
|
|
1909
|
+
}
|
|
1910
|
+
return (_ctx, _cache) => {
|
|
1911
|
+
return openBlock(), createElementBlock("div", {
|
|
1912
|
+
class: "input number-field",
|
|
1913
|
+
dir: __props.dir
|
|
1914
|
+
}, [
|
|
1915
|
+
createVNode(unref(Label), {
|
|
1916
|
+
class: "label",
|
|
1917
|
+
for: unref(controlId)
|
|
1918
|
+
}, {
|
|
1919
|
+
default: withCtx(() => [createTextVNode(toDisplayString(__props.label), 1)]),
|
|
1920
|
+
_: 1
|
|
1921
|
+
}, 8, ["for"]),
|
|
1922
|
+
createVNode(unref(NumberFieldRoot), {
|
|
1923
|
+
id: unref(controlId),
|
|
1924
|
+
"model-value": selected.value,
|
|
1925
|
+
min: __props.min,
|
|
1926
|
+
max: __props.max,
|
|
1927
|
+
step: __props.step,
|
|
1928
|
+
locale: __props.locale,
|
|
1929
|
+
"format-options": __props.formatOptions,
|
|
1930
|
+
disabled: __props.disabled,
|
|
1931
|
+
readonly: __props.readonly,
|
|
1932
|
+
required: __props.required,
|
|
1933
|
+
"disable-wheel-change": "",
|
|
1934
|
+
"onUpdate:modelValue": update
|
|
1935
|
+
}, {
|
|
1936
|
+
default: withCtx(() => [createElementVNode("div", _hoisted_2$19, [
|
|
1937
|
+
createVNode(unref(NumberFieldDecrement), {
|
|
1938
|
+
class: "number-field__step",
|
|
1939
|
+
"aria-label": __props.decrementLabel ?? `Kurangi ${__props.label}`
|
|
1940
|
+
}, {
|
|
1941
|
+
default: withCtx(() => [..._cache[0] || (_cache[0] = [createTextVNode("−", -1)])]),
|
|
1942
|
+
_: 1
|
|
1943
|
+
}, 8, ["aria-label"]),
|
|
1944
|
+
createVNode(unref(NumberFieldInput), {
|
|
1945
|
+
class: "number-field__control",
|
|
1946
|
+
required: __props.required,
|
|
1947
|
+
"aria-required": __props.required || void 0,
|
|
1948
|
+
"aria-invalid": __props.invalid || void 0,
|
|
1949
|
+
"aria-describedby": unref(describedBy)
|
|
1950
|
+
}, null, 8, [
|
|
1951
|
+
"required",
|
|
1952
|
+
"aria-required",
|
|
1953
|
+
"aria-invalid",
|
|
1954
|
+
"aria-describedby"
|
|
1955
|
+
]),
|
|
1956
|
+
createVNode(unref(NumberFieldIncrement), {
|
|
1957
|
+
class: "number-field__step",
|
|
1958
|
+
"aria-label": __props.incrementLabel ?? `Tambah ${__props.label}`
|
|
1959
|
+
}, {
|
|
1960
|
+
default: withCtx(() => [..._cache[1] || (_cache[1] = [createTextVNode("+", -1)])]),
|
|
1961
|
+
_: 1
|
|
1962
|
+
}, 8, ["aria-label"])
|
|
1963
|
+
])]),
|
|
1964
|
+
_: 1
|
|
1965
|
+
}, 8, [
|
|
1966
|
+
"id",
|
|
1967
|
+
"model-value",
|
|
1968
|
+
"min",
|
|
1969
|
+
"max",
|
|
1970
|
+
"step",
|
|
1971
|
+
"locale",
|
|
1972
|
+
"format-options",
|
|
1973
|
+
"disabled",
|
|
1974
|
+
"readonly",
|
|
1975
|
+
"required"
|
|
1976
|
+
]),
|
|
1977
|
+
createVNode(FieldFeedback_default, {
|
|
1978
|
+
"control-id": unref(controlId),
|
|
1979
|
+
description: __props.description,
|
|
1980
|
+
"error-message": __props.errorMessage,
|
|
1981
|
+
"show-error": unref(showError)
|
|
1982
|
+
}, null, 8, [
|
|
1983
|
+
"control-id",
|
|
1984
|
+
"description",
|
|
1985
|
+
"error-message",
|
|
1986
|
+
"show-error"
|
|
1987
|
+
]),
|
|
1988
|
+
__props.name ? (openBlock(), createElementBlock("input", {
|
|
1989
|
+
key: 0,
|
|
1990
|
+
type: "hidden",
|
|
1991
|
+
name: __props.name,
|
|
1992
|
+
value: selected.value === null ? "" : String(selected.value),
|
|
1993
|
+
disabled: __props.disabled
|
|
1994
|
+
}, null, 8, _hoisted_3$16)) : createCommentVNode("", true)
|
|
1995
|
+
], 8, _hoisted_1$22);
|
|
1996
|
+
};
|
|
1997
|
+
}
|
|
1998
|
+
});
|
|
1999
|
+
//#endregion
|
|
2000
|
+
//#region src/Card.vue?vue&type=script&setup=true&lang.ts
|
|
2001
|
+
var _hoisted_1$21 = { class: "card" };
|
|
2002
|
+
var _hoisted_2$18 = {
|
|
2003
|
+
key: 0,
|
|
2004
|
+
class: "card__header"
|
|
2005
|
+
};
|
|
2006
|
+
var _hoisted_3$15 = {
|
|
2007
|
+
key: 0,
|
|
2008
|
+
class: "card__heading"
|
|
2009
|
+
};
|
|
2010
|
+
var _hoisted_4$14 = {
|
|
2011
|
+
key: 0,
|
|
2012
|
+
class: "card__title-row"
|
|
2013
|
+
};
|
|
2014
|
+
var _hoisted_5$9 = {
|
|
2015
|
+
key: 2,
|
|
2016
|
+
class: "card__description"
|
|
2017
|
+
};
|
|
2018
|
+
var _hoisted_6$7 = {
|
|
2019
|
+
key: 1,
|
|
2020
|
+
class: "card__actions"
|
|
2021
|
+
};
|
|
2022
|
+
var _hoisted_7$6 = { class: "card__content" };
|
|
2023
|
+
var _hoisted_8$6 = {
|
|
2024
|
+
key: 1,
|
|
2025
|
+
class: "card__footer"
|
|
2026
|
+
};
|
|
2027
|
+
//#endregion
|
|
2028
|
+
//#region src/Card.vue
|
|
2029
|
+
var Card_default = /* @__PURE__ */ defineComponent({
|
|
2030
|
+
__name: "Card",
|
|
2031
|
+
props: {
|
|
2032
|
+
title: { default: void 0 },
|
|
2033
|
+
description: { default: void 0 },
|
|
2034
|
+
headingLevel: { default: 3 }
|
|
2035
|
+
},
|
|
2036
|
+
setup(__props) {
|
|
2037
|
+
return (_ctx, _cache) => {
|
|
2038
|
+
return openBlock(), createElementBlock("div", _hoisted_1$21, [
|
|
2039
|
+
__props.title || __props.description || _ctx.$slots.actions || _ctx.$slots.header || _ctx.$slots["title-extras"] ? (openBlock(), createElementBlock("div", _hoisted_2$18, [__props.title || __props.description || _ctx.$slots.header || _ctx.$slots["title-extras"] ? (openBlock(), createElementBlock("div", _hoisted_3$15, [renderSlot(_ctx.$slots, "header", {}, () => [_ctx.$slots["title-extras"] ? (openBlock(), createElementBlock("div", _hoisted_4$14, [__props.title ? (openBlock(), createBlock(resolveDynamicComponent(`h${__props.headingLevel}`), {
|
|
2040
|
+
key: 0,
|
|
2041
|
+
class: "card__title"
|
|
2042
|
+
}, {
|
|
2043
|
+
default: withCtx(() => [createTextVNode(toDisplayString(__props.title), 1)]),
|
|
2044
|
+
_: 1
|
|
2045
|
+
})) : createCommentVNode("", true), renderSlot(_ctx.$slots, "title-extras")])) : __props.title ? (openBlock(), createBlock(resolveDynamicComponent(`h${__props.headingLevel}`), {
|
|
2046
|
+
key: 1,
|
|
2047
|
+
class: "card__title"
|
|
2048
|
+
}, {
|
|
2049
|
+
default: withCtx(() => [createTextVNode(toDisplayString(__props.title), 1)]),
|
|
2050
|
+
_: 1
|
|
2051
|
+
})) : createCommentVNode("", true), __props.description ? (openBlock(), createElementBlock("p", _hoisted_5$9, toDisplayString(__props.description), 1)) : createCommentVNode("", true)])])) : createCommentVNode("", true), _ctx.$slots.actions ? (openBlock(), createElementBlock("div", _hoisted_6$7, [renderSlot(_ctx.$slots, "actions")])) : createCommentVNode("", true)])) : createCommentVNode("", true),
|
|
2052
|
+
createElementVNode("div", _hoisted_7$6, [renderSlot(_ctx.$slots, "default")]),
|
|
2053
|
+
_ctx.$slots.footer ? (openBlock(), createElementBlock("div", _hoisted_8$6, [renderSlot(_ctx.$slots, "footer")])) : createCommentVNode("", true)
|
|
2054
|
+
]);
|
|
2055
|
+
};
|
|
2056
|
+
}
|
|
2057
|
+
});
|
|
2058
|
+
//#endregion
|
|
2059
|
+
//#region src/Badge.vue?vue&type=script&setup=true&lang.ts
|
|
2060
|
+
var _hoisted_1$20 = ["data-tone"];
|
|
2061
|
+
//#endregion
|
|
2062
|
+
//#region src/Badge.vue
|
|
2063
|
+
var Badge_default = /* @__PURE__ */ defineComponent({
|
|
2064
|
+
__name: "Badge",
|
|
2065
|
+
props: { tone: { default: "neutral" } },
|
|
2066
|
+
setup(__props) {
|
|
2067
|
+
return (_ctx, _cache) => {
|
|
2068
|
+
return openBlock(), createElementBlock("span", {
|
|
2069
|
+
class: "badge",
|
|
2070
|
+
"data-tone": __props.tone
|
|
2071
|
+
}, [renderSlot(_ctx.$slots, "default")], 8, _hoisted_1$20);
|
|
2072
|
+
};
|
|
2073
|
+
}
|
|
2074
|
+
});
|
|
2075
|
+
//#endregion
|
|
2076
|
+
//#region src/Skeleton.vue?vue&type=script&setup=true&lang.ts
|
|
2077
|
+
var _hoisted_1$19 = ["data-shape", "data-animated"];
|
|
2078
|
+
//#endregion
|
|
2079
|
+
//#region src/Skeleton.vue
|
|
2080
|
+
var Skeleton_default = /* @__PURE__ */ defineComponent({
|
|
2081
|
+
inheritAttrs: false,
|
|
2082
|
+
__name: "Skeleton",
|
|
2083
|
+
props: {
|
|
2084
|
+
shape: { default: "rectangle" },
|
|
2085
|
+
animated: {
|
|
2086
|
+
type: Boolean,
|
|
2087
|
+
default: true
|
|
2088
|
+
}
|
|
2089
|
+
},
|
|
2090
|
+
setup(__props) {
|
|
2091
|
+
return (_ctx, _cache) => {
|
|
2092
|
+
return openBlock(), createElementBlock("span", mergeProps(_ctx.$attrs, {
|
|
2093
|
+
class: "skeleton",
|
|
2094
|
+
"data-shape": __props.shape,
|
|
2095
|
+
"data-animated": __props.animated ? "true" : void 0,
|
|
2096
|
+
"aria-hidden": "true"
|
|
2097
|
+
}), null, 16, _hoisted_1$19);
|
|
2098
|
+
};
|
|
2099
|
+
}
|
|
2100
|
+
});
|
|
2101
|
+
//#endregion
|
|
2102
|
+
//#region src/Separator.vue?vue&type=script&setup=true&lang.ts
|
|
2103
|
+
var _hoisted_1$18 = [
|
|
2104
|
+
"data-orientation",
|
|
2105
|
+
"role",
|
|
2106
|
+
"aria-hidden",
|
|
2107
|
+
"aria-orientation"
|
|
2108
|
+
];
|
|
2109
|
+
//#endregion
|
|
2110
|
+
//#region src/Separator.vue
|
|
2111
|
+
var Separator_default = /* @__PURE__ */ defineComponent({
|
|
2112
|
+
inheritAttrs: false,
|
|
2113
|
+
__name: "Separator",
|
|
2114
|
+
props: {
|
|
2115
|
+
orientation: { default: "horizontal" },
|
|
2116
|
+
decorative: {
|
|
2117
|
+
type: Boolean,
|
|
2118
|
+
default: true
|
|
2119
|
+
}
|
|
2120
|
+
},
|
|
2121
|
+
setup(__props) {
|
|
2122
|
+
return (_ctx, _cache) => {
|
|
2123
|
+
return openBlock(), createElementBlock("div", mergeProps(_ctx.$attrs, {
|
|
2124
|
+
class: "separator",
|
|
2125
|
+
"data-orientation": __props.orientation,
|
|
2126
|
+
role: __props.decorative ? "presentation" : "separator",
|
|
2127
|
+
"aria-hidden": __props.decorative ? "true" : void 0,
|
|
2128
|
+
"aria-orientation": __props.decorative ? void 0 : __props.orientation
|
|
2129
|
+
}), null, 16, _hoisted_1$18);
|
|
2130
|
+
};
|
|
2131
|
+
}
|
|
2132
|
+
});
|
|
2133
|
+
//#endregion
|
|
2134
|
+
//#region src/tabs-indicator.ts
|
|
2135
|
+
function mountTabsIndicator(container) {
|
|
2136
|
+
const list = container.querySelector("[role=\"tablist\"]");
|
|
2137
|
+
if (!list) return () => {};
|
|
2138
|
+
let frame = 0, disposed = false, previous = null, armed = false;
|
|
2139
|
+
const prev = container.querySelector("[data-tabs-scroll=\"prev\"]");
|
|
2140
|
+
const next = container.querySelector("[data-tabs-scroll=\"next\"]");
|
|
2141
|
+
const vertical = () => list.getAttribute("aria-orientation") === "vertical";
|
|
2142
|
+
const reduced = () => window.matchMedia?.("(prefers-reduced-motion: reduce)").matches ?? false;
|
|
2143
|
+
function measure() {
|
|
2144
|
+
if (disposed) return;
|
|
2145
|
+
const selected = list.querySelector("[role=\"tab\"][aria-selected=\"true\"]");
|
|
2146
|
+
const rect = list.getBoundingClientRect();
|
|
2147
|
+
if (selected && rect.width > 0 && rect.height > 0) {
|
|
2148
|
+
const tab = selected.getBoundingClientRect();
|
|
2149
|
+
const border = getComputedStyle(list);
|
|
2150
|
+
list.style.setProperty("--tabs-indicator-x", `${tab.left - rect.left + list.scrollLeft - (parseFloat(border.borderLeftWidth) || 0)}px`);
|
|
2151
|
+
list.style.setProperty("--tabs-indicator-y", `${tab.top - rect.top + list.scrollTop - (parseFloat(border.borderTopWidth) || 0)}px`);
|
|
2152
|
+
list.style.setProperty("--tabs-indicator-width", `${tab.width}px`);
|
|
2153
|
+
list.style.setProperty("--tabs-indicator-height", `${tab.height}px`);
|
|
2154
|
+
list.dataset.indicatorReady = "true";
|
|
2155
|
+
if (!armed) {
|
|
2156
|
+
armed = true;
|
|
2157
|
+
requestAnimationFrame(() => {
|
|
2158
|
+
if (!disposed) list.dataset.indicatorAnimated = "true";
|
|
2159
|
+
});
|
|
2160
|
+
}
|
|
2161
|
+
if (selected !== previous && previous && typeof list.scrollBy === "function") {
|
|
2162
|
+
const delta = vertical() ? tab.top < rect.top ? tab.top - rect.top : tab.bottom > rect.bottom ? tab.bottom - rect.bottom : 0 : tab.left < rect.left ? tab.left - rect.left : tab.right > rect.right ? tab.right - rect.right : 0;
|
|
2163
|
+
if (delta) list.scrollBy({
|
|
2164
|
+
[vertical() ? "top" : "left"]: delta,
|
|
2165
|
+
behavior: reduced() ? "instant" : "smooth"
|
|
2166
|
+
});
|
|
2167
|
+
}
|
|
2168
|
+
} else list.dataset.indicatorReady = "false";
|
|
2169
|
+
previous = selected;
|
|
2170
|
+
const max = vertical() ? list.scrollHeight - list.clientHeight : list.scrollWidth - list.clientWidth;
|
|
2171
|
+
const position = Math.abs(vertical() ? list.scrollTop : list.scrollLeft);
|
|
2172
|
+
list.dataset.overflow = String(max > 1);
|
|
2173
|
+
if (prev) {
|
|
2174
|
+
prev.hidden = max <= 1;
|
|
2175
|
+
prev.disabled = position <= 1;
|
|
2176
|
+
}
|
|
2177
|
+
if (next) {
|
|
2178
|
+
next.hidden = max <= 1;
|
|
2179
|
+
next.disabled = position >= max - 1;
|
|
2180
|
+
}
|
|
2181
|
+
}
|
|
2182
|
+
function schedule() {
|
|
2183
|
+
if (disposed) return;
|
|
2184
|
+
cancelAnimationFrame(frame);
|
|
2185
|
+
frame = requestAnimationFrame(measure);
|
|
2186
|
+
}
|
|
2187
|
+
function scroll(direction) {
|
|
2188
|
+
if (typeof list.scrollBy !== "function") return;
|
|
2189
|
+
const rtl = !vertical() && getComputedStyle(list).direction === "rtl";
|
|
2190
|
+
const amount = (vertical() ? list.clientHeight : list.clientWidth) * .7 * direction * (rtl ? -1 : 1);
|
|
2191
|
+
list.scrollBy({
|
|
2192
|
+
[vertical() ? "top" : "left"]: amount,
|
|
2193
|
+
behavior: reduced() ? "instant" : "smooth"
|
|
2194
|
+
});
|
|
2195
|
+
}
|
|
2196
|
+
const backward = () => scroll(-1), forward = () => scroll(1);
|
|
2197
|
+
prev?.addEventListener("click", backward);
|
|
2198
|
+
next?.addEventListener("click", forward);
|
|
2199
|
+
list.addEventListener("scroll", schedule, { passive: true });
|
|
2200
|
+
window.addEventListener("resize", schedule);
|
|
2201
|
+
const observer = new MutationObserver(schedule);
|
|
2202
|
+
observer.observe(list, {
|
|
2203
|
+
subtree: true,
|
|
2204
|
+
childList: true,
|
|
2205
|
+
characterData: true,
|
|
2206
|
+
attributes: true,
|
|
2207
|
+
attributeFilter: [
|
|
2208
|
+
"aria-selected",
|
|
2209
|
+
"aria-orientation",
|
|
2210
|
+
"aria-disabled",
|
|
2211
|
+
"disabled"
|
|
2212
|
+
]
|
|
2213
|
+
});
|
|
2214
|
+
const resize = typeof ResizeObserver === "undefined" ? void 0 : new ResizeObserver(schedule);
|
|
2215
|
+
resize?.observe(list);
|
|
2216
|
+
for (const tab of list.querySelectorAll("[role=\"tab\"]")) resize?.observe(tab);
|
|
2217
|
+
document.fonts?.ready.then(schedule);
|
|
2218
|
+
schedule();
|
|
2219
|
+
return () => {
|
|
2220
|
+
disposed = true;
|
|
2221
|
+
cancelAnimationFrame(frame);
|
|
2222
|
+
observer.disconnect();
|
|
2223
|
+
resize?.disconnect();
|
|
2224
|
+
prev?.removeEventListener("click", backward);
|
|
2225
|
+
next?.removeEventListener("click", forward);
|
|
2226
|
+
list.removeEventListener("scroll", schedule);
|
|
2227
|
+
window.removeEventListener("resize", schedule);
|
|
2228
|
+
};
|
|
2229
|
+
}
|
|
2230
|
+
//#endregion
|
|
2231
|
+
//#region src/TabsListView.vue?vue&type=script&setup=true&lang.ts
|
|
2232
|
+
var _hoisted_1$17 = ["aria-label"];
|
|
2233
|
+
var _hoisted_2$17 = {
|
|
2234
|
+
key: 0,
|
|
2235
|
+
class: "tabs__separator",
|
|
2236
|
+
"aria-hidden": "true"
|
|
2237
|
+
};
|
|
2238
|
+
var _hoisted_3$14 = {
|
|
2239
|
+
key: 1,
|
|
2240
|
+
class: "tabs__icon",
|
|
2241
|
+
"aria-hidden": "true"
|
|
2242
|
+
};
|
|
2243
|
+
var _hoisted_4$13 = { class: "tabs__label" };
|
|
2244
|
+
var _hoisted_5$8 = ["aria-label"];
|
|
2245
|
+
//#endregion
|
|
2246
|
+
//#region src/TabsListView.vue
|
|
2247
|
+
var TabsListView_default = /* @__PURE__ */ defineComponent({
|
|
2248
|
+
__name: "TabsListView",
|
|
2249
|
+
props: {
|
|
2250
|
+
label: {},
|
|
2251
|
+
items: {},
|
|
2252
|
+
showSeparators: { type: Boolean },
|
|
2253
|
+
previousLabel: {},
|
|
2254
|
+
nextLabel: {}
|
|
2255
|
+
},
|
|
2256
|
+
setup(__props) {
|
|
2257
|
+
const container = ref();
|
|
2258
|
+
let cleanup;
|
|
2259
|
+
onMounted(() => {
|
|
2260
|
+
if (container.value) cleanup = mountTabsIndicator(container.value);
|
|
2261
|
+
});
|
|
2262
|
+
onBeforeUnmount(() => cleanup?.());
|
|
2263
|
+
return (_ctx, _cache) => {
|
|
2264
|
+
return openBlock(), createElementBlock("div", {
|
|
2265
|
+
ref_key: "container",
|
|
2266
|
+
ref: container,
|
|
2267
|
+
class: "tabs__list-container"
|
|
2268
|
+
}, [
|
|
2269
|
+
createElementVNode("button", {
|
|
2270
|
+
type: "button",
|
|
2271
|
+
class: "tabs__scroll-button tabs__scroll-button--prev",
|
|
2272
|
+
"data-tabs-scroll": "prev",
|
|
2273
|
+
hidden: "",
|
|
2274
|
+
"aria-label": __props.previousLabel
|
|
2275
|
+
}, [..._cache[0] || (_cache[0] = [createElementVNode("svg", {
|
|
2276
|
+
viewBox: "0 0 24 24",
|
|
2277
|
+
"aria-hidden": "true"
|
|
2278
|
+
}, [createElementVNode("path", { d: "m14 6-6 6 6 6" })], -1)])], 8, _hoisted_1$17),
|
|
2279
|
+
createVNode(unref(TabsList), {
|
|
2280
|
+
class: "tabs__list",
|
|
2281
|
+
"aria-label": __props.label
|
|
2282
|
+
}, {
|
|
2283
|
+
default: withCtx(() => [(openBlock(true), createElementBlock(Fragment, null, renderList(__props.items, (item, index) => {
|
|
2284
|
+
return openBlock(), createBlock(unref(TabsTrigger), {
|
|
2285
|
+
key: item.id,
|
|
2286
|
+
class: "tabs__trigger",
|
|
2287
|
+
value: item.id,
|
|
2288
|
+
disabled: item.isDisabled
|
|
2289
|
+
}, {
|
|
2290
|
+
default: withCtx(() => [
|
|
2291
|
+
__props.showSeparators && index > 0 ? (openBlock(), createElementBlock("span", _hoisted_2$17)) : createCommentVNode("", true),
|
|
2292
|
+
_ctx.$slots.icon ? (openBlock(), createElementBlock("span", _hoisted_3$14, [renderSlot(_ctx.$slots, "icon", { item })])) : createCommentVNode("", true),
|
|
2293
|
+
createElementVNode("span", _hoisted_4$13, toDisplayString(item.label), 1)
|
|
2294
|
+
]),
|
|
2295
|
+
_: 2
|
|
2296
|
+
}, 1032, ["value", "disabled"]);
|
|
2297
|
+
}), 128))]),
|
|
2298
|
+
_: 3
|
|
2299
|
+
}, 8, ["aria-label"]),
|
|
2300
|
+
createElementVNode("button", {
|
|
2301
|
+
type: "button",
|
|
2302
|
+
class: "tabs__scroll-button tabs__scroll-button--next",
|
|
2303
|
+
"data-tabs-scroll": "next",
|
|
2304
|
+
hidden: "",
|
|
2305
|
+
"aria-label": __props.nextLabel
|
|
2306
|
+
}, [..._cache[1] || (_cache[1] = [createElementVNode("svg", {
|
|
2307
|
+
viewBox: "0 0 24 24",
|
|
2308
|
+
"aria-hidden": "true"
|
|
2309
|
+
}, [createElementVNode("path", { d: "m10 6 6 6-6 6" })], -1)])], 8, _hoisted_5$8)
|
|
2310
|
+
], 512);
|
|
2311
|
+
};
|
|
2312
|
+
}
|
|
2313
|
+
});
|
|
2314
|
+
//#endregion
|
|
2315
|
+
//#region src/Tabs.vue?vue&type=script&setup=true&lang.ts
|
|
2316
|
+
var _hoisted_1$16 = {
|
|
2317
|
+
key: 0,
|
|
2318
|
+
class: "tabs__toolbar"
|
|
2319
|
+
};
|
|
2320
|
+
var _hoisted_2$16 = { class: "tabs__navigation" };
|
|
2321
|
+
var _hoisted_3$13 = {
|
|
2322
|
+
key: 1,
|
|
2323
|
+
class: "tabs__extras"
|
|
2324
|
+
};
|
|
2325
|
+
var _hoisted_4$12 = {
|
|
2326
|
+
key: 0,
|
|
2327
|
+
class: "tabs__actions"
|
|
2328
|
+
};
|
|
2329
|
+
//#endregion
|
|
2330
|
+
//#region src/Tabs.vue
|
|
2331
|
+
var Tabs_default = /* @__PURE__ */ defineComponent({
|
|
2332
|
+
inheritAttrs: false,
|
|
2333
|
+
__name: "Tabs",
|
|
2334
|
+
props: {
|
|
2335
|
+
label: {},
|
|
2336
|
+
variant: { default: "primary" },
|
|
2337
|
+
size: { default: "md" },
|
|
2338
|
+
orientation: { default: "horizontal" },
|
|
2339
|
+
align: { default: "center" },
|
|
2340
|
+
fullWidth: {
|
|
2341
|
+
type: Boolean,
|
|
2342
|
+
default: false
|
|
2343
|
+
},
|
|
2344
|
+
inset: { default: "default" },
|
|
2345
|
+
showSeparators: {
|
|
2346
|
+
type: Boolean,
|
|
2347
|
+
default: false
|
|
2348
|
+
},
|
|
2349
|
+
previousLabel: { default: "Tab sebelumnya / Previous tabs" },
|
|
2350
|
+
nextLabel: { default: "Tab berikutnya / Next tabs" },
|
|
2351
|
+
items: {},
|
|
2352
|
+
modelValue: { default: void 0 },
|
|
2353
|
+
defaultValue: { default: void 0 },
|
|
2354
|
+
activationMode: { default: "manual" },
|
|
2355
|
+
dir: { default: void 0 },
|
|
2356
|
+
id: { default: void 0 }
|
|
2357
|
+
},
|
|
2358
|
+
emits: ["update:modelValue"],
|
|
2359
|
+
setup(__props, { emit: __emit }) {
|
|
2360
|
+
const props = __props;
|
|
2361
|
+
const emit = __emit;
|
|
2362
|
+
const local = ref(props.defaultValue);
|
|
2363
|
+
const selected = computed(() => props.items.find((item) => item.id === (props.modelValue ?? local.value) && !item.isDisabled)?.id ?? props.items.find((item) => !item.isDisabled)?.id);
|
|
2364
|
+
function update(value) {
|
|
2365
|
+
const next = String(value);
|
|
2366
|
+
if (next !== selected.value && props.items.some((item) => item.id === next && !item.isDisabled)) {
|
|
2367
|
+
local.value = next;
|
|
2368
|
+
emit("update:modelValue", next);
|
|
2369
|
+
}
|
|
2370
|
+
}
|
|
2371
|
+
return (_ctx, _cache) => {
|
|
2372
|
+
return openBlock(), createBlock(unref(TabsRoot), {
|
|
2373
|
+
id: __props.id,
|
|
2374
|
+
class: normalizeClass([
|
|
2375
|
+
"tabs",
|
|
2376
|
+
`tabs--${__props.variant === "default" ? "primary" : __props.variant}`,
|
|
2377
|
+
`tabs--align-${__props.align}`,
|
|
2378
|
+
__props.fullWidth && "tabs--full-width",
|
|
2379
|
+
__props.inset === "none" && "tabs--flush",
|
|
2380
|
+
__props.size !== "md" && `tabs--${__props.size}`
|
|
2381
|
+
]),
|
|
2382
|
+
"model-value": selected.value ?? "",
|
|
2383
|
+
"activation-mode": __props.activationMode,
|
|
2384
|
+
dir: __props.dir,
|
|
2385
|
+
orientation: __props.orientation,
|
|
2386
|
+
"data-orientation": __props.orientation,
|
|
2387
|
+
"onUpdate:modelValue": update
|
|
2388
|
+
}, {
|
|
2389
|
+
default: withCtx(() => [_ctx.$slots.extras || _ctx.$slots.actions ? (openBlock(), createElementBlock("div", _hoisted_1$16, [createElementVNode("div", _hoisted_2$16, [__props.items.length ? (openBlock(), createBlock(TabsListView_default, {
|
|
2390
|
+
key: 0,
|
|
2391
|
+
label: __props.label,
|
|
2392
|
+
items: __props.items,
|
|
2393
|
+
"show-separators": __props.showSeparators,
|
|
2394
|
+
"previous-label": __props.previousLabel,
|
|
2395
|
+
"next-label": __props.nextLabel
|
|
2396
|
+
}, createSlots({ _: 2 }, [_ctx.$slots.icon ? {
|
|
2397
|
+
name: "icon",
|
|
2398
|
+
fn: withCtx(({ item }) => [renderSlot(_ctx.$slots, "icon", { item })]),
|
|
2399
|
+
key: "0"
|
|
2400
|
+
} : void 0]), 1032, [
|
|
2401
|
+
"label",
|
|
2402
|
+
"items",
|
|
2403
|
+
"show-separators",
|
|
2404
|
+
"previous-label",
|
|
2405
|
+
"next-label"
|
|
2406
|
+
])) : createCommentVNode("", true), _ctx.$slots.extras ? (openBlock(), createElementBlock("div", _hoisted_3$13, [renderSlot(_ctx.$slots, "extras")])) : createCommentVNode("", true)]), _ctx.$slots.actions ? (openBlock(), createElementBlock("div", _hoisted_4$12, [renderSlot(_ctx.$slots, "actions")])) : createCommentVNode("", true)])) : __props.items.length ? (openBlock(), createBlock(TabsListView_default, {
|
|
2407
|
+
key: 1,
|
|
2408
|
+
label: __props.label,
|
|
2409
|
+
items: __props.items,
|
|
2410
|
+
"show-separators": __props.showSeparators,
|
|
2411
|
+
"previous-label": __props.previousLabel,
|
|
2412
|
+
"next-label": __props.nextLabel
|
|
2413
|
+
}, createSlots({ _: 2 }, [_ctx.$slots.icon ? {
|
|
2414
|
+
name: "icon",
|
|
2415
|
+
fn: withCtx(({ item }) => [renderSlot(_ctx.$slots, "icon", { item })]),
|
|
2416
|
+
key: "0"
|
|
2417
|
+
} : void 0]), 1032, [
|
|
2418
|
+
"label",
|
|
2419
|
+
"items",
|
|
2420
|
+
"show-separators",
|
|
2421
|
+
"previous-label",
|
|
2422
|
+
"next-label"
|
|
2423
|
+
])) : createCommentVNode("", true), (openBlock(true), createElementBlock(Fragment, null, renderList(__props.items, (item) => {
|
|
2424
|
+
return openBlock(), createBlock(unref(TabsContent), {
|
|
2425
|
+
key: item.id,
|
|
2426
|
+
class: "tabs__panel",
|
|
2427
|
+
value: item.id
|
|
2428
|
+
}, {
|
|
2429
|
+
default: withCtx(() => [renderSlot(_ctx.$slots, "default", { item })]),
|
|
2430
|
+
_: 2
|
|
2431
|
+
}, 1032, ["value"]);
|
|
2432
|
+
}), 128))]),
|
|
2433
|
+
_: 3
|
|
2434
|
+
}, 8, [
|
|
2435
|
+
"id",
|
|
2436
|
+
"class",
|
|
2437
|
+
"model-value",
|
|
2438
|
+
"activation-mode",
|
|
2439
|
+
"dir",
|
|
2440
|
+
"orientation",
|
|
2441
|
+
"data-orientation"
|
|
2442
|
+
]);
|
|
2443
|
+
};
|
|
2444
|
+
}
|
|
2445
|
+
});
|
|
2446
|
+
//#endregion
|
|
2447
|
+
//#region src/pagination-model.ts
|
|
2448
|
+
function paginationModel(totalItems, pageSize, value, siblingCount = 1) {
|
|
2449
|
+
const count = Math.max(1, Math.ceil((Number.isFinite(totalItems) ? Math.min(Number.MAX_SAFE_INTEGER, Math.max(0, Math.floor(totalItems))) : 0) / (Number.isFinite(pageSize) ? Math.max(1, Math.floor(pageSize)) : 10)));
|
|
2450
|
+
const current = Math.min(count, Math.max(1, Number.isFinite(value) ? Math.floor(value) : 1));
|
|
2451
|
+
const siblings = Number.isFinite(siblingCount) ? Math.min(2, Math.max(0, Math.floor(siblingCount))) : 1;
|
|
2452
|
+
const pages = /* @__PURE__ */ new Set([
|
|
2453
|
+
1,
|
|
2454
|
+
count,
|
|
2455
|
+
current
|
|
2456
|
+
]);
|
|
2457
|
+
for (let offset = 1; offset <= siblings; offset++) {
|
|
2458
|
+
if (current - offset > 1) pages.add(current - offset);
|
|
2459
|
+
if (current + offset < count) pages.add(current + offset);
|
|
2460
|
+
}
|
|
2461
|
+
const ordered = [...pages].sort((a, b) => a - b);
|
|
2462
|
+
const entries = [];
|
|
2463
|
+
ordered.forEach((page, index) => {
|
|
2464
|
+
if (index && page - ordered[index - 1] > 1) entries.push(`gap-${page}`);
|
|
2465
|
+
entries.push(page);
|
|
2466
|
+
});
|
|
2467
|
+
return {
|
|
2468
|
+
current,
|
|
2469
|
+
count,
|
|
2470
|
+
entries
|
|
2471
|
+
};
|
|
2472
|
+
}
|
|
2473
|
+
//#endregion
|
|
2474
|
+
//#region src/Pagination.vue?vue&type=script&setup=true&lang.ts
|
|
2475
|
+
var _hoisted_1$15 = [
|
|
2476
|
+
"id",
|
|
2477
|
+
"aria-label",
|
|
2478
|
+
"dir"
|
|
2479
|
+
];
|
|
2480
|
+
var _hoisted_2$15 = ["disabled"];
|
|
2481
|
+
var _hoisted_3$12 = {
|
|
2482
|
+
key: 0,
|
|
2483
|
+
class: "pagination__gap",
|
|
2484
|
+
"aria-hidden": "true"
|
|
2485
|
+
};
|
|
2486
|
+
var _hoisted_4$11 = [
|
|
2487
|
+
"aria-label",
|
|
2488
|
+
"aria-current",
|
|
2489
|
+
"disabled",
|
|
2490
|
+
"onClick"
|
|
2491
|
+
];
|
|
2492
|
+
var _hoisted_5$7 = ["disabled"];
|
|
2493
|
+
var _hoisted_6$6 = {
|
|
2494
|
+
class: "pagination__summary",
|
|
2495
|
+
"aria-live": "polite"
|
|
2496
|
+
};
|
|
2497
|
+
//#endregion
|
|
2498
|
+
//#region src/Pagination.vue
|
|
2499
|
+
var Pagination_default = /* @__PURE__ */ defineComponent({
|
|
2500
|
+
inheritAttrs: false,
|
|
2501
|
+
__name: "Pagination",
|
|
2502
|
+
props: {
|
|
2503
|
+
totalItems: {},
|
|
2504
|
+
pageSize: { default: 10 },
|
|
2505
|
+
modelValue: { default: void 0 },
|
|
2506
|
+
defaultValue: { default: 1 },
|
|
2507
|
+
disabled: {
|
|
2508
|
+
type: Boolean,
|
|
2509
|
+
default: false
|
|
2510
|
+
},
|
|
2511
|
+
siblingCount: { default: 1 },
|
|
2512
|
+
label: { default: "Navigasi halaman" },
|
|
2513
|
+
previousLabel: { default: "Sebelumnya" },
|
|
2514
|
+
nextLabel: { default: "Berikutnya" },
|
|
2515
|
+
pageLabel: { default: "Halaman" },
|
|
2516
|
+
dir: { default: void 0 },
|
|
2517
|
+
id: { default: void 0 }
|
|
2518
|
+
},
|
|
2519
|
+
emits: ["update:modelValue"],
|
|
2520
|
+
setup(__props, { emit: __emit }) {
|
|
2521
|
+
const props = __props;
|
|
2522
|
+
const emit = __emit;
|
|
2523
|
+
const local = ref(props.defaultValue);
|
|
2524
|
+
const model = computed(() => paginationModel(props.totalItems, props.pageSize, props.modelValue ?? local.value, props.siblingCount));
|
|
2525
|
+
function change(next) {
|
|
2526
|
+
if (props.disabled || next === model.value.current || next < 1 || next > model.value.count) return;
|
|
2527
|
+
local.value = next;
|
|
2528
|
+
emit("update:modelValue", next);
|
|
2529
|
+
}
|
|
2530
|
+
return (_ctx, _cache) => {
|
|
2531
|
+
return openBlock(), createElementBlock("nav", {
|
|
2532
|
+
id: __props.id,
|
|
2533
|
+
class: "pagination",
|
|
2534
|
+
"aria-label": __props.label,
|
|
2535
|
+
dir: __props.dir
|
|
2536
|
+
}, [
|
|
2537
|
+
createElementVNode("button", {
|
|
2538
|
+
type: "button",
|
|
2539
|
+
class: "pagination__button",
|
|
2540
|
+
disabled: __props.disabled || model.value.current === 1,
|
|
2541
|
+
onClick: _cache[0] || (_cache[0] = ($event) => change(model.value.current - 1))
|
|
2542
|
+
}, toDisplayString(__props.previousLabel), 9, _hoisted_2$15),
|
|
2543
|
+
(openBlock(true), createElementBlock(Fragment, null, renderList(model.value.entries, (entry) => {
|
|
2544
|
+
return openBlock(), createElementBlock(Fragment, { key: entry }, [typeof entry === "string" ? (openBlock(), createElementBlock("span", _hoisted_3$12, "...")) : (openBlock(), createElementBlock("button", {
|
|
2545
|
+
key: 1,
|
|
2546
|
+
type: "button",
|
|
2547
|
+
class: "pagination__button",
|
|
2548
|
+
"aria-label": `${__props.pageLabel} ${entry}`,
|
|
2549
|
+
"aria-current": entry === model.value.current ? "page" : void 0,
|
|
2550
|
+
disabled: __props.disabled,
|
|
2551
|
+
onClick: ($event) => change(entry)
|
|
2552
|
+
}, toDisplayString(entry), 9, _hoisted_4$11))], 64);
|
|
2553
|
+
}), 128)),
|
|
2554
|
+
createElementVNode("button", {
|
|
2555
|
+
type: "button",
|
|
2556
|
+
class: "pagination__button",
|
|
2557
|
+
disabled: __props.disabled || model.value.current === model.value.count,
|
|
2558
|
+
onClick: _cache[1] || (_cache[1] = ($event) => change(model.value.current + 1))
|
|
2559
|
+
}, toDisplayString(__props.nextLabel), 9, _hoisted_5$7),
|
|
2560
|
+
createElementVNode("span", _hoisted_6$6, toDisplayString(model.value.current) + " / " + toDisplayString(model.value.count), 1)
|
|
2561
|
+
], 8, _hoisted_1$15);
|
|
2562
|
+
};
|
|
2563
|
+
}
|
|
2564
|
+
});
|
|
2565
|
+
//#endregion
|
|
2566
|
+
//#region src/Table.vue?vue&type=script&setup=true&lang.ts
|
|
2567
|
+
var _hoisted_1$14 = ["aria-label"];
|
|
2568
|
+
var _hoisted_2$14 = { class: "table__caption" };
|
|
2569
|
+
//#endregion
|
|
2570
|
+
//#region src/Table.vue
|
|
2571
|
+
var Table_default = /* @__PURE__ */ defineComponent({
|
|
2572
|
+
inheritAttrs: false,
|
|
2573
|
+
__name: "Table",
|
|
2574
|
+
props: { caption: {} },
|
|
2575
|
+
setup(__props) {
|
|
2576
|
+
return (_ctx, _cache) => {
|
|
2577
|
+
return openBlock(), createElementBlock("div", {
|
|
2578
|
+
class: "table__scroll",
|
|
2579
|
+
role: "region",
|
|
2580
|
+
"aria-label": __props.caption,
|
|
2581
|
+
tabindex: "0"
|
|
2582
|
+
}, [createElementVNode("table", mergeProps(_ctx.$attrs, { class: "table" }), [createElementVNode("caption", _hoisted_2$14, toDisplayString(__props.caption), 1), renderSlot(_ctx.$slots, "default")], 16)], 8, _hoisted_1$14);
|
|
2583
|
+
};
|
|
2584
|
+
}
|
|
2585
|
+
});
|
|
2586
|
+
//#endregion
|
|
2587
|
+
//#region src/DataTable.vue?vue&type=script&setup=true&lang.ts
|
|
2588
|
+
var _hoisted_1$13 = ["id", "dir"];
|
|
2589
|
+
var _hoisted_2$13 = ["aria-sort"];
|
|
2590
|
+
var _hoisted_3$11 = ["disabled", "onClick"];
|
|
2591
|
+
var _hoisted_4$10 = { "aria-hidden": "true" };
|
|
2592
|
+
var _hoisted_5$6 = { key: 0 };
|
|
2593
|
+
var _hoisted_6$5 = ["colspan"];
|
|
2594
|
+
var _hoisted_7$5 = {
|
|
2595
|
+
key: 0,
|
|
2596
|
+
class: "data-table__status",
|
|
2597
|
+
role: "status"
|
|
2598
|
+
};
|
|
2599
|
+
var _hoisted_8$5 = {
|
|
2600
|
+
key: 1,
|
|
2601
|
+
class: "input__error",
|
|
2602
|
+
role: "alert"
|
|
2603
|
+
};
|
|
2604
|
+
//#endregion
|
|
2605
|
+
//#region src/DataTable.vue
|
|
2606
|
+
var DataTable_default = /* @__PURE__ */ defineComponent({
|
|
2607
|
+
inheritAttrs: false,
|
|
2608
|
+
__name: "DataTable",
|
|
2609
|
+
props: {
|
|
2610
|
+
caption: {},
|
|
2611
|
+
columns: {},
|
|
2612
|
+
rows: {},
|
|
2613
|
+
sort: { default: null },
|
|
2614
|
+
loading: {
|
|
2615
|
+
type: Boolean,
|
|
2616
|
+
default: false
|
|
2617
|
+
},
|
|
2618
|
+
disabled: {
|
|
2619
|
+
type: Boolean,
|
|
2620
|
+
default: false
|
|
2621
|
+
},
|
|
2622
|
+
emptyMessage: { default: "Tidak ada data." },
|
|
2623
|
+
loadingMessage: { default: "Memuat data..." },
|
|
2624
|
+
errorMessage: { default: void 0 },
|
|
2625
|
+
dir: { default: void 0 },
|
|
2626
|
+
id: { default: void 0 }
|
|
2627
|
+
},
|
|
2628
|
+
emits: ["update:sort"],
|
|
2629
|
+
setup(__props, { emit: __emit }) {
|
|
2630
|
+
const props = __props;
|
|
2631
|
+
const emit = __emit;
|
|
2632
|
+
function requestSort(column) {
|
|
2633
|
+
if (props.loading || props.disabled || !column.sortable) return;
|
|
2634
|
+
emit("update:sort", {
|
|
2635
|
+
columnId: column.id,
|
|
2636
|
+
direction: props.sort?.columnId === column.id && props.sort.direction === "ascending" ? "descending" : "ascending"
|
|
2637
|
+
});
|
|
2638
|
+
}
|
|
2639
|
+
return (_ctx, _cache) => {
|
|
2640
|
+
return openBlock(), createElementBlock("div", {
|
|
2641
|
+
id: __props.id,
|
|
2642
|
+
class: "data-table",
|
|
2643
|
+
dir: __props.dir
|
|
2644
|
+
}, [
|
|
2645
|
+
createVNode(Table_default, {
|
|
2646
|
+
caption: __props.caption,
|
|
2647
|
+
"aria-busy": __props.loading || void 0
|
|
2648
|
+
}, {
|
|
2649
|
+
default: withCtx(() => [createElementVNode("thead", null, [createElementVNode("tr", null, [(openBlock(true), createElementBlock(Fragment, null, renderList(__props.columns, (column) => {
|
|
2650
|
+
return openBlock(), createElementBlock("th", {
|
|
2651
|
+
key: column.id,
|
|
2652
|
+
scope: "col",
|
|
2653
|
+
"aria-sort": column.sortable ? __props.sort?.columnId === column.id ? __props.sort.direction : "none" : void 0
|
|
2654
|
+
}, [column.sortable ? (openBlock(), createElementBlock("button", {
|
|
2655
|
+
key: 0,
|
|
2656
|
+
type: "button",
|
|
2657
|
+
class: "table__sort",
|
|
2658
|
+
disabled: __props.loading || __props.disabled,
|
|
2659
|
+
onClick: ($event) => requestSort(column)
|
|
2660
|
+
}, [createTextVNode(toDisplayString(column.label), 1), createElementVNode("span", _hoisted_4$10, toDisplayString(__props.sort?.columnId === column.id ? __props.sort.direction === "ascending" ? "↑" : "↓" : "↕"), 1)], 8, _hoisted_3$11)) : (openBlock(), createElementBlock(Fragment, { key: 1 }, [createTextVNode(toDisplayString(column.label), 1)], 64))], 8, _hoisted_2$13);
|
|
2661
|
+
}), 128))])]), createElementVNode("tbody", null, [(openBlock(true), createElementBlock(Fragment, null, renderList(__props.rows, (row) => {
|
|
2662
|
+
return openBlock(), createElementBlock("tr", { key: row.id }, [(openBlock(true), createElementBlock(Fragment, null, renderList(__props.columns, (column) => {
|
|
2663
|
+
return openBlock(), createElementBlock("td", { key: column.id }, [renderSlot(_ctx.$slots, "cell", {
|
|
2664
|
+
row,
|
|
2665
|
+
column,
|
|
2666
|
+
value: row.cells[column.id]
|
|
2667
|
+
}, () => [createTextVNode(toDisplayString(row.cells[column.id] ?? ""), 1)])]);
|
|
2668
|
+
}), 128))]);
|
|
2669
|
+
}), 128)), !__props.rows.length ? (openBlock(), createElementBlock("tr", _hoisted_5$6, [createElementVNode("td", {
|
|
2670
|
+
colspan: Math.max(1, __props.columns.length),
|
|
2671
|
+
class: "table__empty"
|
|
2672
|
+
}, toDisplayString(__props.loading ? __props.loadingMessage : __props.errorMessage || __props.emptyMessage), 9, _hoisted_6$5)])) : createCommentVNode("", true)])]),
|
|
2673
|
+
_: 3
|
|
2674
|
+
}, 8, ["caption", "aria-busy"]),
|
|
2675
|
+
__props.loading ? (openBlock(), createElementBlock("p", _hoisted_7$5, toDisplayString(__props.loadingMessage), 1)) : createCommentVNode("", true),
|
|
2676
|
+
__props.errorMessage && !__props.loading ? (openBlock(), createElementBlock("p", _hoisted_8$5, toDisplayString(__props.errorMessage), 1)) : createCommentVNode("", true)
|
|
2677
|
+
], 8, _hoisted_1$13);
|
|
2678
|
+
};
|
|
2679
|
+
}
|
|
2680
|
+
});
|
|
2681
|
+
//#endregion
|
|
2682
|
+
//#region src/Alert.vue?vue&type=script&setup=true&lang.ts
|
|
2683
|
+
var _hoisted_1$12 = [
|
|
2684
|
+
"id",
|
|
2685
|
+
"data-tone",
|
|
2686
|
+
"role"
|
|
2687
|
+
];
|
|
2688
|
+
var _hoisted_2$12 = { class: "alert__title" };
|
|
2689
|
+
var _hoisted_3$10 = {
|
|
2690
|
+
key: 0,
|
|
2691
|
+
class: "alert__description"
|
|
2692
|
+
};
|
|
2693
|
+
var _hoisted_4$9 = {
|
|
2694
|
+
key: 1,
|
|
2695
|
+
class: "alert__actions"
|
|
2696
|
+
};
|
|
2697
|
+
//#endregion
|
|
2698
|
+
//#region src/Alert.vue
|
|
2699
|
+
var Alert_default = /* @__PURE__ */ defineComponent({
|
|
2700
|
+
inheritAttrs: false,
|
|
2701
|
+
__name: "Alert",
|
|
2702
|
+
props: {
|
|
2703
|
+
title: {},
|
|
2704
|
+
description: { default: void 0 },
|
|
2705
|
+
tone: { default: "info" },
|
|
2706
|
+
announcement: { default: "off" },
|
|
2707
|
+
id: { default: void 0 }
|
|
2708
|
+
},
|
|
2709
|
+
setup(__props) {
|
|
2710
|
+
return (_ctx, _cache) => {
|
|
2711
|
+
return openBlock(), createElementBlock("div", {
|
|
2712
|
+
id: __props.id,
|
|
2713
|
+
class: "alert",
|
|
2714
|
+
"data-tone": __props.tone,
|
|
2715
|
+
role: __props.announcement === "polite" ? "status" : __props.announcement === "assertive" ? "alert" : void 0
|
|
2716
|
+
}, [
|
|
2717
|
+
createElementVNode("p", _hoisted_2$12, toDisplayString(__props.title), 1),
|
|
2718
|
+
__props.description ? (openBlock(), createElementBlock("p", _hoisted_3$10, toDisplayString(__props.description), 1)) : createCommentVNode("", true),
|
|
2719
|
+
renderSlot(_ctx.$slots, "default"),
|
|
2720
|
+
_ctx.$slots.actions ? (openBlock(), createElementBlock("div", _hoisted_4$9, [renderSlot(_ctx.$slots, "actions")])) : createCommentVNode("", true)
|
|
2721
|
+
], 8, _hoisted_1$12);
|
|
2722
|
+
};
|
|
2723
|
+
}
|
|
2724
|
+
});
|
|
2725
|
+
//#endregion
|
|
2726
|
+
//#region src/Empty.vue?vue&type=script&setup=true&lang.ts
|
|
2727
|
+
var _hoisted_1$11 = ["id"];
|
|
2728
|
+
var _hoisted_2$11 = {
|
|
2729
|
+
key: 0,
|
|
2730
|
+
class: "empty__description"
|
|
2731
|
+
};
|
|
2732
|
+
var _hoisted_3$9 = {
|
|
2733
|
+
key: 1,
|
|
2734
|
+
class: "empty__actions"
|
|
2735
|
+
};
|
|
2736
|
+
//#endregion
|
|
2737
|
+
//#region src/Empty.vue
|
|
2738
|
+
var Empty_default = /* @__PURE__ */ defineComponent({
|
|
2739
|
+
inheritAttrs: false,
|
|
2740
|
+
__name: "Empty",
|
|
2741
|
+
props: {
|
|
2742
|
+
title: {},
|
|
2743
|
+
description: { default: void 0 },
|
|
2744
|
+
headingLevel: { default: 3 },
|
|
2745
|
+
id: { default: void 0 }
|
|
2746
|
+
},
|
|
2747
|
+
setup(__props) {
|
|
2748
|
+
return (_ctx, _cache) => {
|
|
2749
|
+
return openBlock(), createElementBlock("div", {
|
|
2750
|
+
id: __props.id,
|
|
2751
|
+
class: "empty"
|
|
2752
|
+
}, [
|
|
2753
|
+
(openBlock(), createBlock(resolveDynamicComponent(`h${__props.headingLevel}`), { class: "empty__title" }, {
|
|
2754
|
+
default: withCtx(() => [createTextVNode(toDisplayString(__props.title), 1)]),
|
|
2755
|
+
_: 1
|
|
2756
|
+
})),
|
|
2757
|
+
__props.description ? (openBlock(), createElementBlock("p", _hoisted_2$11, toDisplayString(__props.description), 1)) : createCommentVNode("", true),
|
|
2758
|
+
renderSlot(_ctx.$slots, "default"),
|
|
2759
|
+
_ctx.$slots.actions ? (openBlock(), createElementBlock("div", _hoisted_3$9, [renderSlot(_ctx.$slots, "actions")])) : createCommentVNode("", true)
|
|
2760
|
+
], 8, _hoisted_1$11);
|
|
2761
|
+
};
|
|
2762
|
+
}
|
|
2763
|
+
});
|
|
2764
|
+
//#endregion
|
|
2765
|
+
//#region src/Breadcrumb.vue?vue&type=script&setup=true&lang.ts
|
|
2766
|
+
var _hoisted_1$10 = [
|
|
2767
|
+
"id",
|
|
2768
|
+
"aria-label",
|
|
2769
|
+
"dir"
|
|
2770
|
+
];
|
|
2771
|
+
var _hoisted_2$10 = {
|
|
2772
|
+
key: 0,
|
|
2773
|
+
class: "breadcrumb__separator",
|
|
2774
|
+
"aria-hidden": "true"
|
|
2775
|
+
};
|
|
2776
|
+
var _hoisted_3$8 = {
|
|
2777
|
+
key: 1,
|
|
2778
|
+
"aria-current": "page"
|
|
2779
|
+
};
|
|
2780
|
+
var _hoisted_4$8 = ["href"];
|
|
2781
|
+
var _hoisted_5$5 = { key: 3 };
|
|
2782
|
+
//#endregion
|
|
2783
|
+
//#region src/Breadcrumb.vue
|
|
2784
|
+
var Breadcrumb_default = /* @__PURE__ */ defineComponent({
|
|
2785
|
+
inheritAttrs: false,
|
|
2786
|
+
__name: "Breadcrumb",
|
|
2787
|
+
props: {
|
|
2788
|
+
items: {},
|
|
2789
|
+
label: { default: "Jejak halaman" },
|
|
2790
|
+
dir: { default: void 0 },
|
|
2791
|
+
id: { default: void 0 }
|
|
2792
|
+
},
|
|
2793
|
+
setup(__props) {
|
|
2794
|
+
return (_ctx, _cache) => {
|
|
2795
|
+
return openBlock(), createElementBlock("nav", {
|
|
2796
|
+
id: __props.id,
|
|
2797
|
+
class: "breadcrumb",
|
|
2798
|
+
"aria-label": __props.label,
|
|
2799
|
+
dir: __props.dir
|
|
2800
|
+
}, [createElementVNode("ol", null, [(openBlock(true), createElementBlock(Fragment, null, renderList(__props.items, (item, index) => {
|
|
2801
|
+
return openBlock(), createElementBlock("li", { key: index }, [index > 0 ? (openBlock(), createElementBlock("span", _hoisted_2$10, "/")) : createCommentVNode("", true), index === __props.items.length - 1 ? (openBlock(), createElementBlock("span", _hoisted_3$8, toDisplayString(item.label), 1)) : item.href ? (openBlock(), createElementBlock("a", {
|
|
2802
|
+
key: 2,
|
|
2803
|
+
href: item.href
|
|
2804
|
+
}, toDisplayString(item.label), 9, _hoisted_4$8)) : (openBlock(), createElementBlock("span", _hoisted_5$5, toDisplayString(item.label), 1))]);
|
|
2805
|
+
}), 128))])], 8, _hoisted_1$10);
|
|
2806
|
+
};
|
|
2807
|
+
}
|
|
2808
|
+
});
|
|
2809
|
+
//#endregion
|
|
2810
|
+
//#region src/useDisclosure.ts
|
|
2811
|
+
function useDisclosure(props, emit) {
|
|
2812
|
+
const local = ref(props.defaultOpen ?? false);
|
|
2813
|
+
const visible = computed(() => props.open ?? local.value);
|
|
2814
|
+
function change(next) {
|
|
2815
|
+
if (next === visible.value) return;
|
|
2816
|
+
local.value = next;
|
|
2817
|
+
emit(next);
|
|
2818
|
+
}
|
|
2819
|
+
return {
|
|
2820
|
+
visible,
|
|
2821
|
+
change
|
|
2822
|
+
};
|
|
2823
|
+
}
|
|
2824
|
+
//#endregion
|
|
2825
|
+
//#region src/Sidebar.vue?vue&type=script&setup=true&lang.ts
|
|
2826
|
+
var _hoisted_1$9 = ["id", "dir"];
|
|
2827
|
+
var _hoisted_2$9 = { class: "sidebar__header" };
|
|
2828
|
+
var _hoisted_3$7 = { class: "sidebar__title" };
|
|
2829
|
+
var _hoisted_4$7 = [
|
|
2830
|
+
"aria-label",
|
|
2831
|
+
"aria-expanded",
|
|
2832
|
+
"aria-controls"
|
|
2833
|
+
];
|
|
2834
|
+
var _hoisted_5$4 = { "aria-hidden": "true" };
|
|
2835
|
+
var _hoisted_6$4 = [
|
|
2836
|
+
"id",
|
|
2837
|
+
"aria-label",
|
|
2838
|
+
"hidden"
|
|
2839
|
+
];
|
|
2840
|
+
var _hoisted_7$4 = {
|
|
2841
|
+
key: 0,
|
|
2842
|
+
class: "sidebar__link",
|
|
2843
|
+
"aria-disabled": "true"
|
|
2844
|
+
};
|
|
2845
|
+
var _hoisted_8$4 = ["href", "aria-current"];
|
|
2846
|
+
//#endregion
|
|
2847
|
+
//#region src/Sidebar.vue
|
|
2848
|
+
var Sidebar_default = /* @__PURE__ */ defineComponent({
|
|
2849
|
+
inheritAttrs: false,
|
|
2850
|
+
__name: "Sidebar",
|
|
2851
|
+
props: {
|
|
2852
|
+
label: {},
|
|
2853
|
+
items: {},
|
|
2854
|
+
currentId: { default: void 0 },
|
|
2855
|
+
open: {
|
|
2856
|
+
type: Boolean,
|
|
2857
|
+
default: void 0
|
|
2858
|
+
},
|
|
2859
|
+
defaultOpen: {
|
|
2860
|
+
type: Boolean,
|
|
2861
|
+
default: true
|
|
2862
|
+
},
|
|
2863
|
+
toggleLabel: { default: "Menu navigasi" },
|
|
2864
|
+
dir: { default: void 0 },
|
|
2865
|
+
id: { default: void 0 }
|
|
2866
|
+
},
|
|
2867
|
+
emits: ["update:open"],
|
|
2868
|
+
setup(__props, { emit: __emit }) {
|
|
2869
|
+
const props = __props;
|
|
2870
|
+
const emit = __emit;
|
|
2871
|
+
const { visible, change } = useDisclosure(props, (next) => emit("update:open", next));
|
|
2872
|
+
const generated = useId(), navId = computed(() => `${props.id ?? generated}-nav`);
|
|
2873
|
+
return (_ctx, _cache) => {
|
|
2874
|
+
return openBlock(), createElementBlock("aside", {
|
|
2875
|
+
id: __props.id,
|
|
2876
|
+
class: "sidebar",
|
|
2877
|
+
dir: __props.dir
|
|
2878
|
+
}, [createElementVNode("div", _hoisted_2$9, [createElementVNode("span", _hoisted_3$7, toDisplayString(__props.label), 1), createElementVNode("button", {
|
|
2879
|
+
type: "button",
|
|
2880
|
+
class: "sidebar__toggle",
|
|
2881
|
+
"aria-label": __props.toggleLabel,
|
|
2882
|
+
"aria-expanded": unref(visible),
|
|
2883
|
+
"aria-controls": navId.value,
|
|
2884
|
+
onClick: _cache[0] || (_cache[0] = ($event) => unref(change)(!unref(visible)))
|
|
2885
|
+
}, [createElementVNode("span", _hoisted_5$4, toDisplayString(unref(visible) ? "−" : "+"), 1)], 8, _hoisted_4$7)]), createElementVNode("nav", {
|
|
2886
|
+
id: navId.value,
|
|
2887
|
+
"aria-label": __props.label,
|
|
2888
|
+
hidden: !unref(visible)
|
|
2889
|
+
}, [createElementVNode("ul", null, [(openBlock(true), createElementBlock(Fragment, null, renderList(__props.items, (item) => {
|
|
2890
|
+
return openBlock(), createElementBlock("li", { key: item.id }, [item.isDisabled ? (openBlock(), createElementBlock("span", _hoisted_7$4, toDisplayString(item.label), 1)) : (openBlock(), createElementBlock("a", {
|
|
2891
|
+
key: 1,
|
|
2892
|
+
class: "sidebar__link",
|
|
2893
|
+
href: item.href,
|
|
2894
|
+
"aria-current": item.id === __props.currentId ? "page" : void 0
|
|
2895
|
+
}, toDisplayString(item.label), 9, _hoisted_8$4))]);
|
|
2896
|
+
}), 128))])], 8, _hoisted_6$4)], 8, _hoisted_1$9);
|
|
2897
|
+
};
|
|
2898
|
+
}
|
|
2899
|
+
});
|
|
2900
|
+
//#endregion
|
|
2901
|
+
//#region src/chart-model.ts
|
|
2902
|
+
function chartModel(data) {
|
|
2903
|
+
const valid = data.filter((item) => Number.isFinite(item.value));
|
|
2904
|
+
const scale = valid.reduce((max, item) => Math.max(max, Math.abs(item.value)), 1);
|
|
2905
|
+
const min = valid.reduce((min, item) => Math.min(min, item.value / scale), 0);
|
|
2906
|
+
const span = valid.reduce((max, item) => Math.max(max, item.value / scale), 0) - min || 1, step = 560 / Math.max(1, valid.length);
|
|
2907
|
+
const y = (value) => 180 - (value / scale - min) / span * 160;
|
|
2908
|
+
return {
|
|
2909
|
+
items: valid.map((item, index) => ({
|
|
2910
|
+
...item,
|
|
2911
|
+
x: 20 + step * (index + .5),
|
|
2912
|
+
y: y(item.value)
|
|
2913
|
+
})),
|
|
2914
|
+
baseline: y(0),
|
|
2915
|
+
barWidth: Math.min(40, step * .7)
|
|
2916
|
+
};
|
|
2917
|
+
}
|
|
2918
|
+
//#endregion
|
|
2919
|
+
//#region src/Chart.vue?vue&type=script&setup=true&lang.ts
|
|
2920
|
+
var _hoisted_1$8 = [
|
|
2921
|
+
"id",
|
|
2922
|
+
"dir",
|
|
2923
|
+
"aria-labelledby"
|
|
2924
|
+
];
|
|
2925
|
+
var _hoisted_2$8 = ["id"];
|
|
2926
|
+
var _hoisted_3$6 = {
|
|
2927
|
+
key: 0,
|
|
2928
|
+
class: "chart__description"
|
|
2929
|
+
};
|
|
2930
|
+
var _hoisted_4$6 = {
|
|
2931
|
+
class: "chart__plot",
|
|
2932
|
+
viewBox: "0 0 600 210",
|
|
2933
|
+
"aria-hidden": "true",
|
|
2934
|
+
focusable: "false"
|
|
2935
|
+
};
|
|
2936
|
+
var _hoisted_5$3 = ["y1", "y2"];
|
|
2937
|
+
var _hoisted_6$3 = ["points"];
|
|
2938
|
+
var _hoisted_7$3 = [
|
|
2939
|
+
"x",
|
|
2940
|
+
"y",
|
|
2941
|
+
"width",
|
|
2942
|
+
"height"
|
|
2943
|
+
];
|
|
2944
|
+
var _hoisted_8$3 = ["cx", "cy"];
|
|
2945
|
+
var _hoisted_9$3 = ["x"];
|
|
2946
|
+
var _hoisted_10$2 = { scope: "col" };
|
|
2947
|
+
var _hoisted_11$1 = { scope: "col" };
|
|
2948
|
+
var _hoisted_12$1 = { scope: "row" };
|
|
2949
|
+
//#endregion
|
|
2950
|
+
//#region src/Chart.vue
|
|
2951
|
+
var Chart_default = /* @__PURE__ */ defineComponent({
|
|
2952
|
+
inheritAttrs: false,
|
|
2953
|
+
__name: "Chart",
|
|
2954
|
+
props: {
|
|
2955
|
+
label: {},
|
|
2956
|
+
data: {},
|
|
2957
|
+
type: { default: "bar" },
|
|
2958
|
+
description: { default: void 0 },
|
|
2959
|
+
locale: { default: "id-ID" },
|
|
2960
|
+
formatOptions: { default: void 0 },
|
|
2961
|
+
categoryLabel: { default: "Kategori" },
|
|
2962
|
+
valueLabel: { default: "Nilai" },
|
|
2963
|
+
emptyMessage: { default: "Belum ada data grafik." },
|
|
2964
|
+
id: { default: void 0 },
|
|
2965
|
+
dir: { default: void 0 }
|
|
2966
|
+
},
|
|
2967
|
+
setup(__props) {
|
|
2968
|
+
const props = __props;
|
|
2969
|
+
const generated = useId(), labelId = computed(() => `${props.id ?? generated}-label`), model = computed(() => chartModel(props.data)), format = computed(() => new Intl.NumberFormat(props.locale, props.formatOptions));
|
|
2970
|
+
const points = computed(() => model.value.items.map((item) => `${item.x},${item.y}`).join(" "));
|
|
2971
|
+
return (_ctx, _cache) => {
|
|
2972
|
+
return openBlock(), createElementBlock("figure", {
|
|
2973
|
+
id: __props.id,
|
|
2974
|
+
class: "chart",
|
|
2975
|
+
dir: __props.dir,
|
|
2976
|
+
"aria-labelledby": labelId.value
|
|
2977
|
+
}, [
|
|
2978
|
+
createElementVNode("figcaption", {
|
|
2979
|
+
id: labelId.value,
|
|
2980
|
+
class: "chart__title"
|
|
2981
|
+
}, toDisplayString(__props.label), 9, _hoisted_2$8),
|
|
2982
|
+
__props.description ? (openBlock(), createElementBlock("p", _hoisted_3$6, toDisplayString(__props.description), 1)) : createCommentVNode("", true),
|
|
2983
|
+
model.value.items.length ? (openBlock(), createElementBlock(Fragment, { key: 1 }, [(openBlock(), createElementBlock("svg", _hoisted_4$6, [
|
|
2984
|
+
createElementVNode("line", {
|
|
2985
|
+
class: "chart__axis",
|
|
2986
|
+
x1: "20",
|
|
2987
|
+
x2: "580",
|
|
2988
|
+
y1: model.value.baseline,
|
|
2989
|
+
y2: model.value.baseline
|
|
2990
|
+
}, null, 8, _hoisted_5$3),
|
|
2991
|
+
__props.type === "line" ? (openBlock(), createElementBlock("polyline", {
|
|
2992
|
+
key: 0,
|
|
2993
|
+
class: "chart__line",
|
|
2994
|
+
points: points.value
|
|
2995
|
+
}, null, 8, _hoisted_6$3)) : createCommentVNode("", true),
|
|
2996
|
+
(openBlock(true), createElementBlock(Fragment, null, renderList(model.value.items, (item) => {
|
|
2997
|
+
return openBlock(), createElementBlock("g", { key: item.id }, [__props.type === "bar" ? (openBlock(), createElementBlock("rect", {
|
|
2998
|
+
key: 0,
|
|
2999
|
+
class: "chart__bar",
|
|
3000
|
+
x: item.x - model.value.barWidth / 2,
|
|
3001
|
+
y: Math.min(item.y, model.value.baseline),
|
|
3002
|
+
width: model.value.barWidth,
|
|
3003
|
+
height: Math.abs(item.y - model.value.baseline)
|
|
3004
|
+
}, null, 8, _hoisted_7$3)) : (openBlock(), createElementBlock("circle", {
|
|
3005
|
+
key: 1,
|
|
3006
|
+
class: "chart__bar",
|
|
3007
|
+
cx: item.x,
|
|
3008
|
+
cy: item.y,
|
|
3009
|
+
r: "4"
|
|
3010
|
+
}, null, 8, _hoisted_8$3)), model.value.items.length <= 12 ? (openBlock(), createElementBlock("text", {
|
|
3011
|
+
key: 2,
|
|
3012
|
+
class: "chart__label",
|
|
3013
|
+
x: item.x,
|
|
3014
|
+
y: "202",
|
|
3015
|
+
"text-anchor": "middle"
|
|
3016
|
+
}, toDisplayString(item.label.slice(0, 12)), 9, _hoisted_9$3)) : createCommentVNode("", true)]);
|
|
3017
|
+
}), 128))
|
|
3018
|
+
])), createVNode(Table_default, { caption: __props.label }, {
|
|
3019
|
+
default: withCtx(() => [createElementVNode("thead", null, [createElementVNode("tr", null, [createElementVNode("th", _hoisted_10$2, toDisplayString(__props.categoryLabel), 1), createElementVNode("th", _hoisted_11$1, toDisplayString(__props.valueLabel), 1)])]), createElementVNode("tbody", null, [(openBlock(true), createElementBlock(Fragment, null, renderList(model.value.items, (item) => {
|
|
3020
|
+
return openBlock(), createElementBlock("tr", { key: item.id }, [createElementVNode("th", _hoisted_12$1, toDisplayString(item.label), 1), createElementVNode("td", null, toDisplayString(format.value.format(item.value)), 1)]);
|
|
3021
|
+
}), 128))])]),
|
|
3022
|
+
_: 1
|
|
3023
|
+
}, 8, ["caption"])], 64)) : (openBlock(), createBlock(Empty_default, {
|
|
3024
|
+
key: 2,
|
|
3025
|
+
title: __props.emptyMessage
|
|
3026
|
+
}, null, 8, ["title"]))
|
|
3027
|
+
], 8, _hoisted_1$8);
|
|
3028
|
+
};
|
|
3029
|
+
}
|
|
3030
|
+
});
|
|
3031
|
+
//#endregion
|
|
3032
|
+
//#region src/Dialog.vue?vue&type=script&setup=true&lang.ts
|
|
3033
|
+
var _hoisted_1$7 = { class: "dialog__content" };
|
|
3034
|
+
var _hoisted_2$7 = ["data-close-button"];
|
|
3035
|
+
var _hoisted_3$5 = { class: "overlay__body" };
|
|
3036
|
+
var _hoisted_4$5 = {
|
|
3037
|
+
key: 0,
|
|
3038
|
+
class: "overlay__footer"
|
|
3039
|
+
};
|
|
3040
|
+
//#endregion
|
|
3041
|
+
//#region src/Dialog.vue
|
|
3042
|
+
var Dialog_default = /* @__PURE__ */ defineComponent({
|
|
3043
|
+
inheritAttrs: false,
|
|
3044
|
+
__name: "Dialog",
|
|
3045
|
+
props: {
|
|
3046
|
+
triggerLabel: {},
|
|
3047
|
+
title: {},
|
|
3048
|
+
description: { default: void 0 },
|
|
3049
|
+
open: {
|
|
3050
|
+
type: Boolean,
|
|
3051
|
+
default: void 0
|
|
3052
|
+
},
|
|
3053
|
+
defaultOpen: {
|
|
3054
|
+
type: Boolean,
|
|
3055
|
+
default: false
|
|
3056
|
+
},
|
|
3057
|
+
disabled: {
|
|
3058
|
+
type: Boolean,
|
|
3059
|
+
default: false
|
|
3060
|
+
},
|
|
3061
|
+
closeLabel: { default: "Tutup" },
|
|
3062
|
+
dir: { default: void 0 },
|
|
3063
|
+
triggerIconOnly: { type: Boolean },
|
|
3064
|
+
triggerVariant: { default: "secondary" },
|
|
3065
|
+
size: { default: "md" },
|
|
3066
|
+
placement: { default: "center" },
|
|
3067
|
+
scroll: { default: "outside" },
|
|
3068
|
+
backdrop: { default: "opaque" },
|
|
3069
|
+
dismissable: {
|
|
3070
|
+
type: Boolean,
|
|
3071
|
+
default: true
|
|
3072
|
+
},
|
|
3073
|
+
keyboardDismissDisabled: {
|
|
3074
|
+
type: Boolean,
|
|
3075
|
+
default: false
|
|
3076
|
+
},
|
|
3077
|
+
showCloseButton: {
|
|
3078
|
+
type: Boolean,
|
|
3079
|
+
default: true
|
|
3080
|
+
},
|
|
3081
|
+
showFooterClose: {
|
|
3082
|
+
type: Boolean,
|
|
3083
|
+
default: true
|
|
3084
|
+
},
|
|
3085
|
+
closeIconLabel: { default: void 0 }
|
|
3086
|
+
},
|
|
3087
|
+
emits: ["update:open"],
|
|
3088
|
+
setup(__props, { emit: __emit }) {
|
|
3089
|
+
const props = __props;
|
|
3090
|
+
const emit = __emit;
|
|
3091
|
+
const { visible, change } = useDisclosure(props, (next) => emit("update:open", next));
|
|
3092
|
+
return (_ctx, _cache) => {
|
|
3093
|
+
return openBlock(), createBlock(unref(DialogRoot), {
|
|
3094
|
+
open: unref(visible),
|
|
3095
|
+
"onUpdate:open": unref(change)
|
|
3096
|
+
}, {
|
|
3097
|
+
default: withCtx(() => [createVNode(unref(DialogTrigger), {
|
|
3098
|
+
class: normalizeClass([
|
|
3099
|
+
"button",
|
|
3100
|
+
`button--${__props.triggerVariant}`,
|
|
3101
|
+
__props.triggerIconOnly && "button--icon-only"
|
|
3102
|
+
]),
|
|
3103
|
+
"aria-label": __props.triggerLabel,
|
|
3104
|
+
disabled: __props.disabled
|
|
3105
|
+
}, {
|
|
3106
|
+
default: withCtx(() => [renderSlot(_ctx.$slots, "trigger", {}, () => [createTextVNode(toDisplayString(__props.triggerLabel), 1)])]),
|
|
3107
|
+
_: 3
|
|
3108
|
+
}, 8, [
|
|
3109
|
+
"class",
|
|
3110
|
+
"aria-label",
|
|
3111
|
+
"disabled"
|
|
3112
|
+
]), createVNode(unref(DialogPortal), null, {
|
|
3113
|
+
default: withCtx(() => [createVNode(unref(DialogOverlay), {
|
|
3114
|
+
class: "dialog__backdrop dialog__viewport",
|
|
3115
|
+
"data-size": __props.size,
|
|
3116
|
+
"data-placement": __props.placement,
|
|
3117
|
+
"data-scroll": __props.scroll,
|
|
3118
|
+
"data-backdrop": __props.backdrop
|
|
3119
|
+
}, {
|
|
3120
|
+
default: withCtx(() => [createVNode(unref(DialogContent), mergeProps({
|
|
3121
|
+
class: "dialog__panel",
|
|
3122
|
+
dir: __props.dir
|
|
3123
|
+
}, __props.description ? {} : { "aria-describedby": void 0 }, {
|
|
3124
|
+
onEscapeKeyDown: _cache[0] || (_cache[0] = (event) => {
|
|
3125
|
+
if (__props.keyboardDismissDisabled) event.preventDefault();
|
|
3126
|
+
}),
|
|
3127
|
+
onInteractOutside: _cache[1] || (_cache[1] = (event) => {
|
|
3128
|
+
if (!__props.dismissable) event.preventDefault();
|
|
3129
|
+
})
|
|
3130
|
+
}), {
|
|
3131
|
+
default: withCtx(() => [createElementVNode("div", _hoisted_1$7, [
|
|
3132
|
+
createElementVNode("div", {
|
|
3133
|
+
class: "overlay__header",
|
|
3134
|
+
"data-close-button": __props.showCloseButton || void 0
|
|
3135
|
+
}, [
|
|
3136
|
+
createVNode(unref(DialogTitle), { class: "overlay__title" }, {
|
|
3137
|
+
default: withCtx(() => [createTextVNode(toDisplayString(__props.title), 1)]),
|
|
3138
|
+
_: 1
|
|
3139
|
+
}),
|
|
3140
|
+
__props.description ? (openBlock(), createBlock(unref(DialogDescription), {
|
|
3141
|
+
key: 0,
|
|
3142
|
+
class: "overlay__description"
|
|
3143
|
+
}, {
|
|
3144
|
+
default: withCtx(() => [createTextVNode(toDisplayString(__props.description), 1)]),
|
|
3145
|
+
_: 1
|
|
3146
|
+
})) : createCommentVNode("", true),
|
|
3147
|
+
__props.showCloseButton ? (openBlock(), createBlock(unref(DialogClose), {
|
|
3148
|
+
key: 1,
|
|
3149
|
+
class: "dialog__close",
|
|
3150
|
+
"aria-label": __props.closeIconLabel ?? `${__props.closeLabel} dialog`
|
|
3151
|
+
}, {
|
|
3152
|
+
default: withCtx(() => [createVNode(CloseIcon_default)]),
|
|
3153
|
+
_: 1
|
|
3154
|
+
}, 8, ["aria-label"])) : createCommentVNode("", true)
|
|
3155
|
+
], 8, _hoisted_2$7),
|
|
3156
|
+
createElementVNode("div", _hoisted_3$5, [renderSlot(_ctx.$slots, "default")]),
|
|
3157
|
+
_ctx.$slots.footer || __props.showFooterClose ? (openBlock(), createElementBlock("div", _hoisted_4$5, [renderSlot(_ctx.$slots, "footer"), __props.showFooterClose ? (openBlock(), createBlock(unref(DialogClose), {
|
|
3158
|
+
key: 0,
|
|
3159
|
+
class: "button button--secondary"
|
|
3160
|
+
}, {
|
|
3161
|
+
default: withCtx(() => [createTextVNode(toDisplayString(__props.closeLabel), 1)]),
|
|
3162
|
+
_: 1
|
|
3163
|
+
})) : createCommentVNode("", true)])) : createCommentVNode("", true)
|
|
3164
|
+
])]),
|
|
3165
|
+
_: 3
|
|
3166
|
+
}, 16, ["dir"])]),
|
|
3167
|
+
_: 3
|
|
3168
|
+
}, 8, [
|
|
3169
|
+
"data-size",
|
|
3170
|
+
"data-placement",
|
|
3171
|
+
"data-scroll",
|
|
3172
|
+
"data-backdrop"
|
|
3173
|
+
])]),
|
|
3174
|
+
_: 3
|
|
3175
|
+
})]),
|
|
3176
|
+
_: 3
|
|
3177
|
+
}, 8, ["open", "onUpdate:open"]);
|
|
3178
|
+
};
|
|
3179
|
+
}
|
|
3180
|
+
});
|
|
3181
|
+
//#endregion
|
|
3182
|
+
//#region src/MenuItemContent.vue?vue&type=script&setup=true&lang.ts
|
|
3183
|
+
var _hoisted_1$6 = {
|
|
3184
|
+
key: 1,
|
|
3185
|
+
class: "menu__icon",
|
|
3186
|
+
"aria-hidden": "true"
|
|
3187
|
+
};
|
|
3188
|
+
var _hoisted_2$6 = { class: "menu__text" };
|
|
3189
|
+
var _hoisted_3$4 = {
|
|
3190
|
+
key: 0,
|
|
3191
|
+
class: "menu__description"
|
|
3192
|
+
};
|
|
3193
|
+
var _hoisted_4$4 = {
|
|
3194
|
+
key: 2,
|
|
3195
|
+
class: "menu__shortcut",
|
|
3196
|
+
"aria-hidden": "true"
|
|
3197
|
+
};
|
|
3198
|
+
//#endregion
|
|
3199
|
+
//#region src/MenuItemContent.vue
|
|
3200
|
+
var MenuItemContent_default = /* @__PURE__ */ defineComponent({
|
|
3201
|
+
__name: "MenuItemContent",
|
|
3202
|
+
props: {
|
|
3203
|
+
item: {},
|
|
3204
|
+
selectable: { type: Boolean }
|
|
3205
|
+
},
|
|
3206
|
+
setup(__props) {
|
|
3207
|
+
return (_ctx, _cache) => {
|
|
3208
|
+
return openBlock(), createElementBlock(Fragment, null, [
|
|
3209
|
+
__props.selectable && !__props.item.children?.length ? (openBlock(), createBlock(CheckIcon_default, {
|
|
3210
|
+
key: 0,
|
|
3211
|
+
class: "menu__check"
|
|
3212
|
+
})) : createCommentVNode("", true),
|
|
3213
|
+
_ctx.$slots.icon ? (openBlock(), createElementBlock("span", _hoisted_1$6, [renderSlot(_ctx.$slots, "icon", { item: __props.item })])) : createCommentVNode("", true),
|
|
3214
|
+
createElementVNode("span", _hoisted_2$6, [createElementVNode("span", null, toDisplayString(__props.item.label), 1), __props.item.description ? (openBlock(), createElementBlock("span", _hoisted_3$4, toDisplayString(__props.item.description), 1)) : createCommentVNode("", true)]),
|
|
3215
|
+
__props.item.shortcut ? (openBlock(), createElementBlock("kbd", _hoisted_4$4, toDisplayString(__props.item.shortcut), 1)) : createCommentVNode("", true),
|
|
3216
|
+
__props.item.children?.length ? (openBlock(), createBlock(ChevronIcon_default, {
|
|
3217
|
+
key: 3,
|
|
3218
|
+
class: "menu__arrow"
|
|
3219
|
+
})) : createCommentVNode("", true)
|
|
3220
|
+
], 64);
|
|
3221
|
+
};
|
|
3222
|
+
}
|
|
3223
|
+
});
|
|
3224
|
+
//#endregion
|
|
3225
|
+
//#region src/overlay-model.ts
|
|
3226
|
+
function menuGroups(items) {
|
|
3227
|
+
const groups = [];
|
|
3228
|
+
for (const item of items) {
|
|
3229
|
+
const previous = groups.at(-1);
|
|
3230
|
+
if (!previous || previous.label !== item.section || item.separatorBefore) groups.push({
|
|
3231
|
+
key: item.id,
|
|
3232
|
+
label: item.section,
|
|
3233
|
+
items: [item]
|
|
3234
|
+
});
|
|
3235
|
+
else previous.items.push(item);
|
|
3236
|
+
}
|
|
3237
|
+
return groups;
|
|
3238
|
+
}
|
|
3239
|
+
function menuLeaves(items, disabled = false) {
|
|
3240
|
+
return items.flatMap((item) => item.children?.length ? menuLeaves(item.children, disabled || !!item.isDisabled) : [{
|
|
3241
|
+
...item,
|
|
3242
|
+
isDisabled: disabled || item.isDisabled
|
|
3243
|
+
}]);
|
|
3244
|
+
}
|
|
3245
|
+
function menuSelection(keys, items, mode) {
|
|
3246
|
+
const wanted = new Set(keys);
|
|
3247
|
+
const result = menuLeaves(items).filter((item) => wanted.has(item.id)).map((item) => item.id);
|
|
3248
|
+
return mode === "none" ? [] : mode === "single" ? result.slice(0, 1) : result;
|
|
3249
|
+
}
|
|
3250
|
+
//#endregion
|
|
3251
|
+
//#region src/DropdownMenuBranch.vue
|
|
3252
|
+
var DropdownMenuBranch_default = /* @__PURE__ */ defineComponent({
|
|
3253
|
+
__name: "DropdownMenuBranch",
|
|
3254
|
+
props: {
|
|
3255
|
+
items: {},
|
|
3256
|
+
selectedKeys: {},
|
|
3257
|
+
selectionMode: {},
|
|
3258
|
+
closeOnSelect: { type: Boolean },
|
|
3259
|
+
disabled: { type: Boolean },
|
|
3260
|
+
dir: {}
|
|
3261
|
+
},
|
|
3262
|
+
emits: ["action", "selection"],
|
|
3263
|
+
setup(__props, { emit: __emit }) {
|
|
3264
|
+
const props = __props;
|
|
3265
|
+
const emit = __emit;
|
|
3266
|
+
const groups = computed(() => menuGroups(props.items));
|
|
3267
|
+
function keepParentMenuFocus(event) {
|
|
3268
|
+
if (event.target instanceof HTMLElement && event.target.getAttribute("role") === "menu") event.preventDefault();
|
|
3269
|
+
}
|
|
3270
|
+
function action(event, item) {
|
|
3271
|
+
if (props.disabled || item.isDisabled) {
|
|
3272
|
+
event.preventDefault();
|
|
3273
|
+
return;
|
|
3274
|
+
}
|
|
3275
|
+
if (!props.closeOnSelect) event.preventDefault();
|
|
3276
|
+
emit("action", item.id);
|
|
3277
|
+
}
|
|
3278
|
+
return (_ctx, _cache) => {
|
|
3279
|
+
const _component_DropdownMenuBranch = resolveComponent("DropdownMenuBranch", true);
|
|
3280
|
+
return openBlock(), createBlock(unref(DropdownMenuRadioGroup), {
|
|
3281
|
+
"model-value": __props.selectedKeys[0] ?? "",
|
|
3282
|
+
"onUpdate:modelValue": _cache[2] || (_cache[2] = (value) => {
|
|
3283
|
+
if (__props.selectionMode === "single" && typeof value === "string") emit("selection", value, true);
|
|
3284
|
+
})
|
|
3285
|
+
}, {
|
|
3286
|
+
default: withCtx(() => [(openBlock(true), createElementBlock(Fragment, null, renderList(groups.value, (group, index) => {
|
|
3287
|
+
return openBlock(), createElementBlock(Fragment, { key: group.key }, [index > 0 ? (openBlock(), createBlock(unref(DropdownMenuSeparator), {
|
|
3288
|
+
key: 0,
|
|
3289
|
+
class: "menu__separator"
|
|
3290
|
+
})) : createCommentVNode("", true), createVNode(unref(DropdownMenuGroup), { "aria-label": group.label }, {
|
|
3291
|
+
default: withCtx(() => [group.label ? (openBlock(), createBlock(unref(DropdownMenuLabel), {
|
|
3292
|
+
key: 0,
|
|
3293
|
+
class: "menu__heading"
|
|
3294
|
+
}, {
|
|
3295
|
+
default: withCtx(() => [createTextVNode(toDisplayString(group.label), 1)]),
|
|
3296
|
+
_: 2
|
|
3297
|
+
}, 1024)) : createCommentVNode("", true), (openBlock(true), createElementBlock(Fragment, null, renderList(group.items, (item) => {
|
|
3298
|
+
return openBlock(), createElementBlock(Fragment, { key: item.id }, [item.children?.length ? (openBlock(), createBlock(unref(DropdownMenuSub), { key: 0 }, {
|
|
3299
|
+
default: withCtx(() => [createVNode(unref(DropdownMenuSubTrigger), {
|
|
3300
|
+
class: "menu__item",
|
|
3301
|
+
disabled: __props.disabled || item.isDisabled,
|
|
3302
|
+
"text-value": item.label,
|
|
3303
|
+
"data-tone": item.tone ?? "default"
|
|
3304
|
+
}, {
|
|
3305
|
+
default: withCtx(() => [createVNode(MenuItemContent_default, {
|
|
3306
|
+
item,
|
|
3307
|
+
selectable: false
|
|
3308
|
+
}, createSlots({ _: 2 }, [_ctx.$slots.icon ? {
|
|
3309
|
+
name: "icon",
|
|
3310
|
+
fn: withCtx((slot) => [renderSlot(_ctx.$slots, "icon", mergeProps({ ref_for: true }, slot))]),
|
|
3311
|
+
key: "0"
|
|
3312
|
+
} : void 0]), 1032, ["item"])]),
|
|
3313
|
+
_: 2
|
|
3314
|
+
}, 1032, [
|
|
3315
|
+
"disabled",
|
|
3316
|
+
"text-value",
|
|
3317
|
+
"data-tone"
|
|
3318
|
+
]), createVNode(unref(DropdownMenuPortal), null, {
|
|
3319
|
+
default: withCtx(() => [createVNode(unref(DropdownMenuSubContent), {
|
|
3320
|
+
class: "menu__panel menu__list",
|
|
3321
|
+
"aria-label": item.label,
|
|
3322
|
+
"side-offset": 4,
|
|
3323
|
+
"collision-padding": 16,
|
|
3324
|
+
dir: __props.dir,
|
|
3325
|
+
onFocusOutside: keepParentMenuFocus
|
|
3326
|
+
}, {
|
|
3327
|
+
default: withCtx(() => [createVNode(_component_DropdownMenuBranch, {
|
|
3328
|
+
items: item.children,
|
|
3329
|
+
"selected-keys": __props.selectedKeys,
|
|
3330
|
+
"selection-mode": __props.selectionMode,
|
|
3331
|
+
"close-on-select": __props.closeOnSelect,
|
|
3332
|
+
disabled: __props.disabled || item.isDisabled,
|
|
3333
|
+
dir: __props.dir,
|
|
3334
|
+
onAction: _cache[0] || (_cache[0] = (id) => emit("action", id)),
|
|
3335
|
+
onSelection: _cache[1] || (_cache[1] = (id, checked) => emit("selection", id, checked))
|
|
3336
|
+
}, createSlots({ _: 2 }, [_ctx.$slots.icon ? {
|
|
3337
|
+
name: "icon",
|
|
3338
|
+
fn: withCtx((slot) => [renderSlot(_ctx.$slots, "icon", mergeProps({ ref_for: true }, slot))]),
|
|
3339
|
+
key: "0"
|
|
3340
|
+
} : void 0]), 1032, [
|
|
3341
|
+
"items",
|
|
3342
|
+
"selected-keys",
|
|
3343
|
+
"selection-mode",
|
|
3344
|
+
"close-on-select",
|
|
3345
|
+
"disabled",
|
|
3346
|
+
"dir"
|
|
3347
|
+
])]),
|
|
3348
|
+
_: 2
|
|
3349
|
+
}, 1032, ["aria-label", "dir"])]),
|
|
3350
|
+
_: 2
|
|
3351
|
+
}, 1024)]),
|
|
3352
|
+
_: 2
|
|
3353
|
+
}, 1024)) : __props.selectionMode === "single" ? (openBlock(), createBlock(unref(DropdownMenuRadioItem), {
|
|
3354
|
+
key: 1,
|
|
3355
|
+
value: item.id,
|
|
3356
|
+
disabled: __props.disabled || item.isDisabled,
|
|
3357
|
+
"text-value": item.label,
|
|
3358
|
+
class: "menu__item",
|
|
3359
|
+
"data-tone": item.tone ?? "default",
|
|
3360
|
+
onSelect: (event) => action(event, item)
|
|
3361
|
+
}, {
|
|
3362
|
+
default: withCtx(() => [createVNode(MenuItemContent_default, {
|
|
3363
|
+
item,
|
|
3364
|
+
selectable: ""
|
|
3365
|
+
}, createSlots({ _: 2 }, [_ctx.$slots.icon ? {
|
|
3366
|
+
name: "icon",
|
|
3367
|
+
fn: withCtx((slot) => [renderSlot(_ctx.$slots, "icon", mergeProps({ ref_for: true }, slot))]),
|
|
3368
|
+
key: "0"
|
|
3369
|
+
} : void 0]), 1032, ["item"])]),
|
|
3370
|
+
_: 2
|
|
3371
|
+
}, 1032, [
|
|
3372
|
+
"value",
|
|
3373
|
+
"disabled",
|
|
3374
|
+
"text-value",
|
|
3375
|
+
"data-tone",
|
|
3376
|
+
"onSelect"
|
|
3377
|
+
])) : __props.selectionMode === "multiple" ? (openBlock(), createBlock(unref(DropdownMenuCheckboxItem), {
|
|
3378
|
+
key: 2,
|
|
3379
|
+
"model-value": __props.selectedKeys.includes(item.id),
|
|
3380
|
+
disabled: __props.disabled || item.isDisabled,
|
|
3381
|
+
"text-value": item.label,
|
|
3382
|
+
class: "menu__item",
|
|
3383
|
+
"data-tone": item.tone ?? "default",
|
|
3384
|
+
"onUpdate:modelValue": (checked) => {
|
|
3385
|
+
if (!__props.disabled && !item.isDisabled) emit("selection", item.id, checked === true);
|
|
3386
|
+
},
|
|
3387
|
+
onSelect: (event) => action(event, item)
|
|
3388
|
+
}, {
|
|
3389
|
+
default: withCtx(() => [createVNode(MenuItemContent_default, {
|
|
3390
|
+
item,
|
|
3391
|
+
selectable: ""
|
|
3392
|
+
}, createSlots({ _: 2 }, [_ctx.$slots.icon ? {
|
|
3393
|
+
name: "icon",
|
|
3394
|
+
fn: withCtx((slot) => [renderSlot(_ctx.$slots, "icon", mergeProps({ ref_for: true }, slot))]),
|
|
3395
|
+
key: "0"
|
|
3396
|
+
} : void 0]), 1032, ["item"])]),
|
|
3397
|
+
_: 2
|
|
3398
|
+
}, 1032, [
|
|
3399
|
+
"model-value",
|
|
3400
|
+
"disabled",
|
|
3401
|
+
"text-value",
|
|
3402
|
+
"data-tone",
|
|
3403
|
+
"onUpdate:modelValue",
|
|
3404
|
+
"onSelect"
|
|
3405
|
+
])) : (openBlock(), createBlock(unref(DropdownMenuItem), {
|
|
3406
|
+
key: 3,
|
|
3407
|
+
disabled: __props.disabled || item.isDisabled,
|
|
3408
|
+
"text-value": item.label,
|
|
3409
|
+
class: "menu__item",
|
|
3410
|
+
"data-tone": item.tone ?? "default",
|
|
3411
|
+
onSelect: (event) => action(event, item)
|
|
3412
|
+
}, {
|
|
3413
|
+
default: withCtx(() => [createVNode(MenuItemContent_default, {
|
|
3414
|
+
item,
|
|
3415
|
+
selectable: false
|
|
3416
|
+
}, createSlots({ _: 2 }, [_ctx.$slots.icon ? {
|
|
3417
|
+
name: "icon",
|
|
3418
|
+
fn: withCtx((slot) => [renderSlot(_ctx.$slots, "icon", mergeProps({ ref_for: true }, slot))]),
|
|
3419
|
+
key: "0"
|
|
3420
|
+
} : void 0]), 1032, ["item"])]),
|
|
3421
|
+
_: 2
|
|
3422
|
+
}, 1032, [
|
|
3423
|
+
"disabled",
|
|
3424
|
+
"text-value",
|
|
3425
|
+
"data-tone",
|
|
3426
|
+
"onSelect"
|
|
3427
|
+
]))], 64);
|
|
3428
|
+
}), 128))]),
|
|
3429
|
+
_: 2
|
|
3430
|
+
}, 1032, ["aria-label"])], 64);
|
|
3431
|
+
}), 128))]),
|
|
3432
|
+
_: 3
|
|
3433
|
+
}, 8, ["model-value"]);
|
|
3434
|
+
};
|
|
3435
|
+
}
|
|
3436
|
+
});
|
|
3437
|
+
//#endregion
|
|
3438
|
+
//#region src/DropdownMenu.vue
|
|
3439
|
+
var DropdownMenu_default = /* @__PURE__ */ defineComponent({
|
|
3440
|
+
inheritAttrs: false,
|
|
3441
|
+
__name: "DropdownMenu",
|
|
3442
|
+
props: {
|
|
3443
|
+
triggerLabel: {},
|
|
3444
|
+
items: {},
|
|
3445
|
+
open: {
|
|
3446
|
+
type: Boolean,
|
|
3447
|
+
default: void 0
|
|
3448
|
+
},
|
|
3449
|
+
defaultOpen: {
|
|
3450
|
+
type: Boolean,
|
|
3451
|
+
default: false
|
|
3452
|
+
},
|
|
3453
|
+
disabled: {
|
|
3454
|
+
type: Boolean,
|
|
3455
|
+
default: false
|
|
3456
|
+
},
|
|
3457
|
+
dir: { default: void 0 },
|
|
3458
|
+
triggerIconOnly: { type: Boolean },
|
|
3459
|
+
triggerVariant: { default: "secondary" },
|
|
3460
|
+
selectionMode: { default: "none" },
|
|
3461
|
+
selectedKeys: { default: void 0 },
|
|
3462
|
+
defaultSelectedKeys: { default: void 0 },
|
|
3463
|
+
closeOnSelect: {
|
|
3464
|
+
type: Boolean,
|
|
3465
|
+
default: void 0
|
|
3466
|
+
},
|
|
3467
|
+
placement: { default: "bottom-start" }
|
|
3468
|
+
},
|
|
3469
|
+
emits: [
|
|
3470
|
+
"update:open",
|
|
3471
|
+
"action",
|
|
3472
|
+
"update:selectedKeys"
|
|
3473
|
+
],
|
|
3474
|
+
setup(__props, { emit: __emit }) {
|
|
3475
|
+
const props = __props;
|
|
3476
|
+
const emit = __emit;
|
|
3477
|
+
const { visible, change } = useDisclosure(props, (next) => emit("update:open", next));
|
|
3478
|
+
const local = ref(props.defaultSelectedKeys ?? []);
|
|
3479
|
+
const selected = computed(() => menuSelection(props.selectedKeys ?? local.value, props.items, props.selectionMode));
|
|
3480
|
+
const side = computed(() => props.placement.split("-")[0]);
|
|
3481
|
+
const align = computed(() => props.placement.split("-")[1]);
|
|
3482
|
+
function select(id, checked) {
|
|
3483
|
+
const item = menuLeaves(props.items, props.disabled).find((item) => item.id === id);
|
|
3484
|
+
if (!item || item.isDisabled || props.selectionMode === "none") return;
|
|
3485
|
+
const next = menuSelection(props.selectionMode === "single" ? [id] : checked ? [...selected.value, id] : selected.value.filter((key) => key !== id), props.items, props.selectionMode);
|
|
3486
|
+
local.value = next;
|
|
3487
|
+
emit("update:selectedKeys", next);
|
|
3488
|
+
}
|
|
3489
|
+
function action(id) {
|
|
3490
|
+
const item = menuLeaves(props.items, props.disabled).find((item) => item.id === id);
|
|
3491
|
+
if (item && !item.isDisabled) emit("action", id);
|
|
3492
|
+
}
|
|
3493
|
+
return (_ctx, _cache) => {
|
|
3494
|
+
return openBlock(), createBlock(unref(DropdownMenuRoot), {
|
|
3495
|
+
open: unref(visible),
|
|
3496
|
+
dir: __props.dir,
|
|
3497
|
+
"onUpdate:open": unref(change)
|
|
3498
|
+
}, {
|
|
3499
|
+
default: withCtx(() => [createVNode(unref(DropdownMenuTrigger), {
|
|
3500
|
+
class: normalizeClass([
|
|
3501
|
+
"button",
|
|
3502
|
+
`button--${__props.triggerVariant}`,
|
|
3503
|
+
__props.triggerIconOnly && "button--icon-only"
|
|
3504
|
+
]),
|
|
3505
|
+
"aria-label": __props.triggerLabel,
|
|
3506
|
+
disabled: __props.disabled || !__props.items.length
|
|
3507
|
+
}, {
|
|
3508
|
+
default: withCtx(() => [renderSlot(_ctx.$slots, "trigger", {}, () => [createTextVNode(toDisplayString(__props.triggerLabel), 1)])]),
|
|
3509
|
+
_: 3
|
|
3510
|
+
}, 8, [
|
|
3511
|
+
"class",
|
|
3512
|
+
"aria-label",
|
|
3513
|
+
"disabled"
|
|
3514
|
+
]), createVNode(unref(DropdownMenuPortal), null, {
|
|
3515
|
+
default: withCtx(() => [createVNode(unref(DropdownMenuContent), {
|
|
3516
|
+
class: "menu__panel menu__list",
|
|
3517
|
+
"aria-label": __props.triggerLabel,
|
|
3518
|
+
side: side.value,
|
|
3519
|
+
align: align.value,
|
|
3520
|
+
"side-offset": 8,
|
|
3521
|
+
"collision-padding": 16,
|
|
3522
|
+
dir: __props.dir
|
|
3523
|
+
}, {
|
|
3524
|
+
default: withCtx(() => [createVNode(DropdownMenuBranch_default, {
|
|
3525
|
+
items: __props.items,
|
|
3526
|
+
"selected-keys": selected.value,
|
|
3527
|
+
"selection-mode": __props.selectionMode,
|
|
3528
|
+
"close-on-select": __props.closeOnSelect ?? __props.selectionMode !== "multiple",
|
|
3529
|
+
disabled: __props.disabled,
|
|
3530
|
+
dir: __props.dir,
|
|
3531
|
+
onAction: action,
|
|
3532
|
+
onSelection: select
|
|
3533
|
+
}, createSlots({ _: 2 }, [_ctx.$slots.icon ? {
|
|
3534
|
+
name: "icon",
|
|
3535
|
+
fn: withCtx((slot) => [renderSlot(_ctx.$slots, "icon", normalizeProps(guardReactiveProps(slot)))]),
|
|
3536
|
+
key: "0"
|
|
3537
|
+
} : void 0]), 1032, [
|
|
3538
|
+
"items",
|
|
3539
|
+
"selected-keys",
|
|
3540
|
+
"selection-mode",
|
|
3541
|
+
"close-on-select",
|
|
3542
|
+
"disabled",
|
|
3543
|
+
"dir"
|
|
3544
|
+
])]),
|
|
3545
|
+
_: 3
|
|
3546
|
+
}, 8, [
|
|
3547
|
+
"aria-label",
|
|
3548
|
+
"side",
|
|
3549
|
+
"align",
|
|
3550
|
+
"dir"
|
|
3551
|
+
])]),
|
|
3552
|
+
_: 3
|
|
3553
|
+
})]),
|
|
3554
|
+
_: 3
|
|
3555
|
+
}, 8, [
|
|
3556
|
+
"open",
|
|
3557
|
+
"dir",
|
|
3558
|
+
"onUpdate:open"
|
|
3559
|
+
]);
|
|
3560
|
+
};
|
|
3561
|
+
}
|
|
3562
|
+
});
|
|
3563
|
+
//#endregion
|
|
3564
|
+
//#region src/Popover.vue?vue&type=script&setup=true&lang.ts
|
|
3565
|
+
var _hoisted_1$5 = ["dir", "aria-describedby"];
|
|
3566
|
+
var _hoisted_2$5 = ["id"];
|
|
3567
|
+
var _hoisted_3$3 = { class: "overlay__body" };
|
|
3568
|
+
var _hoisted_4$3 = { class: "overlay__footer" };
|
|
3569
|
+
//#endregion
|
|
3570
|
+
//#region src/Popover.vue
|
|
3571
|
+
var Popover_default = /* @__PURE__ */ defineComponent({
|
|
3572
|
+
inheritAttrs: false,
|
|
3573
|
+
__name: "Popover",
|
|
3574
|
+
props: {
|
|
3575
|
+
triggerLabel: {},
|
|
3576
|
+
title: {},
|
|
3577
|
+
description: { default: void 0 },
|
|
3578
|
+
open: {
|
|
3579
|
+
type: Boolean,
|
|
3580
|
+
default: void 0
|
|
3581
|
+
},
|
|
3582
|
+
defaultOpen: {
|
|
3583
|
+
type: Boolean,
|
|
3584
|
+
default: false
|
|
3585
|
+
},
|
|
3586
|
+
disabled: {
|
|
3587
|
+
type: Boolean,
|
|
3588
|
+
default: false
|
|
3589
|
+
},
|
|
3590
|
+
closeLabel: { default: "Tutup" },
|
|
3591
|
+
dir: { default: void 0 }
|
|
3592
|
+
},
|
|
3593
|
+
emits: ["update:open"],
|
|
3594
|
+
setup(__props, { emit: __emit }) {
|
|
3595
|
+
const props = __props;
|
|
3596
|
+
const emit = __emit;
|
|
3597
|
+
const { visible, change } = useDisclosure(props, (next) => emit("update:open", next));
|
|
3598
|
+
const generated = useId(), titleId = `${generated}-title`, descriptionId = computed(() => props.description ? `${generated}-description` : void 0);
|
|
3599
|
+
return (_ctx, _cache) => {
|
|
3600
|
+
return openBlock(), createBlock(unref(PopoverRoot), {
|
|
3601
|
+
open: unref(visible),
|
|
3602
|
+
"onUpdate:open": unref(change)
|
|
3603
|
+
}, {
|
|
3604
|
+
default: withCtx(() => [createVNode(unref(PopoverTrigger), {
|
|
3605
|
+
class: "button button--secondary",
|
|
3606
|
+
disabled: __props.disabled
|
|
3607
|
+
}, {
|
|
3608
|
+
default: withCtx(() => [createTextVNode(toDisplayString(__props.triggerLabel), 1)]),
|
|
3609
|
+
_: 1
|
|
3610
|
+
}, 8, ["disabled"]), createVNode(unref(PopoverPortal), null, {
|
|
3611
|
+
default: withCtx(() => [createVNode(unref(PopoverContent), {
|
|
3612
|
+
"as-child": "",
|
|
3613
|
+
side: "bottom",
|
|
3614
|
+
align: "start",
|
|
3615
|
+
"side-offset": 8,
|
|
3616
|
+
"collision-padding": 16
|
|
3617
|
+
}, {
|
|
3618
|
+
default: withCtx(() => [createElementVNode("div", {
|
|
3619
|
+
class: "popover__panel popover__content",
|
|
3620
|
+
dir: __props.dir,
|
|
3621
|
+
"aria-labelledby": titleId,
|
|
3622
|
+
"aria-describedby": descriptionId.value
|
|
3623
|
+
}, [
|
|
3624
|
+
createElementVNode("h2", {
|
|
3625
|
+
id: titleId,
|
|
3626
|
+
class: "overlay__title"
|
|
3627
|
+
}, toDisplayString(__props.title), 1),
|
|
3628
|
+
__props.description ? (openBlock(), createElementBlock("p", {
|
|
3629
|
+
key: 0,
|
|
3630
|
+
id: descriptionId.value,
|
|
3631
|
+
class: "overlay__description"
|
|
3632
|
+
}, toDisplayString(__props.description), 9, _hoisted_2$5)) : createCommentVNode("", true),
|
|
3633
|
+
createElementVNode("div", _hoisted_3$3, [renderSlot(_ctx.$slots, "default")]),
|
|
3634
|
+
createElementVNode("div", _hoisted_4$3, [createVNode(unref(PopoverClose), { class: "button button--secondary" }, {
|
|
3635
|
+
default: withCtx(() => [createTextVNode(toDisplayString(__props.closeLabel), 1)]),
|
|
3636
|
+
_: 1
|
|
3637
|
+
})])
|
|
3638
|
+
], 8, _hoisted_1$5)]),
|
|
3639
|
+
_: 3
|
|
3640
|
+
})]),
|
|
3641
|
+
_: 3
|
|
3642
|
+
})]),
|
|
3643
|
+
_: 3
|
|
3644
|
+
}, 8, ["open", "onUpdate:open"]);
|
|
3645
|
+
};
|
|
3646
|
+
}
|
|
3647
|
+
});
|
|
3648
|
+
//#endregion
|
|
3649
|
+
//#region src/Tooltip.vue
|
|
3650
|
+
var Tooltip_default = /* @__PURE__ */ defineComponent({
|
|
3651
|
+
inheritAttrs: false,
|
|
3652
|
+
__name: "Tooltip",
|
|
3653
|
+
props: {
|
|
3654
|
+
triggerLabel: {},
|
|
3655
|
+
text: {},
|
|
3656
|
+
triggerIconOnly: {
|
|
3657
|
+
type: Boolean,
|
|
3658
|
+
default: false
|
|
3659
|
+
},
|
|
3660
|
+
triggerVariant: { default: "secondary" },
|
|
3661
|
+
triggerSize: { default: "md" },
|
|
3662
|
+
open: {
|
|
3663
|
+
type: Boolean,
|
|
3664
|
+
default: void 0
|
|
3665
|
+
},
|
|
3666
|
+
defaultOpen: {
|
|
3667
|
+
type: Boolean,
|
|
3668
|
+
default: false
|
|
3669
|
+
},
|
|
3670
|
+
disabled: {
|
|
3671
|
+
type: Boolean,
|
|
3672
|
+
default: false
|
|
3673
|
+
},
|
|
3674
|
+
dir: { default: void 0 }
|
|
3675
|
+
},
|
|
3676
|
+
emits: ["update:open"],
|
|
3677
|
+
setup(__props, { emit: __emit }) {
|
|
3678
|
+
const props = __props;
|
|
3679
|
+
const emit = __emit;
|
|
3680
|
+
const { visible, change } = useDisclosure(props, (next) => emit("update:open", next));
|
|
3681
|
+
return (_ctx, _cache) => {
|
|
3682
|
+
return openBlock(), createBlock(unref(TooltipProvider), {
|
|
3683
|
+
"delay-duration": 300,
|
|
3684
|
+
"skip-delay-duration": 0,
|
|
3685
|
+
"disable-hoverable-content": true
|
|
3686
|
+
}, {
|
|
3687
|
+
default: withCtx(() => [createVNode(unref(TooltipRoot), {
|
|
3688
|
+
open: unref(visible),
|
|
3689
|
+
"onUpdate:open": unref(change)
|
|
3690
|
+
}, {
|
|
3691
|
+
default: withCtx(() => [createVNode(unref(TooltipTrigger), {
|
|
3692
|
+
class: normalizeClass([
|
|
3693
|
+
"button",
|
|
3694
|
+
`button--${__props.triggerVariant}`,
|
|
3695
|
+
__props.triggerSize !== "md" && `button--${__props.triggerSize}`,
|
|
3696
|
+
__props.triggerIconOnly && "button--icon-only"
|
|
3697
|
+
]),
|
|
3698
|
+
"aria-label": __props.triggerLabel,
|
|
3699
|
+
disabled: __props.disabled
|
|
3700
|
+
}, {
|
|
3701
|
+
default: withCtx(() => [renderSlot(_ctx.$slots, "trigger", {}, () => [createTextVNode(toDisplayString(__props.triggerLabel), 1)])]),
|
|
3702
|
+
_: 3
|
|
3703
|
+
}, 8, [
|
|
3704
|
+
"class",
|
|
3705
|
+
"aria-label",
|
|
3706
|
+
"disabled"
|
|
3707
|
+
]), createVNode(unref(TooltipPortal), null, {
|
|
3708
|
+
default: withCtx(() => [createVNode(unref(TooltipContent), {
|
|
3709
|
+
class: "tooltip__panel",
|
|
3710
|
+
side: "top",
|
|
3711
|
+
"side-offset": 8,
|
|
3712
|
+
"collision-padding": 16,
|
|
3713
|
+
dir: __props.dir
|
|
3714
|
+
}, {
|
|
3715
|
+
default: withCtx(() => [createTextVNode(toDisplayString(__props.text), 1)]),
|
|
3716
|
+
_: 1
|
|
3717
|
+
}, 8, ["dir"])]),
|
|
3718
|
+
_: 1
|
|
3719
|
+
})]),
|
|
3720
|
+
_: 3
|
|
3721
|
+
}, 8, ["open", "onUpdate:open"])]),
|
|
3722
|
+
_: 3
|
|
3723
|
+
});
|
|
3724
|
+
};
|
|
3725
|
+
}
|
|
3726
|
+
});
|
|
3727
|
+
//#endregion
|
|
3728
|
+
//#region src/Spinner.vue?vue&type=script&setup=true&lang.ts
|
|
3729
|
+
var _hoisted_1$4 = [
|
|
3730
|
+
"id",
|
|
3731
|
+
"data-color",
|
|
3732
|
+
"role",
|
|
3733
|
+
"aria-label",
|
|
3734
|
+
"aria-hidden"
|
|
3735
|
+
];
|
|
3736
|
+
var _hoisted_2$4 = {
|
|
3737
|
+
key: 0,
|
|
3738
|
+
class: "spinner__label"
|
|
3739
|
+
};
|
|
3740
|
+
//#endregion
|
|
3741
|
+
//#region src/Spinner.vue
|
|
3742
|
+
var Spinner_default = /* @__PURE__ */ defineComponent({
|
|
3743
|
+
inheritAttrs: false,
|
|
3744
|
+
__name: "Spinner",
|
|
3745
|
+
props: {
|
|
3746
|
+
size: { default: "md" },
|
|
3747
|
+
color: { default: "current" },
|
|
3748
|
+
label: { default: void 0 },
|
|
3749
|
+
id: { default: void 0 }
|
|
3750
|
+
},
|
|
3751
|
+
setup(__props) {
|
|
3752
|
+
return (_ctx, _cache) => {
|
|
3753
|
+
return openBlock(), createElementBlock("span", {
|
|
3754
|
+
id: __props.id,
|
|
3755
|
+
class: normalizeClass(["spinner", `spinner--${__props.size}`]),
|
|
3756
|
+
"data-color": __props.color,
|
|
3757
|
+
role: __props.label ? "status" : void 0,
|
|
3758
|
+
"aria-label": __props.label || void 0,
|
|
3759
|
+
"aria-hidden": !__props.label || void 0
|
|
3760
|
+
}, [_cache[0] || (_cache[0] = createElementVNode("svg", {
|
|
3761
|
+
viewBox: "0 0 20 20",
|
|
3762
|
+
fill: "none",
|
|
3763
|
+
"aria-hidden": "true",
|
|
3764
|
+
focusable: "false"
|
|
3765
|
+
}, [createElementVNode("circle", {
|
|
3766
|
+
class: "spinner__track",
|
|
3767
|
+
cx: "10",
|
|
3768
|
+
cy: "10",
|
|
3769
|
+
r: "8"
|
|
3770
|
+
}), createElementVNode("circle", {
|
|
3771
|
+
class: "spinner__arc",
|
|
3772
|
+
cx: "10",
|
|
3773
|
+
cy: "10",
|
|
3774
|
+
r: "8",
|
|
3775
|
+
pathLength: "100",
|
|
3776
|
+
"stroke-dasharray": "36 64"
|
|
3777
|
+
})], -1)), __props.label ? (openBlock(), createElementBlock("span", _hoisted_2$4, toDisplayString(__props.label), 1)) : createCommentVNode("", true)], 10, _hoisted_1$4);
|
|
3778
|
+
};
|
|
3779
|
+
}
|
|
3780
|
+
});
|
|
3781
|
+
//#endregion
|
|
3782
|
+
//#region src/Combobox.vue?vue&type=script&setup=true&lang.ts
|
|
3783
|
+
var _hoisted_1$3 = ["dir"];
|
|
3784
|
+
var _hoisted_2$3 = ["for"];
|
|
3785
|
+
var _hoisted_3$2 = {
|
|
3786
|
+
key: 0,
|
|
3787
|
+
class: "selection__required",
|
|
3788
|
+
"aria-hidden": "true"
|
|
3789
|
+
};
|
|
3790
|
+
var _hoisted_4$2 = {
|
|
3791
|
+
key: 0,
|
|
3792
|
+
class: "selection__leading",
|
|
3793
|
+
"aria-hidden": "true"
|
|
3794
|
+
};
|
|
3795
|
+
var _hoisted_5$2 = [
|
|
3796
|
+
"data-empty",
|
|
3797
|
+
"aria-hidden",
|
|
3798
|
+
"tabindex",
|
|
3799
|
+
"disabled",
|
|
3800
|
+
"aria-label"
|
|
3801
|
+
];
|
|
3802
|
+
var _hoisted_6$2 = { class: "select__item-label" };
|
|
3803
|
+
var _hoisted_7$2 = {
|
|
3804
|
+
key: 0,
|
|
3805
|
+
class: "selection__description"
|
|
3806
|
+
};
|
|
3807
|
+
var _hoisted_8$2 = {
|
|
3808
|
+
key: 0,
|
|
3809
|
+
class: "selection__empty",
|
|
3810
|
+
role: "status"
|
|
3811
|
+
};
|
|
3812
|
+
var _hoisted_9$2 = [
|
|
3813
|
+
"name",
|
|
3814
|
+
"value",
|
|
3815
|
+
"disabled"
|
|
3816
|
+
];
|
|
3817
|
+
//#endregion
|
|
3818
|
+
//#region src/Combobox.vue
|
|
3819
|
+
var Combobox_default = /* @__PURE__ */ defineComponent({
|
|
3820
|
+
__name: "Combobox",
|
|
3821
|
+
props: {
|
|
3822
|
+
label: {},
|
|
3823
|
+
options: {},
|
|
3824
|
+
modelValue: {},
|
|
3825
|
+
defaultValue: {},
|
|
3826
|
+
placeholder: {},
|
|
3827
|
+
name: {},
|
|
3828
|
+
disabled: { type: Boolean },
|
|
3829
|
+
required: { type: Boolean },
|
|
3830
|
+
invalid: { type: Boolean },
|
|
3831
|
+
description: {},
|
|
3832
|
+
errorMessage: {},
|
|
3833
|
+
requiredMessage: {},
|
|
3834
|
+
clearable: { type: Boolean },
|
|
3835
|
+
clearLabel: {},
|
|
3836
|
+
toggleLabel: {},
|
|
3837
|
+
emptyMessage: {},
|
|
3838
|
+
dir: {}
|
|
3839
|
+
},
|
|
3840
|
+
emits: ["update:modelValue"],
|
|
3841
|
+
setup(__props, { emit: __emit }) {
|
|
3842
|
+
const props = __props;
|
|
3843
|
+
const emit = __emit;
|
|
3844
|
+
const instance = getCurrentInstance();
|
|
3845
|
+
const controlled = () => Object.prototype.hasOwnProperty.call(instance?.vnode.props ?? {}, "modelValue");
|
|
3846
|
+
const local = ref(props.defaultValue);
|
|
3847
|
+
const draft = ref(null);
|
|
3848
|
+
const tried = ref(false);
|
|
3849
|
+
const wrapper = ref();
|
|
3850
|
+
const id = computed(() => selectionIds(controlled() ? props.modelValue : local.value, props.options, false)[0]);
|
|
3851
|
+
const selected = computed(() => props.options.find((o) => o.id === id.value));
|
|
3852
|
+
watch(() => selected.value?.id, () => {
|
|
3853
|
+
draft.value = null;
|
|
3854
|
+
});
|
|
3855
|
+
const text = computed(() => draft.value ?? selected.value?.label ?? "");
|
|
3856
|
+
const filtered = computed(() => draft.value === null ? props.options : filterOptions(props.options, draft.value));
|
|
3857
|
+
const invalid = computed(() => props.invalid || tried.value && props.required && !id.value);
|
|
3858
|
+
const error = computed(() => props.errorMessage ?? (props.required && !id.value ? props.requiredMessage ?? "Pilihan wajib diisi." : void 0));
|
|
3859
|
+
const { controlId, describedBy, showError } = useFeedback({
|
|
3860
|
+
get description() {
|
|
3861
|
+
return props.description;
|
|
3862
|
+
},
|
|
3863
|
+
get invalid() {
|
|
3864
|
+
return invalid.value;
|
|
3865
|
+
},
|
|
3866
|
+
get errorMessage() {
|
|
3867
|
+
return error.value;
|
|
3868
|
+
}
|
|
3869
|
+
});
|
|
3870
|
+
function focus() {
|
|
3871
|
+
wrapper.value?.querySelector(".combobox__input")?.focus();
|
|
3872
|
+
}
|
|
3873
|
+
function change(value) {
|
|
3874
|
+
if (props.disabled) return;
|
|
3875
|
+
const next = selectionIds(value, props.options, false)[0];
|
|
3876
|
+
local.value = next;
|
|
3877
|
+
emit("update:modelValue", next);
|
|
3878
|
+
draft.value = null;
|
|
3879
|
+
}
|
|
3880
|
+
function search(value) {
|
|
3881
|
+
if (props.disabled) return;
|
|
3882
|
+
draft.value = value;
|
|
3883
|
+
if (value === "" && id.value) {
|
|
3884
|
+
local.value = void 0;
|
|
3885
|
+
emit("update:modelValue", void 0);
|
|
3886
|
+
}
|
|
3887
|
+
}
|
|
3888
|
+
function reset(cancelled) {
|
|
3889
|
+
if (!cancelled) {
|
|
3890
|
+
tried.value = false;
|
|
3891
|
+
draft.value = null;
|
|
3892
|
+
if (!controlled()) local.value = props.defaultValue;
|
|
3893
|
+
}
|
|
3894
|
+
}
|
|
3895
|
+
return (_ctx, _cache) => {
|
|
3896
|
+
return openBlock(), createElementBlock("div", {
|
|
3897
|
+
ref_key: "wrapper",
|
|
3898
|
+
ref: wrapper,
|
|
3899
|
+
class: "select combobox",
|
|
3900
|
+
dir: __props.dir
|
|
3901
|
+
}, [
|
|
3902
|
+
createElementVNode("label", {
|
|
3903
|
+
class: "select__label",
|
|
3904
|
+
for: unref(controlId)
|
|
3905
|
+
}, [createTextVNode(toDisplayString(__props.label), 1), __props.required ? (openBlock(), createElementBlock("span", _hoisted_3$2, " *")) : createCommentVNode("", true)], 8, _hoisted_2$3),
|
|
3906
|
+
createVNode(unref(ComboboxRoot), {
|
|
3907
|
+
"model-value": id.value ?? null,
|
|
3908
|
+
disabled: __props.disabled,
|
|
3909
|
+
dir: __props.dir,
|
|
3910
|
+
"ignore-filter": "",
|
|
3911
|
+
"reset-search-term-on-blur": false,
|
|
3912
|
+
"reset-search-term-on-select": false,
|
|
3913
|
+
"onUpdate:modelValue": change,
|
|
3914
|
+
"onUpdate:open": _cache[1] || (_cache[1] = (open) => {
|
|
3915
|
+
if (!open) draft.value = null;
|
|
3916
|
+
})
|
|
3917
|
+
}, {
|
|
3918
|
+
default: withCtx(() => [createVNode(unref(ComboboxAnchor), {
|
|
3919
|
+
class: "combobox__control",
|
|
3920
|
+
"data-invalid": invalid.value || void 0,
|
|
3921
|
+
"data-disabled": __props.disabled || void 0
|
|
3922
|
+
}, {
|
|
3923
|
+
default: withCtx(() => [
|
|
3924
|
+
_ctx.$slots.start ? (openBlock(), createElementBlock("span", _hoisted_4$2, [renderSlot(_ctx.$slots, "start")])) : createCommentVNode("", true),
|
|
3925
|
+
createVNode(unref(ComboboxInput), {
|
|
3926
|
+
id: unref(controlId),
|
|
3927
|
+
"model-value": text.value,
|
|
3928
|
+
"display-value": () => selected.value?.label ?? "",
|
|
3929
|
+
class: "combobox__input",
|
|
3930
|
+
placeholder: __props.placeholder,
|
|
3931
|
+
"aria-required": __props.required || void 0,
|
|
3932
|
+
"aria-invalid": invalid.value || void 0,
|
|
3933
|
+
"aria-describedby": unref(describedBy),
|
|
3934
|
+
"onUpdate:modelValue": search
|
|
3935
|
+
}, null, 8, [
|
|
3936
|
+
"id",
|
|
3937
|
+
"model-value",
|
|
3938
|
+
"display-value",
|
|
3939
|
+
"placeholder",
|
|
3940
|
+
"aria-required",
|
|
3941
|
+
"aria-invalid",
|
|
3942
|
+
"aria-describedby"
|
|
3943
|
+
]),
|
|
3944
|
+
__props.clearable ? (openBlock(), createElementBlock("button", {
|
|
3945
|
+
key: 1,
|
|
3946
|
+
type: "button",
|
|
3947
|
+
class: "combobox__clear",
|
|
3948
|
+
"data-empty": !id.value && !text.value || void 0,
|
|
3949
|
+
"aria-hidden": !id.value && !text.value || void 0,
|
|
3950
|
+
tabindex: !id.value && !text.value ? -1 : void 0,
|
|
3951
|
+
disabled: __props.disabled || !id.value && !text.value,
|
|
3952
|
+
"aria-label": __props.clearLabel ?? "Hapus pilihan",
|
|
3953
|
+
onClick: _cache[0] || (_cache[0] = ($event) => {
|
|
3954
|
+
change(void 0);
|
|
3955
|
+
focus();
|
|
3956
|
+
})
|
|
3957
|
+
}, [createVNode(CloseIcon_default, { class: "selection__close-icon" })], 8, _hoisted_5$2)) : createCommentVNode("", true),
|
|
3958
|
+
createVNode(unref(ComboboxTrigger), {
|
|
3959
|
+
class: "combobox__toggle",
|
|
3960
|
+
"aria-label": __props.toggleLabel ?? "Buka pilihan"
|
|
3961
|
+
}, {
|
|
3962
|
+
default: withCtx(() => [createVNode(ChevronIcon_default, { class: "select__icon" })]),
|
|
3963
|
+
_: 1
|
|
3964
|
+
}, 8, ["aria-label"])
|
|
3965
|
+
]),
|
|
3966
|
+
_: 3
|
|
3967
|
+
}, 8, ["data-invalid", "data-disabled"]), createVNode(unref(ComboboxPortal), null, {
|
|
3968
|
+
default: withCtx(() => [createVNode(unref(ComboboxContent), {
|
|
3969
|
+
class: "select__popover combobox__popover",
|
|
3970
|
+
position: "popper",
|
|
3971
|
+
"side-offset": 4
|
|
3972
|
+
}, {
|
|
3973
|
+
default: withCtx(() => [createVNode(unref(ComboboxViewport), { class: "select__list" }, {
|
|
3974
|
+
default: withCtx(() => [(openBlock(true), createElementBlock(Fragment, null, renderList(filtered.value, (option) => {
|
|
3975
|
+
return openBlock(), createBlock(unref(ComboboxItem), {
|
|
3976
|
+
key: option.id,
|
|
3977
|
+
value: option.id,
|
|
3978
|
+
"text-value": option.label,
|
|
3979
|
+
disabled: option.isDisabled,
|
|
3980
|
+
class: "select__item"
|
|
3981
|
+
}, {
|
|
3982
|
+
default: withCtx(() => [createElementVNode("span", _hoisted_6$2, [renderSlot(_ctx.$slots, "option", { option }, () => [createTextVNode(toDisplayString(option.label), 1), option.description ? (openBlock(), createElementBlock("span", _hoisted_7$2, toDisplayString(option.description), 1)) : createCommentVNode("", true)])]), createVNode(CheckIcon_default, { class: "select__check" })]),
|
|
3983
|
+
_: 2
|
|
3984
|
+
}, 1032, [
|
|
3985
|
+
"value",
|
|
3986
|
+
"text-value",
|
|
3987
|
+
"disabled"
|
|
3988
|
+
]);
|
|
3989
|
+
}), 128)), !filtered.value.length ? (openBlock(), createElementBlock("span", _hoisted_8$2, toDisplayString(__props.emptyMessage ?? "Tidak ada pilihan."), 1)) : createCommentVNode("", true)]),
|
|
3990
|
+
_: 3
|
|
3991
|
+
})]),
|
|
3992
|
+
_: 3
|
|
3993
|
+
})]),
|
|
3994
|
+
_: 3
|
|
3995
|
+
})]),
|
|
3996
|
+
_: 3
|
|
3997
|
+
}, 8, [
|
|
3998
|
+
"model-value",
|
|
3999
|
+
"disabled",
|
|
4000
|
+
"dir"
|
|
4001
|
+
]),
|
|
4002
|
+
createVNode(FieldFeedback_default, {
|
|
4003
|
+
"control-id": unref(controlId),
|
|
4004
|
+
description: __props.description,
|
|
4005
|
+
"error-message": error.value,
|
|
4006
|
+
"show-error": unref(showError)
|
|
4007
|
+
}, null, 8, [
|
|
4008
|
+
"control-id",
|
|
4009
|
+
"description",
|
|
4010
|
+
"error-message",
|
|
4011
|
+
"show-error"
|
|
4012
|
+
]),
|
|
4013
|
+
__props.name ? (openBlock(), createElementBlock("input", {
|
|
4014
|
+
key: 0,
|
|
4015
|
+
type: "hidden",
|
|
4016
|
+
name: __props.name,
|
|
4017
|
+
value: id.value ?? "",
|
|
4018
|
+
disabled: __props.disabled
|
|
4019
|
+
}, null, 8, _hoisted_9$2)) : createCommentVNode("", true),
|
|
4020
|
+
createVNode(SelectionValidation_default, {
|
|
4021
|
+
"has-value": !!id.value,
|
|
4022
|
+
required: __props.required,
|
|
4023
|
+
disabled: __props.disabled,
|
|
4024
|
+
onInvalid: _cache[2] || (_cache[2] = ($event) => {
|
|
4025
|
+
tried.value = true;
|
|
4026
|
+
focus();
|
|
4027
|
+
}),
|
|
4028
|
+
onReset: reset
|
|
4029
|
+
}, null, 8, [
|
|
4030
|
+
"has-value",
|
|
4031
|
+
"required",
|
|
4032
|
+
"disabled"
|
|
4033
|
+
])
|
|
4034
|
+
], 8, _hoisted_1$3);
|
|
4035
|
+
};
|
|
4036
|
+
}
|
|
4037
|
+
});
|
|
4038
|
+
//#endregion
|
|
4039
|
+
//#region src/toggle-group-model.ts
|
|
4040
|
+
/** Normalize IDs without discarding existing disabled selections. */
|
|
4041
|
+
function toggleIds(value, items, multiple) {
|
|
4042
|
+
const wanted = new Set(Array.isArray(value) ? value : typeof value === "string" ? [value] : []);
|
|
4043
|
+
const result = [...new Set(items.filter((item) => item.id !== "" && wanted.has(item.id)).map((item) => item.id))];
|
|
4044
|
+
return multiple ? result : result.slice(0, 1);
|
|
4045
|
+
}
|
|
4046
|
+
//#endregion
|
|
4047
|
+
//#region src/ToggleGroup.vue?vue&type=script&setup=true&lang.ts
|
|
4048
|
+
var _hoisted_1$2 = {
|
|
4049
|
+
key: 0,
|
|
4050
|
+
class: "toggle-group__icon",
|
|
4051
|
+
"aria-hidden": "true"
|
|
4052
|
+
};
|
|
4053
|
+
var _hoisted_2$2 = { key: 1 };
|
|
4054
|
+
//#endregion
|
|
4055
|
+
//#region src/ToggleGroup.vue
|
|
4056
|
+
var ToggleGroup_default = /* @__PURE__ */ defineComponent({
|
|
4057
|
+
__name: "ToggleGroup",
|
|
4058
|
+
props: {
|
|
4059
|
+
label: {},
|
|
4060
|
+
items: {},
|
|
4061
|
+
selectionMode: {},
|
|
4062
|
+
modelValue: {},
|
|
4063
|
+
defaultValue: {},
|
|
4064
|
+
disabled: { type: Boolean },
|
|
4065
|
+
iconOnly: { type: Boolean },
|
|
4066
|
+
disallowEmptySelection: { type: Boolean },
|
|
4067
|
+
variant: {},
|
|
4068
|
+
size: {},
|
|
4069
|
+
orientation: {},
|
|
4070
|
+
dir: {}
|
|
4071
|
+
},
|
|
4072
|
+
emits: ["update:modelValue"],
|
|
4073
|
+
setup(__props, { emit: __emit }) {
|
|
4074
|
+
const props = __props;
|
|
4075
|
+
const emit = __emit;
|
|
4076
|
+
const instance = getCurrentInstance();
|
|
4077
|
+
const controlled = () => Object.prototype.hasOwnProperty.call(instance?.vnode.props ?? {}, "modelValue");
|
|
4078
|
+
const local = ref(props.defaultValue);
|
|
4079
|
+
const multiple = computed(() => props.selectionMode === "multiple");
|
|
4080
|
+
const ids = computed(() => toggleIds(controlled() ? props.modelValue : local.value, props.items, multiple.value));
|
|
4081
|
+
function update(value) {
|
|
4082
|
+
if (props.disabled) return;
|
|
4083
|
+
const requested = new Set(toggleIds(value, props.items, true));
|
|
4084
|
+
for (const item of props.items.filter((item) => item.isDisabled)) if (multiple.value && ids.value.includes(item.id)) requested.add(item.id);
|
|
4085
|
+
else if (!ids.value.includes(item.id)) requested.delete(item.id);
|
|
4086
|
+
const next = toggleIds([...requested], props.items, multiple.value);
|
|
4087
|
+
if (next.length === ids.value.length && next.every((id, index) => id === ids.value[index])) return;
|
|
4088
|
+
if (props.disallowEmptySelection && ids.value.length && !next.length) return;
|
|
4089
|
+
const result = multiple.value ? next : next[0] ?? null;
|
|
4090
|
+
local.value = result;
|
|
4091
|
+
emit("update:modelValue", result);
|
|
4092
|
+
}
|
|
4093
|
+
return (_ctx, _cache) => {
|
|
4094
|
+
return openBlock(), createBlock(unref(ToggleGroupRoot), {
|
|
4095
|
+
class: "toggle-group",
|
|
4096
|
+
"aria-label": __props.label,
|
|
4097
|
+
type: multiple.value ? "multiple" : "single",
|
|
4098
|
+
"model-value": multiple.value ? ids.value : ids.value[0] ?? "",
|
|
4099
|
+
disabled: __props.disabled,
|
|
4100
|
+
dir: __props.dir,
|
|
4101
|
+
orientation: __props.orientation ?? "horizontal",
|
|
4102
|
+
"data-orientation": __props.orientation ?? "horizontal",
|
|
4103
|
+
"data-variant": __props.variant ?? "outline",
|
|
4104
|
+
"data-size": __props.size ?? "md",
|
|
4105
|
+
"data-icon-only": __props.iconOnly || void 0,
|
|
4106
|
+
"onUpdate:modelValue": update
|
|
4107
|
+
}, {
|
|
4108
|
+
default: withCtx(() => [(openBlock(true), createElementBlock(Fragment, null, renderList(__props.items, (item) => {
|
|
4109
|
+
return openBlock(), createBlock(unref(ToggleGroupItem), {
|
|
4110
|
+
key: item.id,
|
|
4111
|
+
value: item.id,
|
|
4112
|
+
type: "button",
|
|
4113
|
+
class: "toggle-group__item",
|
|
4114
|
+
"aria-label": item.label,
|
|
4115
|
+
disabled: __props.disabled || item.isDisabled
|
|
4116
|
+
}, {
|
|
4117
|
+
default: withCtx(() => [_ctx.$slots.icon ? (openBlock(), createElementBlock("span", _hoisted_1$2, [renderSlot(_ctx.$slots, "icon", { item })])) : createCommentVNode("", true), !__props.iconOnly ? (openBlock(), createElementBlock("span", _hoisted_2$2, toDisplayString(item.label), 1)) : createCommentVNode("", true)]),
|
|
4118
|
+
_: 2
|
|
4119
|
+
}, 1032, [
|
|
4120
|
+
"value",
|
|
4121
|
+
"aria-label",
|
|
4122
|
+
"disabled"
|
|
4123
|
+
]);
|
|
4124
|
+
}), 128))]),
|
|
4125
|
+
_: 3
|
|
4126
|
+
}, 8, [
|
|
4127
|
+
"aria-label",
|
|
4128
|
+
"type",
|
|
4129
|
+
"model-value",
|
|
4130
|
+
"disabled",
|
|
4131
|
+
"dir",
|
|
4132
|
+
"orientation",
|
|
4133
|
+
"data-orientation",
|
|
4134
|
+
"data-variant",
|
|
4135
|
+
"data-size",
|
|
4136
|
+
"data-icon-only"
|
|
4137
|
+
]);
|
|
4138
|
+
};
|
|
4139
|
+
}
|
|
4140
|
+
});
|
|
4141
|
+
//#endregion
|
|
4142
|
+
//#region src/date-range-model.ts
|
|
4143
|
+
function dateRangeLabels(locale = "id-ID") {
|
|
4144
|
+
return locale.startsWith("id") ? {
|
|
4145
|
+
title: "Pilih rentang tanggal",
|
|
4146
|
+
start: "Tanggal mulai",
|
|
4147
|
+
end: "Tanggal akhir",
|
|
4148
|
+
apply: "Terapkan",
|
|
4149
|
+
cancel: "Batal",
|
|
4150
|
+
clear: "Kosongkan",
|
|
4151
|
+
previousMonth: "Bulan sebelumnya",
|
|
4152
|
+
nextMonth: "Bulan berikutnya",
|
|
4153
|
+
presets: "Pilihan cepat",
|
|
4154
|
+
placeholder: "Pilih tanggal",
|
|
4155
|
+
incomplete: "Lengkapi tanggal mulai dan akhir.",
|
|
4156
|
+
order: "Tanggal akhir harus setelah atau sama dengan tanggal mulai.",
|
|
4157
|
+
bounds: "Tanggal berada di luar batas yang diizinkan.",
|
|
4158
|
+
unavailable: "Rentang memuat tanggal yang tidak tersedia.",
|
|
4159
|
+
length: "Durasi rentang tidak sesuai batas yang diizinkan.",
|
|
4160
|
+
required: "Rentang tanggal wajib diisi."
|
|
4161
|
+
} : {
|
|
4162
|
+
title: "Select date range",
|
|
4163
|
+
start: "Start date",
|
|
4164
|
+
end: "End date",
|
|
4165
|
+
apply: "Apply",
|
|
4166
|
+
cancel: "Cancel",
|
|
4167
|
+
clear: "Clear",
|
|
4168
|
+
previousMonth: "Previous month",
|
|
4169
|
+
nextMonth: "Next month",
|
|
4170
|
+
presets: "Quick selections",
|
|
4171
|
+
placeholder: "Choose dates",
|
|
4172
|
+
incomplete: "Enter both start and end dates.",
|
|
4173
|
+
order: "End date must be on or after start date.",
|
|
4174
|
+
bounds: "Dates are outside the allowed limits.",
|
|
4175
|
+
unavailable: "The range includes an unavailable date.",
|
|
4176
|
+
length: "The range duration is outside the allowed limits.",
|
|
4177
|
+
required: "A date range is required."
|
|
4178
|
+
};
|
|
4179
|
+
}
|
|
4180
|
+
function validDate(value) {
|
|
4181
|
+
if (!/^(?!0000)\d{4}-\d{2}-\d{2}$/.test(value)) return false;
|
|
4182
|
+
try {
|
|
4183
|
+
return parseDate(value).toString() === value;
|
|
4184
|
+
} catch {
|
|
4185
|
+
return false;
|
|
4186
|
+
}
|
|
4187
|
+
}
|
|
4188
|
+
function asDate(value) {
|
|
4189
|
+
return value && validDate(value) ? parseDate(value) : void 0;
|
|
4190
|
+
}
|
|
4191
|
+
function currentDate() {
|
|
4192
|
+
return today(getLocalTimeZone()).toString();
|
|
4193
|
+
}
|
|
4194
|
+
function rangeError(value, constraints = {}) {
|
|
4195
|
+
if (!value) return null;
|
|
4196
|
+
if (!validDate(value.start) || !validDate(value.end)) return "incomplete";
|
|
4197
|
+
if (value.end < value.start) return "order";
|
|
4198
|
+
if (constraints.minDate && value.start < constraints.minDate || constraints.maxDate && value.end > constraints.maxDate) return "bounds";
|
|
4199
|
+
const start = parseDate(value.start), end = parseDate(value.end);
|
|
4200
|
+
const days = end.calendar.toJulianDay(end) - start.calendar.toJulianDay(start) + 1;
|
|
4201
|
+
if (constraints.minDays && days < constraints.minDays || constraints.maxDays && days > constraints.maxDays) return "length";
|
|
4202
|
+
if (constraints.isDateUnavailable) for (let day = start; day.compare(end) <= 0; day = day.add({ days: 1 })) {
|
|
4203
|
+
if (constraints.isDateUnavailable(day.toString())) return "unavailable";
|
|
4204
|
+
if (day.compare(end) === 0) break;
|
|
4205
|
+
}
|
|
4206
|
+
return null;
|
|
4207
|
+
}
|
|
4208
|
+
function rangeText(value, locale = "id-ID") {
|
|
4209
|
+
if (!value || !validDate(value.start) || !validDate(value.end)) return "";
|
|
4210
|
+
const formatter = new Intl.DateTimeFormat(locale, {
|
|
4211
|
+
day: "numeric",
|
|
4212
|
+
month: "short",
|
|
4213
|
+
year: "numeric",
|
|
4214
|
+
timeZone: "UTC",
|
|
4215
|
+
calendar: "gregory"
|
|
4216
|
+
});
|
|
4217
|
+
const date = (s) => parseDate(s).toDate("UTC");
|
|
4218
|
+
return value.start === value.end ? formatter.format(date(value.start)) : `${formatter.format(date(value.start))} – ${formatter.format(date(value.end))}`;
|
|
4219
|
+
}
|
|
4220
|
+
function createDateRangePresets(referenceDate = currentDate(), locale = "id-ID", weekStartsOn = 1) {
|
|
4221
|
+
const day = parseDate(referenceDate), week = startOfWeek(day, locale, weekStartsOn === 1 ? "mon" : "sun");
|
|
4222
|
+
const id = locale.startsWith("id");
|
|
4223
|
+
return [
|
|
4224
|
+
{
|
|
4225
|
+
id: "this-week",
|
|
4226
|
+
label: id ? "Minggu ini" : "This Week",
|
|
4227
|
+
start: week,
|
|
4228
|
+
end: week.add({ days: 6 })
|
|
4229
|
+
},
|
|
4230
|
+
{
|
|
4231
|
+
id: "last-week",
|
|
4232
|
+
label: id ? "Minggu lalu" : "Last Week",
|
|
4233
|
+
start: week.subtract({ days: 7 }),
|
|
4234
|
+
end: week.subtract({ days: 1 })
|
|
4235
|
+
},
|
|
4236
|
+
{
|
|
4237
|
+
id: "last-7-days",
|
|
4238
|
+
label: id ? "7 hari terakhir" : "Last 7 Days",
|
|
4239
|
+
start: day.subtract({ days: 6 }),
|
|
4240
|
+
end: day
|
|
4241
|
+
},
|
|
4242
|
+
{
|
|
4243
|
+
id: "last-30-days",
|
|
4244
|
+
label: id ? "30 hari terakhir" : "Last 30 Days",
|
|
4245
|
+
start: day.subtract({ days: 29 }),
|
|
4246
|
+
end: day
|
|
4247
|
+
},
|
|
4248
|
+
{
|
|
4249
|
+
id: "this-month",
|
|
4250
|
+
label: id ? "Bulan ini" : "Current Month",
|
|
4251
|
+
start: startOfMonth(day),
|
|
4252
|
+
end: endOfMonth(day)
|
|
4253
|
+
},
|
|
4254
|
+
{
|
|
4255
|
+
id: "next-month",
|
|
4256
|
+
label: id ? "Bulan depan" : "Next Month",
|
|
4257
|
+
start: startOfMonth(day.add({ months: 1 })),
|
|
4258
|
+
end: endOfMonth(day.add({ months: 1 }))
|
|
4259
|
+
}
|
|
4260
|
+
].map(({ id, label, start, end }) => ({
|
|
4261
|
+
id,
|
|
4262
|
+
label,
|
|
4263
|
+
value: {
|
|
4264
|
+
start: start.toString(),
|
|
4265
|
+
end: end.toString()
|
|
4266
|
+
}
|
|
4267
|
+
}));
|
|
4268
|
+
}
|
|
4269
|
+
//#endregion
|
|
4270
|
+
//#region src/DateRangePanel.vue?vue&type=script&setup=true&lang.ts
|
|
4271
|
+
var _hoisted_1$1 = ["data-readonly"];
|
|
4272
|
+
var _hoisted_2$1 = { class: "date-range__intro" };
|
|
4273
|
+
var _hoisted_3$1 = ["id"];
|
|
4274
|
+
var _hoisted_4$1 = {
|
|
4275
|
+
class: "date-range__summary",
|
|
4276
|
+
"aria-live": "polite"
|
|
4277
|
+
};
|
|
4278
|
+
var _hoisted_5$1 = { class: "date-range__body" };
|
|
4279
|
+
var _hoisted_6$1 = ["aria-label"];
|
|
4280
|
+
var _hoisted_7$1 = [
|
|
4281
|
+
"disabled",
|
|
4282
|
+
"aria-pressed",
|
|
4283
|
+
"onClick"
|
|
4284
|
+
];
|
|
4285
|
+
var _hoisted_8$1 = { class: "date-range__main" };
|
|
4286
|
+
var _hoisted_9$1 = {
|
|
4287
|
+
key: 0,
|
|
4288
|
+
class: "date-range__jump"
|
|
4289
|
+
};
|
|
4290
|
+
var _hoisted_10$1 = [
|
|
4291
|
+
"aria-label",
|
|
4292
|
+
"disabled",
|
|
4293
|
+
"value"
|
|
4294
|
+
];
|
|
4295
|
+
var _hoisted_11 = ["value"];
|
|
4296
|
+
var _hoisted_12 = [
|
|
4297
|
+
"disabled",
|
|
4298
|
+
"value",
|
|
4299
|
+
"min",
|
|
4300
|
+
"max"
|
|
4301
|
+
];
|
|
4302
|
+
var _hoisted_13 = {
|
|
4303
|
+
key: 1,
|
|
4304
|
+
class: "date-range__inputs"
|
|
4305
|
+
};
|
|
4306
|
+
var _hoisted_14 = [
|
|
4307
|
+
"value",
|
|
4308
|
+
"min",
|
|
4309
|
+
"max",
|
|
4310
|
+
"disabled",
|
|
4311
|
+
"readonly",
|
|
4312
|
+
"aria-invalid",
|
|
4313
|
+
"aria-describedby",
|
|
4314
|
+
"onInput"
|
|
4315
|
+
];
|
|
4316
|
+
var _hoisted_15 = { class: "date-range__navigation" };
|
|
4317
|
+
var _hoisted_16 = { class: "date-range__months" };
|
|
4318
|
+
var _hoisted_17 = { class: "date-range__heading" };
|
|
4319
|
+
var _hoisted_18 = {
|
|
4320
|
+
class: "date-range__validation",
|
|
4321
|
+
"aria-live": "polite"
|
|
4322
|
+
};
|
|
4323
|
+
var _hoisted_19 = ["id"];
|
|
4324
|
+
var _hoisted_20 = { class: "date-range__footer" };
|
|
4325
|
+
var _hoisted_21 = ["disabled"];
|
|
4326
|
+
var _hoisted_22 = ["disabled"];
|
|
4327
|
+
//#endregion
|
|
4328
|
+
//#region src/DateRangePanel.vue
|
|
4329
|
+
var DateRangePanel_default = /* @__PURE__ */ defineComponent({
|
|
4330
|
+
__name: "DateRangePanel",
|
|
4331
|
+
props: {
|
|
4332
|
+
options: {},
|
|
4333
|
+
draft: {},
|
|
4334
|
+
labels: {},
|
|
4335
|
+
id: {},
|
|
4336
|
+
disabled: { type: Boolean },
|
|
4337
|
+
readonly: { type: Boolean },
|
|
4338
|
+
required: { type: Boolean }
|
|
4339
|
+
},
|
|
4340
|
+
emits: [
|
|
4341
|
+
"draft",
|
|
4342
|
+
"apply",
|
|
4343
|
+
"cancel"
|
|
4344
|
+
],
|
|
4345
|
+
setup(__props, { emit: __emit }) {
|
|
4346
|
+
const props = __props;
|
|
4347
|
+
const emit = __emit;
|
|
4348
|
+
const locale = computed(() => props.options.locale ?? "id-ID");
|
|
4349
|
+
const nullable = computed(() => props.draft.start || props.draft.end ? props.draft : null);
|
|
4350
|
+
const errorCode = computed(() => rangeError(nullable.value, props.options) ?? (props.required && !nullable.value ? "required" : null));
|
|
4351
|
+
const error = computed(() => errorCode.value ? props.labels[errorCode.value] : void 0);
|
|
4352
|
+
function initialFocus() {
|
|
4353
|
+
const date = asDate(props.draft.start) ?? asDate(props.options.referenceDate) ?? asDate(currentDate());
|
|
4354
|
+
const min = asDate(props.options.minDate), max = asDate(props.options.maxDate);
|
|
4355
|
+
return min && date.compare(min) < 0 ? min : max && date.compare(max) > 0 ? max : date;
|
|
4356
|
+
}
|
|
4357
|
+
const focused = shallowRef(initialFocus());
|
|
4358
|
+
watch(() => props.draft.start, () => {
|
|
4359
|
+
if (asDate(props.draft.start)) focused.value = asDate(props.draft.start);
|
|
4360
|
+
});
|
|
4361
|
+
const calendarValue = computed(() => ({
|
|
4362
|
+
start: asDate(props.draft.start),
|
|
4363
|
+
end: props.draft.start <= props.draft.end ? asDate(props.draft.end) : void 0
|
|
4364
|
+
}));
|
|
4365
|
+
function select(value) {
|
|
4366
|
+
if (!props.disabled && !props.readonly) emit("draft", {
|
|
4367
|
+
start: value.start?.toString() ?? "",
|
|
4368
|
+
end: value.end?.toString() ?? ""
|
|
4369
|
+
});
|
|
4370
|
+
}
|
|
4371
|
+
function edit(part, event) {
|
|
4372
|
+
emit("draft", {
|
|
4373
|
+
...props.draft,
|
|
4374
|
+
[part]: event.target.value
|
|
4375
|
+
});
|
|
4376
|
+
}
|
|
4377
|
+
function jumpYear(event) {
|
|
4378
|
+
const el = event.target;
|
|
4379
|
+
const year = Number(el.value);
|
|
4380
|
+
if (Number.isInteger(year) && year >= 1 && year <= 9999) focused.value = focused.value.set({ year });
|
|
4381
|
+
else el.value = String(focused.value.year);
|
|
4382
|
+
}
|
|
4383
|
+
const monthLabel = (date) => new Intl.DateTimeFormat(locale.value, {
|
|
4384
|
+
month: "long",
|
|
4385
|
+
year: "numeric",
|
|
4386
|
+
calendar: "gregory",
|
|
4387
|
+
timeZone: "UTC"
|
|
4388
|
+
}).format(date.toDate("UTC"));
|
|
4389
|
+
const unavailable = (date) => props.options.isDateUnavailable?.(date.toString()) ?? false;
|
|
4390
|
+
return (_ctx, _cache) => {
|
|
4391
|
+
return openBlock(), createElementBlock("div", {
|
|
4392
|
+
class: "date-range__content",
|
|
4393
|
+
"data-readonly": __props.readonly || void 0
|
|
4394
|
+
}, [
|
|
4395
|
+
createElementVNode("header", _hoisted_2$1, [createElementVNode("h2", { id: `${__props.id}-title` }, toDisplayString(__props.labels.title), 9, _hoisted_3$1), createElementVNode("p", _hoisted_4$1, toDisplayString(unref(rangeText)(nullable.value, locale.value) || __props.labels.incomplete), 1)]),
|
|
4396
|
+
createElementVNode("div", _hoisted_5$1, [__props.options.presets?.length ? (openBlock(), createElementBlock("div", {
|
|
4397
|
+
key: 0,
|
|
4398
|
+
class: "date-range__presets",
|
|
4399
|
+
role: "group",
|
|
4400
|
+
"aria-label": __props.labels.presets
|
|
4401
|
+
}, [(openBlock(true), createElementBlock(Fragment, null, renderList(__props.options.presets, (preset) => {
|
|
4402
|
+
return openBlock(), createElementBlock("button", {
|
|
4403
|
+
key: preset.id,
|
|
4404
|
+
type: "button",
|
|
4405
|
+
class: "date-range__preset",
|
|
4406
|
+
disabled: __props.disabled || __props.readonly || !!unref(rangeError)(preset.value, __props.options),
|
|
4407
|
+
"aria-pressed": __props.draft.start === preset.value.start && __props.draft.end === preset.value.end,
|
|
4408
|
+
onClick: ($event) => emit("draft", { ...preset.value })
|
|
4409
|
+
}, toDisplayString(preset.label), 9, _hoisted_7$1);
|
|
4410
|
+
}), 128))], 8, _hoisted_6$1)) : createCommentVNode("", true), createElementVNode("div", _hoisted_8$1, [
|
|
4411
|
+
__props.options.showMonthYearPicker ? (openBlock(), createElementBlock("div", _hoisted_9$1, [createElementVNode("label", null, [createElementVNode("span", null, toDisplayString(locale.value.startsWith("id") ? "Bulan" : "Month"), 1), createElementVNode("select", {
|
|
4412
|
+
form: "",
|
|
4413
|
+
"aria-label": locale.value.startsWith("id") ? "Bulan" : "Month",
|
|
4414
|
+
disabled: __props.disabled,
|
|
4415
|
+
value: focused.value.month,
|
|
4416
|
+
onChange: _cache[0] || (_cache[0] = ($event) => focused.value = focused.value.set({ month: Number($event.target.value) }))
|
|
4417
|
+
}, [(openBlock(), createElementBlock(Fragment, null, renderList(12, (month) => {
|
|
4418
|
+
return createElementVNode("option", {
|
|
4419
|
+
key: month,
|
|
4420
|
+
value: month
|
|
4421
|
+
}, toDisplayString(new Intl.DateTimeFormat(locale.value, {
|
|
4422
|
+
month: "long",
|
|
4423
|
+
timeZone: "UTC",
|
|
4424
|
+
calendar: "gregory"
|
|
4425
|
+
}).format(focused.value.set({
|
|
4426
|
+
month,
|
|
4427
|
+
day: 1
|
|
4428
|
+
}).toDate("UTC"))), 9, _hoisted_11);
|
|
4429
|
+
}), 64))], 40, _hoisted_10$1)]), createElementVNode("label", null, [createElementVNode("span", null, toDisplayString(locale.value.startsWith("id") ? "Tahun" : "Year"), 1), createElementVNode("input", {
|
|
4430
|
+
type: "number",
|
|
4431
|
+
form: "",
|
|
4432
|
+
disabled: __props.disabled,
|
|
4433
|
+
value: focused.value.year,
|
|
4434
|
+
min: unref(asDate)(__props.options.minDate)?.year ?? 1,
|
|
4435
|
+
max: unref(asDate)(__props.options.maxDate)?.year ?? 9999,
|
|
4436
|
+
onChange: jumpYear
|
|
4437
|
+
}, null, 40, _hoisted_12)])])) : createCommentVNode("", true),
|
|
4438
|
+
__props.options.showInputs !== false ? (openBlock(), createElementBlock("div", _hoisted_13, [(openBlock(), createElementBlock(Fragment, null, renderList(["start", "end"], (part) => {
|
|
4439
|
+
return createElementVNode("label", {
|
|
4440
|
+
key: part,
|
|
4441
|
+
class: "date-range__field"
|
|
4442
|
+
}, [createElementVNode("span", null, toDisplayString(__props.labels[part]), 1), createElementVNode("input", {
|
|
4443
|
+
type: "date",
|
|
4444
|
+
form: "",
|
|
4445
|
+
value: __props.draft[part],
|
|
4446
|
+
min: __props.options.minDate,
|
|
4447
|
+
max: __props.options.maxDate,
|
|
4448
|
+
disabled: __props.disabled,
|
|
4449
|
+
readonly: __props.readonly,
|
|
4450
|
+
"aria-invalid": !!errorCode.value,
|
|
4451
|
+
"aria-describedby": error.value ? `${__props.id}-draft-error` : void 0,
|
|
4452
|
+
onInput: ($event) => edit(part, $event)
|
|
4453
|
+
}, null, 40, _hoisted_14)]);
|
|
4454
|
+
}), 64))])) : createCommentVNode("", true),
|
|
4455
|
+
createVNode(unref(RangeCalendarRoot), {
|
|
4456
|
+
placeholder: focused.value,
|
|
4457
|
+
"onUpdate:placeholder": _cache[1] || (_cache[1] = ($event) => focused.value = $event),
|
|
4458
|
+
class: "date-range__calendar",
|
|
4459
|
+
"model-value": calendarValue.value,
|
|
4460
|
+
"number-of-months": __props.options.visibleMonths ?? 2,
|
|
4461
|
+
"week-starts-on": __props.options.weekStartsOn ?? 1,
|
|
4462
|
+
"weekday-format": "short",
|
|
4463
|
+
"calendar-label": __props.labels.title,
|
|
4464
|
+
locale: `${locale.value.split("-u-")[0]}-u-ca-gregory`,
|
|
4465
|
+
dir: __props.options.dir,
|
|
4466
|
+
"min-value": unref(asDate)(__props.options.minDate),
|
|
4467
|
+
"max-value": unref(asDate)(__props.options.maxDate),
|
|
4468
|
+
disabled: __props.disabled,
|
|
4469
|
+
readonly: __props.readonly,
|
|
4470
|
+
"is-date-unavailable": unavailable,
|
|
4471
|
+
"onUpdate:modelValue": select
|
|
4472
|
+
}, {
|
|
4473
|
+
default: withCtx(({ grid, weekDays }) => [createElementVNode("div", _hoisted_15, [createVNode(unref(RangeCalendarPrev), {
|
|
4474
|
+
as: "button",
|
|
4475
|
+
type: "button",
|
|
4476
|
+
class: "date-range__nav date-range__nav--previous",
|
|
4477
|
+
"aria-label": __props.labels.previousMonth
|
|
4478
|
+
}, {
|
|
4479
|
+
default: withCtx(() => [createVNode(ChevronIcon_default)]),
|
|
4480
|
+
_: 1
|
|
4481
|
+
}, 8, ["aria-label"]), createVNode(unref(RangeCalendarNext), {
|
|
4482
|
+
as: "button",
|
|
4483
|
+
type: "button",
|
|
4484
|
+
class: "date-range__nav date-range__nav--next",
|
|
4485
|
+
"aria-label": __props.labels.nextMonth
|
|
4486
|
+
}, {
|
|
4487
|
+
default: withCtx(() => [createVNode(ChevronIcon_default)]),
|
|
4488
|
+
_: 1
|
|
4489
|
+
}, 8, ["aria-label"])]), createElementVNode("div", _hoisted_16, [(openBlock(true), createElementBlock(Fragment, null, renderList(grid, (month) => {
|
|
4490
|
+
return openBlock(), createElementBlock("div", {
|
|
4491
|
+
key: month.value.toString(),
|
|
4492
|
+
class: "date-range__month"
|
|
4493
|
+
}, [createElementVNode("h2", _hoisted_17, toDisplayString(monthLabel(month.value)), 1), createVNode(unref(RangeCalendarGrid), { class: "date-range__grid" }, {
|
|
4494
|
+
default: withCtx(() => [createVNode(unref(RangeCalendarGridHead), null, {
|
|
4495
|
+
default: withCtx(() => [createVNode(unref(RangeCalendarGridRow), null, {
|
|
4496
|
+
default: withCtx(() => [(openBlock(true), createElementBlock(Fragment, null, renderList(weekDays, (day) => {
|
|
4497
|
+
return openBlock(), createBlock(unref(RangeCalendarHeadCell), {
|
|
4498
|
+
key: day,
|
|
4499
|
+
class: "date-range__weekday"
|
|
4500
|
+
}, {
|
|
4501
|
+
default: withCtx(() => [createTextVNode(toDisplayString(day), 1)]),
|
|
4502
|
+
_: 2
|
|
4503
|
+
}, 1024);
|
|
4504
|
+
}), 128))]),
|
|
4505
|
+
_: 2
|
|
4506
|
+
}, 1024)]),
|
|
4507
|
+
_: 2
|
|
4508
|
+
}, 1024), createVNode(unref(RangeCalendarGridBody), null, {
|
|
4509
|
+
default: withCtx(() => [(openBlock(true), createElementBlock(Fragment, null, renderList(month.rows, (week, index) => {
|
|
4510
|
+
return openBlock(), createBlock(unref(RangeCalendarGridRow), { key: index }, {
|
|
4511
|
+
default: withCtx(() => [(openBlock(true), createElementBlock(Fragment, null, renderList(week, (date) => {
|
|
4512
|
+
return openBlock(), createBlock(unref(RangeCalendarCell), {
|
|
4513
|
+
key: date.toString(),
|
|
4514
|
+
date
|
|
4515
|
+
}, {
|
|
4516
|
+
default: withCtx(() => [createVNode(unref(RangeCalendarCellTrigger), {
|
|
4517
|
+
class: "date-range__day",
|
|
4518
|
+
day: date,
|
|
4519
|
+
month: month.value
|
|
4520
|
+
}, null, 8, ["day", "month"])]),
|
|
4521
|
+
_: 2
|
|
4522
|
+
}, 1032, ["date"]);
|
|
4523
|
+
}), 128))]),
|
|
4524
|
+
_: 2
|
|
4525
|
+
}, 1024);
|
|
4526
|
+
}), 128))]),
|
|
4527
|
+
_: 2
|
|
4528
|
+
}, 1024)]),
|
|
4529
|
+
_: 2
|
|
4530
|
+
}, 1024)]);
|
|
4531
|
+
}), 128))])]),
|
|
4532
|
+
_: 1
|
|
4533
|
+
}, 8, [
|
|
4534
|
+
"placeholder",
|
|
4535
|
+
"model-value",
|
|
4536
|
+
"number-of-months",
|
|
4537
|
+
"week-starts-on",
|
|
4538
|
+
"calendar-label",
|
|
4539
|
+
"locale",
|
|
4540
|
+
"dir",
|
|
4541
|
+
"min-value",
|
|
4542
|
+
"max-value",
|
|
4543
|
+
"disabled",
|
|
4544
|
+
"readonly"
|
|
4545
|
+
]),
|
|
4546
|
+
createElementVNode("div", _hoisted_18, [error.value ? (openBlock(), createElementBlock("p", {
|
|
4547
|
+
key: 0,
|
|
4548
|
+
id: `${__props.id}-draft-error`,
|
|
4549
|
+
role: "alert"
|
|
4550
|
+
}, toDisplayString(error.value), 9, _hoisted_19)) : createCommentVNode("", true)])
|
|
4551
|
+
])]),
|
|
4552
|
+
createElementVNode("footer", _hoisted_20, [createElementVNode("button", {
|
|
4553
|
+
type: "button",
|
|
4554
|
+
class: "button button--ghost button--sm",
|
|
4555
|
+
disabled: __props.disabled || __props.readonly,
|
|
4556
|
+
onClick: _cache[2] || (_cache[2] = ($event) => emit("draft", {
|
|
4557
|
+
start: "",
|
|
4558
|
+
end: ""
|
|
4559
|
+
}))
|
|
4560
|
+
}, toDisplayString(__props.labels.clear), 9, _hoisted_21), createElementVNode("div", null, [createElementVNode("button", {
|
|
4561
|
+
type: "button",
|
|
4562
|
+
class: "button button--secondary button--sm date-range__cancel",
|
|
4563
|
+
onClick: _cache[3] || (_cache[3] = ($event) => emit("cancel"))
|
|
4564
|
+
}, toDisplayString(__props.labels.cancel), 1), createElementVNode("button", {
|
|
4565
|
+
type: "button",
|
|
4566
|
+
class: "button button--primary button--sm date-range__apply",
|
|
4567
|
+
disabled: __props.disabled || __props.readonly || !!errorCode.value,
|
|
4568
|
+
onClick: _cache[4] || (_cache[4] = ($event) => emit("apply"))
|
|
4569
|
+
}, toDisplayString(__props.labels.apply), 9, _hoisted_22)])])
|
|
4570
|
+
], 8, _hoisted_1$1);
|
|
4571
|
+
};
|
|
4572
|
+
}
|
|
4573
|
+
});
|
|
4574
|
+
//#endregion
|
|
4575
|
+
//#region src/DateRangePicker.vue?vue&type=script&setup=true&lang.ts
|
|
4576
|
+
var _hoisted_1 = ["dir", "data-disabled"];
|
|
4577
|
+
var _hoisted_2 = ["id"];
|
|
4578
|
+
var _hoisted_3 = {
|
|
4579
|
+
key: 0,
|
|
4580
|
+
"aria-hidden": "true"
|
|
4581
|
+
};
|
|
4582
|
+
var _hoisted_4 = ["aria-labelledby", "dir"];
|
|
4583
|
+
var _hoisted_5 = ["id", "data-placeholder"];
|
|
4584
|
+
var _hoisted_6 = ["dir", "aria-labelledby"];
|
|
4585
|
+
var _hoisted_7 = ["id"];
|
|
4586
|
+
var _hoisted_8 = ["id"];
|
|
4587
|
+
var _hoisted_9 = [
|
|
4588
|
+
"name",
|
|
4589
|
+
"value",
|
|
4590
|
+
"disabled"
|
|
4591
|
+
];
|
|
4592
|
+
var _hoisted_10 = [
|
|
4593
|
+
"name",
|
|
4594
|
+
"value",
|
|
4595
|
+
"disabled"
|
|
4596
|
+
];
|
|
4597
|
+
//#endregion
|
|
4598
|
+
//#region src/DateRangePicker.vue
|
|
4599
|
+
var DateRangePicker_default = /* @__PURE__ */ defineComponent({
|
|
4600
|
+
inheritAttrs: false,
|
|
4601
|
+
__name: "DateRangePicker",
|
|
4602
|
+
props: {
|
|
4603
|
+
modelValue: { default: void 0 },
|
|
4604
|
+
disabled: { type: Boolean },
|
|
4605
|
+
readonly: { type: Boolean },
|
|
4606
|
+
required: { type: Boolean },
|
|
4607
|
+
invalid: { type: Boolean },
|
|
4608
|
+
label: {},
|
|
4609
|
+
defaultValue: { default: null },
|
|
4610
|
+
size: { default: "md" },
|
|
4611
|
+
variant: { default: "primary" },
|
|
4612
|
+
hideLabel: { type: Boolean },
|
|
4613
|
+
fullWidth: {
|
|
4614
|
+
type: Boolean,
|
|
4615
|
+
default: true
|
|
4616
|
+
},
|
|
4617
|
+
locale: { default: "id-ID" },
|
|
4618
|
+
dir: { default: void 0 },
|
|
4619
|
+
visibleMonths: { default: 2 },
|
|
4620
|
+
weekStartsOn: { default: 1 },
|
|
4621
|
+
display: { default: "popover" },
|
|
4622
|
+
showInputs: {
|
|
4623
|
+
type: Boolean,
|
|
4624
|
+
default: true
|
|
4625
|
+
},
|
|
4626
|
+
showMonthYearPicker: {
|
|
4627
|
+
type: Boolean,
|
|
4628
|
+
default: false
|
|
4629
|
+
},
|
|
4630
|
+
triggerDisplay: { default: "text" },
|
|
4631
|
+
presets: { default: () => [] },
|
|
4632
|
+
labels: { default: void 0 },
|
|
4633
|
+
formatRange: {
|
|
4634
|
+
type: Function,
|
|
4635
|
+
default: void 0
|
|
4636
|
+
},
|
|
4637
|
+
description: { default: void 0 },
|
|
4638
|
+
errorMessage: { default: void 0 },
|
|
4639
|
+
name: { default: void 0 },
|
|
4640
|
+
referenceDate: { default: void 0 },
|
|
4641
|
+
open: {
|
|
4642
|
+
type: Boolean,
|
|
4643
|
+
default: void 0
|
|
4644
|
+
},
|
|
4645
|
+
defaultOpen: {
|
|
4646
|
+
type: Boolean,
|
|
4647
|
+
default: false
|
|
4648
|
+
},
|
|
4649
|
+
minDate: { default: void 0 },
|
|
4650
|
+
maxDate: { default: void 0 },
|
|
4651
|
+
minDays: { default: void 0 },
|
|
4652
|
+
maxDays: { default: void 0 },
|
|
4653
|
+
isDateUnavailable: {
|
|
4654
|
+
type: Function,
|
|
4655
|
+
default: void 0
|
|
4656
|
+
}
|
|
4657
|
+
},
|
|
4658
|
+
emits: [
|
|
4659
|
+
"update:modelValue",
|
|
4660
|
+
"update:open",
|
|
4661
|
+
"apply"
|
|
4662
|
+
],
|
|
4663
|
+
setup(__props, { emit: __emit }) {
|
|
4664
|
+
const props = __props;
|
|
4665
|
+
const emit = __emit;
|
|
4666
|
+
const local = ref(props.defaultValue);
|
|
4667
|
+
const committed = computed(() => props.modelValue !== void 0 ? props.modelValue : local.value);
|
|
4668
|
+
const draft = ref({ ...committed.value ?? {
|
|
4669
|
+
start: "",
|
|
4670
|
+
end: ""
|
|
4671
|
+
} });
|
|
4672
|
+
watch(() => [committed.value?.start, committed.value?.end], () => {
|
|
4673
|
+
draft.value = { ...committed.value ?? {
|
|
4674
|
+
start: "",
|
|
4675
|
+
end: ""
|
|
4676
|
+
} };
|
|
4677
|
+
});
|
|
4678
|
+
const labels = computed(() => ({
|
|
4679
|
+
...dateRangeLabels(props.locale),
|
|
4680
|
+
...props.labels
|
|
4681
|
+
}));
|
|
4682
|
+
const id = useId(), root = ref(), formError = ref(false);
|
|
4683
|
+
const disclosure = useDisclosure(props, (next) => emit("update:open", next));
|
|
4684
|
+
const visible = computed(() => disclosure.visible.value && !props.disabled);
|
|
4685
|
+
function changeOpen(next) {
|
|
4686
|
+
if (next && props.disabled) return;
|
|
4687
|
+
draft.value = { ...committed.value ?? {
|
|
4688
|
+
start: "",
|
|
4689
|
+
end: ""
|
|
4690
|
+
} };
|
|
4691
|
+
disclosure.change(next);
|
|
4692
|
+
}
|
|
4693
|
+
const committedError = computed(() => rangeError(committed.value, props));
|
|
4694
|
+
const outerError = computed(() => props.invalid || !!committedError.value || formError.value);
|
|
4695
|
+
const text = computed(() => {
|
|
4696
|
+
const value = committed.value;
|
|
4697
|
+
if (!value) return labels.value.placeholder;
|
|
4698
|
+
const preset = props.presets.find((p) => p.value.start === value.start && p.value.end === value.end);
|
|
4699
|
+
return props.formatRange?.(value, props.locale) ?? preset?.label ?? rangeText(value, props.locale);
|
|
4700
|
+
});
|
|
4701
|
+
function apply() {
|
|
4702
|
+
const next = draft.value.start || draft.value.end ? { ...draft.value } : null;
|
|
4703
|
+
if (props.disabled || props.readonly || rangeError(next, props) || props.required && !next) return;
|
|
4704
|
+
local.value = next;
|
|
4705
|
+
formError.value = false;
|
|
4706
|
+
emit("update:modelValue", next);
|
|
4707
|
+
emit("apply", next);
|
|
4708
|
+
disclosure.change(false);
|
|
4709
|
+
}
|
|
4710
|
+
function reset(cancelled) {
|
|
4711
|
+
if (!cancelled) {
|
|
4712
|
+
if (props.modelValue === void 0) local.value = props.defaultValue;
|
|
4713
|
+
formError.value = false;
|
|
4714
|
+
changeOpen(false);
|
|
4715
|
+
}
|
|
4716
|
+
}
|
|
4717
|
+
const describedBy = computed(() => outerError.value ? `${id}-error` : props.description ? `${id}-description` : void 0);
|
|
4718
|
+
return (_ctx, _cache) => {
|
|
4719
|
+
return openBlock(), createElementBlock("div", {
|
|
4720
|
+
ref_key: "root",
|
|
4721
|
+
ref: root,
|
|
4722
|
+
class: normalizeClass([
|
|
4723
|
+
"date-range",
|
|
4724
|
+
`date-range--${__props.size}`,
|
|
4725
|
+
`date-range--${__props.variant}`,
|
|
4726
|
+
!__props.fullWidth && "date-range--fit",
|
|
4727
|
+
__props.hideLabel && "date-range--label-hidden",
|
|
4728
|
+
__props.triggerDisplay === "icon" && "date-range--icon-trigger"
|
|
4729
|
+
]),
|
|
4730
|
+
dir: __props.dir,
|
|
4731
|
+
"data-disabled": __props.disabled || void 0
|
|
4732
|
+
}, [
|
|
4733
|
+
createElementVNode("span", {
|
|
4734
|
+
id: `${unref(id)}-label`,
|
|
4735
|
+
class: "date-range__label"
|
|
4736
|
+
}, [createTextVNode(toDisplayString(__props.label), 1), __props.required ? (openBlock(), createElementBlock("span", _hoisted_3, " *")) : createCommentVNode("", true)], 8, _hoisted_2),
|
|
4737
|
+
__props.display === "inline" ? (openBlock(), createElementBlock("section", {
|
|
4738
|
+
key: 0,
|
|
4739
|
+
class: "date-range__panel date-range__inline",
|
|
4740
|
+
"aria-labelledby": `${unref(id)}-title`,
|
|
4741
|
+
dir: __props.dir
|
|
4742
|
+
}, [createVNode(DateRangePanel_default, {
|
|
4743
|
+
id: unref(id),
|
|
4744
|
+
options: props,
|
|
4745
|
+
draft: draft.value,
|
|
4746
|
+
labels: labels.value,
|
|
4747
|
+
disabled: __props.disabled,
|
|
4748
|
+
readonly: __props.readonly,
|
|
4749
|
+
required: __props.required,
|
|
4750
|
+
onDraft: _cache[0] || (_cache[0] = ($event) => draft.value = $event),
|
|
4751
|
+
onApply: apply,
|
|
4752
|
+
onCancel: _cache[1] || (_cache[1] = ($event) => changeOpen(false))
|
|
4753
|
+
}, null, 8, [
|
|
4754
|
+
"id",
|
|
4755
|
+
"draft",
|
|
4756
|
+
"labels",
|
|
4757
|
+
"disabled",
|
|
4758
|
+
"readonly",
|
|
4759
|
+
"required"
|
|
4760
|
+
])], 8, _hoisted_4)) : (openBlock(), createBlock(unref(PopoverRoot), {
|
|
4761
|
+
key: 1,
|
|
4762
|
+
open: visible.value,
|
|
4763
|
+
"onUpdate:open": changeOpen
|
|
4764
|
+
}, {
|
|
4765
|
+
default: withCtx(() => [createVNode(unref(PopoverTrigger), {
|
|
4766
|
+
class: "date-range__trigger",
|
|
4767
|
+
disabled: __props.disabled,
|
|
4768
|
+
"aria-labelledby": `${unref(id)}-label ${unref(id)}-value`,
|
|
4769
|
+
"aria-describedby": describedBy.value,
|
|
4770
|
+
"aria-invalid": outerError.value
|
|
4771
|
+
}, {
|
|
4772
|
+
default: withCtx(() => [
|
|
4773
|
+
_cache[5] || (_cache[5] = createElementVNode("svg", {
|
|
4774
|
+
class: "date-range__icon",
|
|
4775
|
+
"aria-hidden": "true",
|
|
4776
|
+
focusable: "false",
|
|
4777
|
+
viewBox: "0 0 24 24",
|
|
4778
|
+
fill: "none",
|
|
4779
|
+
stroke: "currentColor",
|
|
4780
|
+
"stroke-width": "1.8",
|
|
4781
|
+
"stroke-linecap": "round"
|
|
4782
|
+
}, [createElementVNode("rect", {
|
|
4783
|
+
x: "3",
|
|
4784
|
+
y: "5",
|
|
4785
|
+
width: "18",
|
|
4786
|
+
height: "16",
|
|
4787
|
+
rx: "2"
|
|
4788
|
+
}), createElementVNode("path", { d: "M7 3v4m10-4v4M3 10h18" })], -1)),
|
|
4789
|
+
createElementVNode("span", {
|
|
4790
|
+
id: `${unref(id)}-value`,
|
|
4791
|
+
class: "date-range__value",
|
|
4792
|
+
"data-placeholder": !committed.value || void 0
|
|
4793
|
+
}, toDisplayString(text.value), 9, _hoisted_5),
|
|
4794
|
+
createVNode(ChevronIcon_default, { class: "date-range__chevron" })
|
|
4795
|
+
]),
|
|
4796
|
+
_: 1
|
|
4797
|
+
}, 8, [
|
|
4798
|
+
"disabled",
|
|
4799
|
+
"aria-labelledby",
|
|
4800
|
+
"aria-describedby",
|
|
4801
|
+
"aria-invalid"
|
|
4802
|
+
]), createVNode(unref(PopoverPortal), null, {
|
|
4803
|
+
default: withCtx(() => [createVNode(unref(PopoverContent), {
|
|
4804
|
+
"as-child": "",
|
|
4805
|
+
side: "bottom",
|
|
4806
|
+
align: "start",
|
|
4807
|
+
"side-offset": 8,
|
|
4808
|
+
"collision-padding": 16
|
|
4809
|
+
}, {
|
|
4810
|
+
default: withCtx(() => [createElementVNode("div", {
|
|
4811
|
+
class: "date-range__panel date-range__dialog",
|
|
4812
|
+
dir: __props.dir,
|
|
4813
|
+
"aria-labelledby": `${unref(id)}-title`
|
|
4814
|
+
}, [createVNode(DateRangePanel_default, {
|
|
4815
|
+
id: unref(id),
|
|
4816
|
+
options: props,
|
|
4817
|
+
draft: draft.value,
|
|
4818
|
+
labels: labels.value,
|
|
4819
|
+
disabled: __props.disabled,
|
|
4820
|
+
readonly: __props.readonly,
|
|
4821
|
+
required: __props.required,
|
|
4822
|
+
onDraft: _cache[2] || (_cache[2] = ($event) => draft.value = $event),
|
|
4823
|
+
onApply: apply,
|
|
4824
|
+
onCancel: _cache[3] || (_cache[3] = ($event) => changeOpen(false))
|
|
4825
|
+
}, null, 8, [
|
|
4826
|
+
"id",
|
|
4827
|
+
"draft",
|
|
4828
|
+
"labels",
|
|
4829
|
+
"disabled",
|
|
4830
|
+
"readonly",
|
|
4831
|
+
"required"
|
|
4832
|
+
])], 8, _hoisted_6)]),
|
|
4833
|
+
_: 1
|
|
4834
|
+
})]),
|
|
4835
|
+
_: 1
|
|
4836
|
+
})]),
|
|
4837
|
+
_: 1
|
|
4838
|
+
}, 8, ["open"])),
|
|
4839
|
+
__props.description ? (openBlock(), createElementBlock("span", {
|
|
4840
|
+
key: 2,
|
|
4841
|
+
id: `${unref(id)}-description`,
|
|
4842
|
+
class: "input__description"
|
|
4843
|
+
}, toDisplayString(__props.description), 9, _hoisted_7)) : createCommentVNode("", true),
|
|
4844
|
+
outerError.value ? (openBlock(), createElementBlock("span", {
|
|
4845
|
+
key: 3,
|
|
4846
|
+
id: `${unref(id)}-error`,
|
|
4847
|
+
class: "input__error",
|
|
4848
|
+
role: "alert"
|
|
4849
|
+
}, toDisplayString(__props.errorMessage ?? (committedError.value ? labels.value[committedError.value] : labels.value.required)), 9, _hoisted_8)) : createCommentVNode("", true),
|
|
4850
|
+
__props.name ? (openBlock(), createElementBlock(Fragment, { key: 4 }, [createElementVNode("input", {
|
|
4851
|
+
type: "hidden",
|
|
4852
|
+
name: `${__props.name}.start`,
|
|
4853
|
+
value: committed.value?.start ?? "",
|
|
4854
|
+
disabled: __props.disabled
|
|
4855
|
+
}, null, 8, _hoisted_9), createElementVNode("input", {
|
|
4856
|
+
type: "hidden",
|
|
4857
|
+
name: `${__props.name}.end`,
|
|
4858
|
+
value: committed.value?.end ?? "",
|
|
4859
|
+
disabled: __props.disabled
|
|
4860
|
+
}, null, 8, _hoisted_10)], 64)) : createCommentVNode("", true),
|
|
4861
|
+
createVNode(SelectionValidation_default, {
|
|
4862
|
+
"has-value": !!committed.value && !committedError.value,
|
|
4863
|
+
required: __props.required || !!committedError.value,
|
|
4864
|
+
disabled: __props.disabled,
|
|
4865
|
+
onInvalid: _cache[4] || (_cache[4] = ($event) => {
|
|
4866
|
+
formError.value = true;
|
|
4867
|
+
root.value?.querySelector(".date-range__trigger")?.focus();
|
|
4868
|
+
}),
|
|
4869
|
+
onReset: reset
|
|
4870
|
+
}, null, 8, [
|
|
4871
|
+
"has-value",
|
|
4872
|
+
"required",
|
|
4873
|
+
"disabled"
|
|
4874
|
+
])
|
|
4875
|
+
], 10, _hoisted_1);
|
|
4876
|
+
};
|
|
4877
|
+
}
|
|
4878
|
+
});
|
|
4879
|
+
//#endregion
|
|
4880
|
+
export { Alert_default as Alert, Badge_default as Badge, Breadcrumb_default as Breadcrumb, Button_default as Button, ButtonGroup_default as ButtonGroup, ButtonGroupSeparator_default as ButtonGroupSeparator, ButtonGroupSeparator_default as ToggleButtonGroupSeparator, Card_default as Card, Chart_default as Chart, Checkbox_default as Checkbox, Combobox_default as Combobox, DataTable_default as DataTable, DateRangePicker_default as DateRangePicker, Dialog_default as Dialog, DropdownMenu_default as DropdownMenu, Empty_default as Empty, Field_default as Field, Form_default as Form, Input_default as Input, Label_default as Label, Listbox_default as Listbox, NumberField_default as NumberField, Pagination_default as Pagination, Popover_default as Popover, RadioGroup_default as RadioGroup, Select_default as Select, SelectGroup_default as SelectGroup, Separator_default as Separator, Sidebar_default as Sidebar, Skeleton_default as Skeleton, Spinner_default as Spinner, Switch_default as Switch, Table_default as Table, Tabs_default as Tabs, Textarea_default as Textarea, ToggleButton_default as ToggleButton, ToggleButtonGroup_default as ToggleButtonGroup, ToggleGroup_default as ToggleGroup, Tooltip_default as Tooltip, createDateRangePresets, rangeText as formatDateRange };
|
|
4881
|
+
|
|
4882
|
+
//# sourceMappingURL=index.js.map
|