@ganpatiinfo/gids-web-dom-reference 8.0.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.
- package/CHANGELOG.md +57 -0
- package/dist/components/GidsActivityGauge/GidsActivityGauge.d.ts +8 -0
- package/dist/components/GidsActivityGauge/GidsActivityGauge.d.ts.map +1 -0
- package/dist/components/GidsActivityGauge/GidsActivityGauge.js +17 -0
- package/dist/components/GidsActivityGauge/GidsActivityGauge.js.map +1 -0
- package/dist/components/GidsBarChart/GidsBarChart.d.ts +6 -0
- package/dist/components/GidsBarChart/GidsBarChart.d.ts.map +1 -0
- package/dist/components/GidsBarChart/GidsBarChart.js +19 -0
- package/dist/components/GidsBarChart/GidsBarChart.js.map +1 -0
- package/dist/components/GidsCalendar/GidsCalendar.d.ts +6 -0
- package/dist/components/GidsCalendar/GidsCalendar.d.ts.map +1 -0
- package/dist/components/GidsCalendar/GidsCalendar.js +36 -0
- package/dist/components/GidsCalendar/GidsCalendar.js.map +1 -0
- package/dist/components/GidsCalendarCell/GidsCalendarCell.d.ts +8 -0
- package/dist/components/GidsCalendarCell/GidsCalendarCell.d.ts.map +1 -0
- package/dist/components/GidsCalendarCell/GidsCalendarCell.js +55 -0
- package/dist/components/GidsCalendarCell/GidsCalendarCell.js.map +1 -0
- package/dist/components/GidsCalendarDayCell/GidsCalendarDayCell.d.ts +6 -0
- package/dist/components/GidsCalendarDayCell/GidsCalendarDayCell.d.ts.map +1 -0
- package/dist/components/GidsCalendarDayCell/GidsCalendarDayCell.js +17 -0
- package/dist/components/GidsCalendarDayCell/GidsCalendarDayCell.js.map +1 -0
- package/dist/components/GidsCalendarHeaderPanel/GidsCalendarHeaderPanel.d.ts +13 -0
- package/dist/components/GidsCalendarHeaderPanel/GidsCalendarHeaderPanel.d.ts.map +1 -0
- package/dist/components/GidsCalendarHeaderPanel/GidsCalendarHeaderPanel.js +45 -0
- package/dist/components/GidsCalendarHeaderPanel/GidsCalendarHeaderPanel.js.map +1 -0
- package/dist/components/GidsCalendarMonthList/GidsCalendarMonthList.d.ts +6 -0
- package/dist/components/GidsCalendarMonthList/GidsCalendarMonthList.d.ts.map +1 -0
- package/dist/components/GidsCalendarMonthList/GidsCalendarMonthList.js +19 -0
- package/dist/components/GidsCalendarMonthList/GidsCalendarMonthList.js.map +1 -0
- package/dist/components/GidsCalendarYearList/GidsCalendarYearList.d.ts +6 -0
- package/dist/components/GidsCalendarYearList/GidsCalendarYearList.d.ts.map +1 -0
- package/dist/components/GidsCalendarYearList/GidsCalendarYearList.js +34 -0
- package/dist/components/GidsCalendarYearList/GidsCalendarYearList.js.map +1 -0
- package/dist/components/GidsChart/GidsChart.d.ts +8 -0
- package/dist/components/GidsChart/GidsChart.d.ts.map +1 -0
- package/dist/components/GidsChart/GidsChart.js +16 -0
- package/dist/components/GidsChart/GidsChart.js.map +1 -0
- package/dist/components/GidsChartLegend/GidsChartLegend.d.ts +8 -0
- package/dist/components/GidsChartLegend/GidsChartLegend.d.ts.map +1 -0
- package/dist/components/GidsChartLegend/GidsChartLegend.js +13 -0
- package/dist/components/GidsChartLegend/GidsChartLegend.js.map +1 -0
- package/dist/components/GidsChartLegendItem/GidsChartLegendItem.d.ts +8 -0
- package/dist/components/GidsChartLegendItem/GidsChartLegendItem.d.ts.map +1 -0
- package/dist/components/GidsChartLegendItem/GidsChartLegendItem.js +14 -0
- package/dist/components/GidsChartLegendItem/GidsChartLegendItem.js.map +1 -0
- package/dist/components/GidsChevronButton/GidsChevronButton.d.ts +7 -0
- package/dist/components/GidsChevronButton/GidsChevronButton.d.ts.map +1 -0
- package/dist/components/GidsChevronButton/GidsChevronButton.js +18 -0
- package/dist/components/GidsChevronButton/GidsChevronButton.js.map +1 -0
- package/dist/components/GidsDot/GidsDot.d.ts +6 -0
- package/dist/components/GidsDot/GidsDot.d.ts.map +1 -0
- package/dist/components/GidsDot/GidsDot.js +19 -0
- package/dist/components/GidsDot/GidsDot.js.map +1 -0
- package/dist/components/GidsDropdown/GidsDropdown.d.ts +15 -0
- package/dist/components/GidsDropdown/GidsDropdown.d.ts.map +1 -0
- package/dist/components/GidsDropdown/GidsDropdown.js +62 -0
- package/dist/components/GidsDropdown/GidsDropdown.js.map +1 -0
- package/dist/components/GidsDropdownField/GidsDropdownField.d.ts +10 -0
- package/dist/components/GidsDropdownField/GidsDropdownField.d.ts.map +1 -0
- package/dist/components/GidsDropdownField/GidsDropdownField.js +38 -0
- package/dist/components/GidsDropdownField/GidsDropdownField.js.map +1 -0
- package/dist/components/GidsDropdownItem/GidsDropdownItem.d.ts +1 -1
- package/dist/components/GidsDropdownItem/GidsDropdownItem.d.ts.map +1 -1
- package/dist/components/GidsDropdownItem/GidsDropdownItem.js +5 -2
- package/dist/components/GidsDropdownItem/GidsDropdownItem.js.map +1 -1
- package/dist/components/GidsDropdownMenuGroup/GidsDropdownMenuGroup.d.ts +1 -1
- package/dist/components/GidsDropdownMenuGroup/GidsDropdownMenuGroup.d.ts.map +1 -1
- package/dist/components/GidsDropdownMenuGroup/GidsDropdownMenuGroup.js +15 -4
- package/dist/components/GidsDropdownMenuGroup/GidsDropdownMenuGroup.js.map +1 -1
- package/dist/components/GidsDropdownPicker/GidsDropdownPicker.d.ts +20 -0
- package/dist/components/GidsDropdownPicker/GidsDropdownPicker.d.ts.map +1 -0
- package/dist/components/GidsDropdownPicker/GidsDropdownPicker.js +62 -0
- package/dist/components/GidsDropdownPicker/GidsDropdownPicker.js.map +1 -0
- package/dist/components/GidsLevelGauge/GidsLevelGauge.d.ts +6 -0
- package/dist/components/GidsLevelGauge/GidsLevelGauge.d.ts.map +1 -0
- package/dist/components/GidsLevelGauge/GidsLevelGauge.js +17 -0
- package/dist/components/GidsLevelGauge/GidsLevelGauge.js.map +1 -0
- package/dist/components/GidsLineChart/GidsLineChart.d.ts +6 -0
- package/dist/components/GidsLineChart/GidsLineChart.d.ts.map +1 -0
- package/dist/components/GidsLineChart/GidsLineChart.js +19 -0
- package/dist/components/GidsLineChart/GidsLineChart.js.map +1 -0
- package/dist/components/GidsListItem/GidsListItem.d.ts.map +1 -1
- package/dist/components/GidsListItem/GidsListItem.js +21 -10
- package/dist/components/GidsListItem/GidsListItem.js.map +1 -1
- package/dist/components/GidsMenu/GidsMenu.d.ts.map +1 -1
- package/dist/components/GidsMenu/GidsMenu.js +0 -7
- package/dist/components/GidsMenu/GidsMenu.js.map +1 -1
- package/dist/components/GidsMenuGroup/GidsMenuGroup.d.ts.map +1 -1
- package/dist/components/GidsMenuGroup/GidsMenuGroup.js +0 -7
- package/dist/components/GidsMenuGroup/GidsMenuGroup.js.map +1 -1
- package/dist/components/GidsPageTitle/GidsPageTitle.d.ts +9 -0
- package/dist/components/GidsPageTitle/GidsPageTitle.d.ts.map +1 -0
- package/dist/components/GidsPageTitle/GidsPageTitle.js +32 -0
- package/dist/components/GidsPageTitle/GidsPageTitle.js.map +1 -0
- package/dist/components/GidsPieChart/GidsPieChart.d.ts +8 -0
- package/dist/components/GidsPieChart/GidsPieChart.d.ts.map +1 -0
- package/dist/components/GidsPieChart/GidsPieChart.js +16 -0
- package/dist/components/GidsPieChart/GidsPieChart.js.map +1 -0
- package/dist/components/GidsProgressCircle/GidsProgressCircle.d.ts +6 -0
- package/dist/components/GidsProgressCircle/GidsProgressCircle.d.ts.map +1 -0
- package/dist/components/GidsProgressCircle/GidsProgressCircle.js +17 -0
- package/dist/components/GidsProgressCircle/GidsProgressCircle.js.map +1 -0
- package/dist/index.d.ts +21 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +21 -0
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
- package/src/components/GidsActivityGauge/GidsActivityGauge.ts +48 -0
- package/src/components/GidsBarChart/GidsBarChart.ts +47 -0
- package/src/components/GidsCalendar/GidsCalendar.ts +72 -0
- package/src/components/GidsCalendarCell/GidsCalendarCell.ts +95 -0
- package/src/components/GidsCalendarDayCell/GidsCalendarDayCell.ts +29 -0
- package/src/components/GidsCalendarHeaderPanel/GidsCalendarHeaderPanel.ts +107 -0
- package/src/components/GidsCalendarMonthList/GidsCalendarMonthList.ts +56 -0
- package/src/components/GidsCalendarYearList/GidsCalendarYearList.ts +76 -0
- package/src/components/GidsChart/GidsChart.ts +41 -0
- package/src/components/GidsChartLegend/GidsChartLegend.ts +38 -0
- package/src/components/GidsChartLegendItem/GidsChartLegendItem.ts +40 -0
- package/src/components/GidsChevronButton/GidsChevronButton.ts +55 -0
- package/src/components/GidsDot/GidsDot.ts +42 -0
- package/src/components/GidsDropdown/GidsDropdown.ts +149 -0
- package/src/components/GidsDropdownField/GidsDropdownField.ts +106 -0
- package/src/components/GidsDropdownItem/GidsDropdownItem.ts +6 -1
- package/src/components/GidsDropdownMenuGroup/GidsDropdownMenuGroup.ts +23 -3
- package/src/components/GidsDropdownPicker/GidsDropdownPicker.ts +144 -0
- package/src/components/GidsLevelGauge/GidsLevelGauge.ts +46 -0
- package/src/components/GidsLineChart/GidsLineChart.ts +50 -0
- package/src/components/GidsListItem/GidsListItem.ts +24 -12
- package/src/components/GidsMenu/GidsMenu.ts +0 -8
- package/src/components/GidsMenuGroup/GidsMenuGroup.ts +0 -8
- package/src/components/GidsPageTitle/GidsPageTitle.ts +60 -0
- package/src/components/GidsPieChart/GidsPieChart.ts +43 -0
- package/src/components/GidsProgressCircle/GidsProgressCircle.ts +46 -0
- package/src/index.ts +21 -0
|
@@ -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,
|
|
@@ -30,16 +31,19 @@ export const GidsDropdownItemDom = ({
|
|
|
30
31
|
index,
|
|
31
32
|
defaultSelectedIndex,
|
|
32
33
|
leadingAccessory,
|
|
34
|
+
divider,
|
|
33
35
|
}: GidsDropdownItemDomProps): HTMLButtonElement => {
|
|
34
36
|
return GidsListItemDom({
|
|
37
|
+
id: id,
|
|
35
38
|
children: title,
|
|
36
|
-
index,
|
|
39
|
+
index: index ?? 0,
|
|
37
40
|
defaultSelectedIndex,
|
|
38
41
|
selected,
|
|
39
42
|
disabled,
|
|
40
43
|
extraClasses: getGidsDropdownItemClassNames(extraClasses),
|
|
41
44
|
name,
|
|
42
45
|
leadingAccessory,
|
|
46
|
+
divider,
|
|
43
47
|
onPressListItem: (event: CustomEvent<GidsListItemSelectEventDetail>) => {
|
|
44
48
|
const customEvent = new CustomEvent<GidsDropdownItemSelectEventDetail>(
|
|
45
49
|
'onPressDropdownItem',
|
|
@@ -47,6 +51,7 @@ export const GidsDropdownItemDom = ({
|
|
|
47
51
|
bubbles: true,
|
|
48
52
|
composed: true,
|
|
49
53
|
detail: {
|
|
54
|
+
id,
|
|
50
55
|
title,
|
|
51
56
|
value,
|
|
52
57
|
disabled,
|
|
@@ -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
|
-
|
|
21
|
+
dropdownMenuGroup.className = getGidsDropdownMenuGroupClassNames(
|
|
22
|
+
{ type },
|
|
23
|
+
extraClasses,
|
|
24
|
+
);
|
|
20
25
|
|
|
21
|
-
if (
|
|
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,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
|
+
};
|
|
@@ -31,6 +31,7 @@ export const GidsListItemDom = (
|
|
|
31
31
|
props: GidsListItemDomProps,
|
|
32
32
|
): HTMLButtonElement => {
|
|
33
33
|
const {
|
|
34
|
+
id,
|
|
34
35
|
index,
|
|
35
36
|
defaultSelectedIndex,
|
|
36
37
|
children,
|
|
@@ -48,8 +49,8 @@ export const GidsListItemDom = (
|
|
|
48
49
|
trailingParagraph,
|
|
49
50
|
divider,
|
|
50
51
|
extraClasses,
|
|
51
|
-
value,
|
|
52
52
|
name,
|
|
53
|
+
value,
|
|
53
54
|
} = props;
|
|
54
55
|
|
|
55
56
|
const listItem = document.createElement('button');
|
|
@@ -60,15 +61,12 @@ export const GidsListItemDom = (
|
|
|
60
61
|
);
|
|
61
62
|
listItem.setAttribute('role', 'list-item-option');
|
|
62
63
|
listItem.setAttribute('aria-selected', selected ? 'true' : 'false');
|
|
64
|
+
listItem.setAttribute('id', id);
|
|
63
65
|
listItem.disabled = disabled;
|
|
64
66
|
if (name) {
|
|
65
67
|
listItem.name = name;
|
|
66
68
|
}
|
|
67
69
|
|
|
68
|
-
if (typeof value === 'string') {
|
|
69
|
-
listItem.value = value;
|
|
70
|
-
}
|
|
71
|
-
|
|
72
70
|
const mainContainer = document.createElement('div');
|
|
73
71
|
mainContainer.className = 'gids-list-item__main-container';
|
|
74
72
|
|
|
@@ -107,17 +105,17 @@ export const GidsListItemDom = (
|
|
|
107
105
|
'gids-list-item__leading-content-container';
|
|
108
106
|
|
|
109
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';
|
|
110
112
|
if (typeof children === 'string') {
|
|
111
|
-
const leadingLabel = document.createElement('span');
|
|
112
|
-
leadingLabel.className = disabled
|
|
113
|
-
? 'gids-list-item__leading-content-label gids-list-item__text-content-disabled'
|
|
114
|
-
: 'gids-list-item__leading-content-label';
|
|
115
113
|
leadingLabel.textContent = children;
|
|
116
|
-
|
|
117
|
-
appendAsChildren(leadingContentContainer, leadingLabel);
|
|
118
114
|
} else {
|
|
119
|
-
appendAsChildren(
|
|
115
|
+
appendAsChildren(leadingLabel, children);
|
|
120
116
|
}
|
|
117
|
+
|
|
118
|
+
appendAsChildren(leadingContentContainer, leadingLabel);
|
|
121
119
|
}
|
|
122
120
|
|
|
123
121
|
if (
|
|
@@ -277,5 +275,19 @@ export const GidsListItemDom = (
|
|
|
277
275
|
});
|
|
278
276
|
}
|
|
279
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
|
+
|
|
280
292
|
return listItem;
|
|
281
293
|
};
|
|
@@ -8,7 +8,6 @@ import {
|
|
|
8
8
|
DomNodeOrString,
|
|
9
9
|
} from '../../utils/domUtils.js';
|
|
10
10
|
import { GidsHeadingDom } from '../GidsHeading/GidsHeading.js';
|
|
11
|
-
import { testDomChildrenValidity } from '../../utils/childrenValidationUtils.js';
|
|
12
11
|
|
|
13
12
|
const { getGidsMenuClassNames } = GidsMenuWebUtils;
|
|
14
13
|
|
|
@@ -46,13 +45,6 @@ export const GidsMenuDom = ({
|
|
|
46
45
|
);
|
|
47
46
|
}
|
|
48
47
|
|
|
49
|
-
testDomChildrenValidity({
|
|
50
|
-
children,
|
|
51
|
-
classNameToBeValidated: 'gids-list-item',
|
|
52
|
-
childrenNameToBeValidated: 'GidsListItemDom',
|
|
53
|
-
currentComponentName: 'GidsMenu',
|
|
54
|
-
});
|
|
55
|
-
|
|
56
48
|
if (children !== undefined && children !== null) {
|
|
57
49
|
const childrenContainer = document.createElement('div');
|
|
58
50
|
childrenContainer.className = 'gids-menu__children';
|
|
@@ -4,7 +4,6 @@ import {
|
|
|
4
4
|
} from '@ganpatiinfo/gids-web-shared';
|
|
5
5
|
import { appendAsChildren, DomChildren } from '../../utils/domUtils.js';
|
|
6
6
|
import { GidsSpinnerDom } from '../GidsSpinner/GidsSpinner.js';
|
|
7
|
-
import { testDomChildrenValidity } from '../../utils/childrenValidationUtils.js';
|
|
8
7
|
|
|
9
8
|
const { getGidsMenuGroupClassNames } = GidsMenuGroupWebUtils;
|
|
10
9
|
|
|
@@ -36,13 +35,6 @@ export const GidsMenuGroupDom = ({
|
|
|
36
35
|
appendAsChildren(menuGroup, noOptionText);
|
|
37
36
|
}
|
|
38
37
|
|
|
39
|
-
testDomChildrenValidity({
|
|
40
|
-
children,
|
|
41
|
-
classNameToBeValidated: 'gids-menu',
|
|
42
|
-
childrenNameToBeValidated: 'GidsMenuDom',
|
|
43
|
-
currentComponentName: 'GidsMenuGroup',
|
|
44
|
-
});
|
|
45
|
-
|
|
46
38
|
if (type === 'default' && children !== undefined && children !== null) {
|
|
47
39
|
appendAsChildren(menuGroup, children);
|
|
48
40
|
}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import {
|
|
2
|
+
GidsPageTitleWebProps,
|
|
3
|
+
GidsPageTitleWebUtils,
|
|
4
|
+
} from '@ganpatiinfo/gids-web-shared';
|
|
5
|
+
import {
|
|
6
|
+
appendAsChildren,
|
|
7
|
+
DomChildren,
|
|
8
|
+
DomNodeOrString,
|
|
9
|
+
} from '../../utils/domUtils';
|
|
10
|
+
|
|
11
|
+
const { getGidsPageTitleClassNames } = GidsPageTitleWebUtils;
|
|
12
|
+
|
|
13
|
+
type GidsPageTitleBaseWebProps = GidsPageTitleWebProps<
|
|
14
|
+
DomChildren,
|
|
15
|
+
DomNodeOrString
|
|
16
|
+
>;
|
|
17
|
+
|
|
18
|
+
export interface GidsPageTitleDomProps extends GidsPageTitleBaseWebProps {
|
|
19
|
+
extraClasses?: string;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export const GidsPageTitleDom = ({
|
|
23
|
+
level = 'parent',
|
|
24
|
+
children,
|
|
25
|
+
leadingAccessory,
|
|
26
|
+
trailingAccessory,
|
|
27
|
+
extraClasses,
|
|
28
|
+
}: GidsPageTitleDomProps): HTMLDivElement => {
|
|
29
|
+
const pageTitle = document.createElement('div');
|
|
30
|
+
pageTitle.className = getGidsPageTitleClassNames(extraClasses);
|
|
31
|
+
|
|
32
|
+
if (leadingAccessory && level === 'child') {
|
|
33
|
+
const leadingAccContainer = document.createElement('div');
|
|
34
|
+
leadingAccContainer.className = 'gids-page-title__leading-accessory';
|
|
35
|
+
appendAsChildren(leadingAccContainer, leadingAccessory);
|
|
36
|
+
pageTitle.append(leadingAccContainer);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
if (children) {
|
|
40
|
+
const h1El = document.createElement('h1');
|
|
41
|
+
h1El.className = 'gids-page-title__heading';
|
|
42
|
+
|
|
43
|
+
if (children instanceof Node) {
|
|
44
|
+
h1El.append(children);
|
|
45
|
+
} else {
|
|
46
|
+
h1El.textContent = children;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
appendAsChildren(pageTitle, h1El);
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
if (trailingAccessory) {
|
|
53
|
+
const trailingAccContainer = document.createElement('div');
|
|
54
|
+
trailingAccContainer.className = 'gids-page-title__trailing-accessory';
|
|
55
|
+
appendAsChildren(trailingAccContainer, trailingAccessory);
|
|
56
|
+
pageTitle.append(trailingAccContainer);
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
return pageTitle;
|
|
60
|
+
};
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import {
|
|
2
|
+
GidsPieChartWebProps,
|
|
3
|
+
GidsPieChartWebUtils,
|
|
4
|
+
} from '@ganpatiinfo/gids-web-shared';
|
|
5
|
+
|
|
6
|
+
const { getGidsPieChartClassNames } = GidsPieChartWebUtils;
|
|
7
|
+
|
|
8
|
+
type GidsPieChartBaseWebProps = GidsPieChartWebProps;
|
|
9
|
+
|
|
10
|
+
type GidsPieChartElement = HTMLElement & GidsPieChartBaseWebProps;
|
|
11
|
+
|
|
12
|
+
export interface GidsPieChartDomProps extends GidsPieChartBaseWebProps {
|
|
13
|
+
extraClasses?: string;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export const GidsPieChartDom = ({
|
|
17
|
+
breakpoint = 'desktop',
|
|
18
|
+
chartLoading = false,
|
|
19
|
+
chartLoaderSize,
|
|
20
|
+
chartLoadingSupportingText,
|
|
21
|
+
chartLoadingTitle,
|
|
22
|
+
legendVisible,
|
|
23
|
+
size = 'xxs',
|
|
24
|
+
chartData = [],
|
|
25
|
+
extraClasses,
|
|
26
|
+
}: GidsPieChartDomProps): HTMLElement => {
|
|
27
|
+
const pieChart = document.createElement(
|
|
28
|
+
'gids-pie-chart',
|
|
29
|
+
) as GidsPieChartElement;
|
|
30
|
+
|
|
31
|
+
pieChart.breakpoint = breakpoint;
|
|
32
|
+
pieChart.size = size;
|
|
33
|
+
pieChart.legendVisible = legendVisible;
|
|
34
|
+
pieChart.chartData = chartData;
|
|
35
|
+
pieChart.chartLoading = chartLoading;
|
|
36
|
+
pieChart.chartLoaderSize = chartLoaderSize;
|
|
37
|
+
pieChart.chartLoadingTitle = chartLoadingTitle;
|
|
38
|
+
pieChart.chartLoadingSupportingText = chartLoadingSupportingText;
|
|
39
|
+
|
|
40
|
+
pieChart.className = getGidsPieChartClassNames({ breakpoint }, extraClasses);
|
|
41
|
+
|
|
42
|
+
return pieChart;
|
|
43
|
+
};
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import {
|
|
2
|
+
GidsProgressCircleWebProps,
|
|
3
|
+
GidsProgressCircleWebUtils,
|
|
4
|
+
} from '@ganpatiinfo/gids-web-shared';
|
|
5
|
+
|
|
6
|
+
const { getGidsProgressCircleClassNames } = GidsProgressCircleWebUtils;
|
|
7
|
+
|
|
8
|
+
type GidsProgressCircleElement = HTMLElement & GidsProgressCircleWebProps;
|
|
9
|
+
|
|
10
|
+
export interface GidsProgressCircleDomProps extends GidsProgressCircleWebProps {
|
|
11
|
+
extraClasses?: string;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export const GidsProgressCircleDom = ({
|
|
15
|
+
label,
|
|
16
|
+
shape = 'circle',
|
|
17
|
+
value = 0,
|
|
18
|
+
breakpoint = 'desktop',
|
|
19
|
+
chartLoading = false,
|
|
20
|
+
chartLoaderSize,
|
|
21
|
+
chartLoadingSupportingText,
|
|
22
|
+
chartLoadingTitle,
|
|
23
|
+
size = 'xxs',
|
|
24
|
+
extraClasses,
|
|
25
|
+
}: GidsProgressCircleDomProps): HTMLElement => {
|
|
26
|
+
const progressCircle = document.createElement(
|
|
27
|
+
'gids-progress-circle',
|
|
28
|
+
) as GidsProgressCircleElement;
|
|
29
|
+
|
|
30
|
+
progressCircle.breakpoint = breakpoint;
|
|
31
|
+
progressCircle.size = size;
|
|
32
|
+
progressCircle.label = label;
|
|
33
|
+
progressCircle.value = value;
|
|
34
|
+
progressCircle.shape = shape;
|
|
35
|
+
progressCircle.chartLoading = chartLoading;
|
|
36
|
+
progressCircle.chartLoaderSize = chartLoaderSize;
|
|
37
|
+
progressCircle.chartLoadingTitle = chartLoadingTitle;
|
|
38
|
+
progressCircle.chartLoadingSupportingText = chartLoadingSupportingText;
|
|
39
|
+
|
|
40
|
+
progressCircle.className = getGidsProgressCircleClassNames(
|
|
41
|
+
{ breakpoint },
|
|
42
|
+
extraClasses,
|
|
43
|
+
);
|
|
44
|
+
|
|
45
|
+
return progressCircle;
|
|
46
|
+
};
|