@ganpatiinfo/gids-web-dom-reference 2.1.0 → 3.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 +24 -0
- package/dist/components/GidsBaseCard/GidsBaseCard.d.ts +8 -0
- package/dist/components/GidsBaseCard/GidsBaseCard.d.ts.map +1 -0
- package/dist/components/GidsBaseCard/GidsBaseCard.js +12 -0
- package/dist/components/GidsBaseCard/GidsBaseCard.js.map +1 -0
- package/dist/components/GidsCard/GidsCard.d.ts +8 -0
- package/dist/components/GidsCard/GidsCard.d.ts.map +1 -0
- package/dist/components/GidsCard/GidsCard.js +81 -0
- package/dist/components/GidsCard/GidsCard.js.map +1 -0
- package/dist/components/GidsCheckbox/GidsCheckbox.js.map +1 -1
- package/dist/components/GidsPagination/GidsPagination.d.ts +8 -0
- package/dist/components/GidsPagination/GidsPagination.d.ts.map +1 -0
- package/dist/components/GidsPagination/GidsPagination.js +169 -0
- package/dist/components/GidsPagination/GidsPagination.js.map +1 -0
- package/dist/components/GidsRadio/GidsRadio.d.ts.map +1 -1
- package/dist/components/GidsRadio/GidsRadio.js.map +1 -1
- package/dist/components/GidsSwitch/GidsSwitch.d.ts.map +1 -1
- package/dist/components/GidsSwitch/GidsSwitch.js.map +1 -1
- package/dist/components/_GidsCheckboxControl/GidsCheckboxControl.d.ts.map +1 -1
- package/dist/components/_GidsCheckboxControl/GidsCheckboxControl.js +1 -1
- package/dist/components/_GidsCheckboxControl/GidsCheckboxControl.js.map +1 -1
- package/dist/components/_GidsPaginationItem/GidsPaginationItem.d.ts +9 -0
- package/dist/components/_GidsPaginationItem/GidsPaginationItem.d.ts.map +1 -0
- package/dist/components/_GidsPaginationItem/GidsPaginationItem.js +26 -0
- package/dist/components/_GidsPaginationItem/GidsPaginationItem.js.map +1 -0
- package/dist/components/_GidsRadioControl/GidsRadioControl.d.ts.map +1 -1
- package/dist/components/_GidsRadioControl/GidsRadioControl.js +1 -1
- package/dist/components/_GidsRadioControl/GidsRadioControl.js.map +1 -1
- package/dist/components/_GidsSwitchControl/GidsSwitchControl.d.ts.map +1 -1
- package/dist/components/_GidsSwitchControl/GidsSwitchControl.js +1 -1
- package/dist/components/_GidsSwitchControl/GidsSwitchControl.js.map +1 -1
- package/dist/index.d.ts +4 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -0
- package/dist/index.js.map +1 -1
- package/package.json +7 -7
- package/src/components/GidsBaseCard/GidsBaseCard.ts +35 -0
- package/src/components/GidsCard/GidsCard.ts +122 -0
- package/src/components/GidsCheckbox/GidsCheckbox.ts +1 -1
- package/src/components/GidsPagination/GidsPagination.ts +233 -0
- package/src/components/GidsRadio/GidsRadio.ts +4 -1
- package/src/components/GidsSwitch/GidsSwitch.ts +55 -52
- package/src/components/_GidsCheckboxControl/GidsCheckboxControl.ts +4 -1
- package/src/components/_GidsPaginationItem/GidsPaginationItem.ts +65 -0
- package/src/components/_GidsRadioControl/GidsRadioControl.ts +4 -1
- package/src/components/_GidsSwitchControl/GidsSwitchControl.ts +4 -1
- package/src/index.ts +4 -0
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { type GidsBaseCardCommonProps } from '@ganpatiinfo/gids-core-shared';
|
|
2
|
+
import {
|
|
3
|
+
type ClassValue,
|
|
4
|
+
GidsBaseCardWebUtils,
|
|
5
|
+
} from '@ganpatiinfo/gids-web-shared';
|
|
6
|
+
import {
|
|
7
|
+
appendAsChildren,
|
|
8
|
+
type DomNodeOrString,
|
|
9
|
+
} from '../../utils/domUtils.js';
|
|
10
|
+
|
|
11
|
+
const { getGidsBaseCardClassNames } = GidsBaseCardWebUtils;
|
|
12
|
+
|
|
13
|
+
export interface GidsBaseCardDomProps
|
|
14
|
+
extends GidsBaseCardCommonProps<DomNodeOrString> {
|
|
15
|
+
extraClasses?: ClassValue;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export const GidsBaseCardDom = ({
|
|
19
|
+
children,
|
|
20
|
+
cardType = 'empty',
|
|
21
|
+
appearance = 'default',
|
|
22
|
+
extraClasses,
|
|
23
|
+
}: GidsBaseCardDomProps): HTMLDivElement => {
|
|
24
|
+
const baseCard = document.createElement('div');
|
|
25
|
+
baseCard.className = getGidsBaseCardClassNames(
|
|
26
|
+
{ cardType, appearance },
|
|
27
|
+
extraClasses,
|
|
28
|
+
);
|
|
29
|
+
|
|
30
|
+
if (children) {
|
|
31
|
+
appendAsChildren(baseCard, children);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
return baseCard;
|
|
35
|
+
};
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
import {
|
|
2
|
+
GidsCardCommonUtils,
|
|
3
|
+
type GidsCardCommonProps,
|
|
4
|
+
} from '@ganpatiinfo/gids-core-shared';
|
|
5
|
+
import {
|
|
6
|
+
type ClassValue,
|
|
7
|
+
GidsCardWebUtils,
|
|
8
|
+
} from '@ganpatiinfo/gids-web-shared';
|
|
9
|
+
import { appendAsChildren, type DomChildren } from '../../utils/domUtils.js';
|
|
10
|
+
import { GidsAvatarDom } from '../GidsAvatar/GidsAvatar.js';
|
|
11
|
+
import { GidsBaseCardDom } from '../GidsBaseCard/GidsBaseCard.js';
|
|
12
|
+
|
|
13
|
+
const { getGidsCardClassNames } = GidsCardWebUtils;
|
|
14
|
+
const { isContentContainerVisible, isSimpleCard } = GidsCardCommonUtils;
|
|
15
|
+
|
|
16
|
+
export interface GidsCardDomProps
|
|
17
|
+
extends GidsCardCommonProps<DomChildren, string, string> {
|
|
18
|
+
extraClasses?: ClassValue;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export const GidsCardDom = ({
|
|
22
|
+
cardHeaderType = 'image',
|
|
23
|
+
cardHeaderSrc,
|
|
24
|
+
children,
|
|
25
|
+
heading,
|
|
26
|
+
subHeading,
|
|
27
|
+
description,
|
|
28
|
+
baseCardAppearance = 'default',
|
|
29
|
+
headerVisible,
|
|
30
|
+
extraClasses,
|
|
31
|
+
}: GidsCardDomProps): HTMLDivElement => {
|
|
32
|
+
const card = document.createElement('div');
|
|
33
|
+
card.className = getGidsCardClassNames(
|
|
34
|
+
{ isSimpleCard: isSimpleCard({ cardHeaderSrc, headerVisible }) },
|
|
35
|
+
extraClasses,
|
|
36
|
+
);
|
|
37
|
+
|
|
38
|
+
const cardInnerContainer = document.createElement('div');
|
|
39
|
+
cardInnerContainer.className = isSimpleCard({ cardHeaderSrc, headerVisible })
|
|
40
|
+
? 'gids-card__simple-card-inner-container'
|
|
41
|
+
: 'gids-card__advanced-card-inner-container';
|
|
42
|
+
|
|
43
|
+
if (cardHeaderSrc && cardHeaderSrc !== '' && headerVisible) {
|
|
44
|
+
const headerContainer = document.createElement('div');
|
|
45
|
+
headerContainer.className =
|
|
46
|
+
cardHeaderType === 'avatar'
|
|
47
|
+
? 'gids-card__header-container-avatar'
|
|
48
|
+
: 'gids-card__header-container-image';
|
|
49
|
+
if (cardHeaderType === 'avatar') {
|
|
50
|
+
headerContainer.appendChild(
|
|
51
|
+
GidsAvatarDom({
|
|
52
|
+
appearance: 'image',
|
|
53
|
+
size: 'xl',
|
|
54
|
+
imageSrc: cardHeaderSrc,
|
|
55
|
+
}),
|
|
56
|
+
);
|
|
57
|
+
} else {
|
|
58
|
+
const image = document.createElement('img');
|
|
59
|
+
image.src = cardHeaderSrc!;
|
|
60
|
+
image.setAttribute('alt', 'alt_text');
|
|
61
|
+
image.className = 'gids-card__image';
|
|
62
|
+
headerContainer.appendChild(image);
|
|
63
|
+
}
|
|
64
|
+
cardInnerContainer.appendChild(headerContainer);
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
const contentContainer = document.createElement('div');
|
|
68
|
+
contentContainer.className = 'gids-card__content-container';
|
|
69
|
+
|
|
70
|
+
if (heading && heading !== '') {
|
|
71
|
+
const headingElement = document.createElement('div');
|
|
72
|
+
headingElement.className = 'gids-card__heading';
|
|
73
|
+
appendAsChildren(headingElement, heading);
|
|
74
|
+
contentContainer.appendChild(headingElement);
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
if (subHeading && subHeading !== '') {
|
|
78
|
+
const subHeadingElement = document.createElement('div');
|
|
79
|
+
subHeadingElement.className = 'gids-card__subheading';
|
|
80
|
+
appendAsChildren(subHeadingElement, subHeading);
|
|
81
|
+
contentContainer.appendChild(subHeadingElement);
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
if (description && description !== '') {
|
|
85
|
+
const descriptionElement = document.createElement('p');
|
|
86
|
+
descriptionElement.className = 'gids-card__description';
|
|
87
|
+
appendAsChildren(descriptionElement, description);
|
|
88
|
+
contentContainer.appendChild(descriptionElement);
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
if (children) {
|
|
92
|
+
const childrenElement = document.createElement('div');
|
|
93
|
+
childrenElement.className = 'gids-card__children';
|
|
94
|
+
|
|
95
|
+
appendAsChildren(childrenElement, children);
|
|
96
|
+
contentContainer.appendChild(childrenElement);
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
if (
|
|
100
|
+
isContentContainerVisible({
|
|
101
|
+
heading,
|
|
102
|
+
subHeading,
|
|
103
|
+
description,
|
|
104
|
+
children,
|
|
105
|
+
})
|
|
106
|
+
) {
|
|
107
|
+
cardInnerContainer.appendChild(contentContainer);
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
card.appendChild(
|
|
111
|
+
GidsBaseCardDom({
|
|
112
|
+
children: cardInnerContainer,
|
|
113
|
+
cardType: 'content',
|
|
114
|
+
appearance: baseCardAppearance,
|
|
115
|
+
extraClasses: isSimpleCard({ cardHeaderSrc, headerVisible })
|
|
116
|
+
? 'gids-card__base-card-simple'
|
|
117
|
+
: 'gids-card__base-card-advanced',
|
|
118
|
+
}),
|
|
119
|
+
);
|
|
120
|
+
|
|
121
|
+
return card;
|
|
122
|
+
};
|
|
@@ -0,0 +1,233 @@
|
|
|
1
|
+
import {
|
|
2
|
+
GidsPaginationCommonProps,
|
|
3
|
+
GidsPaginationCommonUtils,
|
|
4
|
+
} from '@ganpatiinfo/gids-core-shared';
|
|
5
|
+
import {
|
|
6
|
+
ClassValue,
|
|
7
|
+
GidsPaginationButtonParamsProps,
|
|
8
|
+
GidsPaginationWebUtils,
|
|
9
|
+
} from '@ganpatiinfo/gids-web-shared';
|
|
10
|
+
import { GidsPaginationItemDom } from '../_GidsPaginationItem/GidsPaginationItem.js';
|
|
11
|
+
import { IconName } from '@ganpatiinfo/gids-web-theme-interface';
|
|
12
|
+
|
|
13
|
+
const { getGidsPaginationClassNames, getGidsPaginationDotsClassNames } =
|
|
14
|
+
GidsPaginationWebUtils;
|
|
15
|
+
const { getPaginationsArr } = GidsPaginationCommonUtils;
|
|
16
|
+
|
|
17
|
+
export interface GidsPaginationDomProps
|
|
18
|
+
extends Omit<GidsPaginationCommonProps<string>, 'onClickItem'> {
|
|
19
|
+
extraClasses?: ClassValue;
|
|
20
|
+
onClickItem?: ({
|
|
21
|
+
event,
|
|
22
|
+
index,
|
|
23
|
+
page,
|
|
24
|
+
defaultPage,
|
|
25
|
+
type,
|
|
26
|
+
}: GidsPaginationButtonParamsProps<MouseEvent>) => void;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export const GidsPaginationDom = ({
|
|
30
|
+
selectColor = 'default',
|
|
31
|
+
variant = 'default',
|
|
32
|
+
shape = 'circled',
|
|
33
|
+
size = 'sm',
|
|
34
|
+
disabled = false,
|
|
35
|
+
count = 0,
|
|
36
|
+
defaultPage = 1,
|
|
37
|
+
page,
|
|
38
|
+
nextIcon,
|
|
39
|
+
previousIcon,
|
|
40
|
+
showFirstButton,
|
|
41
|
+
showLastButton,
|
|
42
|
+
hidePrevButton = false,
|
|
43
|
+
hideNextButton = false,
|
|
44
|
+
extraClasses,
|
|
45
|
+
onClickItem,
|
|
46
|
+
}: GidsPaginationDomProps): HTMLDivElement => {
|
|
47
|
+
const pagination = document.createElement('div');
|
|
48
|
+
pagination.className = getGidsPaginationClassNames(extraClasses);
|
|
49
|
+
|
|
50
|
+
if (count !== undefined && count > 0) {
|
|
51
|
+
let internalPage = 0;
|
|
52
|
+
if (defaultPage !== undefined && defaultPage > 0) {
|
|
53
|
+
internalPage = defaultPage;
|
|
54
|
+
}
|
|
55
|
+
if (page !== undefined && page > 0) {
|
|
56
|
+
internalPage = page;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
if (showFirstButton) {
|
|
60
|
+
pagination.appendChild(
|
|
61
|
+
GidsPaginationItemDom({
|
|
62
|
+
selectColor: 'none',
|
|
63
|
+
selected: false,
|
|
64
|
+
variant,
|
|
65
|
+
shape,
|
|
66
|
+
size,
|
|
67
|
+
isIcon: true,
|
|
68
|
+
icon: 'backward',
|
|
69
|
+
disabled: internalPage <= 1 || disabled,
|
|
70
|
+
onClickItem: (event: MouseEvent) => {
|
|
71
|
+
if (onClickItem) {
|
|
72
|
+
onClickItem({
|
|
73
|
+
event,
|
|
74
|
+
index: 0,
|
|
75
|
+
page: 1,
|
|
76
|
+
defaultPage,
|
|
77
|
+
type: 'first',
|
|
78
|
+
});
|
|
79
|
+
}
|
|
80
|
+
},
|
|
81
|
+
}),
|
|
82
|
+
);
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
if (!hidePrevButton) {
|
|
86
|
+
const newPagenumber = internalPage > 1 ? internalPage - 1 : 1;
|
|
87
|
+
// if (internalPage <= 0) {
|
|
88
|
+
// newPagenumber = internalPage > 1 ? internalPage - 1 : 1;
|
|
89
|
+
// }
|
|
90
|
+
pagination.appendChild(
|
|
91
|
+
GidsPaginationItemDom({
|
|
92
|
+
selectColor: 'none',
|
|
93
|
+
selected: false,
|
|
94
|
+
variant,
|
|
95
|
+
shape,
|
|
96
|
+
size,
|
|
97
|
+
isIcon: true,
|
|
98
|
+
icon:
|
|
99
|
+
previousIcon !== undefined &&
|
|
100
|
+
previousIcon !== '' &&
|
|
101
|
+
previousIcon !== '(none)'
|
|
102
|
+
? (previousIcon as IconName)
|
|
103
|
+
: 'chevron-left',
|
|
104
|
+
disabled: internalPage <= 1 || disabled,
|
|
105
|
+
onClickItem: (event: MouseEvent) => {
|
|
106
|
+
if (onClickItem) {
|
|
107
|
+
onClickItem({
|
|
108
|
+
event,
|
|
109
|
+
index: newPagenumber - 1,
|
|
110
|
+
page: newPagenumber,
|
|
111
|
+
defaultPage,
|
|
112
|
+
type: 'previous',
|
|
113
|
+
});
|
|
114
|
+
}
|
|
115
|
+
},
|
|
116
|
+
}),
|
|
117
|
+
);
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
const paginationsArr = getPaginationsArr({
|
|
121
|
+
pageNumber: internalPage,
|
|
122
|
+
count,
|
|
123
|
+
});
|
|
124
|
+
|
|
125
|
+
const newLength = paginationsArr.length;
|
|
126
|
+
|
|
127
|
+
Array.from({ length: newLength }, (_, i) => {
|
|
128
|
+
const dataObj = paginationsArr[i];
|
|
129
|
+
|
|
130
|
+
let selectedPage = false;
|
|
131
|
+
if (
|
|
132
|
+
internalPage > 0 &&
|
|
133
|
+
internalPage === Number(dataObj) &&
|
|
134
|
+
dataObj !== '...'
|
|
135
|
+
) {
|
|
136
|
+
selectedPage = true;
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
if (dataObj === '...') {
|
|
140
|
+
const terminatorBlock = document.createElement('div');
|
|
141
|
+
terminatorBlock.className = getGidsPaginationDotsClassNames({ size });
|
|
142
|
+
terminatorBlock.textContent = '...';
|
|
143
|
+
pagination.appendChild(terminatorBlock);
|
|
144
|
+
return;
|
|
145
|
+
}
|
|
146
|
+
pagination.appendChild(
|
|
147
|
+
GidsPaginationItemDom({
|
|
148
|
+
selectColor,
|
|
149
|
+
variant,
|
|
150
|
+
shape,
|
|
151
|
+
size,
|
|
152
|
+
children: `${dataObj}`,
|
|
153
|
+
isIcon: false,
|
|
154
|
+
icon: '(none)',
|
|
155
|
+
disabled,
|
|
156
|
+
selected: selectedPage,
|
|
157
|
+
onClickItem: (event: MouseEvent) => {
|
|
158
|
+
if (onClickItem) {
|
|
159
|
+
onClickItem({
|
|
160
|
+
event,
|
|
161
|
+
index: Number(dataObj) - 1,
|
|
162
|
+
page: Number(dataObj),
|
|
163
|
+
defaultPage,
|
|
164
|
+
type: 'page',
|
|
165
|
+
});
|
|
166
|
+
}
|
|
167
|
+
},
|
|
168
|
+
}),
|
|
169
|
+
);
|
|
170
|
+
});
|
|
171
|
+
|
|
172
|
+
if (!hideNextButton) {
|
|
173
|
+
const newPagenumber = internalPage < count ? internalPage + 1 : count;
|
|
174
|
+
// if (internalPage <= 0) {
|
|
175
|
+
// newPagenumber = internalPage < count ? internalPage + 1 : count;
|
|
176
|
+
// }
|
|
177
|
+
pagination.appendChild(
|
|
178
|
+
GidsPaginationItemDom({
|
|
179
|
+
selectColor: 'none',
|
|
180
|
+
selected: false,
|
|
181
|
+
variant,
|
|
182
|
+
shape,
|
|
183
|
+
size,
|
|
184
|
+
isIcon: true,
|
|
185
|
+
icon:
|
|
186
|
+
nextIcon !== undefined && nextIcon !== '' && nextIcon !== '(none)'
|
|
187
|
+
? (nextIcon as IconName)
|
|
188
|
+
: 'chevron-right',
|
|
189
|
+
disabled: internalPage >= count || disabled,
|
|
190
|
+
onClickItem: (event: MouseEvent) => {
|
|
191
|
+
if (onClickItem) {
|
|
192
|
+
onClickItem({
|
|
193
|
+
event,
|
|
194
|
+
index: newPagenumber - 1,
|
|
195
|
+
page: newPagenumber,
|
|
196
|
+
defaultPage,
|
|
197
|
+
type: 'next',
|
|
198
|
+
});
|
|
199
|
+
}
|
|
200
|
+
},
|
|
201
|
+
}),
|
|
202
|
+
);
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
if (showLastButton) {
|
|
206
|
+
pagination.appendChild(
|
|
207
|
+
GidsPaginationItemDom({
|
|
208
|
+
selectColor: 'none',
|
|
209
|
+
selected: false,
|
|
210
|
+
variant,
|
|
211
|
+
shape,
|
|
212
|
+
size,
|
|
213
|
+
isIcon: true,
|
|
214
|
+
icon: 'forward',
|
|
215
|
+
disabled: internalPage >= count || disabled,
|
|
216
|
+
onClickItem: (event: MouseEvent) => {
|
|
217
|
+
if (onClickItem) {
|
|
218
|
+
onClickItem({
|
|
219
|
+
event,
|
|
220
|
+
index: count - 1,
|
|
221
|
+
page: count,
|
|
222
|
+
defaultPage,
|
|
223
|
+
type: 'last',
|
|
224
|
+
});
|
|
225
|
+
}
|
|
226
|
+
},
|
|
227
|
+
}),
|
|
228
|
+
);
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
return pagination;
|
|
233
|
+
};
|
|
@@ -6,7 +6,10 @@ import {
|
|
|
6
6
|
} from '@ganpatiinfo/gids-web-shared';
|
|
7
7
|
import { GidsRadioControlDom } from '../_GidsRadioControl/GidsRadioControl.js';
|
|
8
8
|
import { GidsLabelDom } from '../GidsLabel/GidsLabel.js';
|
|
9
|
-
import {
|
|
9
|
+
import {
|
|
10
|
+
type DomChildren,
|
|
11
|
+
type DomNodeOrString,
|
|
12
|
+
} from '../../utils/domUtils.js';
|
|
10
13
|
|
|
11
14
|
const { getGidsRadioClassNames } = GidsRadioWebUtils;
|
|
12
15
|
|
|
@@ -1,70 +1,73 @@
|
|
|
1
1
|
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
2
|
+
type ClassValue,
|
|
3
|
+
generateId,
|
|
4
|
+
type GidsSwitchWebProps,
|
|
5
|
+
GidsSwitchWebUtils,
|
|
6
6
|
} from '@ganpatiinfo/gids-web-shared';
|
|
7
7
|
import { GidsSwitchControlDom } from '../_GidsSwitchControl/GidsSwitchControl.js';
|
|
8
8
|
import { GidsLabelDom } from '../GidsLabel/GidsLabel.js';
|
|
9
|
-
import {
|
|
9
|
+
import {
|
|
10
|
+
type DomChildren,
|
|
11
|
+
type DomNodeOrString,
|
|
12
|
+
} from '../../utils/domUtils.js';
|
|
10
13
|
|
|
11
14
|
const { getGidsSwitchClassNames } = GidsSwitchWebUtils;
|
|
12
15
|
|
|
13
16
|
export interface GidsSwitchDomProps
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
+
extends GidsSwitchWebProps<DomChildren, DomNodeOrString> {
|
|
18
|
+
onChange?: (this: HTMLInputElement, event: Event) => void;
|
|
19
|
+
className?: ClassValue;
|
|
17
20
|
}
|
|
18
21
|
|
|
19
22
|
export const GidsSwitchDom = ({
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
23
|
+
// Label props
|
|
24
|
+
children,
|
|
25
|
+
fieldRequirement,
|
|
26
|
+
fieldRequirementOptionalText,
|
|
27
|
+
fieldRequirementRequiredText,
|
|
28
|
+
info,
|
|
29
|
+
labelId,
|
|
27
30
|
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
31
|
+
// Switch props
|
|
32
|
+
checked,
|
|
33
|
+
defaultChecked,
|
|
34
|
+
disabled,
|
|
35
|
+
inputId,
|
|
36
|
+
name,
|
|
37
|
+
value,
|
|
38
|
+
onChange,
|
|
36
39
|
|
|
37
|
-
|
|
38
|
-
|
|
40
|
+
// SwitchWithLabel props
|
|
41
|
+
className,
|
|
39
42
|
}: GidsSwitchDomProps): HTMLDivElement => {
|
|
40
|
-
|
|
41
|
-
|
|
43
|
+
const switchElement = document.createElement('div');
|
|
44
|
+
switchElement.className = getGidsSwitchClassNames(className);
|
|
42
45
|
|
|
43
|
-
|
|
46
|
+
const realInputId = inputId ?? generateId();
|
|
44
47
|
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
48
|
+
switchElement.appendChild(
|
|
49
|
+
GidsSwitchControlDom({
|
|
50
|
+
checked,
|
|
51
|
+
defaultChecked,
|
|
52
|
+
disabled,
|
|
53
|
+
inputId: realInputId,
|
|
54
|
+
name,
|
|
55
|
+
value,
|
|
56
|
+
onChange,
|
|
57
|
+
}),
|
|
58
|
+
);
|
|
59
|
+
switchElement.appendChild(
|
|
60
|
+
GidsLabelDom({
|
|
61
|
+
children,
|
|
62
|
+
disabled,
|
|
63
|
+
fieldRequirement,
|
|
64
|
+
fieldRequirementOptionalText,
|
|
65
|
+
fieldRequirementRequiredText,
|
|
66
|
+
htmlFor: realInputId,
|
|
67
|
+
info,
|
|
68
|
+
labelId,
|
|
69
|
+
}),
|
|
70
|
+
);
|
|
68
71
|
|
|
69
|
-
|
|
72
|
+
return switchElement;
|
|
70
73
|
};
|
|
@@ -3,7 +3,10 @@ import {
|
|
|
3
3
|
type GidsCheckboxControlWebProps,
|
|
4
4
|
GidsCheckboxControlWebUtils,
|
|
5
5
|
} from '@ganpatiinfo/gids-web-shared';
|
|
6
|
-
import {
|
|
6
|
+
import {
|
|
7
|
+
applyStatefulInputProps,
|
|
8
|
+
toggleAttribute,
|
|
9
|
+
} from '../../utils/domUtils.js';
|
|
7
10
|
import { GidsIconDom } from '../GidsIcon/GidsIcon.js';
|
|
8
11
|
|
|
9
12
|
const { getGidsCheckboxControlClassNames } = GidsCheckboxControlWebUtils;
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import {
|
|
2
|
+
GidsPaginationItemCommonProps,
|
|
3
|
+
GidsPaginationItemCommonUtils,
|
|
4
|
+
} from '@ganpatiinfo/gids-core-shared';
|
|
5
|
+
import {
|
|
6
|
+
ClassValue,
|
|
7
|
+
GidsPaginationItemWebUtils,
|
|
8
|
+
} from '@ganpatiinfo/gids-web-shared';
|
|
9
|
+
import {
|
|
10
|
+
appendAsChildren,
|
|
11
|
+
DomChildren,
|
|
12
|
+
DomNodeOrString,
|
|
13
|
+
} from '../../utils/domUtils.js';
|
|
14
|
+
import { GidsIconDom } from '../GidsIcon/GidsIcon.js';
|
|
15
|
+
import { IconName } from '@ganpatiinfo/gids-web-theme-interface';
|
|
16
|
+
|
|
17
|
+
const { getGidsPaginationItemClassNames } = GidsPaginationItemWebUtils;
|
|
18
|
+
const { getPaginationItemIconSize } = GidsPaginationItemCommonUtils;
|
|
19
|
+
|
|
20
|
+
export interface GidsPaginationItemDomProps
|
|
21
|
+
extends GidsPaginationItemCommonProps<DomChildren, DomNodeOrString> {
|
|
22
|
+
extraClasses?: ClassValue;
|
|
23
|
+
onClickItem?: (event: MouseEvent) => void;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export const GidsPaginationItemDom = ({
|
|
27
|
+
selectColor = 'default',
|
|
28
|
+
variant = 'default',
|
|
29
|
+
shape = 'circled',
|
|
30
|
+
size = 'sm',
|
|
31
|
+
children,
|
|
32
|
+
isIcon = false,
|
|
33
|
+
icon,
|
|
34
|
+
disabled = false,
|
|
35
|
+
selected = false,
|
|
36
|
+
extraClasses,
|
|
37
|
+
onClickItem,
|
|
38
|
+
}: GidsPaginationItemDomProps): HTMLButtonElement => {
|
|
39
|
+
const paginationItem = document.createElement('button');
|
|
40
|
+
paginationItem.className = getGidsPaginationItemClassNames(
|
|
41
|
+
{ selectColor, shape, size, variant, disabled, selected },
|
|
42
|
+
extraClasses,
|
|
43
|
+
);
|
|
44
|
+
|
|
45
|
+
if (!isIcon && children) {
|
|
46
|
+
appendAsChildren(paginationItem, children);
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
if (isIcon && icon && icon !== '' && icon !== '(none)') {
|
|
50
|
+
paginationItem.appendChild(
|
|
51
|
+
GidsIconDom({
|
|
52
|
+
size: getPaginationItemIconSize({ size }),
|
|
53
|
+
name: icon as IconName,
|
|
54
|
+
appearance: 'regular',
|
|
55
|
+
alt: '',
|
|
56
|
+
}),
|
|
57
|
+
);
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
if (onClickItem && !disabled) {
|
|
61
|
+
paginationItem.addEventListener('click', onClickItem);
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
return paginationItem;
|
|
65
|
+
};
|
|
@@ -3,7 +3,10 @@ import {
|
|
|
3
3
|
type GidsRadioControlWebProps,
|
|
4
4
|
GidsRadioControlWebUtils,
|
|
5
5
|
} from '@ganpatiinfo/gids-web-shared';
|
|
6
|
-
import {
|
|
6
|
+
import {
|
|
7
|
+
applyStatefulInputProps,
|
|
8
|
+
toggleAttribute,
|
|
9
|
+
} from '../../utils/domUtils.js';
|
|
7
10
|
|
|
8
11
|
const { getGidsRadioControlClassNames } = GidsRadioControlWebUtils;
|
|
9
12
|
|
|
@@ -3,7 +3,10 @@ import {
|
|
|
3
3
|
type GidsSwitchControlWebProps,
|
|
4
4
|
GidsSwitchControlWebUtils,
|
|
5
5
|
} from '@ganpatiinfo/gids-web-shared';
|
|
6
|
-
import {
|
|
6
|
+
import {
|
|
7
|
+
applyStatefulInputProps,
|
|
8
|
+
toggleAttribute,
|
|
9
|
+
} from '../../utils/domUtils.js';
|
|
7
10
|
import { GidsIconDom } from '../GidsIcon/GidsIcon.js';
|
|
8
11
|
|
|
9
12
|
const { getGidsSwitchControlClassNames } = GidsSwitchControlWebUtils;
|
package/src/index.ts
CHANGED
|
@@ -34,6 +34,10 @@ export * from './components/GidsBox/GidsBox.js';
|
|
|
34
34
|
export * from './components/GidsContainer/GidsContainer.js';
|
|
35
35
|
export * from './components/GidsBreadcrumbItem/GidsBreadcrumbItem.js';
|
|
36
36
|
export * from './components/GidsBreadcrumb/GidsBreadcrumb.js';
|
|
37
|
+
export * from './components/GidsBaseCard/GidsBaseCard.js';
|
|
38
|
+
export * from './components/GidsCard/GidsCard.js';
|
|
39
|
+
export * from './components/_GidsPaginationItem/GidsPaginationItem.js';
|
|
40
|
+
export * from './components/GidsPagination/GidsPagination.js';
|
|
37
41
|
|
|
38
42
|
/**
|
|
39
43
|
* Utilities
|