uikit-react-public 0.51.0 → 0.52.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 (32) hide show
  1. package/dist/components/MultiSelect/MultiSelect.d.ts +4 -0
  2. package/dist/components/MultiSelect/MultiSelect.stories.d.ts +206 -0
  3. package/dist/components/MultiSelect/MultiSelect.types.d.ts +128 -0
  4. package/dist/components/MultiSelect/__tests__/MultiSelect.test.d.ts +1 -0
  5. package/dist/components/MultiSelect/index.d.ts +2 -0
  6. package/dist/components/MultiSelect/subcomponents/CustomOption.d.ts +3 -0
  7. package/dist/components/MultiSelect/subcomponents/CustomSelect.d.ts +4 -0
  8. package/dist/components/MultiSelect/subcomponents/FilterInput.d.ts +16 -0
  9. package/dist/components/MultiSelect/subcomponents/Panel.d.ts +8 -0
  10. package/dist/components/MultiSelect/subcomponents/VisibleField.d.ts +17 -0
  11. package/dist/components/MultiSelect/subcomponents/index.d.ts +5 -0
  12. package/dist/components/index.d.ts +2 -0
  13. package/dist/index.js +1079 -525
  14. package/lib/components/Calendar/__tests__/__snapshots__/Calendar.test.tsx.snap +4 -4
  15. package/lib/components/MultiSelect/MultiSelect.mdx +151 -0
  16. package/lib/components/MultiSelect/MultiSelect.stories.tsx +308 -0
  17. package/lib/components/MultiSelect/MultiSelect.tsx +24 -0
  18. package/lib/components/MultiSelect/MultiSelect.types.ts +142 -0
  19. package/lib/components/MultiSelect/__tests__/MultiSelect.test.tsx +1300 -0
  20. package/lib/components/MultiSelect/__tests__/__snapshots__/MultiSelect.test.tsx.snap +44 -0
  21. package/lib/components/MultiSelect/index.ts +2 -0
  22. package/lib/components/MultiSelect/subcomponents/CustomOption.tsx +107 -0
  23. package/lib/components/MultiSelect/subcomponents/CustomSelect.tsx +701 -0
  24. package/lib/components/MultiSelect/subcomponents/FilterInput.tsx +90 -0
  25. package/lib/components/MultiSelect/subcomponents/Panel.tsx +69 -0
  26. package/lib/components/MultiSelect/subcomponents/VisibleField.tsx +147 -0
  27. package/lib/components/MultiSelect/subcomponents/index.tsx +5 -0
  28. package/lib/components/index.ts +3 -0
  29. package/lib/theme/Theme.mdx +2 -0
  30. package/lib/theme/light/lightColour.ts +3 -7
  31. package/lib/theme/original/originalColourNewStructure.ts +3 -7
  32. package/package.json +2 -2
@@ -0,0 +1,90 @@
1
+ import { css, cx } from '@emotion/css';
2
+ import { useTheme } from '../../../theme';
3
+ import type { FilterInputProps } from '../MultiSelect.types';
4
+
5
+ type FilterInputComponentProps = {
6
+ value: string;
7
+ onChange: (value: string) => void;
8
+ onBlur?: (event: React.FocusEvent<HTMLInputElement>) => void;
9
+ onTabOut?: (event: React.KeyboardEvent<HTMLInputElement>) => void;
10
+ placeholder?: string;
11
+ disabled?: boolean;
12
+ inputRef?: React.RefObject<HTMLInputElement | null>;
13
+ className?: string;
14
+ ariaControls?: string;
15
+ ariaExpanded?: boolean;
16
+ ariaActiveDescendant?: string;
17
+ } & FilterInputProps;
18
+
19
+ const FilterInput = ({
20
+ value,
21
+ onChange,
22
+ onBlur,
23
+ onTabOut,
24
+ placeholder,
25
+ disabled,
26
+ inputRef,
27
+ className,
28
+ ariaControls,
29
+ ariaExpanded,
30
+ ariaActiveDescendant,
31
+ ...rest
32
+ }: FilterInputComponentProps) => {
33
+ const [theme] = useTheme();
34
+
35
+ const handleOnKeyDown = (e: React.KeyboardEvent<HTMLInputElement>) => {
36
+ if (e.key === 'Tab') {
37
+ onTabOut?.(e);
38
+ return;
39
+ }
40
+
41
+ // Let parent handle key navigation
42
+ if (
43
+ e.key === 'Escape' ||
44
+ e.key === 'Enter' ||
45
+ e.key === 'ArrowUp' ||
46
+ e.key === 'ArrowDown'
47
+ )
48
+ return;
49
+ e.stopPropagation();
50
+ };
51
+
52
+ const style = css`
53
+ flex: 1;
54
+ border: none;
55
+ outline: none;
56
+ background: transparent;
57
+ font: inherit;
58
+ color: ${theme.colour.text.default};
59
+ &::placeholder {
60
+ color: ${theme.colour.text.tertiary};
61
+ }
62
+ &:disabled {
63
+ color: ${theme.colour.text.disabled};
64
+ cursor: not-allowed;
65
+ }
66
+ `;
67
+ return (
68
+ <input
69
+ ref={inputRef}
70
+ className={cx(style, className)}
71
+ value={value}
72
+ placeholder={placeholder}
73
+ disabled={disabled}
74
+ onChange={(e) => onChange(e.target.value)}
75
+ onBlur={onBlur}
76
+ onClick={(e) => e.stopPropagation()}
77
+ onKeyDown={(e) => handleOnKeyDown(e)}
78
+ aria-autocomplete='list'
79
+ role='searchbox'
80
+ aria-haspopup='listbox'
81
+ aria-controls={ariaControls}
82
+ aria-expanded={ariaExpanded}
83
+ aria-activedescendant={ariaActiveDescendant}
84
+ aria-label='Filter options'
85
+ {...rest}
86
+ />
87
+ );
88
+ };
89
+
90
+ export default FilterInput;
@@ -0,0 +1,69 @@
1
+ import { css, cx } from '@emotion/css';
2
+ import { useTheme } from '../../../theme';
3
+ import type { SelectDropdownWidth } from '../MultiSelect.types';
4
+
5
+ const NAME = 'ucl-uikit-multiselect__panel';
6
+
7
+ type PanelProps = React.ComponentPropsWithoutRef<'div'> & {
8
+ dropdownWidth?: SelectDropdownWidth;
9
+ referenceWidth?: number;
10
+ maxWidth?: number;
11
+ };
12
+
13
+ const Panel = ({
14
+ className,
15
+ dropdownWidth = 'content',
16
+ referenceWidth,
17
+ maxWidth,
18
+ ...props
19
+ }: PanelProps) => {
20
+ const [theme] = useTheme();
21
+
22
+ const handleClick = (event: React.MouseEvent) => {
23
+ // Missed clicks on the panel should not close the dropdown
24
+ event.stopPropagation();
25
+ };
26
+
27
+ const referenceWidthValue =
28
+ typeof referenceWidth === 'number' ? `${referenceWidth}px` : '100%';
29
+ const maxWidthValue =
30
+ typeof maxWidth === 'number'
31
+ ? `min(${maxWidth}px, calc(100vw - (${theme.margin.m32} * 2)))`
32
+ : `calc(100vw - (${theme.margin.m32} * 2))`;
33
+
34
+ const baseStyle = css`
35
+ min-width: ${referenceWidthValue};
36
+ width: fit-content;
37
+ max-width: ${maxWidthValue};
38
+ max-height: min(400px, var(--ucl-overlay-available-height, 400px));
39
+ overflow-y: auto;
40
+ overflow-x: hidden;
41
+ box-sizing: border-box;
42
+ padding: ${theme.padding.p8} 0;
43
+ border: ${theme.border.b1} solid ${theme.colour.border.subtle};
44
+ background-color: ${theme.colour.fill.inverse};
45
+ `;
46
+
47
+ const matchSelectWidthStyle = css`
48
+ width: ${referenceWidthValue};
49
+ max-width: ${referenceWidthValue};
50
+ `;
51
+
52
+ const style = cx(
53
+ NAME,
54
+ baseStyle,
55
+ dropdownWidth === 'match-select' && matchSelectWidthStyle,
56
+ className
57
+ );
58
+
59
+ return (
60
+ <div
61
+ className={style}
62
+ data-testid={NAME}
63
+ onClick={handleClick}
64
+ {...props}
65
+ />
66
+ );
67
+ };
68
+
69
+ export default Panel;
@@ -0,0 +1,147 @@
1
+ import { css, cx } from '@emotion/css';
2
+ import Icon from '../../Icon';
3
+ import { useTheme } from '../../../theme';
4
+ import { OptionData } from '../MultiSelect.types';
5
+
6
+ const NAME = 'ucl-uikit-multiselect__visible-field';
7
+
8
+ interface VisibleFieldProps<T> {
9
+ isOpen?: boolean;
10
+ disabled?: boolean;
11
+ selectedOptions: OptionData<T>[];
12
+ placeholder?: string;
13
+ selectionCountLabel?: string;
14
+ filterable?: boolean;
15
+ clearable?: boolean;
16
+ onClear?: (event: React.MouseEvent | React.KeyboardEvent) => void;
17
+ clearButtonRef?: React.RefObject<HTMLButtonElement | null>;
18
+ className?: string;
19
+ chevronIconClassName?: string;
20
+ children?: React.ReactNode;
21
+ }
22
+
23
+ const VisibleField = <T extends string | number>({
24
+ selectedOptions,
25
+ isOpen,
26
+ placeholder,
27
+ selectionCountLabel,
28
+ disabled,
29
+ filterable,
30
+ clearable = false,
31
+ onClear,
32
+ clearButtonRef,
33
+ className,
34
+ chevronIconClassName,
35
+ children,
36
+ }: VisibleFieldProps<T>) => {
37
+ const [theme] = useTheme();
38
+ const { md } = theme.typography.body;
39
+
40
+ const baseStyle = css`
41
+ display: flex;
42
+ align-items: center;
43
+ justify-content: space-between;
44
+
45
+ gap: 8px;
46
+ width: 100%;
47
+ font-family: ${md.fontFamily};
48
+ font-feature-settings: ${md.fontSettings};
49
+ font-size: ${md.fontSize}px;
50
+ font-weight: ${md.fontWeight};
51
+ line-height: ${md.lineHeight}%;
52
+ `;
53
+
54
+ const style = cx(NAME, baseStyle, className);
55
+
56
+ const innerStyle = css`
57
+ overflow: hidden;
58
+ white-space: nowrap;
59
+ text-overflow: ellipsis;
60
+ `;
61
+
62
+ const chevronIconBaseStyle = css`
63
+ flex-shrink: 0;
64
+ margin-left: auto;
65
+ color: ${theme.colour.icon.default};
66
+ `;
67
+
68
+ const chevronIconOpenStyle = css`
69
+ transform: rotate(180deg);
70
+ `;
71
+
72
+ const chevronIconDisabledStyle = css`
73
+ color: ${theme.colour.icon.disabled};
74
+ `;
75
+
76
+ const chevronIconStyle = cx(
77
+ chevronIconBaseStyle,
78
+ isOpen && chevronIconOpenStyle,
79
+ disabled && chevronIconDisabledStyle,
80
+ chevronIconClassName
81
+ );
82
+
83
+ const clearButtonStyle = css`
84
+ display: flex;
85
+ align-items: center;
86
+ justify-content: center;
87
+ flex-shrink: 0;
88
+ margin-left: auto;
89
+ padding: 0;
90
+ border: none;
91
+ background: transparent;
92
+ color: ${theme.colour.icon.default};
93
+ cursor: pointer;
94
+
95
+ &:focus-visible {
96
+ outline: none;
97
+ box-shadow: ${theme.boxShadow.focus};
98
+ }
99
+ `;
100
+
101
+ // const showClearButton = clearable && !!selectedOption && !disabled;
102
+ const hasSelection = selectedOptions.length > 0;
103
+ const showClearButton = clearable && hasSelection && !disabled;
104
+
105
+ return (
106
+ <div
107
+ className={style}
108
+ data-testid={NAME}
109
+ >
110
+ {filterable && isOpen ? (
111
+ <div className={innerStyle}>{children}</div>
112
+ ) : (
113
+ <span className={innerStyle}>
114
+ {hasSelection
115
+ ? selectedOptions.length >= 3
116
+ ? `${selectedOptions.length}${
117
+ selectionCountLabel ? ` ${selectionCountLabel}` : ''
118
+ } selected`
119
+ : selectedOptions.map((o) => o.label).join(', ')
120
+ : placeholder || ''}
121
+ </span>
122
+ )}
123
+ {showClearButton ? (
124
+ <button
125
+ ref={clearButtonRef}
126
+ type='button'
127
+ className={clearButtonStyle}
128
+ aria-label='Clear selection'
129
+ data-testid={`${NAME}-clear-button`}
130
+ onClick={(event) => {
131
+ event.stopPropagation();
132
+ onClear?.(event);
133
+ }}
134
+ onKeyDown={(event) => {
135
+ event.stopPropagation();
136
+ }}
137
+ >
138
+ <Icon.X />
139
+ </button>
140
+ ) : (
141
+ <Icon.ChevronDown className={chevronIconStyle} />
142
+ )}
143
+ </div>
144
+ );
145
+ };
146
+
147
+ export default VisibleField;
@@ -0,0 +1,5 @@
1
+ export { default as CustomSelect } from './CustomSelect';
2
+ export { default as CustomOption } from './CustomOption';
3
+ export { default as Panel } from './Panel';
4
+ export { default as VisibleField } from './VisibleField';
5
+ export { default as FilterInput } from './FilterInput';
@@ -163,6 +163,9 @@ export type { MenuProps as MenuNewProps } from './MenuNew';
163
163
  export { default as Select } from './Select';
164
164
  export type { SelectProps } from './Select';
165
165
 
166
+ export { default as MultiSelect } from './MultiSelect';
167
+ export type { MultiSelectProps } from './MultiSelect';
168
+
166
169
  export { default as Footer } from './Footer';
167
170
  export type { FooterProps } from './Footer';
168
171
 
@@ -11,6 +11,8 @@ This theme explorer lists all the named properties of the theme object, found in
11
11
 
12
12
  The theme object is a collection of <a href="https://atlassian.design/tokens/design-tokens/" target="_blank">design tokens</a> that are used to style the UIKit-React components.
13
13
 
14
+ Theme mappings use `design-system-foundations-public` 0.1.11 while retaining existing UIKit colour property names. In the light theme, `colour.fill.inverseHover` maps to the foundations `colour/fill/brand-inverse-hover` token. In the light and default themes, `colour.text.cautionSubtle` and `colour.text.warningOnBgFill` map to `colour/text/caution` and `colour/text/warning`, replacing deprecated foundations tokens. Dark-theme mappings are unchanged.
15
+
14
16
  The theme object is also logged to the console when this page is loaded.
15
17
 
16
18
  {
@@ -73,7 +73,7 @@ const fill = {
73
73
  lightThemeTokens.colour.fill['brand-inverse-secondary'].$value
74
74
  ),
75
75
  inverseHover: tokenToHex(
76
- lightThemeTokens.colour.fill['inverse-hover'].$value
76
+ lightThemeTokens.colour.fill['brand-inverse-hover'].$value
77
77
  ),
78
78
  critical: tokenToHex(lightThemeTokens.colour.fill.critical.$value),
79
79
  criticalHover: tokenToHex(
@@ -237,14 +237,10 @@ const text = {
237
237
  lightThemeTokens.colour.text['brand-primary'].$value
238
238
  ),
239
239
  critical: tokenToHex(lightThemeTokens.colour.text.critical.$value),
240
- cautionSubtle: tokenToHex(
241
- lightThemeTokens.colour.text['caution-subtle'].$value
242
- ), // added - commit 331e537 - 14 Jul 2026
240
+ cautionSubtle: tokenToHex(lightThemeTokens.colour.text.caution.$value), // added - commit 331e537 - 14 Jul 2026
243
241
  caution: tokenToHex(lightThemeTokens.colour.text.caution.$value), // added - commit 331e537 - 14 Jul 2026§
244
242
  success: tokenToHex(lightThemeTokens.colour.text.success.$value), // added - commit 331e537 - 14 Jul 2026
245
- warningOnBgFill: tokenToHex(
246
- lightThemeTokens.colour.text['warning-on-bg-fill'].$value
247
- ),
243
+ warningOnBgFill: tokenToHex(lightThemeTokens.colour.text.warning.$value),
248
244
  };
249
245
 
250
246
  const link = {
@@ -51,7 +51,7 @@ const fill = {
51
51
  disabled: tokenToHex(lightThemeTokens.colour.fill.disabled.$value),
52
52
  inverse: tokenToHex(lightThemeTokens.colour.fill.inverse.$value),
53
53
  brandInverseSecondary: color.base.blue40, // tokenToHex(lightThemeTokens.colour.fill['brand-inverse-secondary'].$value),
54
- inverseHover: color.base.blue20Alt, // tokenToHex(lightThemeTokens.colour.fill['inverse-hover'].$value),
54
+ inverseHover: color.base.blue20Alt, // tokenToHex(lightThemeTokens.colour.fill['brand-inverse-hover'].$value),
55
55
  critical: color.system.red70, // tokenToHex(lightThemeTokens.colour.fill.critical.$value),
56
56
  criticalHover: color.base.red80, // tokenToHex(lightThemeTokens.colour.fill['critical-hover'].$value),
57
57
  criticalSelected: color.base.red80, // tokenToHex(lightThemeTokens.colour.fill['critical-selected'].$value),
@@ -151,14 +151,10 @@ const text = {
151
151
  brandInverseSecondarySelected: color.base.blue25, // tokenToHex(lightThemeTokens.colour.text['brand-inverse-secondary-selected'].$value),
152
152
  brandPrimary: color.interaction.blue100, // tokenToHex(lightThemeTokens.colour.text['brand-primary'].$value),
153
153
  critical: color.system.red70, // tokenToHex(lightThemeTokens.colour.text.critical.$value),
154
- cautionSubtle: tokenToHex(
155
- lightThemeTokens.colour.text['caution-subtle'].$value
156
- ),
154
+ cautionSubtle: tokenToHex(lightThemeTokens.colour.text.caution.$value),
157
155
  caution: tokenToHex(lightThemeTokens.colour.text.caution.$value),
158
156
  success: color.system.green70, // tokenToHex(lightThemeTokens.colour.text.success.$value),
159
- warningOnBgFill: tokenToHex(
160
- lightThemeTokens.colour.text['warning-on-bg-fill'].$value
161
- ),
157
+ warningOnBgFill: tokenToHex(lightThemeTokens.colour.text.warning.$value),
162
158
  };
163
159
 
164
160
  const link = {
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.51.0",
5
+ "version": "0.52.1",
6
6
  "type": "module",
7
7
  "main": "dist/index.js",
8
8
  "types": "dist/index.d.ts",
@@ -43,7 +43,7 @@
43
43
  "@emotion/css": "^11.13.5",
44
44
  "@emotion/react": "^11.14.0",
45
45
  "@floating-ui/react-dom": "^2.1.2",
46
- "design-system-foundations-public": "0.1.7"
46
+ "design-system-foundations-public": "0.1.11"
47
47
  },
48
48
  "peerDependencies": {
49
49
  "react": "^19.0.0",