@clasing/ui 2.0.1 → 2.0.2

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.
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("../calendar-gxLdKgjb.cjs");exports.Calendar=e.Calendar;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("../jsx-runtime-BuHQgaKs.cjs"),y=require("react"),m=require("react-day-picker"),p=require("../button-BnSM-lrr.cjs"),g=require("../icon-component-D5YssRbR.cjs"),e=require("../index-DoxiiusW.cjs");function h(r){const d=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(r){for(const n in r)if(n!=="default"){const s=Object.getOwnPropertyDescriptor(r,n);Object.defineProperty(d,n,s.get?s:{enumerable:!0,get:()=>r[n]})}}return d.default=r,Object.freeze(d)}const f=h(y);function _({className:r,classNames:d,showOutsideDays:n=!0,captionLayout:s="label",buttonVariant:l="inverse",formatters:i,components:x,...b}){const t=m.getDefaultClassNames();return o.jsxRuntimeExports.jsx(m.DayPicker,{showOutsideDays:n,className:e.cn("bg-background group/calendar p-3 [--cell-size:--spacing(8)] [[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`,r),captionLayout:s,formatters:{formatMonthDropdown:a=>a.toLocaleString("default",{month:"short"}),...i},classNames:{root:e.cn("w-fit",t.root),months:e.cn("flex gap-4 flex-col md:flex-row relative",t.months),month:e.cn("flex flex-col w-full gap-4",t.month),nav:e.cn("flex items-center gap-1 w-full absolute top-0 inset-x-0 justify-between",t.nav),button_previous:e.cn(p.buttonStyles({variant:l}),"size-(--cell-size) aria-disabled:opacity-50 p-0 select-none",t.button_previous),button_next:e.cn(p.buttonStyles({variant:l}),"size-(--cell-size) aria-disabled:opacity-50 p-0 select-none",t.button_next),month_caption:e.cn("flex items-center justify-center h-(--cell-size) w-full px-(--cell-size)",t.month_caption),dropdowns:e.cn("w-full flex items-center text-paragraph-sm font-medium justify-center h-(--cell-size) gap-1.5",t.dropdowns),dropdown_root:e.cn("relative has-focus:border-ring border border-input has-focus:ring-ring/50 has-focus:ring-[3px] rounded-md",t.dropdown_root),dropdown:e.cn("absolute bg-popover inset-0 opacity-0",t.dropdown),caption_label:e.cn("select-none font-medium",s==="label"?"text-paragraph-sm":"rounded-md pl-2 pr-1 flex items-center gap-1 text-paragraph-sm h-8 [&>svg]:text-muted-foreground [&>svg]:size-3.5",t.caption_label),table:"w-full border-collapse",weekdays:e.cn("flex",t.weekdays),weekday:e.cn("text-muted-foreground rounded-md flex-1 font-normal text-[0.8rem] select-none",t.weekday),week:e.cn("flex w-full mt-2",t.week),week_number_header:e.cn("select-none w-(--cell-size)",t.week_number_header),week_number:e.cn("text-[0.8rem] select-none text-muted-foreground",t.week_number),day:e.cn("relative w-full h-full p-0 text-center [&:first-child[data-selected=true]_button]:rounded-l-md [&:last-child[data-selected=true]_button]:rounded-r-md group/day aspect-square select-none",t.day),range_start:e.cn("rounded-l-md bg-accent",t.range_start),range_middle:e.cn("rounded-none",t.range_middle),range_end:e.cn("rounded-r-md bg-accent",t.range_end),today:e.cn("bg-accent text-accent-foreground rounded-md data-[selected=true]:rounded-none",t.today),outside:e.cn("text-muted-foreground aria-selected:text-muted-foreground",t.outside),disabled:e.cn("text-muted-foreground opacity-50",t.disabled),hidden:e.cn("invisible",t.hidden),...d},components:{Root:({className:a,rootRef:c,...u})=>o.jsxRuntimeExports.jsx("div",{"data-slot":"calendar",ref:c,className:e.cn(a),...u}),Chevron:({className:a,orientation:c,...u})=>c==="left"?o.jsxRuntimeExports.jsx(g.IconComponent,{iconName:"IconChevronLeft",className:e.cn("size-4",a),...u}):c==="right"?o.jsxRuntimeExports.jsx(g.IconComponent,{iconName:"IconChevronRight",className:e.cn("size-4",a),...u}):o.jsxRuntimeExports.jsx(g.IconComponent,{iconName:"IconChevronDown",className:e.cn("size-4",a),...u}),DayButton:v,WeekNumber:({children:a,...c})=>o.jsxRuntimeExports.jsx("td",{...c,children:o.jsxRuntimeExports.jsx("div",{className:"flex size-(--cell-size) items-center justify-center text-center",children:a})}),...x},...b})}function v({className:r,day:d,modifiers:n,...s}){const l=m.getDefaultClassNames(),i=f.useRef(null);return f.useEffect(()=>{n.focused&&i.current?.focus()},[n.focused]),o.jsxRuntimeExports.jsx(p.Button,{ref:i,variant:"inverse",size:"sm","data-day":d.date.toLocaleDateString(),"data-selected-single":n.selected&&!n.range_start&&!n.range_end&&!n.range_middle,"data-range-start":n.range_start,"data-range-end":n.range_end,"data-range-middle":n.range_middle,className:e.cn("data-[selected-single=true]:bg-secondary data-[selected-single=true]:text-secondary-foreground data-[range-middle=true]:bg-blue-050 data-[range-start=true]:bg-secondary data-[range-start=true]:text-secondary-foreground data-[range-end=true]:bg-secondary data-[range-end=true]:text-secondary-foreground group-data-[focused=true]/day:border-ring group-data-[focused=true]/day:ring-ring/50 dark:hover:text-accent-foreground data-[selected-single=true]:hover:bg-secondary/80 data-[selected-single=true]:hover:text-secondary-foreground data-[range-start=true]:hover:bg-secondary/80 data-[range-end=true]:hover:bg-secondary/80 flex aspect-square size-auto w-full min-w-(--cell-size) flex-col gap-1 rounded-md p-1 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-md data-[range-end=true]:rounded-r-md data-[range-middle=true]:rounded-none data-[range-middle=true]:text-blue-800 data-[range-start=true]:rounded-md data-[range-start=true]:rounded-l-md [&>span]:text-xs [&>span]:opacity-70",l.day,r),...s})}exports.Calendar=_;
@@ -1,15 +1,8 @@
1
- import 'react-day-picker/dist/style.css';
2
- export interface ICalendarProps {
3
- locale?: 'enGB' | 'enUS' | 'es' | 'fr';
4
- disabledDates?: string | string[] | Date | Date[] | undefined;
5
- enabledDates?: string | string[] | Date | Date[] | undefined;
6
- dropdownsSelectors?: boolean;
7
- hideNavigation?: boolean;
8
- showOutsideDays?: boolean;
9
- minDate?: Date;
10
- maxDate?: Date;
11
- value?: string;
12
- onChange?: (value: string | undefined) => void | undefined;
13
- className?: string;
14
- }
15
- export declare const Calendar: React.FC<ICalendarProps>;
1
+ import * as React from 'react';
2
+ import { DayButton, DayPicker } from 'react-day-picker';
3
+ import { Button } from '@/components/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 };
@@ -1,4 +1,190 @@
1
- import { C as e } from "../calendar-DA08oJl2.js";
1
+ import { j as n } from "../jsx-runtime-DywqP_6a.js";
2
+ import * as m from "react";
3
+ import { getDefaultClassNames as p, DayPicker as y } from "react-day-picker";
4
+ import { c as f, B as h } from "../button-C5IBh3Tr.js";
5
+ import { I as g } from "../icon-component-CxQsODCa.js";
6
+ import { c as e } from "../index-CRiPKpXj.js";
7
+ function k({
8
+ className: c,
9
+ classNames: i,
10
+ showOutsideDays: a = !0,
11
+ captionLayout: s = "label",
12
+ buttonVariant: l = "inverse",
13
+ formatters: u,
14
+ components: x,
15
+ ...b
16
+ }) {
17
+ const t = p();
18
+ return /* @__PURE__ */ n.jsx(
19
+ y,
20
+ {
21
+ showOutsideDays: a,
22
+ className: e(
23
+ "bg-background group/calendar p-3 [--cell-size:--spacing(8)] [[data-slot=card-content]_&]:bg-transparent [[data-slot=popover-content]_&]:bg-transparent",
24
+ String.raw`rtl:**:[.rdp-button\_next>svg]:rotate-180`,
25
+ String.raw`rtl:**:[.rdp-button\_previous>svg]:rotate-180`,
26
+ c
27
+ ),
28
+ captionLayout: s,
29
+ formatters: {
30
+ formatMonthDropdown: (r) => r.toLocaleString("default", { month: "short" }),
31
+ ...u
32
+ },
33
+ classNames: {
34
+ root: e("w-fit", t.root),
35
+ months: e(
36
+ "flex gap-4 flex-col md:flex-row relative",
37
+ t.months
38
+ ),
39
+ month: e("flex flex-col w-full gap-4", t.month),
40
+ nav: e(
41
+ "flex items-center gap-1 w-full absolute top-0 inset-x-0 justify-between",
42
+ t.nav
43
+ ),
44
+ button_previous: e(
45
+ f({ variant: l }),
46
+ "size-(--cell-size) aria-disabled:opacity-50 p-0 select-none",
47
+ t.button_previous
48
+ ),
49
+ button_next: e(
50
+ f({ variant: l }),
51
+ "size-(--cell-size) aria-disabled:opacity-50 p-0 select-none",
52
+ t.button_next
53
+ ),
54
+ month_caption: e(
55
+ "flex items-center justify-center h-(--cell-size) w-full px-(--cell-size)",
56
+ t.month_caption
57
+ ),
58
+ dropdowns: e(
59
+ "w-full flex items-center text-paragraph-sm font-medium justify-center h-(--cell-size) gap-1.5",
60
+ t.dropdowns
61
+ ),
62
+ dropdown_root: e(
63
+ "relative has-focus:border-ring border border-input has-focus:ring-ring/50 has-focus:ring-[3px] rounded-md",
64
+ t.dropdown_root
65
+ ),
66
+ dropdown: e(
67
+ "absolute bg-popover inset-0 opacity-0",
68
+ t.dropdown
69
+ ),
70
+ caption_label: e(
71
+ "select-none font-medium",
72
+ s === "label" ? "text-paragraph-sm" : "rounded-md pl-2 pr-1 flex items-center gap-1 text-paragraph-sm h-8 [&>svg]:text-muted-foreground [&>svg]:size-3.5",
73
+ t.caption_label
74
+ ),
75
+ table: "w-full border-collapse",
76
+ weekdays: e("flex", t.weekdays),
77
+ weekday: e(
78
+ "text-muted-foreground rounded-md flex-1 font-normal text-[0.8rem] select-none",
79
+ t.weekday
80
+ ),
81
+ week: e("flex w-full mt-2", t.week),
82
+ week_number_header: e(
83
+ "select-none w-(--cell-size)",
84
+ t.week_number_header
85
+ ),
86
+ week_number: e(
87
+ "text-[0.8rem] select-none text-muted-foreground",
88
+ t.week_number
89
+ ),
90
+ day: e(
91
+ "relative w-full h-full p-0 text-center [&:first-child[data-selected=true]_button]:rounded-l-md [&:last-child[data-selected=true]_button]:rounded-r-md group/day aspect-square select-none",
92
+ t.day
93
+ ),
94
+ range_start: e(
95
+ "rounded-l-md bg-accent",
96
+ t.range_start
97
+ ),
98
+ range_middle: e("rounded-none", t.range_middle),
99
+ range_end: e("rounded-r-md bg-accent", t.range_end),
100
+ today: e(
101
+ "bg-accent text-accent-foreground rounded-md data-[selected=true]:rounded-none",
102
+ t.today
103
+ ),
104
+ outside: e(
105
+ "text-muted-foreground aria-selected:text-muted-foreground",
106
+ t.outside
107
+ ),
108
+ disabled: e(
109
+ "text-muted-foreground opacity-50",
110
+ t.disabled
111
+ ),
112
+ hidden: e("invisible", t.hidden),
113
+ ...i
114
+ },
115
+ components: {
116
+ Root: ({
117
+ className: r,
118
+ rootRef: d,
119
+ ...o
120
+ }) => /* @__PURE__ */ n.jsx(
121
+ "div",
122
+ {
123
+ "data-slot": "calendar",
124
+ ref: d,
125
+ className: e(r),
126
+ ...o
127
+ }
128
+ ),
129
+ Chevron: ({ className: r, orientation: d, ...o }) => d === "left" ? /* @__PURE__ */ n.jsx(
130
+ g,
131
+ {
132
+ iconName: "IconChevronLeft",
133
+ className: e("size-4", r),
134
+ ...o
135
+ }
136
+ ) : d === "right" ? /* @__PURE__ */ n.jsx(
137
+ g,
138
+ {
139
+ iconName: "IconChevronRight",
140
+ className: e("size-4", r),
141
+ ...o
142
+ }
143
+ ) : /* @__PURE__ */ n.jsx(
144
+ g,
145
+ {
146
+ iconName: "IconChevronDown",
147
+ className: e("size-4", r),
148
+ ...o
149
+ }
150
+ ),
151
+ DayButton: _,
152
+ WeekNumber: ({ children: r, ...d }) => /* @__PURE__ */ n.jsx("td", { ...d, children: /* @__PURE__ */ n.jsx("div", { className: "flex size-(--cell-size) items-center justify-center text-center", children: r }) }),
153
+ ...x
154
+ },
155
+ ...b
156
+ }
157
+ );
158
+ }
159
+ function _({
160
+ className: c,
161
+ day: i,
162
+ modifiers: a,
163
+ ...s
164
+ }) {
165
+ const l = p(), u = m.useRef(null);
166
+ return m.useEffect(() => {
167
+ a.focused && u.current?.focus();
168
+ }, [a.focused]), /* @__PURE__ */ n.jsx(
169
+ h,
170
+ {
171
+ ref: u,
172
+ variant: "inverse",
173
+ size: "sm",
174
+ "data-day": i.date.toLocaleDateString(),
175
+ "data-selected-single": a.selected && !a.range_start && !a.range_end && !a.range_middle,
176
+ "data-range-start": a.range_start,
177
+ "data-range-end": a.range_end,
178
+ "data-range-middle": a.range_middle,
179
+ className: e(
180
+ "data-[selected-single=true]:bg-secondary data-[selected-single=true]:text-secondary-foreground data-[range-middle=true]:bg-blue-050 data-[range-start=true]:bg-secondary data-[range-start=true]:text-secondary-foreground data-[range-end=true]:bg-secondary data-[range-end=true]:text-secondary-foreground group-data-[focused=true]/day:border-ring group-data-[focused=true]/day:ring-ring/50 dark:hover:text-accent-foreground data-[selected-single=true]:hover:bg-secondary/80 data-[selected-single=true]:hover:text-secondary-foreground data-[range-start=true]:hover:bg-secondary/80 data-[range-end=true]:hover:bg-secondary/80 flex aspect-square size-auto w-full min-w-(--cell-size) flex-col gap-1 rounded-md p-1 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-md data-[range-end=true]:rounded-r-md data-[range-middle=true]:rounded-none data-[range-middle=true]:text-blue-800 data-[range-start=true]:rounded-md data-[range-start=true]:rounded-l-md [&>span]:text-xs [&>span]:opacity-70",
181
+ l.day,
182
+ c
183
+ ),
184
+ ...s
185
+ }
186
+ );
187
+ }
2
188
  export {
3
- e as Calendar
189
+ k as Calendar
4
190
  };
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("../jsx-runtime-BuHQgaKs.cjs"),y=require("../label-U5GnYvFO.cjs"),a=require("../index-DoxiiusW.cjs"),R=require("../index-C8P6Mn4U.cjs"),u=require("../icon-component-D5YssRbR.cjs"),E=R.cva("placeholder:text-muted-foreground selection:bg-primary selection:text-primary-foreground dark:bg-input/30 border-input flex w-full min-w-0 resize-none border bg-transparent transition-[color,box-shadow] outline-none disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50",{variants:{size:{sm:"text-label-md min-h-20 rounded-sm px-2 py-1",md:"text-label-lg min-h-24 rounded-md px-3 py-2",lg:"text-label-xl min-h-32 rounded-lg px-4 py-3"},rounded:{default:"",full:"rounded-2xl"},state:{default:"",error:"border-destructive ring-destructive/20 dark:ring-destructive/40",success:"border-success ring-success/20 dark:ring-success/40"},resize:{none:"resize-none",vertical:"resize-y",horizontal:"resize-x",both:"resize"}},defaultVariants:{size:"md",rounded:"default",state:"default",resize:"vertical"}});function h({className:b,label:x,helperText:c,error:s,touched:i,iconName:m,size:v,rounded:f,state:p,resize:j,containerClassName:g,maxLength:n,showCharacterCount:z=!1,...e}){const l=m?(o=>typeof o=="string"?{name:o}:o)(m):void 0,r=s&&i?"error":i&&!s&&e.value?"success":"default",d=e.value?String(e.value).length:0,N=z||n;return t.jsxRuntimeExports.jsxs("div",{className:a.cn("flex flex-col gap-2",g),children:[x&&t.jsxRuntimeExports.jsx(y.Label,{htmlFor:e.id,className:a.cn({"text-neutral-700":e.disabled}),children:x}),t.jsxRuntimeExports.jsxs("div",{className:"relative w-full",children:[t.jsxRuntimeExports.jsx("textarea",{"data-slot":"textarea","aria-describedby":e.id&&c?`${e.id}-helper-text`:void 0,"aria-invalid":!!(s&&i),"aria-errormessage":e.id&&s?`${e.id}-error-text`:void 0,maxLength:n,className:a.cn(E({size:v,rounded:f,resize:j,state:r,className:a.cn("focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px]",l?"pr-10":"",b)})),...e}),l&&t.jsxRuntimeExports.jsx("span",{className:a.cn("absolute top-3 right-3",{"text-muted-foreground":r==="default","text-destructive":r==="error","text-success-main":r==="success","text-neutral-700":e.disabled}),children:t.jsxRuntimeExports.jsx(u.IconComponent,{iconName:l.name,stroke:l.stroke,size:20})}),!l&&s&&i&&t.jsxRuntimeExports.jsx(u.IconComponent,{iconName:"IconAlertCircleFilled",size:20,className:"text-destructive absolute top-3 right-3"}),!l&&i&&!s&&e.value&&t.jsxRuntimeExports.jsx(u.IconComponent,{iconName:"IconCircleCheckFilled",size:20,className:"text-success-main absolute top-3 right-3"})]}),N&&t.jsxRuntimeExports.jsx("div",{className:"flex justify-end",children:t.jsxRuntimeExports.jsx("span",{className:a.cn("text-label-sm",{"text-muted-foreground":!n||d<=n,"text-destructive":n&&d>n}),children:n?`${d}/${n}`:d})}),s&&i?t.jsxRuntimeExports.jsx("span",{id:e.id&&`${e.id}-error-text`,"aria-invalid":!0,className:"text-destructive text-label-md",children:s}):c?t.jsxRuntimeExports.jsx("span",{id:e.id&&`${e.id}-helper-text`,className:a.cn("text-label-md",{"text-muted-foreground":!s&&!i,"text-destructive":s&&i,"text-success-main":i&&!s&&e.value!==void 0,"text-neutral-700":e.disabled}),children:c}):null]})}exports.Textarea=h;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("../jsx-runtime-BuHQgaKs.cjs"),a=require("../index-DoxiiusW.cjs"),v=require("../index-C8P6Mn4U.cjs"),p=require("../icon-component-D5YssRbR.cjs"),x=v.cva("placeholder:text-muted-foreground selection:bg-primary selection:text-primary-foreground dark:bg-input/30 border-input flex w-full min-w-0 rounded-md border bg-transparent transition-[color,box-shadow] outline-none disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50",{variants:{size:{xs:"text-label-sm min-h-16 px-2 py-1",sm:"text-label-md min-h-20 px-2 py-1",md:"text-label-lg min-h-24 px-3 py-2",lg:"text-label-xl min-h-32 px-4 py-3"},resize:{none:"resize-none",vertical:"resize-y",horizontal:"resize-x",both:"resize"}},defaultVariants:{size:"md",resize:"vertical"}});function b({className:o,size:l,resize:d,iconName:u,maxLength:t,showCharacterCount:m=!1,...i}){const r=u?(n=>typeof n=="string"?{name:n}:n)(u):void 0,s=i.value?String(i.value).length:0,c=m||t;return!r&&!c?e.jsxRuntimeExports.jsx("textarea",{"data-slot":"textarea",maxLength:t,className:a.cn(x({size:l,resize:d}),"focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px]","aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive",o),...i}):e.jsxRuntimeExports.jsxs("div",{className:"space-y-2",children:[e.jsxRuntimeExports.jsxs("div",{className:"relative w-full",children:[e.jsxRuntimeExports.jsx("textarea",{"data-slot":"textarea",maxLength:t,className:a.cn(x({size:l,resize:d}),"focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px]","aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive",r?"pr-10":"",o),...i}),r&&e.jsxRuntimeExports.jsx("span",{className:"absolute top-3 right-3 text-muted-foreground",children:e.jsxRuntimeExports.jsx(p.IconComponent,{iconName:r.name,stroke:r.stroke,size:20})})]}),c&&e.jsxRuntimeExports.jsx("div",{className:"flex justify-end",children:e.jsxRuntimeExports.jsx("span",{className:a.cn("text-xs text-muted-foreground",{"text-destructive":t&&s>t}),children:t?`${s}/${t}`:s})})]})}exports.Textarea=b;
@@ -1,32 +1,20 @@
1
- import { type VariantProps } from 'class-variance-authority';
2
1
  import * as React from 'react';
2
+ import { type VariantProps } from 'class-variance-authority';
3
3
  import { TablerIconName } from './icon-component';
4
4
  declare const textareaStyles: (props?: ({
5
- size?: "lg" | "md" | "sm" | null | undefined;
6
- rounded?: "default" | "full" | null | undefined;
7
- state?: "default" | "error" | "success" | null | undefined;
5
+ size?: "lg" | "md" | "sm" | "xs" | null | undefined;
8
6
  resize?: "none" | "horizontal" | "vertical" | "both" | null | undefined;
9
7
  } & import("class-variance-authority/types").ClassProp) | undefined) => string;
10
8
  export interface TextareaProps extends VariantProps<typeof textareaStyles> {
11
- /** Label text shown above the textarea */
12
- label?: string;
13
- /** Helper text shown below the textarea */
14
- helperText?: string;
15
- /** Error message shown below the textarea */
16
- error?: string;
17
- /** Whether the textarea has been touched/blurred */
18
- touched?: boolean;
19
9
  /** Icon to display in the top-right corner of the textarea */
20
10
  iconName?: TablerIconName | {
21
11
  name: TablerIconName;
22
12
  stroke?: string;
23
13
  };
24
- /** Container className for the entire textarea component including label and helper text */
25
- containerClassName?: string;
26
14
  /** Maximum number of characters allowed */
27
15
  maxLength?: number;
28
16
  /** Show character count */
29
17
  showCharacterCount?: boolean;
30
18
  }
31
- declare function Textarea({ className, label, helperText, error, touched, iconName, size, rounded, state, resize, containerClassName, maxLength, showCharacterCount, ...props }: Omit<React.ComponentProps<'textarea'>, 'size'> & TextareaProps): import("react/jsx-runtime").JSX.Element;
32
- export { Textarea, textareaStyles };
19
+ declare function Textarea({ className, size, resize, iconName, maxLength, showCharacterCount, ...props }: Omit<React.ComponentProps<'textarea'>, 'size'> & TextareaProps): import("react/jsx-runtime").JSX.Element;
20
+ export { Textarea };
@@ -1,25 +1,16 @@
1
- import { j as t } from "../jsx-runtime-DywqP_6a.js";
2
- import { L as y } from "../label-_kG7WBoJ.js";
3
- import { c as l } from "../index-CRiPKpXj.js";
4
- import { c as h } from "../index-BqtVL8d-.js";
5
- import { I as u } from "../icon-component-CxQsODCa.js";
6
- const I = h(
7
- "placeholder:text-muted-foreground selection:bg-primary selection:text-primary-foreground dark:bg-input/30 border-input flex w-full min-w-0 resize-none border bg-transparent transition-[color,box-shadow] outline-none disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50",
1
+ import { j as e } from "../jsx-runtime-DywqP_6a.js";
2
+ import { c as n } from "../index-CRiPKpXj.js";
3
+ import { c as v } from "../index-BqtVL8d-.js";
4
+ import { I as b } from "../icon-component-CxQsODCa.js";
5
+ const x = v(
6
+ "placeholder:text-muted-foreground selection:bg-primary selection:text-primary-foreground dark:bg-input/30 border-input flex w-full min-w-0 rounded-md border bg-transparent transition-[color,box-shadow] outline-none disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50",
8
7
  {
9
8
  variants: {
10
9
  size: {
11
- sm: "text-label-md min-h-20 rounded-sm px-2 py-1",
12
- md: "text-label-lg min-h-24 rounded-md px-3 py-2",
13
- lg: "text-label-xl min-h-32 rounded-lg px-4 py-3"
14
- },
15
- rounded: {
16
- default: "",
17
- full: "rounded-2xl"
18
- },
19
- state: {
20
- default: "",
21
- error: "border-destructive ring-destructive/20 dark:ring-destructive/40",
22
- success: "border-success ring-success/20 dark:ring-success/40"
10
+ xs: "text-label-sm min-h-16 px-2 py-1",
11
+ sm: "text-label-md min-h-20 px-2 py-1",
12
+ md: "text-label-lg min-h-24 px-3 py-2",
13
+ lg: "text-label-xl min-h-32 px-4 py-3"
23
14
  },
24
15
  resize: {
25
16
  none: "resize-none",
@@ -30,134 +21,70 @@ const I = h(
30
21
  },
31
22
  defaultVariants: {
32
23
  size: "md",
33
- rounded: "default",
34
- state: "default",
35
24
  resize: "vertical"
36
25
  }
37
26
  }
38
27
  );
39
- function E({
40
- className: f,
41
- label: x,
42
- helperText: c,
43
- error: s,
44
- touched: i,
45
- iconName: m,
46
- size: v,
47
- rounded: b,
48
- state: k,
49
- resize: g,
50
- containerClassName: z,
51
- maxLength: a,
52
- showCharacterCount: j = !1,
53
- ...e
28
+ function j({
29
+ className: o,
30
+ size: l,
31
+ resize: d,
32
+ iconName: c,
33
+ maxLength: r,
34
+ showCharacterCount: m = !1,
35
+ ...t
54
36
  }) {
55
- const r = m ? ((o) => typeof o == "string" ? { name: o } : o)(m) : void 0, n = s && i ? "error" : i && !s && e.value ? "success" : "default", d = e.value ? String(e.value).length : 0, N = j || a;
56
- return /* @__PURE__ */ t.jsxs("div", { className: l("flex flex-col gap-2", z), children: [
57
- x && /* @__PURE__ */ t.jsx(
58
- y,
59
- {
60
- htmlFor: e.id,
61
- className: l({
62
- "text-neutral-700": e.disabled
63
- }),
64
- children: x
65
- }
66
- ),
67
- /* @__PURE__ */ t.jsxs("div", { className: "relative w-full", children: [
68
- /* @__PURE__ */ t.jsx(
37
+ const i = c ? ((s) => typeof s == "string" ? { name: s } : s)(c) : void 0, a = t.value ? String(t.value).length : 0, u = m || r;
38
+ return !i && !u ? /* @__PURE__ */ e.jsx(
39
+ "textarea",
40
+ {
41
+ "data-slot": "textarea",
42
+ maxLength: r,
43
+ className: n(
44
+ x({ size: l, resize: d }),
45
+ "focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px]",
46
+ "aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive",
47
+ o
48
+ ),
49
+ ...t
50
+ }
51
+ ) : /* @__PURE__ */ e.jsxs("div", { className: "space-y-2", children: [
52
+ /* @__PURE__ */ e.jsxs("div", { className: "relative w-full", children: [
53
+ /* @__PURE__ */ e.jsx(
69
54
  "textarea",
70
55
  {
71
56
  "data-slot": "textarea",
72
- "aria-describedby": e.id && c ? `${e.id}-helper-text` : void 0,
73
- "aria-invalid": !!(s && i),
74
- "aria-errormessage": e.id && s ? `${e.id}-error-text` : void 0,
75
- maxLength: a,
76
- className: l(
77
- I({
78
- size: v,
79
- rounded: b,
80
- resize: g,
81
- state: n,
82
- className: l(
83
- "focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px]",
84
- r ? "pr-10" : "",
85
- f
86
- )
87
- })
57
+ maxLength: r,
58
+ className: n(
59
+ x({ size: l, resize: d }),
60
+ "focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px]",
61
+ "aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive",
62
+ i ? "pr-10" : "",
63
+ o
88
64
  ),
89
- ...e
90
- }
91
- ),
92
- r && /* @__PURE__ */ t.jsx(
93
- "span",
94
- {
95
- className: l("absolute top-3 right-3", {
96
- "text-muted-foreground": n === "default",
97
- "text-destructive": n === "error",
98
- "text-success-main": n === "success",
99
- "text-neutral-700": e.disabled
100
- }),
101
- children: /* @__PURE__ */ t.jsx(
102
- u,
103
- {
104
- iconName: r.name,
105
- stroke: r.stroke,
106
- size: 20
107
- }
108
- )
65
+ ...t
109
66
  }
110
67
  ),
111
- !r && s && i && /* @__PURE__ */ t.jsx(
112
- u,
68
+ i && /* @__PURE__ */ e.jsx("span", { className: "absolute top-3 right-3 text-muted-foreground", children: /* @__PURE__ */ e.jsx(
69
+ b,
113
70
  {
114
- iconName: "IconAlertCircleFilled",
115
- size: 20,
116
- className: "text-destructive absolute top-3 right-3"
71
+ iconName: i.name,
72
+ stroke: i.stroke,
73
+ size: 20
117
74
  }
118
- ),
119
- !r && i && !s && e.value && /* @__PURE__ */ t.jsx(
120
- u,
121
- {
122
- iconName: "IconCircleCheckFilled",
123
- size: 20,
124
- className: "text-success-main absolute top-3 right-3"
125
- }
126
- )
75
+ ) })
127
76
  ] }),
128
- N && /* @__PURE__ */ t.jsx("div", { className: "flex justify-end", children: /* @__PURE__ */ t.jsx(
129
- "span",
130
- {
131
- className: l("text-label-sm", {
132
- "text-muted-foreground": !a || d <= a,
133
- "text-destructive": a && d > a
134
- }),
135
- children: a ? `${d}/${a}` : d
136
- }
137
- ) }),
138
- s && i ? /* @__PURE__ */ t.jsx(
139
- "span",
140
- {
141
- id: e.id && `${e.id}-error-text`,
142
- "aria-invalid": !0,
143
- className: "text-destructive text-label-md",
144
- children: s
145
- }
146
- ) : c ? /* @__PURE__ */ t.jsx(
77
+ u && /* @__PURE__ */ e.jsx("div", { className: "flex justify-end", children: /* @__PURE__ */ e.jsx(
147
78
  "span",
148
79
  {
149
- id: e.id && `${e.id}-helper-text`,
150
- className: l("text-label-md", {
151
- "text-muted-foreground": !s && !i,
152
- "text-destructive": s && i,
153
- "text-success-main": i && !s && e.value !== void 0,
154
- "text-neutral-700": e.disabled
80
+ className: n("text-xs text-muted-foreground", {
81
+ "text-destructive": r && a > r
155
82
  }),
156
- children: c
83
+ children: r ? `${a}/${r}` : a
157
84
  }
158
- ) : null
85
+ ) })
159
86
  ] });
160
87
  }
161
88
  export {
162
- E as Textarea
89
+ j as Textarea
163
90
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@clasing/ui",
3
- "version": "2.0.1",
3
+ "version": "2.0.2",
4
4
  "type": "module",
5
5
  "main": "./dist/index.umd.js",
6
6
  "module": "./dist/index.es.js",
@@ -230,16 +230,6 @@
230
230
  "require": "./dist/components/tooltip.umd.js",
231
231
  "types": "./dist/components/tooltip.d.ts"
232
232
  },
233
- "./blocks/date-picker": {
234
- "import": "./dist/components/blocks/date-picker.es.js",
235
- "require": "./dist/components/blocks/date-picker.umd.js",
236
- "types": "./dist/components/blocks/date-picker.d.ts"
237
- },
238
- "./blocks/date-range-picker": {
239
- "import": "./dist/components/blocks/date-range-picker.es.js",
240
- "require": "./dist/components/blocks/date-range-picker.umd.js",
241
- "types": "./dist/components/blocks/date-range-picker.d.ts"
242
- },
243
233
  "./blocks/interactive-card": {
244
234
  "import": "./dist/components/blocks/interactive-card.es.js",
245
235
  "require": "./dist/components/blocks/interactive-card.umd.js",
@@ -1,117 +0,0 @@
1
- import { j as i } from "./jsx-runtime-DywqP_6a.js";
2
- import { c as x } from "./index-CRiPKpXj.js";
3
- import { min as S, max as E, startOfMonth as N, endOfMonth as k, eachDayOfInterval as I, format as z } from "date-fns";
4
- import { useState as T, useEffect as B } from "react";
5
- import { DayPicker as G } from "react-day-picker";
6
- import { e as L, a as O, f as F, b as H } from "./style-BNIXVvBA.js";
7
- import { I as P } from "./icon-component-CxQsODCa.js";
8
- const R = ({ onChange: r, value: t, options: o }) => /* @__PURE__ */ i.jsx(
9
- "select",
10
- {
11
- className: "text-md focus-visible:ring-ring-default h-fit w-fit! cursor-pointer appearance-none rounded-2xl border-none pr-9 pl-1 font-semibold transition-colors focus:border-0 focus:border-transparent focus:ring-0 focus:ring-transparent focus:outline-hidden focus-visible:ring-[1.5px] focus-visible:ring-offset-1 focus-visible:outline-hidden",
12
- onChange: r,
13
- value: t,
14
- children: o?.map((n, l) => {
15
- const u = n.value === t;
16
- return /* @__PURE__ */ i.jsx(
17
- "option",
18
- {
19
- value: n.value,
20
- disabled: n.disabled,
21
- className: x("disabled:hidden", {
22
- "bg-blue-050 font-semibold text-blue-800": u
23
- }),
24
- children: n.label
25
- },
26
- l
27
- );
28
- })
29
- }
30
- ), U = ({
31
- orientation: r = "down",
32
- size: t = 16
33
- }) => /* @__PURE__ */ i.jsx(
34
- P,
35
- {
36
- iconName: r === "left" ? "IconChevronLeft" : "IconChevronRight",
37
- stroke: "1.5",
38
- size: t
39
- }
40
- ), Y = ({
41
- locale: r = "enGB",
42
- disabledDates: t,
43
- enabledDates: o,
44
- dropdownsSelectors: n = !0,
45
- hideNavigation: l = !1,
46
- showOutsideDays: u = !0,
47
- minDate: w,
48
- maxDate: y,
49
- value: c,
50
- className: D,
51
- onChange: m
52
- }) => {
53
- const [_, b] = T(), j = (e) => e.filter((a) => a !== void 0), d = Array.isArray(o) ? o.map((e) => new Date(e)) : o ? new Date(o) : void 0, s = Array.isArray(d) ? j(d) : d ? [d] : [], f = s.length > 0 ? S(s) : void 0, p = s.length > 0 ? E(s) : void 0, g = () => Array.isArray(t) ? t.map((e) => new Date(e)) : t ? new Date(t) : void 0, h = Array.isArray(g()) ? [...g()] : [];
54
- if (f && p) {
55
- const e = N(f), a = k(p);
56
- I({ start: e, end: a }).forEach((v) => {
57
- s.some(
58
- (M) => M.setHours(0, 0, 0, 0) === v.setHours(0, 0, 0, 0)
59
- ) || h.push(v);
60
- });
61
- }
62
- B(() => {
63
- if (c) {
64
- const e = new Date(c);
65
- isNaN(e.getTime()) || b(e);
66
- } else
67
- b(void 0);
68
- }, [c]);
69
- const C = (e) => {
70
- b(e), m && m(e ? z(e, "yyyy-MM-dd") : void 0);
71
- }, A = r === "enGB" ? L : r === "enUS" ? O : r === "fr" ? F : H;
72
- return /* @__PURE__ */ i.jsx(
73
- G,
74
- {
75
- mode: "single",
76
- captionLayout: n ? "dropdown" : "label",
77
- selected: _,
78
- onSelect: C,
79
- locale: A,
80
- startMonth: w || f || new Date(1900, 1, 1),
81
- endMonth: y || p || new Date(2100, 12, 31),
82
- disabled: h,
83
- showOutsideDays: u,
84
- hideNavigation: l,
85
- className: x(
86
- "bg-background group/calendar p-3 [--cell-size:--spacing(8)] [[data-slot=card-content]_&]:bg-transparent [[data-slot=popover-content]_&]:bg-transparent",
87
- String.raw`rtl:**:[.rdp-button\_next>svg]:rotate-180`,
88
- String.raw`rtl:**:[.rdp-button\_previous>svg]:rotate-180`,
89
- D
90
- ),
91
- classNames: {
92
- root: "w-fit text-sm text-center",
93
- weekday: "text-muted-foreground font-regular",
94
- month_grid: "border-separate",
95
- month_caption: `h-9 relative flex items-center w-full ${l ? "hidden" : ""}`,
96
- dropdowns: "absolute w-fit items-center justify-center z-10 left-1/2 flex -translate-x-1/2 top-1/2 -translate-y-1/2",
97
- button_next: "rounded-md border-none lg:hover:bg-neutral-050 transition-colors z-1 p-2 disabled:opacity-50 focus-visible:ring-ring-default focus-visible:outline-hidden focus-visible:ring-[1.5px] focus-visible:ring-offset-1",
98
- button_previous: "rounded-md border-none lg:hover:bg-neutral-050 transition-colors z-1 p-2 disabled:opacity-50 focus-visible:ring-ring-default focus-visible:outline-hidden focus-visible:ring-[1.5px] focus-visible:ring-offset-1",
99
- nav: "w-full h-9 top-0 left-0 absolute flex justify-between items-center gap-2",
100
- selected: "bg-blue-050! border-[0.5px] border-blue-800! text-blue-800! lg:hover:bg-blue-100 transition-colors font-semibold",
101
- today: "bg-blue-050 border-[0.5px] text-blue-800 lg:hover:bg-blue-100",
102
- disabled: "bg-white text-neutral-200 border-[0.5px] border-neutral-000 lg:hover:bg-white!",
103
- caption_label: "text-neutral-1000 text-base font-semibold leading-none self-center w-full",
104
- outside: "bg-white text-neutral-200 border-[0.5px] border-neutral-000",
105
- day_button: "text-sm h-9 w-9 whitespace-nowrap border-none focus-visible:ring-ring-default focus-visible:outline-hidden focus-visible:ring-[1.5px] rounded-md",
106
- day: "h-9 w-9 aspect-square text-sm rounded-md border-[0.5px] border-neutral-050 lg:hover:bg-blue-050 transition-colors p-0 whitespace-nowrap"
107
- },
108
- components: {
109
- Dropdown: R,
110
- Chevron: ({ orientation: e, size: a }) => /* @__PURE__ */ i.jsx(U, { orientation: e, size: a })
111
- }
112
- }
113
- );
114
- };
115
- export {
116
- Y as C
117
- };