@ganpatiinfo/gids-web-dom-reference 7.1.0 → 8.0.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 (97) hide show
  1. package/CHANGELOG.md +63 -0
  2. package/dist/components/GidsAccordion/GidsAccordion.d.ts +8 -0
  3. package/dist/components/GidsAccordion/GidsAccordion.d.ts.map +1 -0
  4. package/dist/components/GidsAccordion/GidsAccordion.js +10 -0
  5. package/dist/components/GidsAccordion/GidsAccordion.js.map +1 -0
  6. package/dist/components/GidsAccordionItem/GidsAccordionItem.d.ts +9 -0
  7. package/dist/components/GidsAccordionItem/GidsAccordionItem.d.ts.map +1 -0
  8. package/dist/components/GidsAccordionItem/GidsAccordionItem.js +15 -0
  9. package/dist/components/GidsAccordionItem/GidsAccordionItem.js.map +1 -0
  10. package/dist/components/GidsAccordionItemContent/GidsAccordionItemContent.d.ts +8 -0
  11. package/dist/components/GidsAccordionItemContent/GidsAccordionItemContent.d.ts.map +1 -0
  12. package/dist/components/GidsAccordionItemContent/GidsAccordionItemContent.js +10 -0
  13. package/dist/components/GidsAccordionItemContent/GidsAccordionItemContent.js.map +1 -0
  14. package/dist/components/GidsAccordionItemHeader/GidsAccordionItemHeader.d.ts +8 -0
  15. package/dist/components/GidsAccordionItemHeader/GidsAccordionItemHeader.d.ts.map +1 -0
  16. package/dist/components/GidsAccordionItemHeader/GidsAccordionItemHeader.js +20 -0
  17. package/dist/components/GidsAccordionItemHeader/GidsAccordionItemHeader.js.map +1 -0
  18. package/dist/components/GidsButton/GidsButton.d.ts +1 -1
  19. package/dist/components/GidsButton/GidsButton.d.ts.map +1 -1
  20. package/dist/components/GidsButton/GidsButton.js +2 -2
  21. package/dist/components/GidsButton/GidsButton.js.map +1 -1
  22. package/dist/components/GidsDropdownItem/GidsDropdownItem.d.ts +10 -0
  23. package/dist/components/GidsDropdownItem/GidsDropdownItem.d.ts.map +1 -0
  24. package/dist/components/GidsDropdownItem/GidsDropdownItem.js +31 -0
  25. package/dist/components/GidsDropdownItem/GidsDropdownItem.js.map +1 -0
  26. package/dist/components/GidsDropdownMenu/GidsDropdownMenu.d.ts +7 -0
  27. package/dist/components/GidsDropdownMenu/GidsDropdownMenu.d.ts.map +1 -0
  28. package/dist/components/GidsDropdownMenu/GidsDropdownMenu.js +24 -0
  29. package/dist/components/GidsDropdownMenu/GidsDropdownMenu.js.map +1 -0
  30. package/dist/components/GidsDropdownMenuGroup/GidsDropdownMenuGroup.d.ts +7 -0
  31. package/dist/components/GidsDropdownMenuGroup/GidsDropdownMenuGroup.d.ts.map +1 -0
  32. package/dist/components/GidsDropdownMenuGroup/GidsDropdownMenuGroup.js +13 -0
  33. package/dist/components/GidsDropdownMenuGroup/GidsDropdownMenuGroup.js.map +1 -0
  34. package/dist/components/GidsEditButton/GidsEditButton.d.ts +8 -0
  35. package/dist/components/GidsEditButton/GidsEditButton.d.ts.map +1 -0
  36. package/dist/components/GidsEditButton/GidsEditButton.js +44 -0
  37. package/dist/components/GidsEditButton/GidsEditButton.js.map +1 -0
  38. package/dist/components/GidsFeedbackBlock/GidsFeedbackBlock.d.ts +5 -0
  39. package/dist/components/GidsFeedbackBlock/GidsFeedbackBlock.d.ts.map +1 -0
  40. package/dist/components/GidsFeedbackBlock/GidsFeedbackBlock.js +49 -0
  41. package/dist/components/GidsFeedbackBlock/GidsFeedbackBlock.js.map +1 -0
  42. package/dist/components/GidsListItem/GidsListItem.d.ts +11 -0
  43. package/dist/components/GidsListItem/GidsListItem.d.ts.map +1 -0
  44. package/dist/components/GidsListItem/GidsListItem.js +196 -0
  45. package/dist/components/GidsListItem/GidsListItem.js.map +1 -0
  46. package/dist/components/GidsMenu/GidsMenu.d.ts +7 -0
  47. package/dist/components/GidsMenu/GidsMenu.d.ts.map +1 -0
  48. package/dist/components/GidsMenu/GidsMenu.js +34 -0
  49. package/dist/components/GidsMenu/GidsMenu.js.map +1 -0
  50. package/dist/components/GidsMenuGroup/GidsMenuGroup.d.ts +7 -0
  51. package/dist/components/GidsMenuGroup/GidsMenuGroup.d.ts.map +1 -0
  52. package/dist/components/GidsMenuGroup/GidsMenuGroup.js +31 -0
  53. package/dist/components/GidsMenuGroup/GidsMenuGroup.js.map +1 -0
  54. package/dist/components/GidsOverflowContainer/GidsOverflowContainer.d.ts +7 -0
  55. package/dist/components/GidsOverflowContainer/GidsOverflowContainer.d.ts.map +1 -0
  56. package/dist/components/GidsOverflowContainer/GidsOverflowContainer.js +14 -0
  57. package/dist/components/GidsOverflowContainer/GidsOverflowContainer.js.map +1 -0
  58. package/dist/components/GidsPopover/GidsPopover.d.ts +7 -0
  59. package/dist/components/GidsPopover/GidsPopover.d.ts.map +1 -0
  60. package/dist/components/GidsPopover/GidsPopover.js +16 -0
  61. package/dist/components/GidsPopover/GidsPopover.js.map +1 -0
  62. package/dist/components/GidsProgressBar/GidsProgressBar.d.ts +7 -0
  63. package/dist/components/GidsProgressBar/GidsProgressBar.d.ts.map +1 -0
  64. package/dist/components/GidsProgressBar/GidsProgressBar.js +22 -0
  65. package/dist/components/GidsProgressBar/GidsProgressBar.js.map +1 -0
  66. package/dist/components/GidsTooltip/GidsTooltip.d.ts +6 -0
  67. package/dist/components/GidsTooltip/GidsTooltip.d.ts.map +1 -0
  68. package/dist/components/GidsTooltip/GidsTooltip.js +20 -0
  69. package/dist/components/GidsTooltip/GidsTooltip.js.map +1 -0
  70. package/dist/index.d.ts +17 -0
  71. package/dist/index.d.ts.map +1 -1
  72. package/dist/index.js +17 -0
  73. package/dist/index.js.map +1 -1
  74. package/dist/utils/childrenValidationUtils.d.ts +9 -0
  75. package/dist/utils/childrenValidationUtils.d.ts.map +1 -0
  76. package/dist/utils/childrenValidationUtils.js +27 -0
  77. package/dist/utils/childrenValidationUtils.js.map +1 -0
  78. package/package.json +45 -45
  79. package/src/components/GidsAccordion/GidsAccordion.ts +24 -0
  80. package/src/components/GidsAccordionItem/GidsAccordionItem.ts +37 -0
  81. package/src/components/GidsAccordionItemContent/GidsAccordionItemContent.ts +25 -0
  82. package/src/components/GidsAccordionItemHeader/GidsAccordionItemHeader.ts +38 -0
  83. package/src/components/GidsButton/GidsButton.ts +2 -1
  84. package/src/components/GidsDropdownItem/GidsDropdownItem.ts +62 -0
  85. package/src/components/GidsDropdownMenu/GidsDropdownMenu.ts +43 -0
  86. package/src/components/GidsDropdownMenuGroup/GidsDropdownMenuGroup.ts +26 -0
  87. package/src/components/GidsEditButton/GidsEditButton.ts +71 -0
  88. package/src/components/GidsFeedbackBlock/GidsFeedbackBlock.ts +68 -0
  89. package/src/components/GidsListItem/GidsListItem.ts +281 -0
  90. package/src/components/GidsMenu/GidsMenu.ts +64 -0
  91. package/src/components/GidsMenuGroup/GidsMenuGroup.ts +51 -0
  92. package/src/components/GidsOverflowContainer/GidsOverflowContainer.ts +27 -0
  93. package/src/components/GidsPopover/GidsPopover.ts +32 -0
  94. package/src/components/GidsProgressBar/GidsProgressBar.ts +50 -0
  95. package/src/components/GidsTooltip/GidsTooltip.ts +37 -0
  96. package/src/index.ts +17 -0
  97. package/src/utils/childrenValidationUtils.ts +47 -0
@@ -0,0 +1,281 @@
1
+ import {
2
+ ClassValue,
3
+ GidsListItemWebProps,
4
+ GidsListItemWebUtils,
5
+ } from '@ganpatiinfo/gids-web-shared';
6
+ import {
7
+ appendAsChildren,
8
+ DomChildren,
9
+ DomNodeOrString,
10
+ } from '../../utils/domUtils';
11
+ import { GidsEditButtonDom } from '../GidsEditButton/GidsEditButton';
12
+ import { GidsDividerDom } from '../GidsDivider/GidsDivider';
13
+ import { GidsIconDom } from '../GidsIcon/GidsIcon';
14
+ import { GidsListItemSelectEventDetail } from '@ganpatiinfo/gids-core-shared';
15
+
16
+ const { getGidsListItemClassNames } = GidsListItemWebUtils;
17
+
18
+ export interface GidsListItemDomProps extends GidsListItemWebProps<
19
+ DomNodeOrString,
20
+ DomChildren,
21
+ DomNodeOrString,
22
+ DomNodeOrString
23
+ > {
24
+ name?: string;
25
+ onPressEditButton?: (this: HTMLButtonElement, event: Event) => void;
26
+ extraClasses?: ClassValue;
27
+ onPressListItem?: (event: CustomEvent<GidsListItemSelectEventDetail>) => void;
28
+ }
29
+
30
+ export const GidsListItemDom = (
31
+ props: GidsListItemDomProps,
32
+ ): HTMLButtonElement => {
33
+ const {
34
+ index,
35
+ defaultSelectedIndex,
36
+ children,
37
+ disabled = false,
38
+ selected,
39
+ editButton,
40
+ onPressEditButton,
41
+ onPressListItem,
42
+ leadingAccessory,
43
+ leadingSupport,
44
+ leadingParagraph,
45
+ trailingContent,
46
+ trailingAccessory,
47
+ trailingSupport,
48
+ trailingParagraph,
49
+ divider,
50
+ extraClasses,
51
+ value,
52
+ name,
53
+ } = props;
54
+
55
+ const listItem = document.createElement('button');
56
+ listItem.type = 'button';
57
+ listItem.className = getGidsListItemClassNames(
58
+ { disabled, selected },
59
+ extraClasses,
60
+ );
61
+ listItem.setAttribute('role', 'list-item-option');
62
+ listItem.setAttribute('aria-selected', selected ? 'true' : 'false');
63
+ listItem.disabled = disabled;
64
+ if (name) {
65
+ listItem.name = name;
66
+ }
67
+
68
+ if (typeof value === 'string') {
69
+ listItem.value = value;
70
+ }
71
+
72
+ const mainContainer = document.createElement('div');
73
+ mainContainer.className = 'gids-list-item__main-container';
74
+
75
+ if (
76
+ editButton !== undefined &&
77
+ editButton !== null &&
78
+ editButton !== 'none' &&
79
+ !disabled
80
+ ) {
81
+ const editButtonNode = GidsEditButtonDom({
82
+ size: 'md',
83
+ editButtonType: editButton,
84
+ onPressEditButton,
85
+ });
86
+ // 2. Stop the event from bubbling up to mainContainer / listItem
87
+ editButtonNode.addEventListener('click', (event: MouseEvent) => {
88
+ event.stopPropagation();
89
+ });
90
+ mainContainer.append(editButtonNode);
91
+ }
92
+
93
+ if (leadingAccessory !== undefined && leadingAccessory !== null) {
94
+ const leadingAccessoryContainer = document.createElement('div');
95
+ leadingAccessoryContainer.className = disabled
96
+ ? 'gids-list-item__leading-accessory-container gids-list-item__accessory-content-disabled'
97
+ : 'gids-list-item__leading-accessory-container';
98
+ appendAsChildren(leadingAccessoryContainer, leadingAccessory);
99
+ appendAsChildren(mainContainer, leadingAccessoryContainer);
100
+ }
101
+
102
+ const middleContentContainer = document.createElement('div');
103
+ middleContentContainer.className = 'gids-list-item__middle-content-container';
104
+
105
+ const leadingContentContainer = document.createElement('div');
106
+ leadingContentContainer.className =
107
+ 'gids-list-item__leading-content-container';
108
+
109
+ if (children !== undefined && children !== null) {
110
+ if (typeof children === 'string') {
111
+ const leadingLabel = document.createElement('span');
112
+ leadingLabel.className = disabled
113
+ ? 'gids-list-item__leading-content-label gids-list-item__text-content-disabled'
114
+ : 'gids-list-item__leading-content-label';
115
+ leadingLabel.textContent = children;
116
+
117
+ appendAsChildren(leadingContentContainer, leadingLabel);
118
+ } else {
119
+ appendAsChildren(leadingContentContainer, children);
120
+ }
121
+ }
122
+
123
+ if (
124
+ (leadingSupport !== undefined && leadingSupport !== null) ||
125
+ (leadingParagraph !== undefined && leadingParagraph !== null)
126
+ ) {
127
+ const leadingSupportContent = document.createElement('div');
128
+ leadingSupportContent.className = 'gids-list-item__leading-support-content';
129
+
130
+ if (leadingSupport !== undefined && leadingSupport !== null) {
131
+ if (typeof leadingSupport === 'string') {
132
+ const leadingContentSupportingText = document.createElement('p');
133
+ leadingContentSupportingText.className = disabled
134
+ ? 'gids-list-item__leading-content-supporting-text gids-list-item__text-content-disabled'
135
+ : 'gids-list-item__leading-content-supporting-text';
136
+ leadingContentSupportingText.textContent = leadingSupport;
137
+
138
+ appendAsChildren(leadingSupportContent, leadingContentSupportingText);
139
+ } else {
140
+ appendAsChildren(leadingSupportContent, leadingSupport);
141
+ }
142
+ }
143
+
144
+ if (leadingParagraph !== undefined && leadingParagraph !== null) {
145
+ if (typeof leadingParagraph === 'string') {
146
+ const leadingContentParagraphText = document.createElement('p');
147
+ leadingContentParagraphText.className = disabled
148
+ ? 'gids-list-item__leading-content-paragraph-text gids-list-item__text-content-disabled'
149
+ : 'gids-list-item__leading-content-paragraph-text';
150
+ leadingContentParagraphText.textContent = leadingParagraph;
151
+
152
+ appendAsChildren(leadingSupportContent, leadingContentParagraphText);
153
+ } else {
154
+ appendAsChildren(leadingSupportContent, leadingParagraph);
155
+ }
156
+ }
157
+
158
+ appendAsChildren(leadingContentContainer, leadingSupportContent);
159
+ }
160
+
161
+ const trailingContentContainer = document.createElement('div');
162
+ trailingContentContainer.className =
163
+ 'gids-list-item__trailing-content-container';
164
+
165
+ if (trailingContent !== undefined && trailingContent !== null) {
166
+ if (typeof trailingContent === 'string') {
167
+ const trailingLabel = document.createElement('span');
168
+ trailingLabel.className = disabled
169
+ ? 'gids-list-item__trailing-content-label gids-list-item__text-content-disabled'
170
+ : 'gids-list-item__trailing-content-label';
171
+ trailingLabel.textContent = trailingContent;
172
+
173
+ appendAsChildren(trailingContentContainer, trailingLabel);
174
+ } else {
175
+ appendAsChildren(trailingContentContainer, trailingContent);
176
+ }
177
+ }
178
+
179
+ if (
180
+ (trailingSupport !== undefined && trailingSupport !== null) ||
181
+ (trailingParagraph !== undefined && trailingParagraph !== null)
182
+ ) {
183
+ const trailingSupportContent = document.createElement('div');
184
+ trailingSupportContent.className =
185
+ 'gids-list-item__trailing-support-content';
186
+
187
+ if (trailingSupport !== undefined && trailingSupport !== null) {
188
+ if (typeof trailingSupport === 'string') {
189
+ const trailingContentSupportingText = document.createElement('p');
190
+ trailingContentSupportingText.className = disabled
191
+ ? 'gids-list-item__trailing-content-supporting-text gids-list-item__text-content-disabled'
192
+ : 'gids-list-item__trailing-content-supporting-text';
193
+ trailingContentSupportingText.textContent = trailingSupport;
194
+
195
+ appendAsChildren(trailingSupportContent, trailingContentSupportingText);
196
+ } else {
197
+ appendAsChildren(trailingSupportContent, trailingSupport);
198
+ }
199
+ }
200
+
201
+ if (trailingParagraph !== undefined && trailingParagraph !== null) {
202
+ if (typeof trailingParagraph === 'string') {
203
+ const trailingContentParagraphText = document.createElement('p');
204
+ trailingContentParagraphText.className = disabled
205
+ ? 'gids-list-item__trailing-content-paragraph-text gids-list-item__text-content-disabled'
206
+ : 'gids-list-item__trailing-content-paragraph-text';
207
+ trailingContentParagraphText.textContent = trailingParagraph;
208
+
209
+ appendAsChildren(trailingSupportContent, trailingContentParagraphText);
210
+ } else {
211
+ appendAsChildren(trailingSupportContent, trailingParagraph);
212
+ }
213
+ }
214
+
215
+ appendAsChildren(trailingContentContainer, trailingSupportContent);
216
+ }
217
+
218
+ appendAsChildren(middleContentContainer, leadingContentContainer);
219
+ appendAsChildren(middleContentContainer, trailingContentContainer);
220
+ appendAsChildren(mainContainer, middleContentContainer);
221
+
222
+ const trailingAccessoryContainer = document.createElement('div');
223
+ trailingAccessoryContainer.className = disabled
224
+ ? 'gids-list-item__trailing-accessory-container gids-list-item__accessory-content-disabled'
225
+ : 'gids-list-item__trailing-accessory-container';
226
+ if (selected) {
227
+ trailingAccessoryContainer.append(
228
+ GidsIconDom({
229
+ name: 'checkmark',
230
+ size: 'md',
231
+ appearance: 'regular',
232
+ }),
233
+ );
234
+ appendAsChildren(mainContainer, trailingAccessoryContainer);
235
+ } else {
236
+ if (trailingAccessory !== undefined && trailingAccessory !== null) {
237
+ appendAsChildren(trailingAccessoryContainer, trailingAccessory);
238
+ appendAsChildren(mainContainer, trailingAccessoryContainer);
239
+ }
240
+ }
241
+
242
+ appendAsChildren(listItem, mainContainer);
243
+ if (divider && !selected) {
244
+ const dividerWrapper = document.createElement('div');
245
+ dividerWrapper.className = 'gids-list-item__divider';
246
+
247
+ dividerWrapper.append(
248
+ GidsDividerDom({
249
+ orientation: 'horizontal',
250
+ }),
251
+ );
252
+
253
+ appendAsChildren(listItem, dividerWrapper);
254
+ }
255
+
256
+ // --- ADD THIS CODE BLOCK BEFORE THE END OF THE FUNCTION ---
257
+ if (onPressListItem) {
258
+ listItem.addEventListener('click', (event: MouseEvent) => {
259
+ if (event?.defaultPrevented || disabled) {
260
+ return;
261
+ }
262
+ // Create a CustomEvent containing your specific detail payload
263
+ const customEvent = new CustomEvent<GidsListItemSelectEventDetail>(
264
+ 'onPressListItem',
265
+ {
266
+ bubbles: true,
267
+ composed: true,
268
+ detail: {
269
+ selectedIndex: index,
270
+ defaultSelectedIndex, // Toggles or passes current state
271
+ },
272
+ },
273
+ );
274
+
275
+ // If your Storybook/wrapper expects the custom event directly in the callback:
276
+ onPressListItem(customEvent);
277
+ });
278
+ }
279
+
280
+ return listItem;
281
+ };
@@ -0,0 +1,64 @@
1
+ import {
2
+ GidsMenuWebProps,
3
+ GidsMenuWebUtils,
4
+ } from '@ganpatiinfo/gids-web-shared';
5
+ import {
6
+ appendAsChildren,
7
+ DomChildren,
8
+ DomNodeOrString,
9
+ } from '../../utils/domUtils.js';
10
+ import { GidsHeadingDom } from '../GidsHeading/GidsHeading.js';
11
+ import { testDomChildrenValidity } from '../../utils/childrenValidationUtils.js';
12
+
13
+ const { getGidsMenuClassNames } = GidsMenuWebUtils;
14
+
15
+ export interface GidsMenuDomProps extends GidsMenuWebProps<
16
+ DomChildren,
17
+ DomNodeOrString
18
+ > {
19
+ extraClasses?: string;
20
+ }
21
+
22
+ export const GidsMenuDom = ({
23
+ children,
24
+ extraClasses,
25
+ heading,
26
+ supportingText,
27
+ supportingTextTypography,
28
+ ...restProps
29
+ }: GidsMenuDomProps): HTMLDivElement => {
30
+ const menu = document.createElement('div');
31
+ menu.className = getGidsMenuClassNames(extraClasses);
32
+
33
+ if (
34
+ (heading !== undefined && heading !== null && heading !== '') ||
35
+ (supportingText !== undefined &&
36
+ supportingText !== null &&
37
+ supportingText !== '')
38
+ ) {
39
+ menu.append(
40
+ GidsHeadingDom({
41
+ heading,
42
+ supportingText,
43
+ supportingTextTypography: supportingTextTypography ?? 'eyebrow-medium',
44
+ ...restProps,
45
+ }),
46
+ );
47
+ }
48
+
49
+ testDomChildrenValidity({
50
+ children,
51
+ classNameToBeValidated: 'gids-list-item',
52
+ childrenNameToBeValidated: 'GidsListItemDom',
53
+ currentComponentName: 'GidsMenu',
54
+ });
55
+
56
+ if (children !== undefined && children !== null) {
57
+ const childrenContainer = document.createElement('div');
58
+ childrenContainer.className = 'gids-menu__children';
59
+ appendAsChildren(childrenContainer, children);
60
+ appendAsChildren(menu, childrenContainer);
61
+ }
62
+
63
+ return menu;
64
+ };
@@ -0,0 +1,51 @@
1
+ import {
2
+ GidsMenuGroupWebProps,
3
+ GidsMenuGroupWebUtils,
4
+ } from '@ganpatiinfo/gids-web-shared';
5
+ import { appendAsChildren, DomChildren } from '../../utils/domUtils.js';
6
+ import { GidsSpinnerDom } from '../GidsSpinner/GidsSpinner.js';
7
+ import { testDomChildrenValidity } from '../../utils/childrenValidationUtils.js';
8
+
9
+ const { getGidsMenuGroupClassNames } = GidsMenuGroupWebUtils;
10
+
11
+ export interface GidsMenuGroupDomProps extends GidsMenuGroupWebProps<DomChildren> {
12
+ extraClasses?: string;
13
+ }
14
+
15
+ export const GidsMenuGroupDom = ({
16
+ type = 'no-options',
17
+ supportingText = 'No options',
18
+ children,
19
+ extraClasses,
20
+ }: GidsMenuGroupDomProps): HTMLDivElement => {
21
+ const menuGroup = document.createElement('div');
22
+ menuGroup.className = getGidsMenuGroupClassNames({ type }, extraClasses);
23
+
24
+ if (type === 'loading') {
25
+ menuGroup.append(
26
+ GidsSpinnerDom({
27
+ indeterminate: true,
28
+ size: 'md',
29
+ }),
30
+ );
31
+ }
32
+
33
+ if (type === 'no-options') {
34
+ const noOptionText = document.createElement('span');
35
+ noOptionText.textContent = supportingText;
36
+ appendAsChildren(menuGroup, noOptionText);
37
+ }
38
+
39
+ testDomChildrenValidity({
40
+ children,
41
+ classNameToBeValidated: 'gids-menu',
42
+ childrenNameToBeValidated: 'GidsMenuDom',
43
+ currentComponentName: 'GidsMenuGroup',
44
+ });
45
+
46
+ if (type === 'default' && children !== undefined && children !== null) {
47
+ appendAsChildren(menuGroup, children);
48
+ }
49
+
50
+ return menuGroup;
51
+ };
@@ -0,0 +1,27 @@
1
+ import { GidsOverflowContainerCommonProps } from '@ganpatiinfo/gids-core-shared';
2
+ import { GidsOverflowContainerWebUtils } from '@ganpatiinfo/gids-web-shared';
3
+ import { appendAsChildren, DomChildren } from '../../utils/domUtils';
4
+
5
+ const { getGidsOverflowContainerClassNames } = GidsOverflowContainerWebUtils;
6
+
7
+ export interface GidsOverflowContainerDomProps extends GidsOverflowContainerCommonProps<DomChildren> {
8
+ extraClasses?: string;
9
+ }
10
+
11
+ export const GidsOverflowContainerDom = ({
12
+ children,
13
+ shadowLocation,
14
+ extraClasses,
15
+ }: GidsOverflowContainerDomProps): HTMLElement => {
16
+ const overflowContainer = document.createElement('gids-overflow-container');
17
+ overflowContainer.className =
18
+ getGidsOverflowContainerClassNames(extraClasses);
19
+
20
+ appendAsChildren(overflowContainer, children);
21
+
22
+ if (shadowLocation !== undefined) {
23
+ overflowContainer.setAttribute('shadow-location', shadowLocation);
24
+ }
25
+
26
+ return overflowContainer;
27
+ };
@@ -0,0 +1,32 @@
1
+ import {
2
+ GidsPopoverWebProps,
3
+ GidsPopoverWebUtils,
4
+ } from '@ganpatiinfo/gids-web-shared';
5
+ import { appendAsChildren, DomChildren } from '../../utils/domUtils.js';
6
+
7
+ const { getGidsPopoverClassNames } = GidsPopoverWebUtils;
8
+
9
+ export interface GidsPopoverDomProps extends GidsPopoverWebProps<DomChildren> {
10
+ extraClasses?: string;
11
+ }
12
+
13
+ export const GidsPopoverDom = ({
14
+ placement,
15
+ htmlFor,
16
+ extraClasses,
17
+ children,
18
+ }: GidsPopoverDomProps): HTMLElement => {
19
+ const popover = document.createElement('gids-popover');
20
+ popover.className = getGidsPopoverClassNames(extraClasses);
21
+
22
+ if (placement !== undefined) {
23
+ popover.setAttribute('placement', placement);
24
+ }
25
+ if (htmlFor !== undefined) {
26
+ popover.setAttribute('for', htmlFor);
27
+ }
28
+
29
+ appendAsChildren(popover, children);
30
+
31
+ return popover;
32
+ };
@@ -0,0 +1,50 @@
1
+ import {
2
+ GidsProgressBarCommonProps,
3
+ GidsProgressBarCommonUtils,
4
+ } from '@ganpatiinfo/gids-core-shared';
5
+ import {
6
+ ClassValue,
7
+ GidsProgressBarWebUtils,
8
+ } from '@ganpatiinfo/gids-web-shared';
9
+
10
+ const { getDeterminateProgressBarValues } = GidsProgressBarCommonUtils;
11
+ const { getGidsProgressBarClassNames } = GidsProgressBarWebUtils;
12
+
13
+ export interface GidsProgressBarDomProps extends GidsProgressBarCommonProps {
14
+ extraClasses?: ClassValue;
15
+ }
16
+
17
+ export const GidsProgressBarDom = ({
18
+ size,
19
+ color,
20
+ indeterminate,
21
+ value,
22
+ max,
23
+ endCap,
24
+ extraClasses,
25
+ }: GidsProgressBarDomProps): HTMLDivElement => {
26
+ const progressBar = document.createElement('div');
27
+ progressBar.className = getGidsProgressBarClassNames(
28
+ { size, color, indeterminate, endCap },
29
+ extraClasses,
30
+ );
31
+
32
+ progressBar.setAttribute('role', 'progressbar');
33
+
34
+ const fill = document.createElement('div');
35
+ fill.className = 'gids-progress-bar__fill';
36
+ progressBar.appendChild(fill);
37
+
38
+ if (indeterminate !== true) {
39
+ const { sanitisedValue, progressBarWidth, ariaValueMax } =
40
+ getDeterminateProgressBarValues({ value, max });
41
+
42
+ progressBar.setAttribute('aria-valuenow', String(sanitisedValue));
43
+ if (ariaValueMax !== undefined) {
44
+ progressBar.setAttribute('aria-valuemax', String(ariaValueMax));
45
+ }
46
+ fill.style.width = progressBarWidth;
47
+ }
48
+
49
+ return progressBar;
50
+ };
@@ -0,0 +1,37 @@
1
+ import { GidsTooltipWebProps } from '@ganpatiinfo/gids-web-shared';
2
+ import { GidsTooltipWebUtils } from '@ganpatiinfo/gids-web-shared';
3
+
4
+ const { getGidsTooltipClassNames } = GidsTooltipWebUtils;
5
+
6
+ export interface GidsTooltipDomProps extends GidsTooltipWebProps {
7
+ extraClasses?: string;
8
+ }
9
+
10
+ export const GidsTooltipDom = ({
11
+ tooltipText,
12
+ placement,
13
+ htmlFor,
14
+ showWithoutDelay,
15
+ extraClasses,
16
+ }: GidsTooltipDomProps): HTMLElement => {
17
+ const tooltip = document.createElement('gids-tooltip');
18
+ tooltip.className = getGidsTooltipClassNames(extraClasses);
19
+
20
+ if (tooltipText !== undefined) {
21
+ tooltip.setAttribute('tooltip-text', tooltipText);
22
+ }
23
+
24
+ if (placement !== undefined) {
25
+ tooltip.setAttribute('placement', placement);
26
+ }
27
+
28
+ if (htmlFor !== undefined) {
29
+ tooltip.setAttribute('for', htmlFor);
30
+ }
31
+
32
+ if (showWithoutDelay) {
33
+ tooltip.setAttribute('show-without-delay', '');
34
+ }
35
+
36
+ return tooltip;
37
+ };
package/src/index.ts CHANGED
@@ -64,8 +64,25 @@ export * from './components/GidsScrim/GidsScrim.js';
64
64
  export * from './components/GidsSideMenuHeader/GidsSideMenuHeader.js';
65
65
  export * from './components/GidsSideMenu/GidsSideMenu.js';
66
66
  export * from './components/GidsSideNavigation/GidsSideNavigation.js';
67
+ export * from './components/GidsProgressBar/GidsProgressBar.js';
68
+ export * from './components/GidsFeedbackBlock/GidsFeedbackBlock.js';
69
+ export * from './components/GidsOverflowContainer/GidsOverflowContainer.js';
70
+ export * from './components/GidsAccordionItemHeader/GidsAccordionItemHeader.js';
71
+ export * from './components/GidsAccordionItemContent/GidsAccordionItemContent.js';
72
+ export * from './components/GidsAccordionItem/GidsAccordionItem.js';
73
+ export * from './components/GidsAccordion/GidsAccordion.js';
74
+ export * from './components/GidsTooltip/GidsTooltip.js';
75
+ export * from './components/GidsPopover/GidsPopover.js';
76
+ export * from './components/GidsEditButton/GidsEditButton.js';
77
+ export * from './components/GidsListItem/GidsListItem.js';
78
+ export * from './components/GidsMenu/GidsMenu.js';
79
+ export * from './components/GidsMenuGroup/GidsMenuGroup.js';
80
+ export * from './components/GidsDropdownItem/GidsDropdownItem.js';
81
+ export * from './components/GidsDropdownMenu/GidsDropdownMenu.js';
82
+ export * from './components/GidsDropdownMenuGroup/GidsDropdownMenuGroup.js';
67
83
 
68
84
  /**
69
85
  * Utilities
70
86
  */
71
87
  export * from './utils/domUtils.js';
88
+ export * from './utils/childrenValidationUtils.js';
@@ -0,0 +1,47 @@
1
+ import { DomChildren } from './domUtils';
2
+
3
+ export interface TestDomChildrenValidity {
4
+ children?: DomChildren;
5
+ classNameToBeValidated?: string;
6
+ childrenNameToBeValidated?: string;
7
+ currentComponentName?: string;
8
+ }
9
+
10
+ export const testDomChildrenValidity = ({
11
+ children,
12
+ classNameToBeValidated,
13
+ childrenNameToBeValidated,
14
+ currentComponentName,
15
+ }: TestDomChildrenValidity) => {
16
+ if (children !== undefined && children !== null) {
17
+ // --- STRICTOR DOM TYPE VALIDATION BLOCK ---
18
+ // Normalize children to an array to handle both single items and collections safely
19
+ const childrenArray = Array.isArray(children) ? children : [children];
20
+
21
+ for (const child of childrenArray) {
22
+ // 1. Ensure the child is a real DOM node/element (ignore raw strings if they aren't allowed)
23
+ if (child instanceof HTMLElement) {
24
+ // Standard Check A: Using a custom class list or dataset identifier if GidsListItem sets one
25
+ const isGidsListItem =
26
+ child.classList.contains(classNameToBeValidated ?? '') ||
27
+ child.dataset.component === childrenNameToBeValidated;
28
+
29
+ // Standard Check B (Alternative): If GidsListItem returns a custom web component type instance
30
+ // const isGidsListItem = child.tagName.toLowerCase() === 'gids-list-item';
31
+
32
+ if (!isGidsListItem) {
33
+ throw new Error(
34
+ `DOM Validation Error: ${currentComponentName} only accepts ${childrenNameToBeValidated} nodes as children. ` +
35
+ `Received an element with class layout: "${child.className}".`,
36
+ );
37
+ }
38
+ } else {
39
+ // If a string or a non-element node was passed illegally
40
+ throw new Error(
41
+ `DOM Validation Error: Invalid type passed to children. Expected ${childrenNameToBeValidated} DOM elements.`,
42
+ );
43
+ }
44
+ }
45
+ // --- END OF VALIDATION BLOCK ---
46
+ }
47
+ };