tuix-webcomponents 0.63.0 → 0.64.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 (168) hide show
  1. package/README.md +2 -2
  2. package/dist/addon-visual-tests-assets/visual-test-illustration.mp4 +0 -0
  3. package/dist/assets/Color-AVL7NMMY-IH_JbDEF.js +1 -0
  4. package/dist/assets/DocsRenderer-PQXLIZUC-C0ZKNA9m.js +1286 -0
  5. package/dist/{src/tuix-icon/TuixIcon.icons.js → assets/TuixIconButton-eQtxZNXh.js} +203 -125
  6. package/dist/assets/TuixModal-BZFIHTi_.js +78 -0
  7. package/dist/assets/TuixToast-BhxwZIGo.js +62 -0
  8. package/dist/assets/_commonjsHelpers-CqkleIqs.js +1 -0
  9. package/dist/assets/axe-C59a3kt3.js +30 -0
  10. package/dist/assets/iframe-ClsPaEIM.js +1057 -0
  11. package/dist/assets/index-DBzYXxxs.js +1554 -0
  12. package/dist/assets/index-TjhCmV-u.js +1 -0
  13. package/dist/assets/matchers-7Z3WT2CE-CcSi9QFY.js +14 -0
  14. package/dist/assets/screenSizes.enum-C1IhC_dy.js +13 -0
  15. package/dist/assets/state-CLjydI9z.js +13 -0
  16. package/dist/assets/tuix-button.stories-Dm_yifox.js +30 -0
  17. package/dist/assets/tuix-checkbox.stories-DmzoygjC.js +44 -0
  18. package/dist/assets/tuix-dropdown-object-list.stories-Neeajtj-.js +56 -0
  19. package/dist/assets/tuix-dropdown.stories-B7ea8QAz.js +28 -0
  20. package/dist/assets/tuix-icon-button.stories-CgbOSRO4.js +21 -0
  21. package/dist/assets/tuix-icon.enums-DYTtwLZl.js +1 -0
  22. package/dist/assets/tuix-icon.stories-CjN2XsKx.js +19 -0
  23. package/dist/assets/tuix-input.stories-CD7onvw2.js +33 -0
  24. package/dist/assets/tuix-link.stories-CT7pzGlx.js +35 -0
  25. package/dist/assets/tuix-modal.stories-B6v3cOPq.js +39 -0
  26. package/dist/assets/tuix-paper.enum-DhmlUJB7.js +1 -0
  27. package/dist/assets/tuix-paper.stories-CLnRPHNK.js +31 -0
  28. package/dist/assets/tuix-radio-button.stories-BwkKC3a9.js +35 -0
  29. package/dist/assets/tuix-table.stories-Bn-aZa0J.js +65 -0
  30. package/dist/assets/tuix-text.enums-Ck8cVqZZ.js +1 -0
  31. package/dist/assets/tuix-text.stories-BNIqPsGD.js +29 -0
  32. package/dist/assets/tuix-toast.stories-CRYiLiHK.js +21 -0
  33. package/dist/assets/tuix-toggle-button.stories-CY6wlDnA.js +40 -0
  34. package/dist/favicon-wrapper.svg +46 -0
  35. package/dist/favicon.svg +1 -0
  36. package/dist/iframe.html +685 -0
  37. package/dist/index.html +160 -0
  38. package/dist/index.json +1 -0
  39. package/dist/nunito-sans-bold-italic.woff2 +0 -0
  40. package/dist/nunito-sans-bold.woff2 +0 -0
  41. package/dist/nunito-sans-italic.woff2 +0 -0
  42. package/dist/nunito-sans-regular.woff2 +0 -0
  43. package/dist/project.json +1 -0
  44. package/dist/sb-addons/a11y-3/manager-bundle.js +5 -0
  45. package/dist/sb-addons/a11y-3/manager-bundle.js.LEGAL.txt +0 -0
  46. package/dist/sb-addons/chromatic-com-storybook-1/manager-bundle.js +356 -0
  47. package/dist/sb-addons/chromatic-com-storybook-1/manager-bundle.js.LEGAL.txt +40 -0
  48. package/dist/sb-addons/docs-2/manager-bundle.js +151 -0
  49. package/dist/sb-addons/docs-2/manager-bundle.js.LEGAL.txt +0 -0
  50. package/dist/sb-addons/storybook-core-server-presets-0/common-manager-bundle.js +971 -0
  51. package/dist/sb-addons/storybook-core-server-presets-0/common-manager-bundle.js.LEGAL.txt +0 -0
  52. package/dist/sb-addons/vitest-4/manager-bundle.js +3 -0
  53. package/dist/sb-addons/vitest-4/manager-bundle.js.LEGAL.txt +0 -0
  54. package/dist/sb-common-assets/favicon-wrapper.svg +46 -0
  55. package/dist/sb-common-assets/favicon.svg +1 -0
  56. package/dist/sb-common-assets/nunito-sans-bold-italic.woff2 +0 -0
  57. package/dist/sb-common-assets/nunito-sans-bold.woff2 +0 -0
  58. package/dist/sb-common-assets/nunito-sans-italic.woff2 +0 -0
  59. package/dist/sb-common-assets/nunito-sans-regular.woff2 +0 -0
  60. package/dist/sb-manager/globals-module-info.js +797 -0
  61. package/dist/sb-manager/globals-runtime.js +69679 -0
  62. package/dist/sb-manager/globals.js +34 -0
  63. package/dist/sb-manager/runtime.js +13195 -0
  64. package/package.json +6 -6
  65. package/dist/src/index.d.ts +0 -36
  66. package/dist/src/index.js +0 -42
  67. package/dist/src/tuix-button/TuixBaseButton.d.ts +0 -17
  68. package/dist/src/tuix-button/TuixBaseButton.js +0 -60
  69. package/dist/src/tuix-button/TuixButton.d.ts +0 -11
  70. package/dist/src/tuix-button/TuixButton.js +0 -84
  71. package/dist/src/tuix-button/TuixButton.styles.d.ts +0 -3
  72. package/dist/src/tuix-button/TuixButton.styles.js +0 -107
  73. package/dist/src/tuix-button/enums/tuix-button.enums.d.ts +0 -2
  74. package/dist/src/tuix-button/enums/tuix-button.enums.js +0 -6
  75. package/dist/src/tuix-button/interfaces/tuix-button.interface.d.ts +0 -1
  76. package/dist/src/tuix-button/interfaces/tuix-button.interface.js +0 -1
  77. package/dist/src/tuix-checkbox/TuixCheckbox.d.ts +0 -15
  78. package/dist/src/tuix-checkbox/TuixCheckbox.js +0 -106
  79. package/dist/src/tuix-checkbox/TuixCheckbox.styles.d.ts +0 -4
  80. package/dist/src/tuix-checkbox/TuixCheckbox.styles.js +0 -132
  81. package/dist/src/tuix-checkbox/enums/tuix-checkbox.enums.d.ts +0 -21
  82. package/dist/src/tuix-checkbox/enums/tuix-checkbox.enums.js +0 -23
  83. package/dist/src/tuix-checkbox/interfaces/tuix-checkbox.interface.d.ts +0 -5
  84. package/dist/src/tuix-checkbox/interfaces/tuix-checkbox.interface.js +0 -1
  85. package/dist/src/tuix-dropdown/TuixDropdown.d.ts +0 -55
  86. package/dist/src/tuix-dropdown/TuixDropdown.js +0 -360
  87. package/dist/src/tuix-dropdown/TuixDropdown.styles.d.ts +0 -3
  88. package/dist/src/tuix-dropdown/TuixDropdown.styles.js +0 -125
  89. package/dist/src/tuix-dropdown/enums/tuix-dropdown.enums.d.ts +0 -4
  90. package/dist/src/tuix-dropdown/enums/tuix-dropdown.enums.js +0 -5
  91. package/dist/src/tuix-dropdown/interfaces/tuix-dropdown.interface.d.ts +0 -15
  92. package/dist/src/tuix-dropdown/interfaces/tuix-dropdown.interface.js +0 -1
  93. package/dist/src/tuix-icon/TuixIcon.d.ts +0 -15
  94. package/dist/src/tuix-icon/TuixIcon.icons.d.ts +0 -6
  95. package/dist/src/tuix-icon/TuixIcon.js +0 -79
  96. package/dist/src/tuix-icon/enums/tuix-icon.enums.d.ts +0 -62
  97. package/dist/src/tuix-icon/enums/tuix-icon.enums.js +0 -69
  98. package/dist/src/tuix-icon-button/TuixIconButton.d.ts +0 -9
  99. package/dist/src/tuix-icon-button/TuixIconButton.js +0 -51
  100. package/dist/src/tuix-input/TuixInput.d.ts +0 -52
  101. package/dist/src/tuix-input/TuixInput.js +0 -370
  102. package/dist/src/tuix-input/TuixInput.styles.d.ts +0 -8
  103. package/dist/src/tuix-input/TuixInput.styles.js +0 -295
  104. package/dist/src/tuix-input/enums/tuix-input.enums.d.ts +0 -38
  105. package/dist/src/tuix-input/enums/tuix-input.enums.js +0 -41
  106. package/dist/src/tuix-input/interfaces/tuix-input.interface.d.ts +0 -18
  107. package/dist/src/tuix-input/interfaces/tuix-input.interface.js +0 -5
  108. package/dist/src/tuix-link/TuixLink.d.ts +0 -15
  109. package/dist/src/tuix-link/TuixLink.js +0 -71
  110. package/dist/src/tuix-link/TuixLink.styles.d.ts +0 -2
  111. package/dist/src/tuix-link/TuixLink.styles.js +0 -55
  112. package/dist/src/tuix-link/enums/linkTarget.enum.d.ts +0 -6
  113. package/dist/src/tuix-link/enums/linkTarget.enum.js +0 -7
  114. package/dist/src/tuix-modal/TuixModal.d.ts +0 -9
  115. package/dist/src/tuix-modal/TuixModal.js +0 -63
  116. package/dist/src/tuix-modal/TuixModal.styles.d.ts +0 -2
  117. package/dist/src/tuix-modal/TuixModal.styles.js +0 -55
  118. package/dist/src/tuix-paper/TuixPaper.d.ts +0 -10
  119. package/dist/src/tuix-paper/TuixPaper.js +0 -46
  120. package/dist/src/tuix-paper/TuixPaper.styles.d.ts +0 -1
  121. package/dist/src/tuix-paper/TuixPaper.styles.js +0 -30
  122. package/dist/src/tuix-paper/enums/tuix-paper.enum.d.ts +0 -13
  123. package/dist/src/tuix-paper/enums/tuix-paper.enum.js +0 -15
  124. package/dist/src/tuix-radio-button/TuixRadioButton.d.ts +0 -16
  125. package/dist/src/tuix-radio-button/TuixRadioButton.js +0 -95
  126. package/dist/src/tuix-radio-button/TuixRadioButton.styles.d.ts +0 -5
  127. package/dist/src/tuix-radio-button/TuixRadioButton.styles.js +0 -135
  128. package/dist/src/tuix-radio-button/interfaces/tuix-radio-button.interface.d.ts +0 -3
  129. package/dist/src/tuix-radio-button/interfaces/tuix-radio-button.interface.js +0 -1
  130. package/dist/src/tuix-table/TuixTable.d.ts +0 -46
  131. package/dist/src/tuix-table/TuixTable.js +0 -367
  132. package/dist/src/tuix-table/TuixTable.styles.d.ts +0 -2
  133. package/dist/src/tuix-table/TuixTable.styles.js +0 -197
  134. package/dist/src/tuix-table/interfaces/tuix-table.interface.d.ts +0 -45
  135. package/dist/src/tuix-table/interfaces/tuix-table.interface.js +0 -1
  136. package/dist/src/tuix-text/TuixText.d.ts +0 -12
  137. package/dist/src/tuix-text/TuixText.js +0 -66
  138. package/dist/src/tuix-text/TuixText.styles.d.ts +0 -2
  139. package/dist/src/tuix-text/TuixText.styles.js +0 -158
  140. package/dist/src/tuix-text/enums/tuix-text.enums.d.ts +0 -31
  141. package/dist/src/tuix-text/enums/tuix-text.enums.js +0 -63
  142. package/dist/src/tuix-toast/TuixToast.d.ts +0 -15
  143. package/dist/src/tuix-toast/TuixToast.js +0 -100
  144. package/dist/src/tuix-toast/TuixToast.styles.d.ts +0 -3
  145. package/dist/src/tuix-toast/TuixToast.styles.js +0 -43
  146. package/dist/src/tuix-toast/enums/tuix-toast.enums.d.ts +0 -20
  147. package/dist/src/tuix-toast/enums/tuix-toast.enums.js +0 -59
  148. package/dist/src/tuix-toggle-button/TuixToggleButton.d.ts +0 -13
  149. package/dist/src/tuix-toggle-button/TuixToggleButton.js +0 -85
  150. package/dist/src/tuix-toggle-button/TuixToggleButton.styles.d.ts +0 -5
  151. package/dist/src/tuix-toggle-button/TuixToggleButton.styles.js +0 -134
  152. package/dist/src/tuix-toggle-button/interfaces/tuix-toggle.interface.d.ts +0 -2
  153. package/dist/src/tuix-toggle-button/interfaces/tuix-toggle.interface.js +0 -1
  154. package/dist/src/utils/colors.d.ts +0 -29
  155. package/dist/src/utils/colors.js +0 -30
  156. package/dist/src/utils/darkColors.d.ts +0 -31
  157. package/dist/src/utils/darkColors.js +0 -32
  158. package/dist/src/utils/hex-rgb.d.ts +0 -5
  159. package/dist/src/utils/hex-rgb.js +0 -15
  160. package/dist/src/utils/interfaces/detail-value.interface.d.ts +0 -3
  161. package/dist/src/utils/interfaces/detail-value.interface.js +0 -1
  162. package/dist/src/utils/mainVariant.enum.d.ts +0 -4
  163. package/dist/src/utils/mainVariant.enum.js +0 -5
  164. package/dist/src/utils/screenSizes.enum.d.ts +0 -4
  165. package/dist/src/utils/screenSizes.enum.js +0 -5
  166. package/dist/src/utils/slottedClassName.d.ts +0 -2
  167. package/dist/src/utils/slottedClassName.js +0 -1
  168. package/dist/tsconfig.publish.tsbuildinfo +0 -1
@@ -1,132 +0,0 @@
1
- import { css, unsafeCSS } from 'lit';
2
- import { Palette } from '../utils/colors';
3
- import { DarkPalette } from '../utils/darkColors';
4
- import { ScreenSizes } from '../utils/screenSizes.enum';
5
- export const hostStyles = css `
6
- :host {
7
- --t-main-color-tuix: ${unsafeCSS(Palette.MAIN)};
8
- --t-bg-color-primary: ${unsafeCSS(Palette.WHITE)};
9
- --t-bg-color-disabled: ${unsafeCSS(Palette.PRIMARY_100)};
10
- --t-text-color-error: ${unsafeCSS(Palette.ERROR)};
11
- --t-stroke-color-focus: ${unsafeCSS(Palette.SECONDARY)};
12
- --t-stroke-color-grey: ${unsafeCSS(Palette.PRIMARY_300)};
13
- --t-text-color-label: ${unsafeCSS(Palette.BLACK)};
14
- --t-label-right-default-justify: flex-start;
15
- --t-label-left-default-justify: space-between;
16
- }
17
- :host([dark]) {
18
- --t-main-color-tuix: ${unsafeCSS(DarkPalette.MAIN)};
19
- --t-bg-color-primary: ${unsafeCSS(DarkPalette.BLACK)};
20
- --t-bg-color-disabled: ${unsafeCSS(DarkPalette.PRIMARY_800)};
21
- --t-text-color-error: ${unsafeCSS(DarkPalette.ERROR)};
22
- --t-stroke-color-focus: ${unsafeCSS(DarkPalette.SECONDARY)};
23
- --t-stroke-color-grey: ${unsafeCSS(DarkPalette.PRIMARY_100)};
24
- --t-text-color-label: ${unsafeCSS(DarkPalette.WHITE)};
25
- }
26
- `;
27
- export const checkboxContainerStyles = css `
28
- .t-checkbox-full-container {
29
- display: flex;
30
- justify-content: var(--t-label-right-default-justify, flex-start);
31
- cursor: pointer;
32
- -webkit-user-select: none;
33
- -moz-user-select: none;
34
- -ms-user-select: none;
35
- user-select: none;
36
- }
37
- :host([disabled]) .t-checkbox-full-container {
38
- cursor: not-allowed;
39
- }
40
- .t-checkbox-container {
41
- --t-checkbox-size-box: 1.5rem;
42
- --t-checkbox-shadow-width: 2px;
43
- --t-checkbox-border-radius: 0.25rem;
44
- display: block;
45
- position: relative;
46
- height: var(--t-checkbox-size-box);
47
- width: var(--t-checkbox-size-box);
48
- min-width: var(--t-checkbox-size-box);
49
- }
50
- .t-checkbox-container .t-checkbox {
51
- position: absolute;
52
- opacity: 0;
53
- height: 0;
54
- width: 0;
55
- }
56
- @media only screen and (max-width: ${ScreenSizes.MOBILE}px) {
57
- .t-checkbox-container {
58
- --t-checkbox-size-box: 1rem;
59
- --t-checkbox-shadow-width: 1px;
60
- --t-checkbox-border-radius: 0.125rem;
61
- margin-top: 1px;
62
- }
63
- }
64
- `;
65
- export const checkboxCheckmarkStyles = css `
66
- .t-checkbox-container .t-checkbox-checkmark {
67
- position: absolute;
68
- top: 0;
69
- left: 0;
70
- display: flex;
71
- height: var(--t-checkbox-size-box);
72
- width: var(--t-checkbox-size-box);
73
- border-radius: var(--t-checkbox-border-radius);
74
- background-color: var(--t-bg-color-primary);
75
- border: 1px solid var(--t-stroke-color-grey);
76
- box-sizing: border-box;
77
- }
78
- .t-checkbox-container .t-checkbox-checkmark tuix-icon {
79
- margin: auto;
80
- display: none;
81
- width: calc(var(--t-checkbox-size-box) - 0.5rem);
82
- height: calc(var(--t-checkbox-size-box) - 0.5rem);
83
- }
84
- .t-checkbox-container .t-checkbox:checked ~ .t-checkbox-checkmark {
85
- background-color: var(--t-main-color-tuix);
86
- border: none;
87
- }
88
- .t-checkbox-container .t-checkbox:focus ~ .t-checkbox-checkmark {
89
- box-shadow: 0 0 0px var(--t-checkbox-shadow-width)
90
- var(--t-stroke-color-focus);
91
- border: 1px solid var(--t-main-color-tuix);
92
- }
93
- .t-checkbox-container .t-checkbox:checked ~ .t-checkbox-checkmark tuix-icon {
94
- display: block;
95
- }
96
- .t-checkbox-full-container:hover .t-checkbox-container .t-checkbox-checkmark {
97
- border: 1px solid var(--t-main-color-tuix);
98
- }
99
- .t-checkbox-full-container.t-with-error
100
- .t-checkbox-container
101
- .t-checkbox-checkmark {
102
- border: 1px solid var(--t-text-color-error);
103
- }
104
- .t-checkbox-full-container.t-with-error
105
- .t-checkbox-container
106
- .t-checkbox:checked
107
- ~ .t-checkbox-checkmark {
108
- background-color: var(--t-text-color-error);
109
- border: none;
110
- }
111
-
112
- .t-checkbox-container .t-checkbox:disabled ~ .t-checkbox-checkmark {
113
- background-color: var(--t-bg-color-disabled);
114
- border: none;
115
- box-shadow: none;
116
- }
117
- `;
118
- export const checkboxLabelStyles = css `
119
- .t-checkbox-label {
120
- display: block;
121
- color: var(--t-text-color-label);
122
- margin-left: 0.625rem;
123
- }
124
- .t-checkbox-full-container.t-with-label-left {
125
- flex-direction: row-reverse;
126
- justify-content: var(--t-label-left-default-justify, space-between);
127
- }
128
- .t-checkbox-full-container.t-with-label-left .t-checkbox-label {
129
- margin-right: 0.625rem;
130
- margin-left: 0;
131
- }
132
- `;
@@ -1,21 +0,0 @@
1
- import { Palette } from '../../utils/colors';
2
- import { DarkPalette } from '../../utils/darkColors';
3
- export declare enum CheckboxIconMode {
4
- DEFAULT = "default",
5
- DISABLED = "disabled",
6
- ERROR = "error"
7
- }
8
- export declare enum CheckboxLabelSide {
9
- LEFT = "left",
10
- RIGHT = "right"
11
- }
12
- export declare const CheckboxIconColorLight: {
13
- default: Palette;
14
- disabled: Palette;
15
- error: Palette;
16
- };
17
- export declare const CheckboxIconColorDark: {
18
- default: DarkPalette;
19
- disabled: DarkPalette;
20
- error: DarkPalette;
21
- };
@@ -1,23 +0,0 @@
1
- import { Palette } from '../../utils/colors';
2
- import { DarkPalette } from '../../utils/darkColors';
3
- export var CheckboxIconMode;
4
- (function (CheckboxIconMode) {
5
- CheckboxIconMode["DEFAULT"] = "default";
6
- CheckboxIconMode["DISABLED"] = "disabled";
7
- CheckboxIconMode["ERROR"] = "error";
8
- })(CheckboxIconMode || (CheckboxIconMode = {}));
9
- export var CheckboxLabelSide;
10
- (function (CheckboxLabelSide) {
11
- CheckboxLabelSide["LEFT"] = "left";
12
- CheckboxLabelSide["RIGHT"] = "right";
13
- })(CheckboxLabelSide || (CheckboxLabelSide = {}));
14
- export const CheckboxIconColorLight = {
15
- [CheckboxIconMode.DEFAULT]: Palette.WHITE,
16
- [CheckboxIconMode.DISABLED]: Palette.PRIMARY_300,
17
- [CheckboxIconMode.ERROR]: Palette.WHITE,
18
- };
19
- export const CheckboxIconColorDark = {
20
- [CheckboxIconMode.DEFAULT]: DarkPalette.WHITE,
21
- [CheckboxIconMode.DISABLED]: DarkPalette.PRIMARY_100,
22
- [CheckboxIconMode.ERROR]: DarkPalette.WHITE,
23
- };
@@ -1,5 +0,0 @@
1
- import { type DetailValue } from '../../utils/interfaces/detail-value.interface';
2
- export interface DetailValueCheckbox extends DetailValue<boolean> {
3
- label?: string;
4
- }
5
- export type CustomEventTuixCheckbox = CustomEvent<DetailValueCheckbox>;
@@ -1,55 +0,0 @@
1
- import { LitElement, type PropertyValues, type TemplateResult } from 'lit';
2
- import type { TuixDropdownExtendedOption, TuixDropdownOption } from './interfaces/tuix-dropdown.interface';
3
- import { DescriptionType } from '../tuix-input/enums/tuix-input.enums';
4
- import { DropdownType } from './enums/tuix-dropdown.enums';
5
- export declare class TuixDropdown extends LitElement {
6
- static styles: import("lit").CSSResult[];
7
- value?: TuixDropdownOption;
8
- options: TuixDropdownOption[];
9
- placeholder: string;
10
- title: string;
11
- disabled: boolean;
12
- dark: boolean;
13
- description?: string;
14
- descriptionType: DescriptionType;
15
- type: DropdownType;
16
- private _value;
17
- private _isOptionsVisible;
18
- private _searchingOption;
19
- _extendedOptions: TuixDropdownExtendedOption[];
20
- private _optionsContainer;
21
- private _inputDropdown;
22
- private _previousSelectedOption;
23
- private _previousFocusedOption;
24
- connectedCallback(): void;
25
- disconnectedCallback(): void;
26
- private _onEnterPress;
27
- private _onKeyDownOption;
28
- private _onKeyPressOption;
29
- private _onMouseOverOption;
30
- private _onClickOption;
31
- protected _onInputSingle(e: CustomEvent): void;
32
- protected _handleSelectEvent(event: MouseEvent | KeyboardEvent): void;
33
- private _handleBlur;
34
- private _getOptionName;
35
- private _getOptionValue;
36
- private _findIndex;
37
- private _handleInputBase;
38
- private _extendOptionsList;
39
- private _handleArrowDown;
40
- private _handleArrowUp;
41
- private _handleClickOutside;
42
- private _focusTargetOption;
43
- private _toggleOptions;
44
- private _focusOptionsContainer;
45
- private _unselectPreviousOption;
46
- private _hasCompleteDescription;
47
- private _getOptionsContainerClasses;
48
- private _triggerUpdateByExternalValueChange;
49
- private _resetPreviousSelection;
50
- private _getOptionsTemplate;
51
- protected updated(changedProperties: Map<string, any>): void;
52
- protected willUpdate(changedProperties: PropertyValues<this>): void;
53
- protected firstUpdated(changedProperties: PropertyValues<this>): void;
54
- protected render(): TemplateResult;
55
- }
@@ -1,360 +0,0 @@
1
- import { __decorate } from "tslib";
2
- import { LitElement, html, } from 'lit';
3
- import { customElement, property, query, state } from 'lit/decorators.js';
4
- import { classMap } from 'lit/directives/class-map.js';
5
- import { IconName } from '../tuix-icon/enums/tuix-icon.enums';
6
- import { dropdownHostStyles, dropdownMainContainerStyles, dropdownOptionStyles, } from './TuixDropdown.styles';
7
- import { DescriptionType } from '../tuix-input/enums/tuix-input.enums';
8
- import { DropdownType } from './enums/tuix-dropdown.enums';
9
- let TuixDropdown = class TuixDropdown extends LitElement {
10
- constructor() {
11
- super(...arguments);
12
- this.value = undefined;
13
- this.options = [];
14
- this.placeholder = '';
15
- this.title = '';
16
- this.disabled = false;
17
- this.dark = false;
18
- this.descriptionType = DescriptionType.TEXT;
19
- this.type = DropdownType.SINGLE;
20
- this._value = '';
21
- this._isOptionsVisible = false;
22
- this._searchingOption = false;
23
- this._extendedOptions = [];
24
- this._previousSelectedOption = null;
25
- this._previousFocusedOption = null;
26
- this._handleClickOutside = (event) => {
27
- if (!event.composedPath().includes(this)) {
28
- this._isOptionsVisible = false;
29
- }
30
- };
31
- }
32
- static { this.styles = [
33
- dropdownHostStyles,
34
- dropdownMainContainerStyles,
35
- dropdownOptionStyles,
36
- ]; }
37
- connectedCallback() {
38
- super.connectedCallback();
39
- window.addEventListener('click', this._handleClickOutside);
40
- this.addEventListener('blur', this._handleBlur.bind(this));
41
- }
42
- disconnectedCallback() {
43
- window.removeEventListener('click', this._handleClickOutside);
44
- super.disconnectedCallback();
45
- }
46
- _onEnterPress(event) {
47
- if (event.key === 'Enter') {
48
- this._toggleOptions();
49
- }
50
- }
51
- _onKeyDownOption(event) {
52
- switch (event.key) {
53
- case 'ArrowDown':
54
- return this._handleArrowDown();
55
- case 'ArrowUp':
56
- return this._handleArrowUp();
57
- case 'Escape':
58
- this._isOptionsVisible = false;
59
- break;
60
- }
61
- }
62
- _onKeyPressOption(event) {
63
- if (event.key === 'Enter') {
64
- this._onClickOption(event);
65
- }
66
- }
67
- _onMouseOverOption(event) {
68
- const optionTarget = event.target;
69
- this._focusTargetOption(optionTarget);
70
- }
71
- _onClickOption(event) {
72
- const optionTarget = event.target;
73
- this._value = optionTarget.innerText;
74
- this._isOptionsVisible = false;
75
- this._unselectPreviousOption();
76
- optionTarget.classList.add('t-option-selected');
77
- this._previousSelectedOption = optionTarget;
78
- this._handleSelectEvent(event);
79
- }
80
- _onInputSingle(e) {
81
- this._handleInputBase(e, 'input-single');
82
- }
83
- _handleSelectEvent(event) {
84
- const optionIndex = event.target.getAttribute('data-value');
85
- const selectedValue = this.options[Number(optionIndex)];
86
- this.dispatchEvent(new CustomEvent('select', {
87
- detail: {
88
- value: this._getOptionValue(selectedValue),
89
- },
90
- bubbles: true,
91
- }));
92
- if (this.type === DropdownType.SEARCH) {
93
- this._extendOptionsList(this._getOptionName(selectedValue));
94
- this._searchingOption = false;
95
- }
96
- }
97
- _handleBlur() {
98
- if (this.type === DropdownType.SEARCH && this._searchingOption) {
99
- const optionIndex = this._previousSelectedOption?.getAttribute('data-value');
100
- const selectedValue = typeof optionIndex === 'string'
101
- ? this.options[Number(optionIndex)]
102
- : '';
103
- this._value = this._getOptionName(selectedValue);
104
- this._extendOptionsList();
105
- }
106
- }
107
- _getOptionName(option) {
108
- return String(typeof option === 'object' ? option?.name : option);
109
- }
110
- _getOptionValue(option) {
111
- return typeof option === 'object' ? option.value : option;
112
- }
113
- _findIndex(option) {
114
- return this._extendedOptions.findIndex(opt => opt.value === this._getOptionValue(option));
115
- }
116
- _handleInputBase(e, eventName) {
117
- if (!this._searchingOption) {
118
- this._searchingOption = true;
119
- }
120
- this._extendOptionsList(e.detail.value);
121
- this._isOptionsVisible = true;
122
- this.dispatchEvent(new CustomEvent(eventName, {
123
- detail: {
124
- value: e.detail.value,
125
- },
126
- bubbles: true,
127
- }));
128
- this._value = e.detail.value;
129
- }
130
- _extendOptionsList(value = '') {
131
- value = value.trim();
132
- this._extendedOptions = this.options.map(option => {
133
- const optionName = this._getOptionName(option);
134
- return {
135
- name: optionName,
136
- value: this._getOptionValue(option),
137
- filtered: this.type === DropdownType.SEARCH &&
138
- value !== '' &&
139
- !optionName.toLowerCase().includes(value.toLowerCase()),
140
- };
141
- });
142
- }
143
- _handleArrowDown() {
144
- const nextOption = this._previousFocusedOption
145
- ?.nextElementSibling;
146
- if (nextOption) {
147
- this._focusTargetOption(nextOption);
148
- }
149
- }
150
- _handleArrowUp() {
151
- const previousOption = this._previousFocusedOption
152
- ?.previousElementSibling;
153
- if (previousOption) {
154
- this._focusTargetOption(previousOption);
155
- }
156
- }
157
- _focusTargetOption(targetOption, extrict = true) {
158
- this._previousFocusedOption?.classList?.remove('t-option-hover');
159
- targetOption?.classList.add('t-option-hover');
160
- if (extrict) {
161
- targetOption?.focus();
162
- }
163
- this._previousFocusedOption = targetOption;
164
- }
165
- _toggleOptions() {
166
- if (this.disabled) {
167
- return;
168
- }
169
- this._isOptionsVisible = !this._isOptionsVisible;
170
- if (this._isOptionsVisible &&
171
- this.type === DropdownType.SEARCH &&
172
- this._previousSelectedOption) {
173
- this._optionsContainer?.scrollTo({
174
- top: this._previousSelectedOption.offsetTop,
175
- behavior: 'auto',
176
- });
177
- this._inputDropdown?.shadowRoot?.querySelector('input')?.select();
178
- }
179
- }
180
- _focusOptionsContainer() {
181
- if (this.type === DropdownType.SEARCH) {
182
- if (this._previousSelectedOption) {
183
- this._focusTargetOption(this._previousSelectedOption, false);
184
- }
185
- return;
186
- }
187
- if (!this._isOptionsVisible || !this._optionsContainer) {
188
- this._inputDropdown?.shadowRoot?.querySelector('input')?.focus();
189
- return;
190
- }
191
- if (this._previousSelectedOption) {
192
- this._focusTargetOption(this._previousSelectedOption);
193
- }
194
- else {
195
- const firstOption = this._optionsContainer
196
- .firstElementChild;
197
- if (firstOption) {
198
- this._focusTargetOption(firstOption);
199
- }
200
- }
201
- }
202
- _unselectPreviousOption() {
203
- if (this._previousSelectedOption) {
204
- this._previousSelectedOption.classList?.remove('t-option-selected');
205
- this._previousSelectedOption = null;
206
- }
207
- }
208
- _hasCompleteDescription() {
209
- const isValidDescriptionType = Object.values(DescriptionType).includes(this.descriptionType);
210
- return (isValidDescriptionType &&
211
- (this.descriptionType === DescriptionType.TEXT
212
- ? !!this.description
213
- : true));
214
- }
215
- _getOptionsContainerClasses() {
216
- return {
217
- 't-options-container': true,
218
- show: this._isOptionsVisible,
219
- 't-with-description': this._hasCompleteDescription(),
220
- };
221
- }
222
- _triggerUpdateByExternalValueChange() {
223
- this._unselectPreviousOption();
224
- if (!this.value) {
225
- this._value = '';
226
- this._extendOptionsList();
227
- return;
228
- }
229
- const index = this._findIndex(this.value);
230
- if (this.type === DropdownType.SEARCH) {
231
- this._extendOptionsList('');
232
- }
233
- if (index < 0) {
234
- this._value = '';
235
- return;
236
- }
237
- const optionTarget = this._optionsContainer?.children[index];
238
- optionTarget?.classList.add('t-option-selected');
239
- this._previousSelectedOption = optionTarget || null;
240
- this._value = optionTarget ? this._getOptionName(this.options[index]) : '';
241
- }
242
- _resetPreviousSelection() {
243
- this._value = '';
244
- this._unselectPreviousOption();
245
- }
246
- _getOptionsTemplate() {
247
- if (this.type === DropdownType.SINGLE || this._searchingOption === false) {
248
- this._extendOptionsList();
249
- }
250
- return this._extendedOptions?.map((option, index) => {
251
- return html `<div
252
- class="${classMap({
253
- 't-dropdown-option': true,
254
- 't-option-filtered': option.filtered,
255
- })}"
256
- @click="${this._onClickOption}"
257
- data-value="${index}"
258
- tabindex="0"
259
- @keydown="${this._onKeyDownOption}"
260
- @keypress="${this._onKeyPressOption}"
261
- @mouseover="${this._onMouseOverOption}"
262
- >
263
- ${option.name}
264
- </div>`;
265
- });
266
- }
267
- updated(changedProperties) {
268
- if (changedProperties.has('_isOptionsVisible')) {
269
- this._focusOptionsContainer();
270
- }
271
- else if (changedProperties.has('value')) {
272
- this._triggerUpdateByExternalValueChange();
273
- }
274
- }
275
- willUpdate(changedProperties) {
276
- if (changedProperties.has('options')) {
277
- this._resetPreviousSelection();
278
- }
279
- }
280
- firstUpdated(changedProperties) {
281
- super.firstUpdated(changedProperties);
282
- this._triggerUpdateByExternalValueChange();
283
- }
284
- render() {
285
- return html `<div class="t-dropdown-full-container">
286
- <div class="t-dropdown-container">
287
- <tuix-input
288
- .value="${this._value}"
289
- class="t-input-dropdown"
290
- iconRight="${this._isOptionsVisible
291
- ? IconName.CHEVRON_UP
292
- : IconName.CHEVRON_DOWN}"
293
- placeholder="${this.placeholder}"
294
- title="${this.title}"
295
- .description="${this.description}"
296
- descriptionType="${this.descriptionType}"
297
- ?disabled="${this.disabled}"
298
- ?dark="${this.dark}"
299
- ?readonly="${this.type !== DropdownType.SEARCH}"
300
- @on-click="${this._toggleOptions}"
301
- @keypress="${this._onEnterPress}"
302
- @on-change="${this._onInputSingle}"
303
- >
304
- </tuix-input>
305
- </div>
306
- <div class="${classMap(this._getOptionsContainerClasses())}">
307
- ${this._getOptionsTemplate()}
308
- </div>
309
- </div>`;
310
- }
311
- };
312
- __decorate([
313
- property({ type: Object })
314
- ], TuixDropdown.prototype, "value", void 0);
315
- __decorate([
316
- property({ type: Array })
317
- ], TuixDropdown.prototype, "options", void 0);
318
- __decorate([
319
- property({ type: String })
320
- ], TuixDropdown.prototype, "placeholder", void 0);
321
- __decorate([
322
- property({ type: String })
323
- ], TuixDropdown.prototype, "title", void 0);
324
- __decorate([
325
- property({ type: Boolean, reflect: true })
326
- ], TuixDropdown.prototype, "disabled", void 0);
327
- __decorate([
328
- property({ type: Boolean, reflect: true })
329
- ], TuixDropdown.prototype, "dark", void 0);
330
- __decorate([
331
- property({ type: String })
332
- ], TuixDropdown.prototype, "description", void 0);
333
- __decorate([
334
- property({ type: DescriptionType })
335
- ], TuixDropdown.prototype, "descriptionType", void 0);
336
- __decorate([
337
- property({ type: String })
338
- ], TuixDropdown.prototype, "type", void 0);
339
- __decorate([
340
- state()
341
- ], TuixDropdown.prototype, "_value", void 0);
342
- __decorate([
343
- state()
344
- ], TuixDropdown.prototype, "_isOptionsVisible", void 0);
345
- __decorate([
346
- state()
347
- ], TuixDropdown.prototype, "_searchingOption", void 0);
348
- __decorate([
349
- state()
350
- ], TuixDropdown.prototype, "_extendedOptions", void 0);
351
- __decorate([
352
- query('.t-options-container')
353
- ], TuixDropdown.prototype, "_optionsContainer", void 0);
354
- __decorate([
355
- query('.t-dropdown-container .t-input-dropdown')
356
- ], TuixDropdown.prototype, "_inputDropdown", void 0);
357
- TuixDropdown = __decorate([
358
- customElement('tuix-dropdown')
359
- ], TuixDropdown);
360
- export { TuixDropdown };
@@ -1,3 +0,0 @@
1
- export declare const dropdownHostStyles: import("lit").CSSResult;
2
- export declare const dropdownMainContainerStyles: import("lit").CSSResult;
3
- export declare const dropdownOptionStyles: import("lit").CSSResult;