@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,94 @@
1
+ import {
2
+ GidsStepperCommonUtils,
3
+ type StepClickProps,
4
+ type GidsStepperCommonProps,
5
+ } from '@ganpatiinfo/gids-core-shared';
6
+ import { GidsStepperWebUtils } from '@ganpatiinfo/gids-web-shared';
7
+ import { GidsButtonDom } from '../GidsButton/GidsButton.js';
8
+ import { GidsIconDom } from '../GidsIcon/GidsIcon.js';
9
+
10
+ const { isStepperMinusDisabled } = GidsStepperCommonUtils;
11
+ const { getGidsStepperClassNames } = GidsStepperWebUtils;
12
+
13
+ export interface GidsStepperDomProps extends GidsStepperCommonProps {
14
+ extraClasses?: string;
15
+ onClickMinus?: (params: StepClickProps) => void;
16
+ onClickPlus?: (params: StepClickProps) => void;
17
+ }
18
+
19
+ export const GidsStepperDom = ({
20
+ disabled,
21
+ extraClasses,
22
+ onClickMinus,
23
+ onClickPlus,
24
+ }: GidsStepperDomProps): HTMLDivElement => {
25
+ // 1. Maintain internal state within the closure
26
+ let currentValue = 0;
27
+
28
+ const stepper = document.createElement('div');
29
+ stepper.className = getGidsStepperClassNames(extraClasses);
30
+
31
+ // 2. Create the display label
32
+ const label = document.createElement('label');
33
+ label.className = `gids-stepper__label ${disabled ? 'gids-stepper__label-disabled' : ''}`;
34
+
35
+ // Helper to update the text content
36
+ const updateLabel = () => {
37
+ label.textContent = `${currentValue}`;
38
+ };
39
+ updateLabel();
40
+
41
+ // 3. Create the buttons
42
+ const minusButton = GidsButtonDom({
43
+ leadingIcon: GidsIconDom({
44
+ name: 'minus',
45
+ size: 'md',
46
+ appearance: 'regular',
47
+ }),
48
+ disabled: disabled || isStepperMinusDisabled({ stepText: currentValue }),
49
+ size: 'sm',
50
+ width: 'intrinsic',
51
+ appearance: 'default',
52
+ onClick: () => {
53
+ if (disabled) return;
54
+ currentValue -= 1;
55
+ updateLabel();
56
+
57
+ // Re-evaluate the disabled state of the minus button dynamically
58
+ const isMinusDisabled =
59
+ disabled || isStepperMinusDisabled({ stepText: currentValue });
60
+ minusButton.toggleAttribute('disabled', isMinusDisabled);
61
+
62
+ onClickMinus?.({ stepText: currentValue });
63
+ },
64
+ });
65
+
66
+ const plusButton = GidsButtonDom({
67
+ leadingIcon: GidsIconDom({
68
+ name: 'plus',
69
+ size: 'md',
70
+ appearance: 'regular',
71
+ }),
72
+ disabled: disabled,
73
+ size: 'sm',
74
+ width: 'intrinsic',
75
+ appearance: 'default',
76
+ onClick: () => {
77
+ if (disabled) return;
78
+ currentValue += 1;
79
+ updateLabel();
80
+
81
+ // Ensure the minus button is un-disabled if it was previously locked
82
+ const isMinusDisabled =
83
+ disabled || isStepperMinusDisabled({ stepText: currentValue });
84
+ minusButton.toggleAttribute('disabled', isMinusDisabled);
85
+
86
+ onClickPlus?.({ stepText: currentValue });
87
+ },
88
+ });
89
+
90
+ // 4. Assemble the DOM
91
+ stepper.append(minusButton, label, plusButton);
92
+
93
+ return stepper;
94
+ };
@@ -0,0 +1,78 @@
1
+ import {
2
+ type GidsStrengthMeterCommonProps,
3
+ GidsStrengthMeterCommonUtils,
4
+ } from '@ganpatiinfo/gids-core-shared';
5
+ import { GidsStrengthMeterWebUtils } from '@ganpatiinfo/gids-web-shared';
6
+ import { appendAsChildren } from '../../utils/domUtils.js';
7
+ import { minLengthRuleCanBeApplied } from '@ganpatiinfo/gids-core-shared/dist/components/GidsRequirementsMeter/GidsRequirementsMeterCommonUtils.js';
8
+
9
+ const { getGidsStrengthMeterClassNames } = GidsStrengthMeterWebUtils;
10
+ const { getStrengthMeterScore, getColorModifierByScore } =
11
+ GidsStrengthMeterCommonUtils;
12
+
13
+ export interface GidsStrengthMeterDomProps extends GidsStrengthMeterCommonProps {
14
+ extraClasses?: string;
15
+ }
16
+
17
+ export const GidsStrengthMeterDom = ({
18
+ text,
19
+ textMinLength,
20
+ meterRules = [
21
+ '1-uppercase',
22
+ '1-lowercase',
23
+ '1-digit',
24
+ '1-special-character',
25
+ 'include-min-length',
26
+ ],
27
+ extraClasses,
28
+ }: GidsStrengthMeterDomProps): HTMLDivElement => {
29
+ const strengthContainer = document.createElement('div');
30
+ strengthContainer.className = getGidsStrengthMeterClassNames(extraClasses);
31
+
32
+ const textScore = getStrengthMeterScore({
33
+ text,
34
+ textMinLength,
35
+ meterRules,
36
+ });
37
+
38
+ const maxScore = meterRules.length;
39
+ const colorModifier = getColorModifierByScore({ textScore, maxScore });
40
+
41
+ const renderStrengthLine = (
42
+ strengthLine: HTMLDivElement,
43
+ isActive: boolean,
44
+ index: number,
45
+ ) => {
46
+ // Class construction using the dynamic color modifier for active segments
47
+ strengthLine.className = [
48
+ `gids-strength-meter__strength-${index}`,
49
+ isActive ? 'is-active' : '',
50
+ isActive ? colorModifier : '',
51
+ ]
52
+ .filter(Boolean)
53
+ .join(' ');
54
+ };
55
+
56
+ for (let i = 1; i <= maxScore; i++) {
57
+ const strengthLine = document.createElement('div');
58
+
59
+ const isActive = i <= textScore;
60
+
61
+ if (meterRules[i - 1] === 'include-min-length') {
62
+ if (
63
+ minLengthRuleCanBeApplied({
64
+ requirementRule: 'include-min-length',
65
+ textMinLength,
66
+ })
67
+ ) {
68
+ renderStrengthLine(strengthLine, isActive, i);
69
+ }
70
+ } else {
71
+ renderStrengthLine(strengthLine, isActive, i);
72
+ }
73
+
74
+ appendAsChildren(strengthContainer, strengthLine);
75
+ }
76
+
77
+ return strengthContainer;
78
+ };
@@ -0,0 +1,59 @@
1
+ import { type GidsTextFieldWebProps } from '@ganpatiinfo/gids-web-shared';
2
+ import { assignToSlot } from '../../utils/domUtils.js';
3
+ import { type HtmlInputAttributes } from '../GidsInput/GidsInput.js';
4
+
5
+ export interface GidsTextFieldDomProps extends GidsTextFieldWebProps<
6
+ Element,
7
+ HtmlInputAttributes
8
+ > {
9
+ info?: Element;
10
+ className?: string;
11
+ onGidsTextFieldClear?: (event: CustomEvent<void>) => void;
12
+ onChange?: (event: Event) => void;
13
+ onInput?: (event: InputEvent) => void;
14
+ onFocus?: (event: FocusEvent) => void;
15
+ onBlur?: (event: FocusEvent) => void;
16
+ }
17
+
18
+ export const GidsTextFieldDom = (props: GidsTextFieldDomProps): HTMLElement => {
19
+ const {
20
+ info,
21
+ leadingIcon,
22
+ trailingIcon,
23
+ onGidsTextFieldClear,
24
+ onChange,
25
+ onInput,
26
+ onFocus,
27
+ onBlur,
28
+ ...restProps
29
+ } = props;
30
+
31
+ const textFieldComponent = document.createElement('gids-text-field');
32
+ Object.assign(textFieldComponent, restProps);
33
+
34
+ assignToSlot(textFieldComponent, 'info', info);
35
+ assignToSlot(textFieldComponent, 'leadingIcon', leadingIcon);
36
+ assignToSlot(textFieldComponent, 'trailingIcon', trailingIcon);
37
+
38
+ if (onChange) {
39
+ textFieldComponent.addEventListener('change', onChange);
40
+ }
41
+ if (onInput) {
42
+ textFieldComponent.addEventListener('input', onInput as (e: Event) => void);
43
+ }
44
+ if (onFocus) {
45
+ textFieldComponent.addEventListener('focus', onFocus);
46
+ }
47
+ if (onBlur) {
48
+ textFieldComponent.addEventListener('blur', onBlur);
49
+ }
50
+ if (onGidsTextFieldClear) {
51
+ // @ts-expect-error This is a custom event so ts complaining
52
+ textFieldComponent.addEventListener(
53
+ 'gidsTextFieldClear',
54
+ onGidsTextFieldClear,
55
+ );
56
+ }
57
+
58
+ return textFieldComponent;
59
+ };
@@ -0,0 +1,124 @@
1
+ import {
2
+ type GidsTopNavigationWebProps,
3
+ GidsTopNavigationWebUtils,
4
+ } from '@ganpatiinfo/gids-web-shared';
5
+ import {
6
+ appendAsChildren,
7
+ DomChildren,
8
+ DomNodeOrString,
9
+ } from '../../utils/domUtils.js';
10
+ import {
11
+ GidsSearchBarDom,
12
+ GidsSearchBarDomProps,
13
+ } from '../GidsSearchBar/GidsSearchBar.js';
14
+ import {
15
+ GidsSegmentedControlDom,
16
+ GidsSegmentedControlDomProps,
17
+ } from '../GidsSegmentedControl/GidsSegmentedControl.js';
18
+ import { GidsLogoDom } from '../GidsLogo/GidsLogo.js';
19
+
20
+ const { getGidsTopNavigationClassNames } = GidsTopNavigationWebUtils;
21
+
22
+ export interface GidsTopNavigationDomProps
23
+ extends
24
+ GidsTopNavigationWebProps<
25
+ DomChildren,
26
+ DomChildren,
27
+ DomChildren,
28
+ DomNodeOrString,
29
+ string,
30
+ string,
31
+ string,
32
+ DomChildren
33
+ >,
34
+ Pick<GidsSearchBarDomProps, 'onBlur' | 'onChange' | 'onFocus' | 'onInput'>,
35
+ Pick<GidsSegmentedControlDomProps, 'onPress'> {
36
+ extraClasses?: string;
37
+ }
38
+
39
+ export const GidsTopNavigationDom = (
40
+ props: GidsTopNavigationDomProps,
41
+ ): HTMLElement => {
42
+ const {
43
+ isDefaultLeftContentRender = true,
44
+ isDefaultMiddleContentRender = true,
45
+ isDefaultRightContentRender = true,
46
+ leftContent,
47
+ middleContent,
48
+ rightContent,
49
+ src,
50
+ imgHeight = '100',
51
+ href,
52
+ clickable,
53
+ onPress,
54
+ width,
55
+ tabItems = [],
56
+ extraClasses,
57
+ ...rest
58
+ } = props;
59
+
60
+ const topNavigation = document.createElement('nav');
61
+ topNavigation.className = getGidsTopNavigationClassNames(extraClasses);
62
+
63
+ const leftContentContainer = document.createElement('div');
64
+ leftContentContainer.className = 'gids-top-navigation__left-content';
65
+
66
+ if (leftContent || isDefaultLeftContentRender) {
67
+ if (leftContent) {
68
+ appendAsChildren(leftContentContainer, leftContent);
69
+ }
70
+ if (isDefaultLeftContentRender) {
71
+ leftContentContainer.append(
72
+ GidsLogoDom({
73
+ src: src,
74
+ imgHeight: imgHeight,
75
+ alt: 'logo-img',
76
+ href: href && href !== '' ? href : '/',
77
+ clickable,
78
+ }),
79
+ );
80
+ }
81
+ topNavigation.appendChild(leftContentContainer);
82
+ }
83
+
84
+ const middleContentContainer = document.createElement('div');
85
+ middleContentContainer.className = 'gids-top-navigation__middle-content';
86
+
87
+ if (middleContent || isDefaultMiddleContentRender) {
88
+ if (middleContent) {
89
+ appendAsChildren(middleContentContainer, middleContent);
90
+ }
91
+ if (isDefaultMiddleContentRender) {
92
+ middleContentContainer.append(
93
+ GidsSearchBarDom({
94
+ type: 'default',
95
+ appearance: 'default',
96
+ status: 'default',
97
+ ...rest,
98
+ }),
99
+ );
100
+ }
101
+ topNavigation.appendChild(middleContentContainer);
102
+ }
103
+
104
+ const rightContentContainer = document.createElement('div');
105
+ rightContentContainer.className = 'gids-top-navigation__right-content';
106
+
107
+ if (rightContent || isDefaultRightContentRender) {
108
+ if (rightContent) {
109
+ appendAsChildren(rightContentContainer, rightContent);
110
+ }
111
+ if (isDefaultRightContentRender) {
112
+ rightContentContainer.append(
113
+ GidsSegmentedControlDom({
114
+ width: width ? width : 'intrinsic',
115
+ tabItems: tabItems,
116
+ onPress,
117
+ }),
118
+ );
119
+ }
120
+ topNavigation.appendChild(rightContentContainer);
121
+ }
122
+
123
+ return topNavigation;
124
+ };
@@ -0,0 +1,125 @@
1
+ import { GidsNotificationContainerCommonProps } from '@ganpatiinfo/gids-core-shared';
2
+ import {
3
+ ClassValue,
4
+ GidsNotificationContainerWebUtils,
5
+ } from '@ganpatiinfo/gids-web-shared';
6
+ import { type DomNodeOrString } from '../../utils/domUtils.js';
7
+ import { GidsIconDom } from '../GidsIcon/GidsIcon.js';
8
+ import { IconName } from '@ganpatiinfo/gids-web-theme-interface';
9
+ import { GidsButtonDom } from '../GidsButton/GidsButton.js';
10
+
11
+ const {
12
+ getGidsNotificationContainerClassNames,
13
+ getNotificationContainerIconNames,
14
+ } = GidsNotificationContainerWebUtils;
15
+
16
+ export interface GidsNotificationContainerDomProps extends GidsNotificationContainerCommonProps<
17
+ DomNodeOrString,
18
+ DomNodeOrString
19
+ > {
20
+ extraClasses?: ClassValue;
21
+ onCloseNotificationClick?: (this: HTMLButtonElement, event: Event) => void;
22
+ }
23
+
24
+ export const GidsNotificationContainerDom = (
25
+ props: GidsNotificationContainerDomProps,
26
+ ): HTMLDivElement => {
27
+ const {
28
+ notificationTitle,
29
+ children,
30
+ button,
31
+ appearance = 'default',
32
+ pronunciation = 'standard',
33
+ onCloseNotificationClick,
34
+ extraClasses,
35
+ } = props;
36
+
37
+ const notificationContainer = document.createElement('div');
38
+ notificationContainer.className = getGidsNotificationContainerClassNames(
39
+ { appearance },
40
+ extraClasses,
41
+ );
42
+
43
+ const iconWrapper = document.createElement('div');
44
+ iconWrapper.className = 'gids-notification-container__leading-icon-wrapper';
45
+ const iconName = getNotificationContainerIconNames<IconName>(appearance);
46
+ if (appearance !== 'default' && iconName) {
47
+ iconWrapper.appendChild(
48
+ GidsIconDom({
49
+ size: 'md',
50
+ name: iconName,
51
+ alt: '',
52
+ appearance: 'filled',
53
+ }),
54
+ );
55
+ notificationContainer.appendChild(iconWrapper);
56
+ }
57
+
58
+ const notificationContentWrapper = document.createElement('div');
59
+ notificationContentWrapper.className =
60
+ 'gids-notification-container__content-wrapper';
61
+
62
+ const notificationTopContent = document.createElement('div');
63
+ notificationTopContent.className = 'gids-notification-container__top-content';
64
+
65
+ const notificationTextContent = document.createElement('div');
66
+ notificationTextContent.className =
67
+ 'gids-notification-container__text-content';
68
+
69
+ if (notificationTitle && notificationTitle !== '') {
70
+ const notificationTitleEl = document.createElement('span');
71
+ notificationTitleEl.className = 'gids-notification-container__title';
72
+ notificationTitleEl.textContent = notificationTitle;
73
+
74
+ notificationTextContent.appendChild(notificationTitleEl);
75
+ }
76
+
77
+ if (children) {
78
+ if (typeof children === 'string') {
79
+ const textEl = document.createElement('p');
80
+ textEl.textContent = children;
81
+
82
+ notificationTextContent.appendChild(textEl);
83
+ } else {
84
+ notificationTextContent.appendChild(children);
85
+ }
86
+ }
87
+
88
+ notificationTopContent.appendChild(notificationTextContent);
89
+
90
+ const crossBtnWrapper = document.createElement('div');
91
+ crossBtnWrapper.className = 'gids-notification-container__cross-btn-wrapper';
92
+
93
+ if (pronunciation === 'standard') {
94
+ crossBtnWrapper.appendChild(
95
+ GidsButtonDom({
96
+ appearance: 'subtle',
97
+ size: 'sm',
98
+ width: 'intrinsic',
99
+ leadingIcon: GidsIconDom({
100
+ name: 'cross',
101
+ size: 'md',
102
+ appearance: 'regular',
103
+ }),
104
+ onClick: onCloseNotificationClick,
105
+ }),
106
+ );
107
+ notificationTopContent.appendChild(crossBtnWrapper);
108
+ }
109
+
110
+ notificationContentWrapper.appendChild(notificationTopContent);
111
+
112
+ if (button) {
113
+ const notificationBottomContent = document.createElement('div');
114
+ notificationBottomContent.className =
115
+ 'gids-notification-container__bottom-content';
116
+
117
+ notificationBottomContent.append(button);
118
+
119
+ notificationContentWrapper.appendChild(notificationBottomContent);
120
+ }
121
+
122
+ notificationContainer.appendChild(notificationContentWrapper);
123
+
124
+ return notificationContainer;
125
+ };
@@ -0,0 +1,50 @@
1
+ import {
2
+ GidsRequirementsMeterLabelCommonUtils,
3
+ type GidsRequirementsMeterLabelCommonProps,
4
+ } from '@ganpatiinfo/gids-core-shared';
5
+ import { GidsRequirementsMeterLabelWebUtils } from '@ganpatiinfo/gids-web-shared';
6
+ import { GidsIconDom } from '../GidsIcon/GidsIcon.js';
7
+
8
+ const { getGidsRequirementsMeterLabelClassNames } =
9
+ GidsRequirementsMeterLabelWebUtils;
10
+
11
+ const { getRequirementsMeterLabelLeadingIcon } =
12
+ GidsRequirementsMeterLabelCommonUtils;
13
+
14
+ export interface GidsRequirementsMeterLabelDomProps extends GidsRequirementsMeterLabelCommonProps {
15
+ extraClasses?: string;
16
+ }
17
+
18
+ export const GidsRequirementsMeterLabelDom = ({
19
+ label,
20
+ status = 'default',
21
+ leadingIconVisible = true,
22
+ extraClasses,
23
+ }: GidsRequirementsMeterLabelDomProps): HTMLDivElement => {
24
+ const labelContainer = document.createElement('div');
25
+ labelContainer.className = getGidsRequirementsMeterLabelClassNames(
26
+ { status },
27
+ extraClasses,
28
+ );
29
+
30
+ if (leadingIconVisible && status) {
31
+ const iconName = getRequirementsMeterLabelLeadingIcon(status);
32
+ if (iconName) {
33
+ labelContainer.append(
34
+ GidsIconDom({
35
+ name: iconName,
36
+ size: 'sm',
37
+ appearance: 'filled',
38
+ }),
39
+ );
40
+ }
41
+ }
42
+
43
+ if (label && label !== '') {
44
+ const textEl = document.createElement('span');
45
+ textEl.textContent = label;
46
+ labelContainer.appendChild(textEl);
47
+ }
48
+
49
+ return labelContainer;
50
+ };
@@ -0,0 +1,108 @@
1
+ import {
2
+ type GidsSideMenuItemOnPressEvent,
3
+ type GidsSideMenuItemWebProps,
4
+ GidsSideMenuItemWebUtils,
5
+ } from '@ganpatiinfo/gids-web-shared';
6
+ import {
7
+ appendAsChildren,
8
+ DomChildren,
9
+ DomNodeOrString,
10
+ } from '../../utils/domUtils.js';
11
+ import { GidsBadgeDom } from '../GidsBadge/GidsBadge.js';
12
+ import { GidsIconDom } from '../GidsIcon/GidsIcon.js';
13
+ import { GidsSideMenuItemCommonUtils } from '@ganpatiinfo/gids-core-shared';
14
+ import { IconName } from '@ganpatiinfo/gids-web-theme-interface';
15
+
16
+ const { getGidsSideMenuItemClassNames } = GidsSideMenuItemWebUtils;
17
+ const { getSideMenuTrailingIcon } = GidsSideMenuItemCommonUtils;
18
+
19
+ export interface GidsSideMenuItemDomProps extends GidsSideMenuItemWebProps<
20
+ DomNodeOrString,
21
+ DomChildren,
22
+ DomChildren
23
+ > {
24
+ extraClasses?: string;
25
+ onPressSideMenuItem?: GidsSideMenuItemOnPressEvent;
26
+ }
27
+
28
+ export const GidsSideMenuItemDom = ({
29
+ appearance = 'default',
30
+ index = 0,
31
+ selected,
32
+ isLeadingDotVisible = false,
33
+ leadingDotAppearance = 'information',
34
+ leadingAccessory,
35
+ trailingAccessory,
36
+ leadingIcon,
37
+ trailingIcon,
38
+ isTrailingArrowVisible = false,
39
+ trailingArrowDirection = 'right',
40
+ children,
41
+ extraClasses,
42
+ onPressSideMenuItem,
43
+ }: GidsSideMenuItemDomProps): HTMLDivElement => {
44
+ const sideMenuItem = document.createElement('div');
45
+ sideMenuItem.className = getGidsSideMenuItemClassNames(
46
+ { selected, appearance },
47
+ extraClasses,
48
+ );
49
+
50
+ sideMenuItem.setAttribute('index', `${index}`);
51
+
52
+ if (leadingAccessory) {
53
+ appendAsChildren(sideMenuItem, leadingAccessory);
54
+ } else {
55
+ if (isLeadingDotVisible) {
56
+ sideMenuItem.append(
57
+ GidsBadgeDom({
58
+ appearance: leadingDotAppearance,
59
+ type: 'dot',
60
+ }),
61
+ );
62
+ }
63
+ }
64
+
65
+ if (leadingIcon) {
66
+ appendAsChildren(sideMenuItem, leadingIcon);
67
+ }
68
+
69
+ if (children) {
70
+ const textEl = document.createElement('span');
71
+ textEl.className = 'gids-side-menu-item__label';
72
+ if (typeof children === 'string') {
73
+ textEl.textContent = children;
74
+ } else {
75
+ textEl.appendChild(children);
76
+ }
77
+ appendAsChildren(sideMenuItem, textEl);
78
+ }
79
+
80
+ if (trailingAccessory) {
81
+ appendAsChildren(sideMenuItem, trailingAccessory);
82
+ }
83
+
84
+ if (trailingIcon) {
85
+ appendAsChildren(sideMenuItem, trailingIcon);
86
+ } else {
87
+ if (isTrailingArrowVisible) {
88
+ sideMenuItem.append(
89
+ GidsIconDom({
90
+ name: getSideMenuTrailingIcon<IconName>(trailingArrowDirection),
91
+ size: 'md',
92
+ alt: '',
93
+ appearance: 'regular',
94
+ }),
95
+ );
96
+ }
97
+ }
98
+
99
+ if (onPressSideMenuItem) {
100
+ sideMenuItem.addEventListener('click', () => {
101
+ onPressSideMenuItem({
102
+ selectedIndex: index,
103
+ });
104
+ });
105
+ }
106
+
107
+ return sideMenuItem;
108
+ };
@@ -0,0 +1,68 @@
1
+ import { type GidsSnackbarContainerCommonProps } from '@ganpatiinfo/gids-core-shared';
2
+ import {
3
+ type ClassValue,
4
+ GidsSnackbarContainerWebUtils,
5
+ } from '@ganpatiinfo/gids-web-shared';
6
+ import {
7
+ appendAsChildren,
8
+ type DomNodeOrString,
9
+ } from '../../utils/domUtils.js';
10
+ import { GidsIconDom } from '../GidsIcon/GidsIcon.js';
11
+ import { IconName } from '@ganpatiinfo/gids-web-theme-interface';
12
+
13
+ const { getGidsSnackbarContainerClassNames, getSnackbarContainerIconNames } =
14
+ GidsSnackbarContainerWebUtils;
15
+
16
+ export interface GidsSnackbarContainerDomProps extends GidsSnackbarContainerCommonProps<
17
+ DomNodeOrString,
18
+ DomNodeOrString
19
+ > {
20
+ extraClasses?: ClassValue;
21
+ }
22
+
23
+ export const GidsSnackbarContainerDom = (
24
+ props: GidsSnackbarContainerDomProps,
25
+ ): HTMLDivElement => {
26
+ const { appearance = 'default', children, button, extraClasses } = props;
27
+
28
+ const snackbarContainer = document.createElement('div');
29
+ snackbarContainer.className = getGidsSnackbarContainerClassNames(
30
+ { appearance },
31
+ extraClasses,
32
+ );
33
+
34
+ const snackbarContent = document.createElement('div');
35
+ snackbarContent.className = 'gids-snackbar-container__content';
36
+
37
+ const iconName = getSnackbarContainerIconNames<IconName>(appearance);
38
+ if (appearance !== 'default' && iconName) {
39
+ snackbarContent.appendChild(
40
+ GidsIconDom({
41
+ size: 'md',
42
+ name: iconName,
43
+ alt: '',
44
+ appearance: 'filled',
45
+ className: 'gids-snackbar-container__icon',
46
+ }),
47
+ );
48
+ }
49
+
50
+ if (children) {
51
+ if (typeof children === 'string') {
52
+ const textEl = document.createElement('p');
53
+ appendAsChildren(textEl, children);
54
+
55
+ snackbarContent.appendChild(textEl);
56
+ } else {
57
+ snackbarContent.appendChild(children);
58
+ }
59
+ }
60
+
61
+ snackbarContainer.appendChild(snackbarContent);
62
+
63
+ if (button) {
64
+ snackbarContainer.append(button);
65
+ }
66
+
67
+ return snackbarContainer;
68
+ };