@trilogy-ds/react 0.0.1-beta.33 → 0.0.1-beta.35

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 (66) hide show
  1. package/lib/components/alert/Alert.d.ts +10 -2
  2. package/lib/components/alert/Alert.js +84 -3
  3. package/lib/components/alert/Alert.js.map +1 -1
  4. package/lib/components/alert/Alert.native.d.ts +22 -2
  5. package/lib/components/alert/Alert.native.js +82 -1
  6. package/lib/components/alert/Alert.native.js.map +1 -1
  7. package/lib/components/alert/AlertProps.d.ts +23 -1
  8. package/lib/components/alert/AlertProps.js +5 -1
  9. package/lib/components/alert/AlertProps.js.map +1 -1
  10. package/lib/components/alert/context/ToasterContext.d.ts +7 -0
  11. package/lib/components/alert/context/ToasterContext.js +5 -0
  12. package/lib/components/alert/context/ToasterContext.js.map +1 -0
  13. package/lib/components/alert/context/ToasterContextProps.d.ts +27 -0
  14. package/lib/components/alert/context/ToasterContextProps.js +2 -0
  15. package/lib/components/alert/context/ToasterContextProps.js.map +1 -0
  16. package/lib/components/alert/context/index.d.ts +2 -0
  17. package/lib/components/alert/context/index.js +3 -0
  18. package/lib/components/alert/context/index.js.map +1 -0
  19. package/lib/components/alert/index.d.ts +3 -2
  20. package/lib/components/alert/index.js +3 -2
  21. package/lib/components/alert/index.js.map +1 -1
  22. package/lib/components/index.d.ts +0 -1
  23. package/lib/components/index.js +0 -1
  24. package/lib/components/index.js.map +1 -1
  25. package/lib/components/input/Input.js +2 -0
  26. package/lib/components/input/Input.js.map +1 -1
  27. package/lib/components/input/Input.native.js +1 -1
  28. package/lib/components/input/Input.native.js.map +1 -1
  29. package/lib/components/input/InputProps.d.ts +1 -0
  30. package/lib/components/modal/Modal.native.js +4 -1
  31. package/lib/components/modal/Modal.native.js.map +1 -1
  32. package/lib/components/price/Price.native.js +4 -4
  33. package/lib/components/price/Price.native.js.map +1 -1
  34. package/lib/components/select/Select.d.ts +2 -2
  35. package/lib/components/select/Select.js +6 -18
  36. package/lib/components/select/Select.js.map +1 -1
  37. package/lib/components/select/Select.native.d.ts +3 -3
  38. package/lib/components/select/Select.native.js +116 -79
  39. package/lib/components/select/Select.native.js.map +1 -1
  40. package/lib/components/select/SelectProps.d.ts +10 -21
  41. package/lib/components/select/option/SelectOption.d.ts +2 -3
  42. package/lib/components/select/option/SelectOption.js +10 -12
  43. package/lib/components/select/option/SelectOption.js.map +1 -1
  44. package/lib/components/select/option/SelectOption.native.d.ts +3 -3
  45. package/lib/components/select/option/SelectOption.native.js +41 -5
  46. package/lib/components/select/option/SelectOption.native.js.map +1 -1
  47. package/lib/components/select/web/SelectDynamic.d.ts +3 -3
  48. package/lib/components/select/web/SelectDynamic.js +186 -49
  49. package/lib/components/select/web/SelectDynamic.js.map +1 -1
  50. package/lib/components/select/web/SelectNative.d.ts +2 -2
  51. package/lib/components/select/web/SelectNative.js +57 -22
  52. package/lib/components/select/web/SelectNative.js.map +1 -1
  53. package/lib/components/text/TextProps.d.ts +1 -1
  54. package/package.json +1 -1
  55. package/lib/components/select/hooks/accessibility.d.ts +0 -11
  56. package/lib/components/select/hooks/accessibility.js +0 -111
  57. package/lib/components/select/hooks/accessibility.js.map +0 -1
  58. package/lib/components/select/hooks/utils.d.ts +0 -30
  59. package/lib/components/select/hooks/utils.js +0 -94
  60. package/lib/components/select/hooks/utils.js.map +0 -1
  61. package/lib/components/select/option/SelectNativeOption.d.ts +0 -4
  62. package/lib/components/select/option/SelectNativeOption.js +0 -8
  63. package/lib/components/select/option/SelectNativeOption.js.map +0 -1
  64. package/lib/components/select/option/SelectNativeOption.native.d.ts +0 -2
  65. package/lib/components/select/option/SelectNativeOption.native.js +0 -5
  66. package/lib/components/select/option/SelectNativeOption.native.js.map +0 -1
@@ -1,6 +1,6 @@
1
1
  /// <reference types="react" />
2
- import { IconName, IconNameValues } from '../icon';
3
2
  import { Accessibility } from '../../objects';
3
+ import { IconName, IconNameValues } from '../icon';
4
4
  export interface ISelectOption {
5
5
  value: string | undefined;
6
6
  name: string | undefined;
@@ -11,36 +11,25 @@ export interface SelectChangeEvent {
11
11
  selectName?: string;
12
12
  selectId?: string;
13
13
  name?: string;
14
+ selectedOptions?: string[];
14
15
  }
15
- export type SelectChangeEventHandler<T = SelectChangeEvent | number | string> = (event: T) => void;
16
- interface ISelectCommunProps<T = SelectChangeEvent | number | string> {
16
+ export type SelectChangeEventHandler<T = SelectChangeEvent> = (event: T) => void;
17
+ export type SelectedValue = string | number | string[] | undefined;
18
+ export type ParamEventSelectFocus = React.FocusEvent | React.BaseSyntheticEvent;
19
+ export interface SelectProps<T = SelectChangeEvent> extends Accessibility {
17
20
  onChange?: SelectChangeEventHandler<T>;
18
- onFocus?: (event: React.FocusEvent | React.BaseSyntheticEvent) => void;
19
- onBlur?: (event: React.FocusEvent | React.BaseSyntheticEvent | MouseEvent) => void;
21
+ onFocus?: (event: ParamEventSelectFocus) => void;
22
+ onBlur?: (event: unknown) => void;
20
23
  label?: string;
21
24
  children?: React.ReactNode;
22
25
  disabled?: boolean;
23
26
  iconName?: IconName | IconNameValues;
24
- selected?: string | number;
25
- styled?: boolean;
27
+ selected?: SelectedValue;
26
28
  id?: string;
27
29
  name?: string;
28
- }
29
- export interface SelectProps extends Accessibility, ISelectCommunProps {
30
+ multiple?: boolean;
30
31
  className?: string;
31
- classNameOptions?: string;
32
32
  nullable?: boolean;
33
- onMouseEnter?: (event: React.MouseEvent) => void;
34
- onMouseLeave?: (event: React.MouseEvent) => void;
35
33
  placeholder?: string;
36
34
  native?: boolean;
37
35
  }
38
- export interface IAccessibleSelect extends Accessibility, ISelectCommunProps {
39
- selecteClasses?: string;
40
- }
41
- export interface ICustomSelect extends Accessibility, ISelectCommunProps {
42
- selecteClasses?: string;
43
- nullable?: boolean;
44
- classNameOptions?: string;
45
- }
46
- export {};
@@ -1,5 +1,5 @@
1
1
  /// <reference types="react" />
2
- import { SelectOptionProps } from "./SelectOptionProps";
2
+ import { SelectOptionProps } from './SelectOptionProps';
3
3
  /**
4
4
  * Select Option Component
5
5
  * @param value {string} Select option value
@@ -11,8 +11,7 @@ import { SelectOptionProps } from "./SelectOptionProps";
11
11
  * @param iconName {IconName | IconNameValues} icon
12
12
  * @param disabled {boolean} disable option
13
13
  * @param onClick {function} onclick function
14
- * @param selected {boolean} Selected option
15
14
  * @param id {string} Select option custom id
16
15
  */
17
- declare const SelectOption: ({ id, className, selected, value, disabled, children, onClick, label, iconName, testId, ...others }: SelectOptionProps) => JSX.Element;
16
+ declare const SelectOption: ({ id, className, value, disabled, children, onClick, label, iconName, testId, ...others }: SelectOptionProps) => JSX.Element;
18
17
  export default SelectOption;
@@ -1,8 +1,6 @@
1
- import * as React from "react";
2
- import clsx from "clsx";
3
- import { hashClass } from "../../../helpers";
4
- import { useTrilogyContext } from "../../../context";
5
- import { Icon } from "../../icon";
1
+ import clsx from 'clsx';
2
+ import { Radio } from '../../../components/radio';
3
+ import * as React from 'react';
6
4
  /**
7
5
  * Select Option Component
8
6
  * @param value {string} Select option value
@@ -14,15 +12,15 @@ import { Icon } from "../../icon";
14
12
  * @param iconName {IconName | IconNameValues} icon
15
13
  * @param disabled {boolean} disable option
16
14
  * @param onClick {function} onclick function
17
- * @param selected {boolean} Selected option
18
15
  * @param id {string} Select option custom id
19
16
  */
20
- const SelectOption = ({ id, className, selected, value, disabled, children, onClick, label, iconName, testId, ...others }) => {
21
- const { styled } = useTrilogyContext();
22
- return (React.createElement("div", { role: 'option', tabIndex: 0, className: hashClass(styled, clsx("select-options-option", selected && !disabled && "select-options-option-activated", disabled && !selected && "select-options-option-disabled", iconName && "has-icon", className)), "data-testid": testId, id: id, "data-option-name": children || label, "data-option-value": value, onMouseUp: onClick, "aria-disabled": disabled, "aria-selected": selected ? "true" : "false", ...others },
23
- React.createElement("div", { className: hashClass(styled, clsx(iconName && "has-icon")) },
24
- iconName && React.createElement(Icon, { name: iconName, size: 'small' }),
25
- children || label)));
17
+ const SelectOption = ({ id, className, value, disabled, children, onClick, label, iconName, testId, ...others }) => {
18
+ const { checked, native, focused, ...props } = others;
19
+ const selectClasses = React.useMemo(() => clsx(focused && 'focus', className), [focused, className]);
20
+ if (native) {
21
+ return (React.createElement("option", { role: 'option', id: id, value: value, disabled: disabled, "aria-label": label, "data-testid": testId, onClick: onClick, ...props }, children || label));
22
+ }
23
+ return (React.createElement(Radio, { checked: checked, tile: true, horizontalTile: true, marginless: true, className: selectClasses, value: value, disabled: disabled, onClick: onClick, iconTile: iconName, description: label || children, ...others }));
26
24
  };
27
25
  export default SelectOption;
28
26
  //# sourceMappingURL=SelectOption.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"SelectOption.js","sourceRoot":"","sources":["../../../../components/select/option/SelectOption.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAE9B,OAAO,IAAI,MAAM,MAAM,CAAA;AACvB,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAA;AAC5C,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAA;AACpD,OAAO,EAAE,IAAI,EAAE,MAAM,YAAY,CAAA;AAEjC;;;;;;;;;;;;;GAaG;AACH,MAAM,YAAY,GAAG,CAAC,EACpB,EAAE,EACF,SAAS,EACT,QAAQ,EACR,KAAK,EACL,QAAQ,EACR,QAAQ,EACR,OAAO,EACP,KAAK,EACL,QAAQ,EACR,MAAM,EACN,GAAG,MAAM,EACS,EAAe,EAAE;IACnC,MAAM,EAAE,MAAM,EAAE,GAAG,iBAAiB,EAAE,CAAA;IAEtC,OAAO,CACL,6BACE,IAAI,EAAC,QAAQ,EACb,QAAQ,EAAE,CAAC,EACX,SAAS,EAAE,SAAS,CAClB,MAAM,EACN,IAAI,CACF,uBAAuB,EACvB,QAAQ,IAAI,CAAC,QAAQ,IAAI,iCAAiC,EAC1D,QAAQ,IAAI,CAAC,QAAQ,IAAI,gCAAgC,EACzD,QAAQ,IAAI,UAAU,EACtB,SAAS,CACV,CACF,iBACY,MAAM,EACnB,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BACN,KAAK,iBACJ,MAAM,EACnB,OAAO,EAAE,OAAO,KACZ,KAAK,IAER,QAAQ,IAAI,KAAK,CACX,CACV,CAAA;KACF;IAED,OAAO,CACL,oBAAC,KAAK,IACJ,OAAO,EAAE,OAAO,EAChB,IAAI,QACJ,cAAc,QACd,UAAU,QACV,SAAS,EAAE,aAAa,EACxB,KAAK,EAAE,KAAK,EACZ,QAAQ,EAAE,QAAQ,EAClB,OAAO,EAAE,OAAO,EAChB,QAAQ,EAAE,QAAQ,EAClB,WAAW,EAAE,KAAK,IAAI,QAAQ,KAC1B,MAAM,GACV,CACH,CAAA;AACH,CAAC,CAAA;AAED,eAAe,YAAY,CAAA"}
@@ -1,6 +1,6 @@
1
1
  /// <reference types="react" />
2
- import { SelectOptionProps } from "./SelectOptionProps";
3
- import { ComponentName } from "../../enumsComponentsName";
2
+ import { ComponentName } from '../../enumsComponentsName';
3
+ import { SelectOptionProps } from './SelectOptionProps';
4
4
  /**
5
5
  * Select Option Component
6
6
  * @param value {string} Select option value
@@ -8,7 +8,7 @@ import { ComponentName } from "../../enumsComponentsName";
8
8
  * @param children {React.ReactNode}
9
9
  */
10
10
  declare const SelectOption: {
11
- ({ value, label, children, ...others }: SelectOptionProps): JSX.Element;
11
+ ({ id, value, disabled, children, onClick, label, iconName, testId, ...others }: SelectOptionProps): JSX.Element;
12
12
  displayName: ComponentName;
13
13
  };
14
14
  export default SelectOption;
@@ -1,14 +1,50 @@
1
- import * as React from "react";
2
- import { Picker } from "@react-native-picker/picker";
3
- import { ComponentName } from "../../enumsComponentsName";
1
+ import * as React from 'react';
2
+ import { StyleSheet, TouchableOpacity } from 'react-native';
3
+ import { TypographyBold } from '../../../objects/Typography';
4
+ import { TrilogyColor, getColorStyle } from '../../../objects/facets/Color';
5
+ import { Columns, ColumnsItem } from '../../columns';
6
+ import { ComponentName } from '../../enumsComponentsName';
7
+ import { Icon, IconSize } from '../../icon';
8
+ import { Text } from '../../text';
4
9
  /**
5
10
  * Select Option Component
6
11
  * @param value {string} Select option value
7
12
  * @param label {string} Label value
8
13
  * @param children {React.ReactNode}
9
14
  */
10
- const SelectOption = ({ value, label, children, ...others }) => {
11
- return (React.createElement(Picker.Item, { label: children || label, value: value || "", ...others }));
15
+ const SelectOption = ({ id, value, disabled, children, onClick, label, iconName, testId, ...others }) => {
16
+ const { checked } = others;
17
+ const styles = React.useMemo(() => StyleSheet.create({
18
+ container: {
19
+ backgroundColor: (disabled && getColorStyle(TrilogyColor.DISABLED, 1)) || undefined,
20
+ },
21
+ }), [disabled]);
22
+ const textColor = React.useMemo(() => {
23
+ switch (true) {
24
+ case disabled === true:
25
+ return getColorStyle(TrilogyColor.DISABLED);
26
+ default:
27
+ return getColorStyle(TrilogyColor.MAIN);
28
+ }
29
+ }, [disabled]);
30
+ const iconColor = React.useMemo(() => {
31
+ switch (true) {
32
+ case disabled === true:
33
+ return TrilogyColor.DISABLED;
34
+ default:
35
+ return TrilogyColor.MAIN;
36
+ }
37
+ }, [disabled]);
38
+ return (React.createElement(TouchableOpacity, { style: [styles.container], ...others, onPress: onClick },
39
+ React.createElement(Columns, { ...{ style: { paddingVertical: 16, paddingHorizontal: 8 } } },
40
+ React.createElement(ColumnsItem, null,
41
+ React.createElement(Columns, null,
42
+ iconName && (React.createElement(ColumnsItem, { size: 1, verticalCenter: true },
43
+ React.createElement(Icon, { size: IconSize.SMALL, name: iconName, color: iconColor }))),
44
+ React.createElement(ColumnsItem, { verticalCenter: true },
45
+ React.createElement(Text, { typo: [checked && TypographyBold.TEXT_WEIGHT_SEMIBOLD], ...{ style: { paddingLeft: 8, color: textColor } } }, children || label)),
46
+ checked && (React.createElement(ColumnsItem, { size: 1, verticalCenter: true },
47
+ React.createElement(Icon, { size: IconSize.SMALL, name: 'tri-check', color: iconColor }))))))));
12
48
  };
13
49
  SelectOption.displayName = ComponentName.SelectOption;
14
50
  export default SelectOption;
@@ -1 +1 @@
1
- {"version":3,"file":"SelectOption.native.js","sourceRoot":"","sources":["../../../../components/select/option/SelectOption.native.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAC9B,OAAO,EAAE,MAAM,EAAE,MAAM,6BAA6B,CAAA;AAEpD,OAAO,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAA;AAEzD;;;;;GAKG;AACH,MAAM,YAAY,GAAG,CAAC,EACpB,KAAK,EACL,KAAK,EACL,QAAQ,EACR,GAAG,MAAM,EACS,EAAe,EAAE;IACnC,OAAO,CACL,oBAAC,MAAM,CAAC,IAAI,IAAC,KAAK,EAAE,QAAQ,IAAI,KAAK,EAAE,KAAK,EAAE,KAAK,IAAI,EAAE,KAAM,MAAM,GAAI,CAC1E,CAAA;AACH,CAAC,CAAA;AAED,YAAY,CAAC,WAAW,GAAG,aAAa,CAAC,YAAY,CAAA;AAErD,eAAe,YAAY,CAAA"}
1
+ {"version":3,"file":"SelectOption.native.js","sourceRoot":"","sources":["../../../../components/select/option/SelectOption.native.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAC9B,OAAO,EAAE,UAAU,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAA;AAC3D,OAAO,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAA;AAC5D,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,+BAA+B,CAAA;AAC3E,OAAO,EAAE,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAA;AACpD,OAAO,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAA;AACzD,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAA;AAC3C,OAAO,EAAE,IAAI,EAAE,MAAM,YAAY,CAAA;AAGjC;;;;;GAKG;AACH,MAAM,YAAY,GAAG,CAAC,EACpB,EAAE,EACF,KAAK,EACL,QAAQ,EACR,QAAQ,EACR,OAAO,EACP,KAAK,EACL,QAAQ,EACR,MAAM,EACN,GAAG,MAAM,EACS,EAAe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EAAE,QAAQ,CAAC,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,KAAK,EAAE,SAAS,GAAI,CACpD,CACf;oBACD,oBAAC,WAAW,IAAC,cAAc;wBACzB,oBAAC,IAAI,IACH,IAAI,EAAE,CAAC,OAAO,IAAI,cAAc,CAAC,oBAAoB,CAAC,KAClD,EAAE,KAAK,EAAE,EAAE,WAAW,EAAE,CAAC,EAAE,KAAK,EAAE,SAAS,EAAE,EAAE,IAElD,QAAQ,IAAI,KAAK,CACb,CACK;oBACb,OAAO,IAAI,CACV,oBAAC,WAAW,IAAC,IAAI,EAAE,CAAC,EAAE,cAAc;wBAClC,oBAAC,IAAI,IAAC,IAAI,EAAE,QAAQ,CAAC,KAAK,EAAE,IAAI,EAAC,WAAW,EAAC,KAAK,EAAE,SAAS,GAAI,CACrD,CACf,CACO,CACE,CACN,CACO,CACpB,CAAA;AACH,CAAC,CAAA;AAED,YAAY,CAAC,WAAW,GAAG,aAAa,CAAC,YAAY,CAAA;AAErD,eAAe,YAAY,CAAA"}
@@ -1,4 +1,4 @@
1
- import { PropsWithChildren } from "react";
2
- import { ICustomSelect } from "../SelectProps";
3
- declare const SelectDynamic: ({ styled, onChange, nullable, disabled, onFocus, onBlur, children, selected, name, id, testId, classNameOptions, selecteClasses, label, iconName, ...others }: PropsWithChildren<ICustomSelect>) => JSX.Element;
1
+ import { PropsWithChildren } from 'react';
2
+ import { SelectProps } from '../SelectProps';
3
+ declare const SelectDynamic: ({ onChange, nullable, disabled, onFocus, onBlur, children, selected, name, id, testId, label, iconName, multiple, className, }: PropsWithChildren<SelectProps>) => JSX.Element;
4
4
  export default SelectDynamic;
@@ -1,54 +1,191 @@
1
- import { hashClass } from "../../../helpers";
2
- import clsx from "clsx";
3
- import { useUtils } from "../hooks/utils";
4
- import { useAccessibility } from "../hooks/accessibility";
5
- import React from "react";
6
- import { Icon } from "../../icon";
7
- import SelectOption from "../option";
8
- import { has } from "../../../services";
9
- const SelectDynamic = ({ styled, onChange, nullable, disabled, onFocus, onBlur, children, selected, name, id, testId, classNameOptions, selecteClasses, label, iconName, ...others }) => {
10
- const { handleChangeSelect, handleFocusCurrentOption, handleFocusSelect, handleOpenSelect, isOpenSelect, setIsOpenSelect, optionRefs, selectRef, selectedOption, } = useUtils({
11
- onChange,
12
- nullable,
13
- disabled,
14
- onFocus,
15
- onBlur,
16
- children,
17
- selected,
18
- name,
19
- id,
20
- });
21
- const { handleKeyDown } = useAccessibility(isOpenSelect, handleChangeSelect, setIsOpenSelect, optionRefs, selectRef, handleFocusCurrentOption);
22
- const optionsClasses = React.useMemo(() => hashClass(styled, clsx("select-options", classNameOptions)), [classNameOptions, styled]);
23
- const selectedValueClasses = React.useMemo(() => hashClass(styled, clsx("select-value", !label && "no-label")), [styled]);
24
- const controlClasses = React.useMemo(() => hashClass(styled, clsx("control", (selectedOption === null || selectedOption === void 0 ? void 0 : selectedOption.value) && has("dynamic-placeholder"))), [styled, selectedOption === null || selectedOption === void 0 ? void 0 : selectedOption.value]);
25
- return (React.createElement("div", { className: hashClass(styled, clsx("field")) },
26
- React.createElement("div", { className: controlClasses },
27
- React.createElement("div", { ...{ disabled: disabled }, ref: selectRef, onKeyDown: handleKeyDown, tabIndex: disabled ? -1 : 0, id: id, "data-testid": testId, "data-select-name": name, className: selecteClasses, onClick: handleOpenSelect, onFocus: handleFocusSelect, "aria-haspopup": 'listbox', "aria-label": label, "aria-disabled": disabled, role: 'listbox', ...others },
28
- iconName && React.createElement(Icon, { name: iconName, size: 'small' }),
29
- label && React.createElement("label", null, label),
30
- (selectedOption === null || selectedOption === void 0 ? void 0 : selectedOption.name) && (React.createElement("span", { className: selectedValueClasses }, selectedOption === null || selectedOption === void 0 ? void 0 : selectedOption.name))),
31
- React.createElement("div", { "data-is-open-options": isOpenSelect, className: optionsClasses, "aria-expanded": isOpenSelect, "aria-hidden": !isOpenSelect }, React.Children.map(children, (child, index) => {
32
- if (React.isValidElement(child)) {
33
- const props = {
34
- ...child.props,
35
- selected: child.props.value === (selectedOption === null || selectedOption === void 0 ? void 0 : selectedOption.value),
36
- onClick: () => {
37
- handleChangeSelect({
38
- selectValue: child.props.value,
39
- selectName: child.props.children || child.props.label,
40
- selectId: child.props.id,
41
- disabled: child.props.disabled,
42
- });
43
- if (child.props.onClick)
44
- child.props.onClick();
45
- },
46
- };
47
- return (React.createElement("div", { ...{ disabled: disabled }, "data-is-disabled": child.props.disabled, className: hashClass(styled, clsx("option-container")), "data-is-active": child.props.value === (selectedOption === null || selectedOption === void 0 ? void 0 : selectedOption.value), "data-index": child.props.value, "data-id": child.props.id, "data-textcontent": child.props.children || child.props.label, onKeyDown: (e) => handleKeyDown(e, child), ref: (element) => (optionRefs.current[index] = element), tabIndex: child.props.value === (selectedOption === null || selectedOption === void 0 ? void 0 : selectedOption.value) ? 0 : -1, onMouseEnter: () => { var _a; return (_a = optionRefs.current[index]) === null || _a === void 0 ? void 0 : _a.focus(); }, onMouseLeave: () => { var _a; return (_a = optionRefs.current[index]) === null || _a === void 0 ? void 0 : _a.blur(); } },
48
- React.createElement(SelectOption, { ...props })));
1
+ import clsx from 'clsx';
2
+ import React, { useCallback, useMemo, useState } from 'react';
3
+ import ReactDOM from 'react-dom';
4
+ import { hashClass } from '../../../helpers';
5
+ import { Input } from '../../input';
6
+ import SelectOption from '../option';
7
+ import { useTrilogyContext } from './../../../context';
8
+ const SelectDynamic = ({ onChange, nullable, disabled, onFocus, onBlur, children, selected, name, id, testId, label, iconName, multiple, className, }) => {
9
+ const { styled } = useTrilogyContext();
10
+ const [focused, setIsFocused] = React.useState(false);
11
+ const [selectedValues, setSelectedValues] = React.useState(selected);
12
+ const [selectedName, setSelectedName] = React.useState([]);
13
+ const reactId = React.useId();
14
+ const selectClasses = React.useMemo(() => hashClass(styled, clsx('select', className)), [styled, className]);
15
+ const [focusedIndex, setFocusedIndex] = useState(-1);
16
+ const onClickInput = React.useCallback(() => {
17
+ setIsFocused((prev) => !prev);
18
+ }, []);
19
+ const onKeyPressInput = React.useCallback((keyCode) => {
20
+ keyCode === 0 && setIsFocused((prev) => !prev);
21
+ }, []);
22
+ const isChecked = useCallback((value) => multiple && selectedValues && typeof selectedValues !== 'string' && typeof selectedValues !== 'number'
23
+ ? selectedValues === null || selectedValues === void 0 ? void 0 : selectedValues.includes(value)
24
+ : selectedValues === value, [multiple, selectedValues]);
25
+ const setNewSelectedValues = useCallback(({ isChecked, children, label, value }) => {
26
+ const selectedOptions = [];
27
+ if (isChecked) {
28
+ setSelectedValues((prev) => {
29
+ switch (true) {
30
+ case Array.isArray(prev) && nullable:
31
+ setSelectedName((prev) => prev.filter((txt) => ![children, label].includes(txt)));
32
+ const opts = prev.filter((item) => item !== value);
33
+ selectedOptions.push(...opts);
34
+ return opts;
35
+ case Array.isArray(prev) && !nullable:
36
+ selectedOptions.push(...prev);
37
+ return prev;
38
+ case !Array.isArray(prev) && !nullable:
39
+ selectedOptions.push(value);
40
+ setIsFocused(false);
41
+ return prev;
42
+ case !Array.isArray(prev) && nullable:
43
+ setIsFocused(false);
44
+ setSelectedName([]);
45
+ return undefined;
46
+ default:
47
+ return value;
49
48
  }
49
+ });
50
+ }
51
+ if (!isChecked) {
52
+ setSelectedValues((prev) => {
53
+ if (Array.isArray(prev)) {
54
+ const opts = [...prev, value];
55
+ selectedOptions.push(...opts);
56
+ return opts;
57
+ }
58
+ selectedOptions.push(value);
59
+ return value;
60
+ });
61
+ setSelectedName((prev) => {
62
+ if (multiple)
63
+ return [...prev, children || label];
64
+ setIsFocused(false);
65
+ return [children || label];
66
+ });
67
+ }
68
+ return selectedOptions;
69
+ }, [multiple, nullable]);
70
+ React.useEffect(() => {
71
+ var _a;
72
+ const labelSelected = (_a = React.Children.map(children, (child) => {
73
+ if (!React.isValidElement(child))
74
+ return false;
75
+ const label = child.props.children || child.props.label;
76
+ switch (true) {
77
+ case (Array.isArray(selected) && selected.includes(child.props.value)) ||
78
+ (!Array.isArray(selected) && child.props.value === selected):
79
+ return label;
80
+ default:
81
+ return false;
82
+ }
83
+ })) === null || _a === void 0 ? void 0 : _a.filter((item) => item);
84
+ labelSelected && setSelectedName(labelSelected);
85
+ setSelectedValues(selected);
86
+ }, [selected]);
87
+ React.useEffect(() => {
88
+ const onKeyDown = (e) => {
89
+ const childs = children;
90
+ const child = childs[focusedIndex];
91
+ if (['ArrowDown', 'ArrowUp', 'Enter', 'Escape', ' '].includes(e.key))
92
+ e.preventDefault();
93
+ switch (true) {
94
+ case e.key === 'ArrowDown':
95
+ options &&
96
+ setFocusedIndex((prev) => {
97
+ let nextIndex = (prev + 1) % options.length;
98
+ if (childs[nextIndex].props.disabled)
99
+ nextIndex++;
100
+ return nextIndex % options.length;
101
+ });
102
+ break;
103
+ case e.key === 'ArrowUp' && focusedIndex !== -1:
104
+ options &&
105
+ setFocusedIndex((prev) => {
106
+ let nextIndex = (prev - 1 + options.length) % options.length;
107
+ if (childs[nextIndex].props.disabled)
108
+ nextIndex--;
109
+ if (nextIndex === -1)
110
+ nextIndex = options.length - 1;
111
+ return nextIndex % options.length;
112
+ });
113
+ break;
114
+ case e.key === 'ArrowUp' && focusedIndex === -1:
115
+ options &&
116
+ setFocusedIndex(() => {
117
+ let nextIndex = options.length - 1;
118
+ if (childs[nextIndex].props.disabled)
119
+ nextIndex--;
120
+ return nextIndex;
121
+ });
122
+ break;
123
+ case ['Enter', ' '].includes(e.key) && focusedIndex !== -1 && !child.props.disabled:
124
+ const isCheckedOption = isChecked(child.props.value);
125
+ setNewSelectedValues({
126
+ children: child.props.children,
127
+ label: child.props.label,
128
+ value: child.props.value,
129
+ isChecked: isCheckedOption,
130
+ });
131
+ break;
132
+ case e.key === 'Escape':
133
+ setFocusedIndex(-1);
134
+ setIsFocused(false);
135
+ break;
136
+ }
137
+ };
138
+ focused && document.addEventListener('keydown', onKeyDown);
139
+ !focused && setFocusedIndex(-1);
140
+ return () => document.removeEventListener('keydown', onKeyDown);
141
+ }, [focused, focusedIndex, children, isChecked]);
142
+ const modal = useMemo(() => React.createElement("div", { role: 'presentation', className: 'select-trilogy_modal_open', onClick: () => setIsFocused(false) }), []);
143
+ const options = React.useMemo(() => {
144
+ return React.Children.map(children, (child, index) => {
145
+ if (!React.isValidElement(child))
50
146
  return null;
51
- })))));
147
+ const clickEventValue = (v) => {
148
+ switch (true) {
149
+ case (nullable && multiple && (selectedValues === null || selectedValues === void 0 ? void 0 : selectedValues.includes(child.props.value))) ||
150
+ (nullable && !multiple && selectedValues === child.props.value):
151
+ return undefined;
152
+ default:
153
+ return v;
154
+ }
155
+ };
156
+ const props = {
157
+ ...child.props,
158
+ checked: isChecked(child.props.value),
159
+ focused: focusedIndex === index ? 'true' : undefined,
160
+ onClick: () => {
161
+ const opts = setNewSelectedValues({
162
+ children: child.props.children,
163
+ label: child.props.label,
164
+ value: child.props.value,
165
+ isChecked: isChecked(child.props.value),
166
+ });
167
+ onChange &&
168
+ onChange({
169
+ selectValue: clickEventValue(child.props.value),
170
+ selectName: clickEventValue(child.props.children || child.props.label),
171
+ selectId: clickEventValue(child.props.id),
172
+ name: clickEventValue(child.props.children || child.props.label),
173
+ selectedOptions: opts,
174
+ });
175
+ if (child.props.onClick)
176
+ child.props.onClick();
177
+ },
178
+ };
179
+ return React.createElement(SelectOption, { ...props, key: `${reactId}_${index}` });
180
+ });
181
+ }, [multiple, nullable, selectedValues, focusedIndex, children]);
182
+ return (React.createElement("div", { className: selectClasses },
183
+ React.createElement(Input, { value: selectedName.join(', '), testId: testId, name: name, disabled: disabled, placeholder: label, onFocus: onFocus, customIconLeft: iconName, customIconRight: focused ? 'tri-arrow-up' : 'tri-arrow-down', onBlur: onBlur, onClick: onClickInput, className: hashClass(styled, clsx(focused && 'focus')), onKeyPress: (e) => {
184
+ e.preventDefault();
185
+ onKeyPressInput(e.inputKeyCode);
186
+ }, ...{ readOnly: true, id } }),
187
+ focused && React.createElement("div", { className: hashClass(styled, clsx('select-options')) }, options),
188
+ focused && ReactDOM.createPortal(modal, document.body)));
52
189
  };
53
190
  export default SelectDynamic;
54
191
  //# sourceMappingURL=SelectDynamic.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"SelectDynamic.js","sourceRoot":"","sources":["../../../../components/select/web/SelectDynamic.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAA;AAC5C,OAAO,IAAI,MAAM,MAAM,CAAA;AACvB,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAA;AACzC,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAA;AACzD,OAAO,KAA4B,MAAM,OAAO,CAAA;AAChD,OAAO,EAAE,IAAI,EAAE,MAAM,YAAY,CAAA;AACjC,OAAO,YAAY,MAAM,WAAW,CAAA;AAEpC,OAAO,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAA;AAEvC,MAAM,aAAa,GAAG,CAAC,EACrB,MAAM,EACN,QAAQ,EACR,QAAQ,EACR,QAAQ,EACR,OAAO,EACP,MAAM,EACN,QAAQ,EACR,QAAQ,EACR,IAAI,EACJ,EAAE,EACF,MAAM,EACN,gBAAgB,EAChB,cAAc,EACd,KAAK,EACL,QAAQ,EACR,GAAG,MAAM,EACwB,EAAe,EAAE;IAClD,MAAM,EACJ,kBAAkB,EAClB,wBAAwB,EACxB,iBAAiB,EACjB,gBAAgB,EAChB,YAAY,EACZ,eAAe,EACf,UAAU,EACV,SAAS,EACT,cAAc,GACf,GAAG,QAAQ,CAAC;QACX,QAAQ;QACR,QAAQ;QACR,QAAQ;QACR,OAAO;QACP,MAAM;QACN,QAAQ;QACR,QAAQ;QACR,IAAI;QACJ,EAAE;KACH,CAAC,CAAA;IAEF,MAAM,EAAE,aAAa,EAAE,GAAG,gBAAgB,CACxC,YAAY,EACZ,kBAAkB,EAClB,eAAe,EACf,UAAU,EACV,SAAS,EACT,wBAAwB,CACzB,CAAA;IAED,MAAM,cAAc,GAAG,KAAK,CAAC,OAAO,CAClC,GAAG,EAAE,CAAC,SAAS,CAAC,MAAM,EAAE,IAAI,C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AC,CAAC,IAAG,OAAO,CAAO;QACrF,OAAO,IAAI,QAAQ,CAAC,YAAY,CAAC,KAAK,EAAE,QAAQ,CAAC,IAAI,CAAC,CACnD,CACP,CAAA;AACH,CAAC,CAAA;AACD,eAAe,aAAa,CAAA"}
@@ -1,4 +1,4 @@
1
1
  /// <reference types="react" />
2
- import { IAccessibleSelect } from "../SelectProps";
3
- declare const SelectNative: ({ selecteClasses, onChange, onFocus, onBlur, id, name, disabled, children, label, iconName, styled, testId, accessibilityLabel, selected, ...others }: IAccessibleSelect) => JSX.Element;
2
+ import { SelectProps } from '../SelectProps';
3
+ declare const SelectNative: ({ onChange, nullable, disabled, onFocus, onBlur, children, selected, name, id, testId, label, iconName, multiple, className, accessibilityLabel, ...others }: SelectProps) => JSX.Element;
4
4
  export default SelectNative;
@@ -1,25 +1,60 @@
1
- import * as React from "react";
2
- import { Icon } from "../../icon";
3
- import { hashClass } from "../../../helpers";
4
- import clsx from "clsx";
5
- import { has } from "../../../services";
6
- const SelectNative = ({ selecteClasses, onChange, onFocus, onBlur, id, name, disabled, children, label, iconName, styled, testId, accessibilityLabel, selected, ...others }) => {
7
- const controlClasses = React.useMemo(() => hashClass(styled, clsx("control", has("dynamic-placeholder"))), [styled]);
8
- return (React.createElement("div", { className: hashClass(styled, clsx("field")) },
9
- React.createElement("div", { className: controlClasses },
10
- React.createElement("div", { className: selecteClasses },
11
- iconName && React.createElement(Icon, { name: iconName, size: 'small' }),
12
- React.createElement("select", { className: hashClass(styled, clsx(!label && "no-label")), value: selected, "aria-label": accessibilityLabel, "data-testid": testId, role: 'listbox', onChange: (e) => {
13
- if (onChange) {
14
- onChange({
15
- selectValue: e.target.value,
16
- selectName: e.target.name,
17
- selectId: e.target.id,
18
- name: e.target.name,
19
- });
20
- }
21
- }, onFocus: onFocus, onBlur: onBlur, id: id ? String(id) : undefined, name: name, disabled: disabled, ...others }, children),
22
- label && React.createElement("label", { htmlFor: id }, label)))));
1
+ import clsx from 'clsx';
2
+ import * as React from 'react';
3
+ import { hashClass } from '../../../helpers';
4
+ import { has, is } from '../../../services';
5
+ import { Icon, IconSize } from '../../icon';
6
+ import SelectOption from '../option';
7
+ import { useTrilogyContext } from './../../../context';
8
+ const SelectNative = ({ onChange, nullable, disabled, onFocus, onBlur, children, selected, name, id, testId, label, iconName, multiple, className, accessibilityLabel, ...others }) => {
9
+ const { styled } = useTrilogyContext();
10
+ const selectClasses = React.useMemo(() => hashClass(styled, clsx('select', className)), [styled, className, iconName]);
11
+ const [focused, setIsFocused] = React.useState(false);
12
+ const [selectedValues, setSelectedValues] = React.useState(selected);
13
+ React.useEffect(() => {
14
+ setSelectedValues(selected);
15
+ }, [selected]);
16
+ const classes = React.useMemo(() => ({
17
+ input: hashClass(styled, clsx('input', disabled && is('disabled'), 'select-native', multiple && 'multiple', className)),
18
+ control: hashClass(styled, clsx('control', has('dynamic-placeholder'), iconName && 'has-icons-left', iconName && 'has-icons-right')),
19
+ }), [styled, disabled, iconName, className, multiple]);
20
+ const handleFocus = React.useCallback((e) => {
21
+ setIsFocused(true);
22
+ onFocus && onFocus(e);
23
+ }, []);
24
+ const handleBlur = React.useCallback((e) => {
25
+ setIsFocused(false);
26
+ onBlur && onBlur(e);
27
+ }, []);
28
+ return (React.createElement("div", { className: selectClasses },
29
+ React.createElement("div", { className: hashClass(styled, clsx('field', focused && 'focus')) },
30
+ React.createElement("div", { className: classes.control },
31
+ React.createElement("div", { className: classes.input },
32
+ React.createElement("select", { multiple: multiple, className: hashClass(styled, clsx(!label && 'no-label')), value: selectedValues, "aria-label": accessibilityLabel, "data-testid": testId, onChange: (e) => {
33
+ const selectedV = Array.from(e.target.selectedOptions).map((select) => select.value);
34
+ setSelectedValues(selectedV);
35
+ if (onChange) {
36
+ onChange({
37
+ selectValue: e.target.value,
38
+ selectName: e.target.name,
39
+ selectId: e.target.id,
40
+ name: e.target.name,
41
+ selectedOptions: selectedV,
42
+ });
43
+ }
44
+ }, onFocus: handleFocus, onBlur: handleBlur, id: id ? String(id) : undefined, name: name, disabled: disabled, ...others }, React.Children.map(children, (child) => {
45
+ if (!React.isValidElement(child))
46
+ return null;
47
+ const props = {
48
+ ...child.props,
49
+ native: 'true',
50
+ };
51
+ return React.createElement(SelectOption, { ...props });
52
+ }))),
53
+ label && !multiple && React.createElement("label", { htmlFor: id }, label),
54
+ iconName && (React.createElement("div", null,
55
+ React.createElement(Icon, { name: iconName, size: 'small' }))),
56
+ !multiple && (React.createElement("div", null,
57
+ React.createElement(Icon, { className: 'icon-right', name: focused ? 'tri-arrow-up' : 'tri-arrow-down', size: IconSize.SMALL })))))));
23
58
  };
24
59
  export default SelectNative;
25
60
  //# sourceMappingURL=SelectNative.js.map