@plexui/vue 0.1.4 → 0.1.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/es/components/Checkbox/Checkbox.js +4 -1
- package/dist/es/components/Checkbox/Checkbox.js.map +1 -1
- package/dist/es/components/DateRangePicker/Calendar.js +19 -18
- package/dist/es/components/DateRangePicker/Calendar.js.map +1 -1
- package/dist/es/components/DateRangePicker/DateRangePicker.js +5 -0
- package/dist/es/components/DateRangePicker/DateRangePicker.js.map +1 -1
- package/dist/es/components/DateRangePicker/context.js.map +1 -1
- package/dist/es/components/DateRangePicker/index.js.map +1 -1
- package/dist/es/components/DateRangePicker/types.js.map +1 -1
- package/dist/es/components/Dialog/Dialog.js +46 -11
- package/dist/es/components/Dialog/Dialog.js.map +1 -1
- package/dist/es/components/Field/Field.js +6 -3
- package/dist/es/components/Field/Field.js.map +1 -1
- package/dist/es/components/InputGroup/InputGroup.js +0 -1
- package/dist/es/components/InputGroup/InputGroup.js.map +1 -1
- package/dist/es/components/Menu/Menu.js +27 -5
- package/dist/es/components/Menu/Menu.js.map +1 -1
- package/dist/es/components/Popover/Popover.js +24 -9
- package/dist/es/components/Popover/Popover.js.map +1 -1
- package/dist/es/components/Select/Select.js +31 -15
- package/dist/es/components/Select/Select.js.map +1 -1
- package/dist/es/components/SelectControl/SelectControl.js +7 -4
- package/dist/es/components/SelectControl/SelectControl.js.map +1 -1
- package/dist/es/components/Transition/TransitionGroup.js +12 -1
- package/dist/es/components/Transition/TransitionGroup.js.map +1 -1
- package/dist/es/components/Transition/shared.js +30 -1
- package/dist/es/components/Transition/shared.js.map +1 -1
- package/dist/es/components/Transition/useTransitionChild.js +2 -2
- package/dist/es/components/Transition/useTransitionChild.js.map +1 -1
- package/dist/es/lib/dateUtils.js +5 -0
- package/dist/es/lib/dateUtils.js.map +1 -1
- package/dist/es/lib/helpers.js +30 -0
- package/dist/es/lib/helpers.js.map +1 -1
- package/dist/types/components/DateRangePicker/DateRangePicker.d.ts +23 -1
- package/dist/types/components/DateRangePicker/context.d.ts +2 -1
- package/dist/types/components/DateRangePicker/index.d.ts +1 -1
- package/dist/types/components/DateRangePicker/types.d.ts +2 -0
- package/dist/types/components/Field/Field.d.ts +2 -2
- package/dist/types/components/Select/Select.d.ts +11 -0
- package/dist/types/components/SelectControl/SelectControl.d.ts +11 -0
- package/dist/types/components/Transition/TransitionGroup.d.ts +11 -0
- package/dist/types/components/Transition/shared.d.ts +23 -0
- package/dist/types/components/Transition/useTransitionChild.d.ts +1 -0
- package/dist/types/lib/dateUtils.d.ts +5 -0
- package/dist/types/lib/helpers.d.ts +13 -0
- package/package.json +1 -1
|
@@ -141,7 +141,10 @@ const CheckboxComponent = defineComponent({
|
|
|
141
141
|
"aria-disabled": undefined,
|
|
142
142
|
...buttonAttrs,
|
|
143
143
|
"aria-describedby": ariaDescribedBy,
|
|
144
|
-
},
|
|
144
|
+
},
|
|
145
|
+
// Mounted for good: on every uncheck Presence reads computed style, and
|
|
146
|
+
// a long list of boxes cleared at once forces one style pass per box.
|
|
147
|
+
{ default: () => h(RekaCheckboxIndicator, { class: s.CheckMark, forceMount: true }) }),
|
|
145
148
|
}),
|
|
146
149
|
isFormControl.value
|
|
147
150
|
? h("input", {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Checkbox.js","sourceRoot":"","sources":["../../../../src/components/Checkbox/Checkbox.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,eAAe,EAAE,CAAC,EAAE,SAAS,EAAE,GAAG,EAAE,KAAK,EAAE,KAAK,EAAiB,MAAM,KAAK,CAAA;AAC/F,OAAO,EAAE,iBAAiB,IAAI,qBAAqB,EAAE,YAAY,IAAI,gBAAgB,EAAE,MAAM,SAAS,CAAA;AACtG,OAAO,EAAE,gBAAgB,EAAE,oBAAoB,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAA;AACvH,OAA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AAW,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC,WAAW,CAC5D;qBACF,CAAC;oBACJ,CAAC,CAAC,YAAY;aACjB,CACF,CAAA;QACH,CAAC,CAAA;IACH,CAAC;CACF,CAAC,CAAA;AAMF,MAAM,CAAC,MAAM,QAAQ,GAAG,iBAAiB,CAAA","sourcesContent":["import { computed, defineComponent, h, onMounted, ref, useId, watch, type PropType } from \"vue\"\nimport { CheckboxIndicator as RekaCheckboxIndicator, CheckboxRoot as RekaCheckboxRoot } from \"reka-ui\"\nimport { bubbleInputStyle, useBubbleInputEffect, useCheckedTracker, useIsFormControl, useSize } from \"./bubbleInput.js\"\nimport { ControlButton, isListener, type Listeners } from \"./ControlButton.js\"\nimport s from \"@plexui/styles/components/Checkbox/Checkbox.module.css\"\n\n// Vue port of packages/ui/src/components/Checkbox/Checkbox.tsx on Reka UI's\n// Checkbox (state, role, aria-checked, Enter handling, indicator presence).\n// Where Reka's DOM differs from Radix's, Radix's is rendered (see the parity\n// tests): the button carries `value`, no `aria-disabled` and no `aria-label`\n// copied from the label text; the hidden form input is Radix's BubbleInput;\n// the consumer's handlers run before the toggle and can cancel it; a form\n// reset restores the initial state.\n\nexport type CheckedState = boolean | \"indeterminate\"\n\nconst CheckboxComponent = defineComponent({\n name: \"Checkbox\",\n inheritAttrs: false,\n props: {\n /** The `id` of the checkbox. */\n id: String,\n /** The state of the checkbox when it is initially rendered. Use when you do not need to control its state. */\n defaultChecked: { type: [Boolean, String] as PropType<CheckedState>, default: undefined },\n /** The controlled state of the checkbox. Bind with `v-model:checked`. */\n checked: { type: [Boolean, String] as PropType<CheckedState>, default: undefined },\n /** Optional accessible label rendered to the right of the checkbox. The `label` slot takes rich content. */\n label: String,\n /** Optional second line below the label, linked via `aria-describedby`. The `description` slot takes rich content. */\n description: String,\n /** When `true`, prevents the user from interacting with the checkbox. */\n disabled: { type: Boolean, default: false },\n /** When `true`, indicates that the user must check the checkbox before the owning form can be submitted. */\n required: { type: Boolean, default: undefined },\n /** The name of the checkbox. Submitted with its owning form as part of a name/value pair. */\n name: String,\n /** The value given as data when submitted with a `name`. @default \"on\" */\n value: String,\n /** The orientation of the checkbox relative to the label. @default \"left\" */\n orientation: { type: String as PropType<\"left\" | \"right\">, default: \"left\" },\n /** Determines if the checkbox should be a fully rounded pill shape. @default false */\n pill: { type: Boolean, default: false },\n /** Visual style: `\"solid\"` fills the box when checked, `\"ghost\"` shows the checkmark only. @default \"solid\" */\n variant: { type: String as PropType<\"solid\" | \"ghost\">, default: \"solid\" },\n },\n emits: {\n /** The state of the checkbox changed */\n \"update:checked\": (_checked: CheckedState) => true,\n /** The checkbox gained focus */\n focus: (_event: FocusEvent) => true,\n /** The checkbox lost focus */\n blur: (_event: FocusEvent) => true,\n },\n setup(props, { attrs, slots, emit }) {\n const generatedId = useId()\n const container = ref<HTMLDivElement | null>(null)\n const control = ref<HTMLButtonElement | null>(null)\n const bubbleInput = ref<HTMLInputElement | null>(null)\n useCheckedTracker(bubbleInput)\n\n // Radix's useControllableState: controlled while `checked` is set, and\n // only actual changes are reported\n const internalChecked = ref<CheckedState>(props.defaultChecked ?? false)\n const checked = computed(() => props.checked ?? internalChecked.value)\n // The state a click asks for (Reka's toggle sets it), for the user click\n let requestedChecked = true\n const setChecked = (next: CheckedState) => {\n requestedChecked = next === true\n if (next === checked.value) return\n if (props.checked === undefined) internalChecked.value = next\n emit(\"update:checked\", next)\n }\n\n const initialChecked = checked.value\n const isFormControl = useIsFormControl(control, () => attrs.form)\n const controlSize = useSize(() => (isFormControl.value ? control.value : null))\n const onUserClick = useBubbleInputEffect(bubbleInput, () => checked.value, true)\n\n onMounted(() => {\n control.value = (container.value?.firstElementChild as HTMLButtonElement | null) ?? null\n })\n\n // Like a native checkbox, a form reset restores the initial state\n watch(control, (button, _, onCleanup) => {\n const form = button?.form\n if (!form) return\n const reset = () => setChecked(initialChecked)\n form.addEventListener(\"reset\", reset)\n onCleanup(() => form.removeEventListener(\"reset\", reset))\n })\n\n // In a form, the button's click stops here; the input's click bubbles instead\n const afterClick = (event: Event) => {\n const hasConsumerStoppedPropagation = event.cancelBubble\n onUserClick({ requestedChecked, hasConsumerStoppedPropagation })\n if (bubbleInput.value && isFormControl.value && !hasConsumerStoppedPropagation) event.stopPropagation()\n }\n\n // Prevents text selection when double-clicking the label\n const handleLabelMouseDown = (event: MouseEvent) => {\n if (!event.defaultPrevented && event.detail > 1) event.preventDefault()\n }\n\n return () => {\n const { class: className, form, ...rest } = attrs\n const id = props.id ?? generatedId\n const hasLabel = Boolean(slots.label || props.label)\n // The description only renders next to a label; it comes before any ids\n // the caller (a Field, say) passes\n const descriptionId = hasLabel && (slots.description || props.description) ? `${id}-label-description` : undefined\n const indeterminateDefault = props.defaultChecked === \"indeterminate\" ? false : props.defaultChecked\n const inputDefaultChecked = indeterminateDefault ?? (initialChecked === \"indeterminate\" ? false : initialChecked)\n\n // The consumer's listeners compose with Reka's; other attributes land\n // on the button after the component's own, as `{...restProps}` does\n const listeners: Listeners = {\n onFocus: (event: FocusEvent) => emit(\"focus\", event),\n onBlur: (event: FocusEvent) => emit(\"blur\", event),\n }\n const buttonAttrs: Record<string, unknown> = {}\n for (const [key, value] of Object.entries(rest)) {\n if (isListener(key)) listeners[key] = value\n else buttonAttrs[key] = value\n }\n const ariaDescribedBy =\n [descriptionId, buttonAttrs[\"aria-describedby\"] as string | undefined].filter(Boolean).join(\" \") || undefined\n const labelElement = hasLabel\n ? h(\"label\", { for: id, class: s.Label, onMousedown: handleLabelMouseDown }, slots.label ? slots.label() : props.label)\n : null\n\n return h(\n \"div\",\n {\n \"ref\": container,\n \"data-disabled\": props.disabled ? \"\" : undefined,\n \"data-has-label\": hasLabel ? \"\" : undefined,\n \"data-orientation\": props.orientation,\n \"class\": [className, s.Container],\n },\n [\n h(\n RekaCheckboxRoot as never,\n {\n \"asChild\": true,\n \"modelValue\": checked.value,\n \"onUpdate:modelValue\": setChecked,\n \"disabled\": props.disabled,\n // Passed even when unset, so Reka renders no aria-required=\"false\"\n \"required\": props.required,\n },\n {\n default: () =>\n h(\n ControlButton,\n {\n \"listeners\": listeners,\n \"after\": { onClick: afterClick },\n \"class\": s.Checkbox,\n \"id\": id,\n \"data-pill\": props.pill ? \"\" : undefined,\n \"data-variant\": props.variant,\n \"value\": props.value ?? \"on\",\n // Reka marks a disabled checkbox aria-disabled; Radix does not\n \"aria-disabled\": undefined,\n ...buttonAttrs,\n \"aria-describedby\": ariaDescribedBy,\n },\n { default: () => h(RekaCheckboxIndicator, { class: s.CheckMark }) },\n ),\n },\n ),\n isFormControl.value\n ? h(\"input\", {\n \"ref\": bubbleInput,\n \"type\": \"checkbox\",\n \"aria-hidden\": \"true\",\n \"^checked\": inputDefaultChecked ? \"\" : undefined,\n \"required\": props.required,\n \"disabled\": props.disabled,\n \"name\": props.name,\n \"^value\": props.value ?? \"on\",\n \"form\": form,\n \"tabindex\": -1,\n \"style\": bubbleInputStyle(controlSize.value, { transform: \"translateX(-100%)\" }),\n })\n : null,\n descriptionId\n ? h(\"div\", { class: s.LabelGroup }, [\n labelElement,\n h(\n \"span\",\n { id: descriptionId, class: s.Description },\n slots.description ? slots.description() : props.description,\n ),\n ])\n : labelElement,\n ],\n )\n }\n },\n})\n\ntype CheckboxOwnProps = InstanceType<typeof CheckboxComponent>[\"$props\"]\n\nexport type CheckboxProps = CheckboxOwnProps\n\nexport const Checkbox = CheckboxComponent\n"]}
|
|
1
|
+
{"version":3,"file":"Checkbox.js","sourceRoot":"","sources":["../../../../src/components/Checkbox/Checkbox.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,eAAe,EAAE,CAAC,EAAE,SAAS,EAAE,GAAG,EAAE,KAAK,EAAE,KAAK,EAAiB,MAAM,KAAK,CAAA;AAC/F,OAAO,EAAE,iBAAiB,IAAI,qBAAqB,EAAE,YAAY,IAAI,gBAAgB,EAAE,MAAM,SAAS,CAAA;AACtG,OAAO,EAAE,gBAAgB,EAAE,oBAAoB,EAAE,iBAAiB,E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,EAAE,EAAE,aAAa,EAAE,KAAK,EAAE,CAAC,CAAC,WAAW,EAAE,EAC3C,KAAK,CAAC,WAAW,CAAC,CAAC,CAAC,KAAK,CAAC,WAAW,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC,WAAW,CAC5D;qBACF,CAAC;oBACJ,CAAC,CAAC,YAAY;aACjB,CACF,CAAA;QACH,CAAC,CAAA;IACH,CAAC;CACF,CAAC,CAAA;AAMF,MAAM,CAAC,MAAM,QAAQ,GAAG,iBAAiB,CAAA","sourcesContent":["import { computed, defineComponent, h, onMounted, ref, useId, watch, type PropType } from \"vue\"\nimport { CheckboxIndicator as RekaCheckboxIndicator, CheckboxRoot as RekaCheckboxRoot } from \"reka-ui\"\nimport { bubbleInputStyle, useBubbleInputEffect, useCheckedTracker, useIsFormControl, useSize } from \"./bubbleInput.js\"\nimport { ControlButton, isListener, type Listeners } from \"./ControlButton.js\"\nimport s from \"@plexui/styles/components/Checkbox/Checkbox.module.css\"\n\n// Vue port of packages/ui/src/components/Checkbox/Checkbox.tsx on Reka UI's\n// Checkbox (state, role, aria-checked, Enter handling, indicator presence).\n// Where Reka's DOM differs from Radix's, Radix's is rendered (see the parity\n// tests): the button carries `value`, no `aria-disabled` and no `aria-label`\n// copied from the label text; the hidden form input is Radix's BubbleInput;\n// the consumer's handlers run before the toggle and can cancel it; a form\n// reset restores the initial state.\n\nexport type CheckedState = boolean | \"indeterminate\"\n\nconst CheckboxComponent = defineComponent({\n name: \"Checkbox\",\n inheritAttrs: false,\n props: {\n /** The `id` of the checkbox. */\n id: String,\n /** The state of the checkbox when it is initially rendered. Use when you do not need to control its state. */\n defaultChecked: { type: [Boolean, String] as PropType<CheckedState>, default: undefined },\n /** The controlled state of the checkbox. Bind with `v-model:checked`. */\n checked: { type: [Boolean, String] as PropType<CheckedState>, default: undefined },\n /** Optional accessible label rendered to the right of the checkbox. The `label` slot takes rich content. */\n label: String,\n /** Optional second line below the label, linked via `aria-describedby`. The `description` slot takes rich content. */\n description: String,\n /** When `true`, prevents the user from interacting with the checkbox. */\n disabled: { type: Boolean, default: false },\n /** When `true`, indicates that the user must check the checkbox before the owning form can be submitted. */\n required: { type: Boolean, default: undefined },\n /** The name of the checkbox. Submitted with its owning form as part of a name/value pair. */\n name: String,\n /** The value given as data when submitted with a `name`. @default \"on\" */\n value: String,\n /** The orientation of the checkbox relative to the label. @default \"left\" */\n orientation: { type: String as PropType<\"left\" | \"right\">, default: \"left\" },\n /** Determines if the checkbox should be a fully rounded pill shape. @default false */\n pill: { type: Boolean, default: false },\n /** Visual style: `\"solid\"` fills the box when checked, `\"ghost\"` shows the checkmark only. @default \"solid\" */\n variant: { type: String as PropType<\"solid\" | \"ghost\">, default: \"solid\" },\n },\n emits: {\n /** The state of the checkbox changed */\n \"update:checked\": (_checked: CheckedState) => true,\n /** The checkbox gained focus */\n focus: (_event: FocusEvent) => true,\n /** The checkbox lost focus */\n blur: (_event: FocusEvent) => true,\n },\n setup(props, { attrs, slots, emit }) {\n const generatedId = useId()\n const container = ref<HTMLDivElement | null>(null)\n const control = ref<HTMLButtonElement | null>(null)\n const bubbleInput = ref<HTMLInputElement | null>(null)\n useCheckedTracker(bubbleInput)\n\n // Radix's useControllableState: controlled while `checked` is set, and\n // only actual changes are reported\n const internalChecked = ref<CheckedState>(props.defaultChecked ?? false)\n const checked = computed(() => props.checked ?? internalChecked.value)\n // The state a click asks for (Reka's toggle sets it), for the user click\n let requestedChecked = true\n const setChecked = (next: CheckedState) => {\n requestedChecked = next === true\n if (next === checked.value) return\n if (props.checked === undefined) internalChecked.value = next\n emit(\"update:checked\", next)\n }\n\n const initialChecked = checked.value\n const isFormControl = useIsFormControl(control, () => attrs.form)\n const controlSize = useSize(() => (isFormControl.value ? control.value : null))\n const onUserClick = useBubbleInputEffect(bubbleInput, () => checked.value, true)\n\n onMounted(() => {\n control.value = (container.value?.firstElementChild as HTMLButtonElement | null) ?? null\n })\n\n // Like a native checkbox, a form reset restores the initial state\n watch(control, (button, _, onCleanup) => {\n const form = button?.form\n if (!form) return\n const reset = () => setChecked(initialChecked)\n form.addEventListener(\"reset\", reset)\n onCleanup(() => form.removeEventListener(\"reset\", reset))\n })\n\n // In a form, the button's click stops here; the input's click bubbles instead\n const afterClick = (event: Event) => {\n const hasConsumerStoppedPropagation = event.cancelBubble\n onUserClick({ requestedChecked, hasConsumerStoppedPropagation })\n if (bubbleInput.value && isFormControl.value && !hasConsumerStoppedPropagation) event.stopPropagation()\n }\n\n // Prevents text selection when double-clicking the label\n const handleLabelMouseDown = (event: MouseEvent) => {\n if (!event.defaultPrevented && event.detail > 1) event.preventDefault()\n }\n\n return () => {\n const { class: className, form, ...rest } = attrs\n const id = props.id ?? generatedId\n const hasLabel = Boolean(slots.label || props.label)\n // The description only renders next to a label; it comes before any ids\n // the caller (a Field, say) passes\n const descriptionId = hasLabel && (slots.description || props.description) ? `${id}-label-description` : undefined\n const indeterminateDefault = props.defaultChecked === \"indeterminate\" ? false : props.defaultChecked\n const inputDefaultChecked = indeterminateDefault ?? (initialChecked === \"indeterminate\" ? false : initialChecked)\n\n // The consumer's listeners compose with Reka's; other attributes land\n // on the button after the component's own, as `{...restProps}` does\n const listeners: Listeners = {\n onFocus: (event: FocusEvent) => emit(\"focus\", event),\n onBlur: (event: FocusEvent) => emit(\"blur\", event),\n }\n const buttonAttrs: Record<string, unknown> = {}\n for (const [key, value] of Object.entries(rest)) {\n if (isListener(key)) listeners[key] = value\n else buttonAttrs[key] = value\n }\n const ariaDescribedBy =\n [descriptionId, buttonAttrs[\"aria-describedby\"] as string | undefined].filter(Boolean).join(\" \") || undefined\n const labelElement = hasLabel\n ? h(\"label\", { for: id, class: s.Label, onMousedown: handleLabelMouseDown }, slots.label ? slots.label() : props.label)\n : null\n\n return h(\n \"div\",\n {\n \"ref\": container,\n \"data-disabled\": props.disabled ? \"\" : undefined,\n \"data-has-label\": hasLabel ? \"\" : undefined,\n \"data-orientation\": props.orientation,\n \"class\": [className, s.Container],\n },\n [\n h(\n RekaCheckboxRoot as never,\n {\n \"asChild\": true,\n \"modelValue\": checked.value,\n \"onUpdate:modelValue\": setChecked,\n \"disabled\": props.disabled,\n // Passed even when unset, so Reka renders no aria-required=\"false\"\n \"required\": props.required,\n },\n {\n default: () =>\n h(\n ControlButton,\n {\n \"listeners\": listeners,\n \"after\": { onClick: afterClick },\n \"class\": s.Checkbox,\n \"id\": id,\n \"data-pill\": props.pill ? \"\" : undefined,\n \"data-variant\": props.variant,\n \"value\": props.value ?? \"on\",\n // Reka marks a disabled checkbox aria-disabled; Radix does not\n \"aria-disabled\": undefined,\n ...buttonAttrs,\n \"aria-describedby\": ariaDescribedBy,\n },\n // Mounted for good: on every uncheck Presence reads computed style, and\n // a long list of boxes cleared at once forces one style pass per box.\n { default: () => h(RekaCheckboxIndicator, { class: s.CheckMark, forceMount: true }) },\n ),\n },\n ),\n isFormControl.value\n ? h(\"input\", {\n \"ref\": bubbleInput,\n \"type\": \"checkbox\",\n \"aria-hidden\": \"true\",\n \"^checked\": inputDefaultChecked ? \"\" : undefined,\n \"required\": props.required,\n \"disabled\": props.disabled,\n \"name\": props.name,\n \"^value\": props.value ?? \"on\",\n \"form\": form,\n \"tabindex\": -1,\n \"style\": bubbleInputStyle(controlSize.value, { transform: \"translateX(-100%)\" }),\n })\n : null,\n descriptionId\n ? h(\"div\", { class: s.LabelGroup }, [\n labelElement,\n h(\n \"span\",\n { id: descriptionId, class: s.Description },\n slots.description ? slots.description() : props.description,\n ),\n ])\n : labelElement,\n ],\n )\n }\n },\n})\n\ntype CheckboxOwnProps = InstanceType<typeof CheckboxComponent>[\"$props\"]\n\nexport type CheckboxProps = CheckboxOwnProps\n\nexport const Checkbox = CheckboxComponent\n"]}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { DateTime, Interval } from "luxon";
|
|
2
2
|
import { computed, createCommentVNode, defineComponent, h, onMounted, ref, shallowRef, watch } from "vue";
|
|
3
3
|
import { useBreakpoint } from "../../composables/useBreakpoints.js";
|
|
4
|
-
import { chunkIntoWeeks, getDaysOfMonth, isAfter, isBefore, isSameDay, isToday } from "../../lib/dateUtils.js";
|
|
4
|
+
import { chunkIntoWeeks, getDaysOfMonth, isAfter, isBefore, isSameDay, isToday, weekPosition } from "../../lib/dateUtils.js";
|
|
5
5
|
import { waitForAnimationFrame } from "../../lib/helpers.js";
|
|
6
6
|
import { Button } from "../Button/index.js";
|
|
7
7
|
import { Check, ChevronLeft, ChevronRight } from "../Icon/index.js";
|
|
@@ -20,12 +20,9 @@ import {} from "./types.js";
|
|
|
20
20
|
// `{isSmallUp && ...}`: TransitionGroup still renders its (empty) wrapper
|
|
21
21
|
// when animations are off.
|
|
22
22
|
// - React quirk kept: the day buttons have no `type`.
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
const
|
|
26
|
-
// The day a grid key moves to: a day, a week, the Sunday or Saturday of the
|
|
27
|
-
// week (rows start on Sunday), or a month (Luxon clamps Jan 31 to Feb 28/29)
|
|
28
|
-
const getKeyTarget = (key, day) => {
|
|
23
|
+
// The day a grid key moves to: a day, a week, the first or last day of the
|
|
24
|
+
// week row, or a month (Luxon clamps Jan 31 to Feb 28/29)
|
|
25
|
+
const getKeyTarget = (key, day, weekStartsOn) => {
|
|
29
26
|
switch (key) {
|
|
30
27
|
case "ArrowLeft":
|
|
31
28
|
return day.minus({ days: 1 });
|
|
@@ -36,9 +33,9 @@ const getKeyTarget = (key, day) => {
|
|
|
36
33
|
case "ArrowDown":
|
|
37
34
|
return day.plus({ days: 7 });
|
|
38
35
|
case "Home":
|
|
39
|
-
return day.minus({ days: day
|
|
36
|
+
return day.minus({ days: weekPosition(day, weekStartsOn) });
|
|
40
37
|
case "End":
|
|
41
|
-
return day.plus({ days: 6 - (day
|
|
38
|
+
return day.plus({ days: 6 - weekPosition(day, weekStartsOn) });
|
|
42
39
|
case "PageUp":
|
|
43
40
|
return day.minus({ months: 1 });
|
|
44
41
|
case "PageDown":
|
|
@@ -129,7 +126,7 @@ export const DateRangeCalendar = defineComponent({
|
|
|
129
126
|
}
|
|
130
127
|
// While a move waits for its month to render, the next key starts from
|
|
131
128
|
// the day it is moving to (key repeat), not the day that still has focus
|
|
132
|
-
const target = getKeyTarget(event.key, pendingFocus ?? day);
|
|
129
|
+
const target = getKeyTarget(event.key, pendingFocus ?? day, context.weekStartsOn);
|
|
133
130
|
if (!target) {
|
|
134
131
|
return;
|
|
135
132
|
}
|
|
@@ -283,7 +280,7 @@ export const DateRangeCalendar = defineComponent({
|
|
|
283
280
|
]),
|
|
284
281
|
h("div", {
|
|
285
282
|
class: s.CalendarRange,
|
|
286
|
-
style: { transform: `translate(${calendarSteps.value * -1 *
|
|
283
|
+
style: { transform: `translate(calc(${calendarSteps.value * -1} * var(--calendar-step)), 0)` },
|
|
287
284
|
}, [
|
|
288
285
|
h(TransitionGroup, { enterDuration: 400, exitDuration: 400 }, {
|
|
289
286
|
default: () => [
|
|
@@ -327,13 +324,15 @@ const CalendarView = defineComponent({
|
|
|
327
324
|
stepPosition: { type: Number, required: true },
|
|
328
325
|
},
|
|
329
326
|
setup(props) {
|
|
327
|
+
const context = useDateRangeContext();
|
|
330
328
|
// Lock position on mount and don't respond to changes
|
|
331
329
|
const position = props.stepPosition;
|
|
332
330
|
const view = computed(() => {
|
|
333
331
|
const { date, min, max } = props;
|
|
332
|
+
const { weekStartsOn } = context;
|
|
334
333
|
const monthStart = date.startOf("month");
|
|
335
334
|
const endOfMonth = date.endOf("month");
|
|
336
|
-
const daysBeforeMonthStart = monthStart
|
|
335
|
+
const daysBeforeMonthStart = weekPosition(monthStart, weekStartsOn);
|
|
337
336
|
const blankDays = new Array(daysBeforeMonthStart).fill(null);
|
|
338
337
|
const daysInMonth = getDaysOfMonth(monthStart);
|
|
339
338
|
const calendarCells = [...blankDays, ...daysInMonth];
|
|
@@ -359,9 +358,11 @@ const CalendarView = defineComponent({
|
|
|
359
358
|
const { selectionStart, maxRangeDays, isSelecting } = props;
|
|
360
359
|
const [selectedStart, selectedEnd] = props.selectedDates || [];
|
|
361
360
|
const rangeEndLimit = selectionStart && maxRangeDays != null ? selectionStart.plus({ days: maxRangeDays - 1 }) : undefined;
|
|
362
|
-
|
|
361
|
+
const { weekStartsOn } = context;
|
|
362
|
+
const dayLabels = [...daysOfTheWeekLabels.slice(weekStartsOn), ...daysOfTheWeekLabels.slice(0, weekStartsOn)];
|
|
363
|
+
return h("div", { "class": s.Calendar, "style": { left: `calc(${position} * var(--calendar-step))` }, "data-calendar": true }, [
|
|
363
364
|
h("p", { class: s.MonthLabel }, [startOfMonth.monthLong, " ", String(startOfMonth.year)]),
|
|
364
|
-
h("div", { class: s.Week },
|
|
365
|
+
h("div", { class: s.Week }, dayLabels.map((day) => h("div", { key: day, class: s.DayLabel }, day))),
|
|
365
366
|
...weeks.map((week, weekIndex) => h("div", { class: s.Week, key: weekIndex }, week.map((d, dayIndex) => {
|
|
366
367
|
if (!d) {
|
|
367
368
|
return h("div", { class: s.Day, key: `${weekIndex}-${dayIndex}` });
|
|
@@ -374,13 +375,13 @@ const CalendarView = defineComponent({
|
|
|
374
375
|
const isInRange = hasRange && selectedInterval.value?.contains(d);
|
|
375
376
|
const dayIsToday = isToday(d);
|
|
376
377
|
const isFirstRangeTrail = d.day === 1 &&
|
|
377
|
-
// Trail doesn't make sense to display at the start of the week
|
|
378
|
-
d
|
|
378
|
+
// Trail doesn't make sense to display at the start of the week
|
|
379
|
+
weekPosition(d, weekStartsOn) !== 0 &&
|
|
379
380
|
isInRange &&
|
|
380
381
|
!isStart;
|
|
381
382
|
const isLastRangeTrail = d.day === d.daysInMonth &&
|
|
382
|
-
// Trail doesn't make sense to display at the end of the week
|
|
383
|
-
d
|
|
383
|
+
// Trail doesn't make sense to display at the end of the week
|
|
384
|
+
weekPosition(d, weekStartsOn) !== 6 &&
|
|
384
385
|
isInRange &&
|
|
385
386
|
!isEnd;
|
|
386
387
|
return h("div", {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Calendar.js","sourceRoot":"","sources":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C,CAAC,GAAG,IAAI,QAAQ,CAAC,KAAK,EAAE,GAAG,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC;IAC7C,CAAC,CAAC,GAAG,IAAI,OAAO,CAAC,GAAG,EAAE,GAAG,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC;IACxC,CAAC,CAAC,YAAY,IAAI,IAAI,IAAI,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,YAAY,GAAG,CAAC,EAAE,CAAC,CAAC,CAAC,CAAA;AAE/G,MAAM,mBAAmB,GAAG,CAAC,UAAoB,EAAE,OAAkB,EAAE,EAAE;IACvE,IAAI,CAAC,OAAO,EAAE,CAAC;QACb,OAAO,UAAU,CAAA;IACnB,CAAC;IAED,OAAO,QAAQ,CAAC,UAAU,CAAC,KAAK,CAAC,OAAO,CAAC,EAAE,OAAO,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,UAAU,CAAC,KAAK,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,CAAC,CAAA;AACpG,CAAC,CAAA","sourcesContent":["import { DateTime, Interval } from \"luxon\"\nimport { computed, createCommentVNode, defineComponent, h, onMounted, ref, shallowRef, watch, type PropType } from \"vue\"\nimport { useBreakpoint } from \"../../composables/useBreakpoints.js\"\nimport { chunkIntoWeeks, getDaysOfMonth, isAfter, isBefore, isSameDay, isToday } from \"../../lib/dateUtils.js\"\nimport { waitForAnimationFrame } from \"../../lib/helpers.js\"\nimport { Button } from \"../Button/index.js\"\nimport { Check, ChevronLeft, ChevronRight } from \"../Icon/index.js\"\nimport { TransitionGroup } from \"../Transition/index.js\"\nimport s from \"@plexui/styles/components/DateRangePicker/Calendar.module.css\"\nimport { useDateRangeContext } from \"./context.js\"\nimport { type DateRange, type DateRangeShortcut } from \"./types.js\"\n\n// Vue port of packages/ui/src/components/DateRangePicker/Calendar.tsx.\n// - React's `[value]` effect is a watcher on the context value; the height\n// effect runs on mount and when the left month changes, after render.\n// - The `stable-view-N` key on the wrapper remounts the calendar view, as in\n// React, when the value jumps out of view.\n// - React's pending-focus effect is a post watcher on the left month; its\n// cleanup cancels the frame, as the effect's does.\n// - Below the `sm` breakpoint the right calendar is a placeholder, as React's\n// `{isSmallUp && ...}`: TransitionGroup still renders its (empty) wrapper\n// when animations are off.\n// - React quirk kept: the day buttons have no `type`.\n\nconst CALENDAR_WIDTH_PX = 210\nconst CALENDAR_GAP_PX = 32\nconst STEP_DISTANCE_PX = CALENDAR_WIDTH_PX + CALENDAR_GAP_PX\n\n// The day a grid key moves to: a day, a week, the Sunday or Saturday of the\n// week (rows start on Sunday), or a month (Luxon clamps Jan 31 to Feb 28/29)\nconst getKeyTarget = (key: string, day: DateTime): DateTime | null => {\n switch (key) {\n case \"ArrowLeft\":\n return day.minus({ days: 1 })\n case \"ArrowRight\":\n return day.plus({ days: 1 })\n case \"ArrowUp\":\n return day.minus({ days: 7 })\n case \"ArrowDown\":\n return day.plus({ days: 7 })\n case \"Home\":\n return day.minus({ days: day.weekday % 7 })\n case \"End\":\n return day.plus({ days: 6 - (day.weekday % 7) })\n case \"PageUp\":\n return day.minus({ months: 1 })\n case \"PageDown\":\n return day.plus({ months: 1 })\n default:\n return null\n }\n}\n\nconst monthIndex = (date: DateTime) => date.year * 12 + date.month\n\nexport const DateRangeCalendar = defineComponent({\n name: \"DateRangeCalendar\",\n setup() {\n const context = useDateRangeContext()\n const isSmallUp = useBreakpoint(\"sm\")\n const calendarContainerRef = shallowRef<HTMLDivElement | null>(null)\n // The day to focus once a key has moved the view to its month\n let pendingFocus: DateTime | null = null\n const selectionRange = shallowRef<DateRange | null>(null)\n const calendarSteps = ref(0)\n const forceRenderIncrement = ref(0)\n const leftCalendarDate = shallowRef<DateTime>(\n isSmallUp.value\n ? getLeftCalendarDate(context.value?.[0] ?? DateTime.now(), context.max)\n : (context.value?.[0] ?? DateTime.now()),\n )\n\n const rightCalendarDate = computed(() =>\n isSmallUp.value\n ? leftCalendarDate.value.plus({ months: 1 }).startOf(\"month\")\n : leftCalendarDate.value.startOf(\"month\"),\n )\n\n const canGoBack = () => !context.min || isBefore(context.min, leftCalendarDate.value.startOf(\"month\"))\n const canGoForward = () => !context.max || isBefore(rightCalendarDate.value.endOf(\"month\"), context.max)\n\n const handleNext = () => {\n calendarSteps.value += 1\n leftCalendarDate.value = leftCalendarDate.value.plus({ months: 1 })\n }\n\n const handlePrevious = () => {\n calendarSteps.value -= 1\n leftCalendarDate.value = leftCalendarDate.value.minus({ months: 1 })\n }\n\n const handleDateSelect = (selectedDate: DateTime) => {\n if (!selectionRange.value) {\n selectionRange.value = [selectedDate, selectedDate]\n return\n }\n\n const [currentSelectionStartDate] = selectionRange.value\n\n // Selecting a date before the current selected start date moves the start date\n // but does not resolve the selection\n if (isBefore(selectedDate, currentSelectionStartDate)) {\n selectionRange.value = [selectedDate, selectedDate]\n return\n }\n\n // Resolve the selection by emitting the value and clearing selection\n context.onChange([currentSelectionStartDate, selectedDate])\n selectionRange.value = null\n }\n\n const handleDateMouseEnter = (hoveredDate: DateTime) => {\n // If we're not actively selecting, no-op\n const currentSelectionRange = selectionRange.value\n if (!currentSelectionRange) {\n return\n }\n\n const [currentStartDate] = currentSelectionRange\n\n // When hovering a date before the current date, don't change the selection range\n if (isBefore(hoveredDate, currentStartDate)) {\n selectionRange.value = [currentStartDate, currentStartDate]\n return\n }\n\n selectionRange.value = [currentStartDate, hoveredDate]\n }\n\n const handleCalendarMouseLeave = () => {\n // If we're not actively selecting, no-op\n const currentSelectionRange = selectionRange.value\n if (!currentSelectionRange) {\n return\n }\n\n // Reset the end selection\n const [currentStartDate] = currentSelectionRange\n selectionRange.value = [currentStartDate, currentStartDate]\n }\n\n // Days are named by their full date; skip calendars that are leaving\n const focusDay = (day: DateTime) => {\n const label = day.toLocaleString(DateTime.DATE_HUGE)\n const buttons = calendarContainerRef.value?.querySelectorAll<HTMLButtonElement>(`button[aria-label=\"${label}\"]`)\n Array.from(buttons ?? [])\n .find((button) => !button.closest(\"[data-exiting]\"))\n ?.focus()\n }\n\n const handleDayKeyDown = (event: KeyboardEvent, day: DateTime) => {\n if (event.altKey || event.ctrlKey || event.metaKey) {\n return\n }\n\n // While a move waits for its month to render, the next key starts from\n // the day it is moving to (key repeat), not the day that still has focus\n const target = getKeyTarget(event.key, pendingFocus ?? day)\n if (!target) {\n return\n }\n\n event.preventDefault()\n\n // A disabled day (outside min/max, or past maxRangeDays while selecting)\n // keeps focus where it is\n const { min, max, maxRangeDays } = context\n const selection = selectionRange.value\n const rangeEndLimit =\n selection && maxRangeDays != null ? selection[0].plus({ days: maxRangeDays - 1 }) : undefined\n if (\n (min && isBefore(target, min.startOf(\"day\"))) ||\n (max && isAfter(target, max.endOf(\"day\"))) ||\n (rangeEndLimit && isAfter(target, rangeEndLimit))\n ) {\n return\n }\n\n const monthsBefore = monthIndex(leftCalendarDate.value) - monthIndex(target)\n const monthsAfter = monthIndex(target) - monthIndex(rightCalendarDate.value)\n if (monthsBefore <= 0 && monthsAfter <= 0) {\n pendingFocus = null\n focusDay(target)\n return\n }\n\n // Step the view like the month buttons; a day within min/max keeps every step in bounds\n if (monthsAfter > 0 ? !canGoForward() : !canGoBack()) {\n return\n }\n\n pendingFocus = target\n for (let step = 0; step < Math.max(monthsBefore, monthsAfter); step++) {\n if (monthsAfter > 0) {\n handleNext()\n } else {\n handlePrevious()\n }\n }\n }\n\n // Force re-renders when `value` changes out of brand from direct user-selection\n watch(\n () => context.value,\n (value) => {\n // When a new value is received, it could be out of band from the control of this calendar.\n // For example, a shortcut could be selected, or clear could be pressed. In either case, selection\n // should be reset so that the new `value` can be displayed fully.\n selectionRange.value = null\n\n // Nothing else to do when value is empty\n if (!value) {\n return\n }\n\n // Check if `value` is still within view of our calendar\n const viewInterval = Interval.fromDateTimes(\n leftCalendarDate.value.startOf(\"month\"),\n rightCalendarDate.value.endOf(\"month\"),\n )\n const isValueInRangeOfCalendar = viewInterval.contains(value[0]) || viewInterval.contains(value[1])\n if (!isValueInRangeOfCalendar) {\n // Reset state the calendar view entirely\n selectionRange.value = null\n calendarSteps.value = 0\n leftCalendarDate.value = isSmallUp.value ? getLeftCalendarDate(value[0], context.max) : value[0]\n forceRenderIncrement.value += 1\n }\n },\n )\n\n // Detect height changes when new calendars are rendered\n const measureHeight = () => {\n waitForAnimationFrame(() => {\n const container = calendarContainerRef.value\n\n if (!container) {\n return\n }\n\n let maxHeight = -Infinity\n\n // Find the tallest calendar\n container.querySelectorAll<HTMLElement>(\"[data-calendar]\")?.forEach((element) => {\n // NOTE: clientHeight does not respect the scale() that popover uses to animate in, which is what we want\n // We want to know the full height of the element, without any transform applied.\n const height = element.clientHeight\n\n // Ignore calendars that are exiting\n if (element.closest(\"[data-exiting]\")) {\n return\n }\n\n if (height > maxHeight) {\n maxHeight = height\n }\n })\n\n container.style.height = `${maxHeight}px`\n\n // Don't animate the initial height.\n // This is relevant when the calendar opens to a larger size than the default.\n if (!container.style.transition) {\n waitForAnimationFrame(() => {\n container.style.transition = `height 0.25s var(--cubic-move)`\n })\n }\n })\n }\n onMounted(measureHeight)\n watch(leftCalendarDate, measureHeight, { flush: \"post\" })\n\n // Focus a pending day once its month has rendered. TransitionGroup marks\n // the leaving calendar after this render, so wait a frame like the height does\n watch(\n leftCalendarDate,\n (_date, _previous, onCleanup) => {\n if (!pendingFocus) {\n return\n }\n\n onCleanup(\n waitForAnimationFrame(() => {\n const target = pendingFocus\n pendingFocus = null\n if (target) {\n focusDay(target)\n }\n }),\n )\n },\n { flush: \"post\" },\n )\n\n const setContainer = (el: unknown) => {\n calendarContainerRef.value = (el as HTMLDivElement | null) ?? null\n }\n\n return () => {\n const { value, min, max, maxRangeDays } = context\n const left = leftCalendarDate.value\n const right = rightCalendarDate.value\n const selection = selectionRange.value\n const selectedDisplayValue = selection || value\n const viewProps = {\n selectedDates: selectedDisplayValue,\n min,\n max,\n selectionStart: selection?.[0],\n maxRangeDays,\n isSelecting: !!selection,\n onDateSelect: handleDateSelect,\n onDateMouseEnter: handleDateMouseEnter,\n onDayKeyDown: handleDayKeyDown,\n }\n\n return h(\"div\", { key: `stable-view-${forceRenderIncrement.value}`, class: s.CalendarWrapper }, [\n h(\"div\", { ref: setContainer, class: s.CalendarContainer, onMouseleave: handleCalendarMouseLeave }, [\n h(\"div\", { class: s.Previous }, [\n h(\n Button,\n {\n \"variant\": \"ghost\",\n \"color\": \"secondary\",\n \"size\": \"sm\",\n \"pill\": false,\n \"gutterSize\": \"2xs\",\n \"iconSize\": \"sm\",\n \"onClick\": handlePrevious,\n \"disabled\": !canGoBack(),\n \"aria-label\": \"Previous month\",\n },\n { default: () => [h(ChevronLeft)] },\n ),\n ]),\n h(\"div\", { class: s.Next }, [\n h(\n Button,\n {\n \"variant\": \"ghost\",\n \"color\": \"secondary\",\n \"size\": \"sm\",\n \"pill\": false,\n \"gutterSize\": \"2xs\",\n \"iconSize\": \"sm\",\n \"onClick\": handleNext,\n \"disabled\": !canGoForward(),\n \"aria-label\": \"Next month\",\n },\n { default: () => [h(ChevronRight)] },\n ),\n ]),\n h(\n \"div\",\n {\n class: s.CalendarRange,\n style: { transform: `translate(${calendarSteps.value * -1 * STEP_DISTANCE_PX}px, 0)` },\n },\n [\n h(\n TransitionGroup,\n { enterDuration: 400, exitDuration: 400 },\n {\n default: () => [\n h(CalendarView, {\n key: left.toLocaleString({ month: \"long\", year: \"numeric\" }),\n stepPosition: calendarSteps.value,\n date: left,\n ...viewProps,\n }),\n isSmallUp.value\n ? h(CalendarView, {\n key: right.toLocaleString({ month: \"long\", year: \"numeric\" }),\n stepPosition: calendarSteps.value + 1,\n date: right,\n ...viewProps,\n })\n : createCommentVNode(),\n ],\n },\n ),\n ],\n ),\n ]),\n ])\n }\n },\n})\n\nconst daysOfTheWeekLabels = [\"Su\", \"Mo\", \"Tu\", \"We\", \"Th\", \"Fr\", \"Sa\"]\n\nconst CalendarView = defineComponent({\n name: \"DateRangeCalendarView\",\n props: {\n // Can be any day within the given month that the calendar should render for\n date: { type: Object as PropType<DateTime>, required: true },\n selectedDates: { type: Array as unknown as PropType<DateRange | null>, default: undefined },\n onDateSelect: Function as PropType<(dt: DateTime) => void>,\n onDateMouseEnter: Function as PropType<(dt: DateTime) => void>,\n onDayKeyDown: Function as PropType<(event: KeyboardEvent, dt: DateTime) => void>,\n min: Object as PropType<DateTime>,\n max: Object as PropType<DateTime>,\n selectionStart: { type: Object as PropType<DateTime | null>, default: undefined },\n maxRangeDays: Number,\n isSelecting: Boolean,\n stepPosition: { type: Number, required: true },\n },\n setup(props) {\n // Lock position on mount and don't respond to changes\n const position = props.stepPosition\n const view = computed(() => {\n const { date, min, max } = props\n const monthStart = date.startOf(\"month\")\n const endOfMonth = date.endOf(\"month\")\n\n const daysBeforeMonthStart = monthStart.weekday % 7\n const blankDays = new Array(daysBeforeMonthStart).fill(null)\n const daysInMonth = getDaysOfMonth(monthStart)\n const calendarCells = [...blankDays, ...daysInMonth]\n\n // Cells are start-of-day values and Interval excludes its end, so widen the\n // bounds to whole days: min/max days themselves stay selectable.\n const enabledDateInterval = Interval.fromDateTimes(\n (min || monthStart).startOf(\"day\"),\n (max || endOfMonth).endOf(\"day\"),\n )\n\n return {\n startOfMonth: monthStart,\n endOfMonth,\n weeks: chunkIntoWeeks(calendarCells, 7) as Array<Array<DateTime | null>>,\n enabledInterval: enabledDateInterval,\n }\n })\n\n const selectedInterval = computed<Interval | null>(() => {\n const [selectedStart, selectedEnd] = props.selectedDates || []\n if (!selectedStart || !selectedEnd) {\n return null\n }\n\n return Interval.fromDateTimes(selectedStart.startOf(\"day\"), selectedEnd.endOf(\"day\"))\n })\n\n return () => {\n const { startOfMonth, weeks, enabledInterval } = view.value\n const { selectionStart, maxRangeDays, isSelecting } = props\n const [selectedStart, selectedEnd] = props.selectedDates || []\n const rangeEndLimit =\n selectionStart && maxRangeDays != null ? selectionStart.plus({ days: maxRangeDays - 1 }) : undefined\n\n return h(\"div\", { \"class\": s.Calendar, \"style\": { left: `${position * STEP_DISTANCE_PX}px` }, \"data-calendar\": true }, [\n h(\"p\", { class: s.MonthLabel }, [startOfMonth.monthLong, \" \", String(startOfMonth.year)]),\n h(\n \"div\",\n { class: s.Week },\n daysOfTheWeekLabels.map((day) => h(\"div\", { key: day, class: s.DayLabel }, day)),\n ),\n ...weeks.map((week, weekIndex) =>\n h(\n \"div\",\n { class: s.Week, key: weekIndex },\n week.map((d, dayIndex) => {\n if (!d) {\n return h(\"div\", { class: s.Day, key: `${weekIndex}-${dayIndex}` })\n }\n\n // Check if 'day' is within selected range\n const enabled = enabledInterval.contains(d) && !(isSelecting && rangeEndLimit && isAfter(d, rangeEndLimit))\n const isStart = enabled && selectedStart && isSameDay(d, selectedStart)\n const isEnd = enabled && selectedEnd && isSameDay(d, selectedEnd)\n const hasRange = selectedStart && selectedEnd && !isSameDay(selectedStart, selectedEnd)\n const isInRange = hasRange && selectedInterval.value?.contains(d)\n const dayIsToday = isToday(d)\n const isFirstRangeTrail =\n d.day === 1 &&\n // Trail doesn't make sense to display at the start of the week (Monday)\n d.weekday !== 7 &&\n isInRange &&\n !isStart\n const isLastRangeTrail =\n d.day === d.daysInMonth &&\n // Trail doesn't make sense to display at the end of the week (Saturday)\n d.weekday !== 6 &&\n isInRange &&\n !isEnd\n\n return h(\n \"div\",\n {\n \"class\": s.Day,\n \"key\": dayIndex,\n \"data-is-start\": isStart ? \"\" : undefined,\n \"data-is-end\": isEnd ? \"\" : undefined,\n \"data-is-in-range\": isInRange ? \"\" : undefined,\n \"data-is-first-range-trail\": isFirstRangeTrail ? \"\" : undefined,\n \"data-is-last-range-trail\": isLastRangeTrail ? \"\" : undefined,\n },\n [\n // The full date names the day, which \"15\" alone does not across months\n h(\n \"button\",\n {\n \"class\": s.InteractiveDay,\n \"disabled\": !enabled,\n \"aria-label\": d.toLocaleString(DateTime.DATE_HUGE),\n \"aria-pressed\": isStart || isEnd || isInRange ? \"true\" : \"false\",\n \"aria-current\": dayIsToday ? \"date\" : undefined,\n \"onClick\": () => d && props.onDateSelect?.(d),\n \"onMouseenter\": () => d && props.onDateMouseEnter?.(d),\n \"onKeydown\": (event: KeyboardEvent) => d && props.onDayKeyDown?.(event, d),\n },\n [String(d.day), dayIsToday ? h(\"span\", { class: s.TodayDot }) : null],\n ),\n ],\n )\n }),\n ),\n ),\n ])\n }\n },\n})\n\nexport const DateRangeShortcuts = defineComponent({\n name: \"DateRangeShortcuts\",\n props: {\n shortcuts: Array as PropType<DateRangeShortcut[]>,\n },\n setup(props) {\n const isMediumUp = useBreakpoint(\"md\")\n const context = useDateRangeContext()\n\n return () => {\n const { shortcuts } = props\n if (!isMediumUp.value || !shortcuts?.length) {\n return null\n }\n\n const { value, min, max, maxRangeDays, onChange } = context\n\n return h(\n \"div\",\n { class: s.Shortcuts },\n shortcuts.map((shortcut) => {\n const { label, getDateRange } = shortcut\n const range = getDateRange()\n const [start, end] = range\n const isActive = !!value && isSameDay(value[0], start) && isSameDay(value[1], end)\n\n return h(\n Button,\n {\n key: label,\n class: \"mb-1\",\n variant: \"ghost\",\n color: \"primary\",\n pill: false,\n size: \"md\",\n iconSize: \"sm\",\n block: true,\n selected: isActive,\n disabled: !isRangeWithinLimits(range, min, max, maxRangeDays),\n onClick: () => onChange(range, shortcut),\n },\n { default: () => [h(\"span\", { class: s.ButtonText }, label), isActive ? h(Check) : null] },\n )\n }),\n )\n }\n },\n})\n\n// A shortcut follows the calendar's limits: whole days from min to max, and\n// no more than maxRangeDays days\nconst isRangeWithinLimits = ([start, end]: DateRange, min?: DateTime, max?: DateTime, maxRangeDays?: number) =>\n !(min && isBefore(start, min.startOf(\"day\"))) &&\n !(max && isAfter(end, max.endOf(\"day\"))) &&\n !(maxRangeDays != null && isAfter(end.startOf(\"day\"), start.startOf(\"day\").plus({ days: maxRangeDays - 1 })))\n\nconst getLeftCalendarDate = (targetDate: DateTime, maxDate?: DateTime) => {\n if (!maxDate) {\n return targetDate\n }\n\n return isBefore(targetDate.endOf(\"month\"), maxDate) ? targetDate : targetDate.minus({ months: 1 })\n}\n"]}
|
|
1
|
+
{"version":3,"file":"Calendar.js","sourceRoot":"","sources":["../../../../src/components/DateRangePicker/Calendar.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAA;AAC1C,OAAO,EAAE,QAAQ,EAAE,kBAAkB,EAAE,eAAe,EAAE,CAAC,EAAE,SAAS,EAAE,GAAG,EAAE,UAAU,EAAE,KAAK,EAAiB,MAAM,KAAK,CAAA;AACxH,OAAO,EAAE,aAAa,EAAE,MAAM,qCAAqC,CAAA;AACnE,OAAO,EAAE,cAAc,EAAE,cAAc,EAAE,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,OAAO,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAA;AAC5H,OAAO,EAAE,qBAAqB,EAAE,MAAM,sBAAsB,CAAA;AAC5D,OAAO,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAA;AAC3C,OAAO,EAAE,KAAK,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAA;AACnE,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAA;AACxD,OAAO,CAAC,MAAM,+DAA+D,CAAA;AAC7E,OAAO,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAA;AAClD,OAAO,EAA0C,MAAM,YAAY,CAAA;AAEnE,uEAAuE;AACvE,2EAA2E;AAC3E,wEAAwE;AACxE,6EAA6E;AAC7E,6CAA6C;AAC7C,0EAA0E;AAC1E,qDAAqD;AACrD,8EAA8E;AAC9E,4EAA4E;AAC5E,6BAA6B;AAC7B,sDAAsD;AAEtD,2EAA2E;AAC3E,0DAA0D;AAC1D,MAAM,YAAY,GAAG,CAAC,GAAW,EAAE,GAAa,EAAE,YAAoB,EAAmB,EAAE;IACzF,QAAQ,GAAG,EAAE,CAAC;QACZ,KAAK,WAAW;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,UAAU,EAAE,EAAE,KAAK,CAAC,EAAE,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,EAAE,CAC3F,CAAA;YACH,CAAC,CAAC,CACH,CAAA;QACH,CAAC,CAAA;IACH,CAAC;CACF,CAAC,CAAA;AAEF,4EAA4E;AAC5E,iCAAiC;AACjC,MAAM,mBAAmB,GAAG,CAAC,CAAC,KAAK,EAAE,GAAG,CAAY,EAAE,GAAc,EAAE,GAAc,EAAE,YAAqB,EAAE,EAAE,CAC7G,CAAC,CAAC,GAAG,IAAI,QAAQ,CAAC,KAAK,EAAE,GAAG,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC;IAC7C,CAAC,CAAC,GAAG,IAAI,OAAO,CAAC,GAAG,EAAE,GAAG,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC;IACxC,CAAC,CAAC,YAAY,IAAI,IAAI,IAAI,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,YAAY,GAAG,CAAC,EAAE,CAAC,CAAC,CAAC,CAAA;AAE/G,MAAM,mBAAmB,GAAG,CAAC,UAAoB,EAAE,OAAkB,EAAE,EAAE;IACvE,IAAI,CAAC,OAAO,EAAE,CAAC;QACb,OAAO,UAAU,CAAA;IACnB,CAAC;IAED,OAAO,QAAQ,CAAC,UAAU,CAAC,KAAK,CAAC,OAAO,CAAC,EAAE,OAAO,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,UAAU,CAAC,KAAK,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,CAAC,CAAA;AACpG,CAAC,CAAA","sourcesContent":["import { DateTime, Interval } from \"luxon\"\nimport { computed, createCommentVNode, defineComponent, h, onMounted, ref, shallowRef, watch, type PropType } from \"vue\"\nimport { useBreakpoint } from \"../../composables/useBreakpoints.js\"\nimport { chunkIntoWeeks, getDaysOfMonth, isAfter, isBefore, isSameDay, isToday, weekPosition } from \"../../lib/dateUtils.js\"\nimport { waitForAnimationFrame } from \"../../lib/helpers.js\"\nimport { Button } from \"../Button/index.js\"\nimport { Check, ChevronLeft, ChevronRight } from \"../Icon/index.js\"\nimport { TransitionGroup } from \"../Transition/index.js\"\nimport s from \"@plexui/styles/components/DateRangePicker/Calendar.module.css\"\nimport { useDateRangeContext } from \"./context.js\"\nimport { type DateRange, type DateRangeShortcut } from \"./types.js\"\n\n// Vue port of packages/ui/src/components/DateRangePicker/Calendar.tsx.\n// - React's `[value]` effect is a watcher on the context value; the height\n// effect runs on mount and when the left month changes, after render.\n// - The `stable-view-N` key on the wrapper remounts the calendar view, as in\n// React, when the value jumps out of view.\n// - React's pending-focus effect is a post watcher on the left month; its\n// cleanup cancels the frame, as the effect's does.\n// - Below the `sm` breakpoint the right calendar is a placeholder, as React's\n// `{isSmallUp && ...}`: TransitionGroup still renders its (empty) wrapper\n// when animations are off.\n// - React quirk kept: the day buttons have no `type`.\n\n// The day a grid key moves to: a day, a week, the first or last day of the\n// week row, or a month (Luxon clamps Jan 31 to Feb 28/29)\nconst getKeyTarget = (key: string, day: DateTime, weekStartsOn: number): DateTime | null => {\n switch (key) {\n case \"ArrowLeft\":\n return day.minus({ days: 1 })\n case \"ArrowRight\":\n return day.plus({ days: 1 })\n case \"ArrowUp\":\n return day.minus({ days: 7 })\n case \"ArrowDown\":\n return day.plus({ days: 7 })\n case \"Home\":\n return day.minus({ days: weekPosition(day, weekStartsOn) })\n case \"End\":\n return day.plus({ days: 6 - weekPosition(day, weekStartsOn) })\n case \"PageUp\":\n return day.minus({ months: 1 })\n case \"PageDown\":\n return day.plus({ months: 1 })\n default:\n return null\n }\n}\n\nconst monthIndex = (date: DateTime) => date.year * 12 + date.month\n\nexport const DateRangeCalendar = defineComponent({\n name: \"DateRangeCalendar\",\n setup() {\n const context = useDateRangeContext()\n const isSmallUp = useBreakpoint(\"sm\")\n const calendarContainerRef = shallowRef<HTMLDivElement | null>(null)\n // The day to focus once a key has moved the view to its month\n let pendingFocus: DateTime | null = null\n const selectionRange = shallowRef<DateRange | null>(null)\n const calendarSteps = ref(0)\n const forceRenderIncrement = ref(0)\n const leftCalendarDate = shallowRef<DateTime>(\n isSmallUp.value\n ? getLeftCalendarDate(context.value?.[0] ?? DateTime.now(), context.max)\n : (context.value?.[0] ?? DateTime.now()),\n )\n\n const rightCalendarDate = computed(() =>\n isSmallUp.value\n ? leftCalendarDate.value.plus({ months: 1 }).startOf(\"month\")\n : leftCalendarDate.value.startOf(\"month\"),\n )\n\n const canGoBack = () => !context.min || isBefore(context.min, leftCalendarDate.value.startOf(\"month\"))\n const canGoForward = () => !context.max || isBefore(rightCalendarDate.value.endOf(\"month\"), context.max)\n\n const handleNext = () => {\n calendarSteps.value += 1\n leftCalendarDate.value = leftCalendarDate.value.plus({ months: 1 })\n }\n\n const handlePrevious = () => {\n calendarSteps.value -= 1\n leftCalendarDate.value = leftCalendarDate.value.minus({ months: 1 })\n }\n\n const handleDateSelect = (selectedDate: DateTime) => {\n if (!selectionRange.value) {\n selectionRange.value = [selectedDate, selectedDate]\n return\n }\n\n const [currentSelectionStartDate] = selectionRange.value\n\n // Selecting a date before the current selected start date moves the start date\n // but does not resolve the selection\n if (isBefore(selectedDate, currentSelectionStartDate)) {\n selectionRange.value = [selectedDate, selectedDate]\n return\n }\n\n // Resolve the selection by emitting the value and clearing selection\n context.onChange([currentSelectionStartDate, selectedDate])\n selectionRange.value = null\n }\n\n const handleDateMouseEnter = (hoveredDate: DateTime) => {\n // If we're not actively selecting, no-op\n const currentSelectionRange = selectionRange.value\n if (!currentSelectionRange) {\n return\n }\n\n const [currentStartDate] = currentSelectionRange\n\n // When hovering a date before the current date, don't change the selection range\n if (isBefore(hoveredDate, currentStartDate)) {\n selectionRange.value = [currentStartDate, currentStartDate]\n return\n }\n\n selectionRange.value = [currentStartDate, hoveredDate]\n }\n\n const handleCalendarMouseLeave = () => {\n // If we're not actively selecting, no-op\n const currentSelectionRange = selectionRange.value\n if (!currentSelectionRange) {\n return\n }\n\n // Reset the end selection\n const [currentStartDate] = currentSelectionRange\n selectionRange.value = [currentStartDate, currentStartDate]\n }\n\n // Days are named by their full date; skip calendars that are leaving\n const focusDay = (day: DateTime) => {\n const label = day.toLocaleString(DateTime.DATE_HUGE)\n const buttons = calendarContainerRef.value?.querySelectorAll<HTMLButtonElement>(`button[aria-label=\"${label}\"]`)\n Array.from(buttons ?? [])\n .find((button) => !button.closest(\"[data-exiting]\"))\n ?.focus()\n }\n\n const handleDayKeyDown = (event: KeyboardEvent, day: DateTime) => {\n if (event.altKey || event.ctrlKey || event.metaKey) {\n return\n }\n\n // While a move waits for its month to render, the next key starts from\n // the day it is moving to (key repeat), not the day that still has focus\n const target = getKeyTarget(event.key, pendingFocus ?? day, context.weekStartsOn)\n if (!target) {\n return\n }\n\n event.preventDefault()\n\n // A disabled day (outside min/max, or past maxRangeDays while selecting)\n // keeps focus where it is\n const { min, max, maxRangeDays } = context\n const selection = selectionRange.value\n const rangeEndLimit =\n selection && maxRangeDays != null ? selection[0].plus({ days: maxRangeDays - 1 }) : undefined\n if (\n (min && isBefore(target, min.startOf(\"day\"))) ||\n (max && isAfter(target, max.endOf(\"day\"))) ||\n (rangeEndLimit && isAfter(target, rangeEndLimit))\n ) {\n return\n }\n\n const monthsBefore = monthIndex(leftCalendarDate.value) - monthIndex(target)\n const monthsAfter = monthIndex(target) - monthIndex(rightCalendarDate.value)\n if (monthsBefore <= 0 && monthsAfter <= 0) {\n pendingFocus = null\n focusDay(target)\n return\n }\n\n // Step the view like the month buttons; a day within min/max keeps every step in bounds\n if (monthsAfter > 0 ? !canGoForward() : !canGoBack()) {\n return\n }\n\n pendingFocus = target\n for (let step = 0; step < Math.max(monthsBefore, monthsAfter); step++) {\n if (monthsAfter > 0) {\n handleNext()\n } else {\n handlePrevious()\n }\n }\n }\n\n // Force re-renders when `value` changes out of brand from direct user-selection\n watch(\n () => context.value,\n (value) => {\n // When a new value is received, it could be out of band from the control of this calendar.\n // For example, a shortcut could be selected, or clear could be pressed. In either case, selection\n // should be reset so that the new `value` can be displayed fully.\n selectionRange.value = null\n\n // Nothing else to do when value is empty\n if (!value) {\n return\n }\n\n // Check if `value` is still within view of our calendar\n const viewInterval = Interval.fromDateTimes(\n leftCalendarDate.value.startOf(\"month\"),\n rightCalendarDate.value.endOf(\"month\"),\n )\n const isValueInRangeOfCalendar = viewInterval.contains(value[0]) || viewInterval.contains(value[1])\n if (!isValueInRangeOfCalendar) {\n // Reset state the calendar view entirely\n selectionRange.value = null\n calendarSteps.value = 0\n leftCalendarDate.value = isSmallUp.value ? getLeftCalendarDate(value[0], context.max) : value[0]\n forceRenderIncrement.value += 1\n }\n },\n )\n\n // Detect height changes when new calendars are rendered\n const measureHeight = () => {\n waitForAnimationFrame(() => {\n const container = calendarContainerRef.value\n\n if (!container) {\n return\n }\n\n let maxHeight = -Infinity\n\n // Find the tallest calendar\n container.querySelectorAll<HTMLElement>(\"[data-calendar]\")?.forEach((element) => {\n // NOTE: clientHeight does not respect the scale() that popover uses to animate in, which is what we want\n // We want to know the full height of the element, without any transform applied.\n const height = element.clientHeight\n\n // Ignore calendars that are exiting\n if (element.closest(\"[data-exiting]\")) {\n return\n }\n\n if (height > maxHeight) {\n maxHeight = height\n }\n })\n\n container.style.height = `${maxHeight}px`\n\n // Don't animate the initial height.\n // This is relevant when the calendar opens to a larger size than the default.\n if (!container.style.transition) {\n waitForAnimationFrame(() => {\n container.style.transition = `height 0.25s var(--cubic-move)`\n })\n }\n })\n }\n onMounted(measureHeight)\n watch(leftCalendarDate, measureHeight, { flush: \"post\" })\n\n // Focus a pending day once its month has rendered. TransitionGroup marks\n // the leaving calendar after this render, so wait a frame like the height does\n watch(\n leftCalendarDate,\n (_date, _previous, onCleanup) => {\n if (!pendingFocus) {\n return\n }\n\n onCleanup(\n waitForAnimationFrame(() => {\n const target = pendingFocus\n pendingFocus = null\n if (target) {\n focusDay(target)\n }\n }),\n )\n },\n { flush: \"post\" },\n )\n\n const setContainer = (el: unknown) => {\n calendarContainerRef.value = (el as HTMLDivElement | null) ?? null\n }\n\n return () => {\n const { value, min, max, maxRangeDays } = context\n const left = leftCalendarDate.value\n const right = rightCalendarDate.value\n const selection = selectionRange.value\n const selectedDisplayValue = selection || value\n const viewProps = {\n selectedDates: selectedDisplayValue,\n min,\n max,\n selectionStart: selection?.[0],\n maxRangeDays,\n isSelecting: !!selection,\n onDateSelect: handleDateSelect,\n onDateMouseEnter: handleDateMouseEnter,\n onDayKeyDown: handleDayKeyDown,\n }\n\n return h(\"div\", { key: `stable-view-${forceRenderIncrement.value}`, class: s.CalendarWrapper }, [\n h(\"div\", { ref: setContainer, class: s.CalendarContainer, onMouseleave: handleCalendarMouseLeave }, [\n h(\"div\", { class: s.Previous }, [\n h(\n Button,\n {\n \"variant\": \"ghost\",\n \"color\": \"secondary\",\n \"size\": \"sm\",\n \"pill\": false,\n \"gutterSize\": \"2xs\",\n \"iconSize\": \"sm\",\n \"onClick\": handlePrevious,\n \"disabled\": !canGoBack(),\n \"aria-label\": \"Previous month\",\n },\n { default: () => [h(ChevronLeft)] },\n ),\n ]),\n h(\"div\", { class: s.Next }, [\n h(\n Button,\n {\n \"variant\": \"ghost\",\n \"color\": \"secondary\",\n \"size\": \"sm\",\n \"pill\": false,\n \"gutterSize\": \"2xs\",\n \"iconSize\": \"sm\",\n \"onClick\": handleNext,\n \"disabled\": !canGoForward(),\n \"aria-label\": \"Next month\",\n },\n { default: () => [h(ChevronRight)] },\n ),\n ]),\n h(\n \"div\",\n {\n class: s.CalendarRange,\n style: { transform: `translate(calc(${calendarSteps.value * -1} * var(--calendar-step)), 0)` },\n },\n [\n h(\n TransitionGroup,\n { enterDuration: 400, exitDuration: 400 },\n {\n default: () => [\n h(CalendarView, {\n key: left.toLocaleString({ month: \"long\", year: \"numeric\" }),\n stepPosition: calendarSteps.value,\n date: left,\n ...viewProps,\n }),\n isSmallUp.value\n ? h(CalendarView, {\n key: right.toLocaleString({ month: \"long\", year: \"numeric\" }),\n stepPosition: calendarSteps.value + 1,\n date: right,\n ...viewProps,\n })\n : createCommentVNode(),\n ],\n },\n ),\n ],\n ),\n ]),\n ])\n }\n },\n})\n\nconst daysOfTheWeekLabels = [\"Su\", \"Mo\", \"Tu\", \"We\", \"Th\", \"Fr\", \"Sa\"]\n\nconst CalendarView = defineComponent({\n name: \"DateRangeCalendarView\",\n props: {\n // Can be any day within the given month that the calendar should render for\n date: { type: Object as PropType<DateTime>, required: true },\n selectedDates: { type: Array as unknown as PropType<DateRange | null>, default: undefined },\n onDateSelect: Function as PropType<(dt: DateTime) => void>,\n onDateMouseEnter: Function as PropType<(dt: DateTime) => void>,\n onDayKeyDown: Function as PropType<(event: KeyboardEvent, dt: DateTime) => void>,\n min: Object as PropType<DateTime>,\n max: Object as PropType<DateTime>,\n selectionStart: { type: Object as PropType<DateTime | null>, default: undefined },\n maxRangeDays: Number,\n isSelecting: Boolean,\n stepPosition: { type: Number, required: true },\n },\n setup(props) {\n const context = useDateRangeContext()\n // Lock position on mount and don't respond to changes\n const position = props.stepPosition\n const view = computed(() => {\n const { date, min, max } = props\n const { weekStartsOn } = context\n const monthStart = date.startOf(\"month\")\n const endOfMonth = date.endOf(\"month\")\n\n const daysBeforeMonthStart = weekPosition(monthStart, weekStartsOn)\n const blankDays = new Array(daysBeforeMonthStart).fill(null)\n const daysInMonth = getDaysOfMonth(monthStart)\n const calendarCells = [...blankDays, ...daysInMonth]\n\n // Cells are start-of-day values and Interval excludes its end, so widen the\n // bounds to whole days: min/max days themselves stay selectable.\n const enabledDateInterval = Interval.fromDateTimes(\n (min || monthStart).startOf(\"day\"),\n (max || endOfMonth).endOf(\"day\"),\n )\n\n return {\n startOfMonth: monthStart,\n endOfMonth,\n weeks: chunkIntoWeeks(calendarCells, 7) as Array<Array<DateTime | null>>,\n enabledInterval: enabledDateInterval,\n }\n })\n\n const selectedInterval = computed<Interval | null>(() => {\n const [selectedStart, selectedEnd] = props.selectedDates || []\n if (!selectedStart || !selectedEnd) {\n return null\n }\n\n return Interval.fromDateTimes(selectedStart.startOf(\"day\"), selectedEnd.endOf(\"day\"))\n })\n\n return () => {\n const { startOfMonth, weeks, enabledInterval } = view.value\n const { selectionStart, maxRangeDays, isSelecting } = props\n const [selectedStart, selectedEnd] = props.selectedDates || []\n const rangeEndLimit =\n selectionStart && maxRangeDays != null ? selectionStart.plus({ days: maxRangeDays - 1 }) : undefined\n\n const { weekStartsOn } = context\n const dayLabels = [...daysOfTheWeekLabels.slice(weekStartsOn), ...daysOfTheWeekLabels.slice(0, weekStartsOn)]\n return h(\"div\", { \"class\": s.Calendar, \"style\": { left: `calc(${position} * var(--calendar-step))` }, \"data-calendar\": true }, [\n h(\"p\", { class: s.MonthLabel }, [startOfMonth.monthLong, \" \", String(startOfMonth.year)]),\n h(\n \"div\",\n { class: s.Week },\n dayLabels.map((day) => h(\"div\", { key: day, class: s.DayLabel }, day)),\n ),\n ...weeks.map((week, weekIndex) =>\n h(\n \"div\",\n { class: s.Week, key: weekIndex },\n week.map((d, dayIndex) => {\n if (!d) {\n return h(\"div\", { class: s.Day, key: `${weekIndex}-${dayIndex}` })\n }\n\n // Check if 'day' is within selected range\n const enabled = enabledInterval.contains(d) && !(isSelecting && rangeEndLimit && isAfter(d, rangeEndLimit))\n const isStart = enabled && selectedStart && isSameDay(d, selectedStart)\n const isEnd = enabled && selectedEnd && isSameDay(d, selectedEnd)\n const hasRange = selectedStart && selectedEnd && !isSameDay(selectedStart, selectedEnd)\n const isInRange = hasRange && selectedInterval.value?.contains(d)\n const dayIsToday = isToday(d)\n const isFirstRangeTrail =\n d.day === 1 &&\n // Trail doesn't make sense to display at the start of the week\n weekPosition(d, weekStartsOn) !== 0 &&\n isInRange &&\n !isStart\n const isLastRangeTrail =\n d.day === d.daysInMonth &&\n // Trail doesn't make sense to display at the end of the week\n weekPosition(d, weekStartsOn) !== 6 &&\n isInRange &&\n !isEnd\n\n return h(\n \"div\",\n {\n \"class\": s.Day,\n \"key\": dayIndex,\n \"data-is-start\": isStart ? \"\" : undefined,\n \"data-is-end\": isEnd ? \"\" : undefined,\n \"data-is-in-range\": isInRange ? \"\" : undefined,\n \"data-is-first-range-trail\": isFirstRangeTrail ? \"\" : undefined,\n \"data-is-last-range-trail\": isLastRangeTrail ? \"\" : undefined,\n },\n [\n // The full date names the day, which \"15\" alone does not across months\n h(\n \"button\",\n {\n \"class\": s.InteractiveDay,\n \"disabled\": !enabled,\n \"aria-label\": d.toLocaleString(DateTime.DATE_HUGE),\n \"aria-pressed\": isStart || isEnd || isInRange ? \"true\" : \"false\",\n \"aria-current\": dayIsToday ? \"date\" : undefined,\n \"onClick\": () => d && props.onDateSelect?.(d),\n \"onMouseenter\": () => d && props.onDateMouseEnter?.(d),\n \"onKeydown\": (event: KeyboardEvent) => d && props.onDayKeyDown?.(event, d),\n },\n [String(d.day), dayIsToday ? h(\"span\", { class: s.TodayDot }) : null],\n ),\n ],\n )\n }),\n ),\n ),\n ])\n }\n },\n})\n\nexport const DateRangeShortcuts = defineComponent({\n name: \"DateRangeShortcuts\",\n props: {\n shortcuts: Array as PropType<DateRangeShortcut[]>,\n },\n setup(props) {\n const isMediumUp = useBreakpoint(\"md\")\n const context = useDateRangeContext()\n\n return () => {\n const { shortcuts } = props\n if (!isMediumUp.value || !shortcuts?.length) {\n return null\n }\n\n const { value, min, max, maxRangeDays, onChange } = context\n\n return h(\n \"div\",\n { class: s.Shortcuts },\n shortcuts.map((shortcut) => {\n const { label, getDateRange } = shortcut\n const range = getDateRange()\n const [start, end] = range\n const isActive = !!value && isSameDay(value[0], start) && isSameDay(value[1], end)\n\n return h(\n Button,\n {\n key: label,\n class: \"mb-1\",\n variant: \"ghost\",\n color: \"primary\",\n pill: false,\n size: \"md\",\n iconSize: \"sm\",\n block: true,\n selected: isActive,\n disabled: !isRangeWithinLimits(range, min, max, maxRangeDays),\n onClick: () => onChange(range, shortcut),\n },\n { default: () => [h(\"span\", { class: s.ButtonText }, label), isActive ? h(Check) : null] },\n )\n }),\n )\n }\n },\n})\n\n// A shortcut follows the calendar's limits: whole days from min to max, and\n// no more than maxRangeDays days\nconst isRangeWithinLimits = ([start, end]: DateRange, min?: DateTime, max?: DateTime, maxRangeDays?: number) =>\n !(min && isBefore(start, min.startOf(\"day\"))) &&\n !(max && isAfter(end, max.endOf(\"day\"))) &&\n !(maxRangeDays != null && isAfter(end.startOf(\"day\"), start.startOf(\"day\").plus({ days: maxRangeDays - 1 })))\n\nconst getLeftCalendarDate = (targetDate: DateTime, maxDate?: DateTime) => {\n if (!maxDate) {\n return targetDate\n }\n\n return isBefore(targetDate.endOf(\"month\"), maxDate) ? targetDate : targetDate.minus({ months: 1 })\n}\n"]}
|
|
@@ -24,6 +24,8 @@ const DateRangePickerComponent = defineComponent({
|
|
|
24
24
|
max: Object,
|
|
25
25
|
/** Maximum length of the selectable range in days (inclusive). */
|
|
26
26
|
maxRangeDays: Number,
|
|
27
|
+
/** The day each week starts on, from 0 (Sunday) to 6 (Saturday). @default 0 */
|
|
28
|
+
weekStartsOn: { type: Number, default: 0 },
|
|
27
29
|
/** Date range shortcuts for quick selection, shown to the left of the calendar. */
|
|
28
30
|
shortcuts: Array,
|
|
29
31
|
/** The preferred side of the trigger to render against when open. @default "bottom" */
|
|
@@ -87,6 +89,9 @@ const DateRangePickerComponent = defineComponent({
|
|
|
87
89
|
get maxRangeDays() {
|
|
88
90
|
return props.maxRangeDays;
|
|
89
91
|
},
|
|
92
|
+
get weekStartsOn() {
|
|
93
|
+
return props.weekStartsOn;
|
|
94
|
+
},
|
|
90
95
|
get triggerStepperUnit() {
|
|
91
96
|
return props.triggerStepperUnit;
|
|
92
97
|
},
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DateRangePicker.js","sourceRoot":"","sources":["../../../../src/components/DateRangePicker/DateRangePicker.ts"],"names":[],"mappings":"AACA,OAAO,EAAE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CAAC,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;qBAChE,EACD;wBACE,OAAO,EAAE,GAAG,EAAE,CAAC;4BACb,CAAC,CAAC,KAAK,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE,EAAE,CAAC,CAAC,CAAC,kBAAkB,EAAE,EAAE,SAAS,EAAE,KAAK,CAAC,SAAS,EAAE,CAAC,EAAE,CAAC,CAAC,iBAAiB,CAAC,CAAC,CAAC;yBAC3G;qBACF,CACF;iBACF;aACF,CAAC,CAAA;QACJ,CAAC,CAAA;IACH,CAAC;CACF,CAAC,CAAA;AAIF;;;;GAIG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG,wBAAwB,CAAA","sourcesContent":["import type { DateTime } from \"luxon\"\nimport { computed, defineComponent, h, provide, toRaw, type PropType } from \"vue\"\nimport type { ControlSize } from \"@plexui/styles/types\"\nimport { isAfter } from \"../../lib/dateUtils.js\"\nimport { Popover, PopoverContent, PopoverTrigger, type PopoverAlign, type PopoverSide } from \"../Popover/index.js\"\nimport type { DropdownIconType } from \"../SelectControl/index.js\"\nimport { DateRangeCalendar, DateRangeShortcuts } from \"./Calendar.js\"\nimport { DateRangeContextKey, type DateRangeContextValue } from \"./context.js\"\nimport { DateRangeTrigger } from \"./Trigger.js\"\nimport { type DateRange, type DateRangeShortcut } from \"./types.js\"\n\n// Vue port of packages/ui/src/components/DateRangePicker/DateRangePicker.tsx.\n// - `value` + `update:value` (`v-model:value`), plus `change`, which also\n// carries the selected shortcut like React's `onChange(range, shortcut)`.\n// Like React the picker is controlled: a parent that does not update\n// `value` keeps the shown range.\n// - DateTime values are read unwrapped (`toRaw`), so a `ref()` holding a\n// range (a deep reactive proxy) works like a plain value.\n\nconst DateRangePickerComponent = defineComponent({\n name: \"DateRangePicker\",\n inheritAttrs: false,\n props: {\n /** The selected date range value (`v-model:value`). */\n value: { type: Array as unknown as PropType<DateRange | null>, default: null },\n /** Defines the earliest selectable date (inclusive). */\n min: Object as PropType<DateTime>,\n /** Defines the latest selectable date (inclusive). */\n max: Object as PropType<DateTime>,\n /** Maximum length of the selectable range in days (inclusive). */\n maxRangeDays: Number,\n /** Date range shortcuts for quick selection, shown to the left of the calendar. */\n shortcuts: Array as PropType<DateRangeShortcut[]>,\n /** The preferred side of the trigger to render against when open. @default \"bottom\" */\n side: { type: String as PropType<PopoverSide>, default: \"bottom\" },\n /** The distance in pixels from the trigger. @default 8 */\n sideOffset: { type: Number, default: 8 },\n /** The preferred alignment against the trigger. @default \"center\" */\n align: { type: String as PropType<PopoverAlign>, default: \"center\" },\n /** An offset in pixels from the \"start\" or \"end\" alignment options. @default 0 */\n alignOffset: Number,\n /** Disables the select visually and from interactions. @default false */\n disabled: { type: Boolean, default: false },\n /** Placeholder text for the select. @default \"Select date range...\" */\n placeholder: { type: String, default: \"Select date range...\" },\n /** Style variant for the select trigger. @default \"outline\" */\n variant: { type: String as PropType<\"soft\" | \"outline\" | \"ghost\">, default: \"outline\" },\n /** Determines if the select trigger should be a fully rounded pill shape. @default true */\n pill: { type: Boolean, default: true },\n /** Size of the control: `3xs` 22px up to `3xl` 48px. @default \"md\" */\n size: { type: String as PropType<ControlSize>, default: \"md\" },\n /** Icon displayed in the far right of the select trigger. @default \"dropdown\" */\n dropdownIconType: String as PropType<DropdownIconType>,\n /** Custom class applied to the select trigger */\n triggerClassName: String,\n /** Display calendar icon at the start of the trigger. @default true */\n triggerShowIcon: { type: Boolean, default: true },\n /** Shows a stepper in the trigger when the selected range matches the unit ('month'). */\n triggerStepperUnit: String as PropType<\"month\">,\n /** Format of dates displayed in the trigger. @default \"MM/dd/yy\" */\n triggerDateFormat: { type: String, default: \"MM/dd/yy\" },\n /** Display a clear action that allows the select to be unset. @default false */\n clearable: { type: Boolean, default: false },\n /** Extends select to 100% of available width. @default false */\n block: { type: Boolean, default: false },\n },\n emits: {\n \"update:value\": (_nextValue: DateRange | null) => true,\n \"change\": (_nextValue: DateRange | null, _shortcut?: DateRangeShortcut) => true,\n },\n setup(props, { emit }) {\n const unwrap = <T>(value: T): T => (value ? toRaw(value) : value)\n\n // A new range only when `value` or one of its endpoints changes, as the\n // identity React's effects see. The endpoints are read through the array\n // so that `range.value[0] = date` on a `ref()` range is tracked.\n const value = computed<DateRange | null>(() => {\n const range = props.value\n if (!range) return null\n return [toRaw(range[0]), toRaw(range[1])]\n })\n\n const store: DateRangeContextValue = {\n get value() {\n return value.value\n },\n get min() {\n return unwrap(props.min)\n },\n get max() {\n return unwrap(props.max)\n },\n get maxRangeDays() {\n return props.maxRangeDays\n },\n get triggerStepperUnit() {\n return props.triggerStepperUnit\n },\n get triggerClassName() {\n return props.triggerClassName\n },\n get triggerShowIcon() {\n return props.triggerShowIcon\n },\n get triggerDateFormat() {\n return props.triggerDateFormat\n },\n get disabled() {\n return props.disabled\n },\n get variant() {\n return props.variant\n },\n get pill() {\n return props.pill\n },\n get block() {\n return props.block\n },\n get size() {\n return props.size\n },\n get dropdownIconType() {\n return props.dropdownIconType\n },\n get clearable() {\n return props.clearable\n },\n get placeholder() {\n return props.placeholder\n },\n get shortcuts() {\n return props.shortcuts\n },\n onChange: (nextValue, shortcut) => {\n emit(\"update:value\", nextValue)\n emit(\"change\", nextValue, shortcut)\n },\n }\n provide(DateRangeContextKey, store)\n\n return () => {\n const { min, max } = store\n const { align } = props\n\n // min and max are inclusive, so equal bounds allow one date\n if (min && max && isAfter(min, max)) {\n throw new Error(\"DateRangePicker error: `min` date must not be after the `max` date\")\n }\n\n return h(Popover, null, {\n default: () => [\n h(PopoverTrigger, null, { default: () => [h(DateRangeTrigger)] }),\n h(\n PopoverContent,\n {\n minWidth: 230,\n side: props.side,\n sideOffset: props.sideOffset,\n align,\n alignOffset: props.alignOffset ?? (align === \"center\" ? 0 : -5),\n },\n {\n default: () => [\n h(\"div\", { class: \"flex\" }, [h(DateRangeShortcuts, { shortcuts: props.shortcuts }), h(DateRangeCalendar)]),\n ],\n },\n ),\n ],\n })\n }\n },\n})\n\nexport type DateRangePickerProps = InstanceType<typeof DateRangePickerComponent>[\"$props\"]\n\n/**\n * A date range picker: a SelectControl trigger (or a month stepper) opening\n * two calendars and optional shortcuts in a popover. Bind the range\n * (`[start, end]` luxon `DateTime`s) with `v-model:value`.\n */\nexport const DateRangePicker = DateRangePickerComponent\n"]}
|
|
1
|
+
{"version":3,"file":"DateRangePicker.js","sourceRoot":"","sources":["../../../../src/components/DateRangePicker/DateRangePicker.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAE,eAAe,EAAE,CAAC,EAAE,OAAO,EAAE,KAAK,EAAiB,MAAM,KAAK,CAAA;AAEjF,OAAO,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAA;AAChD,OAAO,EAAE,OAAO,EAAE,cAAc,EAAE,cAAc,EAAuC,MAAM,qBAAqB,CAAA;AAElH,OAAO,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAA;AACrE,OAAO,EAAE,mBAAmB,EAA8B,MAAM,cAAc,CAAA;AAC9E,OAAO,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAA;AAC/C,OAAO,EAA0D,MAAM,YAAY,CAAA;AAEnF,8EAA8E;AAC9E,0EAA0E;AAC1E,4EAA4E;AAC5E,uEAAuE;AACvE,mCAAmC;AACnC,yEAAyE;AACzE,4DAA4D;AAE5D,MAAM,wBAAwB,GAAG,eAAe,CAAC;IAC/C,IAAI,EAAE,iBAAiB;IACvB,YAAY,EAAE,KAAK;IACnB,KAAK,EAAE;QACL,uDAAuD;QACvD,KAAK,EAAE,EAAE,IAAI,EAAE,KAA8C,EAAE,OAAO,EAAE,IAAI,EAAE;QAC9E,wDAAwD;QACxD,GAAG,EAAE,MAA4B;QACjC,sDAAsD;QACtD,GAAG,EAAE,MAA4B;QACjC,kEAAkE;QAClE,YAAY,EAAE,MAAM;QACpB,+EAA+E;QAC/E,YAAY,EAAE,EAAE,IAAI,EAAE,MAA6B,EAAE,O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AAG,CAAC,EAAE,CAAC;gBACpC,MAAM,IAAI,KAAK,CAAC,oEAAoE,CAAC,CAAA;YACvF,CAAC;YAED,OAAO,CAAC,CAAC,OAAO,EAAE,IAAI,EAAE;gBACtB,OAAO,EAAE,GAAG,EAAE,CAAC;oBACb,CAAC,CAAC,cAAc,EAAE,IAAI,EAAE,EAAE,OAAO,EAAE,GAAG,EAAE,CAAC,CAAC,CAAC,CAAC,gBAAgB,CAAC,CAAC,EAAE,CAAC;oBACjE,CAAC,CACC,cAAc,EACd;wBACE,QAAQ,EAAE,GAAG;wBACb,IAAI,EAAE,KAAK,CAAC,IAAI;wBAChB,UAAU,EAAE,KAAK,CAAC,UAAU;wBAC5B,KAAK;wBACL,WAAW,EAAE,KAAK,CAAC,WAAW,IAAI,CAAC,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;qBAChE,EACD;wBACE,OAAO,EAAE,GAAG,EAAE,CAAC;4BACb,CAAC,CAAC,KAAK,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE,EAAE,CAAC,CAAC,CAAC,kBAAkB,EAAE,EAAE,SAAS,EAAE,KAAK,CAAC,SAAS,EAAE,CAAC,EAAE,CAAC,CAAC,iBAAiB,CAAC,CAAC,CAAC;yBAC3G;qBACF,CACF;iBACF;aACF,CAAC,CAAA;QACJ,CAAC,CAAA;IACH,CAAC;CACF,CAAC,CAAA;AAIF;;;;GAIG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG,wBAAwB,CAAA","sourcesContent":["import type { DateTime } from \"luxon\"\nimport { computed, defineComponent, h, provide, toRaw, type PropType } from \"vue\"\nimport type { ControlSize } from \"@plexui/styles/types\"\nimport { isAfter } from \"../../lib/dateUtils.js\"\nimport { Popover, PopoverContent, PopoverTrigger, type PopoverAlign, type PopoverSide } from \"../Popover/index.js\"\nimport type { DropdownIconType } from \"../SelectControl/index.js\"\nimport { DateRangeCalendar, DateRangeShortcuts } from \"./Calendar.js\"\nimport { DateRangeContextKey, type DateRangeContextValue } from \"./context.js\"\nimport { DateRangeTrigger } from \"./Trigger.js\"\nimport { type DateRange, type DateRangeShortcut, type WeekStart } from \"./types.js\"\n\n// Vue port of packages/ui/src/components/DateRangePicker/DateRangePicker.tsx.\n// - `value` + `update:value` (`v-model:value`), plus `change`, which also\n// carries the selected shortcut like React's `onChange(range, shortcut)`.\n// Like React the picker is controlled: a parent that does not update\n// `value` keeps the shown range.\n// - DateTime values are read unwrapped (`toRaw`), so a `ref()` holding a\n// range (a deep reactive proxy) works like a plain value.\n\nconst DateRangePickerComponent = defineComponent({\n name: \"DateRangePicker\",\n inheritAttrs: false,\n props: {\n /** The selected date range value (`v-model:value`). */\n value: { type: Array as unknown as PropType<DateRange | null>, default: null },\n /** Defines the earliest selectable date (inclusive). */\n min: Object as PropType<DateTime>,\n /** Defines the latest selectable date (inclusive). */\n max: Object as PropType<DateTime>,\n /** Maximum length of the selectable range in days (inclusive). */\n maxRangeDays: Number,\n /** The day each week starts on, from 0 (Sunday) to 6 (Saturday). @default 0 */\n weekStartsOn: { type: Number as PropType<WeekStart>, default: 0 },\n /** Date range shortcuts for quick selection, shown to the left of the calendar. */\n shortcuts: Array as PropType<DateRangeShortcut[]>,\n /** The preferred side of the trigger to render against when open. @default \"bottom\" */\n side: { type: String as PropType<PopoverSide>, default: \"bottom\" },\n /** The distance in pixels from the trigger. @default 8 */\n sideOffset: { type: Number, default: 8 },\n /** The preferred alignment against the trigger. @default \"center\" */\n align: { type: String as PropType<PopoverAlign>, default: \"center\" },\n /** An offset in pixels from the \"start\" or \"end\" alignment options. @default 0 */\n alignOffset: Number,\n /** Disables the select visually and from interactions. @default false */\n disabled: { type: Boolean, default: false },\n /** Placeholder text for the select. @default \"Select date range...\" */\n placeholder: { type: String, default: \"Select date range...\" },\n /** Style variant for the select trigger. @default \"outline\" */\n variant: { type: String as PropType<\"soft\" | \"outline\" | \"ghost\">, default: \"outline\" },\n /** Determines if the select trigger should be a fully rounded pill shape. @default true */\n pill: { type: Boolean, default: true },\n /** Size of the control: `3xs` 22px up to `3xl` 48px. @default \"md\" */\n size: { type: String as PropType<ControlSize>, default: \"md\" },\n /** Icon displayed in the far right of the select trigger. @default \"dropdown\" */\n dropdownIconType: String as PropType<DropdownIconType>,\n /** Custom class applied to the select trigger */\n triggerClassName: String,\n /** Display calendar icon at the start of the trigger. @default true */\n triggerShowIcon: { type: Boolean, default: true },\n /** Shows a stepper in the trigger when the selected range matches the unit ('month'). */\n triggerStepperUnit: String as PropType<\"month\">,\n /** Format of dates displayed in the trigger. @default \"MM/dd/yy\" */\n triggerDateFormat: { type: String, default: \"MM/dd/yy\" },\n /** Display a clear action that allows the select to be unset. @default false */\n clearable: { type: Boolean, default: false },\n /** Extends select to 100% of available width. @default false */\n block: { type: Boolean, default: false },\n },\n emits: {\n \"update:value\": (_nextValue: DateRange | null) => true,\n \"change\": (_nextValue: DateRange | null, _shortcut?: DateRangeShortcut) => true,\n },\n setup(props, { emit }) {\n const unwrap = <T>(value: T): T => (value ? toRaw(value) : value)\n\n // A new range only when `value` or one of its endpoints changes, as the\n // identity React's effects see. The endpoints are read through the array\n // so that `range.value[0] = date` on a `ref()` range is tracked.\n const value = computed<DateRange | null>(() => {\n const range = props.value\n if (!range) return null\n return [toRaw(range[0]), toRaw(range[1])]\n })\n\n const store: DateRangeContextValue = {\n get value() {\n return value.value\n },\n get min() {\n return unwrap(props.min)\n },\n get max() {\n return unwrap(props.max)\n },\n get maxRangeDays() {\n return props.maxRangeDays\n },\n get weekStartsOn() {\n return props.weekStartsOn\n },\n get triggerStepperUnit() {\n return props.triggerStepperUnit\n },\n get triggerClassName() {\n return props.triggerClassName\n },\n get triggerShowIcon() {\n return props.triggerShowIcon\n },\n get triggerDateFormat() {\n return props.triggerDateFormat\n },\n get disabled() {\n return props.disabled\n },\n get variant() {\n return props.variant\n },\n get pill() {\n return props.pill\n },\n get block() {\n return props.block\n },\n get size() {\n return props.size\n },\n get dropdownIconType() {\n return props.dropdownIconType\n },\n get clearable() {\n return props.clearable\n },\n get placeholder() {\n return props.placeholder\n },\n get shortcuts() {\n return props.shortcuts\n },\n onChange: (nextValue, shortcut) => {\n emit(\"update:value\", nextValue)\n emit(\"change\", nextValue, shortcut)\n },\n }\n provide(DateRangeContextKey, store)\n\n return () => {\n const { min, max } = store\n const { align } = props\n\n // min and max are inclusive, so equal bounds allow one date\n if (min && max && isAfter(min, max)) {\n throw new Error(\"DateRangePicker error: `min` date must not be after the `max` date\")\n }\n\n return h(Popover, null, {\n default: () => [\n h(PopoverTrigger, null, { default: () => [h(DateRangeTrigger)] }),\n h(\n PopoverContent,\n {\n minWidth: 230,\n side: props.side,\n sideOffset: props.sideOffset,\n align,\n alignOffset: props.alignOffset ?? (align === \"center\" ? 0 : -5),\n },\n {\n default: () => [\n h(\"div\", { class: \"flex\" }, [h(DateRangeShortcuts, { shortcuts: props.shortcuts }), h(DateRangeCalendar)]),\n ],\n },\n ),\n ],\n })\n }\n },\n})\n\nexport type DateRangePickerProps = InstanceType<typeof DateRangePickerComponent>[\"$props\"]\n\n/**\n * A date range picker: a SelectControl trigger (or a month stepper) opening\n * two calendars and optional shortcuts in a popover. Bind the range\n * (`[start, end]` luxon `DateTime`s) with `v-model:value`.\n */\nexport const DateRangePicker = DateRangePickerComponent\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"context.js","sourceRoot":"","sources":["../../../../src/components/DateRangePicker/context.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAqB,MAAM,KAAK,CAAA;
|
|
1
|
+
{"version":3,"file":"context.js","sourceRoot":"","sources":["../../../../src/components/DateRangePicker/context.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAqB,MAAM,KAAK,CAAA;AAgC/C,MAAM,CAAC,MAAM,mBAAmB,GAAwC,MAAM,CAAC,uBAAuB,CAAC,CAAA;AAEvG,MAAM,CAAC,MAAM,mBAAmB,GAAG,GAAG,EAAE;IACtC,MAAM,OAAO,GAAG,MAAM,CAAC,mBAAmB,EAAE,IAAI,CAAC,CAAA;IAEjD,IAAI,CAAC,OAAO,EAAE,CAAC;QACb,MAAM,IAAI,KAAK,CAAC,6DAA6D,CAAC,CAAA;IAChF,CAAC;IAED,OAAO,OAAO,CAAA;AAChB,CAAC,CAAA","sourcesContent":["import type { DateTime } from \"luxon\"\nimport { inject, type InjectionKey } from \"vue\"\nimport type { ControlSize } from \"@plexui/styles/types\"\nimport type { DropdownIconType } from \"../SelectControl/index.js\"\nimport type { DateRange, DateRangeShortcut, WeekStart } from \"./types.js\"\n\n// Vue port of packages/ui/src/components/DateRangePicker/context.tsx. The\n// values are getters over DateRangePicker's props (read them in render,\n// computed or watch to track them); React's `onChangeRef` is a plain\n// function here, as Vue props and emits are always current.\n\nexport type DateRangeContextValue = {\n readonly value: DateRange | null\n readonly min?: DateTime\n readonly max?: DateTime\n readonly maxRangeDays?: number\n readonly weekStartsOn: WeekStart\n readonly triggerStepperUnit?: \"month\"\n readonly triggerClassName?: string\n readonly triggerShowIcon?: boolean\n readonly triggerDateFormat: string\n readonly disabled: boolean\n readonly variant?: \"soft\" | \"outline\" | \"ghost\"\n readonly pill: boolean\n readonly block: boolean\n readonly size?: ControlSize\n readonly dropdownIconType?: DropdownIconType\n readonly clearable: boolean\n readonly placeholder: string\n readonly shortcuts?: DateRangeShortcut[]\n onChange: (nextValue: DateRange | null, shortcut?: DateRangeShortcut) => void\n}\n\nexport const DateRangeContextKey: InjectionKey<DateRangeContextValue> = Symbol(\"PlexUIDateRangePicker\")\n\nexport const useDateRangeContext = () => {\n const context = inject(DateRangeContextKey, null)\n\n if (!context) {\n throw new Error(\"DateRange components must be wrapped in <DateRangePicker />\")\n }\n\n return context\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/components/DateRangePicker/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAA6B,MAAM,sBAAsB,CAAA;AAEjF,OAAO,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/components/DateRangePicker/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAA6B,MAAM,sBAAsB,CAAA;AAEjF,OAAO,EAA0D,MAAM,YAAY,CAAA","sourcesContent":["export { DateRangePicker, type DateRangePickerProps } from \"./DateRangePicker.js\"\n\nexport { type DateRange, type DateRangeShortcut, type WeekStart } from \"./types.js\"\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../src/components/DateRangePicker/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAiB,MAAM,OAAO,CAAA","sourcesContent":["import { type DateTime } from \"luxon\"\n\nexport type DateRange = [DateTime, DateTime]\nexport type DateRangeShortcut = {\n label: string\n getDateRange: () => DateRange\n}\n"]}
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../src/components/DateRangePicker/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAiB,MAAM,OAAO,CAAA","sourcesContent":["import { type DateTime } from \"luxon\"\n\nexport type DateRange = [DateTime, DateTime]\n/** The day a week starts on: 0 is Sunday, 6 is Saturday. */\nexport type WeekStart = 0 | 1 | 2 | 3 | 4 | 5 | 6\nexport type DateRangeShortcut = {\n label: string\n getDateRange: () => DateRange\n}\n"]}
|