uikit-react-public 0.21.8 → 0.22.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.
Files changed (30) hide show
  1. package/dist/components/Heading/Heading.d.ts +6 -4
  2. package/dist/components/Heading/Heading.stories.d.ts +8 -6
  3. package/dist/components/Paragraph/Paragraph.d.ts +5 -2
  4. package/dist/components/Paragraph/Paragraph.stories.d.ts +6 -3
  5. package/dist/components/Spinner/Spinner.d.ts +3 -2
  6. package/dist/components/Spinner/Spinner.stories.d.ts +1 -1
  7. package/dist/components/index.d.ts +6 -4
  8. package/dist/index.js +3712 -3783
  9. package/lib/components/Button/__tests__/__snapshots__/Button.test.tsx.snap +5 -3
  10. package/lib/components/Field/Field.tsx +0 -3
  11. package/lib/components/Heading/Heading.stories.tsx +34 -41
  12. package/lib/components/Heading/Heading.tsx +180 -49
  13. package/lib/components/Heading/__tests__/__snapshots__/Heading.test.tsx.snap +4 -4
  14. package/lib/components/Paragraph/Paragraph.stories.tsx +29 -27
  15. package/lib/components/Paragraph/Paragraph.tsx +212 -81
  16. package/lib/components/Paragraph/__tests__/__snapshots__/Paragraph.test.tsx.snap +5 -5
  17. package/lib/components/Spinner/Spinner.tsx +69 -70
  18. package/lib/components/Spinner/__tests__/Spinner.test.tsx +33 -1
  19. package/lib/components/Spinner/__tests__/__snapshots__/Spinner.test.tsx.snap +20 -12
  20. package/lib/components/Table/improvements-tracking.md +25 -0
  21. package/lib/components/index.ts +7 -4
  22. package/package.json +2 -1
  23. package/dist/components/HeadingNew/Heading.d.ts +0 -13
  24. package/dist/components/HeadingNew/index.d.ts +0 -2
  25. package/dist/components/ParagraphNew/Paragraph.d.ts +0 -13
  26. package/dist/components/ParagraphNew/index.d.ts +0 -4
  27. package/lib/components/HeadingNew/Heading.tsx +0 -208
  28. package/lib/components/HeadingNew/index.ts +0 -2
  29. package/lib/components/ParagraphNew/Paragraph.tsx +0 -200
  30. package/lib/components/ParagraphNew/index.ts +0 -6
@@ -31,6 +31,9 @@ export type { SnackbarProps } from './Snackbar';
31
31
  export { default as Avatar } from './Avatar';
32
32
  export type { AvatarProps } from './Avatar';
33
33
 
34
+ export { default as Badge } from './Badge';
35
+ export type { BadgeProps } from './Badge';
36
+
34
37
  export { default as Spinner } from './Spinner';
35
38
  export type { SpinnerProps } from './Spinner';
36
39
 
@@ -40,14 +43,14 @@ export type { TextareaProps } from './Textarea';
40
43
  export { default as Heading } from './Heading';
41
44
  export type { HeadingProps } from './Heading';
42
45
 
43
- export { default as HeadingNew } from './HeadingNew';
44
- export type { HeadingProps as HeadingNewProps } from './HeadingNew';
46
+ export { default as HeadingNew } from './Heading';
47
+ export type { HeadingProps as HeadingNewProps } from './Heading';
45
48
 
46
49
  export { default as Paragraph } from './Paragraph';
47
50
  export type { ParagraphProps } from './Paragraph';
48
51
 
49
- export { default as ParagraphNew } from './ParagraphNew';
50
- export type { ParagraphProps as ParagraphNewProps } from './ParagraphNew';
52
+ export { default as ParagraphNew } from './Paragraph';
53
+ export type { ParagraphProps as ParagraphNewProps } from './Paragraph';
51
54
 
52
55
  // TODO: Remove aliased export in future breaking release
53
56
  // <Paragraph> will be used in place of <Text> in the future
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "uikit-react-public",
3
3
  "private": false,
4
4
  "license": "UNLICENSED",
5
- "version": "0.21.8",
5
+ "version": "0.22.0",
6
6
  "type": "module",
7
7
  "main": "dist/index.js",
8
8
  "types": "dist/index.d.ts",
@@ -17,6 +17,7 @@
17
17
  "dev": "vite",
18
18
  "dev_expose": "vite --host",
19
19
  "build": "tsc --p ./tsconfig-build.json && vite build",
20
+ "build:watch": "tsc --p ./tsconfig-build.json --watch --preserveWatchOutput & vite build --watch",
20
21
  "lint": "eslint . --ext ts,tsx --report-unused-disable-directives --max-warnings 0",
21
22
  "pre-commit": "lint-staged",
22
23
  "format": "prettier \"./**/*.{ts,tsx}\" --write --config ./prettierrc",
@@ -1,13 +0,0 @@
1
- import { HTMLAttributes } from 'react';
2
- import { MarginProps } from '../common/marginsStyle';
3
- export declare const NAME = "ucl-uikit-heading";
4
- export type HeadingLevel = 'xxl' | 'xl' | 'lg' | 'md' | 'sm' | 'xs';
5
- export interface HeadingBaseProps extends HTMLAttributes<HTMLHeadingElement> {
6
- level?: HeadingLevel;
7
- as?: 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6' | 'div' | 'span';
8
- testId?: string;
9
- ref?: React.Ref<HTMLHeadingElement>;
10
- }
11
- export type HeadingProps = HeadingBaseProps & MarginProps;
12
- declare const Heading: import('react').MemoExoticComponent<({ level, as, testId, className, ref, ...props }: HeadingProps) => import("react/jsx-runtime").JSX.Element>;
13
- export default Heading;
@@ -1,2 +0,0 @@
1
- export { default } from './Heading';
2
- export type { HeadingProps } from './Heading';
@@ -1,13 +0,0 @@
1
- import { HTMLAttributes } from 'react';
2
- import { MarginProps } from '../common/marginsStyle';
3
- export declare const NAME = "ucl-uikit-paragrah";
4
- export type ParagraphLevel = 'lg' | 'lg-medium' | 'lg-semibold' | 'lg-bold' | 'md' | 'md-medium' | 'md-semibold' | 'md-semibold' | 'md-medium-numeric' | 'sm' | 'sm-medium' | 'sm-semibold' | 'xs' | 'xs-medium';
5
- export interface ParagraphBaseProps extends HTMLAttributes<HTMLParagraphElement> {
6
- level?: ParagraphLevel;
7
- as?: 'p' | 'div' | 'span';
8
- testId?: string;
9
- ref?: React.Ref<HTMLParagraphElement>;
10
- }
11
- export type ParagraphProps = ParagraphBaseProps & MarginProps;
12
- declare const _default: import('react').MemoExoticComponent<({ level, as, testId, className, ref, ...props }: ParagraphProps) => import("react/jsx-runtime").JSX.Element>;
13
- export default _default;
@@ -1,4 +0,0 @@
1
- export { default } from './Paragraph';
2
- export type { ParagraphProps } from './Paragraph';
3
- export { default as Text } from './Paragraph';
4
- export type { ParagraphProps as TextProps } from './Paragraph';
@@ -1,208 +0,0 @@
1
- import { memo, HTMLAttributes, JSX } from 'react';
2
- import { css, cx } from '@emotion/css';
3
- import useTheme from '../../theme/useTheme';
4
- import marginsStyle, { MarginProps } from '../common/marginsStyle';
5
-
6
- export const NAME = 'ucl-uikit-heading';
7
-
8
- export type HeadingLevel = 'xxl' | 'xl' | 'lg' | 'md' | 'sm' | 'xs';
9
-
10
- export interface HeadingBaseProps extends HTMLAttributes<HTMLHeadingElement> {
11
- level?: HeadingLevel;
12
- as?: 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6' | 'div' | 'span';
13
- testId?: string;
14
- ref?: React.Ref<HTMLHeadingElement>;
15
- }
16
-
17
- export type HeadingProps = HeadingBaseProps & MarginProps;
18
-
19
- const Heading = memo(
20
- ({
21
- level = 'md',
22
- as,
23
- testId = NAME,
24
- className,
25
- ref,
26
- ...props
27
- }: HeadingProps) => {
28
- const [theme] = useTheme();
29
-
30
- const {
31
- typography: {
32
- heading: { xxl, xl, lg, md, sm, xs },
33
- },
34
- } = theme;
35
-
36
- const defaultHeadingTag =
37
- level === 'xxl'
38
- ? 'h1'
39
- : level === 'xl'
40
- ? 'h2'
41
- : level === 'lg'
42
- ? 'h3'
43
- : level === 'md'
44
- ? 'h4'
45
- : level === 'sm'
46
- ? 'h5'
47
- : 'h6';
48
-
49
- const baseStyle = css`
50
- font-family: ${md.md.fontFamily};
51
- font-feature-settings: ${md.md.fontSettings};
52
- color: ${theme.colour.text.default};
53
- margin: 0;
54
- `;
55
-
56
- const levelXxlStyle = css`
57
- font-size: ${xxl.sm.fontSize}px;
58
- font-weight: ${xxl.sm.fontWeight};
59
- line-height: ${xxl.sm.lineHeight}%;
60
- @media screen and (min-width: ${theme.breakpoints.tablet}px) {
61
- font-size: ${xxl.md.fontSize}px;
62
- font-weight: ${xxl.md.fontWeight};
63
- line-height: ${xxl.md.lineHeight}%;
64
- }
65
- `;
66
-
67
- const levelXlStyle = css`
68
- font-size: ${xl.sm.fontSize}px;
69
- font-weight: ${xl.sm.fontWeight};
70
- line-height: ${xl.sm.lineHeight}%;
71
- @media screen and (min-width: ${theme.breakpoints.tablet}px) {
72
- font-size: ${xl.md.fontSize}px;
73
- font-weight: ${xl.md.fontWeight};
74
- line-height: ${xl.md.lineHeight}%;
75
- }
76
- `;
77
-
78
- const levelLgStyle = css`
79
- font-size: ${lg.sm.fontSize}px;
80
- font-weight: ${lg.sm.fontWeight};
81
- line-height: ${lg.sm.lineHeight}%;
82
- @media screen and (min-width: ${theme.breakpoints.tablet}px) {
83
- font-size: ${lg.md.fontSize}px;
84
- font-weight: ${lg.md.fontWeight};
85
- line-height: ${lg.md.lineHeight}%;
86
- }
87
- `;
88
-
89
- const levelMdStyle = css`
90
- font-size: ${md.sm.fontSize}px;
91
- font-weight: ${md.sm.fontWeight};
92
- line-height: ${md.sm.lineHeight}%;
93
- @media screen and (min-width: ${theme.breakpoints.tablet}px) {
94
- font-size: ${md.md.fontSize}px;
95
- font-weight: ${md.md.fontWeight};
96
- line-height: ${md.md.lineHeight}%;
97
- }
98
- `;
99
-
100
- const levelSmStyle = css`
101
- font-size: ${sm.sm.fontSize}px;
102
- font-weight: ${sm.sm.fontWeight};
103
- line-height: ${sm.sm.lineHeight}%;
104
- @media screen and (min-width: ${theme.breakpoints.tablet}px) {
105
- font-size: ${sm.md.fontSize}px;
106
- font-weight: ${sm.md.fontWeight};
107
- line-height: ${sm.md.lineHeight}%;
108
- }
109
- `;
110
-
111
- const levelXsStyle = css`
112
- font-size: ${xs.sm.fontSize}px;
113
- font-weight: ${xs.sm.fontWeight};
114
- line-height: ${xs.sm.lineHeight}%;
115
- @media screen and (min-width: ${theme.breakpoints.tablet}px) {
116
- font-size: ${xs.md.fontSize}px;
117
- font-weight: ${xs.md.fontWeight};
118
- line-height: ${xs.md.lineHeight}%;
119
- }
120
- `;
121
-
122
- const style = cx(
123
- NAME,
124
- baseStyle,
125
- level === 'xxl' && levelXxlStyle,
126
- level === 'xl' && levelXlStyle,
127
- level === 'lg' && levelLgStyle,
128
- level === 'md' && levelMdStyle,
129
- level === 'sm' && levelSmStyle,
130
- level === 'xs' && levelXsStyle,
131
- marginsStyle(props, theme),
132
- className
133
- );
134
-
135
- const headingTag = (as || defaultHeadingTag) as keyof JSX.IntrinsicElements;
136
-
137
- return (
138
- <>
139
- {headingTag === 'h1' && (
140
- <h1
141
- ref={ref}
142
- className={style}
143
- data-testid={testId}
144
- {...props}
145
- />
146
- )}
147
- {headingTag === 'h2' && (
148
- <h2
149
- ref={ref}
150
- className={style}
151
- data-testid={testId}
152
- {...props}
153
- />
154
- )}
155
- {headingTag === 'h3' && (
156
- <h3
157
- ref={ref}
158
- className={style}
159
- data-testid={testId}
160
- {...props}
161
- />
162
- )}
163
- {headingTag === 'h4' && (
164
- <h4
165
- ref={ref}
166
- className={style}
167
- data-testid={testId}
168
- {...props}
169
- />
170
- )}
171
- {headingTag === 'h5' && (
172
- <h5
173
- ref={ref}
174
- className={style}
175
- data-testid={testId}
176
- {...props}
177
- />
178
- )}
179
- {headingTag === 'h6' && (
180
- <h6
181
- ref={ref}
182
- className={style}
183
- data-testid={testId}
184
- {...props}
185
- />
186
- )}
187
- {headingTag === 'span' && (
188
- <span
189
- ref={ref as React.Ref<HTMLSpanElement>}
190
- className={style}
191
- data-testid={testId}
192
- {...props}
193
- />
194
- )}
195
- {headingTag === 'div' && (
196
- <div
197
- ref={ref as React.Ref<HTMLDivElement>}
198
- className={style}
199
- data-testid={testId}
200
- {...props}
201
- />
202
- )}
203
- </>
204
- );
205
- }
206
- );
207
-
208
- export default Heading;
@@ -1,2 +0,0 @@
1
- export { default } from './Heading';
2
- export type { HeadingProps } from './Heading';
@@ -1,200 +0,0 @@
1
- import { memo, HTMLAttributes, JSX } from 'react';
2
- import { css, cx } from '@emotion/css';
3
- import useTheme from '../../theme/useTheme';
4
- import marginsStyle, { MarginProps } from '../common/marginsStyle';
5
-
6
- export const NAME = 'ucl-uikit-paragrah';
7
-
8
- export type ParagraphLevel =
9
- | 'lg'
10
- | 'lg-medium'
11
- | 'lg-semibold'
12
- | 'lg-bold'
13
- | 'md'
14
- | 'md-medium'
15
- | 'md-semibold'
16
- | 'md-semibold'
17
- | 'md-medium-numeric'
18
- | 'sm'
19
- | 'sm-medium'
20
- | 'sm-semibold'
21
- | 'xs'
22
- | 'xs-medium';
23
-
24
- export interface ParagraphBaseProps extends HTMLAttributes<HTMLParagraphElement> {
25
- level?: ParagraphLevel;
26
- as?: 'p' | 'div' | 'span';
27
- testId?: string;
28
- ref?: React.Ref<HTMLParagraphElement>;
29
- }
30
-
31
- export type ParagraphProps = ParagraphBaseProps & MarginProps;
32
-
33
- const Paragraph = ({
34
- level = 'md',
35
- as = 'p',
36
- testId = NAME,
37
- className,
38
- ref,
39
- ...props
40
- }: ParagraphProps) => {
41
- const [theme] = useTheme();
42
-
43
- const {
44
- typography: {
45
- body: {
46
- lg,
47
- lgMedium,
48
- lgSemibold,
49
- lgBold,
50
- md,
51
- mdMedium,
52
- mdSemibold,
53
- mdMediumNumeric,
54
- sm,
55
- smMedium,
56
- smSemibold,
57
- xs,
58
- xsMedium,
59
- },
60
- },
61
- } = theme;
62
-
63
- const baseStyle = css`
64
- font-family: ${md.fontFamily};
65
- font-feature-settings: ${md.fontSettings};
66
- color: ${theme.colour.text.default};
67
- margin: 0;
68
- `;
69
-
70
- const lgStyle = css`
71
- font-size: ${lg.fontSize}px;
72
- font-weight: ${lg.fontWeight};
73
- line-height: ${lg.lineHeight}%;
74
- `;
75
-
76
- const lgMediumStyle = css`
77
- font-size: ${lgMedium.fontSize}px;
78
- font-weight: ${lgMedium.fontWeight};
79
- line-height: ${lgMedium.lineHeight}%;
80
- `;
81
-
82
- const lgSemiboldStyle = css`
83
- font-size: ${lgSemibold.fontSize}px;
84
- font-weight: ${lgSemibold.fontWeight};
85
- line-height: ${lgSemibold.lineHeight}%;
86
- `;
87
-
88
- const lgBoldStyle = css`
89
- font-size: ${lgBold.fontSize}px;
90
- font-weight: ${lgBold.fontWeight};
91
- line-height: ${lgBold.lineHeight}%;
92
- `;
93
-
94
- const mdStyle = css`
95
- font-size: ${md.fontSize}px;
96
- font-weight: ${md.fontWeight};
97
- line-height: ${md.lineHeight}%;
98
- `;
99
-
100
- const mdMediumStyle = css`
101
- font-size: ${mdMedium.fontSize}px;
102
- font-weight: ${mdMedium.fontWeight};
103
- line-height: ${mdMedium.lineHeight}%;
104
- `;
105
-
106
- const mdSemiboldStyle = css`
107
- font-size: ${mdSemibold.fontSize}px;
108
- font-weight: ${mdSemibold.fontWeight};
109
- line-height: ${mdSemibold.lineHeight}%;
110
- `;
111
-
112
- const mdMediumNumericStyle = css`
113
- font-size: ${mdMediumNumeric.fontSize}px;
114
- font-weight: ${mdMediumNumeric.fontWeight};
115
- line-height: ${mdMediumNumeric.lineHeight}%;
116
- `;
117
-
118
- const smStyle = css`
119
- font-size: ${sm.fontSize}px;
120
- font-weight: ${sm.fontWeight};
121
- line-height: ${sm.lineHeight}%;
122
- `;
123
-
124
- const smMediumStyle = css`
125
- font-size: ${smMedium.fontSize}px;
126
- font-weight: ${smMedium.fontWeight};
127
- line-height: ${smMedium.lineHeight}%;
128
- `;
129
-
130
- const smSemiboldStyle = css`
131
- font-size: ${smSemibold.fontSize}px;
132
- font-weight: ${smSemibold.fontWeight};
133
- line-height: ${smSemibold.lineHeight}%;
134
- `;
135
-
136
- const xsStyle = css`
137
- font-size: ${xs.fontSize}px;
138
- font-weight: ${xs.fontWeight};
139
- line-height: ${xs.lineHeight}%;
140
- `;
141
-
142
- const xsMediumStyle = css`
143
- font-size: ${xsMedium.fontSize}px;
144
- font-weight: ${xsMedium.fontWeight};
145
- line-height: ${xsMedium.lineHeight}%;
146
- `;
147
-
148
- const style = cx(
149
- NAME,
150
- baseStyle,
151
- level === 'lg' && lgStyle,
152
- level === 'lg-medium' && lgMediumStyle,
153
- level === 'lg-semibold' && lgSemiboldStyle,
154
- level === 'lg-bold' && lgBoldStyle,
155
- level === 'md' && mdStyle,
156
- level === 'md-medium' && mdMediumStyle,
157
- level === 'md-semibold' && mdSemiboldStyle,
158
- level === 'md-medium-numeric' && mdMediumNumericStyle,
159
- level === 'sm' && smStyle,
160
- level === 'sm-medium' && smMediumStyle,
161
- level === 'sm-semibold' && smSemiboldStyle,
162
- level === 'xs' && xsStyle,
163
- level === 'xs-medium' && xsMediumStyle,
164
- marginsStyle(props, theme),
165
- className
166
- );
167
-
168
- const paragraphTag = as as keyof JSX.IntrinsicElements;
169
-
170
- return (
171
- <>
172
- {paragraphTag === 'p' && (
173
- <p
174
- ref={ref}
175
- className={style}
176
- data-testid={testId}
177
- {...props}
178
- />
179
- )}
180
- {paragraphTag === 'div' && (
181
- <div
182
- ref={ref as React.Ref<HTMLDivElement>}
183
- className={style}
184
- data-testid={testId}
185
- {...props}
186
- />
187
- )}
188
- {paragraphTag === 'span' && (
189
- <span
190
- ref={ref as React.Ref<HTMLSpanElement>}
191
- className={style}
192
- data-testid={testId}
193
- {...props}
194
- />
195
- )}
196
- </>
197
- );
198
- };
199
-
200
- export default memo(Paragraph);
@@ -1,6 +0,0 @@
1
- export { default } from './Paragraph';
2
- export type { ParagraphProps } from './Paragraph';
3
- // TODO: Remove aliased export in future breaking release
4
- // <Paragraph> will be used in place of <Text> in the future
5
- export { default as Text } from './Paragraph';
6
- export type { ParagraphProps as TextProps } from './Paragraph';