@hazelcast/ui 3.0.13 → 4.0.1-canary.10
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 +1 -29
- package/lib/components/Alert.js +2 -2
- package/lib/components/Alert.js.map +1 -1
- package/lib/components/AppHeader/AppHeaderMenu/AppHeaderMenu.js +1 -1
- package/lib/components/AppHeader/AppHeaderMenu/AppHeaderMenu.js.map +1 -1
- package/lib/components/AppHeader/SelectCluster/SelectCluster.js +1 -1
- package/lib/components/AppHeader/SelectCluster/SelectCluster.js.map +1 -1
- package/lib/components/AppSidebar/AppSidebar.js +1 -1
- package/lib/components/AppSidebar/AppSidebar.js.map +1 -1
- package/lib/components/AppSidebar/AppSidebarFavoriteButton/AppSidebarFavoriteButton.js +1 -1
- package/lib/components/AppSidebar/AppSidebarFavoriteButton/AppSidebarFavoriteButton.js.map +1 -1
- package/lib/components/AppSidebar/AppSidebarItem/AppSidebarItem.d.ts +1 -3
- package/lib/components/AppSidebar/AppSidebarItem/AppSidebarItem.js +11 -10
- package/lib/components/AppSidebar/AppSidebarItem/AppSidebarItem.js.map +1 -1
- package/lib/components/AutocompleteField.d.ts +1 -3
- package/lib/components/AutocompleteField.js +4 -5
- package/lib/components/AutocompleteField.js.map +1 -1
- package/lib/components/AutocompleteField.module.css +183 -0
- package/lib/components/Badge.d.ts +1 -2
- package/lib/components/Badge.js +3 -7
- package/lib/components/Badge.js.map +1 -1
- package/lib/components/Badge.module.scss +18 -29
- package/lib/components/Button.d.ts +10 -33
- package/lib/components/Button.js +31 -51
- package/lib/components/Button.js.map +1 -1
- package/lib/components/Button.module.css +188 -0
- package/lib/components/ButtonGroup.d.ts +10 -0
- package/lib/components/ButtonGroup.js +6 -0
- package/lib/components/ButtonGroup.js.map +1 -0
- package/lib/components/ButtonGroup.module.css +29 -0
- package/lib/components/Calendar/components/CalendarTime.js +1 -1
- package/lib/components/Calendar/components/CalendarTime.js.map +1 -1
- package/lib/components/Checkbox.js +1 -1
- package/lib/components/Checkbox.js.map +1 -1
- package/lib/components/Checkbox.module.css +97 -0
- package/lib/components/Dialog.js +1 -1
- package/lib/components/Dialog.js.map +1 -1
- package/lib/components/Error.d.ts +2 -2
- package/lib/components/Help.d.ts +2 -2
- package/lib/components/Help.js +3 -2
- package/lib/components/Help.js.map +1 -1
- package/lib/components/IconButton.d.ts +8 -8
- package/lib/components/IconButton.js +24 -13
- package/lib/components/IconButton.js.map +1 -1
- package/lib/components/IconButton.module.css +145 -0
- package/lib/components/InteractiveList.d.ts +1 -1
- package/lib/components/InteractiveList.js +5 -5
- package/lib/components/InteractiveList.js.map +1 -1
- package/lib/components/InteractiveList.module.css +59 -0
- package/lib/components/Modal.d.ts +19 -2
- package/lib/components/Modal.js +56 -25
- package/lib/components/Modal.js.map +1 -1
- package/lib/components/Modal.module.css +222 -0
- package/lib/components/NumberField.d.ts +2 -3
- package/lib/components/NumberField.js +7 -10
- package/lib/components/NumberField.js.map +1 -1
- package/lib/components/NumberField.module.css +73 -0
- package/lib/components/Pagination.js +7 -7
- package/lib/components/Pagination.js.map +1 -1
- package/lib/components/PasswordField.d.ts +1 -2
- package/lib/components/PasswordField.js +2 -2
- package/lib/components/PasswordField.js.map +1 -1
- package/lib/components/PasswordField.module.scss +3 -0
- package/lib/components/Select/CheckableSelectField.d.ts +0 -1
- package/lib/components/Select/CheckableSelectField.js +12 -6
- package/lib/components/Select/CheckableSelectField.js.map +1 -1
- package/lib/components/Select/CheckableSelectField.module.css +112 -0
- package/lib/components/Select/Common.js +3 -3
- package/lib/components/Select/Common.js.map +1 -1
- package/lib/components/Select/Common.module.css +35 -0
- package/lib/components/Select/MultiSelectField.d.ts +1 -1
- package/lib/components/Select/MultiSelectField.js +3 -5
- package/lib/components/Select/MultiSelectField.js.map +1 -1
- package/lib/components/Select/MultiSelectField.module.css +60 -0
- package/lib/components/Select/SelectField.d.ts +2 -3
- package/lib/components/Select/SelectField.js +4 -6
- package/lib/components/Select/SelectField.js.map +1 -1
- package/lib/components/Select/SelectField.module.css +202 -0
- package/lib/components/SimpleTable.d.ts +25 -6
- package/lib/components/SimpleTable.js +27 -12
- package/lib/components/SimpleTable.js.map +1 -1
- package/lib/components/SimpleTable.module.css +80 -0
- package/lib/components/Table/Cell.js +6 -7
- package/lib/components/Table/Cell.js.map +1 -1
- package/lib/components/Tabs/Tab.js +1 -1
- package/lib/components/Tabs/Tab.js.map +1 -1
- package/lib/components/Tabs/Tab.module.css +58 -0
- package/lib/components/Tabs/TabList.js +1 -1
- package/lib/components/Tabs/TabList.js.map +1 -1
- package/lib/components/Tabs/TabList.module.css +9 -0
- package/lib/components/Tabs/TabPanel.js +1 -1
- package/lib/components/Tabs/TabPanel.js.map +1 -1
- package/lib/components/Tabs/TabPanel.module.css +7 -0
- package/lib/components/TextArea.js +1 -1
- package/lib/components/TextArea.js.map +1 -1
- package/lib/components/TextArea.module.css +109 -0
- package/lib/components/TextField.d.ts +2 -2
- package/lib/components/TextField.js +2 -2
- package/lib/components/TextField.js.map +1 -1
- package/lib/components/TextField.module.css +195 -0
- package/lib/components/Toast/Toast.d.ts +12 -0
- package/lib/components/Toast/Toast.js +26 -0
- package/lib/components/Toast/Toast.js.map +1 -0
- package/lib/components/Toast/Toast.module.css +98 -0
- package/lib/components/Toast/index.d.ts +4 -0
- package/lib/components/Toast/index.js +5 -0
- package/lib/components/Toast/index.js.map +1 -0
- package/lib/components/Toggle.js +2 -3
- package/lib/components/Toggle.js.map +1 -1
- package/lib/components/Toggle.module.css +120 -0
- package/lib/components/Tooltip.d.ts +35 -22
- package/lib/components/Tooltip.js +22 -47
- package/lib/components/Tooltip.js.map +1 -1
- package/lib/components/Tooltip.module.css +128 -0
- package/lib/components/TruncatedText.d.ts +2 -2
- package/lib/components/TruncatedText.js +3 -3
- package/lib/components/TruncatedText.js.map +1 -1
- package/lib/index.d.ts +1 -0
- package/lib/index.js.map +1 -1
- package/lib/old/AutocompleteField.d.ts +49 -0
- package/lib/old/AutocompleteField.js +166 -0
- package/lib/old/AutocompleteField.js.map +1 -0
- package/lib/old/AutocompleteFieldFormik.d.ts +9 -0
- package/lib/old/AutocompleteFieldFormik.js +19 -0
- package/lib/old/AutocompleteFieldFormik.js.map +1 -0
- package/lib/old/Button.d.ts +75 -0
- package/lib/old/Button.js +37 -0
- package/lib/old/Button.js.map +1 -0
- package/lib/{components/Button.module.scss → old/ButtonLegacy.module.scss} +2 -8
- package/lib/old/Checkbox.d.ts +35 -0
- package/lib/old/Checkbox.js +38 -0
- package/lib/old/Checkbox.js.map +1 -0
- package/lib/old/CheckboxFormik.d.ts +10 -0
- package/lib/old/CheckboxFormik.js +17 -0
- package/lib/old/CheckboxFormik.js.map +1 -0
- package/lib/old/IconButton.d.ts +49 -0
- package/lib/old/IconButton.js +25 -0
- package/lib/old/IconButton.js.map +1 -0
- package/lib/old/InteractiveList.d.ts +34 -0
- package/lib/old/InteractiveList.js +43 -0
- package/lib/old/InteractiveList.js.map +1 -0
- package/lib/old/InteractiveListFormik.d.ts +10 -0
- package/lib/old/InteractiveListFormik.js +75 -0
- package/lib/old/InteractiveListFormik.js.map +1 -0
- package/lib/old/Modal.d.ts +26 -0
- package/lib/old/Modal.js +41 -0
- package/lib/old/Modal.js.map +1 -0
- package/lib/old/NumberField.d.ts +33 -0
- package/lib/old/NumberField.js +141 -0
- package/lib/old/NumberField.js.map +1 -0
- package/lib/old/NumberFieldFormik.d.ts +10 -0
- package/lib/old/NumberFieldFormik.js +52 -0
- package/lib/old/NumberFieldFormik.js.map +1 -0
- package/lib/old/PasswordField.d.ts +29 -0
- package/lib/old/PasswordField.js +26 -0
- package/lib/old/PasswordField.js.map +1 -0
- package/lib/old/PasswordFieldFormik.d.ts +10 -0
- package/lib/old/PasswordFieldFormik.js +17 -0
- package/lib/old/PasswordFieldFormik.js.map +1 -0
- package/lib/old/PasswordFieldLegacy.module.scss +26 -0
- package/lib/old/Select/CheckableSelectField.d.ts +40 -0
- package/lib/old/Select/CheckableSelectField.js +77 -0
- package/lib/old/Select/CheckableSelectField.js.map +1 -0
- package/lib/old/Select/CheckableSelectFieldFormik.d.ts +10 -0
- package/lib/old/Select/CheckableSelectFieldFormik.js +19 -0
- package/lib/old/Select/CheckableSelectFieldFormik.js.map +1 -0
- package/lib/old/Select/Common.d.ts +5 -0
- package/lib/old/Select/Common.js +54 -0
- package/lib/old/Select/Common.js.map +1 -0
- package/lib/old/Select/MultiSelectField.d.ts +28 -0
- package/lib/old/Select/MultiSelectField.js +113 -0
- package/lib/old/Select/MultiSelectField.js.map +1 -0
- package/lib/old/Select/MultiSelectFieldFormik.d.ts +11 -0
- package/lib/old/Select/MultiSelectFieldFormik.js +19 -0
- package/lib/old/Select/MultiSelectFieldFormik.js.map +1 -0
- package/lib/old/Select/SelectField.d.ts +43 -0
- package/lib/old/Select/SelectField.js +103 -0
- package/lib/old/Select/SelectField.js.map +1 -0
- package/lib/old/Select/SelectFieldFormik.d.ts +10 -0
- package/lib/old/Select/SelectFieldFormik.js +19 -0
- package/lib/old/Select/SelectFieldFormik.js.map +1 -0
- package/lib/old/Select/helpers.d.ts +12 -0
- package/lib/old/Select/helpers.js +29 -0
- package/lib/old/Select/helpers.js.map +1 -0
- package/lib/old/SimpleTable.d.ts +11 -0
- package/lib/old/SimpleTable.js +26 -0
- package/lib/old/SimpleTable.js.map +1 -0
- package/lib/old/Tabs.d.ts +53 -0
- package/lib/old/Tabs.js +92 -0
- package/lib/old/Tabs.js.map +1 -0
- package/lib/{components/Tabs/Tab.module.scss → old/TabsLegacy.module.scss} +14 -6
- package/lib/old/TextArea.d.ts +19 -0
- package/lib/old/TextArea.js +25 -0
- package/lib/old/TextArea.js.map +1 -0
- package/lib/old/TextAreaFormik.d.ts +9 -0
- package/lib/old/TextAreaFormik.js +11 -0
- package/lib/old/TextAreaFormik.js.map +1 -0
- package/lib/old/TextField.d.ts +50 -0
- package/lib/old/TextField.js +65 -0
- package/lib/old/TextField.js.map +1 -0
- package/lib/old/TextFieldFormik.d.ts +11 -0
- package/lib/old/TextFieldFormik.js +23 -0
- package/lib/old/TextFieldFormik.js.map +1 -0
- package/lib/{components/TextField.module.scss → old/TextFieldLegacy.module.scss} +0 -1
- package/lib/{components → old}/Toast.js +2 -2
- package/lib/old/Toast.js.map +1 -0
- package/lib/old/Toggle.d.ts +21 -0
- package/lib/old/Toggle.js +22 -0
- package/lib/old/Toggle.js.map +1 -0
- package/lib/old/ToggleFormik.d.ts +9 -0
- package/lib/old/ToggleFormik.js +12 -0
- package/lib/old/ToggleFormik.js.map +1 -0
- package/lib/{components/Toggle.module.scss → old/ToggleLegacy.module.scss} +0 -2
- package/lib/old/Tooltip.d.ts +34 -0
- package/lib/old/Tooltip.js +57 -0
- package/lib/old/Tooltip.js.map +1 -0
- package/lib/old/Tooltip.module.scss +45 -0
- package/lib/old/index.d.ts +58 -0
- package/lib/old/index.js +34 -0
- package/lib/old/index.js.map +1 -0
- package/package.json +5 -11
- package/styles/constants/_colors.scss +18 -0
- package/styles/variables.css +162 -0
- package/lib/components/Tabs/TabList.module.scss +0 -3
- package/lib/components/Tabs/TabPanel.module.scss +0 -7
- package/lib/components/Toast.js.map +0 -1
- /package/lib/{components/AutocompleteField.module.scss → old/AutocompleteFieldLegacy.module.scss} +0 -0
- /package/lib/{components/Checkbox.module.scss → old/CheckboxLegacy.module.scss} +0 -0
- /package/lib/{components/IconButton.module.scss → old/IconButtonLegacy.module.scss} +0 -0
- /package/lib/{components/InteractiveList.module.scss → old/InteractiveListLegacy.module.scss} +0 -0
- /package/lib/{components/Modal.module.scss → old/ModalLegacy.module.scss} +0 -0
- /package/lib/{components/NumberField.module.scss → old/NumberFieldLegacy.module.scss} +0 -0
- /package/lib/{components/Select/CheckableSelectField.module.scss → old/Select/CheckableSelectFieldLegacy.module.scss} +0 -0
- /package/lib/{components/Select/Common.module.scss → old/Select/CommonLegacy.module.scss} +0 -0
- /package/lib/{components/Select/MultiSelectField.module.scss → old/Select/MultiSelectFieldLegacy.module.scss} +0 -0
- /package/lib/{components/Select/SelectField.module.scss → old/Select/SelectFieldLegacy.module.scss} +0 -0
- /package/lib/{components/SimpleTable.module.scss → old/SimpleTableLegacy.module.scss} +0 -0
- /package/lib/{components/TextArea.module.scss → old/TextAreaLegacy.module.scss} +0 -0
- /package/lib/{components → old}/Toast.d.ts +0 -0
- /package/lib/{components/Toast.module.scss → old/ToastLegacy.module.scss} +0 -0
|
@@ -4,52 +4,41 @@
|
|
|
4
4
|
display: inline-flex;
|
|
5
5
|
flex-direction: row;
|
|
6
6
|
align-items: center;
|
|
7
|
-
border-radius:
|
|
7
|
+
border-radius: 8px;
|
|
8
|
+
padding: c.$grid * 0.5 c.$grid * 2;
|
|
8
9
|
|
|
9
10
|
.content {
|
|
10
11
|
margin-left: c.$grid;
|
|
12
|
+
@include c.typographyBodySmall;
|
|
11
13
|
}
|
|
12
14
|
|
|
13
|
-
// Sizes
|
|
14
|
-
&.normal {
|
|
15
|
-
padding: c.$grid * 2 c.$grid * 3;
|
|
16
|
-
|
|
17
|
-
.content {
|
|
18
|
-
@include c.typographyBodyNormal;
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
&.small {
|
|
23
|
-
padding: c.$grid c.$grid * 2;
|
|
24
|
-
|
|
25
|
-
.content {
|
|
26
|
-
@include c.typographyBodySmall;
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
// Themes
|
|
31
15
|
&.neutral {
|
|
32
|
-
background-color:
|
|
33
|
-
color:
|
|
16
|
+
background-color: lab(from var(--hive-color-text-secondary) 97% a b);
|
|
17
|
+
color: var(--hive-color-text-secondary);
|
|
18
|
+
border: 1px solid var(--hive-color-text-secondary);
|
|
34
19
|
}
|
|
35
20
|
|
|
36
21
|
&.success {
|
|
37
|
-
background-color:
|
|
38
|
-
color:
|
|
22
|
+
background-color: lab(from var(--hive-color-success-darkest) 95% a b);
|
|
23
|
+
color: var(--hive-color-success-darkest);
|
|
24
|
+
border: 1px solid var(--hive-color-success-darkest);
|
|
39
25
|
}
|
|
40
26
|
|
|
41
27
|
&.info {
|
|
42
|
-
background-color:
|
|
43
|
-
color:
|
|
28
|
+
background-color: lab(from var(--hive-color-info-darkest) 95% a b);
|
|
29
|
+
color: var(--hive-color-info-darkest);
|
|
30
|
+
border: 1px solid var(--hive-color-info-darkest);
|
|
44
31
|
}
|
|
45
32
|
|
|
46
33
|
&.warning {
|
|
47
|
-
background-color:
|
|
48
|
-
color:
|
|
34
|
+
background-color: lab(from var(--hive-color-warning-darkest) 95% a b);
|
|
35
|
+
color: var(--hive-color-warning-darkest);
|
|
36
|
+
border: 1px solid var(--hive-color-warning-darkest);
|
|
49
37
|
}
|
|
50
38
|
|
|
51
39
|
&.critical {
|
|
52
|
-
background-color:
|
|
53
|
-
color:
|
|
40
|
+
background-color: lab(from var(--hive-color-error) 95% a b);
|
|
41
|
+
color: var(--hive-color-error);
|
|
42
|
+
border: 1px solid var(--hive-color-error);
|
|
54
43
|
}
|
|
55
44
|
}
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import React, { ButtonHTMLAttributes, HTMLAttributes, ReactElement } from 'react';
|
|
2
|
-
import { IconProps
|
|
3
|
-
import {
|
|
2
|
+
import { IconProps } from './Icon';
|
|
3
|
+
import { TooltipSide } from './Tooltip';
|
|
4
4
|
import { LinkRel, LinkTarget } from './Link';
|
|
5
5
|
import { DataTestProp } from '../helpers/types';
|
|
6
|
-
export type ButtonVariant = 'contained' | 'outlined' | '
|
|
7
|
-
export type ButtonColor = 'primary' | 'secondary' | 'warning' | '
|
|
8
|
-
export type ButtonSize = '
|
|
6
|
+
export type ButtonVariant = 'contained' | 'outlined' | 'ghost' | 'link';
|
|
7
|
+
export type ButtonColor = 'primary' | 'secondary' | 'warning' | 'danger';
|
|
8
|
+
export type ButtonSize = 'small' | 'regular';
|
|
9
|
+
export type ButtonOutlineType = 'outline' | 'inset';
|
|
9
10
|
export type ButtonAccessibleIconLeftProps = {
|
|
10
11
|
iconLeft: IconProps['icon'];
|
|
11
12
|
iconLeftAriaLabel: string;
|
|
@@ -38,23 +39,19 @@ export type ButtonDisabledProps = {
|
|
|
38
39
|
disabledTooltip?: string;
|
|
39
40
|
disabled: boolean;
|
|
40
41
|
disabledTooltipVisible?: boolean;
|
|
41
|
-
disabledTooltipPlacement?:
|
|
42
|
+
disabledTooltipPlacement?: TooltipSide;
|
|
42
43
|
};
|
|
43
|
-
export type ButtonOutlineType = 'outline' | 'inset';
|
|
44
44
|
export type ButtonCommonProps = {
|
|
45
45
|
children: string | ReactElement;
|
|
46
|
-
|
|
47
|
-
iconSize?: IconSize;
|
|
46
|
+
variant?: ButtonVariant;
|
|
48
47
|
color?: ButtonColor;
|
|
49
|
-
|
|
48
|
+
size?: ButtonSize;
|
|
50
49
|
bodyClassName?: string;
|
|
51
|
-
variant?: ButtonVariant;
|
|
52
|
-
outlineClassName?: string;
|
|
53
50
|
outline?: ButtonOutlineType;
|
|
54
51
|
tooltip?: string;
|
|
55
|
-
tooltipColor?: TooltipProps['color'];
|
|
56
52
|
active?: boolean;
|
|
57
53
|
truncate?: boolean;
|
|
54
|
+
fullWidth?: boolean;
|
|
58
55
|
} & (ButtonDisabledProps | ButtonNotDisabledProps) & Pick<HTMLAttributes<HTMLAnchorElement | HTMLButtonElement>, 'className' | 'onClick' | 'tabIndex' | 'style'>;
|
|
59
56
|
export type ButtonTypeAnchorProps = {
|
|
60
57
|
component: 'a';
|
|
@@ -73,25 +70,5 @@ export type ButtonTypeButtonProps = {
|
|
|
73
70
|
} & Pick<ButtonHTMLAttributes<HTMLButtonElement>, 'autoFocus' | 'type'>;
|
|
74
71
|
export type ButtonTypeProps = ButtonTypeAnchorProps | ButtonTypeButtonProps;
|
|
75
72
|
export type ButtonProps<T = ButtonTypeProps> = ButtonCommonProps & T & ButtonAccessibleIconLeftProps & ButtonAccessibleIconRightProps & DataTestProp;
|
|
76
|
-
/**
|
|
77
|
-
* ### Purpose
|
|
78
|
-
* Make it clear what users should do to continue with their main flow by using buttons to highlight the main actions they can take.
|
|
79
|
-
* Prioritize the actions on a page and use the button sizes and types to make it clear to users which are the most important. If you have many actions, consider using button links to offer less important ones.
|
|
80
|
-
*
|
|
81
|
-
* ### General Info
|
|
82
|
-
* - Use 4 types of Button: Primary, Secondary, Danger and Transparent
|
|
83
|
-
* - There are two sizes: `small` with height of `30px` and `medium` with height of `40px`
|
|
84
|
-
* - Button can stand only with the label, icon on the left side, icon on the right side, icon on both left and right side, or only icon (depends on the type of the button).
|
|
85
|
-
* - You can use an icon with the label to draw more attention.
|
|
86
|
-
* - Button label is always in upper-case
|
|
87
|
-
* - The labels should be actionable (e.g. "EDIT" or "ADD NEW FILTER") and it should be clear from the button label what will happen when the user interacts with it. Make button labels short and clear. Avoid long explanations in the button text.
|
|
88
|
-
* - You can change underlying semantics with a component property. Typescript will guard you on providing other properties related to the component type.
|
|
89
|
-
*
|
|
90
|
-
* ### Usage
|
|
91
|
-
* - **Primary**: Use primary button for the single primary action on the screen. To call attention to an action on a form, or highlight the strongest call to action on a page. Primary button should only appear once per screen. Not every screen requires a primary button.
|
|
92
|
-
* - **Secondary**: Use secondary buttons for all remaining actions. Secondary button is the standard button for most use cases.
|
|
93
|
-
* - **Danger**: Use danger button for potentially destructive actions.
|
|
94
|
-
* - **Transparent**: Use for IconButton and similar use-cases.
|
|
95
|
-
*/
|
|
96
73
|
export declare const Button: React.ForwardRefExoticComponent<ButtonProps<ButtonTypeProps> & React.RefAttributes<HTMLElement>>;
|
|
97
74
|
export {};
|
package/lib/components/Button.js
CHANGED
|
@@ -1,64 +1,44 @@
|
|
|
1
1
|
import React, { forwardRef } from 'react';
|
|
2
2
|
import cn from 'classnames';
|
|
3
|
-
import mergeRefs from 'react-merge-refs';
|
|
4
3
|
import { useUID } from 'react-uid';
|
|
5
4
|
import { Icon } from './Icon';
|
|
6
5
|
import { TruncatedText } from './TruncatedText';
|
|
7
6
|
import { Tooltip } from './Tooltip';
|
|
8
7
|
import { Loader } from './Loader';
|
|
9
|
-
import styles from './Button.module.
|
|
10
|
-
const
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
* - **Secondary**: Use secondary buttons for all remaining actions. Secondary button is the standard button for most use cases.
|
|
28
|
-
* - **Danger**: Use danger button for potentially destructive actions.
|
|
29
|
-
* - **Transparent**: Use for IconButton and similar use-cases.
|
|
30
|
-
*/
|
|
31
|
-
export const Button = forwardRef(({ component: Component = 'button', className, bodyClassName, outlineClassName, outline = 'outline', children, capitalize = true,
|
|
32
|
-
// Disabled tooltip
|
|
33
|
-
disabled, disabledTooltip, disabledTooltipVisible, disabledTooltipPlacement,
|
|
34
|
-
// Left icon
|
|
35
|
-
iconLeft, iconLeftAriaLabel, iconLeftColor, iconLeftClassName,
|
|
36
|
-
// Right icon
|
|
37
|
-
iconRight, iconRightAriaLabel, iconRightColor, iconRightClassName, rel = 'noopener', target, type = 'button', loading, variant = 'contained', color = 'primary', tooltip, size = 'small', active, truncate = true, iconSize: propIconSize, tooltipColor, ...rest }, ref) => {
|
|
8
|
+
import styles from './Button.module.css';
|
|
9
|
+
const variantClass = {
|
|
10
|
+
contained: styles.variantContained,
|
|
11
|
+
outlined: styles.variantOutlined,
|
|
12
|
+
ghost: styles.variantGhost,
|
|
13
|
+
link: styles.variantLink,
|
|
14
|
+
};
|
|
15
|
+
const colorClass = {
|
|
16
|
+
primary: styles.colorPrimary,
|
|
17
|
+
secondary: styles.colorSecondary,
|
|
18
|
+
warning: styles.colorWarning,
|
|
19
|
+
danger: styles.colorDanger,
|
|
20
|
+
};
|
|
21
|
+
const sizeClass = {
|
|
22
|
+
small: styles.sizeSmall,
|
|
23
|
+
regular: styles.sizeRegular,
|
|
24
|
+
};
|
|
25
|
+
export const Button = forwardRef(({ component: Component = 'button', className, bodyClassName, outline = 'outline', children, disabled, disabledTooltip, disabledTooltipVisible, disabledTooltipPlacement, iconLeft, iconLeftAriaLabel, iconLeftColor, iconLeftClassName, iconRight, iconRightAriaLabel, iconRightColor, iconRightClassName, rel = 'noopener', target, type = 'button', loading, variant = 'contained', color = 'primary', size = 'regular', tooltip, active, truncate = true, fullWidth, ...rest }, ref) => {
|
|
38
26
|
const tooltipId = useUID();
|
|
39
|
-
const iconSize =
|
|
27
|
+
const iconSize = size === 'small' ? 'small' : 'smallMedium';
|
|
40
28
|
const relFinal = Array.isArray(rel) ? rel.join(' ') : rel;
|
|
41
29
|
const loadingAnimationOnRight = loading && iconRight && iconRightAriaLabel && !(iconLeft && iconLeftAriaLabel);
|
|
42
|
-
return (React.createElement(Tooltip, { id: tooltipId,
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
If a button is disabled and text is long we don't want to show 2 popups.
|
|
55
|
-
1. In case a button is disabled and no `disabledTooltipVisible` is enforced, we just hide truncated popup.
|
|
56
|
-
2. In case a button is disabled and disabledTooltip is hidden with a false flag, there is a space to show
|
|
57
|
-
the truncated popup -> setting it to undefined will leave the default behaviour.
|
|
58
|
-
*/
|
|
59
|
-
tooltipVisible: disabled && disabledTooltipVisible !== false ? false : undefined })) : (children),
|
|
60
|
-
loadingAnimationOnRight && React.createElement(Loader, { className: styles.iconRight, size: iconSize }),
|
|
61
|
-
!loadingAnimationOnRight && iconRight && iconRightAriaLabel && (React.createElement(Icon, { icon: iconRight, ariaLabel: iconRightAriaLabel, "data-test": "button-icon-right", className: cn(styles.iconRight, iconRightClassName), size: iconSize, color: iconRightColor })))))));
|
|
30
|
+
return (React.createElement(Tooltip, { id: tooltipId, content: disabled ? disabledTooltip : tooltip, open: disabled && disabledTooltipVisible, side: disabledTooltipPlacement },
|
|
31
|
+
React.createElement(Component, { "data-test": "button", className: cn(styles.button, variantClass[variant], colorClass[color], sizeClass[size], {
|
|
32
|
+
[styles.active]: active,
|
|
33
|
+
[styles.inset]: outline === 'inset',
|
|
34
|
+
[styles.fullWidth]: fullWidth,
|
|
35
|
+
}, className), "aria-describedby": disabled ? tooltipId : undefined, disabled: disabled !== null && disabled !== void 0 ? disabled : loading, rel: Component === 'a' ? relFinal : undefined, target: Component === 'a' ? target : undefined, type: Component === 'button' ? type : undefined, ref: ref, ...rest },
|
|
36
|
+
React.createElement("span", { className: cn(styles.body, bodyClassName) },
|
|
37
|
+
loading && !loadingAnimationOnRight && React.createElement(Loader, { className: styles.iconLeft, size: iconSize }),
|
|
38
|
+
iconLeft && iconLeftAriaLabel && !loading && (React.createElement(Icon, { icon: iconLeft, ariaLabel: iconLeftAriaLabel, "data-test": "button-icon-left", containerClassName: cn(styles.iconLeft, iconLeftClassName), size: iconSize, color: iconLeftColor })),
|
|
39
|
+
truncate ? (React.createElement(TruncatedText, { text: children, tooltipVisible: disabled && disabledTooltipVisible !== false ? false : undefined })) : (children),
|
|
40
|
+
loadingAnimationOnRight && React.createElement(Loader, { className: styles.iconRight, size: iconSize }),
|
|
41
|
+
!loadingAnimationOnRight && iconRight && iconRightAriaLabel && (React.createElement(Icon, { icon: iconRight, ariaLabel: iconRightAriaLabel, "data-test": "button-icon-right", containerClassName: cn(styles.iconRight, iconRightClassName), size: iconSize, color: iconRightColor }))))));
|
|
62
42
|
});
|
|
63
43
|
Button.displayName = 'Button';
|
|
64
44
|
//# sourceMappingURL=Button.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Button.js","sourceRoot":"","sources":["../../src/components/Button.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAwB,UAAU,EAAgC,MAAM,OAAO,CAAA;AAC7F,OAAO,EAAE,MAAM,YAAY,CAAA;AAC3B,OAAO,
|
|
1
|
+
{"version":3,"file":"Button.js","sourceR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H,IAAI,EAAE,SAAS,EACf,SAAS,EAAE,kBAAkB,eACnB,mBAAmB,EAC7B,kBAAkB,EAAE,EAAE,CAAC,MAAM,CAAC,SAAS,EAAE,kBAAkB,CAAC,EAC5D,IAAI,EAAE,QAAQ,EACd,KAAK,EAAE,cAAc,GACrB,CACH,CACI,CACG,CACJ,CACX,CAAA;AACH,CAAC,CACF,CAAA;AAED,MAAM,CAAC,WAAW,GAAG,QAAQ,CAAA"}
|
|
@@ -0,0 +1,188 @@
|
|
|
1
|
+
.button {
|
|
2
|
+
--button-height: 36px;
|
|
3
|
+
--button-padding-x: 16px;
|
|
4
|
+
--button-icon-gap: 8px;
|
|
5
|
+
--button-color-base: var(--hive-color-brand-v4);
|
|
6
|
+
--button-color-fg-on-base: var(--hive-color-text-v4);
|
|
7
|
+
--button-color-fg-on-light: var(--hive-color-text-v4);
|
|
8
|
+
--button-bg: var(--button-color-base);
|
|
9
|
+
--button-bg-hover: oklch(from var(--button-bg) calc(l - 0.04) c h);
|
|
10
|
+
--button-bg-active: oklch(from var(--button-bg) calc(l - 0.08) c h);
|
|
11
|
+
--button-color: var(--button-color-fg-on-base);
|
|
12
|
+
--button-border: transparent;
|
|
13
|
+
--button-border-hover: var(--button-border);
|
|
14
|
+
|
|
15
|
+
position: relative;
|
|
16
|
+
display: inline-flex;
|
|
17
|
+
align-items: center;
|
|
18
|
+
justify-content: center;
|
|
19
|
+
gap: var(--button-icon-gap);
|
|
20
|
+
box-sizing: border-box;
|
|
21
|
+
height: var(--button-height);
|
|
22
|
+
max-width: var(--hive-button-max-width);
|
|
23
|
+
padding: 0 var(--button-padding-x);
|
|
24
|
+
border: var(--hive-border-width) solid var(--button-border);
|
|
25
|
+
border-radius: var(--hive-border-radius);
|
|
26
|
+
background: var(--button-bg);
|
|
27
|
+
color: var(--button-color);
|
|
28
|
+
font-family: var(--hive-font-family-text);
|
|
29
|
+
font-size: var(--hive-font-size-button-small);
|
|
30
|
+
line-height: 1.4286;
|
|
31
|
+
font-weight: var(--hive-font-weight-text-medium);
|
|
32
|
+
text-decoration: none;
|
|
33
|
+
cursor: pointer;
|
|
34
|
+
transition:
|
|
35
|
+
background-color 120ms ease,
|
|
36
|
+
border-color 120ms ease,
|
|
37
|
+
color 120ms ease;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
.sizeSmall {
|
|
41
|
+
--button-height: 32px;
|
|
42
|
+
--button-padding-x: 12px;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
.sizeRegular {
|
|
46
|
+
--button-height: 36px;
|
|
47
|
+
--button-padding-x: 16px;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
.fullWidth.fullWidth {
|
|
51
|
+
display: flex;
|
|
52
|
+
width: 100%;
|
|
53
|
+
max-width: 100%;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
.button:hover,
|
|
57
|
+
.button.hover {
|
|
58
|
+
background: var(--button-bg-hover);
|
|
59
|
+
border-color: var(--button-border-hover);
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
.button:active,
|
|
63
|
+
.button.active {
|
|
64
|
+
background: var(--button-bg-active);
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
.button:disabled,
|
|
68
|
+
.button.disabled {
|
|
69
|
+
opacity: 0.5;
|
|
70
|
+
cursor: not-allowed;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
.button:focus-visible,
|
|
74
|
+
.button.focus {
|
|
75
|
+
outline: var(--hive-outline-width) solid var(--hive-color-primary-v4);
|
|
76
|
+
outline-offset: 2px;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
.button.inset:focus-visible,
|
|
80
|
+
.button.inset.focus {
|
|
81
|
+
outline-offset: -2px;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
.variantContained {
|
|
85
|
+
--button-bg: var(--button-color-base);
|
|
86
|
+
--button-color: var(--button-color-fg-on-base);
|
|
87
|
+
--button-border: transparent;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
.variantOutlined {
|
|
91
|
+
--button-bg: var(--hive-color-neutral-white-v4);
|
|
92
|
+
--button-bg-hover: var(--hive-color-surface-hover-v4);
|
|
93
|
+
--button-bg-active: var(--hive-color-surface-active-v4);
|
|
94
|
+
--button-color: var(--button-color-fg-on-light);
|
|
95
|
+
--button-border: var(--button-color-base);
|
|
96
|
+
--button-border-hover: var(--button-color-base);
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
.variantGhost {
|
|
100
|
+
--button-bg: transparent;
|
|
101
|
+
--button-bg-hover: var(--hive-color-surface-hover-v4);
|
|
102
|
+
--button-bg-active: var(--hive-color-surface-active-v4);
|
|
103
|
+
--button-color: var(--button-color-fg-on-light);
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
.variantGhost.colorPrimary {
|
|
107
|
+
--button-bg-hover: oklch(from var(--hive-color-brand-v4) 0.95 calc(c * 0.5) h);
|
|
108
|
+
--button-bg-active: oklch(from var(--hive-color-brand-v4) 0.9 calc(c * 0.6) h);
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
.variantGhost.colorWarning {
|
|
112
|
+
--button-bg-hover: oklch(from var(--hive-color-warning) 0.95 calc(c * 0.5) h);
|
|
113
|
+
--button-bg-active: oklch(from var(--hive-color-warning) 0.9 calc(c * 0.6) h);
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
.variantGhost.colorDanger {
|
|
117
|
+
--button-bg-hover: oklch(from var(--hive-color-error) 0.95 calc(c * 0.4) h);
|
|
118
|
+
--button-bg-active: oklch(from var(--hive-color-error) 0.9 calc(c * 0.5) h);
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
.variantLink {
|
|
122
|
+
--button-bg: transparent;
|
|
123
|
+
--button-bg-hover: transparent;
|
|
124
|
+
--button-bg-active: transparent;
|
|
125
|
+
--button-color: var(--hive-color-link-v4);
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
.variantLink:hover,
|
|
129
|
+
.variantLink.hover {
|
|
130
|
+
text-decoration: underline;
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
.colorPrimary {
|
|
134
|
+
--button-color-base: var(--hive-color-brand-v4);
|
|
135
|
+
--button-color-fg-on-base: var(--hive-color-text-v4);
|
|
136
|
+
--button-color-fg-on-light: var(--hive-color-text-v4);
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
.colorSecondary {
|
|
140
|
+
--button-color-base: var(--hive-color-secondary-v4);
|
|
141
|
+
--button-color-fg-on-base: var(--hive-color-text-v4);
|
|
142
|
+
--button-color-fg-on-light: var(--hive-color-text-v4);
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
.colorWarning {
|
|
146
|
+
--button-color-base: var(--hive-color-warning);
|
|
147
|
+
--button-color-fg-on-base: var(--hive-color-warning-darkest);
|
|
148
|
+
--button-color-fg-on-light: var(--hive-color-warning-darkest);
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
.colorDanger {
|
|
152
|
+
--button-color-base: var(--hive-color-error);
|
|
153
|
+
--button-color-fg-on-base: var(--hive-color-neutral-white-v4);
|
|
154
|
+
--button-color-fg-on-light: var(--hive-color-error);
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
.variantOutlined.colorSecondary {
|
|
158
|
+
--button-border: var(--hive-color-border-v4);
|
|
159
|
+
--button-border-hover: var(--hive-color-border-v4);
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
.variantOutlined.colorWarning {
|
|
163
|
+
--button-border: var(--hive-color-warning-darkest);
|
|
164
|
+
--button-border-hover: var(--hive-color-warning-darkest);
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
.body {
|
|
168
|
+
display: inline-flex;
|
|
169
|
+
align-items: center;
|
|
170
|
+
justify-content: center;
|
|
171
|
+
gap: var(--button-icon-gap);
|
|
172
|
+
min-width: 0;
|
|
173
|
+
max-width: 100%;
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
.iconLeft,
|
|
177
|
+
.iconRight {
|
|
178
|
+
display: inline-flex;
|
|
179
|
+
align-items: center;
|
|
180
|
+
justify-content: center;
|
|
181
|
+
flex-shrink: 0;
|
|
182
|
+
line-height: 0;
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
.iconOnly {
|
|
186
|
+
padding: 0;
|
|
187
|
+
width: var(--button-height);
|
|
188
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import React, { HTMLAttributes, ReactNode } from 'react';
|
|
2
|
+
import { DataTestProp } from '../helpers/types';
|
|
3
|
+
export type ButtonGroupProps = {
|
|
4
|
+
children: ReactNode;
|
|
5
|
+
ariaLabel?: string;
|
|
6
|
+
} & DataTestProp & Omit<HTMLAttributes<HTMLDivElement>, 'aria-label'>;
|
|
7
|
+
export declare const ButtonGroup: React.ForwardRefExoticComponent<{
|
|
8
|
+
children: ReactNode;
|
|
9
|
+
ariaLabel?: string;
|
|
10
|
+
} & DataTestProp & Omit<React.HTMLAttributes<HTMLDivElement>, "aria-label"> & React.RefAttributes<HTMLDivElement>>;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import React, { forwardRef } from 'react';
|
|
2
|
+
import cn from 'classnames';
|
|
3
|
+
import styles from './ButtonGroup.module.css';
|
|
4
|
+
export const ButtonGroup = forwardRef(({ children, className, ariaLabel, 'data-test': dataTest = 'button-group', ...rest }, ref) => (React.createElement("div", { ref: ref, role: "group", "aria-label": ariaLabel, "data-test": dataTest, className: cn(styles.group, className), ...rest }, children)));
|
|
5
|
+
ButtonGroup.displayName = 'ButtonGroup';
|
|
6
|
+
//# sourceMappingURL=ButtonGroup.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ButtonGroup.js","sourceRoot":"","sources":["../../src/components/ButtonGroup.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,UAAU,EAA6B,MAAM,OAAO,CAAA;AACpE,OAAO,EAAE,MAAM,YAAY,CAAA;AAI3B,OAAO,MAAM,MAAM,0BAA0B,CAAA;AAQ7C,MAAM,CAAC,MAAM,WAAW,GAAG,UAAU,CACnC,CAAC,EAAE,QAAQ,EAAE,SAAS,EAAE,SAAS,EAAE,WAAW,EAAE,QAAQ,GAAG,cAAc,EAAE,GAAG,IAAI,EAAE,EAAE,GAAG,EAAE,EAAE,CAAC,CAC5F,6BAAK,GAAG,EAAE,GAAG,EAAE,IAAI,EAAC,OAAO,gBAAa,SAAS,eAAa,QAAQ,EAAE,SAAS,EAAE,EAAE,CAAC,MAAM,CAAC,KAAK,EAAE,SAAS,CAAC,KAAM,IAAI,IACrH,QAAQ,CACL,CACP,CACF,CAAA;AAED,WAAW,CAAC,WAAW,GAAG,aAAa,CAAA"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
.group {
|
|
2
|
+
display: inline-flex;
|
|
3
|
+
border-radius: var(--hive-border-radius);
|
|
4
|
+
box-shadow: var(--hive-shadow-button-v4);
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
.group > * {
|
|
8
|
+
border-radius: 0;
|
|
9
|
+
box-shadow: none;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
.group > *:first-child {
|
|
13
|
+
border-top-left-radius: var(--hive-border-radius);
|
|
14
|
+
border-bottom-left-radius: var(--hive-border-radius);
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
.group > *:last-child {
|
|
18
|
+
border-top-right-radius: var(--hive-border-radius);
|
|
19
|
+
border-bottom-right-radius: var(--hive-border-radius);
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
.group > * + * {
|
|
23
|
+
margin-left: calc(var(--hive-border-width) * -1);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
.group > *:focus-visible,
|
|
27
|
+
.group > *:hover {
|
|
28
|
+
z-index: 1;
|
|
29
|
+
}
|
|
@@ -59,7 +59,7 @@ export const CalendarTimeInternal = ({ date, value, onChange, 'data-test': dataT
|
|
|
59
59
|
return (React.createElement("div", { "data-test": dataTest, className: styles.container },
|
|
60
60
|
React.createElement("div", { "data-test": `${dataTest}-header`, className: styles.header },
|
|
61
61
|
React.createElement(TimeField, { showAriaLabel: true, size: "small", label: "Time Input", error: timeInputError, name: "time", value: time.toString(), "data-test": `${dataTest}-input`, inputClassName: styles.timeInput, onChange: handleTimeInputChange })),
|
|
62
|
-
React.createElement("div", { "data-test": `${dataTest}-timePoints`, className: styles.timePoints }, timePoints.map((tP) => (React.createElement(Button, { className: styles.timePoint, bodyClassName: styles.timePointBody, key: tP, variant: "
|
|
62
|
+
React.createElement("div", { "data-test": `${dataTest}-timePoints`, className: styles.timePoints }, timePoints.map((tP) => (React.createElement(Button, { className: styles.timePoint, bodyClassName: styles.timePointBody, key: tP, variant: "ghost", color: "secondary", onClick: handleDateClick(tP) }, tP))))));
|
|
63
63
|
};
|
|
64
64
|
export const CalendarTime = (props) => {
|
|
65
65
|
// Note: Cast the "unknown" props to the actual type
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CalendarTime.js","sourceRoot":"","sources":["../../../../src/components/Calendar/components/CalendarTime.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAmB,WAAW,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAA;AAChF,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,UAAU,CAAA;AAGxC,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAA;AACrC,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAA;AAC9C,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAA;AAC3C,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAA;AAE5C,OAAO,MAAM,MAAM,4BAA4B,CAAA;AAE/C,MAAM,WAAW,GAAG,OAAO,CAAA;AAQ3B,MAAM,CAAC,MAAM,oBAAoB,GAAkC,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,QAAQ,EAAE,WAAW,EAAE,QAAQ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M,UAAU,GAAG,KAAkC,CAAA;IAErD,OAAO,oBAAC,oBAAoB,OAAK,UAAU,GAAI,CAAA;AACjD,CAAC,CAAA"}
|
|
@@ -4,7 +4,7 @@ import { useUID } from 'react-uid';
|
|
|
4
4
|
import classNames from 'classnames';
|
|
5
5
|
import { Error, errorId } from './Error';
|
|
6
6
|
import { Help, helpTooltipId } from './Help';
|
|
7
|
-
import styles from './Checkbox.module.
|
|
7
|
+
import styles from './Checkbox.module.css';
|
|
8
8
|
import { TruncatedText } from './TruncatedText';
|
|
9
9
|
/**
|
|
10
10
|
* ### Purpose
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Checkbox.js","sourceRoot":"","sources":["../../src/components/Checkbox.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAyC,MAAM,EAAc,UAAU,EAAE,MAAM,OAAO,CAAA;AACpG,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,eAAe,CAAA;AAC5C,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAA;AAClC,OAAO,UAAU,MAAM,YAAY,CAAA;AAEnC,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,SAAS,CAAA;AACxC,OAAO,EAAE,IAAI,EAAa,aAAa,EAAE,MAAM,QAAQ,CAAA;AAGvD,OAAO,MAAM,MAAM,
|
|
1
|
+
{"version":3,"file":"Checkbox.js","sourceRoot":"","sources":["../../src/components/Checkbox.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAyC,MAAM,EAAc,UAAU,EAAE,MAAM,OAAO,CAAA;AACpG,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,eAAe,CAAA;AAC5C,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAA;AAClC,OAAO,UAAU,MAAM,YAAY,CAAA;AAEnC,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,SAAS,CAAA;AACxC,OAAO,EAAE,IAAI,EAA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