uikit-react-public 0.11.13 → 0.11.16

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 (40) hide show
  1. package/dist/components/Button/Button.d.ts +21 -3
  2. package/dist/components/Button/Button.stories.d.ts +1 -1
  3. package/dist/components/Button/buttonPrimaryStyle.d.ts +2 -2
  4. package/dist/components/Button/buttonSecondaryStyle.d.ts +2 -2
  5. package/dist/components/Button/buttonTertiaryStyle.d.ts +2 -2
  6. package/dist/components/Button/index.d.ts +1 -1
  7. package/dist/components/Select/Select.d.ts +3 -8
  8. package/dist/components/Select/Select.stories.d.ts +50 -2
  9. package/dist/components/Select/Select.types.d.ts +122 -0
  10. package/dist/components/Select/index.d.ts +1 -1
  11. package/dist/components/Select/subcomponents/CustomOption.d.ts +3 -0
  12. package/dist/components/Select/subcomponents/CustomSelect.d.ts +3 -0
  13. package/dist/components/Select/subcomponents/NativeSelect.d.ts +3 -0
  14. package/dist/components/Select/subcomponents/Panel.d.ts +3 -0
  15. package/dist/components/Select/subcomponents/VisibleField.d.ts +9 -0
  16. package/dist/components/Select/subcomponents/index.d.ts +5 -0
  17. package/dist/index.js +2875 -2549
  18. package/lib/Welcome.mdx +7 -7
  19. package/lib/components/Button/Button.tsx +36 -7
  20. package/lib/components/Button/buttonPrimaryStyle.ts +4 -4
  21. package/lib/components/Button/buttonSecondaryStyle.ts +4 -4
  22. package/lib/components/Button/buttonTertiaryStyle.ts +3 -3
  23. package/lib/components/Button/index.ts +1 -1
  24. package/lib/components/Icon/svgs/AvatarSvg.tsx +2 -2
  25. package/lib/components/Icon/svgs/ChevronDownSvg.tsx +2 -5
  26. package/lib/components/Select/Select.stories.tsx +192 -13
  27. package/lib/components/Select/Select.tsx +33 -76
  28. package/lib/components/Select/Select.types.ts +146 -0
  29. package/lib/components/Select/__tests__/Select.test.tsx +99 -20
  30. package/lib/components/Select/__tests__/__snapshots__/Select.test.tsx.snap +33 -37
  31. package/lib/components/Select/index.ts +1 -1
  32. package/lib/components/Select/subcomponents/CustomOption.tsx +74 -0
  33. package/lib/components/Select/subcomponents/CustomSelect.tsx +211 -0
  34. package/lib/components/Select/subcomponents/NativeSelect.tsx +109 -0
  35. package/lib/components/Select/subcomponents/Panel.tsx +46 -0
  36. package/lib/components/Select/subcomponents/VisibleField.tsx +69 -0
  37. package/lib/components/Select/subcomponents/index.tsx +5 -0
  38. package/package.json +2 -2
  39. package/dist/components/Button/Button.types.d.ts +0 -26
  40. package/lib/components/Button/Button.types.ts +0 -46
@@ -0,0 +1,69 @@
1
+ import { css, cx } from '@emotion/css';
2
+ import Icon from '../../Icon';
3
+ import { useTheme } from '../../../theme';
4
+ import { OptionData } from '../Select.types';
5
+
6
+ const NAME = 'ucl-uikit-select__visible-field';
7
+
8
+ interface VisibleFieldProps {
9
+ isOpen?: boolean;
10
+ disabled?: boolean;
11
+ selectedOption: OptionData | null | undefined;
12
+ placeholder?: string;
13
+ }
14
+
15
+ const Field = ({
16
+ selectedOption,
17
+ isOpen,
18
+ placeholder,
19
+ disabled,
20
+ }: VisibleFieldProps) => {
21
+ const [theme] = useTheme();
22
+
23
+ const baseStyle = css`
24
+ display: flex;
25
+ align-items: center;
26
+ justify-content: space-between;
27
+ gap: 8px;
28
+ width: 100%;
29
+ line-height: ${theme.font.lineHeight.h150};
30
+ `;
31
+
32
+ const innerStyle = css`
33
+ display: inline-flex;
34
+ gap: 8px;
35
+ white-space: nowrap;
36
+ overflow: hidden;
37
+ `;
38
+
39
+ const iconStyle = css`
40
+ min-width: 24px;
41
+ margin-left: auto;
42
+ color: ${theme.color.interaction.blue70};
43
+ ${disabled && `color: ${theme.color.neutral.grey20};`}
44
+ ${isOpen && `transform: rotate(180deg);`}
45
+ `;
46
+
47
+ const style = cx(NAME, baseStyle);
48
+
49
+ return (
50
+ <div
51
+ className={style}
52
+ data-testid={NAME}
53
+ >
54
+ <span className={innerStyle}>
55
+ {selectedOption ? (
56
+ <>
57
+ {selectedOption.icon ?? null}
58
+ {selectedOption.text}
59
+ </>
60
+ ) : (
61
+ placeholder || ''
62
+ )}
63
+ </span>
64
+ <Icon.ChevronDown className={iconStyle} />
65
+ </div>
66
+ );
67
+ };
68
+
69
+ export default Field;
@@ -0,0 +1,5 @@
1
+ export { default as CustomSelect } from './CustomSelect';
2
+ export { default as NativeSelect } from './NativeSelect';
3
+ export { default as CustomOption } from './CustomOption';
4
+ export { default as Panel } from './Panel';
5
+ export { default as VisibleField } from './VisibleField';
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "uikit-react-public",
3
3
  "private": false,
4
4
  "license": "MIT",
5
- "version": "0.11.13",
5
+ "version": "0.11.16",
6
6
  "type": "module",
7
7
  "main": "dist/index.js",
8
8
  "types": "dist/index.d.ts",
@@ -41,7 +41,6 @@
41
41
  ]
42
42
  },
43
43
  "dependencies": {
44
- "@azure/msal-browser": "^4.7.0",
45
44
  "@emotion/css": "^11.13.5",
46
45
  "@floating-ui/react-dom": "^2.1.2"
47
46
  },
@@ -50,6 +49,7 @@
50
49
  "react-dom": "^18.0.0 || ^19.0.0"
51
50
  },
52
51
  "devDependencies": {
52
+ "@azure/msal-browser": "^4.7.0",
53
53
  "@chromatic-com/storybook": "^3.2.5",
54
54
  "@eslint/compat": "^1.2.7",
55
55
  "@eslint/eslintrc": "^3.3.0",
@@ -1,26 +0,0 @@
1
- import { ReactElement, ButtonHTMLAttributes, AnchorHTMLAttributes, ComponentPropsWithRef, ElementType, RefObject } from 'react';
2
- import { MarginProps } from '../common/marginsStyle';
3
- export interface ButtonBaseProps {
4
- variant?: 'primary' | 'secondary' | 'tertiary';
5
- destructive?: boolean;
6
- size?: 'large' | 'default' | 'small';
7
- disabled?: boolean;
8
- icon?: ReactElement;
9
- iconPosition?: 'left' | 'right';
10
- tooltip?: string;
11
- loading?: boolean;
12
- fullWidth?: boolean;
13
- testId?: string;
14
- ref?: RefObject<HTMLElement | null>;
15
- }
16
- export type ButtonAsButtonProps = ButtonBaseProps & ButtonHTMLAttributes<HTMLButtonElement> & {
17
- as?: 'button';
18
- };
19
- export type ButtonAsAnchorProps = ButtonBaseProps & AnchorHTMLAttributes<HTMLAnchorElement> & {
20
- as: 'a';
21
- };
22
- export type ButtonAsCustomProps<C extends ElementType> = ButtonBaseProps & {
23
- as: C;
24
- } & Omit<ComponentPropsWithRef<C>, keyof ButtonBaseProps | 'as'>;
25
- export type ButtonProps = (ButtonAsButtonProps | ButtonAsAnchorProps | ButtonAsCustomProps<ElementType>) & MarginProps;
26
- export type Ref = Element;
@@ -1,46 +0,0 @@
1
- import {
2
- ReactElement,
3
- ButtonHTMLAttributes,
4
- AnchorHTMLAttributes,
5
- ComponentPropsWithRef,
6
- ElementType,
7
- RefObject,
8
- } from 'react';
9
- import { MarginProps } from '../common/marginsStyle';
10
-
11
- export interface ButtonBaseProps {
12
- variant?: 'primary' | 'secondary' | 'tertiary';
13
- destructive?: boolean;
14
- size?: 'large' | 'default' | 'small';
15
- disabled?: boolean;
16
- icon?: ReactElement;
17
- iconPosition?: 'left' | 'right';
18
- tooltip?: string;
19
- loading?: boolean;
20
- fullWidth?: boolean;
21
- testId?: string;
22
- ref?: RefObject<HTMLElement | null>;
23
- }
24
-
25
- export type ButtonAsButtonProps = ButtonBaseProps &
26
- ButtonHTMLAttributes<HTMLButtonElement> & {
27
- as?: 'button';
28
- };
29
-
30
- export type ButtonAsAnchorProps = ButtonBaseProps &
31
- AnchorHTMLAttributes<HTMLAnchorElement> & {
32
- as: 'a';
33
- };
34
-
35
- export type ButtonAsCustomProps<C extends ElementType> = ButtonBaseProps & {
36
- as: C;
37
- } & Omit<ComponentPropsWithRef<C>, keyof ButtonBaseProps | 'as'>;
38
-
39
- export type ButtonProps = (
40
- | ButtonAsButtonProps
41
- | ButtonAsAnchorProps
42
- | ButtonAsCustomProps<ElementType>
43
- ) &
44
- MarginProps;
45
-
46
- export type Ref = Element;