@spaced-out/ui-design-system 0.0.1-alpha.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/.commitlintrc.json +3 -0
- package/.cspell/custom-words.txt +22 -0
- package/.editorconfig +9 -0
- package/.eslintignore +1 -0
- package/.eslintrc.yml +122 -0
- package/.flowconfig +45 -0
- package/.github/workflows/pages.yml +52 -0
- package/.prettierrc +11 -0
- package/.storybook/SenseTheme.js +12 -0
- package/.storybook/main.js +73 -0
- package/.storybook/manager-head.html +41 -0
- package/.storybook/manager.js +14 -0
- package/.storybook/preview-head.html +130 -0
- package/.storybook/preview.js +128 -0
- package/.storybook/public/favicon.ico +0 -0
- package/.storybook/public/favicon.svg +6 -0
- package/.storybook/public/fonts/CentraNo2-Book.woff +0 -0
- package/.storybook/public/fonts/CentraNo2-Book.woff2 +0 -0
- package/.storybook/public/fonts/CentraNo2-BookItalic.woff +0 -0
- package/.storybook/public/fonts/CentraNo2-BookItalic.woff2 +0 -0
- package/.storybook/public/fonts/CentraNo2-Medium.woff +0 -0
- package/.storybook/public/fonts/CentraNo2-Medium.woff2 +0 -0
- package/.vscode/extensions.json +3 -0
- package/CHANGELOG.md +73 -0
- package/README.md +178 -0
- package/babel.config.js +24 -0
- package/config.js +58 -0
- package/cspell.json +26 -0
- package/design-tokens/border/app-border.json +41 -0
- package/design-tokens/border/base-border.json +41 -0
- package/design-tokens/color/app-color.json +226 -0
- package/design-tokens/color/base-color.json +265 -0
- package/design-tokens/elevation/app-elevation.json +22 -0
- package/design-tokens/elevation/base-elevation.json +19 -0
- package/design-tokens/font/base-font.json +98 -0
- package/design-tokens/index.js +5 -0
- package/design-tokens/motion/app.motion.json +24 -0
- package/design-tokens/motion/base-motion.json +40 -0
- package/design-tokens/opacity/base-opacity.json +49 -0
- package/design-tokens/shadow/base-shadow.json +86 -0
- package/design-tokens/size/base-size.json +94 -0
- package/design-tokens/space/app-space.json +40 -0
- package/design-tokens/space/base-space.json +40 -0
- package/flow-typed/npm/lodash_v4.x.x.js +6407 -0
- package/git-conventional-commits.json +43 -0
- package/gulpfile.js +48 -0
- package/jest.config.js +9 -0
- package/lib/assets/fontawesome/LICENSE.txt +18 -0
- package/lib/assets/fontawesome/css/all.min.css +27184 -0
- package/lib/assets/fontawesome/webfonts/fa-brands-400.ttf +0 -0
- package/lib/assets/fontawesome/webfonts/fa-brands-400.woff2 +0 -0
- package/lib/assets/fontawesome/webfonts/fa-duotone-900.ttf +0 -0
- package/lib/assets/fontawesome/webfonts/fa-duotone-900.woff2 +0 -0
- package/lib/assets/fontawesome/webfonts/fa-light-300.ttf +0 -0
- package/lib/assets/fontawesome/webfonts/fa-light-300.woff2 +0 -0
- package/lib/assets/fontawesome/webfonts/fa-regular-400.ttf +0 -0
- package/lib/assets/fontawesome/webfonts/fa-regular-400.woff2 +0 -0
- package/lib/assets/fontawesome/webfonts/fa-solid-900.ttf +0 -0
- package/lib/assets/fontawesome/webfonts/fa-solid-900.woff2 +0 -0
- package/lib/assets/fontawesome/webfonts/fa-thin-100.ttf +0 -0
- package/lib/assets/fontawesome/webfonts/fa-thin-100.woff2 +0 -0
- package/lib/assets/fontawesome/webfonts/fa-v4compatibility.ttf +0 -0
- package/lib/assets/fontawesome/webfonts/fa-v4compatibility.woff2 +0 -0
- package/lib/components/Button/Button.js +120 -0
- package/lib/components/Button/Button.js.flow +166 -0
- package/lib/components/Button/Button.module.css +226 -0
- package/lib/components/Button/index.js +24 -0
- package/lib/components/Button/index.js.flow +4 -0
- package/lib/components/ButtonDropdown/ButtonDropdown.js +89 -0
- package/lib/components/ButtonDropdown/ButtonDropdown.js.flow +119 -0
- package/lib/components/ButtonDropdown/ButtonDropdown.module.css +4 -0
- package/lib/components/ButtonDropdown/index.js +12 -0
- package/lib/components/ButtonDropdown/index.js.flow +4 -0
- package/lib/components/Checkbox/Checkbox.js +99 -0
- package/lib/components/Checkbox/Checkbox.js.flow +133 -0
- package/lib/components/Checkbox/Checkbox.module.css +160 -0
- package/lib/components/Checkbox/CheckboxGroup.js +85 -0
- package/lib/components/Checkbox/CheckboxGroup.js.flow +105 -0
- package/lib/components/Checkbox/CheckboxGroup.module.css +47 -0
- package/lib/components/Checkbox/index.js +19 -0
- package/lib/components/Checkbox/index.js.flow +3 -0
- package/lib/components/CircularLoader/CircularLoader.js +44 -0
- package/lib/components/CircularLoader/CircularLoader.js.flow +44 -0
- package/lib/components/CircularLoader/CircularLoader.module.css +81 -0
- package/lib/components/CircularLoader/index.js +12 -0
- package/lib/components/CircularLoader/index.js.flow +3 -0
- package/lib/components/CodeBlock.js +26 -0
- package/lib/components/CodeBlock.js.flow +19 -0
- package/lib/components/Dialog/Dialog.js +148 -0
- package/lib/components/Dialog/Dialog.js.flow +165 -0
- package/lib/components/Dialog/Dialog.module.css +87 -0
- package/lib/components/Dialog/index.js +36 -0
- package/lib/components/Dialog/index.js.flow +14 -0
- package/lib/components/Dropdown/Dropdown.js +108 -0
- package/lib/components/Dropdown/Dropdown.js.flow +129 -0
- package/lib/components/Dropdown/Dropdown.module.css +14 -0
- package/lib/components/Dropdown/index.js +18 -0
- package/lib/components/Dropdown/index.js.flow +4 -0
- package/lib/components/Grid/Grid.js +82 -0
- package/lib/components/Grid/Grid.js.flow +88 -0
- package/lib/components/Grid/Grid.module.css +30 -0
- package/lib/components/Grid/index.js +16 -0
- package/lib/components/Grid/index.js.flow +3 -0
- package/lib/components/Icon/ClickableIcon.js +51 -0
- package/lib/components/Icon/ClickableIcon.js.flow +51 -0
- package/lib/components/Icon/ClickableIcon.module.css +50 -0
- package/lib/components/Icon/FontAwesomeLibrary.js +3 -0
- package/lib/components/Icon/FontAwesomeLibrary.js.flow +3 -0
- package/lib/components/Icon/Icon.js +38 -0
- package/lib/components/Icon/Icon.js.flow +51 -0
- package/lib/components/Icon/index.js +25 -0
- package/lib/components/Icon/index.js.flow +6 -0
- package/lib/components/InContextAlert/InContextAlert.js +121 -0
- package/lib/components/InContextAlert/InContextAlert.js.flow +173 -0
- package/lib/components/InContextAlert/InContextAlert.module.css +54 -0
- package/lib/components/InContextAlert/index.js +18 -0
- package/lib/components/InContextAlert/index.js.flow +3 -0
- package/lib/components/Input/Input.js +172 -0
- package/lib/components/Input/Input.js.flow +246 -0
- package/lib/components/Input/Input.module.css +122 -0
- package/lib/components/Input/index.js +12 -0
- package/lib/components/Input/index.js.flow +4 -0
- package/lib/components/LinearLoader/LinearLoader.js +35 -0
- package/lib/components/LinearLoader/LinearLoader.js.flow +34 -0
- package/lib/components/LinearLoader/LinearLoader.module.css +43 -0
- package/lib/components/LinearLoader/index.js +12 -0
- package/lib/components/LinearLoader/index.js.flow +3 -0
- package/lib/components/Menu/Menu.js +76 -0
- package/lib/components/Menu/Menu.js.flow +85 -0
- package/lib/components/Menu/Menu.module.css +124 -0
- package/lib/components/Menu/index.js +12 -0
- package/lib/components/Menu/index.js.flow +4 -0
- package/lib/components/Modal/Modal.js +121 -0
- package/lib/components/Modal/Modal.js.flow +157 -0
- package/lib/components/Modal/Modal.module.css +62 -0
- package/lib/components/Modal/index.js +12 -0
- package/lib/components/Modal/index.js.flow +3 -0
- package/lib/components/Notification/Notification.js +89 -0
- package/lib/components/Notification/Notification.js.flow +136 -0
- package/lib/components/Notification/Notification.module.css +54 -0
- package/lib/components/Notification/index.js +18 -0
- package/lib/components/Notification/index.js.flow +3 -0
- package/lib/components/Panel/Panel.js +96 -0
- package/lib/components/Panel/Panel.js.flow +109 -0
- package/lib/components/Panel/Panel.module.css +77 -0
- package/lib/components/Panel/index.js +30 -0
- package/lib/components/Panel/index.js.flow +10 -0
- package/lib/components/RadioButton/RadioButton.js +76 -0
- package/lib/components/RadioButton/RadioButton.js.flow +102 -0
- package/lib/components/RadioButton/RadioButton.module.css +122 -0
- package/lib/components/RadioButton/RadioGroup.js +60 -0
- package/lib/components/RadioButton/RadioGroup.js.flow +85 -0
- package/lib/components/RadioButton/RadioGroup.module.css +47 -0
- package/lib/components/RadioButton/index.js +19 -0
- package/lib/components/RadioButton/index.js.flow +3 -0
- package/lib/components/SearchInput/SearchInput.js +47 -0
- package/lib/components/SearchInput/SearchInput.js.flow +73 -0
- package/lib/components/SearchInput/SearchInput.module.css +11 -0
- package/lib/components/SearchInput/index.js +12 -0
- package/lib/components/SearchInput/index.js.flow +4 -0
- package/lib/components/Text/Text.js +195 -0
- package/lib/components/Text/Text.js.flow +160 -0
- package/lib/components/Text/index.js +103 -0
- package/lib/components/Text/index.js.flow +21 -0
- package/lib/components/Textarea/Textarea.js +95 -0
- package/lib/components/Textarea/Textarea.js.flow +133 -0
- package/lib/components/Textarea/Textarea.module.css +110 -0
- package/lib/components/Textarea/index.js +12 -0
- package/lib/components/Textarea/index.js.flow +4 -0
- package/lib/components/Toast/Toast.js +187 -0
- package/lib/components/Toast/Toast.js.flow +210 -0
- package/lib/components/Toast/Toast.module.css +52 -0
- package/lib/components/Toast/ToastContainer.js +129 -0
- package/lib/components/Toast/ToastContainer.js.flow +125 -0
- package/lib/components/Toast/ToastContainer.module.css +41 -0
- package/lib/components/Toast/ToastManager.js +62 -0
- package/lib/components/Toast/ToastManager.js.flow +67 -0
- package/lib/components/Toast/index.js +56 -0
- package/lib/components/Toast/index.js.flow +12 -0
- package/lib/components/Toggle/Toggle.js +69 -0
- package/lib/components/Toggle/Toggle.js.flow +94 -0
- package/lib/components/Toggle/Toggle.module.css +144 -0
- package/lib/components/Toggle/index.js +12 -0
- package/lib/components/Toggle/index.js.flow +2 -0
- package/lib/components/Tooltip/Tooltip.js +81 -0
- package/lib/components/Tooltip/Tooltip.js.flow +110 -0
- package/lib/components/Tooltip/Tooltip.module.css +16 -0
- package/lib/components/Tooltip/index.js +12 -0
- package/lib/components/Tooltip/index.js.flow +4 -0
- package/lib/components/Truncate/Truncate.js +28 -0
- package/lib/components/Truncate/Truncate.js.flow +22 -0
- package/lib/components/Truncate/Truncate.module.css +6 -0
- package/lib/components/Truncate/index.js +12 -0
- package/lib/components/Truncate/index.js.flow +4 -0
- package/lib/components/Typeahead/Typeahead.js +124 -0
- package/lib/components/Typeahead/Typeahead.js.flow +153 -0
- package/lib/components/Typeahead/Typeahead.module.css +10 -0
- package/lib/components/Typeahead/index.js +12 -0
- package/lib/components/Typeahead/index.js.flow +4 -0
- package/lib/hooks/index.js +27 -0
- package/lib/hooks/index.js.flow +4 -0
- package/lib/hooks/useMountTransition.js +25 -0
- package/lib/hooks/useMountTransition.js.flow +27 -0
- package/lib/hooks/useToastPortal.js +32 -0
- package/lib/hooks/useToastPortal.js.flow +30 -0
- package/lib/styles/animation.module.css +9 -0
- package/lib/styles/border.module.css +27 -0
- package/lib/styles/shadow.module.css +42 -0
- package/lib/styles/typography.module.css +227 -0
- package/lib/styles/variables/_border.css +21 -0
- package/lib/styles/variables/_border.js +29 -0
- package/lib/styles/variables/_border.js.flow +23 -0
- package/lib/styles/variables/_color.css +131 -0
- package/lib/styles/variables/_color.js +139 -0
- package/lib/styles/variables/_color.js.flow +133 -0
- package/lib/styles/variables/_elevation.css +11 -0
- package/lib/styles/variables/_elevation.js +19 -0
- package/lib/styles/variables/_elevation.js.flow +13 -0
- package/lib/styles/variables/_font.css +51 -0
- package/lib/styles/variables/_font.js +59 -0
- package/lib/styles/variables/_font.js.flow +53 -0
- package/lib/styles/variables/_motion.css +11 -0
- package/lib/styles/variables/_motion.js +19 -0
- package/lib/styles/variables/_motion.js.flow +13 -0
- package/lib/styles/variables/_opacity.css +29 -0
- package/lib/styles/variables/_opacity.js +37 -0
- package/lib/styles/variables/_opacity.js.flow +31 -0
- package/lib/styles/variables/_shadow.css +47 -0
- package/lib/styles/variables/_shadow.js +55 -0
- package/lib/styles/variables/_shadow.js.flow +49 -0
- package/lib/styles/variables/_size.css +59 -0
- package/lib/styles/variables/_size.js +67 -0
- package/lib/styles/variables/_size.js.flow +61 -0
- package/lib/styles/variables/_space.css +23 -0
- package/lib/styles/variables/_space.js +31 -0
- package/lib/styles/variables/_space.js.flow +25 -0
- package/lib/types/common.js +1 -0
- package/lib/types/common.js.flow +3 -0
- package/lib/types/toast.js +24 -0
- package/lib/types/toast.js.flow +41 -0
- package/lib/types/typography.js +22 -0
- package/lib/types/typography.js.flow +18 -0
- package/lib/utils/classify.js +33 -0
- package/lib/utils/classify.js.flow +29 -0
- package/lib/utils/click-away.js +110 -0
- package/lib/utils/click-away.js.flow +134 -0
- package/lib/utils/dom.js +202 -0
- package/lib/utils/dom.js.flow +238 -0
- package/lib/utils/helpers.js +16 -0
- package/lib/utils/helpers.js.flow +11 -0
- package/lib/utils/makeClassNameComponent.js +58 -0
- package/lib/utils/makeClassNameComponent.js.flow +71 -0
- package/lib/utils/merge-refs.js +17 -0
- package/lib/utils/merge-refs.js.flow +14 -0
- package/lint-staged.config.js +5 -0
- package/package.json +114 -0
- package/postcss.config.js +3 -0
- package/pull_request_template.md +48 -0
- package/settings.json +3 -0
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
// @flow strict
|
|
2
|
+
|
|
3
|
+
import * as React from 'react';
|
|
4
|
+
|
|
5
|
+
import type {GroupAlign} from '../../types/common';
|
|
6
|
+
import classify from '../../utils/classify';
|
|
7
|
+
import {BodySmall} from '../Text/Text.js';
|
|
8
|
+
|
|
9
|
+
import css from './CheckboxGroup.module.css';
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
type ClassNames = $ReadOnly<{
|
|
13
|
+
wrapper?: string,
|
|
14
|
+
checkboxGroup?: string,
|
|
15
|
+
errorText?: string,
|
|
16
|
+
}>;
|
|
17
|
+
export type CheckboxOptions = Array<{
|
|
18
|
+
label: React.Node,
|
|
19
|
+
value: string,
|
|
20
|
+
}>;
|
|
21
|
+
|
|
22
|
+
export type CheckboxGroupProps = {
|
|
23
|
+
align?: GroupAlign,
|
|
24
|
+
disabled?: boolean,
|
|
25
|
+
name: string,
|
|
26
|
+
value?: Array<string>,
|
|
27
|
+
onChange?: (value: Array<string>) => mixed,
|
|
28
|
+
classNames?: ClassNames,
|
|
29
|
+
error?: boolean,
|
|
30
|
+
errorText?: string,
|
|
31
|
+
children?: React.Node,
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
export const CheckboxGroup = ({
|
|
35
|
+
align = 'vertical',
|
|
36
|
+
disabled = false,
|
|
37
|
+
name,
|
|
38
|
+
value: checkedList,
|
|
39
|
+
onChange,
|
|
40
|
+
classNames,
|
|
41
|
+
error = false,
|
|
42
|
+
errorText = '',
|
|
43
|
+
children,
|
|
44
|
+
}: CheckboxGroupProps): React.Node => {
|
|
45
|
+
const onChangeHandler = ({value, checked}) => {
|
|
46
|
+
const checkedListTemp = checkedList ? [...checkedList] : [];
|
|
47
|
+
if (checked && !checkedListTemp.includes(value)) {
|
|
48
|
+
checkedListTemp.push(value);
|
|
49
|
+
} else if (!checked && checkedListTemp.includes(value)) {
|
|
50
|
+
for (let i = 0; i < checkedListTemp.length; i++) {
|
|
51
|
+
if (checkedListTemp[i] === value) {
|
|
52
|
+
checkedListTemp.splice(i, 1);
|
|
53
|
+
break;
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
onChange && onChange(checkedListTemp);
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
const childrenWithProps = React.Children.map(children, (child) => {
|
|
61
|
+
if (React.isValidElement(child)) {
|
|
62
|
+
const {
|
|
63
|
+
value,
|
|
64
|
+
disabled: disabledChild,
|
|
65
|
+
error: errorChild,
|
|
66
|
+
onChange,
|
|
67
|
+
} = child.props;
|
|
68
|
+
const childOnChange = (...params) => {
|
|
69
|
+
onChangeHandler(...params);
|
|
70
|
+
onChange && onChange(...params);
|
|
71
|
+
};
|
|
72
|
+
return React.cloneElement(child, {
|
|
73
|
+
name,
|
|
74
|
+
checked: !!checkedList?.includes(value),
|
|
75
|
+
onChange: childOnChange,
|
|
76
|
+
align,
|
|
77
|
+
error: errorChild || error,
|
|
78
|
+
disabled: disabledChild || disabled,
|
|
79
|
+
});
|
|
80
|
+
}
|
|
81
|
+
return child;
|
|
82
|
+
});
|
|
83
|
+
|
|
84
|
+
return (
|
|
85
|
+
<div className={classify(css.checkboxGroupContainer, classNames?.wrapper)}>
|
|
86
|
+
<div
|
|
87
|
+
className={classify(
|
|
88
|
+
{
|
|
89
|
+
[css.vertical]: align === 'vertical',
|
|
90
|
+
[css.horizontal]: align === 'horizontal-fixed',
|
|
91
|
+
[css.horizontalFluid]: align === 'horizontal-fluid',
|
|
92
|
+
},
|
|
93
|
+
classNames?.checkboxGroup,
|
|
94
|
+
)}
|
|
95
|
+
>
|
|
96
|
+
{childrenWithProps}
|
|
97
|
+
</div>
|
|
98
|
+
{error && (
|
|
99
|
+
<BodySmall className={classify(classNames?.errorText)} color="danger">
|
|
100
|
+
{errorText}
|
|
101
|
+
</BodySmall>
|
|
102
|
+
)}
|
|
103
|
+
</div>
|
|
104
|
+
);
|
|
105
|
+
};
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
@value (
|
|
2
|
+
colorBackgroundTertiary,
|
|
3
|
+
colorBorderSecondary,
|
|
4
|
+
colorFillPrimary,
|
|
5
|
+
colorFillDisabled,
|
|
6
|
+
colorFocusPrimary
|
|
7
|
+
) from '../../styles/variables/_color.css';
|
|
8
|
+
|
|
9
|
+
@value (
|
|
10
|
+
spaceXSmall,
|
|
11
|
+
spaceSmall,
|
|
12
|
+
spaceMedium
|
|
13
|
+
) from '../../styles/variables/_space.css';
|
|
14
|
+
|
|
15
|
+
@value (
|
|
16
|
+
size500,
|
|
17
|
+
sizeFluid
|
|
18
|
+
) from '../../styles/variables/_size.css';
|
|
19
|
+
|
|
20
|
+
.checkboxGroupContainer {
|
|
21
|
+
display: flex;
|
|
22
|
+
flex-direction: column;
|
|
23
|
+
gap: spaceXSmall;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
.vertical {
|
|
27
|
+
display: flex;
|
|
28
|
+
flex-direction: column;
|
|
29
|
+
align-items: flex-start;
|
|
30
|
+
gap: spaceSmall;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
.horizontal {
|
|
34
|
+
display: flex;
|
|
35
|
+
align-items: flex-start;
|
|
36
|
+
gap: spaceMedium;
|
|
37
|
+
flex-wrap: wrap;
|
|
38
|
+
width: sizeFluid;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
.horizontalFluid {
|
|
42
|
+
display: flex;
|
|
43
|
+
align-items: flex-start;
|
|
44
|
+
gap: spaceMedium;
|
|
45
|
+
flex-wrap: wrap;
|
|
46
|
+
width: sizeFluid;
|
|
47
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
Object.defineProperty(exports, "Checkbox", {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: function () {
|
|
9
|
+
return _Checkbox.Checkbox;
|
|
10
|
+
}
|
|
11
|
+
});
|
|
12
|
+
Object.defineProperty(exports, "CheckboxGroup", {
|
|
13
|
+
enumerable: true,
|
|
14
|
+
get: function () {
|
|
15
|
+
return _CheckboxGroup.CheckboxGroup;
|
|
16
|
+
}
|
|
17
|
+
});
|
|
18
|
+
var _Checkbox = require("./Checkbox.js");
|
|
19
|
+
var _CheckboxGroup = require("./CheckboxGroup.js");
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.CircularLoader = void 0;
|
|
7
|
+
var React = _interopRequireWildcard(require("react"));
|
|
8
|
+
var COLORS = _interopRequireWildcard(require("../../styles/variables/_color.js"));
|
|
9
|
+
var _classify = _interopRequireDefault(require("../../utils/classify"));
|
|
10
|
+
var _CircularLoaderModule = _interopRequireDefault(require("./CircularLoader.module.css"));
|
|
11
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
12
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
13
|
+
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
14
|
+
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
15
|
+
|
|
16
|
+
const CircularLoader = _ref => {
|
|
17
|
+
let {
|
|
18
|
+
size = 'medium',
|
|
19
|
+
className,
|
|
20
|
+
colorToken = 'colorFillPrimary'
|
|
21
|
+
} = _ref;
|
|
22
|
+
return /*#__PURE__*/(0, _jsxRuntime.js)("div", {
|
|
23
|
+
className: (0, _classify.default)(_CircularLoaderModule.default.container, {
|
|
24
|
+
[_CircularLoaderModule.default.mediumContainer]: size === 'medium',
|
|
25
|
+
[_CircularLoaderModule.default.smallContainer]: size === 'small'
|
|
26
|
+
}, className),
|
|
27
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jss)("div", {
|
|
28
|
+
className: _CircularLoaderModule.default.spinLoader,
|
|
29
|
+
"aria-hidden": "true",
|
|
30
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.js)("div", {
|
|
31
|
+
className: _CircularLoaderModule.default.outerCircle,
|
|
32
|
+
style: {
|
|
33
|
+
'--color': COLORS[colorToken]
|
|
34
|
+
}
|
|
35
|
+
}), /*#__PURE__*/(0, _jsxRuntime.js)("div", {
|
|
36
|
+
className: _CircularLoaderModule.default.ellipse,
|
|
37
|
+
style: {
|
|
38
|
+
'--color': COLORS[colorToken]
|
|
39
|
+
}
|
|
40
|
+
})]
|
|
41
|
+
})
|
|
42
|
+
});
|
|
43
|
+
};
|
|
44
|
+
exports.CircularLoader = CircularLoader;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
// @flow strict
|
|
2
|
+
|
|
3
|
+
import * as React from 'react';
|
|
4
|
+
|
|
5
|
+
import * as COLORS from '../../styles/variables/_color.js';
|
|
6
|
+
import classify from '../../utils/classify';
|
|
7
|
+
|
|
8
|
+
import css from './CircularLoader.module.css';
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
export type CircularLoaderProps = {
|
|
12
|
+
size?: 'large' | 'medium' | 'small',
|
|
13
|
+
className?: string,
|
|
14
|
+
// TODO: update it to permissible colors
|
|
15
|
+
colorToken?: $Keys<typeof COLORS>,
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
export const CircularLoader = ({
|
|
19
|
+
size = 'medium',
|
|
20
|
+
className,
|
|
21
|
+
colorToken = 'colorFillPrimary',
|
|
22
|
+
}: CircularLoaderProps): React.Node => (
|
|
23
|
+
<div
|
|
24
|
+
className={classify(
|
|
25
|
+
css.container,
|
|
26
|
+
{
|
|
27
|
+
[css.mediumContainer]: size === 'medium',
|
|
28
|
+
[css.smallContainer]: size === 'small',
|
|
29
|
+
},
|
|
30
|
+
className,
|
|
31
|
+
)}
|
|
32
|
+
>
|
|
33
|
+
<div className={css.spinLoader} aria-hidden="true">
|
|
34
|
+
<div
|
|
35
|
+
className={css.outerCircle}
|
|
36
|
+
style={{'--color': COLORS[colorToken]}}
|
|
37
|
+
></div>
|
|
38
|
+
<div
|
|
39
|
+
className={css.ellipse}
|
|
40
|
+
style={{'--color': COLORS[colorToken]}}
|
|
41
|
+
></div>
|
|
42
|
+
</div>
|
|
43
|
+
</div>
|
|
44
|
+
);
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
@value (colorFillPrimary, colorBackgroundTertiary, colorFillNone) from '../../styles/variables/_color.css';
|
|
2
|
+
@value (
|
|
3
|
+
spaceNone
|
|
4
|
+
) from '../../styles/variables/_space.css';
|
|
5
|
+
|
|
6
|
+
@value (
|
|
7
|
+
size5,
|
|
8
|
+
size60
|
|
9
|
+
) from '../../styles/variables/_size.css';
|
|
10
|
+
|
|
11
|
+
@value (
|
|
12
|
+
motionDurationSlowest
|
|
13
|
+
) from '../../styles/variables/_motion.css';
|
|
14
|
+
|
|
15
|
+
@value spinnerSize: size60;
|
|
16
|
+
@value spinnerThickness: size5;
|
|
17
|
+
|
|
18
|
+
@value innerCircleSize: calc(spinnerSize - 2 * spinnerThickness);
|
|
19
|
+
|
|
20
|
+
@value innerMaskGradient: radial-gradient(farthest-side, colorFillNone calc(99% - spinnerThickness), colorFillPrimary calc(100% - spinnerThickness));
|
|
21
|
+
|
|
22
|
+
.container {
|
|
23
|
+
display: flex;
|
|
24
|
+
justify-content: flex-start;
|
|
25
|
+
align-items: flex-start;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
.mediumContainer {
|
|
29
|
+
transform: scale(0.5);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
.smallContainer {
|
|
33
|
+
transform: scale(0.36);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
.spinLoader {
|
|
37
|
+
height: spinnerSize;
|
|
38
|
+
width: spinnerSize;
|
|
39
|
+
display: block;
|
|
40
|
+
position: relative;
|
|
41
|
+
animation: spin motionDurationSlowest linear 0s infinite normal;
|
|
42
|
+
background: transparent;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
.outerCircle {
|
|
46
|
+
--color: colorFillPrimary;
|
|
47
|
+
display: block;
|
|
48
|
+
position: absolute;
|
|
49
|
+
border-radius: calc(spinnerSize/2);
|
|
50
|
+
height: spinnerSize;
|
|
51
|
+
width: spinnerSize;
|
|
52
|
+
top: spaceNone;
|
|
53
|
+
right: spaceNone;
|
|
54
|
+
background: conic-gradient(
|
|
55
|
+
from 90deg at 50% 50%,
|
|
56
|
+
colorFillNone 1deg,
|
|
57
|
+
var(--color) 360deg
|
|
58
|
+
);
|
|
59
|
+
-webkit-mask: innerMaskGradient;
|
|
60
|
+
mask: innerMaskGradient;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
.ellipse {
|
|
64
|
+
--color: colorFillPrimary;
|
|
65
|
+
position: absolute;
|
|
66
|
+
left: calc(spinnerSize - spinnerThickness);
|
|
67
|
+
right: spaceNone;
|
|
68
|
+
top: spaceNone;
|
|
69
|
+
bottom: spaceNone;
|
|
70
|
+
border-radius: calc(spinnerThickness/2);
|
|
71
|
+
height: spinnerThickness;
|
|
72
|
+
width: spinnerThickness;
|
|
73
|
+
margin: auto;
|
|
74
|
+
background: var(--color);
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
@keyframes spin {
|
|
78
|
+
to {
|
|
79
|
+
transform: rotate(360deg);
|
|
80
|
+
}
|
|
81
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
Object.defineProperty(exports, "CircularLoader", {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: function () {
|
|
9
|
+
return _CircularLoader.CircularLoader;
|
|
10
|
+
}
|
|
11
|
+
});
|
|
12
|
+
var _CircularLoader = require("./CircularLoader");
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.CodeBlock = void 0;
|
|
7
|
+
var React = _interopRequireWildcard(require("react"));
|
|
8
|
+
var _reactCodeBlocks = require("react-code-blocks");
|
|
9
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
10
|
+
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
11
|
+
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
12
|
+
|
|
13
|
+
// $FlowFixMe[untyped-import]
|
|
14
|
+
|
|
15
|
+
const CodeBlock = _ref => {
|
|
16
|
+
let {
|
|
17
|
+
children,
|
|
18
|
+
...props
|
|
19
|
+
} = _ref;
|
|
20
|
+
return /*#__PURE__*/(0, _jsxRuntime.js)(_reactCodeBlocks.CodeBlock, {
|
|
21
|
+
text: children,
|
|
22
|
+
showLineNumbers: false,
|
|
23
|
+
...props
|
|
24
|
+
});
|
|
25
|
+
};
|
|
26
|
+
exports.CodeBlock = CodeBlock;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
// @flow strict
|
|
2
|
+
|
|
3
|
+
import * as React from 'react';
|
|
4
|
+
// $FlowFixMe[untyped-import]
|
|
5
|
+
import {CodeBlock as ReactCodeBlock} from 'react-code-blocks';
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
type CodeBlockProps = {
|
|
9
|
+
children?: React.Node,
|
|
10
|
+
language?: string,
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
export const CodeBlock = ({children, ...props}: CodeBlockProps): React.Node => (
|
|
14
|
+
<ReactCodeBlock
|
|
15
|
+
text={children}
|
|
16
|
+
showLineNumbers={false}
|
|
17
|
+
{...props}
|
|
18
|
+
></ReactCodeBlock>
|
|
19
|
+
);
|
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.DialogHeader = exports.DialogFooter = exports.DialogBody = exports.Dialog = exports.DIALOG_SEMANTIC = void 0;
|
|
7
|
+
var React = _interopRequireWildcard(require("react"));
|
|
8
|
+
var _typography = require("../../types/typography");
|
|
9
|
+
var _classify = _interopRequireDefault(require("../../utils/classify"));
|
|
10
|
+
var _Icon = require("../Icon");
|
|
11
|
+
var _Modal = require("../Modal");
|
|
12
|
+
var _DialogModule = _interopRequireDefault(require("./Dialog.module.css"));
|
|
13
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
14
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
15
|
+
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
16
|
+
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
17
|
+
|
|
18
|
+
const DIALOG_SEMANTIC = Object.freeze({
|
|
19
|
+
neutral: 'neutral',
|
|
20
|
+
success: 'success',
|
|
21
|
+
information: 'information',
|
|
22
|
+
warning: 'warning',
|
|
23
|
+
danger: 'danger'
|
|
24
|
+
});
|
|
25
|
+
exports.DIALOG_SEMANTIC = DIALOG_SEMANTIC;
|
|
26
|
+
const DialogIcon = _ref => {
|
|
27
|
+
let {
|
|
28
|
+
semantic,
|
|
29
|
+
iconName
|
|
30
|
+
} = _ref;
|
|
31
|
+
switch (semantic) {
|
|
32
|
+
case DIALOG_SEMANTIC.neutral:
|
|
33
|
+
return /*#__PURE__*/(0, _jsxRuntime.js)(_Icon.Icon, {
|
|
34
|
+
color: _typography.TEXT_COLORS.neutral,
|
|
35
|
+
name: iconName ? iconName : 'face-smile',
|
|
36
|
+
type: "solid"
|
|
37
|
+
});
|
|
38
|
+
case DIALOG_SEMANTIC.success:
|
|
39
|
+
return /*#__PURE__*/(0, _jsxRuntime.js)(_Icon.Icon, {
|
|
40
|
+
name: "circle-check",
|
|
41
|
+
color: _typography.TEXT_COLORS.success,
|
|
42
|
+
type: "solid"
|
|
43
|
+
});
|
|
44
|
+
case DIALOG_SEMANTIC.information:
|
|
45
|
+
return /*#__PURE__*/(0, _jsxRuntime.js)(_Icon.Icon, {
|
|
46
|
+
name: "circle-info",
|
|
47
|
+
color: _typography.TEXT_COLORS.information,
|
|
48
|
+
type: "solid"
|
|
49
|
+
});
|
|
50
|
+
case DIALOG_SEMANTIC.warning:
|
|
51
|
+
return /*#__PURE__*/(0, _jsxRuntime.js)(_Icon.Icon, {
|
|
52
|
+
name: "circle-exclamation",
|
|
53
|
+
color: _typography.TEXT_COLORS.warning,
|
|
54
|
+
type: "solid"
|
|
55
|
+
});
|
|
56
|
+
case DIALOG_SEMANTIC.danger:
|
|
57
|
+
return /*#__PURE__*/(0, _jsxRuntime.js)(_Icon.Icon, {
|
|
58
|
+
name: "shield-exclamation",
|
|
59
|
+
color: _typography.TEXT_COLORS.danger,
|
|
60
|
+
type: "solid"
|
|
61
|
+
});
|
|
62
|
+
default:
|
|
63
|
+
return /*#__PURE__*/(0, _jsxRuntime.js)(_Icon.Icon, {
|
|
64
|
+
color: _typography.TEXT_COLORS.neutral,
|
|
65
|
+
name: "face-smile",
|
|
66
|
+
type: "solid"
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
};
|
|
70
|
+
const DialogHeader = _ref2 => {
|
|
71
|
+
let {
|
|
72
|
+
children
|
|
73
|
+
} = _ref2;
|
|
74
|
+
return /*#__PURE__*/(0, _jsxRuntime.js)(_jsxRuntime.Fragment, {
|
|
75
|
+
children: React.Children.count(children) > 0 && /*#__PURE__*/(0, _jsxRuntime.js)("div", {
|
|
76
|
+
className: _DialogModule.default.dialogHeader,
|
|
77
|
+
children: /*#__PURE__*/(0, _jsxRuntime.js)("div", {
|
|
78
|
+
className: _DialogModule.default.headerContent,
|
|
79
|
+
children: children
|
|
80
|
+
})
|
|
81
|
+
})
|
|
82
|
+
});
|
|
83
|
+
};
|
|
84
|
+
exports.DialogHeader = DialogHeader;
|
|
85
|
+
const DialogBody = _ref3 => {
|
|
86
|
+
let {
|
|
87
|
+
children
|
|
88
|
+
} = _ref3;
|
|
89
|
+
return /*#__PURE__*/(0, _jsxRuntime.js)("div", {
|
|
90
|
+
className: _DialogModule.default.dialogBody,
|
|
91
|
+
children: children
|
|
92
|
+
});
|
|
93
|
+
};
|
|
94
|
+
exports.DialogBody = DialogBody;
|
|
95
|
+
const DialogFooter = _ref4 => {
|
|
96
|
+
let {
|
|
97
|
+
children
|
|
98
|
+
} = _ref4;
|
|
99
|
+
return /*#__PURE__*/(0, _jsxRuntime.js)(_jsxRuntime.Fragment, {
|
|
100
|
+
children: React.Children.count(children) > 0 && /*#__PURE__*/(0, _jsxRuntime.js)("div", {
|
|
101
|
+
className: _DialogModule.default.dialogFooter,
|
|
102
|
+
children: /*#__PURE__*/(0, _jsxRuntime.js)("div", {
|
|
103
|
+
className: _DialogModule.default.dialogFooterActions,
|
|
104
|
+
children: children
|
|
105
|
+
})
|
|
106
|
+
})
|
|
107
|
+
});
|
|
108
|
+
};
|
|
109
|
+
exports.DialogFooter = DialogFooter;
|
|
110
|
+
const Dialog = _ref5 => {
|
|
111
|
+
let {
|
|
112
|
+
children,
|
|
113
|
+
isOpen = false,
|
|
114
|
+
showBackdrop = true,
|
|
115
|
+
onClose,
|
|
116
|
+
tapOutsideToClose = false,
|
|
117
|
+
iconName = '',
|
|
118
|
+
semantic = 'neutral',
|
|
119
|
+
...restDialogProps
|
|
120
|
+
} = _ref5;
|
|
121
|
+
return /*#__PURE__*/(0, _jsxRuntime.jss)(_Modal.Modal, {
|
|
122
|
+
isOpen: isOpen,
|
|
123
|
+
onClose: onClose,
|
|
124
|
+
showBackdrop: showBackdrop,
|
|
125
|
+
tapOutsideToClose: tapOutsideToClose,
|
|
126
|
+
...restDialogProps,
|
|
127
|
+
classNames: {
|
|
128
|
+
content: (0, _classify.default)(_DialogModule.default.dialog)
|
|
129
|
+
},
|
|
130
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.js)("div", {
|
|
131
|
+
className: _DialogModule.default.topBlock,
|
|
132
|
+
children: /*#__PURE__*/(0, _jsxRuntime.js)("div", {
|
|
133
|
+
className: (0, _classify.default)(_DialogModule.default.iconContainer, {
|
|
134
|
+
[_DialogModule.default.neutral]: semantic === DIALOG_SEMANTIC.neutral,
|
|
135
|
+
[_DialogModule.default.success]: semantic === DIALOG_SEMANTIC.success,
|
|
136
|
+
[_DialogModule.default.information]: semantic === DIALOG_SEMANTIC.information,
|
|
137
|
+
[_DialogModule.default.warning]: semantic === DIALOG_SEMANTIC.warning,
|
|
138
|
+
[_DialogModule.default.danger]: semantic === DIALOG_SEMANTIC.danger
|
|
139
|
+
}),
|
|
140
|
+
children: /*#__PURE__*/(0, _jsxRuntime.js)(DialogIcon, {
|
|
141
|
+
semantic: semantic,
|
|
142
|
+
iconName: iconName
|
|
143
|
+
})
|
|
144
|
+
})
|
|
145
|
+
}), children]
|
|
146
|
+
});
|
|
147
|
+
};
|
|
148
|
+
exports.Dialog = Dialog;
|