@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.
Files changed (50) hide show
  1. package/CHANGELOG.md +26 -0
  2. package/dist/components/GidsCheckbox/GidsCheckbox.js.map +1 -1
  3. package/dist/components/GidsPagination/GidsPagination.d.ts +8 -0
  4. package/dist/components/GidsPagination/GidsPagination.d.ts.map +1 -0
  5. package/dist/components/GidsPagination/GidsPagination.js +169 -0
  6. package/dist/components/GidsPagination/GidsPagination.js.map +1 -0
  7. package/dist/components/GidsRadio/GidsRadio.d.ts.map +1 -1
  8. package/dist/components/GidsRadio/GidsRadio.js.map +1 -1
  9. package/dist/components/GidsSectionNotice/GidsSectionNotice.d.ts.map +1 -1
  10. package/dist/components/GidsSectionNotice/GidsSectionNotice.js.map +1 -1
  11. package/dist/components/GidsSegmentedControl/GidsSegmentedControl.d.ts +9 -0
  12. package/dist/components/GidsSegmentedControl/GidsSegmentedControl.d.ts.map +1 -0
  13. package/dist/components/GidsSegmentedControl/GidsSegmentedControl.js +45 -0
  14. package/dist/components/GidsSegmentedControl/GidsSegmentedControl.js.map +1 -0
  15. package/dist/components/GidsSegmentedTabItem/GidsSegmentedTabItem.d.ts +9 -0
  16. package/dist/components/GidsSegmentedTabItem/GidsSegmentedTabItem.d.ts.map +1 -0
  17. package/dist/components/GidsSegmentedTabItem/GidsSegmentedTabItem.js +40 -0
  18. package/dist/components/GidsSegmentedTabItem/GidsSegmentedTabItem.js.map +1 -0
  19. package/dist/components/GidsSwitch/GidsSwitch.d.ts.map +1 -1
  20. package/dist/components/GidsSwitch/GidsSwitch.js.map +1 -1
  21. package/dist/components/_GidsCheckboxControl/GidsCheckboxControl.d.ts.map +1 -1
  22. package/dist/components/_GidsCheckboxControl/GidsCheckboxControl.js +1 -1
  23. package/dist/components/_GidsCheckboxControl/GidsCheckboxControl.js.map +1 -1
  24. package/dist/components/_GidsPaginationItem/GidsPaginationItem.d.ts +9 -0
  25. package/dist/components/_GidsPaginationItem/GidsPaginationItem.d.ts.map +1 -0
  26. package/dist/components/_GidsPaginationItem/GidsPaginationItem.js +26 -0
  27. package/dist/components/_GidsPaginationItem/GidsPaginationItem.js.map +1 -0
  28. package/dist/components/_GidsRadioControl/GidsRadioControl.d.ts.map +1 -1
  29. package/dist/components/_GidsRadioControl/GidsRadioControl.js +1 -1
  30. package/dist/components/_GidsRadioControl/GidsRadioControl.js.map +1 -1
  31. package/dist/components/_GidsSwitchControl/GidsSwitchControl.d.ts.map +1 -1
  32. package/dist/components/_GidsSwitchControl/GidsSwitchControl.js +1 -1
  33. package/dist/components/_GidsSwitchControl/GidsSwitchControl.js.map +1 -1
  34. package/dist/index.d.ts +4 -0
  35. package/dist/index.d.ts.map +1 -1
  36. package/dist/index.js +4 -0
  37. package/dist/index.js.map +1 -1
  38. package/package.json +7 -7
  39. package/src/components/GidsCheckbox/GidsCheckbox.ts +1 -1
  40. package/src/components/GidsPagination/GidsPagination.ts +233 -0
  41. package/src/components/GidsRadio/GidsRadio.ts +4 -1
  42. package/src/components/GidsSectionNotice/GidsSectionNotice.ts +74 -74
  43. package/src/components/GidsSegmentedControl/GidsSegmentedControl.ts +75 -0
  44. package/src/components/GidsSegmentedTabItem/GidsSegmentedTabItem.ts +75 -0
  45. package/src/components/GidsSwitch/GidsSwitch.ts +55 -52
  46. package/src/components/_GidsCheckboxControl/GidsCheckboxControl.ts +4 -1
  47. package/src/components/_GidsPaginationItem/GidsPaginationItem.ts +65 -0
  48. package/src/components/_GidsRadioControl/GidsRadioControl.ts +4 -1
  49. package/src/components/_GidsSwitchControl/GidsSwitchControl.ts +4 -1
  50. package/src/index.ts +4 -0
@@ -1,70 +1,73 @@
1
1
  import {
2
- type ClassValue,
3
- generateId,
4
- type GidsSwitchWebProps,
5
- GidsSwitchWebUtils,
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 { type DomChildren, type DomNodeOrString } from '../../utils/domUtils.js';
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
- extends GidsSwitchWebProps<DomChildren, DomNodeOrString> {
15
- onChange?: (this: HTMLInputElement, event: Event) => void;
16
- className?: ClassValue;
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
- // Label props
21
- children,
22
- fieldRequirement,
23
- fieldRequirementOptionalText,
24
- fieldRequirementRequiredText,
25
- info,
26
- labelId,
23
+ // Label props
24
+ children,
25
+ fieldRequirement,
26
+ fieldRequirementOptionalText,
27
+ fieldRequirementRequiredText,
28
+ info,
29
+ labelId,
27
30
 
28
- // Switch props
29
- checked,
30
- defaultChecked,
31
- disabled,
32
- inputId,
33
- name,
34
- value,
35
- onChange,
31
+ // Switch props
32
+ checked,
33
+ defaultChecked,
34
+ disabled,
35
+ inputId,
36
+ name,
37
+ value,
38
+ onChange,
36
39
 
37
- // SwitchWithLabel props
38
- className,
40
+ // SwitchWithLabel props
41
+ className,
39
42
  }: GidsSwitchDomProps): HTMLDivElement => {
40
- const switchElement = document.createElement('div');
41
- switchElement.className = getGidsSwitchClassNames(className);
43
+ const switchElement = document.createElement('div');
44
+ switchElement.className = getGidsSwitchClassNames(className);
42
45
 
43
- const realInputId = inputId ?? generateId();
46
+ const realInputId = inputId ?? generateId();
44
47
 
45
- switchElement.appendChild(
46
- GidsSwitchControlDom({
47
- checked,
48
- defaultChecked,
49
- disabled,
50
- inputId: realInputId,
51
- name,
52
- value,
53
- onChange,
54
- }),
55
- );
56
- switchElement.appendChild(
57
- GidsLabelDom({
58
- children,
59
- disabled,
60
- fieldRequirement,
61
- fieldRequirementOptionalText,
62
- fieldRequirementRequiredText,
63
- htmlFor: realInputId,
64
- info,
65
- labelId,
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
- return switchElement;
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 { applyStatefulInputProps, toggleAttribute } from '../../utils/domUtils.js';
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 { applyStatefulInputProps, toggleAttribute } from '../../utils/domUtils.js';
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 { applyStatefulInputProps, toggleAttribute } from '../../utils/domUtils.js';
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