@akad/design-system 1.1.1 → 1.1.3
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/css/core.css +1 -1
- package/package.json +1 -1
- package/react/react-lib.js +2492 -2245
- package/react/react-lib.umd.cjs +5 -5
- package/react/src/components/atoms/Chip/Chip.config.d.ts +43 -0
- package/react/src/components/atoms/Chip/Chip.d.ts +15 -0
- package/react/src/components/atoms/Chip/Chip.stories.d.ts +33 -0
- package/react/src/components/atoms/Chip/Chip.test.d.ts +1 -0
- package/react/src/components/atoms/Chip/index.d.ts +4 -0
- package/react/src/components/atoms/Radio/Radio.config.d.ts +21 -0
- package/react/src/components/atoms/Radio/Radio.d.ts +13 -0
- package/react/src/components/atoms/Radio/Radio.stories.d.ts +49 -0
- package/react/src/components/atoms/Radio/Radio.test.d.ts +1 -0
- package/react/src/components/atoms/Radio/index.d.ts +4 -0
- package/react/src/components/index.d.ts +2 -0
- package/react/src/components/molecules/EditableSelect/EditableSelect.config.d.ts +5 -0
- package/react/src/components/molecules/EditableSelect/EditableSelect.d.ts +63 -2
- package/react/src/components/molecules/Tabs/Tab.d.ts +2 -2
- package/react/src/components/molecules/Tabs/Tabs.config.d.ts +10 -0
- package/react/src/components/molecules/Tabs/Tabs.d.ts +7 -11
- package/react/src/components/molecules/Tabs/Tabs.stories.d.ts +16 -0
- package/react/src/components/molecules/Tabs/index.d.ts +1 -0
- package/react/src/components/molecules/Tabs/types.d.ts +23 -0
- package/scss/core/components/atoms/chip.scss +101 -0
- package/scss/core/components/atoms/radio-card.scss +117 -0
- package/scss/core/components/atoms/radio.scss +140 -0
- package/scss/core/components/index.scss +2 -0
- package/scss/core/components/molecules/editable-select.scss +4 -0
- package/scss/core/components/molecules/tabs.scss +153 -0
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
export declare enum ChipColor {
|
|
2
|
+
Primary = "primary",
|
|
3
|
+
Secondary = "secondary",
|
|
4
|
+
Info = "info",
|
|
5
|
+
Success = "success",
|
|
6
|
+
Danger = "danger",
|
|
7
|
+
Warning = "warning",
|
|
8
|
+
Neutral = "neutral"
|
|
9
|
+
}
|
|
10
|
+
export declare enum ChipVariant {
|
|
11
|
+
Solid = "solid",
|
|
12
|
+
Light = "light"
|
|
13
|
+
}
|
|
14
|
+
export declare enum ChipIconPosition {
|
|
15
|
+
Left = "left",
|
|
16
|
+
Right = "right"
|
|
17
|
+
}
|
|
18
|
+
export interface ChipColorProps {
|
|
19
|
+
type: StringConstructor;
|
|
20
|
+
default: ChipColor;
|
|
21
|
+
options: ChipColor[];
|
|
22
|
+
}
|
|
23
|
+
export interface ChipVariantProps {
|
|
24
|
+
type: StringConstructor;
|
|
25
|
+
default: ChipVariant;
|
|
26
|
+
options: ChipVariant[];
|
|
27
|
+
}
|
|
28
|
+
export interface ChipIconPositionProps {
|
|
29
|
+
type: StringConstructor;
|
|
30
|
+
default: ChipIconPosition;
|
|
31
|
+
options: ChipIconPosition[];
|
|
32
|
+
}
|
|
33
|
+
export interface ChipConfig {
|
|
34
|
+
name: string;
|
|
35
|
+
class: string;
|
|
36
|
+
props: {
|
|
37
|
+
color: ChipColorProps;
|
|
38
|
+
variant: ChipVariantProps;
|
|
39
|
+
iconPosition: ChipIconPositionProps;
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
declare const chipConfig: ChipConfig;
|
|
43
|
+
export default chipConfig;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { ChipColor, ChipIconPosition, ChipVariant } from './Chip.config';
|
|
3
|
+
|
|
4
|
+
export interface DsChipProps {
|
|
5
|
+
label: React.ReactNode;
|
|
6
|
+
color?: ChipColor;
|
|
7
|
+
variant?: ChipVariant;
|
|
8
|
+
icon?: React.ReactNode;
|
|
9
|
+
iconPosition?: ChipIconPosition;
|
|
10
|
+
className?: string;
|
|
11
|
+
title?: string;
|
|
12
|
+
testId?: string;
|
|
13
|
+
}
|
|
14
|
+
declare const DsChip: React.FC<DsChipProps>;
|
|
15
|
+
export default DsChip;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { Meta } from '@storybook/react';
|
|
2
|
+
import { DsChipProps } from './Chip';
|
|
3
|
+
import { ChipColor, ChipIconPosition, ChipVariant } from './Chip.config';
|
|
4
|
+
|
|
5
|
+
declare const componentProps: Meta;
|
|
6
|
+
export default componentProps;
|
|
7
|
+
export declare const Default: {
|
|
8
|
+
render: import('storybook/internal/types').AnnotatedStoryFn<import('@storybook/react').ReactRenderer, DsChipProps>;
|
|
9
|
+
args: {
|
|
10
|
+
label: string;
|
|
11
|
+
color: ChipColor;
|
|
12
|
+
variant: ChipVariant;
|
|
13
|
+
};
|
|
14
|
+
};
|
|
15
|
+
export declare const WithIconLeft: {
|
|
16
|
+
render: import('storybook/internal/types').AnnotatedStoryFn<import('@storybook/react').ReactRenderer, DsChipProps>;
|
|
17
|
+
args: {
|
|
18
|
+
label: string;
|
|
19
|
+
color: ChipColor;
|
|
20
|
+
icon: import("react/jsx-runtime").JSX.Element;
|
|
21
|
+
variant: ChipVariant;
|
|
22
|
+
};
|
|
23
|
+
};
|
|
24
|
+
export declare const WithIconRight: {
|
|
25
|
+
render: import('storybook/internal/types').AnnotatedStoryFn<import('@storybook/react').ReactRenderer, DsChipProps>;
|
|
26
|
+
args: {
|
|
27
|
+
label: string;
|
|
28
|
+
color: ChipColor;
|
|
29
|
+
variant: ChipVariant;
|
|
30
|
+
icon: import("react/jsx-runtime").JSX.Element;
|
|
31
|
+
iconPosition: ChipIconPosition;
|
|
32
|
+
};
|
|
33
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
export declare enum RadioVariant {
|
|
2
|
+
Default = "default",
|
|
3
|
+
Card = "card"
|
|
4
|
+
}
|
|
5
|
+
export interface RadioConfig {
|
|
6
|
+
name: string;
|
|
7
|
+
class: string;
|
|
8
|
+
props: {
|
|
9
|
+
variant: {
|
|
10
|
+
type: StringConstructor;
|
|
11
|
+
default: RadioVariant;
|
|
12
|
+
options: RadioVariant[];
|
|
13
|
+
};
|
|
14
|
+
fullWidth: {
|
|
15
|
+
type: BooleanConstructor;
|
|
16
|
+
default: boolean;
|
|
17
|
+
};
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
declare const radioConfig: RadioConfig;
|
|
21
|
+
export default radioConfig;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { RadioVariant } from './Radio.config';
|
|
3
|
+
|
|
4
|
+
export interface DsRadioProps extends Omit<React.InputHTMLAttributes<HTMLInputElement>, 'type' | 'children' | 'className' | 'size'> {
|
|
5
|
+
variant?: RadioVariant;
|
|
6
|
+
fullWidth?: boolean;
|
|
7
|
+
label?: React.ReactNode;
|
|
8
|
+
description?: React.ReactNode;
|
|
9
|
+
className?: string;
|
|
10
|
+
testId?: string;
|
|
11
|
+
}
|
|
12
|
+
declare const DsRadio: React.ForwardRefExoticComponent<DsRadioProps & React.RefAttributes<HTMLInputElement>>;
|
|
13
|
+
export default DsRadio;
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { Meta } from '@storybook/react';
|
|
2
|
+
import { DsRadioProps } from './Radio';
|
|
3
|
+
import { RadioVariant } from './Radio.config';
|
|
4
|
+
|
|
5
|
+
declare const meta: Meta<DsRadioProps>;
|
|
6
|
+
export default meta;
|
|
7
|
+
export declare const Default: {
|
|
8
|
+
render: import('storybook/internal/types').AnnotatedStoryFn<import('@storybook/react').ReactRenderer, DsRadioProps>;
|
|
9
|
+
args: {
|
|
10
|
+
label: string;
|
|
11
|
+
name: string;
|
|
12
|
+
value: string;
|
|
13
|
+
};
|
|
14
|
+
};
|
|
15
|
+
export declare const WithDescription: {
|
|
16
|
+
render: import('storybook/internal/types').AnnotatedStoryFn<import('@storybook/react').ReactRenderer, DsRadioProps>;
|
|
17
|
+
args: {
|
|
18
|
+
label: string;
|
|
19
|
+
description: string;
|
|
20
|
+
name: string;
|
|
21
|
+
value: string;
|
|
22
|
+
};
|
|
23
|
+
};
|
|
24
|
+
export declare const Disabled: {
|
|
25
|
+
render: import('storybook/internal/types').AnnotatedStoryFn<import('@storybook/react').ReactRenderer, DsRadioProps>;
|
|
26
|
+
args: {
|
|
27
|
+
label: string;
|
|
28
|
+
description: string;
|
|
29
|
+
disabled: boolean;
|
|
30
|
+
name: string;
|
|
31
|
+
value: string;
|
|
32
|
+
};
|
|
33
|
+
};
|
|
34
|
+
export declare const Card: {
|
|
35
|
+
render: import('storybook/internal/types').AnnotatedStoryFn<import('@storybook/react').ReactRenderer, DsRadioProps>;
|
|
36
|
+
args: {
|
|
37
|
+
variant: RadioVariant;
|
|
38
|
+
label: string;
|
|
39
|
+
description: string;
|
|
40
|
+
name: string;
|
|
41
|
+
value: string;
|
|
42
|
+
};
|
|
43
|
+
};
|
|
44
|
+
export declare const CardGroupVertical: {
|
|
45
|
+
render: () => import("react/jsx-runtime").JSX.Element;
|
|
46
|
+
};
|
|
47
|
+
export declare const CardGroupHorizontal: {
|
|
48
|
+
render: () => import("react/jsx-runtime").JSX.Element;
|
|
49
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -2,6 +2,7 @@ export * from './atoms/Button';
|
|
|
2
2
|
export * from './atoms/Caption';
|
|
3
3
|
export * from './atoms/Card';
|
|
4
4
|
export * from './atoms/Checkbox';
|
|
5
|
+
export * from './atoms/Chip';
|
|
5
6
|
export * from './atoms/Heading';
|
|
6
7
|
export * from './atoms/HorizontalRule';
|
|
7
8
|
export * from './atoms/Icon';
|
|
@@ -10,6 +11,7 @@ export * from './atoms/Loading';
|
|
|
10
11
|
export * from './atoms/Option';
|
|
11
12
|
export * from './atoms/Paragraph';
|
|
12
13
|
export * from './atoms/Progress';
|
|
14
|
+
export * from './atoms/Radio';
|
|
13
15
|
export * from './atoms/Select';
|
|
14
16
|
export * from './atoms/Subtitle';
|
|
15
17
|
export * from './atoms/TextArea';
|
|
@@ -77,6 +77,10 @@ export interface EditableSelectOnSelectHandlerProps {
|
|
|
77
77
|
type: FunctionConstructor;
|
|
78
78
|
default: () => void;
|
|
79
79
|
}
|
|
80
|
+
export interface EditableSelectOnClearHandlerProps {
|
|
81
|
+
type: FunctionConstructor;
|
|
82
|
+
default: () => void;
|
|
83
|
+
}
|
|
80
84
|
export interface EditableSelectConfig {
|
|
81
85
|
name: string;
|
|
82
86
|
class: string;
|
|
@@ -97,6 +101,7 @@ export interface EditableSelectConfig {
|
|
|
97
101
|
onBlurHandler: EditableSelectOnBlurHandlerProps;
|
|
98
102
|
onFocusHandler: EditableSelectOnFocusHandlerProps;
|
|
99
103
|
onSelectHandler: EditableSelectOnSelectHandlerProps;
|
|
104
|
+
onClearHandler: EditableSelectOnClearHandlerProps;
|
|
100
105
|
placeholder: EditableSelectPlaceholderProps;
|
|
101
106
|
};
|
|
102
107
|
}
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import { EditableSelectOption } from './EditableSelect.config';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
|
-
* DsEditableSelect - A select component with two usage modes
|
|
4
|
+
* DsEditableSelect - A combobox-style select component with two usage modes.
|
|
5
|
+
*
|
|
6
|
+
* ## Modes
|
|
5
7
|
*
|
|
6
8
|
* **Mode 1: Autocomplete (default)**
|
|
7
9
|
* The user types in the input and the parent component is responsible for
|
|
@@ -31,8 +33,66 @@ import { EditableSelectOption } from './EditableSelect.config';
|
|
|
31
33
|
* showOptionsOnFocus
|
|
32
34
|
* onChangeHandler={handleChange}
|
|
33
35
|
* onSelectHandler={handleSelect}
|
|
36
|
+
* onClearHandler={handleClear}
|
|
37
|
+
* />
|
|
38
|
+
* ```
|
|
39
|
+
*
|
|
40
|
+
* ## Selection lifecycle
|
|
41
|
+
*
|
|
42
|
+
* - `onChangeHandler(event)` — fires on every keystroke (both modes). Update
|
|
43
|
+
* the displayed text state from `event.target.value`.
|
|
44
|
+
* - `onSelectHandler(option)` — fires when a selection is committed:
|
|
45
|
+
* 1. user clicks an option in the dropdown (both modes), OR
|
|
46
|
+
* 2. (Searchable Dropdown only) user blurs the input with text that matches
|
|
47
|
+
* an option's label exactly (case-insensitive, trimmed — auto-select on
|
|
48
|
+
* blur).
|
|
49
|
+
* Update both the displayed text (to `option.label`) and the form-validated
|
|
50
|
+
* value (to `option.value`).
|
|
51
|
+
* - `onClearHandler()` — **Searchable Dropdown only**. Fires when the
|
|
52
|
+
* selection becomes invalid:
|
|
53
|
+
* 1. user blurs with text that does not match any option, OR
|
|
54
|
+
* 2. while typing, the value transitions from matching an option to not
|
|
55
|
+
* matching (e.g., user appends a character to a previously matched label).
|
|
56
|
+
* Clear the form-validated value so subsequent validation sees no selection.
|
|
57
|
+
*
|
|
58
|
+
* In Searchable Dropdown mode, on blur with no match the component **also**
|
|
59
|
+
* dispatches a native `input` event with empty value to force the input
|
|
60
|
+
* display to clear via your existing `onChangeHandler`. This guarantees the
|
|
61
|
+
* display does not retain a stale unmatched value, even if `onClearHandler`
|
|
62
|
+
* is not wired to clear the display.
|
|
63
|
+
*
|
|
64
|
+
* Autocomplete mode keeps the legacy contract: blur only fires
|
|
65
|
+
* `onBlurHandler`; typing only fires `onChangeHandler`. No auto-select, no
|
|
66
|
+
* clear, no native dispatch.
|
|
67
|
+
*
|
|
68
|
+
* ## Highlighted option
|
|
69
|
+
*
|
|
70
|
+
* The option whose label equals `value` (case-sensitive, exact) is rendered
|
|
71
|
+
* with the `--selected` modifier class for visual feedback when the dropdown
|
|
72
|
+
* reopens after a selection.
|
|
73
|
+
*
|
|
74
|
+
* ## Recommended consumer state shape
|
|
75
|
+
*
|
|
76
|
+
* Keep two separate state fields — one for what shows in the input, one for
|
|
77
|
+
* what the form validates:
|
|
78
|
+
*
|
|
79
|
+
* ```tsx
|
|
80
|
+
* const [displayValue, setDisplayValue] = useState('');
|
|
81
|
+
* const [selectedValue, setSelectedValue] = useState<string | null>(null);
|
|
82
|
+
*
|
|
83
|
+
* <DsEditableSelect
|
|
84
|
+
* value={displayValue}
|
|
85
|
+
* onChangeHandler={(e) => setDisplayValue(e.target.value)}
|
|
86
|
+
* onSelectHandler={(opt) => {
|
|
87
|
+
* setDisplayValue(opt.label);
|
|
88
|
+
* setSelectedValue(opt.value);
|
|
89
|
+
* }}
|
|
90
|
+
* onClearHandler={() => setSelectedValue(null)}
|
|
34
91
|
* />
|
|
35
92
|
* ```
|
|
93
|
+
*
|
|
94
|
+
* Validate `selectedValue`, not `displayValue`. This guarantees that typed-but-
|
|
95
|
+
* not-selected text is treated as no selection.
|
|
36
96
|
*/
|
|
37
97
|
export interface DsEditableSelectProps {
|
|
38
98
|
label?: string;
|
|
@@ -43,6 +103,7 @@ export interface DsEditableSelectProps {
|
|
|
43
103
|
options?: EditableSelectOption[];
|
|
44
104
|
onChangeHandler?: (event: React.ChangeEvent<HTMLInputElement> | React.FormEvent<HTMLInputElement>) => void;
|
|
45
105
|
onSelectHandler?: (selectedOption: object) => void;
|
|
106
|
+
onClearHandler?: () => void;
|
|
46
107
|
icon?: string;
|
|
47
108
|
noOptionsMessage?: string;
|
|
48
109
|
disabled?: boolean;
|
|
@@ -66,7 +127,7 @@ export interface DsEditableSelectProps {
|
|
|
66
127
|
inputOnKeyDownHandler?: (event: React.KeyboardEvent<HTMLInputElement>) => void;
|
|
67
128
|
}
|
|
68
129
|
declare const DsEditableSelect: {
|
|
69
|
-
({ label, name, testId, value, options, size, onChangeHandler, onSelectHandler, icon, noOptionsMessage, disabled, status, onBlurHandler, onFocusHandler, animated, placeholder, loading, showOptionsOnFocus, inputType, inputMin, inputMax, inputTooltip, inputTooltipPosition, inputTooltipPlacement, inputFeedback, inputHasFeedback, inputNoMargin, inputMask, inputOnKeyDownHandler, }: DsEditableSelectProps): import("react/jsx-runtime").JSX.Element;
|
|
130
|
+
({ label, name, testId, value, options, size, onChangeHandler, onSelectHandler, onClearHandler, icon, noOptionsMessage, disabled, status, onBlurHandler, onFocusHandler, animated, placeholder, loading, showOptionsOnFocus, inputType, inputMin, inputMax, inputTooltip, inputTooltipPosition, inputTooltipPlacement, inputFeedback, inputHasFeedback, inputNoMargin, inputMask, inputOnKeyDownHandler, }: DsEditableSelectProps): import("react/jsx-runtime").JSX.Element;
|
|
70
131
|
displayName: string;
|
|
71
132
|
};
|
|
72
133
|
export default DsEditableSelect;
|
|
@@ -8,6 +8,10 @@ export declare enum TabsColor {
|
|
|
8
8
|
Danger = "danger",
|
|
9
9
|
Info = "info"
|
|
10
10
|
}
|
|
11
|
+
export declare enum TabsVariant {
|
|
12
|
+
Segmented = "segmented",
|
|
13
|
+
Navigation = "navigation"
|
|
14
|
+
}
|
|
11
15
|
export interface TabsTabsProps {
|
|
12
16
|
type: ArrayConstructor;
|
|
13
17
|
required: boolean;
|
|
@@ -29,6 +33,11 @@ export interface TabsOnChangeProps {
|
|
|
29
33
|
type: FunctionConstructor;
|
|
30
34
|
default: () => void;
|
|
31
35
|
}
|
|
36
|
+
export interface TabsVariantProps {
|
|
37
|
+
type: StringConstructor;
|
|
38
|
+
default: TabsVariant;
|
|
39
|
+
options: TabsVariant[];
|
|
40
|
+
}
|
|
32
41
|
export interface TabsConfig {
|
|
33
42
|
name: string;
|
|
34
43
|
class: string;
|
|
@@ -36,6 +45,7 @@ export interface TabsConfig {
|
|
|
36
45
|
tabs: TabsTabsProps;
|
|
37
46
|
selectedTab: TabsSelectedTabProps;
|
|
38
47
|
color: TabsColorProps;
|
|
48
|
+
variant: TabsVariantProps;
|
|
39
49
|
className: TabsClassNameProps;
|
|
40
50
|
onChange: TabsOnChangeProps;
|
|
41
51
|
};
|
|
@@ -1,22 +1,18 @@
|
|
|
1
1
|
import { default as React } from 'react';
|
|
2
|
+
import { TabsVariant } from './Tabs.config';
|
|
3
|
+
import { DsTabProps } from './types';
|
|
2
4
|
|
|
3
|
-
export
|
|
4
|
-
active?: boolean;
|
|
5
|
-
className?: string;
|
|
6
|
-
color?: string;
|
|
7
|
-
content: React.ReactNode | string;
|
|
8
|
-
disabled?: boolean;
|
|
9
|
-
name?: string;
|
|
10
|
-
index: number;
|
|
11
|
-
title: React.ReactNode | string;
|
|
12
|
-
onClick?: (index: number) => void;
|
|
13
|
-
}
|
|
5
|
+
export type { DsTabProps } from './types';
|
|
14
6
|
export interface DsTabsProps {
|
|
15
7
|
tabs: DsTabProps[];
|
|
16
8
|
selectedTab?: number;
|
|
17
9
|
color?: string;
|
|
18
10
|
className?: string;
|
|
11
|
+
variant?: TabsVariant;
|
|
19
12
|
onChange?: (index: number) => void;
|
|
13
|
+
'aria-label'?: string;
|
|
14
|
+
'aria-labelledby'?: string;
|
|
15
|
+
rootDataTestId?: string;
|
|
20
16
|
}
|
|
21
17
|
declare const DsTabs: React.FC<DsTabsProps>;
|
|
22
18
|
export default DsTabs;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { Meta } from '@storybook/react';
|
|
2
2
|
import { DsTabsProps } from './Tabs';
|
|
3
|
+
import { TabsVariant } from './Tabs.config';
|
|
3
4
|
|
|
4
5
|
declare const componentProps: Meta;
|
|
5
6
|
export default componentProps;
|
|
@@ -8,6 +9,7 @@ export declare const Default: {
|
|
|
8
9
|
args: {
|
|
9
10
|
color: import('../../../main').TabsColor;
|
|
10
11
|
selectedTab: number;
|
|
12
|
+
variant: TabsVariant;
|
|
11
13
|
tabs: ({
|
|
12
14
|
name: string;
|
|
13
15
|
title: import("react/jsx-runtime").JSX.Element;
|
|
@@ -22,3 +24,17 @@ export declare const Default: {
|
|
|
22
24
|
onChange: import('@storybook/addon-actions').HandlerFunction;
|
|
23
25
|
};
|
|
24
26
|
};
|
|
27
|
+
export declare const Navigation: {
|
|
28
|
+
render: import('storybook/internal/types').AnnotatedStoryFn<import('@storybook/react').ReactRenderer, DsTabsProps>;
|
|
29
|
+
args: {
|
|
30
|
+
tabs: {
|
|
31
|
+
name: string;
|
|
32
|
+
title: string;
|
|
33
|
+
content: import("react/jsx-runtime").JSX.Element;
|
|
34
|
+
}[];
|
|
35
|
+
variant: TabsVariant;
|
|
36
|
+
color: import('../../../main').TabsColor;
|
|
37
|
+
selectedTab: number;
|
|
38
|
+
onChange: import('@storybook/addon-actions').HandlerFunction;
|
|
39
|
+
};
|
|
40
|
+
};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
import { TabsVariant } from './Tabs.config';
|
|
3
|
+
|
|
4
|
+
export interface DsTabProps {
|
|
5
|
+
active?: boolean;
|
|
6
|
+
className?: string;
|
|
7
|
+
color?: string;
|
|
8
|
+
content?: ReactNode | string;
|
|
9
|
+
disabled?: boolean;
|
|
10
|
+
hidden?: boolean;
|
|
11
|
+
name?: string;
|
|
12
|
+
index: number;
|
|
13
|
+
title: ReactNode | string;
|
|
14
|
+
onClick?: (index: number) => void;
|
|
15
|
+
tabDataTestId?: string;
|
|
16
|
+
panelDataTestId?: string;
|
|
17
|
+
}
|
|
18
|
+
export type DsTabRenderProps = DsTabProps & {
|
|
19
|
+
variant: TabsVariant;
|
|
20
|
+
tabDomId: string;
|
|
21
|
+
panelDomId?: string;
|
|
22
|
+
hasPanel: boolean;
|
|
23
|
+
};
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
$chip__font--family: var(--font__family--base) !default;
|
|
2
|
+
$chip__font--weight: $font__weight--semibold !default;
|
|
3
|
+
$chip__font--size: $font__size--xs !default;
|
|
4
|
+
$chip__font--style: normal !default;
|
|
5
|
+
$chip__line-height: 1.25 !default;
|
|
6
|
+
$chip__letter-spacing: 0 !default;
|
|
7
|
+
$chip__padding--y: $spacing__inset--quark !default; // 4px
|
|
8
|
+
$chip__padding--x: $spacing__inset--quark + $spacing__inset--nano !default; // 4px + 8px = 12px
|
|
9
|
+
$chip__min-height: $spacing__inset--sm !default; // 24px
|
|
10
|
+
$chip__border-radius: $border__radius--sm !default;
|
|
11
|
+
$chip__border-width: $border__width--hairline !default;
|
|
12
|
+
$chip__icon--gap: 6px !default;
|
|
13
|
+
$chip__colors: primary, secondary, success, danger, warning, info, neutral;
|
|
14
|
+
$chip__solid: (
|
|
15
|
+
'bg__primary': var(--color__primary),
|
|
16
|
+
'text__primary': var(--color__neutral--00),
|
|
17
|
+
'bg__secondary': var(--color__secondary),
|
|
18
|
+
'text__secondary': var(--color__neutral--00),
|
|
19
|
+
'bg__success': var(--color__success),
|
|
20
|
+
'text__success': var(--color__neutral--00),
|
|
21
|
+
'bg__danger': var(--color__danger),
|
|
22
|
+
'text__danger': var(--color__neutral--00),
|
|
23
|
+
'bg__warning': var(--color__warning),
|
|
24
|
+
'text__warning': var(--color__neutral--90),
|
|
25
|
+
'bg__info': var(--color__info),
|
|
26
|
+
'text__info': var(--color__neutral--00),
|
|
27
|
+
'bg__neutral': var(--color__neutral--80),
|
|
28
|
+
'text__neutral': var(--color__neutral--00),
|
|
29
|
+
) !default;
|
|
30
|
+
$chip__light: (
|
|
31
|
+
'bg__primary': var(--color__primary--lighter),
|
|
32
|
+
'text__primary': var(--color__primary--dark),
|
|
33
|
+
'bg__secondary': var(--color__secondary--lighter),
|
|
34
|
+
'text__secondary': var(--color__secondary--dark),
|
|
35
|
+
'bg__success': var(--color__success--lighter),
|
|
36
|
+
'text__success': var(--color__success--dark),
|
|
37
|
+
'bg__danger': var(--color__danger--lighter),
|
|
38
|
+
'text__danger': var(--color__danger--dark),
|
|
39
|
+
'bg__warning': var(--color__warning--lighter),
|
|
40
|
+
'text__warning': var(--color__warning--dark),
|
|
41
|
+
'bg__info': var(--color__info--lighter),
|
|
42
|
+
'text__info': var(--color__info--dark),
|
|
43
|
+
'bg__neutral': var(--color__neutral--20),
|
|
44
|
+
'text__neutral': var(--color__neutral--80),
|
|
45
|
+
) !default;
|
|
46
|
+
|
|
47
|
+
.ds-chip {
|
|
48
|
+
--chip__border-radius: #{$chip__border-radius};
|
|
49
|
+
--chip__border-width: #{$chip__border-width};
|
|
50
|
+
--chip__min-height: #{$chip__min-height};
|
|
51
|
+
--chip__padding: #{$chip__padding--y} #{$chip__padding--x};
|
|
52
|
+
--chip__icon-gap: #{$chip__icon--gap};
|
|
53
|
+
|
|
54
|
+
align-items: center;
|
|
55
|
+
border: none;
|
|
56
|
+
border-radius: var(--chip__border-radius);
|
|
57
|
+
box-sizing: border-box;
|
|
58
|
+
display: inline-flex;
|
|
59
|
+
font-family: $chip__font--family;
|
|
60
|
+
font-size: $chip__font--size;
|
|
61
|
+
font-style: $chip__font--style;
|
|
62
|
+
font-weight: $chip__font--weight;
|
|
63
|
+
gap: var(--chip__icon-gap);
|
|
64
|
+
justify-content: center;
|
|
65
|
+
letter-spacing: $chip__letter-spacing;
|
|
66
|
+
line-height: $chip__line-height;
|
|
67
|
+
margin: 0;
|
|
68
|
+
max-width: 100%;
|
|
69
|
+
min-height: var(--chip__min-height);
|
|
70
|
+
padding: var(--chip__padding);
|
|
71
|
+
text-align: center;
|
|
72
|
+
vertical-align: middle;
|
|
73
|
+
white-space: nowrap;
|
|
74
|
+
|
|
75
|
+
&__label {
|
|
76
|
+
overflow: hidden;
|
|
77
|
+
text-overflow: ellipsis;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
&__icon {
|
|
81
|
+
align-items: center;
|
|
82
|
+
display: inline-flex;
|
|
83
|
+
flex-shrink: 0;
|
|
84
|
+
justify-content: center;
|
|
85
|
+
line-height: 1;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
@each $color in $chip__colors {
|
|
89
|
+
&__#{$color} {
|
|
90
|
+
&--solid {
|
|
91
|
+
background-color: get-token($chip__solid, 'bg__' + $color);
|
|
92
|
+
color: get-token($chip__solid, 'text__' + $color);
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
&--light {
|
|
96
|
+
background-color: get-token($chip__light, 'bg__' + $color);
|
|
97
|
+
color: get-token($chip__light, 'text__' + $color);
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
}
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
$radio-card__padding: $spacing__inset--quark + $spacing__inset--nano !default;
|
|
2
|
+
$radio-card__gap: $spacing__inset--quark + $spacing__inset--nano !default;
|
|
3
|
+
$radio-card__min-height: $spacing--lg !default;
|
|
4
|
+
$radio-card__text-gap: $spacing--quark !default;
|
|
5
|
+
$radio-card__border-radius: $border__radius--sm !default;
|
|
6
|
+
$radio-card__border-width: $border__width--hairline !default;
|
|
7
|
+
$radio-card__outline-width: $border__width--thin !default;
|
|
8
|
+
|
|
9
|
+
// Tipografia
|
|
10
|
+
$radio-card__font--family: var(--font__family--base) !default;
|
|
11
|
+
$radio-card__font--size: $font__size--xs !default;
|
|
12
|
+
$radio-card__font--weight: $font__weight--semibold !default;
|
|
13
|
+
$radio-card__line-height: 1.5 !default;
|
|
14
|
+
|
|
15
|
+
// Cores (light)
|
|
16
|
+
$radio-card__bg: var(--color__neutral--00) !default;
|
|
17
|
+
$radio-card__border: var(--color__neutral--30) !default;
|
|
18
|
+
$radio-card__bg--checked: var(--color__neutral--05) !default;
|
|
19
|
+
$radio-card__border--checked: var(--color__neutral--80) !default;
|
|
20
|
+
$radio-card__text: var(--color__neutral--80) !default;
|
|
21
|
+
|
|
22
|
+
// Cores (dark)
|
|
23
|
+
$radio-card__bg--dark: var(--color__neutral--90) !default;
|
|
24
|
+
$radio-card__border--dark: var(--color__neutral--60) !default;
|
|
25
|
+
$radio-card__text--dark: var(--color__neutral--10) !default;
|
|
26
|
+
$radio-card__bg--checked-dark: var(--color__neutral--80) !default;
|
|
27
|
+
$radio-card__border--checked-dark: var(--color__neutral--30) !default;
|
|
28
|
+
$radio-card__disabled-opacity: 0.55 !default;
|
|
29
|
+
|
|
30
|
+
@mixin radio-card-wrapper {
|
|
31
|
+
align-items: center;
|
|
32
|
+
background-color: #{$radio-card__bg};
|
|
33
|
+
border: $radio-card__border-width solid #{$radio-card__border};
|
|
34
|
+
border-radius: $radio-card__border-radius;
|
|
35
|
+
box-sizing: border-box;
|
|
36
|
+
cursor: pointer;
|
|
37
|
+
display: inline-flex;
|
|
38
|
+
font-family: $radio-card__font--family;
|
|
39
|
+
-webkit-font-smoothing: antialiased;
|
|
40
|
+
-moz-osx-font-smoothing: grayscale;
|
|
41
|
+
gap: $radio-card__gap;
|
|
42
|
+
min-height: $radio-card__min-height;
|
|
43
|
+
padding: $radio-card__padding;
|
|
44
|
+
position: relative;
|
|
45
|
+
width: fit-content;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
@mixin radio-card-wrapper-checked {
|
|
49
|
+
background-color: #{$radio-card__bg--checked};
|
|
50
|
+
border-color: #{$radio-card__border--checked};
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
@mixin radio-card-wrapper-focus-visible {
|
|
54
|
+
outline: $radio-card__outline-width solid #{$radio-card__border--checked};
|
|
55
|
+
outline-offset: $radio-card__outline-width;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
@mixin radio-card-wrapper-disabled {
|
|
59
|
+
cursor: not-allowed;
|
|
60
|
+
opacity: $radio-card__disabled-opacity;
|
|
61
|
+
pointer-events: none;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
@mixin radio-card-input-hidden {
|
|
65
|
+
cursor: pointer;
|
|
66
|
+
inset: 0;
|
|
67
|
+
margin: 0;
|
|
68
|
+
opacity: 0;
|
|
69
|
+
position: absolute;
|
|
70
|
+
z-index: 1;
|
|
71
|
+
|
|
72
|
+
&:disabled {
|
|
73
|
+
cursor: not-allowed;
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
@mixin radio-card-text-block {
|
|
78
|
+
display: flex;
|
|
79
|
+
flex: 1;
|
|
80
|
+
flex-direction: column;
|
|
81
|
+
gap: $radio-card__text-gap;
|
|
82
|
+
justify-content: center;
|
|
83
|
+
min-width: 0;
|
|
84
|
+
pointer-events: none;
|
|
85
|
+
z-index: 0;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
@mixin radio-card-text-style {
|
|
89
|
+
color: #{$radio-card__text};
|
|
90
|
+
font-family: inherit;
|
|
91
|
+
font-size: $radio-card__font--size;
|
|
92
|
+
font-style: normal;
|
|
93
|
+
font-weight: $radio-card__font--weight;
|
|
94
|
+
letter-spacing: 0;
|
|
95
|
+
line-height: $radio-card__line-height;
|
|
96
|
+
vertical-align: middle;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
@mixin radio-card-dark-mode {
|
|
100
|
+
background-color: #{$radio-card__bg--dark};
|
|
101
|
+
border-color: #{$radio-card__border--dark};
|
|
102
|
+
color: #{$radio-card__text--dark};
|
|
103
|
+
|
|
104
|
+
.ds-radio__label,
|
|
105
|
+
.ds-radio__description {
|
|
106
|
+
color: #{$radio-card__text--dark};
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
@mixin radio-card-dark-mode-checked {
|
|
111
|
+
background-color: #{$radio-card__bg--checked-dark};
|
|
112
|
+
border-color: #{$radio-card__border--checked-dark};
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
@mixin radio-card-dark-mode-focus-visible {
|
|
116
|
+
outline-color: #{$radio-card__border--checked-dark};
|
|
117
|
+
}
|