next-helios-fe 1.11.7 → 1.12.0
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/button/index.d.ts +27 -3
- package/dist/components/content-container/modal/escape-stack.d.ts +7 -0
- package/dist/components/content-container/tab/index.d.ts +7 -0
- package/dist/components/dialog/index.d.ts +2 -1
- package/dist/components/form/input/date.d.ts +10 -0
- package/dist/components/form/input/search.d.ts +9 -0
- package/dist/components/form/other/modalSelect.d.ts +14 -0
- package/dist/components/form/other/multipleSelect.d.ts +13 -0
- package/dist/components/form/other/select.d.ts +10 -0
- package/dist/components/form/use-input-text.d.ts +14 -0
- package/dist/components/table/index.d.ts +13 -0
- package/dist/index.js +1 -1
- package/package.json +1 -1
- package/src/components/button/index.tsx +210 -74
- package/src/components/content-container/modal/escape-stack.ts +52 -0
- package/src/components/content-container/modal/index.tsx +5 -19
- package/src/components/content-container/tab/index.tsx +31 -2
- package/src/components/dialog/index.tsx +30 -22
- package/src/components/dropdown/index.tsx +51 -2
- package/src/components/form/input/checkbox.tsx +43 -17
- package/src/components/form/input/date.tsx +31 -3
- package/src/components/form/input/email.tsx +5 -3
- package/src/components/form/input/number.tsx +23 -26
- package/src/components/form/input/search.tsx +88 -35
- package/src/components/form/input/text.tsx +5 -3
- package/src/components/form/other/modalSelect.tsx +43 -4
- package/src/components/form/other/multipleSelect.tsx +92 -10
- package/src/components/form/other/select.tsx +17 -3
- package/src/components/form/other/textarea.tsx +30 -36
- package/src/components/form/use-input-text.ts +33 -0
- package/src/components/table/index.tsx +170 -93
- package/tests/button-props.test.tsx +147 -0
- package/tests/clearable.test.tsx +155 -0
- package/tests/dropdown.test.tsx +67 -0
- package/tests/escape-stack.test.tsx +114 -0
- package/tests/multiple-select-min-locked.test.tsx +165 -0
- package/tests/multiple-select-select-all.test.tsx +106 -0
- package/tests/search.test.tsx +119 -0
- package/tests/small-fixes.test.tsx +155 -0
- package/tests/tab-keep-mounted.test.tsx +71 -0
- package/tests/table-category-select-all.test.tsx +268 -0
|
@@ -1,17 +1,41 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
|
|
3
|
-
|
|
2
|
+
type ButtonVariant = "basic" | "primary" | "secondary" | "success" | "warning" | "danger";
|
|
3
|
+
type ButtonAppearance = "solid" | "outline" | "ghost" | "link";
|
|
4
|
+
type ButtonSize = "xs" | "sm" | "md" | "lg";
|
|
5
|
+
export interface ButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {
|
|
6
|
+
children?: React.ReactNode;
|
|
4
7
|
options?: {
|
|
5
|
-
variant?:
|
|
8
|
+
variant?: ButtonVariant;
|
|
9
|
+
/**
|
|
10
|
+
* How the color is applied. Defaults to "solid" for colored variants and
|
|
11
|
+
* "ghost" for "basic".
|
|
12
|
+
*/
|
|
13
|
+
appearance?: ButtonAppearance;
|
|
14
|
+
/** Padding and text size. Takes precedence over `height`. */
|
|
15
|
+
size?: ButtonSize;
|
|
6
16
|
width?: "full" | "fit";
|
|
17
|
+
/** @deprecated Use `size`. Kept as is: short / medium / high. */
|
|
7
18
|
height?: "short" | "medium" | "high";
|
|
8
19
|
position?: "left" | "center" | "right";
|
|
9
20
|
border?: boolean;
|
|
21
|
+
/** Square button for a single icon: equal padding, centered, fit width. */
|
|
22
|
+
iconOnly?: boolean;
|
|
23
|
+
/** "pill" is fully rounded (a circle when combined with iconOnly). */
|
|
24
|
+
shape?: "rounded" | "pill";
|
|
10
25
|
tooltipPosition?: "left" | "right" | "top" | "bottom";
|
|
11
26
|
};
|
|
27
|
+
/** Iconify icon name, rendered next to the children. */
|
|
28
|
+
icon?: string;
|
|
29
|
+
iconPosition?: "left" | "right";
|
|
12
30
|
tooltip?: string | React.ReactNode;
|
|
13
31
|
loading?: boolean;
|
|
14
32
|
active?: boolean;
|
|
33
|
+
/**
|
|
34
|
+
* Marks the current item in a set (menu, tabs, toggles). Use this instead of
|
|
35
|
+
* `disabled` to highlight the active item.
|
|
36
|
+
*/
|
|
37
|
+
selected?: boolean;
|
|
38
|
+
ref?: React.Ref<HTMLButtonElement>;
|
|
15
39
|
}
|
|
16
40
|
export declare const Button: React.FC<ButtonProps>;
|
|
17
41
|
export {};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Registers an open overlay and calls `onEscape` when Escape is pressed while
|
|
3
|
+
* it is the top-most one. Pass `onEscape` as undefined to keep the overlay on
|
|
4
|
+
* the stack (so it still blocks the ones below) without closing it, e.g. for
|
|
5
|
+
* a Modal with `disableClose`.
|
|
6
|
+
*/
|
|
7
|
+
export declare const useEscapeStack: (open: boolean, onEscape: (() => void) | undefined) => void;
|
|
@@ -11,6 +11,13 @@ interface TabProps {
|
|
|
11
11
|
variant?: "vertical" | "horizontal";
|
|
12
12
|
border?: boolean;
|
|
13
13
|
disablePadding?: boolean;
|
|
14
|
+
/**
|
|
15
|
+
* Keep a window mounted (hidden) after leaving it, so its state such as
|
|
16
|
+
* form input or loaded data survives switching tabs. A
|
|
17
|
+
* window is first mounted when it is opened. Give each Tab.Window a
|
|
18
|
+
* `key` if tabs can be closed, so state stays with the right window.
|
|
19
|
+
*/
|
|
20
|
+
keepMounted?: boolean;
|
|
14
21
|
};
|
|
15
22
|
cornerComponent?: React.ReactNode;
|
|
16
23
|
activeTab?: number;
|
|
@@ -2,7 +2,8 @@ import React from "react";
|
|
|
2
2
|
interface DialogProps {
|
|
3
3
|
title: string;
|
|
4
4
|
message: string;
|
|
5
|
-
|
|
5
|
+
/** Optional: without it, the dialog shows only the Close button. */
|
|
6
|
+
action?: {
|
|
6
7
|
variant: "primary" | "secondary" | "success" | "warning" | "danger";
|
|
7
8
|
label: string;
|
|
8
9
|
onClick: () => void;
|
|
@@ -12,6 +12,16 @@ export interface DateProps extends React.InputHTMLAttributes<HTMLInputElement> {
|
|
|
12
12
|
disableFuture?: boolean;
|
|
13
13
|
width?: "full" | "fit";
|
|
14
14
|
height?: "short" | "medium" | "high";
|
|
15
|
+
/**
|
|
16
|
+
* Show the × button that clears the value. Defaults to true unless the field is `required`.
|
|
17
|
+
*/
|
|
18
|
+
clearable?: boolean;
|
|
19
|
+
/**
|
|
20
|
+
* Value the × resets to instead of [], as [start, end] (the same date
|
|
21
|
+
* twice without enableSelectRange). The × is hidden while the value
|
|
22
|
+
* already covers the same days.
|
|
23
|
+
*/
|
|
24
|
+
clearValue?: [dayjs.ConfigType, dayjs.ConfigType];
|
|
15
25
|
};
|
|
16
26
|
value?: any;
|
|
17
27
|
defaultValue?: any;
|
|
@@ -4,6 +4,15 @@ export interface SearchProps extends React.InputHTMLAttributes<HTMLInputElement>
|
|
|
4
4
|
width?: "full" | "fit";
|
|
5
5
|
height?: "short" | "medium" | "high";
|
|
6
6
|
delayed?: boolean;
|
|
7
|
+
/**
|
|
8
|
+
* Show the × button that clears the value. Defaults to true.
|
|
9
|
+
*/
|
|
10
|
+
clearable?: boolean;
|
|
11
|
+
/**
|
|
12
|
+
* Value the × (and Escape) resets to instead of "". The × is hidden
|
|
13
|
+
* while the value already equals it.
|
|
14
|
+
*/
|
|
15
|
+
clearValue?: string;
|
|
7
16
|
};
|
|
8
17
|
value?: string;
|
|
9
18
|
onChange?: (e: {
|
|
@@ -18,9 +18,23 @@ export interface ModalSelectProps {
|
|
|
18
18
|
placeholder?: string;
|
|
19
19
|
description?: string;
|
|
20
20
|
max?: number;
|
|
21
|
+
/** type "multipleSelect" only: see MultipleSelect `min`. */
|
|
22
|
+
min?: number;
|
|
23
|
+
/**
|
|
24
|
+
* type "multipleSelect" only: values that can't be removed while selected,
|
|
25
|
+
* like `disableUnselect` on a menu item. See MultipleSelect.
|
|
26
|
+
*/
|
|
27
|
+
disableUnselectValues?: string[];
|
|
21
28
|
options?: {
|
|
22
29
|
width?: "full" | "fit";
|
|
23
30
|
height?: "short" | "medium" | "high";
|
|
31
|
+
/**
|
|
32
|
+
* Show the × button that clears the value (type "select" only).
|
|
33
|
+
* Defaults to true unless the field is `required`.
|
|
34
|
+
*/
|
|
35
|
+
clearable?: boolean;
|
|
36
|
+
/** type "select" only: value the × resets to instead of "". */
|
|
37
|
+
clearValue?: string;
|
|
24
38
|
};
|
|
25
39
|
disabled?: boolean;
|
|
26
40
|
required?: boolean;
|
|
@@ -17,9 +17,22 @@ export interface MultipleSelectProps extends Omit<React.HTMLAttributes<HTMLDivEl
|
|
|
17
17
|
width?: "full" | "fit";
|
|
18
18
|
height?: "short" | "medium" | "high";
|
|
19
19
|
disableDropdown?: boolean;
|
|
20
|
+
/** Show "Select all" / "Unselect all" at the top of the dropdown. */
|
|
21
|
+
enableSelectAll?: boolean;
|
|
20
22
|
};
|
|
21
23
|
max?: number;
|
|
24
|
+
/**
|
|
25
|
+
* Minimum number of selected items. With `required`, the field needs at
|
|
26
|
+
* least this many (instead of 1). Without it, the field may stay empty, but
|
|
27
|
+
* once something is picked it needs at least this many.
|
|
28
|
+
*/
|
|
29
|
+
min?: number;
|
|
22
30
|
required?: boolean;
|
|
31
|
+
/**
|
|
32
|
+
* Values that can't be removed while selected, like `disableUnselect` on a
|
|
33
|
+
* menu item. They aren't added automatically: put them in `value`.
|
|
34
|
+
*/
|
|
35
|
+
disableUnselectValues?: string[];
|
|
23
36
|
disabled?: boolean;
|
|
24
37
|
value?: string[];
|
|
25
38
|
onClick?: () => void;
|
|
@@ -17,6 +17,16 @@ export interface SelectProps extends React.SelectHTMLAttributes<HTMLSelectElemen
|
|
|
17
17
|
height?: "short" | "medium" | "high";
|
|
18
18
|
disableDropdown?: boolean;
|
|
19
19
|
hideRequiredSymbol?: boolean;
|
|
20
|
+
/**
|
|
21
|
+
* Show the × button that clears the value. Defaults to true unless the
|
|
22
|
+
* field is `required` (with `clearValue`, also true when required).
|
|
23
|
+
*/
|
|
24
|
+
clearable?: boolean;
|
|
25
|
+
/**
|
|
26
|
+
* Value the × resets to instead of "". The × is hidden while the value
|
|
27
|
+
* already equals it.
|
|
28
|
+
*/
|
|
29
|
+
clearValue?: string;
|
|
20
30
|
};
|
|
21
31
|
readOnly?: boolean;
|
|
22
32
|
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
/**
|
|
3
|
+
* The current text of an input, for controlled and uncontrolled use. An
|
|
4
|
+
* uncontrolled input is followed through its change events, so pass the
|
|
5
|
+
* returned `onChange` to the input instead of the consumer's.
|
|
6
|
+
*/
|
|
7
|
+
export declare const useInputText: <E extends HTMLInputElement | HTMLTextAreaElement>(props: {
|
|
8
|
+
value?: React.InputHTMLAttributes<E>["value"];
|
|
9
|
+
defaultValue?: React.InputHTMLAttributes<E>["defaultValue"];
|
|
10
|
+
onChange?: React.ChangeEventHandler<E>;
|
|
11
|
+
}, enabled?: boolean) => {
|
|
12
|
+
text: string;
|
|
13
|
+
onChange: React.ChangeEventHandler<E, Element>;
|
|
14
|
+
};
|
|
@@ -7,6 +7,19 @@ interface TableProps {
|
|
|
7
7
|
key: string;
|
|
8
8
|
defaultHide?: boolean;
|
|
9
9
|
type?: "basic" | "category" | "date" | string;
|
|
10
|
+
/**
|
|
11
|
+
* `type: "category"` only: how many values must stay checked in the
|
|
12
|
+
* column's filter. Defaults to 0: every value can be unchecked, and an
|
|
13
|
+
* empty selection shows no rows. Set 1 to lock the last checked value.
|
|
14
|
+
*/
|
|
15
|
+
categoryMin?: number;
|
|
16
|
+
/**
|
|
17
|
+
* `type: "category"` only: values checked when the filter is first built,
|
|
18
|
+
* instead of every value. Values that aren't among the options are
|
|
19
|
+
* ignored; if none match, every value is checked. Values that show up
|
|
20
|
+
* later in `data` are only checked automatically if they're listed here.
|
|
21
|
+
*/
|
|
22
|
+
categoryDefault?: (string | number)[];
|
|
10
23
|
render?: (item: any) => React.ReactNode;
|
|
11
24
|
disableSort?: boolean;
|
|
12
25
|
disableSearch?: boolean;
|