@ganpatiinfo/gids-web-dom-reference 2.1.1 → 3.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +26 -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/GidsSectionNotice/GidsSectionNotice.d.ts.map +1 -1
- package/dist/components/GidsSectionNotice/GidsSectionNotice.js.map +1 -1
- package/dist/components/GidsSegmentedControl/GidsSegmentedControl.d.ts +9 -0
- package/dist/components/GidsSegmentedControl/GidsSegmentedControl.d.ts.map +1 -0
- package/dist/components/GidsSegmentedControl/GidsSegmentedControl.js +45 -0
- package/dist/components/GidsSegmentedControl/GidsSegmentedControl.js.map +1 -0
- package/dist/components/GidsSegmentedTabItem/GidsSegmentedTabItem.d.ts +9 -0
- package/dist/components/GidsSegmentedTabItem/GidsSegmentedTabItem.d.ts.map +1 -0
- package/dist/components/GidsSegmentedTabItem/GidsSegmentedTabItem.js +40 -0
- package/dist/components/GidsSegmentedTabItem/GidsSegmentedTabItem.js.map +1 -0
- 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/GidsCheckbox/GidsCheckbox.ts +1 -1
- package/src/components/GidsPagination/GidsPagination.ts +233 -0
- package/src/components/GidsRadio/GidsRadio.ts +4 -1
- package/src/components/GidsSectionNotice/GidsSectionNotice.ts +74 -74
- package/src/components/GidsSegmentedControl/GidsSegmentedControl.ts +75 -0
- package/src/components/GidsSegmentedTabItem/GidsSegmentedTabItem.ts +75 -0
- 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
|
@@ -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
|
@@ -36,6 +36,10 @@ export * from './components/GidsBreadcrumbItem/GidsBreadcrumbItem.js';
|
|
|
36
36
|
export * from './components/GidsBreadcrumb/GidsBreadcrumb.js';
|
|
37
37
|
export * from './components/GidsBaseCard/GidsBaseCard.js';
|
|
38
38
|
export * from './components/GidsCard/GidsCard.js';
|
|
39
|
+
export * from './components/_GidsPaginationItem/GidsPaginationItem.js';
|
|
40
|
+
export * from './components/GidsPagination/GidsPagination.js';
|
|
41
|
+
export * from './components/GidsSegmentedTabItem/GidsSegmentedTabItem.js';
|
|
42
|
+
export * from './components/GidsSegmentedControl/GidsSegmentedControl.js';
|
|
39
43
|
|
|
40
44
|
/**
|
|
41
45
|
* Utilities
|