@plexui/vue 0.16.0 → 0.17.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.
@@ -1,7 +1,8 @@
1
- import { maskitoDateOptionsGenerator, maskitoDateTimeOptionsGenerator, maskitoParseDate, maskitoParseDateTime, maskitoStringifyDate, maskitoStringifyDateTime, } from "@maskito/kit";
1
+ import { maskitoDateOptionsGenerator, maskitoDateTimeOptionsGenerator, } from "@maskito/kit";
2
2
  import { maskito as vMaskito } from "@maskito/vue";
3
3
  import { DateTime } from "luxon";
4
4
  import { computed, defineComponent, h, mergeProps, onBeforeUnmount, onMounted, ref, watch, withDirectives, } from "vue";
5
+ import { dateInputValueKey, dateInputZone, formatDateInput, keepTypedValue, maskDate, parseDateInput, } from "../../lib/dateInputText.js";
5
6
  import { Input } from "../Input/index.js";
6
7
  // Vue port of packages/ui/src/components/DateInput/DateInput.tsx: an Input
7
8
  // with a Maskito date (or date + time) mask, same options as React.
@@ -22,6 +23,9 @@ import { Input } from "../Input/index.js";
22
23
  // read the same way here, from the event bubbling through Input's container.
23
24
  // Input's `update:value` only keeps its controlled value in step, so Input
24
25
  // does not put the previous text back.
26
+ // - The text is made from the value's own fields in its own zone and read
27
+ // back into that zone (lib/dateInputText, shared with React), never through
28
+ // the browser's local Date.
25
29
  const DateInputComponent = defineComponent({
26
30
  name: "DateInput",
27
31
  inheritAttrs: false,
@@ -53,14 +57,24 @@ const DateInputComponent = defineComponent({
53
57
  },
54
58
  setup(props, { attrs, slots, emit, expose }) {
55
59
  const hasTime = computed(() => !!props.timeMode);
56
- // React memoizes on the dates' milliseconds, not on the DateTime objects
60
+ // React memoizes on the dates' milliseconds and the value's zone, not on the DateTime objects
61
+ const zone = computed(() => dateInputZone(props.value));
57
62
  const minMs = computed(() => props.min?.toMillis());
58
63
  const maxMs = computed(() => props.max?.toMillis());
64
+ const textFormat = computed(() => ({
65
+ mode: props.mode,
66
+ separator: props.separator,
67
+ timeMode: props.timeMode,
68
+ dateTimeSeparator: props.dateTimeSeparator,
69
+ min: minMs.value,
70
+ max: maxMs.value,
71
+ zone: zone.value,
72
+ }));
59
73
  const dateParams = computed(() => ({
60
74
  mode: props.mode,
61
75
  separator: props.separator,
62
- ...(minMs.value !== undefined ? { min: new Date(minMs.value) } : undefined),
63
- ...(maxMs.value !== undefined ? { max: new Date(maxMs.value) } : undefined),
76
+ ...(minMs.value !== undefined ? { min: maskDate(minMs.value, zone.value) } : undefined),
77
+ ...(maxMs.value !== undefined ? { max: maskDate(maxMs.value, zone.value) } : undefined),
64
78
  }));
65
79
  const dateTimeParams = computed(() => ({
66
80
  dateMode: props.mode,
@@ -68,32 +82,36 @@ const DateInputComponent = defineComponent({
68
82
  timeMode: props.timeMode ?? "HH:MM",
69
83
  dateTimeSeparator: props.dateTimeSeparator,
70
84
  ...(props.timeStep ? { timeStep: props.timeStep } : undefined),
71
- ...(minMs.value !== undefined ? { min: new Date(minMs.value) } : undefined),
72
- ...(maxMs.value !== undefined ? { max: new Date(maxMs.value) } : undefined),
85
+ ...(minMs.value !== undefined ? { min: maskDate(minMs.value, zone.value) } : undefined),
86
+ ...(maxMs.value !== undefined ? { max: maskDate(maxMs.value, zone.value) } : undefined),
73
87
  }));
74
- // Like React's memo, new options whenever either set of params changes
88
+ // Like React's memo, new options whenever either set of params changes. The mask shows a complete text as the
89
+ // value reads it (lib/dateInputText)
75
90
  const maskOptions = computed(() => {
76
91
  const date = dateParams.value;
77
92
  const dateTime = dateTimeParams.value;
78
- return hasTime.value ? maskitoDateTimeOptionsGenerator(dateTime) : maskitoDateOptionsGenerator(date);
93
+ const format = textFormat.value;
94
+ return keepTypedValue(hasTime.value ? maskitoDateTimeOptionsGenerator(dateTime) : maskitoDateOptionsGenerator(date), format);
79
95
  });
80
- const inputValue = ref("");
81
- const format = (date) => {
82
- if (!date)
83
- return "";
84
- return hasTime.value
85
- ? maskitoStringifyDateTime(date.toJSDate(), dateTimeParams.value)
86
- : maskitoStringifyDate(date.toJSDate(), dateParams.value);
87
- };
88
- const parse = (str) => hasTime.value ? maskitoParseDateTime(str, dateTimeParams.value) : maskitoParseDate(str, dateParams.value);
89
- // React formats the value in an effect: the first render (and the server
90
- // markup) has an empty field, without the clear button
91
- const syncInputValue = () => {
96
+ const format = (date) => formatDateInput(date, textFormat.value);
97
+ const parse = (str) => parseDateInput(str, textFormat.value);
98
+ // The first render, on the server too, already shows the value. A new
99
+ // value or format shows it again before the next render, as React does
100
+ // during its render
101
+ const inputValue = ref(format(props.value));
102
+ const syncKey = computed(() => [
103
+ dateInputValueKey(props.value),
104
+ props.mode,
105
+ props.separator,
106
+ props.timeMode,
107
+ props.dateTimeSeparator,
108
+ props.timeStep,
109
+ minMs.value,
110
+ maxMs.value,
111
+ ].join("|"));
112
+ watch(syncKey, () => {
92
113
  inputValue.value = format(props.value);
93
- };
94
- const valueMsKey = computed(() => props.value?.toMillis() ?? null);
95
- watch([valueMsKey, hasTime, dateParams, dateTimeParams], syncInputValue);
96
- onMounted(syncInputValue);
114
+ });
97
115
  const change = (value) => {
98
116
  emit("update:value", value);
99
117
  emit("change", value);
@@ -111,7 +129,7 @@ const DateInputComponent = defineComponent({
111
129
  }
112
130
  const parsed = parse(str);
113
131
  if (parsed) {
114
- change(DateTime.fromJSDate(parsed));
132
+ change(parsed);
115
133
  }
116
134
  };
117
135
  // Text that is not a complete date never reaches `change`, so leaving the
@@ -1 +1 @@
1
- {"version":3,"file":"DateInput.js","sourceRoot":"","sources":["../../../../src/components/DateInput/DateInput.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,2BAA2B,EAC3B,+BAA+B,EAC/B,gBAAgB,EAChB,oBAAoB,EACpB,oBAAoB,EACpB,wBAAwB,GAKzB,MAAM,cAAc,CAAA;AACrB,OAAO,EAAE,OAAO,IAAI,QAAQ,EAAE,MAAM,cAAc,CAAA;AAClD,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAA;AAChC,OAAO,EACL,QAAQ,EACR,eAA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AAC,cAAc,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;gBACzE,GAAG,CAAC,KAAK,CAAC,YAAY,CAAC,CAAC,CAAC,EAAE,YAAY,EAAE,KAAK,CAAC,YAAY,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;aACpE,CACF,EACD,CAAC,CAAC,QAAQ,EAAE,WAAW,CAAC,KAAK,CAAC,CAAC,CAChC,CAAA;QACH,CAAC,CAAA;IACH,CAAC;CACF,CAAC,CAAA;AAQF,kEAAkE;AAClE,MAAM,CAAC,MAAM,SAAS,GAAG,kBAAwF,CAAA","sourcesContent":["import {\n maskitoDateOptionsGenerator,\n maskitoDateTimeOptionsGenerator,\n maskitoParseDate,\n maskitoParseDateTime,\n maskitoStringifyDate,\n maskitoStringifyDateTime,\n type MaskitoDateMode,\n type MaskitoDateParams,\n type MaskitoDateTimeParams,\n type MaskitoTimeMode,\n} from \"@maskito/kit\"\nimport { maskito as vMaskito } from \"@maskito/vue\"\nimport { DateTime } from \"luxon\"\nimport {\n computed,\n defineComponent,\n h,\n mergeProps,\n onBeforeUnmount,\n onMounted,\n ref,\n watch,\n withDirectives,\n type PropType,\n} from \"vue\"\nimport { Input, type InputProps } from \"../Input/index.js\"\n\n// Vue port of packages/ui/src/components/DateInput/DateInput.tsx: an Input\n// with a Maskito date (or date + time) mask, same options as React.\n//\n// - `value` + `update:value` (`v-model:value`) and `change` mirror React's\n// `value` + `onChange`: both fire with a Luxon DateTime once a complete\n// valid date is typed, and with `null` when the field is emptied or cleared.\n// What is typed in between stays in the field without an event until the\n// field loses focus, which shows the value again.\n// - Every other attribute, listener and the `startAdornment` /\n// `endAdornment` slots go to Input, like React's `...inputProps`. React\n// sets `onInput` and `onClear` itself, so `@input` and `@clear` given to\n// DateInput are dropped, as there.\n// - The mask is `@maskito/vue`'s directive on Input's container; its default\n// element predicate picks the <input> inside.\n// - React reads the typed text in a listener React delegates to the root, so\n// it runs after Maskito's own `input` listeners on the <input>. The text is\n// read the same way here, from the event bubbling through Input's container.\n// Input's `update:value` only keeps its controlled value in step, so Input\n// does not put the previous text back.\n\nconst DateInputComponent = defineComponent({\n name: \"DateInput\",\n inheritAttrs: false,\n props: {\n /** Selected date (Luxon DateTime). Bind `v-model:value`. */\n value: { type: [Object, null] as PropType<DateTime | null>, required: true as const },\n /** Date format: `dd/mm/yyyy`, `mm/dd/yyyy`, `yyyy/mm/dd`, ... @default \"dd/mm/yyyy\" */\n mode: { type: String as PropType<MaskitoDateMode>, default: \"dd/mm/yyyy\" },\n /** Character between date parts. @default \".\" */\n separator: { type: String, default: \".\" },\n /** Enables time input: `HH:MM`, `HH:MM:SS`, ... */\n timeMode: String as PropType<MaskitoTimeMode>,\n /** Separator between the date and time parts. @default \", \" */\n dateTimeSeparator: { type: String, default: \", \" },\n /** Arrow-key increment step for time segments. @default 0 */\n timeStep: { type: Number, default: 0 },\n /** Earliest allowed date */\n min: Object as PropType<DateTime>,\n /** Latest allowed date */\n max: Object as PropType<DateTime>,\n /** Shows the clear button while the input has a value. @default false */\n clearable: { type: Boolean, default: false },\n /** Generated from the format when not set */\n placeholder: String,\n },\n emits: {\n \"update:value\": (value: DateTime | null) => value === null || DateTime.isDateTime(value),\n \"change\": (value: DateTime | null) => value === null || DateTime.isDateTime(value),\n },\n setup(props, { attrs, slots, emit, expose }) {\n const hasTime = computed(() => !!props.timeMode)\n // React memoizes on the dates' milliseconds, not on the DateTime objects\n const minMs = computed(() => props.min?.toMillis())\n const maxMs = computed(() => props.max?.toMillis())\n\n const dateParams = computed<MaskitoDateParams>(() => ({\n mode: props.mode,\n separator: props.separator,\n ...(minMs.value !== undefined ? { min: new Date(minMs.value) } : undefined),\n ...(maxMs.value !== undefined ? { max: new Date(maxMs.value) } : undefined),\n }))\n\n const dateTimeParams = computed<MaskitoDateTimeParams>(() => ({\n dateMode: props.mode,\n dateSeparator: props.separator,\n timeMode: props.timeMode ?? \"HH:MM\",\n dateTimeSeparator: props.dateTimeSeparator,\n ...(props.timeStep ? { timeStep: props.timeStep } : undefined),\n ...(minMs.value !== undefined ? { min: new Date(minMs.value) } : undefined),\n ...(maxMs.value !== undefined ? { max: new Date(maxMs.value) } : undefined),\n }))\n\n // Like React's memo, new options whenever either set of params changes\n const maskOptions = computed(() => {\n const date = dateParams.value\n const dateTime = dateTimeParams.value\n return hasTime.value ? maskitoDateTimeOptionsGenerator(dateTime) : maskitoDateOptionsGenerator(date)\n })\n\n const inputValue = ref(\"\")\n\n const format = (date: DateTime | null) => {\n if (!date) return \"\"\n return hasTime.value\n ? maskitoStringifyDateTime(date.toJSDate(), dateTimeParams.value)\n : maskitoStringifyDate(date.toJSDate(), dateParams.value)\n }\n\n const parse = (str: string) =>\n hasTime.value ? maskitoParseDateTime(str, dateTimeParams.value) : maskitoParseDate(str, dateParams.value)\n\n // React formats the value in an effect: the first render (and the server\n // markup) has an empty field, without the clear button\n const syncInputValue = () => {\n inputValue.value = format(props.value)\n }\n const valueMsKey = computed(() => props.value?.toMillis() ?? null)\n watch([valueMsKey, hasTime, dateParams, dateTimeParams], syncInputValue)\n onMounted(syncInputValue)\n\n const change = (value: DateTime | null) => {\n emit(\"update:value\", value)\n emit(\"change\", value)\n }\n\n const inputComponent = ref<{ $el: HTMLElement; input: HTMLInputElement | null; focus: () => void } | null>(null)\n\n const handleInput = (evt: Event) => {\n const input = inputComponent.value?.input\n if (!input || evt.target !== input) return\n const str = input.value\n inputValue.value = str\n\n if (!str) {\n change(null)\n return\n }\n\n const parsed = parse(str)\n\n if (parsed) {\n change(DateTime.fromJSDate(parsed))\n }\n }\n\n // Text that is not a complete date never reaches `change`, so leaving the\n // field shows the value again instead of a date the value does not hold\n const handleBlur = () => {\n if (inputValue.value && !parse(inputValue.value)) {\n inputValue.value = format(props.value)\n }\n }\n\n const handleClear = () => {\n inputValue.value = \"\"\n change(null)\n }\n\n let container: HTMLElement | null = null\n onMounted(() => {\n container = inputComponent.value?.$el ?? null\n container?.addEventListener(\"input\", handleInput)\n })\n onBeforeUnmount(() => {\n container?.removeEventListener(\"input\", handleInput)\n container = null\n })\n\n const defaultPlaceholder = computed(() => {\n const datePart = props.mode.replace(/\\//g, props.separator).toUpperCase()\n if (!hasTime.value) return datePart\n return `${datePart}${props.dateTimeSeparator}${props.timeMode}`\n })\n\n expose({\n focus: () => inputComponent.value?.focus(),\n input: computed(() => inputComponent.value?.input ?? null),\n })\n\n return () => {\n const { inputMode, inputmode, ...inputProps } = attrs\n delete inputProps.onInput\n delete inputProps.onClear\n return withDirectives(\n h(\n Input,\n // mergeProps keeps the caller's `@blur` and runs it first, as React does\n mergeProps(inputProps, {\n // Accept both native and JSX spelling, without duplicate DOM attributes.\n \"inputmode\": inputMode ?? inputmode ?? (props.timeMode?.includes(\"AA\") ? \"text\" : \"numeric\"),\n \"ref\": inputComponent,\n \"value\": inputValue.value,\n \"onUpdate:value\": (str: string) => {\n inputValue.value = str\n },\n \"onBlur\": handleBlur,\n \"placeholder\": props.placeholder ?? defaultPlaceholder.value,\n \"onClear\": props.clearable ? handleClear : undefined,\n }),\n {\n ...(slots.startAdornment ? { startAdornment: slots.startAdornment } : {}),\n ...(slots.endAdornment ? { endAdornment: slots.endAdornment } : {}),\n },\n ),\n [[vMaskito, maskOptions.value]],\n )\n }\n },\n})\n\ntype DateInputOwnProps = InstanceType<typeof DateInputComponent>[\"$props\"]\n\n/** DateInput props plus the Input props and attributes that fall through to it. */\nexport type DateInputProps = DateInputOwnProps &\n Omit<InputProps, keyof DateInputOwnProps | \"defaultValue\" | \"onUpdate:value\" | \"onInput\" | \"onClear\" | \"type\">\n\n/** Masked text input for typing dates (Luxon DateTime values). */\nexport const DateInput = DateInputComponent as typeof DateInputComponent & { new (): { $props: DateInputProps } }\n"]}
1
+ {"version":3,"file":"DateInput.js","sourceRoot":"","sources":["../../../../src/components/DateInput/DateInput.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,2BAA2B,EAC3B,+BAA+B,GAKhC,MAAM,cAAc,CAAA;AACrB,OAAO,EAAE,OAAO,IAAI,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,yEAAyE;YACzE,UAAU,CAAC,UAAU,EAAE;gBACrB,yEAAyE;gBACzE,WAAW,EAAE,SAAS,IAAI,SAAS,IAAI,CAAC,KAAK,CAAC,QAAQ,EAAE,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,SAAS,CAAC;gBAC5F,KAAK,EAAE,cAAc;gBACrB,OAAO,EAAE,UAAU,CAAC,KAAK;gBACzB,gBAAgB,EAAE,CAAC,GAAW,EAAE,EAAE;oBAChC,UAAU,CAAC,KAAK,GAAG,GAAG,CAAA;gBACxB,CAAC;gBACD,QAAQ,EAAE,UAAU;gBACpB,aAAa,EAAE,KAAK,CAAC,WAAW,IAAI,kBAAkB,CAAC,KAAK;gBAC5D,SAAS,EAAE,KAAK,CAAC,SAAS,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,SAAS;aACrD,CAAC,EACF;gBACE,GAAG,CAAC,KAAK,CAAC,cAAc,CAAC,CAAC,CAAC,EAAE,cAAc,EAAE,KAAK,CAAC,cAAc,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;gBACzE,GAAG,CAAC,KAAK,CAAC,YAAY,CAAC,CAAC,CAAC,EAAE,YAAY,EAAE,KAAK,CAAC,YAAY,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;aACpE,CACF,EACD,CAAC,CAAC,QAAQ,EAAE,WAAW,CAAC,KAAK,CAAC,CAAC,CAChC,CAAA;QACH,CAAC,CAAA;IACH,CAAC;CACF,CAAC,CAAA;AAQF,kEAAkE;AAClE,MAAM,CAAC,MAAM,SAAS,GAAG,kBAAwF,CAAA","sourcesContent":["import {\n maskitoDateOptionsGenerator,\n maskitoDateTimeOptionsGenerator,\n type MaskitoDateMode,\n type MaskitoDateParams,\n type MaskitoDateTimeParams,\n type MaskitoTimeMode,\n} from \"@maskito/kit\"\nimport { maskito as vMaskito } from \"@maskito/vue\"\nimport { DateTime } from \"luxon\"\nimport {\n computed,\n defineComponent,\n h,\n mergeProps,\n onBeforeUnmount,\n onMounted,\n ref,\n watch,\n withDirectives,\n type PropType,\n} from \"vue\"\nimport {\n dateInputValueKey,\n dateInputZone,\n formatDateInput,\n keepTypedValue,\n maskDate,\n parseDateInput,\n type DateInputFormat,\n} from \"../../lib/dateInputText.js\"\nimport { Input, type InputProps } from \"../Input/index.js\"\n\n// Vue port of packages/ui/src/components/DateInput/DateInput.tsx: an Input\n// with a Maskito date (or date + time) mask, same options as React.\n//\n// - `value` + `update:value` (`v-model:value`) and `change` mirror React's\n// `value` + `onChange`: both fire with a Luxon DateTime once a complete\n// valid date is typed, and with `null` when the field is emptied or cleared.\n// What is typed in between stays in the field without an event until the\n// field loses focus, which shows the value again.\n// - Every other attribute, listener and the `startAdornment` /\n// `endAdornment` slots go to Input, like React's `...inputProps`. React\n// sets `onInput` and `onClear` itself, so `@input` and `@clear` given to\n// DateInput are dropped, as there.\n// - The mask is `@maskito/vue`'s directive on Input's container; its default\n// element predicate picks the <input> inside.\n// - React reads the typed text in a listener React delegates to the root, so\n// it runs after Maskito's own `input` listeners on the <input>. The text is\n// read the same way here, from the event bubbling through Input's container.\n// Input's `update:value` only keeps its controlled value in step, so Input\n// does not put the previous text back.\n// - The text is made from the value's own fields in its own zone and read\n// back into that zone (lib/dateInputText, shared with React), never through\n// the browser's local Date.\n\nconst DateInputComponent = defineComponent({\n name: \"DateInput\",\n inheritAttrs: false,\n props: {\n /** Selected date (Luxon DateTime). Bind `v-model:value`. */\n value: { type: [Object, null] as PropType<DateTime | null>, required: true as const },\n /** Date format: `dd/mm/yyyy`, `mm/dd/yyyy`, `yyyy/mm/dd`, ... @default \"dd/mm/yyyy\" */\n mode: { type: String as PropType<MaskitoDateMode>, default: \"dd/mm/yyyy\" },\n /** Character between date parts. @default \".\" */\n separator: { type: String, default: \".\" },\n /** Enables time input: `HH:MM`, `HH:MM:SS`, ... */\n timeMode: String as PropType<MaskitoTimeMode>,\n /** Separator between the date and time parts. @default \", \" */\n dateTimeSeparator: { type: String, default: \", \" },\n /** Arrow-key increment step for time segments. @default 0 */\n timeStep: { type: Number, default: 0 },\n /** Earliest allowed date */\n min: Object as PropType<DateTime>,\n /** Latest allowed date */\n max: Object as PropType<DateTime>,\n /** Shows the clear button while the input has a value. @default false */\n clearable: { type: Boolean, default: false },\n /** Generated from the format when not set */\n placeholder: String,\n },\n emits: {\n \"update:value\": (value: DateTime | null) => value === null || DateTime.isDateTime(value),\n \"change\": (value: DateTime | null) => value === null || DateTime.isDateTime(value),\n },\n setup(props, { attrs, slots, emit, expose }) {\n const hasTime = computed(() => !!props.timeMode)\n // React memoizes on the dates' milliseconds and the value's zone, not on the DateTime objects\n const zone = computed(() => dateInputZone(props.value))\n const minMs = computed(() => props.min?.toMillis())\n const maxMs = computed(() => props.max?.toMillis())\n\n const textFormat = computed<DateInputFormat>(() => ({\n mode: props.mode,\n separator: props.separator,\n timeMode: props.timeMode,\n dateTimeSeparator: props.dateTimeSeparator,\n min: minMs.value,\n max: maxMs.value,\n zone: zone.value,\n }))\n\n const dateParams = computed<MaskitoDateParams>(() => ({\n mode: props.mode,\n separator: props.separator,\n ...(minMs.value !== undefined ? { min: maskDate(minMs.value, zone.value) } : undefined),\n ...(maxMs.value !== undefined ? { max: maskDate(maxMs.value, zone.value) } : undefined),\n }))\n\n const dateTimeParams = computed<MaskitoDateTimeParams>(() => ({\n dateMode: props.mode,\n dateSeparator: props.separator,\n timeMode: props.timeMode ?? \"HH:MM\",\n dateTimeSeparator: props.dateTimeSeparator,\n ...(props.timeStep ? { timeStep: props.timeStep } : undefined),\n ...(minMs.value !== undefined ? { min: maskDate(minMs.value, zone.value) } : undefined),\n ...(maxMs.value !== undefined ? { max: maskDate(maxMs.value, zone.value) } : undefined),\n }))\n\n // Like React's memo, new options whenever either set of params changes. The mask shows a complete text as the\n // value reads it (lib/dateInputText)\n const maskOptions = computed(() => {\n const date = dateParams.value\n const dateTime = dateTimeParams.value\n const format = textFormat.value\n return keepTypedValue(\n hasTime.value ? maskitoDateTimeOptionsGenerator(dateTime) : maskitoDateOptionsGenerator(date),\n format,\n )\n })\n\n const format = (date: DateTime | null) => formatDateInput(date, textFormat.value)\n const parse = (str: string) => parseDateInput(str, textFormat.value)\n\n // The first render, on the server too, already shows the value. A new\n // value or format shows it again before the next render, as React does\n // during its render\n const inputValue = ref(format(props.value))\n const syncKey = computed(() =>\n [\n dateInputValueKey(props.value),\n props.mode,\n props.separator,\n props.timeMode,\n props.dateTimeSeparator,\n props.timeStep,\n minMs.value,\n maxMs.value,\n ].join(\"|\"),\n )\n watch(syncKey, () => {\n inputValue.value = format(props.value)\n })\n\n const change = (value: DateTime | null) => {\n emit(\"update:value\", value)\n emit(\"change\", value)\n }\n\n const inputComponent = ref<{ $el: HTMLElement; input: HTMLInputElement | null; focus: () => void } | null>(null)\n\n const handleInput = (evt: Event) => {\n const input = inputComponent.value?.input\n if (!input || evt.target !== input) return\n const str = input.value\n inputValue.value = str\n\n if (!str) {\n change(null)\n return\n }\n\n const parsed = parse(str)\n\n if (parsed) {\n change(parsed)\n }\n }\n\n // Text that is not a complete date never reaches `change`, so leaving the\n // field shows the value again instead of a date the value does not hold\n const handleBlur = () => {\n if (inputValue.value && !parse(inputValue.value)) {\n inputValue.value = format(props.value)\n }\n }\n\n const handleClear = () => {\n inputValue.value = \"\"\n change(null)\n }\n\n let container: HTMLElement | null = null\n onMounted(() => {\n container = inputComponent.value?.$el ?? null\n container?.addEventListener(\"input\", handleInput)\n })\n onBeforeUnmount(() => {\n container?.removeEventListener(\"input\", handleInput)\n container = null\n })\n\n const defaultPlaceholder = computed(() => {\n const datePart = props.mode.replace(/\\//g, props.separator).toUpperCase()\n if (!hasTime.value) return datePart\n return `${datePart}${props.dateTimeSeparator}${props.timeMode}`\n })\n\n expose({\n focus: () => inputComponent.value?.focus(),\n input: computed(() => inputComponent.value?.input ?? null),\n })\n\n return () => {\n const { inputMode, inputmode, ...inputProps } = attrs\n delete inputProps.onInput\n delete inputProps.onClear\n return withDirectives(\n h(\n Input,\n // mergeProps keeps the caller's `@blur` and runs it first, as React does\n mergeProps(inputProps, {\n // Accept both native and JSX spelling, without duplicate DOM attributes.\n \"inputmode\": inputMode ?? inputmode ?? (props.timeMode?.includes(\"AA\") ? \"text\" : \"numeric\"),\n \"ref\": inputComponent,\n \"value\": inputValue.value,\n \"onUpdate:value\": (str: string) => {\n inputValue.value = str\n },\n \"onBlur\": handleBlur,\n \"placeholder\": props.placeholder ?? defaultPlaceholder.value,\n \"onClear\": props.clearable ? handleClear : undefined,\n }),\n {\n ...(slots.startAdornment ? { startAdornment: slots.startAdornment } : {}),\n ...(slots.endAdornment ? { endAdornment: slots.endAdornment } : {}),\n },\n ),\n [[vMaskito, maskOptions.value]],\n )\n }\n },\n})\n\ntype DateInputOwnProps = InstanceType<typeof DateInputComponent>[\"$props\"]\n\n/** DateInput props plus the Input props and attributes that fall through to it. */\nexport type DateInputProps = DateInputOwnProps &\n Omit<InputProps, keyof DateInputOwnProps | \"defaultValue\" | \"onUpdate:value\" | \"onInput\" | \"onClear\" | \"type\">\n\n/** Masked text input for typing dates (Luxon DateTime values). */\nexport const DateInput = DateInputComponent as typeof DateInputComponent & { new (): { $props: DateInputProps } }\n"]}
@@ -1,5 +1,5 @@
1
- import { computed, defineComponent, Fragment, h, inject, onBeforeUnmount, onMounted, provide, ref, Text, watch, } from "vue";
2
- import { attachDrawerSwipe, closeOnUnhandledEscape, drawerInitialFocus, loopDrawerFocus } from "../../lib/phoneDrawer.js";
1
+ import { computed, defineComponent, Fragment, h, inject, onBeforeUnmount, onMounted, onUnmounted, provide, ref, Text, watch, } from "vue";
2
+ import { attachDrawerSwipe, closeOnUnhandledEscape, drawerInitialFocus, returnDrawerFocus, loopDrawerFocus, } from "../../lib/phoneDrawer.js";
3
3
  import { Button } from "../Button/index.js";
4
4
  import { ChevronRightMd, Disclosure, Search as SearchIcon, Sidebar as SidebarIcon, SidebarMenuMobile, X } from "../Icon/index.js";
5
5
  import { Input } from "../Input/index.js";
@@ -541,6 +541,8 @@ export const SidebarMobileMenuButton = defineComponent({
541
541
  return h("button", {
542
542
  "type": "button",
543
543
  "data-expanded": sidebar.openMobile ? "" : undefined,
544
+ // Where focus goes when a drawer closes and what opened it can no longer take it (lib/phoneDrawer)
545
+ "data-sidebar-mobile-menu-button": "",
544
546
  "class": [s.MobileMenuButton, className],
545
547
  // The caller's listener runs first and can cancel the toggle
546
548
  "onClick": composeEventHandlers(onClick, () => sidebar.setOpenMobile(!sidebar.openMobile)),
@@ -564,6 +566,18 @@ export const SidebarMobileMenuButton = defineComponent({
564
566
  * goes back to the control that opened it. A swipe in from the edge it slides from opens it and a swipe back closes
565
567
  * it (lib/phoneDrawer).
566
568
  */
569
+ /** Runs `run` once `element` has left the page: a leaving `<Transition>` keeps it there for its animation */
570
+ const whenDetached = (element, run) => {
571
+ if (!element.isConnected)
572
+ return run();
573
+ const observer = new MutationObserver(() => {
574
+ if (element.isConnected)
575
+ return;
576
+ observer.disconnect();
577
+ run();
578
+ });
579
+ observer.observe(element.ownerDocument, { childList: true, subtree: true });
580
+ };
567
581
  const SidebarMobileComponent = defineComponent({
568
582
  name: "SidebarMobile",
569
583
  inheritAttrs: false,
@@ -581,22 +595,35 @@ const SidebarMobileComponent = defineComponent({
581
595
  drawer.value = el instanceof HTMLElement ? el : el?.$el;
582
596
  };
583
597
  let detachSwipe;
598
+ // Vue runs a watcher's cleanup on unmount while the drawer is still on the page, where React runs it once the
599
+ // drawer has left: focus goes back once the drawer has left (after unmount, or after a leaving <Transition>), so a
600
+ // menu button that leaves with the drawer is not picked
601
+ let unmounting = false;
602
+ let restoreAfterUnmount;
584
603
  onMounted(() => {
585
- // Focus moves in on open and back to what opened the drawer on close (from mount, as React's effect). A drawer
586
- // that is not contained shows only at phone width, so going back to it from a wide window moves focus in again.
604
+ // Focus moves in on open and back to what opened the drawer on close, or to a menu button when that can no longer
605
+ // take it (from mount, as React's effect). A drawer that is not contained shows only at phone width, so going
606
+ // back to it from a wide window moves focus in again.
587
607
  watch(() => sidebar.openMobile && (sidebar.isMobile || Boolean(props.contained)), (open, _, onCleanup) => {
588
608
  const el = drawer.value;
589
609
  if (!open || !el)
590
610
  return;
591
611
  const trigger = document.activeElement;
612
+ // Taken now: after unmount the drawer has left the page, with no provider around it
613
+ const root = el.closest("[data-mobile-menu]");
592
614
  if (!el.contains(document.activeElement))
593
615
  drawerInitialFocus(el).focus({ preventScroll: true });
594
616
  onCleanup(() => {
595
- const active = document.activeElement;
596
- const lost = !active || active === document.body || el.contains(active);
597
- if (lost && trigger instanceof HTMLElement && trigger.isConnected && !el.contains(trigger)) {
598
- trigger.focus({ preventScroll: true });
599
- }
617
+ const restore = () => {
618
+ const active = document.activeElement;
619
+ const lost = !active || active === document.body || el.contains(active);
620
+ if (lost)
621
+ returnDrawerFocus(trigger, el, root);
622
+ };
623
+ if (unmounting)
624
+ restoreAfterUnmount = () => whenDetached(el, restore);
625
+ else
626
+ restore();
600
627
  });
601
628
  }, { flush: "post", immediate: true });
602
629
  const el = drawer.value;
@@ -611,7 +638,14 @@ const SidebarMobileComponent = defineComponent({
611
638
  enabled: () => sidebar.isMobile,
612
639
  });
613
640
  });
614
- onBeforeUnmount(() => detachSwipe?.());
641
+ onBeforeUnmount(() => {
642
+ unmounting = true;
643
+ detachSwipe?.();
644
+ });
645
+ onUnmounted(() => {
646
+ restoreAfterUnmount?.();
647
+ restoreAfterUnmount = undefined;
648
+ });
615
649
  const onDrawerKeydown = (event) => {
616
650
  const el = drawer.value;
617
651
  if (!sidebar.openMobile || !el)
@@ -1 +1 @@
1
- {"version":3,"file":"Sidebar.js","sourceRoot":"","sources":["../../../../src/components/Sidebar/Sidebar.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EACR,eAAe,EACf,QAAQ,EACR,CAAC,EACD,MAAM,EACN,eAAe,EACf,SAAS,EACT,OAAO,EACP,GAAG,EACH,IAAI,EACJ,KAAK,GAYN,MAAM,KAAK,CAAA;AACZ,OAAO,EAAE,iB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computed,\n defineComponent,\n Fragment,\n h,\n inject,\n onBeforeUnmount,\n onMounted,\n provide,\n ref,\n Text,\n watch,\n type AnchorHTMLAttributes,\n type ButtonHTMLAttributes,\n type DefineComponent,\n type HTMLAttributes,\n type InjectionKey,\n type LiHTMLAttributes,\n type PropType,\n type Ref,\n type Slots,\n type VNode,\n type VNodeArrayChildren,\n} from \"vue\"\nimport { attachDrawerSwipe, closeOnUnhandledEscape, drawerInitialFocus, loopDrawerFocus } from \"../../lib/phoneDrawer.js\"\nimport { Button } from \"../Button/index.js\"\nimport { ChevronRightMd, Disclosure, Search as SearchIcon, Sidebar as SidebarIcon, SidebarMenuMobile, X } from \"../Icon/index.js\"\nimport { Input, type InputProps } from \"../Input/index.js\"\nimport { Tooltip } from \"../Tooltip/index.js\"\nimport { composeEventHandlers, firstElementChild, flattenSlot, mergeSlotProps } from \"../Tooltip/slot.js\"\nimport s from \"@plexui/styles/components/Sidebar/Sidebar.module.css\"\nimport {\n SidebarProvider,\n useSidebar,\n type SidebarCollapsible,\n type SidebarSide,\n type SidebarProviderVariant,\n type SidebarVariant,\n} from \"./useSidebarContext.js\"\n\n// Vue port of packages/ui/src/components/Sidebar/Sidebar.tsx. Exports are\n// flat, as in React's index. Every part renders its React element with the\n// caller's attributes applied after its own (React spreads `...props` last),\n// so a caller's attribute or listener replaces the part's own. `class` is\n// merged. An `@click` on SidebarTrigger or SidebarMobileMenuButton runs before\n// the toggle and cancels it with `preventDefault()`, as `onClick` does in\n// React. `data-toggle` (injected by MDX) is dropped, as React's `cleanProps`\n// does.\n// - `asChild` (SidebarGroupLabel, SidebarMenuButton, SidebarMenuSubButton)\n// merges into the first element of the default slot the way Radix's Slot\n// does. SidebarMenuButton puts its inner `<span>` inside that element,\n// around the element's own content, as React clones it; with no single\n// element child it merges into the inner `<span>` instead.\n// - ReactNode props are slots: SidebarMenuButton `tooltip` (prop or\n// `#tooltip` slot), SidebarTrigger's icon (default slot), SidebarInput's\n// `startAdornment` (slot, Search icon by default).\n// - Parts whose React children are fixed (SidebarMenuChevron,\n// SidebarMenuSkeleton, SidebarMobileMenuButton) ignore the default slot.\n\n// Re-export provider and composable\nexport { SidebarProvider, useSidebar }\nexport type { SidebarCollapsible, SidebarProviderVariant, SidebarSide, SidebarVariant }\n\ntype Attrs = Record<string, unknown>\n\n// Filter out attributes that shouldn't reach the DOM (e.g. injected by MDX)\nconst cleanAttrs = (attrs: Attrs) => {\n const { \"data-toggle\": _, class: className, ...rest } = attrs\n return { className, rest }\n}\n\n// An explicit type keeps the published declaration on Vue's `DefineComponent`\n// alias; an inferred one is expanded there and fails consumers' type checks\n// (`GlobalComponents` against `Record<string, Component>`, TS2344).\ntype Part<A> = DefineComponent & { new (): { $props: A } }\n\n/** A part that renders one element with its class and the caller's attributes. */\nconst part = <A>(name: string, tag: string, className: string | undefined): Part<A> => {\n const component = defineComponent({\n name,\n inheritAttrs: false,\n setup(_props, { attrs, slots }) {\n return () => {\n const { className: userClass, rest } = cleanAttrs(attrs)\n return h(tag, { ...rest, class: [className, userClass] }, slots.default?.())\n }\n },\n })\n return component as unknown as Part<A>\n}\n\n// =============================================\n// Sidebar Root\n// =============================================\n\nconst SidebarComponent = defineComponent({\n name: \"Sidebar\",\n inheritAttrs: false,\n props: {\n /** The side the sidebar is on. @default \"left\" */\n side: { type: String as PropType<SidebarSide>, default: \"left\" },\n /** The visual variant of the sidebar. @default \"sidebar\" */\n variant: { type: String as PropType<SidebarVariant>, default: \"sidebar\" },\n },\n setup(props, { attrs, slots }) {\n const sidebar = useSidebar()\n\n return () => {\n // Skip rendering sidebar on mobile for offcanvas mode\n if (sidebar.isMobile && sidebar.collapsible === \"offcanvas\") {\n return null\n }\n\n const { className, rest } = cleanAttrs(attrs)\n return h(\n \"aside\",\n { \"data-side\": props.side, \"data-variant\": props.variant, \"class\": [s.Sidebar, className], ...rest },\n slots.default?.(),\n )\n }\n },\n})\n\nexport type SidebarProps = InstanceType<typeof SidebarComponent>[\"$props\"] & HTMLAttributes\n\n/** The sidebar container, an `<aside>`. Renders nothing on mobile in offcanvas mode. */\nexport const Sidebar = SidebarComponent as typeof SidebarComponent & { new (): { $props: SidebarProps } }\n\n// =============================================\n// Sidebar Sections\n// =============================================\n\nexport type SidebarHeaderProps = HTMLAttributes\n\n/** Sticky top area of the sidebar. */\nexport const SidebarHeader = part<SidebarHeaderProps>(\"SidebarHeader\", \"div\", s.Header)\n\nexport type SidebarContentProps = HTMLAttributes\n\n/**\n * Scrollable content area. Sets `data-content-scrollable` on the sidebar\n * while its content overflows.\n */\nexport const SidebarContent = defineComponent({\n name: \"SidebarContent\",\n inheritAttrs: false,\n setup(_props, { attrs, slots }) {\n const contentEl = ref<HTMLDivElement | null>(null)\n let observer: ResizeObserver | undefined\n\n onMounted(() => {\n const el = contentEl.value\n if (!el) return\n const sidebar = el.parentElement\n if (!sidebar) return\n\n const update = () => {\n const hasOverflow = el.scrollHeight > el.clientHeight\n sidebar.setAttribute(\"data-content-scrollable\", hasOverflow ? \"true\" : \"false\")\n }\n update()\n observer = new ResizeObserver(update)\n observer.observe(el)\n })\n onBeforeUnmount(() => observer?.disconnect())\n\n return () => {\n const { className, rest } = cleanAttrs(attrs)\n return h(\"div\", { ref: contentEl, class: [s.Content, className], ...rest }, slots.default?.())\n }\n },\n}) as unknown as ReturnType<typeof part<SidebarContentProps>>\n\nexport type SidebarFooterProps = HTMLAttributes\n\n/** Sticky bottom area of the sidebar, with a separator line on top. */\nexport const SidebarFooter = defineComponent({\n name: \"SidebarFooter\",\n inheritAttrs: false,\n setup(_props, { attrs, slots }) {\n return () => {\n const { className, rest } = cleanAttrs(attrs)\n return h(\"div\", { class: [s.Footer, className], ...rest }, [\n h(\"div\", { class: s.FooterSeparator }),\n slots.default?.(),\n ])\n }\n },\n}) as unknown as ReturnType<typeof part<SidebarFooterProps>>\n\nexport type SidebarRailProps = HTMLAttributes\n\nexport const SidebarRail = part<SidebarRailProps>(\"SidebarRail\", \"div\", s.Rail)\n\n// =============================================\n// Groups\n// =============================================\n\nconst SidebarGroupComponent = defineComponent({\n name: \"SidebarGroup\",\n inheritAttrs: false,\n props: {\n /** Whether the group is open initially. A closed group hides its `SidebarGroupContent`. @default true */\n defaultOpen: { type: Boolean, default: true },\n /** Controlled open state. The group has no toggle of its own: change `open` from your own control. */\n open: { type: Boolean, default: undefined },\n },\n setup(props, { attrs, slots }) {\n // The initial value only, like an uncontrolled input's defaultValue\n const internalOpen = ref(props.defaultOpen)\n\n return () => {\n const open = props.open ?? internalOpen.value\n const { className, rest } = cleanAttrs(attrs)\n return h(\n \"div\",\n { \"data-state\": open ? \"open\" : \"closed\", \"class\": [s.Group, className], ...rest },\n slots.default?.(),\n )\n }\n },\n})\n\nexport type SidebarGroupProps = InstanceType<typeof SidebarGroupComponent>[\"$props\"] & HTMLAttributes\n\n/** Section within the content. `data-state` follows `open` / `defaultOpen`. */\nexport const SidebarGroup = SidebarGroupComponent as typeof SidebarGroupComponent & {\n new (): { $props: SidebarGroupProps }\n}\n\n/** Radix Slot: the first element of the slot, with `slotProps` merged in. */\nconst renderAsChild = (children: VNodeArrayChildren | undefined, slotProps: Attrs) => {\n const child = firstElementChild(children)\n return child ? mergeSlotProps(child, slotProps) : null\n}\n\n/**\n * React's `cloneElement(child, undefined, wrap(child.props.children))`: the\n * same element (key and ref kept) with its content, or its default slot for a\n * component such as RouterLink, passed through `wrap`.\n */\nconst wrapChildContent = (child: VNode, wrap: (content: VNodeArrayChildren | undefined) => VNode): VNode => {\n const content = child.children\n let children: VNodeArrayChildren | Slots\n if (content && typeof content === \"object\" && !Array.isArray(content)) {\n // Drop the compiled-slots flag so the new default slot is always used\n const { _: _compiled, ...slotFns } = content as Slots & { _?: unknown }\n children = { ...slotFns, default: () => [wrap(slotFns.default?.())] }\n } else {\n children = [wrap(typeof content === \"string\" ? [content] : (content ?? undefined))]\n }\n return h(child.type as string, { ...child.props, key: child.key ?? undefined, ref: child.ref as never }, children as never)\n}\n\nconst SidebarGroupLabelComponent = defineComponent({\n name: \"SidebarGroupLabel\",\n inheritAttrs: false,\n props: {\n /** Merges into the slot's first element instead of rendering a `<span>`. @default false */\n asChild: { type: Boolean, default: false },\n /**\n * Size variant for the label.\n * - \"sm\": Compact style for dashboard/settings sidebars\n * - \"lg\": Documentation style with larger text and more spacing\n * @default \"lg\"\n */\n size: { type: String as PropType<\"sm\" | \"lg\">, default: \"lg\" },\n },\n setup(props, { attrs, slots }) {\n return () => {\n const { className, rest } = cleanAttrs(attrs)\n const ownProps = { \"data-size\": props.size, \"class\": [s.GroupLabel, className], ...rest }\n return props.asChild ? renderAsChild(slots.default?.(), ownProps) : h(\"span\", ownProps, slots.default?.())\n }\n },\n})\n\nexport type SidebarGroupLabelProps = InstanceType<typeof SidebarGroupLabelComponent>[\"$props\"] & HTMLAttributes\n\n/** Section label within a SidebarGroup. */\nexport const SidebarGroupLabel = SidebarGroupLabelComponent as typeof SidebarGroupLabelComponent & {\n new (): { $props: SidebarGroupLabelProps }\n}\n\nexport type SidebarGroupActionProps = HTMLAttributes\n\nexport const SidebarGroupAction = part<SidebarGroupActionProps>(\"SidebarGroupAction\", \"div\", s.GroupAction)\n\nexport type SidebarGroupContentProps = HTMLAttributes\n\nexport const SidebarGroupContent = part<SidebarGroupContentProps>(\"SidebarGroupContent\", \"div\", s.GroupContent)\n\n// =============================================\n// Menu\n// =============================================\n\nexport type SidebarMenuProps = HTMLAttributes\n\n/** Navigation menu, a `<ul>`. */\nexport const SidebarMenu = part<SidebarMenuProps>(\"SidebarMenu\", \"ul\", s.Menu)\n\nconst SidebarMenuItemComponent = defineComponent({\n name: \"SidebarMenuItem\",\n inheritAttrs: false,\n props: {\n /** Marks the item as expanded (`data-expanded`), for chevrons and sub menus. */\n expanded: { type: Boolean, default: undefined },\n },\n setup(props, { attrs, slots }) {\n return () => {\n const { className, rest } = cleanAttrs(attrs)\n return h(\n \"li\",\n { \"data-expanded\": props.expanded ? \"true\" : undefined, \"class\": [s.MenuItem, className], ...rest },\n slots.default?.(),\n )\n }\n },\n})\n\nexport type SidebarMenuItemProps = InstanceType<typeof SidebarMenuItemComponent>[\"$props\"] & LiHTMLAttributes\n\n/** Menu item, an `<li>`. */\nexport const SidebarMenuItem = SidebarMenuItemComponent as typeof SidebarMenuItemComponent & {\n new (): { $props: SidebarMenuItemProps }\n}\n\n// =============================================\n// Menu Button\n// =============================================\n\n// Shared by every row of the rail: moving to the next one shows its label at once.\nlet railLeftAt = 0\n\n// Rows inside the mobile drawer end with a disclosure chevron (see the drawer list in the styles), unless the drawer\n// leaves it out (`:disclosure=\"false\"`).\nconst sidebarDrawerKey: InjectionKey<Ref<boolean>> = Symbol(\"SidebarDrawer\")\nconst notInDrawer = computed(() => false)\n\n/** The chevron of a drawer row that leads to another page. */\nconst menuDisclosure = () => h(\"span\", { \"class\": s.MenuDisclosure, \"aria-hidden\": \"true\" }, [h(Disclosure)])\n\nconst SidebarMenuButtonComponent = defineComponent({\n name: \"SidebarMenuButton\",\n inheritAttrs: false,\n props: {\n /** Whether the button is in an active/highlighted state. @default false */\n isActive: { type: Boolean, default: false },\n /**\n * Optional tooltip to show when the sidebar is collapsed (or the\n * `#tooltip` slot). Hidden on mobile.\n */\n tooltip: String,\n /** Whether to render the button as a custom element via Slot. @default false */\n asChild: { type: Boolean, default: false },\n },\n setup(props, { attrs, slots }) {\n const sidebar = useSidebar()\n const drawerRows = inject(sidebarDrawerKey, notInDrawer)\n const openDelay = ref<number>()\n\n return () => {\n const { className, rest } = cleanAttrs(attrs)\n const hasTooltip = !!(props.tooltip || slots.tooltip)\n const ownProps: Record<string, unknown> = {\n \"data-active\": props.isActive ? \"true\" : \"false\",\n \"aria-current\": props.isActive ? \"page\" : undefined,\n \"class\": [s.MenuButton, className],\n ...rest,\n }\n if (hasTooltip) {\n ownProps.onPointerenter = composeEventHandlers(rest.onPointerenter, () => {\n openDelay.value = Date.now() - railLeftAt < 300 ? 0 : undefined\n })\n ownProps.onPointerleave = composeEventHandlers(rest.onPointerleave, () => {\n railLeftAt = Date.now()\n })\n }\n const content = slots.default?.()\n const wrap = (children: VNodeArrayChildren | undefined) =>\n h(\"span\", { class: s.MenuButtonInner }, drawerRows.value ? [children, menuDisclosure()] : children)\n let button: VNode\n if (props.asChild) {\n // With asChild the child element is the button, so the inner wrapper\n // goes inside it. Wrapping the child instead would merge the button\n // attributes onto the wrapper span.\n // A lone text child is wrapped below rather than slotted\n const nodes = flattenSlot(content)\n const child = nodes.length === 1 && nodes[0].type !== Text ? nodes[0] : undefined\n button = mergeSlotProps(child ? wrapChildContent(child, wrap) : wrap(content), ownProps)\n } else {\n button = h(\"button\", ownProps, [wrap(content)])\n }\n\n // The tooltip shows when collapsed (icon mode) and not on mobile. It wraps\n // the row in every state, so the row stays mounted and its label can fade.\n if (hasTooltip) {\n const shown = sidebar.state === \"collapsed\" && !sidebar.isMobile\n return h(\n Tooltip,\n { content: shown ? props.tooltip : null, openDelay: openDelay.value, side: \"right\" },\n { default: () => button, ...(slots.tooltip && shown ? { content: slots.tooltip } : {}) },\n )\n }\n\n return button\n }\n },\n})\n\nexport type SidebarMenuButtonProps = InstanceType<typeof SidebarMenuButtonComponent>[\"$props\"] & ButtonHTMLAttributes\n\n/** Menu item button. Shows its `tooltip` when the sidebar is collapsed to icons. */\nexport const SidebarMenuButton = SidebarMenuButtonComponent as typeof SidebarMenuButtonComponent & {\n new (): { $props: SidebarMenuButtonProps }\n}\n\n// =============================================\n// Menu Button Parts\n// =============================================\n\nexport type SidebarMenuButtonIconProps = HTMLAttributes\n\nexport const SidebarMenuButtonIcon = part<SidebarMenuButtonIconProps>(\n \"SidebarMenuButtonIcon\",\n \"span\",\n s.MenuButtonIcon,\n)\n\nconst SidebarMenuButtonLabelComponent = defineComponent({\n name: \"SidebarMenuButtonLabel\",\n inheritAttrs: false,\n props: {\n /** Shorter label rendered next to the full one (`data-short-label`). */\n shortLabel: String,\n },\n setup(props, { attrs, slots }) {\n return () => {\n const { className, rest } = cleanAttrs(attrs)\n return [\n h(\n \"span\",\n { \"data-long-label\": \"true\", \"class\": [s.MenuButtonLabel, className], ...rest },\n slots.default?.(),\n ),\n props.shortLabel\n ? h(\"span\", { \"data-short-label\": \"true\", \"class\": [s.MenuButtonLabel, className] }, props.shortLabel)\n : null,\n ]\n }\n },\n})\n\nexport type SidebarMenuButtonLabelProps = InstanceType<typeof SidebarMenuButtonLabelComponent>[\"$props\"] & HTMLAttributes\n\nexport const SidebarMenuButtonLabel = SidebarMenuButtonLabelComponent as typeof SidebarMenuButtonLabelComponent & {\n new (): { $props: SidebarMenuButtonLabelProps }\n}\n\n// =============================================\n// Menu Chevron (Expand/Collapse Toggle)\n// =============================================\n\nexport type SidebarMenuChevronProps = HTMLAttributes\n\nexport const SidebarMenuChevron = defineComponent({\n name: \"SidebarMenuChevron\",\n inheritAttrs: false,\n setup(_props, { attrs }) {\n return () => {\n const { className, rest } = cleanAttrs(attrs)\n return h(\"span\", { class: [s.MenuChevron, className], ...rest }, [h(ChevronRightMd)])\n }\n },\n}) as unknown as ReturnType<typeof part<SidebarMenuChevronProps>>\n\n// =============================================\n// Menu Badge & Action\n// =============================================\n\nexport type SidebarMenuBadgeProps = HTMLAttributes\n\nexport const SidebarMenuBadge = part<SidebarMenuBadgeProps>(\"SidebarMenuBadge\", \"span\", s.MenuBadge)\n\nexport type SidebarMenuActionProps = HTMLAttributes\n\nexport const SidebarMenuAction = part<SidebarMenuActionProps>(\"SidebarMenuAction\", \"div\", s.MenuAction)\n\n// =============================================\n// Menu Skeleton\n// =============================================\n\nconst SidebarMenuSkeletonComponent = defineComponent({\n name: \"SidebarMenuSkeleton\",\n inheritAttrs: false,\n props: {\n /** Renders the icon placeholder. @default true */\n showIcon: { type: Boolean, default: true },\n /** Width of the label skeleton (e.g., \"60%\", \"80%\", \"100px\"). @default \"60%\" */\n labelWidth: { type: String, default: \"60%\" },\n },\n setup(props, { attrs }) {\n return () => {\n const { className, rest } = cleanAttrs(attrs)\n return h(\"div\", { \"data-skeleton\": \"true\", \"class\": [s.MenuSkeleton, className], ...rest }, [\n props.showIcon ? h(\"div\", { class: s.MenuSkeletonIcon }) : null,\n h(\"div\", { class: s.MenuSkeletonLabel, style: { width: props.labelWidth } }),\n ])\n }\n },\n})\n\nexport type SidebarMenuSkeletonProps = InstanceType<typeof SidebarMenuSkeletonComponent>[\"$props\"] & HTMLAttributes\n\nexport const SidebarMenuSkeleton = SidebarMenuSkeletonComponent as typeof SidebarMenuSkeletonComponent & {\n new (): { $props: SidebarMenuSkeletonProps }\n}\n\n// =============================================\n// Submenu\n// =============================================\n\nconst SidebarMenuSubComponent = defineComponent({\n name: \"SidebarMenuSub\",\n inheritAttrs: false,\n props: {\n /** Whether the submenu is expanded. @default true */\n open: { type: Boolean, default: true },\n /**\n * When true, child items align with parent text that has icons.\n * This adjusts the padding so level 2 text aligns with level 1 text.\n * @default false\n */\n hasIcons: { type: Boolean, default: false },\n },\n setup(props, { attrs, slots }) {\n return () => {\n const { className, rest } = cleanAttrs(attrs)\n return h(\n \"ul\",\n {\n \"data-state\": props.open ? \"open\" : \"closed\",\n \"data-has-icons\": props.hasIcons ? \"true\" : undefined,\n // Collapsed items are only hidden visually: keep them out of the tab\n // order. \"\" renders `inert=\"\"` (a DOM property in browsers)\n \"inert\": props.open ? undefined : \"\",\n \"class\": [s.MenuSub, className],\n ...rest,\n },\n slots.default?.(),\n )\n }\n },\n})\n\nexport type SidebarMenuSubProps = InstanceType<typeof SidebarMenuSubComponent>[\"$props\"] & HTMLAttributes\n\nexport const SidebarMenuSub = SidebarMenuSubComponent as typeof SidebarMenuSubComponent & {\n new (): { $props: SidebarMenuSubProps }\n}\n\nexport type SidebarMenuSubItemProps = LiHTMLAttributes\n\nexport const SidebarMenuSubItem = part<SidebarMenuSubItemProps>(\"SidebarMenuSubItem\", \"li\", s.MenuSubItem)\n\nconst SidebarMenuSubButtonComponent = defineComponent({\n name: \"SidebarMenuSubButton\",\n inheritAttrs: false,\n props: {\n /** Whether the button is in an active/highlighted state. @default false */\n isActive: { type: Boolean, default: false },\n /** Merges into the slot's first element instead of rendering a `<button>`. @default false */\n asChild: { type: Boolean, default: false },\n /**\n * Indent level for nested items (0-3).\n * Each level adds 12px of left margin.\n * @default 0\n */\n indent: { type: Number as PropType<0 | 1 | 2 | 3>, default: 0 },\n },\n setup(props, { attrs, slots }) {\n const drawerRows = inject(sidebarDrawerKey, notInDrawer)\n return () => {\n const { className, rest } = cleanAttrs(attrs)\n const ownProps = {\n \"data-active\": props.isActive ? \"true\" : \"false\",\n \"aria-current\": props.isActive ? \"page\" : undefined,\n \"class\": [s.MenuSubButton, s[`indent${props.indent}`], className],\n ...rest,\n }\n const content = slots.default?.()\n if (!drawerRows.value) return props.asChild ? renderAsChild(content, ownProps) : h(\"button\", ownProps, content)\n // In the drawer the disclosure follows the content, inside the child element with asChild\n if (props.asChild) {\n const child = firstElementChild(content)\n return child ? mergeSlotProps(wrapChildContent(child, (inner) => h(Fragment, null, [inner, menuDisclosure()])), ownProps) : null\n }\n return h(\"button\", ownProps, [content, menuDisclosure()])\n }\n },\n})\n\nexport type SidebarMenuSubButtonProps = InstanceType<typeof SidebarMenuSubButtonComponent>[\"$props\"] & ButtonHTMLAttributes\n\nexport const SidebarMenuSubButton = SidebarMenuSubButtonComponent as typeof SidebarMenuSubButtonComponent & {\n new (): { $props: SidebarMenuSubButtonProps }\n}\n\n// =============================================\n// Separator\n// =============================================\n\nexport type SidebarSeparatorProps = HTMLAttributes\n\nexport const SidebarSeparator = defineComponent({\n name: \"SidebarSeparator\",\n inheritAttrs: false,\n setup(_props, { attrs }) {\n return () => {\n const { className, rest } = cleanAttrs(attrs)\n return h(\"hr\", { class: [s.Separator, className], ...rest })\n }\n },\n}) as unknown as ReturnType<typeof part<SidebarSeparatorProps>>\n\n// =============================================\n// Card\n// =============================================\n\nconst SidebarCardComponent = defineComponent({\n name: \"SidebarCard\",\n inheritAttrs: false,\n props: {\n /** Visual variant. @default \"default\" */\n variant: { type: String as PropType<\"default\" | \"elevated\">, default: \"default\" },\n /** Shows a dismiss button. @default false */\n dismissible: { type: Boolean, default: false },\n },\n emits: {\n /** The dismiss button was clicked */\n dismiss: (_event: MouseEvent) => true,\n },\n setup(props, { attrs, slots, emit }) {\n return () => {\n const { className, rest } = cleanAttrs(attrs)\n return h(\"div\", { \"data-variant\": props.variant, \"class\": [s.Card, className], ...rest }, [\n props.dismissible\n ? h(\n Button,\n {\n \"uniform\": true,\n \"size\": \"3xs\",\n \"variant\": \"ghost\",\n \"color\": \"secondary\",\n \"class\": s.CardDismiss,\n \"onClick\": (event: MouseEvent) => emit(\"dismiss\", event),\n \"aria-label\": \"Dismiss\",\n },\n { default: () => h(X) },\n )\n : null,\n slots.default?.(),\n ])\n }\n },\n})\n\nexport type SidebarCardProps = InstanceType<typeof SidebarCardComponent>[\"$props\"] & HTMLAttributes\n\n/** Promotional card for CTAs, upgrades or announcements. */\nexport const SidebarCard = SidebarCardComponent as typeof SidebarCardComponent & {\n new (): { $props: SidebarCardProps }\n}\n\nexport type SidebarCardHeaderProps = HTMLAttributes\n\nexport const SidebarCardHeader = part<SidebarCardHeaderProps>(\"SidebarCardHeader\", \"div\", s.CardHeader)\n\nexport type SidebarCardTitleProps = HTMLAttributes\n\nexport const SidebarCardTitle = part<SidebarCardTitleProps>(\"SidebarCardTitle\", \"div\", s.CardTitle)\n\nexport type SidebarCardTitleLinkProps = AnchorHTMLAttributes\n\nexport const SidebarCardTitleLink = defineComponent({\n name: \"SidebarCardTitleLink\",\n inheritAttrs: false,\n setup(_props, { attrs, slots }) {\n return () => {\n const { className, rest } = cleanAttrs(attrs)\n return h(\"a\", { class: [s.CardTitleLink, className], ...rest }, [\n slots.default?.(),\n h(ChevronRightMd, { class: s.CardTitleChevron }),\n ])\n }\n },\n}) as unknown as ReturnType<typeof part<SidebarCardTitleLinkProps>>\n\nexport type SidebarCardContentProps = HTMLAttributes\n\nexport const SidebarCardContent = part<SidebarCardContentProps>(\"SidebarCardContent\", \"div\", s.CardContent)\n\nexport type SidebarCardFooterProps = HTMLAttributes\n\nexport const SidebarCardFooter = part<SidebarCardFooterProps>(\"SidebarCardFooter\", \"div\", s.CardFooter)\n\n// =============================================\n// Inset (Main Content Area)\n// =============================================\n\nexport type SidebarInsetProps = HTMLAttributes\n\n/**\n * Main content area next to the sidebar, a `<main>`. Behind the open phone drawer it takes no focus or touch\n * (`inert`); an `inert` of your own wins.\n */\nexport const SidebarInset = defineComponent({\n name: \"SidebarInset\",\n inheritAttrs: false,\n setup(_props, { attrs, slots }) {\n const sidebar = useSidebar()\n return () => {\n const { className, rest } = cleanAttrs(attrs)\n return h(\n \"main\",\n { inert: sidebar.isMobile && sidebar.openMobile ? \"\" : undefined, ...rest, class: [s.Inset, className] },\n slots.default?.(),\n )\n }\n },\n}) as unknown as Part<SidebarInsetProps>\n\n// =============================================\n// Layout Container\n// =============================================\n\nexport type SidebarLayoutProps = HTMLAttributes\n\n/** Wrapper for the sidebar and the main content. */\nexport const SidebarLayout = part<SidebarLayoutProps>(\"SidebarLayout\", \"div\", s.SidebarLayout)\n\n// =============================================\n// Trigger (Collapse Button)\n// =============================================\n\nexport type SidebarTriggerProps = ButtonHTMLAttributes\n\n/**\n * Collapse button. The default slot replaces the icon. Renders nothing when\n * `collapsible=\"none\"`.\n */\nexport const SidebarTrigger = defineComponent({\n name: \"SidebarTrigger\",\n inheritAttrs: false,\n setup(_props, { attrs, slots }) {\n const sidebar = useSidebar()\n\n return () => {\n // Don't render if collapsible=\"none\" (text-only sidebars)\n if (sidebar.collapsible === \"none\") {\n return null\n }\n\n const { className, rest } = cleanAttrs(attrs)\n const { onClick, ...others } = rest\n return h(\n \"button\",\n {\n \"type\": \"button\",\n \"class\": [s.Trigger, className],\n // The caller's listener runs first and can cancel the toggle\n \"onClick\": composeEventHandlers(onClick, () => sidebar.toggleSidebar()),\n \"aria-label\": sidebar.isMobile\n ? \"Open menu\"\n : sidebar.state === \"expanded\"\n ? \"Collapse sidebar\"\n : \"Expand sidebar\",\n ...others,\n },\n [\n h(\"span\", { class: s.TriggerInner }, [\n // One icon for both states: the tooltip, not the icon, says what a press does\n h(\"span\", { class: s.TriggerIcon }, slots.default ? slots.default() : [h(SidebarIcon)]),\n ]),\n ],\n )\n }\n },\n}) as unknown as ReturnType<typeof part<SidebarTriggerProps>>\n\n// =============================================\n// Mobile Menu Button (SidebarMenuMobile icon → X)\n// =============================================\n\nexport type SidebarMobileMenuButtonProps = ButtonHTMLAttributes\n\nexport const SidebarMobileMenuButton = defineComponent({\n name: \"SidebarMobileMenuButton\",\n inheritAttrs: false,\n setup(_props, { attrs }) {\n const sidebar = useSidebar()\n\n return () => {\n const { className, rest } = cleanAttrs(attrs)\n const { onClick, ...others } = rest\n return h(\n \"button\",\n {\n \"type\": \"button\",\n \"data-expanded\": sidebar.openMobile ? \"\" : undefined,\n \"class\": [s.MobileMenuButton, className],\n // The caller's listener runs first and can cancel the toggle\n \"onClick\": composeEventHandlers(onClick, () => sidebar.setOpenMobile(!sidebar.openMobile)),\n \"aria-label\": sidebar.openMobile ? \"Close menu\" : \"Open menu\",\n ...others,\n },\n [\n h(\"span\", { class: s.MobileMenuIcon }, [\n h(SidebarMenuMobile, { \"class\": s.MobileMenuGlyph, \"data-glyph\": \"menu\" }),\n h(X, { \"class\": s.MobileMenuGlyph, \"data-glyph\": \"close\" }),\n ]),\n ],\n )\n }\n },\n}) as unknown as ReturnType<typeof part<SidebarMobileMenuButtonProps>>\n\n// =============================================\n// Mobile Sidebar\n// =============================================\n\n/**\n * The phone drawer: a modal dialog while it is open. Focus moves into it and Tab goes round its controls, the page\n * behind is inert (SidebarInset), Escape inside it closes it after any layer over it has taken its own, and focus\n * goes back to the control that opened it. A swipe in from the edge it slides from opens it and a swipe back closes\n * it (lib/phoneDrawer).\n */\nconst SidebarMobileComponent = defineComponent({\n name: \"SidebarMobile\",\n inheritAttrs: false,\n props: {\n /** When true, drawer is positioned absolute instead of fixed (for contained demos) */\n contained: { type: Boolean, default: undefined },\n /** Rows that lead to another page end with a disclosure chevron, as in an iOS list. `false` leaves it out. @default true */\n disclosure: { type: Boolean, default: true },\n },\n setup(props, { attrs, slots }) {\n const sidebar = useSidebar()\n provide(sidebarDrawerKey, computed(() => props.disclosure))\n const drawer = ref<HTMLElement>()\n const setDrawer = (el: unknown) => {\n drawer.value = el instanceof HTMLElement ? el : ((el as { $el?: unknown } | null)?.$el as HTMLElement | undefined)\n }\n\n let detachSwipe: (() => void) | undefined\n onMounted(() => {\n // Focus moves in on open and back to what opened the drawer on close (from mount, as React's effect). A drawer\n // that is not contained shows only at phone width, so going back to it from a wide window moves focus in again.\n watch(\n () => sidebar.openMobile && (sidebar.isMobile || Boolean(props.contained)),\n (open, _, onCleanup) => {\n const el = drawer.value\n if (!open || !el) return\n const trigger = document.activeElement\n if (!el.contains(document.activeElement)) drawerInitialFocus(el).focus({ preventScroll: true })\n onCleanup(() => {\n const active = document.activeElement\n const lost = !active || active === document.body || el.contains(active)\n if (lost && trigger instanceof HTMLElement && trigger.isConnected && !el.contains(trigger)) {\n trigger.focus({ preventScroll: true })\n }\n })\n },\n { flush: \"post\", immediate: true },\n )\n\n const el = drawer.value\n const root = el?.closest<HTMLElement>(\"[data-mobile-menu]\")\n if (!el || !root) return\n detachSwipe = attachDrawerSwipe({\n root,\n drawer: el,\n isOpen: () => sidebar.openMobile,\n setOpen: (open) => sidebar.setOpenMobile(open),\n enabled: () => sidebar.isMobile,\n })\n })\n onBeforeUnmount(() => detachSwipe?.())\n\n const onDrawerKeydown = (event: KeyboardEvent) => {\n const el = drawer.value\n if (!sidebar.openMobile || !el) return\n loopDrawerFocus(event, el)\n closeOnUnhandledEscape(event, el, () => sidebar.setOpenMobile(false))\n }\n\n return () => {\n const { className, rest } = cleanAttrs(attrs)\n const { onKeydown: userKeydown, ...drawerAttrs } = rest\n const contained = props.contained && s.contained\n const open = sidebar.openMobile\n return [\n // Backdrop\n h(\"div\", {\n \"class\": [s.MobileBackdrop, contained],\n \"onClick\": () => sidebar.setOpenMobile(false),\n \"aria-hidden\": \"true\",\n }),\n // Drawer\n h(\n \"div\",\n {\n \"ref\": setDrawer,\n \"role\": \"dialog\",\n \"aria-modal\": open ? \"true\" : undefined,\n \"aria-label\": \"Menu\",\n \"tabindex\": -1,\n \"inert\": open ? undefined : \"\",\n ...drawerAttrs,\n \"class\": [s.MobileSidebar, contained, className],\n // Your handler runs first and can keep the drawer open with preventDefault(), as onKeyDown in React\n \"onKeydown\": (event: KeyboardEvent) => {\n for (const handler of [userKeydown].flat()) if (typeof handler === \"function\") handler(event)\n onDrawerKeydown(event)\n },\n },\n slots.default?.(),\n ),\n ]\n }\n },\n})\n\nexport type SidebarMobileProps = InstanceType<typeof SidebarMobileComponent>[\"$props\"] & HTMLAttributes\n\nexport const SidebarMobile = SidebarMobileComponent as typeof SidebarMobileComponent & {\n new (): { $props: SidebarMobileProps }\n}\n\nexport type SidebarMobileHeaderProps = HTMLAttributes\n\nexport const SidebarMobileHeader = part<SidebarMobileHeaderProps>(\"SidebarMobileHeader\", \"div\", s.MobileHeader)\n\nexport type SidebarMobileFooterProps = HTMLAttributes\n\nexport const SidebarMobileFooter = part<SidebarMobileFooterProps>(\"SidebarMobileFooter\", \"div\", s.MobileFooter)\n\n// =============================================\n// Input (Search)\n// =============================================\n\nexport type SidebarInputProps = InputProps\n\n/**\n * Search input: an Input with a Search icon in its `startAdornment` slot.\n * Every attribute, listener and slot goes to the Input (`v-model:value`,\n * `@clear`, ...). A template ref gets the Input's `focus()` and `input`\n * (React forwards its ref to the <input>).\n */\nexport const SidebarInput = defineComponent({\n name: \"SidebarInput\",\n inheritAttrs: false,\n setup(_props, { attrs, slots, expose }) {\n // Input's exposed API\n const inputComponent = ref<{ input: HTMLInputElement | null; focus: () => void } | null>(null)\n\n expose({\n focus: () => inputComponent.value?.focus(),\n input: computed(() => inputComponent.value?.input ?? null),\n })\n\n return () => {\n const { className, rest } = cleanAttrs(attrs)\n return h(\"div\", { class: s.Input }, [\n h(\n Input,\n { class: className, ...rest, ref: inputComponent },\n { ...slots, startAdornment: slots.startAdornment ?? (() => h(SearchIcon)) },\n ),\n ])\n }\n },\n}) as unknown as typeof Input\n\n// =============================================\n// Footer Links\n// =============================================\n\nexport type SidebarFooterLinksProps = HTMLAttributes\n\nexport const SidebarFooterLinks = part<SidebarFooterLinksProps>(\"SidebarFooterLinks\", \"div\", s.FooterLinks)\n"]}
1
+ {"version":3,"file":"Sidebar.js","sourceRoot":"","sources":["../../../../src/components/Sidebar/Sidebar.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EACR,eAAe,EACf,QAAQ,EACR,CAAC,EACD,MAAM,EACN,eAAe,EACf,SAAS,EACT,WAAW,EACX,OAAO,EACP,GAAG,EACH,IAAI,EACJ,KAAK,GAYN,MAAM,KAAK,CAAA;AACZ,OAAO,EACL,iBAAiB,EACjB,sBAAsB,EACtB,kBAAkB,EAClB,iBAAiB,EACjB,eAAe,GAChB,MAAM,0BAA0B,CAAA;AACjC,OAAO,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAA;AAC3C,OAAO,EAAE,cAAc,EAAE,UAAU,EAAE,MAAM,IAAI,UAAU,EAAE,OAAO,IAAI,WAAW,EAAE,iBAAiB,EAAE,CAAC,EAAE,MAAM,kBAAkB,CAAA;AACjI,OAAO,EAAE,KAAK,EAAmB,MAAM,mBAAmB,CAAA;AAC1D,OAAO,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAA;AAC7C,OAAO,EAAE,oBAAoB,EAAE,iBAAiB,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAA;AACzG,OAAO,CAAC,MAAM,sDAAsD,CAAA;AACpE,OAAO,EACL,eAAe,EACf,UAAU,GAKX,MAAM,wBAAwB,CAAA;AAE/B,0EAA0E;AAC1E,2EAA2E;AAC3E,6EAA6E;AAC7E,0EAA0E;AAC1E,+EAA+E;AAC/E,0EAA0E;AAC1E,6EAA6E;AAC7E,QAAQ;AACR,2EAA2E;AAC3E,2EAA2E;AAC3E,yEAAyE;AACzE,yEAAyE;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5E;aACF,CAAC,CAAA;QACJ,CAAC,CAAA;IACH,CAAC;CACF,CAA4B,CAAA;AAQ7B,MAAM,CAAC,MAAM,kBAAkB,GAAG,IAAI,CAA0B,oBAAoB,EAAE,KAAK,EAAE,CAAC,CAAC,WAAW,CAAC,CAAA","sourcesContent":["import {\n computed,\n defineComponent,\n Fragment,\n h,\n inject,\n onBeforeUnmount,\n onMounted,\n onUnmounted,\n provide,\n ref,\n Text,\n watch,\n type AnchorHTMLAttributes,\n type ButtonHTMLAttributes,\n type DefineComponent,\n type HTMLAttributes,\n type InjectionKey,\n type LiHTMLAttributes,\n type PropType,\n type Ref,\n type Slots,\n type VNode,\n type VNodeArrayChildren,\n} from \"vue\"\nimport {\n attachDrawerSwipe,\n closeOnUnhandledEscape,\n drawerInitialFocus,\n returnDrawerFocus,\n loopDrawerFocus,\n} from \"../../lib/phoneDrawer.js\"\nimport { Button } from \"../Button/index.js\"\nimport { ChevronRightMd, Disclosure, Search as SearchIcon, Sidebar as SidebarIcon, SidebarMenuMobile, X } from \"../Icon/index.js\"\nimport { Input, type InputProps } from \"../Input/index.js\"\nimport { Tooltip } from \"../Tooltip/index.js\"\nimport { composeEventHandlers, firstElementChild, flattenSlot, mergeSlotProps } from \"../Tooltip/slot.js\"\nimport s from \"@plexui/styles/components/Sidebar/Sidebar.module.css\"\nimport {\n SidebarProvider,\n useSidebar,\n type SidebarCollapsible,\n type SidebarSide,\n type SidebarProviderVariant,\n type SidebarVariant,\n} from \"./useSidebarContext.js\"\n\n// Vue port of packages/ui/src/components/Sidebar/Sidebar.tsx. Exports are\n// flat, as in React's index. Every part renders its React element with the\n// caller's attributes applied after its own (React spreads `...props` last),\n// so a caller's attribute or listener replaces the part's own. `class` is\n// merged. An `@click` on SidebarTrigger or SidebarMobileMenuButton runs before\n// the toggle and cancels it with `preventDefault()`, as `onClick` does in\n// React. `data-toggle` (injected by MDX) is dropped, as React's `cleanProps`\n// does.\n// - `asChild` (SidebarGroupLabel, SidebarMenuButton, SidebarMenuSubButton)\n// merges into the first element of the default slot the way Radix's Slot\n// does. SidebarMenuButton puts its inner `<span>` inside that element,\n// around the element's own content, as React clones it; with no single\n// element child it merges into the inner `<span>` instead.\n// - ReactNode props are slots: SidebarMenuButton `tooltip` (prop or\n// `#tooltip` slot), SidebarTrigger's icon (default slot), SidebarInput's\n// `startAdornment` (slot, Search icon by default).\n// - Parts whose React children are fixed (SidebarMenuChevron,\n// SidebarMenuSkeleton, SidebarMobileMenuButton) ignore the default slot.\n\n// Re-export provider and composable\nexport { SidebarProvider, useSidebar }\nexport type { SidebarCollapsible, SidebarProviderVariant, SidebarSide, SidebarVariant }\n\ntype Attrs = Record<string, unknown>\n\n// Filter out attributes that shouldn't reach the DOM (e.g. injected by MDX)\nconst cleanAttrs = (attrs: Attrs) => {\n const { \"data-toggle\": _, class: className, ...rest } = attrs\n return { className, rest }\n}\n\n// An explicit type keeps the published declaration on Vue's `DefineComponent`\n// alias; an inferred one is expanded there and fails consumers' type checks\n// (`GlobalComponents` against `Record<string, Component>`, TS2344).\ntype Part<A> = DefineComponent & { new (): { $props: A } }\n\n/** A part that renders one element with its class and the caller's attributes. */\nconst part = <A>(name: string, tag: string, className: string | undefined): Part<A> => {\n const component = defineComponent({\n name,\n inheritAttrs: false,\n setup(_props, { attrs, slots }) {\n return () => {\n const { className: userClass, rest } = cleanAttrs(attrs)\n return h(tag, { ...rest, class: [className, userClass] }, slots.default?.())\n }\n },\n })\n return component as unknown as Part<A>\n}\n\n// =============================================\n// Sidebar Root\n// =============================================\n\nconst SidebarComponent = defineComponent({\n name: \"Sidebar\",\n inheritAttrs: false,\n props: {\n /** The side the sidebar is on. @default \"left\" */\n side: { type: String as PropType<SidebarSide>, default: \"left\" },\n /** The visual variant of the sidebar. @default \"sidebar\" */\n variant: { type: String as PropType<SidebarVariant>, default: \"sidebar\" },\n },\n setup(props, { attrs, slots }) {\n const sidebar = useSidebar()\n\n return () => {\n // Skip rendering sidebar on mobile for offcanvas mode\n if (sidebar.isMobile && sidebar.collapsible === \"offcanvas\") {\n return null\n }\n\n const { className, rest } = cleanAttrs(attrs)\n return h(\n \"aside\",\n { \"data-side\": props.side, \"data-variant\": props.variant, \"class\": [s.Sidebar, className], ...rest },\n slots.default?.(),\n )\n }\n },\n})\n\nexport type SidebarProps = InstanceType<typeof SidebarComponent>[\"$props\"] & HTMLAttributes\n\n/** The sidebar container, an `<aside>`. Renders nothing on mobile in offcanvas mode. */\nexport const Sidebar = SidebarComponent as typeof SidebarComponent & { new (): { $props: SidebarProps } }\n\n// =============================================\n// Sidebar Sections\n// =============================================\n\nexport type SidebarHeaderProps = HTMLAttributes\n\n/** Sticky top area of the sidebar. */\nexport const SidebarHeader = part<SidebarHeaderProps>(\"SidebarHeader\", \"div\", s.Header)\n\nexport type SidebarContentProps = HTMLAttributes\n\n/**\n * Scrollable content area. Sets `data-content-scrollable` on the sidebar\n * while its content overflows.\n */\nexport const SidebarContent = defineComponent({\n name: \"SidebarContent\",\n inheritAttrs: false,\n setup(_props, { attrs, slots }) {\n const contentEl = ref<HTMLDivElement | null>(null)\n let observer: ResizeObserver | undefined\n\n onMounted(() => {\n const el = contentEl.value\n if (!el) return\n const sidebar = el.parentElement\n if (!sidebar) return\n\n const update = () => {\n const hasOverflow = el.scrollHeight > el.clientHeight\n sidebar.setAttribute(\"data-content-scrollable\", hasOverflow ? \"true\" : \"false\")\n }\n update()\n observer = new ResizeObserver(update)\n observer.observe(el)\n })\n onBeforeUnmount(() => observer?.disconnect())\n\n return () => {\n const { className, rest } = cleanAttrs(attrs)\n return h(\"div\", { ref: contentEl, class: [s.Content, className], ...rest }, slots.default?.())\n }\n },\n}) as unknown as ReturnType<typeof part<SidebarContentProps>>\n\nexport type SidebarFooterProps = HTMLAttributes\n\n/** Sticky bottom area of the sidebar, with a separator line on top. */\nexport const SidebarFooter = defineComponent({\n name: \"SidebarFooter\",\n inheritAttrs: false,\n setup(_props, { attrs, slots }) {\n return () => {\n const { className, rest } = cleanAttrs(attrs)\n return h(\"div\", { class: [s.Footer, className], ...rest }, [\n h(\"div\", { class: s.FooterSeparator }),\n slots.default?.(),\n ])\n }\n },\n}) as unknown as ReturnType<typeof part<SidebarFooterProps>>\n\nexport type SidebarRailProps = HTMLAttributes\n\nexport const SidebarRail = part<SidebarRailProps>(\"SidebarRail\", \"div\", s.Rail)\n\n// =============================================\n// Groups\n// =============================================\n\nconst SidebarGroupComponent = defineComponent({\n name: \"SidebarGroup\",\n inheritAttrs: false,\n props: {\n /** Whether the group is open initially. A closed group hides its `SidebarGroupContent`. @default true */\n defaultOpen: { type: Boolean, default: true },\n /** Controlled open state. The group has no toggle of its own: change `open` from your own control. */\n open: { type: Boolean, default: undefined },\n },\n setup(props, { attrs, slots }) {\n // The initial value only, like an uncontrolled input's defaultValue\n const internalOpen = ref(props.defaultOpen)\n\n return () => {\n const open = props.open ?? internalOpen.value\n const { className, rest } = cleanAttrs(attrs)\n return h(\n \"div\",\n { \"data-state\": open ? \"open\" : \"closed\", \"class\": [s.Group, className], ...rest },\n slots.default?.(),\n )\n }\n },\n})\n\nexport type SidebarGroupProps = InstanceType<typeof SidebarGroupComponent>[\"$props\"] & HTMLAttributes\n\n/** Section within the content. `data-state` follows `open` / `defaultOpen`. */\nexport const SidebarGroup = SidebarGroupComponent as typeof SidebarGroupComponent & {\n new (): { $props: SidebarGroupProps }\n}\n\n/** Radix Slot: the first element of the slot, with `slotProps` merged in. */\nconst renderAsChild = (children: VNodeArrayChildren | undefined, slotProps: Attrs) => {\n const child = firstElementChild(children)\n return child ? mergeSlotProps(child, slotProps) : null\n}\n\n/**\n * React's `cloneElement(child, undefined, wrap(child.props.children))`: the\n * same element (key and ref kept) with its content, or its default slot for a\n * component such as RouterLink, passed through `wrap`.\n */\nconst wrapChildContent = (child: VNode, wrap: (content: VNodeArrayChildren | undefined) => VNode): VNode => {\n const content = child.children\n let children: VNodeArrayChildren | Slots\n if (content && typeof content === \"object\" && !Array.isArray(content)) {\n // Drop the compiled-slots flag so the new default slot is always used\n const { _: _compiled, ...slotFns } = content as Slots & { _?: unknown }\n children = { ...slotFns, default: () => [wrap(slotFns.default?.())] }\n } else {\n children = [wrap(typeof content === \"string\" ? [content] : (content ?? undefined))]\n }\n return h(child.type as string, { ...child.props, key: child.key ?? undefined, ref: child.ref as never }, children as never)\n}\n\nconst SidebarGroupLabelComponent = defineComponent({\n name: \"SidebarGroupLabel\",\n inheritAttrs: false,\n props: {\n /** Merges into the slot's first element instead of rendering a `<span>`. @default false */\n asChild: { type: Boolean, default: false },\n /**\n * Size variant for the label.\n * - \"sm\": Compact style for dashboard/settings sidebars\n * - \"lg\": Documentation style with larger text and more spacing\n * @default \"lg\"\n */\n size: { type: String as PropType<\"sm\" | \"lg\">, default: \"lg\" },\n },\n setup(props, { attrs, slots }) {\n return () => {\n const { className, rest } = cleanAttrs(attrs)\n const ownProps = { \"data-size\": props.size, \"class\": [s.GroupLabel, className], ...rest }\n return props.asChild ? renderAsChild(slots.default?.(), ownProps) : h(\"span\", ownProps, slots.default?.())\n }\n },\n})\n\nexport type SidebarGroupLabelProps = InstanceType<typeof SidebarGroupLabelComponent>[\"$props\"] & HTMLAttributes\n\n/** Section label within a SidebarGroup. */\nexport const SidebarGroupLabel = SidebarGroupLabelComponent as typeof SidebarGroupLabelComponent & {\n new (): { $props: SidebarGroupLabelProps }\n}\n\nexport type SidebarGroupActionProps = HTMLAttributes\n\nexport const SidebarGroupAction = part<SidebarGroupActionProps>(\"SidebarGroupAction\", \"div\", s.GroupAction)\n\nexport type SidebarGroupContentProps = HTMLAttributes\n\nexport const SidebarGroupContent = part<SidebarGroupContentProps>(\"SidebarGroupContent\", \"div\", s.GroupContent)\n\n// =============================================\n// Menu\n// =============================================\n\nexport type SidebarMenuProps = HTMLAttributes\n\n/** Navigation menu, a `<ul>`. */\nexport const SidebarMenu = part<SidebarMenuProps>(\"SidebarMenu\", \"ul\", s.Menu)\n\nconst SidebarMenuItemComponent = defineComponent({\n name: \"SidebarMenuItem\",\n inheritAttrs: false,\n props: {\n /** Marks the item as expanded (`data-expanded`), for chevrons and sub menus. */\n expanded: { type: Boolean, default: undefined },\n },\n setup(props, { attrs, slots }) {\n return () => {\n const { className, rest } = cleanAttrs(attrs)\n return h(\n \"li\",\n { \"data-expanded\": props.expanded ? \"true\" : undefined, \"class\": [s.MenuItem, className], ...rest },\n slots.default?.(),\n )\n }\n },\n})\n\nexport type SidebarMenuItemProps = InstanceType<typeof SidebarMenuItemComponent>[\"$props\"] & LiHTMLAttributes\n\n/** Menu item, an `<li>`. */\nexport const SidebarMenuItem = SidebarMenuItemComponent as typeof SidebarMenuItemComponent & {\n new (): { $props: SidebarMenuItemProps }\n}\n\n// =============================================\n// Menu Button\n// =============================================\n\n// Shared by every row of the rail: moving to the next one shows its label at once.\nlet railLeftAt = 0\n\n// Rows inside the mobile drawer end with a disclosure chevron (see the drawer list in the styles), unless the drawer\n// leaves it out (`:disclosure=\"false\"`).\nconst sidebarDrawerKey: InjectionKey<Ref<boolean>> = Symbol(\"SidebarDrawer\")\nconst notInDrawer = computed(() => false)\n\n/** The chevron of a drawer row that leads to another page. */\nconst menuDisclosure = () => h(\"span\", { \"class\": s.MenuDisclosure, \"aria-hidden\": \"true\" }, [h(Disclosure)])\n\nconst SidebarMenuButtonComponent = defineComponent({\n name: \"SidebarMenuButton\",\n inheritAttrs: false,\n props: {\n /** Whether the button is in an active/highlighted state. @default false */\n isActive: { type: Boolean, default: false },\n /**\n * Optional tooltip to show when the sidebar is collapsed (or the\n * `#tooltip` slot). Hidden on mobile.\n */\n tooltip: String,\n /** Whether to render the button as a custom element via Slot. @default false */\n asChild: { type: Boolean, default: false },\n },\n setup(props, { attrs, slots }) {\n const sidebar = useSidebar()\n const drawerRows = inject(sidebarDrawerKey, notInDrawer)\n const openDelay = ref<number>()\n\n return () => {\n const { className, rest } = cleanAttrs(attrs)\n const hasTooltip = !!(props.tooltip || slots.tooltip)\n const ownProps: Record<string, unknown> = {\n \"data-active\": props.isActive ? \"true\" : \"false\",\n \"aria-current\": props.isActive ? \"page\" : undefined,\n \"class\": [s.MenuButton, className],\n ...rest,\n }\n if (hasTooltip) {\n ownProps.onPointerenter = composeEventHandlers(rest.onPointerenter, () => {\n openDelay.value = Date.now() - railLeftAt < 300 ? 0 : undefined\n })\n ownProps.onPointerleave = composeEventHandlers(rest.onPointerleave, () => {\n railLeftAt = Date.now()\n })\n }\n const content = slots.default?.()\n const wrap = (children: VNodeArrayChildren | undefined) =>\n h(\"span\", { class: s.MenuButtonInner }, drawerRows.value ? [children, menuDisclosure()] : children)\n let button: VNode\n if (props.asChild) {\n // With asChild the child element is the button, so the inner wrapper\n // goes inside it. Wrapping the child instead would merge the button\n // attributes onto the wrapper span.\n // A lone text child is wrapped below rather than slotted\n const nodes = flattenSlot(content)\n const child = nodes.length === 1 && nodes[0].type !== Text ? nodes[0] : undefined\n button = mergeSlotProps(child ? wrapChildContent(child, wrap) : wrap(content), ownProps)\n } else {\n button = h(\"button\", ownProps, [wrap(content)])\n }\n\n // The tooltip shows when collapsed (icon mode) and not on mobile. It wraps\n // the row in every state, so the row stays mounted and its label can fade.\n if (hasTooltip) {\n const shown = sidebar.state === \"collapsed\" && !sidebar.isMobile\n return h(\n Tooltip,\n { content: shown ? props.tooltip : null, openDelay: openDelay.value, side: \"right\" },\n { default: () => button, ...(slots.tooltip && shown ? { content: slots.tooltip } : {}) },\n )\n }\n\n return button\n }\n },\n})\n\nexport type SidebarMenuButtonProps = InstanceType<typeof SidebarMenuButtonComponent>[\"$props\"] & ButtonHTMLAttributes\n\n/** Menu item button. Shows its `tooltip` when the sidebar is collapsed to icons. */\nexport const SidebarMenuButton = SidebarMenuButtonComponent as typeof SidebarMenuButtonComponent & {\n new (): { $props: SidebarMenuButtonProps }\n}\n\n// =============================================\n// Menu Button Parts\n// =============================================\n\nexport type SidebarMenuButtonIconProps = HTMLAttributes\n\nexport const SidebarMenuButtonIcon = part<SidebarMenuButtonIconProps>(\n \"SidebarMenuButtonIcon\",\n \"span\",\n s.MenuButtonIcon,\n)\n\nconst SidebarMenuButtonLabelComponent = defineComponent({\n name: \"SidebarMenuButtonLabel\",\n inheritAttrs: false,\n props: {\n /** Shorter label rendered next to the full one (`data-short-label`). */\n shortLabel: String,\n },\n setup(props, { attrs, slots }) {\n return () => {\n const { className, rest } = cleanAttrs(attrs)\n return [\n h(\n \"span\",\n { \"data-long-label\": \"true\", \"class\": [s.MenuButtonLabel, className], ...rest },\n slots.default?.(),\n ),\n props.shortLabel\n ? h(\"span\", { \"data-short-label\": \"true\", \"class\": [s.MenuButtonLabel, className] }, props.shortLabel)\n : null,\n ]\n }\n },\n})\n\nexport type SidebarMenuButtonLabelProps = InstanceType<typeof SidebarMenuButtonLabelComponent>[\"$props\"] & HTMLAttributes\n\nexport const SidebarMenuButtonLabel = SidebarMenuButtonLabelComponent as typeof SidebarMenuButtonLabelComponent & {\n new (): { $props: SidebarMenuButtonLabelProps }\n}\n\n// =============================================\n// Menu Chevron (Expand/Collapse Toggle)\n// =============================================\n\nexport type SidebarMenuChevronProps = HTMLAttributes\n\nexport const SidebarMenuChevron = defineComponent({\n name: \"SidebarMenuChevron\",\n inheritAttrs: false,\n setup(_props, { attrs }) {\n return () => {\n const { className, rest } = cleanAttrs(attrs)\n return h(\"span\", { class: [s.MenuChevron, className], ...rest }, [h(ChevronRightMd)])\n }\n },\n}) as unknown as ReturnType<typeof part<SidebarMenuChevronProps>>\n\n// =============================================\n// Menu Badge & Action\n// =============================================\n\nexport type SidebarMenuBadgeProps = HTMLAttributes\n\nexport const SidebarMenuBadge = part<SidebarMenuBadgeProps>(\"SidebarMenuBadge\", \"span\", s.MenuBadge)\n\nexport type SidebarMenuActionProps = HTMLAttributes\n\nexport const SidebarMenuAction = part<SidebarMenuActionProps>(\"SidebarMenuAction\", \"div\", s.MenuAction)\n\n// =============================================\n// Menu Skeleton\n// =============================================\n\nconst SidebarMenuSkeletonComponent = defineComponent({\n name: \"SidebarMenuSkeleton\",\n inheritAttrs: false,\n props: {\n /** Renders the icon placeholder. @default true */\n showIcon: { type: Boolean, default: true },\n /** Width of the label skeleton (e.g., \"60%\", \"80%\", \"100px\"). @default \"60%\" */\n labelWidth: { type: String, default: \"60%\" },\n },\n setup(props, { attrs }) {\n return () => {\n const { className, rest } = cleanAttrs(attrs)\n return h(\"div\", { \"data-skeleton\": \"true\", \"class\": [s.MenuSkeleton, className], ...rest }, [\n props.showIcon ? h(\"div\", { class: s.MenuSkeletonIcon }) : null,\n h(\"div\", { class: s.MenuSkeletonLabel, style: { width: props.labelWidth } }),\n ])\n }\n },\n})\n\nexport type SidebarMenuSkeletonProps = InstanceType<typeof SidebarMenuSkeletonComponent>[\"$props\"] & HTMLAttributes\n\nexport const SidebarMenuSkeleton = SidebarMenuSkeletonComponent as typeof SidebarMenuSkeletonComponent & {\n new (): { $props: SidebarMenuSkeletonProps }\n}\n\n// =============================================\n// Submenu\n// =============================================\n\nconst SidebarMenuSubComponent = defineComponent({\n name: \"SidebarMenuSub\",\n inheritAttrs: false,\n props: {\n /** Whether the submenu is expanded. @default true */\n open: { type: Boolean, default: true },\n /**\n * When true, child items align with parent text that has icons.\n * This adjusts the padding so level 2 text aligns with level 1 text.\n * @default false\n */\n hasIcons: { type: Boolean, default: false },\n },\n setup(props, { attrs, slots }) {\n return () => {\n const { className, rest } = cleanAttrs(attrs)\n return h(\n \"ul\",\n {\n \"data-state\": props.open ? \"open\" : \"closed\",\n \"data-has-icons\": props.hasIcons ? \"true\" : undefined,\n // Collapsed items are only hidden visually: keep them out of the tab\n // order. \"\" renders `inert=\"\"` (a DOM property in browsers)\n \"inert\": props.open ? undefined : \"\",\n \"class\": [s.MenuSub, className],\n ...rest,\n },\n slots.default?.(),\n )\n }\n },\n})\n\nexport type SidebarMenuSubProps = InstanceType<typeof SidebarMenuSubComponent>[\"$props\"] & HTMLAttributes\n\nexport const SidebarMenuSub = SidebarMenuSubComponent as typeof SidebarMenuSubComponent & {\n new (): { $props: SidebarMenuSubProps }\n}\n\nexport type SidebarMenuSubItemProps = LiHTMLAttributes\n\nexport const SidebarMenuSubItem = part<SidebarMenuSubItemProps>(\"SidebarMenuSubItem\", \"li\", s.MenuSubItem)\n\nconst SidebarMenuSubButtonComponent = defineComponent({\n name: \"SidebarMenuSubButton\",\n inheritAttrs: false,\n props: {\n /** Whether the button is in an active/highlighted state. @default false */\n isActive: { type: Boolean, default: false },\n /** Merges into the slot's first element instead of rendering a `<button>`. @default false */\n asChild: { type: Boolean, default: false },\n /**\n * Indent level for nested items (0-3).\n * Each level adds 12px of left margin.\n * @default 0\n */\n indent: { type: Number as PropType<0 | 1 | 2 | 3>, default: 0 },\n },\n setup(props, { attrs, slots }) {\n const drawerRows = inject(sidebarDrawerKey, notInDrawer)\n return () => {\n const { className, rest } = cleanAttrs(attrs)\n const ownProps = {\n \"data-active\": props.isActive ? \"true\" : \"false\",\n \"aria-current\": props.isActive ? \"page\" : undefined,\n \"class\": [s.MenuSubButton, s[`indent${props.indent}`], className],\n ...rest,\n }\n const content = slots.default?.()\n if (!drawerRows.value) return props.asChild ? renderAsChild(content, ownProps) : h(\"button\", ownProps, content)\n // In the drawer the disclosure follows the content, inside the child element with asChild\n if (props.asChild) {\n const child = firstElementChild(content)\n return child ? mergeSlotProps(wrapChildContent(child, (inner) => h(Fragment, null, [inner, menuDisclosure()])), ownProps) : null\n }\n return h(\"button\", ownProps, [content, menuDisclosure()])\n }\n },\n})\n\nexport type SidebarMenuSubButtonProps = InstanceType<typeof SidebarMenuSubButtonComponent>[\"$props\"] & ButtonHTMLAttributes\n\nexport const SidebarMenuSubButton = SidebarMenuSubButtonComponent as typeof SidebarMenuSubButtonComponent & {\n new (): { $props: SidebarMenuSubButtonProps }\n}\n\n// =============================================\n// Separator\n// =============================================\n\nexport type SidebarSeparatorProps = HTMLAttributes\n\nexport const SidebarSeparator = defineComponent({\n name: \"SidebarSeparator\",\n inheritAttrs: false,\n setup(_props, { attrs }) {\n return () => {\n const { className, rest } = cleanAttrs(attrs)\n return h(\"hr\", { class: [s.Separator, className], ...rest })\n }\n },\n}) as unknown as ReturnType<typeof part<SidebarSeparatorProps>>\n\n// =============================================\n// Card\n// =============================================\n\nconst SidebarCardComponent = defineComponent({\n name: \"SidebarCard\",\n inheritAttrs: false,\n props: {\n /** Visual variant. @default \"default\" */\n variant: { type: String as PropType<\"default\" | \"elevated\">, default: \"default\" },\n /** Shows a dismiss button. @default false */\n dismissible: { type: Boolean, default: false },\n },\n emits: {\n /** The dismiss button was clicked */\n dismiss: (_event: MouseEvent) => true,\n },\n setup(props, { attrs, slots, emit }) {\n return () => {\n const { className, rest } = cleanAttrs(attrs)\n return h(\"div\", { \"data-variant\": props.variant, \"class\": [s.Card, className], ...rest }, [\n props.dismissible\n ? h(\n Button,\n {\n \"uniform\": true,\n \"size\": \"3xs\",\n \"variant\": \"ghost\",\n \"color\": \"secondary\",\n \"class\": s.CardDismiss,\n \"onClick\": (event: MouseEvent) => emit(\"dismiss\", event),\n \"aria-label\": \"Dismiss\",\n },\n { default: () => h(X) },\n )\n : null,\n slots.default?.(),\n ])\n }\n },\n})\n\nexport type SidebarCardProps = InstanceType<typeof SidebarCardComponent>[\"$props\"] & HTMLAttributes\n\n/** Promotional card for CTAs, upgrades or announcements. */\nexport const SidebarCard = SidebarCardComponent as typeof SidebarCardComponent & {\n new (): { $props: SidebarCardProps }\n}\n\nexport type SidebarCardHeaderProps = HTMLAttributes\n\nexport const SidebarCardHeader = part<SidebarCardHeaderProps>(\"SidebarCardHeader\", \"div\", s.CardHeader)\n\nexport type SidebarCardTitleProps = HTMLAttributes\n\nexport const SidebarCardTitle = part<SidebarCardTitleProps>(\"SidebarCardTitle\", \"div\", s.CardTitle)\n\nexport type SidebarCardTitleLinkProps = AnchorHTMLAttributes\n\nexport const SidebarCardTitleLink = defineComponent({\n name: \"SidebarCardTitleLink\",\n inheritAttrs: false,\n setup(_props, { attrs, slots }) {\n return () => {\n const { className, rest } = cleanAttrs(attrs)\n return h(\"a\", { class: [s.CardTitleLink, className], ...rest }, [\n slots.default?.(),\n h(ChevronRightMd, { class: s.CardTitleChevron }),\n ])\n }\n },\n}) as unknown as ReturnType<typeof part<SidebarCardTitleLinkProps>>\n\nexport type SidebarCardContentProps = HTMLAttributes\n\nexport const SidebarCardContent = part<SidebarCardContentProps>(\"SidebarCardContent\", \"div\", s.CardContent)\n\nexport type SidebarCardFooterProps = HTMLAttributes\n\nexport const SidebarCardFooter = part<SidebarCardFooterProps>(\"SidebarCardFooter\", \"div\", s.CardFooter)\n\n// =============================================\n// Inset (Main Content Area)\n// =============================================\n\nexport type SidebarInsetProps = HTMLAttributes\n\n/**\n * Main content area next to the sidebar, a `<main>`. Behind the open phone drawer it takes no focus or touch\n * (`inert`); an `inert` of your own wins.\n */\nexport const SidebarInset = defineComponent({\n name: \"SidebarInset\",\n inheritAttrs: false,\n setup(_props, { attrs, slots }) {\n const sidebar = useSidebar()\n return () => {\n const { className, rest } = cleanAttrs(attrs)\n return h(\n \"main\",\n { inert: sidebar.isMobile && sidebar.openMobile ? \"\" : undefined, ...rest, class: [s.Inset, className] },\n slots.default?.(),\n )\n }\n },\n}) as unknown as Part<SidebarInsetProps>\n\n// =============================================\n// Layout Container\n// =============================================\n\nexport type SidebarLayoutProps = HTMLAttributes\n\n/** Wrapper for the sidebar and the main content. */\nexport const SidebarLayout = part<SidebarLayoutProps>(\"SidebarLayout\", \"div\", s.SidebarLayout)\n\n// =============================================\n// Trigger (Collapse Button)\n// =============================================\n\nexport type SidebarTriggerProps = ButtonHTMLAttributes\n\n/**\n * Collapse button. The default slot replaces the icon. Renders nothing when\n * `collapsible=\"none\"`.\n */\nexport const SidebarTrigger = defineComponent({\n name: \"SidebarTrigger\",\n inheritAttrs: false,\n setup(_props, { attrs, slots }) {\n const sidebar = useSidebar()\n\n return () => {\n // Don't render if collapsible=\"none\" (text-only sidebars)\n if (sidebar.collapsible === \"none\") {\n return null\n }\n\n const { className, rest } = cleanAttrs(attrs)\n const { onClick, ...others } = rest\n return h(\n \"button\",\n {\n \"type\": \"button\",\n \"class\": [s.Trigger, className],\n // The caller's listener runs first and can cancel the toggle\n \"onClick\": composeEventHandlers(onClick, () => sidebar.toggleSidebar()),\n \"aria-label\": sidebar.isMobile\n ? \"Open menu\"\n : sidebar.state === \"expanded\"\n ? \"Collapse sidebar\"\n : \"Expand sidebar\",\n ...others,\n },\n [\n h(\"span\", { class: s.TriggerInner }, [\n // One icon for both states: the tooltip, not the icon, says what a press does\n h(\"span\", { class: s.TriggerIcon }, slots.default ? slots.default() : [h(SidebarIcon)]),\n ]),\n ],\n )\n }\n },\n}) as unknown as ReturnType<typeof part<SidebarTriggerProps>>\n\n// =============================================\n// Mobile Menu Button (SidebarMenuMobile icon → X)\n// =============================================\n\nexport type SidebarMobileMenuButtonProps = ButtonHTMLAttributes\n\nexport const SidebarMobileMenuButton = defineComponent({\n name: \"SidebarMobileMenuButton\",\n inheritAttrs: false,\n setup(_props, { attrs }) {\n const sidebar = useSidebar()\n\n return () => {\n const { className, rest } = cleanAttrs(attrs)\n const { onClick, ...others } = rest\n return h(\n \"button\",\n {\n \"type\": \"button\",\n \"data-expanded\": sidebar.openMobile ? \"\" : undefined,\n // Where focus goes when a drawer closes and what opened it can no longer take it (lib/phoneDrawer)\n \"data-sidebar-mobile-menu-button\": \"\",\n \"class\": [s.MobileMenuButton, className],\n // The caller's listener runs first and can cancel the toggle\n \"onClick\": composeEventHandlers(onClick, () => sidebar.setOpenMobile(!sidebar.openMobile)),\n \"aria-label\": sidebar.openMobile ? \"Close menu\" : \"Open menu\",\n ...others,\n },\n [\n h(\"span\", { class: s.MobileMenuIcon }, [\n h(SidebarMenuMobile, { \"class\": s.MobileMenuGlyph, \"data-glyph\": \"menu\" }),\n h(X, { \"class\": s.MobileMenuGlyph, \"data-glyph\": \"close\" }),\n ]),\n ],\n )\n }\n },\n}) as unknown as ReturnType<typeof part<SidebarMobileMenuButtonProps>>\n\n// =============================================\n// Mobile Sidebar\n// =============================================\n\n/**\n * The phone drawer: a modal dialog while it is open. Focus moves into it and Tab goes round its controls, the page\n * behind is inert (SidebarInset), Escape inside it closes it after any layer over it has taken its own, and focus\n * goes back to the control that opened it. A swipe in from the edge it slides from opens it and a swipe back closes\n * it (lib/phoneDrawer).\n */\n/** Runs `run` once `element` has left the page: a leaving `<Transition>` keeps it there for its animation */\nconst whenDetached = (element: Element, run: () => void) => {\n if (!element.isConnected) return run()\n const observer = new MutationObserver(() => {\n if (element.isConnected) return\n observer.disconnect()\n run()\n })\n observer.observe(element.ownerDocument, { childList: true, subtree: true })\n}\n\nconst SidebarMobileComponent = defineComponent({\n name: \"SidebarMobile\",\n inheritAttrs: false,\n props: {\n /** When true, drawer is positioned absolute instead of fixed (for contained demos) */\n contained: { type: Boolean, default: undefined },\n /** Rows that lead to another page end with a disclosure chevron, as in an iOS list. `false` leaves it out. @default true */\n disclosure: { type: Boolean, default: true },\n },\n setup(props, { attrs, slots }) {\n const sidebar = useSidebar()\n provide(sidebarDrawerKey, computed(() => props.disclosure))\n const drawer = ref<HTMLElement>()\n const setDrawer = (el: unknown) => {\n drawer.value = el instanceof HTMLElement ? el : ((el as { $el?: unknown } | null)?.$el as HTMLElement | undefined)\n }\n\n let detachSwipe: (() => void) | undefined\n // Vue runs a watcher's cleanup on unmount while the drawer is still on the page, where React runs it once the\n // drawer has left: focus goes back once the drawer has left (after unmount, or after a leaving <Transition>), so a\n // menu button that leaves with the drawer is not picked\n let unmounting = false\n let restoreAfterUnmount: (() => void) | undefined\n onMounted(() => {\n // Focus moves in on open and back to what opened the drawer on close, or to a menu button when that can no longer\n // take it (from mount, as React's effect). A drawer that is not contained shows only at phone width, so going\n // back to it from a wide window moves focus in again.\n watch(\n () => sidebar.openMobile && (sidebar.isMobile || Boolean(props.contained)),\n (open, _, onCleanup) => {\n const el = drawer.value\n if (!open || !el) return\n const trigger = document.activeElement\n // Taken now: after unmount the drawer has left the page, with no provider around it\n const root = el.closest(\"[data-mobile-menu]\")\n if (!el.contains(document.activeElement)) drawerInitialFocus(el).focus({ preventScroll: true })\n onCleanup(() => {\n const restore = () => {\n const active = document.activeElement\n const lost = !active || active === document.body || el.contains(active)\n if (lost) returnDrawerFocus(trigger, el, root)\n }\n if (unmounting) restoreAfterUnmount = () => whenDetached(el, restore)\n else restore()\n })\n },\n { flush: \"post\", immediate: true },\n )\n\n const el = drawer.value\n const root = el?.closest<HTMLElement>(\"[data-mobile-menu]\")\n if (!el || !root) return\n detachSwipe = attachDrawerSwipe({\n root,\n drawer: el,\n isOpen: () => sidebar.openMobile,\n setOpen: (open) => sidebar.setOpenMobile(open),\n enabled: () => sidebar.isMobile,\n })\n })\n onBeforeUnmount(() => {\n unmounting = true\n detachSwipe?.()\n })\n onUnmounted(() => {\n restoreAfterUnmount?.()\n restoreAfterUnmount = undefined\n })\n\n const onDrawerKeydown = (event: KeyboardEvent) => {\n const el = drawer.value\n if (!sidebar.openMobile || !el) return\n loopDrawerFocus(event, el)\n closeOnUnhandledEscape(event, el, () => sidebar.setOpenMobile(false))\n }\n\n return () => {\n const { className, rest } = cleanAttrs(attrs)\n const { onKeydown: userKeydown, ...drawerAttrs } = rest\n const contained = props.contained && s.contained\n const open = sidebar.openMobile\n return [\n // Backdrop\n h(\"div\", {\n \"class\": [s.MobileBackdrop, contained],\n \"onClick\": () => sidebar.setOpenMobile(false),\n \"aria-hidden\": \"true\",\n }),\n // Drawer\n h(\n \"div\",\n {\n \"ref\": setDrawer,\n \"role\": \"dialog\",\n \"aria-modal\": open ? \"true\" : undefined,\n \"aria-label\": \"Menu\",\n \"tabindex\": -1,\n \"inert\": open ? undefined : \"\",\n ...drawerAttrs,\n \"class\": [s.MobileSidebar, contained, className],\n // Your handler runs first and can keep the drawer open with preventDefault(), as onKeyDown in React\n \"onKeydown\": (event: KeyboardEvent) => {\n for (const handler of [userKeydown].flat()) if (typeof handler === \"function\") handler(event)\n onDrawerKeydown(event)\n },\n },\n slots.default?.(),\n ),\n ]\n }\n },\n})\n\nexport type SidebarMobileProps = InstanceType<typeof SidebarMobileComponent>[\"$props\"] & HTMLAttributes\n\nexport const SidebarMobile = SidebarMobileComponent as typeof SidebarMobileComponent & {\n new (): { $props: SidebarMobileProps }\n}\n\nexport type SidebarMobileHeaderProps = HTMLAttributes\n\nexport const SidebarMobileHeader = part<SidebarMobileHeaderProps>(\"SidebarMobileHeader\", \"div\", s.MobileHeader)\n\nexport type SidebarMobileFooterProps = HTMLAttributes\n\nexport const SidebarMobileFooter = part<SidebarMobileFooterProps>(\"SidebarMobileFooter\", \"div\", s.MobileFooter)\n\n// =============================================\n// Input (Search)\n// =============================================\n\nexport type SidebarInputProps = InputProps\n\n/**\n * Search input: an Input with a Search icon in its `startAdornment` slot.\n * Every attribute, listener and slot goes to the Input (`v-model:value`,\n * `@clear`, ...). A template ref gets the Input's `focus()` and `input`\n * (React forwards its ref to the <input>).\n */\nexport const SidebarInput = defineComponent({\n name: \"SidebarInput\",\n inheritAttrs: false,\n setup(_props, { attrs, slots, expose }) {\n // Input's exposed API\n const inputComponent = ref<{ input: HTMLInputElement | null; focus: () => void } | null>(null)\n\n expose({\n focus: () => inputComponent.value?.focus(),\n input: computed(() => inputComponent.value?.input ?? null),\n })\n\n return () => {\n const { className, rest } = cleanAttrs(attrs)\n return h(\"div\", { class: s.Input }, [\n h(\n Input,\n { class: className, ...rest, ref: inputComponent },\n { ...slots, startAdornment: slots.startAdornment ?? (() => h(SearchIcon)) },\n ),\n ])\n }\n },\n}) as unknown as typeof Input\n\n// =============================================\n// Footer Links\n// =============================================\n\nexport type SidebarFooterLinksProps = HTMLAttributes\n\nexport const SidebarFooterLinks = part<SidebarFooterLinksProps>(\"SidebarFooterLinks\", \"div\", s.FooterLinks)\n"]}
@@ -0,0 +1,201 @@
1
+ import { maskitoParseTime, maskitoStringifyTime } from "@maskito/kit";
2
+ import { DateTime } from "luxon";
3
+ const MS_IN_HOUR = 3_600_000;
4
+ const MS_IN_MINUTE = 60_000;
5
+ const MS_IN_SECOND = 1_000;
6
+ const inZone = (zone) => (zone ? { zone } : undefined);
7
+ const pad = (value, length) => String(value).padStart(length, "0");
8
+ const zones = new Map();
9
+ /**
10
+ * The zone typed dates are made in: the value's own zone object (Luxon's default zone without a value). A zone rebuilt
11
+ * from its name can be another one: Luxon's system zone becomes the zone of its name, the zone named UTC becomes the
12
+ * fixed UTC offset, and a name like UTC+5:5 (a 5:05 offset) does not parse back. The same object for the same zone,
13
+ * so it keys a memo.
14
+ */
15
+ export const dateInputZone = (value) => {
16
+ if (!value?.isValid)
17
+ return undefined;
18
+ const { zone } = value;
19
+ const key = zone.isUniversal ? `${zone.type} ${zone.offset(0)}` : `${zone.type} ${zone.name}`;
20
+ const known = zones.get(key);
21
+ if (known)
22
+ return known;
23
+ zones.set(key, zone);
24
+ return zone;
25
+ };
26
+ /** The key a DateInput re-shows its value on: the instant and the zone. */
27
+ export const dateInputValueKey = (value) => value?.isValid ? `${value.toMillis()} ${value.zoneName}` : "";
28
+ // Maskito's own range: 0001-01-01 to 9999-12-31, end of day
29
+ const lowest = (zone) => DateTime.fromObject({ year: 1, month: 1, day: 1 }, inZone(zone));
30
+ const highest = (zone) => DateTime.fromObject({ year: 9999, month: 12, day: 31, hour: 23, minute: 59, second: 59, millisecond: 999 }, inZone(zone));
31
+ /**
32
+ * Within min and max, and within Maskito's own range when the mode has a year: a date typed without one is in
33
+ * year 0, which that range would turn into 0001-01-01.
34
+ */
35
+ const clampToRange = (value, format, zone) => {
36
+ const withYear = format.mode.includes("y");
37
+ const min = format.min ?? (withYear ? lowest(zone).toMillis() : undefined);
38
+ const max = format.max ?? (withYear ? highest(zone).toMillis() : undefined);
39
+ const millis = value.toMillis();
40
+ if (min !== undefined && millis < min)
41
+ return DateTime.fromMillis(min, inZone(zone));
42
+ if (max !== undefined && millis > max)
43
+ return DateTime.fromMillis(max, inZone(zone));
44
+ return value;
45
+ };
46
+ /** The value's wall clock in its own zone, in the format */
47
+ const wallText = (shown, format) => {
48
+ const date = format.mode
49
+ .replaceAll("/", format.separator)
50
+ .replace(/d+/, pad(shown.day, 2))
51
+ .replace(/m+/, pad(shown.month, 2))
52
+ .replace(/y+/, (year) => pad(shown.year, 4).slice(-year.length));
53
+ if (!format.timeMode)
54
+ return date;
55
+ const msOfDay = shown.hour * MS_IN_HOUR + shown.minute * MS_IN_MINUTE + shown.second * MS_IN_SECOND + shown.millisecond;
56
+ return date + format.dateTimeSeparator + maskitoStringifyTime(msOfDay, { mode: format.timeMode });
57
+ };
58
+ /** The text a DateInput shows for a value: its wall clock in its own zone, kept within min and max. */
59
+ export const formatDateInput = (value, format) => value?.isValid ? wallText(clampToRange(value, format, value.zone), format) : "";
60
+ const segment = (digits, letters, letter) => digits.slice(letters.indexOf(letter), letters.lastIndexOf(letter) + 1);
61
+ /**
62
+ * Each instant the fields show in the zone, earliest first: two in an hour the clocks repeat, one in a time they skip,
63
+ * moved forward as Luxon does. `[]` for a date that does not exist.
64
+ */
65
+ const passesAt = (fields, zone) => {
66
+ const parsed = DateTime.fromObject(fields, inZone(zone));
67
+ if (!parsed.isValid)
68
+ return [];
69
+ const passes = parsed.getPossibleOffsets().sort((a, b) => a.toMillis() - b.toMillis());
70
+ return passes.length ? passes : [parsed];
71
+ };
72
+ const withinBounds = (value, format) => (format.min === undefined || value.toMillis() >= format.min) && (format.max === undefined || value.toMillis() <= format.max);
73
+ /**
74
+ * Which instant a time the clocks show twice is. Luxon reads it with the offset in force today, so the same text would
75
+ * be one instant in summer and another in winter: it is the first pass, as the browser's Date reads it, or the second
76
+ * when only that one is within min and max. A text that is min's or max's own is that bound's pass, so a time kept at a
77
+ * bound reads back as the bound.
78
+ */
79
+ const pickPass = (passes, format) => {
80
+ const [first] = passes;
81
+ if (passes.length < 2)
82
+ return first;
83
+ const text = wallText(first, format);
84
+ for (const bound of [format.min, format.max]) {
85
+ if (bound === undefined)
86
+ continue;
87
+ const shown = DateTime.fromMillis(bound, inZone(format.zone));
88
+ const onBound = wallText(shown, format) === text && passes.find((pass) => pass.offset === shown.offset);
89
+ if (onBound)
90
+ return onBound;
91
+ }
92
+ return passes.find((pass) => withinBounds(pass, format)) ?? first;
93
+ };
94
+ /** The typed fields of a complete text as a DateTime in the format's zone, or `null` */
95
+ const readTyped = (text, format) => {
96
+ const dateLetters = format.mode.replaceAll(/[^dmy]/g, "");
97
+ const timeLetters = format.timeMode?.replaceAll(/[^HMS]/g, "") ?? "";
98
+ const digits = text.replaceAll(/\D+/g, "");
99
+ if (digits.length !== dateLetters.length + timeLetters.length)
100
+ return null;
101
+ const dateDigits = digits.slice(0, dateLetters.length);
102
+ const day = segment(dateDigits, dateLetters, "d");
103
+ const month = segment(dateDigits, dateLetters, "m");
104
+ const year = segment(dateDigits, dateLetters, "y");
105
+ let msOfDay = 0;
106
+ if (format.timeMode) {
107
+ // Everything after the date's digits: the time and an AM/PM
108
+ const dateEnd = new RegExp(String.raw `^(?:\D*\d){${dateLetters.length}}`).exec(text)?.[0].length ?? 0;
109
+ msOfDay = maskitoParseTime(text.slice(dateEnd), { mode: format.timeMode });
110
+ }
111
+ const passes = passesAt({
112
+ // Maskito's reading: a two-digit year is in the 2000s, a missing one is year 0
113
+ year: year.length === 2 ? 2000 + Number(year) : Number(year || 0),
114
+ month: Number(month || 1),
115
+ day: Number(day || 1),
116
+ hour: Math.trunc(msOfDay / MS_IN_HOUR),
117
+ minute: Math.trunc((msOfDay % MS_IN_HOUR) / MS_IN_MINUTE),
118
+ second: Math.trunc((msOfDay % MS_IN_MINUTE) / MS_IN_SECOND),
119
+ millisecond: msOfDay % MS_IN_SECOND,
120
+ }, format.zone);
121
+ return passes.length ? pickPass(passes, format) : null;
122
+ };
123
+ /**
124
+ * The value for a complete text, or `null` while it is not one. A typed
125
+ * date is made in the format's zone from the typed fields, so the time is
126
+ * the one typed on a daylight saving day too. A date that does not exist is
127
+ * `null`; a time skipped by a clock change moves forward, as Luxon does, and
128
+ * a time the clocks show twice is its first pass, as the browser's Date reads
129
+ * it, unless only the second is within min and max or the text is a bound's
130
+ * own. Kept within min and max when the mode has a year, as Maskito's reading is.
131
+ */
132
+ export const parseDateInput = (text, format) => {
133
+ const typed = readTyped(text, format);
134
+ if (!typed)
135
+ return null;
136
+ return format.mode.includes("y") ? clampToRange(typed, format, format.zone) : typed;
137
+ };
138
+ /**
139
+ * min or max for Maskito's mask, which builds the typed dates with the
140
+ * browser's Date from their fields: the same fields, read in the value's
141
+ * zone, so the mask compares wall clocks. Only its steps for a date not yet
142
+ * complete read them, as keepTypedValue takes over the rest.
143
+ */
144
+ export const maskDate = (millis, zone) => {
145
+ const shown = DateTime.fromMillis(millis, inZone(zone));
146
+ const date = new Date(shown.year, shown.month - 1, shown.day, shown.hour, shown.minute, shown.second, shown.millisecond);
147
+ // Years 0 to 99 would read as 1900 to 1999
148
+ date.setFullYear(shown.year);
149
+ return date;
150
+ };
151
+ const NO_BREAK_SPACE = "\u00A0";
152
+ /** A wall date made in UTC, where every day exists, to compare calendar dates */
153
+ const calendarDay = (value) => DateTime.fromObject({ year: value.year, month: value.month, day: value.day }, { zone: "UTC" });
154
+ /**
155
+ * A text whose date is complete but not its time: its date kept within the dates of min and max, as Maskito's step
156
+ * keeps it, on the calendar instead of the browser's Date. `null` for a date that does not exist, left to Maskito.
157
+ */
158
+ const keepTypedDay = (value, format) => {
159
+ const dateLetters = format.mode.replaceAll(/[^dmy]/g, "");
160
+ const dateText = new RegExp(String.raw `^(?:\D*\d){${dateLetters.length}}`).exec(value)?.[0];
161
+ const dayFormat = { ...format, timeMode: undefined, min: undefined, max: undefined, zone: "UTC" };
162
+ const typed = dateText ? readTyped(dateText, dayFormat) : null;
163
+ if (!dateText || !typed)
164
+ return null;
165
+ const bound = (millis) => (millis === undefined ? undefined : calendarDay(DateTime.fromMillis(millis, inZone(format.zone))));
166
+ const min = bound(format.min);
167
+ const max = bound(format.max);
168
+ const kept = min && typed.toMillis() < min.toMillis() ? min : max && typed.toMillis() > max.toMillis() ? max : typed;
169
+ return wallText(kept, dayFormat) + value.slice(dateText.length);
170
+ };
171
+ /**
172
+ * Maskito's date and date-and-time masks end with a step that rebuilds a complete date with the browser's Date to keep
173
+ * it within min and max: in a zone whose clocks skipped a whole day the date moved a day, in the hour the browser's
174
+ * clocks skip a time typed for a value in another zone moved an hour, and min and max held on the browser's clock.
175
+ * This step reads a complete text in the value's zone, as the value is read (a time the clocks skip moves forward, an
176
+ * hour they repeat is its first pass or the one within min and max), and shows it kept within min and max as instants,
177
+ * so the text is the value's. A date and time without its time yet keeps its date within the dates of min and max. A
178
+ * date that does not exist, or one not yet complete, stays with Maskito's step.
179
+ */
180
+ export const keepTypedValue = (options, format) => {
181
+ const postprocessors = [...(options.postprocessors ?? [])];
182
+ const maskitoRange = postprocessors.pop();
183
+ if (!maskitoRange)
184
+ return options;
185
+ const keep = (state, initial) => {
186
+ // Complete once the AM or PM is typed too, as for Maskito
187
+ const complete = !format.timeMode?.includes("AA") || /[AP]M$/.test(state.value);
188
+ const typed = complete ? readTyped(state.value, format) : null;
189
+ // The mask puts a no-break space before AM and PM
190
+ const value = typed
191
+ ? formatDateInput(typed, format).replace(/ (?=[AP]M$)/, NO_BREAK_SPACE)
192
+ : format.timeMode
193
+ ? keepTypedDay(state.value, format)
194
+ : null;
195
+ if (value === null)
196
+ return maskitoRange(state, initial);
197
+ return value === state.value ? state : { value, selection: state.selection };
198
+ };
199
+ return { ...options, postprocessors: [...postprocessors, keep] };
200
+ };
201
+ //# sourceMappingURL=dateInputText.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dateInputText.js","sourceRoot":"","sources":["../../../src/lib/dateInputText.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,gBAAgB,EAAE,oBAAoB,EAA8C,MAAM,cAAc,CAAA;AACjH,OAAO,EAAE,QAAQ,EAAa,MAAM,OAAO,CAAA;AAsB3C,MAAM,UAAU,GAAG,SAAS,CAAA;AAC5B,MAAM,YAAY,GAAG,MAAM,CAAA;AAC3B,MAAM,YAAY,GAAG,KAAK,CAAA;AAE1B,MAAM,MAAM,GAAG,CAAC,IAA+B,EAAE,EAAE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AE,OAAO,YAAY,CAAC,KAAK,EAAE,OAAO,CAAC,CAAA;QACvD,OAAO,KAAK,KAAK,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,SAAS,EAAE,KAAK,CAAC,SAAS,EAAE,CAAA;IAC9E,CAAC,CAAA;IACD,OAAO,EAAE,GAAG,OAAO,EAAE,cAAc,EAAE,CAAC,GAAG,cAAc,EAAE,IAAI,CAAC,EAAE,CAAA;AAClE,CAAC,CAAA","sourcesContent":["import type { MaskitoOptions, MaskitoPostprocessor } from \"@maskito/core\"\nimport { maskitoParseTime, maskitoStringifyTime, type MaskitoDateMode, type MaskitoTimeMode } from \"@maskito/kit\"\nimport { DateTime, type Zone } from \"luxon\"\n\n// DateInput's text and value, converted through the Luxon DateTime's own\n// calendar fields in its own zone. Maskito's date helpers go through the\n// browser's local Date instead: they show the browser's wall clock for a\n// value in another zone, and the date and time helpers count the time from\n// local midnight, an hour off on a daylight saving day.\n\nexport type DateInputFormat = {\n mode: MaskitoDateMode\n separator: string\n /** Set for a date and time */\n timeMode?: MaskitoTimeMode\n dateTimeSeparator: string\n /** Earliest allowed instant, in milliseconds */\n min?: number\n /** Latest allowed instant, in milliseconds */\n max?: number\n /** Zone of the value (dateInputZone): typed dates are made in it. Luxon's default zone when not set */\n zone?: Zone | string\n}\n\nconst MS_IN_HOUR = 3_600_000\nconst MS_IN_MINUTE = 60_000\nconst MS_IN_SECOND = 1_000\n\nconst inZone = (zone: Zone | string | undefined) => (zone ? { zone } : undefined)\n\nconst pad = (value: number, length: number) => String(value).padStart(length, \"0\")\n\nconst zones = new Map<string, Zone>()\n\n/**\n * The zone typed dates are made in: the value's own zone object (Luxon's default zone without a value). A zone rebuilt\n * from its name can be another one: Luxon's system zone becomes the zone of its name, the zone named UTC becomes the\n * fixed UTC offset, and a name like UTC+5:5 (a 5:05 offset) does not parse back. The same object for the same zone,\n * so it keys a memo.\n */\nexport const dateInputZone = (value: DateTime | null | undefined): Zone | undefined => {\n if (!value?.isValid) return undefined\n const { zone } = value\n const key = zone.isUniversal ? `${zone.type} ${zone.offset(0)}` : `${zone.type} ${zone.name}`\n const known = zones.get(key)\n if (known) return known\n zones.set(key, zone)\n return zone\n}\n\n/** The key a DateInput re-shows its value on: the instant and the zone. */\nexport const dateInputValueKey = (value: DateTime | null | undefined) =>\n value?.isValid ? `${value.toMillis()} ${value.zoneName}` : \"\"\n\n// Maskito's own range: 0001-01-01 to 9999-12-31, end of day\nconst lowest = (zone: Zone | string | undefined) => DateTime.fromObject({ year: 1, month: 1, day: 1 }, inZone(zone))\nconst highest = (zone: Zone | string | undefined) =>\n DateTime.fromObject({ year: 9999, month: 12, day: 31, hour: 23, minute: 59, second: 59, millisecond: 999 }, inZone(zone))\n\n/**\n * Within min and max, and within Maskito's own range when the mode has a year: a date typed without one is in\n * year 0, which that range would turn into 0001-01-01.\n */\nconst clampToRange = (value: DateTime, format: DateInputFormat, zone: Zone | string | undefined) => {\n const withYear = format.mode.includes(\"y\")\n const min = format.min ?? (withYear ? lowest(zone).toMillis() : undefined)\n const max = format.max ?? (withYear ? highest(zone).toMillis() : undefined)\n const millis = value.toMillis()\n if (min !== undefined && millis < min) return DateTime.fromMillis(min, inZone(zone))\n if (max !== undefined && millis > max) return DateTime.fromMillis(max, inZone(zone))\n return value\n}\n\n/** The value's wall clock in its own zone, in the format */\nconst wallText = (shown: DateTime, format: DateInputFormat) => {\n const date = format.mode\n .replaceAll(\"/\", format.separator)\n .replace(/d+/, pad(shown.day, 2))\n .replace(/m+/, pad(shown.month, 2))\n .replace(/y+/, (year) => pad(shown.year, 4).slice(-year.length))\n if (!format.timeMode) return date\n const msOfDay = shown.hour * MS_IN_HOUR + shown.minute * MS_IN_MINUTE + shown.second * MS_IN_SECOND + shown.millisecond\n return date + format.dateTimeSeparator + maskitoStringifyTime(msOfDay, { mode: format.timeMode })\n}\n\n/** The text a DateInput shows for a value: its wall clock in its own zone, kept within min and max. */\nexport const formatDateInput = (value: DateTime | null, format: DateInputFormat) =>\n value?.isValid ? wallText(clampToRange(value, format, value.zone), format) : \"\"\n\nconst segment = (digits: string, letters: string, letter: string) =>\n digits.slice(letters.indexOf(letter), letters.lastIndexOf(letter) + 1)\n\ntype Fields = { year: number; month: number; day: number; hour: number; minute: number; second: number; millisecond: number }\n\n/**\n * Each instant the fields show in the zone, earliest first: two in an hour the clocks repeat, one in a time they skip,\n * moved forward as Luxon does. `[]` for a date that does not exist.\n */\nconst passesAt = (fields: Fields, zone: Zone | string | undefined) => {\n const parsed = DateTime.fromObject(fields, inZone(zone))\n if (!parsed.isValid) return []\n const passes = parsed.getPossibleOffsets().sort((a, b) => a.toMillis() - b.toMillis())\n return passes.length ? passes : [parsed]\n}\n\nconst withinBounds = (value: DateTime, format: DateInputFormat) =>\n (format.min === undefined || value.toMillis() >= format.min) && (format.max === undefined || value.toMillis() <= format.max)\n\n/**\n * Which instant a time the clocks show twice is. Luxon reads it with the offset in force today, so the same text would\n * be one instant in summer and another in winter: it is the first pass, as the browser's Date reads it, or the second\n * when only that one is within min and max. A text that is min's or max's own is that bound's pass, so a time kept at a\n * bound reads back as the bound.\n */\nconst pickPass = (passes: DateTime[], format: DateInputFormat) => {\n const [first] = passes\n if (passes.length < 2) return first\n const text = wallText(first, format)\n for (const bound of [format.min, format.max]) {\n if (bound === undefined) continue\n const shown = DateTime.fromMillis(bound, inZone(format.zone))\n const onBound = wallText(shown, format) === text && passes.find((pass) => pass.offset === shown.offset)\n if (onBound) return onBound\n }\n return passes.find((pass) => withinBounds(pass, format)) ?? first\n}\n\n/** The typed fields of a complete text as a DateTime in the format's zone, or `null` */\nconst readTyped = (text: string, format: DateInputFormat) => {\n const dateLetters = format.mode.replaceAll(/[^dmy]/g, \"\")\n const timeLetters = format.timeMode?.replaceAll(/[^HMS]/g, \"\") ?? \"\"\n const digits = text.replaceAll(/\\D+/g, \"\")\n if (digits.length !== dateLetters.length + timeLetters.length) return null\n\n const dateDigits = digits.slice(0, dateLetters.length)\n const day = segment(dateDigits, dateLetters, \"d\")\n const month = segment(dateDigits, dateLetters, \"m\")\n const year = segment(dateDigits, dateLetters, \"y\")\n\n let msOfDay = 0\n if (format.timeMode) {\n // Everything after the date's digits: the time and an AM/PM\n const dateEnd = new RegExp(String.raw`^(?:\\D*\\d){${dateLetters.length}}`).exec(text)?.[0].length ?? 0\n msOfDay = maskitoParseTime(text.slice(dateEnd), { mode: format.timeMode })\n }\n\n const passes = passesAt(\n {\n // Maskito's reading: a two-digit year is in the 2000s, a missing one is year 0\n year: year.length === 2 ? 2000 + Number(year) : Number(year || 0),\n month: Number(month || 1),\n day: Number(day || 1),\n hour: Math.trunc(msOfDay / MS_IN_HOUR),\n minute: Math.trunc((msOfDay % MS_IN_HOUR) / MS_IN_MINUTE),\n second: Math.trunc((msOfDay % MS_IN_MINUTE) / MS_IN_SECOND),\n millisecond: msOfDay % MS_IN_SECOND,\n },\n format.zone,\n )\n return passes.length ? pickPass(passes, format) : null\n}\n\n/**\n * The value for a complete text, or `null` while it is not one. A typed\n * date is made in the format's zone from the typed fields, so the time is\n * the one typed on a daylight saving day too. A date that does not exist is\n * `null`; a time skipped by a clock change moves forward, as Luxon does, and\n * a time the clocks show twice is its first pass, as the browser's Date reads\n * it, unless only the second is within min and max or the text is a bound's\n * own. Kept within min and max when the mode has a year, as Maskito's reading is.\n */\nexport const parseDateInput = (text: string, format: DateInputFormat) => {\n const typed = readTyped(text, format)\n if (!typed) return null\n return format.mode.includes(\"y\") ? clampToRange(typed, format, format.zone) : typed\n}\n\n/**\n * min or max for Maskito's mask, which builds the typed dates with the\n * browser's Date from their fields: the same fields, read in the value's\n * zone, so the mask compares wall clocks. Only its steps for a date not yet\n * complete read them, as keepTypedValue takes over the rest.\n */\nexport const maskDate = (millis: number, zone: Zone | string | undefined) => {\n const shown = DateTime.fromMillis(millis, inZone(zone))\n const date = new Date(shown.year, shown.month - 1, shown.day, shown.hour, shown.minute, shown.second, shown.millisecond)\n // Years 0 to 99 would read as 1900 to 1999\n date.setFullYear(shown.year)\n return date\n}\n\nconst NO_BREAK_SPACE = \"\\u00A0\"\n\n/** A wall date made in UTC, where every day exists, to compare calendar dates */\nconst calendarDay = (value: DateTime) => DateTime.fromObject({ year: value.year, month: value.month, day: value.day }, { zone: \"UTC\" })\n\n/**\n * A text whose date is complete but not its time: its date kept within the dates of min and max, as Maskito's step\n * keeps it, on the calendar instead of the browser's Date. `null` for a date that does not exist, left to Maskito.\n */\nconst keepTypedDay = (value: string, format: DateInputFormat) => {\n const dateLetters = format.mode.replaceAll(/[^dmy]/g, \"\")\n const dateText = new RegExp(String.raw`^(?:\\D*\\d){${dateLetters.length}}`).exec(value)?.[0]\n const dayFormat = { ...format, timeMode: undefined, min: undefined, max: undefined, zone: \"UTC\" }\n const typed = dateText ? readTyped(dateText, dayFormat) : null\n if (!dateText || !typed) return null\n const bound = (millis: number | undefined) => (millis === undefined ? undefined : calendarDay(DateTime.fromMillis(millis, inZone(format.zone))))\n const min = bound(format.min)\n const max = bound(format.max)\n const kept = min && typed.toMillis() < min.toMillis() ? min : max && typed.toMillis() > max.toMillis() ? max : typed\n return wallText(kept, dayFormat) + value.slice(dateText.length)\n}\n\n/**\n * Maskito's date and date-and-time masks end with a step that rebuilds a complete date with the browser's Date to keep\n * it within min and max: in a zone whose clocks skipped a whole day the date moved a day, in the hour the browser's\n * clocks skip a time typed for a value in another zone moved an hour, and min and max held on the browser's clock.\n * This step reads a complete text in the value's zone, as the value is read (a time the clocks skip moves forward, an\n * hour they repeat is its first pass or the one within min and max), and shows it kept within min and max as instants,\n * so the text is the value's. A date and time without its time yet keeps its date within the dates of min and max. A\n * date that does not exist, or one not yet complete, stays with Maskito's step.\n */\nexport const keepTypedValue = (options: MaskitoOptions, format: DateInputFormat): MaskitoOptions => {\n const postprocessors = [...(options.postprocessors ?? [])]\n const maskitoRange = postprocessors.pop()\n if (!maskitoRange) return options\n const keep: MaskitoPostprocessor = (state, initial) => {\n // Complete once the AM or PM is typed too, as for Maskito\n const complete = !format.timeMode?.includes(\"AA\") || /[AP]M$/.test(state.value)\n const typed = complete ? readTyped(state.value, format) : null\n // The mask puts a no-break space before AM and PM\n const value = typed\n ? formatDateInput(typed, format).replace(/ (?=[AP]M$)/, NO_BREAK_SPACE)\n : format.timeMode\n ? keepTypedDay(state.value, format)\n : null\n if (value === null) return maskitoRange(state, initial)\n return value === state.value ? state : { value, selection: state.selection }\n }\n return { ...options, postprocessors: [...postprocessors, keep] }\n}\n"]}
@@ -158,6 +158,33 @@ export const drawerTabbables = (drawer) => Array.from(drawer.querySelectorAll(TA
158
158
  (typeof element.checkVisibility !== "function" || element.checkVisibility({ visibilityProperty: true })));
159
159
  /** The first control of the open drawer, or the drawer itself */
160
160
  export const drawerInitialFocus = (drawer) => drawerTabbables(drawer)[0] ?? drawer;
161
+ const MENU_BUTTON = "[data-sidebar-mobile-menu-button]";
162
+ const PROVIDER = "[data-mobile-menu]";
163
+ /** Focus can go there: connected, not disabled, not inert or hidden, visible */
164
+ const canTakeFocus = (element) => element instanceof HTMLElement &&
165
+ element.isConnected &&
166
+ !element.matches(":disabled") &&
167
+ !element.closest("[inert], [hidden]") &&
168
+ (typeof element.checkVisibility !== "function" || element.checkVisibility({ visibilityProperty: true }));
169
+ /**
170
+ * Focuses where focus goes when the drawer closes: the control that opened it, or, when that cannot take focus (it
171
+ * sat in another drawer that has closed since, it is gone, or it was the page itself), the menu button of this
172
+ * drawer's provider, then any menu button on the page. The first that takes focus; `null` when none does. A drawer
173
+ * that has already left the page has no provider around it, so `root` is the provider taken while it was open.
174
+ */
175
+ export const returnDrawerFocus = (opener, drawer, root = drawer.closest(PROVIDER)) => {
176
+ // The provider's own menu buttons, not those of a provider inside it
177
+ const own = [...(root?.querySelectorAll(MENU_BUTTON) ?? [])].filter((button) => button.closest(PROVIDER) === root);
178
+ const candidates = [opener, ...own, ...document.querySelectorAll(MENU_BUTTON)];
179
+ for (const candidate of candidates) {
180
+ if (!canTakeFocus(candidate) || drawer.contains(candidate) || candidate === candidate.ownerDocument.body)
181
+ continue;
182
+ candidate.focus({ preventScroll: true });
183
+ if (candidate.ownerDocument.activeElement === candidate)
184
+ return candidate;
185
+ }
186
+ return null;
187
+ };
161
188
  /**
162
189
  * Tab from the last control goes to the first and Shift+Tab from the first to the last, so focus stays in the open
163
190
  * drawer. A layer over it in a portal (a menu, a dialog) keeps its own Tab.
@@ -1 +1 @@
1
- {"version":3,"file":"phoneDrawer.js","sourceRoot":"","sources":["../../../src/lib/phoneDrawer.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,uEAAuE;AACvE,MAAM,CAAC,MAAM,gBAAgB,GAAG,EAAE,CAAA;AAClC,yFAAyF;AACzF,MAAM,CAAC,MAAM,iBAAiB,GAAG,EAAE,CAAA;AACnC,sGAAsG;AACtG,MAAM,CAAC,MAAM,qBAAqB,GAAG,GAAG,CAAA;AACxC,sFAAsF;AACtF,MAAM,CAAC,MAAM,iBAAiB,GAAG,GAAG,CAAA;AA0BpC,MAAM,MAAM,GAAG,CAAC,MAAmB,EAAoB,EAAE,CACvD,gBAAgB,CAAC,MAAM,CAAC,CAAC,gBAAgB,CAAC,uBAAuB,CAAC,CAAC,IAAI,EAAE,KAAK,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,OAAO,CAAA;AAEzG,mHAAmH;AACnH,MAAM,QAAQ,GAAG,CAAC,MAAmB,EAAE,IAAiB,EAAE,IAAsB,EAAE,EAAE;IAClF,IAAI,IAAI,KAAK,MAAM;QAAE,OAAO,MAAM,CAAC,qBAAqB,EAAE,CAAC,KAAK,IAAI,IAAI,CAAC,qBAAqB,EAAE,CAAC,KAAK,CAAA;IACtG,MAAM,SAAS,GAAG,MAAM,CAAC,YAAY,YAAY,WAAW,CAAC,CAAC,CAAC,MAAM,CAAC,YAAY,CAAC,CAAC,CAAC,IAAI,CAAA;IACzF,OAAO,SAAS,EAAE,WAAW,IAAI,MAAM,CAAC,UAAU,CA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AM;IACjB,MAAM,WAAW,GAAG,CAAC,IAAW,EAAE,EAAE;QAClC,IAAI,CAAC,mBAAmB,CAAC,SAAS,EAAE,WAAW,CAAC,CAAA;QAChD,oGAAoG;QACpG,IAAI,IAAI,KAAK,KAAK,IAAI,KAAK,CAAC,gBAAgB;YAAE,OAAM;QACpD,KAAK,CAAC,cAAc,EAAE,CAAA;QACtB,KAAK,EAAE,CAAA;IACT,CAAC,CAAA;IACD,IAAI,CAAC,gBAAgB,CAAC,SAAS,EAAE,WAAW,CAAC,CAAA;AAC/C,CAAC","sourcesContent":["/**\n * The phone drawer of Sidebar, shared by React and Vue (one copy per package, kept identical by lib-sync).\n *\n * - It follows the finger: a swipe in from the edge it lives behind opens it, a swipe back toward that edge closes\n * it, and either finishes on release by how far and how fast the finger went. The drawer says its edge in\n * `--sidebar-drawer-edge` (`left` or `right`). While a finger drags it, the root carries `data-mobile-dragging`\n * and `--sidebar-drawer-progress` (0 closed to 1 open), and the styles place the drawer by them.\n * - While it is open, Tab goes round its controls (the page behind is inert), and Escape closes it once every other\n * listener has had the key, so a menu or dialog over the drawer takes its own Escape first.\n */\n\n/** How far in from its edge a swipe that opens the drawer may start */\nexport const DRAWER_EDGE_ZONE = 24\n/** How far a finger moves before the swipe is taken as horizontal or left to the page */\nexport const DRAWER_SWIPE_SLOP = 10\n/** A release faster than this, in px/ms, finishes the swipe in its direction whatever the distance */\nexport const DRAWER_SWIPE_VELOCITY = 0.3\n/** A finger held still this long, in ms, before it lifts lets go by distance alone */\nexport const DRAWER_SWIPE_HOLD = 100\n\nexport type DrawerSwipeOptions = {\n /** The element that holds the drawer and the page, where the drag state is written */\n root: HTMLElement\n /** The drawer itself */\n drawer: HTMLElement\n isOpen: () => boolean\n setOpen: (open: boolean) => void\n /** False turns the gesture off (a wide layout) */\n enabled?: () => boolean\n}\n\ntype Drag = {\n x: number\n y: number\n lastX: number\n lastTime: number\n velocity: number\n open: boolean\n edge: \"left\" | \"right\"\n travel: number\n state: \"pending\" | \"dragging\" | \"ignored\"\n progress: number\n}\n\nconst edgeOf = (drawer: HTMLElement): \"left\" | \"right\" =>\n getComputedStyle(drawer).getPropertyValue(\"--sidebar-drawer-edge\").trim() === \"left\" ? \"left\" : \"right\"\n\n/** The distance the drawer travels: its own width when it slides in beside the page, else its container's width */\nconst travelOf = (drawer: HTMLElement, root: HTMLElement, edge: \"left\" | \"right\") => {\n if (edge === \"left\") return drawer.getBoundingClientRect().width || root.getBoundingClientRect().width\n const container = drawer.offsetParent instanceof HTMLElement ? drawer.offsetParent : null\n return container?.clientWidth || window.innerWidth\n}\n\n/**\n * A finger on a slider, on an element that takes horizontal touches itself (`touch-action` without `pan-x`, such\n * as the Slider) or in a row that scrolls sideways moves that, not the drawer\n */\nconst ownsHorizontalSwipe = (target: EventTarget | null, root: HTMLElement) => {\n for (let node = target instanceof Element ? target : null; node && node !== root; node = node.parentElement) {\n if ((node instanceof HTMLInputElement && node.type === \"range\") || node.getAttribute(\"role\") === \"slider\") return true\n const style = getComputedStyle(node)\n if (/^(none|pan-y|pinch-zoom)/.test(style.touchAction) && !style.touchAction.includes(\"pan-x\")) return true\n if (node.scrollWidth > node.clientWidth && /auto|scroll/.test(style.overflowX)) return true\n }\n return false\n}\n\n/**\n * A popover or menu open over the drawer (the Radix and Reka popper wrappers) keeps the touch: swiping the drawer\n * away from under it would leave it open on an inert trigger. A modal dialog's overlay already covers the drawer.\n */\nconst layerOpen = (root: HTMLElement) =>\n root.ownerDocument.querySelector(\"[data-radix-popper-content-wrapper], [data-reka-popper-content-wrapper]\") !== null\n\n/** Starts the gesture on `root`; returns the cleanup */\nexport function attachDrawerSwipe({ root, drawer, isOpen, setOpen, enabled = () => true }: DrawerSwipeOptions) {\n let drag: Drag | null = null\n\n const setProgress = (progress: number) => {\n root.style.setProperty(\"--sidebar-drawer-progress\", String(progress))\n }\n\n const end = (commit: boolean, time = 0) => {\n const current = drag\n drag = null\n if (!current || current.state !== \"dragging\") return\n let next = current.open\n if (commit) {\n // Velocity in the opening direction is positive; a finger that stopped before lifting has none\n const velocity = time - current.lastTime > DRAWER_SWIPE_HOLD ? 0 : current.velocity\n const opening = current.edge === \"left\" ? velocity : -velocity\n next = opening > DRAWER_SWIPE_VELOCITY ? true : opening < -DRAWER_SWIPE_VELOCITY ? false : current.progress > 0.5\n }\n if (next !== current.open) setOpen(next)\n // The drawer leaves the finger once the new state is on the page, so it animates from where it was let go\n requestAnimationFrame(() => {\n root.removeAttribute(\"data-mobile-dragging\")\n root.style.removeProperty(\"--sidebar-drawer-progress\")\n })\n }\n\n const onTouchStart = (event: TouchEvent) => {\n // A second finger cancels a swipe under way, and the drawer goes back to where it was\n end(false)\n if (event.touches.length !== 1 || !enabled() || layerOpen(root) || ownsHorizontalSwipe(event.target, root)) return\n const touch = event.touches[0]!\n const open = isOpen()\n const edge = edgeOf(drawer)\n if (!open) {\n const bounds = root.getBoundingClientRect()\n const fromEdge = edge === \"left\" ? touch.clientX - bounds.left : bounds.right - touch.clientX\n if (fromEdge < 0 || fromEdge > DRAWER_EDGE_ZONE) return\n }\n drag = {\n x: touch.clientX,\n y: touch.clientY,\n lastX: touch.clientX,\n lastTime: event.timeStamp,\n velocity: 0,\n open,\n edge,\n travel: Math.max(1, travelOf(drawer, root, edge)),\n state: \"pending\",\n progress: open ? 1 : 0,\n }\n }\n\n const onTouchMove = (event: TouchEvent) => {\n if (!drag || drag.state === \"ignored\") return\n // A second finger put down outside the root shows only here\n if (event.touches.length !== 1) {\n end(false)\n return\n }\n const touch = event.touches[0]\n if (!touch) return\n const dx = touch.clientX - drag.x\n const dy = touch.clientY - drag.y\n // Toward the open drawer is positive\n const toward = drag.edge === \"left\" ? dx : -dx\n if (drag.state === \"pending\") {\n if (Math.abs(dx) < DRAWER_SWIPE_SLOP && Math.abs(dy) < DRAWER_SWIPE_SLOP) return\n const horizontal = Math.abs(dx) > Math.abs(dy)\n if (!horizontal || (drag.open ? toward >= 0 : toward <= 0)) {\n drag.state = \"ignored\"\n return\n }\n drag.state = \"dragging\"\n root.setAttribute(\"data-mobile-dragging\", \"\")\n }\n if (event.cancelable) event.preventDefault()\n const elapsed = event.timeStamp - drag.lastTime\n if (elapsed > 0) drag.velocity = (touch.clientX - drag.lastX) / elapsed\n drag.lastX = touch.clientX\n drag.lastTime = event.timeStamp\n drag.progress = Math.min(1, Math.max(0, (drag.open ? 1 : 0) + toward / drag.travel))\n setProgress(drag.progress)\n }\n\n // A finger lifted while another stays on the screen cancels the swipe\n const onTouchEnd = (event: TouchEvent) => end(event.touches.length === 0, event.timeStamp)\n const onTouchCancel = () => end(false)\n\n root.addEventListener(\"touchstart\", onTouchStart, { passive: true })\n root.addEventListener(\"touchmove\", onTouchMove, { passive: false })\n root.addEventListener(\"touchend\", onTouchEnd)\n root.addEventListener(\"touchcancel\", onTouchCancel)\n return () => {\n root.removeEventListener(\"touchstart\", onTouchStart)\n root.removeEventListener(\"touchmove\", onTouchMove)\n root.removeEventListener(\"touchend\", onTouchEnd)\n root.removeEventListener(\"touchcancel\", onTouchCancel)\n root.removeAttribute(\"data-mobile-dragging\")\n root.style.removeProperty(\"--sidebar-drawer-progress\")\n }\n}\n\nconst TABBABLE =\n 'a[href], area[href], button:not([disabled]), input:not([disabled]):not([type=\"hidden\"]), select:not([disabled]), textarea:not([disabled]), iframe, [contenteditable]:not([contenteditable=\"false\"]), [tabindex]'\n\n/** The controls Tab reaches in the drawer, in order: not disabled (a disabled fieldset too), not in a closed submenu, not hidden */\nexport const drawerTabbables = (drawer: HTMLElement) =>\n Array.from(drawer.querySelectorAll<HTMLElement>(TABBABLE)).filter(\n (element) =>\n element.tabIndex >= 0 &&\n !element.matches(\":disabled\") &&\n !element.closest(\"[inert], [hidden]\") &&\n (typeof element.checkVisibility !== \"function\" || element.checkVisibility({ visibilityProperty: true })),\n )\n\n/** The first control of the open drawer, or the drawer itself */\nexport const drawerInitialFocus = (drawer: HTMLElement) => drawerTabbables(drawer)[0] ?? drawer\n\n/**\n * Tab from the last control goes to the first and Shift+Tab from the first to the last, so focus stays in the open\n * drawer. A layer over it in a portal (a menu, a dialog) keeps its own Tab.\n */\nexport function loopDrawerFocus(event: KeyboardEvent, drawer: HTMLElement) {\n if (event.key !== \"Tab\" || event.defaultPrevented || event.altKey || event.ctrlKey || event.metaKey) return\n if (!(event.target instanceof Node) || !drawer.contains(event.target)) return\n const items = drawerTabbables(drawer)\n const active = drawer.ownerDocument.activeElement\n const first = items[0]\n const last = items[items.length - 1]\n if (!first || !last) {\n event.preventDefault()\n drawer.focus({ preventScroll: true })\n } else if (event.shiftKey && (active === first || active === drawer)) {\n event.preventDefault()\n last.focus({ preventScroll: true })\n } else if (!event.shiftKey && active === last) {\n event.preventDefault()\n first.focus({ preventScroll: true })\n }\n}\n\n/**\n * Escape pressed in the open drawer closes it when the key reaches the window unprevented: a menu, popover or dialog\n * over the drawer has its listener on the way there and takes the key first, however it listens.\n */\nexport function closeOnUnhandledEscape(event: KeyboardEvent, drawer: HTMLElement, close: () => void) {\n if (event.key !== \"Escape\" || event.defaultPrevented) return\n const view = drawer.ownerDocument.defaultView\n if (!view) return\n const afterOthers = (late: Event) => {\n view.removeEventListener(\"keydown\", afterOthers)\n // A listener that stopped the key on its way leaves this one to the next key, which only removes it\n if (late !== event || event.defaultPrevented) return\n event.preventDefault()\n close()\n }\n view.addEventListener(\"keydown\", afterOthers)\n}\n"]}
1
+ {"version":3,"file":"phoneDrawer.js","sourceRoot":"","sources":["../../../src/lib/phoneDrawer.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,uEAAuE;AACvE,MAAM,CAAC,MAAM,gBAAgB,GAAG,EAAE,CAAA;AAClC,yFAAyF;AACzF,MAAM,CAAC,MAAM,iBAAiB,GAAG,EAAE,CAAA;AACnC,sGAAsG;AACtG,MAAM,CAAC,MAAM,qBAAqB,GAAG,GAAG,CAAA;AACxC,sFAAsF;AACtF,MAAM,CAAC,MAAM,iBAAiB,GAAG,GAAG,CAAA;AA0BpC,MAAM,MAAM,GAAG,C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AQ,IAAI,CAAC,MAAM,KAAK,KAAK,IAAI,MAAM,KAAK,MAAM,CAAC,EAAE,CAAC;QACrE,KAAK,CAAC,cAAc,EAAE,CAAA;QACtB,IAAI,CAAC,KAAK,CAAC,EAAE,aAAa,EAAE,IAAI,EAAE,CAAC,CAAA;IACrC,CAAC;SAAM,IAAI,CAAC,KAAK,CAAC,QAAQ,IAAI,MAAM,KAAK,IAAI,EAAE,CAAC;QAC9C,KAAK,CAAC,cAAc,EAAE,CAAA;QACtB,KAAK,CAAC,KAAK,CAAC,EAAE,aAAa,EAAE,IAAI,EAAE,CAAC,CAAA;IACtC,CAAC;AACH,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,sBAAsB,CAAC,KAAoB,EAAE,MAAmB,EAAE,KAAiB;IACjG,IAAI,KAAK,CAAC,GAAG,KAAK,QAAQ,IAAI,KAAK,CAAC,gBAAgB;QAAE,OAAM;IAC5D,MAAM,IAAI,GAAG,MAAM,CAAC,aAAa,CAAC,WAAW,CAAA;IAC7C,IAAI,CAAC,IAAI;QAAE,OAAM;IACjB,MAAM,WAAW,GAAG,CAAC,IAAW,EAAE,EAAE;QAClC,IAAI,CAAC,mBAAmB,CAAC,SAAS,EAAE,WAAW,CAAC,CAAA;QAChD,oGAAoG;QACpG,IAAI,IAAI,KAAK,KAAK,IAAI,KAAK,CAAC,gBAAgB;YAAE,OAAM;QACpD,KAAK,CAAC,cAAc,EAAE,CAAA;QACtB,KAAK,EAAE,CAAA;IACT,CAAC,CAAA;IACD,IAAI,CAAC,gBAAgB,CAAC,SAAS,EAAE,WAAW,CAAC,CAAA;AAC/C,CAAC","sourcesContent":["/**\n * The phone drawer of Sidebar, shared by React and Vue (one copy per package, kept identical by lib-sync).\n *\n * - It follows the finger: a swipe in from the edge it lives behind opens it, a swipe back toward that edge closes\n * it, and either finishes on release by how far and how fast the finger went. The drawer says its edge in\n * `--sidebar-drawer-edge` (`left` or `right`). While a finger drags it, the root carries `data-mobile-dragging`\n * and `--sidebar-drawer-progress` (0 closed to 1 open), and the styles place the drawer by them.\n * - While it is open, Tab goes round its controls (the page behind is inert), and Escape closes it once every other\n * listener has had the key, so a menu or dialog over the drawer takes its own Escape first.\n */\n\n/** How far in from its edge a swipe that opens the drawer may start */\nexport const DRAWER_EDGE_ZONE = 24\n/** How far a finger moves before the swipe is taken as horizontal or left to the page */\nexport const DRAWER_SWIPE_SLOP = 10\n/** A release faster than this, in px/ms, finishes the swipe in its direction whatever the distance */\nexport const DRAWER_SWIPE_VELOCITY = 0.3\n/** A finger held still this long, in ms, before it lifts lets go by distance alone */\nexport const DRAWER_SWIPE_HOLD = 100\n\nexport type DrawerSwipeOptions = {\n /** The element that holds the drawer and the page, where the drag state is written */\n root: HTMLElement\n /** The drawer itself */\n drawer: HTMLElement\n isOpen: () => boolean\n setOpen: (open: boolean) => void\n /** False turns the gesture off (a wide layout) */\n enabled?: () => boolean\n}\n\ntype Drag = {\n x: number\n y: number\n lastX: number\n lastTime: number\n velocity: number\n open: boolean\n edge: \"left\" | \"right\"\n travel: number\n state: \"pending\" | \"dragging\" | \"ignored\"\n progress: number\n}\n\nconst edgeOf = (drawer: HTMLElement): \"left\" | \"right\" =>\n getComputedStyle(drawer).getPropertyValue(\"--sidebar-drawer-edge\").trim() === \"left\" ? \"left\" : \"right\"\n\n/** The distance the drawer travels: its own width when it slides in beside the page, else its container's width */\nconst travelOf = (drawer: HTMLElement, root: HTMLElement, edge: \"left\" | \"right\") => {\n if (edge === \"left\") return drawer.getBoundingClientRect().width || root.getBoundingClientRect().width\n const container = drawer.offsetParent instanceof HTMLElement ? drawer.offsetParent : null\n return container?.clientWidth || window.innerWidth\n}\n\n/**\n * A finger on a slider, on an element that takes horizontal touches itself (`touch-action` without `pan-x`, such\n * as the Slider) or in a row that scrolls sideways moves that, not the drawer\n */\nconst ownsHorizontalSwipe = (target: EventTarget | null, root: HTMLElement) => {\n for (let node = target instanceof Element ? target : null; node && node !== root; node = node.parentElement) {\n if ((node instanceof HTMLInputElement && node.type === \"range\") || node.getAttribute(\"role\") === \"slider\") return true\n const style = getComputedStyle(node)\n if (/^(none|pan-y|pinch-zoom)/.test(style.touchAction) && !style.touchAction.includes(\"pan-x\")) return true\n if (node.scrollWidth > node.clientWidth && /auto|scroll/.test(style.overflowX)) return true\n }\n return false\n}\n\n/**\n * A popover or menu open over the drawer (the Radix and Reka popper wrappers) keeps the touch: swiping the drawer\n * away from under it would leave it open on an inert trigger. A modal dialog's overlay already covers the drawer.\n */\nconst layerOpen = (root: HTMLElement) =>\n root.ownerDocument.querySelector(\"[data-radix-popper-content-wrapper], [data-reka-popper-content-wrapper]\") !== null\n\n/** Starts the gesture on `root`; returns the cleanup */\nexport function attachDrawerSwipe({ root, drawer, isOpen, setOpen, enabled = () => true }: DrawerSwipeOptions) {\n let drag: Drag | null = null\n\n const setProgress = (progress: number) => {\n root.style.setProperty(\"--sidebar-drawer-progress\", String(progress))\n }\n\n const end = (commit: boolean, time = 0) => {\n const current = drag\n drag = null\n if (!current || current.state !== \"dragging\") return\n let next = current.open\n if (commit) {\n // Velocity in the opening direction is positive; a finger that stopped before lifting has none\n const velocity = time - current.lastTime > DRAWER_SWIPE_HOLD ? 0 : current.velocity\n const opening = current.edge === \"left\" ? velocity : -velocity\n next = opening > DRAWER_SWIPE_VELOCITY ? true : opening < -DRAWER_SWIPE_VELOCITY ? false : current.progress > 0.5\n }\n if (next !== current.open) setOpen(next)\n // The drawer leaves the finger once the new state is on the page, so it animates from where it was let go\n requestAnimationFrame(() => {\n root.removeAttribute(\"data-mobile-dragging\")\n root.style.removeProperty(\"--sidebar-drawer-progress\")\n })\n }\n\n const onTouchStart = (event: TouchEvent) => {\n // A second finger cancels a swipe under way, and the drawer goes back to where it was\n end(false)\n if (event.touches.length !== 1 || !enabled() || layerOpen(root) || ownsHorizontalSwipe(event.target, root)) return\n const touch = event.touches[0]!\n const open = isOpen()\n const edge = edgeOf(drawer)\n if (!open) {\n const bounds = root.getBoundingClientRect()\n const fromEdge = edge === \"left\" ? touch.clientX - bounds.left : bounds.right - touch.clientX\n if (fromEdge < 0 || fromEdge > DRAWER_EDGE_ZONE) return\n }\n drag = {\n x: touch.clientX,\n y: touch.clientY,\n lastX: touch.clientX,\n lastTime: event.timeStamp,\n velocity: 0,\n open,\n edge,\n travel: Math.max(1, travelOf(drawer, root, edge)),\n state: \"pending\",\n progress: open ? 1 : 0,\n }\n }\n\n const onTouchMove = (event: TouchEvent) => {\n if (!drag || drag.state === \"ignored\") return\n // A second finger put down outside the root shows only here\n if (event.touches.length !== 1) {\n end(false)\n return\n }\n const touch = event.touches[0]\n if (!touch) return\n const dx = touch.clientX - drag.x\n const dy = touch.clientY - drag.y\n // Toward the open drawer is positive\n const toward = drag.edge === \"left\" ? dx : -dx\n if (drag.state === \"pending\") {\n if (Math.abs(dx) < DRAWER_SWIPE_SLOP && Math.abs(dy) < DRAWER_SWIPE_SLOP) return\n const horizontal = Math.abs(dx) > Math.abs(dy)\n if (!horizontal || (drag.open ? toward >= 0 : toward <= 0)) {\n drag.state = \"ignored\"\n return\n }\n drag.state = \"dragging\"\n root.setAttribute(\"data-mobile-dragging\", \"\")\n }\n if (event.cancelable) event.preventDefault()\n const elapsed = event.timeStamp - drag.lastTime\n if (elapsed > 0) drag.velocity = (touch.clientX - drag.lastX) / elapsed\n drag.lastX = touch.clientX\n drag.lastTime = event.timeStamp\n drag.progress = Math.min(1, Math.max(0, (drag.open ? 1 : 0) + toward / drag.travel))\n setProgress(drag.progress)\n }\n\n // A finger lifted while another stays on the screen cancels the swipe\n const onTouchEnd = (event: TouchEvent) => end(event.touches.length === 0, event.timeStamp)\n const onTouchCancel = () => end(false)\n\n root.addEventListener(\"touchstart\", onTouchStart, { passive: true })\n root.addEventListener(\"touchmove\", onTouchMove, { passive: false })\n root.addEventListener(\"touchend\", onTouchEnd)\n root.addEventListener(\"touchcancel\", onTouchCancel)\n return () => {\n root.removeEventListener(\"touchstart\", onTouchStart)\n root.removeEventListener(\"touchmove\", onTouchMove)\n root.removeEventListener(\"touchend\", onTouchEnd)\n root.removeEventListener(\"touchcancel\", onTouchCancel)\n root.removeAttribute(\"data-mobile-dragging\")\n root.style.removeProperty(\"--sidebar-drawer-progress\")\n }\n}\n\nconst TABBABLE =\n 'a[href], area[href], button:not([disabled]), input:not([disabled]):not([type=\"hidden\"]), select:not([disabled]), textarea:not([disabled]), iframe, [contenteditable]:not([contenteditable=\"false\"]), [tabindex]'\n\n/** The controls Tab reaches in the drawer, in order: not disabled (a disabled fieldset too), not in a closed submenu, not hidden */\nexport const drawerTabbables = (drawer: HTMLElement) =>\n Array.from(drawer.querySelectorAll<HTMLElement>(TABBABLE)).filter(\n (element) =>\n element.tabIndex >= 0 &&\n !element.matches(\":disabled\") &&\n !element.closest(\"[inert], [hidden]\") &&\n (typeof element.checkVisibility !== \"function\" || element.checkVisibility({ visibilityProperty: true })),\n )\n\n/** The first control of the open drawer, or the drawer itself */\nexport const drawerInitialFocus = (drawer: HTMLElement) => drawerTabbables(drawer)[0] ?? drawer\n\nconst MENU_BUTTON = \"[data-sidebar-mobile-menu-button]\"\nconst PROVIDER = \"[data-mobile-menu]\"\n\n/** Focus can go there: connected, not disabled, not inert or hidden, visible */\nconst canTakeFocus = (element: Element | null): element is HTMLElement =>\n element instanceof HTMLElement &&\n element.isConnected &&\n !element.matches(\":disabled\") &&\n !element.closest(\"[inert], [hidden]\") &&\n (typeof element.checkVisibility !== \"function\" || element.checkVisibility({ visibilityProperty: true }))\n\n/**\n * Focuses where focus goes when the drawer closes: the control that opened it, or, when that cannot take focus (it\n * sat in another drawer that has closed since, it is gone, or it was the page itself), the menu button of this\n * drawer's provider, then any menu button on the page. The first that takes focus; `null` when none does. A drawer\n * that has already left the page has no provider around it, so `root` is the provider taken while it was open.\n */\nexport const returnDrawerFocus = (\n opener: Element | null,\n drawer: HTMLElement,\n root: Element | null = drawer.closest(PROVIDER),\n): HTMLElement | null => {\n // The provider's own menu buttons, not those of a provider inside it\n const own = [...(root?.querySelectorAll(MENU_BUTTON) ?? [])].filter((button) => button.closest(PROVIDER) === root)\n const candidates = [opener, ...own, ...document.querySelectorAll(MENU_BUTTON)]\n for (const candidate of candidates) {\n if (!canTakeFocus(candidate) || drawer.contains(candidate) || candidate === candidate.ownerDocument.body) continue\n candidate.focus({ preventScroll: true })\n if (candidate.ownerDocument.activeElement === candidate) return candidate\n }\n return null\n}\n\n/**\n * Tab from the last control goes to the first and Shift+Tab from the first to the last, so focus stays in the open\n * drawer. A layer over it in a portal (a menu, a dialog) keeps its own Tab.\n */\nexport function loopDrawerFocus(event: KeyboardEvent, drawer: HTMLElement) {\n if (event.key !== \"Tab\" || event.defaultPrevented || event.altKey || event.ctrlKey || event.metaKey) return\n if (!(event.target instanceof Node) || !drawer.contains(event.target)) return\n const items = drawerTabbables(drawer)\n const active = drawer.ownerDocument.activeElement\n const first = items[0]\n const last = items[items.length - 1]\n if (!first || !last) {\n event.preventDefault()\n drawer.focus({ preventScroll: true })\n } else if (event.shiftKey && (active === first || active === drawer)) {\n event.preventDefault()\n last.focus({ preventScroll: true })\n } else if (!event.shiftKey && active === last) {\n event.preventDefault()\n first.focus({ preventScroll: true })\n }\n}\n\n/**\n * Escape pressed in the open drawer closes it when the key reaches the window unprevented: a menu, popover or dialog\n * over the drawer has its listener on the way there and takes the key first, however it listens.\n */\nexport function closeOnUnhandledEscape(event: KeyboardEvent, drawer: HTMLElement, close: () => void) {\n if (event.key !== \"Escape\" || event.defaultPrevented) return\n const view = drawer.ownerDocument.defaultView\n if (!view) return\n const afterOthers = (late: Event) => {\n view.removeEventListener(\"keydown\", afterOthers)\n // A listener that stopped the key on its way leaves this one to the next key, which only removes it\n if (late !== event || event.defaultPrevented) return\n event.preventDefault()\n close()\n }\n view.addEventListener(\"keydown\", afterOthers)\n}\n"]}
@@ -438,12 +438,6 @@ export type SidebarTriggerProps = ButtonHTMLAttributes;
438
438
  export declare const SidebarTrigger: ReturnType<typeof part<SidebarTriggerProps>>;
439
439
  export type SidebarMobileMenuButtonProps = ButtonHTMLAttributes;
440
440
  export declare const SidebarMobileMenuButton: ReturnType<typeof part<SidebarMobileMenuButtonProps>>;
441
- /**
442
- * The phone drawer: a modal dialog while it is open. Focus moves into it and Tab goes round its controls, the page
443
- * behind is inert (SidebarInset), Escape inside it closes it after any layer over it has taken its own, and focus
444
- * goes back to the control that opened it. A swipe in from the edge it slides from opens it and a swipe back closes
445
- * it (lib/phoneDrawer).
446
- */
447
441
  declare const SidebarMobileComponent: DefineComponent<import("vue").ExtractPropTypes<{
448
442
  /** When true, drawer is positioned absolute instead of fixed (for contained demos) */
449
443
  contained: {
@@ -0,0 +1,54 @@
1
+ import type { MaskitoOptions } from "@maskito/core";
2
+ import { type MaskitoDateMode, type MaskitoTimeMode } from "@maskito/kit";
3
+ import { DateTime, type Zone } from "luxon";
4
+ export type DateInputFormat = {
5
+ mode: MaskitoDateMode;
6
+ separator: string;
7
+ /** Set for a date and time */
8
+ timeMode?: MaskitoTimeMode;
9
+ dateTimeSeparator: string;
10
+ /** Earliest allowed instant, in milliseconds */
11
+ min?: number;
12
+ /** Latest allowed instant, in milliseconds */
13
+ max?: number;
14
+ /** Zone of the value (dateInputZone): typed dates are made in it. Luxon's default zone when not set */
15
+ zone?: Zone | string;
16
+ };
17
+ /**
18
+ * The zone typed dates are made in: the value's own zone object (Luxon's default zone without a value). A zone rebuilt
19
+ * from its name can be another one: Luxon's system zone becomes the zone of its name, the zone named UTC becomes the
20
+ * fixed UTC offset, and a name like UTC+5:5 (a 5:05 offset) does not parse back. The same object for the same zone,
21
+ * so it keys a memo.
22
+ */
23
+ export declare const dateInputZone: (value: DateTime | null | undefined) => Zone | undefined;
24
+ /** The key a DateInput re-shows its value on: the instant and the zone. */
25
+ export declare const dateInputValueKey: (value: DateTime | null | undefined) => string;
26
+ /** The text a DateInput shows for a value: its wall clock in its own zone, kept within min and max. */
27
+ export declare const formatDateInput: (value: DateTime | null, format: DateInputFormat) => string;
28
+ /**
29
+ * The value for a complete text, or `null` while it is not one. A typed
30
+ * date is made in the format's zone from the typed fields, so the time is
31
+ * the one typed on a daylight saving day too. A date that does not exist is
32
+ * `null`; a time skipped by a clock change moves forward, as Luxon does, and
33
+ * a time the clocks show twice is its first pass, as the browser's Date reads
34
+ * it, unless only the second is within min and max or the text is a bound's
35
+ * own. Kept within min and max when the mode has a year, as Maskito's reading is.
36
+ */
37
+ export declare const parseDateInput: (text: string, format: DateInputFormat) => DateTime<boolean> | null;
38
+ /**
39
+ * min or max for Maskito's mask, which builds the typed dates with the
40
+ * browser's Date from their fields: the same fields, read in the value's
41
+ * zone, so the mask compares wall clocks. Only its steps for a date not yet
42
+ * complete read them, as keepTypedValue takes over the rest.
43
+ */
44
+ export declare const maskDate: (millis: number, zone: Zone | string | undefined) => Date;
45
+ /**
46
+ * Maskito's date and date-and-time masks end with a step that rebuilds a complete date with the browser's Date to keep
47
+ * it within min and max: in a zone whose clocks skipped a whole day the date moved a day, in the hour the browser's
48
+ * clocks skip a time typed for a value in another zone moved an hour, and min and max held on the browser's clock.
49
+ * This step reads a complete text in the value's zone, as the value is read (a time the clocks skip moves forward, an
50
+ * hour they repeat is its first pass or the one within min and max), and shows it kept within min and max as instants,
51
+ * so the text is the value's. A date and time without its time yet keeps its date within the dates of min and max. A
52
+ * date that does not exist, or one not yet complete, stays with Maskito's step.
53
+ */
54
+ export declare const keepTypedValue: (options: MaskitoOptions, format: DateInputFormat) => MaskitoOptions;
@@ -32,6 +32,13 @@ export declare function attachDrawerSwipe({ root, drawer, isOpen, setOpen, enabl
32
32
  export declare const drawerTabbables: (drawer: HTMLElement) => HTMLElement[];
33
33
  /** The first control of the open drawer, or the drawer itself */
34
34
  export declare const drawerInitialFocus: (drawer: HTMLElement) => HTMLElement;
35
+ /**
36
+ * Focuses where focus goes when the drawer closes: the control that opened it, or, when that cannot take focus (it
37
+ * sat in another drawer that has closed since, it is gone, or it was the page itself), the menu button of this
38
+ * drawer's provider, then any menu button on the page. The first that takes focus; `null` when none does. A drawer
39
+ * that has already left the page has no provider around it, so `root` is the provider taken while it was open.
40
+ */
41
+ export declare const returnDrawerFocus: (opener: Element | null, drawer: HTMLElement, root?: Element | null) => HTMLElement | null;
35
42
  /**
36
43
  * Tab from the last control goes to the first and Shift+Tab from the first to the last, so focus stays in the open
37
44
  * drawer. A layer over it in a portal (a menu, a dialog) keeps its own Tab.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@plexui/vue",
3
- "version": "0.16.0",
3
+ "version": "0.17.0",
4
4
  "description": "Plex UI components for Vue 3, built on Reka UI and the shared @plexui/styles CSS",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -77,7 +77,7 @@
77
77
  "@maskito/core": "5.2.2",
78
78
  "@maskito/kit": "5.2.2",
79
79
  "@maskito/vue": "5.2.2",
80
- "@plexui/styles": "^0.1.41",
80
+ "@plexui/styles": "^0.1.42",
81
81
  "@tanstack/table-core": "8.21.3",
82
82
  "@tanstack/vue-table": "8.21.3",
83
83
  "@tiptap/core": "3.21.0",