@ganpatiinfo/gids-web-dom-reference 2.0.2 → 2.0.3
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 +12 -0
- package/dist/components/GidsCheckbox/GidsCheckbox.d.ts +7 -0
- package/dist/components/GidsCheckbox/GidsCheckbox.d.ts.map +1 -0
- package/dist/components/GidsCheckbox/GidsCheckbox.js +38 -0
- package/dist/components/GidsCheckbox/GidsCheckbox.js.map +1 -0
- package/dist/components/GidsLabel/GidsLabel.d.ts +6 -0
- package/dist/components/GidsLabel/GidsLabel.d.ts.map +1 -0
- package/dist/components/GidsLabel/GidsLabel.js +34 -0
- package/dist/components/GidsLabel/GidsLabel.js.map +1 -0
- package/dist/components/GidsLabel/GidsLabelInfo/GidsLabelInfo.d.ts +8 -0
- package/dist/components/GidsLabel/GidsLabelInfo/GidsLabelInfo.d.ts.map +1 -0
- package/dist/components/GidsLabel/GidsLabelInfo/GidsLabelInfo.js +24 -0
- package/dist/components/GidsLabel/GidsLabelInfo/GidsLabelInfo.js.map +1 -0
- package/dist/components/GidsLink/GidsLink.d.ts +10 -0
- package/dist/components/GidsLink/GidsLink.d.ts.map +1 -0
- package/dist/components/GidsLink/GidsLink.js +16 -0
- package/dist/components/GidsLink/GidsLink.js.map +1 -0
- package/dist/components/GidsRadio/GidsRadio.d.ts +8 -0
- package/dist/components/GidsRadio/GidsRadio.d.ts.map +1 -0
- package/dist/components/GidsRadio/GidsRadio.js +36 -0
- package/dist/components/GidsRadio/GidsRadio.js.map +1 -0
- package/dist/components/GidsSwitch/GidsSwitch.d.ts +8 -0
- package/dist/components/GidsSwitch/GidsSwitch.d.ts.map +1 -0
- package/dist/components/GidsSwitch/GidsSwitch.js +36 -0
- package/dist/components/GidsSwitch/GidsSwitch.js.map +1 -0
- package/dist/components/_GidsCheckboxControl/GidsCheckboxControl.d.ts +7 -0
- package/dist/components/_GidsCheckboxControl/GidsCheckboxControl.d.ts.map +1 -0
- package/dist/components/_GidsCheckboxControl/GidsCheckboxControl.js +44 -0
- package/dist/components/_GidsCheckboxControl/GidsCheckboxControl.js.map +1 -0
- package/dist/components/_GidsRadioControl/GidsRadioControl.d.ts +7 -0
- package/dist/components/_GidsRadioControl/GidsRadioControl.d.ts.map +1 -0
- package/dist/components/_GidsRadioControl/GidsRadioControl.js +31 -0
- package/dist/components/_GidsRadioControl/GidsRadioControl.js.map +1 -0
- package/dist/components/_GidsSwitchControl/GidsSwitchControl.d.ts +7 -0
- package/dist/components/_GidsSwitchControl/GidsSwitchControl.d.ts.map +1 -0
- package/dist/components/_GidsSwitchControl/GidsSwitchControl.js +45 -0
- package/dist/components/_GidsSwitchControl/GidsSwitchControl.js.map +1 -0
- package/dist/index.d.ts +11 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +11 -2
- package/dist/index.js.map +1 -1
- package/package.json +4 -4
- package/src/components/GidsCheckbox/GidsCheckbox.ts +76 -0
- package/src/components/GidsLabel/GidsLabel.ts +58 -0
- package/src/components/GidsLabel/GidsLabelInfo/GidsLabelInfo.ts +44 -0
- package/src/components/GidsLink/GidsLink.ts +37 -0
- package/src/components/GidsRadio/GidsRadio.ts +70 -0
- package/src/components/GidsSwitch/GidsSwitch.ts +70 -0
- package/src/components/_GidsCheckboxControl/GidsCheckboxControl.ts +80 -0
- package/src/components/_GidsRadioControl/GidsRadioControl.ts +58 -0
- package/src/components/_GidsSwitchControl/GidsSwitchControl.ts +78 -0
- package/src/index.ts +11 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# @ganpatiinfo/gids-web-dom-reference
|
|
2
2
|
|
|
3
|
+
## 2.0.3
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Develeoped components checkbox, radio and switch
|
|
8
|
+
- Updated dependencies
|
|
9
|
+
- Updated dependencies
|
|
10
|
+
- Updated dependencies
|
|
11
|
+
- @ganpatiinfo/gids-core-shared@2.0.3
|
|
12
|
+
- @ganpatiinfo/gids-web-theme-interface@2.0.3
|
|
13
|
+
- @ganpatiinfo/gids-web-shared@2.0.3
|
|
14
|
+
|
|
3
15
|
## 2.0.2
|
|
4
16
|
|
|
5
17
|
### Patch Changes
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { type ClassValue, type GidsCheckboxWebProps } from '@ganpatiinfo/gids-web-shared';
|
|
2
|
+
export interface GidsCheckboxDomProps extends GidsCheckboxWebProps<Element | Element[] | string | string[], Element> {
|
|
3
|
+
onChange?: (this: HTMLInputElement, event: Event) => void;
|
|
4
|
+
className?: ClassValue;
|
|
5
|
+
}
|
|
6
|
+
export declare const GidsCheckboxDom: ({ children, fieldRequirement, fieldRequirementOptionalText, fieldRequirementRequiredText, info, labelId, checked, defaultChecked, disabled, indeterminate, required, inputId, name, value, onChange, className, }: GidsCheckboxDomProps) => HTMLDivElement;
|
|
7
|
+
//# sourceMappingURL=GidsCheckbox.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"GidsCheckbox.d.ts","sourceRoot":"","sources":["../../../src/components/GidsCheckbox/GidsCheckbox.ts"],"names":[],"mappings":"AAAA,OAAO,EACN,KAAK,UAAU,EAEf,KAAK,oBAAoB,EAEzB,MAAM,8BAA8B,CAAC;AAMtC,MAAM,WAAW,oBAChB,SAAQ,oBAAoB,CAC3B,OAAO,GAAG,OAAO,EAAE,GAAG,MAAM,GAAG,MAAM,EAAE,EACvC,OAAO,CACP;IACD,QAAQ,CAAC,EAAE,CAAC,IAAI,EAAE,gBAAgB,EAAE,KAAK,EAAE,KAAK,KAAK,IAAI,CAAC;IAC1D,SAAS,CAAC,EAAE,UAAU,CAAC;CACvB;AAED,eAAO,MAAM,eAAe,GAAI,mNAsB7B,oBAAoB,KAAG,cAiCzB,CAAC"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { generateId, GidsCheckboxWebUtils, } from '@ganpatiinfo/gids-web-shared';
|
|
2
|
+
import { GidsCheckboxControlDom } from '../_GidsCheckboxControl/GidsCheckboxControl';
|
|
3
|
+
import { GidsLabelDom } from '../GidsLabel/GidsLabel';
|
|
4
|
+
const { getGidsCheckboxClassNames } = GidsCheckboxWebUtils;
|
|
5
|
+
export const GidsCheckboxDom = ({
|
|
6
|
+
// Label props
|
|
7
|
+
children, fieldRequirement, fieldRequirementOptionalText, fieldRequirementRequiredText, info, labelId,
|
|
8
|
+
// Checkbox props
|
|
9
|
+
checked, defaultChecked, disabled, indeterminate, required, inputId, name, value, onChange,
|
|
10
|
+
// CheckboxWithLabel props
|
|
11
|
+
className, }) => {
|
|
12
|
+
const checkboxWithLabel = document.createElement('div');
|
|
13
|
+
checkboxWithLabel.className = getGidsCheckboxClassNames(className);
|
|
14
|
+
const realInputId = inputId ?? generateId();
|
|
15
|
+
checkboxWithLabel.appendChild(GidsCheckboxControlDom({
|
|
16
|
+
checked,
|
|
17
|
+
defaultChecked,
|
|
18
|
+
disabled,
|
|
19
|
+
indeterminate,
|
|
20
|
+
inputId: realInputId,
|
|
21
|
+
name,
|
|
22
|
+
value,
|
|
23
|
+
required,
|
|
24
|
+
onChange,
|
|
25
|
+
}));
|
|
26
|
+
checkboxWithLabel.appendChild(GidsLabelDom({
|
|
27
|
+
children,
|
|
28
|
+
disabled,
|
|
29
|
+
fieldRequirement,
|
|
30
|
+
fieldRequirementOptionalText,
|
|
31
|
+
fieldRequirementRequiredText,
|
|
32
|
+
htmlFor: realInputId,
|
|
33
|
+
info,
|
|
34
|
+
labelId,
|
|
35
|
+
}));
|
|
36
|
+
return checkboxWithLabel;
|
|
37
|
+
};
|
|
38
|
+
//# sourceMappingURL=GidsCheckbox.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"GidsCheckbox.js","sourceRoot":"","sources":["../../../src/components/GidsCheckbox/GidsCheckbox.ts"],"names":[],"mappings":"AAAA,OAAO,EAEN,UAAU,EAEV,oBAAoB,GACpB,MAAM,8BAA8B,CAAC;AACtC,OAAO,EAAE,sBAAsB,EAAE,MAAM,6CAA6C,CAAC;AACrF,OAAO,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAEtD,MAAM,EAAE,yBAAyB,EAAE,GAAG,oBAAoB,CAAC;AAW3D,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC;AAC/B,cAAc;AACd,QAAQ,EACR,gBAAgB,EAChB,4BAA4B,EAC5B,4BAA4B,EAC5B,IAAI,EACJ,OAAO;AAEP,iBAAiB;AACjB,OAAO,EACP,cAAc,EACd,QAAQ,EACR,aAAa,EACb,QAAQ,EACR,OAAO,EACP,IAAI,EACJ,KAAK,EACL,QAAQ;AAER,0BAA0B;AAC1B,SAAS,GACa,EAAkB,EAAE;IAC1C,MAAM,iBAAiB,GAAG,QAAQ,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC;IACxD,iBAAiB,CAAC,SAAS,GAAG,yBAAyB,CAAC,SAAS,CAAC,CAAC;IAEnE,MAAM,WAAW,GAAG,OAAO,IAAI,UAAU,EAAE,CAAC;IAE5C,iBAAiB,CAAC,WAAW,CAC5B,sBAAsB,CAAC;QACtB,OAAO;QACP,cAAc;QACd,QAAQ;QACR,aAAa;QACb,OAAO,EAAE,WAAW;QACpB,IAAI;QACK,KAAK;QACd,QAAQ;QACR,QAAQ;KACR,CAAC,CACF,CAAC;IACF,iBAAiB,CAAC,WAAW,CAC5B,YAAY,CAAC;QACZ,QAAQ;QACR,QAAQ;QACR,gBAAgB;QAChB,4BAA4B;QAC5B,4BAA4B;QAC5B,OAAO,EAAE,WAAW;QACpB,IAAI;QACJ,OAAO;KACP,CAAC,CACF,CAAC;IAEF,OAAO,iBAAiB,CAAC;AAC1B,CAAC,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { type GidsLabelWebProps } from '@ganpatiinfo/gids-web-shared';
|
|
2
|
+
import { type DomChildren, type DomNodeOrString } from '../../utils/domUtils';
|
|
3
|
+
export interface GidsLabelDomProps extends GidsLabelWebProps<DomChildren, DomNodeOrString> {
|
|
4
|
+
}
|
|
5
|
+
export declare const GidsLabelDom: ({ children, disabled, fieldRequirement, fieldRequirementOptionalText, fieldRequirementRequiredText, info, htmlFor, labelId, }: GidsLabelDomProps) => HTMLDivElement;
|
|
6
|
+
//# sourceMappingURL=GidsLabel.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"GidsLabel.d.ts","sourceRoot":"","sources":["../../../src/components/GidsLabel/GidsLabel.ts"],"names":[],"mappings":"AAAA,OAAO,EAEN,KAAK,iBAAiB,EACtB,MAAM,8BAA8B,CAAC;AACtC,OAAO,EAEN,KAAK,WAAW,EAChB,KAAK,eAAe,EACpB,MAAM,sBAAsB,CAAC;AAM9B,MAAM,WAAW,iBAChB,SAAQ,iBAAiB,CAAC,WAAW,EAAE,eAAe,CAAC;CAAG;AAE3D,eAAO,MAAM,YAAY,GAAI,+HAS1B,iBAAiB,KAAG,cA+BtB,CAAC"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { GidsLabelWebUtils, } from '@ganpatiinfo/gids-web-shared';
|
|
2
|
+
import { appendAsChildren, } from '../../utils/domUtils';
|
|
3
|
+
import { GidsLabelCommonUtils } from '@ganpatiinfo/gids-core-shared';
|
|
4
|
+
const { getIndicatorText } = GidsLabelCommonUtils;
|
|
5
|
+
const { getGidsLabelClassNames } = GidsLabelWebUtils;
|
|
6
|
+
export const GidsLabelDom = ({ children, disabled, fieldRequirement, fieldRequirementOptionalText, fieldRequirementRequiredText, info, htmlFor, labelId, }) => {
|
|
7
|
+
const container = document.createElement('div');
|
|
8
|
+
container.className = getGidsLabelClassNames({ disabled });
|
|
9
|
+
const label = document.createElement('label');
|
|
10
|
+
if (htmlFor !== undefined) {
|
|
11
|
+
label.setAttribute('for', htmlFor);
|
|
12
|
+
}
|
|
13
|
+
if (labelId !== undefined) {
|
|
14
|
+
label.id = labelId;
|
|
15
|
+
}
|
|
16
|
+
appendAsChildren(label, children);
|
|
17
|
+
const indicatorText = getIndicatorText({
|
|
18
|
+
fieldRequirement,
|
|
19
|
+
fieldRequirementOptionalText,
|
|
20
|
+
fieldRequirementRequiredText,
|
|
21
|
+
});
|
|
22
|
+
if (indicatorText !== undefined) {
|
|
23
|
+
const fieldRequirementSpan = document.createElement('span');
|
|
24
|
+
fieldRequirementSpan.className = 'gids-label__field-requirement';
|
|
25
|
+
fieldRequirementSpan.textContent = indicatorText;
|
|
26
|
+
label.appendChild(fieldRequirementSpan);
|
|
27
|
+
}
|
|
28
|
+
container.appendChild(label);
|
|
29
|
+
if (info) {
|
|
30
|
+
container.append(info);
|
|
31
|
+
}
|
|
32
|
+
return container;
|
|
33
|
+
};
|
|
34
|
+
//# sourceMappingURL=GidsLabel.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"GidsLabel.js","sourceRoot":"","sources":["../../../src/components/GidsLabel/GidsLabel.ts"],"names":[],"mappings":"AAAA,OAAO,EACN,iBAAiB,GAEjB,MAAM,8BAA8B,CAAC;AACtC,OAAO,EACN,gBAAgB,GAGhB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,oBAAoB,EAAE,MAAM,+BAA+B,CAAC;AAErE,MAAM,EAAE,gBAAgB,EAAE,GAAG,oBAAoB,CAAC;AAClD,MAAM,EAAE,sBAAsB,EAAE,GAAG,iBAAiB,CAAC;AAKrD,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC,EAC5B,QAAQ,EACR,QAAQ,EACR,gBAAgB,EAChB,4BAA4B,EAC5B,4BAA4B,EAC5B,IAAI,EACJ,OAAO,EACP,OAAO,GACY,EAAkB,EAAE;IACvC,MAAM,SAAS,GAAG,QAAQ,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC;IAChD,SAAS,CAAC,SAAS,GAAG,sBAAsB,CAAC,EAAE,QAAQ,EAAE,CAAC,CAAC;IAE3D,MAAM,KAAK,GAAG,QAAQ,CAAC,aAAa,CAAC,OAAO,CAAC,CAAC;IAC9C,IAAI,OAAO,KAAK,SAAS,EAAE,CAAC;QAC3B,KAAK,CAAC,YAAY,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC;IACpC,CAAC;IACD,IAAI,OAAO,KAAK,SAAS,EAAE,CAAC;QAC3B,KAAK,CAAC,EAAE,GAAG,OAAO,CAAC;IACpB,CAAC;IACD,gBAAgB,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAC;IAElC,MAAM,aAAa,GAAG,gBAAgB,CAAC;QACtC,gBAAgB;QAChB,4BAA4B;QAC5B,4BAA4B;KAC5B,CAAC,CAAC;IACH,IAAI,aAAa,KAAK,SAAS,EAAE,CAAC;QACjC,MAAM,oBAAoB,GAAG,QAAQ,CAAC,aAAa,CAAC,MAAM,CAAC,CAAC;QAC5D,oBAAoB,CAAC,SAAS,GAAG,+BAA+B,CAAC;QACjE,oBAAoB,CAAC,WAAW,GAAG,aAAa,CAAC;QACjD,KAAK,CAAC,WAAW,CAAC,oBAAoB,CAAC,CAAC;IACzC,CAAC;IAED,SAAS,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC;IAC7B,IAAI,IAAI,EAAE,CAAC;QACV,SAAS,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;IACxB,CAAC;IAED,OAAO,SAAS,CAAC;AAClB,CAAC,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { type GidsLabelInfoCommonProps } from '@ganpatiinfo/gids-core-shared';
|
|
2
|
+
import { type ClassValue } from '@ganpatiinfo/gids-web-shared';
|
|
3
|
+
export interface GidsLabelInfoDomProps extends GidsLabelInfoCommonProps {
|
|
4
|
+
onClick?: (event: MouseEvent) => void;
|
|
5
|
+
className?: ClassValue;
|
|
6
|
+
}
|
|
7
|
+
export declare const GidsLabelInfoDom: ({ disabled, alt, onClick, className, }: GidsLabelInfoDomProps) => HTMLButtonElement;
|
|
8
|
+
//# sourceMappingURL=GidsLabelInfo.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"GidsLabelInfo.d.ts","sourceRoot":"","sources":["../../../../src/components/GidsLabel/GidsLabelInfo/GidsLabelInfo.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,wBAAwB,EAAE,MAAM,+BAA+B,CAAC;AAC9E,OAAO,EAAE,KAAK,UAAU,EAAE,MAAM,8BAA8B,CAAC;AAS/D,MAAM,WAAW,qBAAsB,SAAQ,wBAAwB;IACtE,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,UAAU,KAAK,IAAI,CAAC;IACtC,SAAS,CAAC,EAAE,UAAU,CAAC;CACvB;AAED,eAAO,MAAM,gBAAgB,GAAI,wCAK9B,qBAAqB,KAAG,iBAuB1B,CAAC"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { GidsLabelInfoWebUtils } from '@ganpatiinfo/gids-web-shared';
|
|
2
|
+
import { toggleAttribute } from '../../../utils/domUtils';
|
|
3
|
+
import { GidsLabelInfoCommonUtils } from '@ganpatiinfo/gids-core-shared';
|
|
4
|
+
import { GidsIconDom } from '../../GidsIcon/GidsIcon';
|
|
5
|
+
const { getGidsLabelInfoClassNames } = GidsLabelInfoWebUtils;
|
|
6
|
+
const { getLabelInfoAltText } = GidsLabelInfoCommonUtils;
|
|
7
|
+
export const GidsLabelInfoDom = ({ disabled, alt, onClick, className, }) => {
|
|
8
|
+
const labelInfo = document.createElement('button');
|
|
9
|
+
labelInfo.className = getGidsLabelInfoClassNames(className);
|
|
10
|
+
labelInfo.setAttribute('type', 'button');
|
|
11
|
+
if (onClick) {
|
|
12
|
+
labelInfo.addEventListener('click', onClick);
|
|
13
|
+
}
|
|
14
|
+
if (disabled) {
|
|
15
|
+
toggleAttribute(labelInfo, 'disabled', true);
|
|
16
|
+
}
|
|
17
|
+
const labelSpan = document.createElement('span');
|
|
18
|
+
labelSpan.className = 'gids-visually-hidden';
|
|
19
|
+
labelSpan.textContent = getLabelInfoAltText({ alt });
|
|
20
|
+
labelInfo.appendChild(labelSpan);
|
|
21
|
+
labelInfo.appendChild(GidsIconDom({ name: 'information', size: 'sm', alt: '' }));
|
|
22
|
+
return labelInfo;
|
|
23
|
+
};
|
|
24
|
+
//# sourceMappingURL=GidsLabelInfo.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"GidsLabelInfo.js","sourceRoot":"","sources":["../../../../src/components/GidsLabel/GidsLabelInfo/GidsLabelInfo.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,qBAAqB,EAAE,MAAM,8BAA8B,CAAC;AACrE,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAC1D,OAAO,EAAE,wBAAwB,EAAE,MAAM,+BAA+B,CAAC;AACzE,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAEtD,MAAM,EAAE,0BAA0B,EAAE,GAAG,qBAAqB,CAAC;AAC7D,MAAM,EAAE,mBAAmB,EAAE,GAAG,wBAAwB,CAAC;AAOzD,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,EAChC,QAAQ,EACR,GAAG,EACH,OAAO,EACP,SAAS,GACc,EAAqB,EAAE;IAC9C,MAAM,SAAS,GAAG,QAAQ,CAAC,aAAa,CAAC,QAAQ,CAAC,CAAC;IACnD,SAAS,CAAC,SAAS,GAAG,0BAA0B,CAAC,SAAS,CAAC,CAAC;IAC5D,SAAS,CAAC,YAAY,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC;IAEzC,IAAI,OAAO,EAAE,CAAC;QACb,SAAS,CAAC,gBAAgB,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;IAC9C,CAAC;IAED,IAAI,QAAQ,EAAE,CAAC;QACd,eAAe,CAAC,SAAS,EAAE,UAAU,EAAE,IAAI,CAAC,CAAC;IAC9C,CAAC;IAED,MAAM,SAAS,GAAG,QAAQ,CAAC,aAAa,CAAC,MAAM,CAAC,CAAC;IACjD,SAAS,CAAC,SAAS,GAAG,sBAAsB,CAAC;IAC7C,SAAS,CAAC,WAAW,GAAG,mBAAmB,CAAC,EAAE,GAAG,EAAE,CAAC,CAAC;IAErD,SAAS,CAAC,WAAW,CAAC,SAAS,CAAC,CAAC;IACjC,SAAS,CAAC,WAAW,CACpB,WAAW,CAAC,EAAE,IAAI,EAAE,aAAa,EAAE,IAAI,EAAE,IAAI,EAAE,GAAG,EAAE,EAAE,EAAE,CAAC,CACzD,CAAC;IAEF,OAAO,SAAS,CAAC;AAClB,CAAC,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { type GidsLinkCommonProps } from '@ganpatiinfo/gids-core-shared';
|
|
2
|
+
import { type DomChildren } from '../../utils/domUtils';
|
|
3
|
+
import { type ClassValue } from '@ganpatiinfo/gids-web-shared';
|
|
4
|
+
export interface GidsLinkDomProps extends GidsLinkCommonProps<DomChildren> {
|
|
5
|
+
extraClasses?: ClassValue;
|
|
6
|
+
href?: string;
|
|
7
|
+
onClick?: (this: HTMLInputElement, event: Event) => void;
|
|
8
|
+
}
|
|
9
|
+
export declare const GidsLinkDom: ({ children, size, extraClasses, href, onClick, }: GidsLinkDomProps) => HTMLAnchorElement;
|
|
10
|
+
//# sourceMappingURL=GidsLink.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"GidsLink.d.ts","sourceRoot":"","sources":["../../../src/components/GidsLink/GidsLink.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,mBAAmB,EAAE,MAAM,+BAA+B,CAAC;AACzE,OAAO,EAAoB,KAAK,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAC1E,OAAO,EACN,KAAK,UAAU,EAEf,MAAM,8BAA8B,CAAC;AAItC,MAAM,WAAW,gBAAiB,SAAQ,mBAAmB,CAAC,WAAW,CAAC;IACzE,YAAY,CAAC,EAAE,UAAU,CAAC;IAC1B,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,OAAO,CAAC,EAAE,CAAC,IAAI,EAAE,gBAAgB,EAAE,KAAK,EAAE,KAAK,KAAK,IAAI,CAAC;CACzD;AAED,eAAO,MAAM,WAAW,GAAI,kDAMzB,gBAAgB,KAAG,iBAerB,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { appendAsChildren } from '../../utils/domUtils';
|
|
2
|
+
import { GidsLinkWebUtils, } from '@ganpatiinfo/gids-web-shared';
|
|
3
|
+
const { getGidsLinkClassNames } = GidsLinkWebUtils;
|
|
4
|
+
export const GidsLinkDom = ({ children, size, extraClasses, href, onClick, }) => {
|
|
5
|
+
const linkElement = document.createElement('a');
|
|
6
|
+
linkElement.className = getGidsLinkClassNames({ size }, extraClasses);
|
|
7
|
+
appendAsChildren(linkElement, children);
|
|
8
|
+
if (href) {
|
|
9
|
+
linkElement.setAttribute('href', href);
|
|
10
|
+
}
|
|
11
|
+
if (onClick) {
|
|
12
|
+
linkElement.addEventListener('click', onClick);
|
|
13
|
+
}
|
|
14
|
+
return linkElement;
|
|
15
|
+
};
|
|
16
|
+
//# sourceMappingURL=GidsLink.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"GidsLink.js","sourceRoot":"","sources":["../../../src/components/GidsLink/GidsLink.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,gBAAgB,EAAoB,MAAM,sBAAsB,CAAC;AAC1E,OAAO,EAEN,gBAAgB,GAChB,MAAM,8BAA8B,CAAC;AAEtC,MAAM,EAAE,qBAAqB,EAAE,GAAG,gBAAgB,CAAC;AAQnD,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC,EAC3B,QAAQ,EACR,IAAI,EACJ,YAAY,EACZ,IAAI,EACJ,OAAO,GACW,EAAqB,EAAE;IACzC,MAAM,WAAW,GAAG,QAAQ,CAAC,aAAa,CAAC,GAAG,CAAC,CAAC;IAChD,WAAW,CAAC,SAAS,GAAG,qBAAqB,CAAC,EAAE,IAAI,EAAE,EAAE,YAAY,CAAC,CAAC;IAEtE,gBAAgB,CAAC,WAAW,EAAE,QAAQ,CAAC,CAAC;IAExC,IAAI,IAAI,EAAE,CAAC;QACV,WAAW,CAAC,YAAY,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;IACxC,CAAC;IAED,IAAI,OAAO,EAAE,CAAC;QACb,WAAW,CAAC,gBAAgB,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;IAChD,CAAC;IAED,OAAO,WAAW,CAAC;AACpB,CAAC,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { type ClassValue, type GidsRadioWebProps } from '@ganpatiinfo/gids-web-shared';
|
|
2
|
+
import { type DomChildren, type DomNodeOrString } from '../../utils/domUtils';
|
|
3
|
+
export interface GidsRadioDomProps extends GidsRadioWebProps<DomChildren, DomNodeOrString> {
|
|
4
|
+
onChange?: (this: HTMLInputElement, event: Event) => void;
|
|
5
|
+
className?: ClassValue;
|
|
6
|
+
}
|
|
7
|
+
export declare const GidsRadioDom: ({ children, fieldRequirement, fieldRequirementOptionalText, fieldRequirementRequiredText, info, labelId, checked, defaultChecked, disabled, inputId, name, value, onChange, className, }: GidsRadioDomProps) => HTMLDivElement;
|
|
8
|
+
//# sourceMappingURL=GidsRadio.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"GidsRadio.d.ts","sourceRoot":"","sources":["../../../src/components/GidsRadio/GidsRadio.ts"],"names":[],"mappings":"AAAA,OAAO,EACN,KAAK,UAAU,EAEf,KAAK,iBAAiB,EAEtB,MAAM,8BAA8B,CAAC;AAGtC,OAAO,EAAE,KAAK,WAAW,EAAE,KAAK,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAI9E,MAAM,WAAW,iBAChB,SAAQ,iBAAiB,CAAC,WAAW,EAAE,eAAe,CAAC;IACvD,QAAQ,CAAC,EAAE,CAAC,IAAI,EAAE,gBAAgB,EAAE,KAAK,EAAE,KAAK,KAAK,IAAI,CAAC;IAC1D,SAAS,CAAC,EAAE,UAAU,CAAC;CACvB;AAED,eAAO,MAAM,YAAY,GAAI,0LAoB1B,iBAAiB,KAAG,cA+BtB,CAAC"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { generateId, GidsRadioWebUtils, } from '@ganpatiinfo/gids-web-shared';
|
|
2
|
+
import { GidsRadioControlDom } from '../_GidsRadioControl/GidsRadioControl';
|
|
3
|
+
import { GidsLabelDom } from '../GidsLabel/GidsLabel';
|
|
4
|
+
const { getGidsRadioClassNames } = GidsRadioWebUtils;
|
|
5
|
+
export const GidsRadioDom = ({
|
|
6
|
+
// Label props
|
|
7
|
+
children, fieldRequirement, fieldRequirementOptionalText, fieldRequirementRequiredText, info, labelId,
|
|
8
|
+
// Radio props
|
|
9
|
+
checked, defaultChecked, disabled, inputId, name, value, onChange,
|
|
10
|
+
// RadioWithLabel props
|
|
11
|
+
className, }) => {
|
|
12
|
+
const radioWithLabel = document.createElement('div');
|
|
13
|
+
radioWithLabel.className = getGidsRadioClassNames(className);
|
|
14
|
+
const realInputId = inputId ?? generateId();
|
|
15
|
+
radioWithLabel.appendChild(GidsRadioControlDom({
|
|
16
|
+
checked,
|
|
17
|
+
defaultChecked,
|
|
18
|
+
disabled,
|
|
19
|
+
inputId: realInputId,
|
|
20
|
+
name,
|
|
21
|
+
value,
|
|
22
|
+
onChange,
|
|
23
|
+
}));
|
|
24
|
+
radioWithLabel.appendChild(GidsLabelDom({
|
|
25
|
+
children,
|
|
26
|
+
disabled,
|
|
27
|
+
fieldRequirement,
|
|
28
|
+
fieldRequirementOptionalText,
|
|
29
|
+
fieldRequirementRequiredText,
|
|
30
|
+
htmlFor: realInputId,
|
|
31
|
+
info,
|
|
32
|
+
labelId,
|
|
33
|
+
}));
|
|
34
|
+
return radioWithLabel;
|
|
35
|
+
};
|
|
36
|
+
//# sourceMappingURL=GidsRadio.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"GidsRadio.js","sourceRoot":"","sources":["../../../src/components/GidsRadio/GidsRadio.ts"],"names":[],"mappings":"AAAA,OAAO,EAEN,UAAU,EAEV,iBAAiB,GACjB,MAAM,8BAA8B,CAAC;AACtC,OAAO,EAAE,mBAAmB,EAAE,MAAM,uCAAuC,CAAC;AAC5E,OAAO,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAGtD,MAAM,EAAE,sBAAsB,EAAE,GAAG,iBAAiB,CAAC;AAQrD,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC;AAC5B,cAAc;AACd,QAAQ,EACR,gBAAgB,EAChB,4BAA4B,EAC5B,4BAA4B,EAC5B,IAAI,EACJ,OAAO;AAEP,cAAc;AACd,OAAO,EACP,cAAc,EACd,QAAQ,EACR,OAAO,EACP,IAAI,EACJ,KAAK,EACL,QAAQ;AAER,uBAAuB;AACvB,SAAS,GACU,EAAkB,EAAE;IACvC,MAAM,cAAc,GAAG,QAAQ,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC;IACrD,cAAc,CAAC,SAAS,GAAG,sBAAsB,CAAC,SAAS,CAAC,CAAC;IAE7D,MAAM,WAAW,GAAG,OAAO,IAAI,UAAU,EAAE,CAAC;IAE5C,cAAc,CAAC,WAAW,CACzB,mBAAmB,CAAC;QACnB,OAAO;QACP,cAAc;QACd,QAAQ;QACR,OAAO,EAAE,WAAW;QACpB,IAAI;QACJ,KAAK;QACL,QAAQ;KACR,CAAC,CACF,CAAC;IACF,cAAc,CAAC,WAAW,CACzB,YAAY,CAAC;QACZ,QAAQ;QACR,QAAQ;QACR,gBAAgB;QAChB,4BAA4B;QAC5B,4BAA4B;QAC5B,OAAO,EAAE,WAAW;QACpB,IAAI;QACJ,OAAO;KACP,CAAC,CACF,CAAC;IAEF,OAAO,cAAc,CAAC;AACvB,CAAC,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { type ClassValue, type GidsSwitchWebProps } from '@ganpatiinfo/gids-web-shared';
|
|
2
|
+
import { type DomChildren, type DomNodeOrString } from '../../utils/domUtils';
|
|
3
|
+
export interface GidsSwitchDomProps extends GidsSwitchWebProps<DomChildren, DomNodeOrString> {
|
|
4
|
+
onChange?: (this: HTMLInputElement, event: Event) => void;
|
|
5
|
+
className?: ClassValue;
|
|
6
|
+
}
|
|
7
|
+
export declare const GidsSwitchDom: ({ children, fieldRequirement, fieldRequirementOptionalText, fieldRequirementRequiredText, info, labelId, checked, defaultChecked, disabled, inputId, name, value, onChange, className, }: GidsSwitchDomProps) => HTMLDivElement;
|
|
8
|
+
//# sourceMappingURL=GidsSwitch.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"GidsSwitch.d.ts","sourceRoot":"","sources":["../../../src/components/GidsSwitch/GidsSwitch.ts"],"names":[],"mappings":"AAAA,OAAO,EACH,KAAK,UAAU,EAEf,KAAK,kBAAkB,EAE1B,MAAM,8BAA8B,CAAC;AAGtC,OAAO,EAAE,KAAK,WAAW,EAAE,KAAK,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAI9E,MAAM,WAAW,kBACb,SAAQ,kBAAkB,CAAC,WAAW,EAAE,eAAe,CAAC;IACxD,QAAQ,CAAC,EAAE,CAAC,IAAI,EAAE,gBAAgB,EAAE,KAAK,EAAE,KAAK,KAAK,IAAI,CAAC;IAC1D,SAAS,CAAC,EAAE,UAAU,CAAC;CAC1B;AAED,eAAO,MAAM,aAAa,GAAI,0LAoB3B,kBAAkB,KAAG,cA+BvB,CAAC"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { generateId, GidsSwitchWebUtils, } from '@ganpatiinfo/gids-web-shared';
|
|
2
|
+
import { GidsSwitchControlDom } from '../_GidsSwitchControl/GidsSwitchControl';
|
|
3
|
+
import { GidsLabelDom } from '../GidsLabel/GidsLabel';
|
|
4
|
+
const { getGidsSwitchClassNames } = GidsSwitchWebUtils;
|
|
5
|
+
export const GidsSwitchDom = ({
|
|
6
|
+
// Label props
|
|
7
|
+
children, fieldRequirement, fieldRequirementOptionalText, fieldRequirementRequiredText, info, labelId,
|
|
8
|
+
// Switch props
|
|
9
|
+
checked, defaultChecked, disabled, inputId, name, value, onChange,
|
|
10
|
+
// SwitchWithLabel props
|
|
11
|
+
className, }) => {
|
|
12
|
+
const switchElement = document.createElement('div');
|
|
13
|
+
switchElement.className = getGidsSwitchClassNames(className);
|
|
14
|
+
const realInputId = inputId ?? generateId();
|
|
15
|
+
switchElement.appendChild(GidsSwitchControlDom({
|
|
16
|
+
checked,
|
|
17
|
+
defaultChecked,
|
|
18
|
+
disabled,
|
|
19
|
+
inputId: realInputId,
|
|
20
|
+
name,
|
|
21
|
+
value,
|
|
22
|
+
onChange,
|
|
23
|
+
}));
|
|
24
|
+
switchElement.appendChild(GidsLabelDom({
|
|
25
|
+
children,
|
|
26
|
+
disabled,
|
|
27
|
+
fieldRequirement,
|
|
28
|
+
fieldRequirementOptionalText,
|
|
29
|
+
fieldRequirementRequiredText,
|
|
30
|
+
htmlFor: realInputId,
|
|
31
|
+
info,
|
|
32
|
+
labelId,
|
|
33
|
+
}));
|
|
34
|
+
return switchElement;
|
|
35
|
+
};
|
|
36
|
+
//# sourceMappingURL=GidsSwitch.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"GidsSwitch.js","sourceRoot":"","sources":["../../../src/components/GidsSwitch/GidsSwitch.ts"],"names":[],"mappings":"AAAA,OAAO,EAEH,UAAU,EAEV,kBAAkB,GACrB,MAAM,8BAA8B,CAAC;AACtC,OAAO,EAAE,oBAAoB,EAAE,MAAM,yCAAyC,CAAC;AAC/E,OAAO,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAGtD,MAAM,EAAE,uBAAuB,EAAE,GAAG,kBAAkB,CAAC;AAQvD,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC;AAC1B,cAAc;AACd,QAAQ,EACR,gBAAgB,EAChB,4BAA4B,EAC5B,4BAA4B,EAC5B,IAAI,EACJ,OAAO;AAEP,eAAe;AACf,OAAO,EACP,cAAc,EACd,QAAQ,EACR,OAAO,EACP,IAAI,EACJ,KAAK,EACL,QAAQ;AAER,wBAAwB;AACxB,SAAS,GACQ,EAAkB,EAAE;IACrC,MAAM,aAAa,GAAG,QAAQ,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC;IACpD,aAAa,CAAC,SAAS,GAAG,uBAAuB,CAAC,SAAS,CAAC,CAAC;IAE7D,MAAM,WAAW,GAAG,OAAO,IAAI,UAAU,EAAE,CAAC;IAE5C,aAAa,CAAC,WAAW,CACrB,oBAAoB,CAAC;QACjB,OAAO;QACP,cAAc;QACd,QAAQ;QACR,OAAO,EAAE,WAAW;QACpB,IAAI;QACJ,KAAK;QACL,QAAQ;KACX,CAAC,CACL,CAAC;IACF,aAAa,CAAC,WAAW,CACrB,YAAY,CAAC;QACT,QAAQ;QACR,QAAQ;QACR,gBAAgB;QAChB,4BAA4B;QAC5B,4BAA4B;QAC5B,OAAO,EAAE,WAAW;QACpB,IAAI;QACJ,OAAO;KACV,CAAC,CACL,CAAC;IAEF,OAAO,aAAa,CAAC;AACzB,CAAC,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { type ClassValue, type GidsCheckboxControlWebProps } from '@ganpatiinfo/gids-web-shared';
|
|
2
|
+
export interface GidsCheckboxControlDomProps extends GidsCheckboxControlWebProps {
|
|
3
|
+
onChange?: (this: HTMLInputElement, event: Event) => void;
|
|
4
|
+
className?: ClassValue;
|
|
5
|
+
}
|
|
6
|
+
export declare const GidsCheckboxControlDom: ({ checked, defaultChecked, disabled, inputId, indeterminate, name, value, required, onChange, className, }: GidsCheckboxControlDomProps) => HTMLSpanElement;
|
|
7
|
+
//# sourceMappingURL=GidsCheckboxControl.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"GidsCheckboxControl.d.ts","sourceRoot":"","sources":["../../../src/components/_GidsCheckboxControl/GidsCheckboxControl.ts"],"names":[],"mappings":"AAAA,OAAO,EACN,KAAK,UAAU,EACf,KAAK,2BAA2B,EAEhC,MAAM,8BAA8B,CAAC;AAMtC,MAAM,WAAW,2BAChB,SAAQ,2BAA2B;IACnC,QAAQ,CAAC,EAAE,CAAC,IAAI,EAAE,gBAAgB,EAAE,KAAK,EAAE,KAAK,KAAK,IAAI,CAAC;IAC1D,SAAS,CAAC,EAAE,UAAU,CAAC;CACvB;AAED,eAAO,MAAM,sBAAsB,GAAI,4GAWpC,2BAA2B,KAAG,eAoDhC,CAAC"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { GidsCheckboxControlWebUtils, } from '@ganpatiinfo/gids-web-shared';
|
|
2
|
+
import { applyStatefulInputProps, toggleAttribute } from '../../utils/domUtils';
|
|
3
|
+
import { GidsIconDom } from '../GidsIcon/GidsIcon';
|
|
4
|
+
const { getGidsCheckboxControlClassNames } = GidsCheckboxControlWebUtils;
|
|
5
|
+
export const GidsCheckboxControlDom = ({ checked, defaultChecked, disabled, inputId, indeterminate, name, value, required, onChange, className, }) => {
|
|
6
|
+
const checkboxControlWrapper = document.createElement('span');
|
|
7
|
+
checkboxControlWrapper.className =
|
|
8
|
+
getGidsCheckboxControlClassNames(className);
|
|
9
|
+
const checkboxInput = document.createElement('input');
|
|
10
|
+
checkboxInput.className = 'gids-checkbox-control__input';
|
|
11
|
+
checkboxInput.setAttribute('type', 'checkbox');
|
|
12
|
+
toggleAttribute(checkboxInput, 'disabled', disabled ?? false);
|
|
13
|
+
toggleAttribute(checkboxInput, 'required', required ?? false);
|
|
14
|
+
applyStatefulInputProps(checkboxInput, {
|
|
15
|
+
checked,
|
|
16
|
+
defaultChecked,
|
|
17
|
+
value,
|
|
18
|
+
});
|
|
19
|
+
checkboxInput.indeterminate = indeterminate ?? false;
|
|
20
|
+
if (inputId) {
|
|
21
|
+
checkboxInput.setAttribute('id', inputId);
|
|
22
|
+
}
|
|
23
|
+
if (name) {
|
|
24
|
+
checkboxInput.setAttribute('name', name);
|
|
25
|
+
}
|
|
26
|
+
if (onChange) {
|
|
27
|
+
checkboxInput.addEventListener('change', onChange);
|
|
28
|
+
}
|
|
29
|
+
checkboxControlWrapper.appendChild(checkboxInput);
|
|
30
|
+
checkboxControlWrapper.appendChild(GidsIconDom({
|
|
31
|
+
size: 'sm',
|
|
32
|
+
name: 'checkmark',
|
|
33
|
+
alt: '',
|
|
34
|
+
className: 'gids-checkbox-control__check',
|
|
35
|
+
}));
|
|
36
|
+
checkboxControlWrapper.appendChild(GidsIconDom({
|
|
37
|
+
size: 'sm',
|
|
38
|
+
name: 'minus',
|
|
39
|
+
alt: '',
|
|
40
|
+
className: 'gids-checkbox-control__minus',
|
|
41
|
+
}));
|
|
42
|
+
return checkboxControlWrapper;
|
|
43
|
+
};
|
|
44
|
+
//# sourceMappingURL=GidsCheckboxControl.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"GidsCheckboxControl.js","sourceRoot":"","sources":["../../../src/components/_GidsCheckboxControl/GidsCheckboxControl.ts"],"names":[],"mappings":"AAAA,OAAO,EAGN,2BAA2B,GAC3B,MAAM,8BAA8B,CAAC;AACtC,OAAO,EAAE,uBAAuB,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAChF,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAEnD,MAAM,EAAE,gCAAgC,EAAE,GAAG,2BAA2B,CAAC;AAQzE,MAAM,CAAC,MAAM,sBAAsB,GAAG,CAAC,EACtC,OAAO,EACP,cAAc,EACd,QAAQ,EACR,OAAO,EACP,aAAa,EACb,IAAI,EACJ,KAAK,EACL,QAAQ,EACR,QAAQ,EACR,SAAS,GACoB,EAAmB,EAAE;IAClD,MAAM,sBAAsB,GAAG,QAAQ,CAAC,aAAa,CAAC,MAAM,CAAC,CAAC;IAC9D,sBAAsB,CAAC,SAAS;QAC/B,gCAAgC,CAAC,SAAS,CAAC,CAAC;IAE7C,MAAM,aAAa,GAAG,QAAQ,CAAC,aAAa,CAAC,OAAO,CAAC,CAAC;IACtD,aAAa,CAAC,SAAS,GAAG,8BAA8B,CAAC;IACzD,aAAa,CAAC,YAAY,CAAC,MAAM,EAAE,UAAU,CAAC,CAAC;IAE/C,eAAe,CAAC,aAAa,EAAE,UAAU,EAAE,QAAQ,IAAI,KAAK,CAAC,CAAC;IAC9D,eAAe,CAAC,aAAa,EAAE,UAAU,EAAE,QAAQ,IAAI,KAAK,CAAC,CAAC;IAE9D,uBAAuB,CAAC,aAAa,EAAE;QACtC,OAAO;QACP,cAAc;QACd,KAAK;KACL,CAAC,CAAC;IAEH,aAAa,CAAC,aAAa,GAAG,aAAa,IAAI,KAAK,CAAC;IAErD,IAAI,OAAO,EAAE,CAAC;QACb,aAAa,CAAC,YAAY,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;IAC3C,CAAC;IACD,IAAI,IAAI,EAAE,CAAC;QACV,aAAa,CAAC,YAAY,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;IAC1C,CAAC;IAED,IAAI,QAAQ,EAAE,CAAC;QACd,aAAa,CAAC,gBAAgB,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC;IACpD,CAAC;IAED,sBAAsB,CAAC,WAAW,CAAC,aAAa,CAAC,CAAC;IAElD,sBAAsB,CAAC,WAAW,CACjC,WAAW,CAAC;QACX,IAAI,EAAE,IAAI;QACV,IAAI,EAAE,WAAW;QACjB,GAAG,EAAE,EAAE;QACP,SAAS,EAAE,8BAA8B;KACzC,CAAC,CACF,CAAC;IAEF,sBAAsB,CAAC,WAAW,CACjC,WAAW,CAAC;QACX,IAAI,EAAE,IAAI;QACV,IAAI,EAAE,OAAO;QACb,GAAG,EAAE,EAAE;QACP,SAAS,EAAE,8BAA8B;KACzC,CAAC,CACF,CAAC;IAEF,OAAO,sBAAsB,CAAC;AAC/B,CAAC,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { type ClassValue, type GidsRadioControlWebProps } from '@ganpatiinfo/gids-web-shared';
|
|
2
|
+
export interface GidsRadioControlDomProps extends GidsRadioControlWebProps {
|
|
3
|
+
onChange?: (this: HTMLInputElement, event: Event) => void;
|
|
4
|
+
className?: ClassValue;
|
|
5
|
+
}
|
|
6
|
+
export declare const GidsRadioControlDom: ({ checked, defaultChecked, disabled, inputId, name, value, onChange, className, }: GidsRadioControlDomProps) => HTMLSpanElement;
|
|
7
|
+
//# sourceMappingURL=GidsRadioControl.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"GidsRadioControl.d.ts","sourceRoot":"","sources":["../../../src/components/_GidsRadioControl/GidsRadioControl.ts"],"names":[],"mappings":"AAAA,OAAO,EACN,KAAK,UAAU,EACf,KAAK,wBAAwB,EAE7B,MAAM,8BAA8B,CAAC;AAKtC,MAAM,WAAW,wBAAyB,SAAQ,wBAAwB;IACzE,QAAQ,CAAC,EAAE,CAAC,IAAI,EAAE,gBAAgB,EAAE,KAAK,EAAE,KAAK,KAAK,IAAI,CAAC;IAC1D,SAAS,CAAC,EAAE,UAAU,CAAC;CACvB;AAED,eAAO,MAAM,mBAAmB,GAAI,mFASjC,wBAAwB,KAAG,eAkC7B,CAAC"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { GidsRadioControlWebUtils, } from '@ganpatiinfo/gids-web-shared';
|
|
2
|
+
import { applyStatefulInputProps, toggleAttribute } from '../../utils/domUtils';
|
|
3
|
+
const { getGidsRadioControlClassNames } = GidsRadioControlWebUtils;
|
|
4
|
+
export const GidsRadioControlDom = ({ checked, defaultChecked, disabled, inputId, name, value, onChange, className, }) => {
|
|
5
|
+
const checkedDot = document.createElement('span');
|
|
6
|
+
checkedDot.className = 'gids-radio-control__check';
|
|
7
|
+
const radioControlWrapper = document.createElement('span');
|
|
8
|
+
radioControlWrapper.className = getGidsRadioControlClassNames(className);
|
|
9
|
+
const radioControlInput = document.createElement('input');
|
|
10
|
+
radioControlInput.className = 'gids-radio-control__input';
|
|
11
|
+
radioControlInput.setAttribute('type', 'radio');
|
|
12
|
+
toggleAttribute(radioControlInput, 'disabled', disabled ?? false);
|
|
13
|
+
applyStatefulInputProps(radioControlInput, {
|
|
14
|
+
checked,
|
|
15
|
+
defaultChecked,
|
|
16
|
+
value,
|
|
17
|
+
});
|
|
18
|
+
if (inputId) {
|
|
19
|
+
radioControlInput.setAttribute('id', inputId);
|
|
20
|
+
}
|
|
21
|
+
if (name) {
|
|
22
|
+
radioControlInput.setAttribute('name', name);
|
|
23
|
+
}
|
|
24
|
+
if (onChange) {
|
|
25
|
+
radioControlInput.addEventListener('click', onChange);
|
|
26
|
+
}
|
|
27
|
+
radioControlWrapper.appendChild(radioControlInput);
|
|
28
|
+
radioControlWrapper.appendChild(checkedDot);
|
|
29
|
+
return radioControlWrapper;
|
|
30
|
+
};
|
|
31
|
+
//# sourceMappingURL=GidsRadioControl.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"GidsRadioControl.js","sourceRoot":"","sources":["../../../src/components/_GidsRadioControl/GidsRadioControl.ts"],"names":[],"mappings":"AAAA,OAAO,EAGN,wBAAwB,GACxB,MAAM,8BAA8B,CAAC;AACtC,OAAO,EAAE,uBAAuB,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAEhF,MAAM,EAAE,6BAA6B,EAAE,GAAG,wBAAwB,CAAC;AAOnE,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC,EACnC,OAAO,EACP,cAAc,EACd,QAAQ,EACR,OAAO,EACP,IAAI,EACJ,KAAK,EACL,QAAQ,EACR,SAAS,GACiB,EAAmB,EAAE;IAC/C,MAAM,UAAU,GAAG,QAAQ,CAAC,aAAa,CAAC,MAAM,CAAC,CAAC;IAClD,UAAU,CAAC,SAAS,GAAG,2BAA2B,CAAC;IAEnD,MAAM,mBAAmB,GAAG,QAAQ,CAAC,aAAa,CAAC,MAAM,CAAC,CAAC;IAC3D,mBAAmB,CAAC,SAAS,GAAG,6BAA6B,CAAC,SAAS,CAAC,CAAC;IAEzE,MAAM,iBAAiB,GAAG,QAAQ,CAAC,aAAa,CAAC,OAAO,CAAC,CAAC;IAC1D,iBAAiB,CAAC,SAAS,GAAG,2BAA2B,CAAC;IAC1D,iBAAiB,CAAC,YAAY,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAEhD,eAAe,CAAC,iBAAiB,EAAE,UAAU,EAAE,QAAQ,IAAI,KAAK,CAAC,CAAC;IAElE,uBAAuB,CAAC,iBAAiB,EAAE;QAC1C,OAAO;QACP,cAAc;QACd,KAAK;KACL,CAAC,CAAC;IAEH,IAAI,OAAO,EAAE,CAAC;QACb,iBAAiB,CAAC,YAAY,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;IAC/C,CAAC;IACD,IAAI,IAAI,EAAE,CAAC;QACV,iBAAiB,CAAC,YAAY,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;IAC9C,CAAC;IAED,IAAI,QAAQ,EAAE,CAAC;QACd,iBAAiB,CAAC,gBAAgB,CAAC,OAAO,EAAE,QAAQ,CAAC,CAAC;IACvD,CAAC;IAED,mBAAmB,CAAC,WAAW,CAAC,iBAAiB,CAAC,CAAC;IACnD,mBAAmB,CAAC,WAAW,CAAC,UAAU,CAAC,CAAC;IAE5C,OAAO,mBAAmB,CAAC;AAC5B,CAAC,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { type ClassValue, type GidsSwitchControlWebProps } from '@ganpatiinfo/gids-web-shared';
|
|
2
|
+
export interface GidsSwitchControlDomProps extends GidsSwitchControlWebProps {
|
|
3
|
+
onChange?: (this: HTMLInputElement, event: Event) => void;
|
|
4
|
+
className?: ClassValue;
|
|
5
|
+
}
|
|
6
|
+
export declare const GidsSwitchControlDom: ({ checked, defaultChecked, disabled, inputId, name, value, onChange, className, }: GidsSwitchControlDomProps) => HTMLSpanElement;
|
|
7
|
+
//# sourceMappingURL=GidsSwitchControl.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"GidsSwitchControl.d.ts","sourceRoot":"","sources":["../../../src/components/_GidsSwitchControl/GidsSwitchControl.ts"],"names":[],"mappings":"AAAA,OAAO,EACN,KAAK,UAAU,EACf,KAAK,yBAAyB,EAE9B,MAAM,8BAA8B,CAAC;AAMtC,MAAM,WAAW,yBAA0B,SAAQ,yBAAyB;IAC3E,QAAQ,CAAC,EAAE,CAAC,IAAI,EAAE,gBAAgB,EAAE,KAAK,EAAE,KAAK,KAAK,IAAI,CAAC;IAC1D,SAAS,CAAC,EAAE,UAAU,CAAC;CACvB;AAED,eAAO,MAAM,oBAAoB,GAAI,mFASlC,yBAAyB,KAAG,eAqD9B,CAAC"}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { GidsSwitchControlWebUtils, } from '@ganpatiinfo/gids-web-shared';
|
|
2
|
+
import { applyStatefulInputProps, toggleAttribute } from '../../utils/domUtils';
|
|
3
|
+
import { GidsIconDom } from '../GidsIcon/GidsIcon';
|
|
4
|
+
const { getGidsSwitchControlClassNames } = GidsSwitchControlWebUtils;
|
|
5
|
+
export const GidsSwitchControlDom = ({ checked, defaultChecked, disabled, inputId, name, value, onChange, className, }) => {
|
|
6
|
+
const switchControlWrapper = document.createElement('span');
|
|
7
|
+
switchControlWrapper.className = getGidsSwitchControlClassNames(className);
|
|
8
|
+
const switchControlInput = document.createElement('input');
|
|
9
|
+
switchControlInput.className = 'gids-switch-control__input';
|
|
10
|
+
switchControlInput.setAttribute('type', 'checkbox');
|
|
11
|
+
switchControlInput.setAttribute('role', 'switch');
|
|
12
|
+
toggleAttribute(switchControlInput, 'disabled', disabled ?? false);
|
|
13
|
+
applyStatefulInputProps(switchControlInput, {
|
|
14
|
+
checked,
|
|
15
|
+
defaultChecked,
|
|
16
|
+
value,
|
|
17
|
+
});
|
|
18
|
+
if (inputId) {
|
|
19
|
+
switchControlInput.id = inputId;
|
|
20
|
+
}
|
|
21
|
+
if (name) {
|
|
22
|
+
switchControlInput.name = name;
|
|
23
|
+
}
|
|
24
|
+
if (onChange) {
|
|
25
|
+
switchControlInput.addEventListener('change', onChange);
|
|
26
|
+
}
|
|
27
|
+
switchControlWrapper.appendChild(switchControlInput);
|
|
28
|
+
switchControlWrapper.appendChild(GidsIconDom({
|
|
29
|
+
size: 'sm',
|
|
30
|
+
name: 'checkmark',
|
|
31
|
+
alt: '',
|
|
32
|
+
className: 'gids-switch-control__check',
|
|
33
|
+
}));
|
|
34
|
+
switchControlWrapper.appendChild(GidsIconDom({
|
|
35
|
+
size: 'sm',
|
|
36
|
+
name: 'cross',
|
|
37
|
+
alt: '',
|
|
38
|
+
className: 'gids-switch-control__cross',
|
|
39
|
+
}));
|
|
40
|
+
const slider = document.createElement('span');
|
|
41
|
+
slider.className = 'gids-switch-control__slider';
|
|
42
|
+
switchControlWrapper.appendChild(slider);
|
|
43
|
+
return switchControlWrapper;
|
|
44
|
+
};
|
|
45
|
+
//# sourceMappingURL=GidsSwitchControl.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"GidsSwitchControl.js","sourceRoot":"","sources":["../../../src/components/_GidsSwitchControl/GidsSwitchControl.ts"],"names":[],"mappings":"AAAA,OAAO,EAGN,yBAAyB,GACzB,MAAM,8BAA8B,CAAC;AACtC,OAAO,EAAE,uBAAuB,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAChF,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAEnD,MAAM,EAAE,8BAA8B,EAAE,GAAG,yBAAyB,CAAC;AAOrE,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,EACpC,OAAO,EACP,cAAc,EACd,QAAQ,EACR,OAAO,EACP,IAAI,EACJ,KAAK,EACL,QAAQ,EACR,SAAS,GACkB,EAAmB,EAAE;IAChD,MAAM,oBAAoB,GAAG,QAAQ,CAAC,aAAa,CAAC,MAAM,CAAC,CAAC;IAC5D,oBAAoB,CAAC,SAAS,GAAG,8BAA8B,CAAC,SAAS,CAAC,CAAC;IAE3E,MAAM,kBAAkB,GAAG,QAAQ,CAAC,aAAa,CAAC,OAAO,CAAC,CAAC;IAC3D,kBAAkB,CAAC,SAAS,GAAG,4BAA4B,CAAC;IAC5D,kBAAkB,CAAC,YAAY,CAAC,MAAM,EAAE,UAAU,CAAC,CAAC;IACpD,kBAAkB,CAAC,YAAY,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC;IAElD,eAAe,CAAC,kBAAkB,EAAE,UAAU,EAAE,QAAQ,IAAI,KAAK,CAAC,CAAC;IAEnE,uBAAuB,CAAC,kBAAkB,EAAE;QAC3C,OAAO;QACP,cAAc;QACd,KAAK;KACL,CAAC,CAAC;IAEH,IAAI,OAAO,EAAE,CAAC;QACb,kBAAkB,CAAC,EAAE,GAAG,OAAO,CAAC;IACjC,CAAC;IACD,IAAI,IAAI,EAAE,CAAC;QACV,kBAAkB,CAAC,IAAI,GAAG,IAAI,CAAC;IAChC,CAAC;IAED,IAAI,QAAQ,EAAE,CAAC;QACd,kBAAkB,CAAC,gBAAgB,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC;IACzD,CAAC;IAED,oBAAoB,CAAC,WAAW,CAAC,kBAAkB,CAAC,CAAC;IAErD,oBAAoB,CAAC,WAAW,CAC/B,WAAW,CAAC;QACX,IAAI,EAAE,IAAI;QACV,IAAI,EAAE,WAAW;QACjB,GAAG,EAAE,EAAE;QACP,SAAS,EAAE,4BAA4B;KACvC,CAAC,CACF,CAAC;IAEF,oBAAoB,CAAC,WAAW,CAC/B,WAAW,CAAC;QACX,IAAI,EAAE,IAAI;QACV,IAAI,EAAE,OAAO;QACb,GAAG,EAAE,EAAE;QACP,SAAS,EAAE,4BAA4B;KACvC,CAAC,CACF,CAAC;IAEF,MAAM,MAAM,GAAG,QAAQ,CAAC,aAAa,CAAC,MAAM,CAAC,CAAC;IAC9C,MAAM,CAAC,SAAS,GAAG,6BAA6B,CAAC;IACjD,oBAAoB,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC;IAEzC,OAAO,oBAAoB,CAAC;AAC7B,CAAC,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,13 +1,22 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Referenced to DOM components
|
|
3
3
|
*/
|
|
4
|
+
export * from './components/GidsButton/GidsButton';
|
|
4
5
|
export * from './components/GidsDivider/GidsDivider';
|
|
5
6
|
export * from './components/GidsDisplayTag/GidsDisplayTag';
|
|
7
|
+
export * from './components/GidsIcon/GidsIcon';
|
|
8
|
+
export * from './components/GidsLabel/GidsLabelInfo/GidsLabelInfo';
|
|
9
|
+
export * from './components/GidsLabel/GidsLabel';
|
|
10
|
+
export * from './components/GidsLink/GidsLink';
|
|
6
11
|
export * from './components/_GidsSpinnerControl/GidsSpinnerControl';
|
|
7
12
|
export * from './components/GidsSpinner/GidsSpinner';
|
|
8
|
-
export * from './components/GidsIcon/GidsIcon';
|
|
9
|
-
export * from './components/GidsButton/GidsButton';
|
|
10
13
|
export * from './components/GidsToggleButton/GidsToggleButton';
|
|
14
|
+
export * from './components/_GidsCheckboxControl/GidsCheckboxControl';
|
|
15
|
+
export * from './components/_GidsRadioControl/GidsRadioControl';
|
|
16
|
+
export * from './components/_GidsSwitchControl/GidsSwitchControl';
|
|
17
|
+
export * from './components/GidsCheckbox/GidsCheckbox';
|
|
18
|
+
export * from './components/GidsRadio/GidsRadio';
|
|
19
|
+
export * from './components/GidsSwitch/GidsSwitch';
|
|
11
20
|
/**
|
|
12
21
|
* Utilities
|
|
13
22
|
*/
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,cAAc,sCAAsC,CAAC;AACrD,cAAc,4CAA4C,CAAC;AAC3D,cAAc,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,cAAc,oCAAoC,CAAC;AACnD,cAAc,sCAAsC,CAAC;AACrD,cAAc,4CAA4C,CAAC;AAC3D,cAAc,gCAAgC,CAAC;AAC/C,cAAc,oDAAoD,CAAC;AACnE,cAAc,kCAAkC,CAAC;AACjD,cAAc,gCAAgC,CAAC;AAC/C,cAAc,qDAAqD,CAAC;AACpE,cAAc,sCAAsC,CAAC;AACrD,cAAc,gDAAgD,CAAC;AAC/D,cAAc,uDAAuD,CAAC;AACtE,cAAc,iDAAiD,CAAC;AAChE,cAAc,mDAAmD,CAAC;AAClE,cAAc,wCAAwC,CAAC;AACvD,cAAc,kCAAkC,CAAC;AACjD,cAAc,oCAAoC,CAAC;AAEnD;;GAEG;AACH,cAAc,kBAAkB,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -1,13 +1,22 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Referenced to DOM components
|
|
3
3
|
*/
|
|
4
|
+
export * from './components/GidsButton/GidsButton';
|
|
4
5
|
export * from './components/GidsDivider/GidsDivider';
|
|
5
6
|
export * from './components/GidsDisplayTag/GidsDisplayTag';
|
|
7
|
+
export * from './components/GidsIcon/GidsIcon';
|
|
8
|
+
export * from './components/GidsLabel/GidsLabelInfo/GidsLabelInfo';
|
|
9
|
+
export * from './components/GidsLabel/GidsLabel';
|
|
10
|
+
export * from './components/GidsLink/GidsLink';
|
|
6
11
|
export * from './components/_GidsSpinnerControl/GidsSpinnerControl';
|
|
7
12
|
export * from './components/GidsSpinner/GidsSpinner';
|
|
8
|
-
export * from './components/GidsIcon/GidsIcon';
|
|
9
|
-
export * from './components/GidsButton/GidsButton';
|
|
10
13
|
export * from './components/GidsToggleButton/GidsToggleButton';
|
|
14
|
+
export * from './components/_GidsCheckboxControl/GidsCheckboxControl';
|
|
15
|
+
export * from './components/_GidsRadioControl/GidsRadioControl';
|
|
16
|
+
export * from './components/_GidsSwitchControl/GidsSwitchControl';
|
|
17
|
+
export * from './components/GidsCheckbox/GidsCheckbox';
|
|
18
|
+
export * from './components/GidsRadio/GidsRadio';
|
|
19
|
+
export * from './components/GidsSwitch/GidsSwitch';
|
|
11
20
|
/**
|
|
12
21
|
* Utilities
|
|
13
22
|
*/
|
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,sCAAsC,CAAC;AACrD,cAAc,4CAA4C,CAAC;AAC3D,cAAc,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,cAAc,oCAAoC,CAAC;AACnD,cAAc,sCAAsC,CAAC;AACrD,cAAc,4CAA4C,CAAC;AAC3D,cAAc,gCAAgC,CAAC;AAC/C,cAAc,oDAAoD,CAAC;AACnE,cAAc,kCAAkC,CAAC;AACjD,cAAc,gCAAgC,CAAC;AAC/C,cAAc,qDAAqD,CAAC;AACpE,cAAc,sCAAsC,CAAC;AACrD,cAAc,gDAAgD,CAAC;AAC/D,cAAc,uDAAuD,CAAC;AACtE,cAAc,iDAAiD,CAAC;AAChE,cAAc,mDAAmD,CAAC;AAClE,cAAc,wCAAwC,CAAC;AACvD,cAAc,kCAAkC,CAAC;AACjD,cAAc,oCAAoC,CAAC;AAEnD;;GAEG;AACH,cAAc,kBAAkB,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ganpatiinfo/gids-web-dom-reference",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.3",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "DOM for components reference implementations",
|
|
6
6
|
"homepage": "https://ganpatiinfosystem.vercel.app/",
|
|
@@ -24,11 +24,11 @@
|
|
|
24
24
|
"directory": "packages/private/web-dom-reference"
|
|
25
25
|
},
|
|
26
26
|
"dependencies": {
|
|
27
|
-
"@ganpatiinfo/gids-core-shared": "2.0.
|
|
28
|
-
"@ganpatiinfo/gids-web-shared": "2.0.
|
|
27
|
+
"@ganpatiinfo/gids-core-shared": "2.0.3",
|
|
28
|
+
"@ganpatiinfo/gids-web-shared": "2.0.3"
|
|
29
29
|
},
|
|
30
30
|
"peerDependencies": {
|
|
31
|
-
"@ganpatiinfo/gids-web-theme-interface": "2.0.
|
|
31
|
+
"@ganpatiinfo/gids-web-theme-interface": "2.0.3",
|
|
32
32
|
"@jest/globals": "29.7.0",
|
|
33
33
|
"@types/jasmine": "5.1.7",
|
|
34
34
|
"expect": "29.7.0"
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import {
|
|
2
|
+
type ClassValue,
|
|
3
|
+
generateId,
|
|
4
|
+
type GidsCheckboxWebProps,
|
|
5
|
+
GidsCheckboxWebUtils,
|
|
6
|
+
} from '@ganpatiinfo/gids-web-shared';
|
|
7
|
+
import { GidsCheckboxControlDom } from '../_GidsCheckboxControl/GidsCheckboxControl';
|
|
8
|
+
import { GidsLabelDom } from '../GidsLabel/GidsLabel';
|
|
9
|
+
|
|
10
|
+
const { getGidsCheckboxClassNames } = GidsCheckboxWebUtils;
|
|
11
|
+
|
|
12
|
+
export interface GidsCheckboxDomProps
|
|
13
|
+
extends GidsCheckboxWebProps<
|
|
14
|
+
Element | Element[] | string | string[],
|
|
15
|
+
Element
|
|
16
|
+
> {
|
|
17
|
+
onChange?: (this: HTMLInputElement, event: Event) => void;
|
|
18
|
+
className?: ClassValue;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export const GidsCheckboxDom = ({
|
|
22
|
+
// Label props
|
|
23
|
+
children,
|
|
24
|
+
fieldRequirement,
|
|
25
|
+
fieldRequirementOptionalText,
|
|
26
|
+
fieldRequirementRequiredText,
|
|
27
|
+
info,
|
|
28
|
+
labelId,
|
|
29
|
+
|
|
30
|
+
// Checkbox props
|
|
31
|
+
checked,
|
|
32
|
+
defaultChecked,
|
|
33
|
+
disabled,
|
|
34
|
+
indeterminate,
|
|
35
|
+
required,
|
|
36
|
+
inputId,
|
|
37
|
+
name,
|
|
38
|
+
value,
|
|
39
|
+
onChange,
|
|
40
|
+
|
|
41
|
+
// CheckboxWithLabel props
|
|
42
|
+
className,
|
|
43
|
+
}: GidsCheckboxDomProps): HTMLDivElement => {
|
|
44
|
+
const checkboxWithLabel = document.createElement('div');
|
|
45
|
+
checkboxWithLabel.className = getGidsCheckboxClassNames(className);
|
|
46
|
+
|
|
47
|
+
const realInputId = inputId ?? generateId();
|
|
48
|
+
|
|
49
|
+
checkboxWithLabel.appendChild(
|
|
50
|
+
GidsCheckboxControlDom({
|
|
51
|
+
checked,
|
|
52
|
+
defaultChecked,
|
|
53
|
+
disabled,
|
|
54
|
+
indeterminate,
|
|
55
|
+
inputId: realInputId,
|
|
56
|
+
name,
|
|
57
|
+
value,
|
|
58
|
+
required,
|
|
59
|
+
onChange,
|
|
60
|
+
}),
|
|
61
|
+
);
|
|
62
|
+
checkboxWithLabel.appendChild(
|
|
63
|
+
GidsLabelDom({
|
|
64
|
+
children,
|
|
65
|
+
disabled,
|
|
66
|
+
fieldRequirement,
|
|
67
|
+
fieldRequirementOptionalText,
|
|
68
|
+
fieldRequirementRequiredText,
|
|
69
|
+
htmlFor: realInputId,
|
|
70
|
+
info,
|
|
71
|
+
labelId,
|
|
72
|
+
}),
|
|
73
|
+
);
|
|
74
|
+
|
|
75
|
+
return checkboxWithLabel;
|
|
76
|
+
};
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import {
|
|
2
|
+
GidsLabelWebUtils,
|
|
3
|
+
type GidsLabelWebProps,
|
|
4
|
+
} from '@ganpatiinfo/gids-web-shared';
|
|
5
|
+
import {
|
|
6
|
+
appendAsChildren,
|
|
7
|
+
type DomChildren,
|
|
8
|
+
type DomNodeOrString,
|
|
9
|
+
} from '../../utils/domUtils';
|
|
10
|
+
import { GidsLabelCommonUtils } from '@ganpatiinfo/gids-core-shared';
|
|
11
|
+
|
|
12
|
+
const { getIndicatorText } = GidsLabelCommonUtils;
|
|
13
|
+
const { getGidsLabelClassNames } = GidsLabelWebUtils;
|
|
14
|
+
|
|
15
|
+
export interface GidsLabelDomProps
|
|
16
|
+
extends GidsLabelWebProps<DomChildren, DomNodeOrString> {}
|
|
17
|
+
|
|
18
|
+
export const GidsLabelDom = ({
|
|
19
|
+
children,
|
|
20
|
+
disabled,
|
|
21
|
+
fieldRequirement,
|
|
22
|
+
fieldRequirementOptionalText,
|
|
23
|
+
fieldRequirementRequiredText,
|
|
24
|
+
info,
|
|
25
|
+
htmlFor,
|
|
26
|
+
labelId,
|
|
27
|
+
}: GidsLabelDomProps): HTMLDivElement => {
|
|
28
|
+
const container = document.createElement('div');
|
|
29
|
+
container.className = getGidsLabelClassNames({ disabled });
|
|
30
|
+
|
|
31
|
+
const label = document.createElement('label');
|
|
32
|
+
if (htmlFor !== undefined) {
|
|
33
|
+
label.setAttribute('for', htmlFor);
|
|
34
|
+
}
|
|
35
|
+
if (labelId !== undefined) {
|
|
36
|
+
label.id = labelId;
|
|
37
|
+
}
|
|
38
|
+
appendAsChildren(label, children);
|
|
39
|
+
|
|
40
|
+
const indicatorText = getIndicatorText({
|
|
41
|
+
fieldRequirement,
|
|
42
|
+
fieldRequirementOptionalText,
|
|
43
|
+
fieldRequirementRequiredText,
|
|
44
|
+
});
|
|
45
|
+
if (indicatorText !== undefined) {
|
|
46
|
+
const fieldRequirementSpan = document.createElement('span');
|
|
47
|
+
fieldRequirementSpan.className = 'gids-label__field-requirement';
|
|
48
|
+
fieldRequirementSpan.textContent = indicatorText;
|
|
49
|
+
label.appendChild(fieldRequirementSpan);
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
container.appendChild(label);
|
|
53
|
+
if (info) {
|
|
54
|
+
container.append(info);
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
return container;
|
|
58
|
+
};
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { type GidsLabelInfoCommonProps } from '@ganpatiinfo/gids-core-shared';
|
|
2
|
+
import { type ClassValue } from '@ganpatiinfo/gids-web-shared';
|
|
3
|
+
import { GidsLabelInfoWebUtils } from '@ganpatiinfo/gids-web-shared';
|
|
4
|
+
import { toggleAttribute } from '../../../utils/domUtils';
|
|
5
|
+
import { GidsLabelInfoCommonUtils } from '@ganpatiinfo/gids-core-shared';
|
|
6
|
+
import { GidsIconDom } from '../../GidsIcon/GidsIcon';
|
|
7
|
+
|
|
8
|
+
const { getGidsLabelInfoClassNames } = GidsLabelInfoWebUtils;
|
|
9
|
+
const { getLabelInfoAltText } = GidsLabelInfoCommonUtils;
|
|
10
|
+
|
|
11
|
+
export interface GidsLabelInfoDomProps extends GidsLabelInfoCommonProps {
|
|
12
|
+
onClick?: (event: MouseEvent) => void;
|
|
13
|
+
className?: ClassValue;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export const GidsLabelInfoDom = ({
|
|
17
|
+
disabled,
|
|
18
|
+
alt,
|
|
19
|
+
onClick,
|
|
20
|
+
className,
|
|
21
|
+
}: GidsLabelInfoDomProps): HTMLButtonElement => {
|
|
22
|
+
const labelInfo = document.createElement('button');
|
|
23
|
+
labelInfo.className = getGidsLabelInfoClassNames(className);
|
|
24
|
+
labelInfo.setAttribute('type', 'button');
|
|
25
|
+
|
|
26
|
+
if (onClick) {
|
|
27
|
+
labelInfo.addEventListener('click', onClick);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
if (disabled) {
|
|
31
|
+
toggleAttribute(labelInfo, 'disabled', true);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
const labelSpan = document.createElement('span');
|
|
35
|
+
labelSpan.className = 'gids-visually-hidden';
|
|
36
|
+
labelSpan.textContent = getLabelInfoAltText({ alt });
|
|
37
|
+
|
|
38
|
+
labelInfo.appendChild(labelSpan);
|
|
39
|
+
labelInfo.appendChild(
|
|
40
|
+
GidsIconDom({ name: 'information', size: 'sm', alt: '' }),
|
|
41
|
+
);
|
|
42
|
+
|
|
43
|
+
return labelInfo;
|
|
44
|
+
};
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { type GidsLinkCommonProps } from '@ganpatiinfo/gids-core-shared';
|
|
2
|
+
import { appendAsChildren, type DomChildren } from '../../utils/domUtils';
|
|
3
|
+
import {
|
|
4
|
+
type ClassValue,
|
|
5
|
+
GidsLinkWebUtils,
|
|
6
|
+
} from '@ganpatiinfo/gids-web-shared';
|
|
7
|
+
|
|
8
|
+
const { getGidsLinkClassNames } = GidsLinkWebUtils;
|
|
9
|
+
|
|
10
|
+
export interface GidsLinkDomProps extends GidsLinkCommonProps<DomChildren> {
|
|
11
|
+
extraClasses?: ClassValue;
|
|
12
|
+
href?: string;
|
|
13
|
+
onClick?: (this: HTMLInputElement, event: Event) => void;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export const GidsLinkDom = ({
|
|
17
|
+
children,
|
|
18
|
+
size,
|
|
19
|
+
extraClasses,
|
|
20
|
+
href,
|
|
21
|
+
onClick,
|
|
22
|
+
}: GidsLinkDomProps): HTMLAnchorElement => {
|
|
23
|
+
const linkElement = document.createElement('a');
|
|
24
|
+
linkElement.className = getGidsLinkClassNames({ size }, extraClasses);
|
|
25
|
+
|
|
26
|
+
appendAsChildren(linkElement, children);
|
|
27
|
+
|
|
28
|
+
if (href) {
|
|
29
|
+
linkElement.setAttribute('href', href);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
if (onClick) {
|
|
33
|
+
linkElement.addEventListener('click', onClick);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
return linkElement;
|
|
37
|
+
};
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import {
|
|
2
|
+
type ClassValue,
|
|
3
|
+
generateId,
|
|
4
|
+
type GidsRadioWebProps,
|
|
5
|
+
GidsRadioWebUtils,
|
|
6
|
+
} from '@ganpatiinfo/gids-web-shared';
|
|
7
|
+
import { GidsRadioControlDom } from '../_GidsRadioControl/GidsRadioControl';
|
|
8
|
+
import { GidsLabelDom } from '../GidsLabel/GidsLabel';
|
|
9
|
+
import { type DomChildren, type DomNodeOrString } from '../../utils/domUtils';
|
|
10
|
+
|
|
11
|
+
const { getGidsRadioClassNames } = GidsRadioWebUtils;
|
|
12
|
+
|
|
13
|
+
export interface GidsRadioDomProps
|
|
14
|
+
extends GidsRadioWebProps<DomChildren, DomNodeOrString> {
|
|
15
|
+
onChange?: (this: HTMLInputElement, event: Event) => void;
|
|
16
|
+
className?: ClassValue;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export const GidsRadioDom = ({
|
|
20
|
+
// Label props
|
|
21
|
+
children,
|
|
22
|
+
fieldRequirement,
|
|
23
|
+
fieldRequirementOptionalText,
|
|
24
|
+
fieldRequirementRequiredText,
|
|
25
|
+
info,
|
|
26
|
+
labelId,
|
|
27
|
+
|
|
28
|
+
// Radio props
|
|
29
|
+
checked,
|
|
30
|
+
defaultChecked,
|
|
31
|
+
disabled,
|
|
32
|
+
inputId,
|
|
33
|
+
name,
|
|
34
|
+
value,
|
|
35
|
+
onChange,
|
|
36
|
+
|
|
37
|
+
// RadioWithLabel props
|
|
38
|
+
className,
|
|
39
|
+
}: GidsRadioDomProps): HTMLDivElement => {
|
|
40
|
+
const radioWithLabel = document.createElement('div');
|
|
41
|
+
radioWithLabel.className = getGidsRadioClassNames(className);
|
|
42
|
+
|
|
43
|
+
const realInputId = inputId ?? generateId();
|
|
44
|
+
|
|
45
|
+
radioWithLabel.appendChild(
|
|
46
|
+
GidsRadioControlDom({
|
|
47
|
+
checked,
|
|
48
|
+
defaultChecked,
|
|
49
|
+
disabled,
|
|
50
|
+
inputId: realInputId,
|
|
51
|
+
name,
|
|
52
|
+
value,
|
|
53
|
+
onChange,
|
|
54
|
+
}),
|
|
55
|
+
);
|
|
56
|
+
radioWithLabel.appendChild(
|
|
57
|
+
GidsLabelDom({
|
|
58
|
+
children,
|
|
59
|
+
disabled,
|
|
60
|
+
fieldRequirement,
|
|
61
|
+
fieldRequirementOptionalText,
|
|
62
|
+
fieldRequirementRequiredText,
|
|
63
|
+
htmlFor: realInputId,
|
|
64
|
+
info,
|
|
65
|
+
labelId,
|
|
66
|
+
}),
|
|
67
|
+
);
|
|
68
|
+
|
|
69
|
+
return radioWithLabel;
|
|
70
|
+
};
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import {
|
|
2
|
+
type ClassValue,
|
|
3
|
+
generateId,
|
|
4
|
+
type GidsSwitchWebProps,
|
|
5
|
+
GidsSwitchWebUtils,
|
|
6
|
+
} from '@ganpatiinfo/gids-web-shared';
|
|
7
|
+
import { GidsSwitchControlDom } from '../_GidsSwitchControl/GidsSwitchControl';
|
|
8
|
+
import { GidsLabelDom } from '../GidsLabel/GidsLabel';
|
|
9
|
+
import { type DomChildren, type DomNodeOrString } from '../../utils/domUtils';
|
|
10
|
+
|
|
11
|
+
const { getGidsSwitchClassNames } = GidsSwitchWebUtils;
|
|
12
|
+
|
|
13
|
+
export interface GidsSwitchDomProps
|
|
14
|
+
extends GidsSwitchWebProps<DomChildren, DomNodeOrString> {
|
|
15
|
+
onChange?: (this: HTMLInputElement, event: Event) => void;
|
|
16
|
+
className?: ClassValue;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export const GidsSwitchDom = ({
|
|
20
|
+
// Label props
|
|
21
|
+
children,
|
|
22
|
+
fieldRequirement,
|
|
23
|
+
fieldRequirementOptionalText,
|
|
24
|
+
fieldRequirementRequiredText,
|
|
25
|
+
info,
|
|
26
|
+
labelId,
|
|
27
|
+
|
|
28
|
+
// Switch props
|
|
29
|
+
checked,
|
|
30
|
+
defaultChecked,
|
|
31
|
+
disabled,
|
|
32
|
+
inputId,
|
|
33
|
+
name,
|
|
34
|
+
value,
|
|
35
|
+
onChange,
|
|
36
|
+
|
|
37
|
+
// SwitchWithLabel props
|
|
38
|
+
className,
|
|
39
|
+
}: GidsSwitchDomProps): HTMLDivElement => {
|
|
40
|
+
const switchElement = document.createElement('div');
|
|
41
|
+
switchElement.className = getGidsSwitchClassNames(className);
|
|
42
|
+
|
|
43
|
+
const realInputId = inputId ?? generateId();
|
|
44
|
+
|
|
45
|
+
switchElement.appendChild(
|
|
46
|
+
GidsSwitchControlDom({
|
|
47
|
+
checked,
|
|
48
|
+
defaultChecked,
|
|
49
|
+
disabled,
|
|
50
|
+
inputId: realInputId,
|
|
51
|
+
name,
|
|
52
|
+
value,
|
|
53
|
+
onChange,
|
|
54
|
+
}),
|
|
55
|
+
);
|
|
56
|
+
switchElement.appendChild(
|
|
57
|
+
GidsLabelDom({
|
|
58
|
+
children,
|
|
59
|
+
disabled,
|
|
60
|
+
fieldRequirement,
|
|
61
|
+
fieldRequirementOptionalText,
|
|
62
|
+
fieldRequirementRequiredText,
|
|
63
|
+
htmlFor: realInputId,
|
|
64
|
+
info,
|
|
65
|
+
labelId,
|
|
66
|
+
}),
|
|
67
|
+
);
|
|
68
|
+
|
|
69
|
+
return switchElement;
|
|
70
|
+
};
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import {
|
|
2
|
+
type ClassValue,
|
|
3
|
+
type GidsCheckboxControlWebProps,
|
|
4
|
+
GidsCheckboxControlWebUtils,
|
|
5
|
+
} from '@ganpatiinfo/gids-web-shared';
|
|
6
|
+
import { applyStatefulInputProps, toggleAttribute } from '../../utils/domUtils';
|
|
7
|
+
import { GidsIconDom } from '../GidsIcon/GidsIcon';
|
|
8
|
+
|
|
9
|
+
const { getGidsCheckboxControlClassNames } = GidsCheckboxControlWebUtils;
|
|
10
|
+
|
|
11
|
+
export interface GidsCheckboxControlDomProps
|
|
12
|
+
extends GidsCheckboxControlWebProps {
|
|
13
|
+
onChange?: (this: HTMLInputElement, event: Event) => void;
|
|
14
|
+
className?: ClassValue;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export const GidsCheckboxControlDom = ({
|
|
18
|
+
checked,
|
|
19
|
+
defaultChecked,
|
|
20
|
+
disabled,
|
|
21
|
+
inputId,
|
|
22
|
+
indeterminate,
|
|
23
|
+
name,
|
|
24
|
+
value,
|
|
25
|
+
required,
|
|
26
|
+
onChange,
|
|
27
|
+
className,
|
|
28
|
+
}: GidsCheckboxControlDomProps): HTMLSpanElement => {
|
|
29
|
+
const checkboxControlWrapper = document.createElement('span');
|
|
30
|
+
checkboxControlWrapper.className =
|
|
31
|
+
getGidsCheckboxControlClassNames(className);
|
|
32
|
+
|
|
33
|
+
const checkboxInput = document.createElement('input');
|
|
34
|
+
checkboxInput.className = 'gids-checkbox-control__input';
|
|
35
|
+
checkboxInput.setAttribute('type', 'checkbox');
|
|
36
|
+
|
|
37
|
+
toggleAttribute(checkboxInput, 'disabled', disabled ?? false);
|
|
38
|
+
toggleAttribute(checkboxInput, 'required', required ?? false);
|
|
39
|
+
|
|
40
|
+
applyStatefulInputProps(checkboxInput, {
|
|
41
|
+
checked,
|
|
42
|
+
defaultChecked,
|
|
43
|
+
value,
|
|
44
|
+
});
|
|
45
|
+
|
|
46
|
+
checkboxInput.indeterminate = indeterminate ?? false;
|
|
47
|
+
|
|
48
|
+
if (inputId) {
|
|
49
|
+
checkboxInput.setAttribute('id', inputId);
|
|
50
|
+
}
|
|
51
|
+
if (name) {
|
|
52
|
+
checkboxInput.setAttribute('name', name);
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
if (onChange) {
|
|
56
|
+
checkboxInput.addEventListener('change', onChange);
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
checkboxControlWrapper.appendChild(checkboxInput);
|
|
60
|
+
|
|
61
|
+
checkboxControlWrapper.appendChild(
|
|
62
|
+
GidsIconDom({
|
|
63
|
+
size: 'sm',
|
|
64
|
+
name: 'checkmark',
|
|
65
|
+
alt: '',
|
|
66
|
+
className: 'gids-checkbox-control__check',
|
|
67
|
+
}),
|
|
68
|
+
);
|
|
69
|
+
|
|
70
|
+
checkboxControlWrapper.appendChild(
|
|
71
|
+
GidsIconDom({
|
|
72
|
+
size: 'sm',
|
|
73
|
+
name: 'minus',
|
|
74
|
+
alt: '',
|
|
75
|
+
className: 'gids-checkbox-control__minus',
|
|
76
|
+
}),
|
|
77
|
+
);
|
|
78
|
+
|
|
79
|
+
return checkboxControlWrapper;
|
|
80
|
+
};
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import {
|
|
2
|
+
type ClassValue,
|
|
3
|
+
type GidsRadioControlWebProps,
|
|
4
|
+
GidsRadioControlWebUtils,
|
|
5
|
+
} from '@ganpatiinfo/gids-web-shared';
|
|
6
|
+
import { applyStatefulInputProps, toggleAttribute } from '../../utils/domUtils';
|
|
7
|
+
|
|
8
|
+
const { getGidsRadioControlClassNames } = GidsRadioControlWebUtils;
|
|
9
|
+
|
|
10
|
+
export interface GidsRadioControlDomProps extends GidsRadioControlWebProps {
|
|
11
|
+
onChange?: (this: HTMLInputElement, event: Event) => void;
|
|
12
|
+
className?: ClassValue;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export const GidsRadioControlDom = ({
|
|
16
|
+
checked,
|
|
17
|
+
defaultChecked,
|
|
18
|
+
disabled,
|
|
19
|
+
inputId,
|
|
20
|
+
name,
|
|
21
|
+
value,
|
|
22
|
+
onChange,
|
|
23
|
+
className,
|
|
24
|
+
}: GidsRadioControlDomProps): HTMLSpanElement => {
|
|
25
|
+
const checkedDot = document.createElement('span');
|
|
26
|
+
checkedDot.className = 'gids-radio-control__check';
|
|
27
|
+
|
|
28
|
+
const radioControlWrapper = document.createElement('span');
|
|
29
|
+
radioControlWrapper.className = getGidsRadioControlClassNames(className);
|
|
30
|
+
|
|
31
|
+
const radioControlInput = document.createElement('input');
|
|
32
|
+
radioControlInput.className = 'gids-radio-control__input';
|
|
33
|
+
radioControlInput.setAttribute('type', 'radio');
|
|
34
|
+
|
|
35
|
+
toggleAttribute(radioControlInput, 'disabled', disabled ?? false);
|
|
36
|
+
|
|
37
|
+
applyStatefulInputProps(radioControlInput, {
|
|
38
|
+
checked,
|
|
39
|
+
defaultChecked,
|
|
40
|
+
value,
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
if (inputId) {
|
|
44
|
+
radioControlInput.setAttribute('id', inputId);
|
|
45
|
+
}
|
|
46
|
+
if (name) {
|
|
47
|
+
radioControlInput.setAttribute('name', name);
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
if (onChange) {
|
|
51
|
+
radioControlInput.addEventListener('click', onChange);
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
radioControlWrapper.appendChild(radioControlInput);
|
|
55
|
+
radioControlWrapper.appendChild(checkedDot);
|
|
56
|
+
|
|
57
|
+
return radioControlWrapper;
|
|
58
|
+
};
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import {
|
|
2
|
+
type ClassValue,
|
|
3
|
+
type GidsSwitchControlWebProps,
|
|
4
|
+
GidsSwitchControlWebUtils,
|
|
5
|
+
} from '@ganpatiinfo/gids-web-shared';
|
|
6
|
+
import { applyStatefulInputProps, toggleAttribute } from '../../utils/domUtils';
|
|
7
|
+
import { GidsIconDom } from '../GidsIcon/GidsIcon';
|
|
8
|
+
|
|
9
|
+
const { getGidsSwitchControlClassNames } = GidsSwitchControlWebUtils;
|
|
10
|
+
|
|
11
|
+
export interface GidsSwitchControlDomProps extends GidsSwitchControlWebProps {
|
|
12
|
+
onChange?: (this: HTMLInputElement, event: Event) => void;
|
|
13
|
+
className?: ClassValue;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export const GidsSwitchControlDom = ({
|
|
17
|
+
checked,
|
|
18
|
+
defaultChecked,
|
|
19
|
+
disabled,
|
|
20
|
+
inputId,
|
|
21
|
+
name,
|
|
22
|
+
value,
|
|
23
|
+
onChange,
|
|
24
|
+
className,
|
|
25
|
+
}: GidsSwitchControlDomProps): HTMLSpanElement => {
|
|
26
|
+
const switchControlWrapper = document.createElement('span');
|
|
27
|
+
switchControlWrapper.className = getGidsSwitchControlClassNames(className);
|
|
28
|
+
|
|
29
|
+
const switchControlInput = document.createElement('input');
|
|
30
|
+
switchControlInput.className = 'gids-switch-control__input';
|
|
31
|
+
switchControlInput.setAttribute('type', 'checkbox');
|
|
32
|
+
switchControlInput.setAttribute('role', 'switch');
|
|
33
|
+
|
|
34
|
+
toggleAttribute(switchControlInput, 'disabled', disabled ?? false);
|
|
35
|
+
|
|
36
|
+
applyStatefulInputProps(switchControlInput, {
|
|
37
|
+
checked,
|
|
38
|
+
defaultChecked,
|
|
39
|
+
value,
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
if (inputId) {
|
|
43
|
+
switchControlInput.id = inputId;
|
|
44
|
+
}
|
|
45
|
+
if (name) {
|
|
46
|
+
switchControlInput.name = name;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
if (onChange) {
|
|
50
|
+
switchControlInput.addEventListener('change', onChange);
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
switchControlWrapper.appendChild(switchControlInput);
|
|
54
|
+
|
|
55
|
+
switchControlWrapper.appendChild(
|
|
56
|
+
GidsIconDom({
|
|
57
|
+
size: 'sm',
|
|
58
|
+
name: 'checkmark',
|
|
59
|
+
alt: '',
|
|
60
|
+
className: 'gids-switch-control__check',
|
|
61
|
+
}),
|
|
62
|
+
);
|
|
63
|
+
|
|
64
|
+
switchControlWrapper.appendChild(
|
|
65
|
+
GidsIconDom({
|
|
66
|
+
size: 'sm',
|
|
67
|
+
name: 'cross',
|
|
68
|
+
alt: '',
|
|
69
|
+
className: 'gids-switch-control__cross',
|
|
70
|
+
}),
|
|
71
|
+
);
|
|
72
|
+
|
|
73
|
+
const slider = document.createElement('span');
|
|
74
|
+
slider.className = 'gids-switch-control__slider';
|
|
75
|
+
switchControlWrapper.appendChild(slider);
|
|
76
|
+
|
|
77
|
+
return switchControlWrapper;
|
|
78
|
+
};
|
package/src/index.ts
CHANGED
|
@@ -1,13 +1,22 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Referenced to DOM components
|
|
3
3
|
*/
|
|
4
|
+
export * from './components/GidsButton/GidsButton';
|
|
4
5
|
export * from './components/GidsDivider/GidsDivider';
|
|
5
6
|
export * from './components/GidsDisplayTag/GidsDisplayTag';
|
|
7
|
+
export * from './components/GidsIcon/GidsIcon';
|
|
8
|
+
export * from './components/GidsLabel/GidsLabelInfo/GidsLabelInfo';
|
|
9
|
+
export * from './components/GidsLabel/GidsLabel';
|
|
10
|
+
export * from './components/GidsLink/GidsLink';
|
|
6
11
|
export * from './components/_GidsSpinnerControl/GidsSpinnerControl';
|
|
7
12
|
export * from './components/GidsSpinner/GidsSpinner';
|
|
8
|
-
export * from './components/GidsIcon/GidsIcon';
|
|
9
|
-
export * from './components/GidsButton/GidsButton';
|
|
10
13
|
export * from './components/GidsToggleButton/GidsToggleButton';
|
|
14
|
+
export * from './components/_GidsCheckboxControl/GidsCheckboxControl';
|
|
15
|
+
export * from './components/_GidsRadioControl/GidsRadioControl';
|
|
16
|
+
export * from './components/_GidsSwitchControl/GidsSwitchControl';
|
|
17
|
+
export * from './components/GidsCheckbox/GidsCheckbox';
|
|
18
|
+
export * from './components/GidsRadio/GidsRadio';
|
|
19
|
+
export * from './components/GidsSwitch/GidsSwitch';
|
|
11
20
|
|
|
12
21
|
/**
|
|
13
22
|
* Utilities
|