@openfin/ui-library 0.1.11-alpha.1620227229 → 0.1.11

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 CHANGED
@@ -1,18 +1,8 @@
1
1
  # OpenFin UI Library
2
2
 
3
- > React component library for OpenFin Workspace products – Informed by [Spatial](https://www.figma.com/file/0Y3pKZj0tJWuleF12h5Sua/Spatial---Components).
4
-
5
- **Storybook:** [openfin-ui.netlify.com](https://openfin-ui.netlify.com) (pw: pizza)
6
- **NPM Package:** [@openfin/ui-library](https://www.npmjs.com/package/@openfin/ui-library)
3
+ **[openfin-ui.netlify.com](https://openfin-ui.netlify.com)** `pw: pizza`
7
4
 
8
5
  [![Netlify Status](https://api.netlify.com/api/v1/badges/8fc15443-c69c-473b-b5cf-c5dbc516b0bf/deploy-status)](https://app.netlify.com/sites/openfin-ui/deploys)
9
- ![Release Package](https://github.com/openfin/ui-library/actions/workflows/release-package.yml/badge.svg)
10
-
11
- ## What is this for?
12
-
13
- **TL;DR** – Use this library and write less CSS.
14
-
15
- This is an opinionated React component library, which aims to provide the basic building blocks that you can use in any OpenFin environment. It was built w/ our [Spatial Design System](https://www.figma.com/file/0Y3pKZj0tJWuleF12h5Sua/Spatial---Components) in mind, so it should always reflect OpenFin's latest branding and designs.
16
6
 
17
7
  ## Installation
18
8
 
@@ -33,140 +23,101 @@ $ yarn add @openfin/ui-library
33
23
  $ yarn add @openfin/ui-library@v1.0.1
34
24
  ```
35
25
 
36
- ## Usage
26
+ ## Working in tandem on UI Library and Application
37
27
 
38
- ### ThemeProvider
28
+ Sometimes you may need to work on the `ui-library` alongside your own application. We use [yalc](https://www.npmjs.com/package/yalc) for this. It solves a few problems that `yarn link` creates and it's pretty intuitive
39
29
 
40
- `ThemeProvider` is the component that provides theme information to the `ui-library` components nested deeply within your application. Make sure to include this above your application so your components will be styled properly.
30
+ ### 1. Install and setup yalc
41
31
 
42
- ```javascript
43
- import { ThemeProvider } from '@openfin/ui-library';
44
- import MyApp from 'some/cool/place';
32
+ ```bash
33
+ # Make sure yalc is installed globally
34
+ $ npm i yalc -g
45
35
 
46
- const MyCoolAppContainer = () => (
47
- <ThemeProvider>
48
- <MyApp />
49
- </ThemeProvider>
50
- );
36
+ # Set up yalc in ui-library
37
+ $ cd ui-library/
38
+ $ yalc publish
39
+
40
+ # Add local ui-library package to your app
41
+ $ cd ../myCoolApp/
42
+ $ yalc add @openfin/ui-library
51
43
  ```
52
44
 
53
- ### Basic Usage
45
+ This links your local copy of UI Library to your app using symlinks and `package.json`.
54
46
 
55
- ```javascript
56
- import { Box, H1, Icon, TextInput } from '@openfin/ui-library';
47
+ ### 2. Working with yalc
57
48
 
58
- export const MyApp = () => (
59
- <Box flexDirection="column">
60
- <H1>
61
- <Icon icon="OpenFinIcon" /> Cool heading
62
- </H1>
49
+ Once you're setup, subsequent changes in UI Library can be propagated across easily.
63
50
 
64
- <TextInput placeholder="Cool stuff goes here" />
65
- </Box>
66
- );
51
+ After making changes in `ui-library`, run `yarn build && yalc push`. This will apply a version bump to the local yalc package respository. It will also update the package in your app directory, but you will most likely need to restart any development servers to see the changes.
52
+
53
+ ```sh
54
+ # push updates from ui-library side to your app
55
+ $ yarn build && yalc push
67
56
  ```
68
57
 
69
- **View the [Full Component Docs](./src/components) for more usage info.**
58
+ #### Known Issues
70
59
 
71
- ### Extending Components
60
+ - Storybook does not pick up changes after a `yalc push` and must be restarted
72
61
 
73
- Whenever possible, it is prefereable to use the components as-is. However – using [styled-components](https://styled-components.com/docs), it is very easy. Try using the following guiding principles when doing so:
62
+ ## Using UI Library
74
63
 
75
- - Familiarize yourself w/ the `theme` prop, and use it whenever possible.
76
- - Avoid hard-coded pixel values.
77
- - Don't _ever_ use hard-coded color values.
64
+ ### Theme Provider
78
65
 
79
- ```javascript
80
- import { Box, Text } from '@openfin/ui-library';
81
- import styled from 'styled-components';
82
-
83
- export const MyCoolComponent = () => (
84
- <Container flexDirection="column">
85
- <ImportantText>How cool is this?</ImportantText>
86
- <Text weight="bold">Super cool</Text>
87
- </Container>
88
- );
66
+ The `ThemeProvider` is a component that provides theme information to the `ui-library` components nested deeply within your application. Make sure to include this above your application so your components will be styled properly.
89
67
 
90
- const Container = styled(Box)`
91
- background: ${({ theme }) => theme.palette.background6};
92
- border-radius: ${({ theme }) => theme.radius.small};
93
- margin: ${({ theme }) => `${theme.px.small} 0 ${theme.px.base}`};
94
- `;
68
+ ```javascript
69
+ import { ThemeProvider } from '@openfin/ui-library';
70
+ import MyApp from 'some/cool/place';
95
71
 
96
- const ImportantText = styled(Text)`
97
- color: ${({ theme }) => theme.palette.statusWarning};
98
- cursor: pointer;
99
- font-weight: ${({ theme }) => theme.fontWeight.bold};
100
- `;
72
+ const MyCoolAppContainer = () => (
73
+ <ThemeProvider>
74
+ <MyApp />
75
+ </ThemeProvider>
76
+ );
101
77
  ```
102
78
 
103
- ## Contributing
104
-
105
- ### Open a pull request 😎
79
+ ## [Storybook](https://storybook.js.org)
106
80
 
107
- Pull requests are a great way to express an idea or need, if it's easier to "show" instead of "tell", go for it, propose a change!
108
-
109
- Also keep in mind, UI Library is a home of centralized common components, **used by several products**. It's reasonable to expect PRs may spark conversations about the **essence of the change** and it's benefits and impact across the application ecosystem.
110
-
111
- Meaning: While there are no hard rules about what belongs in _our_ library, if a change is too opinionated or too specialized, it may make sense to leave it out. **A library that does less, is a lot easier to know and work with**.
112
-
113
- ### Storybook
81
+ Great for exploring and experimenting with UI Library components. It's also a used for [testing our components](https://storybook.js.org/docs/react/workflows/unit-testing).
114
82
 
115
- Great for exploring and experimenting with UI Library components. It's also used for [testing our components](https://storybook.js.org/docs/react/workflows/unit-testing).
83
+ ### Storybook For Developers
116
84
 
117
85
  ```bash
118
- # Run it locally
119
86
  $ yarn storybook
120
87
  ```
121
88
 
122
- ### Codesandbox.io
89
+ ### Storybook For Designers
123
90
 
124
- Great for developer experimentation without all of the overhead.
91
+ Great for a quick look at the latest build, [check it out](https://openfin-ui.netlify.com)
125
92
 
126
- The sandbox is currently **private**, request access and [give it a try](https://codesandbox.io/s/openfin-ui-library-39y7c).
93
+ ## UI Lib @ Codesandbox.io
127
94
 
128
- ### Working locally w/ other apps
129
-
130
- Sometimes you may need to work on the `ui-library` alongside your own application. We use [yalc](https://www.npmjs.com/package/yalc) for this. It solves a few problems that `yarn link` creates, and it's pretty intuitive.
131
-
132
- #### 1. Install and setup yalc
95
+ Great for developer experimentation without all of the overhead.
133
96
 
134
- ```bash
135
- # Make sure yalc is installed globally
136
- $ npm i yalc -g
97
+ The sandbox is currently **private**, request access and [give it a try](https://codesandbox.io/s/openfin-ui-library-39y7c).
137
98
 
138
- # Set up yalc in ui-library
139
- $ cd ui-library/
140
- $ yalc publish
99
+ ## How to test
141
100
 
142
- # Add local ui-library package to your app
143
- $ cd ../myCoolApp/
144
- $ yalc add @openfin/ui-library
101
+ ```sh
102
+ yarn test
145
103
  ```
146
104
 
147
- This links your local copy of UI Library to your app using symlinks and `package.json`.
148
-
149
- #### 2. Working with yalc
150
-
151
- Once you're setup, subsequent changes in UI Library can be propagated across easily.
105
+ ## How to Contribute
152
106
 
153
- After making changes in `ui-library`, run `yarn build && yalc push`. This will apply a version bump to the local yalc package respository. It will also update the package in your app directory, but you will most likely need to restart any development servers to see the changes.
107
+ ### 1. Git pre-push hook is handled by Husky automatically
154
108
 
155
109
  ```sh
156
- # push updates from ui-library side to your app
157
- $ yarn build && yalc push
110
+ $ yarn git:pre-push
111
+ # Husky should runs this command automatically before pushing
158
112
  ```
159
113
 
160
- #### Known Issues
114
+ ### 2. Open a pull request 😎
161
115
 
162
- - Storybook does not pick up changes after a `yalc push` and must be restarted
116
+ Pull requests are a great way to express an idea or need, if it's easier to "show" instead of "tell", go for it, propose a change!
163
117
 
164
- ### Linting
118
+ Also keep in mind, UI Library is a home of centralized common components, **used by several products**. It's reasonable to expect PRs may spark conversations about the **essence of the change** and it's benefits and impact across the application ecosystem.
165
119
 
166
- ```sh
167
- # Husky runs this command automatically before pushing
168
- $ yarn git:pre-push
169
- ```
120
+ Meaning: While there are no hard rules about what belongs in _our_ library, if a change is too opinionated or too specialized, it may make sense to leave it out. **A library that does less, is a lot easier to know and work with**.
170
121
 
171
122
  ## Compiling the Library
172
123
 
@@ -182,12 +133,6 @@ Extending base config used by `tsc` when bundling the library for a new release.
182
133
 
183
134
  Extending base config used by `Storybook` to quiet some extraneous warnings.
184
135
 
185
- ## Testing
186
-
187
- ```sh
188
- yarn test
189
- ```
190
-
191
136
  ## Versioning & Releasing
192
137
 
193
138
  ### 1. Create a release branch
@@ -221,3 +166,96 @@ Once your release branch is merged into main, you should now create a release th
221
166
  - Enter a description that includes all feature ticket numbers that were included since the previous release. Don't worry, you can always go back and edit it later.
222
167
 
223
168
  This triggers a Github Action to automatically build the latest version of the `ui-library` and package it for remote installation. Check the status of this task within this repo's actions tab.
169
+
170
+ ## Components
171
+
172
+ ### Controls
173
+
174
+ - [Button](./src/components/controls/Button)
175
+ - [Icon](./src/components/controls/Icon)
176
+ - [Input](./src/components/input/Input)
177
+ - [Toggle](./src/components/controls/Toggle)
178
+ - [Badge](./src/components/controls/Badge)
179
+
180
+ ### Layout
181
+
182
+ - [Box](./src/components/layout/Box)
183
+
184
+ ### List
185
+
186
+ - [DefinitionList](./src/components/list/DefinitionList)
187
+
188
+ ### System
189
+
190
+ - [GlobalStyles](./src/components/system/GlobalStyles)
191
+ - [ThemeProvider](./src/components/system/ThemeProvider)
192
+ - [Themes](./src/components/system/ThemeProvider/themes) (included OpenFin Themes)
193
+
194
+ ### [Typography](./src/components/typography)
195
+
196
+ - Text
197
+ - Heading
198
+
199
+ ## [Hooks](./src/hooks)
200
+
201
+ - useMediaQuery
202
+ - useLayoutMediaQuery
203
+ - useColorScheme
204
+ - useTheme
205
+
206
+ ## [Mixins](./src/components/system/ThemeProvider/lib/mixins.ts)
207
+
208
+ CSS fragments that you can include in any styled component
209
+
210
+ - `${Mixins.noSelect}`
211
+ - `${Mixins.textOverflow}`
212
+ - `${Mixins.scrollbar.base}`
213
+ - `${Mixins.scrollbar.small}`
214
+
215
+ ## Variants
216
+
217
+ ### What are variants?
218
+
219
+ Variants as a concept is shared with the Design team and [Spatial](https://www.figma.com/file/0Y3pKZj0tJWuleF12h5Sua/Spatial) and it's a way of describing the _variations_ of a given component.
220
+
221
+ **In Figma**, variants are represented as a matrix of options mapped / instrumented into the design itself.
222
+
223
+ **In UI Library**, variants are represented as a matrix of component props key:values mapped / instrumented into Styled Component css partials.
224
+
225
+ This isn't a new idea, or proprietary to Figma, but it is a built-in first class construct in that software. It's **not** built into the Styled Components as a first class construct, we are creating it here in the UI Library as a novel way to mirror that visual mapping in component builds. It's syntactic sugar, an opinion for working with fragments of style using Styled Components.
226
+
227
+ _It may be slightly more verbose with a bit of initial cognitive cost to represent component variations this way._ Let's commit to this pattern for now, to see it at scale, "in the wild". And let's also commit to continuing to evaluate it's usefulness. The goal is to offer a **semantic symmetry with design and build** that hopefuly translates to more consistent and stable products over a longer timeline.
228
+
229
+ ### Can I see an example of variants?
230
+
231
+ Yes! [Button](./src/components/Button), [Icon](./src/components/Icon), and [Toggle](./src/components/Toggle) all implement variants in the UI Library mirroring the variants in Figma.
232
+
233
+ ### How does it work?
234
+
235
+ ```tsx
236
+ // component.variants.ts
237
+ export const variants = {
238
+ propName: {
239
+ propValueA: css`
240
+ /* CSS... */
241
+ color: red;
242
+ `,
243
+ propValueB: css`
244
+ /* CSS... */
245
+ color: blue;
246
+ `,
247
+ },
248
+ };
249
+
250
+ // component.tsx
251
+ const Component = styled.div<{ propName: string }>`
252
+ /* Injects a CSS Partial matching prop name -> value */
253
+ ${getVariantCSS(variants, 'propName')};
254
+ `;
255
+
256
+ // Component with red text
257
+ <Component someProp="propValueA" />
258
+
259
+ // Component with blue text
260
+ <Component someProp="propValueB" />
261
+ ```
@@ -37,5 +37,5 @@ const BadgeElement = styled_components_1.default(Box_1.Box) `
37
37
  display: inline-flex;
38
38
  align-items: center;
39
39
  justify-content: center;
40
- box-shadow: ${({ theme }) => theme.shadow.base};
40
+ box-shadow: 0px 2px 4px rgba(0, 0, 0, 0.2);
41
41
  `;
@@ -8,9 +8,8 @@ export declare type PropsWithChild = {
8
8
  icon?: never;
9
9
  children: ReactNode;
10
10
  };
11
- export declare type IconSizeProps = {
11
+ export declare type IconProps = HTMLAttributes<HTMLDivElement> & (PropsWithIcon | PropsWithChild) & {
12
12
  size?: IconSizeType;
13
13
  containerSize?: IconSizeType;
14
14
  };
15
- export declare type IconProps = HTMLAttributes<HTMLDivElement> & (PropsWithIcon | PropsWithChild) & IconSizeProps;
16
15
  export declare const Icon: import("styled-components").StyledComponent<({ icon, children, size, containerSize, ...props }: IconProps) => JSX.Element, import("styled-components").DefaultTheme, {}, never>;
@@ -1,13 +1,9 @@
1
- import { InputHTMLAttributes } from 'react';
1
+ import { FC, InputHTMLAttributes } from 'react';
2
2
  import { WithStatusProps } from '../../system/HOC';
3
3
  export declare type BaseInputProps = InputHTMLAttributes<HTMLInputElement> & {
4
4
  message?: string;
5
5
  label?: string;
6
6
  renderInput?: Function;
7
7
  } & WithStatusProps;
8
- export declare const BaseInput: import("react").ForwardRefExoticComponent<InputHTMLAttributes<HTMLInputElement> & {
9
- message?: string | undefined;
10
- label?: string | undefined;
11
- renderInput?: Function | undefined;
12
- } & WithStatusProps & import("react").RefAttributes<HTMLInputElement>>;
8
+ export declare const BaseInput: FC<BaseInputProps>;
13
9
  export declare const StyledInputField: import("styled-components").StyledComponent<"input", import("styled-components").DefaultTheme, InputHTMLAttributes<HTMLInputElement> & WithStatusProps, never>;
@@ -16,19 +16,18 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
17
  exports.StyledInputField = exports.BaseInput = void 0;
18
18
  const jsx_runtime_1 = require("react/jsx-runtime");
19
- const react_1 = require("react");
20
19
  const styled_components_1 = __importDefault(require("styled-components"));
21
20
  const Box_1 = require("../../layout/Box");
21
+ const HOC_1 = require("../../system/HOC");
22
22
  const ThemeProvider_1 = require("../../system/ThemeProvider");
23
23
  const Text_1 = require("../../typography/Text");
24
- exports.BaseInput = react_1.forwardRef((_a, ref) => {
24
+ exports.BaseInput = HOC_1.withStatus((_a) => {
25
25
  var { className, renderInput, message, label, status, name } = _a, inputProps = __rest(_a, ["className", "renderInput", "message", "label", "status", "name"]);
26
26
  return (jsx_runtime_1.jsxs(InputContainer, Object.assign({ flexDirection: "column", alignItems: "flex-start" }, { children: [!!label && (jsx_runtime_1.jsx(InputLabel, Object.assign({ as: "label", htmlFor: name, weight: "bold" }, { children: label }), void 0)),
27
27
  !!renderInput && renderInput(Object.assign({ name, status }, inputProps)),
28
- !renderInput && (jsx_runtime_1.jsx(exports.StyledInputField, Object.assign({ className: className, name: name, status: status }, inputProps, { ref: ref }), void 0)),
28
+ !renderInput && (jsx_runtime_1.jsx(exports.StyledInputField, Object.assign({ className: className, name: name, status: status }, inputProps), void 0)),
29
29
  !!message && jsx_runtime_1.jsx(InputMessage, Object.assign({ status: status }, { children: message }), void 0)] }), void 0));
30
30
  });
31
- exports.BaseInput.displayName = 'BaseInput';
32
31
  const InputLabel = styled_components_1.default(Text_1.Text) `
33
32
  margin-bottom: ${({ theme }) => theme.px.small};
34
33
  `;
@@ -44,7 +43,7 @@ exports.StyledInputField = styled_components_1.default.input `
44
43
  border: 1px solid ${({ theme }) => theme.palette.inputBg};
45
44
  border-color: ${({ theme, status }) => ThemeProvider_1.getStatusColor(theme, status, 'inputBg')};
46
45
  border-radius: ${({ theme }) => theme.radius.small};
47
- box-shadow: ${({ theme }) => theme.shadow.base};
46
+ box-shadow: 0px 4px 4px rgba(0, 0, 0, 0.25);
48
47
  color: ${({ theme }) => theme.palette.inputColor};
49
48
  font-size: ${({ theme }) => theme.fontSize.base};
50
49
  padding: ${({ theme }) => `${theme.px.small} ${theme.px.base}`};
@@ -1,14 +1,3 @@
1
- import { ChangeEventHandler } from 'react';
1
+ import { FC } from 'react';
2
2
  import { BaseInputProps } from '../BaseInput';
3
- interface NumberInputProps extends Omit<BaseInputProps, 'value'> {
4
- min?: number;
5
- max?: number;
6
- onChange?: ChangeEventHandler<HTMLInputElement>;
7
- /**
8
- * @default 1
9
- */
10
- step?: number;
11
- value?: number;
12
- }
13
- export declare const NumberInput: import("react").ForwardRefExoticComponent<NumberInputProps & import("react").RefAttributes<HTMLInputElement>>;
14
- export {};
3
+ export declare const NumberInput: FC<BaseInputProps>;
@@ -27,12 +27,12 @@ var Direction;
27
27
  Direction[Direction["Up"] = 1] = "Up";
28
28
  Direction[Direction["Down"] = -1] = "Down";
29
29
  })(Direction || (Direction = {}));
30
- exports.NumberInput = react_1.forwardRef((_a, ref) => {
31
- var { min, max, onChange, step = 1, value } = _a, props = __rest(_a, ["min", "max", "onChange", "step", "value"]);
30
+ const NumberInput = (_a) => {
31
+ var { min, max, onChange, step = 1, value = '' } = _a, props = __rest(_a, ["min", "max", "onChange", "step", "value"]);
32
32
  // Since we are recreating the +/- buttons, we need to capture the value state at this level.
33
33
  const stepInterval = Number(step);
34
- const [num, setNum] = react_1.useState(Number(value));
35
- react_1.useEffect(() => setNum(Number(value)), []);
34
+ const [num, setNum] = react_1.useState(value);
35
+ react_1.useEffect(() => setNum(value), []);
36
36
  const takeStep = (direction) => {
37
37
  const base = num ? Number(num) : 0;
38
38
  const lower = min ? Number(min) : undefined;
@@ -42,7 +42,7 @@ exports.NumberInput = react_1.forwardRef((_a, ref) => {
42
42
  };
43
43
  return (jsx_runtime_1.jsx(BaseInput_1.BaseInput, Object.assign({ type: "number" }, props, { renderInput: (_a) => {
44
44
  var inputProps = __rest(_a, []);
45
- return (jsx_runtime_1.jsx(StyledNumberInput, Object.assign({ ref: ref, onIncrement: () => takeStep(Direction.Up), onDecrement: () => takeStep(Direction.Down), onChange: (event) => {
45
+ return (jsx_runtime_1.jsx(StyledNumberInput, Object.assign({ onIncrement: () => takeStep(Direction.Up), onDecrement: () => takeStep(Direction.Down), onChange: (event) => {
46
46
  const { value } = event === null || event === void 0 ? void 0 : event.target;
47
47
  if (value) {
48
48
  setNum(Number(value));
@@ -50,15 +50,14 @@ exports.NumberInput = react_1.forwardRef((_a, ref) => {
50
50
  onChange && onChange(event);
51
51
  }, min: min, max: max, step: step }, inputProps, { value: num }), void 0));
52
52
  } }), void 0));
53
- });
54
- exports.NumberInput.displayName = 'NumberInput';
55
- const StyledNumberInput = react_1.forwardRef((_a, ref) => {
53
+ };
54
+ exports.NumberInput = NumberInput;
55
+ const StyledNumberInput = (_a) => {
56
56
  var { onIncrement, onDecrement } = _a, props = __rest(_a, ["onIncrement", "onDecrement"]);
57
- return (jsx_runtime_1.jsxs(StyledInputContainer, { children: [jsx_runtime_1.jsx(Input, Object.assign({ ref: ref }, props), void 0),
57
+ return (jsx_runtime_1.jsxs(StyledInputContainer, { children: [jsx_runtime_1.jsx(Input, Object.assign({}, props), void 0),
58
58
  jsx_runtime_1.jsxs(ControlContainer, Object.assign({ flexDirection: "column", disabled: props.disabled }, { children: [jsx_runtime_1.jsx(ArrowControl, Object.assign({ onClick: onIncrement, disabled: props.disabled }, { children: jsx_runtime_1.jsx(Icon_1.Icon, { icon: "TriangleUpIcon" }, void 0) }), void 0),
59
59
  jsx_runtime_1.jsx(ArrowControl, Object.assign({ onClick: onDecrement, disabled: props.disabled }, { children: jsx_runtime_1.jsx(Icon_1.Icon, { icon: "TriangleDownIcon" }, void 0) }), void 0)] }), void 0)] }, void 0));
60
- });
61
- StyledNumberInput.displayName = "StyledNumberInput";
60
+ };
62
61
  const StyledInputContainer = styled_components_1.default.div `
63
62
  position: relative;
64
63
  overflow: hidden;
@@ -1,8 +1,4 @@
1
- /// <reference types="react" />
1
+ import { FC } from 'react';
2
2
  import { BaseInputProps } from '../BaseInput';
3
3
  export declare type TextInputProps = BaseInputProps;
4
- export declare const TextInput: import("react").ForwardRefExoticComponent<import("react").InputHTMLAttributes<HTMLInputElement> & {
5
- message?: string | undefined;
6
- label?: string | undefined;
7
- renderInput?: Function | undefined;
8
- } & import("../../system/HOC").WithStatusProps & import("react").RefAttributes<HTMLInputElement>>;
4
+ export declare const TextInput: FC<TextInputProps>;
@@ -1,10 +1,21 @@
1
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
+ };
2
13
  Object.defineProperty(exports, "__esModule", { value: true });
3
14
  exports.TextInput = void 0;
4
15
  const jsx_runtime_1 = require("react/jsx-runtime");
5
- const react_1 = require("react");
6
16
  const BaseInput_1 = require("../BaseInput");
7
- exports.TextInput = react_1.forwardRef((props, ref) => {
8
- return jsx_runtime_1.jsx(BaseInput_1.BaseInput, Object.assign({ ref: ref, type: "text" }, props), void 0);
9
- });
10
- exports.TextInput.displayName = 'TextInput';
17
+ const TextInput = (_a) => {
18
+ var props = __rest(_a, []);
19
+ return jsx_runtime_1.jsx(BaseInput_1.BaseInput, Object.assign({ type: "text" }, props), void 0);
20
+ };
21
+ exports.TextInput = TextInput;
@@ -1,4 +1,11 @@
1
+ import { ComponentType, FC } from 'react';
1
2
  export declare type StatusType = 'success' | 'warning' | 'critical' | 'active';
2
3
  export declare type WithStatusProps = {
3
4
  status?: StatusType;
4
5
  };
6
+ /**
7
+ * withStatus HOC
8
+ * Takes a component and applies the status prop to it.
9
+ * @returns Instantiated component w/ status and other props applied.
10
+ */
11
+ export declare const withStatus: <P extends object>(Component: ComponentType<P>) => FC<P & WithStatusProps>;
@@ -1,2 +1,25 @@
1
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
+ };
2
13
  Object.defineProperty(exports, "__esModule", { value: true });
14
+ exports.withStatus = void 0;
15
+ const jsx_runtime_1 = require("react/jsx-runtime");
16
+ /**
17
+ * withStatus HOC
18
+ * Takes a component and applies the status prop to it.
19
+ * @returns Instantiated component w/ status and other props applied.
20
+ */
21
+ const withStatus = (Component) => function withStatus(_a) {
22
+ var { status } = _a, props = __rest(_a, ["status"]);
23
+ return jsx_runtime_1.jsx(Component, Object.assign({ status: status }, props), void 0);
24
+ };
25
+ exports.withStatus = withStatus;
@@ -136,7 +136,9 @@ export declare const Radius: {
136
136
  * Note: This does not include any `text-shadow`
137
137
  */
138
138
  export declare const Shadow: {
139
+ small: string;
139
140
  base: string;
141
+ large: string;
140
142
  };
141
143
  /**
142
144
  * FontStack --
@@ -161,7 +161,9 @@ exports.Radius = {
161
161
  * Note: This does not include any `text-shadow`
162
162
  */
163
163
  exports.Shadow = {
164
- [exports.Size.base]: `0 4px 4px rgba(0, 0, 0, 0.25)`,
164
+ [exports.Size.small]: `0 0 ${exports.UnitPx.base} rgba(0,0,0,0.5)`,
165
+ [exports.Size.base]: `0 0 ${exports.UnitPx.large} rgba(0,0,0,0.5)`,
166
+ [exports.Size.large]: `0 0 ${exports.UnitPx.xlarge} rgba(0,0,0,0.5)`,
165
167
  };
166
168
  const fonts = [
167
169
  'Inter',
package/dist/index.d.ts CHANGED
@@ -2,12 +2,11 @@ export * from './components/controls/Button';
2
2
  export * from './components/controls/Toggle';
3
3
  export * from './components/elements/Badge';
4
4
  export * from './components/elements/Icon';
5
- export * from './components/elements/Loader';
6
5
  export * from './components/input/RawInput';
7
6
  export * from './components/input/TextInput';
8
7
  export * from './components/input/NumberInput';
9
8
  export * from './components/layout/Box';
10
- export * from './components/layout/DefinitionList';
9
+ export * from './components/list/DefinitionList';
11
10
  export * from './components/system/GlobalStyles';
12
11
  export * from './components/system/ThemeProvider';
13
12
  export * from './components/typography/Heading';
package/dist/index.js CHANGED
@@ -27,12 +27,11 @@ __exportStar(require("./components/controls/Button"), exports);
27
27
  __exportStar(require("./components/controls/Toggle"), exports);
28
28
  __exportStar(require("./components/elements/Badge"), exports);
29
29
  __exportStar(require("./components/elements/Icon"), exports);
30
- __exportStar(require("./components/elements/Loader"), exports);
31
30
  __exportStar(require("./components/input/RawInput"), exports);
32
31
  __exportStar(require("./components/input/TextInput"), exports);
33
32
  __exportStar(require("./components/input/NumberInput"), exports);
34
33
  __exportStar(require("./components/layout/Box"), exports);
35
- __exportStar(require("./components/layout/DefinitionList"), exports);
34
+ __exportStar(require("./components/list/DefinitionList"), exports);
36
35
  __exportStar(require("./components/system/GlobalStyles"), exports);
37
36
  __exportStar(require("./components/system/ThemeProvider"), exports);
38
37
  __exportStar(require("./components/typography/Heading"), exports);
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@openfin/ui-library",
3
3
  "description": "OpenFin UI Component Library",
4
- "version": "0.1.11-alpha.1620227229",
4
+ "version": "0.1.11",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
7
7
  "repository": "github:openfin/ui-library",
@@ -10,7 +10,7 @@
10
10
  "dist/**/*"
11
11
  ],
12
12
  "engines": {
13
- "node": "12",
13
+ "node": "14",
14
14
  "yarn": "1"
15
15
  },
16
16
  "license": "MIT",
@@ -19,19 +19,19 @@
19
19
  "tinycolor2": "^1.4.2"
20
20
  },
21
21
  "peerDependencies": {
22
- "styled-components": "^5.2.3"
22
+ "styled-components": "^5.2.1"
23
23
  },
24
24
  "devDependencies": {
25
25
  "@babel/cli": "^7.13.10",
26
26
  "@babel/core": "^7.13.10",
27
27
  "@babel/preset-env": "^7.13.10",
28
28
  "@babel/preset-typescript": "^7.13.0",
29
- "@storybook/addon-actions": "^6.2.9",
30
- "@storybook/addon-essentials": "^6.2.9",
31
- "@storybook/addon-links": "^6.2.9",
32
- "@storybook/node-logger": "^6.2.9",
29
+ "@storybook/addon-actions": "^6.2.8",
30
+ "@storybook/addon-essentials": "^6.2.8",
31
+ "@storybook/addon-links": "^6.2.8",
32
+ "@storybook/node-logger": "^6.2.8",
33
33
  "@storybook/preset-create-react-app": "^3.1.7",
34
- "@storybook/react": "^6.2.9",
34
+ "@storybook/react": "^6.2.8",
35
35
  "@testing-library/jest-dom": "^5.11.9",
36
36
  "@testing-library/react": "^11.2.3",
37
37
  "@testing-library/user-event": "^12.6.2",
@@ -42,7 +42,7 @@
42
42
  "@types/node": "^14.14.34",
43
43
  "@types/react": "^17.0.3",
44
44
  "@types/react-dom": "^17.0.2",
45
- "@types/styled-components": "^5.1.9",
45
+ "@types/styled-components": "^5.1.8",
46
46
  "@types/tinycolor2": "^1.4.2",
47
47
  "@typescript-eslint/eslint-plugin": "^4.17.0",
48
48
  "@typescript-eslint/parser": "^4.17.0",
@@ -61,13 +61,13 @@
61
61
  "react-scripts": "4.0.1",
62
62
  "rimraf": "^3.0.2",
63
63
  "storybook-addon-performance": "^0.15.2",
64
- "styled-components": "^5.2.3",
64
+ "styled-components": "^5.2.1",
65
65
  "stylelint": "^13.12.0",
66
66
  "stylelint-config-recommended": "^4.0.0",
67
67
  "stylelint-config-styled-components": "^0.1.1",
68
68
  "stylelint-processor-styled-components": "^1.10.0",
69
69
  "tsconfig-paths-webpack-plugin": "^3.3.0",
70
- "typescript": "^4.2.4",
70
+ "typescript": "^4.1.3",
71
71
  "web-vitals": "^1.1.0"
72
72
  },
73
73
  "scripts": {
@@ -1 +0,0 @@
1
- export * from './loader';
@@ -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("./loader"), exports);
@@ -1,4 +0,0 @@
1
- import { HTMLAttributes } from 'react';
2
- import { IconSizeProps } from '../Icon';
3
- export declare type LoaderProps = IconSizeProps & HTMLAttributes<HTMLDivElement>;
4
- export declare const Loader: import("styled-components").StyledComponent<({ ...props }: LoaderProps) => JSX.Element, import("styled-components").DefaultTheme, IconSizeProps & HTMLAttributes<HTMLDivElement>, never>;
@@ -1,25 +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.Loader = void 0;
18
- const jsx_runtime_1 = require("react/jsx-runtime");
19
- const styled_components_1 = __importDefault(require("styled-components"));
20
- const Icon_1 = require("../Icon");
21
- exports.Loader = styled_components_1.default((_a) => {
22
- var props = __rest(_a, []);
23
- return (jsx_runtime_1.jsx(Icon_1.Icon, Object.assign({}, props, { children: jsx_runtime_1.jsx("svg", Object.assign({ width: "100%", height: "100%", viewBox: "0 0 38 38", xmlns: "http://www.w3.org/2000/svg", stroke: "currentColor" }, { children: jsx_runtime_1.jsx("g", Object.assign({ fill: "none", fillRule: "evenodd" }, { children: jsx_runtime_1.jsxs("g", Object.assign({ transform: "translate(1 1)", strokeWidth: "2" }, { children: [jsx_runtime_1.jsx("circle", { strokeOpacity: ".5", cx: "18", cy: "18", r: "18" }, void 0),
24
- jsx_runtime_1.jsx("path", Object.assign({ d: "M36 18c0-9.94-8.06-18-18-18" }, { children: jsx_runtime_1.jsx("animateTransform", { attributeName: "transform", type: "rotate", from: "0 18 18", to: "360 18 18", dur: "1s", repeatCount: "indefinite" }, void 0) }), void 0)] }), void 0) }), void 0) }), void 0) }), void 0));
25
- }) ``;