@ganpatiinfo/gids-web-dom-reference 3.1.0 → 5.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.
Files changed (129) hide show
  1. package/CHANGELOG.md +75 -0
  2. package/dist/components/GidsDismissButton/GidsDismissButton.d.ts +8 -0
  3. package/dist/components/GidsDismissButton/GidsDismissButton.d.ts.map +1 -0
  4. package/dist/components/GidsDismissButton/GidsDismissButton.js +20 -0
  5. package/dist/components/GidsDismissButton/GidsDismissButton.js.map +1 -0
  6. package/dist/components/GidsField/GidsField.d.ts +7 -0
  7. package/dist/components/GidsField/GidsField.d.ts.map +1 -0
  8. package/dist/components/GidsField/GidsField.js +27 -0
  9. package/dist/components/GidsField/GidsField.js.map +1 -0
  10. package/dist/components/GidsHeading/GidsHeading.d.ts +7 -0
  11. package/dist/components/GidsHeading/GidsHeading.d.ts.map +1 -0
  12. package/dist/components/GidsHeading/GidsHeading.js +45 -0
  13. package/dist/components/GidsHeading/GidsHeading.js.map +1 -0
  14. package/dist/components/GidsInput/GidsInput.d.ts +18 -0
  15. package/dist/components/GidsInput/GidsInput.d.ts.map +1 -0
  16. package/dist/components/GidsInput/GidsInput.js +28 -0
  17. package/dist/components/GidsInput/GidsInput.js.map +1 -0
  18. package/dist/components/GidsLink/GidsLink.d.ts.map +1 -1
  19. package/dist/components/GidsLink/GidsLink.js.map +1 -1
  20. package/dist/components/GidsLogo/GidsLogo.d.ts +8 -0
  21. package/dist/components/GidsLogo/GidsLogo.d.ts.map +1 -0
  22. package/dist/components/GidsLogo/GidsLogo.js +25 -0
  23. package/dist/components/GidsLogo/GidsLogo.js.map +1 -0
  24. package/dist/components/GidsNotification/GidsNotification.d.ts +4 -0
  25. package/dist/components/GidsNotification/GidsNotification.d.ts.map +1 -0
  26. package/dist/components/GidsNotification/GidsNotification.js +30 -0
  27. package/dist/components/GidsNotification/GidsNotification.js.map +1 -0
  28. package/dist/components/GidsOverlayProvider/GidsOverlayProvider.d.ts +7 -0
  29. package/dist/components/GidsOverlayProvider/GidsOverlayProvider.d.ts.map +1 -0
  30. package/dist/components/GidsOverlayProvider/GidsOverlayProvider.js +7 -0
  31. package/dist/components/GidsOverlayProvider/GidsOverlayProvider.js.map +1 -0
  32. package/dist/components/GidsPasswordField/GidsPasswordField.d.ts +16 -0
  33. package/dist/components/GidsPasswordField/GidsPasswordField.d.ts.map +1 -0
  34. package/dist/components/GidsPasswordField/GidsPasswordField.js +34 -0
  35. package/dist/components/GidsPasswordField/GidsPasswordField.js.map +1 -0
  36. package/dist/components/GidsRequirementsMeter/GidsRequirementsMeter.d.ts +6 -0
  37. package/dist/components/GidsRequirementsMeter/GidsRequirementsMeter.d.ts.map +1 -0
  38. package/dist/components/GidsRequirementsMeter/GidsRequirementsMeter.js +48 -0
  39. package/dist/components/GidsRequirementsMeter/GidsRequirementsMeter.js.map +1 -0
  40. package/dist/components/GidsScrim/GidsScrim.d.ts +7 -0
  41. package/dist/components/GidsScrim/GidsScrim.d.ts.map +1 -0
  42. package/dist/components/GidsScrim/GidsScrim.js +12 -0
  43. package/dist/components/GidsScrim/GidsScrim.js.map +1 -0
  44. package/dist/components/GidsSearchBar/GidsSearchBar.d.ts +9 -0
  45. package/dist/components/GidsSearchBar/GidsSearchBar.d.ts.map +1 -0
  46. package/dist/components/GidsSearchBar/GidsSearchBar.js +59 -0
  47. package/dist/components/GidsSearchBar/GidsSearchBar.js.map +1 -0
  48. package/dist/components/GidsSegmentedControl/GidsSegmentedControl.d.ts +2 -2
  49. package/dist/components/GidsSegmentedControl/GidsSegmentedControl.d.ts.map +1 -1
  50. package/dist/components/GidsSegmentedControl/GidsSegmentedControl.js.map +1 -1
  51. package/dist/components/GidsSegmentedTabItem/GidsSegmentedTabItem.d.ts +3 -3
  52. package/dist/components/GidsSegmentedTabItem/GidsSegmentedTabItem.d.ts.map +1 -1
  53. package/dist/components/GidsSegmentedTabItem/GidsSegmentedTabItem.js +14 -1
  54. package/dist/components/GidsSegmentedTabItem/GidsSegmentedTabItem.js.map +1 -1
  55. package/dist/components/GidsSnackbar/GidsSnackbar.d.ts +4 -0
  56. package/dist/components/GidsSnackbar/GidsSnackbar.d.ts.map +1 -0
  57. package/dist/components/GidsSnackbar/GidsSnackbar.js +24 -0
  58. package/dist/components/GidsSnackbar/GidsSnackbar.js.map +1 -0
  59. package/dist/components/GidsStatusTag/GidsStatusTag.d.ts +6 -0
  60. package/dist/components/GidsStatusTag/GidsStatusTag.d.ts.map +1 -0
  61. package/dist/components/GidsStatusTag/GidsStatusTag.js +18 -0
  62. package/dist/components/GidsStatusTag/GidsStatusTag.js.map +1 -0
  63. package/dist/components/GidsStepper/GidsStepper.d.ts +8 -0
  64. package/dist/components/GidsStepper/GidsStepper.d.ts.map +1 -0
  65. package/dist/components/GidsStepper/GidsStepper.js +67 -0
  66. package/dist/components/GidsStepper/GidsStepper.js.map +1 -0
  67. package/dist/components/GidsStrengthMeter/GidsStrengthMeter.d.ts +6 -0
  68. package/dist/components/GidsStrengthMeter/GidsStrengthMeter.d.ts.map +1 -0
  69. package/dist/components/GidsStrengthMeter/GidsStrengthMeter.js +51 -0
  70. package/dist/components/GidsStrengthMeter/GidsStrengthMeter.js.map +1 -0
  71. package/dist/components/GidsTextField/GidsTextField.d.ts +13 -0
  72. package/dist/components/GidsTextField/GidsTextField.d.ts.map +1 -0
  73. package/dist/components/GidsTextField/GidsTextField.js +27 -0
  74. package/dist/components/GidsTextField/GidsTextField.js.map +1 -0
  75. package/dist/components/GidsTopNavigation/GidsTopNavigation.d.ts +9 -0
  76. package/dist/components/GidsTopNavigation/GidsTopNavigation.d.ts.map +1 -0
  77. package/dist/components/GidsTopNavigation/GidsTopNavigation.js +61 -0
  78. package/dist/components/GidsTopNavigation/GidsTopNavigation.js.map +1 -0
  79. package/dist/components/_GidsNotificationContainer/GidsNotificationContainer.d.ts +9 -0
  80. package/dist/components/_GidsNotificationContainer/GidsNotificationContainer.d.ts.map +1 -0
  81. package/dist/components/_GidsNotificationContainer/GidsNotificationContainer.js +73 -0
  82. package/dist/components/_GidsNotificationContainer/GidsNotificationContainer.js.map +1 -0
  83. package/dist/components/_GidsRequirementsMeterLabel/GidsRequirementsMeterLabel.d.ts +6 -0
  84. package/dist/components/_GidsRequirementsMeterLabel/GidsRequirementsMeterLabel.d.ts.map +1 -0
  85. package/dist/components/_GidsRequirementsMeterLabel/GidsRequirementsMeterLabel.js +26 -0
  86. package/dist/components/_GidsRequirementsMeterLabel/GidsRequirementsMeterLabel.js.map +1 -0
  87. package/dist/components/_GidsSideMenuItem/GidsSideMenuItem.d.ts +8 -0
  88. package/dist/components/_GidsSideMenuItem/GidsSideMenuItem.d.ts.map +1 -0
  89. package/dist/components/_GidsSideMenuItem/GidsSideMenuItem.js +62 -0
  90. package/dist/components/_GidsSideMenuItem/GidsSideMenuItem.js.map +1 -0
  91. package/dist/components/_GidsSnackbarContainer/GidsSnackbarContainer.d.ts +8 -0
  92. package/dist/components/_GidsSnackbarContainer/GidsSnackbarContainer.d.ts.map +1 -0
  93. package/dist/components/_GidsSnackbarContainer/GidsSnackbarContainer.js +37 -0
  94. package/dist/components/_GidsSnackbarContainer/GidsSnackbarContainer.js.map +1 -0
  95. package/dist/index.d.ts +21 -0
  96. package/dist/index.d.ts.map +1 -1
  97. package/dist/index.js +21 -0
  98. package/dist/index.js.map +1 -1
  99. package/dist/utils/domUtils.d.ts +2 -0
  100. package/dist/utils/domUtils.d.ts.map +1 -1
  101. package/dist/utils/domUtils.js +17 -0
  102. package/dist/utils/domUtils.js.map +1 -1
  103. package/package.json +3 -3
  104. package/src/components/GidsDismissButton/GidsDismissButton.ts +45 -0
  105. package/src/components/GidsField/GidsField.ts +55 -0
  106. package/src/components/GidsHeading/GidsHeading.ts +72 -0
  107. package/src/components/GidsInput/GidsInput.ts +64 -0
  108. package/src/components/GidsLink/GidsLink.ts +20 -20
  109. package/src/components/GidsLogo/GidsLogo.ts +60 -0
  110. package/src/components/GidsNotification/GidsNotification.ts +48 -0
  111. package/src/components/GidsOverlayProvider/GidsOverlayProvider.ts +16 -0
  112. package/src/components/GidsPasswordField/GidsPasswordField.ts +77 -0
  113. package/src/components/GidsRequirementsMeter/GidsRequirementsMeter.ts +71 -0
  114. package/src/components/GidsScrim/GidsScrim.ts +25 -0
  115. package/src/components/GidsSearchBar/GidsSearchBar.ts +103 -0
  116. package/src/components/GidsSegmentedControl/GidsSegmentedControl.ts +3 -2
  117. package/src/components/GidsSegmentedTabItem/GidsSegmentedTabItem.ts +23 -2
  118. package/src/components/GidsSnackbar/GidsSnackbar.ts +40 -0
  119. package/src/components/GidsStatusTag/GidsStatusTag.ts +43 -0
  120. package/src/components/GidsStepper/GidsStepper.ts +94 -0
  121. package/src/components/GidsStrengthMeter/GidsStrengthMeter.ts +78 -0
  122. package/src/components/GidsTextField/GidsTextField.ts +59 -0
  123. package/src/components/GidsTopNavigation/GidsTopNavigation.ts +124 -0
  124. package/src/components/_GidsNotificationContainer/GidsNotificationContainer.ts +125 -0
  125. package/src/components/_GidsRequirementsMeterLabel/GidsRequirementsMeterLabel.ts +50 -0
  126. package/src/components/_GidsSideMenuItem/GidsSideMenuItem.ts +108 -0
  127. package/src/components/_GidsSnackbarContainer/GidsSnackbarContainer.ts +68 -0
  128. package/src/index.ts +21 -0
  129. package/src/utils/domUtils.ts +75 -48
@@ -0,0 +1,64 @@
1
+ import { type GidsInputWebProps } from '@ganpatiinfo/gids-web-shared';
2
+ import { assignToSlot } from '../../utils/domUtils.js';
3
+
4
+ export interface HtmlInputAttributes {
5
+ id?: string;
6
+ placeholder?: string;
7
+ pattern?: string;
8
+ autocompleted?: string;
9
+ type?: string;
10
+ maxlength?: number;
11
+ }
12
+
13
+ export interface GidsInputDomProps extends GidsInputWebProps<
14
+ Element,
15
+ HtmlInputAttributes
16
+ > {
17
+ onChange?: (this: HTMLInputElement, event: Event) => void;
18
+ onInput?: (this: HTMLInputElement, event: Event) => void;
19
+ onFocus?: (this: HTMLInputElement, event: Event) => void;
20
+ onBlur?: (this: HTMLInputElement, event: Event) => void;
21
+ extraClasses?: string;
22
+ }
23
+
24
+ export const GidsInputDom = ({
25
+ leadingIcon,
26
+ leadingAccessory,
27
+ trailingAccessory,
28
+ trailingIcon,
29
+ onChange,
30
+ onInput,
31
+ onFocus,
32
+ onBlur,
33
+ extraClasses,
34
+ ...rest
35
+ }: GidsInputDomProps): HTMLElement => {
36
+ const input = document.createElement('gids-input');
37
+
38
+ Object.assign(input, rest);
39
+
40
+ // Elements Slot
41
+ assignToSlot(input, 'leadingIcon', leadingIcon);
42
+ assignToSlot(input, 'leadingAccessory', leadingAccessory);
43
+ assignToSlot(input, 'trailingAccessory', trailingAccessory);
44
+ assignToSlot(input, 'trailingIcon', trailingIcon);
45
+
46
+ // Event Listeners
47
+ if (onChange) {
48
+ input.addEventListener('change', onChange);
49
+ }
50
+ if (onInput) {
51
+ input.addEventListener('input', onInput);
52
+ }
53
+ if (onFocus) {
54
+ input.addEventListener('focus', onFocus);
55
+ }
56
+ if (onBlur) {
57
+ input.addEventListener('blur', onBlur);
58
+ }
59
+ if (extraClasses) {
60
+ input.className = extraClasses;
61
+ }
62
+
63
+ return input;
64
+ };
@@ -1,37 +1,37 @@
1
1
  import { type GidsLinkCommonProps } from '@ganpatiinfo/gids-core-shared';
2
2
  import { appendAsChildren, type DomChildren } from '../../utils/domUtils.js';
3
3
  import {
4
- type ClassValue,
5
- GidsLinkWebUtils,
4
+ type ClassValue,
5
+ GidsLinkWebUtils,
6
6
  } from '@ganpatiinfo/gids-web-shared';
7
7
 
8
8
  const { getGidsLinkClassNames } = GidsLinkWebUtils;
9
9
 
10
10
  export interface GidsLinkDomProps extends GidsLinkCommonProps<DomChildren> {
11
- extraClasses?: ClassValue;
12
- href?: string;
13
- onClick?: (this: HTMLInputElement, event: Event) => void;
11
+ extraClasses?: ClassValue;
12
+ href?: string;
13
+ onClick?: (this: HTMLInputElement, event: Event) => void;
14
14
  }
15
15
 
16
16
  export const GidsLinkDom = ({
17
- children,
18
- size,
19
- extraClasses,
20
- href,
21
- onClick,
17
+ children,
18
+ size,
19
+ extraClasses,
20
+ href,
21
+ onClick,
22
22
  }: GidsLinkDomProps): HTMLAnchorElement => {
23
- const linkElement = document.createElement('a');
24
- linkElement.className = getGidsLinkClassNames({ size }, extraClasses);
23
+ const linkElement = document.createElement('a');
24
+ linkElement.className = getGidsLinkClassNames({ size }, extraClasses);
25
25
 
26
- appendAsChildren(linkElement, children);
26
+ appendAsChildren(linkElement, children);
27
27
 
28
- if (href) {
29
- linkElement.setAttribute('href', href);
30
- }
28
+ if (href) {
29
+ linkElement.setAttribute('href', href);
30
+ }
31
31
 
32
- if (onClick) {
33
- linkElement.addEventListener('click', onClick);
34
- }
32
+ if (onClick) {
33
+ linkElement.addEventListener('click', onClick);
34
+ }
35
35
 
36
- return linkElement;
36
+ return linkElement;
37
37
  };
@@ -0,0 +1,60 @@
1
+ import {
2
+ type ClassValue,
3
+ type GidsLogoWebProps,
4
+ GidsLogoWebUtils,
5
+ } from '@ganpatiinfo/gids-web-shared';
6
+ import clsx from 'clsx';
7
+
8
+ const { getGidsLogoClassNames } = GidsLogoWebUtils;
9
+
10
+ export interface GidsLogoDomProps
11
+ extends
12
+ GidsLogoWebProps<string, string>,
13
+ Omit<Partial<HTMLAnchorElement>, 'href' | 'class'> {
14
+ extraClasses?: ClassValue;
15
+ imgClasses?: ClassValue;
16
+ imgProps?: Omit<
17
+ Partial<HTMLImageElement>,
18
+ 'src' | 'alt' | 'class' | 'height'
19
+ >;
20
+ }
21
+
22
+ export const GidsLogoDom = ({
23
+ src,
24
+ href,
25
+ alt,
26
+ clickable,
27
+ extraClasses,
28
+ imgClasses,
29
+ imgProps,
30
+ imgHeight = '100',
31
+ ...restProps
32
+ }: GidsLogoDomProps): HTMLAnchorElement => {
33
+ const linkElement = document.createElement('a');
34
+ linkElement.className = getGidsLogoClassNames(extraClasses);
35
+ if (restProps) {
36
+ Object.assign(linkElement, restProps);
37
+ }
38
+
39
+ if (clickable && href && href !== '') {
40
+ linkElement.setAttribute('href', href);
41
+ }
42
+
43
+ if (src && src !== '') {
44
+ const imgElement = document.createElement('img');
45
+ imgElement.className = clsx(
46
+ `gids-logo__img gids-logo__img-height-${imgHeight}`,
47
+ imgClasses,
48
+ );
49
+ imgElement.setAttribute('src', src);
50
+ imgElement.setAttribute('alt', alt ? alt : 'logo');
51
+
52
+ if (imgProps) {
53
+ Object.assign(imgElement, imgProps);
54
+ }
55
+
56
+ linkElement.appendChild(imgElement);
57
+ }
58
+
59
+ return linkElement;
60
+ };
@@ -0,0 +1,48 @@
1
+ import { type GidsNotificationWebProps } from '@ganpatiinfo/gids-web-shared';
2
+
3
+ export type GidsNotificationDomProps = GidsNotificationWebProps;
4
+
5
+ export const GidsNotificationDom = ({
6
+ notificationTitle,
7
+ message,
8
+ pronunciation,
9
+ appearance = 'default',
10
+ show,
11
+ onQueueNotification,
12
+ buttonLabel,
13
+ onButtonClick,
14
+ position = 'bottom-center',
15
+ timerInMs,
16
+ }: GidsNotificationDomProps): HTMLElement => {
17
+ const notification = document.createElement('gids-notification');
18
+
19
+ if (notificationTitle) {
20
+ notification.setAttribute('notification-title', notificationTitle);
21
+ }
22
+ if (message) {
23
+ notification.setAttribute('message', message);
24
+ }
25
+ if (pronunciation) {
26
+ notification.setAttribute('pronunciation', pronunciation);
27
+ }
28
+ if (appearance) {
29
+ notification.setAttribute('appearance', appearance);
30
+ }
31
+ notification.setAttribute('position', position);
32
+ notification.setAttribute('timer-in-ms', timerInMs ? `${timerInMs}` : '0');
33
+
34
+ notification.toggleAttribute('show', show ? show : false);
35
+
36
+ if (onQueueNotification) {
37
+ notification.addEventListener('queueNotification', onQueueNotification);
38
+ }
39
+ if (buttonLabel) {
40
+ notification.setAttribute('button-label', buttonLabel);
41
+ }
42
+ if (onButtonClick) {
43
+ // @ts-expect-error Expected
44
+ notification.onButtonClick = onButtonClick;
45
+ }
46
+
47
+ return notification;
48
+ };
@@ -0,0 +1,16 @@
1
+ import { GidsOverlayProviderCommonProps } from '@ganpatiinfo/gids-core-shared';
2
+ import { appendAsChildren, DomChildren } from '../../utils/domUtils.js';
3
+
4
+ export interface GidsOverlayProviderDomProps extends GidsOverlayProviderCommonProps<DomChildren> {
5
+ extraClasses?: string;
6
+ }
7
+
8
+ export const GidsOverlayProviderDom = ({
9
+ children,
10
+ }: GidsOverlayProviderDomProps): HTMLElement => {
11
+ const overlayProvider = document.createElement('gids-overlay-provider');
12
+
13
+ appendAsChildren(overlayProvider, children);
14
+
15
+ return overlayProvider;
16
+ };
@@ -0,0 +1,77 @@
1
+ import { type GidsPasswordFieldWebProps } from '@ganpatiinfo/gids-web-shared';
2
+ import { assignToSlot } from '../../utils/domUtils.js';
3
+ import { type HtmlInputAttributes } from '../GidsInput/GidsInput.js';
4
+
5
+ export interface GidsPasswordFieldDomProps extends GidsPasswordFieldWebProps<
6
+ Element,
7
+ HtmlInputAttributes
8
+ > {
9
+ info?: Element;
10
+ className?: string;
11
+ onGidsPasswordFieldClear?: (event: CustomEvent<void>) => void;
12
+ onGidsPasswordFieldRevealPassword?: (
13
+ event: CustomEvent<{ passwordRevealed: boolean }>,
14
+ ) => void;
15
+ onChange?: (event: Event) => void;
16
+ onInput?: (event: InputEvent) => void;
17
+ onFocus?: (event: FocusEvent) => void;
18
+ onBlur?: (event: FocusEvent) => void;
19
+ }
20
+
21
+ export const GidsPasswordFieldDom = (
22
+ props: GidsPasswordFieldDomProps,
23
+ ): HTMLElement => {
24
+ const {
25
+ info,
26
+ leadingIcon,
27
+ onGidsPasswordFieldClear,
28
+ onGidsPasswordFieldRevealPassword,
29
+ onChange,
30
+ onInput,
31
+ onFocus,
32
+ onBlur,
33
+ ...restProps
34
+ } = props;
35
+
36
+ const passwordFieldComponent = document.createElement('gids-password-field');
37
+ Object.assign(passwordFieldComponent, restProps);
38
+ passwordFieldComponent.setAttribute('type', 'password');
39
+
40
+ assignToSlot(passwordFieldComponent, 'info', info);
41
+ assignToSlot(passwordFieldComponent, 'leadingIcon', leadingIcon);
42
+
43
+ if (onChange) {
44
+ passwordFieldComponent.addEventListener('change', onChange);
45
+ }
46
+ if (onInput) {
47
+ passwordFieldComponent.addEventListener(
48
+ 'input',
49
+ onInput as (e: Event) => void,
50
+ );
51
+ }
52
+ if (onFocus) {
53
+ passwordFieldComponent.addEventListener('focus', onFocus);
54
+ }
55
+ if (onBlur) {
56
+ passwordFieldComponent.addEventListener('blur', onBlur);
57
+ }
58
+ if (onGidsPasswordFieldClear) {
59
+ // @ts-expect-error This is a custom event so ts complaining
60
+ passwordFieldComponent.addEventListener(
61
+ 'gidsPasswordFieldClear',
62
+ onGidsPasswordFieldClear,
63
+ );
64
+ }
65
+ if (onGidsPasswordFieldRevealPassword) {
66
+ // @ts-expect-error This is a custom event so ts complaining
67
+ passwordFieldComponent.addEventListener(
68
+ 'gidsPasswordFieldRevealPassword',
69
+ (event: CustomEvent) => {
70
+ // Stencil data is always nested inside 'detail'
71
+ onGidsPasswordFieldRevealPassword(event.detail);
72
+ },
73
+ );
74
+ }
75
+
76
+ return passwordFieldComponent;
77
+ };
@@ -0,0 +1,71 @@
1
+ import {
2
+ type GidsRequirementsMeterCommonProps,
3
+ GidsRequirementsMeterCommonUtils,
4
+ GidsRequirementsProps,
5
+ } from '@ganpatiinfo/gids-core-shared';
6
+ import { GidsRequirementsMeterWebUtils } from '@ganpatiinfo/gids-web-shared';
7
+ import { GidsRequirementsMeterLabelDom } from '../_GidsRequirementsMeterLabel/GidsRequirementsMeterLabel.js';
8
+ import { minLengthRuleCanBeApplied } from '@ganpatiinfo/gids-core-shared/dist/components/GidsRequirementsMeter/GidsRequirementsMeterCommonUtils.js';
9
+
10
+ const { getGidsRequirementsMeterClassNames } = GidsRequirementsMeterWebUtils;
11
+ const { checkRequirementRuleSatisfied } = GidsRequirementsMeterCommonUtils;
12
+
13
+ export interface GidsRequirementsMeterDomProps extends GidsRequirementsMeterCommonProps {
14
+ extraClasses?: string;
15
+ }
16
+
17
+ export const GidsRequirementsMeterDom = (
18
+ props: GidsRequirementsMeterDomProps,
19
+ ): HTMLDivElement => {
20
+ const { text, textMinLength, requirements = [], extraClasses } = props;
21
+
22
+ const requirementsMeter = document.createElement('div');
23
+ requirementsMeter.className =
24
+ getGidsRequirementsMeterClassNames(extraClasses);
25
+
26
+ const renderRequirements = (
27
+ isSatisfied: boolean,
28
+ requirement: GidsRequirementsProps,
29
+ ) => {
30
+ if (isSatisfied) {
31
+ requirementsMeter.append(
32
+ GidsRequirementsMeterLabelDom({
33
+ label: requirement.requirementText,
34
+ status: 'success',
35
+ }),
36
+ );
37
+ } else {
38
+ requirementsMeter.append(
39
+ GidsRequirementsMeterLabelDom({
40
+ label: requirement.requirementText,
41
+ status: 'error',
42
+ }),
43
+ );
44
+ }
45
+ };
46
+
47
+ requirements.map((requirement) => {
48
+ if (requirement?.requirementText && requirement?.requirementRule) {
49
+ const isSatisfied = checkRequirementRuleSatisfied({
50
+ rule: requirement.requirementRule,
51
+ textMinLength,
52
+ text,
53
+ });
54
+
55
+ if (requirement.requirementRule == 'include-min-length') {
56
+ if (
57
+ minLengthRuleCanBeApplied({
58
+ requirementRule: requirement.requirementRule,
59
+ textMinLength,
60
+ })
61
+ ) {
62
+ renderRequirements(isSatisfied, requirement);
63
+ }
64
+ } else {
65
+ renderRequirements(isSatisfied, requirement);
66
+ }
67
+ }
68
+ });
69
+
70
+ return requirementsMeter;
71
+ };
@@ -0,0 +1,25 @@
1
+ import {
2
+ type GidsScrimWebProps,
3
+ GidsScrimWebUtils,
4
+ } from '@ganpatiinfo/gids-web-shared';
5
+ import { appendAsChildren, type DomChildren } from '../../utils/domUtils.js';
6
+
7
+ const { getGidsScrimClassNames } = GidsScrimWebUtils;
8
+
9
+ export interface GidsScrimDomProps extends GidsScrimWebProps<DomChildren> {
10
+ extraClasses?: string;
11
+ }
12
+
13
+ export const GidsScrimDom = ({
14
+ children,
15
+ extraClasses,
16
+ }: GidsScrimDomProps): HTMLElement => {
17
+ const scrimEl = document.createElement('gids-scrim');
18
+ scrimEl.className = getGidsScrimClassNames(extraClasses);
19
+
20
+ if (children) {
21
+ appendAsChildren(scrimEl, children);
22
+ }
23
+
24
+ return scrimEl;
25
+ };
@@ -0,0 +1,103 @@
1
+ import {
2
+ type GidsSearchBarWebProps,
3
+ GidsSearchBarWebUtils,
4
+ } from '@ganpatiinfo/gids-web-shared';
5
+ import { type HtmlInputAttributes } from '../GidsInput/GidsInput.js';
6
+ import {
7
+ GidsTextFieldDom,
8
+ GidsTextFieldDomProps,
9
+ } from '../GidsTextField/GidsTextField.js';
10
+ import { GidsIconDom } from '../GidsIcon/GidsIcon.js';
11
+ import { GidsSearchBarCommonUtils } from '@ganpatiinfo/gids-core-shared';
12
+
13
+ const { getSearchBarValue } = GidsSearchBarCommonUtils;
14
+ const { getSearchBarType, getSearchBarClassNames } = GidsSearchBarWebUtils;
15
+
16
+ export interface GidsSearchBarDomProps
17
+ extends
18
+ GidsSearchBarWebProps<Element, HtmlInputAttributes>,
19
+ Pick<
20
+ GidsTextFieldDomProps,
21
+ 'className' | 'onChange' | 'onInput' | 'onFocus' | 'onBlur'
22
+ > {
23
+ wrapperClass?: string;
24
+ onGidsSearchBarClear?: (event: CustomEvent<void>) => void;
25
+ }
26
+
27
+ export const GidsSearchBarDom = (
28
+ props: GidsSearchBarDomProps,
29
+ ): HTMLDivElement => {
30
+ const {
31
+ wrapperClass,
32
+ leadingIcon,
33
+ onGidsSearchBarClear,
34
+ onChange,
35
+ onInput,
36
+ onFocus,
37
+ onBlur,
38
+ type = 'default',
39
+ value = '',
40
+ inputProps,
41
+ ...restProps
42
+ } = props;
43
+
44
+ const newValue = getSearchBarValue(value);
45
+ const textFieldType = getSearchBarType(type);
46
+
47
+ // 2. Render your initial DOM exactly once
48
+ const searchBar = document.createElement('div');
49
+ searchBar.className = getSearchBarClassNames(wrapperClass);
50
+
51
+ const updatedLeadingIcon = leadingIcon
52
+ ? leadingIcon
53
+ : GidsIconDom({
54
+ name: 'search',
55
+ appearance: 'regular',
56
+ size: 'md',
57
+ });
58
+
59
+ const gidsSearchBarClear = (event: CustomEvent<void>) => {
60
+ onGidsSearchBarClear?.(event);
61
+ };
62
+
63
+ const gidsOnChange = (event: Event) => {
64
+ if (onChange) {
65
+ onChange(event);
66
+ }
67
+ };
68
+
69
+ const gidsOnInput = (event: InputEvent) => {
70
+ if (onInput) {
71
+ onInput(event);
72
+ }
73
+ };
74
+
75
+ const textFieldProps: GidsTextFieldDomProps = {
76
+ ...restProps,
77
+ leadingAccessory: undefined,
78
+ showClearButton: true,
79
+ leadingIcon: updatedLeadingIcon,
80
+ onGidsTextFieldClear: gidsSearchBarClear,
81
+ onChange: gidsOnChange,
82
+ onInput: gidsOnInput,
83
+ onFocus,
84
+ onBlur,
85
+ type: textFieldType,
86
+ label: undefined,
87
+ value: newValue,
88
+ inputProps: {
89
+ ...inputProps,
90
+ placeholder:
91
+ inputProps?.placeholder && inputProps.placeholder !== ''
92
+ ? inputProps.placeholder
93
+ : 'Search',
94
+ },
95
+ };
96
+
97
+ // 3. Create the text field once
98
+ const textField = GidsTextFieldDom(textFieldProps);
99
+
100
+ searchBar.append(textField);
101
+
102
+ return searchBar;
103
+ };
@@ -6,14 +6,15 @@ import {
6
6
  type ClassValue,
7
7
  GidsSegmentedControlWebUtils,
8
8
  } from '@ganpatiinfo/gids-web-shared';
9
- import { type DomNodeOrString } from '../../utils/domUtils.js';
9
+ import { DomChildren, type DomNodeOrString } from '../../utils/domUtils.js';
10
10
  import { GidsSegmentedTabItemDom } from '../GidsSegmentedTabItem/GidsSegmentedTabItem.js';
11
11
 
12
12
  const { getGidsSegmentedControlClassNames } = GidsSegmentedControlWebUtils;
13
13
 
14
14
  export interface GidsSegmentedControlDomProps extends GidsSegmentedControlCommonProps<
15
15
  DomNodeOrString,
16
- string
16
+ string,
17
+ DomChildren
17
18
  > {
18
19
  onPress?: (props: GidsSegmentedTabItemPressedReturnedProps) => void;
19
20
  className?: ClassValue;
@@ -7,20 +7,27 @@ import {
7
7
  GidsSegmentedTabItemWebUtils,
8
8
  } from '@ganpatiinfo/gids-web-shared';
9
9
  import clsx from 'clsx';
10
- import { type DomNodeOrString } from '../../utils/domUtils.js';
10
+ import {
11
+ appendAsChildren,
12
+ DomChildren,
13
+ type DomNodeOrString,
14
+ } from '../../utils/domUtils.js';
11
15
  import { GidsBadgeDom } from '../GidsBadge/GidsBadge.js';
12
16
 
13
17
  const { getGidsSegmentedTabItemClassNames } = GidsSegmentedTabItemWebUtils;
14
18
 
15
19
  export interface GidsSegmentedTabItemDomProps extends GidsSegmentedTabItemCommonProps<
16
20
  DomNodeOrString,
17
- string
21
+ string,
22
+ DomChildren
18
23
  > {
19
24
  onPress?: (props: GidsSegmentedTabItemPressedReturnedProps) => void;
20
25
  className?: ClassValue;
21
26
  }
22
27
 
23
28
  export const GidsSegmentedTabItemDom = ({
29
+ leadingIcon,
30
+ trailingIcon,
24
31
  index,
25
32
  label,
26
33
  selected = false,
@@ -47,6 +54,13 @@ export const GidsSegmentedTabItemDom = ({
47
54
  }
48
55
  });
49
56
 
57
+ if (leadingIcon) {
58
+ const leadingIconContainer = document.createElement('div');
59
+ leadingIconContainer.className = 'gids-segmented-item__icons';
60
+ appendAsChildren(leadingIconContainer, leadingIcon);
61
+ segmentedTabItem.appendChild(leadingIconContainer);
62
+ }
63
+
50
64
  if (label && label !== '') {
51
65
  if (typeof label === 'string') {
52
66
  const labelElement = document.createElement('label');
@@ -60,6 +74,13 @@ export const GidsSegmentedTabItemDom = ({
60
74
  }
61
75
  }
62
76
 
77
+ if (trailingIcon) {
78
+ const trailingIconContainer = document.createElement('div');
79
+ trailingIconContainer.className = 'gids-segmented-item__selected-icons';
80
+ appendAsChildren(trailingIconContainer, trailingIcon);
81
+ segmentedTabItem.appendChild(trailingIconContainer);
82
+ }
83
+
63
84
  if (badge) {
64
85
  segmentedTabItem.appendChild(
65
86
  GidsBadgeDom({
@@ -0,0 +1,40 @@
1
+ import { type GidsSnackbarWebProps } from '@ganpatiinfo/gids-web-shared';
2
+
3
+ export type GidsSnackbarDomProps = GidsSnackbarWebProps;
4
+
5
+ export const GidsSnackbarDom = ({
6
+ message,
7
+ appearance = 'default',
8
+ show,
9
+ onQueueSnackbar,
10
+ buttonLabel,
11
+ onButtonClick,
12
+ position = 'bottom-center',
13
+ timerInMs,
14
+ }: GidsSnackbarDomProps): HTMLElement => {
15
+ const snackbar = document.createElement('gids-snackbar');
16
+
17
+ if (message) {
18
+ snackbar.setAttribute('message', message);
19
+ }
20
+ if (appearance) {
21
+ snackbar.setAttribute('appearance', appearance);
22
+ }
23
+ snackbar.setAttribute('position', position);
24
+ snackbar.setAttribute('timer-in-ms', timerInMs ? `${timerInMs}` : '0');
25
+
26
+ snackbar.toggleAttribute('show', show ? show : false);
27
+
28
+ if (onQueueSnackbar) {
29
+ snackbar.addEventListener('queueSnackbar', onQueueSnackbar);
30
+ }
31
+ if (buttonLabel) {
32
+ snackbar.setAttribute('button-label', buttonLabel);
33
+ }
34
+ if (onButtonClick) {
35
+ // @ts-expect-error Expected
36
+ snackbar.onButtonClick = onButtonClick;
37
+ }
38
+
39
+ return snackbar;
40
+ };
@@ -0,0 +1,43 @@
1
+ import { type GidsStatusTagCommonProps } from '@ganpatiinfo/gids-core-shared';
2
+ import { GidsStatusTagWebUtils } from '@ganpatiinfo/gids-web-shared';
3
+ import { GidsIconDom } from '../GidsIcon/GidsIcon.js';
4
+ import { type IconName } from '@ganpatiinfo/gids-web-theme-interface';
5
+
6
+ const { getGidsStatusTagClassNames, getStatusTagText, getStatusTagIconName } =
7
+ GidsStatusTagWebUtils;
8
+
9
+ export interface GidsStatusTagDomProps extends GidsStatusTagCommonProps {
10
+ extraClasses?: string;
11
+ }
12
+
13
+ export const GidsStatusTagDom = (
14
+ props: GidsStatusTagDomProps,
15
+ ): HTMLDivElement => {
16
+ const {
17
+ type = 'new',
18
+ appearance = 'subtlest',
19
+ size = 'sm',
20
+ extraClasses,
21
+ } = props;
22
+
23
+ const statusTag = document.createElement('div');
24
+ statusTag.className = getGidsStatusTagClassNames(
25
+ { appearance, size, type },
26
+ extraClasses,
27
+ );
28
+
29
+ const statusTagIconName = getStatusTagIconName<IconName>(type);
30
+ statusTag.append(
31
+ GidsIconDom({
32
+ name: statusTagIconName,
33
+ appearance: 'filled',
34
+ }),
35
+ );
36
+
37
+ const label = document.createElement('label');
38
+ label.textContent = getStatusTagText(type) ?? '';
39
+
40
+ statusTag.appendChild(label);
41
+
42
+ return statusTag;
43
+ };