@dragunio/fe-libs 0.1.5 → 0.1.7

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/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, HTMLAttributes, TableHTMLAttributes, InputHTMLAttributes, TextareaHTMLAttributes, KeyboardEventHandler, ChangeEvent, ReactElement } from 'react';
3
+ export { ChevronDownIcon, ChevronUpIcon, CloseIcon, IconProps, MoreHorizontalIcon, MoreVerticalIcon, 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';
@@ -44,6 +44,22 @@ declare const Button: react.ForwardRefExoticComponent<Omit<ButtonHTMLAttributes<
44
44
  variant?: ButtonVariant;
45
45
  } & react.RefAttributes<HTMLButtonElement>>;
46
46
 
47
+ /** A Button action with a stable identifier for use in ButtonBar. */
48
+ type ButtonBarAction = ButtonProps & {
49
+ id: string;
50
+ };
51
+ type ButtonBarProps = Omit<HTMLAttributes<HTMLDivElement>, 'children'> & {
52
+ /** Actions render in this order, both in the bar and the More menu. */
53
+ actions: ButtonBarAction[];
54
+ /** Number of actions to keep visible before overflowing the remainder. */
55
+ maxVisible?: number;
56
+ /** Overrides for the icon-only More trigger. */
57
+ moreButtonProps?: ButtonProps;
58
+ /** Accessible label for the More trigger and its action list. */
59
+ moreLabel?: string;
60
+ };
61
+ declare function ButtonBar({ actions, maxVisible, moreButtonProps, moreLabel, className, ...props }: ButtonBarProps): react.JSX.Element;
62
+
47
63
  type TableData = readonly (readonly ReactNode[])[];
48
64
  type ColumnResizeHandler = (columnSizes: number[], columnIndex: number) => void;
49
65
  type TablePaginationPosition = 'top-right' | 'bottom-right' | 'bottom-center' | 'middle-bottom';
@@ -92,12 +108,16 @@ type ToggleProps = Omit<InputHTMLAttributes<HTMLInputElement>, 'color' | 'type'>
92
108
  color?: string;
93
109
  /** Optional text displayed next to the switch. */
94
110
  label?: ReactNode;
111
+ /** Places the label above or to the right of the switch. Defaults to `right`. */
112
+ labelPosition?: 'top' | 'right';
95
113
  };
96
114
  declare const Toggle: react.ForwardRefExoticComponent<Omit<InputHTMLAttributes<HTMLInputElement>, "color" | "type"> & {
97
115
  /** Active track color. Accepts any valid CSS color, for example `#16a34a`. */
98
116
  color?: string;
99
117
  /** Optional text displayed next to the switch. */
100
118
  label?: ReactNode;
119
+ /** Places the label above or to the right of the switch. Defaults to `right`. */
120
+ labelPosition?: "top" | "right";
101
121
  } & react.RefAttributes<HTMLInputElement>>;
102
122
 
103
123
  type DrawerProps = Omit<HTMLAttributes<HTMLElement>, 'title'> & {
@@ -175,11 +195,14 @@ declare const TextArea: react.ForwardRefExoticComponent<Omit<react.TextareaHTMLA
175
195
  onValueChange?: (value: string) => void;
176
196
  clearLabel?: string;
177
197
  } & {
198
+ autosize?: boolean;
178
199
  value?: string;
179
200
  defaultValue?: string;
180
201
  } & react.RefAttributes<HTMLTextAreaElement>>;
181
202
 
182
203
  type TextAreaProps = Omit<TextareaHTMLAttributes<HTMLTextAreaElement>, 'value' | 'defaultValue'> & TextFieldBaseProps & {
204
+ /** Expands the textarea to fit its content. */
205
+ autosize?: boolean;
183
206
  value?: string;
184
207
  defaultValue?: string;
185
208
  };
@@ -241,7 +264,7 @@ declare const Selection: react.ForwardRefExoticComponent<Omit<react.HTMLAttribut
241
264
 
242
265
  declare function formatNumber(value: number, decimals?: number, thousandSeparator?: string, decimalSeparator?: string): string;
243
266
  /** 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"> & {
267
+ declare const NumberInput: react.ForwardRefExoticComponent<Omit<react.InputHTMLAttributes<HTMLInputElement>, "type" | "value" | "defaultValue" | "onChange" | "step" | "max" | "min"> & {
245
268
  value?: number | null;
246
269
  defaultValue?: number | null;
247
270
  onValueChange?: (value: number | null) => void;
@@ -251,10 +274,18 @@ declare const NumberInput: react.ForwardRefExoticComponent<Omit<react.InputHTMLA
251
274
  max?: number;
252
275
  decimalSeparator?: string;
253
276
  thousandSeparator?: string;
277
+ prefix?: react.ReactNode;
278
+ suffix?: react.ReactNode;
279
+ Prefix?: react.ReactNode;
280
+ Suffix?: react.ReactNode;
254
281
  endAdornment?: react.ReactNode;
282
+ step?: number;
283
+ showStepper?: boolean;
284
+ incrementLabel?: string;
285
+ decrementLabel?: string;
255
286
  } & FieldBaseProps & react.RefAttributes<HTMLInputElement>>;
256
287
 
257
- type NumberInputProps = Omit<InputHTMLAttributes<HTMLInputElement>, 'type' | 'value' | 'defaultValue' | 'onChange' | 'min' | 'max'> & {
288
+ type NumberInputProps = Omit<InputHTMLAttributes<HTMLInputElement>, 'type' | 'value' | 'defaultValue' | 'onChange' | 'min' | 'max' | 'step'> & {
258
289
  value?: number | null;
259
290
  defaultValue?: number | null;
260
291
  onValueChange?: (value: number | null) => void;
@@ -267,8 +298,24 @@ type NumberInputProps = Omit<InputHTMLAttributes<HTMLInputElement>, 'type' | 'va
267
298
  max?: number;
268
299
  decimalSeparator?: string;
269
300
  thousandSeparator?: string;
301
+ /** Content rendered inside the control before the numeric value. */
302
+ prefix?: ReactNode;
303
+ /** Content rendered inside the control after the numeric value. */
304
+ suffix?: ReactNode;
305
+ /** Alias for prefix. */
306
+ Prefix?: ReactNode;
307
+ /** Alias for suffix. */
308
+ Suffix?: ReactNode;
270
309
  /** Content rendered inside the control after the numeric value. */
271
310
  endAdornment?: ReactNode;
311
+ /** Amount added or subtracted by the increment and decrement controls. Defaults to 1. */
312
+ step?: number;
313
+ /** Shows the increment and decrement controls. Defaults to true. */
314
+ showStepper?: boolean;
315
+ /** Accessible label for the increment control. */
316
+ incrementLabel?: string;
317
+ /** Accessible label for the decrement control. */
318
+ decrementLabel?: string;
272
319
  } & FieldBaseProps;
273
320
 
274
321
  type Currency = {
@@ -311,6 +358,68 @@ type DateTimePickerProps = DateTimePickerSingleProps | DateTimePickerRangeProps;
311
358
  /** Calendar and time picker. Supports a single Date or [start, end] range. */
312
359
  declare function DateTimePicker(props: DateTimePickerProps): react.JSX.Element;
313
360
 
361
+ type ControlLabelPosition = 'top' | 'right';
362
+ type CheckboxProps = Omit<InputHTMLAttributes<HTMLInputElement>, 'type'> & {
363
+ /** Optional text associated with the checkbox. */
364
+ label?: ReactNode;
365
+ /** Places the label above or to the right of the checkbox. Defaults to `right`. */
366
+ labelPosition?: ControlLabelPosition;
367
+ };
368
+
369
+ /** A native checkbox with an accessible, custom visual control. */
370
+ declare const Checkbox: react.ForwardRefExoticComponent<Omit<react.InputHTMLAttributes<HTMLInputElement>, "type"> & {
371
+ label?: react.ReactNode;
372
+ labelPosition?: ControlLabelPosition;
373
+ } & react.RefAttributes<HTMLInputElement>>;
374
+
375
+ /** A native radio input with an accessible, custom visual control. */
376
+ declare const RadioButton: react.ForwardRefExoticComponent<Omit<react.InputHTMLAttributes<HTMLInputElement>, "type"> & {
377
+ label?: react.ReactNode;
378
+ labelPosition?: ControlLabelPosition;
379
+ } & react.RefAttributes<HTMLInputElement>>;
380
+
381
+ type RadioButtonProps = Omit<InputHTMLAttributes<HTMLInputElement>, 'type'> & {
382
+ /** Optional text associated with the radio button. */
383
+ label?: ReactNode;
384
+ /** Places the label above or to the right of the radio button. Defaults to `right`. */
385
+ labelPosition?: ControlLabelPosition;
386
+ };
387
+
388
+ type RadioValue = string | number;
389
+ type RadioGroupOption = {
390
+ label: ReactNode;
391
+ value: RadioValue;
392
+ disabled?: boolean;
393
+ };
394
+ type RadioGroupProps = Omit<HTMLAttributes<HTMLDivElement>, 'onChange' | 'defaultValue' | 'value'> & {
395
+ /** Optional text that names the radio group. */
396
+ label?: ReactNode;
397
+ /** Places the group label above or to the right of its options. Defaults to `top`. */
398
+ labelPosition?: ControlLabelPosition;
399
+ options: RadioGroupOption[];
400
+ name?: string;
401
+ value?: RadioValue;
402
+ defaultValue?: RadioValue;
403
+ onChange?: (value: RadioValue, option: RadioGroupOption, event: ChangeEvent<HTMLInputElement>) => void;
404
+ disabled?: boolean;
405
+ direction?: 'horizontal' | 'vertical';
406
+ isRequired?: boolean;
407
+ };
408
+
409
+ /** A named collection of native radio buttons with controlled and uncontrolled values. */
410
+ declare const RadioGroup: react.ForwardRefExoticComponent<Omit<react.HTMLAttributes<HTMLDivElement>, "value" | "defaultValue" | "onChange"> & {
411
+ label?: react.ReactNode;
412
+ labelPosition?: ControlLabelPosition;
413
+ options: RadioGroupOption[];
414
+ name?: string;
415
+ value?: RadioValue;
416
+ defaultValue?: RadioValue;
417
+ onChange?: (value: RadioValue, option: RadioGroupOption, event: ChangeEvent<HTMLInputElement>) => void;
418
+ disabled?: boolean;
419
+ direction?: "horizontal" | "vertical";
420
+ isRequired?: boolean;
421
+ } & react.RefAttributes<HTMLDivElement>>;
422
+
314
423
  type TooltipProps = Omit<HTMLAttributes<HTMLSpanElement>, 'content'> & {
315
424
  content: ReactNode;
316
425
  children: ReactElement;
@@ -513,4 +622,37 @@ type SnackbarProps = Omit<HTMLAttributes<HTMLDivElement>, 'onClose'> & {
513
622
  /** A controlled, temporary notification surface. */
514
623
  declare function Snackbar({ open, message, autoHideDuration, onClose, action, anchorOrigin, closeLabel, className, ...props }: SnackbarProps): react.JSX.Element | null;
515
624
 
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 };
625
+ type AvatarShape = 'circle' | 'rounded';
626
+ type AvatarSize = number | string;
627
+ type AvatarProps = Omit<HTMLAttributes<HTMLSpanElement>, 'content'> & {
628
+ /** Image URL. A successfully loaded image takes priority over all fallbacks. */
629
+ src?: string | null;
630
+ /** Name or label used to derive initials when no image is available. */
631
+ content?: string | null;
632
+ /** Accessible description for the image or fallback avatar. Defaults to content. */
633
+ alt?: string;
634
+ /** Avatar width and height. Numbers are interpreted as pixels. */
635
+ size?: AvatarSize;
636
+ /** Circle is the default; rounded uses a square with rounded corners. */
637
+ shape?: AvatarShape;
638
+ /** Chooses a specific illustration from the fallback collection. */
639
+ fallbackIndex?: number;
640
+ };
641
+ type AvatarGroupProps = Omit<HTMLAttributes<HTMLDivElement>, 'children'> & {
642
+ /** Avatar elements to show in the group. */
643
+ children: ReactNode;
644
+ /** Maximum total items to show, including the final +n overflow item. */
645
+ maxCount?: number;
646
+ };
647
+ /**
648
+ * A compact avatar that shows an image, name initials, or one of 32 fallback
649
+ * illustrations in that order.
650
+ */
651
+ declare function Avatar({ src, content, alt, size, shape, fallbackIndex, className, style, role, 'aria-label': ariaLabel, ...props }: AvatarProps): react.JSX.Element;
652
+ /**
653
+ * A compact overlapping set of Avatar elements. When it contains one Avatar
654
+ * with content, the full content is shown beside it.
655
+ */
656
+ declare function AvatarGroup({ children, maxCount, className, style, role, ...props }: AvatarGroupProps): react.JSX.Element;
657
+
658
+ export { Avatar, AvatarGroup, type AvatarGroupProps, type AvatarProps, type AvatarShape, type AvatarSize, Button, ButtonBar, type ButtonBarAction, type ButtonBarProps, 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 };