@ganpatiinfo/gids-web-dom-reference 3.1.0 → 4.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 +52 -0
- package/dist/components/GidsDismissButton/GidsDismissButton.d.ts +8 -0
- package/dist/components/GidsDismissButton/GidsDismissButton.d.ts.map +1 -0
- package/dist/components/GidsDismissButton/GidsDismissButton.js +20 -0
- package/dist/components/GidsDismissButton/GidsDismissButton.js.map +1 -0
- package/dist/components/GidsField/GidsField.d.ts +7 -0
- package/dist/components/GidsField/GidsField.d.ts.map +1 -0
- package/dist/components/GidsField/GidsField.js +27 -0
- package/dist/components/GidsField/GidsField.js.map +1 -0
- package/dist/components/GidsHeading/GidsHeading.d.ts +7 -0
- package/dist/components/GidsHeading/GidsHeading.d.ts.map +1 -0
- package/dist/components/GidsHeading/GidsHeading.js +45 -0
- package/dist/components/GidsHeading/GidsHeading.js.map +1 -0
- package/dist/components/GidsInput/GidsInput.d.ts +18 -0
- package/dist/components/GidsInput/GidsInput.d.ts.map +1 -0
- package/dist/components/GidsInput/GidsInput.js +28 -0
- package/dist/components/GidsInput/GidsInput.js.map +1 -0
- package/dist/components/GidsLink/GidsLink.d.ts.map +1 -1
- package/dist/components/GidsLink/GidsLink.js.map +1 -1
- package/dist/components/GidsLogo/GidsLogo.d.ts +8 -0
- package/dist/components/GidsLogo/GidsLogo.d.ts.map +1 -0
- package/dist/components/GidsLogo/GidsLogo.js +25 -0
- package/dist/components/GidsLogo/GidsLogo.js.map +1 -0
- package/dist/components/GidsNotification/GidsNotification.d.ts +4 -0
- package/dist/components/GidsNotification/GidsNotification.d.ts.map +1 -0
- package/dist/components/GidsNotification/GidsNotification.js +30 -0
- package/dist/components/GidsNotification/GidsNotification.js.map +1 -0
- package/dist/components/GidsOverlayProvider/GidsOverlayProvider.d.ts +7 -0
- package/dist/components/GidsOverlayProvider/GidsOverlayProvider.d.ts.map +1 -0
- package/dist/components/GidsOverlayProvider/GidsOverlayProvider.js +7 -0
- package/dist/components/GidsOverlayProvider/GidsOverlayProvider.js.map +1 -0
- package/dist/components/GidsPasswordField/GidsPasswordField.d.ts +16 -0
- package/dist/components/GidsPasswordField/GidsPasswordField.d.ts.map +1 -0
- package/dist/components/GidsPasswordField/GidsPasswordField.js +34 -0
- package/dist/components/GidsPasswordField/GidsPasswordField.js.map +1 -0
- package/dist/components/GidsRequirementsMeter/GidsRequirementsMeter.d.ts +6 -0
- package/dist/components/GidsRequirementsMeter/GidsRequirementsMeter.d.ts.map +1 -0
- package/dist/components/GidsRequirementsMeter/GidsRequirementsMeter.js +48 -0
- package/dist/components/GidsRequirementsMeter/GidsRequirementsMeter.js.map +1 -0
- package/dist/components/GidsSearchBar/GidsSearchBar.d.ts +9 -0
- package/dist/components/GidsSearchBar/GidsSearchBar.d.ts.map +1 -0
- package/dist/components/GidsSearchBar/GidsSearchBar.js +59 -0
- package/dist/components/GidsSearchBar/GidsSearchBar.js.map +1 -0
- package/dist/components/GidsSnackbar/GidsSnackbar.d.ts +4 -0
- package/dist/components/GidsSnackbar/GidsSnackbar.d.ts.map +1 -0
- package/dist/components/GidsSnackbar/GidsSnackbar.js +24 -0
- package/dist/components/GidsSnackbar/GidsSnackbar.js.map +1 -0
- package/dist/components/GidsStatusTag/GidsStatusTag.d.ts +6 -0
- package/dist/components/GidsStatusTag/GidsStatusTag.d.ts.map +1 -0
- package/dist/components/GidsStatusTag/GidsStatusTag.js +18 -0
- package/dist/components/GidsStatusTag/GidsStatusTag.js.map +1 -0
- package/dist/components/GidsStepper/GidsStepper.d.ts +8 -0
- package/dist/components/GidsStepper/GidsStepper.d.ts.map +1 -0
- package/dist/components/GidsStepper/GidsStepper.js +67 -0
- package/dist/components/GidsStepper/GidsStepper.js.map +1 -0
- package/dist/components/GidsStrengthMeter/GidsStrengthMeter.d.ts +6 -0
- package/dist/components/GidsStrengthMeter/GidsStrengthMeter.d.ts.map +1 -0
- package/dist/components/GidsStrengthMeter/GidsStrengthMeter.js +51 -0
- package/dist/components/GidsStrengthMeter/GidsStrengthMeter.js.map +1 -0
- package/dist/components/GidsTextField/GidsTextField.d.ts +13 -0
- package/dist/components/GidsTextField/GidsTextField.d.ts.map +1 -0
- package/dist/components/GidsTextField/GidsTextField.js +27 -0
- package/dist/components/GidsTextField/GidsTextField.js.map +1 -0
- package/dist/components/GidsTopNavigation/GidsTopNavigation.d.ts +9 -0
- package/dist/components/GidsTopNavigation/GidsTopNavigation.d.ts.map +1 -0
- package/dist/components/GidsTopNavigation/GidsTopNavigation.js +61 -0
- package/dist/components/GidsTopNavigation/GidsTopNavigation.js.map +1 -0
- package/dist/components/_GidsNotificationContainer/GidsNotificationContainer.d.ts +9 -0
- package/dist/components/_GidsNotificationContainer/GidsNotificationContainer.d.ts.map +1 -0
- package/dist/components/_GidsNotificationContainer/GidsNotificationContainer.js +73 -0
- package/dist/components/_GidsNotificationContainer/GidsNotificationContainer.js.map +1 -0
- package/dist/components/_GidsRequirementsMeterLabel/GidsRequirementsMeterLabel.d.ts +6 -0
- package/dist/components/_GidsRequirementsMeterLabel/GidsRequirementsMeterLabel.d.ts.map +1 -0
- package/dist/components/_GidsRequirementsMeterLabel/GidsRequirementsMeterLabel.js +26 -0
- package/dist/components/_GidsRequirementsMeterLabel/GidsRequirementsMeterLabel.js.map +1 -0
- package/dist/components/_GidsSnackbarContainer/GidsSnackbarContainer.d.ts +8 -0
- package/dist/components/_GidsSnackbarContainer/GidsSnackbarContainer.d.ts.map +1 -0
- package/dist/components/_GidsSnackbarContainer/GidsSnackbarContainer.js +37 -0
- package/dist/components/_GidsSnackbarContainer/GidsSnackbarContainer.js.map +1 -0
- package/dist/index.d.ts +19 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +19 -0
- package/dist/index.js.map +1 -1
- package/dist/utils/domUtils.d.ts +2 -0
- package/dist/utils/domUtils.d.ts.map +1 -1
- package/dist/utils/domUtils.js +17 -0
- package/dist/utils/domUtils.js.map +1 -1
- package/package.json +3 -3
- package/src/components/GidsDismissButton/GidsDismissButton.ts +45 -0
- package/src/components/GidsField/GidsField.ts +55 -0
- package/src/components/GidsHeading/GidsHeading.ts +72 -0
- package/src/components/GidsInput/GidsInput.ts +64 -0
- package/src/components/GidsLink/GidsLink.ts +20 -20
- package/src/components/GidsLogo/GidsLogo.ts +60 -0
- package/src/components/GidsNotification/GidsNotification.ts +48 -0
- package/src/components/GidsOverlayProvider/GidsOverlayProvider.ts +16 -0
- package/src/components/GidsPasswordField/GidsPasswordField.ts +77 -0
- package/src/components/GidsRequirementsMeter/GidsRequirementsMeter.ts +71 -0
- package/src/components/GidsSearchBar/GidsSearchBar.ts +103 -0
- package/src/components/GidsSnackbar/GidsSnackbar.ts +40 -0
- package/src/components/GidsStatusTag/GidsStatusTag.ts +43 -0
- package/src/components/GidsStepper/GidsStepper.ts +94 -0
- package/src/components/GidsStrengthMeter/GidsStrengthMeter.ts +78 -0
- package/src/components/GidsTextField/GidsTextField.ts +59 -0
- package/src/components/GidsTopNavigation/GidsTopNavigation.ts +123 -0
- package/src/components/_GidsNotificationContainer/GidsNotificationContainer.ts +125 -0
- package/src/components/_GidsRequirementsMeterLabel/GidsRequirementsMeterLabel.ts +50 -0
- package/src/components/_GidsSnackbarContainer/GidsSnackbarContainer.ts +68 -0
- package/src/index.ts +19 -0
- package/src/utils/domUtils.ts +75 -48
package/dist/index.js
CHANGED
|
@@ -40,6 +40,25 @@ export * from './components/_GidsPaginationItem/GidsPaginationItem.js';
|
|
|
40
40
|
export * from './components/GidsPagination/GidsPagination.js';
|
|
41
41
|
export * from './components/GidsSegmentedTabItem/GidsSegmentedTabItem.js';
|
|
42
42
|
export * from './components/GidsSegmentedControl/GidsSegmentedControl.js';
|
|
43
|
+
export * from './components/GidsLogo/GidsLogo.js';
|
|
44
|
+
export * from './components/GidsDismissButton/GidsDismissButton.js';
|
|
45
|
+
export * from './components/GidsInput/GidsInput.js';
|
|
46
|
+
export * from './components/GidsField/GidsField.js';
|
|
47
|
+
export * from './components/GidsTextField/GidsTextField.js';
|
|
48
|
+
export * from './components/GidsSearchBar/GidsSearchBar.js';
|
|
49
|
+
export * from './components/GidsTopNavigation/GidsTopNavigation.js';
|
|
50
|
+
export * from './components/GidsStrengthMeter/GidsStrengthMeter.js';
|
|
51
|
+
export * from './components/_GidsRequirementsMeterLabel/GidsRequirementsMeterLabel.js';
|
|
52
|
+
export * from './components/GidsRequirementsMeter/GidsRequirementsMeter.js';
|
|
53
|
+
export * from './components/GidsStepper/GidsStepper.js';
|
|
54
|
+
export * from './components/GidsStatusTag/GidsStatusTag.js';
|
|
55
|
+
export * from './components/GidsHeading/GidsHeading.js';
|
|
56
|
+
export * from './components/GidsPasswordField/GidsPasswordField.js';
|
|
57
|
+
export * from './components/_GidsSnackbarContainer/GidsSnackbarContainer.js';
|
|
58
|
+
export * from './components/GidsOverlayProvider/GidsOverlayProvider.js';
|
|
59
|
+
export * from './components/GidsSnackbar/GidsSnackbar.js';
|
|
60
|
+
export * from './components/_GidsNotificationContainer/GidsNotificationContainer.js';
|
|
61
|
+
export * from './components/GidsNotification/GidsNotification.js';
|
|
43
62
|
/**
|
|
44
63
|
* Utilities
|
|
45
64
|
*/
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,cAAc,uCAAuC,CAAC;AACtD,cAAc,yCAAyC,CAAC;AACxD,cAAc,+CAA+C,CAAC;AAC9D,cAAc,mCAAmC,CAAC;AAClD,cAAc,uDAAuD,CAAC;AACtE,cAAc,qCAAqC,CAAC;AACpD,cAAc,mCAAmC,CAAC;AAClD,cAAc,wDAAwD,CAAC;AACvE,cAAc,yCAAyC,CAAC;AACxD,cAAc,mDAAmD,CAAC;AAClE,cAAc,0DAA0D,CAAC;AACzE,cAAc,oDAAoD,CAAC;AACnE,cAAc,sDAAsD,CAAC;AACrE,cAAc,2CA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
9
|
checked?: boolean;
|
|
10
10
|
defaultChecked?: boolean;
|
|
11
11
|
}) => void;
|
|
12
|
+
export declare const htmlToDomChildren: (html: DomChildren | undefined) => DomChildren | undefined;
|
|
13
|
+
export declare const assignToSlot: (parent: Element, slotName: string, element?: Element) => void;
|
|
12
14
|
//# sourceMappingURL=domUtils.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"domUtils.d.ts","sourceRoot":"","sources":["../../src/utils/domUtils.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,eAAe,GAAG,IAAI,GAAG,MAAM,CAAC;AAE5C,MAAM,MAAM,WAAW,GAAG,eAAe,GAAG,eAAe,EAAE,CAAC;AAE9D,eAAO,MAAM,cAAc,GAAI,CAAC,SAAS,eAAe,GAAG,eAAe,
|
|
1
|
+
{"version":3,"file":"domUtils.d.ts","sourceRoot":"","sources":["../../src/utils/domUtils.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,eAAe,GAAG,IAAI,GAAG,MAAM,CAAC;AAE5C,MAAM,MAAM,WAAW,GAAG,eAAe,GAAG,eAAe,EAAE,CAAC;AAE9D,eAAO,MAAM,cAAc,GAAI,CAAC,SAAS,eAAe,GAAG,eAAe,EACxE,aAAa,CAAC,GAAG,CAAC,EAAE,GAAG,SAAS,KAC/B,CAAC,EAKH,CAAC;AAEF,eAAO,MAAM,gBAAgB,GAC3B,QAAQ,OAAO,EACf,UAAU,WAAW,GAAG,SAAS,KAChC,IAIF,CAAC;AAEF,eAAO,MAAM,eAAe,GAC1B,SAAS,OAAO,EAChB,eAAe,MAAM,EACrB,QAAQ,OAAO,KACd,OAYF,CAAC;AAEF,eAAO,MAAM,uBAAuB,GAClC,cAAc,gBAAgB,EAC9B,mDAKG;IACD,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,cAAc,CAAC,EAAE,OAAO,CAAC;CAC1B,KACA,IAaF,CAAC;AAEF,eAAO,MAAM,iBAAiB,GAC5B,MAAM,WAAW,GAAG,SAAS,KAC5B,WAAW,GAAG,SAYhB,CAAC;AAEF,eAAO,MAAM,YAAY,GACvB,QAAQ,OAAO,EACf,UAAU,MAAM,EAChB,UAAU,OAAO,KAChB,IAKF,CAAC"}
|
package/dist/utils/domUtils.js
CHANGED
|
@@ -38,4 +38,21 @@ export const applyStatefulInputProps = (inputElement, { value, defaultValue, che
|
|
|
38
38
|
inputElement.defaultChecked = defaultChecked;
|
|
39
39
|
}
|
|
40
40
|
};
|
|
41
|
+
export const htmlToDomChildren = (html) => {
|
|
42
|
+
if (Array.isArray(html)) {
|
|
43
|
+
return html.flatMap(htmlToDomChildren).filter((x) => x !== undefined);
|
|
44
|
+
}
|
|
45
|
+
if (typeof html === 'string') {
|
|
46
|
+
const template = document.createElement('template');
|
|
47
|
+
template.innerHTML = html;
|
|
48
|
+
return Array.from(template.content.childNodes);
|
|
49
|
+
}
|
|
50
|
+
return html;
|
|
51
|
+
};
|
|
52
|
+
export const assignToSlot = (parent, slotName, element) => {
|
|
53
|
+
if (element) {
|
|
54
|
+
element.slot = slotName;
|
|
55
|
+
parent.appendChild(element);
|
|
56
|
+
}
|
|
57
|
+
};
|
|
41
58
|
//# sourceMappingURL=domUtils.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"domUtils.js","sourceRoot":"","sources":["../../src/utils/domUtils.ts"],"names":[],"mappings":"AAIA,MAAM,CAAC,MAAM,cAAc,GAAG,
|
|
1
|
+
{"version":3,"file":"domUtils.js","sourceRoot":"","sources":["../../src/utils/domUtils.ts"],"names":[],"mappings":"AAIA,MAAM,CAAC,MAAM,cAAc,GAAG,CAC5B,WAAgC,EAC3B,EAAE;IACP,IAAI,WAAW,KAAK,SAAS,EAAE,CAAC;QAC9B,OAAO,EAAE,CAAC;IACZ,CAAC;IACD,OAAO,KAAK,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC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,OAAO,CAAC;IACjC,CAAC;IACD,IAAI,cAAc,KAAK,SAAS,EAAE,CAAC;QACjC,YAAY,CAAC,cAAc,GAAG,cAAc,CAAC;IAC/C,CAAC;AACH,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAC/B,IAA6B,EACJ,EAAE;IAC3B,IAAI,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,CAAC;QACxB,OAAO,IAAI,CAAC,OAAO,CAAC,iBAAiB,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,KAAK,SAAS,CAAC,CAAC;IACxE,CAAC;IAED,IAAI,OAAO,IAAI,KAAK,QAAQ,EAAE,CAAC;QAC7B,MAAM,QAAQ,GAAG,QAAQ,CAAC,aAAa,CAAC,UAAU,CAAC,CAAC;QACpD,QAAQ,CAAC,SAAS,GAAG,IAAI,CAAC;QAC1B,OAAO,KAAK,CAAC,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC;IACjD,CAAC;IAED,OAAO,IAAI,CAAC;AACd,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,YAAY,GAAG,CAC1B,MAAe,EACf,QAAgB,EAChB,OAAiB,EACX,EAAE;IACR,IAAI,OAAO,EAAE,CAAC;QACZ,OAAO,CAAC,IAAI,GAAG,QAAQ,CAAC;QACxB,MAAM,CAAC,WAAW,CAAC,OAAO,CAAC,CAAC;IAC9B,CAAC;AACH,CAAC,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ganpatiinfo/gids-web-dom-reference",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "4.0.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "DOM for components reference implementations",
|
|
6
6
|
"homepage": "https://ganpatiinfosystem.vercel.app/",
|
|
@@ -24,8 +24,8 @@
|
|
|
24
24
|
"directory": "packages/private/web-dom-reference"
|
|
25
25
|
},
|
|
26
26
|
"dependencies": {
|
|
27
|
-
"@ganpatiinfo/gids-core-shared": "
|
|
28
|
-
"@ganpatiinfo/gids-web-shared": "
|
|
27
|
+
"@ganpatiinfo/gids-core-shared": "4.0.0",
|
|
28
|
+
"@ganpatiinfo/gids-web-shared": "4.0.0"
|
|
29
29
|
},
|
|
30
30
|
"peerDependencies": {
|
|
31
31
|
"@ganpatiinfo/gids-web-theme-interface": "3.1.0",
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { type GidsDismissButtonCommonProps } from '@ganpatiinfo/gids-core-shared';
|
|
2
|
+
import {
|
|
3
|
+
type ClassValue,
|
|
4
|
+
GidsDismissButtonWebUtils,
|
|
5
|
+
} from '@ganpatiinfo/gids-web-shared';
|
|
6
|
+
import { GidsIconDom } from '../GidsIcon/GidsIcon.js';
|
|
7
|
+
import { toggleAttribute } from '../../utils/domUtils.js';
|
|
8
|
+
|
|
9
|
+
const { getGidsDismissButtonClassNames } = GidsDismissButtonWebUtils;
|
|
10
|
+
|
|
11
|
+
export interface GidsDismissButtonDomProps extends GidsDismissButtonCommonProps {
|
|
12
|
+
onPressDismiss?: (this: HTMLButtonElement, event: Event) => void;
|
|
13
|
+
extraClasses?: ClassValue;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export const GidsDismissButtonDom = ({
|
|
17
|
+
appearance = 'subtle',
|
|
18
|
+
size = 'md',
|
|
19
|
+
disabled = false,
|
|
20
|
+
extraClasses,
|
|
21
|
+
onPressDismiss,
|
|
22
|
+
label,
|
|
23
|
+
}: GidsDismissButtonDomProps): HTMLButtonElement => {
|
|
24
|
+
const buttonElement = document.createElement('button');
|
|
25
|
+
buttonElement.className = getGidsDismissButtonClassNames(
|
|
26
|
+
{ appearance, size },
|
|
27
|
+
extraClasses,
|
|
28
|
+
);
|
|
29
|
+
buttonElement.type = 'button';
|
|
30
|
+
buttonElement.setAttribute('aria-label', label);
|
|
31
|
+
toggleAttribute(buttonElement, 'disabled', disabled);
|
|
32
|
+
|
|
33
|
+
buttonElement.append(
|
|
34
|
+
GidsIconDom({
|
|
35
|
+
name: 'cross',
|
|
36
|
+
appearance: 'regular',
|
|
37
|
+
}),
|
|
38
|
+
);
|
|
39
|
+
|
|
40
|
+
if (onPressDismiss) {
|
|
41
|
+
buttonElement.addEventListener('click', onPressDismiss);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
return buttonElement;
|
|
45
|
+
};
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { type GidsFieldWebProps } from '@ganpatiinfo/gids-web-shared';
|
|
2
|
+
import {
|
|
3
|
+
appendAsChildren,
|
|
4
|
+
toggleAttribute,
|
|
5
|
+
type DomChildren,
|
|
6
|
+
} from '../../utils/domUtils.js';
|
|
7
|
+
|
|
8
|
+
export interface GidsFieldDomProps extends GidsFieldWebProps<
|
|
9
|
+
DomChildren,
|
|
10
|
+
DomChildren
|
|
11
|
+
> {
|
|
12
|
+
extraClasses?: string;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export const GidsFieldDom = ({
|
|
16
|
+
children,
|
|
17
|
+
count,
|
|
18
|
+
disabled,
|
|
19
|
+
label,
|
|
20
|
+
helperText,
|
|
21
|
+
statusText,
|
|
22
|
+
status,
|
|
23
|
+
extraClasses,
|
|
24
|
+
}: GidsFieldDomProps): HTMLElement => {
|
|
25
|
+
const field = document.createElement('gids-field');
|
|
26
|
+
|
|
27
|
+
if (count !== undefined) {
|
|
28
|
+
field.setAttribute('count', count);
|
|
29
|
+
} else {
|
|
30
|
+
field.removeAttribute('count');
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
if (helperText !== undefined) {
|
|
34
|
+
field.setAttribute('helper-text', helperText);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
if (statusText !== undefined) {
|
|
38
|
+
field.setAttribute('status-text', statusText);
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
if (status !== undefined) {
|
|
42
|
+
field.setAttribute('status', status);
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
toggleAttribute(field, 'disabled', disabled);
|
|
46
|
+
|
|
47
|
+
appendAsChildren(field, label);
|
|
48
|
+
appendAsChildren(field, children);
|
|
49
|
+
|
|
50
|
+
if (extraClasses) {
|
|
51
|
+
field.className = extraClasses;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
return field;
|
|
55
|
+
};
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { GidsHeadingCommonProps } from '@ganpatiinfo/gids-core-shared';
|
|
2
|
+
import { GidsHeadingWebUtils } from '@ganpatiinfo/gids-web-shared';
|
|
3
|
+
import {
|
|
4
|
+
appendAsChildren,
|
|
5
|
+
DomChildren,
|
|
6
|
+
DomNodeOrString,
|
|
7
|
+
} from '../../utils/domUtils.js';
|
|
8
|
+
import { GidsButtonGroupDom } from '../GidsButtonGroup/GidsButtonGroup.js';
|
|
9
|
+
|
|
10
|
+
const { getGidsHeadingClassNames } = GidsHeadingWebUtils;
|
|
11
|
+
|
|
12
|
+
export interface GidsHeadingDomProps extends GidsHeadingCommonProps<
|
|
13
|
+
DomChildren,
|
|
14
|
+
DomNodeOrString
|
|
15
|
+
> {
|
|
16
|
+
extraClasses?: string;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export const GidsHeadingDom = (props: GidsHeadingDomProps): HTMLDivElement => {
|
|
20
|
+
const {
|
|
21
|
+
heading,
|
|
22
|
+
supportingText,
|
|
23
|
+
level = 'section',
|
|
24
|
+
children,
|
|
25
|
+
extraClasses,
|
|
26
|
+
} = props;
|
|
27
|
+
|
|
28
|
+
const headingContainer = document.createElement('div');
|
|
29
|
+
headingContainer.className = getGidsHeadingClassNames(extraClasses);
|
|
30
|
+
|
|
31
|
+
const contentContainer = document.createElement('div');
|
|
32
|
+
contentContainer.className = 'gids-heading__content-container';
|
|
33
|
+
if (heading) {
|
|
34
|
+
if (typeof heading === 'string') {
|
|
35
|
+
const headingEl = document.createElement('span');
|
|
36
|
+
headingEl.className =
|
|
37
|
+
level === 'section'
|
|
38
|
+
? 'gids-heading__heading-text-section'
|
|
39
|
+
: 'gids-heading__heading-text-group';
|
|
40
|
+
headingEl.textContent = heading;
|
|
41
|
+
|
|
42
|
+
appendAsChildren(contentContainer, headingEl);
|
|
43
|
+
} else {
|
|
44
|
+
contentContainer.append(heading);
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
if (supportingText) {
|
|
49
|
+
if (typeof supportingText === 'string') {
|
|
50
|
+
const supportingTextEl = document.createElement('span');
|
|
51
|
+
supportingTextEl.className =
|
|
52
|
+
level === 'section'
|
|
53
|
+
? 'gids-heading__supporting-text-section'
|
|
54
|
+
: 'gids-heading__supporting-text-group';
|
|
55
|
+
supportingTextEl.textContent = supportingText;
|
|
56
|
+
|
|
57
|
+
appendAsChildren(contentContainer, supportingTextEl);
|
|
58
|
+
} else {
|
|
59
|
+
contentContainer.append(supportingText);
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
headingContainer.appendChild(contentContainer);
|
|
64
|
+
|
|
65
|
+
if (children) {
|
|
66
|
+
headingContainer.append(
|
|
67
|
+
GidsButtonGroupDom({ children: children, layout: 'wrap' }),
|
|
68
|
+
);
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
return headingContainer;
|
|
72
|
+
};
|
|
@@ -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
|
-
|
|
5
|
-
|
|
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
|
-
|
|
12
|
-
|
|
13
|
-
|
|
11
|
+
extraClasses?: ClassValue;
|
|
12
|
+
href?: string;
|
|
13
|
+
onClick?: (this: HTMLInputElement, event: Event) => void;
|
|
14
14
|
}
|
|
15
15
|
|
|
16
16
|
export const GidsLinkDom = ({
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
17
|
+
children,
|
|
18
|
+
size,
|
|
19
|
+
extraClasses,
|
|
20
|
+
href,
|
|
21
|
+
onClick,
|
|
22
22
|
}: GidsLinkDomProps): HTMLAnchorElement => {
|
|
23
|
-
|
|
24
|
-
|
|
23
|
+
const linkElement = document.createElement('a');
|
|
24
|
+
linkElement.className = getGidsLinkClassNames({ size }, extraClasses);
|
|
25
25
|
|
|
26
|
-
|
|
26
|
+
appendAsChildren(linkElement, children);
|
|
27
27
|
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
28
|
+
if (href) {
|
|
29
|
+
linkElement.setAttribute('href', href);
|
|
30
|
+
}
|
|
31
31
|
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
32
|
+
if (onClick) {
|
|
33
|
+
linkElement.addEventListener('click', onClick);
|
|
34
|
+
}
|
|
35
35
|
|
|
36
|
-
|
|
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
|
+
};
|