@intility/bifrost-react-select 4.0.0 → 4.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.
package/CHANGELOG.md CHANGED
@@ -1,17 +1,25 @@
1
1
  # @intility/bifrost-react-select
2
2
 
3
+ ## 4.0.1
4
+
5
+ ### Patch Changes
6
+
7
+ - 611f82ca: Removed unnecessary files from npm package output.
8
+ - 63f4c54d: fix: Select menu background color is no longer transparent for grouped options.
9
+ - Updated dependencies [611f82ca]
10
+ - @intility/bifrost-react@4.0.1
11
+
3
12
  ## 4.0.0 (first release)
4
13
 
5
14
  ### Minor Changes
6
15
 
7
16
  - 62b02461: Include JSDoc comments in typescript definition output
8
- - 6b355639: New styling for inputs, now always outlined. Removed `variant` prop from `<Input>`.
17
+ - 6b355639: New styling for inputs, now always outlined.
9
18
 
10
19
  ### Patch Changes
11
20
 
12
21
  - 217c8741: Named export for Select and DatePicker
13
- - a903f282: fix: export typescript types used in react components
22
+ - a903f282: Fix: export typescript types used in react components
14
23
  - e410a910: New base color values for light mode #711
15
- - ea861dbc: Update lint config, add displayName for components
16
- - 165904af: use deep imports from @intility/bifrost-react
17
- - fdc6caee: fix: select dropdown background should no longer bleed outside border radius when opened
24
+ - 165904af: Use deep imports from @intility/bifrost-react
25
+ - fdc6caee: Fix: select dropdown background should no longer bleed outside border radius when opened
package/dist/Select.js CHANGED
@@ -82,6 +82,7 @@ export const selectStyles = {
82
82
  }),
83
83
  menuList: (provided)=>({
84
84
  ...provided,
85
+ backgroundColor: "var(--bfc-base-3)",
85
86
  padding: 0,
86
87
  border: "1px solid var(--bfc-theme-3)",
87
88
  borderTop: "none",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@intility/bifrost-react-select",
3
- "version": "4.0.0",
3
+ "version": "4.0.1",
4
4
  "description": "React select component for Intility's design system, Bifrost.",
5
5
  "type": "module",
6
6
  "main": "dist/Select.js",
@@ -41,8 +41,13 @@
41
41
  "@fortawesome/fontawesome-svg-core": "^6.4.2",
42
42
  "@fortawesome/free-solid-svg-icons": "^6.4.2",
43
43
  "@fortawesome/react-fontawesome": "^0.2.0",
44
- "@intility/bifrost-react": "4.0.0",
44
+ "@intility/bifrost-react": "4.0.1",
45
45
  "classnames": "^2.2.6",
46
46
  "react-select": "^5.7.7"
47
- }
47
+ },
48
+ "files": [
49
+ "CHANGELOG.md",
50
+ "dist/**/*",
51
+ "!dist/**/*.test.*"
52
+ ]
48
53
  }
package/.swcrc DELETED
@@ -1,16 +0,0 @@
1
- {
2
- "$schema": "https://json.schemastore.org/swcrc",
3
- "jsc": {
4
- "parser": {
5
- "syntax": "typescript",
6
- "tsx": true
7
- },
8
- "transform": {
9
- "react": {
10
- "runtime": "automatic"
11
- }
12
- },
13
- "target": "es2022"
14
- },
15
- "exclude": ["\\.test\\.", "\\.d\\.ts$"]
16
- }
@@ -1 +0,0 @@
1
- export {};
@@ -1,119 +0,0 @@
1
- import { render } from "@testing-library/react";
2
-
3
- import Select from "./Select.js";
4
-
5
- let getByTestId, getByText, queryByText, element, customInput, rerender;
6
-
7
- beforeEach(() => {
8
- const options = [
9
- { value: "Norway", label: "Norway" },
10
- { value: "Sweden", label: "Sweden" },
11
- { value: "Denmark", label: "Denmark" },
12
- { value: "Germany", label: "Germany" },
13
- ];
14
-
15
- const select = render(
16
- <Select
17
- label="Select country"
18
- placeholder="Select country here"
19
- options={options}
20
- />,
21
- );
22
-
23
- getByTestId = select.getByTestId;
24
- getByText = select.getByText;
25
- queryByText = select.queryByText;
26
- element = getByTestId("bf-select-container");
27
- customInput = getByTestId("bf-select-input");
28
- rerender = select.rerender;
29
- // debug = select.debug
30
- });
31
-
32
- describe("select component", () => {
33
- it("renders select component", () => {
34
- expect(element);
35
- });
36
- });
37
-
38
- describe("select with required label prop", () => {
39
- it("renders label text", () => {
40
- expect(getByText("Select country"));
41
- });
42
- });
43
-
44
- describe("select with className and style", () => {
45
- it("renders with custom classname and custom styles", () => {
46
- rerender(
47
- <Select
48
- label="Custom classname"
49
- className="custom-classname"
50
- style={{ width: "100%" }}
51
- />,
52
- );
53
-
54
- expect(element).toHaveClass("custom-classname");
55
- expect(element).toHaveStyle("width: 100%");
56
- });
57
- });
58
-
59
- describe("select with description prop", () => {
60
- it("renders with text as description", () => {
61
- rerender(
62
- <Select label="Select country" description="Please select one country" />,
63
- );
64
-
65
- expect(getByText("Please select one country"));
66
- });
67
- });
68
-
69
- describe("select with state and feedback props", () => {
70
- it("renders with alert state ", () => {
71
- rerender(
72
- <Select label="Select country" state="alert" feedback="Missing value " />,
73
- );
74
-
75
- expect(element).toHaveClass("bf-select-alert");
76
- });
77
-
78
- it("renders with feedback text", () => {
79
- rerender(
80
- <Select label="Select country" state="alert" feedback="Missing value " />,
81
- );
82
- const feedback = getByText("Missing value");
83
-
84
- expect(feedback);
85
- expect(feedback).toHaveClass("bf-label-feedback");
86
- expect(feedback.tagName.toLowerCase()).toBe("div");
87
- });
88
- });
89
-
90
- describe("select disabled", () => {
91
- it("renders as disabled", () => {
92
- rerender(<Select label="Disabled" isDisabled />);
93
- // can only test classname, hence isDisabled is a prop for react-select
94
- expect(element).toHaveClass("bf-select-disabled");
95
- });
96
- });
97
-
98
- describe("select with required/optional props", () => {
99
- it("renders as required", () => {
100
- rerender(<Select label="This is required" required />);
101
-
102
- expect(customInput).toBeRequired();
103
- expect(getByText("(required)"));
104
- });
105
-
106
- it("renders as required, but hiding the (required) text", () => {
107
- rerender(<Select label="This is required" requiredNoLabel />);
108
-
109
- expect(customInput).toBeRequired();
110
- expect(queryByText("(required)")).toBeNull();
111
- });
112
-
113
- it("renders as optional with (optional) text", () => {
114
- rerender(<Select label="This is optional" optional />);
115
-
116
- expect(customInput).not.toBeRequired();
117
- expect(getByText("(optional)"));
118
- });
119
- });
package/src/Select.tsx DELETED
@@ -1,434 +0,0 @@
1
- /* eslint-disable @typescript-eslint/ban-ts-comment */
2
- "use client";
3
-
4
- import { CSSProperties, forwardRef, ReactNode, RefAttributes } from "react";
5
- import ReactSelectDefaultExport, {
6
- GroupBase,
7
- Props as ReactSelectProps,
8
- SelectInstance,
9
- components,
10
- } from "react-select";
11
- import AsyncReactSelect, {
12
- AsyncProps as AsyncSelectProps,
13
- } from "react-select/async";
14
- import CreatableReactSelect, {
15
- CreatableProps as CreatableSelectProps,
16
- } from "react-select/creatable";
17
- import AsyncCreatableReactSelect, {
18
- AsyncCreatableProps as AsyncCreatableSelectProps,
19
- } from "react-select/async-creatable";
20
- import classNames from "classnames";
21
- import Description from "@intility/bifrost-react/Description";
22
- import Feedback from "@intility/bifrost-react/Feedback";
23
- import Label from "@intility/bifrost-react/Label";
24
- import useUniqueId from "@intility/bifrost-react/hooks/useUniqueId";
25
-
26
- import {
27
- DropdownIndicator,
28
- ClearIndicator,
29
- CustomInput,
30
- CustomMenuList,
31
- CustomOption,
32
- LoadingIndicator,
33
- } from "./overrides/index.js";
34
-
35
- const ReactSelect =
36
- (
37
- ReactSelectDefaultExport as unknown as {
38
- default: typeof ReactSelectDefaultExport;
39
- }
40
- ).default ?? ReactSelectDefaultExport;
41
-
42
- export const selectStyles = {
43
- container: (provided) => ({
44
- ...provided,
45
- ".bf-label-description + &, .bf-label + &": {
46
- marginTop: "var(--bfs4)", // add margin-top only when label or description is direct sibling with select
47
- },
48
- }),
49
- control: (provided, state) => ({
50
- ...provided,
51
- "&:hover": {
52
- borderColor: state.isFocused
53
- ? "var(--bfc-theme-3)"
54
- : "var(--bfc-base-c-inverted-2)",
55
- // Change color of dropdown icon when hover on Select
56
- ".bf-select__dropdown-indicator": {
57
- color: "var(--bfc-theme-3)",
58
- },
59
- },
60
- backgroundColor: state.isDisabled
61
- ? "var(--bfc-base-dimmed)"
62
- : "var(--bfc-base-3)",
63
- borderWidth: "1px",
64
- borderStyle: "solid",
65
- borderColor: state.isFocused
66
- ? "var(--bfc-theme-3)"
67
- : state.isDisabled
68
- ? "transparent"
69
- : "var(--bfc-base-c-wcag)",
70
- boxShadow: "none",
71
- borderRadius: state.selectProps.menuIsOpen
72
- ? " var(--bf-radius-xs) var(--bf-radius-xs) 0 0"
73
- : "var(--bf-radius-xs)",
74
- minHeight: "var(--bfs40)",
75
- cursor: "text",
76
- }),
77
- indicatorSeparator: () => ({
78
- display: "none",
79
- }),
80
- indicatorsContainer: (provided) => ({
81
- ...provided,
82
- alignItems: "flex-start",
83
- padding: "7.5px 0",
84
- }),
85
- clearIndicator: (provided) => ({
86
- ...provided,
87
- "&:hover": {
88
- color: "var(--bfc-base-c-1)",
89
- },
90
- color: "var(--bfc-base-c-2)",
91
- cursor: "pointer",
92
- padding: "var(--bfs4)",
93
- margin: "1px var(--bfs4) 0px 0px",
94
- }),
95
- dropdownIndicator: (provided, state) => ({
96
- ...provided,
97
- color: state.isDisabled ? "var(--bfc-base-c-2)" : "var(--bfc-theme-1)",
98
- cursor: "pointer",
99
- padding: "var(--bfs4)",
100
- marginRight: "var(--bfs8)",
101
- }),
102
- input: (provided) => ({
103
- ...provided,
104
- color: "var(--bfc-base-c-1)",
105
- fontFamily: "inherit",
106
- fontSize: "var(--bf-font-size-l)",
107
- }),
108
- menuPortal: (provided) => ({
109
- ...provided,
110
- zIndex: 9999,
111
- }),
112
- menu: (provided) => ({
113
- ...provided,
114
- backgroundColor: "transparent",
115
- boxShadow: "none",
116
- borderRadius: "none",
117
- marginTop: 0,
118
- zIndex: 3,
119
- }),
120
- menuList: (provided) => ({
121
- ...provided,
122
- padding: 0,
123
- border: "1px solid var(--bfc-theme-3)",
124
- borderTop: "none",
125
- borderRadius: "0 0 var(--bf-radius-xs) var(--bf-radius-xs)",
126
- }),
127
- placeholder: (provided) => ({
128
- ...provided,
129
- color: "var(--bfc-base-c-2)",
130
- fontSize: "var(--bf-font-size-l)",
131
- }),
132
- singleValue: (provided, state) => ({
133
- ...provided,
134
- color: state.selectProps.menuIsOpen
135
- ? "var(--bfc-base-c-2)"
136
- : "var(--bfc-base-c)",
137
- fontSize: "var(--bf-font-size-l)",
138
- }),
139
- option: (provided, state) => ({
140
- ...provided,
141
- display: "flex",
142
- justifyContent: !state.isMulti ? "space-between" : "normal",
143
- alignItems: "baseline",
144
- padding: "7px 12px",
145
- backgroundColor: state.isDisabled
146
- ? "var(--bfc-base-dimmed)"
147
- : state.isFocused
148
- ? "var(--bfc-base-1)"
149
- : "var(--bfc-base-3)",
150
- color: "var(--bfc-base-c)",
151
- "& .bf-select-checkbox": {
152
- marginRight: "var(--bfs8)",
153
- color: "var(--bfc-theme)",
154
- },
155
- "& .bf-select-selected-icon": {
156
- color: "var(--bfc-base-c-theme)",
157
- marginLeft: "var(--bfs4)",
158
- },
159
- "&:hover": {
160
- backgroundColor: state.isDisabled
161
- ? "var(--bfc-base-dimmed)"
162
- : "var(--bfc-base-1)",
163
- cursor: state.isDisabled ? "default" : "pointer",
164
- },
165
- fontSize: "var(--bf-font-size-l)",
166
- fontWeight: state.isSelected ? 600 : 400,
167
- wordBreak: "break-word",
168
- whiteSpace: "normal",
169
- }),
170
- multiValue: (provided, state) => ({
171
- ...provided,
172
- backgroundColor: state.isDisabled
173
- ? "var(--bfc-base-c-inverted-2)"
174
- : "var(--bfc-theme-c)",
175
- borderRadius: "var(--bf-radius-xs)",
176
- }),
177
- multiValueLabel: (provided, state) => ({
178
- ...provided,
179
- color: state.isDisabled ? "var(--bfc-base-1)" : "var(--bfc-base-c-theme)",
180
- fontSize: "var(--bf-font-size-m)",
181
- }),
182
- multiValueRemove: (provided, state) => ({
183
- ...provided,
184
- color: state.isDisabled
185
- ? "var(--bfc-base-1)"
186
- : state.isFocused
187
- ? "var(--bfc-theme-c-base-3)"
188
- : "var(--bfc-theme-1)",
189
- borderRadius: "unset",
190
- borderTopRightRadius: "var(--bf-radius-xs)",
191
- borderBottomRightRadius: "var(--bf-radius-xs)",
192
- paddingLeft: "var(--bfs2)",
193
- paddingRight: "var(--bfs2)",
194
- marginLeft: "var(--bfs2)",
195
- background: state.isFocused && "var(--bfc-theme-2)",
196
- "&:hover": {
197
- color: "var(--bfc-theme-c-base-3)",
198
- cursor: "pointer",
199
- background: "var(--bfc-theme)",
200
- },
201
- "&:active": {
202
- background: "var(--bfc-theme-2)",
203
- },
204
- svg: {
205
- marginTop: "1px",
206
- },
207
- }),
208
- group: (provided) => ({
209
- ...provided,
210
- padding: "var(--bfs6) 0",
211
- "&:first-of-type": {
212
- marginTop: "var(--bfs4)",
213
- },
214
- }),
215
- groupHeading: (provided) => ({
216
- ...provided,
217
- textTransform: "capitalize",
218
- color: "var(--bfc-base-c-2)",
219
- fontSize: "var(--bf-font-size-s)",
220
- marginBottom: "var(--bfs2)",
221
- }),
222
- };
223
-
224
- export const selectComponents: Partial<typeof components> = {
225
- DropdownIndicator,
226
- Input: CustomInput,
227
- MenuList: CustomMenuList,
228
- ClearIndicator,
229
- Option: CustomOption,
230
- LoadingIndicator,
231
- };
232
-
233
- const selectStates = ["default", "alert"] as const;
234
- export type SelectState = (typeof selectStates)[number];
235
-
236
- /**
237
- * Select HOC
238
- */
239
- const SelectHOC = <Type, Selector>(Selector: Selector) => {
240
- // @ts-ignore
241
- // eslint-disable-next-line @typescript-eslint/no-explicit-any, react/display-name
242
- const GeneratedSelect: Type = forwardRef<any, any>(
243
- (
244
- {
245
- label,
246
- hideLabel = false,
247
- isDisabled = false,
248
- state,
249
- feedback,
250
- required = false,
251
- description,
252
- requiredNoLabel = false,
253
- optional = false,
254
- inputId,
255
- className,
256
- style,
257
- loading = false,
258
- components,
259
- ...props
260
- },
261
- ref,
262
- ) => {
263
- const selectId = useUniqueId(inputId);
264
-
265
- return (
266
- <div
267
- className={classNames(
268
- className,
269
- { "bf-select-container": true },
270
- { "bf-select-disabled": isDisabled },
271
- { "bf-select-alert": !isDisabled && state === "alert" },
272
- )}
273
- style={style}
274
- data-testid="bf-select-container"
275
- >
276
- {!hideLabel && (
277
- <Label
278
- htmlFor={selectId}
279
- required={!isDisabled && required && !requiredNoLabel}
280
- optional={optional}
281
- disabled={isDisabled}
282
- >
283
- {label}
284
- </Label>
285
- )}
286
- <Description>{description}</Description>
287
- {/* @ts-ignore */}
288
- <Selector
289
- ref={ref}
290
- inputId={selectId}
291
- placeholder=""
292
- components={{ ...selectComponents, ...components }}
293
- styles={selectStyles}
294
- isDisabled={isDisabled}
295
- classNamePrefix="bf-select"
296
- required={!isDisabled && (required || requiredNoLabel)}
297
- aria-label={label}
298
- hideSelectedOptions={false}
299
- closeMenuOnSelect={props.isMulti ? false : true}
300
- isLoading={loading ?? props.isLoading}
301
- {...props}
302
- />
303
- <Feedback>{feedback}</Feedback>
304
- </div>
305
- );
306
- },
307
- );
308
-
309
- return GeneratedSelect;
310
- };
311
-
312
- // this is somewhat useless on it's own
313
- // has to be combined with one of the Select's props
314
- export type SelectProps = {
315
- /** Required label text */
316
- label: ReactNode;
317
- /** Hide label text, will add label prop as aria-label for screen readers */
318
- hideLabel?: boolean;
319
- /** Description text to show more information */
320
- description?: ReactNode;
321
- /** Available states: `default` and `alert` */
322
- state?: SelectState;
323
- /** Feedback text below the Select component */
324
- feedback?: ReactNode;
325
- /** Required prop indicating mandatory field */
326
- required?: boolean;
327
- /** Bool to mark Select component required, but hides the required label */
328
- requiredNoLabel?: boolean;
329
- /** Marks Select component as optional */
330
- optional?: boolean;
331
- /** Inline CSS styles */
332
- style?: CSSProperties;
333
- /** Displays a loading spinner */
334
- loading?: boolean;
335
- };
336
-
337
- // Each select get its own type which uses the correctly imported props
338
- // And calls the HOC
339
- // The resulting component should be correctly typed
340
-
341
- // Plain Select
342
- export type SelectType = {
343
- <
344
- OptionType = { label: string; value: string },
345
- IsMulti extends boolean = false,
346
- Group extends GroupBase<OptionType> = GroupBase<OptionType>,
347
- >(
348
- props: ReactSelectProps<OptionType, IsMulti, Group> &
349
- RefAttributes<SelectInstance<OptionType, IsMulti, Group>> &
350
- SelectProps,
351
- ): React.ReactElement | null;
352
- displayName?: string;
353
- };
354
-
355
- /**
356
- * Select component - dropdown list
357
- */
358
- export const Select: SelectType = SelectHOC<SelectType, typeof ReactSelect>(
359
- ReactSelect,
360
- );
361
- Select.displayName = "Select";
362
-
363
- // Async Select
364
- export type AsyncType = {
365
- <
366
- OptionType = { label: string; value: string },
367
- IsMulti extends boolean = false,
368
- Group extends GroupBase<OptionType> = {
369
- options: OptionType[];
370
- label?: string;
371
- },
372
- >(
373
- props: AsyncSelectProps<OptionType, IsMulti, Group> &
374
- RefAttributes<SelectInstance<OptionType, IsMulti, Group>> &
375
- SelectProps,
376
- ): React.ReactElement | null;
377
- displayName?: string;
378
- };
379
-
380
- const AsyncSelect = SelectHOC<AsyncType, typeof AsyncReactSelect>(
381
- AsyncReactSelect,
382
- );
383
-
384
- AsyncSelect.displayName = "AsyncSelect";
385
-
386
- // Creatable Select
387
- export type CreatableType = {
388
- <
389
- OptionType = { label: string; value: string },
390
- IsMulti extends boolean = false,
391
- Group extends GroupBase<OptionType> = {
392
- options: OptionType[];
393
- label?: string;
394
- },
395
- >(
396
- props: CreatableSelectProps<OptionType, IsMulti, Group> &
397
- RefAttributes<SelectInstance<OptionType, IsMulti, Group>> &
398
- SelectProps,
399
- ): React.ReactElement | null;
400
- displayName?: string;
401
- };
402
-
403
- const CreatableSelect = SelectHOC<CreatableType, typeof CreatableReactSelect>(
404
- CreatableReactSelect,
405
- );
406
-
407
- CreatableSelect.displayName = "CreatableSelect";
408
-
409
- // Async Creatable Select
410
- export type AsyncCreatableType = {
411
- <
412
- OptionType = { label: string; value: string },
413
- IsMulti extends boolean = false,
414
- Group extends GroupBase<OptionType> = {
415
- options: OptionType[];
416
- label?: string;
417
- },
418
- >(
419
- props: AsyncCreatableSelectProps<OptionType, IsMulti, Group> &
420
- RefAttributes<SelectInstance<OptionType, IsMulti, Group>> &
421
- SelectProps,
422
- ): React.ReactElement | null;
423
- displayName?: string;
424
- };
425
-
426
- const AsyncCreatableSelect = SelectHOC<
427
- AsyncCreatableType,
428
- typeof AsyncCreatableReactSelect
429
- >(AsyncCreatableReactSelect);
430
-
431
- AsyncCreatableSelect.displayName = "AsyncCreatableSelect";
432
-
433
- export { AsyncSelect, CreatableSelect, AsyncCreatableSelect };
434
- export default Select;
@@ -1,37 +0,0 @@
1
- import {
2
- IconDefinition,
3
- IconName,
4
- IconPathData,
5
- IconPrefix,
6
- } from "@fortawesome/fontawesome-svg-core";
7
-
8
- const prefix = "fac" as IconPrefix;
9
- const iconName = "bf-spinner" as IconName;
10
- const width = 18;
11
- const height = 18;
12
- const aliases = [];
13
- const unicode = "";
14
- const svgPathData: IconPathData = [
15
- "M9 2C5.13401 2 2 5.13401 2 9C2 12.866 5.13401 16 9 16C12.866 16 16 12.866 16 9C16 5.13401 12.866 2 9 2ZM0 9C0 4.02944 4.02944 0 9 0C13.9706 0 18 4.02944 18 9C18 13.9706 13.9706 18 9 18C4.02944 18 0 13.9706 0 9Z",
16
- "M8 1C8 0.447715 8.44772 0 9 0C13.9706 0 18 4.02944 18 9C18 9.55229 17.5523 10 17 10C16.4477 10 16 9.55229 16 9C16 5.13401 12.866 2 9 2C8.44772 2 8 1.55228 8 1Z",
17
- ];
18
-
19
- const definition: IconDefinition = {
20
- prefix,
21
- iconName,
22
- icon: [width, height, aliases, unicode, svgPathData],
23
- };
24
-
25
- export {
26
- definition as default,
27
- definition as faIndeterminate,
28
- definition,
29
- prefix,
30
- iconName,
31
- width,
32
- height,
33
- aliases as ligatures,
34
- unicode,
35
- svgPathData,
36
- aliases,
37
- };
@@ -1,13 +0,0 @@
1
- import { Icon } from "@intility/bifrost-react";
2
- import { components } from "react-select";
3
- import { faXmark } from "@fortawesome/free-solid-svg-icons/faXmark";
4
-
5
- const ClearIndicator = (props) => {
6
- return (
7
- <components.ClearIndicator {...props}>
8
- <Icon icon={faXmark} />
9
- </components.ClearIndicator>
10
- );
11
- };
12
-
13
- export default ClearIndicator;
@@ -1,34 +0,0 @@
1
- import { components, Props } from "react-select";
2
-
3
- const CustomInput = (props) => {
4
- const { required, value } = props.selectProps as Props & {
5
- required: boolean;
6
- };
7
- const updatedProps = {
8
- ...props,
9
- autoComplete: "noAutocomplete",
10
- };
11
-
12
- return (
13
- <>
14
- <components.Input {...updatedProps} />
15
- <input
16
- style={{
17
- opacity: 0,
18
- height: 0,
19
- position: "absolute",
20
- pointerEvents: "none",
21
- }}
22
- onChange={(e) => e.preventDefault()}
23
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
24
- value={(value as any)?.label ?? ""} // casting to any, because we don't know the type of an option
25
- tabIndex={-1}
26
- autoComplete="noAutocomplete"
27
- required={required}
28
- data-testid="bf-select-input"
29
- />
30
- </>
31
- );
32
- };
33
-
34
- export default CustomInput;
@@ -1,15 +0,0 @@
1
- import { components } from "react-select";
2
-
3
- const CustomMenuList = (props) => {
4
- return (
5
- <components.MenuList
6
- data-testid="bf-select-menulist"
7
- className="bf-scrollbar-small"
8
- {...props}
9
- >
10
- {props.children}
11
- </components.MenuList>
12
- );
13
- };
14
-
15
- export default CustomMenuList;
@@ -1,29 +0,0 @@
1
- import { components } from "react-select";
2
- import { faSquare } from "@fortawesome/free-regular-svg-icons/faSquare";
3
- import { faCheckSquare } from "@fortawesome/free-solid-svg-icons/faCheckSquare";
4
- import { faCheck } from "@fortawesome/free-solid-svg-icons/faCheck";
5
- import { Icon } from "@intility/bifrost-react";
6
-
7
- const CustomOption = (props) => {
8
- return (
9
- <components.Option {...props}>
10
- {props.isMulti && (
11
- <div>
12
- <Icon
13
- icon={props.isSelected ? faCheckSquare : faSquare}
14
- fixedWidth
15
- className="bf-select-checkbox"
16
- />
17
- </div>
18
- )}
19
- {props.children}
20
- {!props.isMulti && props.isSelected && (
21
- <div>
22
- <Icon icon={faCheck} fixedWidth className="bf-select-selected-icon" />
23
- </div>
24
- )}
25
- </components.Option>
26
- );
27
- };
28
-
29
- export default CustomOption;
@@ -1,13 +0,0 @@
1
- import { components } from "react-select";
2
- import { faCaretDown } from "@fortawesome/free-solid-svg-icons/faCaretDown";
3
- import { Icon } from "@intility/bifrost-react";
4
-
5
- const DropdownIndicator = (props) => {
6
- return (
7
- <components.DropdownIndicator {...props}>
8
- <Icon icon={faCaretDown} />
9
- </components.DropdownIndicator>
10
- );
11
- };
12
-
13
- export default DropdownIndicator;
@@ -1,9 +0,0 @@
1
- import { Icon } from "@intility/bifrost-react";
2
-
3
- import bfSpinner from "../assets/bfSpinner.js";
4
-
5
- export default function LoadingIndicator() {
6
- return (
7
- <Icon icon={bfSpinner} spin fixedWidth className="bf-input-loading-icon" />
8
- );
9
- }
@@ -1,6 +0,0 @@
1
- export { default as ClearIndicator } from "./ClearIndicator.internal.js";
2
- export { default as CustomInput } from "./CustomInput.internal.js";
3
- export { default as LoadingIndicator } from "./LoadingIndicator.internal.js";
4
- export { default as CustomMenuList } from "./CustomMenuList.internal.js";
5
- export { default as DropdownIndicator } from "./DropdownIndicator.internal.js";
6
- export { default as CustomOption } from "./CustomOption.internal.js";
package/tsconfig.json DELETED
@@ -1,16 +0,0 @@
1
- {
2
- "extends": "../../tsconfig.json",
3
- "compilerOptions": {
4
- "declaration": true,
5
- "rootDir": "src",
6
- "declarationMap": false,
7
- "isolatedModules": false,
8
- "noEmit": false,
9
- "allowJs": false,
10
- "sourceMap": false,
11
- "emitDeclarationOnly": true,
12
- "outDir": "dist"
13
- },
14
- "include": ["./src/"],
15
- "exclude": []
16
- }
package/vitest.config.ts DELETED
@@ -1,12 +0,0 @@
1
- import react from "@vitejs/plugin-react-swc";
2
- import { defineConfig } from "vitest/config";
3
-
4
- export default defineConfig({
5
- plugins: [react()],
6
- test: {
7
- globals: true,
8
- environment: "jsdom",
9
- setupFiles: "../test-setup.ts",
10
- css: true,
11
- },
12
- });