@glob-ui/date-picker 0.0.0-stage → 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Kevin Martínez E
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,3 +1,17 @@
1
- # Temporary Holding Version
1
+ # @glob-ui/date-picker
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ A date field. The trigger shows the value and opens a calendar in a popover, for one day or a range, with optional presets.
4
+
5
+ ## Install
6
+
7
+ ```bash
8
+ pnpm add @glob-ui/date-picker
9
+ ```
10
+
11
+ ## Documentation
12
+
13
+ Full docs, examples and the accessibility table: [Date picker](https://github.com/kevin-martineze/GlobUI/tree/main/apps/docs/content/docs/components/date-picker.mdx).
14
+
15
+ ## License
16
+
17
+ MIT. See [LICENSE](./LICENSE).
@@ -0,0 +1,51 @@
1
+ import * as react from 'react';
2
+ import { DateRange } from '@glob-ui/calendar';
3
+
4
+ interface DatePickerPreset {
5
+ label: string;
6
+ /** A single day ("YYYY-MM-DD") for single mode, or a range for range mode. */
7
+ value: string | DateRange;
8
+ }
9
+ interface DatePickerBaseProps {
10
+ locale?: string;
11
+ weekStartsOn?: 0 | 1 | 2 | 3 | 4 | 5 | 6;
12
+ min?: string;
13
+ max?: string;
14
+ isDateDisabled?: (iso: string) => boolean;
15
+ /** Months shown side by side (stacked on small screens). Default 1, or 2 in range mode. */
16
+ numberOfMonths?: 1 | 2;
17
+ /** Buttons next to the calendar (above it on small screens). Selecting one closes the picker. */
18
+ presets?: DatePickerPreset[];
19
+ placeholder?: string;
20
+ disabled?: boolean;
21
+ /** Shows an X that clears the value. Default true. */
22
+ clearable?: boolean;
23
+ size?: "sm" | "md" | "lg";
24
+ variant?: "default" | "ghost" | "outline";
25
+ className?: string;
26
+ id?: string;
27
+ name?: string;
28
+ "aria-invalid"?: boolean | "true" | "false";
29
+ "aria-describedby"?: string;
30
+ "aria-labelledby"?: string;
31
+ "aria-label"?: string;
32
+ }
33
+ interface DatePickerSingleProps extends DatePickerBaseProps {
34
+ mode?: "single";
35
+ /** "YYYY-MM-DD", or null for none. */
36
+ value?: string | null;
37
+ defaultValue?: string | null;
38
+ onChange?: (iso: string | null) => void;
39
+ allowDeselect?: boolean;
40
+ }
41
+ interface DatePickerRangeProps extends DatePickerBaseProps {
42
+ mode: "range";
43
+ value?: DateRange;
44
+ defaultValue?: DateRange;
45
+ onChange?: (range: DateRange) => void;
46
+ }
47
+ type DatePickerProps = DatePickerSingleProps | DatePickerRangeProps;
48
+ /** A date field. The value is an ISO date ("YYYY-MM-DD") or a range of them, and the calendar opens in a popover. */
49
+ declare const DatePicker: react.ForwardRefExoticComponent<DatePickerProps & react.RefAttributes<HTMLButtonElement>>;
50
+
51
+ export { DatePicker, type DatePickerPreset, type DatePickerProps, type DatePickerRangeProps, type DatePickerSingleProps };
@@ -0,0 +1,51 @@
1
+ import * as react from 'react';
2
+ import { DateRange } from '@glob-ui/calendar';
3
+
4
+ interface DatePickerPreset {
5
+ label: string;
6
+ /** A single day ("YYYY-MM-DD") for single mode, or a range for range mode. */
7
+ value: string | DateRange;
8
+ }
9
+ interface DatePickerBaseProps {
10
+ locale?: string;
11
+ weekStartsOn?: 0 | 1 | 2 | 3 | 4 | 5 | 6;
12
+ min?: string;
13
+ max?: string;
14
+ isDateDisabled?: (iso: string) => boolean;
15
+ /** Months shown side by side (stacked on small screens). Default 1, or 2 in range mode. */
16
+ numberOfMonths?: 1 | 2;
17
+ /** Buttons next to the calendar (above it on small screens). Selecting one closes the picker. */
18
+ presets?: DatePickerPreset[];
19
+ placeholder?: string;
20
+ disabled?: boolean;
21
+ /** Shows an X that clears the value. Default true. */
22
+ clearable?: boolean;
23
+ size?: "sm" | "md" | "lg";
24
+ variant?: "default" | "ghost" | "outline";
25
+ className?: string;
26
+ id?: string;
27
+ name?: string;
28
+ "aria-invalid"?: boolean | "true" | "false";
29
+ "aria-describedby"?: string;
30
+ "aria-labelledby"?: string;
31
+ "aria-label"?: string;
32
+ }
33
+ interface DatePickerSingleProps extends DatePickerBaseProps {
34
+ mode?: "single";
35
+ /** "YYYY-MM-DD", or null for none. */
36
+ value?: string | null;
37
+ defaultValue?: string | null;
38
+ onChange?: (iso: string | null) => void;
39
+ allowDeselect?: boolean;
40
+ }
41
+ interface DatePickerRangeProps extends DatePickerBaseProps {
42
+ mode: "range";
43
+ value?: DateRange;
44
+ defaultValue?: DateRange;
45
+ onChange?: (range: DateRange) => void;
46
+ }
47
+ type DatePickerProps = DatePickerSingleProps | DatePickerRangeProps;
48
+ /** A date field. The value is an ISO date ("YYYY-MM-DD") or a range of them, and the calendar opens in a popover. */
49
+ declare const DatePicker: react.ForwardRefExoticComponent<DatePickerProps & react.RefAttributes<HTMLButtonElement>>;
50
+
51
+ export { DatePicker, type DatePickerPreset, type DatePickerProps, type DatePickerRangeProps, type DatePickerSingleProps };
package/dist/index.js ADDED
@@ -0,0 +1,217 @@
1
+ "use client"
2
+ "use strict";
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __export = (target, all) => {
8
+ for (var name in all)
9
+ __defProp(target, name, { get: all[name], enumerable: true });
10
+ };
11
+ var __copyProps = (to, from, except, desc) => {
12
+ if (from && typeof from === "object" || typeof from === "function") {
13
+ for (let key of __getOwnPropNames(from))
14
+ if (!__hasOwnProp.call(to, key) && key !== except)
15
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
16
+ }
17
+ return to;
18
+ };
19
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
20
+
21
+ // src/index.ts
22
+ var index_exports = {};
23
+ __export(index_exports, {
24
+ DatePicker: () => DatePicker
25
+ });
26
+ module.exports = __toCommonJS(index_exports);
27
+
28
+ // src/date-picker.tsx
29
+ var import_react = require("react");
30
+ var import_utils = require("@glob-ui/utils");
31
+ var import_hooks = require("@glob-ui/hooks");
32
+ var import_calendar = require("@glob-ui/calendar");
33
+ var import_popover = require("@glob-ui/popover");
34
+ var import_slot = require("@glob-ui/slot");
35
+ var import_jsx_runtime = require("react/jsx-runtime");
36
+ var sizeClasses = { sm: "h-8 text-xs", md: "h-10 text-sm", lg: "h-12 text-base" };
37
+ var variantClasses = {
38
+ default: "border-glob-border bg-glob-surface",
39
+ ghost: "border-transparent bg-transparent hover:bg-glob-surface-hover",
40
+ outline: "border-glob-border bg-transparent hover:bg-glob-surface-hover"
41
+ };
42
+ function formatValue(value, isRange, locale) {
43
+ const format = new Intl.DateTimeFormat(locale, { dateStyle: "medium" });
44
+ if (!isRange) return typeof value === "string" ? format.format((0, import_calendar.parseISODate)(value)) : null;
45
+ const range = value;
46
+ if (!(range == null ? void 0 : range.from)) return null;
47
+ const from = format.format((0, import_calendar.parseISODate)(range.from));
48
+ if (!range.to) return `${from} \u2013 \u2026`;
49
+ const to = (0, import_calendar.parseISODate)(range.to);
50
+ const fromDate = (0, import_calendar.parseISODate)(range.from);
51
+ const withRange = format;
52
+ return typeof withRange.formatRange === "function" ? withRange.formatRange(fromDate, to) : `${from} \u2013 ${format.format(to)}`;
53
+ }
54
+ var DatePicker = (0, import_react.forwardRef)((props, ref) => {
55
+ var _a;
56
+ const {
57
+ mode = "single",
58
+ locale: localeProp,
59
+ weekStartsOn,
60
+ min,
61
+ max,
62
+ isDateDisabled,
63
+ numberOfMonths,
64
+ presets,
65
+ placeholder,
66
+ disabled = false,
67
+ clearable = true,
68
+ size = "md",
69
+ variant = "default",
70
+ className,
71
+ id,
72
+ name,
73
+ "aria-invalid": ariaInvalid,
74
+ "aria-describedby": ariaDescribedBy,
75
+ "aria-labelledby": ariaLabelledBy,
76
+ "aria-label": ariaLabel,
77
+ value,
78
+ defaultValue,
79
+ onChange,
80
+ allowDeselect = false
81
+ } = props;
82
+ const isRange = mode === "range";
83
+ const locale = (0, import_calendar.useResolvedLocale)(localeProp);
84
+ const baseId = (0, import_react.useId)();
85
+ const triggerId = id != null ? id : `${baseId}-trigger`;
86
+ const valueId = `${baseId}-value`;
87
+ const [open, setOpen] = (0, import_react.useState)(false);
88
+ const triggerRef = (0, import_react.useRef)(null);
89
+ const mergedRef = (0, import_react.useMemo)(() => (0, import_slot.composeRefs)(ref, triggerRef), [ref]);
90
+ const [single, setSingle] = (0, import_hooks.useControllableState)(
91
+ isRange ? void 0 : value,
92
+ defaultValue != null ? defaultValue : null,
93
+ isRange ? void 0 : onChange
94
+ );
95
+ const [range, setRange] = (0, import_hooks.useControllableState)(
96
+ isRange ? value : void 0,
97
+ defaultValue != null ? defaultValue : { from: null, to: null },
98
+ isRange ? onChange : void 0
99
+ );
100
+ const current = isRange ? range : single;
101
+ const text = formatValue(current, isRange, locale);
102
+ const hasValue = isRange ? range.from !== null : single !== null;
103
+ const months = numberOfMonths != null ? numberOfMonths : isRange ? 2 : 1;
104
+ function closeAndFocus() {
105
+ var _a2;
106
+ setOpen(false);
107
+ (_a2 = triggerRef.current) == null ? void 0 : _a2.focus();
108
+ }
109
+ function applyPreset(preset) {
110
+ if (isRange) {
111
+ setRange(typeof preset.value === "string" ? { from: preset.value, to: preset.value } : preset.value);
112
+ } else {
113
+ setSingle(typeof preset.value === "string" ? preset.value : preset.value.from);
114
+ }
115
+ closeAndFocus();
116
+ }
117
+ function clear() {
118
+ var _a2;
119
+ if (isRange) setRange({ from: null, to: null });
120
+ else setSingle(null);
121
+ (_a2 = triggerRef.current) == null ? void 0 : _a2.focus();
122
+ }
123
+ const hiddenValue = isRange ? range.from && range.to ? `${range.from}/${range.to}` : "" : single != null ? single : "";
124
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "relative w-full", children: [
125
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_popover.Popover, { open, onOpenChange: setOpen, placement: "bottom-start", offset: 6, children: [
126
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
127
+ import_popover.PopoverTrigger,
128
+ {
129
+ ref: mergedRef,
130
+ id: triggerId,
131
+ type: "button",
132
+ disabled,
133
+ "data-invalid": ariaInvalid === true || ariaInvalid === "true" ? "true" : void 0,
134
+ "aria-describedby": ariaDescribedBy,
135
+ "aria-labelledby": [ariaLabelledBy, valueId].filter(Boolean).join(" "),
136
+ "aria-label": ariaLabel,
137
+ className: (0, import_utils.cn)(
138
+ "flex w-full cursor-pointer items-center justify-between gap-2 rounded-glob-md border px-3 text-left transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-glob-ring disabled:cursor-not-allowed disabled:opacity-50 data-[invalid=true]:border-glob-danger",
139
+ sizeClasses[size],
140
+ variantClasses[variant],
141
+ // Room for the clear button, which sits beside the trigger (never inside it).
142
+ hasValue && clearable && "pr-16",
143
+ className
144
+ ),
145
+ children: [
146
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { id: valueId, className: (0, import_utils.cn)("truncate", text === null && "text-glob-text-secondary"), children: (_a = text != null ? text : placeholder) != null ? _a : isRange ? "Pick a date range" : "Pick a date" }),
147
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("svg", { "aria-hidden": "true", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", className: "h-4 w-4 shrink-0 text-glob-text-secondary", children: [
148
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("rect", { x: "3", y: "4", width: "18", height: "18", rx: "2" }),
149
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { d: "M16 2v4M8 2v4M3 10h18" })
150
+ ] })
151
+ ]
152
+ }
153
+ ),
154
+ clearable && hasValue && !disabled && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
155
+ "button",
156
+ {
157
+ type: "button",
158
+ "aria-label": "Clear date",
159
+ onClick: clear,
160
+ className: "absolute right-9 top-1/2 flex h-6 w-6 -translate-y-1/2 items-center justify-center rounded-glob-sm text-glob-text-secondary hover:bg-glob-surface-hover hover:text-glob-text focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-glob-ring",
161
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("svg", { "aria-hidden": "true", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", className: "h-3.5 w-3.5", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { d: "M18 6L6 18M6 6l12 12" }) })
162
+ }
163
+ ),
164
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_popover.PopoverContent, { className: "w-fit p-3", "aria-labelledby": void 0, "aria-label": isRange ? "Choose a date range" : "Choose a date", children: open && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "flex flex-col gap-3 sm:flex-row", children: [
165
+ presets && presets.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { role: "group", "aria-label": "Presets", className: "flex flex-wrap gap-1 sm:w-36 sm:flex-col", children: presets.map((preset) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
166
+ "button",
167
+ {
168
+ type: "button",
169
+ onClick: () => applyPreset(preset),
170
+ className: "rounded-glob-sm px-2 py-1.5 text-left text-sm text-glob-text transition-colors hover:bg-glob-surface-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-glob-ring",
171
+ children: preset.label
172
+ },
173
+ preset.label
174
+ )) }),
175
+ isRange ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
176
+ import_calendar.Calendar,
177
+ {
178
+ mode: "range",
179
+ value: range,
180
+ onChange: (next) => {
181
+ setRange(next);
182
+ if (next.to) closeAndFocus();
183
+ },
184
+ locale: localeProp,
185
+ weekStartsOn,
186
+ min,
187
+ max,
188
+ isDateDisabled,
189
+ numberOfMonths: months
190
+ }
191
+ ) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
192
+ import_calendar.Calendar,
193
+ {
194
+ mode: "single",
195
+ value: single,
196
+ onChange: (next) => setSingle(next),
197
+ onSelectDay: () => closeAndFocus(),
198
+ allowDeselect,
199
+ locale: localeProp,
200
+ weekStartsOn,
201
+ min,
202
+ max,
203
+ isDateDisabled,
204
+ numberOfMonths: months
205
+ }
206
+ )
207
+ ] }) })
208
+ ] }),
209
+ name !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("input", { type: "hidden", name, value: hiddenValue })
210
+ ] });
211
+ });
212
+ DatePicker.displayName = "DatePicker";
213
+ // Annotate the CommonJS export names for ESM import in node:
214
+ 0 && (module.exports = {
215
+ DatePicker
216
+ });
217
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/index.ts","../src/date-picker.tsx"],"sourcesContent":["export { DatePicker } from \"./date-picker\"\nexport type { DatePickerProps, DatePickerSingleProps, DatePickerRangeProps, DatePickerPreset } from \"./date-picker\"\n","\"use client\"\n\nimport { forwardRef, useId, useMemo, useRef, useState } from \"react\"\nimport { cn } from \"@glob-ui/utils\"\nimport { useControllableState } from \"@glob-ui/hooks\"\nimport { Calendar, parseISODate, useResolvedLocale, type DateRange } from \"@glob-ui/calendar\"\nimport { Popover, PopoverContent, PopoverTrigger } from \"@glob-ui/popover\"\nimport { composeRefs } from \"@glob-ui/slot\"\n\nexport interface DatePickerPreset {\n label: string\n /** A single day (\"YYYY-MM-DD\") for single mode, or a range for range mode. */\n value: string | DateRange\n}\n\ninterface DatePickerBaseProps {\n locale?: string\n weekStartsOn?: 0 | 1 | 2 | 3 | 4 | 5 | 6\n min?: string\n max?: string\n isDateDisabled?: (iso: string) => boolean\n /** Months shown side by side (stacked on small screens). Default 1, or 2 in range mode. */\n numberOfMonths?: 1 | 2\n /** Buttons next to the calendar (above it on small screens). Selecting one closes the picker. */\n presets?: DatePickerPreset[]\n placeholder?: string\n disabled?: boolean\n /** Shows an X that clears the value. Default true. */\n clearable?: boolean\n size?: \"sm\" | \"md\" | \"lg\"\n variant?: \"default\" | \"ghost\" | \"outline\"\n className?: string\n id?: string\n name?: string\n \"aria-invalid\"?: boolean | \"true\" | \"false\"\n \"aria-describedby\"?: string\n \"aria-labelledby\"?: string\n \"aria-label\"?: string\n}\n\nexport interface DatePickerSingleProps extends DatePickerBaseProps {\n mode?: \"single\"\n /** \"YYYY-MM-DD\", or null for none. */\n value?: string | null\n defaultValue?: string | null\n onChange?: (iso: string | null) => void\n allowDeselect?: boolean\n}\n\nexport interface DatePickerRangeProps extends DatePickerBaseProps {\n mode: \"range\"\n value?: DateRange\n defaultValue?: DateRange\n onChange?: (range: DateRange) => void\n}\n\nexport type DatePickerProps = DatePickerSingleProps | DatePickerRangeProps\n\nconst sizeClasses = { sm: \"h-8 text-xs\", md: \"h-10 text-sm\", lg: \"h-12 text-base\" }\nconst variantClasses = {\n default: \"border-glob-border bg-glob-surface\",\n ghost: \"border-transparent bg-transparent hover:bg-glob-surface-hover\",\n outline: \"border-glob-border bg-transparent hover:bg-glob-surface-hover\",\n}\n\n/** The text shown in the trigger: \"Nov 9, 2026\", or \"Nov 3 – Nov 9, 2026\" for a range. */\nfunction formatValue(value: string | DateRange | null, isRange: boolean, locale: string): string | null {\n const format = new Intl.DateTimeFormat(locale, { dateStyle: \"medium\" })\n if (!isRange) return typeof value === \"string\" ? format.format(parseISODate(value)) : null\n const range = value as DateRange | null\n if (!range?.from) return null\n const from = format.format(parseISODate(range.from))\n if (!range.to) return `${from} – …`\n const to = parseISODate(range.to)\n const fromDate = parseISODate(range.from)\n // formatRange collapses shared parts (\"Nov 3 – 9, 2026\"); fall back to two dates where it is missing.\n const withRange = format as Intl.DateTimeFormat & { formatRange?: (a: Date, b: Date) => string }\n return typeof withRange.formatRange === \"function\" ? withRange.formatRange(fromDate, to) : `${from} – ${format.format(to)}`\n}\n\n/** A date field. The value is an ISO date (\"YYYY-MM-DD\") or a range of them, and the calendar opens in a popover. */\nconst DatePicker = forwardRef<HTMLButtonElement, DatePickerProps>((props, ref) => {\n const {\n mode = \"single\",\n locale: localeProp,\n weekStartsOn,\n min,\n max,\n isDateDisabled,\n numberOfMonths,\n presets,\n placeholder,\n disabled = false,\n clearable = true,\n size = \"md\",\n variant = \"default\",\n className,\n id,\n name,\n \"aria-invalid\": ariaInvalid,\n \"aria-describedby\": ariaDescribedBy,\n \"aria-labelledby\": ariaLabelledBy,\n \"aria-label\": ariaLabel,\n value,\n defaultValue,\n onChange,\n allowDeselect = false,\n } = props as DatePickerProps & { allowDeselect?: boolean }\n const isRange = mode === \"range\"\n // Same HTML on the server and during hydration; the browser locale takes over after (see useResolvedLocale).\n const locale = useResolvedLocale(localeProp)\n const baseId = useId()\n const triggerId = id ?? `${baseId}-trigger`\n const valueId = `${baseId}-value`\n const [open, setOpen] = useState(false)\n const triggerRef = useRef<HTMLButtonElement | null>(null)\n const mergedRef = useMemo(() => composeRefs<HTMLButtonElement>(ref, triggerRef), [ref])\n\n const [single, setSingle] = useControllableState<string | null>(\n isRange ? undefined : (value as string | null | undefined),\n (defaultValue as string | null | undefined) ?? null,\n isRange ? undefined : (onChange as ((next: string | null) => void) | undefined)\n )\n const [range, setRange] = useControllableState<DateRange>(\n isRange ? (value as DateRange | undefined) : undefined,\n (defaultValue as DateRange | undefined) ?? { from: null, to: null },\n isRange ? (onChange as ((next: DateRange) => void) | undefined) : undefined\n )\n\n const current: string | DateRange | null = isRange ? range : single\n const text = formatValue(current, isRange, locale)\n const hasValue = isRange ? range.from !== null : single !== null\n const months = numberOfMonths ?? (isRange ? 2 : 1)\n\n /** Closes the calendar and gives focus back to the trigger. */\n function closeAndFocus() {\n setOpen(false)\n triggerRef.current?.focus()\n }\n\n function applyPreset(preset: DatePickerPreset) {\n if (isRange) {\n setRange(typeof preset.value === \"string\" ? { from: preset.value, to: preset.value } : preset.value)\n } else {\n setSingle(typeof preset.value === \"string\" ? preset.value : preset.value.from)\n }\n closeAndFocus()\n }\n\n function clear() {\n if (isRange) setRange({ from: null, to: null })\n else setSingle(null)\n triggerRef.current?.focus()\n }\n\n const hiddenValue = isRange ? (range.from && range.to ? `${range.from}/${range.to}` : \"\") : (single ?? \"\")\n\n return (\n <div className=\"relative w-full\">\n {/* One Popover for the trigger and the content: they share its context. */}\n <Popover open={open} onOpenChange={setOpen} placement=\"bottom-start\" offset={6}>\n {/* PopoverTrigger renders the button and forwards these props (no asChild: the registry transform rewrites it). */}\n <PopoverTrigger\n ref={mergedRef}\n id={triggerId}\n type=\"button\"\n disabled={disabled}\n data-invalid={ariaInvalid === true || ariaInvalid === \"true\" ? \"true\" : undefined}\n aria-describedby={ariaDescribedBy}\n // The name includes the shown value, so it contains the visible text (WCAG 2.5.3).\n aria-labelledby={[ariaLabelledBy, valueId].filter(Boolean).join(\" \")}\n aria-label={ariaLabel}\n className={cn(\n \"flex w-full cursor-pointer items-center justify-between gap-2 rounded-glob-md border px-3 text-left transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-glob-ring disabled:cursor-not-allowed disabled:opacity-50 data-[invalid=true]:border-glob-danger\",\n sizeClasses[size],\n variantClasses[variant],\n // Room for the clear button, which sits beside the trigger (never inside it).\n hasValue && clearable && \"pr-16\",\n className\n )}\n >\n <span id={valueId} className={cn(\"truncate\", text === null && \"text-glob-text-secondary\")}>\n {text ?? placeholder ?? (isRange ? \"Pick a date range\" : \"Pick a date\")}\n </span>\n <svg aria-hidden=\"true\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" strokeWidth=\"2\" className=\"h-4 w-4 shrink-0 text-glob-text-secondary\">\n <rect x=\"3\" y=\"4\" width=\"18\" height=\"18\" rx=\"2\" />\n <path d=\"M16 2v4M8 2v4M3 10h18\" />\n </svg>\n </PopoverTrigger>\n\n {clearable && hasValue && !disabled && (\n <button\n type=\"button\"\n aria-label=\"Clear date\"\n onClick={clear}\n className=\"absolute right-9 top-1/2 flex h-6 w-6 -translate-y-1/2 items-center justify-center rounded-glob-sm text-glob-text-secondary hover:bg-glob-surface-hover hover:text-glob-text focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-glob-ring\"\n >\n <svg aria-hidden=\"true\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" strokeWidth=\"2\" className=\"h-3.5 w-3.5\">\n <path d=\"M18 6L6 18M6 6l12 12\" />\n </svg>\n </button>\n )}\n\n {/* Named explicitly: the Popover's default name points at its own trigger id, which Field may replace. */}\n <PopoverContent className=\"w-fit p-3\" aria-labelledby={undefined} aria-label={isRange ? \"Choose a date range\" : \"Choose a date\"}>\n {open && (\n <div className=\"flex flex-col gap-3 sm:flex-row\">\n {presets && presets.length > 0 && (\n <div role=\"group\" aria-label=\"Presets\" className=\"flex flex-wrap gap-1 sm:w-36 sm:flex-col\">\n {presets.map((preset) => (\n <button\n key={preset.label}\n type=\"button\"\n onClick={() => applyPreset(preset)}\n className=\"rounded-glob-sm px-2 py-1.5 text-left text-sm text-glob-text transition-colors hover:bg-glob-surface-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-glob-ring\"\n >\n {preset.label}\n </button>\n ))}\n </div>\n )}\n {isRange ? (\n <Calendar\n mode=\"range\"\n value={range}\n onChange={(next) => {\n setRange(next)\n // The range is complete once `to` is set.\n if (next.to) closeAndFocus()\n }}\n locale={localeProp}\n weekStartsOn={weekStartsOn}\n min={min}\n max={max}\n isDateDisabled={isDateDisabled}\n numberOfMonths={months as 1 | 2}\n />\n ) : (\n <Calendar\n mode=\"single\"\n value={single}\n onChange={(next) => setSingle(next)}\n onSelectDay={() => closeAndFocus()}\n allowDeselect={allowDeselect}\n locale={localeProp}\n weekStartsOn={weekStartsOn}\n min={min}\n max={max}\n isDateDisabled={isDateDisabled}\n numberOfMonths={months as 1 | 2}\n />\n )}\n </div>\n )}\n </PopoverContent>\n </Popover>\n\n {name !== undefined && <input type=\"hidden\" name={name} value={hiddenValue} />}\n </div>\n )\n})\nDatePicker.displayName = \"DatePicker\"\n\nexport { DatePicker }\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACEA,mBAA6D;AAC7D,mBAAmB;AACnB,mBAAqC;AACrC,sBAA0E;AAC1E,qBAAwD;AACxD,kBAA4B;AA8KhB;AA3HZ,IAAM,cAAc,EAAE,IAAI,eAAe,IAAI,gBAAgB,IAAI,iBAAiB;AAClF,IAAM,iBAAiB;AAAA,EACrB,SAAS;AAAA,EACT,OAAO;AAAA,EACP,SAAS;AACX;AAGA,SAAS,YAAY,OAAkC,SAAkB,QAA+B;AACtG,QAAM,SAAS,IAAI,KAAK,eAAe,QAAQ,EAAE,WAAW,SAAS,CAAC;AACtE,MAAI,CAAC,QAAS,QAAO,OAAO,UAAU,WAAW,OAAO,WAAO,8BAAa,KAAK,CAAC,IAAI;AACtF,QAAM,QAAQ;AACd,MAAI,EAAC,+BAAO,MAAM,QAAO;AACzB,QAAM,OAAO,OAAO,WAAO,8BAAa,MAAM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A,YACL,OAAO;AAAA,YACP,UAAU,CAAC,SAAS;AAClB,uBAAS,IAAI;AAEb,kBAAI,KAAK,GAAI,eAAc;AAAA,YAC7B;AAAA,YACA,QAAQ;AAAA,YACR;AAAA,YACA;AAAA,YACA;AAAA,YACA;AAAA,YACA,gBAAgB;AAAA;AAAA,QAClB,IAEA;AAAA,UAAC;AAAA;AAAA,YACC,MAAK;AAAA,YACL,OAAO;AAAA,YACP,UAAU,CAAC,SAAS,UAAU,IAAI;AAAA,YAClC,aAAa,MAAM,cAAc;AAAA,YACjC;AAAA,YACA,QAAQ;AAAA,YACR;AAAA,YACA;AAAA,YACA;AAAA,YACA;AAAA,YACA,gBAAgB;AAAA;AAAA,QAClB;AAAA,SAEJ,GAEJ;AAAA,OACF;AAAA,IAEC,SAAS,UAAa,4CAAC,WAAM,MAAK,UAAS,MAAY,OAAO,aAAa;AAAA,KAC9E;AAEJ,CAAC;AACD,WAAW,cAAc;","names":["_a"]}
package/dist/index.mjs ADDED
@@ -0,0 +1,191 @@
1
+ "use client"
2
+
3
+ // src/date-picker.tsx
4
+ import { forwardRef, useId, useMemo, useRef, useState } from "react";
5
+ import { cn } from "@glob-ui/utils";
6
+ import { useControllableState } from "@glob-ui/hooks";
7
+ import { Calendar, parseISODate, useResolvedLocale } from "@glob-ui/calendar";
8
+ import { Popover, PopoverContent, PopoverTrigger } from "@glob-ui/popover";
9
+ import { composeRefs } from "@glob-ui/slot";
10
+ import { jsx, jsxs } from "react/jsx-runtime";
11
+ var sizeClasses = { sm: "h-8 text-xs", md: "h-10 text-sm", lg: "h-12 text-base" };
12
+ var variantClasses = {
13
+ default: "border-glob-border bg-glob-surface",
14
+ ghost: "border-transparent bg-transparent hover:bg-glob-surface-hover",
15
+ outline: "border-glob-border bg-transparent hover:bg-glob-surface-hover"
16
+ };
17
+ function formatValue(value, isRange, locale) {
18
+ const format = new Intl.DateTimeFormat(locale, { dateStyle: "medium" });
19
+ if (!isRange) return typeof value === "string" ? format.format(parseISODate(value)) : null;
20
+ const range = value;
21
+ if (!(range == null ? void 0 : range.from)) return null;
22
+ const from = format.format(parseISODate(range.from));
23
+ if (!range.to) return `${from} \u2013 \u2026`;
24
+ const to = parseISODate(range.to);
25
+ const fromDate = parseISODate(range.from);
26
+ const withRange = format;
27
+ return typeof withRange.formatRange === "function" ? withRange.formatRange(fromDate, to) : `${from} \u2013 ${format.format(to)}`;
28
+ }
29
+ var DatePicker = forwardRef((props, ref) => {
30
+ var _a;
31
+ const {
32
+ mode = "single",
33
+ locale: localeProp,
34
+ weekStartsOn,
35
+ min,
36
+ max,
37
+ isDateDisabled,
38
+ numberOfMonths,
39
+ presets,
40
+ placeholder,
41
+ disabled = false,
42
+ clearable = true,
43
+ size = "md",
44
+ variant = "default",
45
+ className,
46
+ id,
47
+ name,
48
+ "aria-invalid": ariaInvalid,
49
+ "aria-describedby": ariaDescribedBy,
50
+ "aria-labelledby": ariaLabelledBy,
51
+ "aria-label": ariaLabel,
52
+ value,
53
+ defaultValue,
54
+ onChange,
55
+ allowDeselect = false
56
+ } = props;
57
+ const isRange = mode === "range";
58
+ const locale = useResolvedLocale(localeProp);
59
+ const baseId = useId();
60
+ const triggerId = id != null ? id : `${baseId}-trigger`;
61
+ const valueId = `${baseId}-value`;
62
+ const [open, setOpen] = useState(false);
63
+ const triggerRef = useRef(null);
64
+ const mergedRef = useMemo(() => composeRefs(ref, triggerRef), [ref]);
65
+ const [single, setSingle] = useControllableState(
66
+ isRange ? void 0 : value,
67
+ defaultValue != null ? defaultValue : null,
68
+ isRange ? void 0 : onChange
69
+ );
70
+ const [range, setRange] = useControllableState(
71
+ isRange ? value : void 0,
72
+ defaultValue != null ? defaultValue : { from: null, to: null },
73
+ isRange ? onChange : void 0
74
+ );
75
+ const current = isRange ? range : single;
76
+ const text = formatValue(current, isRange, locale);
77
+ const hasValue = isRange ? range.from !== null : single !== null;
78
+ const months = numberOfMonths != null ? numberOfMonths : isRange ? 2 : 1;
79
+ function closeAndFocus() {
80
+ var _a2;
81
+ setOpen(false);
82
+ (_a2 = triggerRef.current) == null ? void 0 : _a2.focus();
83
+ }
84
+ function applyPreset(preset) {
85
+ if (isRange) {
86
+ setRange(typeof preset.value === "string" ? { from: preset.value, to: preset.value } : preset.value);
87
+ } else {
88
+ setSingle(typeof preset.value === "string" ? preset.value : preset.value.from);
89
+ }
90
+ closeAndFocus();
91
+ }
92
+ function clear() {
93
+ var _a2;
94
+ if (isRange) setRange({ from: null, to: null });
95
+ else setSingle(null);
96
+ (_a2 = triggerRef.current) == null ? void 0 : _a2.focus();
97
+ }
98
+ const hiddenValue = isRange ? range.from && range.to ? `${range.from}/${range.to}` : "" : single != null ? single : "";
99
+ return /* @__PURE__ */ jsxs("div", { className: "relative w-full", children: [
100
+ /* @__PURE__ */ jsxs(Popover, { open, onOpenChange: setOpen, placement: "bottom-start", offset: 6, children: [
101
+ /* @__PURE__ */ jsxs(
102
+ PopoverTrigger,
103
+ {
104
+ ref: mergedRef,
105
+ id: triggerId,
106
+ type: "button",
107
+ disabled,
108
+ "data-invalid": ariaInvalid === true || ariaInvalid === "true" ? "true" : void 0,
109
+ "aria-describedby": ariaDescribedBy,
110
+ "aria-labelledby": [ariaLabelledBy, valueId].filter(Boolean).join(" "),
111
+ "aria-label": ariaLabel,
112
+ className: cn(
113
+ "flex w-full cursor-pointer items-center justify-between gap-2 rounded-glob-md border px-3 text-left transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-glob-ring disabled:cursor-not-allowed disabled:opacity-50 data-[invalid=true]:border-glob-danger",
114
+ sizeClasses[size],
115
+ variantClasses[variant],
116
+ // Room for the clear button, which sits beside the trigger (never inside it).
117
+ hasValue && clearable && "pr-16",
118
+ className
119
+ ),
120
+ children: [
121
+ /* @__PURE__ */ jsx("span", { id: valueId, className: cn("truncate", text === null && "text-glob-text-secondary"), children: (_a = text != null ? text : placeholder) != null ? _a : isRange ? "Pick a date range" : "Pick a date" }),
122
+ /* @__PURE__ */ jsxs("svg", { "aria-hidden": "true", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", className: "h-4 w-4 shrink-0 text-glob-text-secondary", children: [
123
+ /* @__PURE__ */ jsx("rect", { x: "3", y: "4", width: "18", height: "18", rx: "2" }),
124
+ /* @__PURE__ */ jsx("path", { d: "M16 2v4M8 2v4M3 10h18" })
125
+ ] })
126
+ ]
127
+ }
128
+ ),
129
+ clearable && hasValue && !disabled && /* @__PURE__ */ jsx(
130
+ "button",
131
+ {
132
+ type: "button",
133
+ "aria-label": "Clear date",
134
+ onClick: clear,
135
+ className: "absolute right-9 top-1/2 flex h-6 w-6 -translate-y-1/2 items-center justify-center rounded-glob-sm text-glob-text-secondary hover:bg-glob-surface-hover hover:text-glob-text focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-glob-ring",
136
+ children: /* @__PURE__ */ jsx("svg", { "aria-hidden": "true", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", className: "h-3.5 w-3.5", children: /* @__PURE__ */ jsx("path", { d: "M18 6L6 18M6 6l12 12" }) })
137
+ }
138
+ ),
139
+ /* @__PURE__ */ jsx(PopoverContent, { className: "w-fit p-3", "aria-labelledby": void 0, "aria-label": isRange ? "Choose a date range" : "Choose a date", children: open && /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-3 sm:flex-row", children: [
140
+ presets && presets.length > 0 && /* @__PURE__ */ jsx("div", { role: "group", "aria-label": "Presets", className: "flex flex-wrap gap-1 sm:w-36 sm:flex-col", children: presets.map((preset) => /* @__PURE__ */ jsx(
141
+ "button",
142
+ {
143
+ type: "button",
144
+ onClick: () => applyPreset(preset),
145
+ className: "rounded-glob-sm px-2 py-1.5 text-left text-sm text-glob-text transition-colors hover:bg-glob-surface-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-glob-ring",
146
+ children: preset.label
147
+ },
148
+ preset.label
149
+ )) }),
150
+ isRange ? /* @__PURE__ */ jsx(
151
+ Calendar,
152
+ {
153
+ mode: "range",
154
+ value: range,
155
+ onChange: (next) => {
156
+ setRange(next);
157
+ if (next.to) closeAndFocus();
158
+ },
159
+ locale: localeProp,
160
+ weekStartsOn,
161
+ min,
162
+ max,
163
+ isDateDisabled,
164
+ numberOfMonths: months
165
+ }
166
+ ) : /* @__PURE__ */ jsx(
167
+ Calendar,
168
+ {
169
+ mode: "single",
170
+ value: single,
171
+ onChange: (next) => setSingle(next),
172
+ onSelectDay: () => closeAndFocus(),
173
+ allowDeselect,
174
+ locale: localeProp,
175
+ weekStartsOn,
176
+ min,
177
+ max,
178
+ isDateDisabled,
179
+ numberOfMonths: months
180
+ }
181
+ )
182
+ ] }) })
183
+ ] }),
184
+ name !== void 0 && /* @__PURE__ */ jsx("input", { type: "hidden", name, value: hiddenValue })
185
+ ] });
186
+ });
187
+ DatePicker.displayName = "DatePicker";
188
+ export {
189
+ DatePicker
190
+ };
191
+ //# sourceMappingURL=index.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/date-picker.tsx"],"sourcesContent":["\"use client\"\n\nimport { forwardRef, useId, useMemo, useRef, useState } from \"react\"\nimport { cn } from \"@glob-ui/utils\"\nimport { useControllableState } from \"@glob-ui/hooks\"\nimport { Calendar, parseISODate, useResolvedLocale, type DateRange } from \"@glob-ui/calendar\"\nimport { Popover, PopoverContent, PopoverTrigger } from \"@glob-ui/popover\"\nimport { composeRefs } from \"@glob-ui/slot\"\n\nexport interface DatePickerPreset {\n label: string\n /** A single day (\"YYYY-MM-DD\") for single mode, or a range for range mode. */\n value: string | DateRange\n}\n\ninterface DatePickerBaseProps {\n locale?: string\n weekStartsOn?: 0 | 1 | 2 | 3 | 4 | 5 | 6\n min?: string\n max?: string\n isDateDisabled?: (iso: string) => boolean\n /** Months shown side by side (stacked on small screens). Default 1, or 2 in range mode. */\n numberOfMonths?: 1 | 2\n /** Buttons next to the calendar (above it on small screens). Selecting one closes the picker. */\n presets?: DatePickerPreset[]\n placeholder?: string\n disabled?: boolean\n /** Shows an X that clears the value. Default true. */\n clearable?: boolean\n size?: \"sm\" | \"md\" | \"lg\"\n variant?: \"default\" | \"ghost\" | \"outline\"\n className?: string\n id?: string\n name?: string\n \"aria-invalid\"?: boolean | \"true\" | \"false\"\n \"aria-describedby\"?: string\n \"aria-labelledby\"?: string\n \"aria-label\"?: string\n}\n\nexport interface DatePickerSingleProps extends DatePickerBaseProps {\n mode?: \"single\"\n /** \"YYYY-MM-DD\", or null for none. */\n value?: string | null\n defaultValue?: string | null\n onChange?: (iso: string | null) => void\n allowDeselect?: boolean\n}\n\nexport interface DatePickerRangeProps extends DatePickerBaseProps {\n mode: \"range\"\n value?: DateRange\n defaultValue?: DateRange\n onChange?: (range: DateRange) => void\n}\n\nexport type DatePickerProps = DatePickerSingleProps | DatePickerRangeProps\n\nconst sizeClasses = { sm: \"h-8 text-xs\", md: \"h-10 text-sm\", lg: \"h-12 text-base\" }\nconst variantClasses = {\n default: \"border-glob-border bg-glob-surface\",\n ghost: \"border-transparent bg-transparent hover:bg-glob-surface-hover\",\n outline: \"border-glob-border bg-transparent hover:bg-glob-surface-hover\",\n}\n\n/** The text shown in the trigger: \"Nov 9, 2026\", or \"Nov 3 – Nov 9, 2026\" for a range. */\nfunction formatValue(value: string | DateRange | null, isRange: boolean, locale: string): string | null {\n const format = new Intl.DateTimeFormat(locale, { dateStyle: \"medium\" })\n if (!isRange) return typeof value === \"string\" ? format.format(parseISODate(value)) : null\n const range = value as DateRange | null\n if (!range?.from) return null\n const from = format.format(parseISODate(range.from))\n if (!range.to) return `${from} – …`\n const to = parseISODate(range.to)\n const fromDate = parseISODate(range.from)\n // formatRange collapses shared parts (\"Nov 3 – 9, 2026\"); fall back to two dates where it is missing.\n const withRange = format as Intl.DateTimeFormat & { formatRange?: (a: Date, b: Date) => string }\n return typeof withRange.formatRange === \"function\" ? withRange.formatRange(fromDate, to) : `${from} – ${format.format(to)}`\n}\n\n/** A date field. The value is an ISO date (\"YYYY-MM-DD\") or a range of them, and the calendar opens in a popover. */\nconst DatePicker = forwardRef<HTMLButtonElement, DatePickerProps>((props, ref) => {\n const {\n mode = \"single\",\n locale: localeProp,\n weekStartsOn,\n min,\n max,\n isDateDisabled,\n numberOfMonths,\n presets,\n placeholder,\n disabled = false,\n clearable = true,\n size = \"md\",\n variant = \"default\",\n className,\n id,\n name,\n \"aria-invalid\": ariaInvalid,\n \"aria-describedby\": ariaDescribedBy,\n \"aria-labelledby\": ariaLabelledBy,\n \"aria-label\": ariaLabel,\n value,\n defaultValue,\n onChange,\n allowDeselect = false,\n } = props as DatePickerProps & { allowDeselect?: boolean }\n const isRange = mode === \"range\"\n // Same HTML on the server and during hydration; the browser locale takes over after (see useResolvedLocale).\n const locale = useResolvedLocale(localeProp)\n const baseId = useId()\n const triggerId = id ?? `${baseId}-trigger`\n const valueId = `${baseId}-value`\n const [open, setOpen] = useState(false)\n const triggerRef = useRef<HTMLButtonElement | null>(null)\n const mergedRef = useMemo(() => composeRefs<HTMLButtonElement>(ref, triggerRef), [ref])\n\n const [single, setSingle] = useControllableState<string | null>(\n isRange ? undefined : (value as string | null | undefined),\n (defaultValue as string | null | undefined) ?? null,\n isRange ? undefined : (onChange as ((next: string | null) => void) | undefined)\n )\n const [range, setRange] = useControllableState<DateRange>(\n isRange ? (value as DateRange | undefined) : undefined,\n (defaultValue as DateRange | undefined) ?? { from: null, to: null },\n isRange ? (onChange as ((next: DateRange) => void) | undefined) : undefined\n )\n\n const current: string | DateRange | null = isRange ? range : single\n const text = formatValue(current, isRange, locale)\n const hasValue = isRange ? range.from !== null : single !== null\n const months = numberOfMonths ?? (isRange ? 2 : 1)\n\n /** Closes the calendar and gives focus back to the trigger. */\n function closeAndFocus() {\n setOpen(false)\n triggerRef.current?.focus()\n }\n\n function applyPreset(preset: DatePickerPreset) {\n if (isRange) {\n setRange(typeof preset.value === \"string\" ? { from: preset.value, to: preset.value } : preset.value)\n } else {\n setSingle(typeof preset.value === \"string\" ? preset.value : preset.value.from)\n }\n closeAndFocus()\n }\n\n function clear() {\n if (isRange) setRange({ from: null, to: null })\n else setSingle(null)\n triggerRef.current?.focus()\n }\n\n const hiddenValue = isRange ? (range.from && range.to ? `${range.from}/${range.to}` : \"\") : (single ?? \"\")\n\n return (\n <div className=\"relative w-full\">\n {/* One Popover for the trigger and the content: they share its context. */}\n <Popover open={open} onOpenChange={setOpen} placement=\"bottom-start\" offset={6}>\n {/* PopoverTrigger renders the button and forwards these props (no asChild: the registry transform rewrites it). */}\n <PopoverTrigger\n ref={mergedRef}\n id={triggerId}\n type=\"button\"\n disabled={disabled}\n data-invalid={ariaInvalid === true || ariaInvalid === \"true\" ? \"true\" : undefined}\n aria-describedby={ariaDescribedBy}\n // The name includes the shown value, so it contains the visible text (WCAG 2.5.3).\n aria-labelledby={[ariaLabelledBy, valueId].filter(Boolean).join(\" \")}\n aria-label={ariaLabel}\n className={cn(\n \"flex w-full cursor-pointer items-center justify-between gap-2 rounded-glob-md border px-3 text-left transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-glob-ring disabled:cursor-not-allowed disabled:opacity-50 data-[invalid=true]:border-glob-danger\",\n sizeClasses[size],\n variantClasses[variant],\n // Room for the clear button, which sits beside the trigger (never inside it).\n hasValue && clearable && \"pr-16\",\n className\n )}\n >\n <span id={valueId} className={cn(\"truncate\", text === null && \"text-glob-text-secondary\")}>\n {text ?? placeholder ?? (isRange ? \"Pick a date range\" : \"Pick a date\")}\n </span>\n <svg aria-hidden=\"true\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" strokeWidth=\"2\" className=\"h-4 w-4 shrink-0 text-glob-text-secondary\">\n <rect x=\"3\" y=\"4\" width=\"18\" height=\"18\" rx=\"2\" />\n <path d=\"M16 2v4M8 2v4M3 10h18\" />\n </svg>\n </PopoverTrigger>\n\n {clearable && hasValue && !disabled && (\n <button\n type=\"button\"\n aria-label=\"Clear date\"\n onClick={clear}\n className=\"absolute right-9 top-1/2 flex h-6 w-6 -translate-y-1/2 items-center justify-center rounded-glob-sm text-glob-text-secondary hover:bg-glob-surface-hover hover:text-glob-text focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-glob-ring\"\n >\n <svg aria-hidden=\"true\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" strokeWidth=\"2\" className=\"h-3.5 w-3.5\">\n <path d=\"M18 6L6 18M6 6l12 12\" />\n </svg>\n </button>\n )}\n\n {/* Named explicitly: the Popover's default name points at its own trigger id, which Field may replace. */}\n <PopoverContent className=\"w-fit p-3\" aria-labelledby={undefined} aria-label={isRange ? \"Choose a date range\" : \"Choose a date\"}>\n {open && (\n <div className=\"flex flex-col gap-3 sm:flex-row\">\n {presets && presets.length > 0 && (\n <div role=\"group\" aria-label=\"Presets\" className=\"flex flex-wrap gap-1 sm:w-36 sm:flex-col\">\n {presets.map((preset) => (\n <button\n key={preset.label}\n type=\"button\"\n onClick={() => applyPreset(preset)}\n className=\"rounded-glob-sm px-2 py-1.5 text-left text-sm text-glob-text transition-colors hover:bg-glob-surface-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-glob-ring\"\n >\n {preset.label}\n </button>\n ))}\n </div>\n )}\n {isRange ? (\n <Calendar\n mode=\"range\"\n value={range}\n onChange={(next) => {\n setRange(next)\n // The range is complete once `to` is set.\n if (next.to) closeAndFocus()\n }}\n locale={localeProp}\n weekStartsOn={weekStartsOn}\n min={min}\n max={max}\n isDateDisabled={isDateDisabled}\n numberOfMonths={months as 1 | 2}\n />\n ) : (\n <Calendar\n mode=\"single\"\n value={single}\n onChange={(next) => setSingle(next)}\n onSelectDay={() => closeAndFocus()}\n allowDeselect={allowDeselect}\n locale={localeProp}\n weekStartsOn={weekStartsOn}\n min={min}\n max={max}\n isDateDisabled={isDateDisabled}\n numberOfMonths={months as 1 | 2}\n />\n )}\n </div>\n )}\n </PopoverContent>\n </Popover>\n\n {name !== undefined && <input type=\"hidden\" name={name} value={hiddenValue} />}\n </div>\n )\n})\nDatePicker.displayName = \"DatePicker\"\n\nexport { Dat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.json CHANGED
@@ -1,6 +1,71 @@
1
1
  {
2
2
  "name": "@glob-ui/date-picker",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
3
+ "version": "0.1.0",
4
+ "main": "./dist/index.js",
5
+ "module": "./dist/index.mjs",
6
+ "types": "./dist/index.d.ts",
7
+ "exports": {
8
+ ".": {
9
+ "import": {
10
+ "types": "./dist/index.d.mts",
11
+ "default": "./dist/index.mjs"
12
+ },
13
+ "require": {
14
+ "types": "./dist/index.d.ts",
15
+ "default": "./dist/index.js"
16
+ }
17
+ },
18
+ "./package.json": "./package.json"
19
+ },
20
+ "files": [
21
+ "dist/",
22
+ "LICENSE",
23
+ "README.md"
24
+ ],
25
+ "peerDependencies": {
26
+ "react": "^19"
27
+ },
28
+ "dependencies": {
29
+ "@glob-ui/calendar": "0.1.0",
30
+ "@glob-ui/hooks": "0.1.0",
31
+ "@glob-ui/popover": "0.1.0",
32
+ "@glob-ui/slot": "0.1.0",
33
+ "@glob-ui/utils": "0.1.0"
34
+ },
35
+ "devDependencies": {
36
+ "tsup": "^8.5.1"
37
+ },
38
+ "description": "A date field. The trigger shows the value and opens a calendar in a popover, for one day or a range, with optional presets.",
39
+ "keywords": [
40
+ "react",
41
+ "glob-ui",
42
+ "components",
43
+ "accessible",
44
+ "tailwind",
45
+ "date-picker"
46
+ ],
47
+ "license": "MIT",
48
+ "author": "Kevin Martínez E",
49
+ "repository": {
50
+ "type": "git",
51
+ "url": "git+https://github.com/kevin-martineze/GlobUI.git",
52
+ "directory": "packages/date-picker"
53
+ },
54
+ "homepage": "https://github.com/kevin-martineze/GlobUI#readme",
55
+ "bugs": {
56
+ "url": "https://github.com/kevin-martineze/GlobUI/issues"
57
+ },
58
+ "publishConfig": {
59
+ "access": "public",
60
+ "provenance": true
61
+ },
62
+ "sideEffects": false,
63
+ "type": "commonjs",
64
+ "engines": {
65
+ "node": ">=18.18"
66
+ },
67
+ "scripts": {
68
+ "build": "tsup",
69
+ "dev": "tsup --watch --no-clean"
70
+ }
6
71
  }