@intility/bifrost-react-select 0.0.0-experimental-themeinstein-20241114083153 → 0.0.0-fa7-20250730123404

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/CHANGELOG.md CHANGED
@@ -1,27 +1,84 @@
1
1
  # @intility/bifrost-react-select
2
2
 
3
- ## 0.0.0-experimental-themeinstein-20241114083153
3
+ ## 0.0.0-fa7-20250730123404
4
4
 
5
5
  ### Patch Changes
6
6
 
7
- - Updated dependencies [91f354b]
8
- - Updated dependencies [582d87e]
9
- - Updated dependencies [65c4ebd]
10
- - Updated dependencies [285f893]
11
- - @intility/bifrost-react@0.0.0-experimental-themeinstein-20241114083153
7
+ - 123c323: Bump `react-select` dependency from `5.10.1` to `5.10.2`
8
+ - d74de86: Update css-in-js selector for `<Select>` component to remove warning about `:first-child`
9
+ - Updated dependencies [d1a1d0e]
10
+ - Updated dependencies [1f39455]
11
+ - Updated dependencies [3dc2523]
12
+ - @intility/bifrost-react@0.0.0-fa7-20250730123404
12
13
 
13
- ## 4.3.1
14
+ ## 5.2.1
15
+
16
+ ### Patch Changes
17
+
18
+ - b16e76d: Update styling for disabled select
19
+
20
+ ## 5.2.0
21
+
22
+ ### Minor Changes
23
+
24
+ - a161a0c: `<Select>` menu dropdown now uses bifrost `<Dropdown>` internally
25
+ - should fix layering issues (overlapping and/or scrollbars) when used inside
26
+ `<Modal>`, `<Nav.Group>`, and `<Dropdown>`
27
+
28
+ ## 5.1.0
29
+
30
+ ### Minor Changes
31
+
32
+ - c7e5540: Bump `react-select` dependency to `5.10.1`
33
+
34
+ ### Patch Changes
35
+
36
+ - 30fd9d3: Fix: Avoid wrapping `<Select isMulti>` with a single long-worded option selected. #178
37
+
38
+ ## 5.0.2
39
+
40
+ ### Patch Changes
41
+
42
+ - 775ce3c: Fix: Include styling for `small` and `state="alert"` for `<Select>` css-in-js.
43
+ (This means we can now use main bifrost-bundle.css in a layer, and selects
44
+ should still be styled correctly) #117
45
+
46
+ ## 5.0.1
47
+
48
+ ### Patch Changes
49
+
50
+ - 6d67f5f: Fix: Explicitly set `font-family` to "Open Sans" to prevent inheriting wrong
51
+ font from parent. #86
52
+
53
+ ## 5.0.0
54
+
55
+ ### Major Changes
56
+
57
+ - fcbbe97: Update `@Intility/bifrost-react` peer dependency to `>=5.0.0`
58
+
59
+ ## 4.3.3 - 2025-02-26
60
+
61
+ ### Patch Changes
62
+
63
+ - 1e2116f: update package metadata
64
+
65
+ ## 4.3.2 - 2024-12-13
66
+
67
+ ### Patch Changes
68
+
69
+ - eb3b1cc: Fix: Text color should be `base-c-2` for disabled inputs (when they have a value).
70
+
71
+ ## 4.3.1 - 2024-11-06
14
72
 
15
73
  ### Patch Changes
16
74
 
17
75
  - 9ac0d65: allow react 17 as a peer dep
18
76
 
19
- ## 4.3.0
77
+ ## 4.3.0 - 2024-10-15
20
78
 
21
79
  ### Minor Changes
22
80
 
23
81
  - 2703b98: Add support for `small` variants for most form field inputs, to match existing `small` button styling.
24
-
25
82
  - `<Input>`
26
83
  - `<DatePicker>`
27
84
  - `<FieldGroup.Item>`
@@ -50,7 +107,6 @@
50
107
  ### Patch Changes
51
108
 
52
109
  - 3434ad1: Update Select styling to match new bifrost Button
53
-
54
110
  - Increased `border-radius` (from xs to s)
55
111
  - Slight `border-color` tweaks
56
112
 
package/dist/Select.d.ts CHANGED
@@ -1,4 +1,3 @@
1
- import { CSSProperties, ReactNode, RefAttributes } from "react";
2
1
  import { GroupBase, Props as ReactSelectProps, SelectInstance, components as originalComponents } from "react-select";
3
2
  import { AsyncProps as AsyncSelectProps } from "react-select/async";
4
3
  import { CreatableProps as CreatableSelectProps } from "react-select/creatable";
@@ -13,10 +12,10 @@ export declare const selectStyles: {
13
12
  clearIndicator: (provided: any) => any;
14
13
  dropdownIndicator: (provided: any, state: any) => any;
15
14
  input: (provided: any) => any;
16
- menuPortal: (provided: any) => any;
17
15
  menu: (provided: any) => any;
18
16
  menuList: (provided: any) => any;
19
- placeholder: (provided: any) => any;
17
+ placeholder: (provided: any, state: any) => any;
18
+ valueContainer: (provided: any) => any;
20
19
  singleValue: (provided: any, state: any) => any;
21
20
  option: (provided: any, state: any) => any;
22
21
  multiValue: (provided: any, state: any) => any;
@@ -26,19 +25,18 @@ export declare const selectStyles: {
26
25
  groupHeading: (provided: any) => any;
27
26
  };
28
27
  export declare const selectComponents: typeof originalComponents;
29
- declare const selectStates: readonly ["default", "alert"];
30
- export type SelectState = (typeof selectStates)[number];
28
+ export type SelectState = "default" | "alert";
31
29
  export type SelectProps = {
32
30
  /** Required label text */
33
- label: ReactNode;
31
+ label: React.ReactNode;
34
32
  /** Hide label text, will add label prop as aria-label for screen readers */
35
33
  hideLabel?: boolean;
36
34
  /** Description text to show more information */
37
- description?: ReactNode;
35
+ description?: React.ReactNode;
38
36
  /** Available states: `default` and `alert` */
39
37
  state?: SelectState;
40
38
  /** Feedback text below the Select component */
41
- feedback?: ReactNode;
39
+ feedback?: React.ReactNode;
42
40
  /** Required prop indicating mandatory field */
43
41
  required?: boolean;
44
42
  /** Bool to mark Select component required, but hides the required label */
@@ -46,7 +44,7 @@ export type SelectProps = {
46
44
  /** Marks Select component as optional */
47
45
  optional?: boolean;
48
46
  /** Inline CSS styles */
49
- style?: CSSProperties;
47
+ style?: React.CSSProperties;
50
48
  /** Displays a loading spinner */
51
49
  loading?: boolean;
52
50
  /** Decrease height of the input from `40px` to `32px` */
@@ -56,7 +54,7 @@ export type SelectType = {
56
54
  <OptionType = {
57
55
  label: string;
58
56
  value: string;
59
- }, IsMulti extends boolean = false, Group extends GroupBase<OptionType> = GroupBase<OptionType>>(props: ReactSelectProps<OptionType, IsMulti, Group> & RefAttributes<SelectInstance<OptionType, IsMulti, Group>> & SelectProps): React.ReactElement | null;
57
+ }, IsMulti extends boolean = false, Group extends GroupBase<OptionType> = GroupBase<OptionType>>(props: ReactSelectProps<OptionType, IsMulti, Group> & React.RefAttributes<SelectInstance<OptionType, IsMulti, Group>> & SelectProps): React.ReactElement | null;
60
58
  displayName?: string;
61
59
  };
62
60
  /**
@@ -70,7 +68,7 @@ export type AsyncType = {
70
68
  }, IsMulti extends boolean = false, Group extends GroupBase<OptionType> = {
71
69
  options: OptionType[];
72
70
  label?: string;
73
- }>(props: AsyncSelectProps<OptionType, IsMulti, Group> & RefAttributes<SelectInstance<OptionType, IsMulti, Group>> & SelectProps): React.ReactElement | null;
71
+ }>(props: AsyncSelectProps<OptionType, IsMulti, Group> & React.RefAttributes<SelectInstance<OptionType, IsMulti, Group>> & SelectProps): React.ReactElement | null;
74
72
  displayName?: string;
75
73
  };
76
74
  declare const AsyncSelect: AsyncType;
@@ -81,7 +79,7 @@ export type CreatableType = {
81
79
  }, IsMulti extends boolean = false, Group extends GroupBase<OptionType> = {
82
80
  options: OptionType[];
83
81
  label?: string;
84
- }>(props: CreatableSelectProps<OptionType, IsMulti, Group> & RefAttributes<SelectInstance<OptionType, IsMulti, Group>> & SelectProps): React.ReactElement | null;
82
+ }>(props: CreatableSelectProps<OptionType, IsMulti, Group> & React.RefAttributes<SelectInstance<OptionType, IsMulti, Group>> & SelectProps): React.ReactElement | null;
85
83
  displayName?: string;
86
84
  };
87
85
  declare const CreatableSelect: CreatableType;
@@ -92,7 +90,7 @@ export type AsyncCreatableType = {
92
90
  }, IsMulti extends boolean = false, Group extends GroupBase<OptionType> = {
93
91
  options: OptionType[];
94
92
  label?: string;
95
- }>(props: AsyncCreatableSelectProps<OptionType, IsMulti, Group> & RefAttributes<SelectInstance<OptionType, IsMulti, Group>> & SelectProps): React.ReactElement | null;
93
+ }>(props: AsyncCreatableSelectProps<OptionType, IsMulti, Group> & React.RefAttributes<SelectInstance<OptionType, IsMulti, Group>> & SelectProps): React.ReactElement | null;
96
94
  displayName?: string;
97
95
  };
98
96
  declare const AsyncCreatableSelect: AsyncCreatableType;
package/dist/Select.js CHANGED
@@ -1,6 +1,6 @@
1
1
  /* eslint-disable @typescript-eslint/ban-ts-comment */ "use client";
2
2
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
- import { forwardRef } from "react";
3
+ import { forwardRef, useState } from "react";
4
4
  import ReactSelectDefaultExport, { components as originalComponents } from "react-select";
5
5
  import AsyncReactSelect from "react-select/async";
6
6
  import CreatableReactSelect from "react-select/creatable";
@@ -17,6 +17,7 @@ import CustomMenuList from "./overrides/CustomMenuList.internal.js";
17
17
  import ClearIndicator from "./overrides/ClearIndicator.internal.js";
18
18
  import CustomOption from "./overrides/CustomOption.internal.js";
19
19
  import LoadingIndicator from "./overrides/LoadingIndicator.internal.js";
20
+ import Menu, { SelectRefCtx } from "./overrides/Menu.internal.js";
20
21
  const ReactSelect = ReactSelectDefaultExport.default ?? ReactSelectDefaultExport;
21
22
  export const selectStyles = {
22
23
  container: (provided)=>({
@@ -34,13 +35,33 @@ export const selectStyles = {
34
35
  color: "var(--bfc-base-c)"
35
36
  }
36
37
  },
37
- backgroundColor: state.isDisabled ? "var(--bfc-base-dimmed)" : "var(--bfc-base-3)",
38
- borderWidth: "1px",
38
+ ".bf-select-small &": {
39
+ minHeight: "var(--rem32)"
40
+ },
41
+ ".bf-select-alert &": {
42
+ borderColor: state.isFocused ? "var(--bfc-base-c-inverted)" : state.isDisabled ? "transparent" : "var(--bfc-base-c-alert)"
43
+ },
44
+ ".bf-select-alert &:hover": {
45
+ borderColor: state.isFocused ? undefined : state.isDisabled ? "transparent" : "var(--bfc-alert-2)"
46
+ },
47
+ ".bf-fieldgroup &": {
48
+ borderRadius: 0
49
+ },
50
+ ".bf-fieldgroup > :first-of-type &": {
51
+ borderTopLeftRadius: "var(--bf-radius-s)",
52
+ borderBottomLeftRadius: "var(--bf-radius-s)"
53
+ },
54
+ ".bf-fieldgroup > :last-child &": {
55
+ borderTopRightRadius: "var(--bf-radius-s)",
56
+ borderBottomRightRadius: "var(--bf-radius-s)"
57
+ },
58
+ backgroundColor: state.isDisabled ? "var(--bfc-base)" : "var(--bfc-base-3)",
59
+ borderWidth: 1,
39
60
  borderStyle: "solid",
40
- borderColor: state.isFocused ? "var(--bfc-base-c-inverted)" : state.isDisabled ? "transparent" : "var(--bfc-base-c-wcag)",
61
+ borderColor: state.isFocused ? "var(--bfc-base-c-inverted)" : state.isDisabled ? "var(--bfc-base-c-dimmed)" : "var(--bfc-base-c-wcag)",
41
62
  boxShadow: state.isFocused ? "inset 0 0 0 1px var(--bfc-base-c-inverted)" : "none",
42
63
  borderRadius: "var(--bf-radius-s)",
43
- minHeight: undefined,
64
+ minHeight: "var(--rem40)",
44
65
  cursor: "text"
45
66
  }),
46
67
  indicatorSeparator: ()=>({
@@ -48,41 +69,47 @@ export const selectStyles = {
48
69
  }),
49
70
  indicatorsContainer: (provided)=>({
50
71
  ...provided,
72
+ ".bf-select-small &": {
73
+ paddingBlock: "0.2187rem"
74
+ },
75
+ padding: "0.469rem 0",
51
76
  alignItems: "flex-start"
52
77
  }),
53
78
  clearIndicator: (provided)=>({
54
79
  ...provided,
55
80
  "&:hover": {
56
- color: "var(--bfc-base-c-1)"
81
+ color: "var(--bfc-base-c)"
57
82
  },
58
83
  color: "var(--bfc-base-c-2)",
59
84
  cursor: "pointer",
60
- padding: "var(--bfs4)",
85
+ padding: 4,
61
86
  margin: "1px 4px 0px 0px"
62
87
  }),
63
88
  dropdownIndicator: (provided, state)=>({
64
89
  ...provided,
65
- color: state.isFocused ? "var(--bfc-base-c)" : "var(--bfc-base-c-2)",
90
+ ".bf-select-small &": {
91
+ marginRight: 4
92
+ },
93
+ color: state.isDisabled ? "var(--bfc-base-c-disabled)" : state.isFocused ? "var(--bfc-base-c)" : "var(--bfc-base-c-2)",
66
94
  cursor: "pointer",
67
- padding: "var(--bfs4)",
95
+ padding: 4,
68
96
  marginRight: 8
69
97
  }),
70
98
  input: (provided)=>({
71
99
  ...provided,
72
- color: "var(--bfc-base-c-1)",
100
+ color: "var(--bfc-base-c)",
73
101
  fontFamily: "inherit",
74
- fontSize: "var(--bf-font-size-l)"
75
- }),
76
- menuPortal: (provided)=>({
77
- ...provided,
78
- zIndex: 9999
102
+ fontSize: "var(--bf-font-size-l)",
103
+ margin: 0,
104
+ padding: 0
79
105
  }),
80
106
  menu: (provided)=>({
81
107
  ...provided,
108
+ position: "static",
109
+ margin: 0,
82
110
  backgroundColor: "transparent",
83
111
  boxShadow: "none",
84
- borderRadius: "none",
85
- zIndex: 3
112
+ borderRadius: "none"
86
113
  }),
87
114
  menuList: (provided)=>({
88
115
  ...provided,
@@ -91,14 +118,21 @@ export const selectStyles = {
91
118
  border: "1px solid var(--bfc-base-c-wcag)",
92
119
  borderRadius: "var(--bf-radius-s)"
93
120
  }),
94
- placeholder: (provided)=>({
121
+ placeholder: (provided, state)=>({
95
122
  ...provided,
96
- color: "var(--bfc-base-c-2)",
123
+ color: state.isDisabled ? "var(--bfc-base-c-disabled)" : "var(--bfc-base-c-2)",
97
124
  fontSize: "var(--bf-font-size-l)"
98
125
  }),
126
+ valueContainer: (provided)=>({
127
+ ...provided,
128
+ ".bf-select-small &": {
129
+ padding: "0 8px"
130
+ },
131
+ padding: "var(--rem2) 12px"
132
+ }),
99
133
  singleValue: (provided, state)=>({
100
134
  ...provided,
101
- color: state.selectProps.menuIsOpen ? "var(--bfc-base-c-2)" : "var(--bfc-base-c)",
135
+ color: state.selectProps.menuIsOpen ? "var(--bfc-base-c-2)" : state.isDisabled ? "var(--bfc-base-c-disabled)" : "var(--bfc-base-c)",
102
136
  fontSize: "var(--bf-font-size-l)"
103
137
  }),
104
138
  option: (provided, state)=>({
@@ -107,14 +141,14 @@ export const selectStyles = {
107
141
  justifyContent: !state.isMulti ? "space-between" : "normal",
108
142
  alignItems: "baseline",
109
143
  padding: "7px 12px",
110
- backgroundColor: state.isDisabled ? "var(--bfc-base-dimmed)" : state.isFocused ? "var(--bfc-base-1)" : "var(--bfc-base-3)",
111
- color: "var(--bfc-base-c)",
144
+ backgroundColor: state.isDisabled ? "var(--bfc-base-dimmed)" : state.isFocused ? "var(--bfc-base)" : "var(--bfc-base-3)",
145
+ color: state.isDisabled ? "var(--bfc-base-c-2)" : "var(--bfc-base-c)",
112
146
  "& .bf-select-selected-icon": {
113
147
  color: "var(--bfc-base-c)",
114
- marginLeft: "var(--bfs4)"
148
+ marginLeft: 4
115
149
  },
116
150
  "&:hover": {
117
- backgroundColor: state.isDisabled ? "var(--bfc-base-dimmed)" : "var(--bfc-base-1)",
151
+ backgroundColor: state.isDisabled ? "var(--bfc-base-dimmed)" : "var(--bfc-base)",
118
152
  cursor: state.isDisabled ? "default" : "pointer"
119
153
  },
120
154
  fontSize: "var(--bf-font-size-l)",
@@ -127,7 +161,8 @@ export const selectStyles = {
127
161
  backgroundColor: "var(--bfc-base)",
128
162
  borderRadius: "var(--bf-radius-xs)",
129
163
  border: state.isDisabled ? "1px solid var(--bfc-base-c-disabled)" : "var(--bf-border)",
130
- opacity: state.isDisabled ? 0.5 : 1
164
+ opacity: state.isDisabled ? 0.5 : 1,
165
+ maxWidth: "calc(100% - 10px)"
131
166
  }),
132
167
  multiValueLabel: (provided)=>({
133
168
  ...provided,
@@ -140,9 +175,9 @@ export const selectStyles = {
140
175
  color: "var(--bfc-base-c-2)",
141
176
  paddingLeft: 5,
142
177
  paddingRight: 5,
143
- background: state.isFocused && "var(--bfc-theme-2)",
178
+ background: state.isFocused ? "var(--bfc-theme-2)" : undefined,
144
179
  "&:hover": {
145
- color: "var(--bfc-base-c-1)",
180
+ color: "var(--bfc-base-c)",
146
181
  cursor: "pointer",
147
182
  background: "var(--bfc-base-2)"
148
183
  },
@@ -150,14 +185,14 @@ export const selectStyles = {
150
185
  background: "var(--bfc-base-3)"
151
186
  },
152
187
  svg: {
153
- marginTop: "1px"
188
+ marginTop: 1
154
189
  }
155
190
  }),
156
191
  group: (provided)=>({
157
192
  ...provided,
158
- padding: "var(--bfs6) 0",
193
+ padding: "6px 0",
159
194
  "&:first-of-type": {
160
- marginTop: "var(--bfs4)"
195
+ marginTop: 4
161
196
  }
162
197
  }),
163
198
  groupHeading: (provided)=>({
@@ -165,7 +200,7 @@ export const selectStyles = {
165
200
  textTransform: "capitalize",
166
201
  color: "var(--bfc-base-c-2)",
167
202
  fontSize: "var(--bf-font-size-s)",
168
- marginBottom: "var(--bfs2)"
203
+ marginBottom: 2
169
204
  })
170
205
  };
171
206
  export const selectComponents = {
@@ -173,14 +208,12 @@ export const selectComponents = {
173
208
  DropdownIndicator,
174
209
  Input: CustomInput,
175
210
  MenuList: CustomMenuList,
211
+ // @ts-ignore
212
+ Menu,
176
213
  ClearIndicator,
177
214
  Option: CustomOption,
178
215
  LoadingIndicator
179
216
  };
180
- const selectStates = [
181
- "default",
182
- "alert"
183
- ];
184
217
  /**
185
218
  * Select HOC
186
219
  */ const SelectHOC = (Selector)=>{
@@ -189,52 +222,59 @@ const selectStates = [
189
222
  const GeneratedSelect = /*#__PURE__*/ forwardRef(({ label, hideLabel = false, isDisabled = false, state, feedback, required = false, description, requiredNoLabel = false, optional = false, inputId, className, style, loading = false, components, small = false, ...props }, ref)=>{
190
223
  const selectId = useUniqueId(inputId);
191
224
  const locale = useLocale();
192
- return /*#__PURE__*/ _jsxs("div", {
193
- className: classNames(className, {
194
- "bf-select-container": true
195
- }, {
196
- "bf-select-disabled": isDisabled
197
- }, {
198
- "bf-select-alert": !isDisabled && state === "alert"
199
- }, {
200
- "bf-select-small": small
201
- }),
202
- style: style,
203
- "data-testid": "bf-select-container",
204
- children: [
205
- !hideLabel && /*#__PURE__*/ _jsx(Label, {
206
- htmlFor: selectId,
207
- required: !isDisabled && required && !requiredNoLabel,
208
- optional: optional,
209
- disabled: isDisabled,
210
- children: label
211
- }),
212
- /*#__PURE__*/ _jsx(Description, {
213
- children: description
214
- }),
215
- /*#__PURE__*/ _jsx(Selector, {
216
- ref: ref,
217
- inputId: selectId,
218
- placeholder: "",
219
- components: {
220
- ...selectComponents,
221
- ...components
222
- },
223
- styles: selectStyles,
224
- isDisabled: isDisabled,
225
- classNamePrefix: "bf-select",
226
- required: !isDisabled && (required || requiredNoLabel),
227
- "aria-label": label,
228
- hideSelectedOptions: false,
229
- closeMenuOnSelect: props.isMulti ? false : true,
230
- isLoading: loading ?? props.isLoading,
231
- loadingMessage: ()=>locale.loading + "...",
232
- ...props
225
+ const [controlElement, setControlElement] = useState(null);
226
+ return /*#__PURE__*/ _jsx(SelectRefCtx.Provider, {
227
+ value: controlElement,
228
+ children: /*#__PURE__*/ _jsxs("div", {
229
+ className: classNames(className, "bf-select-container", "bf-open-sans", {
230
+ "bf-select-disabled": isDisabled,
231
+ "bf-select-alert": !isDisabled && state === "alert",
232
+ "bf-select-small": small
233
233
  }),
234
- /*#__PURE__*/ _jsx(Feedback, {
235
- children: feedback
236
- })
237
- ]
234
+ style: style,
235
+ "data-testid": "bf-select-container",
236
+ children: [
237
+ !hideLabel && /*#__PURE__*/ _jsx(Label, {
238
+ htmlFor: selectId,
239
+ required: !isDisabled && required && !requiredNoLabel,
240
+ optional: optional,
241
+ disabled: isDisabled,
242
+ children: label
243
+ }),
244
+ /*#__PURE__*/ _jsx(Description, {
245
+ children: description
246
+ }),
247
+ /*#__PURE__*/ _jsx(Selector, {
248
+ ref: (r)=>{
249
+ setControlElement(r?.controlRef ?? null);
250
+ if (typeof ref === "function") {
251
+ ref(r);
252
+ } else if (ref != null) {
253
+ ref.current = r;
254
+ }
255
+ },
256
+ inputId: selectId,
257
+ placeholder: "",
258
+ components: {
259
+ ...selectComponents,
260
+ ...components
261
+ },
262
+ styles: selectStyles,
263
+ isDisabled: isDisabled,
264
+ classNamePrefix: "bf-select",
265
+ required: !isDisabled && (required || requiredNoLabel),
266
+ "aria-label": label,
267
+ hideSelectedOptions: false,
268
+ closeMenuOnSelect: props.isMulti ? false : true,
269
+ isLoading: loading ?? props.isLoading,
270
+ loadingMessage: ()=>locale.loading + "...",
271
+ ...props
272
+ }),
273
+ /*#__PURE__*/ _jsx(Feedback, {
274
+ children: feedback
275
+ })
276
+ ]
277
+ })
238
278
  });
239
279
  });
240
280
  return GeneratedSelect;
@@ -13,7 +13,7 @@ const CustomOption = (props)=>{
13
13
  icon: props.isSelected ? faCheckSquare : faSquare,
14
14
  fixedWidth: true,
15
15
  marginRight: true,
16
- color: props.isSelected ? "var(--bsc-theme-icon)" : "var(--bfc-base-c-1)"
16
+ color: props.isSelected ? "var(--bfc-theme)" : "var(--bfc-base-c-2)"
17
17
  })
18
18
  }),
19
19
  props.children,
@@ -0,0 +1,3 @@
1
+ import { components } from "react-select";
2
+ export declare const SelectRefCtx: import("react").Context<HTMLDivElement | null>;
3
+ export default function Menu(props: React.ComponentProps<typeof components.Menu>): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,37 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { Dropdown } from "@intility/bifrost-react";
3
+ import useResizeObserver from "@intility/bifrost-react/hooks/useResizeObserver";
4
+ import { createContext, useContext, useRef } from "react";
5
+ import { components } from "react-select";
6
+ export const SelectRefCtx = /*#__PURE__*/ createContext(null);
7
+ export default function Menu(props) {
8
+ const { menuPlacement, menuPosition } = props;
9
+ const controlElement = useContext(SelectRefCtx);
10
+ // Keep width of dropdown in sync with select control
11
+ const divRef = useRef(null);
12
+ useResizeObserver(controlElement, (entry)=>{
13
+ if (!divRef.current) return;
14
+ divRef.current.style.width = entry.borderBoxSize[0].inlineSize + "px";
15
+ });
16
+ return /*#__PURE__*/ _jsx(Dropdown, {
17
+ unstyled: true,
18
+ noArrow: true,
19
+ visible: true,
20
+ reference: controlElement,
21
+ placement: menuPlacement === "auto" ? "bottom" : menuPlacement,
22
+ strategy: menuPosition,
23
+ offset: [
24
+ 0,
25
+ 4
26
+ ],
27
+ content: /*#__PURE__*/ _jsx("div", {
28
+ ref: divRef,
29
+ style: {
30
+ width: controlElement?.offsetWidth
31
+ },
32
+ children: /*#__PURE__*/ _jsx(components.Menu, {
33
+ ...props
34
+ })
35
+ })
36
+ });
37
+ }
package/package.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@intility/bifrost-react-select",
3
- "version": "0.0.0-experimental-themeinstein-20241114083153",
3
+ "version": "0.0.0-fa7-20250730123404",
4
4
  "description": "React select component for Intility's design system, Bifrost.",
5
5
  "type": "module",
6
6
  "main": "dist/Select.js",
7
7
  "scripts": {
8
8
  "build": "run-p build:*",
9
- "build:module": "swc ./src -d dist",
9
+ "build:module": "swc ./src -d dist --strip-leading-paths",
10
10
  "build:types": "tsc",
11
11
  "start": "run-p watch:*",
12
12
  "watch:module": "npm run build:module -- --watch",
@@ -29,24 +29,29 @@
29
29
  ],
30
30
  "author": "Intility AS",
31
31
  "license": "MIT",
32
+ "repository": {
33
+ "type": "git",
34
+ "url": "https://github.com/intility/bifrost",
35
+ "directory": "packages/bifrost-react-select"
36
+ },
32
37
  "publishConfig": {
33
38
  "registry": "https://registry.npmjs.org/",
34
39
  "access": "public"
35
40
  },
36
41
  "peerDependencies": {
37
- "react-dom": ">=17.0.0",
42
+ "@intility/bifrost-react": "0.0.0-fa7-20250730123404",
38
43
  "react": ">=17.0.0",
39
- "@intility/bifrost-react": "0.0.0-experimental-themeinstein-20241114083153"
44
+ "react-dom": ">=17.0.0"
40
45
  },
41
46
  "devDependencies": {
42
- "@intility/bifrost-react": "0.0.0-experimental-themeinstein-20241114083153"
47
+ "@intility/bifrost-react": "0.0.0-fa7-20250730123404"
43
48
  },
44
49
  "dependencies": {
45
50
  "@fortawesome/fontawesome-svg-core": "^6.4.2",
46
51
  "@fortawesome/free-solid-svg-icons": "^6.4.2",
47
52
  "@fortawesome/react-fontawesome": "^0.2.0",
48
53
  "classnames": "^2.2.6",
49
- "react-select": "^5.7.7"
54
+ "react-select": "^5.10.2"
50
55
  },
51
56
  "files": [
52
57
  "CHANGELOG.md",