@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,76 @@
1
+ import {
2
+ GidsCalendarYearListWebProps,
3
+ GidsCalendarYearListWebUtils,
4
+ } from '@ganpatiinfo/gids-web-shared';
5
+ import {
6
+ GidsCalendarYearListItemSelectEventDetail,
7
+ GidsMenuGroupType,
8
+ } from '@ganpatiinfo/gids-core-shared';
9
+
10
+ const { getGidsCalendarYearListClassNames, isValidFourDigitYear } =
11
+ GidsCalendarYearListWebUtils;
12
+
13
+ type GidsCalendarYearListElement = HTMLElement & {
14
+ type?: GidsMenuGroupType;
15
+ noOptionsText?: string;
16
+ disabledIndices?: number[];
17
+ selectedYear?: number;
18
+ divider?: boolean;
19
+ startYear?: number;
20
+ endYear?: number;
21
+ onSelectionYearChange?: (
22
+ detail: GidsCalendarYearListItemSelectEventDetail,
23
+ ) => void;
24
+ };
25
+
26
+ export interface GidsCalendarYearListDomProps extends GidsCalendarYearListWebProps {
27
+ extraClasses?: string;
28
+ }
29
+
30
+ export const GidsCalendarYearListDom = ({
31
+ type = 'default',
32
+ noOptionsText,
33
+ disabledIndices = [],
34
+ divider = false,
35
+ selectedYear,
36
+ startYear,
37
+ endYear,
38
+ onSelectionYearChange,
39
+ extraClasses,
40
+ }: GidsCalendarYearListDomProps): HTMLElement => {
41
+ const calendarYearList = document.createElement(
42
+ 'gids-calendar-year-list',
43
+ ) as GidsCalendarYearListElement;
44
+
45
+ calendarYearList.type = type;
46
+ if (noOptionsText) {
47
+ calendarYearList.noOptionsText = noOptionsText;
48
+ }
49
+ calendarYearList.disabledIndices = disabledIndices;
50
+ calendarYearList.divider = divider;
51
+ calendarYearList.selectedYear = selectedYear;
52
+
53
+ calendarYearList.className = getGidsCalendarYearListClassNames(extraClasses);
54
+
55
+ if (onSelectionYearChange) {
56
+ calendarYearList.onSelectionYearChange = onSelectionYearChange;
57
+ }
58
+
59
+ let newStartYear = 0;
60
+ let newEndYear = 0;
61
+ if (startYear && startYear > 0 && isValidFourDigitYear(startYear)) {
62
+ newStartYear = startYear;
63
+ } else {
64
+ newStartYear = new Date().getFullYear();
65
+ }
66
+ if (endYear && endYear > 0 && isValidFourDigitYear(endYear)) {
67
+ newEndYear = endYear;
68
+ } else {
69
+ newEndYear = newStartYear + 100;
70
+ }
71
+
72
+ calendarYearList.startYear = newStartYear;
73
+ calendarYearList.endYear = newEndYear;
74
+
75
+ return calendarYearList;
76
+ };
@@ -0,0 +1,41 @@
1
+ import {
2
+ GidsChartWebProps,
3
+ GidsChartWebUtils,
4
+ } from '@ganpatiinfo/gids-web-shared';
5
+
6
+ const { getGidsChartClassNames } = GidsChartWebUtils;
7
+
8
+ type GidsChartBaseWebProps = GidsChartWebProps;
9
+
10
+ type GidsChartElement = HTMLElement & GidsChartBaseWebProps;
11
+
12
+ export interface GidsChartDomProps extends GidsChartBaseWebProps {
13
+ extraClasses?: string;
14
+ }
15
+
16
+ export const GidsChartDom = ({
17
+ breakpoint = 'desktop',
18
+ chartType = 'line-chart',
19
+ lineChartProps,
20
+ barChartProps,
21
+ pieChartProps,
22
+ activityGaugeProps,
23
+ levelGaugeProps,
24
+ progressCircleProps,
25
+ extraClasses,
26
+ }: GidsChartDomProps): HTMLElement => {
27
+ const chart = document.createElement('gids-chart') as GidsChartElement;
28
+
29
+ chart.breakpoint = breakpoint;
30
+ chart.chartType = chartType;
31
+ chart.lineChartProps = lineChartProps;
32
+ chart.barChartProps = barChartProps;
33
+ chart.pieChartProps = pieChartProps;
34
+ chart.activityGaugeProps = activityGaugeProps;
35
+ chart.levelGaugeProps = levelGaugeProps;
36
+ chart.progressCircleProps = progressCircleProps;
37
+
38
+ chart.className = getGidsChartClassNames(extraClasses);
39
+
40
+ return chart;
41
+ };
@@ -0,0 +1,38 @@
1
+ import {
2
+ GidsChartLegendWebProps,
3
+ GidsChartLegendWebUtils,
4
+ } from '@ganpatiinfo/gids-web-shared';
5
+ import { appendAsChildren, DomChildren } from '../../utils/domUtils';
6
+
7
+ const { getGidsChartLegendClassNames } = GidsChartLegendWebUtils;
8
+
9
+ type GidsChartLegendElement = HTMLElement &
10
+ GidsChartLegendWebProps<DomChildren>;
11
+
12
+ export interface GidsChartLegendDomProps extends GidsChartLegendWebProps<DomChildren> {
13
+ children?: HTMLElement | HTMLElement[];
14
+ extraClasses?: string;
15
+ }
16
+
17
+ export const GidsChartLegendDom = ({
18
+ children,
19
+ orientation = 'horizontal',
20
+ extraClasses,
21
+ }: GidsChartLegendDomProps): HTMLElement => {
22
+ const chartLegend = document.createElement(
23
+ 'gids-chart-legend',
24
+ ) as GidsChartLegendElement;
25
+
26
+ if (children) {
27
+ appendAsChildren(chartLegend, children);
28
+ }
29
+
30
+ chartLegend.orientation = orientation;
31
+
32
+ chartLegend.className = getGidsChartLegendClassNames(
33
+ { orientation },
34
+ extraClasses,
35
+ );
36
+
37
+ return chartLegend;
38
+ };
@@ -0,0 +1,40 @@
1
+ import {
2
+ GidsChartLegendItemWebProps,
3
+ GidsChartLegendItemWebUtils,
4
+ } from '@ganpatiinfo/gids-web-shared';
5
+ import { appendAsChildren, DomChildren } from '../../utils/domUtils';
6
+
7
+ const { getGidsChartLegendItemClassNames } = GidsChartLegendItemWebUtils;
8
+
9
+ type GidsChartLegendItemElement = HTMLElement &
10
+ GidsChartLegendItemWebProps<DomChildren>;
11
+
12
+ export interface GidsChartLegendItemDomProps extends GidsChartLegendItemWebProps<DomChildren> {
13
+ children?: HTMLElement | HTMLElement[];
14
+ extraClasses?: string;
15
+ }
16
+
17
+ export const GidsChartLegendItemDom = ({
18
+ children,
19
+ seriesType = '1',
20
+ orientation = 'horizontal',
21
+ extraClasses,
22
+ }: GidsChartLegendItemDomProps): HTMLElement => {
23
+ const chartLegendItem = document.createElement(
24
+ 'gids-chart-legend-item',
25
+ ) as GidsChartLegendItemElement;
26
+
27
+ if (children) {
28
+ appendAsChildren(chartLegendItem, children);
29
+ }
30
+
31
+ chartLegendItem.seriesType = seriesType;
32
+ chartLegendItem.orientation = orientation;
33
+
34
+ chartLegendItem.className = getGidsChartLegendItemClassNames(
35
+ { seriesType, orientation },
36
+ extraClasses,
37
+ );
38
+
39
+ return chartLegendItem;
40
+ };
@@ -0,0 +1,55 @@
1
+ import {
2
+ GidsChevronButtonWebProps,
3
+ GidsChevronButtonWebUtils,
4
+ } from '@ganpatiinfo/gids-web-shared';
5
+ import { GidsButtonDomProps } from '../GidsButton/GidsButton';
6
+ import { GidsButtonSize } from '@ganpatiinfo/gids-core-shared';
7
+ // import { GidsIconDom } from '../GidsIcon/GidsIcon';
8
+
9
+ const { getGidsChevronButtonClassNames } = GidsChevronButtonWebUtils;
10
+
11
+ export interface GidsChevronButtonDomProps extends GidsChevronButtonWebProps {
12
+ extraClasses?: string;
13
+ gidsChevronButton?: (this: HTMLButtonElement, event: Event) => void;
14
+ }
15
+
16
+ type GidsChevronButtonElement = HTMLElement & {
17
+ size?: GidsButtonSize;
18
+ disabled?: boolean;
19
+ 'aria-label'?: string;
20
+ 'aria-expanded'?: string;
21
+ 'aria-haspopup'?: string;
22
+ 'aria-autocomplete'?: string;
23
+ 'aria-controls'?: string;
24
+ } & Pick<GidsButtonDomProps<'button'>, 'onClick'>;
25
+
26
+ export const GidsChevronButtonDom = ({
27
+ size = 'xs',
28
+ disabled,
29
+ gidsChevronButton,
30
+ extraClasses,
31
+ ariaLabel,
32
+ ariaHaspopup,
33
+ ariaExpanded,
34
+ ariaControls,
35
+ }: GidsChevronButtonDomProps): HTMLElement => {
36
+ const chevronButton = document.createElement(
37
+ 'gids-chevron-button',
38
+ ) as GidsChevronButtonElement;
39
+ chevronButton.className = getGidsChevronButtonClassNames(
40
+ { size },
41
+ extraClasses,
42
+ );
43
+
44
+ chevronButton.size = size;
45
+ chevronButton.disabled = disabled;
46
+ chevronButton['aria-label'] = ariaLabel ?? '';
47
+ chevronButton['aria-haspopup'] = ariaHaspopup ?? '';
48
+ chevronButton['aria-expanded'] = ariaExpanded ?? '';
49
+ chevronButton['aria-controls'] = ariaControls ?? '';
50
+ if (gidsChevronButton) {
51
+ chevronButton.addEventListener('click', gidsChevronButton);
52
+ }
53
+
54
+ return chevronButton;
55
+ };
@@ -0,0 +1,42 @@
1
+ import { GidsDotAppearance, GidsDotSize } from '@ganpatiinfo/gids-core-shared';
2
+ import { GidsDotWebProps, GidsDotWebUtils } from '@ganpatiinfo/gids-web-shared';
3
+
4
+ const { getGidsDotClassNames } = GidsDotWebUtils;
5
+
6
+ export interface GidsDotDomProps extends GidsDotWebProps {
7
+ extraClasses?: string;
8
+ }
9
+
10
+ type GidsDotElement = HTMLElement & {
11
+ appearance?: GidsDotAppearance;
12
+ size?: GidsDotSize;
13
+ disabled?: boolean;
14
+ };
15
+
16
+ export const GidsDotDom = ({
17
+ appearance = 'subtle',
18
+ disabled = false,
19
+ size = 'xs',
20
+ extraClasses,
21
+ }: GidsDotDomProps): HTMLElement => {
22
+ const dot = document.createElement('gids-dot') as GidsDotElement;
23
+ dot.className = getGidsDotClassNames(
24
+ { appearance, size, disabled },
25
+ extraClasses,
26
+ );
27
+
28
+ dot.setAttribute('appearance', appearance);
29
+ dot.setAttribute('size', size);
30
+
31
+ if (disabled) {
32
+ dot.setAttribute('disabled', '');
33
+ } else {
34
+ dot.removeAttribute('disabled');
35
+ }
36
+
37
+ dot.appearance = appearance;
38
+ dot.size = size;
39
+ dot.disabled = disabled;
40
+
41
+ return dot;
42
+ };
@@ -0,0 +1,149 @@
1
+ import {
2
+ type GidsDropdownChangeEventDetail,
3
+ type GidsInputAppearance,
4
+ } from '@ganpatiinfo/gids-core-shared';
5
+ import {
6
+ type GidsDropdownWebProps,
7
+ GidsDropdownWebUtils,
8
+ } from '@ganpatiinfo/gids-web-shared';
9
+ import {
10
+ appendAsChildren,
11
+ assignToSlot,
12
+ DomChildren,
13
+ } from '../../utils/domUtils.js';
14
+
15
+ const { getGidsDropdownClassNames } = GidsDropdownWebUtils;
16
+
17
+ type NativeInputForwardedProps = Partial<
18
+ Omit<HTMLInputElement, 'value' | 'readOnly' | 'name' | 'disabled'>
19
+ >;
20
+
21
+ type GidsDropdownInputA11yProps = NativeInputForwardedProps & {
22
+ role?: string | null;
23
+ 'aria-expanded'?: string;
24
+ 'aria-haspopup'?: string;
25
+ 'aria-autocomplete'?: string;
26
+ 'aria-controls'?: string;
27
+ };
28
+
29
+ export interface GidsDropdownToggleEventDetail {
30
+ expanded: boolean;
31
+ originalEvent?: Event;
32
+ }
33
+
34
+ type GidsDropdownElement = HTMLElement & {
35
+ appearance?: GidsInputAppearance;
36
+ expanded?: boolean;
37
+ inputProps?: NativeInputForwardedProps;
38
+ disabled?: boolean;
39
+ readOnly?: boolean;
40
+ loading?: boolean;
41
+ value?: string;
42
+ name?: string;
43
+ onSelectionChange?: (detail: GidsDropdownChangeEventDetail) => void;
44
+ required?: boolean;
45
+ };
46
+
47
+ export interface GidsDropdownDomProps extends GidsDropdownWebProps<
48
+ DomChildren,
49
+ NativeInputForwardedProps,
50
+ DomChildren
51
+ > {
52
+ children?: HTMLElement | HTMLElement[];
53
+ onToggle?: (detail: GidsDropdownToggleEventDetail) => void;
54
+ extraClasses?: string;
55
+ }
56
+
57
+ export const GidsDropdownDom = ({
58
+ appearance,
59
+ expanded,
60
+ loading = false,
61
+ leadingIcon,
62
+ value,
63
+ name,
64
+ disabled = false,
65
+ readOnly = false,
66
+ children,
67
+ onSelectionChange,
68
+ inputProps,
69
+ onToggle,
70
+ extraClasses,
71
+ required = false,
72
+ leadingAccessory,
73
+ }: GidsDropdownDomProps): HTMLElement => {
74
+ const dropdown = document.createElement(
75
+ 'gids-dropdown',
76
+ ) as GidsDropdownElement;
77
+
78
+ if (appearance) {
79
+ dropdown.appearance = appearance;
80
+ }
81
+ if (typeof expanded === 'boolean') {
82
+ dropdown.expanded = expanded;
83
+ }
84
+ dropdown.loading = loading;
85
+
86
+ if (leadingIcon) {
87
+ // @ts-expect-error expected err
88
+ assignToSlot(dropdown, 'leadingIconDropdown', leadingIcon);
89
+ }
90
+
91
+ if (leadingAccessory) {
92
+ // @ts-expect-error expected err
93
+ assignToSlot(dropdown, 'leadingAccessoryDropdown', leadingAccessory);
94
+ }
95
+
96
+ dropdown.disabled = disabled;
97
+ dropdown.readOnly = readOnly;
98
+ if (typeof value === 'string') {
99
+ dropdown.value = value;
100
+ }
101
+ if (name) {
102
+ dropdown.name = name;
103
+ }
104
+ dropdown.required = required;
105
+
106
+ const isInteractive = !(disabled || readOnly);
107
+ const isExpanded = Boolean(expanded) && isInteractive;
108
+ const hasMenuContent = children !== undefined;
109
+
110
+ const inputId =
111
+ typeof inputProps?.id === 'string' ? inputProps.id : undefined;
112
+ const menuId = typeof inputId === 'string' ? `${inputId}__menu` : undefined;
113
+ const inputPropsWithA11y: GidsDropdownInputA11yProps = {
114
+ ...(inputProps ?? {}),
115
+ };
116
+
117
+ if (hasMenuContent) {
118
+ inputPropsWithA11y.role = 'combobox';
119
+ inputPropsWithA11y['aria-expanded'] = isExpanded ? 'true' : 'false';
120
+ inputPropsWithA11y['aria-haspopup'] = 'listbox';
121
+ inputPropsWithA11y['aria-autocomplete'] = 'list';
122
+ if (typeof menuId === 'string') {
123
+ inputPropsWithA11y['aria-controls'] = menuId;
124
+ }
125
+ }
126
+
127
+ dropdown.className = getGidsDropdownClassNames(
128
+ { expanded: isExpanded },
129
+ extraClasses,
130
+ );
131
+
132
+ dropdown.inputProps = inputPropsWithA11y;
133
+
134
+ if (onSelectionChange) {
135
+ dropdown.onSelectionChange = onSelectionChange;
136
+ }
137
+
138
+ if (onToggle) {
139
+ dropdown.addEventListener('gidsDropdownToggle', (event: Event) => {
140
+ onToggle((event as CustomEvent<GidsDropdownToggleEventDetail>).detail);
141
+ });
142
+ }
143
+
144
+ if (children !== undefined && children !== null) {
145
+ appendAsChildren(dropdown, children);
146
+ }
147
+
148
+ return dropdown;
149
+ };
@@ -0,0 +1,106 @@
1
+ import {
2
+ GidsDropdownChangeEventDetail,
3
+ GidsInputAppearance,
4
+ } from '@ganpatiinfo/gids-core-shared';
5
+ import {
6
+ GidsDropdownFieldWebProps,
7
+ GidsDropdownFieldWebUtils,
8
+ GidsInputWebStatus,
9
+ GidsWebFieldStatus,
10
+ } from '@ganpatiinfo/gids-web-shared';
11
+ import { assignToSlot, DomChildren } from '../../utils/domUtils';
12
+
13
+ const { getGidsDropdownFieldClassNames } = GidsDropdownFieldWebUtils;
14
+
15
+ type NativeInputForwardedProps = Partial<
16
+ Omit<HTMLInputElement, 'value' | 'readOnly' | 'name' | 'disabled'>
17
+ >;
18
+
19
+ type GidsDropdownFieldElement = HTMLElement & {
20
+ label?: string;
21
+ helperText?: string;
22
+ statusText?: string;
23
+ status?: GidsWebFieldStatus;
24
+ appearance?: GidsInputAppearance;
25
+ expanded?: boolean;
26
+ inputProps?: NativeInputForwardedProps;
27
+ disabled?: boolean;
28
+ readOnly?: boolean;
29
+ loading?: boolean;
30
+ value?: string;
31
+ name?: string;
32
+ onSelectionChange?: (detail: GidsDropdownChangeEventDetail) => void;
33
+ required?: boolean;
34
+ state?: GidsInputWebStatus;
35
+ };
36
+
37
+ export interface GidsDropdownFieldDomProps extends GidsDropdownFieldWebProps<
38
+ DomChildren,
39
+ NativeInputForwardedProps,
40
+ DomChildren
41
+ > {
42
+ children?: HTMLElement | HTMLElement[];
43
+ extraClasses?: string;
44
+ }
45
+
46
+ export const GidsDropdownFieldDom = ({
47
+ label,
48
+ helperText,
49
+ statusText,
50
+ status,
51
+ appearance,
52
+ expanded,
53
+ inputProps,
54
+ disabled,
55
+ readOnly,
56
+ loading,
57
+ value,
58
+ name,
59
+ children,
60
+ onSelectionChange,
61
+ required,
62
+ state,
63
+ extraClasses,
64
+ leadingIcon,
65
+ leadingAccessory,
66
+ }: GidsDropdownFieldDomProps): HTMLElement => {
67
+ const dropdownField = document.createElement(
68
+ 'gids-dropdown-field',
69
+ ) as GidsDropdownFieldElement;
70
+
71
+ dropdownField.className = getGidsDropdownFieldClassNames(extraClasses);
72
+ dropdownField.label = label;
73
+ dropdownField.helperText = helperText;
74
+ dropdownField.statusText = statusText;
75
+ dropdownField.status = status;
76
+ dropdownField.appearance = appearance;
77
+ dropdownField.expanded = expanded;
78
+ dropdownField.inputProps = inputProps;
79
+ dropdownField.disabled = disabled;
80
+ dropdownField.readOnly = readOnly;
81
+ dropdownField.loading = loading;
82
+ dropdownField.value = value;
83
+ dropdownField.name = name;
84
+ const childrenNodes = children
85
+ ? (Array.isArray(children) ? children : [children]).filter(
86
+ (node): node is HTMLElement => node != null,
87
+ )
88
+ : [];
89
+ if (childrenNodes.length > 0) {
90
+ dropdownField.append(...childrenNodes);
91
+ }
92
+ dropdownField.onSelectionChange = onSelectionChange;
93
+ dropdownField.required = required;
94
+ dropdownField.state = state;
95
+ if (leadingIcon) {
96
+ // @ts-expect-error expected err
97
+ assignToSlot(dropdownField, 'leadingIconDropdown', leadingIcon);
98
+ }
99
+
100
+ if (leadingAccessory) {
101
+ // @ts-expect-error expected err
102
+ assignToSlot(dropdownField, 'leadingAccessoryDropdown', leadingAccessory);
103
+ }
104
+
105
+ return dropdownField;
106
+ };
@@ -0,0 +1,67 @@
1
+ import {
2
+ type GidsDropdownItemWebProps,
3
+ GidsDropdownItemWebUtils,
4
+ } from '@ganpatiinfo/gids-web-shared';
5
+ import { GidsListItemDom } from '../GidsListItem/GidsListItem.js';
6
+ import {
7
+ GidsDropdownItemSelectEventDetail,
8
+ GidsListItemSelectEventDetail,
9
+ } from '@ganpatiinfo/gids-core-shared';
10
+ import { DomChildren } from '../../utils/domUtils.js';
11
+
12
+ const { getGidsDropdownItemClassNames } = GidsDropdownItemWebUtils;
13
+
14
+ export interface GidsDropdownItemDomProps extends GidsDropdownItemWebProps<DomChildren> {
15
+ name?: string;
16
+ extraClasses?: string;
17
+ onPressDropdownItem?: (
18
+ event: CustomEvent<GidsDropdownItemSelectEventDetail>,
19
+ ) => void;
20
+ }
21
+
22
+ export const GidsDropdownItemDom = ({
23
+ id,
24
+ title,
25
+ selected = false,
26
+ disabled = false,
27
+ extraClasses,
28
+ name,
29
+ value,
30
+ onPressDropdownItem,
31
+ index,
32
+ defaultSelectedIndex,
33
+ leadingAccessory,
34
+ divider,
35
+ }: GidsDropdownItemDomProps): HTMLButtonElement => {
36
+ return GidsListItemDom({
37
+ id: id,
38
+ children: title,
39
+ index: index ?? 0,
40
+ defaultSelectedIndex,
41
+ selected,
42
+ disabled,
43
+ extraClasses: getGidsDropdownItemClassNames(extraClasses),
44
+ name,
45
+ leadingAccessory,
46
+ divider,
47
+ onPressListItem: (event: CustomEvent<GidsListItemSelectEventDetail>) => {
48
+ const customEvent = new CustomEvent<GidsDropdownItemSelectEventDetail>(
49
+ 'onPressDropdownItem',
50
+ {
51
+ bubbles: true,
52
+ composed: true,
53
+ detail: {
54
+ id,
55
+ title,
56
+ value,
57
+ disabled,
58
+ ...event.detail,
59
+ },
60
+ },
61
+ );
62
+ if (onPressDropdownItem) {
63
+ onPressDropdownItem(customEvent);
64
+ }
65
+ },
66
+ });
67
+ };
@@ -0,0 +1,43 @@
1
+ import {
2
+ type GidsDropdownMenuWebProps,
3
+ GidsDropdownMenuWebUtils,
4
+ } from '@ganpatiinfo/gids-web-shared';
5
+ import { appendAsChildren, DomChildren } from '../../utils/domUtils.js';
6
+ import { GidsHeadingDom } from '../GidsHeading/GidsHeading.js';
7
+
8
+ const { getGidsDropdownMenuClassNames } = GidsDropdownMenuWebUtils;
9
+
10
+ export interface GidsDropdownMenuDomProps extends GidsDropdownMenuWebProps<DomChildren> {
11
+ extraClasses?: string;
12
+ }
13
+
14
+ export const GidsDropdownMenuDom = ({
15
+ sectionLabel,
16
+ children,
17
+ extraClasses,
18
+ }: GidsDropdownMenuDomProps): HTMLDivElement => {
19
+ const dropdownMenu = document.createElement('div');
20
+ dropdownMenu.className = getGidsDropdownMenuClassNames(extraClasses);
21
+
22
+ if (
23
+ sectionLabel !== undefined &&
24
+ sectionLabel !== null &&
25
+ sectionLabel !== ''
26
+ ) {
27
+ dropdownMenu.append(
28
+ GidsHeadingDom({
29
+ supportingText: sectionLabel,
30
+ supportingTextTypography: 'eyebrow-medium',
31
+ }),
32
+ );
33
+ }
34
+
35
+ if (children !== undefined && children !== null) {
36
+ const childrenContainer = document.createElement('div');
37
+ childrenContainer.className = 'gids-dropdown-menu__children';
38
+ appendAsChildren(childrenContainer, children);
39
+ appendAsChildren(dropdownMenu, childrenContainer);
40
+ }
41
+
42
+ return dropdownMenu;
43
+ };