@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.
- package/CHANGELOG.md +96 -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/GidsButton/GidsButton.d.ts +1 -1
- package/dist/components/GidsButton/GidsButton.d.ts.map +1 -1
- package/dist/components/GidsButton/GidsButton.js +2 -2
- package/dist/components/GidsButton/GidsButton.js.map +1 -1
- 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 +10 -0
- package/dist/components/GidsDropdownItem/GidsDropdownItem.d.ts.map +1 -0
- package/dist/components/GidsDropdownItem/GidsDropdownItem.js +34 -0
- package/dist/components/GidsDropdownItem/GidsDropdownItem.js.map +1 -0
- package/dist/components/GidsDropdownMenu/GidsDropdownMenu.d.ts +7 -0
- package/dist/components/GidsDropdownMenu/GidsDropdownMenu.d.ts.map +1 -0
- package/dist/components/GidsDropdownMenu/GidsDropdownMenu.js +24 -0
- package/dist/components/GidsDropdownMenu/GidsDropdownMenu.js.map +1 -0
- package/dist/components/GidsDropdownMenuGroup/GidsDropdownMenuGroup.d.ts +7 -0
- package/dist/components/GidsDropdownMenuGroup/GidsDropdownMenuGroup.d.ts.map +1 -0
- package/dist/components/GidsDropdownMenuGroup/GidsDropdownMenuGroup.js +24 -0
- package/dist/components/GidsDropdownMenuGroup/GidsDropdownMenuGroup.js.map +1 -0
- 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/GidsEditButton/GidsEditButton.d.ts +8 -0
- package/dist/components/GidsEditButton/GidsEditButton.d.ts.map +1 -0
- package/dist/components/GidsEditButton/GidsEditButton.js +44 -0
- package/dist/components/GidsEditButton/GidsEditButton.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 +11 -0
- package/dist/components/GidsListItem/GidsListItem.d.ts.map +1 -0
- package/dist/components/GidsListItem/GidsListItem.js +207 -0
- package/dist/components/GidsListItem/GidsListItem.js.map +1 -0
- package/dist/components/GidsMenu/GidsMenu.d.ts +7 -0
- package/dist/components/GidsMenu/GidsMenu.d.ts.map +1 -0
- package/dist/components/GidsMenu/GidsMenu.js +27 -0
- package/dist/components/GidsMenu/GidsMenu.js.map +1 -0
- package/dist/components/GidsMenuGroup/GidsMenuGroup.d.ts +7 -0
- package/dist/components/GidsMenuGroup/GidsMenuGroup.d.ts.map +1 -0
- package/dist/components/GidsMenuGroup/GidsMenuGroup.js +24 -0
- package/dist/components/GidsMenuGroup/GidsMenuGroup.js.map +1 -0
- 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/GidsPopover/GidsPopover.d.ts +7 -0
- package/dist/components/GidsPopover/GidsPopover.d.ts.map +1 -0
- package/dist/components/GidsPopover/GidsPopover.js +16 -0
- package/dist/components/GidsPopover/GidsPopover.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/components/GidsTooltip/GidsTooltip.d.ts +6 -0
- package/dist/components/GidsTooltip/GidsTooltip.d.ts.map +1 -0
- package/dist/components/GidsTooltip/GidsTooltip.js +20 -0
- package/dist/components/GidsTooltip/GidsTooltip.js.map +1 -0
- package/dist/index.d.ts +31 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +31 -0
- package/dist/index.js.map +1 -1
- package/dist/utils/childrenValidationUtils.d.ts +9 -0
- package/dist/utils/childrenValidationUtils.d.ts.map +1 -0
- package/dist/utils/childrenValidationUtils.js +27 -0
- package/dist/utils/childrenValidationUtils.js.map +1 -0
- package/package.json +45 -45
- package/src/components/GidsActivityGauge/GidsActivityGauge.ts +48 -0
- package/src/components/GidsBarChart/GidsBarChart.ts +47 -0
- package/src/components/GidsButton/GidsButton.ts +2 -1
- 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 +67 -0
- package/src/components/GidsDropdownMenu/GidsDropdownMenu.ts +43 -0
- package/src/components/GidsDropdownMenuGroup/GidsDropdownMenuGroup.ts +46 -0
- package/src/components/GidsDropdownPicker/GidsDropdownPicker.ts +144 -0
- package/src/components/GidsEditButton/GidsEditButton.ts +71 -0
- package/src/components/GidsLevelGauge/GidsLevelGauge.ts +46 -0
- package/src/components/GidsLineChart/GidsLineChart.ts +50 -0
- package/src/components/GidsListItem/GidsListItem.ts +293 -0
- package/src/components/GidsMenu/GidsMenu.ts +56 -0
- package/src/components/GidsMenuGroup/GidsMenuGroup.ts +43 -0
- package/src/components/GidsPageTitle/GidsPageTitle.ts +60 -0
- package/src/components/GidsPieChart/GidsPieChart.ts +43 -0
- package/src/components/GidsPopover/GidsPopover.ts +32 -0
- package/src/components/GidsProgressCircle/GidsProgressCircle.ts +46 -0
- package/src/components/GidsTooltip/GidsTooltip.ts +37 -0
- package/src/index.ts +31 -0
- 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
|
+
};
|