@medusajs/ui 2.1.0 → 2.2.1-next-20231110080228
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/cjs/components/avatar/avatar.d.ts +1 -10
- package/dist/cjs/components/badge/badge.d.ts +2 -20
- package/dist/cjs/components/button/button.d.ts +1 -10
- package/dist/cjs/components/currency-input/currency-input.d.ts +1 -10
- package/dist/cjs/components/date-picker/date-picker.js +34 -11
- package/dist/cjs/components/date-picker/date-picker.js.map +1 -1
- package/dist/cjs/components/heading/heading.d.ts +1 -10
- package/dist/cjs/components/hint/hint.d.ts +1 -10
- package/dist/cjs/components/icon-badge/icon-badge.d.ts +1 -10
- package/dist/cjs/components/icon-button/icon-button.d.ts +1 -10
- package/dist/cjs/components/input/input.d.ts +1 -10
- package/dist/cjs/components/label/label.d.ts +1 -10
- package/dist/cjs/components/popover/index.d.ts +1 -0
- package/dist/cjs/components/popover/index.js +5 -0
- package/dist/cjs/components/popover/index.js.map +1 -0
- package/dist/cjs/components/popover/popover.d.ts +17 -0
- package/dist/cjs/components/popover/popover.js +41 -0
- package/dist/cjs/components/popover/popover.js.map +1 -0
- package/dist/cjs/components/switch/switch.d.ts +1 -10
- package/dist/cjs/components/text/text.d.ts +1 -10
- package/dist/cjs/index.d.ts +1 -0
- package/dist/cjs/index.js +3 -1
- package/dist/cjs/index.js.map +1 -1
- package/dist/esm/components/avatar/avatar.d.ts +1 -10
- package/dist/esm/components/badge/badge.d.ts +2 -20
- package/dist/esm/components/button/button.d.ts +1 -10
- package/dist/esm/components/currency-input/currency-input.d.ts +1 -10
- package/dist/esm/components/date-picker/date-picker.js +34 -11
- package/dist/esm/components/date-picker/date-picker.js.map +1 -1
- package/dist/esm/components/heading/heading.d.ts +1 -10
- package/dist/esm/components/hint/hint.d.ts +1 -10
- package/dist/esm/components/icon-badge/icon-badge.d.ts +1 -10
- package/dist/esm/components/icon-button/icon-button.d.ts +1 -10
- package/dist/esm/components/input/input.d.ts +1 -10
- package/dist/esm/components/label/label.d.ts +1 -10
- package/dist/esm/components/popover/index.d.ts +1 -0
- package/dist/esm/components/popover/index.js +2 -0
- package/dist/esm/components/popover/index.js.map +1 -0
- package/dist/esm/components/popover/popover.d.ts +17 -0
- package/dist/esm/components/popover/popover.js +37 -0
- package/dist/esm/components/popover/popover.js.map +1 -0
- package/dist/esm/components/switch/switch.d.ts +1 -10
- package/dist/esm/components/text/text.d.ts +1 -10
- package/dist/esm/index.d.ts +1 -0
- package/dist/esm/index.js +1 -0
- package/dist/esm/index.js.map +1 -1
- package/package.json +6 -13
|
@@ -4,16 +4,7 @@ import * as React from "react";
|
|
|
4
4
|
declare const avatarVariants: (props?: ({
|
|
5
5
|
variant?: "squared" | "rounded" | null | undefined;
|
|
6
6
|
size?: "base" | "large" | null | undefined;
|
|
7
|
-
} & (
|
|
8
|
-
class: import("clsx").ClassValue;
|
|
9
|
-
className?: undefined;
|
|
10
|
-
} | {
|
|
11
|
-
class?: undefined;
|
|
12
|
-
className: import("clsx").ClassValue;
|
|
13
|
-
} | {
|
|
14
|
-
class?: undefined;
|
|
15
|
-
className?: undefined;
|
|
16
|
-
})) | undefined) => string;
|
|
7
|
+
} & import("class-variance-authority/dist/types").ClassProp) | undefined) => string;
|
|
17
8
|
interface AvatarProps extends Omit<React.ComponentPropsWithoutRef<typeof Primitives.Root>, "asChild" | "children" | "size">, VariantProps<typeof avatarVariants> {
|
|
18
9
|
src?: string;
|
|
19
10
|
fallback: string;
|
|
@@ -2,29 +2,11 @@ import { VariantProps } from "class-variance-authority";
|
|
|
2
2
|
import * as React from "react";
|
|
3
3
|
declare const badgeColorVariants: (props?: ({
|
|
4
4
|
color?: "green" | "red" | "blue" | "orange" | "grey" | "purple" | null | undefined;
|
|
5
|
-
} & (
|
|
6
|
-
class: import("clsx").ClassValue;
|
|
7
|
-
className?: undefined;
|
|
8
|
-
} | {
|
|
9
|
-
class?: undefined;
|
|
10
|
-
className: import("clsx").ClassValue;
|
|
11
|
-
} | {
|
|
12
|
-
class?: undefined;
|
|
13
|
-
className?: undefined;
|
|
14
|
-
})) | undefined) => string;
|
|
5
|
+
} & import("class-variance-authority/dist/types").ClassProp) | undefined) => string;
|
|
15
6
|
declare const badgeSizeVariants: (props?: ({
|
|
16
7
|
size?: "base" | "large" | "small" | null | undefined;
|
|
17
8
|
rounded?: "base" | "full" | null | undefined;
|
|
18
|
-
} & (
|
|
19
|
-
class: import("clsx").ClassValue;
|
|
20
|
-
className?: undefined;
|
|
21
|
-
} | {
|
|
22
|
-
class?: undefined;
|
|
23
|
-
className: import("clsx").ClassValue;
|
|
24
|
-
} | {
|
|
25
|
-
class?: undefined;
|
|
26
|
-
className?: undefined;
|
|
27
|
-
})) | undefined) => string;
|
|
9
|
+
} & import("class-variance-authority/dist/types").ClassProp) | undefined) => string;
|
|
28
10
|
interface BadgeProps extends Omit<React.HTMLAttributes<HTMLSpanElement>, "color">, VariantProps<typeof badgeSizeVariants>, VariantProps<typeof badgeColorVariants> {
|
|
29
11
|
asChild?: boolean;
|
|
30
12
|
}
|
|
@@ -3,16 +3,7 @@ import * as React from "react";
|
|
|
3
3
|
declare const buttonVariants: (props?: ({
|
|
4
4
|
variant?: "primary" | "secondary" | "transparent" | "danger" | null | undefined;
|
|
5
5
|
size?: "base" | "large" | "xlarge" | null | undefined;
|
|
6
|
-
} & (
|
|
7
|
-
class: import("clsx").ClassValue;
|
|
8
|
-
className?: undefined;
|
|
9
|
-
} | {
|
|
10
|
-
class?: undefined;
|
|
11
|
-
className: import("clsx").ClassValue;
|
|
12
|
-
} | {
|
|
13
|
-
class?: undefined;
|
|
14
|
-
className?: undefined;
|
|
15
|
-
})) | undefined) => string;
|
|
6
|
+
} & import("class-variance-authority/dist/types").ClassProp) | undefined) => string;
|
|
16
7
|
interface ButtonProps extends React.ComponentPropsWithoutRef<"button">, VariantProps<typeof buttonVariants> {
|
|
17
8
|
isLoading?: boolean;
|
|
18
9
|
asChild?: boolean;
|
|
@@ -3,16 +3,7 @@ import Primitive from "react-currency-input-field";
|
|
|
3
3
|
import { VariantProps } from "class-variance-authority";
|
|
4
4
|
declare const currencyInputVariants: (props?: ({
|
|
5
5
|
size?: "base" | "small" | null | undefined;
|
|
6
|
-
} & (
|
|
7
|
-
class: import("clsx").ClassValue;
|
|
8
|
-
className?: undefined;
|
|
9
|
-
} | {
|
|
10
|
-
class?: undefined;
|
|
11
|
-
className: import("clsx").ClassValue;
|
|
12
|
-
} | {
|
|
13
|
-
class?: undefined;
|
|
14
|
-
className?: undefined;
|
|
15
|
-
})) | undefined) => string;
|
|
6
|
+
} & import("class-variance-authority/dist/types").ClassProp) | undefined) => string;
|
|
16
7
|
interface CurrencyInputProps extends Omit<React.ComponentPropsWithoutRef<typeof Primitive>, "prefix" | "suffix" | "size">, VariantProps<typeof currencyInputVariants> {
|
|
17
8
|
symbol: string;
|
|
18
9
|
code: string;
|
|
@@ -140,9 +140,17 @@ const SingleDatePicker = ({ defaultValue, value, size = "base", onChange, preset
|
|
|
140
140
|
}, [open]);
|
|
141
141
|
const onCancel = () => {
|
|
142
142
|
setDate(initialDate);
|
|
143
|
-
setTime(
|
|
143
|
+
setTime(initialDate
|
|
144
|
+
? new date_1.Time(initialDate.getHours(), initialDate.getMinutes())
|
|
145
|
+
: new date_1.Time(0, 0));
|
|
144
146
|
setOpen(false);
|
|
145
147
|
};
|
|
148
|
+
const onOpenChange = (open) => {
|
|
149
|
+
if (!open) {
|
|
150
|
+
onCancel();
|
|
151
|
+
}
|
|
152
|
+
setOpen(open);
|
|
153
|
+
};
|
|
146
154
|
const onDateChange = (date) => {
|
|
147
155
|
const newDate = date;
|
|
148
156
|
if (showTimePicker) {
|
|
@@ -162,9 +170,8 @@ const SingleDatePicker = ({ defaultValue, value, size = "base", onChange, preset
|
|
|
162
170
|
newDate.setHours(time.hour);
|
|
163
171
|
newDate.setMinutes(time.minute);
|
|
164
172
|
}
|
|
165
|
-
setDate(newDate);
|
|
166
|
-
onChange === null || onChange === void 0 ? void 0 : onChange(newDate);
|
|
167
173
|
}
|
|
174
|
+
setDate(newDate);
|
|
168
175
|
};
|
|
169
176
|
const onTimeChange = (time) => {
|
|
170
177
|
setTime(time);
|
|
@@ -188,7 +195,6 @@ const SingleDatePicker = ({ defaultValue, value, size = "base", onChange, preset
|
|
|
188
195
|
newDate.setMinutes(time.minute);
|
|
189
196
|
}
|
|
190
197
|
setDate(newDate);
|
|
191
|
-
onChange === null || onChange === void 0 ? void 0 : onChange(newDate);
|
|
192
198
|
};
|
|
193
199
|
const formattedDate = React.useMemo(() => {
|
|
194
200
|
if (!date) {
|
|
@@ -196,7 +202,11 @@ const SingleDatePicker = ({ defaultValue, value, size = "base", onChange, preset
|
|
|
196
202
|
}
|
|
197
203
|
return formatDate(date, showTimePicker);
|
|
198
204
|
}, [date, showTimePicker]);
|
|
199
|
-
|
|
205
|
+
const onApply = () => {
|
|
206
|
+
setOpen(false);
|
|
207
|
+
onChange === null || onChange === void 0 ? void 0 : onChange(date);
|
|
208
|
+
};
|
|
209
|
+
return (React.createElement(Primitives.Root, { open: open, onOpenChange: onOpenChange },
|
|
200
210
|
React.createElement(Display, { placeholder: "Pick a date", disabled: disabled, className: className, "aria-required": props.required || props["aria-required"], "aria-invalid": props["aria-invalid"], "aria-label": props["aria-label"], "aria-labelledby": props["aria-labelledby"], size: size }, formattedDate),
|
|
201
211
|
React.createElement(Flyout, null,
|
|
202
212
|
React.createElement("div", { className: "flex" },
|
|
@@ -210,7 +220,7 @@ const SingleDatePicker = ({ defaultValue, value, size = "base", onChange, preset
|
|
|
210
220
|
React.createElement(time_input_1.TimeInput, { "aria-label": "Time", onChange: onTimeChange, isDisabled: !date, value: time, isRequired: props.required }))),
|
|
211
221
|
React.createElement("div", { className: "border-ui-border-base flex items-center gap-x-2 border-t p-3" },
|
|
212
222
|
React.createElement(button_1.Button, { variant: "secondary", className: "w-full", type: "button", onClick: onCancel }, "Cancel"),
|
|
213
|
-
React.createElement(button_1.Button, { variant: "primary", className: "w-full", type: "button", onClick:
|
|
223
|
+
React.createElement(button_1.Button, { variant: "primary", className: "w-full", type: "button", onClick: onApply }, "Apply"))))))));
|
|
214
224
|
};
|
|
215
225
|
const RangeDatePicker = ({ defaultValue, value, onChange, size = "base", showTimePicker, presets, disabled, className, ...props }) => {
|
|
216
226
|
var _a;
|
|
@@ -268,14 +278,23 @@ const RangeDatePicker = ({ defaultValue, value, onChange, size = "base", showTim
|
|
|
268
278
|
}
|
|
269
279
|
}
|
|
270
280
|
setRange(newRange);
|
|
271
|
-
onChange === null || onChange === void 0 ? void 0 : onChange(newRange);
|
|
272
281
|
};
|
|
273
282
|
const onCancel = () => {
|
|
274
283
|
setRange(initialRange);
|
|
275
|
-
setStartTime(
|
|
276
|
-
|
|
284
|
+
setStartTime((initialRange === null || initialRange === void 0 ? void 0 : initialRange.from)
|
|
285
|
+
? new date_1.Time(initialRange.from.getHours(), initialRange.from.getMinutes())
|
|
286
|
+
: new date_1.Time(0, 0));
|
|
287
|
+
setEndTime((initialRange === null || initialRange === void 0 ? void 0 : initialRange.to)
|
|
288
|
+
? new date_1.Time(initialRange.to.getHours(), initialRange.to.getMinutes())
|
|
289
|
+
: new date_1.Time(0, 0));
|
|
277
290
|
setOpen(false);
|
|
278
291
|
};
|
|
292
|
+
const onOpenChange = (open) => {
|
|
293
|
+
if (!open) {
|
|
294
|
+
onCancel();
|
|
295
|
+
}
|
|
296
|
+
setOpen(open);
|
|
297
|
+
};
|
|
279
298
|
const onTimeChange = (time, pos) => {
|
|
280
299
|
switch (pos) {
|
|
281
300
|
case "start":
|
|
@@ -331,7 +350,11 @@ const RangeDatePicker = ({ defaultValue, value, onChange, size = "base", showTim
|
|
|
331
350
|
}
|
|
332
351
|
return `${range.from ? formatDate(range.from, showTimePicker) : ""} - ${range.to ? formatDate(range.to, showTimePicker) : ""}`;
|
|
333
352
|
}, [range, showTimePicker]);
|
|
334
|
-
|
|
353
|
+
const onApply = () => {
|
|
354
|
+
setOpen(false);
|
|
355
|
+
onChange === null || onChange === void 0 ? void 0 : onChange(range);
|
|
356
|
+
};
|
|
357
|
+
return (React.createElement(Primitives.Root, { open: open, onOpenChange: onOpenChange },
|
|
335
358
|
React.createElement(Display, { placeholder: "Pick a date", disabled: disabled, className: className, "aria-required": props.required || props["aria-required"], "aria-invalid": props["aria-invalid"], "aria-label": props["aria-label"], "aria-labelledby": props["aria-labelledby"], size: size }, displayRange),
|
|
336
359
|
React.createElement(Flyout, null,
|
|
337
360
|
React.createElement("div", { className: "flex" },
|
|
@@ -358,7 +381,7 @@ const RangeDatePicker = ({ defaultValue, value, onChange, size = "base", showTim
|
|
|
358
381
|
displayRange),
|
|
359
382
|
React.createElement("div", { className: "flex items-center gap-x-2" },
|
|
360
383
|
React.createElement(button_1.Button, { variant: "secondary", type: "button", onClick: onCancel }, "Cancel"),
|
|
361
|
-
React.createElement(button_1.Button, { variant: "primary", type: "button", onClick:
|
|
384
|
+
React.createElement(button_1.Button, { variant: "primary", type: "button", onClick: onApply }, "Apply")))))))));
|
|
362
385
|
};
|
|
363
386
|
const validatePresets = (presets, rules) => {
|
|
364
387
|
const { toYear, fromYear, fromMonth, toMonth, fromDay, toDay } = rules;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"date-picker.js","sourceRoot":"","sources":["../../../../src/components/date-picker/date-picker.tsx"],"names":[],"mappings":";AAAA,YAAY,CAAA;;;;AAEZ,kDAA8C;AAC9C,2CAAiE;AACjE,4EAAqD;AAErD,uCAAiC;AACjC,qDAA8B;AAE9B,gDAA4C;AAC5C,oDAAqE;AACrE,wDAAmD;AAEnD,qCAAiC;AACjC,+FAAsF;AACtF,uEAA8C;AAE9C,MAAM,eAAe,GAAG,IAAA,8BAAG,EACzB,IAAA,SAAG,EACD,8HAA8H,EAC9H,4BAA4B,EAC5B,uGAAuG,EACvG,yFAAyF,EACzF,2CAA2C,CAC5C,EACD;IACE,QAAQ,EAAE;QACR,IAAI,EAAE;YACJ,IAAI,EAAE,qCAAqC;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AG,CAClE,CAAA;qBACF;iBACF;gBAED,IAAI,KAAK,EAAE;oBACT,MAAM,SAAS,GAAG,MAAA,MAAM,CAAC,SAAS,CAAC,EAAE,0CAAE,OAAO,EAAE,CAAA;oBAEhD,IAAI,SAAS,IAAI,SAAS,GAAG,KAAK,CAAC,OAAO,EAAE,EAAE;wBAC5C,MAAM,IAAI,KAAK,CACb,UAAU,MAAM,CAAC,KAAK,0BAA0B,IAAA,iBAAM,EACpD,KAAK,EACL,cAAc,CACf,GAAG,CACL,CAAA;qBACF;iBACF;aACF;QACH,CAAC,CAAC,CAAA;KACH;AACH,CAAC,CAAA;AAED,MAAM,UAAU,GAAG,CAAC,EAAE,IAAI,GAAG,QAAQ,EAAE,GAAG,KAAK,EAAmB,EAAE,EAAE;IACpE,IAAI,KAAK,CAAC,OAAO,EAAE;QACjB,eAAe,CAAC,KAAK,CAAC,OAAO,EAAE,KAAK,CAAC,CAAA;KACtC;IAED,IAAI,IAAI,KAAK,QAAQ,EAAE;QACrB,OAAO,oBAAC,gBAAgB,OAAM,KAAqB,GAAI,CAAA;KACxD;IAED,OAAO,oBAAC,eAAe,OAAM,KAAoB,GAAI,CAAA;AACvD,CAAC,CAAA;AAEQ,gCAAU","sourcesContent":["\"use client\"\n\nimport { Time } from \"@internationalized/date\"\nimport { Calendar as CalendarIcon, Minus } from \"@medusajs/icons\"\nimport * as Primitives from \"@radix-ui/react-popover\"\nimport { TimeValue } from \"@react-aria/datepicker\"\nimport { format } from \"date-fns\"\nimport * as React from \"react\"\n\nimport { Button } from \"@/components/button\"\nimport { Calendar as CalendarPrimitive } from \"@/components/calendar\"\nimport { TimeInput } from \"@/components/time-input\"\nimport type { DateRange } from \"@/types\"\nimport { clx } from \"@/utils/clx\"\nimport { isBrowserLocaleClockType24h } from \"@/utils/is-browser-locale-hour-cycle-24h\"\nimport { cva } from \"class-variance-authority\"\n\nconst displayVariants = cva(\n clx(\n \"text-ui-fg-base bg-ui-bg-field transition-fg shadow-buttons-neutral flex w-full items-center gap-x-2 rounded-md outline-none\",\n \"hover:bg-ui-bg-field-hover\",\n \"focus:shadow-borders-interactive-with-active data-[state=open]:shadow-borders-interactive-with-active\",\n \"disabled:bg-ui-bg-disabled disabled:text-ui-fg-disabled disabled:shadow-buttons-neutral\",\n \"aria-[invalid=true]:!shadow-borders-error\"\n ),\n {\n variants: {\n size: {\n base: \"txt-compact-medium h-10 px-3 py-2.5\",\n small: \"txt-compact-small h-8 px-2 py-1.5\",\n },\n },\n defaultVariants: {\n size: \"base\",\n },\n }\n)\n\nconst Display = React.forwardRef<\n HTMLButtonElement,\n React.ComponentProps<\"button\"> & {\n placeholder?: string\n size?: \"small\" | \"base\"\n }\n>(({ className, children, placeholder, size = \"base\", ...props }, ref) => {\n return (\n <Primitives.Trigger asChild>\n <button\n ref={ref}\n className={clx(displayVariants({ size }), className)}\n {...props}\n >\n <CalendarIcon className=\"text-ui-fg-muted\" />\n <span className=\"flex-1 overflow-hidden text-ellipsis whitespace-nowrap text-left\">\n {children ? (\n children\n ) : placeholder ? (\n <span className=\"text-ui-fg-muted\">{placeholder}</span>\n ) : null}\n </span>\n </button>\n </Primitives.Trigger>\n )\n})\nDisplay.displayName = \"DatePicker.Display\"\n\nconst Flyout = React.forwardRef<\n React.ElementRef<typeof Primitives.Content>,\n React.ComponentProps<typeof Primitives.Content>\n>(({ className, children, ...props }, ref) => {\n return (\n <Primitives.Portal>\n <Primitives.Content\n ref={ref}\n sideOffset={8}\n align=\"center\"\n className={clx(\n \"txt-compact-small shadow-elevation-flyout bg-ui-bg-base w-fit rounded-lg\",\n \"animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95\",\n \"data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2\",\n className\n )}\n {...props}\n >\n {children}\n </Primitives.Content>\n </Primitives.Portal>\n )\n})\nFlyout.displayName = \"DatePicker.Flyout\"\n\ninterface Preset {\n label: string\n}\n\ninterface DatePreset extends Preset {\n date: Date\n}\n\ninterface DateRangePreset extends Preset {\n dateRange: DateRange\n}\n\ntype PresetContainerProps<TPreset extends Preset, TValue> = {\n presets: TPreset[] | TPreset[]\n onSelect: (value: TValue) => void\n currentValue?: TValue\n}\n\nconst PresetContainer = <TPreset extends Preset, TValue>({\n presets,\n onSelect,\n currentValue,\n}: PresetContainerProps<TPreset, TValue>) => {\n const isDateRangePresets = (preset: any): preset is DateRangePreset => {\n return \"dateRange\" in preset\n }\n\n const isDatePresets = (preset: any): preset is DatePreset => {\n return \"date\" in preset\n }\n\n const handleClick = (preset: TPreset) => {\n if (isDateRangePresets(preset)) {\n onSelect(preset.dateRange as TValue)\n } else if (isDatePresets(preset)) {\n onSelect(preset.date as TValue)\n }\n }\n\n const compareDates = (date1: Date, date2: Date) => {\n return (\n date1.getDate() === date2.getDate() &&\n date1.getMonth() === date2.getMonth() &&\n date1.getFullYear() === date2.getFullYear()\n )\n }\n\n const compareRanges = (range1: DateRange, range2: DateRange) => {\n const from1 = range1.from\n const from2 = range2.from\n\n let equalFrom = false\n\n if (from1 && from2) {\n const sameFrom = compareDates(from1, from2)\n\n if (sameFrom) {\n equalFrom = true\n }\n }\n\n const to1 = range1.to\n const to2 = range2.to\n\n let equalTo = false\n\n if (to1 && to2) {\n const sameTo = compareDates(to1, to2)\n\n if (sameTo) {\n equalTo = true\n }\n }\n\n return equalFrom && equalTo\n }\n\n const matchesCurrent = (preset: TPreset) => {\n if (isDateRangePresets(preset)) {\n const value = currentValue as DateRange | undefined\n\n return value && compareRanges(value, preset.dateRange)\n } else if (isDatePresets(preset)) {\n const value = currentValue as Date | undefined\n\n return value && compareDates(value, preset.date)\n }\n\n return false\n }\n\n return (\n <ul className=\"flex flex-col items-start\">\n {presets.map((preset, index) => {\n return (\n <li key={index} className=\"w-full\">\n <button\n className={clx(\n \"txt-compact-small-plus w-full overflow-hidden text-ellipsis whitespace-nowrap rounded-md p-2 text-left\",\n \"text-ui-fg-subtle hover:bg-ui-bg-base-hover outline-none transition-all\",\n \"focus:bg-ui-bg-base-hover\",\n {\n \"!bg-ui-bg-base-pressed\": matchesCurrent(preset),\n }\n )}\n onClick={() => handleClick(preset)}\n aria-label={`Select ${preset.label}`}\n >\n {preset.label}\n </button>\n </li>\n )\n })}\n </ul>\n )\n}\n\nconst formatDate = (date: Date, includeTime?: boolean) => {\n const usesAmPm = !isBrowserLocaleClockType24h()\n\n if (includeTime) {\n if (usesAmPm) {\n return format(date, \"MMM d, yyyy h:mm a\")\n }\n\n return format(date, \"MMM d, yyyy HH:mm\")\n }\n\n return format(date, \"MMM d, yyyy\")\n}\n\ntype CalendarProps = {\n fromYear?: number\n toYear?: number\n fromMonth?: Date\n toMonth?: Date\n fromDay?: Date\n toDay?: Date\n fromDate?: Date\n toDate?: Date\n}\n\ninterface PickerProps extends CalendarProps {\n className?: string\n disabled?: boolean\n required?: boolean\n size?: \"small\" | \"base\"\n showTimePicker?: boolean\n id?: string\n \"aria-invalid\"?: boolean\n \"aria-label\"?: string\n \"aria-labelledby\"?: string\n \"aria-required\"?: boolean\n}\n\ninterface SingleProps extends PickerProps {\n presets?: DatePreset[]\n defaultValue?: Date\n value?: Date\n onChange?: (date: Date | undefined) => void\n}\n\nconst SingleDatePicker = ({\n defaultValue,\n value,\n size = \"base\",\n onChange,\n presets,\n showTimePicker,\n disabled,\n className,\n ...props\n}: SingleProps) => {\n const [open, setOpen] = React.useState(false)\n const [date, setDate] = React.useState<Date | undefined>(\n value ?? defaultValue ?? undefined\n )\n const [month, setMonth] = React.useState<Date | undefined>(date)\n\n const [time, setTime] = React.useState<TimeValue>(\n value\n ? new Time(value.getHours(), value.getMinutes())\n : defaultValue\n ? new Time(defaultValue.getHours(), defaultValue.getMinutes())\n : new Time(0, 0)\n )\n\n const initialDate = React.useMemo(() => {\n return date\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [open])\n\n /**\n * Update the date when the value changes.\n */\n React.useEffect(() => {\n setDate(value ?? defaultValue ?? undefined)\n }, [value, defaultValue])\n\n React.useEffect(() => {\n if (date) {\n setMonth(date)\n }\n }, [date])\n\n React.useEffect(() => {\n if (!open) {\n setMonth(date)\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [open])\n\n const onCancel = () => {\n setDate(initialDate)\n setTime(new Time(0, 0))\n setOpen(false)\n }\n\n const onDateChange = (date: Date | undefined) => {\n const newDate = date\n\n if (showTimePicker) {\n /**\n * If the time is cleared, and the date is\n * changed then we want to reset the time.\n */\n if (newDate && !time) {\n setTime(new Time(0, 0))\n }\n\n /**\n * If the time is set, and the date is changed\n * then we want to update the date with the\n * time.\n */\n if (newDate && time) {\n newDate.setHours(time.hour)\n newDate.setMinutes(time.minute)\n }\n\n setDate(newDate)\n onChange?.(newDate)\n }\n }\n\n const onTimeChange = (time: TimeValue) => {\n setTime(time)\n\n if (!date) {\n return\n }\n\n const newDate = new Date(date.getTime())\n\n if (!time) {\n /**\n * When a segment of the time input is cleared,\n * it will return `null` as the value is no longer\n * a valid time. In this case, we want to set the\n * time to for the date, effectivly resetting the\n * input field.\n */\n newDate.setHours(0)\n newDate.setMinutes(0)\n } else {\n newDate.setHours(time.hour)\n newDate.setMinutes(time.minute)\n }\n\n setDate(newDate)\n onChange?.(newDate)\n }\n\n const formattedDate = React.useMemo(() => {\n if (!date) {\n return null\n }\n\n return formatDate(date, showTimePicker)\n }, [date, showTimePicker])\n\n return (\n <Primitives.Root open={open} onOpenChange={setOpen}>\n <Display\n placeholder=\"Pick a date\"\n disabled={disabled}\n className={className}\n aria-required={props.required || props[\"aria-required\"]}\n aria-invalid={props[\"aria-invalid\"]}\n aria-label={props[\"aria-label\"]}\n aria-labelledby={props[\"aria-labelledby\"]}\n size={size}\n >\n {formattedDate}\n </Display>\n <Flyout>\n <div className=\"flex\">\n <div className=\"flex items-start\">\n {presets && presets.length > 0 && (\n <div className=\"relative h-full w-[160px] border-r\">\n <div className=\"absolute inset-0 overflow-y-scroll p-3\">\n <PresetContainer\n currentValue={date}\n presets={presets}\n onSelect={onDateChange}\n />\n </div>\n </div>\n )}\n <div>\n <CalendarPrimitive\n mode=\"single\"\n month={month}\n onMonthChange={setMonth}\n selected={date}\n onSelect={onDateChange}\n disabled={disabled}\n {...props}\n />\n {showTimePicker && (\n <div className=\"border-ui-border-base border-t p-3\">\n <TimeInput\n aria-label=\"Time\"\n onChange={onTimeChange}\n isDisabled={!date}\n value={time}\n isRequired={props.required}\n />\n </div>\n )}\n <div className=\"border-ui-border-base flex items-center gap-x-2 border-t p-3\">\n <Button\n variant=\"secondary\"\n className=\"w-full\"\n type=\"button\"\n onClick={onCancel}\n >\n Cancel\n </Button>\n <Button\n variant=\"primary\"\n className=\"w-full\"\n type=\"button\"\n onClick={() => setOpen(false)}\n >\n Apply\n </Button>\n </div>\n </div>\n </div>\n </div>\n </Flyout>\n </Primitives.Root>\n )\n}\n\ninterface RangeProps extends PickerProps {\n presets?: DateRangePreset[]\n defaultValue?: DateRange\n value?: DateRange\n onChange?: (dateRange: DateRange | undefined) => void\n}\n\nconst RangeDatePicker = ({\n defaultValue,\n value,\n onChange,\n size = \"base\",\n showTimePicker,\n presets,\n disabled,\n className,\n ...props\n}: RangeProps) => {\n const [open, setOpen] = React.useState(false)\n const [range, setRange] = React.useState<DateRange | undefined>(\n value ?? defaultValue ?? undefined\n )\n const [month, setMonth] = React.useState<Date | undefined>(range?.from)\n\n const [startTime, setStartTime] = React.useState<TimeValue>(\n value?.from\n ? new Time(value.from.getHours(), value.from.getMinutes())\n : defaultValue?.from\n ? new Time(defaultValue.from.getHours(), defaultValue.from.getMinutes())\n : new Time(0, 0)\n )\n const [endTime, setEndTime] = React.useState<TimeValue>(\n value?.to\n ? new Time(value.to.getHours(), value.to.getMinutes())\n : defaultValue?.to\n ? new Time(defaultValue.to.getHours(), defaultValue.to.getMinutes())\n : new Time(0, 0)\n )\n\n const initialRange = React.useMemo(() => {\n return range\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [open])\n\n /**\n * Update the range when the value changes.\n */\n React.useEffect(() => {\n setRange(value ?? defaultValue ?? undefined)\n }, [value, defaultValue])\n\n React.useEffect(() => {\n if (range) {\n setMonth(range.from)\n }\n }, [range])\n\n React.useEffect(() => {\n if (!open) {\n setMonth(range?.from)\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [open])\n\n const onRangeChange = (range: DateRange | undefined) => {\n const newRange = range\n\n if (showTimePicker) {\n if (newRange?.from && !startTime) {\n setStartTime(new Time(0, 0))\n }\n\n if (newRange?.to && !endTime) {\n setEndTime(new Time(0, 0))\n }\n\n if (newRange?.from && startTime) {\n newRange.from.setHours(startTime.hour)\n newRange.from.setMinutes(startTime.minute)\n }\n\n if (newRange?.to && endTime) {\n newRange.to.setHours(endTime.hour)\n newRange.to.setMinutes(endTime.minute)\n }\n }\n\n setRange(newRange)\n onChange?.(newRange)\n }\n\n const onCancel = () => {\n setRange(initialRange)\n setStartTime(new Time(0, 0))\n setEndTime(new Time(0, 0))\n setOpen(false)\n }\n\n const onTimeChange = (time: TimeValue, pos: \"start\" | \"end\") => {\n switch (pos) {\n case \"start\":\n setStartTime(time)\n break\n case \"end\":\n setEndTime(time)\n break\n }\n\n if (!range) {\n return\n }\n\n if (pos === \"start\") {\n if (!range.from) {\n return\n }\n\n const newDate = new Date(range.from.getTime())\n\n if (!time) {\n newDate.setHours(0)\n newDate.setMinutes(0)\n } else {\n newDate.setHours(time.hour)\n newDate.setMinutes(time.minute)\n }\n\n setRange({\n ...range,\n from: newDate,\n })\n }\n\n if (pos === \"end\") {\n if (!range.to) {\n return\n }\n\n const newDate = new Date(range.to.getTime())\n\n if (!time) {\n newDate.setHours(0)\n newDate.setMinutes(0)\n } else {\n newDate.setHours(time.hour)\n newDate.setMinutes(time.minute)\n }\n\n setRange({\n ...range,\n to: newDate,\n })\n }\n }\n\n const displayRange = React.useMemo(() => {\n if (!range) {\n return null\n }\n\n return `${range.from ? formatDate(range.from, showTimePicker) : \"\"} - ${\n range.to ? formatDate(range.to, showTimePicker) : \"\"\n }`\n }, [range, showTimePicker])\n\n return (\n <Primitives.Root open={open} onOpenChange={setOpen}>\n <Display\n placeholder=\"Pick a date\"\n disabled={disabled}\n className={className}\n aria-required={props.required || props[\"aria-required\"]}\n aria-invalid={props[\"aria-invalid\"]}\n aria-label={props[\"aria-label\"]}\n aria-labelledby={props[\"aria-labelledby\"]}\n size={size}\n >\n {displayRange}\n </Display>\n <Flyout>\n <div className=\"flex\">\n <div className=\"flex items-start\">\n {presets && presets.length > 0 && (\n <div className=\"relative h-full w-[160px] border-r\">\n <div className=\"absolute inset-0 overflow-y-scroll p-3\">\n <PresetContainer\n currentValue={range}\n presets={presets}\n onSelect={onRangeChange}\n />\n </div>\n </div>\n )}\n <div>\n <CalendarPrimitive\n mode=\"range\"\n selected={range}\n onSelect={onRangeChange}\n month={month}\n onMonthChange={setMonth}\n numberOfMonths={2}\n disabled={disabled}\n classNames={{\n months: \"flex flex-row divide-x divide-ui-border-base\",\n }}\n {...props}\n />\n {showTimePicker && (\n <div className=\"border-ui-border-base flex items-center justify-evenly gap-x-3 border-t p-3\">\n <div className=\"flex flex-1 items-center gap-x-2\">\n <span className=\"text-ui-fg-subtle\">Start:</span>\n <TimeInput\n value={startTime}\n onChange={(v) => onTimeChange(v, \"start\")}\n aria-label=\"Start date time\"\n isDisabled={!range?.from}\n isRequired={props.required}\n />\n </div>\n <Minus className=\"text-ui-fg-muted\" />\n <div className=\"flex flex-1 items-center gap-x-2\">\n <span className=\"text-ui-fg-subtle\">End:</span>\n <TimeInput\n value={endTime}\n onChange={(v) => onTimeChange(v, \"end\")}\n aria-label=\"End date time\"\n isDisabled={!range?.to}\n isRequired={props.required}\n />\n </div>\n </div>\n )}\n <div className=\"flex items-center justify-between border-t p-3\">\n <p className={clx(\"text-ui-fg-subtle txt-compact-small-plus\")}>\n <span className=\"text-ui-fg-muted\">Range:</span>{\" \"}\n {displayRange}\n </p>\n <div className=\"flex items-center gap-x-2\">\n <Button variant=\"secondary\" type=\"button\" onClick={onCancel}>\n Cancel\n </Button>\n <Button\n variant=\"primary\"\n type=\"button\"\n onClick={() => setOpen(false)}\n >\n Apply\n </Button>\n </div>\n </div>\n </div>\n </div>\n </div>\n </Flyout>\n </Primitives.Root>\n )\n}\n\ntype DatePickerProps = (\n | {\n mode?: \"single\"\n presets?: DatePreset[]\n defaultValue?: Date\n value?: Date\n onChange?: (date: Date | undefined) => void\n }\n | {\n mode: \"range\"\n presets?: DateRangePreset[]\n defaultValue?: DateRange\n value?: DateRange\n onChange?: (dateRange: DateRange | undefined) => void\n }\n) &\n PickerProps\n\nconst validatePresets = (\n presets: DateRangePreset[] | DatePreset[],\n rules: PickerProps\n) => {\n const { toYear, fromYear, fromMonth, toMonth, fromDay, toDay } = rules\n\n if (presets && presets.length > 0) {\n const fromYearToUse = fromYear\n const toYearToUse = toYear\n\n presets.forEach((preset) => {\n if (\"date\" in preset) {\n const presetYear = preset.date.getFullYear()\n\n if (fromYear && presetYear < fromYear) {\n throw new Error(\n `Preset ${preset.label} is before fromYear ${fromYearToUse}.`\n )\n }\n\n if (toYear && presetYear > toYear) {\n throw new Error(\n `Preset ${preset.label} is after toYear ${toYearToUse}.`\n )\n }\n\n if (fromMonth) {\n const presetMonth = preset.date.getMonth()\n\n if (presetMonth < fromMonth.getMonth()) {\n throw new Error(\n `Preset ${preset.label} is before fromMonth ${fromMonth}.`\n )\n }\n }\n\n if (toMonth) {\n const presetMonth = preset.date.getMonth()\n\n if (presetMonth > toMonth.getMonth()) {\n throw new Error(\n `Preset ${preset.label} is after toMonth ${toMonth}.`\n )\n }\n }\n\n if (fromDay) {\n const presetDay = preset.date.getDate()\n\n if (presetDay < fromDay.getDate()) {\n throw new Error(\n `Preset ${preset.label} is before fromDay ${fromDay}.`\n )\n }\n }\n\n if (toDay) {\n const presetDay = preset.date.getDate()\n\n if (presetDay > toDay.getDate()) {\n throw new Error(\n `Preset ${preset.label} is after toDay ${format(\n toDay,\n \"MMM dd, yyyy\"\n )}.`\n )\n }\n }\n }\n\n if (\"dateRange\" in preset) {\n const presetFromYear = preset.dateRange.from?.getFullYear()\n const presetToYear = preset.dateRange.to?.getFullYear()\n\n if (presetFromYear && fromYear && presetFromYear < fromYear) {\n throw new Error(\n `Preset ${preset.label}'s 'from' is before fromYear ${fromYearToUse}.`\n )\n }\n\n if (presetToYear && toYear && presetToYear > toYear) {\n throw new Error(\n `Preset ${preset.label}'s 'to' is after toYear ${toYearToUse}.`\n )\n }\n\n if (fromMonth) {\n const presetMonth = preset.dateRange.from?.getMonth()\n\n if (presetMonth && presetMonth < fromMonth.getMonth()) {\n throw new Error(\n `Preset ${preset.label}'s 'from' is before fromMonth ${format(\n fromMonth,\n \"MMM, yyyy\"\n )}.`\n )\n }\n }\n\n if (toMonth) {\n const presetMonth = preset.dateRange.to?.getMonth()\n\n if (presetMonth && presetMonth > toMonth.getMonth()) {\n throw new Error(\n `Preset ${preset.label}'s 'to' is after toMonth ${format(\n toMonth,\n \"MMM, yyyy\"\n )}.`\n )\n }\n }\n\n if (fromDay) {\n const presetDay = preset.dateRange.from?.getDate()\n\n if (presetDay && presetDay < fromDay.getDate()) {\n throw new Error(\n `Preset ${\n preset.dateRange.from\n }'s 'from' is before fromDay ${format(fromDay, \"MMM dd, yyyy\")}.`\n )\n }\n }\n\n if (toDay) {\n const presetDay = preset.dateRange.to?.getDate()\n\n if (presetDay && presetDay > toDay.getDate()) {\n throw new Error(\n `Preset ${preset.label}'s 'to' is after toDay ${format(\n toDay,\n \"MMM dd, yyyy\"\n )}.`\n )\n }\n }\n }\n })\n }\n}\n\nconst DatePicker = ({ mode = \"single\", ...props }: DatePickerProps) => {\n if (props.presets) {\n validatePresets(props.presets, props)\n }\n\n if (mode === \"single\") {\n return <SingleDatePicker {...(props as SingleProps)} />\n }\n\n return <RangeDatePicker {...(props as RangeProps)} />\n}\n\nexport { DatePicker }\n"]}
|
|
1
|
+
{"version":3,"file":"date-picker.js","sourceRoot":"","sources":["../../../../src/components/date-picker/date-picker.tsx"],"names":[],"mappings":";AAAA,YAAY,CAAA;;;;AAEZ,kDAA8C;AAC9C,2CAAiE;AACjE,4EAAqD;AAErD,uCAAiC;AACjC,qDAA8B;AAE9B,gDAA4C;AAC5C,oDAAqE;AACrE,wDAAmD;AAEnD,qCAAiC;AACjC,+FAAsF;AACtF,uEAA8C;AAE9C,MAAM,eAAe,GAAG,IAAA,8BAAG,EACzB,IAAA,SAAG,EACD,8HAA8H,EAC9H,4BAA4B,EAC5B,uGAAuG,EACvG,yFAAyF,EACzF,2CAA2C,CAC5C,EACD;IACE,QAAQ,EAAE;QACR,IAAI,EAAE;YACJ,IAAI,EAAE,qCAAqC;YAC3C,KAAK,EAAE,mCAAmC;SAC3C;KACF;IACD,eAAe,EAAE;QACf,IAAI,EAAE,MAAM;KACb;CACF,CACF,CAAA;AAED,MAAM,OAAO,GAAG,KAAK,CAAC,UAAU,CAM9B,CAAC,EAAE,SAAS,EAAE,QAAQ,EAAE,WAAW,EAAE,IAAI,GAAG,MAAM,EAAE,GAAG,KAAK,EAAE,EAAE,GAAG,EAAE,EAAE;IACvE,OAAO,CACL,oBAAC,UAAU,CAAC,OAAO,IAAC,OAAO;QACzB,gCACE,GAAG,EAAE,GAAG,EACR,SAAS,EAAE,IAAA,SAAG,EAAC,eAAe,CAAC,EAAE,IAAI,EAAE,CAAC,EAAE,SAAS,CAAC,KAChD,KAAK;YAET,oBAAC,gBAAY,IAAC,SAAS,EAAC,kBAAkB,GAAG;YAC7C,8BAAM,SAAS,EAAC,kEAAkE,IAC/E,QAAQ,CAAC,CAAC,CAAC,CACV,QAAQ,CACT,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,CAChB,8BAAM,SAAS,EAAC,kBAAkB,IAAE,WAAW,CAAQ,CACxD,CAAC,CAAC,CAAC,IAAI,CACH,CACA,CACU,CACtB,CAAA;AACH,CAAC,CAAC,CAAA;AACF,OAAO,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AAC,SAAS,CAAC,IACnB,+BAA+B,IAAA,iBAAM,EAAC,OAAO,EAAE,cAAc,CAAC,GAAG,CAClE,CAAA;qBACF;iBACF;gBAED,IAAI,KAAK,EAAE;oBACT,MAAM,SAAS,GAAG,MAAA,MAAM,CAAC,SAAS,CAAC,EAAE,0CAAE,OAAO,EAAE,CAAA;oBAEhD,IAAI,SAAS,IAAI,SAAS,GAAG,KAAK,CAAC,OAAO,EAAE,EAAE;wBAC5C,MAAM,IAAI,KAAK,CACb,UAAU,MAAM,CAAC,KAAK,0BAA0B,IAAA,iBAAM,EACpD,KAAK,EACL,cAAc,CACf,GAAG,CACL,CAAA;qBACF;iBACF;aACF;QACH,CAAC,CAAC,CAAA;KACH;AACH,CAAC,CAAA;AAED,MAAM,UAAU,GAAG,CAAC,EAAE,IAAI,GAAG,QAAQ,EAAE,GAAG,KAAK,EAAmB,EAAE,EAAE;IACpE,IAAI,KAAK,CAAC,OAAO,EAAE;QACjB,eAAe,CAAC,KAAK,CAAC,OAAO,EAAE,KAAK,CAAC,CAAA;KACtC;IAED,IAAI,IAAI,KAAK,QAAQ,EAAE;QACrB,OAAO,oBAAC,gBAAgB,OAAM,KAAqB,GAAI,CAAA;KACxD;IAED,OAAO,oBAAC,eAAe,OAAM,KAAoB,GAAI,CAAA;AACvD,CAAC,CAAA;AAEQ,gCAAU","sourcesContent":["\"use client\"\n\nimport { Time } from \"@internationalized/date\"\nimport { Calendar as CalendarIcon, Minus } from \"@medusajs/icons\"\nimport * as Primitives from \"@radix-ui/react-popover\"\nimport { TimeValue } from \"@react-aria/datepicker\"\nimport { format } from \"date-fns\"\nimport * as React from \"react\"\n\nimport { Button } from \"@/components/button\"\nimport { Calendar as CalendarPrimitive } from \"@/components/calendar\"\nimport { TimeInput } from \"@/components/time-input\"\nimport type { DateRange } from \"@/types\"\nimport { clx } from \"@/utils/clx\"\nimport { isBrowserLocaleClockType24h } from \"@/utils/is-browser-locale-hour-cycle-24h\"\nimport { cva } from \"class-variance-authority\"\n\nconst displayVariants = cva(\n clx(\n \"text-ui-fg-base bg-ui-bg-field transition-fg shadow-buttons-neutral flex w-full items-center gap-x-2 rounded-md outline-none\",\n \"hover:bg-ui-bg-field-hover\",\n \"focus:shadow-borders-interactive-with-active data-[state=open]:shadow-borders-interactive-with-active\",\n \"disabled:bg-ui-bg-disabled disabled:text-ui-fg-disabled disabled:shadow-buttons-neutral\",\n \"aria-[invalid=true]:!shadow-borders-error\"\n ),\n {\n variants: {\n size: {\n base: \"txt-compact-medium h-10 px-3 py-2.5\",\n small: \"txt-compact-small h-8 px-2 py-1.5\",\n },\n },\n defaultVariants: {\n size: \"base\",\n },\n }\n)\n\nconst Display = React.forwardRef<\n HTMLButtonElement,\n React.ComponentProps<\"button\"> & {\n placeholder?: string\n size?: \"small\" | \"base\"\n }\n>(({ className, children, placeholder, size = \"base\", ...props }, ref) => {\n return (\n <Primitives.Trigger asChild>\n <button\n ref={ref}\n className={clx(displayVariants({ size }), className)}\n {...props}\n >\n <CalendarIcon className=\"text-ui-fg-muted\" />\n <span className=\"flex-1 overflow-hidden text-ellipsis whitespace-nowrap text-left\">\n {children ? (\n children\n ) : placeholder ? (\n <span className=\"text-ui-fg-muted\">{placeholder}</span>\n ) : null}\n </span>\n </button>\n </Primitives.Trigger>\n )\n})\nDisplay.displayName = \"DatePicker.Display\"\n\nconst Flyout = React.forwardRef<\n React.ElementRef<typeof Primitives.Content>,\n React.ComponentProps<typeof Primitives.Content>\n>(({ className, children, ...props }, ref) => {\n return (\n <Primitives.Portal>\n <Primitives.Content\n ref={ref}\n sideOffset={8}\n align=\"center\"\n className={clx(\n \"txt-compact-small shadow-elevation-flyout bg-ui-bg-base w-fit rounded-lg\",\n \"animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95\",\n \"data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2\",\n className\n )}\n {...props}\n >\n {children}\n </Primitives.Content>\n </Primitives.Portal>\n )\n})\nFlyout.displayName = \"DatePicker.Flyout\"\n\ninterface Preset {\n label: string\n}\n\ninterface DatePreset extends Preset {\n date: Date\n}\n\ninterface DateRangePreset extends Preset {\n dateRange: DateRange\n}\n\ntype PresetContainerProps<TPreset extends Preset, TValue> = {\n presets: TPreset[] | TPreset[]\n onSelect: (value: TValue) => void\n currentValue?: TValue\n}\n\nconst PresetContainer = <TPreset extends Preset, TValue>({\n presets,\n onSelect,\n currentValue,\n}: PresetContainerProps<TPreset, TValue>) => {\n const isDateRangePresets = (preset: any): preset is DateRangePreset => {\n return \"dateRange\" in preset\n }\n\n const isDatePresets = (preset: any): preset is DatePreset => {\n return \"date\" in preset\n }\n\n const handleClick = (preset: TPreset) => {\n if (isDateRangePresets(preset)) {\n onSelect(preset.dateRange as TValue)\n } else if (isDatePresets(preset)) {\n onSelect(preset.date as TValue)\n }\n }\n\n const compareDates = (date1: Date, date2: Date) => {\n return (\n date1.getDate() === date2.getDate() &&\n date1.getMonth() === date2.getMonth() &&\n date1.getFullYear() === date2.getFullYear()\n )\n }\n\n const compareRanges = (range1: DateRange, range2: DateRange) => {\n const from1 = range1.from\n const from2 = range2.from\n\n let equalFrom = false\n\n if (from1 && from2) {\n const sameFrom = compareDates(from1, from2)\n\n if (sameFrom) {\n equalFrom = true\n }\n }\n\n const to1 = range1.to\n const to2 = range2.to\n\n let equalTo = false\n\n if (to1 && to2) {\n const sameTo = compareDates(to1, to2)\n\n if (sameTo) {\n equalTo = true\n }\n }\n\n return equalFrom && equalTo\n }\n\n const matchesCurrent = (preset: TPreset) => {\n if (isDateRangePresets(preset)) {\n const value = currentValue as DateRange | undefined\n\n return value && compareRanges(value, preset.dateRange)\n } else if (isDatePresets(preset)) {\n const value = currentValue as Date | undefined\n\n return value && compareDates(value, preset.date)\n }\n\n return false\n }\n\n return (\n <ul className=\"flex flex-col items-start\">\n {presets.map((preset, index) => {\n return (\n <li key={index} className=\"w-full\">\n <button\n className={clx(\n \"txt-compact-small-plus w-full overflow-hidden text-ellipsis whitespace-nowrap rounded-md p-2 text-left\",\n \"text-ui-fg-subtle hover:bg-ui-bg-base-hover outline-none transition-all\",\n \"focus:bg-ui-bg-base-hover\",\n {\n \"!bg-ui-bg-base-pressed\": matchesCurrent(preset),\n }\n )}\n onClick={() => handleClick(preset)}\n aria-label={`Select ${preset.label}`}\n >\n {preset.label}\n </button>\n </li>\n )\n })}\n </ul>\n )\n}\n\nconst formatDate = (date: Date, includeTime?: boolean) => {\n const usesAmPm = !isBrowserLocaleClockType24h()\n\n if (includeTime) {\n if (usesAmPm) {\n return format(date, \"MMM d, yyyy h:mm a\")\n }\n\n return format(date, \"MMM d, yyyy HH:mm\")\n }\n\n return format(date, \"MMM d, yyyy\")\n}\n\ntype CalendarProps = {\n fromYear?: number\n toYear?: number\n fromMonth?: Date\n toMonth?: Date\n fromDay?: Date\n toDay?: Date\n fromDate?: Date\n toDate?: Date\n}\n\ninterface PickerProps extends CalendarProps {\n className?: string\n disabled?: boolean\n required?: boolean\n size?: \"small\" | \"base\"\n showTimePicker?: boolean\n id?: string\n \"aria-invalid\"?: boolean\n \"aria-label\"?: string\n \"aria-labelledby\"?: string\n \"aria-required\"?: boolean\n}\n\ninterface SingleProps extends PickerProps {\n presets?: DatePreset[]\n defaultValue?: Date\n value?: Date\n onChange?: (date: Date | undefined) => void\n}\n\nconst SingleDatePicker = ({\n defaultValue,\n value,\n size = \"base\",\n onChange,\n presets,\n showTimePicker,\n disabled,\n className,\n ...props\n}: SingleProps) => {\n const [open, setOpen] = React.useState(false)\n const [date, setDate] = React.useState<Date | undefined>(\n value ?? defaultValue ?? undefined\n )\n const [month, setMonth] = React.useState<Date | undefined>(date)\n\n const [time, setTime] = React.useState<TimeValue>(\n value\n ? new Time(value.getHours(), value.getMinutes())\n : defaultValue\n ? new Time(defaultValue.getHours(), defaultValue.getMinutes())\n : new Time(0, 0)\n )\n\n const initialDate = React.useMemo(() => {\n return date\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [open])\n\n /**\n * Update the date when the value changes.\n */\n React.useEffect(() => {\n setDate(value ?? defaultValue ?? undefined)\n }, [value, defaultValue])\n\n React.useEffect(() => {\n if (date) {\n setMonth(date)\n }\n }, [date])\n\n React.useEffect(() => {\n if (!open) {\n setMonth(date)\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [open])\n\n const onCancel = () => {\n setDate(initialDate)\n setTime(\n initialDate\n ? new Time(initialDate.getHours(), initialDate.getMinutes())\n : new Time(0, 0)\n )\n setOpen(false)\n }\n\n const onOpenChange = (open: boolean) => {\n if (!open) {\n onCancel()\n }\n\n setOpen(open)\n }\n\n const onDateChange = (date: Date | undefined) => {\n const newDate = date\n\n if (showTimePicker) {\n /**\n * If the time is cleared, and the date is\n * changed then we want to reset the time.\n */\n if (newDate && !time) {\n setTime(new Time(0, 0))\n }\n\n /**\n * If the time is set, and the date is changed\n * then we want to update the date with the\n * time.\n */\n if (newDate && time) {\n newDate.setHours(time.hour)\n newDate.setMinutes(time.minute)\n }\n }\n\n setDate(newDate)\n }\n\n const onTimeChange = (time: TimeValue) => {\n setTime(time)\n\n if (!date) {\n return\n }\n\n const newDate = new Date(date.getTime())\n\n if (!time) {\n /**\n * When a segment of the time input is cleared,\n * it will return `null` as the value is no longer\n * a valid time. In this case, we want to set the\n * time to for the date, effectivly resetting the\n * input field.\n */\n newDate.setHours(0)\n newDate.setMinutes(0)\n } else {\n newDate.setHours(time.hour)\n newDate.setMinutes(time.minute)\n }\n\n setDate(newDate)\n }\n\n const formattedDate = React.useMemo(() => {\n if (!date) {\n return null\n }\n\n return formatDate(date, showTimePicker)\n }, [date, showTimePicker])\n\n const onApply = () => {\n setOpen(false)\n onChange?.(date)\n }\n\n return (\n <Primitives.Root open={open} onOpenChange={onOpenChange}>\n <Display\n placeholder=\"Pick a date\"\n disabled={disabled}\n className={className}\n aria-required={props.required || props[\"aria-required\"]}\n aria-invalid={props[\"aria-invalid\"]}\n aria-label={props[\"aria-label\"]}\n aria-labelledby={props[\"aria-labelledby\"]}\n size={size}\n >\n {formattedDate}\n </Display>\n <Flyout>\n <div className=\"flex\">\n <div className=\"flex items-start\">\n {presets && presets.length > 0 && (\n <div className=\"relative h-full w-[160px] border-r\">\n <div className=\"absolute inset-0 overflow-y-scroll p-3\">\n <PresetContainer\n currentValue={date}\n presets={presets}\n onSelect={onDateChange}\n />\n </div>\n </div>\n )}\n <div>\n <CalendarPrimitive\n mode=\"single\"\n month={month}\n onMonthChange={setMonth}\n selected={date}\n onSelect={onDateChange}\n disabled={disabled}\n {...props}\n />\n {showTimePicker && (\n <div className=\"border-ui-border-base border-t p-3\">\n <TimeInput\n aria-label=\"Time\"\n onChange={onTimeChange}\n isDisabled={!date}\n value={time}\n isRequired={props.required}\n />\n </div>\n )}\n <div className=\"border-ui-border-base flex items-center gap-x-2 border-t p-3\">\n <Button\n variant=\"secondary\"\n className=\"w-full\"\n type=\"button\"\n onClick={onCancel}\n >\n Cancel\n </Button>\n <Button\n variant=\"primary\"\n className=\"w-full\"\n type=\"button\"\n onClick={onApply}\n >\n Apply\n </Button>\n </div>\n </div>\n </div>\n </div>\n </Flyout>\n </Primitives.Root>\n )\n}\n\ninterface RangeProps extends PickerProps {\n presets?: DateRangePreset[]\n defaultValue?: DateRange\n value?: DateRange\n onChange?: (dateRange: DateRange | undefined) => void\n}\n\nconst RangeDatePicker = ({\n defaultValue,\n value,\n onChange,\n size = \"base\",\n showTimePicker,\n presets,\n disabled,\n className,\n ...props\n}: RangeProps) => {\n const [open, setOpen] = React.useState(false)\n const [range, setRange] = React.useState<DateRange | undefined>(\n value ?? defaultValue ?? undefined\n )\n const [month, setMonth] = React.useState<Date | undefined>(range?.from)\n\n const [startTime, setStartTime] = React.useState<TimeValue>(\n value?.from\n ? new Time(value.from.getHours(), value.from.getMinutes())\n : defaultValue?.from\n ? new Time(defaultValue.from.getHours(), defaultValue.from.getMinutes())\n : new Time(0, 0)\n )\n const [endTime, setEndTime] = React.useState<TimeValue>(\n value?.to\n ? new Time(value.to.getHours(), value.to.getMinutes())\n : defaultValue?.to\n ? new Time(defaultValue.to.getHours(), defaultValue.to.getMinutes())\n : new Time(0, 0)\n )\n\n const initialRange = React.useMemo(() => {\n return range\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [open])\n\n /**\n * Update the range when the value changes.\n */\n React.useEffect(() => {\n setRange(value ?? defaultValue ?? undefined)\n }, [value, defaultValue])\n\n React.useEffect(() => {\n if (range) {\n setMonth(range.from)\n }\n }, [range])\n\n React.useEffect(() => {\n if (!open) {\n setMonth(range?.from)\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [open])\n\n const onRangeChange = (range: DateRange | undefined) => {\n const newRange = range\n\n if (showTimePicker) {\n if (newRange?.from && !startTime) {\n setStartTime(new Time(0, 0))\n }\n\n if (newRange?.to && !endTime) {\n setEndTime(new Time(0, 0))\n }\n\n if (newRange?.from && startTime) {\n newRange.from.setHours(startTime.hour)\n newRange.from.setMinutes(startTime.minute)\n }\n\n if (newRange?.to && endTime) {\n newRange.to.setHours(endTime.hour)\n newRange.to.setMinutes(endTime.minute)\n }\n }\n\n setRange(newRange)\n }\n\n const onCancel = () => {\n setRange(initialRange)\n setStartTime(\n initialRange?.from\n ? new Time(initialRange.from.getHours(), initialRange.from.getMinutes())\n : new Time(0, 0)\n )\n setEndTime(\n initialRange?.to\n ? new Time(initialRange.to.getHours(), initialRange.to.getMinutes())\n : new Time(0, 0)\n )\n setOpen(false)\n }\n\n const onOpenChange = (open: boolean) => {\n if (!open) {\n onCancel()\n }\n\n setOpen(open)\n }\n\n const onTimeChange = (time: TimeValue, pos: \"start\" | \"end\") => {\n switch (pos) {\n case \"start\":\n setStartTime(time)\n break\n case \"end\":\n setEndTime(time)\n break\n }\n\n if (!range) {\n return\n }\n\n if (pos === \"start\") {\n if (!range.from) {\n return\n }\n\n const newDate = new Date(range.from.getTime())\n\n if (!time) {\n newDate.setHours(0)\n newDate.setMinutes(0)\n } else {\n newDate.setHours(time.hour)\n newDate.setMinutes(time.minute)\n }\n\n setRange({\n ...range,\n from: newDate,\n })\n }\n\n if (pos === \"end\") {\n if (!range.to) {\n return\n }\n\n const newDate = new Date(range.to.getTime())\n\n if (!time) {\n newDate.setHours(0)\n newDate.setMinutes(0)\n } else {\n newDate.setHours(time.hour)\n newDate.setMinutes(time.minute)\n }\n\n setRange({\n ...range,\n to: newDate,\n })\n }\n }\n\n const displayRange = React.useMemo(() => {\n if (!range) {\n return null\n }\n\n return `${range.from ? formatDate(range.from, showTimePicker) : \"\"} - ${\n range.to ? formatDate(range.to, showTimePicker) : \"\"\n }`\n }, [range, showTimePicker])\n\n const onApply = () => {\n setOpen(false)\n onChange?.(range)\n }\n\n return (\n <Primitives.Root open={open} onOpenChange={onOpenChange}>\n <Display\n placeholder=\"Pick a date\"\n disabled={disabled}\n className={className}\n aria-required={props.required || props[\"aria-required\"]}\n aria-invalid={props[\"aria-invalid\"]}\n aria-label={props[\"aria-label\"]}\n aria-labelledby={props[\"aria-labelledby\"]}\n size={size}\n >\n {displayRange}\n </Display>\n <Flyout>\n <div className=\"flex\">\n <div className=\"flex items-start\">\n {presets && presets.length > 0 && (\n <div className=\"relative h-full w-[160px] border-r\">\n <div className=\"absolute inset-0 overflow-y-scroll p-3\">\n <PresetContainer\n currentValue={range}\n presets={presets}\n onSelect={onRangeChange}\n />\n </div>\n </div>\n )}\n <div>\n <CalendarPrimitive\n mode=\"range\"\n selected={range}\n onSelect={onRangeChange}\n month={month}\n onMonthChange={setMonth}\n numberOfMonths={2}\n disabled={disabled}\n classNames={{\n months: \"flex flex-row divide-x divide-ui-border-base\",\n }}\n {...props}\n />\n {showTimePicker && (\n <div className=\"border-ui-border-base flex items-center justify-evenly gap-x-3 border-t p-3\">\n <div className=\"flex flex-1 items-center gap-x-2\">\n <span className=\"text-ui-fg-subtle\">Start:</span>\n <TimeInput\n value={startTime}\n onChange={(v) => onTimeChange(v, \"start\")}\n aria-label=\"Start date time\"\n isDisabled={!range?.from}\n isRequired={props.required}\n />\n </div>\n <Minus className=\"text-ui-fg-muted\" />\n <div className=\"flex flex-1 items-center gap-x-2\">\n <span className=\"text-ui-fg-subtle\">End:</span>\n <TimeInput\n value={endTime}\n onChange={(v) => onTimeChange(v, \"end\")}\n aria-label=\"End date time\"\n isDisabled={!range?.to}\n isRequired={props.required}\n />\n </div>\n </div>\n )}\n <div className=\"flex items-center justify-between border-t p-3\">\n <p className={clx(\"text-ui-fg-subtle txt-compact-small-plus\")}>\n <span className=\"text-ui-fg-muted\">Range:</span>{\" \"}\n {displayRange}\n </p>\n <div className=\"flex items-center gap-x-2\">\n <Button variant=\"secondary\" type=\"button\" onClick={onCancel}>\n Cancel\n </Button>\n <Button variant=\"primary\" type=\"button\" onClick={onApply}>\n Apply\n </Button>\n </div>\n </div>\n </div>\n </div>\n </div>\n </Flyout>\n </Primitives.Root>\n )\n}\n\ntype DatePickerProps = (\n | {\n mode?: \"single\"\n presets?: DatePreset[]\n defaultValue?: Date\n value?: Date\n onChange?: (date: Date | undefined) => void\n }\n | {\n mode: \"range\"\n presets?: DateRangePreset[]\n defaultValue?: DateRange\n value?: DateRange\n onChange?: (dateRange: DateRange | undefined) => void\n }\n) &\n PickerProps\n\nconst validatePresets = (\n presets: DateRangePreset[] | DatePreset[],\n rules: PickerProps\n) => {\n const { toYear, fromYear, fromMonth, toMonth, fromDay, toDay } = rules\n\n if (presets && presets.length > 0) {\n const fromYearToUse = fromYear\n const toYearToUse = toYear\n\n presets.forEach((preset) => {\n if (\"date\" in preset) {\n const presetYear = preset.date.getFullYear()\n\n if (fromYear && presetYear < fromYear) {\n throw new Error(\n `Preset ${preset.label} is before fromYear ${fromYearToUse}.`\n )\n }\n\n if (toYear && presetYear > toYear) {\n throw new Error(\n `Preset ${preset.label} is after toYear ${toYearToUse}.`\n )\n }\n\n if (fromMonth) {\n const presetMonth = preset.date.getMonth()\n\n if (presetMonth < fromMonth.getMonth()) {\n throw new Error(\n `Preset ${preset.label} is before fromMonth ${fromMonth}.`\n )\n }\n }\n\n if (toMonth) {\n const presetMonth = preset.date.getMonth()\n\n if (presetMonth > toMonth.getMonth()) {\n throw new Error(\n `Preset ${preset.label} is after toMonth ${toMonth}.`\n )\n }\n }\n\n if (fromDay) {\n const presetDay = preset.date.getDate()\n\n if (presetDay < fromDay.getDate()) {\n throw new Error(\n `Preset ${preset.label} is before fromDay ${fromDay}.`\n )\n }\n }\n\n if (toDay) {\n const presetDay = preset.date.getDate()\n\n if (presetDay > toDay.getDate()) {\n throw new Error(\n `Preset ${preset.label} is after toDay ${format(\n toDay,\n \"MMM dd, yyyy\"\n )}.`\n )\n }\n }\n }\n\n if (\"dateRange\" in preset) {\n const presetFromYear = preset.dateRange.from?.getFullYear()\n const presetToYear = preset.dateRange.to?.getFullYear()\n\n if (presetFromYear && fromYear && presetFromYear < fromYear) {\n throw new Error(\n `Preset ${preset.label}'s 'from' is before fromYear ${fromYearToUse}.`\n )\n }\n\n if (presetToYear && toYear && presetToYear > toYear) {\n throw new Error(\n `Preset ${preset.label}'s 'to' is after toYear ${toYearToUse}.`\n )\n }\n\n if (fromMonth) {\n const presetMonth = preset.dateRange.from?.getMonth()\n\n if (presetMonth && presetMonth < fromMonth.getMonth()) {\n throw new Error(\n `Preset ${preset.label}'s 'from' is before fromMonth ${format(\n fromMonth,\n \"MMM, yyyy\"\n )}.`\n )\n }\n }\n\n if (toMonth) {\n const presetMonth = preset.dateRange.to?.getMonth()\n\n if (presetMonth && presetMonth > toMonth.getMonth()) {\n throw new Error(\n `Preset ${preset.label}'s 'to' is after toMonth ${format(\n toMonth,\n \"MMM, yyyy\"\n )}.`\n )\n }\n }\n\n if (fromDay) {\n const presetDay = preset.dateRange.from?.getDate()\n\n if (presetDay && presetDay < fromDay.getDate()) {\n throw new Error(\n `Preset ${\n preset.dateRange.from\n }'s 'from' is before fromDay ${format(fromDay, \"MMM dd, yyyy\")}.`\n )\n }\n }\n\n if (toDay) {\n const presetDay = preset.dateRange.to?.getDate()\n\n if (presetDay && presetDay > toDay.getDate()) {\n throw new Error(\n `Preset ${preset.label}'s 'to' is after toDay ${format(\n toDay,\n \"MMM dd, yyyy\"\n )}.`\n )\n }\n }\n }\n })\n }\n}\n\nconst DatePicker = ({ mode = \"single\", ...props }: DatePickerProps) => {\n if (props.presets) {\n validatePresets(props.presets, props)\n }\n\n if (mode === \"single\") {\n return <SingleDatePicker {...(props as SingleProps)} />\n }\n\n return <RangeDatePicker {...(props as RangeProps)} />\n}\n\nexport { DatePicker }\n"]}
|
|
@@ -2,16 +2,7 @@ import { type VariantProps } from "class-variance-authority";
|
|
|
2
2
|
import * as React from "react";
|
|
3
3
|
declare const headingVariants: (props?: ({
|
|
4
4
|
level?: "h2" | "h3" | "h1" | null | undefined;
|
|
5
|
-
} & (
|
|
6
|
-
class: import("clsx").ClassValue;
|
|
7
|
-
className?: undefined;
|
|
8
|
-
} | {
|
|
9
|
-
class?: undefined;
|
|
10
|
-
className: import("clsx").ClassValue;
|
|
11
|
-
} | {
|
|
12
|
-
class?: undefined;
|
|
13
|
-
className?: undefined;
|
|
14
|
-
})) | undefined) => string;
|
|
5
|
+
} & import("class-variance-authority/dist/types").ClassProp) | undefined) => string;
|
|
15
6
|
type HeadingProps = VariantProps<typeof headingVariants> & React.HTMLAttributes<HTMLHeadingElement>;
|
|
16
7
|
declare const Heading: ({ level, className, ...props }: HeadingProps) => React.JSX.Element;
|
|
17
8
|
export { Heading, headingVariants };
|
|
@@ -2,14 +2,5 @@ import { VariantProps } from "class-variance-authority";
|
|
|
2
2
|
import * as React from "react";
|
|
3
3
|
declare const Hint: React.ForwardRefExoticComponent<VariantProps<(props?: ({
|
|
4
4
|
variant?: "error" | "info" | null | undefined;
|
|
5
|
-
} & (
|
|
6
|
-
class: import("clsx").ClassValue;
|
|
7
|
-
className?: undefined;
|
|
8
|
-
} | {
|
|
9
|
-
class?: undefined;
|
|
10
|
-
className: import("clsx").ClassValue;
|
|
11
|
-
} | {
|
|
12
|
-
class?: undefined;
|
|
13
|
-
className?: undefined;
|
|
14
|
-
})) | undefined) => string> & Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, "ref"> & React.RefAttributes<HTMLSpanElement>>;
|
|
5
|
+
} & import("class-variance-authority/dist/types").ClassProp) | undefined) => string> & Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, "ref"> & React.RefAttributes<HTMLSpanElement>>;
|
|
15
6
|
export { Hint };
|
|
@@ -3,16 +3,7 @@ import * as React from "react";
|
|
|
3
3
|
import { badgeColorVariants } from "../badge";
|
|
4
4
|
declare const iconBadgeVariants: (props?: ({
|
|
5
5
|
size?: "base" | "large" | null | undefined;
|
|
6
|
-
} & (
|
|
7
|
-
class: import("clsx").ClassValue;
|
|
8
|
-
className?: undefined;
|
|
9
|
-
} | {
|
|
10
|
-
class?: undefined;
|
|
11
|
-
className: import("clsx").ClassValue;
|
|
12
|
-
} | {
|
|
13
|
-
class?: undefined;
|
|
14
|
-
className?: undefined;
|
|
15
|
-
})) | undefined) => string;
|
|
6
|
+
} & import("class-variance-authority/dist/types").ClassProp) | undefined) => string;
|
|
16
7
|
interface IconBadgeProps extends Omit<React.ComponentPropsWithoutRef<"span">, "color">, VariantProps<typeof badgeColorVariants>, VariantProps<typeof iconBadgeVariants> {
|
|
17
8
|
asChild?: boolean;
|
|
18
9
|
}
|
|
@@ -3,16 +3,7 @@ import * as React from "react";
|
|
|
3
3
|
declare const iconButtonVariants: (props?: ({
|
|
4
4
|
variant?: "primary" | "transparent" | null | undefined;
|
|
5
5
|
size?: "base" | "large" | "xlarge" | null | undefined;
|
|
6
|
-
} & (
|
|
7
|
-
class: import("clsx").ClassValue;
|
|
8
|
-
className?: undefined;
|
|
9
|
-
} | {
|
|
10
|
-
class?: undefined;
|
|
11
|
-
className: import("clsx").ClassValue;
|
|
12
|
-
} | {
|
|
13
|
-
class?: undefined;
|
|
14
|
-
className?: undefined;
|
|
15
|
-
})) | undefined) => string;
|
|
6
|
+
} & import("class-variance-authority/dist/types").ClassProp) | undefined) => string;
|
|
16
7
|
interface IconButtonProps extends React.ComponentPropsWithoutRef<"button">, VariantProps<typeof iconButtonVariants> {
|
|
17
8
|
asChild?: boolean;
|
|
18
9
|
isLoading?: boolean;
|
|
@@ -3,14 +3,5 @@ import * as React from "react";
|
|
|
3
3
|
declare const inputBaseStyles: string;
|
|
4
4
|
declare const Input: React.ForwardRefExoticComponent<VariantProps<(props?: ({
|
|
5
5
|
size?: "base" | "small" | null | undefined;
|
|
6
|
-
} & (
|
|
7
|
-
class: import("clsx").ClassValue;
|
|
8
|
-
className?: undefined;
|
|
9
|
-
} | {
|
|
10
|
-
class?: undefined;
|
|
11
|
-
className: import("clsx").ClassValue;
|
|
12
|
-
} | {
|
|
13
|
-
class?: undefined;
|
|
14
|
-
className?: undefined;
|
|
15
|
-
})) | undefined) => string> & Omit<React.InputHTMLAttributes<HTMLInputElement>, "size"> & React.RefAttributes<HTMLInputElement>>;
|
|
6
|
+
} & import("class-variance-authority/dist/types").ClassProp) | undefined) => string> & Omit<React.InputHTMLAttributes<HTMLInputElement>, "size"> & React.RefAttributes<HTMLInputElement>>;
|
|
16
7
|
export { Input, inputBaseStyles };
|
|
@@ -3,16 +3,7 @@ import * as React from "react";
|
|
|
3
3
|
declare const labelVariants: (props?: ({
|
|
4
4
|
size?: "base" | "large" | "small" | "xsmall" | null | undefined;
|
|
5
5
|
weight?: "regular" | "plus" | null | undefined;
|
|
6
|
-
} & (
|
|
7
|
-
class: import("clsx").ClassValue;
|
|
8
|
-
className?: undefined;
|
|
9
|
-
} | {
|
|
10
|
-
class?: undefined;
|
|
11
|
-
className: import("clsx").ClassValue;
|
|
12
|
-
} | {
|
|
13
|
-
class?: undefined;
|
|
14
|
-
className?: undefined;
|
|
15
|
-
})) | undefined) => string;
|
|
6
|
+
} & import("class-variance-authority/dist/types").ClassProp) | undefined) => string;
|
|
16
7
|
interface LabelProps extends React.ComponentPropsWithoutRef<"label">, VariantProps<typeof labelVariants> {
|
|
17
8
|
}
|
|
18
9
|
declare const Label: React.ForwardRefExoticComponent<LabelProps & React.RefAttributes<HTMLLabelElement>>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./popover";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/components/popover/index.ts"],"names":[],"mappings":";;;AAAA,oDAAyB","sourcesContent":["export * from \"./popover\"\n"]}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import * as Primitives from "@radix-ui/react-popover";
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
declare const Root: {
|
|
4
|
+
(props: React.ComponentPropsWithoutRef<typeof Primitives.Root>): React.JSX.Element;
|
|
5
|
+
displayName: string;
|
|
6
|
+
};
|
|
7
|
+
declare const Popover: {
|
|
8
|
+
(props: React.ComponentPropsWithoutRef<typeof Primitives.Root>): React.JSX.Element;
|
|
9
|
+
displayName: string;
|
|
10
|
+
} & {
|
|
11
|
+
Trigger: React.ForwardRefExoticComponent<Omit<Primitives.PopoverTriggerProps & React.RefAttributes<HTMLButtonElement>, "ref"> & React.RefAttributes<HTMLButtonElement>>;
|
|
12
|
+
Anchor: React.ForwardRefExoticComponent<Omit<Primitives.PopoverAnchorProps & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
13
|
+
Close: React.ForwardRefExoticComponent<Omit<Primitives.PopoverCloseProps & React.RefAttributes<HTMLButtonElement>, "ref"> & React.RefAttributes<HTMLButtonElement>>;
|
|
14
|
+
Content: React.ForwardRefExoticComponent<Omit<Primitives.PopoverContentProps & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
15
|
+
Seperator: React.ForwardRefExoticComponent<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
16
|
+
};
|
|
17
|
+
export { Popover };
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Popover = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const Primitives = tslib_1.__importStar(require("@radix-ui/react-popover"));
|
|
6
|
+
const React = tslib_1.__importStar(require("react"));
|
|
7
|
+
const clx_1 = require("../../utils/clx");
|
|
8
|
+
const Root = (props) => {
|
|
9
|
+
return React.createElement(Primitives.Root, { ...props });
|
|
10
|
+
};
|
|
11
|
+
Root.displayName = "Popover";
|
|
12
|
+
const Trigger = React.forwardRef((props, ref) => {
|
|
13
|
+
return React.createElement(Primitives.Trigger, { ref: ref, ...props });
|
|
14
|
+
});
|
|
15
|
+
Trigger.displayName = "Popover.Trigger";
|
|
16
|
+
const Anchor = React.forwardRef((props, ref) => {
|
|
17
|
+
return React.createElement(Primitives.Anchor, { ref: ref, ...props });
|
|
18
|
+
});
|
|
19
|
+
Anchor.displayName = "Popover.Anchor";
|
|
20
|
+
const Close = React.forwardRef((props, ref) => {
|
|
21
|
+
return React.createElement(Primitives.Close, { ref: ref, ...props });
|
|
22
|
+
});
|
|
23
|
+
Close.displayName = "Popover.Close";
|
|
24
|
+
const Content = React.forwardRef(({ className, sideOffset = 8, side = "bottom", align = "start", collisionPadding, ...props }, ref) => {
|
|
25
|
+
return (React.createElement(Primitives.Portal, null,
|
|
26
|
+
React.createElement(Primitives.Content, { ref: ref, sideOffset: sideOffset, side: side, align: align, collisionPadding: collisionPadding, className: (0, clx_1.clx)("bg-ui-bg-base text-ui-fg-base shadow-elevation-flyout max-h-[var(--radix-popper-available-height)] min-w-[220px] overflow-hidden rounded-lg p-1", "data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2", className), ...props })));
|
|
27
|
+
});
|
|
28
|
+
Content.displayName = "Popover.Content";
|
|
29
|
+
const Seperator = React.forwardRef(({ className, ...props }, ref) => {
|
|
30
|
+
return (React.createElement("div", { ref: ref, className: (0, clx_1.clx)("bg-ui-border-base -mx-1 my-1 h-px", className), ...props }));
|
|
31
|
+
});
|
|
32
|
+
Seperator.displayName = "Popover.Seperator";
|
|
33
|
+
const Popover = Object.assign(Root, {
|
|
34
|
+
Trigger,
|
|
35
|
+
Anchor,
|
|
36
|
+
Close,
|
|
37
|
+
Content,
|
|
38
|
+
Seperator,
|
|
39
|
+
});
|
|
40
|
+
exports.Popover = Popover;
|
|
41
|
+
//# sourceMappingURL=popover.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"popover.js","sourceRoot":"","sources":["../../../../src/components/popover/popover.tsx"],"names":[],"mappings":";;;;AAAA,4EAAqD;AACrD,qDAA8B;AAE9B,qCAAiC;AAEjC,MAAM,IAAI,GAAG,CACX,KAA6D,EAC7D,EAAE;IACF,OAAO,oBAAC,UAAU,CAAC,IAAI,OAAK,KAAK,GAAI,CAAA;AACvC,CAAC,CAAA;AACD,IAAI,CAAC,WAAW,GAAG,SAAS,CAAA;AAE5B,MAAM,OAAO,GAAG,KAAK,CAAC,UAAU,CAG9B,CAAC,KAAK,EAAE,GAAG,EAAE,EAAE;IACf,OAAO,oBAAC,UAAU,CAAC,OAAO,IAAC,GAAG,EAAE,GAAG,KAAM,KAAK,GAAI,CAAA;AACpD,CAAC,CAAC,CAAA;AACF,OAAO,CAAC,WAAW,GAAG,iBAAiB,CAAA;AAEvC,MAAM,MAAM,GAAG,KAAK,CAAC,UAAU,CAG7B,CAAC,KAAK,EAAE,GAAG,EAAE,EAAE;IACf,OAAO,oBAAC,UAAU,CAAC,MAAM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AE3C,MAAM,OAAO,GAAG,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE;IAClC,OAAO;IACP,MAAM;IACN,KAAK;IACL,OAAO;IACP,SAAS;CACV,CAAC,CAAA;AAEO,0BAAO","sourcesContent":["import * as Primitives from \"@radix-ui/react-popover\"\nimport * as React from \"react\"\n\nimport { clx } from \"@/utils/clx\"\n\nconst Root = (\n props: React.ComponentPropsWithoutRef<typeof Primitives.Root>\n) => {\n return <Primitives.Root {...props} />\n}\nRoot.displayName = \"Popover\"\n\nconst Trigger = React.forwardRef<\n React.ElementRef<typeof Primitives.Trigger>,\n React.ComponentPropsWithoutRef<typeof Primitives.Trigger>\n>((props, ref) => {\n return <Primitives.Trigger ref={ref} {...props} />\n})\nTrigger.displayName = \"Popover.Trigger\"\n\nconst Anchor = React.forwardRef<\n React.ElementRef<typeof Primitives.Anchor>,\n React.ComponentPropsWithoutRef<typeof Primitives.Anchor>\n>((props, ref) => {\n return <Primitives.Anchor ref={ref} {...props} />\n})\nAnchor.displayName = \"Popover.Anchor\"\n\nconst Close = React.forwardRef<\n React.ElementRef<typeof Primitives.Close>,\n React.ComponentPropsWithoutRef<typeof Primitives.Close>\n>((props, ref) => {\n return <Primitives.Close ref={ref} {...props} />\n})\nClose.displayName = \"Popover.Close\"\n\nconst Content = React.forwardRef<\n React.ElementRef<typeof Primitives.Content>,\n React.ComponentPropsWithoutRef<typeof Primitives.Content>\n>(\n (\n {\n className,\n sideOffset = 8,\n side = \"bottom\",\n align = \"start\",\n collisionPadding,\n ...props\n },\n ref\n ) => {\n return (\n <Primitives.Portal>\n <Primitives.Content\n ref={ref}\n sideOffset={sideOffset}\n side={side}\n align={align}\n collisionPadding={collisionPadding}\n className={clx(\n \"bg-ui-bg-base text-ui-fg-base shadow-elevation-flyout max-h-[var(--radix-popper-available-height)] min-w-[220px] overflow-hidden rounded-lg p-1\",\n \"data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2\",\n className\n )}\n {...props}\n />\n </Primitives.Portal>\n )\n }\n)\nContent.displayName = \"Popover.Content\"\n\nconst Seperator = React.forwardRef<\n HTMLDivElement,\n React.ComponentPropsWithoutRef<\"div\">\n>(({ className, ...props }, ref) => {\n return (\n <div\n ref={ref}\n className={clx(\"bg-ui-border-base -mx-1 my-1 h-px\", className)}\n {...props}\n />\n )\n})\nSeperator.displayName = \"Popover.Seperator\"\n\nconst Popover = Object.assign(Root, {\n Trigger,\n Anchor,\n Close,\n Content,\n Seperator,\n})\n\nexport { Popover }\n"]}
|