@ganpatiinfo/gids-web-dom-reference 8.0.0 → 9.1.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 (144) hide show
  1. package/CHANGELOG.md +71 -0
  2. package/dist/components/GidsActionBar/GidsActionBar.d.ts +8 -0
  3. package/dist/components/GidsActionBar/GidsActionBar.d.ts.map +1 -0
  4. package/dist/components/GidsActionBar/GidsActionBar.js +29 -0
  5. package/dist/components/GidsActionBar/GidsActionBar.js.map +1 -0
  6. package/dist/components/GidsActivityGauge/GidsActivityGauge.d.ts +8 -0
  7. package/dist/components/GidsActivityGauge/GidsActivityGauge.d.ts.map +1 -0
  8. package/dist/components/GidsActivityGauge/GidsActivityGauge.js +17 -0
  9. package/dist/components/GidsActivityGauge/GidsActivityGauge.js.map +1 -0
  10. package/dist/components/GidsBarChart/GidsBarChart.d.ts +6 -0
  11. package/dist/components/GidsBarChart/GidsBarChart.d.ts.map +1 -0
  12. package/dist/components/GidsBarChart/GidsBarChart.js +19 -0
  13. package/dist/components/GidsBarChart/GidsBarChart.js.map +1 -0
  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 +1 -1
  67. package/dist/components/GidsDropdownItem/GidsDropdownItem.d.ts.map +1 -1
  68. package/dist/components/GidsDropdownItem/GidsDropdownItem.js +8 -3
  69. package/dist/components/GidsDropdownItem/GidsDropdownItem.js.map +1 -1
  70. package/dist/components/GidsDropdownMenuGroup/GidsDropdownMenuGroup.d.ts +1 -1
  71. package/dist/components/GidsDropdownMenuGroup/GidsDropdownMenuGroup.d.ts.map +1 -1
  72. package/dist/components/GidsDropdownMenuGroup/GidsDropdownMenuGroup.js +15 -4
  73. package/dist/components/GidsDropdownMenuGroup/GidsDropdownMenuGroup.js.map +1 -1
  74. package/dist/components/GidsDropdownPicker/GidsDropdownPicker.d.ts +20 -0
  75. package/dist/components/GidsDropdownPicker/GidsDropdownPicker.d.ts.map +1 -0
  76. package/dist/components/GidsDropdownPicker/GidsDropdownPicker.js +62 -0
  77. package/dist/components/GidsDropdownPicker/GidsDropdownPicker.js.map +1 -0
  78. package/dist/components/GidsFilter/GidsFilter.d.ts +16 -0
  79. package/dist/components/GidsFilter/GidsFilter.d.ts.map +1 -0
  80. package/dist/components/GidsFilter/GidsFilter.js +49 -0
  81. package/dist/components/GidsFilter/GidsFilter.js.map +1 -0
  82. package/dist/components/GidsLevelGauge/GidsLevelGauge.d.ts +6 -0
  83. package/dist/components/GidsLevelGauge/GidsLevelGauge.d.ts.map +1 -0
  84. package/dist/components/GidsLevelGauge/GidsLevelGauge.js +17 -0
  85. package/dist/components/GidsLevelGauge/GidsLevelGauge.js.map +1 -0
  86. package/dist/components/GidsLineChart/GidsLineChart.d.ts +6 -0
  87. package/dist/components/GidsLineChart/GidsLineChart.d.ts.map +1 -0
  88. package/dist/components/GidsLineChart/GidsLineChart.js +19 -0
  89. package/dist/components/GidsLineChart/GidsLineChart.js.map +1 -0
  90. package/dist/components/GidsListItem/GidsListItem.d.ts.map +1 -1
  91. package/dist/components/GidsListItem/GidsListItem.js +30 -15
  92. package/dist/components/GidsListItem/GidsListItem.js.map +1 -1
  93. package/dist/components/GidsMenu/GidsMenu.d.ts.map +1 -1
  94. package/dist/components/GidsMenu/GidsMenu.js +0 -7
  95. package/dist/components/GidsMenu/GidsMenu.js.map +1 -1
  96. package/dist/components/GidsMenuGroup/GidsMenuGroup.d.ts.map +1 -1
  97. package/dist/components/GidsMenuGroup/GidsMenuGroup.js +0 -7
  98. package/dist/components/GidsMenuGroup/GidsMenuGroup.js.map +1 -1
  99. package/dist/components/GidsPageTitle/GidsPageTitle.d.ts +9 -0
  100. package/dist/components/GidsPageTitle/GidsPageTitle.d.ts.map +1 -0
  101. package/dist/components/GidsPageTitle/GidsPageTitle.js +32 -0
  102. package/dist/components/GidsPageTitle/GidsPageTitle.js.map +1 -0
  103. package/dist/components/GidsPieChart/GidsPieChart.d.ts +8 -0
  104. package/dist/components/GidsPieChart/GidsPieChart.d.ts.map +1 -0
  105. package/dist/components/GidsPieChart/GidsPieChart.js +16 -0
  106. package/dist/components/GidsPieChart/GidsPieChart.js.map +1 -0
  107. package/dist/components/GidsProgressCircle/GidsProgressCircle.d.ts +6 -0
  108. package/dist/components/GidsProgressCircle/GidsProgressCircle.d.ts.map +1 -0
  109. package/dist/components/GidsProgressCircle/GidsProgressCircle.js +17 -0
  110. package/dist/components/GidsProgressCircle/GidsProgressCircle.js.map +1 -0
  111. package/dist/index.d.ts +23 -0
  112. package/dist/index.d.ts.map +1 -1
  113. package/dist/index.js +23 -0
  114. package/dist/index.js.map +1 -1
  115. package/package.json +3 -3
  116. package/src/components/GidsActionBar/GidsActionBar.ts +67 -0
  117. package/src/components/GidsActivityGauge/GidsActivityGauge.ts +48 -0
  118. package/src/components/GidsBarChart/GidsBarChart.ts +47 -0
  119. package/src/components/GidsCalendar/GidsCalendar.ts +72 -0
  120. package/src/components/GidsCalendarCell/GidsCalendarCell.ts +95 -0
  121. package/src/components/GidsCalendarDayCell/GidsCalendarDayCell.ts +29 -0
  122. package/src/components/GidsCalendarHeaderPanel/GidsCalendarHeaderPanel.ts +107 -0
  123. package/src/components/GidsCalendarMonthList/GidsCalendarMonthList.ts +56 -0
  124. package/src/components/GidsCalendarYearList/GidsCalendarYearList.ts +76 -0
  125. package/src/components/GidsChart/GidsChart.ts +41 -0
  126. package/src/components/GidsChartLegend/GidsChartLegend.ts +38 -0
  127. package/src/components/GidsChartLegendItem/GidsChartLegendItem.ts +40 -0
  128. package/src/components/GidsChevronButton/GidsChevronButton.ts +55 -0
  129. package/src/components/GidsDot/GidsDot.ts +42 -0
  130. package/src/components/GidsDropdown/GidsDropdown.ts +149 -0
  131. package/src/components/GidsDropdownField/GidsDropdownField.ts +106 -0
  132. package/src/components/GidsDropdownItem/GidsDropdownItem.ts +11 -3
  133. package/src/components/GidsDropdownMenuGroup/GidsDropdownMenuGroup.ts +23 -3
  134. package/src/components/GidsDropdownPicker/GidsDropdownPicker.ts +144 -0
  135. package/src/components/GidsFilter/GidsFilter.ts +110 -0
  136. package/src/components/GidsLevelGauge/GidsLevelGauge.ts +46 -0
  137. package/src/components/GidsLineChart/GidsLineChart.ts +50 -0
  138. package/src/components/GidsListItem/GidsListItem.ts +39 -18
  139. package/src/components/GidsMenu/GidsMenu.ts +0 -8
  140. package/src/components/GidsMenuGroup/GidsMenuGroup.ts +0 -8
  141. package/src/components/GidsPageTitle/GidsPageTitle.ts +60 -0
  142. package/src/components/GidsPieChart/GidsPieChart.ts +43 -0
  143. package/src/components/GidsProgressCircle/GidsProgressCircle.ts +46 -0
  144. package/src/index.ts +23 -0
@@ -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
+ };
@@ -20,6 +20,7 @@ export interface GidsDropdownItemDomProps extends GidsDropdownItemWebProps<DomCh
20
20
  }
21
21
 
22
22
  export const GidsDropdownItemDom = ({
23
+ id,
23
24
  title,
24
25
  selected = false,
25
26
  disabled = false,
@@ -28,18 +29,23 @@ export const GidsDropdownItemDom = ({
28
29
  value,
29
30
  onPressDropdownItem,
30
31
  index,
31
- defaultSelectedIndex,
32
+ defaultSelected,
32
33
  leadingAccessory,
34
+ divider,
35
+ isPlaceholderItem,
33
36
  }: GidsDropdownItemDomProps): HTMLButtonElement => {
34
37
  return GidsListItemDom({
38
+ id: id,
35
39
  children: title,
36
- index,
37
- defaultSelectedIndex,
40
+ index: index ?? 0,
41
+ defaultSelected,
38
42
  selected,
39
43
  disabled,
40
44
  extraClasses: getGidsDropdownItemClassNames(extraClasses),
41
45
  name,
42
46
  leadingAccessory,
47
+ divider,
48
+ isPlaceholderItem,
43
49
  onPressListItem: (event: CustomEvent<GidsListItemSelectEventDetail>) => {
44
50
  const customEvent = new CustomEvent<GidsDropdownItemSelectEventDetail>(
45
51
  'onPressDropdownItem',
@@ -47,10 +53,12 @@ export const GidsDropdownItemDom = ({
47
53
  bubbles: true,
48
54
  composed: true,
49
55
  detail: {
56
+ id,
50
57
  title,
51
58
  value,
52
59
  disabled,
53
60
  ...event.detail,
61
+ isPlaceholderItem,
54
62
  },
55
63
  },
56
64
  );
@@ -3,6 +3,7 @@ import {
3
3
  GidsDropdownMenuGroupWebUtils,
4
4
  } from '@ganpatiinfo/gids-web-shared';
5
5
  import { appendAsChildren, DomChildren } from '../../utils/domUtils.js';
6
+ import { GidsSpinnerDom } from '../GidsSpinner/GidsSpinner.js';
6
7
 
7
8
  const { getGidsDropdownMenuGroupClassNames } = GidsDropdownMenuGroupWebUtils;
8
9
 
@@ -11,14 +12,33 @@ export interface GidsDropdownMenuGroupDomProps extends GidsDropdownMenuGroupWebP
11
12
  }
12
13
 
13
14
  export const GidsDropdownMenuGroupDom = ({
15
+ type = 'no-options',
16
+ supportingText = 'No options',
14
17
  children,
15
18
  extraClasses,
16
19
  }: GidsDropdownMenuGroupDomProps): HTMLDivElement => {
17
20
  const dropdownMenuGroup = document.createElement('div');
18
- dropdownMenuGroup.className =
19
- getGidsDropdownMenuGroupClassNames(extraClasses);
21
+ dropdownMenuGroup.className = getGidsDropdownMenuGroupClassNames(
22
+ { type },
23
+ extraClasses,
24
+ );
20
25
 
21
- if (children !== undefined && children !== null && children !== '') {
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) {
22
42
  appendAsChildren(dropdownMenuGroup, children);
23
43
  }
24
44
 
@@ -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,110 @@
1
+ import {
2
+ GidsFilterWebProps,
3
+ GidsFilterWebUtils,
4
+ } from '@ganpatiinfo/gids-web-shared';
5
+ import { appendAsChildren } from '../../utils/domUtils';
6
+ import { GidsFilterToggleEventDetail } from '@ganpatiinfo/gids-core-shared';
7
+
8
+ const { getGidsFilterClassNames } = GidsFilterWebUtils;
9
+
10
+ type GidsFilterA11yProps = {
11
+ role?: string | null;
12
+ 'aria-expanded'?: string;
13
+ 'aria-haspopup'?: string;
14
+ 'aria-controls'?: string;
15
+ };
16
+
17
+ type GidsFilterBaseWebProps = GidsFilterWebProps<
18
+ HTMLElement | HTMLElement[] | undefined
19
+ >;
20
+
21
+ type GidsFilterElement = HTMLElement &
22
+ GidsFilterA11yProps &
23
+ GidsFilterBaseWebProps & {
24
+ onToggle?: (detail: GidsFilterToggleEventDetail<Event>) => void;
25
+ };
26
+
27
+ export interface GidsFilterDomProps
28
+ extends GidsFilterBaseWebProps, GidsFilterA11yProps {
29
+ onToggle?: (detail: GidsFilterToggleEventDetail<Event>) => void;
30
+ extraClasses?: string;
31
+ }
32
+
33
+ export const GidsFilterDom = ({
34
+ name,
35
+ filterId,
36
+ filterPickerId,
37
+ expanded = false,
38
+ type = 'none',
39
+ value,
40
+ filterSelected = false,
41
+ filterDefaultSelected = false,
42
+ children,
43
+ filterItemType = 'primary',
44
+ disabled = false,
45
+ size = 'sm',
46
+ loading = false,
47
+ filterIndex = 0,
48
+ onFilterMenuItemChange,
49
+ onToggle,
50
+ extraClasses,
51
+ }: GidsFilterDomProps): HTMLElement => {
52
+ const filter = document.createElement('gids-filter') as GidsFilterElement;
53
+
54
+ filter.type = type;
55
+ filter.filterId = filterId;
56
+ filter.filterSelected = filterSelected;
57
+ filter.filterDefaultSelected = filterDefaultSelected;
58
+
59
+ if (typeof expanded === 'boolean') {
60
+ filter.expanded = expanded;
61
+ }
62
+ filter.loading = loading;
63
+
64
+ filter.disabled = disabled;
65
+ filter.size = size;
66
+ filter.filterItemType = filterItemType;
67
+ filter.filterIndex = filterIndex;
68
+ if (typeof value === 'string') {
69
+ filter.value = value;
70
+ }
71
+ if (name) {
72
+ filter.name = name;
73
+ }
74
+
75
+ const isInteractive = !disabled;
76
+ const isExpanded = Boolean(expanded) && isInteractive;
77
+ const hasMenuContent = children !== undefined && children !== null;
78
+
79
+ const pickerId =
80
+ typeof filterPickerId === 'string' ? filterPickerId : undefined;
81
+ const menuId = typeof pickerId === 'string' ? `${pickerId}__menu` : undefined;
82
+
83
+ if (hasMenuContent) {
84
+ filter.role = 'pickerbox';
85
+ filter['aria-expanded'] = isExpanded ? 'true' : 'false';
86
+ filter['aria-haspopup'] = 'pickerlistbox';
87
+ if (typeof menuId === 'string') {
88
+ filter['aria-controls'] = menuId;
89
+ }
90
+ }
91
+
92
+ filter.className = getGidsFilterClassNames(
93
+ { expanded: isExpanded },
94
+ extraClasses,
95
+ );
96
+
97
+ if (onFilterMenuItemChange) {
98
+ filter.onFilterMenuItemChange = onFilterMenuItemChange;
99
+ }
100
+
101
+ if (onToggle) {
102
+ filter.onToggle = onToggle;
103
+ }
104
+
105
+ if (children !== undefined && children !== null) {
106
+ appendAsChildren(filter, children);
107
+ }
108
+
109
+ return filter;
110
+ };
@@ -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
+ };