@brett_lamy/ui 5.0.0 → 5.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/dist/components/calendar.d.ts +26 -0
- package/dist/components/calendar.d.ts.map +1 -0
- package/dist/components/calendar.js +97 -0
- package/dist/components/color-field.d.ts +22 -0
- package/dist/components/color-field.d.ts.map +1 -0
- package/dist/components/color-field.js +60 -0
- package/dist/components/color-picker.d.ts +49 -0
- package/dist/components/color-picker.d.ts.map +1 -0
- package/dist/components/color-picker.js +121 -0
- package/dist/components/date-field.d.ts +19 -0
- package/dist/components/date-field.d.ts.map +1 -0
- package/dist/components/date-field.js +79 -0
- package/dist/components/date-picker.d.ts +38 -0
- package/dist/components/date-picker.d.ts.map +1 -0
- package/dist/components/date-picker.js +110 -0
- package/dist/components/spinner-shapes.d.ts +36 -0
- package/dist/components/spinner-shapes.d.ts.map +1 -1
- package/dist/components/spinner-shapes.js +105 -0
- package/dist/components/spinner.d.ts +1 -1
- package/dist/components/spinner.d.ts.map +1 -1
- package/dist/index.css +1 -1
- package/dist/index.d.ts +5 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +45 -40
- package/package.json +3 -2
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { ComponentProps } from 'react';
|
|
2
|
+
import { CalendarProps as AriaCalendarProps, CalendarCellProps as AriaCalendarCellProps, CalendarGridProps as AriaCalendarGridProps, RangeCalendarProps as AriaRangeCalendarProps, DateValue } from 'react-aria-components';
|
|
3
|
+
import { VariantProps } from 'class-variance-authority';
|
|
4
|
+
export declare const calendarVariants: (props?: ({
|
|
5
|
+
variant?: "card" | "plain" | null | undefined;
|
|
6
|
+
} & import('class-variance-authority/types').ClassProp) | undefined) => string;
|
|
7
|
+
/** Previous / next buttons around the month and year. Must sit inside a Calendar or RangeCalendar. */
|
|
8
|
+
export declare function CalendarHeader({ className, ...props }: ComponentProps<'header'>): import("react/jsx-runtime").JSX.Element;
|
|
9
|
+
export interface CalendarCellProps extends Omit<AriaCalendarCellProps, 'children'> {
|
|
10
|
+
}
|
|
11
|
+
/** One day. In a RangeCalendar the days between the ends are joined by a band; today is tinted. */
|
|
12
|
+
export declare function CalendarCell({ className, date, ...props }: CalendarCellProps): import("react/jsx-runtime").JSX.Element;
|
|
13
|
+
/** A month: the weekday row and its days. `offset` shifts it forward by months (for a multi-month calendar). */
|
|
14
|
+
export declare function CalendarGrid({ className, ...props }: Omit<AriaCalendarGridProps, 'children'>): import("react/jsx-runtime").JSX.Element;
|
|
15
|
+
interface CalendarExtras extends VariantProps<typeof calendarVariants> {
|
|
16
|
+
/** How many months to show side by side. Default: 1. */
|
|
17
|
+
visibleMonths?: 1 | 2 | 3;
|
|
18
|
+
}
|
|
19
|
+
export interface CalendarProps<T extends DateValue> extends AriaCalendarProps<T>, CalendarExtras {
|
|
20
|
+
}
|
|
21
|
+
export declare function Calendar<T extends DateValue>({ className, variant, visibleMonths, children, ...props }: CalendarProps<T>): import("react/jsx-runtime").JSX.Element;
|
|
22
|
+
export interface RangeCalendarProps<T extends DateValue> extends AriaRangeCalendarProps<T>, CalendarExtras {
|
|
23
|
+
}
|
|
24
|
+
export declare function RangeCalendar<T extends DateValue>({ className, variant, visibleMonths, children, ...props }: RangeCalendarProps<T>): import("react/jsx-runtime").JSX.Element;
|
|
25
|
+
export {};
|
|
26
|
+
//# sourceMappingURL=calendar.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"calendar.d.ts","sourceRoot":"","sources":["../../src/components/calendar.tsx"],"names":[],"mappings":"AACA,OAAO,EAAc,KAAK,cAAc,EAAE,MAAM,OAAO,CAAC;AAExD,OAAO,EACqB,KAAK,aAAa,IAAI,iBAAiB,EAC/B,KAAK,iBAAiB,IAAI,qBAAqB,EAC/C,KAAK,iBAAiB,IAAI,qBAAqB,EAE7C,KAAK,kBAAkB,IAAI,sBAAsB,EAIrF,KAAK,SAAS,EACf,MAAM,uBAAuB,C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
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { cn as e } from "../lib/utils.js";
|
|
3
|
+
import { Icon as t } from "../lib/icon.js";
|
|
4
|
+
import { Button as n } from "./button.js";
|
|
5
|
+
import { useContext as r } from "react";
|
|
6
|
+
import { Fragment as i, jsx as a, jsxs as o } from "react/jsx-runtime";
|
|
7
|
+
import { Calendar as s, CalendarCell as c, CalendarGrid as l, CalendarGridBody as u, CalendarGridHeader as d, CalendarHeaderCell as f, Heading as p, RangeCalendar as m, RangeCalendarStateContext as h, composeRenderProps as g } from "react-aria-components";
|
|
8
|
+
import { cva as _ } from "class-variance-authority";
|
|
9
|
+
import { getLocalTimeZone as v, isToday as y } from "@internationalized/date";
|
|
10
|
+
//#region src/components/calendar.tsx
|
|
11
|
+
var b = _("flex w-fit max-w-full flex-col text-foreground data-disabled:opacity-50", {
|
|
12
|
+
variants: { variant: {
|
|
13
|
+
plain: "",
|
|
14
|
+
card: "rounded-panel bg-secondary p-3"
|
|
15
|
+
} },
|
|
16
|
+
defaultVariants: { variant: "plain" }
|
|
17
|
+
});
|
|
18
|
+
function x({ className: r, ...i }) {
|
|
19
|
+
return /* @__PURE__ */ o("header", {
|
|
20
|
+
"data-slot": "calendar-header",
|
|
21
|
+
className: e("flex items-center gap-1 pb-2", r),
|
|
22
|
+
...i,
|
|
23
|
+
children: [
|
|
24
|
+
/* @__PURE__ */ a(n, {
|
|
25
|
+
slot: "previous",
|
|
26
|
+
variant: "quiet",
|
|
27
|
+
size: "icon",
|
|
28
|
+
className: "size-8",
|
|
29
|
+
children: /* @__PURE__ */ a(t, {
|
|
30
|
+
name: "chevron-left",
|
|
31
|
+
size: 16
|
|
32
|
+
})
|
|
33
|
+
}),
|
|
34
|
+
/* @__PURE__ */ a(p, { className: "min-w-0 flex-1 truncate text-center text-subhead font-semibold" }),
|
|
35
|
+
/* @__PURE__ */ a(n, {
|
|
36
|
+
slot: "next",
|
|
37
|
+
variant: "quiet",
|
|
38
|
+
size: "icon",
|
|
39
|
+
className: "size-8",
|
|
40
|
+
children: /* @__PURE__ */ a(t, {
|
|
41
|
+
name: "chevron-right",
|
|
42
|
+
size: 16
|
|
43
|
+
})
|
|
44
|
+
})
|
|
45
|
+
]
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
function S({ className: t, date: n, ...i }) {
|
|
49
|
+
let o = r(h) != null, s = y(n, v());
|
|
50
|
+
return /* @__PURE__ */ a(c, {
|
|
51
|
+
"data-slot": "calendar-cell",
|
|
52
|
+
date: n,
|
|
53
|
+
className: g(t, (t) => e("group/cell relative flex size-9 cursor-default items-center justify-center text-subhead outline-none data-outside-month:invisible data-disabled:opacity-30", o && "before:absolute before:inset-y-0 before:inset-x-0 before:hidden before:bg-primary/15 data-selected:before:block data-selection-start:before:left-1/2 data-selection-end:before:right-1/2", t)),
|
|
54
|
+
...i,
|
|
55
|
+
children: ({ formattedDate: t }) => /* @__PURE__ */ a("span", {
|
|
56
|
+
className: e("relative z-1 grid size-9 place-items-center rounded-full tabular-nums transition-colors duration-spring-snappy ease-spring-snappy", "cursor-pointer not-group-data-selected/cell:group-data-hovered/cell:bg-secondary-strong group-data-focus-visible/cell:ring-2 group-data-focus-visible/cell:ring-ring", "group-data-unavailable/cell:text-destructive group-data-unavailable/cell:line-through group-data-disabled/cell:cursor-default", s && "font-semibold text-primary", o ? "group-data-selection-start/cell:bg-primary group-data-selection-start/cell:text-primary-foreground group-data-selection-end/cell:bg-primary group-data-selection-end/cell:text-primary-foreground" : "group-data-selected/cell:bg-primary group-data-selected/cell:text-primary-foreground"),
|
|
57
|
+
children: t
|
|
58
|
+
})
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
function C({ className: t, ...n }) {
|
|
62
|
+
return /* @__PURE__ */ o(l, {
|
|
63
|
+
"data-slot": "calendar-grid",
|
|
64
|
+
className: e("border-separate border-spacing-0", t),
|
|
65
|
+
...n,
|
|
66
|
+
children: [/* @__PURE__ */ a(d, { children: (e) => /* @__PURE__ */ a(f, {
|
|
67
|
+
className: "h-8 text-center text-caption font-medium text-muted-foreground",
|
|
68
|
+
children: e
|
|
69
|
+
}) }), /* @__PURE__ */ a(u, { children: (e) => /* @__PURE__ */ a(S, { date: e }) })]
|
|
70
|
+
});
|
|
71
|
+
}
|
|
72
|
+
function w({ count: e }) {
|
|
73
|
+
return /* @__PURE__ */ a("div", {
|
|
74
|
+
className: "flex gap-6",
|
|
75
|
+
children: Array.from({ length: e }, (e, t) => /* @__PURE__ */ a(C, { offset: { months: t } }, t))
|
|
76
|
+
});
|
|
77
|
+
}
|
|
78
|
+
function T({ className: t, variant: n, visibleMonths: r = 1, children: c, ...l }) {
|
|
79
|
+
return /* @__PURE__ */ a(s, {
|
|
80
|
+
"data-slot": "calendar",
|
|
81
|
+
visibleDuration: { months: r },
|
|
82
|
+
className: g(t, (t) => e(b({ variant: n }), t)),
|
|
83
|
+
...l,
|
|
84
|
+
children: c ?? /* @__PURE__ */ o(i, { children: [/* @__PURE__ */ a(x, {}), /* @__PURE__ */ a(w, { count: r })] })
|
|
85
|
+
});
|
|
86
|
+
}
|
|
87
|
+
function E({ className: t, variant: n, visibleMonths: r = 1, children: s, ...c }) {
|
|
88
|
+
return /* @__PURE__ */ a(m, {
|
|
89
|
+
"data-slot": "range-calendar",
|
|
90
|
+
visibleDuration: { months: r },
|
|
91
|
+
className: g(t, (t) => e(b({ variant: n }), t)),
|
|
92
|
+
...c,
|
|
93
|
+
children: s ?? /* @__PURE__ */ o(i, { children: [/* @__PURE__ */ a(x, {}), /* @__PURE__ */ a(w, { count: r })] })
|
|
94
|
+
});
|
|
95
|
+
}
|
|
96
|
+
//#endregion
|
|
97
|
+
export { T as Calendar, S as CalendarCell, C as CalendarGrid, x as CalendarHeader, E as RangeCalendar, b as calendarVariants };
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { ComponentProps } from 'react';
|
|
2
|
+
import { ColorFieldProps as AriaColorFieldProps, ColorSwatchProps as AriaColorSwatchProps, Group, InputProps as AriaInputProps } from 'react-aria-components';
|
|
3
|
+
import { VariantProps } from 'class-variance-authority';
|
|
4
|
+
export interface ColorFieldProps extends AriaColorFieldProps {
|
|
5
|
+
}
|
|
6
|
+
export declare function ColorField({ className, ...props }: ColorFieldProps): import("react/jsx-runtime").JSX.Element;
|
|
7
|
+
export declare const colorFieldGroupVariants: (props?: ({
|
|
8
|
+
size?: "default" | "sm" | "lg" | null | undefined;
|
|
9
|
+
} & import('class-variance-authority/types').ClassProp) | undefined) => string;
|
|
10
|
+
export interface ColorFieldGroupProps extends ComponentProps<typeof Group>, VariantProps<typeof colorFieldGroupVariants> {
|
|
11
|
+
}
|
|
12
|
+
/** The filled field around a swatch and the input. Without a swatch, a plain `Input` from the library does the same job. */
|
|
13
|
+
export declare function ColorFieldGroup({ className, size, ...props }: ColorFieldGroupProps): import("react/jsx-runtime").JSX.Element;
|
|
14
|
+
/** The text box inside a ColorFieldGroup: no fill or outline of its own. */
|
|
15
|
+
export declare function ColorFieldInput({ className, ...props }: AriaInputProps): import("react/jsx-runtime").JSX.Element;
|
|
16
|
+
export interface ColorSwatchProps extends AriaColorSwatchProps {
|
|
17
|
+
}
|
|
18
|
+
/** A color chip. Give it a `color`, or place it where a color is in context (a ColorPicker, ColorFieldSwatch …). */
|
|
19
|
+
export declare function ColorSwatch({ className, ...props }: ColorSwatchProps): import("react/jsx-runtime").JSX.Element;
|
|
20
|
+
/** A swatch of what the surrounding ColorField currently holds (clear while the field is empty or unparsable). */
|
|
21
|
+
export declare function ColorFieldSwatch({ className, ...props }: Omit<ColorSwatchProps, 'color'>): import("react/jsx-runtime").JSX.Element;
|
|
22
|
+
//# sourceMappingURL=color-field.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"color-field.d.ts","sourceRoot":"","sources":["../../src/components/color-field.tsx"],"names":[],"mappings":"AACA,OAAO,EAAc,KAAK,cAAc,EAAE,MAAM,OAAO,CAAC;AACxD,OAAO,EACyB,KAAK,eAAe,IAAI,mBAAmB,EAEzC,KAAK,gBAAgB,IAAI,oBAAoB,EAC7E,KAAK,EACe,KAAK,UAAU,IAAI,cAAc,EAGtD,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAO,KAAK,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAalE,MAAM,WAAW,eAAgB,SAAQ,mBAAmB;CAAG;AAE/D,wBAAgB,UAAU,CAAC,EAAE,SAAS,EAAE,GAAG,KAAK,EAAE,EAAE,eAAe,2CAQlE;AAED,eAAO,MAAM,uBAAuB;;8EAgBnC,CAAC;AAEF,MAAM,WAAW,oBAAqB,SAAQ,cAAc,CAAC,OAAO,KAAK,CAAC,EAAE,YAAY,CAAC,OAAO,uBAAuB,CAAC;CAAG;AAE3H,4HAA4H;AAC5H,wBAAgB,eAAe,CAAC,EAAE,SAAS,EAAE,IAAI,EAAE,GAAG,KAAK,EAAE,EAAE,oBAAoB,2CAQlF;AAED,4EAA4E;AAC5E,wBAAgB,eAAe,CAAC,EAAE,SAAS,EAAE,GAAG,KAAK,EAAE,EAAE,cAAc,2CAUtE;AAID,MAAM,WAAW,gBAAiB,SAAQ,oBAAoB;CAAG;AAEjE,oHAAoH;AACpH,wBAAgB,WAAW,CAAC,EAAE,SAAS,EAAE,GAAG,KAAK,EAAE,EAAE,gBAAgB,2CAQpE;AAED,kHAAkH;AAClH,wBAAgB,gBAAgB,CAAC,EAAE,SAAS,EAAE,GAAG,KAAK,EAAE,EAAE,IAAI,CAAC,gBAAgB,EAAE,OAAO,CAAC,2CAGxF"}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { cn as e } from "../lib/utils.js";
|
|
3
|
+
import { selectableText as t } from "../lib/primitives.js";
|
|
4
|
+
import { useContext as n } from "react";
|
|
5
|
+
import { jsx as r } from "react/jsx-runtime";
|
|
6
|
+
import { ColorField as i, ColorFieldStateContext as a, ColorSwatch as o, Group as s, Input as c, composeRenderProps as l, parseColor as u } from "react-aria-components";
|
|
7
|
+
import { cva as d } from "class-variance-authority";
|
|
8
|
+
//#region src/components/color-field.tsx
|
|
9
|
+
function f({ className: t, ...n }) {
|
|
10
|
+
return /* @__PURE__ */ r(i, {
|
|
11
|
+
"data-slot": "color-field",
|
|
12
|
+
className: l(t, (t) => e("group flex flex-col gap-1.5", t)),
|
|
13
|
+
...n
|
|
14
|
+
});
|
|
15
|
+
}
|
|
16
|
+
var p = d([
|
|
17
|
+
"box-border flex w-full min-w-0 items-center gap-2 bg-input px-3 text-foreground outline-none transition-[box-shadow,background-color] duration-spring-snappy ease-spring-snappy",
|
|
18
|
+
"data-focus-within:bg-transparent data-focus-within:ring-[1.5px] data-focus-within:ring-primary data-focus-within:ring-inset",
|
|
19
|
+
"data-invalid:ring-[1.5px] data-invalid:ring-destructive data-invalid:ring-inset data-disabled:cursor-not-allowed data-disabled:opacity-50"
|
|
20
|
+
], {
|
|
21
|
+
variants: { size: {
|
|
22
|
+
sm: "h-8 rounded-lg text-subhead",
|
|
23
|
+
default: "h-11 rounded-ctl text-body",
|
|
24
|
+
lg: "h-[50px] rounded-xl text-body"
|
|
25
|
+
} },
|
|
26
|
+
defaultVariants: { size: "default" }
|
|
27
|
+
});
|
|
28
|
+
function m({ className: t, size: n, ...i }) {
|
|
29
|
+
return /* @__PURE__ */ r(s, {
|
|
30
|
+
"data-slot": "color-field-group",
|
|
31
|
+
className: l(t, (t) => e(p({ size: n }), t)),
|
|
32
|
+
...i
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
function h({ className: n, ...i }) {
|
|
36
|
+
return /* @__PURE__ */ r(c, {
|
|
37
|
+
"data-slot": "color-field-input",
|
|
38
|
+
className: l(n, (n) => e("h-full min-w-0 flex-1 border-0 bg-transparent p-0 [font-family:inherit] [font-size:inherit] text-foreground outline-none placeholder:text-tertiary-foreground", t, n)),
|
|
39
|
+
...i
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
var g = u("hsla(0, 0%, 0%, 0)");
|
|
43
|
+
function _({ className: t, ...n }) {
|
|
44
|
+
return /* @__PURE__ */ r(o, {
|
|
45
|
+
"data-slot": "color-swatch",
|
|
46
|
+
className: l(t, (t) => e("size-6 shrink-0 rounded-full shadow-hairline", t)),
|
|
47
|
+
...n
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
function v({ className: e, ...t }) {
|
|
51
|
+
let i = n(a);
|
|
52
|
+
return /* @__PURE__ */ r(_, {
|
|
53
|
+
"data-slot": "color-field-swatch",
|
|
54
|
+
className: e,
|
|
55
|
+
color: i?.colorValue ?? g,
|
|
56
|
+
...t
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
//#endregion
|
|
60
|
+
export { f as ColorField, m as ColorFieldGroup, h as ColorFieldInput, v as ColorFieldSwatch, _ as ColorSwatch, p as colorFieldGroupVariants };
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
import { ColorAreaProps as AriaColorAreaProps, ColorPicker as AriaColorPicker, ColorPickerProps as AriaColorPickerProps, ColorSliderProps as AriaColorSliderProps, ColorSwatchPickerProps as AriaColorSwatchPickerProps, ColorSwatchPickerItemProps as AriaColorSwatchPickerItemProps, ColorThumbProps as AriaColorThumbProps } from 'react-aria-components';
|
|
3
|
+
import { ButtonProps } from './button';
|
|
4
|
+
import { PopoverProps } from './popover';
|
|
5
|
+
export declare const ColorPicker: typeof AriaColorPicker;
|
|
6
|
+
export type ColorPickerProps = AriaColorPickerProps;
|
|
7
|
+
export interface ColorThumbProps extends AriaColorThumbProps {
|
|
8
|
+
}
|
|
9
|
+
/** The draggable handle of a ColorArea or ColorSlider; it is filled with the color it sits on. */
|
|
10
|
+
export declare function ColorThumb({ className, ...props }: ColorThumbProps): import("react/jsx-runtime").JSX.Element;
|
|
11
|
+
export interface ColorAreaProps extends AriaColorAreaProps {
|
|
12
|
+
}
|
|
13
|
+
/** A square of two channels (saturation across, brightness up by default). The background is the color space itself, so it
|
|
14
|
+
sets its own `style`; size it with `className` (`h-40 w-full`). */
|
|
15
|
+
export declare function ColorArea({ className, colorSpace, xChannel, yChannel, ...props }: ColorAreaProps): import("react/jsx-runtime").JSX.Element;
|
|
16
|
+
export interface ColorSliderProps extends AriaColorSliderProps {
|
|
17
|
+
/** Text above the track, naming the channel. Without it, pass `aria-label`. */
|
|
18
|
+
label?: ReactNode;
|
|
19
|
+
/** Show the channel's value opposite the label. */
|
|
20
|
+
showValue?: boolean;
|
|
21
|
+
}
|
|
22
|
+
/** One channel as a gradient track (`channel="hue"`, `"alpha"`, `"saturation"` …; `colorSpace` picks the model). The alpha
|
|
23
|
+
track sits on a checkerboard. */
|
|
24
|
+
export declare function ColorSlider({ className, label, showValue, ...props }: ColorSliderProps): import("react/jsx-runtime").JSX.Element;
|
|
25
|
+
export interface ColorSwatchPickerProps extends AriaColorSwatchPickerProps {
|
|
26
|
+
}
|
|
27
|
+
/** A row of preset colors; one at a time is selected. Fill it with ColorSwatchPickerItems. */
|
|
28
|
+
export declare function ColorSwatchPicker({ className, ...props }: ColorSwatchPickerProps): import("react/jsx-runtime").JSX.Element;
|
|
29
|
+
export interface ColorSwatchPickerItemProps extends Omit<AriaColorSwatchPickerItemProps, 'children'> {
|
|
30
|
+
}
|
|
31
|
+
export declare function ColorSwatchPickerItem({ className, ...props }: ColorSwatchPickerItemProps): import("react/jsx-runtime").JSX.Element;
|
|
32
|
+
export interface ColorPickerTriggerProps extends Omit<ButtonProps, 'variant' | 'size' | 'children'> {
|
|
33
|
+
size?: 'sm' | 'default' | 'lg';
|
|
34
|
+
/** Show the hex value beside the swatch. Default: true. */
|
|
35
|
+
showValue?: boolean;
|
|
36
|
+
}
|
|
37
|
+
/** A filled button showing the current color (and its hex, with the opacity when it is below 1); press it to open the ColorPickerContent beside it. */
|
|
38
|
+
export declare function ColorPickerTrigger({ className, size, showValue, ...props }: ColorPickerTriggerProps): import("react/jsx-runtime").JSX.Element;
|
|
39
|
+
export interface ColorPickerContentProps extends Omit<PopoverProps, 'children'> {
|
|
40
|
+
/** Preset colors shown as a row of swatches under the sliders. */
|
|
41
|
+
swatches?: readonly string[];
|
|
42
|
+
/** Add an opacity slider. Default: false. */
|
|
43
|
+
alpha?: boolean;
|
|
44
|
+
/** Replace the default area, hue slider, hex field and swatches. */
|
|
45
|
+
children?: ReactNode;
|
|
46
|
+
}
|
|
47
|
+
/** The popover: a ColorArea, a hue slider, an optional opacity slider, a hex field and optional swatches. */
|
|
48
|
+
export declare function ColorPickerContent({ swatches, alpha, children, className, placement, ...props }: ColorPickerContentProps): import("react/jsx-runtime").JSX.Element;
|
|
49
|
+
//# sourceMappingURL=color-picker.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"color-picker.d.ts","sourceRoot":"","sources":["../../src/components/color-picker.tsx"],"names":[],"mappings":"AACA,OAAO,EAAc,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AACnD,OAAO,EACuB,KAAK,cAAc,IAAI,kBAAkB,EACrE,WAAW,IAAI,eAAe,EAAE,KAAK,gBAAgB,IAAI,oBAAoB,EAE7C,KAAK,gBAAgB,IAAI,oBAAoB,EACjC,KAAK,sBAAsB,IAAI,0BAA0B,EACjD,KAAK,0BAA0B,IAAI,8BAA8B,EACvF,KAAK,eAAe,IAAI,mBAAmB,EAK1E,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAU,KAAK,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAGlE,OAAO,EAAW,KAAK,YAAY,EAAE,MAAM,yBAAyB,CAAC;AAcrE,eAAO,MAAM,WAAW,wBAAkB,CAAC;AAC3C,MAAM,MAAM,gBAAgB,GAAG,oBAAoB,CAAC;AAEpD,MAAM,WAAW,eAAgB,SAAQ,mBAAmB;CAAG;AAE/D,kGAAkG;AAClG,wBAAgB,UAAU,CAAC,EAAE,SAAS,EAAE,GAAG,KAAK,EAAE,EAAE,eAAe,2CAclE;AAED,MAAM,WAAW,cAAe,SAAQ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;IAC7C,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,oEAAoE;IACpE,QAAQ,CAAC,EAAE,SAAS,CAAC;CACtB;AAED,6GAA6G;AAC7G,wBAAgB,kBAAkB,CAAC,EAAE,QAAQ,EAAE,KAAK,EAAE,QAAQ,EAAE,SAAS,EAAE,SAA0B,EAAE,GAAG,KAAK,EAAE,EAAE,uBAAuB,2CAyBzI"}
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { cn as e } from "../lib/utils.js";
|
|
3
|
+
import { Button as t } from "./button.js";
|
|
4
|
+
import { Label as n } from "./label.js";
|
|
5
|
+
import { Popover as r } from "./popover.js";
|
|
6
|
+
import { ColorField as i, ColorFieldGroup as a, ColorFieldInput as o, ColorFieldSwatch as s, ColorSwatch as c } from "./color-field.js";
|
|
7
|
+
import { useContext as l } from "react";
|
|
8
|
+
import { Fragment as u, jsx as d, jsxs as f } from "react/jsx-runtime";
|
|
9
|
+
import { ColorArea as p, ColorPicker as m, ColorPickerStateContext as h, ColorSlider as g, ColorSwatchPicker as _, ColorSwatchPickerItem as v, ColorThumb as y, Dialog as b, SliderOutput as x, SliderTrack as S, composeRenderProps as C } from "react-aria-components";
|
|
10
|
+
//#region src/components/color-picker.tsx
|
|
11
|
+
var w = m;
|
|
12
|
+
function T({ className: t, ...n }) {
|
|
13
|
+
return /* @__PURE__ */ d(y, {
|
|
14
|
+
"data-slot": "color-thumb",
|
|
15
|
+
className: C(t, (t) => e("box-border size-6 rounded-full border-2 border-white shadow-md outline-none transition-[width,height] duration-spring-snappy ease-spring-snappy motion-reduce:transition-none", "data-dragging:size-7 data-focus-visible:size-7 data-focus-visible:ring-2 data-focus-visible:ring-ring", t)),
|
|
16
|
+
...n
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
function E({ className: t, colorSpace: n = "hsb", xChannel: r = "saturation", yChannel: i = "brightness", ...a }) {
|
|
20
|
+
return /* @__PURE__ */ d(p, {
|
|
21
|
+
"data-slot": "color-area",
|
|
22
|
+
colorSpace: n,
|
|
23
|
+
xChannel: r,
|
|
24
|
+
yChannel: i,
|
|
25
|
+
className: C(t, (t) => e("size-48 shrink-0 rounded-panel data-disabled:opacity-50", t)),
|
|
26
|
+
...a,
|
|
27
|
+
children: /* @__PURE__ */ d(T, {})
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
function D({ className: t, label: r, showValue: i, ...a }) {
|
|
31
|
+
let o = a.channel === "alpha";
|
|
32
|
+
return /* @__PURE__ */ f(g, {
|
|
33
|
+
"data-slot": "color-slider",
|
|
34
|
+
className: C(t, (t) => e("group flex w-full flex-col gap-1.5 data-disabled:opacity-50", t)),
|
|
35
|
+
...a,
|
|
36
|
+
children: [r || i ? /* @__PURE__ */ f("div", {
|
|
37
|
+
className: "flex items-center justify-between text-footnote",
|
|
38
|
+
children: [r ? /* @__PURE__ */ d(n, {
|
|
39
|
+
variant: "field",
|
|
40
|
+
children: r
|
|
41
|
+
}) : /* @__PURE__ */ d("span", {}), i ? /* @__PURE__ */ d(x, { className: "px-1 text-foreground/70 tabular-nums" }) : null]
|
|
42
|
+
}) : null, /* @__PURE__ */ d(S, {
|
|
43
|
+
className: "h-6 w-full rounded-full",
|
|
44
|
+
style: ({ defaultStyle: e }) => o ? {
|
|
45
|
+
...e,
|
|
46
|
+
background: `${e.background}, repeating-conic-gradient(var(--secondary-strong) 0% 25%, var(--background) 0% 50%) 50% / 12px 12px`
|
|
47
|
+
} : e,
|
|
48
|
+
children: /* @__PURE__ */ d(T, { className: "top-1/2" })
|
|
49
|
+
})]
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
function O({ className: t, ...n }) {
|
|
53
|
+
return /* @__PURE__ */ d(_, {
|
|
54
|
+
"data-slot": "color-swatch-picker",
|
|
55
|
+
className: C(t, (t) => e("flex flex-wrap gap-2", t)),
|
|
56
|
+
...n
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
function k({ className: t, ...n }) {
|
|
60
|
+
return /* @__PURE__ */ d(v, {
|
|
61
|
+
"data-slot": "color-swatch-picker-item",
|
|
62
|
+
className: C(t, (t) => e("size-7 cursor-pointer rounded-full outline-none transition-transform duration-spring-snappy ease-spring-snappy data-hovered:scale-110 motion-reduce:transition-none", "data-selected:ring-2 data-selected:ring-ring data-selected:ring-offset-2 data-selected:ring-offset-popover data-focus-visible:ring-2 data-focus-visible:ring-ring data-focus-visible:ring-offset-2 data-focus-visible:ring-offset-popover", t)),
|
|
63
|
+
...n,
|
|
64
|
+
children: /* @__PURE__ */ d(c, { className: "size-full" })
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
var A = {
|
|
68
|
+
sm: "h-8 rounded-lg text-subhead",
|
|
69
|
+
default: "h-11 rounded-ctl text-body",
|
|
70
|
+
lg: "h-[50px] rounded-xl text-body"
|
|
71
|
+
};
|
|
72
|
+
function j({ className: n, size: r = "default", showValue: i = !0, ...a }) {
|
|
73
|
+
let o = l(h);
|
|
74
|
+
return /* @__PURE__ */ f(t, {
|
|
75
|
+
"data-slot": "color-picker-trigger",
|
|
76
|
+
variant: "secondary",
|
|
77
|
+
className: C(n, (t) => e("w-full justify-start bg-input px-3 font-normal text-foreground data-hovered:bg-secondary aria-expanded:ring-[1.5px] aria-expanded:ring-primary aria-expanded:ring-inset", A[r], t)),
|
|
78
|
+
...a,
|
|
79
|
+
children: [/* @__PURE__ */ d(c, {}), i && o?.color ? /* @__PURE__ */ d("span", {
|
|
80
|
+
className: "tabular-nums",
|
|
81
|
+
children: o.color.toString(o.color.getChannelValue("alpha") < 1 ? "hexa" : "hex")
|
|
82
|
+
}) : null]
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
function M({ swatches: t, alpha: n, children: c, className: l, placement: p = "bottom start", ...m }) {
|
|
86
|
+
return /* @__PURE__ */ d(r, {
|
|
87
|
+
"data-slot": "color-picker-content",
|
|
88
|
+
placement: p,
|
|
89
|
+
className: C(l, (t) => e("w-64 min-w-0", t)),
|
|
90
|
+
...m,
|
|
91
|
+
children: /* @__PURE__ */ d(b, {
|
|
92
|
+
"aria-label": "Color picker",
|
|
93
|
+
className: "flex flex-col gap-3 p-3 outline-none",
|
|
94
|
+
children: c ?? /* @__PURE__ */ f(u, { children: [
|
|
95
|
+
/* @__PURE__ */ d(E, { className: "h-40 w-full" }),
|
|
96
|
+
/* @__PURE__ */ d(D, {
|
|
97
|
+
colorSpace: "hsb",
|
|
98
|
+
channel: "hue",
|
|
99
|
+
"aria-label": "Hue"
|
|
100
|
+
}),
|
|
101
|
+
n ? /* @__PURE__ */ d(D, {
|
|
102
|
+
channel: "alpha",
|
|
103
|
+
"aria-label": "Opacity"
|
|
104
|
+
}) : null,
|
|
105
|
+
/* @__PURE__ */ d(i, {
|
|
106
|
+
"aria-label": "Hex color",
|
|
107
|
+
children: /* @__PURE__ */ f(a, {
|
|
108
|
+
size: "sm",
|
|
109
|
+
children: [/* @__PURE__ */ d(s, { className: "size-5" }), /* @__PURE__ */ d(o, {})]
|
|
110
|
+
})
|
|
111
|
+
}),
|
|
112
|
+
t?.length ? /* @__PURE__ */ d(O, {
|
|
113
|
+
"aria-label": "Preset colors",
|
|
114
|
+
children: t.map((e) => /* @__PURE__ */ d(k, { color: e }, e))
|
|
115
|
+
}) : null
|
|
116
|
+
] })
|
|
117
|
+
})
|
|
118
|
+
});
|
|
119
|
+
}
|
|
120
|
+
//#endregion
|
|
121
|
+
export { E as ColorArea, w as ColorPicker, M as ColorPickerContent, j as ColorPickerTrigger, D as ColorSlider, O as ColorSwatchPicker, k as ColorSwatchPickerItem, T as ColorThumb };
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { DateFieldProps as AriaDateFieldProps, DateInputProps as AriaDateInputProps, DateSegmentProps as AriaDateSegmentProps, TimeFieldProps as AriaTimeFieldProps, DateValue, TimeValue } from 'react-aria-components';
|
|
2
|
+
import { VariantProps } from 'class-variance-authority';
|
|
3
|
+
export interface DateFieldProps<T extends DateValue> extends AriaDateFieldProps<T> {
|
|
4
|
+
}
|
|
5
|
+
export declare function DateField<T extends DateValue>({ className, ...props }: DateFieldProps<T>): import("react/jsx-runtime").JSX.Element;
|
|
6
|
+
export interface TimeFieldProps<T extends TimeValue> extends AriaTimeFieldProps<T> {
|
|
7
|
+
}
|
|
8
|
+
export declare function TimeField<T extends TimeValue>({ className, ...props }: TimeFieldProps<T>): import("react/jsx-runtime").JSX.Element;
|
|
9
|
+
export declare const dateInputVariants: (props?: ({
|
|
10
|
+
variant?: "field" | "bare" | null | undefined;
|
|
11
|
+
size?: "default" | "sm" | "lg" | null | undefined;
|
|
12
|
+
} & import('class-variance-authority/types').ClassProp) | undefined) => string;
|
|
13
|
+
export interface DateInputProps extends Omit<AriaDateInputProps, 'children' | 'size'>, VariantProps<typeof dateInputVariants> {
|
|
14
|
+
}
|
|
15
|
+
/** The row of segments (month / day / year …). Use `variant="bare"` inside a DatePickerField. */
|
|
16
|
+
export declare function DateInput({ className, variant, size, ...props }: DateInputProps): import("react/jsx-runtime").JSX.Element;
|
|
17
|
+
/** One editable part of the date. The one being edited is filled with the tint; an empty one shows its name dimmed. */
|
|
18
|
+
export declare function DateSegment({ className, ...props }: AriaDateSegmentProps): import("react/jsx-runtime").JSX.Element;
|
|
19
|
+
//# sourceMappingURL=date-field.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"date-field.d.ts","sourceRoot":"","sources":["../../src/components/date-field.tsx"],"names":[],"mappings":"AACA,OAAO,EACuB,KAAK,cAAc,IAAI,kBAAkB,EACzC,KAAK,cAAc,IAAI,kBAAkB,EACrC,KAAK,gBAAgB,IAAI,oBAAoB,EACjD,KAAK,cAAc,IAAI,kBAAkB,EAErE,KAAK,SAAS,EAAE,KAAK,SAAS,EAC/B,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAO,KAAK,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAalE,MAAM,WAAW,cAAc,CAAC,CAAC,SAAS,SAAS,CAAE,SAAQ,kBAAkB,CAAC,CAAC,CAAC;CAAG;AAErF,wBAAgB,SAAS,CAAC,CAAC,SAAS,SAAS,EAAE,EAAE,SAAS,EAAE,GAAG,KAAK,EAAE,EAAE,cAAc,CAAC,CAAC,CAAC,2CAQxF;AAED,MAAM,WAAW,cAAc,CAAC,CAAC,SAAS,SAAS,CAAE,SAAQ,kBAAkB,CAAC,CAAC,CAAC;CAAG;AAErF,wBAAgB,SAAS,CAAC,CAAC,SAAS,SAAS,EAAE,EAAE,SAAS,EAAE,GAAG,KAAK,EAAE,EAAE,cAAc,CAAC,CAAC,CAAC,2CAQxF;AAED,eAAO,MAAM,iBAAiB;;;8EAwB5B,CAAC;AAEH,MAAM,WAAW,cAAe,SAAQ,IAAI,CAAC,kBAAkB,EAAE,UAAU,GAAG,MAAM,CAAC,EAAE,YAAY,CAAC,OAAO,iBAAiB,CAAC;CAAG;AAEhI,iGAAiG;AACjG,wBAAgB,SAAS,CAAC,EAAE,SAAS,EAAE,OAAO,EAAE,IAAI,EAAE,GAAG,KAAK,EAAE,EAAE,cAAc,2CAU/E;AAED,uHAAuH;AACvH,wBAAgB,WAAW,CAAC,EAAE,SAAS,EAAE,GAAG,KAAK,EAAE,EAAE,oBAAoB,2CAkBxE"}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { cn as e } from "../lib/utils.js";
|
|
3
|
+
import { selectableText as t } from "../lib/primitives.js";
|
|
4
|
+
import { jsx as n } from "react/jsx-runtime";
|
|
5
|
+
import { DateField as r, DateInput as i, DateSegment as a, TimeField as o, composeRenderProps as s } from "react-aria-components";
|
|
6
|
+
import { cva as c } from "class-variance-authority";
|
|
7
|
+
//#region src/components/date-field.tsx
|
|
8
|
+
function l({ className: t, ...i }) {
|
|
9
|
+
return /* @__PURE__ */ n(r, {
|
|
10
|
+
"data-slot": "date-field",
|
|
11
|
+
className: s(t, (t) => e("group flex flex-col gap-1.5", t)),
|
|
12
|
+
...i
|
|
13
|
+
});
|
|
14
|
+
}
|
|
15
|
+
function u({ className: t, ...r }) {
|
|
16
|
+
return /* @__PURE__ */ n(o, {
|
|
17
|
+
"data-slot": "time-field",
|
|
18
|
+
className: s(t, (t) => e("group flex flex-col gap-1.5", t)),
|
|
19
|
+
...r
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
var d = c("flex min-w-0 items-center text-foreground [font-family:inherit] whitespace-nowrap", {
|
|
23
|
+
variants: {
|
|
24
|
+
variant: {
|
|
25
|
+
field: [
|
|
26
|
+
"box-border w-full rounded-ctl bg-input px-3 outline-none transition-[box-shadow,background-color] duration-spring-snappy ease-spring-snappy",
|
|
27
|
+
"data-focus-within:bg-transparent data-focus-within:ring-[1.5px] data-focus-within:ring-primary data-focus-within:ring-inset",
|
|
28
|
+
"data-invalid:ring-[1.5px] data-invalid:ring-destructive data-invalid:ring-inset data-disabled:cursor-not-allowed data-disabled:opacity-50"
|
|
29
|
+
],
|
|
30
|
+
bare: "flex-1"
|
|
31
|
+
},
|
|
32
|
+
size: {
|
|
33
|
+
sm: "text-subhead",
|
|
34
|
+
default: "text-body",
|
|
35
|
+
lg: "text-body"
|
|
36
|
+
}
|
|
37
|
+
},
|
|
38
|
+
compoundVariants: [
|
|
39
|
+
{
|
|
40
|
+
variant: "field",
|
|
41
|
+
size: "sm",
|
|
42
|
+
class: "h-8"
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
variant: "field",
|
|
46
|
+
size: "default",
|
|
47
|
+
class: "h-11"
|
|
48
|
+
},
|
|
49
|
+
{
|
|
50
|
+
variant: "field",
|
|
51
|
+
size: "lg",
|
|
52
|
+
class: "h-[50px] rounded-xl"
|
|
53
|
+
}
|
|
54
|
+
],
|
|
55
|
+
defaultVariants: {
|
|
56
|
+
variant: "field",
|
|
57
|
+
size: "default"
|
|
58
|
+
}
|
|
59
|
+
});
|
|
60
|
+
function f({ className: t, variant: r, size: a, ...o }) {
|
|
61
|
+
return /* @__PURE__ */ n(i, {
|
|
62
|
+
"data-slot": "date-input",
|
|
63
|
+
className: s(t, (t) => e(d({
|
|
64
|
+
variant: r,
|
|
65
|
+
size: a
|
|
66
|
+
}), t)),
|
|
67
|
+
...o,
|
|
68
|
+
children: (e) => /* @__PURE__ */ n(p, { segment: e })
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
function p({ className: r, ...i }) {
|
|
72
|
+
return /* @__PURE__ */ n(a, {
|
|
73
|
+
"data-slot": "date-segment",
|
|
74
|
+
className: s(r, (n) => e("min-h-6 min-w-6 rounded-sm px-0.5 text-center tabular-nums caret-transparent outline-none", "data-placeholder:text-foreground/60 data-[type=literal]:min-w-0 data-[type=literal]:px-0 data-[type=literal]:text-muted-foreground", "data-focused:bg-primary data-focused:text-primary-foreground data-focused:data-placeholder:text-primary-foreground", "data-disabled:cursor-not-allowed", t, n)),
|
|
75
|
+
...i
|
|
76
|
+
});
|
|
77
|
+
}
|
|
78
|
+
//#endregion
|
|
79
|
+
export { l as DateField, f as DateInput, p as DateSegment, u as TimeField, d as dateInputVariants };
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
import { DatePickerProps as AriaDatePickerProps, DateRangePickerProps as AriaDateRangePickerProps, DateValue } from 'react-aria-components';
|
|
3
|
+
import { VariantProps } from 'class-variance-authority';
|
|
4
|
+
import { CalendarProps, RangeCalendarProps } from './calendar';
|
|
5
|
+
import { PopoverProps } from './popover';
|
|
6
|
+
export declare const datePickerFieldVariants: (props?: ({
|
|
7
|
+
size?: "default" | "sm" | "lg" | null | undefined;
|
|
8
|
+
} & import('class-variance-authority/types').ClassProp) | undefined) => string;
|
|
9
|
+
interface FieldProps extends VariantProps<typeof datePickerFieldVariants> {
|
|
10
|
+
className?: string;
|
|
11
|
+
}
|
|
12
|
+
/** The filled field: the date's segments and the calendar button. */
|
|
13
|
+
export declare function DatePickerField({ className, size }: FieldProps): import("react/jsx-runtime").JSX.Element;
|
|
14
|
+
/** The filled field of a DateRangePicker: start and end segments with a dash between, and the calendar button. */
|
|
15
|
+
export declare function DateRangePickerField({ className, size }: FieldProps): import("react/jsx-runtime").JSX.Element;
|
|
16
|
+
export interface DatePickerContentProps<T extends DateValue> extends Omit<PopoverProps, 'children'> {
|
|
17
|
+
/** Props for the Calendar inside (`visibleMonths`, `variant` …). Ignored when you pass `children`. */
|
|
18
|
+
calendarProps?: Omit<CalendarProps<T>, 'value' | 'defaultValue' | 'onChange'>;
|
|
19
|
+
/** Replace the Calendar, e.g. to add presets beside it. */
|
|
20
|
+
children?: ReactNode;
|
|
21
|
+
}
|
|
22
|
+
/** The popover with the Calendar. Place it anywhere inside the DatePicker. */
|
|
23
|
+
export declare function DatePickerContent<T extends DateValue>({ calendarProps, children, placement, className, ...props }: DatePickerContentProps<T>): import("react/jsx-runtime").JSX.Element;
|
|
24
|
+
export interface DateRangePickerContentProps<T extends DateValue> extends Omit<PopoverProps, 'children'> {
|
|
25
|
+
/** Props for the RangeCalendar inside (`visibleMonths`, `variant` …). Ignored when you pass `children`. */
|
|
26
|
+
calendarProps?: Omit<RangeCalendarProps<T>, 'value' | 'defaultValue' | 'onChange'>;
|
|
27
|
+
children?: ReactNode;
|
|
28
|
+
}
|
|
29
|
+
/** The popover with the RangeCalendar. Place it anywhere inside the DateRangePicker. */
|
|
30
|
+
export declare function DateRangePickerContent<T extends DateValue>({ calendarProps, children, placement, className, ...props }: DateRangePickerContentProps<T>): import("react/jsx-runtime").JSX.Element;
|
|
31
|
+
export interface DatePickerProps<T extends DateValue> extends AriaDatePickerProps<T> {
|
|
32
|
+
}
|
|
33
|
+
export declare function DatePicker<T extends DateValue>({ className, ...props }: DatePickerProps<T>): import("react/jsx-runtime").JSX.Element;
|
|
34
|
+
export interface DateRangePickerProps<T extends DateValue> extends AriaDateRangePickerProps<T> {
|
|
35
|
+
}
|
|
36
|
+
export declare function DateRangePicker<T extends DateValue>({ className, ...props }: DateRangePickerProps<T>): import("react/jsx-runtime").JSX.Element;
|
|
37
|
+
export {};
|
|
38
|
+
//# sourceMappingURL=date-picker.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"date-picker.d.ts","sourceRoot":"","sources":["../../src/components/date-picker.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACvC,OAAO,EACyB,KAAK,eAAe,IAAI,mBAAmB,EACjC,KAAK,oBAAoB,IAAI,wBAAwB,EAI7F,KAAK,SAAS,EACf,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAO,KAAK,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAElE,OAAO,EAA2B,KAAK,aAAa,EAAE,KAAK,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AAEhH,OAAO,EAAW,KAAK,YAAY,EAAE,MAAM,yBAAyB,CAAC;AAerE,eAAO,MAAM,uBAAuB;;8EAiBnC,CAAC;AAEF,UAAU,UAAW,SAAQ,YAAY,CAAC,OAAO,uBAAuB,CAAC;IACvE,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAWD,qEAAqE;AACrE,wBAAgB,eAAe,CAAC,EAAE,SAAS,EAAE,IAAI,EAAE,EAAE,UAAU,2CAO9D;AAED,kHAAkH;AAClH,wBAAgB,oBAAoB,CAAC,EAAE,SAAS,EAAE,IAAI,EAAE,EAAE,UAAU,2CASnE;AAED,MAAM,WAAW,sBAAsB,CAAC,CAAC,SAAS,SAAS,CAAE,SAAQ,IAAI,CAAC,YAAY,EAAE,UAAU,CAAC;IACjG,sGAAsG;IACtG,aAAa,CAAC,EAAE,IAAI,CAAC,aAAa,CAAC,CAAC,CAAC,EAAE,OAAO,GAAG,cAAc,GAAG,UAAU,CAAC,CAAC;IAC9E,2DAA2D;IAC3D,QAAQ,CAAC,EAAE,SAAS,CAAC;CACtB;AAMD,8EAA8E;AAC9E,wBAAgB,iBAAiB,CAAC,CAAC,SAAS,SAAS,EAAE,EAAE,aAAa,EAAE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