@vkzstudio/muza-ui 1.0.43 → 1.0.44
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/Accordion/Accordion.d.ts +42 -6
- package/dist/components/Accordion/Accordion.d.ts.map +1 -1
- package/dist/components/Button/Button.d.ts +71 -17
- package/dist/components/Button/Button.d.ts.map +1 -1
- package/dist/components/DataTable/DataTable.d.ts +52 -15
- package/dist/components/DataTable/DataTable.d.ts.map +1 -1
- package/dist/components/DatePicker/DatePicker.d.ts +69 -36
- package/dist/components/DatePicker/DatePicker.d.ts.map +1 -1
- package/dist/components/DatePicker/DatePicker.stories.d.ts.map +1 -1
- package/dist/components/EdgeButton/EdgeButton.d.ts +10 -11
- package/dist/components/EdgeButton/EdgeButton.d.ts.map +1 -1
- package/dist/components/ExpandableTable/ExpandableTable.d.ts +73 -8
- package/dist/components/ExpandableTable/ExpandableTable.d.ts.map +1 -1
- package/dist/components/ExpandableTable/ExpandableTable.stories.d.ts +3 -0
- package/dist/components/ExpandableTable/ExpandableTable.stories.d.ts.map +1 -1
- package/dist/components/ExpandableTable/index.d.ts +1 -1
- package/dist/components/ExpandableTable/index.d.ts.map +1 -1
- package/dist/components/FileUpload/FileItem.d.ts +16 -0
- package/dist/components/FileUpload/FileItem.d.ts.map +1 -1
- package/dist/components/FileUpload/FileUpload.d.ts +105 -42
- package/dist/components/FileUpload/FileUpload.d.ts.map +1 -1
- package/dist/components/FileUpload/index.d.ts +1 -1
- package/dist/components/FileUpload/index.d.ts.map +1 -1
- package/dist/components/Input/Input.d.ts +33 -34
- package/dist/components/Input/Input.d.ts.map +1 -1
- package/dist/components/Input/Input.stories.d.ts.map +1 -1
- package/dist/components/MultiSelect/MultiSelect.d.ts +50 -23
- package/dist/components/MultiSelect/MultiSelect.d.ts.map +1 -1
- package/dist/components/Reorderable/Reorderable.d.ts +48 -1
- package/dist/components/Reorderable/Reorderable.d.ts.map +1 -1
- package/dist/components/ReorderableTable/ReorderableTable.d.ts +34 -17
- package/dist/components/ReorderableTable/ReorderableTable.d.ts.map +1 -1
- package/dist/components/ReorderableTable/ReorderableTable.stories.d.ts.map +1 -1
- package/dist/components/Select/Select.d.ts +38 -21
- package/dist/components/Select/Select.d.ts.map +1 -1
- package/dist/components/Select/index.d.ts +1 -1
- package/dist/components/Select/index.d.ts.map +1 -1
- package/dist/components/TextEditor/TextEditor.d.ts +82 -46
- package/dist/components/TextEditor/TextEditor.d.ts.map +1 -1
- package/dist/components/TextEditor/TextEditor.stories.d.ts.map +1 -1
- package/dist/components/TextEditor/index.d.ts +1 -1
- package/dist/components/TextEditor/index.d.ts.map +1 -1
- package/dist/components/Textarea/Textarea.d.ts +41 -10
- package/dist/components/Textarea/Textarea.d.ts.map +1 -1
- package/dist/components/Textarea/Textarea.stories.d.ts.map +1 -1
- package/dist/muza-ui.css +1 -1
- package/package.json +1 -1
|
@@ -6,7 +6,19 @@ import { ReactNode } from 'react';
|
|
|
6
6
|
export type ResponsiveBreakpoint = 'xs' | 'sm' | 'md' | 'lg' | 'xl' | '2xl' | '3xl';
|
|
7
7
|
/**
|
|
8
8
|
* Column definition for the ExpandableTable.
|
|
9
|
+
*
|
|
9
10
|
* @typeParam T - The type of data objects in each row
|
|
11
|
+
*
|
|
12
|
+
* @example
|
|
13
|
+
* const columns: IColumn<Order>[] = [
|
|
14
|
+
* { dataKey: 'date', title: 'Date', responsive: 'sm' },
|
|
15
|
+
* {
|
|
16
|
+
* dataKey: 'status',
|
|
17
|
+
* title: 'Status',
|
|
18
|
+
* responsive: 'md',
|
|
19
|
+
* render: (value) => <Tag variant="success">{value}</Tag>,
|
|
20
|
+
* },
|
|
21
|
+
* ]
|
|
10
22
|
*/
|
|
11
23
|
export interface IColumn<T> {
|
|
12
24
|
/** Key of the data object to display in this column. */
|
|
@@ -28,20 +40,31 @@ export interface IColumn<T> {
|
|
|
28
40
|
* - Named breakpoint (`'xs'..'3xl'`): visible at and above that breakpoint, rendered with static Tailwind classes.
|
|
29
41
|
* - Boolean: caller supplies the visibility directly (e.g. from `useMediaQuery('(min-width: 52rem)')`).
|
|
30
42
|
* `true` shows the column, `false` hides it. Use this for arbitrary thresholds.
|
|
43
|
+
*
|
|
31
44
|
* @default 'xs'
|
|
45
|
+
* @see ResponsiveBreakpoint
|
|
32
46
|
*/
|
|
33
47
|
responsive?: ResponsiveBreakpoint | boolean;
|
|
34
48
|
/**
|
|
35
49
|
* When `responsive` hides this column, also render it in the automatic expandable area
|
|
36
50
|
* below the row. Set to `false` to just hide the column — useful when the expandable
|
|
37
51
|
* area already contains a richer version of the same data.
|
|
52
|
+
*
|
|
38
53
|
* @default true
|
|
39
54
|
*/
|
|
40
55
|
moveToExpandable?: boolean;
|
|
41
56
|
}
|
|
42
57
|
/**
|
|
43
58
|
* Cell definition within an expandable row section.
|
|
59
|
+
*
|
|
44
60
|
* @typeParam T - The type of data objects in each row
|
|
61
|
+
*
|
|
62
|
+
* @example
|
|
63
|
+
* const cell: IExpandableTableRowCell<Order> = {
|
|
64
|
+
* dataKey: 'customerName',
|
|
65
|
+
* title: 'Customer',
|
|
66
|
+
* render: (value) => <a href="#profile">{value}</a>,
|
|
67
|
+
* }
|
|
45
68
|
*/
|
|
46
69
|
export interface IExpandableTableRowCell<T> {
|
|
47
70
|
/** Key of the data object to display in this cell. */
|
|
@@ -50,28 +73,59 @@ export interface IExpandableTableRowCell<T> {
|
|
|
50
73
|
className?: string;
|
|
51
74
|
/** Label rendered next to the cell value. */
|
|
52
75
|
title: ReactNode;
|
|
53
|
-
/**
|
|
76
|
+
/**
|
|
77
|
+
* Custom render function for the cell value.
|
|
78
|
+
* When omitted, the raw value is rendered as text.
|
|
79
|
+
*
|
|
80
|
+
* @example
|
|
81
|
+
* render: (value, row) => <Typography weight="medium">{value}</Typography>
|
|
82
|
+
*/
|
|
54
83
|
render?: (value: T[keyof T], rowData: T) => ReactNode;
|
|
55
84
|
}
|
|
56
85
|
/**
|
|
57
86
|
* Section definition for the expandable row content.
|
|
58
87
|
* Groups related cells under an optional heading.
|
|
88
|
+
*
|
|
59
89
|
* @typeParam T - The type of data objects in each row
|
|
90
|
+
*
|
|
91
|
+
* @example
|
|
92
|
+
* const section: IExpandableTableRowSection<Order> = {
|
|
93
|
+
* title: 'Customer Information',
|
|
94
|
+
* cells: [
|
|
95
|
+
* { dataKey: 'customerName', title: 'Name' },
|
|
96
|
+
* { dataKey: 'customerAddress', title: 'Address' },
|
|
97
|
+
* ],
|
|
98
|
+
* }
|
|
60
99
|
*/
|
|
61
100
|
export interface IExpandableTableRowSection<T> {
|
|
62
101
|
/** Optional heading rendered above the section cells. */
|
|
63
102
|
title?: ReactNode;
|
|
64
|
-
/**
|
|
103
|
+
/**
|
|
104
|
+
* Array of cell definitions displayed within this section.
|
|
105
|
+
*
|
|
106
|
+
* @see IExpandableTableRowCell
|
|
107
|
+
*/
|
|
65
108
|
cells: IExpandableTableRowCell<T>[];
|
|
66
109
|
}
|
|
67
110
|
/**
|
|
68
111
|
* Props for the ExpandableTable component.
|
|
112
|
+
*
|
|
69
113
|
* @typeParam T - The type of data objects in each row
|
|
70
114
|
*/
|
|
71
115
|
export interface ExpandableTableProps<T> {
|
|
72
116
|
/** Array of data objects where each item represents one table row. */
|
|
73
117
|
data: T[];
|
|
74
|
-
/**
|
|
118
|
+
/**
|
|
119
|
+
* Array of column definitions describing headers and cell rendering.
|
|
120
|
+
*
|
|
121
|
+
* @example
|
|
122
|
+
* const columns: IColumn<Order>[] = [
|
|
123
|
+
* { dataKey: 'date', title: 'Date', responsive: 'sm' },
|
|
124
|
+
* { dataKey: 'title', title: 'Order' },
|
|
125
|
+
* ]
|
|
126
|
+
*
|
|
127
|
+
* @see IColumn
|
|
128
|
+
*/
|
|
75
129
|
columns: IColumn<T>[];
|
|
76
130
|
/**
|
|
77
131
|
* Sections shown when a row is expanded. Can be a static array applied to every row
|
|
@@ -80,21 +134,32 @@ export interface ExpandableTableProps<T> {
|
|
|
80
134
|
*
|
|
81
135
|
* @example
|
|
82
136
|
* // Static sections
|
|
83
|
-
* expandableRowSections={[
|
|
137
|
+
* expandableRowSections={[
|
|
138
|
+
* { title: 'Details', cells: [{ dataKey: 'name', title: 'Name' }] },
|
|
139
|
+
* ]}
|
|
84
140
|
*
|
|
85
141
|
* // Dynamic sections based on row data
|
|
86
|
-
* expandableRowSections={(row) =>
|
|
142
|
+
* expandableRowSections={(row) =>
|
|
143
|
+
* row.status === 'active' ? activeSections : inactiveSections
|
|
144
|
+
* }
|
|
87
145
|
*
|
|
88
146
|
* @see IExpandableTableRowSection
|
|
89
147
|
*/
|
|
90
148
|
expandableRowSections?: IExpandableTableRowSection<T>[] | ((row: T) => IExpandableTableRowSection<T>[]);
|
|
91
149
|
/**
|
|
92
|
-
* Custom CSS classes for internal elements.
|
|
150
|
+
* Custom CSS classes for internal elements of the expanded row area.
|
|
151
|
+
* Use to override the default grid layouts when labels are long or when
|
|
152
|
+
* independent column sizing is needed.
|
|
93
153
|
*
|
|
94
154
|
* @example
|
|
95
|
-
*
|
|
155
|
+
* // Override the outer grid used inside the expanded row
|
|
96
156
|
* classNames={{ expandedContentGrid: 'md:grid-cols-[200px_1fr]' }}
|
|
97
|
-
*
|
|
157
|
+
*
|
|
158
|
+
* // Replace the subgrid inside each section with independent columns
|
|
159
|
+
* classNames={{
|
|
160
|
+
* sectionTitle: 'md:grid-cols-[minmax(200px,auto)_1fr]',
|
|
161
|
+
* cellsWrap: 'md:grid-cols-[minmax(200px,auto)_1fr]',
|
|
162
|
+
* }}
|
|
98
163
|
*/
|
|
99
164
|
classNames?: Partial<{
|
|
100
165
|
/** Custom class for the expanded content grid container (overrides default `md:grid-cols-[auto_1fr]`). */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ExpandableTable.d.ts","sourceRoot":"","sources":["../../../src/components/ExpandableTable/ExpandableTable.tsx"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,SAAS,EAMf,MAAM,OAAO,CAAA;AAuBd;;;GAGG;AACH,MAAM,MAAM,oBAAoB,GAC5B,IAAI,GACJ,IAAI,GACJ,IAAI,GACJ,IAAI,GACJ,IAAI,GACJ,KAAK,GACL,KAAK,CAAA;AAET
|
|
1
|
+
{"version":3,"file":"ExpandableTable.d.ts","sourceRoot":"","sources":["../../../src/components/ExpandableTable/ExpandableTable.tsx"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,SAAS,EAMf,MAAM,OAAO,CAAA;AAuBd;;;GAGG;AACH,MAAM,MAAM,oBAAoB,GAC5B,IAAI,GACJ,IAAI,GACJ,IAAI,GACJ,IAAI,GACJ,IAAI,GACJ,KAAK,GACL,KAAK,CAAA;AAET;;;;;;;;;;;;;;;GAeG;AACH,MAAM,WAAW,OAAO,CAAC,CAAC;IACxB,wDAAwD;IACxD,OAAO,EAAE,MAAM,CAAC,CAAA;IAChB,iDAAiD;IACjD,KAAK,EAAE,SAAS,CAAA;IAChB,sEAAsE;IACtE,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB;;;;;;OAMG;IACH,MAAM,CAAC,EAAE,CAAC,KAAK,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,EAAE,OAAO,EAAE,CAAC,KAAK,SAAS,CAAA;IACrD;;;;;;;;OAQG;IACH,UAAU,CAAC,EAAE,oBAAoB,GAAG,OAAO,CAAA;IAC3C;;;;;;OAMG;IACH,gBAAgB,CAAC,EAAE,OAAO,CAAA;CAC3B;AAED;;;;;;;;;;;GAWG;AACH,MAAM,WAAW,uBAAuB,CAAC,CAAC;IACxC,sDAAsD;IACtD,OAAO,EAAE,MAAM,CAAC,CAAA;IAChB,gDAAgD;IAChD,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,6CAA6C;IAC7C,KAAK,EAAE,SAAS,CAAA;IAChB;;;;;;OAMG;IACH,MAAM,CAAC,EAAE,CAAC,KAAK,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,EAAE,OAAO,EAAE,CAAC,KAAK,SAAS,CAAA;CACtD;AAED;;;;;;;;;;;;;;GAcG;AACH,MAAM,WAAW,0BAA0B,CAAC,CAAC;IAC3C,yDAAyD;IACzD,KAAK,CAAC,EAAE,SAAS,CAAA;IACjB;;;;OAIG;IACH,KAAK,EAAE,uBAAuB,CAAC,CAAC,CAAC,EAAE,CAAA;CACpC;AAED;;;;GAIG;AACH,MAAM,WAAW,oBAAoB,CAAC,CAAC;IACrC,sEAAsE;IACtE,IAAI,EAAE,CAAC,EAAE,CAAA;IACT;;;;;;;;;;OAUG;IACH,OAAO,EAAE,OAAO,CAAC,CAAC,CAAC,EAAE,CAAA;IACrB;;;;;;;;;;;;;;;;;OAiBG;IACH,qBAAqB,CAAC,EAClB,0BAA0B,CAAC,CAAC,CAAC,EAAE,GAC/B,CAAC,CAAC,GAAG,EAAE,CAAC,KAAK,0BAA0B,CAAC,CAAC,CAAC,EAAE,CAAC,CAAA;IACjD;;;;;;;;;;;;;;OAcG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC;QACnB,0GAA0G;QAC1G,mBAAmB,EAAE,MAAM,CAAA;QAC3B,yFAAyF;QACzF,YAAY,EAAE,MAAM,CAAA;QACpB,0GAA0G;QAC1G,SAAS,EAAE,MAAM,CAAA;KAClB,CAAC,CAAA;CACH;AA4CD,eAAO,MAAM,eAAe,GAAI,CAAC,EAAG,uDAKjC,oBAAoB,CAAC,CAAC,CAAC,4CAiZzB,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ExpandableTable.stories.d.ts","sourceRoot":"","sources":["../../../src/components/ExpandableTable/ExpandableTable.stories.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAQ,QAAQ,EAAE,MAAM,uBAAuB,CAAA;AAO3D,QAAA,MAAM,IAAI
|
|
1
|
+
{"version":3,"file":"ExpandableTable.stories.d.ts","sourceRoot":"","sources":["../../../src/components/ExpandableTable/ExpandableTable.stories.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAQ,QAAQ,EAAE,MAAM,uBAAuB,CAAA;AAO3D,QAAA,MAAM,IAAI;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAkC8B,CAAA;AAExC,eAAe,IAAI,CAAA;AACnB,KAAK,KAAK,GAAG,QAAQ,CAAC,OAAO,IAAI,CAAC,CAAA;AA+MlC,eAAO,MAAM,MAAM,EAAE,KAsBpB,CAAA;AAED,eAAO,MAAM,iBAAiB,EAAE,KAkB/B,CAAA;AAED,eAAO,MAAM,mBAAmB,EAAE,KAwJjC,CAAA;AAED,eAAO,MAAM,SAAS,EAAE,KAuBvB,CAAA;AAED,eAAO,MAAM,4BAA4B,EAAE,KAyH1C,CAAA;AAED,eAAO,MAAM,kBAAkB,EAAE,KA0DhC,CAAA;AAED,eAAO,MAAM,UAAU,EAAE,KAoExB,CAAA;AAED,eAAO,MAAM,mBAAmB,EAAE,KA6EjC,CAAA;AAED,eAAO,MAAM,iBAAiB,EAAE,KA2E/B,CAAA"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { ExpandableTable, type ExpandableTableProps, type IColumn, type IExpandableTableRowCell, type IExpandableTableRowSection, } from './ExpandableTable';
|
|
1
|
+
export { ExpandableTable, type ExpandableTableProps, type IColumn, type IExpandableTableRowCell, type IExpandableTableRowSection, type ResponsiveBreakpoint, } from './ExpandableTable';
|
|
2
2
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/ExpandableTable/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,eAAe,EACf,KAAK,oBAAoB,EACzB,KAAK,OAAO,EACZ,KAAK,uBAAuB,EAC5B,KAAK,0BAA0B,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/ExpandableTable/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,eAAe,EACf,KAAK,oBAAoB,EACzB,KAAK,OAAO,EACZ,KAAK,uBAAuB,EAC5B,KAAK,0BAA0B,EAC/B,KAAK,oBAAoB,GAC1B,MAAM,mBAAmB,CAAA"}
|
|
@@ -1,27 +1,43 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* Internal base props shared by both `file` and `url` variants of FileItem.
|
|
4
|
+
* Not exported — FileItem is an internal sub-component of FileUpload.
|
|
5
|
+
*/
|
|
2
6
|
interface FileItemBaseProps {
|
|
7
|
+
/** Whether the file has finished uploading. Controls which action buttons render. */
|
|
3
8
|
uploaded?: boolean;
|
|
9
|
+
/** Upload progress in percent (0–100). Renders a progress bar while strictly between 0 and 100. */
|
|
4
10
|
progress?: number;
|
|
11
|
+
/** Controls the item's min-height variant. */
|
|
5
12
|
size?: 'sm' | 'base' | 'lg';
|
|
13
|
+
/** Prevents interaction and applies disabled styling. */
|
|
6
14
|
disabled?: boolean;
|
|
15
|
+
/** Hides the delete button; download button remains available for uploaded items. */
|
|
7
16
|
readOnly?: boolean;
|
|
17
|
+
/** Hint message displayed below the item with secondary styling. */
|
|
8
18
|
note?: React.ReactNode;
|
|
19
|
+
/** Error message displayed below the item with error styling. */
|
|
9
20
|
error?: React.ReactNode;
|
|
10
21
|
/** Secondary text displayed below the file name (e.g., file size). */
|
|
11
22
|
secondaryText?: React.ReactNode;
|
|
23
|
+
/** Fires when the delete button is clicked. */
|
|
12
24
|
onDelete: () => void;
|
|
25
|
+
/** Fires when an internal error occurs (e.g., download failure). */
|
|
13
26
|
onError?: (error: string, file?: File) => void;
|
|
14
27
|
}
|
|
28
|
+
/** Internal props for a FileItem backed by a local `File` object. */
|
|
15
29
|
interface FileItemFileProps extends FileItemBaseProps {
|
|
16
30
|
source: 'file';
|
|
17
31
|
file: File;
|
|
18
32
|
}
|
|
33
|
+
/** Internal props for a FileItem backed by a remote URL (already-uploaded file). */
|
|
19
34
|
interface FileItemUrlProps extends FileItemBaseProps {
|
|
20
35
|
source: 'url';
|
|
21
36
|
url: string;
|
|
22
37
|
name: string;
|
|
23
38
|
type?: string;
|
|
24
39
|
}
|
|
40
|
+
/** Discriminated union: `source: 'file'` uses a local File, `source: 'url'` references a remote URL. */
|
|
25
41
|
type FileItemProps = FileItemFileProps | FileItemUrlProps;
|
|
26
42
|
export declare const FileItem: (props: FileItemProps) => import("react/jsx-runtime").JSX.Element;
|
|
27
43
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FileItem.d.ts","sourceRoot":"","sources":["../../../src/components/FileUpload/FileItem.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AA8C9B,UAAU,iBAAiB;IACzB,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,IAAI,CAAC,EAAE,IAAI,GAAG,MAAM,GAAG,IAAI,CAAA;IAC3B,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,IAAI,CAAC,EAAE,KAAK,CAAC,SAAS,CAAA;IACtB,KAAK,CAAC,EAAE,KAAK,CAAC,SAAS,CAAA;IACvB,sEAAsE;IACtE,aAAa,CAAC,EAAE,KAAK,CAAC,SAAS,CAAA;IAC/B,QAAQ,EAAE,MAAM,IAAI,CAAA;IACpB,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,IAAI,KAAK,IAAI,CAAA;CAC/C;AAED,UAAU,iBAAkB,SAAQ,iBAAiB;IACnD,MAAM,EAAE,MAAM,CAAA;IACd,IAAI,EAAE,IAAI,CAAA;CACX;AAED,UAAU,gBAAiB,SAAQ,iBAAiB;IAClD,MAAM,EAAE,KAAK,CAAA;IACb,GAAG,EAAE,MAAM,CAAA;IACX,IAAI,EAAE,MAAM,CAAA;IACZ,IAAI,CAAC,EAAE,MAAM,CAAA;CACd;AAED,KAAK,aAAa,GAAG,iBAAiB,GAAG,gBAAgB,CAAA;AAsEzD,eAAO,M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O,MAAM,QAAQ,GAAI,OAAO,aAAa,4CAuO5C,CAAA"}
|
|
@@ -9,117 +9,180 @@ declare const fileUploadVariants: (props?: ({
|
|
|
9
9
|
/**
|
|
10
10
|
* Represents a remote file that is already uploaded and accessible via URL.
|
|
11
11
|
* Used to display previously-uploaded files without re-fetching them as `File` objects.
|
|
12
|
+
*
|
|
13
|
+
* @example
|
|
14
|
+
* const urls: PreselectedUrl[] = [
|
|
15
|
+
* { url: 'https://cdn.example.com/photo.jpg', name: 'photo.jpg', type: 'image/jpeg', secondaryText: '3.2 MB' },
|
|
16
|
+
* { url: 'https://cdn.example.com/report.pdf', name: 'report.pdf', type: 'application/pdf' },
|
|
17
|
+
* ]
|
|
12
18
|
*/
|
|
13
19
|
export interface PreselectedUrl {
|
|
14
|
-
/** Direct URL to the file. */
|
|
20
|
+
/** Direct URL to the file. Used for opening the file in a new tab on download. */
|
|
15
21
|
url: string;
|
|
16
|
-
/** Display name
|
|
22
|
+
/** Display name shown in the file list item. */
|
|
17
23
|
name: string;
|
|
18
|
-
/**
|
|
24
|
+
/**
|
|
25
|
+
* MIME type used to pick the file icon. If it starts with `"image/"` the item renders a
|
|
26
|
+
* thumbnail from `url`. When omitted, the extension in `name` is used as a fallback.
|
|
27
|
+
*/
|
|
19
28
|
type?: string;
|
|
20
|
-
/** File size in bytes
|
|
29
|
+
/** File size in bytes. Currently informational; not rendered directly — use `secondaryText` for display. */
|
|
21
30
|
size?: number;
|
|
22
|
-
/** Secondary text displayed below the file name (e.g., formatted file size). */
|
|
31
|
+
/** Secondary text displayed below the file name (e.g., formatted file size like `'3.2 MB'`). */
|
|
23
32
|
secondaryText?: React.ReactNode;
|
|
24
33
|
}
|
|
34
|
+
/**
|
|
35
|
+
* Upload status for a single file in `FileUpload`, matched by index to `preselectedFiles`.
|
|
36
|
+
*
|
|
37
|
+
* @example
|
|
38
|
+
* // Second file is 75% uploaded, first and third are done
|
|
39
|
+
* const status: FileUploadStatus[] = [
|
|
40
|
+
* { uploaded: true },
|
|
41
|
+
* { uploaded: false, progress: 75 },
|
|
42
|
+
* { uploaded: true },
|
|
43
|
+
* ]
|
|
44
|
+
*/
|
|
45
|
+
export interface FileUploadStatus {
|
|
46
|
+
/** Whether the file has finished uploading. Controls the icon (close vs download/trash). */
|
|
47
|
+
uploaded: boolean;
|
|
48
|
+
/** Upload progress in percent (0–100). Renders a progress bar under the item while strictly between 0 and 100. */
|
|
49
|
+
progress?: number;
|
|
50
|
+
}
|
|
25
51
|
/**
|
|
26
52
|
* Props for the FileUpload component.
|
|
27
53
|
* Extends standard div attributes except `onDrop`, `onError`, and `onChange`
|
|
28
54
|
* (replaced by component-specific callbacks).
|
|
29
55
|
*/
|
|
30
56
|
export interface FileUploadProps extends Omit<React.HTMLAttributes<HTMLDivElement>, 'onDrop' | 'onError' | 'onChange'>, Omit<VariantProps<typeof fileUploadVariants>, 'isDragActive'> {
|
|
31
|
-
/**
|
|
57
|
+
/**
|
|
58
|
+
* Fires when files are dropped or selected (after internal validation). Receives the
|
|
59
|
+
* array of newly accepted files from the current interaction only — not the cumulative
|
|
60
|
+
* list. Use `onChange` for the full list after each change.
|
|
61
|
+
*
|
|
62
|
+
* @example
|
|
63
|
+
* <FileUpload onDrop={(files) => uploadToServer(files)} />
|
|
64
|
+
*/
|
|
32
65
|
onDrop?: (acceptedFiles: File[]) => void;
|
|
33
66
|
/**
|
|
34
|
-
* Accepted file types as MIME type strings.
|
|
67
|
+
* Accepted file types as MIME type strings. Accepts either a single MIME type or an array.
|
|
68
|
+
* Wildcards (`image/*`, `video/*`) are supported.
|
|
35
69
|
*
|
|
36
70
|
* @example
|
|
37
|
-
* accept="image/*"
|
|
38
|
-
* accept={['image/*', 'application/pdf']}
|
|
71
|
+
* <FileUpload accept="image/*" />
|
|
72
|
+
* <FileUpload accept={['image/*', 'application/pdf']} />
|
|
39
73
|
*/
|
|
40
74
|
accept?: string | string[];
|
|
41
|
-
/** Allows selecting multiple files simultaneously. @default true */
|
|
75
|
+
/** Allows selecting multiple files simultaneously. When `false`, the dropzone hides after the first file is selected. @default true */
|
|
42
76
|
multiple?: boolean;
|
|
43
|
-
/**
|
|
77
|
+
/**
|
|
78
|
+
* Maximum allowed file size in bytes. Files exceeding this size are rejected and trigger `onError`.
|
|
79
|
+
*
|
|
80
|
+
* @example
|
|
81
|
+
* <FileUpload maxSize={5 * 1024 * 1024} /> // 5 MB
|
|
82
|
+
*/
|
|
44
83
|
maxSize?: number;
|
|
45
84
|
/** Custom error message when a file exceeds `maxSize`. Defaults to a translated message with the size in MB. */
|
|
46
85
|
maxSizeErrorMessage?: string;
|
|
47
|
-
/** Maximum number of files allowed. When reached, the dropzone is hidden. */
|
|
86
|
+
/** Maximum number of files allowed (counts both `preselectedFiles` and `preselectedUrls`). When reached, the dropzone is hidden. */
|
|
48
87
|
maxFiles?: number;
|
|
49
|
-
/** Custom error message when file count exceeds `maxFiles`. Defaults to a translated message. */
|
|
88
|
+
/** Custom error message when file count exceeds `maxFiles`. Defaults to a translated message with the count. */
|
|
50
89
|
maxFilesErrorMessage?: string;
|
|
51
90
|
/** Controls the visual size of file items in the list. @default 'base' */
|
|
52
91
|
size?: 'sm' | 'base' | 'lg';
|
|
53
|
-
/** Prevents interaction and applies disabled styling. @default false */
|
|
92
|
+
/** Prevents interaction and applies disabled styling to the dropzone and all file items. @default false */
|
|
54
93
|
disabled?: boolean;
|
|
55
|
-
/** Hides the dropzone and shows only uploaded files without delete buttons. @default false */
|
|
94
|
+
/** Hides the dropzone and shows only uploaded files without delete buttons. Download buttons remain available. @default false */
|
|
56
95
|
readOnly?: boolean;
|
|
57
96
|
/** Title text displayed inside the dropzone area. Defaults to a translated string. */
|
|
58
97
|
title?: string;
|
|
59
|
-
/** Label displayed above the upload area
|
|
98
|
+
/** Label displayed above the upload area via `FormField`. */
|
|
60
99
|
label?: string;
|
|
61
|
-
/** Subtitle text displayed below the title inside the dropzone. */
|
|
100
|
+
/** Subtitle text displayed below the title inside the dropzone (typically used for supported formats hint). */
|
|
62
101
|
subtitle?: string;
|
|
63
|
-
/** Applies error border and text styling to the dropzone. */
|
|
102
|
+
/** Applies error border and text styling to the dropzone. Independent of per-file errors in `itemErrors`. */
|
|
64
103
|
error?: boolean;
|
|
65
104
|
/** Marks the field as required and displays a red asterisk next to the label. @default false */
|
|
66
105
|
required?: boolean;
|
|
67
106
|
/** Hides the required asterisk even when `required` is true. @default false */
|
|
68
107
|
disableRequiredAsterisk?: boolean;
|
|
69
108
|
/**
|
|
70
|
-
* Additional options passed to react-dropzone.
|
|
71
|
-
*
|
|
109
|
+
* Additional options passed to the underlying react-dropzone hook. Props already managed by
|
|
110
|
+
* `FileUpload` (`onDrop`, `accept`, `multiple`, `maxSize`, `maxFiles`, `disabled`) are excluded.
|
|
111
|
+
*
|
|
72
112
|
* @see DropzoneOptions
|
|
73
113
|
*/
|
|
74
114
|
dropzoneOptions?: Omit<DropzoneOptions, 'onDrop' | 'accept' | 'multiple' | 'maxSize' | 'maxFiles' | 'disabled'>;
|
|
75
115
|
/** Files displayed in the list on mount. @default [] */
|
|
76
116
|
preselectedFiles?: File[];
|
|
77
117
|
/**
|
|
78
|
-
* Upload status for each file, matched by index to `preselectedFiles`.
|
|
79
|
-
*
|
|
118
|
+
* Upload status for each file, matched by index to `preselectedFiles`. Omit or pass an empty
|
|
119
|
+
* array to treat all files as not-yet-uploaded.
|
|
120
|
+
*
|
|
121
|
+
* @example
|
|
122
|
+
* <FileUpload
|
|
123
|
+
* preselectedFiles={[file1, file2]}
|
|
124
|
+
* fileStatus={[{ uploaded: true }, { uploaded: false, progress: 42 }]}
|
|
125
|
+
* />
|
|
126
|
+
*
|
|
127
|
+
* @see FileUploadStatus
|
|
80
128
|
* @default []
|
|
81
129
|
*/
|
|
82
|
-
fileStatus?:
|
|
83
|
-
uploaded: boolean;
|
|
84
|
-
progress?: number;
|
|
85
|
-
}[];
|
|
130
|
+
fileStatus?: FileUploadStatus[];
|
|
86
131
|
/**
|
|
87
|
-
* Per-file error messages keyed by File reference.
|
|
132
|
+
* Per-file error messages keyed by File reference. Displayed below the file item with error styling.
|
|
88
133
|
*
|
|
89
134
|
* @example
|
|
90
|
-
* const
|
|
91
|
-
* <FileUpload itemErrors={
|
|
135
|
+
* const itemErrors = new Map<File, React.ReactNode>([[file, 'Upload failed']])
|
|
136
|
+
* <FileUpload itemErrors={itemErrors} />
|
|
92
137
|
*/
|
|
93
138
|
itemErrors?: Map<File, React.ReactNode>;
|
|
94
139
|
/**
|
|
95
|
-
* Per-file hint messages keyed by File reference.
|
|
140
|
+
* Per-file hint messages keyed by File reference. Displayed below the file item with secondary styling.
|
|
96
141
|
*
|
|
97
142
|
* @example
|
|
98
|
-
* const
|
|
99
|
-
* <FileUpload itemHints={
|
|
143
|
+
* const itemHints = new Map<File, React.ReactNode>([[file, 'Will be optimized before upload']])
|
|
144
|
+
* <FileUpload itemHints={itemHints} />
|
|
100
145
|
*/
|
|
101
146
|
itemHints?: Map<File, React.ReactNode>;
|
|
102
147
|
/**
|
|
103
|
-
* Per-file secondary text keyed by File reference (e.g., formatted file size).
|
|
148
|
+
* Per-file secondary text keyed by File reference (e.g., formatted file size). Displayed below the file name inside the item.
|
|
104
149
|
*
|
|
105
150
|
* @example
|
|
106
|
-
* const
|
|
107
|
-
* <FileUpload itemSecondaryTexts={
|
|
151
|
+
* const itemSecondaryTexts = new Map<File, React.ReactNode>([[file, '7 MB']])
|
|
152
|
+
* <FileUpload itemSecondaryTexts={itemSecondaryTexts} />
|
|
108
153
|
*/
|
|
109
154
|
itemSecondaryTexts?: Map<File, React.ReactNode>;
|
|
110
|
-
/**
|
|
155
|
+
/**
|
|
156
|
+
* Fires when an error occurs (file too large, too many files, processing or deletion failure).
|
|
157
|
+
* Receives the error message and the optional file that caused it.
|
|
158
|
+
*
|
|
159
|
+
* @example
|
|
160
|
+
* <FileUpload onError={(msg, file) => toast({ variant: 'error', text: msg })} />
|
|
161
|
+
*/
|
|
111
162
|
onError?: (error: string, file?: File) => void;
|
|
112
|
-
/** Fires when a
|
|
163
|
+
/** Fires when a `File` item is removed. Receives the deleted file and its index in `preselectedFiles`. */
|
|
113
164
|
onDelete?: (file: File, index: number) => void;
|
|
114
|
-
/**
|
|
165
|
+
/**
|
|
166
|
+
* Fires when the internal file list changes (after drop or delete). Receives the full updated array,
|
|
167
|
+
* including previously-selected files.
|
|
168
|
+
*
|
|
169
|
+
* @example
|
|
170
|
+
* <FileUpload onChange={(files) => setValue('attachments', files)} />
|
|
171
|
+
*/
|
|
115
172
|
onChange?: (files: File[]) => void;
|
|
116
|
-
/**
|
|
173
|
+
/**
|
|
174
|
+
* Already-uploaded files to display via URL, without needing `File` objects. Rendered before
|
|
175
|
+
* `preselectedFiles` in the list.
|
|
176
|
+
*
|
|
177
|
+
* @see PreselectedUrl
|
|
178
|
+
* @default []
|
|
179
|
+
*/
|
|
117
180
|
preselectedUrls?: PreselectedUrl[];
|
|
118
|
-
/** Fires when a URL-backed item is
|
|
181
|
+
/** Fires when a URL-backed item is removed. Receives the item and its index in `preselectedUrls`. @see PreselectedUrl */
|
|
119
182
|
onDeleteUrl?: (item: PreselectedUrl, index: number) => void;
|
|
120
|
-
/** Extra content rendered inline next to the label (e.g. a tooltip icon). */
|
|
183
|
+
/** Extra content rendered inline next to the label (e.g. a tooltip icon). Takes precedence over `infoTooltip`. */
|
|
121
184
|
labelExtra?: React.ReactNode;
|
|
122
|
-
/** Tooltip content shown in an info icon next to the label.
|
|
185
|
+
/** Tooltip content shown in an info icon next to the label. Ignored when `labelExtra` is provided. */
|
|
123
186
|
infoTooltip?: string;
|
|
124
187
|
}
|
|
125
188
|
declare const FileUpload: React.ForwardRefExoticComponent<FileUploadProps & React.RefAttributes<HTMLDivElement>>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FileUpload.d.ts","sourceRoot":"","sources":["../../../src/components/FileUpload/FileUpload.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAC9B,OAAO,EAA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SAAS,CAAC,CAAA;IACtC;;;;;;OAMG;IACH,kBAAkB,CAAC,EAAE,GAAG,CAAC,IAAI,EAAE,KAAK,CAAC,SAAS,CAAC,CAAA;IAC/C;;;;;;OAMG;IACH,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,IAAI,KAAK,IAAI,CAAA;IAC9C,0GAA0G;IAC1G,QAAQ,CAAC,EAAE,CAAC,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,KAAK,IAAI,CAAA;IAC9C;;;;;;OAMG;IACH,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,IAAI,EAAE,KAAK,IAAI,CAAA;IAClC;;;;;;OAMG;IACH,eAAe,CAAC,EAAE,cAAc,EAAE,CAAA;IAClC,yHAAyH;IACzH,WAAW,CAAC,EAAE,CAAC,IAAI,EAAE,cAAc,EAAE,KAAK,EAAE,MAAM,KAAK,IAAI,CAAA;IAC3D,kHAAkH;IAClH,UAAU,CAAC,EAAE,KAAK,CAAC,SAAS,CAAA;IAC5B,sGAAsG;IACtG,WAAW,CAAC,EAAE,MAAM,CAAA;CACrB;AAED,QAAA,MAAM,UAAU,wFAyRf,CAAA;AAGD,OAAO,EAAE,UAAU,EAAE,CAAA"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { FileUpload, type FileUploadProps, type PreselectedUrl, } from './FileUpload';
|
|
1
|
+
export { FileUpload, type FileUploadProps, type FileUploadStatus, type PreselectedUrl, } from './FileUpload';
|
|
2
2
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/FileUpload/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,UAAU,EACV,KAAK,eAAe,EACpB,KAAK,cAAc,GACpB,MAAM,cAAc,CAAA"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/FileUpload/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,UAAU,EACV,KAAK,eAAe,EACpB,KAAK,gBAAgB,EACrB,KAAK,cAAc,GACpB,MAAM,cAAc,CAAA"}
|
|
@@ -7,53 +7,54 @@ declare const inputWrapperVariants: (props?: ({
|
|
|
7
7
|
/**
|
|
8
8
|
* Props for the Input component.
|
|
9
9
|
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
10
|
+
* Extends standard input attributes except `size` (replaced by a custom size
|
|
11
|
+
* variant), `type` (narrowed to a supported union), and `prefix`/`suffix`
|
|
12
|
+
* (replaced by ReactNode slots rendered inside the wrapper).
|
|
12
13
|
*/
|
|
13
14
|
export interface InputProps extends Omit<ComponentProps<'input'>, 'size' | 'prefix' | 'suffix' | 'type'>, VariantProps<typeof inputWrapperVariants> {
|
|
14
|
-
/**
|
|
15
|
+
/** Label text rendered above the input. */
|
|
15
16
|
label?: string;
|
|
16
17
|
/**
|
|
17
|
-
*
|
|
18
|
-
* @default
|
|
18
|
+
* HTML input type controlling keyboard layout and browser validation.
|
|
19
|
+
* @default 'text'
|
|
19
20
|
*/
|
|
20
21
|
type?: 'text' | 'email' | 'password' | 'number' | 'time';
|
|
21
|
-
/**
|
|
22
|
-
* Controls the visual size variant affecting height and typography.
|
|
23
|
-
* @default "base"
|
|
24
|
-
*/
|
|
22
|
+
/** Controls height and typography. @default 'base' */
|
|
25
23
|
size?: 'xs' | 'sm' | 'base' | 'lg';
|
|
26
|
-
/**
|
|
27
|
-
* Enables error state with red border and red hint text.
|
|
28
|
-
* @default false
|
|
29
|
-
*/
|
|
24
|
+
/** Applies error border and hint styling. @default false */
|
|
30
25
|
error?: boolean;
|
|
31
|
-
/**
|
|
26
|
+
/** Content rendered before the input value (e.g. an icon). */
|
|
32
27
|
prefix?: ReactNode;
|
|
33
|
-
/**
|
|
28
|
+
/** Content rendered after the input value (e.g. an icon or action button). */
|
|
34
29
|
suffix?: ReactNode;
|
|
35
30
|
/**
|
|
36
|
-
* Hides the required asterisk
|
|
31
|
+
* Hides the required asterisk in the label even when `required` is `true`.
|
|
37
32
|
* @default false
|
|
38
33
|
*/
|
|
39
34
|
disableRequiredAsterisk?: boolean;
|
|
40
|
-
/**
|
|
35
|
+
/** Helper or error text rendered below the input. */
|
|
41
36
|
hint?: string;
|
|
42
|
-
/**
|
|
37
|
+
/**
|
|
38
|
+
* Custom content rendered inline next to the label. Takes precedence over
|
|
39
|
+
* `infoTooltip` when both are provided.
|
|
40
|
+
*/
|
|
43
41
|
labelExtra?: ReactNode;
|
|
44
|
-
/**
|
|
42
|
+
/**
|
|
43
|
+
* Tooltip content shown in an info icon next to the label. Ignored when
|
|
44
|
+
* `labelExtra` is provided.
|
|
45
|
+
*/
|
|
45
46
|
infoTooltip?: string;
|
|
46
47
|
/**
|
|
47
|
-
* Input mask pattern using react-imask syntax.
|
|
48
|
+
* Input mask pattern using [react-imask](https://imask.js.org/) syntax.
|
|
49
|
+
* All alphabetic input is automatically uppercased.
|
|
48
50
|
*
|
|
49
|
-
*
|
|
50
|
-
* - `0`
|
|
51
|
-
* - `a`
|
|
52
|
-
* - `*`
|
|
53
|
-
* -
|
|
51
|
+
* Pattern tokens:
|
|
52
|
+
* - `0` — digit (0-9)
|
|
53
|
+
* - `a` — letter (auto-uppercased)
|
|
54
|
+
* - `*` — alphanumeric (auto-uppercased)
|
|
55
|
+
* - any other character — literal
|
|
54
56
|
*
|
|
55
57
|
* @example
|
|
56
|
-
* ```tsx
|
|
57
58
|
* // Phone number: (123) 456-7890
|
|
58
59
|
* <Input mask="(000) 000-0000" />
|
|
59
60
|
*
|
|
@@ -62,18 +63,16 @@ export interface InputProps extends Omit<ComponentProps<'input'>, 'size' | 'pref
|
|
|
62
63
|
*
|
|
63
64
|
* // Mixed format: AB-1234-CD
|
|
64
65
|
* <Input mask="aa-0000-aa" />
|
|
65
|
-
* ```
|
|
66
66
|
*/
|
|
67
67
|
mask?: string;
|
|
68
68
|
/**
|
|
69
|
-
* Stops `click` events on the wrapper from propagating to ancestors. Use
|
|
70
|
-
* when the Input
|
|
71
|
-
* ReorderableTable row
|
|
72
|
-
*
|
|
69
|
+
* Stops `click` events on the wrapper from propagating to ancestors. Use
|
|
70
|
+
* when the Input sits inside a clickable container (e.g. a DataTable or
|
|
71
|
+
* ReorderableTable row with `onRowClick`) so clicking the input's padding,
|
|
72
|
+
* prefix, or suffix area does not trigger the parent's click handler.
|
|
73
73
|
*
|
|
74
|
-
*
|
|
75
|
-
* and `keydown`
|
|
76
|
-
* itself is preserved.
|
|
74
|
+
* Only `click` events are stopped — `focus`, `pointerdown`/`mousedown`,
|
|
75
|
+
* and `keydown` still bubble, and focus behavior on the input is preserved.
|
|
77
76
|
* @default false
|
|
78
77
|
*/
|
|
79
78
|
stopClickPropagation?: boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Input.d.ts","sourceRoot":"","sources":["../../../src/components/Input/Input.tsx"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,cAAc,EACnB,KAAK,SAAS,EAKf,MAAM,OAAO,CAAA;AACd,OAAO,EAAE,KAAK,YAAY,EAAO,MAAM,0BAA0B,CAAA;AAMjE,QAAA,MAAM,oBAAoB;;;8EA0BzB,CAAA;AAgBD
|
|
1
|
+
{"version":3,"file":"Input.d.ts","sourceRoot":"","sources":["../../../src/components/Input/Input.tsx"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,cAAc,EACnB,KAAK,SAAS,EAKf,MAAM,OAAO,CAAA;AACd,OAAO,EAAE,KAAK,YAAY,EAAO,MAAM,0BAA0B,CAAA;AAMjE,QAAA,MAAM,oBAAoB;;;8EA0BzB,CAAA;AAgBD;;;;;;GAMG;AACH,MAAM,WAAW,UACf,SAAQ,IAAI,CAAC,cAAc,CAAC,OAAO,CAAC,EAAE,MAAM,GAAG,QAAQ,GAAG,QAAQ,GAAG,MAAM,CAAC,EAC1E,YAAY,CAAC,OAAO,oBAAoB,CAAC;IAC3C,2CAA2C;IAC3C,KAAK,CAAC,EAAE,MAAM,CAAA;IACd;;;OAGG;IACH,IAAI,CAAC,EAAE,MAAM,GAAG,OAAO,GAAG,UAAU,GAAG,QAAQ,GAAG,MAAM,CAAA;IACxD,sDAAsD;IACtD,IAAI,CAAC,EAAE,IAAI,GAAG,IAAI,GAAG,MAAM,GAAG,IAAI,CAAA;IAClC,4DAA4D;IAC5D,KAAK,CAAC,EAAE,OAAO,CAAA;IACf,8DAA8D;IAC9D,MAAM,CAAC,EAAE,SAAS,CAAA;IAClB,8EAA8E;IAC9E,MAAM,CAAC,EAAE,SAAS,CAAA;IAClB;;;OAGG;IACH,uBAAuB,CAAC,EAAE,OAAO,CAAA;IACjC,qDAAqD;IACrD,IAAI,CAAC,EAAE,MAAM,CAAA;IACb;;;OAGG;IACH,UAAU,CAAC,EAAE,SAAS,CAAA;IACtB;;;OAGG;IACH,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB;;;;;;;;;;;;;;;;;;;OAmBG;IACH,IAAI,CAAC,EAAE,MAAM,CAAA;IACb;;;;;;;;;OASG;IACH,oBAAoB,CAAC,EAAE,OAAO,CAAA;CAC/B;AAED,eAAO,MAAM,KAAK,sHAiJjB,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Input.stories.d.ts","sourceRoot":"","sources":["../../../src/components/Input/Input.stories.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAA;AAE3D,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAA;AAE/B,QAAA,MAAM,IAAI,EAAE,IAAI,CAAC,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"Input.stories.d.ts","sourceRoot":"","sources":["../../../src/components/Input/Input.stories.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAA;AAE3D,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAA;AAE/B,QAAA,MAAM,IAAI,EAAE,IAAI,CAAC,OAAO,KAAK,CAgK5B,CAAA;AAED,eAAe,IAAI,CAAA;AACnB,KAAK,KAAK,GAAG,QAAQ,CAAC,OAAO,KAAK,CAAC,CAAA;AAGnC,eAAO,MAAM,OAAO,EAAE,KAarB,CAAA;AAED,eAAO,MAAM,wBAAwB,EAAE,KAgBtC,CAAA;AAED,eAAO,MAAM,qBAAqB,EAAE,KAgBnC,CAAA;AAED,eAAO,MAAM,cAAc,EAAE,KAgB5B,CAAA;AAED,eAAO,MAAM,aAAa,EAAE,KAgB3B,CAAA;AAED,eAAO,MAAM,aAAa,EAAE,KAyB3B,CAAA;AAED,eAAO,MAAM,yBAAyB,EAAE,KAyBvC,CAAA;AAED,eAAO,MAAM,QAAQ,EAAE,KAqBtB,CAAA;AAED,eAAO,MAAM,QAAQ,EAAE,KAsBtB,CAAA"}
|