@ganpatiinfo/gids-web-dom-reference 9.2.0 → 11.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 +79 -0
- package/dist/components/GidsActionBar/GidsActionBar.d.ts +1 -1
- package/dist/components/GidsActionBar/GidsActionBar.d.ts.map +1 -1
- package/dist/components/GidsActionBar/GidsActionBar.js +2 -1
- package/dist/components/GidsActionBar/GidsActionBar.js.map +1 -1
- package/dist/components/GidsBasicTableBody/GidsBasicTableBody.d.ts +8 -0
- package/dist/components/GidsBasicTableBody/GidsBasicTableBody.d.ts.map +1 -0
- package/dist/components/GidsBasicTableBody/GidsBasicTableBody.js +27 -0
- package/dist/components/GidsBasicTableBody/GidsBasicTableBody.js.map +1 -0
- package/dist/components/GidsBasicTableCell/GidsBasicTableCell.d.ts +8 -0
- package/dist/components/GidsBasicTableCell/GidsBasicTableCell.d.ts.map +1 -0
- package/dist/components/GidsBasicTableCell/GidsBasicTableCell.js +16 -0
- package/dist/components/GidsBasicTableCell/GidsBasicTableCell.js.map +1 -0
- package/dist/components/GidsBasicTableHead/GidsBasicTableHead.d.ts +11 -0
- package/dist/components/GidsBasicTableHead/GidsBasicTableHead.d.ts.map +1 -0
- package/dist/components/GidsBasicTableHead/GidsBasicTableHead.js +86 -0
- package/dist/components/GidsBasicTableHead/GidsBasicTableHead.js.map +1 -0
- package/dist/components/GidsBasicTableHeader/GidsBasicTableHeader.d.ts +8 -0
- package/dist/components/GidsBasicTableHeader/GidsBasicTableHeader.d.ts.map +1 -0
- package/dist/components/GidsBasicTableHeader/GidsBasicTableHeader.js +26 -0
- package/dist/components/GidsBasicTableHeader/GidsBasicTableHeader.js.map +1 -0
- package/dist/components/GidsBasicTableRow/GidsBasicTableRow.d.ts +8 -0
- package/dist/components/GidsBasicTableRow/GidsBasicTableRow.d.ts.map +1 -0
- package/dist/components/GidsBasicTableRow/GidsBasicTableRow.js +41 -0
- package/dist/components/GidsBasicTableRow/GidsBasicTableRow.js.map +1 -0
- package/dist/components/GidsBsTable/GidsBsTable.d.ts +11 -0
- package/dist/components/GidsBsTable/GidsBsTable.d.ts.map +1 -0
- package/dist/components/GidsBsTable/GidsBsTable.js +99 -0
- package/dist/components/GidsBsTable/GidsBsTable.js.map +1 -0
- package/dist/components/GidsExpansion/GidsExpansion.d.ts +9 -0
- package/dist/components/GidsExpansion/GidsExpansion.d.ts.map +1 -0
- package/dist/components/GidsExpansion/GidsExpansion.js +31 -0
- package/dist/components/GidsExpansion/GidsExpansion.js.map +1 -0
- package/dist/components/GidsExpansionBodyList/GidsExpansionBodyList.d.ts +8 -0
- package/dist/components/GidsExpansionBodyList/GidsExpansionBodyList.d.ts.map +1 -0
- package/dist/components/GidsExpansionBodyList/GidsExpansionBodyList.js +18 -0
- package/dist/components/GidsExpansionBodyList/GidsExpansionBodyList.js.map +1 -0
- package/dist/components/GidsExpansionBodyListItem/GidsExpansionBodyListItem.d.ts +8 -0
- package/dist/components/GidsExpansionBodyListItem/GidsExpansionBodyListItem.d.ts.map +1 -0
- package/dist/components/GidsExpansionBodyListItem/GidsExpansionBodyListItem.js +25 -0
- package/dist/components/GidsExpansionBodyListItem/GidsExpansionBodyListItem.js.map +1 -0
- package/dist/components/GidsExpansionGroup/GidsExpansionGroup.d.ts +9 -0
- package/dist/components/GidsExpansionGroup/GidsExpansionGroup.d.ts.map +1 -0
- package/dist/components/GidsExpansionGroup/GidsExpansionGroup.js +12 -0
- package/dist/components/GidsExpansionGroup/GidsExpansionGroup.js.map +1 -0
- package/dist/components/GidsMdTable/GidsMdTable.d.ts +8 -0
- package/dist/components/GidsMdTable/GidsMdTable.d.ts.map +1 -0
- package/dist/components/GidsMdTable/GidsMdTable.js +24 -0
- package/dist/components/GidsMdTable/GidsMdTable.js.map +1 -0
- package/dist/components/GidsSideMenu/GidsSideMenu.d.ts +1 -1
- package/dist/components/GidsSideMenu/GidsSideMenu.d.ts.map +1 -1
- package/dist/components/GidsSideMenu/GidsSideMenu.js +3 -2
- package/dist/components/GidsSideMenu/GidsSideMenu.js.map +1 -1
- package/dist/components/GidsSideNavigation/GidsSideNavigation.d.ts +1 -1
- package/dist/components/GidsSideNavigation/GidsSideNavigation.d.ts.map +1 -1
- package/dist/components/GidsSideNavigation/GidsSideNavigation.js +3 -1
- package/dist/components/GidsSideNavigation/GidsSideNavigation.js.map +1 -1
- package/dist/index.d.ts +11 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +11 -0
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
- package/src/components/GidsActionBar/GidsActionBar.ts +2 -0
- package/src/components/GidsBasicTableBody/GidsBasicTableBody.ts +55 -0
- package/src/components/GidsBasicTableCell/GidsBasicTableCell.ts +45 -0
- package/src/components/GidsBasicTableHead/GidsBasicTableHead.ts +172 -0
- package/src/components/GidsBasicTableHeader/GidsBasicTableHeader.ts +56 -0
- package/src/components/GidsBasicTableRow/GidsBasicTableRow.ts +70 -0
- package/src/components/GidsBsTable/GidsBsTable.ts +206 -0
- package/src/components/GidsExpansion/GidsExpansion.ts +65 -0
- package/src/components/GidsExpansionBodyList/GidsExpansionBodyList.ts +43 -0
- package/src/components/GidsExpansionBodyListItem/GidsExpansionBodyListItem.ts +60 -0
- package/src/components/GidsExpansionGroup/GidsExpansionGroup.ts +32 -0
- package/src/components/GidsMdTable/GidsMdTable.ts +57 -0
- package/src/components/GidsSideMenu/GidsSideMenu.ts +18 -16
- package/src/components/GidsSideNavigation/GidsSideNavigation.ts +79 -76
- package/src/index.ts +11 -0
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import {
|
|
2
|
+
GidsBasicTableCellTypographyStyle,
|
|
3
|
+
GidsBasicTableHeaderWebProps,
|
|
4
|
+
GidsBasicTableHeaderWebUtils,
|
|
5
|
+
} from '@ganpatiinfo/gids-web-shared';
|
|
6
|
+
import { GidsBasicTableRowDom } from '../GidsBasicTableRow/GidsBasicTableRow';
|
|
7
|
+
import { GidsBasicTableRowItem } from '@ganpatiinfo/gids-core-shared';
|
|
8
|
+
|
|
9
|
+
const { getGidsBasicTableHeaderClassNames } = GidsBasicTableHeaderWebUtils;
|
|
10
|
+
|
|
11
|
+
type GidsBasicTableHeaderBaseWebProps = GidsBasicTableHeaderWebProps;
|
|
12
|
+
|
|
13
|
+
export interface GidsBasicTableHeaderDomProps extends GidsBasicTableHeaderBaseWebProps {
|
|
14
|
+
extraClasses?: string;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export const GidsBasicTableHeaderDom = ({
|
|
18
|
+
width = 'full',
|
|
19
|
+
headerCells = [],
|
|
20
|
+
appearance = 'none',
|
|
21
|
+
labelTypography = 'label-medium',
|
|
22
|
+
textAlignment = 'center',
|
|
23
|
+
layout = 'horizontal',
|
|
24
|
+
extraClasses,
|
|
25
|
+
}: GidsBasicTableHeaderDomProps) => {
|
|
26
|
+
const basicTableHeader = document.createElement('thead');
|
|
27
|
+
basicTableHeader.className = getGidsBasicTableHeaderClassNames(
|
|
28
|
+
{ width },
|
|
29
|
+
extraClasses,
|
|
30
|
+
);
|
|
31
|
+
|
|
32
|
+
if (headerCells && headerCells.length > 0) {
|
|
33
|
+
// 1. Map cells to forward global table header styles/props into each row item
|
|
34
|
+
const mappedHeaderCells: GidsBasicTableRowItem<GidsBasicTableCellTypographyStyle>[] =
|
|
35
|
+
headerCells.map(
|
|
36
|
+
(cell): GidsBasicTableRowItem<GidsBasicTableCellTypographyStyle> => ({
|
|
37
|
+
appearance, // Falling back to header level appearance
|
|
38
|
+
labelTypography, // Falling back to header level typography
|
|
39
|
+
textAlignment, // Falling back to header level text alignment
|
|
40
|
+
...cell, // Individual cell settings override header properties if explicitly passed
|
|
41
|
+
}),
|
|
42
|
+
);
|
|
43
|
+
|
|
44
|
+
// 2. Feed the combined data payload into your Row builder safely
|
|
45
|
+
const rowContent = GidsBasicTableRowDom({
|
|
46
|
+
width,
|
|
47
|
+
layout,
|
|
48
|
+
rows: mappedHeaderCells,
|
|
49
|
+
isHeaderRow: true,
|
|
50
|
+
});
|
|
51
|
+
|
|
52
|
+
basicTableHeader.append(rowContent);
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
return basicTableHeader;
|
|
56
|
+
};
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import {
|
|
2
|
+
type GidsBasicTableRowWebProps,
|
|
3
|
+
GidsBasicTableRowWebUtils,
|
|
4
|
+
} from '@ganpatiinfo/gids-web-shared';
|
|
5
|
+
import { GidsBasicTableCellDom } from '../GidsBasicTableCell/GidsBasicTableCell';
|
|
6
|
+
|
|
7
|
+
const { getGidsBasicTableRowClassNames } = GidsBasicTableRowWebUtils;
|
|
8
|
+
|
|
9
|
+
type GidsBasicTableRowBaseWebProps = GidsBasicTableRowWebProps;
|
|
10
|
+
|
|
11
|
+
export interface GidsBasicTableRowDomProps extends GidsBasicTableRowBaseWebProps {
|
|
12
|
+
extraClasses?: string;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export const GidsBasicTableRowDom = ({
|
|
16
|
+
width = 'full',
|
|
17
|
+
layout = 'horizontal',
|
|
18
|
+
rows,
|
|
19
|
+
isHeaderRow = false,
|
|
20
|
+
extraClasses,
|
|
21
|
+
}: GidsBasicTableRowDomProps): HTMLElement | DocumentFragment => {
|
|
22
|
+
const rowClassName = getGidsBasicTableRowClassNames({ width }, extraClasses);
|
|
23
|
+
|
|
24
|
+
// 2. Handling Vertical Layout
|
|
25
|
+
if (layout === 'vertical' && rows && rows.length > 0) {
|
|
26
|
+
const fragment = document.createDocumentFragment();
|
|
27
|
+
|
|
28
|
+
rows.forEach((tableRow) => {
|
|
29
|
+
// Create a clean, independent <tr> wrapper for each vertical entry
|
|
30
|
+
const singleRowEl = document.createElement('tr');
|
|
31
|
+
singleRowEl.className = rowClassName;
|
|
32
|
+
|
|
33
|
+
const rowLabel = tableRow?.label;
|
|
34
|
+
singleRowEl.append(
|
|
35
|
+
GidsBasicTableCellDom({
|
|
36
|
+
...tableRow,
|
|
37
|
+
width: width,
|
|
38
|
+
label: rowLabel,
|
|
39
|
+
isHeaderCell: isHeaderRow,
|
|
40
|
+
}),
|
|
41
|
+
);
|
|
42
|
+
|
|
43
|
+
// Append the constructed row directly to the fragment tree
|
|
44
|
+
fragment.append(singleRowEl);
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
return fragment;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
// 3. Handling Horizontal Layout (Standard Single Row)
|
|
51
|
+
const basicTableRow = document.createElement('tr');
|
|
52
|
+
basicTableRow.className = rowClassName;
|
|
53
|
+
|
|
54
|
+
if (rows && rows.length > 0) {
|
|
55
|
+
rows.forEach((tableRow) => {
|
|
56
|
+
const rowLabel = tableRow?.label;
|
|
57
|
+
|
|
58
|
+
basicTableRow.append(
|
|
59
|
+
GidsBasicTableCellDom({
|
|
60
|
+
...tableRow,
|
|
61
|
+
width: width,
|
|
62
|
+
label: rowLabel,
|
|
63
|
+
isHeaderCell: isHeaderRow,
|
|
64
|
+
}),
|
|
65
|
+
);
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
return basicTableRow;
|
|
70
|
+
};
|
|
@@ -0,0 +1,206 @@
|
|
|
1
|
+
import {
|
|
2
|
+
GidsBsTableWebProps,
|
|
3
|
+
GidsBsTableWebUtils,
|
|
4
|
+
} from '@ganpatiinfo/gids-web-shared';
|
|
5
|
+
import { DomChildren } from '../../utils/domUtils';
|
|
6
|
+
import { HtmlInputAttributes } from '../GidsInput/GidsInput';
|
|
7
|
+
import {
|
|
8
|
+
GidsBasicTableHeadDom,
|
|
9
|
+
GidsBasicTableHeadDomProps,
|
|
10
|
+
} from '../GidsBasicTableHead/GidsBasicTableHead';
|
|
11
|
+
import { GidsBasicTableHeaderDom } from '../GidsBasicTableHeader/GidsBasicTableHeader';
|
|
12
|
+
import { GidsBasicTableBodyDom } from '../GidsBasicTableBody/GidsBasicTableBody';
|
|
13
|
+
|
|
14
|
+
const {
|
|
15
|
+
getGidsBsTableClassNames,
|
|
16
|
+
getCustomisedTopHeaderCells,
|
|
17
|
+
getBsTableClasses,
|
|
18
|
+
getBsTableBodyBorder,
|
|
19
|
+
} = GidsBsTableWebUtils;
|
|
20
|
+
|
|
21
|
+
type GidsBsTableBaseWebProps = GidsBsTableWebProps<
|
|
22
|
+
DomChildren,
|
|
23
|
+
Event,
|
|
24
|
+
Element,
|
|
25
|
+
HtmlInputAttributes
|
|
26
|
+
> &
|
|
27
|
+
Pick<
|
|
28
|
+
GidsBasicTableHeadDomProps,
|
|
29
|
+
'onChange' | 'onInput' | 'onFocus' | 'onBlur' | 'onGidsSearchBarClear'
|
|
30
|
+
>;
|
|
31
|
+
|
|
32
|
+
export interface GidsBsTableDomProps extends GidsBsTableBaseWebProps {
|
|
33
|
+
extraClasses?: string;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
export const GidsBsTableDom = ({
|
|
37
|
+
// Table properties
|
|
38
|
+
topHeaderCells = [],
|
|
39
|
+
tableBody = [],
|
|
40
|
+
width = 'full',
|
|
41
|
+
isTopHeaderVisible = false,
|
|
42
|
+
isHeadVisible = true,
|
|
43
|
+
topHeaderAppearance = 'none',
|
|
44
|
+
topHeaderLabelTypography = 'eyebrow-small',
|
|
45
|
+
topHeaderTextAlignment = 'left',
|
|
46
|
+
rowAppearance = 'none',
|
|
47
|
+
rowLabelTypography = 'label-small',
|
|
48
|
+
rowTextAlignment = 'left',
|
|
49
|
+
tableBorders = 'none',
|
|
50
|
+
tableBorderRadius = [],
|
|
51
|
+
tableBodyMaxHeight = 200,
|
|
52
|
+
extraClasses,
|
|
53
|
+
|
|
54
|
+
// Table Head properties
|
|
55
|
+
actionGroup = false,
|
|
56
|
+
allFiltersTabVisible = false,
|
|
57
|
+
moreFiltersTabVisible = false,
|
|
58
|
+
clearAllFiltersVisible = true,
|
|
59
|
+
clearAllFiltersButtonAppearance = 'primary',
|
|
60
|
+
primaryFilters = [],
|
|
61
|
+
secondaryFilters = [],
|
|
62
|
+
filterSize = 'xs',
|
|
63
|
+
filterAllIsDefaultSelected = true,
|
|
64
|
+
dropdownDividerVisible,
|
|
65
|
+
onToggleActionBarAllFilter,
|
|
66
|
+
onToggleActionBarDropdownFilter,
|
|
67
|
+
onToggleActionBarMoreFilter,
|
|
68
|
+
onToggleActionBarNoneFilter,
|
|
69
|
+
onDropdownSelectionActionBarFilterChange,
|
|
70
|
+
onMoreSelectionActionBarFilterChange,
|
|
71
|
+
onClearAllFiltersButton,
|
|
72
|
+
actionBarDisabled = false,
|
|
73
|
+
searchDisabled = false,
|
|
74
|
+
allFiltersData,
|
|
75
|
+
moreFiltersData,
|
|
76
|
+
children,
|
|
77
|
+
searchVisible = true,
|
|
78
|
+
filtersVisible = true,
|
|
79
|
+
childrenPosition = 'top-most',
|
|
80
|
+
tabVisible = false,
|
|
81
|
+
tabProps,
|
|
82
|
+
headBorderSides = [],
|
|
83
|
+
headBorderRadiusSides = [],
|
|
84
|
+
leadingIcon,
|
|
85
|
+
leadingLabel,
|
|
86
|
+
trailingLabel,
|
|
87
|
+
loading,
|
|
88
|
+
readOnly,
|
|
89
|
+
onGidsSearchBarClear,
|
|
90
|
+
onChange,
|
|
91
|
+
onInput,
|
|
92
|
+
onFocus,
|
|
93
|
+
onBlur,
|
|
94
|
+
headValue = '',
|
|
95
|
+
inputProps,
|
|
96
|
+
headAppearance = 'surface-default',
|
|
97
|
+
...restProps
|
|
98
|
+
}: GidsBsTableDomProps): HTMLDivElement => {
|
|
99
|
+
const bsTable = document.createElement('div');
|
|
100
|
+
bsTable.className = getGidsBsTableClassNames(
|
|
101
|
+
{ width, tableBorders, tableBorderRadius },
|
|
102
|
+
extraClasses,
|
|
103
|
+
);
|
|
104
|
+
|
|
105
|
+
// Table Head properties
|
|
106
|
+
if (isHeadVisible) {
|
|
107
|
+
bsTable.append(
|
|
108
|
+
GidsBasicTableHeadDom({
|
|
109
|
+
actionGroup,
|
|
110
|
+
allFiltersTabVisible,
|
|
111
|
+
moreFiltersTabVisible,
|
|
112
|
+
clearAllFiltersVisible,
|
|
113
|
+
clearAllFiltersButtonAppearance,
|
|
114
|
+
primaryFilters,
|
|
115
|
+
secondaryFilters,
|
|
116
|
+
filterSize,
|
|
117
|
+
filterAllIsDefaultSelected,
|
|
118
|
+
dropdownDividerVisible,
|
|
119
|
+
onToggleActionBarAllFilter,
|
|
120
|
+
onToggleActionBarDropdownFilter,
|
|
121
|
+
onToggleActionBarMoreFilter,
|
|
122
|
+
onToggleActionBarNoneFilter,
|
|
123
|
+
onDropdownSelectionActionBarFilterChange,
|
|
124
|
+
onMoreSelectionActionBarFilterChange,
|
|
125
|
+
onClearAllFiltersButton,
|
|
126
|
+
actionBarDisabled,
|
|
127
|
+
searchDisabled,
|
|
128
|
+
allFiltersData,
|
|
129
|
+
moreFiltersData,
|
|
130
|
+
children,
|
|
131
|
+
searchVisible,
|
|
132
|
+
filtersVisible,
|
|
133
|
+
childrenPosition,
|
|
134
|
+
tabVisible,
|
|
135
|
+
tabProps,
|
|
136
|
+
borderSides: headBorderSides,
|
|
137
|
+
borderRadiusSides: headBorderRadiusSides,
|
|
138
|
+
leadingIcon,
|
|
139
|
+
leadingLabel,
|
|
140
|
+
trailingLabel,
|
|
141
|
+
loading,
|
|
142
|
+
readOnly,
|
|
143
|
+
onGidsSearchBarClear,
|
|
144
|
+
onChange,
|
|
145
|
+
onInput,
|
|
146
|
+
onFocus,
|
|
147
|
+
onBlur,
|
|
148
|
+
value: headValue,
|
|
149
|
+
inputProps,
|
|
150
|
+
headAppearance,
|
|
151
|
+
...restProps,
|
|
152
|
+
}),
|
|
153
|
+
);
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
// Wrapper Container to safely handle scroll containment
|
|
157
|
+
const tableScrollContainer = document.createElement('div');
|
|
158
|
+
tableScrollContainer.className = 'gids-bs-table__scroll-container';
|
|
159
|
+
|
|
160
|
+
// Safe injection of the custom property value into the container element
|
|
161
|
+
if (tableBodyMaxHeight) {
|
|
162
|
+
tableScrollContainer.style.setProperty(
|
|
163
|
+
'--gidsBsTable-body-max-height',
|
|
164
|
+
`${tableBodyMaxHeight}px`,
|
|
165
|
+
);
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
// Table properties
|
|
169
|
+
const table = document.createElement('table');
|
|
170
|
+
table.className = getBsTableClasses({ width, isHeadVisible });
|
|
171
|
+
|
|
172
|
+
if (isTopHeaderVisible && topHeaderCells && topHeaderCells.length > 0) {
|
|
173
|
+
// Append Table Header
|
|
174
|
+
table.append(
|
|
175
|
+
GidsBasicTableHeaderDom({
|
|
176
|
+
appearance: topHeaderAppearance,
|
|
177
|
+
labelTypography: topHeaderLabelTypography,
|
|
178
|
+
textAlignment: topHeaderTextAlignment,
|
|
179
|
+
headerCells: getCustomisedTopHeaderCells({
|
|
180
|
+
topHeaderCells,
|
|
181
|
+
tableBorders,
|
|
182
|
+
}),
|
|
183
|
+
width: isHeadVisible ? 'full' : width,
|
|
184
|
+
}),
|
|
185
|
+
);
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
if (tableBody && tableBody.length > 0) {
|
|
189
|
+
table.append(
|
|
190
|
+
GidsBasicTableBodyDom({
|
|
191
|
+
width: isHeadVisible ? 'full' : width,
|
|
192
|
+
tableBorders: getBsTableBodyBorder({ tableBorders }),
|
|
193
|
+
tableBodyData: tableBody,
|
|
194
|
+
rowAppearance,
|
|
195
|
+
rowLabelTypography,
|
|
196
|
+
rowTextAlignment,
|
|
197
|
+
}),
|
|
198
|
+
);
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
// Structural Append hierarchy: table -> scroll wrapper -> root container
|
|
202
|
+
tableScrollContainer.appendChild(table);
|
|
203
|
+
bsTable.appendChild(tableScrollContainer);
|
|
204
|
+
|
|
205
|
+
return bsTable;
|
|
206
|
+
};
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import {
|
|
2
|
+
GidsExpansionWebProps,
|
|
3
|
+
GidsExpansionWebUtils,
|
|
4
|
+
} from '@ganpatiinfo/gids-web-shared';
|
|
5
|
+
import { appendAsChildren, DomChildren } from '../../utils/domUtils';
|
|
6
|
+
|
|
7
|
+
const { getGidsExpansionClassNames } = GidsExpansionWebUtils;
|
|
8
|
+
|
|
9
|
+
type GidsExpansionBaseWebProps = GidsExpansionWebProps<DomChildren>;
|
|
10
|
+
|
|
11
|
+
type GidsExpansionElement = HTMLElement & GidsExpansionBaseWebProps;
|
|
12
|
+
|
|
13
|
+
export interface GidsExpansionDomProps extends GidsExpansionBaseWebProps {
|
|
14
|
+
extraClasses?: string;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export const GidsExpansionDom = ({
|
|
18
|
+
expansionId,
|
|
19
|
+
label,
|
|
20
|
+
labelLevel = 'h1',
|
|
21
|
+
expanded,
|
|
22
|
+
onExpand,
|
|
23
|
+
disabled,
|
|
24
|
+
children,
|
|
25
|
+
extraClasses,
|
|
26
|
+
}: GidsExpansionDomProps): HTMLElement => {
|
|
27
|
+
const expansion = document.createElement(
|
|
28
|
+
'gids-expansion',
|
|
29
|
+
) as GidsExpansionElement;
|
|
30
|
+
|
|
31
|
+
expansion.setAttribute('expansion-id', expansionId);
|
|
32
|
+
|
|
33
|
+
if (disabled) {
|
|
34
|
+
expansion.setAttribute('disabled', 'true');
|
|
35
|
+
} else {
|
|
36
|
+
expansion.removeAttribute('disabled');
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
expansion.expansionId = expansionId;
|
|
40
|
+
expansion.label = label;
|
|
41
|
+
expansion.labelLevel = labelLevel;
|
|
42
|
+
expansion.disabled = disabled;
|
|
43
|
+
|
|
44
|
+
if (typeof expanded === 'boolean') {
|
|
45
|
+
expansion.expanded = expanded;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
const isInteractive = !disabled;
|
|
49
|
+
const isExpanded = Boolean(expanded) && isInteractive;
|
|
50
|
+
|
|
51
|
+
if (children) {
|
|
52
|
+
appendAsChildren(expansion, children);
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
expansion.className = getGidsExpansionClassNames(
|
|
56
|
+
{ expanded: isExpanded },
|
|
57
|
+
extraClasses,
|
|
58
|
+
);
|
|
59
|
+
|
|
60
|
+
if (onExpand) {
|
|
61
|
+
expansion.onExpand = onExpand;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
return expansion;
|
|
65
|
+
};
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import {
|
|
2
|
+
GidsExpansionBodyListWebProps,
|
|
3
|
+
GidsExpansionBodyListWebUtils,
|
|
4
|
+
} from '@ganpatiinfo/gids-web-shared';
|
|
5
|
+
|
|
6
|
+
const { getGidsExpansionBodyListClassNames } = GidsExpansionBodyListWebUtils;
|
|
7
|
+
|
|
8
|
+
type GidsExpansionBodyListBaseWebProps = GidsExpansionBodyListWebProps;
|
|
9
|
+
|
|
10
|
+
type GidsExpansionBodyListElement = HTMLElement &
|
|
11
|
+
GidsExpansionBodyListBaseWebProps;
|
|
12
|
+
|
|
13
|
+
export interface GidsExpansionBodyListDomProps extends GidsExpansionBodyListBaseWebProps {
|
|
14
|
+
extraClasses?: string;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export const GidsExpansionBodyListDom = ({
|
|
18
|
+
expansionBodyListItems,
|
|
19
|
+
onExpansionBodyListSubtitlePress,
|
|
20
|
+
onExpansionBodyListSupportingTextPress,
|
|
21
|
+
extraClasses,
|
|
22
|
+
}: GidsExpansionBodyListDomProps): HTMLElement => {
|
|
23
|
+
const expansionBodyList = document.createElement(
|
|
24
|
+
'gids-expansion-body-list',
|
|
25
|
+
) as GidsExpansionBodyListElement;
|
|
26
|
+
|
|
27
|
+
expansionBodyList.expansionBodyListItems = expansionBodyListItems;
|
|
28
|
+
|
|
29
|
+
expansionBodyList.className =
|
|
30
|
+
getGidsExpansionBodyListClassNames(extraClasses);
|
|
31
|
+
|
|
32
|
+
if (onExpansionBodyListSubtitlePress) {
|
|
33
|
+
expansionBodyList.onExpansionBodyListSubtitlePress =
|
|
34
|
+
onExpansionBodyListSubtitlePress;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
if (onExpansionBodyListSupportingTextPress) {
|
|
38
|
+
expansionBodyList.onExpansionBodyListSupportingTextPress =
|
|
39
|
+
onExpansionBodyListSupportingTextPress;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
return expansionBodyList;
|
|
43
|
+
};
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import {
|
|
2
|
+
GidsExpansionBodyListItemWebProps,
|
|
3
|
+
GidsExpansionBodyListItemWebUtils,
|
|
4
|
+
} from '@ganpatiinfo/gids-web-shared';
|
|
5
|
+
|
|
6
|
+
const { getGidsExpansionBodyListItemClassNames } =
|
|
7
|
+
GidsExpansionBodyListItemWebUtils;
|
|
8
|
+
|
|
9
|
+
type GidsExpansionBodyListItemBaseWebProps = GidsExpansionBodyListItemWebProps;
|
|
10
|
+
|
|
11
|
+
type GidsExpansionBodyListItemElement = HTMLElement &
|
|
12
|
+
GidsExpansionBodyListItemBaseWebProps;
|
|
13
|
+
|
|
14
|
+
export interface GidsExpansionBodyListItemDomProps extends GidsExpansionBodyListItemBaseWebProps {
|
|
15
|
+
extraClasses?: string;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export const GidsExpansionBodyListItemDom = ({
|
|
19
|
+
listItemId,
|
|
20
|
+
label,
|
|
21
|
+
subtitle,
|
|
22
|
+
supportingText,
|
|
23
|
+
displayTagVisible = false,
|
|
24
|
+
displayTagColor = 'accent-5',
|
|
25
|
+
displayTagLabel,
|
|
26
|
+
displayTagSize = 'xs',
|
|
27
|
+
displayTagAppearance = 'subtle',
|
|
28
|
+
onSubtitlePress,
|
|
29
|
+
onSupportingTextPress,
|
|
30
|
+
extraClasses,
|
|
31
|
+
}: GidsExpansionBodyListItemDomProps): HTMLElement => {
|
|
32
|
+
const expansionBodyListItem = document.createElement(
|
|
33
|
+
'gids-expansion-body-list-item',
|
|
34
|
+
) as GidsExpansionBodyListItemElement;
|
|
35
|
+
|
|
36
|
+
expansionBodyListItem.setAttribute('list-item-id', listItemId);
|
|
37
|
+
|
|
38
|
+
expansionBodyListItem.listItemId = listItemId;
|
|
39
|
+
expansionBodyListItem.label = label;
|
|
40
|
+
expansionBodyListItem.subtitle = subtitle;
|
|
41
|
+
expansionBodyListItem.supportingText = supportingText;
|
|
42
|
+
expansionBodyListItem.displayTagVisible = displayTagVisible;
|
|
43
|
+
expansionBodyListItem.displayTagColor = displayTagColor;
|
|
44
|
+
expansionBodyListItem.displayTagLabel = displayTagLabel;
|
|
45
|
+
expansionBodyListItem.displayTagSize = displayTagSize;
|
|
46
|
+
expansionBodyListItem.displayTagAppearance = displayTagAppearance;
|
|
47
|
+
|
|
48
|
+
expansionBodyListItem.className =
|
|
49
|
+
getGidsExpansionBodyListItemClassNames(extraClasses);
|
|
50
|
+
|
|
51
|
+
if (onSubtitlePress) {
|
|
52
|
+
expansionBodyListItem.onSubtitlePress = onSubtitlePress;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
if (onSupportingTextPress) {
|
|
56
|
+
expansionBodyListItem.onSupportingTextPress = onSupportingTextPress;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
return expansionBodyListItem;
|
|
60
|
+
};
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import {
|
|
2
|
+
GidsExpansionGroupWebProps,
|
|
3
|
+
GidsExpansionGroupWebUtils,
|
|
4
|
+
} from '@ganpatiinfo/gids-web-shared';
|
|
5
|
+
import { appendAsChildren, DomChildren } from '../../utils/domUtils';
|
|
6
|
+
|
|
7
|
+
const { getGidsExpansionGroupClassNames } = GidsExpansionGroupWebUtils;
|
|
8
|
+
|
|
9
|
+
type GidsExpansionGroupBaseWebProps = GidsExpansionGroupWebProps<DomChildren>;
|
|
10
|
+
|
|
11
|
+
type GidsExpansionGroupElement = HTMLElement & GidsExpansionGroupBaseWebProps;
|
|
12
|
+
|
|
13
|
+
export interface GidsExpansionGroupDomProps extends GidsExpansionGroupBaseWebProps {
|
|
14
|
+
extraClasses?: string;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export const GidsExpansionGroupDom = ({
|
|
18
|
+
children,
|
|
19
|
+
extraClasses,
|
|
20
|
+
}: GidsExpansionGroupDomProps): HTMLElement => {
|
|
21
|
+
const expansionGroup = document.createElement(
|
|
22
|
+
'gids-expansion-group',
|
|
23
|
+
) as GidsExpansionGroupElement;
|
|
24
|
+
|
|
25
|
+
if (children) {
|
|
26
|
+
appendAsChildren(expansionGroup, children);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
expansionGroup.className = getGidsExpansionGroupClassNames(extraClasses);
|
|
30
|
+
|
|
31
|
+
return expansionGroup;
|
|
32
|
+
};
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import {
|
|
2
|
+
GidsMdTableWebProps,
|
|
3
|
+
GidsMdTableWebUtils,
|
|
4
|
+
} from '@ganpatiinfo/gids-web-shared';
|
|
5
|
+
|
|
6
|
+
const { getGidsMdTableClassNames } = GidsMdTableWebUtils;
|
|
7
|
+
|
|
8
|
+
type GidsMdTableBaseWebProps = GidsMdTableWebProps;
|
|
9
|
+
|
|
10
|
+
type GidsMdTableElement = HTMLElement & GidsMdTableBaseWebProps;
|
|
11
|
+
|
|
12
|
+
export interface GidsMdTableDomProps extends GidsMdTableBaseWebProps {
|
|
13
|
+
extraClasses?: string;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export const GidsMdTableDom = ({
|
|
17
|
+
topHeaderCells = [],
|
|
18
|
+
tableBody = [],
|
|
19
|
+
width = 'full',
|
|
20
|
+
isTopHeaderVisible = false,
|
|
21
|
+
isSideHeaderVisible = false,
|
|
22
|
+
topHeaderAppearance = 'none',
|
|
23
|
+
topHeaderLabelTypography = 'eyebrow-small',
|
|
24
|
+
topHeaderTextAlignment = 'left',
|
|
25
|
+
sideHeaderAppearance = 'none',
|
|
26
|
+
sideHeaderLabelTypography = 'label-small',
|
|
27
|
+
sideHeaderTextAlignment = 'left',
|
|
28
|
+
rowAppearance = 'none',
|
|
29
|
+
rowLabelTypography = 'label-small',
|
|
30
|
+
rowTextAlignment = 'left',
|
|
31
|
+
tableBorders = 'none',
|
|
32
|
+
tableBorderRadius = [],
|
|
33
|
+
extraClasses,
|
|
34
|
+
}: GidsMdTableDomProps): HTMLElement => {
|
|
35
|
+
const mdTable = document.createElement('gids-md-table') as GidsMdTableElement;
|
|
36
|
+
|
|
37
|
+
mdTable.isTopHeaderVisible = isTopHeaderVisible;
|
|
38
|
+
mdTable.isSideHeaderVisible = isSideHeaderVisible;
|
|
39
|
+
mdTable.topHeaderAppearance = topHeaderAppearance;
|
|
40
|
+
mdTable.topHeaderLabelTypography = topHeaderLabelTypography;
|
|
41
|
+
mdTable.topHeaderTextAlignment = topHeaderTextAlignment;
|
|
42
|
+
mdTable.sideHeaderAppearance = sideHeaderAppearance;
|
|
43
|
+
mdTable.sideHeaderLabelTypography = sideHeaderLabelTypography;
|
|
44
|
+
mdTable.sideHeaderTextAlignment = sideHeaderTextAlignment;
|
|
45
|
+
mdTable.rowAppearance = rowAppearance;
|
|
46
|
+
mdTable.rowLabelTypography = rowLabelTypography;
|
|
47
|
+
mdTable.rowTextAlignment = rowTextAlignment;
|
|
48
|
+
mdTable.topHeaderCells = topHeaderCells;
|
|
49
|
+
mdTable.tableBody = tableBody;
|
|
50
|
+
mdTable.tableBorders = tableBorders;
|
|
51
|
+
mdTable.tableBorderRadius = tableBorderRadius;
|
|
52
|
+
mdTable.width = width;
|
|
53
|
+
|
|
54
|
+
mdTable.className = getGidsMdTableClassNames({ width }, extraClasses);
|
|
55
|
+
|
|
56
|
+
return mdTable;
|
|
57
|
+
};
|
|
@@ -1,31 +1,33 @@
|
|
|
1
1
|
import {
|
|
2
|
-
|
|
3
|
-
|
|
2
|
+
GidsSideMenuWebProps,
|
|
3
|
+
GidsSideMenuWebUtils,
|
|
4
4
|
} from '@ganpatiinfo/gids-web-shared';
|
|
5
5
|
import { appendAsChildren, DomChildren } from '../../utils/domUtils.js';
|
|
6
6
|
|
|
7
7
|
const { getGidsSideMenuClassNames } = GidsSideMenuWebUtils;
|
|
8
8
|
|
|
9
9
|
export interface GidsSideMenuDomProps extends GidsSideMenuWebProps<DomChildren> {
|
|
10
|
-
|
|
10
|
+
sideMenuExtraClasses?: string;
|
|
11
11
|
}
|
|
12
12
|
|
|
13
13
|
export const GidsSideMenuDom = ({
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
14
|
+
children,
|
|
15
|
+
sideMenuAppearance = 'default',
|
|
16
|
+
height = 'intrinsic',
|
|
17
|
+
sideMenuExtraClasses,
|
|
17
18
|
}: GidsSideMenuDomProps): HTMLDivElement => {
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
19
|
+
const sideMenu = document.createElement('div');
|
|
20
|
+
sideMenu.className = getGidsSideMenuClassNames(
|
|
21
|
+
{ sideMenuAppearance, height },
|
|
22
|
+
sideMenuExtraClasses,
|
|
23
|
+
);
|
|
23
24
|
|
|
24
|
-
|
|
25
|
+
sideMenu.setAttribute('side-menu-appearance', sideMenuAppearance);
|
|
26
|
+
sideMenu.setAttribute('side-menu-height', height);
|
|
25
27
|
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
28
|
+
if (children) {
|
|
29
|
+
appendAsChildren(sideMenu, children);
|
|
30
|
+
}
|
|
29
31
|
|
|
30
|
-
|
|
32
|
+
return sideMenu;
|
|
31
33
|
};
|