@dragunio/fe-libs 0.1.5 → 0.1.6
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/README.md +28 -3
- package/dist/{chunk-3TCR34LS.mjs → chunk-NDMLXSI5.mjs} +13 -0
- package/dist/icons.d.mts +2 -1
- package/dist/icons.d.ts +2 -1
- package/dist/icons.js +14 -0
- package/dist/icons.mjs +3 -1
- package/dist/index.d.mts +98 -5
- package/dist/index.d.ts +98 -5
- package/dist/index.js +410 -99
- package/dist/index.mjs +414 -103
- package/dist/styles.css +238 -30
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -88,6 +88,9 @@ import {
|
|
|
88
88
|
PlusIcon,
|
|
89
89
|
Table,
|
|
90
90
|
Toggle,
|
|
91
|
+
Checkbox,
|
|
92
|
+
RadioButton,
|
|
93
|
+
RadioGroup,
|
|
91
94
|
Selection,
|
|
92
95
|
DateTimePicker,
|
|
93
96
|
} from '@dragunio/fe-libs';
|
|
@@ -96,7 +99,7 @@ import '@dragunio/fe-libs/styles.css';
|
|
|
96
99
|
|
|
97
100
|
### Toggle
|
|
98
101
|
|
|
99
|
-
`Toggle` is a native checkbox styled as a switch. It supports controlled and uncontrolled usage, including the standard `onChange`, `onClick`, and `disabled` props. The active color is green by default and accepts any CSS color.
|
|
102
|
+
`Toggle` is a native checkbox styled as a switch. It supports controlled and uncontrolled usage, including the standard `onChange`, `onClick`, and `disabled` props. The active color is green by default and accepts any CSS color. Use `labelPosition="top"` to render its label above the switch; `right` is the default.
|
|
100
103
|
|
|
101
104
|
```tsx
|
|
102
105
|
<Toggle
|
|
@@ -107,6 +110,28 @@ import '@dragunio/fe-libs/styles.css';
|
|
|
107
110
|
/>
|
|
108
111
|
```
|
|
109
112
|
|
|
113
|
+
### Checkbox and radio controls
|
|
114
|
+
|
|
115
|
+
`Checkbox` and `RadioButton` keep native input behaviour while adding a styled control. They accept `label` and `labelPosition="top" | "right"` (`right` by default).
|
|
116
|
+
|
|
117
|
+
`RadioGroup` renders a named, accessible group from `options`. It is controlled with `value` or uncontrolled with `defaultValue`; `onChange` receives `(value, option, event)`. Its group label defaults to `top` and can also use `labelPosition="right"`.
|
|
118
|
+
|
|
119
|
+
```tsx
|
|
120
|
+
<Checkbox label="Send me product updates" defaultChecked />
|
|
121
|
+
|
|
122
|
+
<RadioButton name="delivery" value="standard" label="Standard delivery" />
|
|
123
|
+
|
|
124
|
+
<RadioGroup
|
|
125
|
+
label="Notification frequency"
|
|
126
|
+
value={frequency}
|
|
127
|
+
onChange={(value) => setFrequency(value)}
|
|
128
|
+
options={[
|
|
129
|
+
{ label: 'Daily', value: 'daily' },
|
|
130
|
+
{ label: 'Weekly', value: 'weekly' },
|
|
131
|
+
]}
|
|
132
|
+
/>
|
|
133
|
+
```
|
|
134
|
+
|
|
110
135
|
### Resizable data table
|
|
111
136
|
|
|
112
137
|
Pass `headers` and `data` to have `Table` derive the maximum column count and an initial width for each column. The resize callback emits pixel widths, ready to persist in user preferences.
|
|
@@ -138,10 +163,10 @@ The library exposes ESM, CommonJS, TypeScript declarations, and keeps React as a
|
|
|
138
163
|
- `Drawer` is a portal-based modal panel with `left`, `right`, `top`, and `bottom` slide-in animations. Use `fullScreen` for a full-viewport panel and `footer` for fixed actions below the scrollable body.
|
|
139
164
|
- `Selection` is a rounded custom dropdown inspired by DropdownCustom, with single/multiple modes, optional search, clear action, tags, form-field values, and keyboard navigation.
|
|
140
165
|
- `DateTimePicker` supports `mode="single"` and `mode="range"`; its default format is `dd/MM/yyyy HH:mm`.
|
|
141
|
-
- `NumberInput` and `CurrencyInput` format values immediately while typing (`1000` → `1,000`) and keep up to two fractional digits by default. Use `allowDecimal`, `decimals`, `min`, and `max` to control decimal input and numeric limits. Both support `error` and `errorMessage` with the same red border/message treatment as `TextInput`. `CurrencyInput` adds a `VND` suffix by default, or a currency dropdown through `currencies`.
|
|
166
|
+
- `NumberInput` and `CurrencyInput` format values immediately while typing (`1000` → `1,000`) and keep up to two fractional digits by default. Both include accessible up/down controls (and arrow-key support); use `step` or `showStepper` to configure them. `NumberInput` also accepts `prefix`/`suffix` adornments. Use `allowDecimal`, `decimals`, `min`, and `max` to control decimal input and numeric limits. Both support `error` and `errorMessage` with the same red border/message treatment as `TextInput`. `CurrencyInput` adds a `VND` suffix by default, or a currency dropdown through `currencies`.
|
|
142
167
|
- `Tooltip` shows accessible content on hover and focus.
|
|
143
168
|
- `ExpandableSection` provides controlled and uncontrolled expand/collapse behavior.
|
|
144
|
-
- `TextInput` and `TextArea` support `error`/`errorMessage`, `helperText`, `clearable`, `onClear`, and `onValueChange`. `TextInput` also accepts `label`, `isRequired`, and `prefix`/`suffix` adornments. Passing a string to `error` shows it below the field and applies the error border.
|
|
169
|
+
- `TextInput` and `TextArea` support `error`/`errorMessage`, `helperText`, `clearable`, `onClear`, and `onValueChange`. `TextArea` also accepts `autosize` (default `false`) to grow with its content. `TextInput` also accepts `label`, `isRequired`, and `prefix`/`suffix` adornments. Passing a string to `error` shows it below the field and applies the error border.
|
|
145
170
|
- `Modal` is a centered portal dialog in `small`, `medium`, `large`, `xlarge`, and `full` sizes. Its close control and `actions` are library `Button` instances.
|
|
146
171
|
- `Loading` provides `small`, `medium`, and `large` circular indicators (or a custom pixel `size`); use `Skeleton.Circle` and `Skeleton.Square` with `size`, or `Skeleton.Box` and `Skeleton.Line` with `width` and `height`.
|
|
147
172
|
- `ProgressBar` is determinate when `value` is supplied and renders an indeterminate back-and-forth animation when it is omitted.
|
|
@@ -118,6 +118,18 @@ function ChevronDownIcon(props) {
|
|
|
118
118
|
}
|
|
119
119
|
) });
|
|
120
120
|
}
|
|
121
|
+
function ChevronUpIcon(props) {
|
|
122
|
+
return /* @__PURE__ */ jsx4("svg", { ...iconProps4(props), children: /* @__PURE__ */ jsx4(
|
|
123
|
+
"path",
|
|
124
|
+
{
|
|
125
|
+
d: "m6 15 6-6 6 6",
|
|
126
|
+
stroke: "currentColor",
|
|
127
|
+
strokeWidth: "2",
|
|
128
|
+
strokeLinecap: "round",
|
|
129
|
+
strokeLinejoin: "round"
|
|
130
|
+
}
|
|
131
|
+
) });
|
|
132
|
+
}
|
|
121
133
|
function CloseIcon(props) {
|
|
122
134
|
return /* @__PURE__ */ jsx4("svg", { ...iconProps4(props), children: /* @__PURE__ */ jsx4(
|
|
123
135
|
"path",
|
|
@@ -164,6 +176,7 @@ export {
|
|
|
164
176
|
lock_unlocked,
|
|
165
177
|
PlusIcon,
|
|
166
178
|
ChevronDownIcon,
|
|
179
|
+
ChevronUpIcon,
|
|
167
180
|
CloseIcon,
|
|
168
181
|
SearchIcon
|
|
169
182
|
};
|
package/dist/icons.d.mts
CHANGED
|
@@ -26,7 +26,8 @@ type IconProps = SVGProps<SVGSVGElement> & {
|
|
|
26
26
|
};
|
|
27
27
|
declare function PlusIcon(props: IconProps): react.JSX.Element;
|
|
28
28
|
declare function ChevronDownIcon(props: IconProps): react.JSX.Element;
|
|
29
|
+
declare function ChevronUpIcon(props: IconProps): react.JSX.Element;
|
|
29
30
|
declare function CloseIcon(props: IconProps): react.JSX.Element;
|
|
30
31
|
declare function SearchIcon(props: IconProps): react.JSX.Element;
|
|
31
32
|
|
|
32
|
-
export { ChevronDownIcon, CloseIcon, type IconProps, PlusIcon, SearchIcon, arrow_left, check_square_fill, chevron_down, chevron_left, chevron_right, chevron_up, copy, key, lock, lock_unlocked, log_out, minus_square, plus, plus_square, search, trash, x_close };
|
|
33
|
+
export { ChevronDownIcon, ChevronUpIcon, CloseIcon, type IconProps, PlusIcon, SearchIcon, arrow_left, check_square_fill, chevron_down, chevron_left, chevron_right, chevron_up, copy, key, lock, lock_unlocked, log_out, minus_square, plus, plus_square, search, trash, x_close };
|
package/dist/icons.d.ts
CHANGED
|
@@ -26,7 +26,8 @@ type IconProps = SVGProps<SVGSVGElement> & {
|
|
|
26
26
|
};
|
|
27
27
|
declare function PlusIcon(props: IconProps): react.JSX.Element;
|
|
28
28
|
declare function ChevronDownIcon(props: IconProps): react.JSX.Element;
|
|
29
|
+
declare function ChevronUpIcon(props: IconProps): react.JSX.Element;
|
|
29
30
|
declare function CloseIcon(props: IconProps): react.JSX.Element;
|
|
30
31
|
declare function SearchIcon(props: IconProps): react.JSX.Element;
|
|
31
32
|
|
|
32
|
-
export { ChevronDownIcon, CloseIcon, type IconProps, PlusIcon, SearchIcon, arrow_left, check_square_fill, chevron_down, chevron_left, chevron_right, chevron_up, copy, key, lock, lock_unlocked, log_out, minus_square, plus, plus_square, search, trash, x_close };
|
|
33
|
+
export { ChevronDownIcon, ChevronUpIcon, CloseIcon, type IconProps, PlusIcon, SearchIcon, arrow_left, check_square_fill, chevron_down, chevron_left, chevron_right, chevron_up, copy, key, lock, lock_unlocked, log_out, minus_square, plus, plus_square, search, trash, x_close };
|
package/dist/icons.js
CHANGED
|
@@ -21,6 +21,7 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
21
21
|
var icons_exports = {};
|
|
22
22
|
__export(icons_exports, {
|
|
23
23
|
ChevronDownIcon: () => ChevronDownIcon,
|
|
24
|
+
ChevronUpIcon: () => ChevronUpIcon,
|
|
24
25
|
CloseIcon: () => CloseIcon,
|
|
25
26
|
PlusIcon: () => PlusIcon,
|
|
26
27
|
SearchIcon: () => SearchIcon,
|
|
@@ -164,6 +165,18 @@ function ChevronDownIcon(props) {
|
|
|
164
165
|
}
|
|
165
166
|
) });
|
|
166
167
|
}
|
|
168
|
+
function ChevronUpIcon(props) {
|
|
169
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("svg", { ...iconProps4(props), children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
170
|
+
"path",
|
|
171
|
+
{
|
|
172
|
+
d: "m6 15 6-6 6 6",
|
|
173
|
+
stroke: "currentColor",
|
|
174
|
+
strokeWidth: "2",
|
|
175
|
+
strokeLinecap: "round",
|
|
176
|
+
strokeLinejoin: "round"
|
|
177
|
+
}
|
|
178
|
+
) });
|
|
179
|
+
}
|
|
167
180
|
function CloseIcon(props) {
|
|
168
181
|
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("svg", { ...iconProps4(props), children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
169
182
|
"path",
|
|
@@ -192,6 +205,7 @@ function SearchIcon(props) {
|
|
|
192
205
|
// Annotate the CommonJS export names for ESM import in node:
|
|
193
206
|
0 && (module.exports = {
|
|
194
207
|
ChevronDownIcon,
|
|
208
|
+
ChevronUpIcon,
|
|
195
209
|
CloseIcon,
|
|
196
210
|
PlusIcon,
|
|
197
211
|
SearchIcon,
|
package/dist/icons.mjs
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
ChevronDownIcon,
|
|
3
|
+
ChevronUpIcon,
|
|
3
4
|
CloseIcon,
|
|
4
5
|
PlusIcon,
|
|
5
6
|
SearchIcon,
|
|
@@ -20,9 +21,10 @@ import {
|
|
|
20
21
|
search,
|
|
21
22
|
trash,
|
|
22
23
|
x_close
|
|
23
|
-
} from "./chunk-
|
|
24
|
+
} from "./chunk-NDMLXSI5.mjs";
|
|
24
25
|
export {
|
|
25
26
|
ChevronDownIcon,
|
|
27
|
+
ChevronUpIcon,
|
|
26
28
|
CloseIcon,
|
|
27
29
|
PlusIcon,
|
|
28
30
|
SearchIcon,
|
package/dist/index.d.mts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as react from 'react';
|
|
2
|
-
import { ButtonHTMLAttributes, ReactNode, TableHTMLAttributes, HTMLAttributes, InputHTMLAttributes, TextareaHTMLAttributes, KeyboardEventHandler, ReactElement } from 'react';
|
|
3
|
-
export { ChevronDownIcon, CloseIcon, IconProps, PlusIcon, SearchIcon, arrow_left, check_square_fill, chevron_down, chevron_left, chevron_right, chevron_up, copy, key, lock, lock_unlocked, log_out, minus_square, plus, plus_square, search, trash, x_close } from './icons.mjs';
|
|
2
|
+
import { ButtonHTMLAttributes, ReactNode, TableHTMLAttributes, HTMLAttributes, InputHTMLAttributes, TextareaHTMLAttributes, KeyboardEventHandler, ChangeEvent, ReactElement } from 'react';
|
|
3
|
+
export { ChevronDownIcon, ChevronUpIcon, CloseIcon, IconProps, PlusIcon, SearchIcon, arrow_left, check_square_fill, chevron_down, chevron_left, chevron_right, chevron_up, copy, key, lock, lock_unlocked, log_out, minus_square, plus, plus_square, search, trash, x_close } from './icons.mjs';
|
|
4
4
|
|
|
5
5
|
type ButtonHierarchy = 'primary' | 'secondary-gray' | 'secondary-color' | 'tertiary-gray' | 'tertiary-color';
|
|
6
6
|
type ButtonSize = '24' | '32' | '40';
|
|
@@ -92,12 +92,16 @@ type ToggleProps = Omit<InputHTMLAttributes<HTMLInputElement>, 'color' | 'type'>
|
|
|
92
92
|
color?: string;
|
|
93
93
|
/** Optional text displayed next to the switch. */
|
|
94
94
|
label?: ReactNode;
|
|
95
|
+
/** Places the label above or to the right of the switch. Defaults to `right`. */
|
|
96
|
+
labelPosition?: 'top' | 'right';
|
|
95
97
|
};
|
|
96
98
|
declare const Toggle: react.ForwardRefExoticComponent<Omit<InputHTMLAttributes<HTMLInputElement>, "color" | "type"> & {
|
|
97
99
|
/** Active track color. Accepts any valid CSS color, for example `#16a34a`. */
|
|
98
100
|
color?: string;
|
|
99
101
|
/** Optional text displayed next to the switch. */
|
|
100
102
|
label?: ReactNode;
|
|
103
|
+
/** Places the label above or to the right of the switch. Defaults to `right`. */
|
|
104
|
+
labelPosition?: "top" | "right";
|
|
101
105
|
} & react.RefAttributes<HTMLInputElement>>;
|
|
102
106
|
|
|
103
107
|
type DrawerProps = Omit<HTMLAttributes<HTMLElement>, 'title'> & {
|
|
@@ -175,11 +179,14 @@ declare const TextArea: react.ForwardRefExoticComponent<Omit<react.TextareaHTMLA
|
|
|
175
179
|
onValueChange?: (value: string) => void;
|
|
176
180
|
clearLabel?: string;
|
|
177
181
|
} & {
|
|
182
|
+
autosize?: boolean;
|
|
178
183
|
value?: string;
|
|
179
184
|
defaultValue?: string;
|
|
180
185
|
} & react.RefAttributes<HTMLTextAreaElement>>;
|
|
181
186
|
|
|
182
187
|
type TextAreaProps = Omit<TextareaHTMLAttributes<HTMLTextAreaElement>, 'value' | 'defaultValue'> & TextFieldBaseProps & {
|
|
188
|
+
/** Expands the textarea to fit its content. */
|
|
189
|
+
autosize?: boolean;
|
|
183
190
|
value?: string;
|
|
184
191
|
defaultValue?: string;
|
|
185
192
|
};
|
|
@@ -241,7 +248,7 @@ declare const Selection: react.ForwardRefExoticComponent<Omit<react.HTMLAttribut
|
|
|
241
248
|
|
|
242
249
|
declare function formatNumber(value: number, decimals?: number, thousandSeparator?: string, decimalSeparator?: string): string;
|
|
243
250
|
/** A text input that displays numbers as 1,000.05 by default. */
|
|
244
|
-
declare const NumberInput: react.ForwardRefExoticComponent<Omit<react.InputHTMLAttributes<HTMLInputElement>, "type" | "value" | "defaultValue" | "onChange" | "max" | "min"> & {
|
|
251
|
+
declare const NumberInput: react.ForwardRefExoticComponent<Omit<react.InputHTMLAttributes<HTMLInputElement>, "type" | "value" | "defaultValue" | "onChange" | "step" | "max" | "min"> & {
|
|
245
252
|
value?: number | null;
|
|
246
253
|
defaultValue?: number | null;
|
|
247
254
|
onValueChange?: (value: number | null) => void;
|
|
@@ -251,10 +258,18 @@ declare const NumberInput: react.ForwardRefExoticComponent<Omit<react.InputHTMLA
|
|
|
251
258
|
max?: number;
|
|
252
259
|
decimalSeparator?: string;
|
|
253
260
|
thousandSeparator?: string;
|
|
261
|
+
prefix?: react.ReactNode;
|
|
262
|
+
suffix?: react.ReactNode;
|
|
263
|
+
Prefix?: react.ReactNode;
|
|
264
|
+
Suffix?: react.ReactNode;
|
|
254
265
|
endAdornment?: react.ReactNode;
|
|
266
|
+
step?: number;
|
|
267
|
+
showStepper?: boolean;
|
|
268
|
+
incrementLabel?: string;
|
|
269
|
+
decrementLabel?: string;
|
|
255
270
|
} & FieldBaseProps & react.RefAttributes<HTMLInputElement>>;
|
|
256
271
|
|
|
257
|
-
type NumberInputProps = Omit<InputHTMLAttributes<HTMLInputElement>, 'type' | 'value' | 'defaultValue' | 'onChange' | 'min' | 'max'> & {
|
|
272
|
+
type NumberInputProps = Omit<InputHTMLAttributes<HTMLInputElement>, 'type' | 'value' | 'defaultValue' | 'onChange' | 'min' | 'max' | 'step'> & {
|
|
258
273
|
value?: number | null;
|
|
259
274
|
defaultValue?: number | null;
|
|
260
275
|
onValueChange?: (value: number | null) => void;
|
|
@@ -267,8 +282,24 @@ type NumberInputProps = Omit<InputHTMLAttributes<HTMLInputElement>, 'type' | 'va
|
|
|
267
282
|
max?: number;
|
|
268
283
|
decimalSeparator?: string;
|
|
269
284
|
thousandSeparator?: string;
|
|
285
|
+
/** Content rendered inside the control before the numeric value. */
|
|
286
|
+
prefix?: ReactNode;
|
|
287
|
+
/** Content rendered inside the control after the numeric value. */
|
|
288
|
+
suffix?: ReactNode;
|
|
289
|
+
/** Alias for prefix. */
|
|
290
|
+
Prefix?: ReactNode;
|
|
291
|
+
/** Alias for suffix. */
|
|
292
|
+
Suffix?: ReactNode;
|
|
270
293
|
/** Content rendered inside the control after the numeric value. */
|
|
271
294
|
endAdornment?: ReactNode;
|
|
295
|
+
/** Amount added or subtracted by the increment and decrement controls. Defaults to 1. */
|
|
296
|
+
step?: number;
|
|
297
|
+
/** Shows the increment and decrement controls. Defaults to true. */
|
|
298
|
+
showStepper?: boolean;
|
|
299
|
+
/** Accessible label for the increment control. */
|
|
300
|
+
incrementLabel?: string;
|
|
301
|
+
/** Accessible label for the decrement control. */
|
|
302
|
+
decrementLabel?: string;
|
|
272
303
|
} & FieldBaseProps;
|
|
273
304
|
|
|
274
305
|
type Currency = {
|
|
@@ -311,6 +342,68 @@ type DateTimePickerProps = DateTimePickerSingleProps | DateTimePickerRangeProps;
|
|
|
311
342
|
/** Calendar and time picker. Supports a single Date or [start, end] range. */
|
|
312
343
|
declare function DateTimePicker(props: DateTimePickerProps): react.JSX.Element;
|
|
313
344
|
|
|
345
|
+
type ControlLabelPosition = 'top' | 'right';
|
|
346
|
+
type CheckboxProps = Omit<InputHTMLAttributes<HTMLInputElement>, 'type'> & {
|
|
347
|
+
/** Optional text associated with the checkbox. */
|
|
348
|
+
label?: ReactNode;
|
|
349
|
+
/** Places the label above or to the right of the checkbox. Defaults to `right`. */
|
|
350
|
+
labelPosition?: ControlLabelPosition;
|
|
351
|
+
};
|
|
352
|
+
|
|
353
|
+
/** A native checkbox with an accessible, custom visual control. */
|
|
354
|
+
declare const Checkbox: react.ForwardRefExoticComponent<Omit<react.InputHTMLAttributes<HTMLInputElement>, "type"> & {
|
|
355
|
+
label?: react.ReactNode;
|
|
356
|
+
labelPosition?: ControlLabelPosition;
|
|
357
|
+
} & react.RefAttributes<HTMLInputElement>>;
|
|
358
|
+
|
|
359
|
+
/** A native radio input with an accessible, custom visual control. */
|
|
360
|
+
declare const RadioButton: react.ForwardRefExoticComponent<Omit<react.InputHTMLAttributes<HTMLInputElement>, "type"> & {
|
|
361
|
+
label?: react.ReactNode;
|
|
362
|
+
labelPosition?: ControlLabelPosition;
|
|
363
|
+
} & react.RefAttributes<HTMLInputElement>>;
|
|
364
|
+
|
|
365
|
+
type RadioButtonProps = Omit<InputHTMLAttributes<HTMLInputElement>, 'type'> & {
|
|
366
|
+
/** Optional text associated with the radio button. */
|
|
367
|
+
label?: ReactNode;
|
|
368
|
+
/** Places the label above or to the right of the radio button. Defaults to `right`. */
|
|
369
|
+
labelPosition?: ControlLabelPosition;
|
|
370
|
+
};
|
|
371
|
+
|
|
372
|
+
type RadioValue = string | number;
|
|
373
|
+
type RadioGroupOption = {
|
|
374
|
+
label: ReactNode;
|
|
375
|
+
value: RadioValue;
|
|
376
|
+
disabled?: boolean;
|
|
377
|
+
};
|
|
378
|
+
type RadioGroupProps = Omit<HTMLAttributes<HTMLDivElement>, 'onChange' | 'defaultValue' | 'value'> & {
|
|
379
|
+
/** Optional text that names the radio group. */
|
|
380
|
+
label?: ReactNode;
|
|
381
|
+
/** Places the group label above or to the right of its options. Defaults to `top`. */
|
|
382
|
+
labelPosition?: ControlLabelPosition;
|
|
383
|
+
options: RadioGroupOption[];
|
|
384
|
+
name?: string;
|
|
385
|
+
value?: RadioValue;
|
|
386
|
+
defaultValue?: RadioValue;
|
|
387
|
+
onChange?: (value: RadioValue, option: RadioGroupOption, event: ChangeEvent<HTMLInputElement>) => void;
|
|
388
|
+
disabled?: boolean;
|
|
389
|
+
direction?: 'horizontal' | 'vertical';
|
|
390
|
+
isRequired?: boolean;
|
|
391
|
+
};
|
|
392
|
+
|
|
393
|
+
/** A named collection of native radio buttons with controlled and uncontrolled values. */
|
|
394
|
+
declare const RadioGroup: react.ForwardRefExoticComponent<Omit<react.HTMLAttributes<HTMLDivElement>, "value" | "defaultValue" | "onChange"> & {
|
|
395
|
+
label?: react.ReactNode;
|
|
396
|
+
labelPosition?: ControlLabelPosition;
|
|
397
|
+
options: RadioGroupOption[];
|
|
398
|
+
name?: string;
|
|
399
|
+
value?: RadioValue;
|
|
400
|
+
defaultValue?: RadioValue;
|
|
401
|
+
onChange?: (value: RadioValue, option: RadioGroupOption, event: ChangeEvent<HTMLInputElement>) => void;
|
|
402
|
+
disabled?: boolean;
|
|
403
|
+
direction?: "horizontal" | "vertical";
|
|
404
|
+
isRequired?: boolean;
|
|
405
|
+
} & react.RefAttributes<HTMLDivElement>>;
|
|
406
|
+
|
|
314
407
|
type TooltipProps = Omit<HTMLAttributes<HTMLSpanElement>, 'content'> & {
|
|
315
408
|
content: ReactNode;
|
|
316
409
|
children: ReactElement;
|
|
@@ -513,4 +606,4 @@ type SnackbarProps = Omit<HTMLAttributes<HTMLDivElement>, 'onClose'> & {
|
|
|
513
606
|
/** A controlled, temporary notification surface. */
|
|
514
607
|
declare function Snackbar({ open, message, autoHideDuration, onClose, action, anchorOrigin, closeLabel, className, ...props }: SnackbarProps): react.JSX.Element | null;
|
|
515
608
|
|
|
516
|
-
export { Button, type ButtonColor, type ButtonHierarchy, type ButtonProps, type ButtonSize, type ButtonVariant, Chip, type ChipProps, type ChipStatus, type ChipVariant, type ColumnResizeHandler, type Currency, CurrencyInput, type CurrencyInputProps, type DateRange, DateTimePicker, type DateTimePickerProps, type DateTimePickerRangeProps, type DateTimePickerSingleProps, type DescriptionDisplay, Drawer, type DrawerProps, ExpandableSection, type ExpandableSectionProps, type FieldError, Loading, type LoadingProps, type LoadingSize, Message, type MessageOptions, type MessageProps, type MessageSeverity, Modal, type ModalAction, type ModalProps, type ModalSize, NumberInput, type NumberInputProps, Pagination, type PaginationProps, ProgressBar, type ProgressBarProps, type ProgressBarSize, Selection, type SelectionOption, type SelectionProps, type SelectionValue, Skeleton, SkeletonBox, type SkeletonBoxProps, SkeletonCircle, SkeletonLine, type SkeletonProps, type SkeletonSizeProps, SkeletonSquare, type SkeletonVariant, Snackbar, type SnackbarAnchorOrigin, type SnackbarProps, Table, TableBody, TableCaption, TableCell, type TableData, TableHead, TableHeader, type TablePaginationPosition, type TableProps, TableRow, TextArea, type TextAreaProps, TextInput, type TextInputProps, Toggle, type ToggleProps, Tooltip, type TooltipProps, formatNumber, getIconSize, message };
|
|
609
|
+
export { Button, type ButtonColor, type ButtonHierarchy, type ButtonProps, type ButtonSize, type ButtonVariant, Checkbox, type CheckboxProps, Chip, type ChipProps, type ChipStatus, type ChipVariant, type ColumnResizeHandler, type ControlLabelPosition, type Currency, CurrencyInput, type CurrencyInputProps, type DateRange, DateTimePicker, type DateTimePickerProps, type DateTimePickerRangeProps, type DateTimePickerSingleProps, type DescriptionDisplay, Drawer, type DrawerProps, ExpandableSection, type ExpandableSectionProps, type FieldError, Loading, type LoadingProps, type LoadingSize, Message, type MessageOptions, type MessageProps, type MessageSeverity, Modal, type ModalAction, type ModalProps, type ModalSize, NumberInput, type NumberInputProps, Pagination, type PaginationProps, ProgressBar, type ProgressBarProps, type ProgressBarSize, RadioButton, type RadioButtonProps, RadioGroup, type RadioGroupOption, type RadioGroupProps, type RadioValue, Selection, type SelectionOption, type SelectionProps, type SelectionValue, Skeleton, SkeletonBox, type SkeletonBoxProps, SkeletonCircle, SkeletonLine, type SkeletonProps, type SkeletonSizeProps, SkeletonSquare, type SkeletonVariant, Snackbar, type SnackbarAnchorOrigin, type SnackbarProps, Table, TableBody, TableCaption, TableCell, type TableData, TableHead, TableHeader, type TablePaginationPosition, type TableProps, TableRow, TextArea, type TextAreaProps, TextInput, type TextInputProps, Toggle, type ToggleProps, Tooltip, type TooltipProps, formatNumber, getIconSize, message };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as react from 'react';
|
|
2
|
-
import { ButtonHTMLAttributes, ReactNode, TableHTMLAttributes, HTMLAttributes, InputHTMLAttributes, TextareaHTMLAttributes, KeyboardEventHandler, ReactElement } from 'react';
|
|
3
|
-
export { ChevronDownIcon, CloseIcon, IconProps, PlusIcon, SearchIcon, arrow_left, check_square_fill, chevron_down, chevron_left, chevron_right, chevron_up, copy, key, lock, lock_unlocked, log_out, minus_square, plus, plus_square, search, trash, x_close } from './icons.js';
|
|
2
|
+
import { ButtonHTMLAttributes, ReactNode, TableHTMLAttributes, HTMLAttributes, InputHTMLAttributes, TextareaHTMLAttributes, KeyboardEventHandler, ChangeEvent, ReactElement } from 'react';
|
|
3
|
+
export { ChevronDownIcon, ChevronUpIcon, CloseIcon, IconProps, PlusIcon, SearchIcon, arrow_left, check_square_fill, chevron_down, chevron_left, chevron_right, chevron_up, copy, key, lock, lock_unlocked, log_out, minus_square, plus, plus_square, search, trash, x_close } from './icons.js';
|
|
4
4
|
|
|
5
5
|
type ButtonHierarchy = 'primary' | 'secondary-gray' | 'secondary-color' | 'tertiary-gray' | 'tertiary-color';
|
|
6
6
|
type ButtonSize = '24' | '32' | '40';
|
|
@@ -92,12 +92,16 @@ type ToggleProps = Omit<InputHTMLAttributes<HTMLInputElement>, 'color' | 'type'>
|
|
|
92
92
|
color?: string;
|
|
93
93
|
/** Optional text displayed next to the switch. */
|
|
94
94
|
label?: ReactNode;
|
|
95
|
+
/** Places the label above or to the right of the switch. Defaults to `right`. */
|
|
96
|
+
labelPosition?: 'top' | 'right';
|
|
95
97
|
};
|
|
96
98
|
declare const Toggle: react.ForwardRefExoticComponent<Omit<InputHTMLAttributes<HTMLInputElement>, "color" | "type"> & {
|
|
97
99
|
/** Active track color. Accepts any valid CSS color, for example `#16a34a`. */
|
|
98
100
|
color?: string;
|
|
99
101
|
/** Optional text displayed next to the switch. */
|
|
100
102
|
label?: ReactNode;
|
|
103
|
+
/** Places the label above or to the right of the switch. Defaults to `right`. */
|
|
104
|
+
labelPosition?: "top" | "right";
|
|
101
105
|
} & react.RefAttributes<HTMLInputElement>>;
|
|
102
106
|
|
|
103
107
|
type DrawerProps = Omit<HTMLAttributes<HTMLElement>, 'title'> & {
|
|
@@ -175,11 +179,14 @@ declare const TextArea: react.ForwardRefExoticComponent<Omit<react.TextareaHTMLA
|
|
|
175
179
|
onValueChange?: (value: string) => void;
|
|
176
180
|
clearLabel?: string;
|
|
177
181
|
} & {
|
|
182
|
+
autosize?: boolean;
|
|
178
183
|
value?: string;
|
|
179
184
|
defaultValue?: string;
|
|
180
185
|
} & react.RefAttributes<HTMLTextAreaElement>>;
|
|
181
186
|
|
|
182
187
|
type TextAreaProps = Omit<TextareaHTMLAttributes<HTMLTextAreaElement>, 'value' | 'defaultValue'> & TextFieldBaseProps & {
|
|
188
|
+
/** Expands the textarea to fit its content. */
|
|
189
|
+
autosize?: boolean;
|
|
183
190
|
value?: string;
|
|
184
191
|
defaultValue?: string;
|
|
185
192
|
};
|
|
@@ -241,7 +248,7 @@ declare const Selection: react.ForwardRefExoticComponent<Omit<react.HTMLAttribut
|
|
|
241
248
|
|
|
242
249
|
declare function formatNumber(value: number, decimals?: number, thousandSeparator?: string, decimalSeparator?: string): string;
|
|
243
250
|
/** A text input that displays numbers as 1,000.05 by default. */
|
|
244
|
-
declare const NumberInput: react.ForwardRefExoticComponent<Omit<react.InputHTMLAttributes<HTMLInputElement>, "type" | "value" | "defaultValue" | "onChange" | "max" | "min"> & {
|
|
251
|
+
declare const NumberInput: react.ForwardRefExoticComponent<Omit<react.InputHTMLAttributes<HTMLInputElement>, "type" | "value" | "defaultValue" | "onChange" | "step" | "max" | "min"> & {
|
|
245
252
|
value?: number | null;
|
|
246
253
|
defaultValue?: number | null;
|
|
247
254
|
onValueChange?: (value: number | null) => void;
|
|
@@ -251,10 +258,18 @@ declare const NumberInput: react.ForwardRefExoticComponent<Omit<react.InputHTMLA
|
|
|
251
258
|
max?: number;
|
|
252
259
|
decimalSeparator?: string;
|
|
253
260
|
thousandSeparator?: string;
|
|
261
|
+
prefix?: react.ReactNode;
|
|
262
|
+
suffix?: react.ReactNode;
|
|
263
|
+
Prefix?: react.ReactNode;
|
|
264
|
+
Suffix?: react.ReactNode;
|
|
254
265
|
endAdornment?: react.ReactNode;
|
|
266
|
+
step?: number;
|
|
267
|
+
showStepper?: boolean;
|
|
268
|
+
incrementLabel?: string;
|
|
269
|
+
decrementLabel?: string;
|
|
255
270
|
} & FieldBaseProps & react.RefAttributes<HTMLInputElement>>;
|
|
256
271
|
|
|
257
|
-
type NumberInputProps = Omit<InputHTMLAttributes<HTMLInputElement>, 'type' | 'value' | 'defaultValue' | 'onChange' | 'min' | 'max'> & {
|
|
272
|
+
type NumberInputProps = Omit<InputHTMLAttributes<HTMLInputElement>, 'type' | 'value' | 'defaultValue' | 'onChange' | 'min' | 'max' | 'step'> & {
|
|
258
273
|
value?: number | null;
|
|
259
274
|
defaultValue?: number | null;
|
|
260
275
|
onValueChange?: (value: number | null) => void;
|
|
@@ -267,8 +282,24 @@ type NumberInputProps = Omit<InputHTMLAttributes<HTMLInputElement>, 'type' | 'va
|
|
|
267
282
|
max?: number;
|
|
268
283
|
decimalSeparator?: string;
|
|
269
284
|
thousandSeparator?: string;
|
|
285
|
+
/** Content rendered inside the control before the numeric value. */
|
|
286
|
+
prefix?: ReactNode;
|
|
287
|
+
/** Content rendered inside the control after the numeric value. */
|
|
288
|
+
suffix?: ReactNode;
|
|
289
|
+
/** Alias for prefix. */
|
|
290
|
+
Prefix?: ReactNode;
|
|
291
|
+
/** Alias for suffix. */
|
|
292
|
+
Suffix?: ReactNode;
|
|
270
293
|
/** Content rendered inside the control after the numeric value. */
|
|
271
294
|
endAdornment?: ReactNode;
|
|
295
|
+
/** Amount added or subtracted by the increment and decrement controls. Defaults to 1. */
|
|
296
|
+
step?: number;
|
|
297
|
+
/** Shows the increment and decrement controls. Defaults to true. */
|
|
298
|
+
showStepper?: boolean;
|
|
299
|
+
/** Accessible label for the increment control. */
|
|
300
|
+
incrementLabel?: string;
|
|
301
|
+
/** Accessible label for the decrement control. */
|
|
302
|
+
decrementLabel?: string;
|
|
272
303
|
} & FieldBaseProps;
|
|
273
304
|
|
|
274
305
|
type Currency = {
|
|
@@ -311,6 +342,68 @@ type DateTimePickerProps = DateTimePickerSingleProps | DateTimePickerRangeProps;
|
|
|
311
342
|
/** Calendar and time picker. Supports a single Date or [start, end] range. */
|
|
312
343
|
declare function DateTimePicker(props: DateTimePickerProps): react.JSX.Element;
|
|
313
344
|
|
|
345
|
+
type ControlLabelPosition = 'top' | 'right';
|
|
346
|
+
type CheckboxProps = Omit<InputHTMLAttributes<HTMLInputElement>, 'type'> & {
|
|
347
|
+
/** Optional text associated with the checkbox. */
|
|
348
|
+
label?: ReactNode;
|
|
349
|
+
/** Places the label above or to the right of the checkbox. Defaults to `right`. */
|
|
350
|
+
labelPosition?: ControlLabelPosition;
|
|
351
|
+
};
|
|
352
|
+
|
|
353
|
+
/** A native checkbox with an accessible, custom visual control. */
|
|
354
|
+
declare const Checkbox: react.ForwardRefExoticComponent<Omit<react.InputHTMLAttributes<HTMLInputElement>, "type"> & {
|
|
355
|
+
label?: react.ReactNode;
|
|
356
|
+
labelPosition?: ControlLabelPosition;
|
|
357
|
+
} & react.RefAttributes<HTMLInputElement>>;
|
|
358
|
+
|
|
359
|
+
/** A native radio input with an accessible, custom visual control. */
|
|
360
|
+
declare const RadioButton: react.ForwardRefExoticComponent<Omit<react.InputHTMLAttributes<HTMLInputElement>, "type"> & {
|
|
361
|
+
label?: react.ReactNode;
|
|
362
|
+
labelPosition?: ControlLabelPosition;
|
|
363
|
+
} & react.RefAttributes<HTMLInputElement>>;
|
|
364
|
+
|
|
365
|
+
type RadioButtonProps = Omit<InputHTMLAttributes<HTMLInputElement>, 'type'> & {
|
|
366
|
+
/** Optional text associated with the radio button. */
|
|
367
|
+
label?: ReactNode;
|
|
368
|
+
/** Places the label above or to the right of the radio button. Defaults to `right`. */
|
|
369
|
+
labelPosition?: ControlLabelPosition;
|
|
370
|
+
};
|
|
371
|
+
|
|
372
|
+
type RadioValue = string | number;
|
|
373
|
+
type RadioGroupOption = {
|
|
374
|
+
label: ReactNode;
|
|
375
|
+
value: RadioValue;
|
|
376
|
+
disabled?: boolean;
|
|
377
|
+
};
|
|
378
|
+
type RadioGroupProps = Omit<HTMLAttributes<HTMLDivElement>, 'onChange' | 'defaultValue' | 'value'> & {
|
|
379
|
+
/** Optional text that names the radio group. */
|
|
380
|
+
label?: ReactNode;
|
|
381
|
+
/** Places the group label above or to the right of its options. Defaults to `top`. */
|
|
382
|
+
labelPosition?: ControlLabelPosition;
|
|
383
|
+
options: RadioGroupOption[];
|
|
384
|
+
name?: string;
|
|
385
|
+
value?: RadioValue;
|
|
386
|
+
defaultValue?: RadioValue;
|
|
387
|
+
onChange?: (value: RadioValue, option: RadioGroupOption, event: ChangeEvent<HTMLInputElement>) => void;
|
|
388
|
+
disabled?: boolean;
|
|
389
|
+
direction?: 'horizontal' | 'vertical';
|
|
390
|
+
isRequired?: boolean;
|
|
391
|
+
};
|
|
392
|
+
|
|
393
|
+
/** A named collection of native radio buttons with controlled and uncontrolled values. */
|
|
394
|
+
declare const RadioGroup: react.ForwardRefExoticComponent<Omit<react.HTMLAttributes<HTMLDivElement>, "value" | "defaultValue" | "onChange"> & {
|
|
395
|
+
label?: react.ReactNode;
|
|
396
|
+
labelPosition?: ControlLabelPosition;
|
|
397
|
+
options: RadioGroupOption[];
|
|
398
|
+
name?: string;
|
|
399
|
+
value?: RadioValue;
|
|
400
|
+
defaultValue?: RadioValue;
|
|
401
|
+
onChange?: (value: RadioValue, option: RadioGroupOption, event: ChangeEvent<HTMLInputElement>) => void;
|
|
402
|
+
disabled?: boolean;
|
|
403
|
+
direction?: "horizontal" | "vertical";
|
|
404
|
+
isRequired?: boolean;
|
|
405
|
+
} & react.RefAttributes<HTMLDivElement>>;
|
|
406
|
+
|
|
314
407
|
type TooltipProps = Omit<HTMLAttributes<HTMLSpanElement>, 'content'> & {
|
|
315
408
|
content: ReactNode;
|
|
316
409
|
children: ReactElement;
|
|
@@ -513,4 +606,4 @@ type SnackbarProps = Omit<HTMLAttributes<HTMLDivElement>, 'onClose'> & {
|
|
|
513
606
|
/** A controlled, temporary notification surface. */
|
|
514
607
|
declare function Snackbar({ open, message, autoHideDuration, onClose, action, anchorOrigin, closeLabel, className, ...props }: SnackbarProps): react.JSX.Element | null;
|
|
515
608
|
|
|
516
|
-
export { Button, type ButtonColor, type ButtonHierarchy, type ButtonProps, type ButtonSize, type ButtonVariant, Chip, type ChipProps, type ChipStatus, type ChipVariant, type ColumnResizeHandler, type Currency, CurrencyInput, type CurrencyInputProps, type DateRange, DateTimePicker, type DateTimePickerProps, type DateTimePickerRangeProps, type DateTimePickerSingleProps, type DescriptionDisplay, Drawer, type DrawerProps, ExpandableSection, type ExpandableSectionProps, type FieldError, Loading, type LoadingProps, type LoadingSize, Message, type MessageOptions, type MessageProps, type MessageSeverity, Modal, type ModalAction, type ModalProps, type ModalSize, NumberInput, type NumberInputProps, Pagination, type PaginationProps, ProgressBar, type ProgressBarProps, type ProgressBarSize, Selection, type SelectionOption, type SelectionProps, type SelectionValue, Skeleton, SkeletonBox, type SkeletonBoxProps, SkeletonCircle, SkeletonLine, type SkeletonProps, type SkeletonSizeProps, SkeletonSquare, type SkeletonVariant, Snackbar, type SnackbarAnchorOrigin, type SnackbarProps, Table, TableBody, TableCaption, TableCell, type TableData, TableHead, TableHeader, type TablePaginationPosition, type TableProps, TableRow, TextArea, type TextAreaProps, TextInput, type TextInputProps, Toggle, type ToggleProps, Tooltip, type TooltipProps, formatNumber, getIconSize, message };
|
|
609
|
+
export { Button, type ButtonColor, type ButtonHierarchy, type ButtonProps, type ButtonSize, type ButtonVariant, Checkbox, type CheckboxProps, Chip, type ChipProps, type ChipStatus, type ChipVariant, type ColumnResizeHandler, type ControlLabelPosition, type Currency, CurrencyInput, type CurrencyInputProps, type DateRange, DateTimePicker, type DateTimePickerProps, type DateTimePickerRangeProps, type DateTimePickerSingleProps, type DescriptionDisplay, Drawer, type DrawerProps, ExpandableSection, type ExpandableSectionProps, type FieldError, Loading, type LoadingProps, type LoadingSize, Message, type MessageOptions, type MessageProps, type MessageSeverity, Modal, type ModalAction, type ModalProps, type ModalSize, NumberInput, type NumberInputProps, Pagination, type PaginationProps, ProgressBar, type ProgressBarProps, type ProgressBarSize, RadioButton, type RadioButtonProps, RadioGroup, type RadioGroupOption, type RadioGroupProps, type RadioValue, Selection, type SelectionOption, type SelectionProps, type SelectionValue, Skeleton, SkeletonBox, type SkeletonBoxProps, SkeletonCircle, SkeletonLine, type SkeletonProps, type SkeletonSizeProps, SkeletonSquare, type SkeletonVariant, Snackbar, type SnackbarAnchorOrigin, type SnackbarProps, Table, TableBody, TableCaption, TableCell, type TableData, TableHead, TableHeader, type TablePaginationPosition, type TableProps, TableRow, TextArea, type TextAreaProps, TextInput, type TextInputProps, Toggle, type ToggleProps, Tooltip, type TooltipProps, formatNumber, getIconSize, message };
|