@ganpatiinfo/gids-web-dom-reference 7.2.0 → 9.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 (167) hide show
  1. package/CHANGELOG.md +96 -0
  2. package/dist/components/GidsActivityGauge/GidsActivityGauge.d.ts +8 -0
  3. package/dist/components/GidsActivityGauge/GidsActivityGauge.d.ts.map +1 -0
  4. package/dist/components/GidsActivityGauge/GidsActivityGauge.js +17 -0
  5. package/dist/components/GidsActivityGauge/GidsActivityGauge.js.map +1 -0
  6. package/dist/components/GidsBarChart/GidsBarChart.d.ts +6 -0
  7. package/dist/components/GidsBarChart/GidsBarChart.d.ts.map +1 -0
  8. package/dist/components/GidsBarChart/GidsBarChart.js +19 -0
  9. package/dist/components/GidsBarChart/GidsBarChart.js.map +1 -0
  10. package/dist/components/GidsButton/GidsButton.d.ts +1 -1
  11. package/dist/components/GidsButton/GidsButton.d.ts.map +1 -1
  12. package/dist/components/GidsButton/GidsButton.js +2 -2
  13. package/dist/components/GidsButton/GidsButton.js.map +1 -1
  14. package/dist/components/GidsCalendar/GidsCalendar.d.ts +6 -0
  15. package/dist/components/GidsCalendar/GidsCalendar.d.ts.map +1 -0
  16. package/dist/components/GidsCalendar/GidsCalendar.js +36 -0
  17. package/dist/components/GidsCalendar/GidsCalendar.js.map +1 -0
  18. package/dist/components/GidsCalendarCell/GidsCalendarCell.d.ts +8 -0
  19. package/dist/components/GidsCalendarCell/GidsCalendarCell.d.ts.map +1 -0
  20. package/dist/components/GidsCalendarCell/GidsCalendarCell.js +55 -0
  21. package/dist/components/GidsCalendarCell/GidsCalendarCell.js.map +1 -0
  22. package/dist/components/GidsCalendarDayCell/GidsCalendarDayCell.d.ts +6 -0
  23. package/dist/components/GidsCalendarDayCell/GidsCalendarDayCell.d.ts.map +1 -0
  24. package/dist/components/GidsCalendarDayCell/GidsCalendarDayCell.js +17 -0
  25. package/dist/components/GidsCalendarDayCell/GidsCalendarDayCell.js.map +1 -0
  26. package/dist/components/GidsCalendarHeaderPanel/GidsCalendarHeaderPanel.d.ts +13 -0
  27. package/dist/components/GidsCalendarHeaderPanel/GidsCalendarHeaderPanel.d.ts.map +1 -0
  28. package/dist/components/GidsCalendarHeaderPanel/GidsCalendarHeaderPanel.js +45 -0
  29. package/dist/components/GidsCalendarHeaderPanel/GidsCalendarHeaderPanel.js.map +1 -0
  30. package/dist/components/GidsCalendarMonthList/GidsCalendarMonthList.d.ts +6 -0
  31. package/dist/components/GidsCalendarMonthList/GidsCalendarMonthList.d.ts.map +1 -0
  32. package/dist/components/GidsCalendarMonthList/GidsCalendarMonthList.js +19 -0
  33. package/dist/components/GidsCalendarMonthList/GidsCalendarMonthList.js.map +1 -0
  34. package/dist/components/GidsCalendarYearList/GidsCalendarYearList.d.ts +6 -0
  35. package/dist/components/GidsCalendarYearList/GidsCalendarYearList.d.ts.map +1 -0
  36. package/dist/components/GidsCalendarYearList/GidsCalendarYearList.js +34 -0
  37. package/dist/components/GidsCalendarYearList/GidsCalendarYearList.js.map +1 -0
  38. package/dist/components/GidsChart/GidsChart.d.ts +8 -0
  39. package/dist/components/GidsChart/GidsChart.d.ts.map +1 -0
  40. package/dist/components/GidsChart/GidsChart.js +16 -0
  41. package/dist/components/GidsChart/GidsChart.js.map +1 -0
  42. package/dist/components/GidsChartLegend/GidsChartLegend.d.ts +8 -0
  43. package/dist/components/GidsChartLegend/GidsChartLegend.d.ts.map +1 -0
  44. package/dist/components/GidsChartLegend/GidsChartLegend.js +13 -0
  45. package/dist/components/GidsChartLegend/GidsChartLegend.js.map +1 -0
  46. package/dist/components/GidsChartLegendItem/GidsChartLegendItem.d.ts +8 -0
  47. package/dist/components/GidsChartLegendItem/GidsChartLegendItem.d.ts.map +1 -0
  48. package/dist/components/GidsChartLegendItem/GidsChartLegendItem.js +14 -0
  49. package/dist/components/GidsChartLegendItem/GidsChartLegendItem.js.map +1 -0
  50. package/dist/components/GidsChevronButton/GidsChevronButton.d.ts +7 -0
  51. package/dist/components/GidsChevronButton/GidsChevronButton.d.ts.map +1 -0
  52. package/dist/components/GidsChevronButton/GidsChevronButton.js +18 -0
  53. package/dist/components/GidsChevronButton/GidsChevronButton.js.map +1 -0
  54. package/dist/components/GidsDot/GidsDot.d.ts +6 -0
  55. package/dist/components/GidsDot/GidsDot.d.ts.map +1 -0
  56. package/dist/components/GidsDot/GidsDot.js +19 -0
  57. package/dist/components/GidsDot/GidsDot.js.map +1 -0
  58. package/dist/components/GidsDropdown/GidsDropdown.d.ts +15 -0
  59. package/dist/components/GidsDropdown/GidsDropdown.d.ts.map +1 -0
  60. package/dist/components/GidsDropdown/GidsDropdown.js +62 -0
  61. package/dist/components/GidsDropdown/GidsDropdown.js.map +1 -0
  62. package/dist/components/GidsDropdownField/GidsDropdownField.d.ts +10 -0
  63. package/dist/components/GidsDropdownField/GidsDropdownField.d.ts.map +1 -0
  64. package/dist/components/GidsDropdownField/GidsDropdownField.js +38 -0
  65. package/dist/components/GidsDropdownField/GidsDropdownField.js.map +1 -0
  66. package/dist/components/GidsDropdownItem/GidsDropdownItem.d.ts +10 -0
  67. package/dist/components/GidsDropdownItem/GidsDropdownItem.d.ts.map +1 -0
  68. package/dist/components/GidsDropdownItem/GidsDropdownItem.js +34 -0
  69. package/dist/components/GidsDropdownItem/GidsDropdownItem.js.map +1 -0
  70. package/dist/components/GidsDropdownMenu/GidsDropdownMenu.d.ts +7 -0
  71. package/dist/components/GidsDropdownMenu/GidsDropdownMenu.d.ts.map +1 -0
  72. package/dist/components/GidsDropdownMenu/GidsDropdownMenu.js +24 -0
  73. package/dist/components/GidsDropdownMenu/GidsDropdownMenu.js.map +1 -0
  74. package/dist/components/GidsDropdownMenuGroup/GidsDropdownMenuGroup.d.ts +7 -0
  75. package/dist/components/GidsDropdownMenuGroup/GidsDropdownMenuGroup.d.ts.map +1 -0
  76. package/dist/components/GidsDropdownMenuGroup/GidsDropdownMenuGroup.js +24 -0
  77. package/dist/components/GidsDropdownMenuGroup/GidsDropdownMenuGroup.js.map +1 -0
  78. package/dist/components/GidsDropdownPicker/GidsDropdownPicker.d.ts +20 -0
  79. package/dist/components/GidsDropdownPicker/GidsDropdownPicker.d.ts.map +1 -0
  80. package/dist/components/GidsDropdownPicker/GidsDropdownPicker.js +62 -0
  81. package/dist/components/GidsDropdownPicker/GidsDropdownPicker.js.map +1 -0
  82. package/dist/components/GidsEditButton/GidsEditButton.d.ts +8 -0
  83. package/dist/components/GidsEditButton/GidsEditButton.d.ts.map +1 -0
  84. package/dist/components/GidsEditButton/GidsEditButton.js +44 -0
  85. package/dist/components/GidsEditButton/GidsEditButton.js.map +1 -0
  86. package/dist/components/GidsLevelGauge/GidsLevelGauge.d.ts +6 -0
  87. package/dist/components/GidsLevelGauge/GidsLevelGauge.d.ts.map +1 -0
  88. package/dist/components/GidsLevelGauge/GidsLevelGauge.js +17 -0
  89. package/dist/components/GidsLevelGauge/GidsLevelGauge.js.map +1 -0
  90. package/dist/components/GidsLineChart/GidsLineChart.d.ts +6 -0
  91. package/dist/components/GidsLineChart/GidsLineChart.d.ts.map +1 -0
  92. package/dist/components/GidsLineChart/GidsLineChart.js +19 -0
  93. package/dist/components/GidsLineChart/GidsLineChart.js.map +1 -0
  94. package/dist/components/GidsListItem/GidsListItem.d.ts +11 -0
  95. package/dist/components/GidsListItem/GidsListItem.d.ts.map +1 -0
  96. package/dist/components/GidsListItem/GidsListItem.js +207 -0
  97. package/dist/components/GidsListItem/GidsListItem.js.map +1 -0
  98. package/dist/components/GidsMenu/GidsMenu.d.ts +7 -0
  99. package/dist/components/GidsMenu/GidsMenu.d.ts.map +1 -0
  100. package/dist/components/GidsMenu/GidsMenu.js +27 -0
  101. package/dist/components/GidsMenu/GidsMenu.js.map +1 -0
  102. package/dist/components/GidsMenuGroup/GidsMenuGroup.d.ts +7 -0
  103. package/dist/components/GidsMenuGroup/GidsMenuGroup.d.ts.map +1 -0
  104. package/dist/components/GidsMenuGroup/GidsMenuGroup.js +24 -0
  105. package/dist/components/GidsMenuGroup/GidsMenuGroup.js.map +1 -0
  106. package/dist/components/GidsPageTitle/GidsPageTitle.d.ts +9 -0
  107. package/dist/components/GidsPageTitle/GidsPageTitle.d.ts.map +1 -0
  108. package/dist/components/GidsPageTitle/GidsPageTitle.js +32 -0
  109. package/dist/components/GidsPageTitle/GidsPageTitle.js.map +1 -0
  110. package/dist/components/GidsPieChart/GidsPieChart.d.ts +8 -0
  111. package/dist/components/GidsPieChart/GidsPieChart.d.ts.map +1 -0
  112. package/dist/components/GidsPieChart/GidsPieChart.js +16 -0
  113. package/dist/components/GidsPieChart/GidsPieChart.js.map +1 -0
  114. package/dist/components/GidsPopover/GidsPopover.d.ts +7 -0
  115. package/dist/components/GidsPopover/GidsPopover.d.ts.map +1 -0
  116. package/dist/components/GidsPopover/GidsPopover.js +16 -0
  117. package/dist/components/GidsPopover/GidsPopover.js.map +1 -0
  118. package/dist/components/GidsProgressCircle/GidsProgressCircle.d.ts +6 -0
  119. package/dist/components/GidsProgressCircle/GidsProgressCircle.d.ts.map +1 -0
  120. package/dist/components/GidsProgressCircle/GidsProgressCircle.js +17 -0
  121. package/dist/components/GidsProgressCircle/GidsProgressCircle.js.map +1 -0
  122. package/dist/components/GidsTooltip/GidsTooltip.d.ts +6 -0
  123. package/dist/components/GidsTooltip/GidsTooltip.d.ts.map +1 -0
  124. package/dist/components/GidsTooltip/GidsTooltip.js +20 -0
  125. package/dist/components/GidsTooltip/GidsTooltip.js.map +1 -0
  126. package/dist/index.d.ts +31 -0
  127. package/dist/index.d.ts.map +1 -1
  128. package/dist/index.js +31 -0
  129. package/dist/index.js.map +1 -1
  130. package/dist/utils/childrenValidationUtils.d.ts +9 -0
  131. package/dist/utils/childrenValidationUtils.d.ts.map +1 -0
  132. package/dist/utils/childrenValidationUtils.js +27 -0
  133. package/dist/utils/childrenValidationUtils.js.map +1 -0
  134. package/package.json +45 -45
  135. package/src/components/GidsActivityGauge/GidsActivityGauge.ts +48 -0
  136. package/src/components/GidsBarChart/GidsBarChart.ts +47 -0
  137. package/src/components/GidsButton/GidsButton.ts +2 -1
  138. package/src/components/GidsCalendar/GidsCalendar.ts +72 -0
  139. package/src/components/GidsCalendarCell/GidsCalendarCell.ts +95 -0
  140. package/src/components/GidsCalendarDayCell/GidsCalendarDayCell.ts +29 -0
  141. package/src/components/GidsCalendarHeaderPanel/GidsCalendarHeaderPanel.ts +107 -0
  142. package/src/components/GidsCalendarMonthList/GidsCalendarMonthList.ts +56 -0
  143. package/src/components/GidsCalendarYearList/GidsCalendarYearList.ts +76 -0
  144. package/src/components/GidsChart/GidsChart.ts +41 -0
  145. package/src/components/GidsChartLegend/GidsChartLegend.ts +38 -0
  146. package/src/components/GidsChartLegendItem/GidsChartLegendItem.ts +40 -0
  147. package/src/components/GidsChevronButton/GidsChevronButton.ts +55 -0
  148. package/src/components/GidsDot/GidsDot.ts +42 -0
  149. package/src/components/GidsDropdown/GidsDropdown.ts +149 -0
  150. package/src/components/GidsDropdownField/GidsDropdownField.ts +106 -0
  151. package/src/components/GidsDropdownItem/GidsDropdownItem.ts +67 -0
  152. package/src/components/GidsDropdownMenu/GidsDropdownMenu.ts +43 -0
  153. package/src/components/GidsDropdownMenuGroup/GidsDropdownMenuGroup.ts +46 -0
  154. package/src/components/GidsDropdownPicker/GidsDropdownPicker.ts +144 -0
  155. package/src/components/GidsEditButton/GidsEditButton.ts +71 -0
  156. package/src/components/GidsLevelGauge/GidsLevelGauge.ts +46 -0
  157. package/src/components/GidsLineChart/GidsLineChart.ts +50 -0
  158. package/src/components/GidsListItem/GidsListItem.ts +293 -0
  159. package/src/components/GidsMenu/GidsMenu.ts +56 -0
  160. package/src/components/GidsMenuGroup/GidsMenuGroup.ts +43 -0
  161. package/src/components/GidsPageTitle/GidsPageTitle.ts +60 -0
  162. package/src/components/GidsPieChart/GidsPieChart.ts +43 -0
  163. package/src/components/GidsPopover/GidsPopover.ts +32 -0
  164. package/src/components/GidsProgressCircle/GidsProgressCircle.ts +46 -0
  165. package/src/components/GidsTooltip/GidsTooltip.ts +37 -0
  166. package/src/index.ts +31 -0
  167. package/src/utils/childrenValidationUtils.ts +47 -0
@@ -0,0 +1,46 @@
1
+ import {
2
+ GidsDropdownMenuGroupWebProps,
3
+ GidsDropdownMenuGroupWebUtils,
4
+ } from '@ganpatiinfo/gids-web-shared';
5
+ import { appendAsChildren, DomChildren } from '../../utils/domUtils.js';
6
+ import { GidsSpinnerDom } from '../GidsSpinner/GidsSpinner.js';
7
+
8
+ const { getGidsDropdownMenuGroupClassNames } = GidsDropdownMenuGroupWebUtils;
9
+
10
+ export interface GidsDropdownMenuGroupDomProps extends GidsDropdownMenuGroupWebProps<DomChildren> {
11
+ extraClasses?: string;
12
+ }
13
+
14
+ export const GidsDropdownMenuGroupDom = ({
15
+ type = 'no-options',
16
+ supportingText = 'No options',
17
+ children,
18
+ extraClasses,
19
+ }: GidsDropdownMenuGroupDomProps): HTMLDivElement => {
20
+ const dropdownMenuGroup = document.createElement('div');
21
+ dropdownMenuGroup.className = getGidsDropdownMenuGroupClassNames(
22
+ { type },
23
+ extraClasses,
24
+ );
25
+
26
+ if (type === 'loading') {
27
+ dropdownMenuGroup.append(
28
+ GidsSpinnerDom({
29
+ indeterminate: true,
30
+ size: 'md',
31
+ }),
32
+ );
33
+ }
34
+
35
+ if (type === 'no-options') {
36
+ const noOptionText = document.createElement('span');
37
+ noOptionText.textContent = supportingText;
38
+ appendAsChildren(dropdownMenuGroup, noOptionText);
39
+ }
40
+
41
+ if (type === 'default' && children !== undefined && children !== null) {
42
+ appendAsChildren(dropdownMenuGroup, children);
43
+ }
44
+
45
+ return dropdownMenuGroup;
46
+ };
@@ -0,0 +1,144 @@
1
+ import {
2
+ GidsButtonAppearance,
3
+ GidsButtonSize,
4
+ GidsDropdownPickerChangeEventDetail,
5
+ } from '@ganpatiinfo/gids-core-shared';
6
+ import {
7
+ GidsDropdownPickerWebProps,
8
+ GidsDropdownPickerWebUtils,
9
+ } from '@ganpatiinfo/gids-web-shared';
10
+ import {
11
+ appendAsChildren,
12
+ assignToSlot,
13
+ DomChildren,
14
+ } from '../../utils/domUtils.js';
15
+ import { GidsIconDom } from '../GidsIcon/GidsIcon.js';
16
+
17
+ const { getGidsDropdownPickerClassNames } = GidsDropdownPickerWebUtils;
18
+
19
+ type GidsDropdownPickerA11yProps = {
20
+ role?: string | null;
21
+ 'aria-expanded'?: string;
22
+ 'aria-haspopup'?: string;
23
+ 'aria-controls'?: string;
24
+ };
25
+
26
+ export interface GidsDropdownPickerToggleEventDetail {
27
+ expanded: boolean;
28
+ originalEvent?: Event;
29
+ }
30
+
31
+ type GidsDropdownPickerElement = HTMLElement &
32
+ GidsDropdownPickerA11yProps & {
33
+ appearance?: GidsButtonAppearance;
34
+ expanded?: boolean;
35
+ disabled?: boolean;
36
+ loading?: boolean;
37
+ size?: GidsButtonSize;
38
+ leadingIcon?: DomChildren;
39
+ listLoading?: boolean;
40
+ value?: string;
41
+ name?: string;
42
+ leadingAccessory?: DomChildren;
43
+ onSelectionChange?: (detail: GidsDropdownPickerChangeEventDetail) => void;
44
+ };
45
+
46
+ export interface GidsDropdownPickerDomProps
47
+ extends
48
+ GidsDropdownPickerWebProps<DomChildren, DomChildren>,
49
+ GidsDropdownPickerA11yProps {
50
+ children?: HTMLElement | HTMLElement[];
51
+ onToggle?: (detail: GidsDropdownPickerToggleEventDetail) => void;
52
+ extraClasses?: string;
53
+ }
54
+
55
+ export const GidsDropdownPickerDom = ({
56
+ idPicker,
57
+ appearance = 'subtle',
58
+ expanded,
59
+ disabled = false,
60
+ loading = false,
61
+ value,
62
+ leadingIcon,
63
+ name,
64
+ onSelectionChange,
65
+ children,
66
+ onToggle,
67
+ size = 'sm',
68
+ extraClasses,
69
+ }: GidsDropdownPickerDomProps): HTMLElement => {
70
+ const dropdownPicker = document.createElement(
71
+ 'gids-dropdown-picker',
72
+ ) as GidsDropdownPickerElement;
73
+
74
+ if (appearance) {
75
+ dropdownPicker.appearance = appearance;
76
+ }
77
+ if (typeof expanded === 'boolean') {
78
+ dropdownPicker.expanded = expanded;
79
+ }
80
+ dropdownPicker.loading = loading;
81
+
82
+ if (leadingIcon) {
83
+ // @ts-expect-error expected err
84
+ assignToSlot(dropdownPicker, 'leadingIconDropdownPicker', leadingIcon);
85
+ } else {
86
+ const leadingIconCust = GidsIconDom({
87
+ name: 'chevron-down',
88
+ size: size,
89
+ appearance: 'regular',
90
+ alt: '',
91
+ });
92
+ assignToSlot(dropdownPicker, 'leadingIconDropdownPicker', leadingIconCust);
93
+ }
94
+ dropdownPicker.disabled = disabled;
95
+ dropdownPicker.size = size;
96
+ if (typeof value === 'string') {
97
+ dropdownPicker.value = value;
98
+ }
99
+ if (name) {
100
+ dropdownPicker.name = name;
101
+ }
102
+
103
+ const isInteractive = !disabled;
104
+ const isExpanded = Boolean(expanded) && isInteractive;
105
+ const hasMenuContent = children !== undefined;
106
+
107
+ const pickerId = typeof idPicker === 'string' ? idPicker : undefined;
108
+ const menuId = typeof pickerId === 'string' ? `${pickerId}__menu` : undefined;
109
+
110
+ if (hasMenuContent) {
111
+ dropdownPicker.role = 'pickerbox';
112
+ dropdownPicker['aria-expanded'] = isExpanded ? 'true' : 'false';
113
+ dropdownPicker['aria-haspopup'] = 'pickerlistbox';
114
+ if (typeof menuId === 'string') {
115
+ dropdownPicker['aria-controls'] = menuId;
116
+ }
117
+ }
118
+
119
+ dropdownPicker.className = getGidsDropdownPickerClassNames(
120
+ { expanded: isExpanded },
121
+ extraClasses,
122
+ );
123
+
124
+ if (onSelectionChange) {
125
+ dropdownPicker.onSelectionChange = onSelectionChange;
126
+ }
127
+
128
+ if (onToggle) {
129
+ dropdownPicker.addEventListener(
130
+ 'gidsDropdownPickerToggle',
131
+ (event: Event) => {
132
+ onToggle(
133
+ (event as CustomEvent<GidsDropdownPickerToggleEventDetail>).detail,
134
+ );
135
+ },
136
+ );
137
+ }
138
+
139
+ if (children !== undefined && children !== null) {
140
+ appendAsChildren(dropdownPicker, children);
141
+ }
142
+
143
+ return dropdownPicker;
144
+ };
@@ -0,0 +1,71 @@
1
+ import {
2
+ ClassValue,
3
+ GidsEditButtonWebProps,
4
+ GidsEditButtonWebUtils,
5
+ } from '@ganpatiinfo/gids-web-shared';
6
+ import { appendAsChildren, DomChildren } from '../../utils/domUtils.js';
7
+ import { GidsIconDom } from '../GidsIcon/GidsIcon';
8
+
9
+ const { getGidsEditButtonClassNames } = GidsEditButtonWebUtils;
10
+
11
+ export interface GidsEditButtonDomProps extends GidsEditButtonWebProps<DomChildren> {
12
+ onPressEditButton?: (this: HTMLButtonElement, event: Event) => void;
13
+ extraClasses?: ClassValue;
14
+ }
15
+
16
+ export const GidsEditButtonDom = ({
17
+ disabled,
18
+ children,
19
+ size = 'md',
20
+ editButtonType = 'add',
21
+ onPressEditButton,
22
+ extraClasses,
23
+ }: GidsEditButtonDomProps): HTMLButtonElement => {
24
+ const editButton = document.createElement('button');
25
+ editButton.className = getGidsEditButtonClassNames({ size }, extraClasses);
26
+
27
+ if (disabled) {
28
+ editButton.setAttribute('disabled', '');
29
+ } else {
30
+ editButton.removeAttribute('disabled');
31
+ }
32
+
33
+ const btnIconContainer = document.createElement('div');
34
+ if (editButtonType === 'custom' && children) {
35
+ appendAsChildren(btnIconContainer, children);
36
+ }
37
+
38
+ if (editButtonType === 'add') {
39
+ btnIconContainer.className = disabled
40
+ ? 'gids-edit-button__add gids-edit-button__disabled'
41
+ : 'gids-edit-button__add';
42
+ btnIconContainer.append(
43
+ GidsIconDom({
44
+ name: 'add',
45
+ size: size,
46
+ appearance: 'filled',
47
+ }),
48
+ );
49
+ }
50
+
51
+ if (editButtonType === 'remove') {
52
+ btnIconContainer.className = disabled
53
+ ? 'gids-edit-button__remove gids-edit-button__disabled'
54
+ : 'gids-edit-button__remove';
55
+ btnIconContainer.append(
56
+ GidsIconDom({
57
+ name: 'remove',
58
+ appearance: 'filled',
59
+ size: size,
60
+ }),
61
+ );
62
+ }
63
+
64
+ editButton.appendChild(btnIconContainer);
65
+
66
+ if (onPressEditButton && !disabled) {
67
+ editButton.addEventListener('click', onPressEditButton);
68
+ }
69
+
70
+ return editButton;
71
+ };
@@ -0,0 +1,46 @@
1
+ import {
2
+ GidsLevelGaugeWebProps,
3
+ GidsLevelGaugeWebUtils,
4
+ } from '@ganpatiinfo/gids-web-shared';
5
+
6
+ const { getGidsLevelGaugeClassNames } = GidsLevelGaugeWebUtils;
7
+
8
+ type GidsLevelGaugeElement = HTMLElement & GidsLevelGaugeWebProps;
9
+
10
+ export interface GidsLevelGaugeDomProps extends GidsLevelGaugeWebProps {
11
+ extraClasses?: string;
12
+ }
13
+
14
+ export const GidsLevelGaugeDom = ({
15
+ label,
16
+ color = 'amber',
17
+ value = 0,
18
+ breakpoint = 'desktop',
19
+ chartLoading = false,
20
+ chartLoaderSize,
21
+ chartLoadingSupportingText,
22
+ chartLoadingTitle,
23
+ size = 'xxs',
24
+ extraClasses,
25
+ }: GidsLevelGaugeDomProps): HTMLElement => {
26
+ const levelGauge = document.createElement(
27
+ 'gids-level-gauge',
28
+ ) as GidsLevelGaugeElement;
29
+
30
+ levelGauge.breakpoint = breakpoint;
31
+ levelGauge.size = size;
32
+ levelGauge.label = label;
33
+ levelGauge.value = value;
34
+ levelGauge.color = color;
35
+ levelGauge.chartLoading = chartLoading;
36
+ levelGauge.chartLoaderSize = chartLoaderSize;
37
+ levelGauge.chartLoadingTitle = chartLoadingTitle;
38
+ levelGauge.chartLoadingSupportingText = chartLoadingSupportingText;
39
+
40
+ levelGauge.className = getGidsLevelGaugeClassNames(
41
+ { breakpoint },
42
+ extraClasses,
43
+ );
44
+
45
+ return levelGauge;
46
+ };
@@ -0,0 +1,50 @@
1
+ import {
2
+ GidsLineChartWebProps,
3
+ GidsLineChartWebUtils,
4
+ } from '@ganpatiinfo/gids-web-shared';
5
+
6
+ const { getGidsLineChartClassNames } = GidsLineChartWebUtils;
7
+
8
+ type GidsLineChartElement = HTMLElement & GidsLineChartWebProps;
9
+
10
+ export interface GidsLineChartDomProps extends GidsLineChartWebProps {
11
+ extraClasses?: string;
12
+ }
13
+
14
+ export const GidsLineChartDom = ({
15
+ breakpoint = 'desktop',
16
+ legend = 'none',
17
+ chartData = [],
18
+ yAxisVisible = false,
19
+ xAxisLabel,
20
+ yAxisLabel,
21
+ dataPoints,
22
+ chartLoading,
23
+ chartLoaderSize,
24
+ chartLoadingTitle,
25
+ chartLoadingSupportingText,
26
+ extraClasses,
27
+ }: GidsLineChartDomProps): HTMLElement => {
28
+ const lineChart = document.createElement(
29
+ 'gids-line-chart',
30
+ ) as GidsLineChartElement;
31
+
32
+ lineChart.breakpoint = breakpoint;
33
+ lineChart.legend = legend;
34
+ lineChart.chartData = chartData;
35
+ lineChart.yAxisVisible = yAxisVisible;
36
+ lineChart.xAxisLabel = xAxisLabel;
37
+ lineChart.yAxisLabel = yAxisLabel;
38
+ lineChart.dataPoints = dataPoints;
39
+ lineChart.chartLoading = chartLoading;
40
+ lineChart.chartLoaderSize = chartLoaderSize;
41
+ lineChart.chartLoadingTitle = chartLoadingTitle;
42
+ lineChart.chartLoadingSupportingText = chartLoadingSupportingText;
43
+
44
+ lineChart.className = getGidsLineChartClassNames(
45
+ { breakpoint },
46
+ extraClasses,
47
+ );
48
+
49
+ return lineChart;
50
+ };
@@ -0,0 +1,293 @@
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
+ id,
35
+ index,
36
+ defaultSelectedIndex,
37
+ children,
38
+ disabled = false,
39
+ selected,
40
+ editButton,
41
+ onPressEditButton,
42
+ onPressListItem,
43
+ leadingAccessory,
44
+ leadingSupport,
45
+ leadingParagraph,
46
+ trailingContent,
47
+ trailingAccessory,
48
+ trailingSupport,
49
+ trailingParagraph,
50
+ divider,
51
+ extraClasses,
52
+ name,
53
+ value,
54
+ } = props;
55
+
56
+ const listItem = document.createElement('button');
57
+ listItem.type = 'button';
58
+ listItem.className = getGidsListItemClassNames(
59
+ { disabled, selected },
60
+ extraClasses,
61
+ );
62
+ listItem.setAttribute('role', 'list-item-option');
63
+ listItem.setAttribute('aria-selected', selected ? 'true' : 'false');
64
+ listItem.setAttribute('id', id);
65
+ listItem.disabled = disabled;
66
+ if (name) {
67
+ listItem.name = name;
68
+ }
69
+
70
+ const mainContainer = document.createElement('div');
71
+ mainContainer.className = 'gids-list-item__main-container';
72
+
73
+ if (
74
+ editButton !== undefined &&
75
+ editButton !== null &&
76
+ editButton !== 'none' &&
77
+ !disabled
78
+ ) {
79
+ const editButtonNode = GidsEditButtonDom({
80
+ size: 'md',
81
+ editButtonType: editButton,
82
+ onPressEditButton,
83
+ });
84
+ // 2. Stop the event from bubbling up to mainContainer / listItem
85
+ editButtonNode.addEventListener('click', (event: MouseEvent) => {
86
+ event.stopPropagation();
87
+ });
88
+ mainContainer.append(editButtonNode);
89
+ }
90
+
91
+ if (leadingAccessory !== undefined && leadingAccessory !== null) {
92
+ const leadingAccessoryContainer = document.createElement('div');
93
+ leadingAccessoryContainer.className = disabled
94
+ ? 'gids-list-item__leading-accessory-container gids-list-item__accessory-content-disabled'
95
+ : 'gids-list-item__leading-accessory-container';
96
+ appendAsChildren(leadingAccessoryContainer, leadingAccessory);
97
+ appendAsChildren(mainContainer, leadingAccessoryContainer);
98
+ }
99
+
100
+ const middleContentContainer = document.createElement('div');
101
+ middleContentContainer.className = 'gids-list-item__middle-content-container';
102
+
103
+ const leadingContentContainer = document.createElement('div');
104
+ leadingContentContainer.className =
105
+ 'gids-list-item__leading-content-container';
106
+
107
+ if (children !== undefined && children !== null) {
108
+ const leadingLabel = document.createElement('span');
109
+ leadingLabel.className = disabled
110
+ ? 'gids-list-item__leading-content-label gids-list-item__text-content-disabled'
111
+ : 'gids-list-item__leading-content-label';
112
+ if (typeof children === 'string') {
113
+ leadingLabel.textContent = children;
114
+ } else {
115
+ appendAsChildren(leadingLabel, children);
116
+ }
117
+
118
+ appendAsChildren(leadingContentContainer, leadingLabel);
119
+ }
120
+
121
+ if (
122
+ (leadingSupport !== undefined && leadingSupport !== null) ||
123
+ (leadingParagraph !== undefined && leadingParagraph !== null)
124
+ ) {
125
+ const leadingSupportContent = document.createElement('div');
126
+ leadingSupportContent.className = 'gids-list-item__leading-support-content';
127
+
128
+ if (leadingSupport !== undefined && leadingSupport !== null) {
129
+ if (typeof leadingSupport === 'string') {
130
+ const leadingContentSupportingText = document.createElement('p');
131
+ leadingContentSupportingText.className = disabled
132
+ ? 'gids-list-item__leading-content-supporting-text gids-list-item__text-content-disabled'
133
+ : 'gids-list-item__leading-content-supporting-text';
134
+ leadingContentSupportingText.textContent = leadingSupport;
135
+
136
+ appendAsChildren(leadingSupportContent, leadingContentSupportingText);
137
+ } else {
138
+ appendAsChildren(leadingSupportContent, leadingSupport);
139
+ }
140
+ }
141
+
142
+ if (leadingParagraph !== undefined && leadingParagraph !== null) {
143
+ if (typeof leadingParagraph === 'string') {
144
+ const leadingContentParagraphText = document.createElement('p');
145
+ leadingContentParagraphText.className = disabled
146
+ ? 'gids-list-item__leading-content-paragraph-text gids-list-item__text-content-disabled'
147
+ : 'gids-list-item__leading-content-paragraph-text';
148
+ leadingContentParagraphText.textContent = leadingParagraph;
149
+
150
+ appendAsChildren(leadingSupportContent, leadingContentParagraphText);
151
+ } else {
152
+ appendAsChildren(leadingSupportContent, leadingParagraph);
153
+ }
154
+ }
155
+
156
+ appendAsChildren(leadingContentContainer, leadingSupportContent);
157
+ }
158
+
159
+ const trailingContentContainer = document.createElement('div');
160
+ trailingContentContainer.className =
161
+ 'gids-list-item__trailing-content-container';
162
+
163
+ if (trailingContent !== undefined && trailingContent !== null) {
164
+ if (typeof trailingContent === 'string') {
165
+ const trailingLabel = document.createElement('span');
166
+ trailingLabel.className = disabled
167
+ ? 'gids-list-item__trailing-content-label gids-list-item__text-content-disabled'
168
+ : 'gids-list-item__trailing-content-label';
169
+ trailingLabel.textContent = trailingContent;
170
+
171
+ appendAsChildren(trailingContentContainer, trailingLabel);
172
+ } else {
173
+ appendAsChildren(trailingContentContainer, trailingContent);
174
+ }
175
+ }
176
+
177
+ if (
178
+ (trailingSupport !== undefined && trailingSupport !== null) ||
179
+ (trailingParagraph !== undefined && trailingParagraph !== null)
180
+ ) {
181
+ const trailingSupportContent = document.createElement('div');
182
+ trailingSupportContent.className =
183
+ 'gids-list-item__trailing-support-content';
184
+
185
+ if (trailingSupport !== undefined && trailingSupport !== null) {
186
+ if (typeof trailingSupport === 'string') {
187
+ const trailingContentSupportingText = document.createElement('p');
188
+ trailingContentSupportingText.className = disabled
189
+ ? 'gids-list-item__trailing-content-supporting-text gids-list-item__text-content-disabled'
190
+ : 'gids-list-item__trailing-content-supporting-text';
191
+ trailingContentSupportingText.textContent = trailingSupport;
192
+
193
+ appendAsChildren(trailingSupportContent, trailingContentSupportingText);
194
+ } else {
195
+ appendAsChildren(trailingSupportContent, trailingSupport);
196
+ }
197
+ }
198
+
199
+ if (trailingParagraph !== undefined && trailingParagraph !== null) {
200
+ if (typeof trailingParagraph === 'string') {
201
+ const trailingContentParagraphText = document.createElement('p');
202
+ trailingContentParagraphText.className = disabled
203
+ ? 'gids-list-item__trailing-content-paragraph-text gids-list-item__text-content-disabled'
204
+ : 'gids-list-item__trailing-content-paragraph-text';
205
+ trailingContentParagraphText.textContent = trailingParagraph;
206
+
207
+ appendAsChildren(trailingSupportContent, trailingContentParagraphText);
208
+ } else {
209
+ appendAsChildren(trailingSupportContent, trailingParagraph);
210
+ }
211
+ }
212
+
213
+ appendAsChildren(trailingContentContainer, trailingSupportContent);
214
+ }
215
+
216
+ appendAsChildren(middleContentContainer, leadingContentContainer);
217
+ appendAsChildren(middleContentContainer, trailingContentContainer);
218
+ appendAsChildren(mainContainer, middleContentContainer);
219
+
220
+ const trailingAccessoryContainer = document.createElement('div');
221
+ trailingAccessoryContainer.className = disabled
222
+ ? 'gids-list-item__trailing-accessory-container gids-list-item__accessory-content-disabled'
223
+ : 'gids-list-item__trailing-accessory-container';
224
+ if (selected) {
225
+ trailingAccessoryContainer.append(
226
+ GidsIconDom({
227
+ name: 'checkmark',
228
+ size: 'md',
229
+ appearance: 'regular',
230
+ }),
231
+ );
232
+ appendAsChildren(mainContainer, trailingAccessoryContainer);
233
+ } else {
234
+ if (trailingAccessory !== undefined && trailingAccessory !== null) {
235
+ appendAsChildren(trailingAccessoryContainer, trailingAccessory);
236
+ appendAsChildren(mainContainer, trailingAccessoryContainer);
237
+ }
238
+ }
239
+
240
+ appendAsChildren(listItem, mainContainer);
241
+ if (divider && !selected) {
242
+ const dividerWrapper = document.createElement('div');
243
+ dividerWrapper.className = 'gids-list-item__divider';
244
+
245
+ dividerWrapper.append(
246
+ GidsDividerDom({
247
+ orientation: 'horizontal',
248
+ }),
249
+ );
250
+
251
+ appendAsChildren(listItem, dividerWrapper);
252
+ }
253
+
254
+ // --- ADD THIS CODE BLOCK BEFORE THE END OF THE FUNCTION ---
255
+ if (onPressListItem) {
256
+ listItem.addEventListener('click', (event: MouseEvent) => {
257
+ if (event?.defaultPrevented || disabled) {
258
+ return;
259
+ }
260
+ // Create a CustomEvent containing your specific detail payload
261
+ const customEvent = new CustomEvent<GidsListItemSelectEventDetail>(
262
+ 'onPressListItem',
263
+ {
264
+ bubbles: true,
265
+ composed: true,
266
+ detail: {
267
+ selectedIndex: index,
268
+ defaultSelectedIndex, // Toggles or passes current state
269
+ },
270
+ },
271
+ );
272
+
273
+ // If your Storybook/wrapper expects the custom event directly in the callback:
274
+ onPressListItem(customEvent);
275
+ });
276
+ }
277
+
278
+ let newValue: DomNodeOrString | undefined = value;
279
+ if (children) {
280
+ newValue = children;
281
+ }
282
+
283
+ if (typeof newValue === 'string') {
284
+ listItem.value = newValue;
285
+ } else {
286
+ const textContent = newValue?.textContent;
287
+ if (textContent) {
288
+ listItem.value = textContent;
289
+ }
290
+ }
291
+
292
+ return listItem;
293
+ };
@@ -0,0 +1,56 @@
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
+
12
+ const { getGidsMenuClassNames } = GidsMenuWebUtils;
13
+
14
+ export interface GidsMenuDomProps extends GidsMenuWebProps<
15
+ DomChildren,
16
+ DomNodeOrString
17
+ > {
18
+ extraClasses?: string;
19
+ }
20
+
21
+ export const GidsMenuDom = ({
22
+ children,
23
+ extraClasses,
24
+ heading,
25
+ supportingText,
26
+ supportingTextTypography,
27
+ ...restProps
28
+ }: GidsMenuDomProps): HTMLDivElement => {
29
+ const menu = document.createElement('div');
30
+ menu.className = getGidsMenuClassNames(extraClasses);
31
+
32
+ if (
33
+ (heading !== undefined && heading !== null && heading !== '') ||
34
+ (supportingText !== undefined &&
35
+ supportingText !== null &&
36
+ supportingText !== '')
37
+ ) {
38
+ menu.append(
39
+ GidsHeadingDom({
40
+ heading,
41
+ supportingText,
42
+ supportingTextTypography: supportingTextTypography ?? 'eyebrow-medium',
43
+ ...restProps,
44
+ }),
45
+ );
46
+ }
47
+
48
+ if (children !== undefined && children !== null) {
49
+ const childrenContainer = document.createElement('div');
50
+ childrenContainer.className = 'gids-menu__children';
51
+ appendAsChildren(childrenContainer, children);
52
+ appendAsChildren(menu, childrenContainer);
53
+ }
54
+
55
+ return menu;
56
+ };