@openfin/ui-library 0.1.0 → 0.1.2-alpha.1616610135
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 +7 -3
- package/package.json +3 -1
- package/dist/components/controls/Button/button.d.ts +0 -37
- package/dist/components/controls/Button/button.js +0 -95
- package/dist/components/controls/Button/button.variants.d.ts +0 -64
- package/dist/components/controls/Button/button.variants.js +0 -88
- package/dist/components/controls/Button/index.d.ts +0 -2
- package/dist/components/controls/Button/index.js +0 -14
- package/dist/components/controls/Toggle/index.d.ts +0 -1
- package/dist/components/controls/Toggle/index.js +0 -13
- package/dist/components/controls/Toggle/toggle.d.ts +0 -9
- package/dist/components/controls/Toggle/toggle.js +0 -94
- package/dist/components/elements/Badge/badge.d.ts +0 -17
- package/dist/components/elements/Badge/badge.js +0 -41
- package/dist/components/elements/Badge/index.d.ts +0 -1
- package/dist/components/elements/Badge/index.js +0 -13
- package/dist/components/elements/Icon/icon.d.ts +0 -15
- package/dist/components/elements/Icon/icon.js +0 -56
- package/dist/components/elements/Icon/icon.variants.d.ts +0 -28
- package/dist/components/elements/Icon/icon.variants.js +0 -60
- package/dist/components/elements/Icon/index.d.ts +0 -1
- package/dist/components/elements/Icon/index.js +0 -13
- package/dist/components/input/Input/index.d.ts +0 -1
- package/dist/components/input/Input/index.js +0 -13
- package/dist/components/input/Input/input.d.ts +0 -6
- package/dist/components/input/Input/input.js +0 -12
- package/dist/components/input/TextInput/index.d.ts +0 -1
- package/dist/components/input/TextInput/index.js +0 -13
- package/dist/components/input/TextInput/textInput.d.ts +0 -3
- package/dist/components/input/TextInput/textInput.js +0 -30
- package/dist/components/layout/Box/box.d.ts +0 -41
- package/dist/components/layout/Box/box.js +0 -44
- package/dist/components/layout/Box/index.d.ts +0 -1
- package/dist/components/layout/Box/index.js +0 -13
- package/dist/components/layout/Box/types.d.ts +0 -7
- package/dist/components/layout/Box/types.js +0 -2
- package/dist/components/system/GlobalStyles/globalStyles.d.ts +0 -1
- package/dist/components/system/GlobalStyles/globalStyles.js +0 -54
- package/dist/components/system/GlobalStyles/index.d.ts +0 -1
- package/dist/components/system/GlobalStyles/index.js +0 -13
- package/dist/components/system/ThemeProvider/index.d.ts +0 -6
- package/dist/components/system/ThemeProvider/index.js +0 -18
- package/dist/components/system/ThemeProvider/lib/config.d.ts +0 -7
- package/dist/components/system/ThemeProvider/lib/config.js +0 -9
- package/dist/components/system/ThemeProvider/lib/constants.d.ts +0 -525
- package/dist/components/system/ThemeProvider/lib/constants.js +0 -269
- package/dist/components/system/ThemeProvider/lib/font-face-base64.d.ts +0 -2
- package/dist/components/system/ThemeProvider/lib/font-face-base64.js +0 -71
- package/dist/components/system/ThemeProvider/lib/font-face-cdn.d.ts +0 -2
- package/dist/components/system/ThemeProvider/lib/font-face-cdn.js +0 -48
- package/dist/components/system/ThemeProvider/lib/helpers.d.ts +0 -19
- package/dist/components/system/ThemeProvider/lib/helpers.js +0 -31
- package/dist/components/system/ThemeProvider/lib/interface.d.ts +0 -25
- package/dist/components/system/ThemeProvider/lib/interface.js +0 -2
- package/dist/components/system/ThemeProvider/lib/palette.d.ts +0 -25
- package/dist/components/system/ThemeProvider/lib/palette.js +0 -28
- package/dist/components/system/ThemeProvider/lib/types.d.ts +0 -49
- package/dist/components/system/ThemeProvider/lib/types.js +0 -2
- package/dist/components/system/ThemeProvider/themeProvider.d.ts +0 -20
- package/dist/components/system/ThemeProvider/themeProvider.js +0 -20
- package/dist/components/system/ThemeProvider/themes/index.d.ts +0 -1
- package/dist/components/system/ThemeProvider/themes/index.js +0 -13
- package/dist/components/system/ThemeProvider/themes/openfin.d.ts +0 -9
- package/dist/components/system/ThemeProvider/themes/openfin.js +0 -52
- package/dist/components/typography/Heading/heading.d.ts +0 -1608
- package/dist/components/typography/Heading/heading.js +0 -64
- package/dist/components/typography/Heading/index.d.ts +0 -1
- package/dist/components/typography/Heading/index.js +0 -13
- package/dist/components/typography/Text/index.d.ts +0 -1
- package/dist/components/typography/Text/index.js +0 -13
- package/dist/components/typography/Text/text.d.ts +0 -19
- package/dist/components/typography/Text/text.js +0 -21
- package/dist/hooks/useColorScheme.d.ts +0 -12
- package/dist/hooks/useColorScheme.js +0 -33
- package/dist/hooks/useMediaQuery.d.ts +0 -12
- package/dist/hooks/useMediaQuery.js +0 -39
- package/dist/hooks/useTheme.d.ts +0 -9
- package/dist/hooks/useTheme.js +0 -32
- package/dist/index.d.ts +0 -13
- package/dist/index.js +0 -38
- package/dist/react-app-env.d.js +0 -2
- package/dist/storybookHelpers.d.ts +0 -84
- package/dist/storybookHelpers.js +0 -55
package/README.md
CHANGED
|
@@ -90,11 +90,11 @@ $ yarn storybook
|
|
|
90
90
|
|
|
91
91
|
Great for a quick look at the latest build, [check it out](https://openfin-ui.netlify.com)
|
|
92
92
|
|
|
93
|
-
## Codesandbox.io
|
|
93
|
+
## UI Lib @ Codesandbox.io
|
|
94
94
|
|
|
95
|
-
|
|
95
|
+
Great for developer experimentation without all of the overhead.
|
|
96
96
|
|
|
97
|
-
|
|
97
|
+
The sandbox is currently **private**, request access and [give it a try](https://codesandbox.io/s/openfin-ui-library-39y7c).
|
|
98
98
|
|
|
99
99
|
## How to test
|
|
100
100
|
|
|
@@ -182,6 +182,10 @@ This triggers a Github Action to automatically build the latest version of the `
|
|
|
182
182
|
|
|
183
183
|
- [Box](./src/components/layout/Box)
|
|
184
184
|
|
|
185
|
+
### List
|
|
186
|
+
|
|
187
|
+
- [DefinitionList](./src/components/list/DefinitionList)
|
|
188
|
+
|
|
185
189
|
### System
|
|
186
190
|
|
|
187
191
|
- [GlobalStyles](./src/components/system/GlobalStyles)
|
package/package.json
CHANGED
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@openfin/ui-library",
|
|
3
3
|
"description": "OpenFin UI Component Library",
|
|
4
|
-
"version": "0.1.
|
|
4
|
+
"version": "0.1.2-alpha.1616610135",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
7
|
+
"repository": "github:openfin/ui-library",
|
|
8
|
+
"homepage": "https://openfin-ui.netlify.app",
|
|
7
9
|
"files": [
|
|
8
10
|
"dist/**/*"
|
|
9
11
|
],
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
import { ButtonHTMLAttributes, FC, ReactNode } from 'react';
|
|
2
|
-
import { ButtonShape, ButtonSize, ButtonKind, ButtonLayout } from './button.variants';
|
|
3
|
-
declare type ButtonPropsWithLabel = {
|
|
4
|
-
label: string;
|
|
5
|
-
children?: never;
|
|
6
|
-
};
|
|
7
|
-
declare type ButtonPropsWithChildren = {
|
|
8
|
-
label?: never;
|
|
9
|
-
children: ReactNode;
|
|
10
|
-
};
|
|
11
|
-
export declare type ButtonProps = ButtonHTMLAttributes<HTMLButtonElement> & (ButtonPropsWithLabel | ButtonPropsWithChildren) & {
|
|
12
|
-
label?: string;
|
|
13
|
-
href?: string;
|
|
14
|
-
size?: keyof typeof ButtonSize;
|
|
15
|
-
shape?: keyof typeof ButtonShape;
|
|
16
|
-
kind?: keyof typeof ButtonKind;
|
|
17
|
-
layout?: keyof typeof ButtonLayout;
|
|
18
|
-
children?: ReactNode;
|
|
19
|
-
};
|
|
20
|
-
/**
|
|
21
|
-
* Button as Anchor
|
|
22
|
-
* @example <Button as="a" href="https://..."/>
|
|
23
|
-
*
|
|
24
|
-
* Button with Label
|
|
25
|
-
* @example <Button label="..."/>
|
|
26
|
-
*
|
|
27
|
-
* Button with Child Element
|
|
28
|
-
* @example <Button><Child></Button>
|
|
29
|
-
*/
|
|
30
|
-
export declare const Button: FC<ButtonProps>;
|
|
31
|
-
/**
|
|
32
|
-
* ## Button Variants
|
|
33
|
-
*/
|
|
34
|
-
export declare const ButtonPrimary: FC<ButtonProps>;
|
|
35
|
-
export declare const ButtonSecondary: FC<ButtonProps>;
|
|
36
|
-
export declare const ButtonTertiary: FC<ButtonProps>;
|
|
37
|
-
export {};
|
|
@@ -1,95 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __rest = (this && this.__rest) || function (s, e) {
|
|
3
|
-
var t = {};
|
|
4
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
5
|
-
t[p] = s[p];
|
|
6
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
7
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
8
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
9
|
-
t[p[i]] = s[p[i]];
|
|
10
|
-
}
|
|
11
|
-
return t;
|
|
12
|
-
};
|
|
13
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
14
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
15
|
-
};
|
|
16
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
exports.ButtonTertiary = exports.ButtonSecondary = exports.ButtonPrimary = exports.Button = void 0;
|
|
18
|
-
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
19
|
-
const styled_components_1 = __importDefault(require("styled-components"));
|
|
20
|
-
const Box_1 = require("../../layout/Box");
|
|
21
|
-
const helpers_1 = require("../../system/ThemeProvider/lib/helpers");
|
|
22
|
-
const button_variants_1 = require("./button.variants");
|
|
23
|
-
/**
|
|
24
|
-
* Button as Anchor
|
|
25
|
-
* @example <Button as="a" href="https://..."/>
|
|
26
|
-
*
|
|
27
|
-
* Button with Label
|
|
28
|
-
* @example <Button label="..."/>
|
|
29
|
-
*
|
|
30
|
-
* Button with Child Element
|
|
31
|
-
* @example <Button><Child></Button>
|
|
32
|
-
*/
|
|
33
|
-
const Button = (_a) => {
|
|
34
|
-
var { label, children, size = 'base', shape = 'square', kind = 'primary', layout = 'fit', href } = _a, buttonProps = __rest(_a, ["label", "children", "size", "shape", "kind", "layout", "href"]);
|
|
35
|
-
return (jsx_runtime_1.jsx(ButtonElement, Object.assign({ as: href ? 'a' : 'button', size: size, shape: shape, kind: kind, layout: layout }, buttonProps, { children: label ? jsx_runtime_1.jsx(ButtonLabel, { children: label }, void 0) : children }), void 0));
|
|
36
|
-
};
|
|
37
|
-
exports.Button = Button;
|
|
38
|
-
const ButtonElement = styled_components_1.default.button `
|
|
39
|
-
/**
|
|
40
|
-
* 1. Initialize local variables with reasonable defaults
|
|
41
|
-
*/
|
|
42
|
-
--color-background: ${({ theme }) => theme.palette.inputBg};
|
|
43
|
-
--color-foreground: ${({ theme }) => theme.palette.inputColor};
|
|
44
|
-
|
|
45
|
-
&:disabled {
|
|
46
|
-
--color-background: ${({ theme }) => theme.palette.inputDisabled};
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
/**
|
|
50
|
-
* 2. Inject variants -- ? What are Variants
|
|
51
|
-
*/
|
|
52
|
-
${helpers_1.getVariantCSS(button_variants_1.variants, button_variants_1.Variant.size)}
|
|
53
|
-
${helpers_1.getVariantCSS(button_variants_1.variants, button_variants_1.Variant.shape)}
|
|
54
|
-
${helpers_1.getVariantCSS(button_variants_1.variants, button_variants_1.Variant.kind)}
|
|
55
|
-
${helpers_1.getVariantCSS(button_variants_1.variants, button_variants_1.Variant.layout)}
|
|
56
|
-
|
|
57
|
-
/**
|
|
58
|
-
* 3. Component Build
|
|
59
|
-
*/
|
|
60
|
-
background: var(--color-background);
|
|
61
|
-
color: var(--color-foreground);
|
|
62
|
-
|
|
63
|
-
display: inline-flex;
|
|
64
|
-
border: none;
|
|
65
|
-
outline: none;
|
|
66
|
-
text-decoration: none;
|
|
67
|
-
white-space: nowrap;
|
|
68
|
-
line-height: ${({ theme }) => theme.lineHeight.ui};
|
|
69
|
-
font-weight: ${({ theme }) => theme.fontWeight.bold};
|
|
70
|
-
|
|
71
|
-
&:focus,
|
|
72
|
-
&:active {
|
|
73
|
-
box-shadow: 0 0 0 2px ${({ theme }) => theme._color.black30},
|
|
74
|
-
0 0 0 2px var(--color-background);
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
&:not(:disabled) {
|
|
78
|
-
cursor: pointer;
|
|
79
|
-
}
|
|
80
|
-
`;
|
|
81
|
-
const ButtonLabel = styled_components_1.default(Box_1.Box).attrs({
|
|
82
|
-
alignItems: 'center',
|
|
83
|
-
justifyContent: 'center',
|
|
84
|
-
}) `
|
|
85
|
-
padding: ${({ theme }) => `0 ${theme.px.xsmall}`};
|
|
86
|
-
`;
|
|
87
|
-
/**
|
|
88
|
-
* ## Button Variants
|
|
89
|
-
*/
|
|
90
|
-
const ButtonPrimary = (props) => (jsx_runtime_1.jsx(exports.Button, Object.assign({}, props, { kind: "primary" }), void 0));
|
|
91
|
-
exports.ButtonPrimary = ButtonPrimary;
|
|
92
|
-
const ButtonSecondary = (props) => (jsx_runtime_1.jsx(exports.Button, Object.assign({}, props, { kind: "secondary" }), void 0));
|
|
93
|
-
exports.ButtonSecondary = ButtonSecondary;
|
|
94
|
-
const ButtonTertiary = (props) => (jsx_runtime_1.jsx(exports.Button, Object.assign({}, props, { kind: "textOnly" }), void 0));
|
|
95
|
-
exports.ButtonTertiary = ButtonTertiary;
|
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Define all Button Variants here in one place.
|
|
3
|
-
* Variants should match the variants in Figma
|
|
4
|
-
*/
|
|
5
|
-
export declare const Variant: {
|
|
6
|
-
readonly shape: "shape";
|
|
7
|
-
readonly size: "size";
|
|
8
|
-
readonly kind: "kind";
|
|
9
|
-
readonly layout: "layout";
|
|
10
|
-
};
|
|
11
|
-
/**
|
|
12
|
-
* Button Type -- Describes the "role" of a button
|
|
13
|
-
*/
|
|
14
|
-
export declare const ButtonKind: {
|
|
15
|
-
readonly primary: "primary";
|
|
16
|
-
readonly secondary: "secondary";
|
|
17
|
-
readonly textOnly: "textOnly";
|
|
18
|
-
};
|
|
19
|
-
export declare type ButtonKindType = keyof typeof ButtonKind;
|
|
20
|
-
/**
|
|
21
|
-
* Button Size
|
|
22
|
-
*/
|
|
23
|
-
export declare const ButtonSize: {
|
|
24
|
-
readonly small: "small";
|
|
25
|
-
readonly base: "base";
|
|
26
|
-
readonly large: "large";
|
|
27
|
-
};
|
|
28
|
-
export declare type ButtonSizeType = keyof typeof ButtonSize;
|
|
29
|
-
/**
|
|
30
|
-
* Button Width
|
|
31
|
-
*/
|
|
32
|
-
export declare const ButtonLayout: {
|
|
33
|
-
readonly fit: "fit";
|
|
34
|
-
readonly full: "full";
|
|
35
|
-
};
|
|
36
|
-
export declare type ButtonLayoutType = keyof typeof ButtonLayout;
|
|
37
|
-
/**
|
|
38
|
-
* Button Shape
|
|
39
|
-
*/
|
|
40
|
-
export declare const ButtonShape: {
|
|
41
|
-
readonly square: "square";
|
|
42
|
-
readonly pill: "pill";
|
|
43
|
-
};
|
|
44
|
-
export declare type ButtonShapeType = keyof typeof ButtonShape;
|
|
45
|
-
export declare const variants: {
|
|
46
|
-
readonly size: {
|
|
47
|
-
readonly base: import("styled-components").FlattenInterpolation<import("styled-components").ThemeProps<import("styled-components").DefaultTheme>>;
|
|
48
|
-
readonly small: import("styled-components").FlattenInterpolation<import("styled-components").ThemeProps<import("styled-components").DefaultTheme>>;
|
|
49
|
-
readonly large: import("styled-components").FlattenInterpolation<import("styled-components").ThemeProps<import("styled-components").DefaultTheme>>;
|
|
50
|
-
};
|
|
51
|
-
readonly shape: {
|
|
52
|
-
readonly square: import("styled-components").FlattenInterpolation<import("styled-components").ThemeProps<import("styled-components").DefaultTheme>>;
|
|
53
|
-
readonly pill: import("styled-components").FlattenInterpolation<import("styled-components").ThemeProps<import("styled-components").DefaultTheme>>;
|
|
54
|
-
};
|
|
55
|
-
readonly layout: {
|
|
56
|
-
readonly fit: import("styled-components").FlattenSimpleInterpolation;
|
|
57
|
-
readonly full: import("styled-components").FlattenSimpleInterpolation;
|
|
58
|
-
};
|
|
59
|
-
readonly kind: {
|
|
60
|
-
readonly primary: import("styled-components").FlattenInterpolation<import("styled-components").ThemeProps<import("styled-components").DefaultTheme>>;
|
|
61
|
-
readonly secondary: import("styled-components").FlattenInterpolation<import("styled-components").ThemeProps<import("styled-components").DefaultTheme>>;
|
|
62
|
-
readonly textOnly: import("styled-components").FlattenInterpolation<import("styled-components").ThemeProps<import("styled-components").DefaultTheme>>;
|
|
63
|
-
};
|
|
64
|
-
};
|
|
@@ -1,88 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.variants = exports.ButtonShape = exports.ButtonLayout = exports.ButtonSize = exports.ButtonKind = exports.Variant = void 0;
|
|
4
|
-
const styled_components_1 = require("styled-components");
|
|
5
|
-
/**
|
|
6
|
-
* Define all Button Variants here in one place.
|
|
7
|
-
* Variants should match the variants in Figma
|
|
8
|
-
*/
|
|
9
|
-
exports.Variant = {
|
|
10
|
-
shape: 'shape',
|
|
11
|
-
size: 'size',
|
|
12
|
-
kind: 'kind',
|
|
13
|
-
layout: 'layout',
|
|
14
|
-
};
|
|
15
|
-
/**
|
|
16
|
-
* Button Type -- Describes the "role" of a button
|
|
17
|
-
*/
|
|
18
|
-
exports.ButtonKind = {
|
|
19
|
-
primary: 'primary',
|
|
20
|
-
secondary: 'secondary',
|
|
21
|
-
textOnly: 'textOnly',
|
|
22
|
-
};
|
|
23
|
-
/**
|
|
24
|
-
* Button Size
|
|
25
|
-
*/
|
|
26
|
-
exports.ButtonSize = {
|
|
27
|
-
small: 'small',
|
|
28
|
-
base: 'base',
|
|
29
|
-
large: 'large',
|
|
30
|
-
};
|
|
31
|
-
/**
|
|
32
|
-
* Button Width
|
|
33
|
-
*/
|
|
34
|
-
exports.ButtonLayout = {
|
|
35
|
-
fit: 'fit',
|
|
36
|
-
full: 'full',
|
|
37
|
-
};
|
|
38
|
-
/**
|
|
39
|
-
* Button Shape
|
|
40
|
-
*/
|
|
41
|
-
exports.ButtonShape = {
|
|
42
|
-
square: 'square',
|
|
43
|
-
pill: 'pill',
|
|
44
|
-
};
|
|
45
|
-
exports.variants = {
|
|
46
|
-
[exports.Variant.size]: {
|
|
47
|
-
[exports.ButtonSize.base]: styled_components_1.css `
|
|
48
|
-
padding: ${({ theme }) => theme.px.large};
|
|
49
|
-
font-size: ${({ theme }) => theme.fontSize.xlarge};
|
|
50
|
-
`,
|
|
51
|
-
[exports.ButtonSize.small]: styled_components_1.css `
|
|
52
|
-
padding: ${({ theme }) => theme.px.small};
|
|
53
|
-
font-size: ${({ theme }) => theme.fontSize.base};
|
|
54
|
-
`,
|
|
55
|
-
[exports.ButtonSize.large]: styled_components_1.css `
|
|
56
|
-
padding: ${({ theme }) => theme.px.xlarge};
|
|
57
|
-
font-size: ${({ theme }) => theme.fontSize.xxxlarge};
|
|
58
|
-
`,
|
|
59
|
-
},
|
|
60
|
-
[exports.Variant.shape]: {
|
|
61
|
-
[exports.ButtonShape.square]: styled_components_1.css `
|
|
62
|
-
border-radius: ${({ theme }) => theme.radius.base};
|
|
63
|
-
`,
|
|
64
|
-
[exports.ButtonShape.pill]: styled_components_1.css `
|
|
65
|
-
border-radius: ${({ theme }) => theme.radius.pill};
|
|
66
|
-
`,
|
|
67
|
-
},
|
|
68
|
-
[exports.Variant.layout]: {
|
|
69
|
-
[exports.ButtonLayout.fit]: styled_components_1.css `
|
|
70
|
-
width: fit-content;
|
|
71
|
-
`,
|
|
72
|
-
[exports.ButtonLayout.full]: styled_components_1.css `
|
|
73
|
-
width: 100%;
|
|
74
|
-
`,
|
|
75
|
-
},
|
|
76
|
-
[exports.Variant.kind]: {
|
|
77
|
-
[exports.ButtonKind.primary]: styled_components_1.css `
|
|
78
|
-
--color-background: ${({ theme }) => theme.palette.brandPrimary};
|
|
79
|
-
`,
|
|
80
|
-
[exports.ButtonKind.secondary]: styled_components_1.css `
|
|
81
|
-
--color-background: ${({ theme }) => theme.palette.brandSecondary};
|
|
82
|
-
`,
|
|
83
|
-
[exports.ButtonKind.textOnly]: styled_components_1.css `
|
|
84
|
-
--color-background: transparent;
|
|
85
|
-
--color-foreground: ${({ theme }) => theme.palette.textDefault};
|
|
86
|
-
`,
|
|
87
|
-
},
|
|
88
|
-
};
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
5
|
-
}) : (function(o, m, k, k2) {
|
|
6
|
-
if (k2 === undefined) k2 = k;
|
|
7
|
-
o[k2] = m[k];
|
|
8
|
-
}));
|
|
9
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
10
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
11
|
-
};
|
|
12
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
|
-
__exportStar(require("./button"), exports);
|
|
14
|
-
__exportStar(require("./button.variants"), exports);
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './toggle';
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
5
|
-
}) : (function(o, m, k, k2) {
|
|
6
|
-
if (k2 === undefined) k2 = k;
|
|
7
|
-
o[k2] = m[k];
|
|
8
|
-
}));
|
|
9
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
10
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
11
|
-
};
|
|
12
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
|
-
__exportStar(require("./toggle"), exports);
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { FC, InputHTMLAttributes } from 'react';
|
|
2
|
-
export declare type LabelSideType = 'left' | 'right';
|
|
3
|
-
export declare type ToggleProps = InputHTMLAttributes<HTMLInputElement> & {
|
|
4
|
-
label?: string;
|
|
5
|
-
labelSide?: LabelSideType;
|
|
6
|
-
type?: 'checkbox' | 'radio';
|
|
7
|
-
onChange?: Function;
|
|
8
|
-
};
|
|
9
|
-
export declare const Toggle: FC<ToggleProps>;
|
|
@@ -1,94 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __rest = (this && this.__rest) || function (s, e) {
|
|
3
|
-
var t = {};
|
|
4
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
5
|
-
t[p] = s[p];
|
|
6
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
7
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
8
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
9
|
-
t[p[i]] = s[p[i]];
|
|
10
|
-
}
|
|
11
|
-
return t;
|
|
12
|
-
};
|
|
13
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
14
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
15
|
-
};
|
|
16
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
exports.Toggle = void 0;
|
|
18
|
-
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
19
|
-
const react_1 = require("react");
|
|
20
|
-
const styled_components_1 = __importDefault(require("styled-components"));
|
|
21
|
-
const Input_1 = require("../../input/Input");
|
|
22
|
-
const Box_1 = require("../../layout/Box");
|
|
23
|
-
const Toggle = (_a) => {
|
|
24
|
-
var { id, label, labelSide = 'right', type = 'checkbox', onChange = () => { } } = _a, inputProps = __rest(_a, ["id", "label", "labelSide", "type", "onChange"]);
|
|
25
|
-
const [isChecked, setIsChecked] = react_1.useState(inputProps.checked);
|
|
26
|
-
return (jsx_runtime_1.jsxs(ToggleContainer, Object.assign({ labelSide: labelSide }, { children: [label ? jsx_runtime_1.jsx(ToggleLabel, Object.assign({ htmlFor: id }, { children: label }), void 0) : undefined,
|
|
27
|
-
jsx_runtime_1.jsxs(InputContainer, Object.assign({ isChecked: isChecked }, { children: [jsx_runtime_1.jsx(ToggleInput, Object.assign({ id: id, type: type }, inputProps, { onChange: (event) => {
|
|
28
|
-
setIsChecked(event.target.checked);
|
|
29
|
-
onChange(event);
|
|
30
|
-
} }), void 0),
|
|
31
|
-
jsx_runtime_1.jsx(ToggleKnob, { tabIndex: -1 }, void 0)] }), void 0)] }), void 0));
|
|
32
|
-
};
|
|
33
|
-
exports.Toggle = Toggle;
|
|
34
|
-
const ToggleContainer = styled_components_1.default.div `
|
|
35
|
-
display: flex;
|
|
36
|
-
gap: ${({ theme }) => theme.px.xlarge};
|
|
37
|
-
flex-direction: ${({ labelSide }) => labelSide === 'right' ? 'row' : 'row-reverse'};
|
|
38
|
-
line-height: ${({ theme }) => theme.px.xlarge /* Matches height of Input to vertically center text */};
|
|
39
|
-
`;
|
|
40
|
-
const InputContainer = styled_components_1.default(Box_1.Box) `
|
|
41
|
-
--px-toggle: ${({ theme }) => theme.px.xlarge};
|
|
42
|
-
--px-knob: ${({ theme }) => theme.px.base};
|
|
43
|
-
|
|
44
|
-
position: relative;
|
|
45
|
-
height: var(--px-toggle);
|
|
46
|
-
width: calc(2 * var(--px-toggle));
|
|
47
|
-
border: 1px solid
|
|
48
|
-
${({ isChecked, theme }) => isChecked ? theme.palette.brandPrimary : theme.palette.inputBg};
|
|
49
|
-
border-radius: calc(0.5 * var(--px-toggle));
|
|
50
|
-
|
|
51
|
-
background: ${({ isChecked, theme }) => isChecked ? theme.palette.brandPrimary : theme.palette.inputBg};
|
|
52
|
-
transition: background var(--global-transition);
|
|
53
|
-
|
|
54
|
-
&:focus-within {
|
|
55
|
-
border-color: ${({ theme }) => theme.palette.inputFocused};
|
|
56
|
-
}
|
|
57
|
-
`;
|
|
58
|
-
const ToggleKnob = styled_components_1.default.button `
|
|
59
|
-
position: absolute;
|
|
60
|
-
width: var(--px-knob);
|
|
61
|
-
height: var(--px-knob);
|
|
62
|
-
top: 50%;
|
|
63
|
-
left: ${({ theme }) => theme.px.xsmall};
|
|
64
|
-
transform: translateY(-50%);
|
|
65
|
-
border-radius: 50%;
|
|
66
|
-
background: ${({ theme }) => theme.palette.inputColor};
|
|
67
|
-
border: none;
|
|
68
|
-
outline: none;
|
|
69
|
-
transition: left var(--global-transition);
|
|
70
|
-
pointer-events: none; /* Allow pass-thru for native input */
|
|
71
|
-
`;
|
|
72
|
-
const ToggleInput = styled_components_1.default(Input_1.Input) `
|
|
73
|
-
position: absolute;
|
|
74
|
-
top: 0;
|
|
75
|
-
left: 0;
|
|
76
|
-
width: 100%;
|
|
77
|
-
height: 100%;
|
|
78
|
-
opacity: 0;
|
|
79
|
-
border: none;
|
|
80
|
-
outline: none;
|
|
81
|
-
appearance: none;
|
|
82
|
-
display: block;
|
|
83
|
-
|
|
84
|
-
&:checked + ${ToggleKnob} {
|
|
85
|
-
left: calc(100% - ${({ theme }) => theme.px.large});
|
|
86
|
-
}
|
|
87
|
-
&:disabled + ${ToggleKnob} {
|
|
88
|
-
background: ${({ theme }) => theme.palette.inputDisabled};
|
|
89
|
-
}
|
|
90
|
-
&:not(:disabled) {
|
|
91
|
-
cursor: pointer;
|
|
92
|
-
}
|
|
93
|
-
`;
|
|
94
|
-
const ToggleLabel = styled_components_1.default.label ``;
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
export interface BadgeProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
3
|
-
/**
|
|
4
|
-
* Number displayed in the badge.
|
|
5
|
-
*/
|
|
6
|
-
count: number;
|
|
7
|
-
/**
|
|
8
|
-
* If `count` is greater than `max` it will be clamped to `max`.
|
|
9
|
-
* When clamped it will display `{max}+`.
|
|
10
|
-
*
|
|
11
|
-
* @example
|
|
12
|
-
* <Badge count={200} max={99} />
|
|
13
|
-
* // outputs `99+`
|
|
14
|
-
*/
|
|
15
|
-
max?: number;
|
|
16
|
-
}
|
|
17
|
-
export declare const Badge: React.FC<BadgeProps>;
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __rest = (this && this.__rest) || function (s, e) {
|
|
3
|
-
var t = {};
|
|
4
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
5
|
-
t[p] = s[p];
|
|
6
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
7
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
8
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
9
|
-
t[p[i]] = s[p[i]];
|
|
10
|
-
}
|
|
11
|
-
return t;
|
|
12
|
-
};
|
|
13
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
14
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
15
|
-
};
|
|
16
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
exports.Badge = void 0;
|
|
18
|
-
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
19
|
-
const styled_components_1 = __importDefault(require("styled-components"));
|
|
20
|
-
const Box_1 = require("../../layout/Box");
|
|
21
|
-
const Badge = (_a) => {
|
|
22
|
-
var { count = 0, max } = _a, rest = __rest(_a, ["count", "max"]);
|
|
23
|
-
let value = count.toString();
|
|
24
|
-
if (max && count > max) {
|
|
25
|
-
value = `${max}+`;
|
|
26
|
-
}
|
|
27
|
-
return jsx_runtime_1.jsx(BadgeElement, Object.assign({}, rest, { children: value }), void 0);
|
|
28
|
-
};
|
|
29
|
-
exports.Badge = Badge;
|
|
30
|
-
const BadgeElement = styled_components_1.default(Box_1.Box) `
|
|
31
|
-
background: ${({ theme }) => theme.palette.statusCritical};
|
|
32
|
-
border-radius: ${({ theme }) => theme.radius.pill};
|
|
33
|
-
color: ${({ theme }) => theme._color.white};
|
|
34
|
-
font-size: ${({ theme }) => theme.fontSize.small};
|
|
35
|
-
min-width: ${({ theme }) => theme.px.xlarge};
|
|
36
|
-
padding: 2px 6px;
|
|
37
|
-
display: inline-flex;
|
|
38
|
-
align-items: center;
|
|
39
|
-
justify-content: center;
|
|
40
|
-
box-shadow: 0px 2px 4px rgba(0, 0, 0, 0.2);
|
|
41
|
-
`;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './badge';
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
5
|
-
}) : (function(o, m, k, k2) {
|
|
6
|
-
if (k2 === undefined) k2 = k;
|
|
7
|
-
o[k2] = m[k];
|
|
8
|
-
}));
|
|
9
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
10
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
11
|
-
};
|
|
12
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
|
-
__exportStar(require("./badge"), exports);
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { HTMLAttributes, ReactNode } from 'react';
|
|
2
|
-
import { IconSizeType, IconType } from '../../system/ThemeProvider/lib/types';
|
|
3
|
-
export declare type PropsWithIcon = {
|
|
4
|
-
icon: IconType;
|
|
5
|
-
children?: never;
|
|
6
|
-
};
|
|
7
|
-
export declare type PropsWithChild = {
|
|
8
|
-
icon?: never;
|
|
9
|
-
children: ReactNode;
|
|
10
|
-
};
|
|
11
|
-
export declare type IconProps = HTMLAttributes<HTMLDivElement> & (PropsWithIcon | PropsWithChild) & {
|
|
12
|
-
size?: IconSizeType;
|
|
13
|
-
containerSize?: IconSizeType;
|
|
14
|
-
};
|
|
15
|
-
export declare const Icon: import("styled-components").StyledComponent<({ icon, children, size, containerSize, ...props }: IconProps) => JSX.Element, import("styled-components").DefaultTheme, {}, never>;
|
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __rest = (this && this.__rest) || function (s, e) {
|
|
3
|
-
var t = {};
|
|
4
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
5
|
-
t[p] = s[p];
|
|
6
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
7
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
8
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
9
|
-
t[p[i]] = s[p[i]];
|
|
10
|
-
}
|
|
11
|
-
return t;
|
|
12
|
-
};
|
|
13
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
14
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
15
|
-
};
|
|
16
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
exports.Icon = void 0;
|
|
18
|
-
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
19
|
-
const styled_components_1 = __importDefault(require("styled-components"));
|
|
20
|
-
const Box_1 = require("../../layout/Box");
|
|
21
|
-
const ThemeProvider_1 = require("../../system/ThemeProvider");
|
|
22
|
-
const constants_1 = require("../../system/ThemeProvider/lib/constants");
|
|
23
|
-
const icon_variants_1 = require("./icon.variants");
|
|
24
|
-
exports.Icon = styled_components_1.default((_a) => {
|
|
25
|
-
var { icon, children, size = 'base', containerSize } = _a, props = __rest(_a, ["icon", "children", "size", "containerSize"]);
|
|
26
|
-
return (jsx_runtime_1.jsx(IconBox, Object.assign({}, props, { iconSize: size, containerSize: containerSize || size, justifyContent: "center", alignItems: "center" }, { children: icon ? jsx_runtime_1.jsx(IconSvg, { icon: icon }, void 0) : children }), void 0));
|
|
27
|
-
}) ``;
|
|
28
|
-
const IconSvg = styled_components_1.default((_a) => {
|
|
29
|
-
var { icon } = _a, props = __rest(_a, ["icon"]);
|
|
30
|
-
const SVG = constants_1.IconSet[icon];
|
|
31
|
-
return jsx_runtime_1.jsx(SVG, Object.assign({}, props), void 0);
|
|
32
|
-
}) ``;
|
|
33
|
-
const IconBox = styled_components_1.default(Box_1.Box) `
|
|
34
|
-
/**
|
|
35
|
-
* 1. Initialize local variables with reasonable defaults
|
|
36
|
-
*/
|
|
37
|
-
--px-default: ${({ theme }) => theme.iconSize.base};
|
|
38
|
-
|
|
39
|
-
/**
|
|
40
|
-
* 2. Inject variants -- ? What are Variants
|
|
41
|
-
*/
|
|
42
|
-
${ThemeProvider_1.getVariantCSS(icon_variants_1.variants, icon_variants_1.Variant.containerSize)}
|
|
43
|
-
${ThemeProvider_1.getVariantCSS(icon_variants_1.variants, icon_variants_1.Variant.iconSize)}
|
|
44
|
-
|
|
45
|
-
width: var(--px-container, var(--px-default));
|
|
46
|
-
height: var(--px-container, var(--px-default));
|
|
47
|
-
|
|
48
|
-
/* SVG Asset */
|
|
49
|
-
& > *,
|
|
50
|
-
${IconSvg} {
|
|
51
|
-
display: block;
|
|
52
|
-
width: var(--px-icon, var(--px-default));
|
|
53
|
-
height: var(--px-icon, var(--px-default));
|
|
54
|
-
border-radius: inherit;
|
|
55
|
-
}
|
|
56
|
-
`;
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Define all Button Variants here in one place.
|
|
3
|
-
* Variants should match the variants in Figma
|
|
4
|
-
*/
|
|
5
|
-
export declare const Variant: {
|
|
6
|
-
readonly iconSize: "iconSize";
|
|
7
|
-
readonly containerSize: "containerSize";
|
|
8
|
-
};
|
|
9
|
-
export declare const variants: {
|
|
10
|
-
readonly iconSize: {
|
|
11
|
-
readonly xsmall: import("styled-components").FlattenInterpolation<import("styled-components").ThemeProps<import("styled-components").DefaultTheme>>;
|
|
12
|
-
readonly small: import("styled-components").FlattenInterpolation<import("styled-components").ThemeProps<import("styled-components").DefaultTheme>>;
|
|
13
|
-
readonly base: import("styled-components").FlattenInterpolation<import("styled-components").ThemeProps<import("styled-components").DefaultTheme>>;
|
|
14
|
-
readonly large: import("styled-components").FlattenInterpolation<import("styled-components").ThemeProps<import("styled-components").DefaultTheme>>;
|
|
15
|
-
readonly xlarge: import("styled-components").FlattenInterpolation<import("styled-components").ThemeProps<import("styled-components").DefaultTheme>>;
|
|
16
|
-
readonly xxlarge: import("styled-components").FlattenInterpolation<import("styled-components").ThemeProps<import("styled-components").DefaultTheme>>;
|
|
17
|
-
readonly xxxlarge: import("styled-components").FlattenInterpolation<import("styled-components").ThemeProps<import("styled-components").DefaultTheme>>;
|
|
18
|
-
};
|
|
19
|
-
readonly containerSize: {
|
|
20
|
-
readonly xsmall: import("styled-components").FlattenInterpolation<import("styled-components").ThemeProps<import("styled-components").DefaultTheme>>;
|
|
21
|
-
readonly small: import("styled-components").FlattenInterpolation<import("styled-components").ThemeProps<import("styled-components").DefaultTheme>>;
|
|
22
|
-
readonly base: import("styled-components").FlattenInterpolation<import("styled-components").ThemeProps<import("styled-components").DefaultTheme>>;
|
|
23
|
-
readonly large: import("styled-components").FlattenInterpolation<import("styled-components").ThemeProps<import("styled-components").DefaultTheme>>;
|
|
24
|
-
readonly xlarge: import("styled-components").FlattenInterpolation<import("styled-components").ThemeProps<import("styled-components").DefaultTheme>>;
|
|
25
|
-
readonly xxlarge: import("styled-components").FlattenInterpolation<import("styled-components").ThemeProps<import("styled-components").DefaultTheme>>;
|
|
26
|
-
readonly xxxlarge: import("styled-components").FlattenInterpolation<import("styled-components").ThemeProps<import("styled-components").DefaultTheme>>;
|
|
27
|
-
};
|
|
28
|
-
};
|