@stack-spot/portal-components 2.5.2 → 2.6.0

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 (48) hide show
  1. package/CHANGELOG.md +7 -0
  2. package/dist/components/form/Select/CustomSelect.d.ts +81 -0
  3. package/dist/components/form/Select/CustomSelect.d.ts.map +1 -0
  4. package/dist/components/form/Select/CustomSelect.js +178 -0
  5. package/dist/components/form/Select/CustomSelect.js.map +1 -0
  6. package/dist/components/form/Select/DetailedSelect.d.ts +65 -0
  7. package/dist/components/form/Select/DetailedSelect.d.ts.map +1 -0
  8. package/dist/components/form/Select/DetailedSelect.js +80 -0
  9. package/dist/components/form/Select/DetailedSelect.js.map +1 -0
  10. package/dist/components/form/Select/Select.d.ts +47 -0
  11. package/dist/components/form/Select/Select.d.ts.map +1 -0
  12. package/dist/components/form/Select/Select.js +62 -0
  13. package/dist/components/form/Select/Select.js.map +1 -0
  14. package/dist/components/form/Select/index.d.ts +5 -0
  15. package/dist/components/form/Select/index.d.ts.map +1 -0
  16. package/dist/components/form/Select/index.js +5 -0
  17. package/dist/components/form/Select/index.js.map +1 -0
  18. package/dist/components/form/Select/styled.d.ts +6 -0
  19. package/dist/components/form/Select/styled.d.ts.map +1 -0
  20. package/dist/components/form/Select/styled.js +165 -0
  21. package/dist/components/form/Select/styled.js.map +1 -0
  22. package/dist/components/form/Select/types.d.ts +103 -0
  23. package/dist/components/form/Select/types.d.ts.map +1 -0
  24. package/dist/components/form/Select/types.js +2 -0
  25. package/dist/components/form/Select/types.js.map +1 -0
  26. package/dist/components/form/Select/utils.d.ts +3 -0
  27. package/dist/components/form/Select/utils.d.ts.map +1 -0
  28. package/dist/components/form/Select/utils.js +20 -0
  29. package/dist/components/form/Select/utils.js.map +1 -0
  30. package/dist/containers/NotificationsPage.js +1 -1
  31. package/dist/hooks/keyboard.d.ts +4 -4
  32. package/dist/hooks/keyboard.d.ts.map +1 -1
  33. package/dist/hooks/keyboard.js +2 -2
  34. package/dist/hooks/keyboard.js.map +1 -1
  35. package/package.json +2 -2
  36. package/src/components/form/Select/CustomSelect.tsx +232 -0
  37. package/src/components/form/Select/DetailedSelect.tsx +85 -0
  38. package/src/components/form/Select/Select.tsx +67 -0
  39. package/src/components/form/Select/index.ts +4 -0
  40. package/src/components/form/Select/styled.ts +165 -0
  41. package/src/components/form/Select/types.ts +112 -0
  42. package/src/components/form/Select/utils.tsx +28 -0
  43. package/src/hooks/keyboard.tsx +6 -4
  44. package/dist/components/form/Select.d.ts +0 -69
  45. package/dist/components/form/Select.d.ts.map +0 -1
  46. package/dist/components/form/Select.js +0 -162
  47. package/dist/components/form/Select.js.map +0 -1
  48. package/src/components/form/Select.tsx +0 -265
@@ -0,0 +1,165 @@
1
+ import { theme } from '@stack-spot/portal-theme';
2
+ import { styled } from 'styled-components';
3
+ export const SelectBox = styled.div `
4
+ position: relative;
5
+ // controls the height of component when it's closed
6
+ height: ${({ $inputHeight }) => $inputHeight};
7
+
8
+ select {
9
+ border: none;
10
+ opacity: 0;
11
+ pointer-events: none;
12
+ // prevents visual overflow
13
+ max-width: 10px;
14
+ }
15
+
16
+ .fake-select {
17
+ position: absolute;
18
+ top: 0;
19
+ left: 0;
20
+ right: 0;
21
+ border-radius: 0.25rem;
22
+ display: flex;
23
+ flex-direction: column;
24
+ border: 1px solid ${theme.color.light[600]};
25
+ transition: border-color 0.3s, box-shadow 0.3s;
26
+ background-color: ${theme.color.light[300]};
27
+
28
+ /* lets the z-index unset until the animation on the height ends. */
29
+ &:not(.open) {
30
+ z-index: unset;
31
+ animation: 0.3s z-index-animation;
32
+ @keyframes z-index-animation {
33
+ 0% {
34
+ z-index: 1;
35
+ }
36
+ 99% {
37
+ z-index: 1;
38
+ }
39
+ 100% {
40
+ z-index: unset;
41
+ }
42
+ }
43
+ }
44
+
45
+ &.disabled {
46
+ background-color: ${theme.color.light[500]};
47
+ color: ${theme.color.light[700]};
48
+ .current-value {
49
+ cursor: not-allowed;
50
+ }
51
+ }
52
+
53
+ .arrow {
54
+ transition: transform ease-in-out 0.3s;
55
+ }
56
+
57
+ &.focused, &.open {
58
+ border: 1px solid ${theme.color.primary[500]};
59
+ box-shadow: 0 0 0 1px ${theme.color.primary[500]};
60
+ }
61
+
62
+ &.open {
63
+ z-index: 1;
64
+ .arrow {
65
+ transform: rotate(180deg);
66
+ }
67
+ .options {
68
+ /* lets the overflow be hidden until the animation on the height ends. */
69
+ overflow-y: auto;
70
+ animation: 0.3s overflow-animation;
71
+ @keyframes overflow-animation {
72
+ 0% {
73
+ overflow-y: hidden;
74
+ }
75
+ 99% {
76
+ overflow-y: hidden;
77
+ }
78
+ 100% {
79
+ overflow-y: auto;
80
+ }
81
+ }
82
+ }
83
+ }
84
+
85
+ .current-value {
86
+ height: calc(100% - 2px);
87
+ display: flex;
88
+ flex-direction: row;
89
+ padding: 8px;
90
+ justify-content: space-between;
91
+ align-items: center;
92
+ cursor: pointer;
93
+ }
94
+
95
+ .clipped-text {
96
+ text-overflow: ellipsis;
97
+ width: 100%;
98
+ overflow: hidden;
99
+ white-space: nowrap;
100
+ }
101
+
102
+ .options {
103
+ list-style: none;
104
+ padding: 0;
105
+ margin: 0;
106
+ overflow-y: hidden;
107
+ transition: height ease-in-out 0.3s;
108
+ scrollbar-gutter: stable;
109
+
110
+ li {
111
+ display: flex;
112
+ flex-direction: row;
113
+ align-items: center;
114
+ padding: 9px;
115
+ border-top: 1px solid ${theme.color.light[600]};
116
+ cursor: pointer;
117
+ transition: background-color 0.2s;
118
+ &:hover, &:focus {
119
+ background-color: ${theme.color.light[500]};
120
+ }
121
+ outline: none;
122
+ }
123
+
124
+ .detailed {
125
+ display: flex;
126
+ flex-direction: row;
127
+ gap: 10px;
128
+ align-items: center;
129
+ .image {
130
+ width: 40px;
131
+ height: 40px;
132
+ display: flex;
133
+ align-items: center;
134
+ justify-content: center;
135
+ flex-shrink: 0;
136
+ overflow: hidden;
137
+ & > * {
138
+ max-width: 100%;
139
+ max-height: 100%;
140
+ }
141
+ }
142
+ .text-content {
143
+ display: flex;
144
+ flex-direction: column;
145
+ gap: 5px;
146
+ .description {
147
+ color: ${theme.color.light[700]};
148
+ }
149
+ }
150
+ }
151
+
152
+ /* the list is inert when, and only when, its having its height measured */
153
+ &[inert] {
154
+ opacity: 0;
155
+ pointer-events: none;
156
+ position: absolute;
157
+ /* we don't want to have the height measured over the height of $maxItems */
158
+ li:nth-child(n+${({ $maxItems }) => $maxItems + 1}) {
159
+ display: none;
160
+ }
161
+ }
162
+ }
163
+ }
164
+ `;
165
+ //# sourceMappingURL=styled.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"styled.js","sourceRoot":"","sources":["../../../../src/components/form/Select/styled.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,0BAA0B,CAAA;AAChD,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAA;AAE1C,MAAM,CAAC,MAAM,SAAS,GAAG,MAAM,CAAC,GAAG,CAA6C;;;YAGpE,CAAC,EAAE,YAAY,EAAE,EAAE,EAAE,CAAC,YAAY;;;;;;;;;;;;;;;;;;wBAkBtB,KAAK,CAAC,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC;;wBAEtB,KAAK,CAAC,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC;;;;;;;;;;;;;;;;;;;;0BAoBpB,KAAK,CAAC,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC;eACjC,KAAK,CAAC,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC;;;;;;;;;;;0BAWX,KAAK,CAAC,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC;8BACpB,KAAK,CAAC,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;gCAwDtB,KAAK,CAAC,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC;;;;8BAIxB,KAAK,CAAC,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;qBA4B/B,KAAK,CAAC,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC;;;;;;;;;;;yBAWlB,CAAC,EAAE,SAAS,EAAE,EAAE,EAAE,CAAC,SAAS,GAAG,CAAC;;;;;;CAMxD,CAAA"}
@@ -0,0 +1,103 @@
1
+ import { InputHTMLAttributes } from 'react';
2
+ export interface GenericAccessibleLabel {
3
+ /**
4
+ * This is how the option's label will be rendered inside the input. This can be any React element.
5
+ *
6
+ * Attention: be careful, this should not have any important information that can't be represented through text (accessibility).
7
+ */
8
+ option: React.ReactElement;
9
+ /**
10
+ * This is a required text representation of the option. This is used for accessibility.
11
+ */
12
+ text: string;
13
+ /**
14
+ * This is how the option's label will be rendered as the select current value.
15
+ *
16
+ * If not provided, will be rendered using `element`.
17
+ */
18
+ selected?: React.ReactElement;
19
+ }
20
+ export interface DetailedLabel {
21
+ title: string;
22
+ description?: string;
23
+ image?: React.ReactElement;
24
+ }
25
+ export type AccessibleLabel = string | DetailedLabel | GenericAccessibleLabel;
26
+ type FilterObjectByValueType<T, Type> = {
27
+ [K in keyof T as T[K] extends Type ? K : never]: T[K];
28
+ };
29
+ export type KeyOfType<Data, Type> = Data extends Record<string, any> ? keyof FilterObjectByValueType<Data, Type> : never;
30
+ interface BaseSelectProps<Option, Label extends AccessibleLabel> extends Omit<InputHTMLAttributes<HTMLSelectElement>, 'value' | 'onChange'> {
31
+ /**
32
+ * The current value.
33
+ */
34
+ value: Option | undefined;
35
+ /**
36
+ * The label for the empty option. This sets the value to undefined.
37
+ *
38
+ * If this is not set, there won't be an empty option for this select.
39
+ */
40
+ emptyOption?: Label;
41
+ /**
42
+ * The options to render in this selection menu.
43
+ */
44
+ options: Option[] | undefined;
45
+ /**
46
+ * Provides the value of each option. This can be either a key of the option object or a function that receives the option and returns
47
+ * the value.
48
+ *
49
+ * This is required if the options are not strings or numbers.
50
+ *
51
+ * @example
52
+ * - `'id'`
53
+ * - `(option) => option.id`
54
+ */
55
+ renderValue?: KeyOfType<Option, string> | ((item: NonNullable<Option>) => string);
56
+ /**
57
+ * Provides the label of each option. This can be either a key of the option object or a function that receives the option and returns
58
+ * the label.
59
+ *
60
+ * This is required if the options are not strings or numbers.
61
+ *
62
+ * @example
63
+ * - `'name'`
64
+ * - `(option) => option.name`
65
+ */
66
+ renderLabel?: KeyOfType<Option, Label> | ((item: NonNullable<Option>) => Label);
67
+ /**
68
+ * Called when the value changes.
69
+ * @param value the new value.
70
+ */
71
+ onChange: (value: Option | undefined) => void;
72
+ /**
73
+ * The maximum number of items before showing a vertical scroll bar.
74
+ * @default 6
75
+ */
76
+ maxItems?: number;
77
+ /**
78
+ * Whether or not the options are being loaded. The field will become disabled while loading is true.
79
+ */
80
+ isLoading?: boolean;
81
+ }
82
+ interface OptionalSelectProps<Option, Label extends AccessibleLabel> extends BaseSelectProps<Option, Label> {
83
+ emptyOption: Label;
84
+ }
85
+ interface RequiredSelectProps<Option, Label extends AccessibleLabel> extends Omit<BaseSelectProps<Option, Label>, 'onChange'> {
86
+ emptyOption?: undefined;
87
+ value: Option | undefined;
88
+ onChange: (value: Option) => void;
89
+ }
90
+ export type SelectProps<Option> = OptionalSelectProps<Option, string> | RequiredSelectProps<Option, string>;
91
+ export type DetailedSelectProps<Option> = OptionalSelectProps<Option, DetailedLabel> | RequiredSelectProps<Option, DetailedLabel>;
92
+ export type CustomSelectProps<Option> = (OptionalSelectProps<Option, GenericAccessibleLabel> | RequiredSelectProps<Option, GenericAccessibleLabel>) & {
93
+ /**
94
+ * Controls the height of component when it's closed.
95
+ *
96
+ * Developer note: it would be nice to automatically calculate this instead of expecting a prop.
97
+ *
98
+ * @default '42px'
99
+ */
100
+ height?: string;
101
+ };
102
+ export {};
103
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/components/form/Select/types.ts"],"names":[],"mappings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CACtD,GAAG;IACF;;;;;;OAMG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB,CAAA"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../src/components/form/Select/types.ts"],"names":[],"mappings":""}
@@ -0,0 +1,3 @@
1
+ import { AccessibleLabel, GenericAccessibleLabel } from './types.js';
2
+ export declare function parseLabel(label: AccessibleLabel): GenericAccessibleLabel;
3
+ //# sourceMappingURL=utils.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../../src/components/form/Select/utils.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,eAAe,EAAE,sBAAsB,EAAE,MAAM,SAAS,CAAA;AAEjE,wBAAgB,UAAU,CAAC,KAAK,EAAE,eAAe,GAAG,sBAAsB,CAwBzE"}
@@ -0,0 +1,20 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { Text } from '@citric/core';
3
+ export function parseLabel(label) {
4
+ if (typeof label === 'string') {
5
+ return {
6
+ option: _jsx(Text, { children: label }),
7
+ text: label,
8
+ selected: _jsx(Text, { className: "clipped-text", children: label }),
9
+ };
10
+ }
11
+ if ('title' in label) {
12
+ return {
13
+ option: (_jsxs("div", { className: "detailed", children: [label.image && _jsx("div", { className: "image", children: label.image }), _jsxs("div", { className: "text-content", children: [_jsx(Text, { className: "title", children: label.title }), label.description && _jsx(Text, { className: "description", appearance: "microtext1", children: label.description })] })] })),
14
+ text: `${label.title}: ${label.description}`,
15
+ selected: _jsx(Text, { className: "clipped-text", children: label.title }),
16
+ };
17
+ }
18
+ return label;
19
+ }
20
+ //# sourceMappingURL=utils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../../src/components/form/Select/utils.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,cAAc,CAAA;AAGnC,MAAM,UAAU,UAAU,CAAC,KAAsB;IAC/C,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;QAC9B,OAAO;YACL,MAAM,EAAE,KAAC,IAAI,cAAE,KAAK,GAAQ;YAC5B,IAAI,EAAE,KAAK;YACX,QAAQ,EAAE,KAAC,IAAI,IAAC,SAAS,EAAC,cAAc,YAAE,KAAK,GAAQ;SACxD,CAAA;IACH,CAAC;IACD,IAAI,OAAO,IAAI,KAAK,EAAE,CAAC;QACrB,OAAO;YACL,MAAM,EAAE,CACN,eAAK,SAAS,EAAC,UAAU,aACtB,KAAK,CAAC,KAAK,IAAI,cAAK,SAAS,EAAC,OAAO,YAAE,KAAK,CAAC,KAAK,GAAO,EAC1D,eAAK,SAAS,EAAC,cAAc,aAC3B,KAAC,IAAI,IAAC,SAAS,EAAC,OAAO,YAAE,KAAK,CAAC,KAAK,GAAQ,EAC3C,KAAK,CAAC,WAAW,IAAI,KAAC,IAAI,IAAC,SAAS,EAAC,aAAa,EAAC,UAAU,EAAC,YAAY,YAAE,KAAK,CAAC,WAAW,GAAQ,IAClG,IACF,CACP;YACD,IAAI,EAAE,GAAG,KAAK,CAAC,KAAK,KAAK,KAAK,CAAC,WAAW,EAAE;YAC5C,QAAQ,EAAE,KAAC,IAAI,IAAC,SAAS,EAAC,cAAc,YAAE,KAAK,CAAC,KAAK,GAAQ;SAC9D,CAAA;IACH,CAAC;IACD,OAAO,KAAK,CAAA;AACd,CAAC"}
@@ -5,7 +5,7 @@ import { styled } from 'styled-components';
5
5
  import { AsyncContent } from '../components/AsyncContent.js';
6
6
  import { ErrorFeedback } from '../components/error/index.js';
7
7
  import { SearchInput } from '../components/form/SearchInput.js';
8
- import { Select } from '../components/form/Select.js';
8
+ import { Select } from '../components/form/Select/index.js';
9
9
  import { NotificationList } from '../components/notification/NotificationList.js';
10
10
  import { useNotificationList } from '../context/notification/hooks.js';
11
11
  import { useNotificationController } from '../notifications.js';
@@ -16,16 +16,16 @@ interface Props {
16
16
  }
17
17
  /**
18
18
  * Creates listeners for controlling a Menu UI through the keyboard.
19
- * - Arrow down: next element in the iterator returned by the query selectors. First element, it the current element is the last.
20
- * - Arrow up: previous element in the iterator returned by the query selectors. Last element, it the current element is the first.
19
+ * - Arrow down: next element in the iterator returned by the query selectors. First element, if the current element is the last.
20
+ * - Arrow up: previous element in the iterator returned by the query selectors. Last element, if the current element is the first.
21
21
  * - Tab: same as Arrow down, but has a different behavior if the element is the last (see onPressLastTab).
22
22
  * - Esc: determined by onPressEscape.
23
23
  * @param props {@link Props}.
24
24
  * @returns an object with the element controlled by the keyboard (useRef); a function to attach the keyboard events and a function to
25
25
  * detach the keyboard events.
26
26
  */
27
- export declare function useKeyboardControls({ querySelectors, onPressEscape, onPressLastTab }: Props): {
28
- keyboardControlledElement: import("react").RefObject<HTMLDivElement>;
27
+ export declare function useKeyboardControls<T extends HTMLElement = HTMLDivElement>({ querySelectors, onPressEscape, onPressLastTab }: Props): {
28
+ keyboardControlledElement: import("react").RefObject<T>;
29
29
  attachKeyboardListeners: () => void;
30
30
  detachKeyboardListeners: () => void;
31
31
  };
@@ -1 +1 @@
1
- {"version":3,"file":"keyboard.d.ts","sourceRoot":"","sources":["../../src/hooks/keyboard.tsx"],"names":[],"mappings":";AAEA,UAAU,KAAK;IACb;;OAEG;IACH,cAAc,EAAE,MAAM,CAAC;IACvB;;OAEG;IACH,aAAa,CAAC,EAAE,MAAM,IAAI,CAAC;IAC3B;;;OAGG;IACH,cAAc,CAAC,EAAE,MAAM,IAAI,CAAC;CAC7B;AAED;;;;;;;;;GASG;AACH,wBAAgB,mBAAmB,CAAC,EAAE,cAAc,EAAE,aAAa,EAAE,cAA8B,EAAE,EAAE,KAAK;;;;EAmD3G"}
1
+ {"version":3,"file":"keyboard.d.ts","sourceRoot":"","sources":["../../src/hooks/keyboard.tsx"],"names":[],"mappings":";AAEA,UAAU,KAAK;IACb;;OAEG;IACH,cAAc,EAAE,MAAM,CAAC;IACvB;;OAEG;IACH,aAAa,CAAC,EAAE,MAAM,IAAI,CAAC;IAC3B;;;OAGG;IACH,cAAc,CAAC,EAAE,MAAM,IAAI,CAAC;CAC7B;AAED;;;;;;;;;GASG;AACH,wBAAgB,mBAAmB,CAAC,CAAC,SAAS,WAAW,GAAG,cAAc,EACxE,EAAE,cAAc,EAAE,aAAa,EAAE,cAA8B,EAAE,EAAE,KAAK;;;;EAoDzE"}
@@ -1,8 +1,8 @@
1
1
  import { useCallback, useRef } from 'react';
2
2
  /**
3
3
  * Creates listeners for controlling a Menu UI through the keyboard.
4
- * - Arrow down: next element in the iterator returned by the query selectors. First element, it the current element is the last.
5
- * - Arrow up: previous element in the iterator returned by the query selectors. Last element, it the current element is the first.
4
+ * - Arrow down: next element in the iterator returned by the query selectors. First element, if the current element is the last.
5
+ * - Arrow up: previous element in the iterator returned by the query selectors. Last element, if the current element is the first.
6
6
  * - Tab: same as Arrow down, but has a different behavior if the element is the last (see onPressLastTab).
7
7
  * - Esc: determined by onPressEscape.
8
8
  * @param props {@link Props}.
@@ -1 +1 @@
1
- {"version":3,"file":"keyboard.js","sourceRoot":"","sources":["../../src/hooks/keyboard.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,EAAE,MAAM,OAAO,CAAA;AAkB3C;;;;;;;;;GASG;AACH,MAAM,UAAU,mBAAmB,CAAC,EAAE,cAAc,EAAE,aAAa,EAAE,cAAc,GAAG,aAAa,EAAS;IAC1G,MAAM,yBAAyB,GAAG,MAAM,CAAiB,IAAI,CAAC,CAAA;IAC9D,MAAM,SAAS,GAAG,MAAM,CAAkD,EAAE,CAAC,CAAA;IAC7E,SAAS,CAAC,OAAO,GAAG,EAAE,aAAa,EAAE,cAAc,EAAE,CAAA;IAErD,MAAM,gBAAgB,GAAG,WAAW,CAAC,CAAC,KAAoB,EAAE,EAAE;QAC5D,MAAM,MAAM,GAAG,KAAK,EAAE,MAA4B,CAAA;QA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AC,KAAK,CAAC,GAAG,CAAC,EAAE,EAAE,CAAA;IACzB,CAAC,EAAE,EAAE,CAAC,CAAA;IAEN,MAAM,uBAAuB,GAAG,WAAW,CAAC,GAAG,EAAE;QAC/C,QAAQ,CAAC,gBAAgB,CAAC,SAAS,EAAE,gBAAgB,CAAC,CAAA;IACxD,CAAC,EAAE,EAAE,CAAC,CAAA;IAEN,MAAM,uBAAuB,GAAG,WAAW,CAAC,GAAG,EAAE;QAC/C,QAAQ,CAAC,mBAAmB,CAAC,SAAS,EAAE,gBAAgB,CAAC,CAAA;IAC3D,CAAC,EAAE,EAAE,CAAC,CAAA;IAEN,OAAO,EAAE,yBAAyB,EAAE,uBAAuB,EAAE,uBAAuB,EAAE,CAAA;AACxF,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stack-spot/portal-components",
3
- "version": "2.5.2",
3
+ "version": "2.6.0",
4
4
  "type": "module",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -21,7 +21,7 @@
21
21
  "./error": "./dist/components/error/index.js",
22
22
  "./AnimatedHeight": "./dist/components/AnimatedHeight.js",
23
23
  "./SearchInput": "./dist/components/form/SearchInput.js",
24
- "./Select": "./dist/components/form/Select.js",
24
+ "./Select": "./dist/components/form/Select/index.js",
25
25
  "./Stepper": "./dist/components/Stepper/index.js"
26
26
  },
27
27
  "scripts": {
@@ -0,0 +1,232 @@
1
+ import { IconBox } from '@citric/core'
2
+ import { ChevronDown } from '@citric/icons'
3
+ import { LoadingCircular } from '@citric/ui'
4
+ import { listToClass } from '@stack-spot/portal-theme'
5
+ import { useCallback, useEffect, useMemo, useRef, useState } from 'react'
6
+ import { delay } from '../../../utils/promise'
7
+ import { SelectBox } from './styled'
8
+ import { CustomSelectProps, GenericAccessibleLabel, KeyOfType } from './types'
9
+ import { parseLabel } from './utils'
10
+
11
+ function getOptionAsValue<Option, T extends KeyOfType<Option, string> | ((o: NonNullable<Option>) => string)>(
12
+ option: Option,
13
+ renderer: T | undefined,
14
+ ): string {
15
+ let result: string | undefined
16
+ if (typeof renderer === 'function') result = option ? renderer(option) : undefined
17
+ else if (typeof renderer === 'string') result = option[renderer as keyof Option] as string
18
+ return result ? result : `${option ?? ''}`
19
+ }
20
+
21
+ function getOptionAsLabel<
22
+ Option,
23
+ T extends KeyOfType<Option, GenericAccessibleLabel> | ((o: NonNullable<Option>) => GenericAccessibleLabel)
24
+ >(
25
+ option: Option,
26
+ renderer: T | undefined,
27
+ ): GenericAccessibleLabel {
28
+ let result: GenericAccessibleLabel | undefined
29
+ if (typeof renderer === 'function') result = option ? renderer(option) : undefined
30
+ else if (typeof renderer === 'string') result = option[renderer as keyof Option] as GenericAccessibleLabel
31
+ return result ? result : parseLabel(`${option ?? ''}`)
32
+ }
33
+
34
+ const FakeOption = (
35
+ { value, label, onChange }: { value: string, label: React.ReactElement, onChange: (event: { target: { value: string } }) => void },
36
+ ) => (
37
+ <li className="option" onClick={() => onChange({ target: { value } })}>
38
+ {label}
39
+ </li>
40
+ )
41
+
42
+ /**
43
+ * Renders a Select component using the Citric Design System.
44
+ *
45
+ * The styled version of the select component is rendered on top of the default select from the browser. Visual users will use the Citric
46
+ * version of a Select, but blind users, who interacts with the keyboard, will use the default browser select instead, which is already
47
+ * highly optimized for accessibility.
48
+ *
49
+ * The CustomSelect lets you customize how each option and the selected value are rendered. To do so, use the prop `renderLabel` and
50
+ * `emptyOption`.
51
+ *
52
+ * If you don't need fully customized labels, check the more simple components: `DetailedSelect` and `Select`.
53
+ *
54
+ * The CustomSelect expects a {@link GenericAccessibleLabel} to create labels.
55
+ *
56
+ * Tips:
57
+ * - This is a controlled field. You can't use it any other way. If you're using it with react-hook-form, you need to wrap it under the
58
+ * component `<Controller>` from the same library.
59
+ * - `value` is required and must be of the same type of an item of the array of options. `value` is only optional if `emptyOption` is
60
+ * provided, in this case, an empty option is rendered and the value is undefined when it's selected.
61
+ * - A consequence of the previous rule is that you can't have an empty selection if you don't set a value for `emptyOption`. This
62
+ * component must work exactly like the browser's `select`, so this behavior is intended.
63
+ * - If `renderLabel` or `renderValue` are not provided, this will use the `toString` method of the object.
64
+ *
65
+ * @example
66
+ * options as an object array
67
+ * ```
68
+ * const options = ['option 1', 'option 2', 'option 3']
69
+ *
70
+ * function renderCustomLabel(option: string) {
71
+ * return {
72
+ * // this is how the option will be rendered in the list
73
+ * option: (
74
+ * <div style={{ display: flex, flexDirection: 'row', gap: '5px' }}>
75
+ * <img src="/my-image.png" width="40px" height="40px" />
76
+ * <p>An option called {option}</p>
77
+ * </div>
78
+ * ),
79
+ * // this is how the option will be rendered inside the input, when it's the value currently selected.
80
+ * selected: <p>{option}</p>,
81
+ * // this a string representation of the option: used for accessibility. This should contain the same information as `option`.
82
+ * text: `An option called ${option}`,
83
+ * )
84
+ * }
85
+ *
86
+ * const MyComponent = {
87
+ * const [value, setValue] = useState(options[0])
88
+ * return <CustomSelect options={options} value={value} onChange={setValue} renderLabel={renderCustomLabel} />
89
+ * }
90
+ * ```
91
+ * @example
92
+ * options as an object array
93
+ * ```
94
+ * const options = [{ id: 1, name: 'John', age: 34 }, { id: 2, name: 'Marcia', age: 28 }, { id: 3, name: 'Angeline', age: 58 }]
95
+ *
96
+ * function renderCustomLabel(option: (typeof options)[number]) {
97
+ * return {
98
+ * // this is how the option will be rendered in the list
99
+ * option: (
100
+ * <div style={{ display: flex, flexDirection: 'row', gap: '5px' }}>
101
+ * <img src="/my-image.png" width="40px" height="40px" />
102
+ * <p>{option.name}, aged {option.age}</p>
103
+ * </div>
104
+ * ),
105
+ * // this is how the option will be rendered inside the input, when it's the value currently selected.
106
+ * selected: <p>{option}</p>,
107
+ * // this a string representation of the option: used for accessibility. This should contain the same information as `option`.
108
+ * text: `${option.name}, aged ${option.age}`,
109
+ * )
110
+ * }
111
+ *
112
+ * const MyComponent = {
113
+ * const [value, setValue] = useState(options[0])
114
+ * // below, renderValue could be `o => o.id`
115
+ * return <CustomSelect options={options} value={value} onChange={setValue} renderValue="id" renderLabel={renderCustomLabel} />
116
+ * }
117
+ * ```
118
+ * @param props the component props: {@link CustomSelectProps}.
119
+ */
120
+ export function CustomSelect<T>({
121
+ onChange, options, value, emptyOption, renderLabel, renderValue, maxItems = 6, onFocus, onBlur, style, className, isLoading, disabled,
122
+ height = '42px', ...props
123
+ }: CustomSelectProps<T>) {
124
+ const [open, setOpen] = useState(false)
125
+ const [focused, setFocused] = useState(false)
126
+ const fakeSelectRef = useRef<HTMLDivElement>(null)
127
+ const listHeight = useRef(0)
128
+ const isDisabled = disabled || isLoading
129
+ const isMeasuring = useRef(false)
130
+
131
+ const onChangeOption = useCallback((event: { target: { value: string } }) => {
132
+ const value = options?.find(o => getOptionAsValue(o, renderValue) === event.target.value)
133
+ onChange(value!)
134
+ setOpen(false)
135
+ }, [options])
136
+
137
+ const onClickOutside = useCallback((event: MouseEvent) => {
138
+ if (fakeSelectRef.current && !fakeSelectRef.current.contains(event.target as Node)) setOpen(false)
139
+ }, [])
140
+
141
+ const [htmlOptions, fakeOptions] = useMemo(
142
+ () => (options ?? []).reduce<[React.ReactElement[], React.ReactElement[]]>(([opts, fake], o) => {
143
+ const id = getOptionAsValue(o, renderValue)
144
+ const label = getOptionAsLabel(o, renderLabel)
145
+ return [
146
+ [...opts, <option key={id} value={id} selected={value === id}>{label.text}</option>],
147
+ [...fake, <FakeOption key={id} value={id} label={label.option} onChange={onChangeOption} />],
148
+ ]
149
+ }, [[], []]),
150
+ [options, value],
151
+ )
152
+
153
+ function getCurrentValue() {
154
+ return value === undefined ? '' : getOptionAsValue(value, renderValue)
155
+ }
156
+
157
+ function getCurrentLabel() {
158
+ return value === undefined ? emptyOption : getOptionAsLabel(value, renderLabel)
159
+ }
160
+
161
+ useEffect(() => {
162
+ const detach = () => document.removeEventListener('mousedown', onClickOutside)
163
+ if (open) document.addEventListener('mousedown', onClickOutside)
164
+ else detach()
165
+ return detach
166
+ }, [open])
167
+
168
+ useEffect(() => {
169
+ async function measure() {
170
+ // semaphore for controlling concurrence
171
+ if (isMeasuring.current) return
172
+ isMeasuring.current = true
173
+ const list = fakeSelectRef.current?.querySelector('.options')
174
+ if (!list) return
175
+ list.setAttribute('inert', '')
176
+ list.setAttribute('style', 'height: auto')
177
+ await delay(0)
178
+ listHeight.current = list.clientHeight
179
+ await delay(0)
180
+ list.setAttribute('style', `height: ${open ? listHeight.current : 0}`)
181
+ list.removeAttribute('inert')
182
+ isMeasuring.current = false
183
+ }
184
+ measure()
185
+ }, [options, fakeSelectRef.current])
186
+
187
+ // replicates the original select effect of the browser to select the first option. This is necessary because we use the default
188
+ // select element for accessibility, the behavior must not differ.
189
+ useEffect(() => {
190
+ if (!value && !emptyOption && options?.length) {
191
+ onChange(options[0])
192
+ }
193
+ }, [options])
194
+
195
+ return (
196
+ <SelectBox style={style} className={className} $maxItems={maxItems} $inputHeight={height}>
197
+ { /* Screen readers can use the select component from the browser instead of the highly styled component we show. */ }
198
+ <select
199
+ {...props}
200
+ value={getCurrentValue()}
201
+ onChange={onChangeOption}
202
+ onFocus={(ev) => {
203
+ setFocused(true)
204
+ onFocus?.(ev)
205
+ }}
206
+ onBlur={(ev) => {
207
+ setFocused(false)
208
+ onBlur?.(ev)
209
+ }}
210
+ disabled={isDisabled}
211
+ aria-busy={isLoading}
212
+ >
213
+ {emptyOption === undefined ? null : <option value="" selected={!value}>{emptyOption.text}</option>}
214
+ {htmlOptions}
215
+ </select>
216
+ <div
217
+ ref={fakeSelectRef}
218
+ className={listToClass(['fake-select', open && 'open', focused && 'focused', isDisabled && 'disabled'])}
219
+ aria-hidden
220
+ >
221
+ <div className="current-value" onClick={isDisabled ? undefined : () => setOpen(!open)}>
222
+ {getCurrentLabel()?.selected || getCurrentLabel()?.option || <div></div>}
223
+ {isLoading ? <LoadingCircular size="sm" /> : <IconBox className="arrow"><ChevronDown /></IconBox>}
224
+ </div>
225
+ <ul className="options" style={{ height: open ? listHeight.current : 0 }}>
226
+ {emptyOption === undefined ? null : <FakeOption value="" label={emptyOption.option} onChange={onChangeOption} />}
227
+ {fakeOptions}
228
+ </ul>
229
+ </div>
230
+ </SelectBox>
231
+ )
232
+ }