@lerianstudio/sindarian-ui 1.0.0-beta.29 → 1.0.0-beta.30

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.
@@ -0,0 +1,19 @@
1
+ import { ReactNode } from 'react';
2
+ import { Control } from 'react-hook-form';
3
+ export type DatePickerFieldProps = {
4
+ name: string;
5
+ label?: ReactNode;
6
+ tooltip?: string;
7
+ labelExtra?: ReactNode;
8
+ description?: ReactNode;
9
+ placeholder?: string;
10
+ disabled?: boolean;
11
+ readOnly?: boolean;
12
+ control: Control<any>;
13
+ required?: boolean;
14
+ dateFormat?: string;
15
+ align?: 'start' | 'center' | 'end';
16
+ 'data-testid'?: string;
17
+ };
18
+ export declare const DatePickerField: ({ name, label, tooltip, labelExtra, description, placeholder, disabled, readOnly, control, required, dateFormat, align, ...others }: DatePickerFieldProps) => import("react/jsx-runtime").JSX.Element;
19
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/form/date-picker-field/index.tsx"],"names":[],"mappings":"AAqBA,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AACjC,OAAO,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAA;AAEzC,MAAM,MAAM,oBAAoB,GAAG;IACjC,IAAI,EAAE,MAAM,CAAA;IACZ,KAAK,CAAC,EAAE,SAAS,CAAA;IACjB,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,UAAU,CAAC,EAAE,SAAS,CAAA;IACtB,WAAW,CAAC,EAAE,SAAS,CAAA;IACvB,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,OAAO,EAAE,OAAO,CAAC,GAAG,CAAC,CAAA;IACrB,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,KAAK,CAAC,EAAE,OAAO,GAAG,QAAQ,GAAG,KAAK,CAAA;IAClC,aAAa,CAAC,EAAE,MAAM,CAAA;CACvB,CAAA;AAED,eAAO,MAAM,eAAe,GAAI,qIAc7B,oBAAoB,4CA4DtB,CAAA"}
@@ -0,0 +1,22 @@
1
+ 'use client';
2
+ "use strict";
3
+ var __importDefault = (this && this.__importDefault) || function (mod) {
4
+ return (mod && mod.__esModule) ? mod : { "default": mod };
5
+ };
6
+ Object.defineProperty(exports, "__esModule", { value: true });
7
+ exports.DatePickerField = void 0;
8
+ const jsx_runtime_1 = require("react/jsx-runtime");
9
+ const button_1 = require("../../../components/ui/button");
10
+ const calendar_1 = require("../../../components/ui/calendar");
11
+ const form_1 = require("../../../components/ui/form");
12
+ const popover_1 = require("../../../components/ui/popover");
13
+ const utils_1 = require("../../../lib/utils");
14
+ const dayjs_1 = __importDefault(require("dayjs"));
15
+ const lucide_react_1 = require("lucide-react");
16
+ const DatePickerField = ({ name, label, tooltip, labelExtra, description, placeholder, disabled, readOnly, control, required, dateFormat = 'MMM DD, YYYY', align = 'start', ...others }) => {
17
+ return ((0, jsx_runtime_1.jsx)(form_1.FormField, { name: name, control: control, render: ({ field }) => {
18
+ const value = field.value;
19
+ return ((0, jsx_runtime_1.jsxs)(form_1.FormItem, { required: required, children: [label && ((0, jsx_runtime_1.jsx)(form_1.FormLabel, { extra: tooltip ? (0, jsx_runtime_1.jsx)(form_1.FormTooltip, { children: tooltip }) : labelExtra, children: label })), (0, jsx_runtime_1.jsxs)(popover_1.Popover, { children: [(0, jsx_runtime_1.jsx)(popover_1.PopoverTrigger, { asChild: true, children: (0, jsx_runtime_1.jsx)(form_1.FormControl, { children: (0, jsx_runtime_1.jsx)(button_1.Button, { variant: "outline", disabled: disabled, className: (0, utils_1.cn)('border-button-border w-full justify-start px-2.5 font-normal', !value && 'text-muted-foreground', readOnly && 'pointer-events-none'), "data-testid": others['data-testid'], icon: (0, jsx_runtime_1.jsx)(lucide_react_1.CalendarIcon, { className: "size-4" }), children: value ? ((0, dayjs_1.default)(value).format(dateFormat)) : ((0, jsx_runtime_1.jsx)("span", { children: placeholder })) }) }) }), (0, jsx_runtime_1.jsx)(popover_1.PopoverContent, { className: "w-auto p-0", align: align, children: (0, jsx_runtime_1.jsx)(calendar_1.Calendar, { mode: "single", defaultMonth: value, selected: value, onSelect: field.onChange, disabled: disabled || readOnly }) })] }), (0, jsx_runtime_1.jsx)(form_1.FormMessage, {}), description && (0, jsx_runtime_1.jsx)(form_1.FormDescription, { children: description })] }));
20
+ } }));
21
+ };
22
+ exports.DatePickerField = DatePickerField;
@@ -0,0 +1,20 @@
1
+ import { ReactNode } from 'react';
2
+ import { Control } from 'react-hook-form';
3
+ export type DateRangeFieldProps = {
4
+ name: string;
5
+ label?: ReactNode;
6
+ tooltip?: string;
7
+ labelExtra?: ReactNode;
8
+ description?: ReactNode;
9
+ placeholder?: string;
10
+ disabled?: boolean;
11
+ readOnly?: boolean;
12
+ control: Control<any>;
13
+ required?: boolean;
14
+ numberOfMonths?: number;
15
+ dateFormat?: string;
16
+ align?: 'start' | 'center' | 'end';
17
+ 'data-testid'?: string;
18
+ };
19
+ export declare const DateRangeField: ({ name, label, tooltip, labelExtra, description, placeholder, disabled, readOnly, control, required, numberOfMonths, dateFormat, align, ...others }: DateRangeFieldProps) => import("react/jsx-runtime").JSX.Element;
20
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/form/date-range-field/index.tsx"],"names":[],"mappings":"AAqBA,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAEjC,OAAO,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAA;AAEzC,MAAM,MAAM,mBAAmB,GAAG;IAChC,IAAI,EAAE,MAAM,CAAA;IACZ,KAAK,CAAC,EAAE,SAAS,CAAA;IACjB,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,UAAU,CAAC,EAAE,SAAS,CAAA;IACtB,WAAW,CAAC,EAAE,SAAS,CAAA;IACvB,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,OAAO,EAAE,OAAO,CAAC,GAAG,CAAC,CAAA;IACrB,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,cAAc,CAAC,EAAE,MAAM,CAAA;IACvB,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,KAAK,CAAC,EAAE,OAAO,GAAG,QAAQ,GAAG,KAAK,CAAA;IAClC,aAAa,CAAC,EAAE,MAAM,CAAA;CACvB,CAAA;AAED,eAAO,MAAM,cAAc,GAAI,qJAe5B,mBAAmB,4CAoErB,CAAA"}
@@ -0,0 +1,22 @@
1
+ 'use client';
2
+ "use strict";
3
+ var __importDefault = (this && this.__importDefault) || function (mod) {
4
+ return (mod && mod.__esModule) ? mod : { "default": mod };
5
+ };
6
+ Object.defineProperty(exports, "__esModule", { value: true });
7
+ exports.DateRangeField = void 0;
8
+ const jsx_runtime_1 = require("react/jsx-runtime");
9
+ const button_1 = require("../../../components/ui/button");
10
+ const calendar_1 = require("../../../components/ui/calendar");
11
+ const form_1 = require("../../../components/ui/form");
12
+ const popover_1 = require("../../../components/ui/popover");
13
+ const utils_1 = require("../../../lib/utils");
14
+ const dayjs_1 = __importDefault(require("dayjs"));
15
+ const lucide_react_1 = require("lucide-react");
16
+ const DateRangeField = ({ name, label, tooltip, labelExtra, description, placeholder, disabled, readOnly, control, required, numberOfMonths = 2, dateFormat = 'MMM DD, YYYY', align = 'start', ...others }) => {
17
+ return ((0, jsx_runtime_1.jsx)(form_1.FormField, { name: name, control: control, render: ({ field }) => {
18
+ const value = field.value;
19
+ return ((0, jsx_runtime_1.jsxs)(form_1.FormItem, { required: required, children: [label && ((0, jsx_runtime_1.jsx)(form_1.FormLabel, { extra: tooltip ? (0, jsx_runtime_1.jsx)(form_1.FormTooltip, { children: tooltip }) : labelExtra, children: label })), (0, jsx_runtime_1.jsxs)(popover_1.Popover, { children: [(0, jsx_runtime_1.jsx)(popover_1.PopoverTrigger, { asChild: true, children: (0, jsx_runtime_1.jsx)(form_1.FormControl, { children: (0, jsx_runtime_1.jsx)(button_1.Button, { variant: "outline", disabled: disabled, className: (0, utils_1.cn)('border-button-border w-full justify-start px-2.5 font-normal', !value && 'text-muted-foreground', readOnly && 'pointer-events-none'), "data-testid": others['data-testid'], icon: (0, jsx_runtime_1.jsx)(lucide_react_1.CalendarIcon, { className: "size-4" }), children: value?.from ? (value.to ? ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, dayjs_1.default)(value.from).format(dateFormat), " -", ' ', (0, dayjs_1.default)(value.to).format(dateFormat)] })) : ((0, dayjs_1.default)(value.from).format(dateFormat))) : ((0, jsx_runtime_1.jsx)("span", { children: placeholder })) }) }) }), (0, jsx_runtime_1.jsx)(popover_1.PopoverContent, { className: "w-auto p-0", align: align, children: (0, jsx_runtime_1.jsx)(calendar_1.Calendar, { mode: "range", defaultMonth: value?.from, selected: value, onSelect: field.onChange, numberOfMonths: numberOfMonths, disabled: disabled || readOnly }) })] }), (0, jsx_runtime_1.jsx)(form_1.FormMessage, {}), description && (0, jsx_runtime_1.jsx)(form_1.FormDescription, { children: description })] }));
20
+ } }));
21
+ };
22
+ exports.DateRangeField = DateRangeField;
@@ -5,4 +5,6 @@ export * from './pagination-limit-field';
5
5
  export * from './combo-box-field';
6
6
  export * from './country-field';
7
7
  export * from './state-field';
8
+ export * from './date-range-field';
9
+ export * from './date-picker-field';
8
10
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/form/index.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAA;AAC7B,cAAc,gBAAgB,CAAA;AAC9B,cAAc,gBAAgB,CAAA;AAC9B,cAAc,0BAA0B,CAAA;AACxC,cAAc,mBAAmB,CAAA;AACjC,cAAc,iBAAiB,CAAA;AAC/B,cAAc,eAAe,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/form/index.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAA;AAC7B,cAAc,gBAAgB,CAAA;AAC9B,cAAc,gBAAgB,CAAA;AAC9B,cAAc,0BAA0B,CAAA;AACxC,cAAc,mBAAmB,CAAA;AACjC,cAAc,iBAAiB,CAAA;AAC/B,cAAc,eAAe,CAAA;AAC7B,cAAc,oBAAoB,CAAA;AAClC,cAAc,qBAAqB,CAAA"}
@@ -21,3 +21,5 @@ __exportStar(require("./pagination-limit-field"), exports);
21
21
  __exportStar(require("./combo-box-field"), exports);
22
22
  __exportStar(require("./country-field"), exports);
23
23
  __exportStar(require("./state-field"), exports);
24
+ __exportStar(require("./date-range-field"), exports);
25
+ __exportStar(require("./date-picker-field"), exports);
@@ -0,0 +1,9 @@
1
+ import * as React from 'react';
2
+ import { DayPicker, type DayButton } from 'react-day-picker';
3
+ import { Button } from '../../../components/ui/button';
4
+ declare function Calendar({ className, classNames, showOutsideDays, captionLayout, buttonVariant, formatters, components, ...props }: React.ComponentProps<typeof DayPicker> & {
5
+ buttonVariant?: React.ComponentProps<typeof Button>['variant'];
6
+ }): import("react/jsx-runtime").JSX.Element;
7
+ declare function CalendarDayButton({ className, day, modifiers, ...props }: React.ComponentProps<typeof DayButton>): import("react/jsx-runtime").JSX.Element;
8
+ export { Calendar, CalendarDayButton };
9
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/ui/calendar/index.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAC9B,OAAO,EACL,SAAS,EAET,KAAK,SAAS,EACf,MAAM,kBAAkB,CAAA;AAGzB,OAAO,EAAE,MAAM,EAAkB,MAAM,wBAAwB,CAAA;AAO/D,iBAAS,QAAQ,CAAC,EAChB,SAAS,EACT,UAAU,EACV,eAAsB,EACtB,aAAuB,EACvB,aAAuB,EACvB,UAAU,EACV,UAAU,EACV,GAAG,KAAK,EACT,EAAE,KAAK,CAAC,cAAc,CAAC,OAAO,SAAS,CAAC,GAAG;IAC1C,aAAa,CAAC,EAAE,KAAK,CAAC,cAAc,CAAC,OAAO,MAAM,CAAC,CAAC,SAAS,CAAC,CAAA;CAC/D,2CA0JA;AAED,iBAAS,iBAAiB,CAAC,EACzB,SAAS,EACT,GAAG,EACH,SAAS,EACT,GAAG,KAAK,EACT,EAAE,KAAK,CAAC,cAAc,CAAC,OAAO,SAAS,CAAC,2CA0CxC;AAED,OAAO,EAAE,QAAQ,EAAE,iBAAiB,EAAE,CAAA"}
@@ -0,0 +1,115 @@
1
+ 'use client';
2
+ "use strict";
3
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
4
+ if (k2 === undefined) k2 = k;
5
+ var desc = Object.getOwnPropertyDescriptor(m, k);
6
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
7
+ desc = { enumerable: true, get: function() { return m[k]; } };
8
+ }
9
+ Object.defineProperty(o, k2, desc);
10
+ }) : (function(o, m, k, k2) {
11
+ if (k2 === undefined) k2 = k;
12
+ o[k2] = m[k];
13
+ }));
14
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
15
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
16
+ }) : function(o, v) {
17
+ o["default"] = v;
18
+ });
19
+ var __importStar = (this && this.__importStar) || (function () {
20
+ var ownKeys = function(o) {
21
+ ownKeys = Object.getOwnPropertyNames || function (o) {
22
+ var ar = [];
23
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
24
+ return ar;
25
+ };
26
+ return ownKeys(o);
27
+ };
28
+ return function (mod) {
29
+ if (mod && mod.__esModule) return mod;
30
+ var result = {};
31
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
32
+ __setModuleDefault(result, mod);
33
+ return result;
34
+ };
35
+ })();
36
+ Object.defineProperty(exports, "__esModule", { value: true });
37
+ exports.Calendar = Calendar;
38
+ exports.CalendarDayButton = CalendarDayButton;
39
+ const jsx_runtime_1 = require("react/jsx-runtime");
40
+ const React = __importStar(require("react"));
41
+ const react_day_picker_1 = require("react-day-picker");
42
+ const utils_1 = require("../../../lib/utils");
43
+ const button_1 = require("../../../components/ui/button");
44
+ const lucide_react_1 = require("lucide-react");
45
+ function Calendar({ className, classNames, showOutsideDays = true, captionLayout = 'label', buttonVariant = 'plain', formatters, components, ...props }) {
46
+ const defaultClassNames = (0, react_day_picker_1.getDefaultClassNames)();
47
+ return ((0, jsx_runtime_1.jsx)(react_day_picker_1.DayPicker, { showOutsideDays: showOutsideDays, className: (0, utils_1.cn)('bg-background group/calendar p-2 [--cell-radius:var(--radius-md)] [--cell-size:--spacing(7)] [[data-slot=card-content]_&]:bg-transparent [[data-slot=popover-content]_&]:bg-transparent', String.raw `rtl:**:[.rdp-button\_next>svg]:rotate-180`, String.raw `rtl:**:[.rdp-button\_previous>svg]:rotate-180`, className), captionLayout: captionLayout, formatters: {
48
+ formatMonthDropdown: (date) => date.toLocaleString('default', { month: 'short' }),
49
+ ...formatters
50
+ }, classNames: {
51
+ root: (0, utils_1.cn)('w-fit', defaultClassNames.root),
52
+ months: (0, utils_1.cn)('flex gap-4 flex-col md:flex-row relative', defaultClassNames.months),
53
+ month: (0, utils_1.cn)('flex flex-col w-full gap-4', defaultClassNames.month),
54
+ nav: (0, utils_1.cn)('flex items-center gap-1 w-full absolute top-0 inset-x-0 justify-between', defaultClassNames.nav),
55
+ button_previous: (0, utils_1.cn)((0, button_1.buttonVariants)({ variant: buttonVariant }), 'size-(--cell-size) aria-disabled:opacity-50 p-0 select-none', defaultClassNames.button_previous),
56
+ button_next: (0, utils_1.cn)((0, button_1.buttonVariants)({ variant: buttonVariant }), 'size-(--cell-size) aria-disabled:opacity-50 p-0 select-none', defaultClassNames.button_next),
57
+ month_caption: (0, utils_1.cn)('flex items-center justify-center h-(--cell-size) w-full px-(--cell-size)', defaultClassNames.month_caption),
58
+ dropdowns: (0, utils_1.cn)('w-full flex items-center text-sm font-medium justify-center h-(--cell-size) gap-1.5', defaultClassNames.dropdowns),
59
+ dropdown_root: (0, utils_1.cn)('relative cn-calendar-dropdown-root rounded-(--cell-radius)', defaultClassNames.dropdown_root),
60
+ dropdown: (0, utils_1.cn)('absolute bg-popover inset-0 opacity-0', defaultClassNames.dropdown),
61
+ caption_label: (0, utils_1.cn)('select-none font-medium', captionLayout === 'label'
62
+ ? 'text-sm'
63
+ : 'cn-calendar-caption-label rounded-(--cell-radius) flex items-center gap-1 text-sm [&>svg]:text-muted-foreground [&>svg]:size-3.5', defaultClassNames.caption_label),
64
+ table: 'w-full border-collapse',
65
+ weekdays: (0, utils_1.cn)('flex', defaultClassNames.weekdays),
66
+ weekday: (0, utils_1.cn)('text-muted-foreground rounded-(--cell-radius) flex-1 font-normal text-[0.8rem] select-none', defaultClassNames.weekday),
67
+ week: (0, utils_1.cn)('flex w-full mt-2', defaultClassNames.week),
68
+ week_number_header: (0, utils_1.cn)('select-none w-(--cell-size)', defaultClassNames.week_number_header),
69
+ week_number: (0, utils_1.cn)('text-[0.8rem] select-none text-muted-foreground', defaultClassNames.week_number),
70
+ day: (0, utils_1.cn)('relative w-full rounded-(--cell-radius) h-full p-0 text-center [&:last-child[data-selected=true]_button]:rounded-r-(--cell-radius) group/day aspect-square select-none', props.showWeekNumber
71
+ ? '[&:nth-child(2)[data-selected=true]_button]:rounded-l-(--cell-radius)'
72
+ : '[&:first-child[data-selected=true]_button]:rounded-l-(--cell-radius)', defaultClassNames.day),
73
+ range_start: (0, utils_1.cn)('rounded-l-(--cell-radius) bg-muted relative after:bg-muted after:absolute after:inset-y-0 after:w-4 after:right-0 -z-0 isolate', defaultClassNames.range_start),
74
+ range_middle: (0, utils_1.cn)('rounded-none', defaultClassNames.range_middle),
75
+ range_end: (0, utils_1.cn)('rounded-r-(--cell-radius) bg-muted relative after:bg-muted-200 after:absolute after:inset-y-0 after:w-4 after:left-0 -z-0 isolate', defaultClassNames.range_end),
76
+ today: (0, utils_1.cn)('bg-muted text-foreground rounded-(--cell-radius) data-[selected=true]:rounded-none', defaultClassNames.today),
77
+ outside: (0, utils_1.cn)('text-muted-foreground aria-selected:text-muted-foreground', defaultClassNames.outside),
78
+ disabled: (0, utils_1.cn)('text-muted-foreground opacity-50', defaultClassNames.disabled),
79
+ hidden: (0, utils_1.cn)('invisible', defaultClassNames.hidden),
80
+ ...classNames
81
+ }, components: {
82
+ Root: ({ className, rootRef, ...props }) => {
83
+ return ((0, jsx_runtime_1.jsx)("div", { "data-slot": "calendar", ref: rootRef, className: (0, utils_1.cn)(className), ...props }));
84
+ },
85
+ Chevron: ({ className, orientation, ...props }) => {
86
+ if (orientation === 'left') {
87
+ return ((0, jsx_runtime_1.jsx)(lucide_react_1.ChevronLeftIcon, { className: (0, utils_1.cn)('size-4', className), ...props }));
88
+ }
89
+ if (orientation === 'right') {
90
+ return ((0, jsx_runtime_1.jsx)(lucide_react_1.ChevronRightIcon, { className: (0, utils_1.cn)('size-4', className), ...props }));
91
+ }
92
+ return ((0, jsx_runtime_1.jsx)(lucide_react_1.ChevronDownIcon, { className: (0, utils_1.cn)('size-4', className), ...props }));
93
+ },
94
+ DayButton: CalendarDayButton,
95
+ WeekNumber: ({ children, ...props }) => {
96
+ return ((0, jsx_runtime_1.jsx)("td", { ...props, children: (0, jsx_runtime_1.jsx)("div", { className: "flex size-(--cell-size) items-center justify-center text-center", children: children }) }));
97
+ },
98
+ ...components
99
+ }, ...props }));
100
+ }
101
+ function CalendarDayButton({ className, day, modifiers, ...props }) {
102
+ const defaultClassNames = (0, react_day_picker_1.getDefaultClassNames)();
103
+ const ref = React.useRef(null);
104
+ React.useEffect(() => {
105
+ if (modifiers.focused)
106
+ ref.current?.focus();
107
+ }, [modifiers.focused]);
108
+ const dayNumber = day.date.getDate();
109
+ const monthName = day.date.toLocaleDateString('en', { month: 'long' });
110
+ const year = day.date.getFullYear();
111
+ return ((0, jsx_runtime_1.jsx)(button_1.Button, { ref: ref, variant: "plain", size: "small", "data-day": day.date.toLocaleDateString(), "data-selected-single": modifiers.selected &&
112
+ !modifiers.range_start &&
113
+ !modifiers.range_end &&
114
+ !modifiers.range_middle, "data-range-start": modifiers.range_start, "data-range-end": modifiers.range_end, "data-range-middle": modifiers.range_middle, "aria-label": `${monthName} ${dayNumber}, ${year}`, "aria-selected": modifiers.selected, "aria-current": modifiers.today ? 'date' : undefined, "aria-disabled": modifiers.disabled, role: "gridcell", tabIndex: modifiers.focused ? 0 : -1, className: (0, utils_1.cn)('data-[selected-single=true]:bg-primary data-[selected-single=true]:text-primary-foreground data-[range-middle=true]:bg-muted data-[range-middle=true]:text-foreground data-[range-start=true]:bg-primary data-[range-start=true]:text-primary-foreground data-[range-end=true]:bg-primary data-[range-end=true]:text-primary-foreground group-data-[focused=true]/day:border-ring group-data-[focused=true]/day:ring-ring/50 dark:hover:text-foreground relative isolate z-10 flex aspect-square size-auto w-full min-w-(--cell-size) flex-col gap-1 border-0 leading-none font-normal group-data-[focused=true]/day:relative group-data-[focused=true]/day:z-10 group-data-[focused=true]/day:ring-[3px] data-[range-end=true]:rounded-(--cell-radius) data-[range-end=true]:rounded-r-(--cell-radius) data-[range-middle=true]:rounded-none data-[range-start=true]:rounded-(--cell-radius) data-[range-start=true]:rounded-l-(--cell-radius) [&>span]:text-xs [&>span]:opacity-70', defaultClassNames.day, className), ...props }));
115
+ }
@@ -0,0 +1,25 @@
1
+ import { type VariantProps } from 'class-variance-authority';
2
+ import { Label } from '../../../components/ui/label';
3
+ declare function FieldSet({ className, ...props }: React.ComponentProps<'fieldset'>): import("react/jsx-runtime").JSX.Element;
4
+ declare function FieldLegend({ className, variant, ...props }: React.ComponentProps<'legend'> & {
5
+ variant?: 'legend' | 'label';
6
+ }): import("react/jsx-runtime").JSX.Element;
7
+ declare function FieldGroup({ className, ...props }: React.ComponentProps<'div'>): import("react/jsx-runtime").JSX.Element;
8
+ declare const fieldVariants: (props?: ({
9
+ orientation?: "horizontal" | "vertical" | "responsive" | null | undefined;
10
+ } & import("class-variance-authority/types").ClassProp) | undefined) => string;
11
+ declare function Field({ className, orientation, ...props }: React.ComponentProps<'div'> & VariantProps<typeof fieldVariants>): import("react/jsx-runtime").JSX.Element;
12
+ declare function FieldContent({ className, ...props }: React.ComponentProps<'div'>): import("react/jsx-runtime").JSX.Element;
13
+ declare function FieldLabel({ className, ...props }: React.ComponentProps<typeof Label>): import("react/jsx-runtime").JSX.Element;
14
+ declare function FieldTitle({ className, ...props }: React.ComponentProps<'div'>): import("react/jsx-runtime").JSX.Element;
15
+ declare function FieldDescription({ className, ...props }: React.ComponentProps<'p'>): import("react/jsx-runtime").JSX.Element;
16
+ declare function FieldSeparator({ children, className, ...props }: React.ComponentProps<'div'> & {
17
+ children?: React.ReactNode;
18
+ }): import("react/jsx-runtime").JSX.Element;
19
+ declare function FieldError({ className, children, errors, ...props }: React.ComponentProps<'div'> & {
20
+ errors?: Array<{
21
+ message?: string;
22
+ } | undefined>;
23
+ }): import("react/jsx-runtime").JSX.Element | null;
24
+ export { Field, FieldLabel, FieldDescription, FieldError, FieldGroup, FieldLegend, FieldSeparator, FieldSet, FieldContent, FieldTitle };
25
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/ui/field/index.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAO,KAAK,YAAY,EAAE,MAAM,0BAA0B,CAAA;AAGjE,OAAO,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAA;AAG7C,iBAAS,QAAQ,CAAC,EAAE,SAAS,EAAE,GAAG,KAAK,EAAE,EAAE,KAAK,CAAC,cAAc,CAAC,UAAU,CAAC,2CAW1E;AAED,iBAAS,WAAW,CAAC,EACnB,SAAS,EACT,OAAkB,EAClB,GAAG,KAAK,EACT,EAAE,KAAK,CAAC,cAAc,CAAC,QAAQ,CAAC,GAAG;IAAE,OAAO,CAAC,EAAE,QAAQ,GAAG,OAAO,CAAA;CAAE,2CAYnE;AAED,iBAAS,UAAU,CAAC,EAAE,SAAS,EAAE,GAAG,KAAK,EAAE,EAAE,KAAK,CAAC,cAAc,CAAC,KAAK,CAAC,2CAWvE;AAED,QAAA,MAAM,aAAa;;8EAgBlB,CAAA;AAED,iBAAS,KAAK,CAAC,EACb,SAAS,EACT,WAAwB,EACxB,GAAG,KAAK,EACT,EAAE,KAAK,CAAC,cAAc,CAAC,KAAK,CAAC,GAAG,YAAY,CAAC,OAAO,aAAa,CAAC,2CAUlE;AAED,iBAAS,YAAY,CAAC,EAAE,SAAS,EAAE,GAAG,KAAK,EAAE,EAAE,KAAK,CAAC,cAAc,CAAC,KAAK,CAAC,2CAWzE;AAED,iBAAS,UAAU,CAAC,EAClB,SAAS,EACT,GAAG,KAAK,EACT,EAAE,KAAK,CAAC,cAAc,CAAC,OAAO,KAAK,CAAC,2CAYpC;AAED,iBAAS,UAAU,CAAC,EAAE,SAAS,EAAE,GAAG,KAAK,EAAE,EAAE,KAAK,CAAC,cAAc,CAAC,KAAK,CAAC,2CAWvE;AAED,iBAAS,gBAAgB,CAAC,EAAE,SAAS,EAAE,GAAG,KAAK,EAAE,EAAE,KAAK,CAAC,cAAc,CAAC,GAAG,CAAC,2CAa3E;AAED,iBAAS,cAAc,CAAC,EACtB,QAAQ,EACR,SAAS,EACT,GAAG,KAAK,EACT,EAAE,KAAK,CAAC,cAAc,CAAC,KAAK,CAAC,GAAG;IAC/B,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAA;CAC3B,2CAsBA;AAED,iBAAS,UAAU,CAAC,EAClB,SAAS,EACT,QAAQ,EACR,MAAM,EACN,GAAG,KAAK,EACT,EAAE,KAAK,CAAC,cAAc,CAAC,KAAK,CAAC,GAAG;IAC/B,MAAM,CAAC,EAAE,KAAK,CAAC;QAAE,OAAO,CAAC,EAAE,MAAM,CAAA;KAAE,GAAG,SAAS,CAAC,CAAA;CACjD,kDA0CA;AAED,OAAO,EACL,KAAK,EACL,UAAU,EACV,gBAAgB,EAChB,UAAU,EACV,UAAU,EACV,WAAW,EACX,cAAc,EACd,QAAQ,EACR,YAAY,EACZ,UAAU,EACX,CAAA"}
@@ -0,0 +1,79 @@
1
+ 'use client';
2
+ "use strict";
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.Field = Field;
5
+ exports.FieldLabel = FieldLabel;
6
+ exports.FieldDescription = FieldDescription;
7
+ exports.FieldError = FieldError;
8
+ exports.FieldGroup = FieldGroup;
9
+ exports.FieldLegend = FieldLegend;
10
+ exports.FieldSeparator = FieldSeparator;
11
+ exports.FieldSet = FieldSet;
12
+ exports.FieldContent = FieldContent;
13
+ exports.FieldTitle = FieldTitle;
14
+ const jsx_runtime_1 = require("react/jsx-runtime");
15
+ const react_1 = require("react");
16
+ const class_variance_authority_1 = require("class-variance-authority");
17
+ const utils_1 = require("../../../lib/utils");
18
+ const label_1 = require("../../../components/ui/label");
19
+ const separator_1 = require("../../../components/ui/separator");
20
+ function FieldSet({ className, ...props }) {
21
+ return ((0, jsx_runtime_1.jsx)("fieldset", { "data-slot": "field-set", className: (0, utils_1.cn)('flex flex-col gap-4 has-[>[data-slot=checkbox-group]]:gap-3 has-[>[data-slot=radio-group]]:gap-3', className), ...props }));
22
+ }
23
+ function FieldLegend({ className, variant = 'legend', ...props }) {
24
+ return ((0, jsx_runtime_1.jsx)("legend", { "data-slot": "field-legend", "data-variant": variant, className: (0, utils_1.cn)('mb-1.5 font-medium data-[variant=label]:text-sm data-[variant=legend]:text-base', className), ...props }));
25
+ }
26
+ function FieldGroup({ className, ...props }) {
27
+ return ((0, jsx_runtime_1.jsx)("div", { "data-slot": "field-group", className: (0, utils_1.cn)('group/field-group @container/field-group flex w-full flex-col gap-5 data-[slot=checkbox-group]:gap-3 [&>[data-slot=field-group]]:gap-4', className), ...props }));
28
+ }
29
+ const fieldVariants = (0, class_variance_authority_1.cva)('data-[invalid=true]:text-destructive gap-2 group/field flex w-full', {
30
+ variants: {
31
+ orientation: {
32
+ vertical: 'flex-col [&>*]:w-full [&>.sr-only]:w-auto',
33
+ horizontal: 'flex-row items-center [&>[data-slot=field-label]]:flex-auto has-[>[data-slot=field-content]]:items-start has-[>[data-slot=field-content]]:[&>[role=checkbox],[role=radio]]:mt-px',
34
+ responsive: 'flex-col [&>*]:w-full [&>.sr-only]:w-auto @md/field-group:flex-row @md/field-group:items-center @md/field-group:[&>*]:w-auto @md/field-group:[&>[data-slot=field-label]]:flex-auto @md/field-group:has-[>[data-slot=field-content]]:items-start @md/field-group:has-[>[data-slot=field-content]]:[&>[role=checkbox],[role=radio]]:mt-px'
35
+ }
36
+ },
37
+ defaultVariants: {
38
+ orientation: 'vertical'
39
+ }
40
+ });
41
+ function Field({ className, orientation = 'vertical', ...props }) {
42
+ return ((0, jsx_runtime_1.jsx)("div", { role: "group", "data-slot": "field", "data-orientation": orientation, className: (0, utils_1.cn)(fieldVariants({ orientation }), className), ...props }));
43
+ }
44
+ function FieldContent({ className, ...props }) {
45
+ return ((0, jsx_runtime_1.jsx)("div", { "data-slot": "field-content", className: (0, utils_1.cn)('group/field-content flex flex-1 flex-col gap-0.5 leading-snug', className), ...props }));
46
+ }
47
+ function FieldLabel({ className, ...props }) {
48
+ return ((0, jsx_runtime_1.jsx)(label_1.Label, { "data-slot": "field-label", className: (0, utils_1.cn)('has-data-checked:bg-primary/5 has-data-checked:border-primary dark:has-data-checked:bg-primary/10 group/field-label peer/field-label flex w-fit gap-2 leading-snug group-data-[disabled=true]/field:opacity-50 has-[>[data-slot=field]]:rounded-lg has-[>[data-slot=field]]:border [&>*]:data-[slot=field]:p-2.5', 'has-[>[data-slot=field]]:w-full has-[>[data-slot=field]]:flex-col', className), ...props }));
49
+ }
50
+ function FieldTitle({ className, ...props }) {
51
+ return ((0, jsx_runtime_1.jsx)("div", { "data-slot": "field-label", className: (0, utils_1.cn)('flex w-fit items-center gap-2 text-sm leading-snug font-medium group-data-[disabled=true]/field:opacity-50', className), ...props }));
52
+ }
53
+ function FieldDescription({ className, ...props }) {
54
+ return ((0, jsx_runtime_1.jsx)("p", { "data-slot": "field-description", className: (0, utils_1.cn)('text-muted-foreground text-left text-sm leading-normal font-normal group-has-[[data-orientation=horizontal]]/field:text-balance [[data-variant=legend]+&]:-mt-1.5', 'last:mt-0 nth-last-2:-mt-1', '[&>a:hover]:text-primary [&>a]:underline [&>a]:underline-offset-4', className), ...props }));
55
+ }
56
+ function FieldSeparator({ children, className, ...props }) {
57
+ return ((0, jsx_runtime_1.jsxs)("div", { "data-slot": "field-separator", "data-content": !!children, className: (0, utils_1.cn)('relative -my-2 h-5 text-sm group-data-[variant=outline]/field-group:-mb-2', className), ...props, children: [(0, jsx_runtime_1.jsx)(separator_1.Separator, { className: "absolute inset-0 top-1/2" }), children && ((0, jsx_runtime_1.jsx)("span", { className: "text-muted-foreground bg-background relative mx-auto block w-fit px-2", "data-slot": "field-separator-content", children: children }))] }));
58
+ }
59
+ function FieldError({ className, children, errors, ...props }) {
60
+ const content = (0, react_1.useMemo)(() => {
61
+ if (children) {
62
+ return children;
63
+ }
64
+ if (!errors?.length) {
65
+ return null;
66
+ }
67
+ const uniqueErrors = [
68
+ ...new Map(errors.map((error) => [error?.message, error])).values()
69
+ ];
70
+ if (uniqueErrors?.length === 1) {
71
+ return uniqueErrors[0]?.message;
72
+ }
73
+ return ((0, jsx_runtime_1.jsx)("ul", { className: "ml-4 flex list-disc flex-col gap-1", children: uniqueErrors.map((error, index) => error?.message && (0, jsx_runtime_1.jsx)("li", { children: error.message }, index)) }));
74
+ }, [children, errors]);
75
+ if (!content) {
76
+ return null;
77
+ }
78
+ return ((0, jsx_runtime_1.jsx)("div", { role: "alert", "data-slot": "field-error", className: (0, utils_1.cn)('text-destructive text-sm font-normal', className), ...props, children: content }));
79
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lerianstudio/sindarian-ui",
3
- "version": "1.0.0-beta.29",
3
+ "version": "1.0.0-beta.30",
4
4
  "description": "Sindarian UI - A UI library for Midaz Console",
5
5
  "license": "ISC",
6
6
  "author": {
@@ -32,29 +32,29 @@
32
32
  "test:cov": "jest --coverage"
33
33
  },
34
34
  "dependencies": {
35
- "@radix-ui/react-avatar": "^1.1.10",
35
+ "@radix-ui/react-avatar": "^1.1.11",
36
36
  "@radix-ui/react-checkbox": "^1.3.3",
37
37
  "@radix-ui/react-collapsible": "^1.1.12",
38
38
  "@radix-ui/react-dialog": "^1.1.15",
39
39
  "@radix-ui/react-dropdown-menu": "^2.1.16",
40
- "@radix-ui/react-label": "^2.1.7",
40
+ "@radix-ui/react-label": "^2.1.8",
41
41
  "@radix-ui/react-popover": "^1.1.15",
42
- "@radix-ui/react-progress": "^1.1.7",
42
+ "@radix-ui/react-progress": "^1.1.8",
43
43
  "@radix-ui/react-select": "^2.2.6",
44
- "@radix-ui/react-separator": "^1.1.7",
45
- "@radix-ui/react-slot": "^1.2.3",
44
+ "@radix-ui/react-separator": "^1.1.8",
45
+ "@radix-ui/react-slot": "^1.2.4",
46
46
  "@radix-ui/react-switch": "^1.2.6",
47
47
  "@radix-ui/react-tabs": "^1.1.13",
48
48
  "@radix-ui/react-toast": "^1.2.15",
49
49
  "@radix-ui/react-tooltip": "^1.2.8",
50
- "@tailwindcss/postcss": "^4.1.16",
50
+ "@tailwindcss/postcss": "^4.1.18",
51
51
  "class-variance-authority": "^0.7.1",
52
52
  "clsx": "^2.1.1",
53
53
  "cmdk": "^1.1.1",
54
- "dayjs": "^1.11.18",
54
+ "dayjs": "^1.11.19",
55
55
  "postcss": "^8.5.6",
56
- "tailwind-merge": "^3.3.1",
57
- "tailwindcss": "^4.1.16",
56
+ "tailwind-merge": "^3.4.0",
57
+ "tailwindcss": "^4.1.18",
58
58
  "tw-animate-css": "^1.4.0"
59
59
  },
60
60
  "peerDependencies": {
@@ -62,16 +62,16 @@
62
62
  "lucide-react": ">=0.536.0",
63
63
  "react": ">=19.0.0",
64
64
  "react-dom": ">=19.0.0",
65
+ "react-day-picker": ">=9.13.0",
65
66
  "react-hook-form": ">=7.60.0"
66
67
  },
67
68
  "devDependencies": {
68
- "@chromatic-com/storybook": "^4.1.0",
69
- "@storybook/addon-docs": "^9.1.1",
70
- "@storybook/addon-links": "^9.1.1",
71
- "@storybook/addon-styling-webpack": "^1.0.1",
72
- "@storybook/nextjs": "^9.1.1",
73
- "@types/react": "^19.2.2",
74
- "storybook": "^9.1.1"
69
+ "@chromatic-com/storybook": "^5.0.0",
70
+ "@storybook/addon-docs": "^10.2.0",
71
+ "@storybook/addon-links": "^10.2.0",
72
+ "@storybook/nextjs": "^10.2.0",
73
+ "@types/react": "^19.2.9",
74
+ "storybook": "^10.2.0"
75
75
  },
76
76
  "publishConfig": {
77
77
  "access": "public"