@pixum/combobox 5.10.4-alpha.18 → 5.10.4-alpha.21

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 (57) hide show
  1. package/lib/ComboBox.d.ts +32 -6
  2. package/lib/ComboBox.js +217 -77
  3. package/lib/ComboBox.js.map +1 -1
  4. package/lib/ComboBox.module.css +7 -1
  5. package/lib/ComboBox.test.js +1 -0
  6. package/lib/ComboBox.test.js.map +1 -1
  7. package/lib/hooks/index.d.ts +2 -0
  8. package/lib/hooks/index.js +2 -0
  9. package/lib/hooks/index.js.map +1 -1
  10. package/lib/hooks/useComboBox.js +1 -0
  11. package/lib/hooks/useComboBox.js.map +1 -1
  12. package/lib/hooks/useComboBoxFocus.js +1 -0
  13. package/lib/hooks/useComboBoxFocus.js.map +1 -1
  14. package/lib/hooks/useIsDesktopScreenWidth.d.ts +5 -0
  15. package/lib/hooks/useIsDesktopScreenWidth.js +34 -24
  16. package/lib/hooks/useIsDesktopScreenWidth.js.map +1 -1
  17. package/lib/index.d.ts +4 -4
  18. package/lib/index.js +2 -3
  19. package/lib/index.js.map +1 -1
  20. package/lib/partials/ComboBoxOptions.d.ts +16 -5
  21. package/lib/partials/ComboBoxOptions.js +25 -21
  22. package/lib/partials/ComboBoxOptions.js.map +1 -1
  23. package/lib/partials/ComboBoxOptionsItems.d.ts +32 -17
  24. package/lib/partials/ComboBoxOptionsItems.js +46 -14
  25. package/lib/partials/ComboBoxOptionsItems.js.map +1 -1
  26. package/lib/partials/ComboBoxOptionsSlot.d.ts +17 -16
  27. package/lib/partials/ComboBoxOptionsSlot.js +26 -11
  28. package/lib/partials/ComboBoxOptionsSlot.js.map +1 -1
  29. package/lib/partials/index.d.ts +2 -1
  30. package/lib/partials/index.js +2 -1
  31. package/lib/partials/index.js.map +1 -1
  32. package/lib/types.d.ts +183 -45
  33. package/lib/utils/index.d.ts +1 -2
  34. package/lib/utils/index.js +1 -2
  35. package/lib/utils/index.js.map +1 -1
  36. package/lib/utils/options.d.ts +38 -1
  37. package/lib/utils/options.js +62 -2
  38. package/lib/utils/options.js.map +1 -1
  39. package/package.json +8 -8
  40. package/lib/ComboboxOptions/Options.d.ts +0 -11
  41. package/lib/ComboboxOptions/Options.js +0 -19
  42. package/lib/ComboboxOptions/Options.js.map +0 -1
  43. package/lib/ComboboxOptions/OptionsGroup.d.ts +0 -12
  44. package/lib/ComboboxOptions/OptionsGroup.js +0 -8
  45. package/lib/ComboboxOptions/OptionsGroup.js.map +0 -1
  46. package/lib/ComboboxOptions/index.d.ts +0 -4
  47. package/lib/ComboboxOptions/index.js +0 -19
  48. package/lib/ComboboxOptions/index.js.map +0 -1
  49. package/lib/helper/calculateListMaxHeight.d.ts +0 -1
  50. package/lib/helper/calculateListMaxHeight.js +0 -8
  51. package/lib/helper/calculateListMaxHeight.js.map +0 -1
  52. package/lib/helper/scrollOptionToViewport.d.ts +0 -1
  53. package/lib/helper/scrollOptionToViewport.js +0 -19
  54. package/lib/helper/scrollOptionToViewport.js.map +0 -1
  55. package/lib/helper/useIsDesktopScreenWidth.d.ts +0 -2
  56. package/lib/helper/useIsDesktopScreenWidth.js +0 -20
  57. package/lib/helper/useIsDesktopScreenWidth.js.map +0 -1
package/lib/types.d.ts CHANGED
@@ -1,78 +1,216 @@
1
- import { LeadingType, MenuItemProps } from '@pixum/menu-item';
2
- import { ThemeType } from '@pixum/theme-provider';
3
- import { InputModesType } from '@pixum/web-input';
1
+ import type { LeadingType, MenuItemProps } from '@pixum/menu-item';
2
+ import type { ThemeType } from '@pixum/theme-provider';
3
+ import type { InputModesType } from '@pixum/web-input';
4
4
  /**
5
- * Props for the ComboBoxOptions component
5
+ * An option as handed in by the consumer.
6
+ *
7
+ * Everything a `MenuItem` understands is accepted and forwarded unchanged -
8
+ * the ComboBox only adds `key` and `disabled` on top. That keeps existing
9
+ * consumers working: they pass their MenuItem props as they always did, and
10
+ * props the ComboBox does not know about still reach the `MenuItem`.
11
+ */
12
+ export interface ComboBoxOptionItemProps extends MenuItemProps {
13
+ /** Unique key for the option item */
14
+ key?: string;
15
+ /**
16
+ * Disabled options are rendered, but skipped by mouse and keyboard.
17
+ *
18
+ * Newly added. Consumer types that already carry a `disabled` field of a
19
+ * different type (e.g. `disabled: 'true' | 'false'`) are no longer
20
+ * assignable - widen it to `boolean` on the consumer side.
21
+ */
22
+ disabled?: boolean;
23
+ }
24
+ /** Options are accepted either as a flat list or grouped by a group headline. */
25
+ export type ComboBoxOptionsInput = ComboBoxOptionItemProps[] | Record<string, ComboBoxOptionItemProps[]>;
26
+ /**
27
+ * An option after normalisation. Flat and grouped options are reduced to this
28
+ * shape once, so keyboard navigation, rendering and ARIA ids all work on the
29
+ * very same list in the very same order.
30
+ */
31
+ export interface ComboBoxOption {
32
+ /** The original option as handed in by the consumer. */
33
+ item: ComboBoxOptionItemProps;
34
+ /**
35
+ * Stable value of the option, reported by `onOptionItemClick` and compared
36
+ * against `value`. Resolved by `resolveOptionValue`: the option's `text` when
37
+ * it is a string, otherwise `key`, otherwise the render index.
38
+ */
39
+ value: string;
40
+ /** Position in render order. Drives the DOM id and the keyboard navigation. */
41
+ index: number;
42
+ /** DOM id, referenced by `aria-activedescendant`. */
43
+ id: string;
44
+ /** Group headline the option belongs to, `undefined` for flat lists. */
45
+ group?: string;
46
+ /** Whether the option can be activated. */
47
+ disabled: boolean;
48
+ }
49
+ /** Options of one render group, produced by `groupOptions`. */
50
+ export interface ComboBoxOptionGroup {
51
+ /** Group headline, `undefined` for flat lists. */
52
+ group?: string;
53
+ /** Options of this group, still carrying their global render index. */
54
+ options: ComboBoxOption[];
55
+ }
56
+ /** ARIA props for the element that owns the `combobox` role. */
57
+ export interface ComboBoxAriaProps {
58
+ role: 'combobox';
59
+ 'aria-expanded': boolean;
60
+ 'aria-haspopup': 'listbox';
61
+ 'aria-controls': string | undefined;
62
+ 'aria-activedescendant': string | undefined;
63
+ 'aria-autocomplete': 'list' | 'none';
64
+ }
65
+ /** ARIA props for the element that owns the `listbox` role. */
66
+ export interface ListboxAriaProps {
67
+ role: 'listbox';
68
+ id: string;
69
+ /** Only set for multi select; single select listboxes omit it. */
70
+ 'aria-multiselectable'?: boolean;
71
+ }
72
+ /**
73
+ * Public options contract, kept for backwards compatibility.
74
+ *
75
+ * In the previous version this interface was the base of `ComboBoxProps` and
76
+ * the prop type of
77
+ * the exported options component. It describes the options as the *consumer*
78
+ * hands them in - not the normalised list the internal panel renders. The
79
+ * internal shape now lives in `ComboBoxOptionsPanelProps`.
80
+ *
81
+ * @deprecated Use `ComboBoxProps` (or `Pick<ComboBoxProps, 'options'>`)
82
+ * directly. Kept so existing imports do not silently change meaning; will be
83
+ * removed in the next major.
6
84
  */
7
85
  export interface ComboBoxOptionsProps {
8
- /** Options to display in the combobox, can be grouped or a flat array */
9
- options: Record<string, ComboBoxOptionItemProps[]> | ComboBoxOptionItemProps[];
10
- /** Currently selected option value */
86
+ /** Options to display, either flat or grouped. */
87
+ options: ComboBoxOptionsInput;
88
+ /**
89
+ * Currently selected option value.
90
+ *
91
+ * @deprecated Use `value`. When both are set, `value` wins.
92
+ */
11
93
  selectedOption?: string;
12
- /** Callback fired when an option is clicked */
94
+ /**
95
+ * Callback fired when an option is clicked.
96
+ *
97
+ * @deprecated Use `onOptionItemClick`. On `ComboBoxProps` this prop is
98
+ * narrowed to the trigger click handler `() => void`.
99
+ */
13
100
  onClick?: (value: string) => void;
14
- /** Type of leading element to display (icon, avatar, etc.) */
101
+ /** Type of leading element to display (icon, avatar, checkbox …). */
102
+ leadingType?: LeadingType;
103
+ /** Additional details rendered below the options. */
104
+ optionDetails?: React.ReactNode;
105
+ }
106
+ /**
107
+ * Props of the rendered options panel - the internal, normalised shape.
108
+ *
109
+ * This is what `ComboBoxOptions` consumes. It is exported so custom panels can
110
+ * be typed against it, but it is not part of the consumer-facing API and may
111
+ * change without a major bump.
112
+ */
113
+ export interface ComboBoxOptionsPanelProps {
114
+ /** Normalised options in render order. */
115
+ options: ComboBoxOption[];
116
+ /** ARIA props of the listbox element. */
117
+ listboxAriaProps: ListboxAriaProps;
118
+ /** Values that are currently selected. */
119
+ selectedValues: string[];
120
+ /** DOM id of the active option (`aria-activedescendant`). */
121
+ activeOptionId?: string;
122
+ /** Type of the leading element, e.g. a checkbox for multi select. */
15
123
  leadingType?: LeadingType;
16
- /** Additional details to display below the options */
124
+ /** Additional details rendered as a sticky footer below the options. */
17
125
  optionDetails?: React.ReactNode;
126
+ /** Called with the value of the clicked option. */
127
+ onOptionClick: (value: string) => void;
18
128
  }
19
129
  /**
20
- * Props for the ComboBox component
130
+ * Props of the ComboBox component.
131
+ *
132
+ * Extends the deprecated `ComboBoxOptionsProps` so that consumers who built
133
+ * their own prop types on top of it keep compiling.
21
134
  */
22
135
  export interface ComboBoxProps extends ComboBoxOptionsProps {
23
- /** Additional CSS class name for the component */
136
+ /** Additional CSS class name for the trigger field. */
24
137
  className?: string;
25
- /** Name attribute for the input field */
138
+ /** Name attribute for the input field. */
26
139
  name?: string;
27
- /** Headline text displayed in mobile bottom sheet */
140
+ /**
141
+ * ID attribute for the input field.
142
+ *
143
+ * @deprecated The trigger generates its own ids for the ARIA wiring; `id` is
144
+ * forwarded to the underlying input untouched and no longer used internally.
145
+ */
146
+ id?: string;
147
+ /** Headline text displayed in the mobile bottom sheet. */
28
148
  headline?: string;
29
- /** Helper text displayed below the input */
149
+ /** Helper text displayed below the input field. */
30
150
  helperText?: string;
31
- /** ID attribute for the input field */
32
- id?: string;
33
- /** Label text for the input field */
151
+ /** Label text for the input field. */
34
152
  label?: string;
35
- /** Whether the dropdown/bottom sheet is currently open */
153
+ /** Options to display, either flat or grouped. */
154
+ options: ComboBoxOptionsInput;
155
+ /** Whether the popover / bottom sheet is currently open. */
36
156
  isOpen: boolean;
37
- /** State setter function to control open/close state */
157
+ /** State setter that controls the open state. */
38
158
  setIsOpen: React.Dispatch<React.SetStateAction<boolean>>;
39
- /** Callback fired when the search input value changes */
40
- onChange?: (value: string) => void;
41
- /** Callback fired when an option item is clicked */
159
+ /**
160
+ * Selected value: a string for single select, an array of strings when
161
+ * `multiple` is set.
162
+ *
163
+ * The array member is new in this version. Code that *reads* this prop back
164
+ * out of
165
+ * a props object has to narrow it (`Array.isArray(value)`).
166
+ */
167
+ value?: string | string[];
168
+ /** Allows selecting several options; combine with a checkbox `leadingType`. */
169
+ multiple?: boolean;
170
+ /** Called with the value of the selected (in multi select: toggled) option. */
42
171
  onOptionItemClick?: (value: string) => void;
43
- /** Callback fired when user clicks outside the component */
172
+ /** Called when the search input value changes. */
173
+ onChange?: (value: string) => void;
174
+ /** Called when the user clicks outside of the component. */
44
175
  onOutsideClick?: () => void;
45
- /** Callback fired when the input field is clicked */
176
+ /** Called when the trigger field is clicked. */
46
177
  onClick?: () => void;
47
- /** Callback fired when the bottom sheet is closed */
178
+ /** Called when the bottom sheet has been closed. */
48
179
  onSheetClose?: () => void;
49
- /** Placeholder text for the input field */
180
+ /** Placeholder text for the input field. */
50
181
  placeholder?: string;
51
- /** Search pattern/regex for input validation */
182
+ /** Search pattern for input validation. */
52
183
  searchPattern?: string;
53
- /** Current value of the combobox */
54
- value?: string;
55
- /** Text to display when no results are found */
184
+ /** Text to display when there is no option to show. */
56
185
  noResultsText?: string;
57
- /** Input mode for mobile keyboards (text, numeric, etc.) */
186
+ /** Input mode for mobile keyboards. */
58
187
  inputMode?: InputModesType;
59
- /** Whether to show the search input field */
188
+ /** Renders a search input inside the popover / bottom sheet. */
60
189
  withSearch?: boolean;
61
- /** Whether the combobox is disabled */
190
+ /** Enter opens the closed list. Disable it inside forms with implicit submit. */
191
+ openOnEnter?: boolean;
192
+ /** Whether the combobox is disabled. */
62
193
  disabled?: boolean;
63
- /** Show disabled style + horizontal shimmer animation while content is loading */
194
+ /** Disabled style plus shimmer animation while content is loading. */
64
195
  loading?: boolean;
65
- /** Theme configuration for the component */
196
+ /** Type of the leading element of an option (icon, avatar, checkbox …). */
197
+ leadingType?: LeadingType;
198
+ /** Additional details rendered below the options. */
199
+ optionDetails?: React.ReactNode;
200
+ /** Theme configuration for the component. */
66
201
  theme?: ThemeType;
67
- /** Custom slot that replaces the standard options/no-results block */
202
+ /** Custom slot that replaces the standard options / no-results block. */
68
203
  optionsSlot?: React.ReactNode;
69
- /** Icon element displayed at the leading (left) side of the trigger input */
204
+ /**
205
+ * Icon element displayed at the leading side of the trigger input.
206
+ *
207
+ * Deliberately `ReactNode`, not `ReactElement`: fragments, strings and
208
+ * conditional `false` have always been accepted here.
209
+ */
70
210
  leadingIcon?: React.ReactNode;
71
- }
72
- /**
73
- * Props for individual ComboBox option items
74
- */
75
- export interface ComboBoxOptionItemProps extends MenuItemProps {
76
- /** Unique key for the option item */
77
- key?: string;
211
+ /**
212
+ * Formats the selected values for the trigger field.
213
+ * Defaults to the labels of the selected options joined by a comma.
214
+ */
215
+ renderValue?: (labels: string[]) => string;
78
216
  }
@@ -1,2 +1 @@
1
- export * from './calculateListMaxHeight';
2
- export * from './scrollOptionToViewport';
1
+ export * from './options';
@@ -1,3 +1,2 @@
1
- export * from './calculateListMaxHeight';
2
- export * from './scrollOptionToViewport';
1
+ export * from './options';
3
2
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAAA,cAAc,0BAA0B,CAAA;AACxC,cAAc,0BAA0B,CAAA"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAA"}
@@ -1,4 +1,41 @@
1
- import type { ComboBoxOption, ComboBoxOptionGroup, ComboBoxOptionsInput } from '../types';
1
+ import type { MenuItemProps } from '@pixum/menu-item';
2
+ import type { ComboBoxOption, ComboBoxOptionGroup, ComboBoxOptionItemProps, ComboBoxOptionsInput } from '../types';
3
+ /**
4
+ * Resolves the stable value of an option.
5
+ *
6
+ * `MenuItemProps` does not guarantee a plain string `text`, so the value is
7
+ * resolved in three steps: the visible label first - that is the value existing
8
+ * consumers pass in as `value` and get back from `onOptionItemClick` -, then
9
+ * the explicit `key`, and finally the render index as a last resort so that
10
+ * options without a label still get a unique value.
11
+ *
12
+ * @param item - The option as handed in by the consumer
13
+ * @param index - Position of the option in render order
14
+ * @returns The stable value of the option
15
+ */
16
+ export declare function resolveOptionValue(item: ComboBoxOptionItemProps, index: number): string;
17
+ /**
18
+ * Returns the label of an option for the trigger field.
19
+ *
20
+ * Falls back to the resolved value when the option renders a custom node
21
+ * instead of a plain string.
22
+ *
23
+ * @param option - A normalised option
24
+ * @returns The label to display in the trigger field
25
+ */
26
+ export declare function getOptionLabel(option: ComboBoxOption): string;
27
+ /**
28
+ * Strips the ComboBox specific props from an option so the rest can be spread
29
+ * onto the `MenuItem`.
30
+ *
31
+ * `key` is a reserved React prop and `disabled` is handled by the option
32
+ * wrapper (`aria-disabled` plus the click guard); everything else belongs to
33
+ * `MenuItem` and is forwarded untouched.
34
+ *
35
+ * @param item - The option as handed in by the consumer
36
+ * @returns The props meant for the `MenuItem`
37
+ */
38
+ export declare function toMenuItemProps({ key, disabled, ...menuItemProps }: ComboBoxOptionItemProps): MenuItemProps;
2
39
  /**
3
40
  * Normalises flat and grouped options into one list in render order.
4
41
  *
@@ -1,3 +1,64 @@
1
+ var __rest = (this && this.__rest) || function (s, e) {
2
+ var t = {};
3
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
4
+ t[p] = s[p];
5
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
6
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
7
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
8
+ t[p[i]] = s[p[i]];
9
+ }
10
+ return t;
11
+ };
12
+ /**
13
+ * Resolves the stable value of an option.
14
+ *
15
+ * `MenuItemProps` does not guarantee a plain string `text`, so the value is
16
+ * resolved in three steps: the visible label first - that is the value existing
17
+ * consumers pass in as `value` and get back from `onOptionItemClick` -, then
18
+ * the explicit `key`, and finally the render index as a last resort so that
19
+ * options without a label still get a unique value.
20
+ *
21
+ * @param item - The option as handed in by the consumer
22
+ * @param index - Position of the option in render order
23
+ * @returns The stable value of the option
24
+ */
25
+ export function resolveOptionValue(item, index) {
26
+ if (typeof item.text === 'string' && item.text)
27
+ return item.text;
28
+ if (item.key)
29
+ return item.key;
30
+ return `option-${index}`;
31
+ }
32
+ /**
33
+ * Returns the label of an option for the trigger field.
34
+ *
35
+ * Falls back to the resolved value when the option renders a custom node
36
+ * instead of a plain string.
37
+ *
38
+ * @param option - A normalised option
39
+ * @returns The label to display in the trigger field
40
+ */
41
+ export function getOptionLabel(option) {
42
+ if (typeof option.item.text === 'string' && option.item.text) {
43
+ return option.item.text;
44
+ }
45
+ return option.value;
46
+ }
47
+ /**
48
+ * Strips the ComboBox specific props from an option so the rest can be spread
49
+ * onto the `MenuItem`.
50
+ *
51
+ * `key` is a reserved React prop and `disabled` is handled by the option
52
+ * wrapper (`aria-disabled` plus the click guard); everything else belongs to
53
+ * `MenuItem` and is forwarded untouched.
54
+ *
55
+ * @param item - The option as handed in by the consumer
56
+ * @returns The props meant for the `MenuItem`
57
+ */
58
+ export function toMenuItemProps(_a) {
59
+ var { key, disabled } = _a, menuItemProps = __rest(_a, ["key", "disabled"]);
60
+ return menuItemProps;
61
+ }
1
62
  /**
2
63
  * Normalises flat and grouped options into one list in render order.
3
64
  *
@@ -16,12 +77,11 @@ export function normaliseOptions(options, listboxId) {
16
77
  const normalised = [];
17
78
  groups.forEach(([group, items]) => {
18
79
  items.forEach(item => {
19
- var _a;
20
80
  const index = normalised.length;
21
81
  normalised.push({
22
82
  item,
23
83
  group: group || undefined,
24
- value: (_a = item.value) !== null && _a !== void 0 ? _a : item.text,
84
+ value: resolveOptionValue(item, index),
25
85
  index,
26
86
  id: `${listboxId}-option-${index}`,
27
87
  disabled: item.disabled === true,
@@ -1 +1 @@
1
- {"version":3,"file":"options.js","sourceRo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AAG,MAAM,EAAE,IAAI,IAAI,CAAC,EAAE,CAAC;QAC5C,KAAK,GAAG,CAAC,KAAK,GAAG,KAAK,GAAG,MAAM,CAAC,GAAG,MAAM,CAAA;QAEzC,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,QAAQ;YAAE,OAAO,KAAK,CAAA;IAC5C,CAAC;IAED,OAAO,IAAI,CAAA;AACb,CAAC"}
package/package.json CHANGED
@@ -1,16 +1,16 @@
1
1
  {
2
2
  "name": "@pixum/combobox",
3
- "version": "5.10.4-alpha.18+d1e52db7f",
3
+ "version": "5.10.4-alpha.21+b5dfcedf0",
4
4
  "main": "lib/index.js",
5
5
  "module": "lib/index.js",
6
6
  "license": "UNLICENSED",
7
7
  "peerDependencies": {
8
- "@pixum/bottom-sheet": "3.0.18",
9
- "@pixum/menu": "3.0.14",
10
- "@pixum/menu-item": "2.0.14",
11
- "@pixum/text": ">=3.7.0",
12
- "@pixum/theme-provider": "4.2.20",
13
- "@pixum/web-input": "2.1.0"
8
+ "@pixum/bottom-sheet": "4.9.0",
9
+ "@pixum/menu": "4.4.2",
10
+ "@pixum/menu-item": "3.4.3",
11
+ "@pixum/text": "3.7.0",
12
+ "@pixum/theme-provider": "^6.0.0",
13
+ "@pixum/web-input": "2.5.6"
14
14
  },
15
15
  "files": [
16
16
  "lib"
@@ -18,5 +18,5 @@
18
18
  "sideEffects": [
19
19
  "*.css"
20
20
  ],
21
- "gitHead": "d1e52db7fc60033d1e40fedde10ee6e52216e657"
21
+ "gitHead": "b5dfcedf09cddc006962439c0a7338cd2b457ba4"
22
22
  }
@@ -1,11 +0,0 @@
1
- import { LeadingType } from '@pixum/menu-item';
2
- import React from 'react';
3
- import { ComboBoxOptionProps } from '../types';
4
- interface OptionsProps {
5
- items: ComboBoxOptionProps[];
6
- selectedOption?: string;
7
- onClick?: (value: string) => void;
8
- leadingType?: LeadingType;
9
- }
10
- declare const Options: React.FC<OptionsProps>;
11
- export default Options;
@@ -1,19 +0,0 @@
1
- import MenuItem from '@pixum/menu-item';
2
- import clsx from 'clsx';
3
- import React from 'react';
4
- const Options = ({ items, selectedOption, onClick, leadingType, }) => (React.createElement(React.Fragment, null, items.map((item) => {
5
- var _a;
6
- const itemText = item.text;
7
- const isSelected = selectedOption === ((item === null || item === void 0 ? void 0 : item.label) || itemText);
8
- return (React.createElement("div", { key: `combobox-item-wrapper-${itemText}`, className: "combobox__option-wrapper", role: "button", tabIndex: 0, onPointerDown: (e) => e.stopPropagation(), onTouchStart: (e) => e.stopPropagation(), onMouseDown: (e) => e.stopPropagation(), onClickCapture: (e) => {
9
- e.stopPropagation();
10
- onClick === null || onClick === void 0 ? void 0 : onClick(itemText);
11
- } },
12
- React.createElement(MenuItem, { tabIndex: -1, className: clsx(isSelected && 'selected'), onMouseEnter: item.onMouseEnter, leadingProps: leadingType
13
- ? { name: itemText, type: leadingType }
14
- : undefined, selected: selectedOption === itemText, text: itemText, subtext: item.subtext, subItemProps: {
15
- text: (_a = item.subItemProps) === null || _a === void 0 ? void 0 : _a.text,
16
- } })));
17
- })));
18
- export default Options;
19
- //# sourceMappingURL=Options.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"Options.js","sourceRoot":"","sources":["../../src/ComboboxOptions/Options.tsx"],"names":[],"mappings":"AAAA,OAAO,QAAwC,MAAM,kBAAkB,CAAA;AACvE,OAAO,IAAI,MAAM,MAAM,CAAA;AACvB,OAAO,KAAK,MAAM,OAAO,CAAA;AAUzB,MAAM,OAAO,GAA2B,CAAC,EACvC,KAAK,EACL,cAAc,EACd,OAAO,EACP,WAAW,GACZ,EAAE,EAAE,CAAC,CACJ,0CACG,KAAK,CAAC,GAAG,CAAC,CAAC,IAAmB,EAAE,EAAE;;IACjC,MAAM,QAAQ,GAAG,IAAI,CAAC,IAAI,CAAA;IAC1B,MAAM,UAAU,GAAG,cAAc,KAAK,CAAC,CAAA,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,KAAK,KAAI,QAAQ,CAAC,CAAA;IAE/D,OAAO,CACL,6BACE,GAAG,EAAE,yBAAyB,QAAQ,EAAE,EACxC,SAAS,EAAC,0BAA0B,EACpC,IAAI,EAAC,QAAQ,EACb,QAAQ,EAAE,CAAC,EACX,aAAa,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,eAAe,EAAE,EACzC,YAAY,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,eAAe,EAAE,EACxC,WAAW,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,eAAe,EAAE,EACvC,cAAc,EAAE,CAAC,CAAC,EAAE,EAAE;YACpB,CAAC,CAAC,eAAe,EAAE,CAAA;YACnB,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAG,QAAQ,CAAC,CAAA;QACrB,CAAC;QAED,oBAAC,QAAQ,IACP,QAAQ,EAAE,CAAC,CAAC,EACZ,SAAS,EAAE,IAAI,CAAC,UAAU,IAAI,UAAU,CAAC,EACzC,YAAY,EAAE,IAAI,CAAC,YAAY,EAC/B,YAAY,EACV,WAAW;gBACT,CAAC,CAAC,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,WAAW,EAAE;gBACvC,CAAC,CAAC,SAAS,EAEf,QAAQ,EAAE,cAAc,KAAK,QAAQ,EACrC,IAAI,EAAE,QAAQ,EACd,OAAO,EAAE,IAAI,CAAC,OAAO,EACrB,YAAY,EAAE;gBACZ,IAAI,EAAE,MAAA,IAAI,CAAC,YAAY,0CAAE,IAAI;aAC9B,GACD,CACE,CACP,CAAA;AACH,CAAC,CAAC,CACD,CACJ,CAAA;AAED,eAAe,OAAO,CAAA"}
@@ -1,12 +0,0 @@
1
- import { LeadingType } from '@pixum/menu-item';
2
- import React from 'react';
3
- import { ComboBoxOptionProps } from '../types';
4
- interface OptionsGroupProps {
5
- group: string;
6
- items: ComboBoxOptionProps[];
7
- selectedOption?: string;
8
- onClick?: (value: string) => void;
9
- leadingType?: LeadingType;
10
- }
11
- declare const OptionsGroup: React.FC<OptionsGroupProps>;
12
- export default OptionsGroup;
@@ -1,8 +0,0 @@
1
- import Text, { TextVariant } from '@pixum/text';
2
- import React from 'react';
3
- import Options from './Options';
4
- const OptionsGroup = ({ group, items, selectedOption, onClick, leadingType, }) => (React.createElement("div", { className: "combobox__options-group", key: `combobox__options-group-${group}` },
5
- React.createElement(Text, { variant: TextVariant.HEADLINE, className: "combobox__sticky-header" }, group),
6
- React.createElement(Options, { items: items, selectedOption: selectedOption, onClick: onClick, leadingType: leadingType })));
7
- export default OptionsGroup;
8
- //# sourceMappingURL=OptionsGroup.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"OptionsGroup.js","sourceRoot":"","sources":["../../src/ComboboxOptions/OptionsGroup.tsx"],"names":[],"mappings":"AACA,OAAO,IAAI,EAAE,EAAE,WAAW,EAAE,MAAM,aAAa,CAAA;AAC/C,OAAO,KAAK,MAAM,OAAO,CAAA;AACzB,OAAO,OAAO,MAAM,WAAW,CAAA;AAW/B,MAAM,YAAY,GAAgC,CAAC,EACjD,KAAK,EACL,KAAK,EACL,cAAc,EACd,OAAO,EACP,WAAW,GACZ,EAAE,EAAE,CAAC,CACJ,6BACE,SAAS,EAAC,yBAAyB,EACnC,GAAG,EAAE,2BAA2B,KAAK,EAAE;IAEvC,oBAAC,IAAI,IAAC,OAAO,EAAE,WAAW,CAAC,QAAQ,EAAE,SAAS,EAAC,yBAAyB,IACrE,KAAK,CACD;IACP,oBAAC,OAAO,IACN,KAAK,EAAE,KAAK,EACZ,cAAc,EAAE,cAAc,EAC9B,OAAO,EAAE,OAAO,EAChB,WAAW,EAAE,WAAW,GACxB,CACE,CACP,CAAA;AAED,eAAe,YAAY,CAAA"}
@@ -1,4 +0,0 @@
1
- import React from 'react';
2
- import { ComboBoxOptionsProps } from '../types';
3
- declare const ComboBoxOptions: React.FC<ComboBoxOptionsProps>;
4
- export default ComboBoxOptions;
@@ -1,19 +0,0 @@
1
- import React, { useEffect } from 'react';
2
- import Menu from '@pixum/menu';
3
- import { scrollOptionToViewport } from '../helper/scrollOptionToViewport';
4
- import OptionsGroup from './OptionsGroup';
5
- import Options from './Options';
6
- import useIsDesktopScreenWidth from '../helper/useIsDesktopScreenWidth';
7
- const ComboBoxOptions = ({ options, onClick, selectedOption, leadingType, optionDetails, }) => {
8
- const isDesktop = useIsDesktopScreenWidth();
9
- const optionsWithoutGroup = Array.isArray(options);
10
- const optionsWithGroup = Object.entries(options);
11
- useEffect(() => {
12
- scrollOptionToViewport(isDesktop);
13
- }, [isDesktop]);
14
- return (React.createElement(Menu, { className: "combobox__options scrollable", "data-tappable": "true" },
15
- optionsWithoutGroup ? (React.createElement(Options, { items: options, selectedOption: selectedOption, onClick: onClick, leadingType: leadingType })) : (React.createElement(React.Fragment, null, optionsWithGroup.map(([group, items]) => (React.createElement(OptionsGroup, { group: group, items: items, selectedOption: selectedOption, onClick: onClick, leadingType: leadingType }))))),
16
- optionDetails && (React.createElement("div", { className: "combobox__option-details text--caption" }, optionDetails))));
17
- };
18
- export default ComboBoxOptions;
19
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/ComboboxOptions/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AACxC,OAAO,IAAI,MAAM,aAAa,CAAA;AAC9B,OAAO,EAAE,sBAAsB,EAAE,MAAM,kCAAkC,CAAA;AAEzE,OAAO,YAAY,MAAM,gBAAgB,CAAA;AACzC,OAAO,OAAO,MAAM,WAAW,CAAA;AAC/B,OAAO,uBAAuB,MAAM,mCAAmC,CAAA;AAEvE,MAAM,eAAe,GAAmC,CAAC,EACvD,OAAO,EACP,OAAO,EACP,cAAc,EACd,WAAW,EACX,aAAa,GACd,EAAE,EAAE;IACH,MAAM,SAAS,GAAG,uBAAuB,EAAE,CAAA;IAC3C,MAAM,mBAAmB,GAAG,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC,CAAA;IAClD,MAAM,gBAAgB,GAAG,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,CAAA;IAEhD,SAAS,CAAC,GAAG,EAAE;QACb,sBAAsB,CAAC,SAAS,CAAC,CAAA;IACnC,CAAC,EAAE,CAAC,SAAS,CAAC,CAAC,CAAA;IAEf,OAAO,CACL,oBAAC,IAAI,IACH,SAAS,EAAC,8BAA8B,mBAC1B,MAAM;QAEnB,mBAAmB,CAAC,CAAC,CAAC,CACrB,oBAAC,OAAO,IACN,KAAK,EAAE,OAAO,EACd,cAAc,EAAE,cAAc,EAC9B,OAAO,EAAE,OAAO,EAChB,WAAW,EAAE,WAAW,GACxB,CACH,CAAC,CAAC,CAAC,CACF,0CACG,gBAAgB,CAAC,GAAG,CAAC,CAAC,CAAC,KAAK,EAAE,KAAK,CAAC,EAAE,EAAE,CAAC,CACxC,oBAAC,YAAY,IACX,KAAK,EAAE,KAAK,EACZ,KAAK,EAAE,KAAK,EACZ,cAAc,EAAE,cAAc,EAC9B,OAAO,EAAE,OAAO,EAChB,WAAW,EAAE,WAAW,GACxB,CACH,CAAC,CACD,CACJ;QACA,aAAa,IAAI,CAChB,6BAAK,SAAS,EAAC,wCAAwC,IACpD,aAAa,CACV,CACP,CACI,CACR,CAAA;AACH,CAAC,CAAA;AAED,eAAe,eAAe,CAAA"}
@@ -1 +0,0 @@
1
- export declare const calculateListMaxHeight: () => number;
@@ -1,8 +0,0 @@
1
- export const calculateListMaxHeight = () => {
2
- const windowHeight = window.innerHeight;
3
- const headerHeight = 50;
4
- const inputFieldHeight = 35;
5
- const maxListHeight = windowHeight - headerHeight - inputFieldHeight;
6
- return maxListHeight;
7
- };
8
- //# sourceMappingURL=calculateListMaxHeight.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"calculateListMaxHeight.js","sourceRoot":"","sources":["../../src/helper/calculateListMaxHeight.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,sBAAsB,GAAG,GAAG,EAAE;IACvC,MAAM,YAAY,GAAG,MAAM,CAAC,WAAW,CAAA;IACvC,MAAM,YAAY,GAAG,EAAE,CAAA;IACvB,MAAM,gBAAgB,GAAG,EAAE,CAAA;IAC3B,MAAM,aAAa,GAAG,YAAY,GAAG,YAAY,GAAG,gBAAgB,CAAA;IAErE,OAAO,aAAa,CAAA;AAEvB,CAAC,CAAA"}
@@ -1 +0,0 @@
1
- export declare const scrollOptionToViewport: (isDesktop: boolean) => void;
@@ -1,19 +0,0 @@
1
- export const scrollOptionToViewport = (isDesktop) => {
2
- const comboboxOptions = isDesktop
3
- ? document.querySelector('.menu')
4
- : document.querySelector('.combobox__options');
5
- const selectedItem = document.querySelector('.menu-item.selected');
6
- if (selectedItem && comboboxOptions) {
7
- let comboboxOptionsGroup = selectedItem === null || selectedItem === void 0 ? void 0 : selectedItem.parentElement;
8
- if (comboboxOptionsGroup) {
9
- const stickyHeader = comboboxOptionsGroup === null || comboboxOptionsGroup === void 0 ? void 0 : comboboxOptionsGroup.querySelector('.sticky-header');
10
- const stickyHeaderOffset = stickyHeader === null || stickyHeader === void 0 ? void 0 : stickyHeader.offsetTop;
11
- comboboxOptions === null || comboboxOptions === void 0 ? void 0 : comboboxOptions.scrollTo({ top: stickyHeaderOffset });
12
- }
13
- else {
14
- const selectedItemOffset = selectedItem === null || selectedItem === void 0 ? void 0 : selectedItem.offsetTop;
15
- comboboxOptions === null || comboboxOptions === void 0 ? void 0 : comboboxOptions.scrollTo({ top: selectedItemOffset });
16
- }
17
- }
18
- };
19
- //# sourceMappingURL=scrollOptionToViewport.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"scrollOptionToViewport.js","sourceRoot":"","sources":["../../src/helper/scrollOptionToViewport.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,sBAAsB,GAAG,CAAC,SAAkB,EAAE,EAAE;IAC3D,MAAM,eAAe,GAAG,SAAS;QAC/B,CAAC,CAAE,QAAQ,CAAC,aAAa,CAAC,OAAO,CAAiB;QAClD,CAAC,CAAE,QAAQ,CAAC,aAAa,CAAC,oBAAoB,CAAiB,CAAA;IACjE,MAAM,YAAY,GAAG,QAAQ,CAAC,aAAa,CACzC,qBAAqB,CACP,CAAA;IAEhB,IAAI,YAAY,IAAI,eAAe,EAAE,CAAC;QACpC,IAAI,oBAAoB,GAAG,YAAY,aAAZ,YAAY,uBAAZ,YAAY,CAAE,aAAa,CAAA;QAEtD,IAAI,oBAAoB,EAAE,CAAC;YACzB,MAAM,YAAY,GAAG,oBAAoB,aAApB,oBAAoB,uBAApB,oBAAoB,CAAE,aAAa,CACtD,gBAAgB,CACF,CAAA;YAChB,MAAM,kBAAkB,GAAG,YAAY,aAAZ,YAAY,uBAAZ,YAAY,CAAE,SAAS,CAAA;YAElD,eAAe,aAAf,eAAe,uBAAf,eAAe,CAAE,QAAQ,CAAC,EAAE,GAAG,EAAE,kBAAkB,EAAE,CAAC,CAAA;QACxD,CAAC;aAAM,CAAC;YACN,MAAM,kBAAkB,GAAG,YAAY,aAAZ,YAAY,uBAAZ,YAAY,CAAE,SAAS,CAAA;YAElD,eAAe,aAAf,eAAe,uBAAf,eAAe,CAAE,QAAQ,CAAC,EAAE,GAAG,EAAE,kBAAkB,EAAE,CAAC,CAAA;QACxD,CAAC;IACH,CAAC;AACH,CAAC,CAAA"}
@@ -1,2 +0,0 @@
1
- declare const useIsDesktopScreenWidth: () => boolean;
2
- export default useIsDesktopScreenWidth;
@@ -1,20 +0,0 @@
1
- import { useState, useEffect } from 'react';
2
- const useIsDesktopScreenWidth = () => {
3
- const hasWindowObject = typeof window !== 'undefined';
4
- if (hasWindowObject) {
5
- const [screenWidth, setScreenWidth] = useState(window.innerWidth);
6
- useEffect(() => {
7
- const handleResize = () => {
8
- setScreenWidth(window.innerWidth);
9
- };
10
- window.addEventListener('resize', handleResize);
11
- return () => {
12
- window.removeEventListener('resize', handleResize);
13
- };
14
- }, []);
15
- return screenWidth > 960;
16
- }
17
- return false;
18
- };
19
- export default useIsDesktopScreenWidth;
20
- //# sourceMappingURL=useIsDesktopScreenWidth.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"useIsDesktopScreenWidth.js","sourceRoot":"","sources":["../../src/helper/useIsDesktopScreenWidth.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAE3C,MAAM,uBAAuB,GAAG,GAAG,EAAE;IACnC,MAAM,eAAe,GAAG,OAAO,MAAM,KAAK,WAAW,CAAA;IAErD,IAAI,eAAe,EAAE,CAAC;QACpB,MAAM,CAAC,WAAW,EAAE,cAAc,CAAC,GAAG,QAAQ,CAAC,MAAM,CAAC,UAAU,CAAC,CAAA;QAEjE,SAAS,CAAC,GAAG,EAAE;YACb,MAAM,YAAY,GAAG,GAAG,EAAE;gBACxB,cAAc,CAAC,MAAM,CAAC,UAAU,CAAC,CAAA;YACnC,CAAC,CAAA;YAED,MAAM,CAAC,gBAAgB,CAAC,QAAQ,EAAE,YAAY,CAAC,CAAA;YAE/C,OAAO,GAAG,EAAE;gBACV,MAAM,CAAC,mBAAmB,CAAC,QAAQ,EAAE,YAAY,CAAC,CAAA;YACpD,CAAC,CAAA;QACH,CAAC,EAAE,EAAE,CAAC,CAAA;QAEN,OAAO,WAAW,GAAG,GAAG,CAAA;IAC1B,CAAC;IAED,OAAO,KAAK,CAAA;AACd,CAAC,CAAA;AAED,eAAe,uBAAuB,CAAA"}