@uni-design-system/uni-react 1.0.0 → 2.0.1

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 (81) hide show
  1. package/.storybook/main.ts +12 -12
  2. package/.storybook/manager.ts +13 -0
  3. package/.storybook/preview.ts +2 -2
  4. package/.turbo/turbo-build.log +4 -4
  5. package/CHANGELOG.md +20 -0
  6. package/dist/components/button/button.component.d.ts.map +1 -1
  7. package/dist/components/card/card.component.d.ts.map +1 -1
  8. package/dist/components/draggable/SortableList/components/SortableItem/sortableItem.component.d.ts.map +1 -1
  9. package/dist/components/draggable/SortableList/sortableList.stories.d.ts.map +1 -1
  10. package/dist/components/draggable/utilities/index.d.ts.map +1 -1
  11. package/dist/components/forms/utils/validations.d.ts.map +1 -1
  12. package/dist/components/grainy-gradient-background/grainy-gradient-background.component.stories.d.ts.map +1 -1
  13. package/dist/components/icon-text-row/icon-text-row.component.d.ts.map +1 -1
  14. package/dist/components/modal/modal.component.d.ts.map +1 -1
  15. package/dist/components/switch/switch.component.d.ts.map +1 -1
  16. package/dist/components/switch/switch.config.d.ts +2 -2
  17. package/dist/components/switch/switch.config.d.ts.map +1 -1
  18. package/dist/core/border/border.style.d.ts +2 -2
  19. package/dist/core/border/border.style.d.ts.map +1 -1
  20. package/dist/core/icon/icon.component.d.ts.map +1 -1
  21. package/dist/core/icon/icon.stories.d.ts.map +1 -1
  22. package/dist/core/icon/index.d.ts +1 -1
  23. package/dist/core/icon/index.d.ts.map +1 -1
  24. package/dist/core/image/image.component.d.ts.map +1 -1
  25. package/dist/core/layout/layout.provider.d.ts.map +1 -1
  26. package/dist/core/overlay/overlay.config.d.ts +2 -2
  27. package/dist/core/overlay/overlay.config.d.ts.map +1 -1
  28. package/dist/core/padding/padding.style.d.ts.map +1 -1
  29. package/dist/core/text/text.component.d.ts.map +1 -1
  30. package/dist/core/text/text.stories.d.ts.map +1 -1
  31. package/dist/core/theme/theming.d.ts +4 -4
  32. package/dist/core/theme/theming.d.ts.map +1 -1
  33. package/dist/core/transition/collapse/collapse.component.d.ts.map +1 -1
  34. package/dist/core/transition/fade/fade.component.d.ts.map +1 -1
  35. package/dist/core/transition/slide/slide.component.d.ts.map +1 -1
  36. package/dist/core/transition/transition.utils.d.ts.map +1 -1
  37. package/dist/index.js +2668 -2442
  38. package/dist/tools/color-picker/color-picker.component.d.ts +1 -1
  39. package/dist/tools/color-picker/color-picker.component.d.ts.map +1 -1
  40. package/dist/tools/color-picker/color-picker.stories.d.ts +1 -1
  41. package/dist/tools/color-swatch/color-swatch.component.d.ts +1 -1
  42. package/dist/tools/color-swatch/color-swatch.component.d.ts.map +1 -1
  43. package/dist/utils/storage-manager.d.ts.map +1 -1
  44. package/package.json +11 -11
  45. package/src/components/button/button.component.tsx +18 -5
  46. package/src/components/card/card.component.tsx +6 -1
  47. package/src/components/draggable/SortableList/components/SortableItem/sortableItem.component.tsx +10 -2
  48. package/src/components/draggable/SortableList/sortableList.component.tsx +1 -1
  49. package/src/components/draggable/SortableList/sortableList.stories.tsx +8 -4
  50. package/src/components/draggable/utilities/index.ts +1 -1
  51. package/src/components/forms/utils/validations.ts +2 -1
  52. package/src/components/grainy-gradient-background/grainy-gradient-background.component.stories.tsx +4 -1
  53. package/src/components/icon-text-row/icon-text-row.component.tsx +6 -1
  54. package/src/components/modal/modal.component.tsx +6 -1
  55. package/src/components/switch/switch.component.tsx +4 -1
  56. package/src/components/switch/switch.config.ts +1 -1
  57. package/src/core/border/border.style.ts +5 -4
  58. package/src/core/flex/flex.style.ts +17 -17
  59. package/src/core/hooks/use-media.ts +1 -1
  60. package/src/core/hooks/use-toggle.tsx +1 -1
  61. package/src/core/icon/icon.component.tsx +1 -1
  62. package/src/core/icon/icon.stories.tsx +4 -1
  63. package/src/core/icon/index.ts +5 -1
  64. package/src/core/image/image.component.tsx +12 -2
  65. package/src/core/layout/layout.provider.tsx +5 -10
  66. package/src/core/overlay/overlay.config.ts +10 -3
  67. package/src/core/padding/padding.style.ts +9 -10
  68. package/src/core/text/text.component.tsx +2 -1
  69. package/src/core/text/text.stories.tsx +12 -30
  70. package/src/core/theme/theming.tsx +8 -7
  71. package/src/core/transition/collapse/collapse.component.tsx +10 -2
  72. package/src/core/transition/fade/fade.component.tsx +16 -2
  73. package/src/core/transition/slide/slide.component.tsx +12 -2
  74. package/src/core/transition/transition.utils.ts +8 -2
  75. package/src/stories/Configure.mdx +31 -26
  76. package/src/tools/color-picker/color-picker.component.tsx +6 -1
  77. package/src/tools/color-swatch/color-swatch.component.tsx +8 -1
  78. package/src/utils/storage-manager.ts +4 -1
  79. package/tsconfig.json +4 -3
  80. package/vite.config.ts +7 -7
  81. package/vitest.shims.d.ts +1 -1
@@ -4,5 +4,5 @@ export interface ColorPickerProps {
4
4
  imageHeight: number;
5
5
  sampleSize: number;
6
6
  }
7
- export declare const ColorPicker: ({ imageUrl, imageWidth, imageHeight, sampleSize }: ColorPickerProps) => JSX.Element;
7
+ export declare const ColorPicker: ({ imageUrl, imageWidth, imageHeight, sampleSize, }: ColorPickerProps) => JSX.Element;
8
8
  //# sourceMappingURL=color-picker.component.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"color-picker.component.d.ts","sourceRoot":"","sources":["../../../src/tools/color-picker/color-picker.component.tsx"],"names":[],"mappings":"AAIA,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,EAAE,MAAM,CAAC;IACjB,UAAU,EAAE,MAAM,CAAC;IACnB,WAAW,EAAE,MAAM,CAAC;IACpB,UAAU,EAAE,MAAM,CAAC;CACpB;AAED,eAAO,MAAM,WAAW,GAAI,mDAAwD,gBAAgB,KAAG,GAAG,CAAC,OAsI1G,CAAC"}
1
+ {"version":3,"file":"color-picker.component.d.ts","sourceRoot":"","sources":["../../../src/tools/color-picker/color-picker.component.tsx"],"names":[],"mappings":"AAIA,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,EAAE,MAAM,CAAC;IACjB,UAAU,EAAE,MAAM,CAAC;IACnB,WAAW,EAAE,MAAM,CAAC;IACpB,UAAU,EAAE,MAAM,CAAC;CACpB;AAED,eAAO,MAAM,WAAW,GAAI,oDAKzB,gBAAgB,KAAG,GAAG,CAAC,OAsIzB,CAAC"}
@@ -1,7 +1,7 @@
1
1
  import { ColorPickerProps } from './color-picker.component';
2
2
  declare const _default: {
3
3
  title: string;
4
- component: ({ imageUrl, imageWidth, imageHeight, sampleSize }: ColorPickerProps) => JSX.Element;
4
+ component: ({ imageUrl, imageWidth, imageHeight, sampleSize, }: ColorPickerProps) => JSX.Element;
5
5
  parameters: {
6
6
  layout: string;
7
7
  };
@@ -9,5 +9,5 @@ export interface ColorSwatchProps {
9
9
  width?: string | number;
10
10
  height?: string | number;
11
11
  }
12
- export declare function ColorSwatch({ rgba, children, cardType, elevation, width, height }: ColorSwatchProps): import("react/jsx-runtime").JSX.Element;
12
+ export declare function ColorSwatch({ rgba, children, cardType, elevation, width, height, }: ColorSwatchProps): import("react/jsx-runtime").JSX.Element;
13
13
  //# sourceMappingURL=color-swatch.component.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"color-swatch.component.d.ts","sourceRoot":"","sources":["../../../src/tools/color-swatch/color-swatch.component.tsx"],"names":[],"mappings":"AAAA,OAAc,EAAiB,SAAS,EAAE,MAAM,OAAO,CAAC;AACxD,OAAO,EAAgB,GAAG,EAAY,eAAe,EAAE,MAAM,6BAA6B,CAAC;AAG3F,MAAM,MAAM,QAAQ,GAAG,UAAU,GAAG,QAAQ,GAAG,UAAU,CAAC;AAE1D,MAAM,WAAW,gBAAgB;IAC/B,IAAI,EAAE,GAAG,CAAC;IACV,QAAQ,CAAC,EAAE,SAAS,CAAC;IACrB,QAAQ,CAAC,EAAE,QAAQ,CAAC;IACpB,SAAS,CAAC,EAAE,eAAe,CAAC;IAC5B,KAAK,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IACxB,MAAM,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;CAC1B;AAED,wBAAgB,WAAW,CAAC,EAAE,IAAI,EAAE,QAAQ,EAAE,QAAqB,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,EAAE,EAAE,gBAAgB,2CA6ChH"}
1
+ {"version":3,"file":"color-swatch.component.d.ts","sourceRoot":"","sources":["../../../src/tools/color-swatch/color-swatch.component.tsx"],"names":[],"mappings":"AAAA,OAAc,EAAiB,SAAS,EAAE,MAAM,OAAO,CAAC;AACxD,OAAO,EAAgB,GAAG,EAAY,eAAe,EAAE,MAAM,6BAA6B,CAAC;AAG3F,MAAM,MAAM,QAAQ,GAAG,UAAU,GAAG,QAAQ,GAAG,UAAU,CAAC;AAE1D,MAAM,WAAW,gBAAgB;IAC/B,IAAI,EAAE,GAAG,CAAC;IACV,QAAQ,CAAC,EAAE,SAAS,CAAC;IACrB,QAAQ,CAAC,EAAE,QAAQ,CAAC;IACpB,SAAS,CAAC,EAAE,eAAe,CAAC;IAC5B,KAAK,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IACxB,MAAM,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;CAC1B;AAED,wBAAgB,WAAW,CAAC,EAC1B,IAAI,EACJ,QAAQ,EACR,QAAqB,EACrB,SAAS,EACT,KAAK,EACL,MAAM,GACP,EAAE,gBAAgB,2CA6ClB"}
@@ -1 +1 @@
1
- {"version":3,"file":"storage-manager.d.ts","sourceRoot":"","sources":["../../src/utils/storage-manager.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,cAAc,CAAC,CAAC;IAC/B,IAAI,EAAE,QAAQ,GAAG,cAAc,CAAC;IAChC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,GAAG,CAAC,GAAG,SAAS,CAAC;IAC7B,GAAG,CAAC,KAAK,EAAE,CAAC,GAAG,IAAI,CAAC;CACrB;AAID,eAAO,MAAM,yBAAyB,GAAI,CAAC,EAAE,KAAK,MAAM,KAAG,cAAc,CAAC,CAAC,CAoBzE,CAAC;AASH,eAAO,MAAM,0BAA0B,GAAI,KAAK,MAAM,EAAE,SAAS,MAAM,KAAG,cAAc,CAAC,MAAM,CAU7F,CAAC"}
1
+ {"version":3,"file":"storage-manager.d.ts","sourceRoot":"","sources":["../../src/utils/storage-manager.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,cAAc,CAAC,CAAC;IAC/B,IAAI,EAAE,QAAQ,GAAG,cAAc,CAAC;IAChC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,GAAG,CAAC,GAAG,SAAS,CAAC;IAC7B,GAAG,CAAC,KAAK,EAAE,CAAC,GAAG,IAAI,CAAC;CACrB;AAID,eAAO,MAAM,yBAAyB,GAAI,CAAC,EAAE,KAAK,MAAM,KAAG,cAAc,CAAC,CAAC,CAoBzE,CAAC;AASH,eAAO,MAAM,0BAA0B,GACrC,KAAK,MAAM,EACX,SAAS,MAAM,KACd,cAAc,CAAC,MAAM,CAUtB,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@uni-design-system/uni-react",
3
- "version": "1.0.0",
3
+ "version": "2.0.1",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "https://github.com/uni-design-system/uni",
@@ -16,8 +16,8 @@
16
16
  ".": "./src/index.ts"
17
17
  },
18
18
  "peerDependencies": {
19
- "react": ">=18",
20
- "@uni-design-system/uni-core": ">=1.0.0"
19
+ "@uni-design-system/uni-core": ">=2.0.1",
20
+ "react": ">=18"
21
21
  },
22
22
  "dependencies": {
23
23
  "@dnd-kit/core": "^6.3.1",
@@ -31,11 +31,11 @@
31
31
  "use-ripple-hook": "^2.0.0"
32
32
  },
33
33
  "devDependencies": {
34
- "@chromatic-com/storybook": "^5.1.2",
35
- "@storybook/addon-a11y": "^10.3.6",
36
- "@storybook/addon-docs": "^10.3.6",
37
- "@storybook/addon-vitest": "^10.3.6",
38
- "@storybook/react-vite": "^10.3.6",
34
+ "@chromatic-com/storybook": "^5.2.1",
35
+ "@storybook/addon-a11y": "^10.4.0",
36
+ "@storybook/addon-docs": "^10.4.0",
37
+ "@storybook/addon-vitest": "^10.4.0",
38
+ "@storybook/react-vite": "^10.4.0",
39
39
  "@types/react": "^18.2.0",
40
40
  "@types/react-dom": "^18.2.0",
41
41
  "@vitejs/plugin-react": "^4.2.0",
@@ -43,13 +43,13 @@
43
43
  "@vitest/coverage-v8": "^4.1.5",
44
44
  "csstype": "^3.2.3",
45
45
  "playwright": "^1.59.1",
46
- "storybook": "^10.3.6",
46
+ "storybook": "^10.4.0",
47
47
  "typescript": "^5.0.0",
48
48
  "unplugin-dts": "^1.0.0",
49
49
  "vite": "^7.0.0",
50
50
  "vitest": "^4.1.5",
51
- "@uni-design-system/uni-core": "1.0.1",
52
- "@uni-design-system/tsconfig": "0.0.0"
51
+ "@uni-design-system/tsconfig": "0.0.0",
52
+ "@uni-design-system/uni-core": "2.0.1"
53
53
  },
54
54
  "scripts": {
55
55
  "dev": "vite",
@@ -1,6 +1,12 @@
1
1
  import React, { CSSProperties, ReactNode, useEffect, useState } from 'react';
2
2
  import { BoxShadow, Text, useLayout, useTheme } from '../../core';
3
- import { Theme, ButtonType, ColorToken, Size, ContentColorToken } from '@uni-design-system/uni-core';
3
+ import {
4
+ UniTheme,
5
+ ButtonType,
6
+ ColorToken,
7
+ Size,
8
+ ContentColorToken,
9
+ } from '@uni-design-system/uni-core';
4
10
  import { IconTextRow } from '../icon-text-row';
5
11
  import { IconName } from '../../core/icon';
6
12
  import { useRipple } from 'use-ripple-hook';
@@ -79,15 +85,22 @@ export const Button = ({
79
85
  };
80
86
 
81
87
  function Style(
82
- theme: Theme,
88
+ theme: UniTheme,
83
89
  buttonType: ButtonType,
84
90
  size: Size = 'md',
85
91
  hover: boolean,
86
92
  disabled: boolean,
87
- click: boolean,
93
+ click: boolean
88
94
  ): CSSProperties {
89
- const { color, horizontalPadding, verticalPadding, borderColor, borderWidth, borderRadius, contentColor } =
90
- theme.buttons[buttonType];
95
+ const {
96
+ color,
97
+ horizontalPadding,
98
+ verticalPadding,
99
+ borderColor,
100
+ borderWidth,
101
+ borderRadius,
102
+ contentColor,
103
+ } = theme.buttons[buttonType];
91
104
 
92
105
  const styles: CSSProperties = {
93
106
  overflow: 'hidden',
@@ -1,5 +1,10 @@
1
1
  import React, { CSSProperties, HTMLAttributes, ReactNode } from 'react';
2
- import { ColorToken, ContainerColorToken, ShadowElevation, Size } from '@uni-design-system/uni-core';
2
+ import {
3
+ ColorToken,
4
+ ContainerColorToken,
5
+ ShadowElevation,
6
+ Size,
7
+ } from '@uni-design-system/uni-core';
3
8
  import { BoxShadow, Padding, useTheme } from '../../core';
4
9
  import { Property } from 'csstype';
5
10
  import Container from '../../core/container/container.component';
@@ -17,7 +17,15 @@ export const SortableItem = ({
17
17
  style: userStyle,
18
18
  onRemove,
19
19
  }: PropsWithChildren<SortableItemProps>): JSX.Element => {
20
- const { attributes, isDragging, listeners, setNodeRef, setActivatorNodeRef, transform, transition } = useSortable({
20
+ const {
21
+ attributes,
22
+ isDragging,
23
+ listeners,
24
+ setNodeRef,
25
+ setActivatorNodeRef,
26
+ transform,
27
+ transition,
28
+ } = useSortable({
21
29
  id,
22
30
  });
23
31
  const context = useMemo(
@@ -26,7 +34,7 @@ export const SortableItem = ({
26
34
  listeners,
27
35
  ref: setActivatorNodeRef,
28
36
  }),
29
- [attributes, listeners, setActivatorNodeRef],
37
+ [attributes, listeners, setActivatorNodeRef]
30
38
  );
31
39
  const style: CSSProperties = {
32
40
  opacity: isDragging ? 0.4 : undefined,
@@ -29,7 +29,7 @@ export const SortableList = <T extends SortableItemProps>({
29
29
  useSensor(PointerSensor),
30
30
  useSensor(KeyboardSensor, {
31
31
  coordinateGetter: sortableKeyboardCoordinates,
32
- }),
32
+ })
33
33
  );
34
34
 
35
35
  const style: CSSProperties = {
@@ -7,8 +7,7 @@ import { findManyChannelStatus } from './mockData';
7
7
 
8
8
  import { Button } from '../../button';
9
9
  import { UniqueIdentifier } from '@dnd-kit/core';
10
- import { Text } from '../../../core';
11
- import { Flex } from '../../../core/flex/flex.component';
10
+ import { Flex, Text } from '../../../core';
12
11
 
13
12
  export default {
14
13
  title: 'Components/Draggable/Sortable List',
@@ -41,7 +40,8 @@ export const BasicList = (): JSX.Element => {
41
40
  export const SortableRows = (): JSX.Element => {
42
41
  const [items, setItems] = useState(findManyChannelStatus);
43
42
 
44
- const handleRemove = (id: UniqueIdentifier): void => setItems((items) => items.filter((item) => item.id !== id));
43
+ const handleRemove = (id: UniqueIdentifier): void =>
44
+ setItems((items) => items.filter((item) => item.id !== id));
45
45
 
46
46
  return (
47
47
  <SortableList
@@ -58,7 +58,11 @@ export const SortableRows = (): JSX.Element => {
58
58
  <Flex align="center">
59
59
  <DragHandle />
60
60
  <Text role="paragraph">{name}</Text>
61
- <Button buttonType="icon" onClick={(): void => handleRemove(id)} iconName="trashCanRegular" />
61
+ <Button
62
+ buttonType="icon"
63
+ onClick={(): void => handleRemove(id)}
64
+ iconName="trashCanRegular"
65
+ />
62
66
  </Flex>
63
67
  </SortableItem>
64
68
  )}
@@ -1 +1 @@
1
- export {createRange} from './createRange';
1
+ export { createRange } from './createRange';
@@ -9,7 +9,8 @@ export type ValidationRule =
9
9
 
10
10
  export const validations: Record<ValidationRule, unknown> = {
11
11
  email: {
12
- rule: () => /^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i,
12
+ rule: () =>
13
+ /^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i,
13
14
  formatter(fieldName: string) {
14
15
  return `${fieldName} is not valid email`;
15
16
  },
@@ -1,5 +1,8 @@
1
1
  import React from 'react';
2
- import { GrainyGradientBackground, GrainyGradientProps } from './grainy-gradient-background.component';
2
+ import {
3
+ GrainyGradientBackground,
4
+ GrainyGradientProps,
5
+ } from './grainy-gradient-background.component';
3
6
 
4
7
  export default {
5
8
  title: 'Components/Background',
@@ -1,5 +1,10 @@
1
1
  import React, { ReactNode } from 'react';
2
- import { ContentColorToken, getValue, HorizontalAlign, TextRole } from '@uni-design-system/uni-core';
2
+ import {
3
+ ContentColorToken,
4
+ getValue,
5
+ HorizontalAlign,
6
+ TextRole,
7
+ } from '@uni-design-system/uni-core';
3
8
 
4
9
  import { alignCenter, expand, fix, row, Text, Icon, useTheme } from '../../core';
5
10
  import { IconName } from '../../core/icon';
@@ -33,7 +33,12 @@ export const Modal = ({ children, isOpen, size = 'lg' }: ModalProps) => {
33
33
  exit={{ y: 36, opacity: 0 }}
34
34
  transition={{ duration: 0.2 }}
35
35
  >
36
- <Card colorToken="background" width={ModalSizes[size]} cardType="elevated" elevation="modal">
36
+ <Card
37
+ colorToken="background"
38
+ width={ModalSizes[size]}
39
+ cardType="elevated"
40
+ elevation="modal"
41
+ >
37
42
  {children}
38
43
  </Card>
39
44
  </motion.div>
@@ -25,7 +25,10 @@ export const Switch = ({ size = 'sm', on = false, onChange }: SwitchProps) => {
25
25
  damping: 30,
26
26
  };
27
27
 
28
- const config = SwitchConfigs[size];
28
+ const config = SwitchConfigs[size] || {
29
+ radius: 8,
30
+ padding: 2,
31
+ };
29
32
 
30
33
  const handleDiameter = config.radius * 2;
31
34
  const switchWidth = config.radius * 4;
@@ -1,6 +1,6 @@
1
1
  import { Size } from '@uni-design-system/uni-core';
2
2
 
3
- export const SwitchConfigs: Record<Size, { radius: number; padding: number }> = {
3
+ export const SwitchConfigs: Partial<Record<Size, { radius: number; padding: number }>> = {
4
4
  xs: {
5
5
  radius: 6,
6
6
  padding: 2,
@@ -1,7 +1,7 @@
1
- import { Border, ColorToken, getValue, Theme } from '@uni-design-system/uni-core';
1
+ import { Border, ColorToken, getValue, UniTheme } from '@uni-design-system/uni-core';
2
2
  import { CSSProperties } from 'react';
3
3
 
4
- export function BorderStyle(border: Border | undefined, theme: Theme): CSSProperties {
4
+ export function BorderStyle(border: Border | undefined, theme: UniTheme): CSSProperties {
5
5
  if (!border) return {};
6
6
 
7
7
  const borderTopColor = extractColor(theme, border, 'colorTop');
@@ -25,6 +25,7 @@ export function BorderStyle(border: Border | undefined, theme: Theme): CSSProper
25
25
  };
26
26
  }
27
27
 
28
- function extractColor(theme: Theme, border: Border, key: string): string {
29
- return theme.colors[getValue(border, key, 'color') as ColorToken];
28
+ function extractColor(theme: UniTheme, border: Border, key: string): string | undefined {
29
+ const colorToken = getValue(border, key, 'color') as ColorToken;
30
+ return colorToken ? theme.colors[colorToken] : undefined;
30
31
  }
@@ -6,12 +6,12 @@ export const flex: CSSProperties = { flex: 1 };
6
6
  export const row: CSSProperties = {
7
7
  display: 'flex',
8
8
  flex: 1,
9
- flexDirection: 'row'
9
+ flexDirection: 'row',
10
10
  };
11
11
 
12
12
  export const column: CSSProperties = {
13
13
  flex: 1,
14
- flexDirection: 'column'
14
+ flexDirection: 'column',
15
15
  };
16
16
 
17
17
  export const alignTop: CSSProperties = { alignItems: 'flex-start' };
@@ -21,7 +21,7 @@ export const alignBottom: CSSProperties = { alignItems: 'flex-end' };
21
21
  export const FlexVerticalAlignments: Record<VerticalAlign, CSSProperties> = {
22
22
  top: alignTop,
23
23
  middle: alignCenter,
24
- bottom: alignBottom
24
+ bottom: alignBottom,
25
25
  };
26
26
 
27
27
  export const justifyLeft: CSSProperties = { justifyContent: 'flex-start' };
@@ -31,76 +31,76 @@ export const justifyRight: CSSProperties = { justifyContent: 'flex-end' };
31
31
  export const FlexHorizontalAlignments: Record<HorizontalAlign, CSSProperties> = {
32
32
  left: justifyLeft,
33
33
  center: justifyCenter,
34
- right: justifyRight
34
+ right: justifyRight,
35
35
  };
36
36
 
37
37
  export const expand: CSSProperties = { flexGrow: 1 };
38
38
  export const fix: CSSProperties = { flex: 0, flexGrow: 0 };
39
39
 
40
40
  export const rowFlexItem: CSSProperties = {
41
- flexGrow: 1
41
+ flexGrow: 1,
42
42
  };
43
43
 
44
44
  export const rowFixedItem: CSSProperties = {
45
- flexGrow: 0
45
+ flexGrow: 0,
46
46
  };
47
47
 
48
48
  export const flexRowStart: CSSProperties = {
49
49
  flexDirection: 'row',
50
50
  justifyContent: 'flex-start',
51
- alignItems: 'center'
51
+ alignItems: 'center',
52
52
  };
53
53
 
54
54
  export const flexRowCenter: CSSProperties = {
55
55
  flexDirection: 'row',
56
56
  justifyContent: 'center',
57
- alignItems: 'center'
57
+ alignItems: 'center',
58
58
  };
59
59
 
60
60
  export const flexRowEnd: CSSProperties = {
61
61
  flexDirection: 'row',
62
62
  justifyContent: 'flex-end',
63
- alignItems: 'center'
63
+ alignItems: 'center',
64
64
  };
65
65
 
66
66
  export const spaceBetween: CSSProperties = {
67
- justifyContent: 'space-between'
67
+ justifyContent: 'space-between',
68
68
  };
69
69
 
70
70
  export const flexRowSpaceBetween: CSSProperties = {
71
71
  flexDirection: 'row',
72
72
  justifyContent: 'space-between',
73
- alignItems: 'center'
73
+ alignItems: 'center',
74
74
  };
75
75
 
76
76
  export const flexRowSpaceAround: CSSProperties = {
77
77
  flexDirection: 'row',
78
78
  justifyContent: 'space-around',
79
- alignItems: 'center'
79
+ alignItems: 'center',
80
80
  };
81
81
 
82
82
  export const spaceEvenly: CSSProperties = {
83
- justifyContent: 'space-evenly'
83
+ justifyContent: 'space-evenly',
84
84
  };
85
85
 
86
86
  export const flexRowSpaceEvenly: CSSProperties = {
87
87
  flexDirection: 'row',
88
88
  justifyContent: 'space-evenly',
89
- alignItems: 'center'
89
+ alignItems: 'center',
90
90
  };
91
91
 
92
92
  export const flexColumnCenter: CSSProperties = {
93
93
  flexDirection: 'column',
94
94
  justifyContent: 'center',
95
- alignItems: 'center'
95
+ alignItems: 'center',
96
96
  };
97
97
 
98
98
  export const flexColumnSpaceAround: CSSProperties = {
99
99
  flexDirection: 'column',
100
100
  justifyContent: 'space-around',
101
- alignItems: 'center'
101
+ alignItems: 'center',
102
102
  };
103
103
 
104
104
  export const flexOff: CSSProperties = {
105
- position: 'relative'
105
+ position: 'relative',
106
106
  };
@@ -23,7 +23,7 @@ export const useMedia = <T>(queries: string[], values: T[], defaultValue: T) =>
23
23
  // Remove listeners on cleanup
24
24
  return () => mediaQueryLists.forEach((mql) => mql.removeListener(handler));
25
25
  },
26
- [], // Empty array ensures effect is only run on mount and unmount
26
+ [] // Empty array ensures effect is only run on mount and unmount
27
27
  );
28
28
  return value;
29
29
  };
@@ -17,7 +17,7 @@ export function useToggle(initialState: InitialState = false) {
17
17
  off: () => setValue(false),
18
18
  toggle: () => setValue((prev) => !prev),
19
19
  }),
20
- [],
20
+ []
21
21
  );
22
22
  return [value, callbacks] as const;
23
23
  }
@@ -2,7 +2,7 @@ import React from 'react';
2
2
  import { ContentColorToken } from '@uni-design-system/uni-core';
3
3
 
4
4
  import { useTheme } from '../theme';
5
- import {IconDictionary, type IconName} from "@uni-design-system/uni-react-icons/dist/cjs/src";
5
+ import { IconDictionary, type IconName } from '@uni-design-system/uni-react-icons/dist/cjs/src';
6
6
 
7
7
  export interface IconProps {
8
8
  name?: IconName;
@@ -30,7 +30,10 @@ export const IconManifest = (): JSX.Element => {
30
30
 
31
31
  return (
32
32
  <div>
33
- <input onChange={(e): void => setFilteredIcons(Filter(e.target.value))} placeholder="Filter Icons by Name" />
33
+ <input
34
+ onChange={(e): void => setFilteredIcons(Filter(e.target.value))}
35
+ placeholder="Filter Icons by Name"
36
+ />
34
37
  <div>
35
38
  {filteredIcons.map((iconName) => {
36
39
  return (
@@ -1,2 +1,6 @@
1
- export { IconDictionary, type IconName, IconKeys } from '@uni-design-system/uni-react-icons/dist/cjs/src';
1
+ export {
2
+ IconDictionary,
3
+ type IconName,
4
+ IconKeys,
5
+ } from '@uni-design-system/uni-react-icons/dist/cjs/src';
2
6
  export * from './icon.component';
@@ -2,6 +2,16 @@ import React from 'react';
2
2
  import { ImageProps } from './image.model';
3
3
  import { ImageStyle } from './image.style';
4
4
 
5
- export const Image = ({ url, alt, height, width, opacity, fit = 'cover', ...rest }: ImageProps): JSX.Element | null => {
6
- return url ? <img src={url} alt={alt} style={ImageStyle({ fit, opacity, height, width, ...rest })} /> : null;
5
+ export const Image = ({
6
+ url,
7
+ alt,
8
+ height,
9
+ width,
10
+ opacity,
11
+ fit = 'cover',
12
+ ...rest
13
+ }: ImageProps): JSX.Element | null => {
14
+ return url ? (
15
+ <img src={url} alt={alt} style={ImageStyle({ fit, opacity, height, width, ...rest })} />
16
+ ) : null;
7
17
  };
@@ -2,8 +2,7 @@ import React from 'react';
2
2
  import LayoutContext from './layout.context';
3
3
 
4
4
  // @ts-ignore
5
- export const LayoutProvider = ({children}) => {
6
-
5
+ export const LayoutProvider = ({ children }) => {
7
6
  const getWidth = () => document.documentElement.clientWidth;
8
7
  const getHeight = () => document.documentElement.clientHeight;
9
8
 
@@ -16,13 +15,9 @@ export const LayoutProvider = ({children}) => {
16
15
  };
17
16
 
18
17
  React.useEffect(() => {
19
- window.addEventListener("resize", handleWindowResize);
20
- return () => window.removeEventListener("resize", handleWindowResize);
18
+ window.addEventListener('resize', handleWindowResize);
19
+ return () => window.removeEventListener('resize', handleWindowResize);
21
20
  }, []);
22
21
 
23
- return (
24
- <LayoutContext.Provider value={{ height, width }}>
25
- { children }
26
- </LayoutContext.Provider>
27
- )
28
- }
22
+ return <LayoutContext.Provider value={{ height, width }}>{children}</LayoutContext.Provider>;
23
+ };
@@ -1,10 +1,17 @@
1
- import { Theme, HSLAToString } from '@uni-design-system/uni-core';
1
+ import { UniTheme, HSLAToString } from '@uni-design-system/uni-core';
2
2
  import { CSSProperties } from 'react';
3
3
  import { OverlayProps } from './overlay.model';
4
4
 
5
5
  export const OverlayStyle = (
6
- theme: Theme,
7
- { hueRotateDeg = 0, hueDeg = 0, saturation = 0, lightness = 0, transparency = 0.5, blurPx = 0 }: OverlayProps,
6
+ theme: UniTheme,
7
+ {
8
+ hueRotateDeg = 0,
9
+ hueDeg = 0,
10
+ saturation = 0,
11
+ lightness = 0,
12
+ transparency = 0.5,
13
+ blurPx = 0,
14
+ }: OverlayProps
8
15
  ): CSSProperties => {
9
16
  const backgroundColor = HSLAToString({ hue: hueDeg, saturation, lightness, alpha: transparency });
10
17
 
@@ -2,35 +2,34 @@ import { CSSProperties } from 'react';
2
2
  import { Apply, Size } from '@uni-design-system/uni-core';
3
3
 
4
4
  export function Padding(size: Size, apply: Apply): CSSProperties {
5
-
6
5
  const amount: number = 16;
7
6
  const unit: string = 'px';
8
7
 
9
8
  const PaddingMap: Record<Apply, CSSProperties> = {
10
9
  top: {
11
- paddingTop: amount + unit
10
+ paddingTop: amount + unit,
12
11
  },
13
12
  bottom: {
14
- paddingBottom: amount + unit
13
+ paddingBottom: amount + unit,
15
14
  },
16
15
  left: {
17
- paddingLeft: amount + unit
16
+ paddingLeft: amount + unit,
18
17
  },
19
18
  right: {
20
- paddingRight: amount + unit
19
+ paddingRight: amount + unit,
21
20
  },
22
21
  vertical: {
23
22
  paddingTop: amount + unit,
24
- paddingBottom: amount + unit
23
+ paddingBottom: amount + unit,
25
24
  },
26
25
  horizontal: {
27
26
  paddingLeft: amount + unit,
28
- paddingRight: amount + unit
27
+ paddingRight: amount + unit,
29
28
  },
30
29
  all: {
31
- padding: amount + unit
32
- }
33
- }
30
+ padding: amount + unit,
31
+ },
32
+ };
34
33
 
35
34
  return PaddingMap[apply];
36
35
  }
@@ -29,7 +29,8 @@ export function Text(props: TextProps) {
29
29
 
30
30
  const colorToken = containerColorToken ? (`on-${containerColorToken}` as ColorToken) : undefined;
31
31
 
32
- const { fontSize, letterSpacing, lineHeight, fontWeight, fontFamily, fontStyle, textTransform } = typography[role];
32
+ const { fontSize, letterSpacing, lineHeight, fontWeight, fontFamily, fontStyle, textTransform } =
33
+ typography[role];
33
34
 
34
35
  const style = {
35
36
  color: colors[overridingColorToken || colorToken || 'on-surface'],