@ganpatiinfo/gids-web-dom-reference 2.0.2 → 2.0.5
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 +24 -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/GidsCheckboxGroup/GidsCheckboxGroup.d.ts +7 -0
- package/dist/components/GidsCheckboxGroup/GidsCheckboxGroup.d.ts.map +1 -0
- package/dist/components/GidsCheckboxGroup/GidsCheckboxGroup.js +10 -0
- package/dist/components/GidsCheckboxGroup/GidsCheckboxGroup.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/GidsRadioGroup/GidsRadioGroup.d.ts +5 -0
- package/dist/components/GidsRadioGroup/GidsRadioGroup.d.ts.map +1 -0
- package/dist/components/GidsRadioGroup/GidsRadioGroup.js +8 -0
- package/dist/components/GidsRadioGroup/GidsRadioGroup.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/GidsSwitchGroup/GidsSwitchGroup.d.ts +5 -0
- package/dist/components/GidsSwitchGroup/GidsSwitchGroup.d.ts.map +1 -0
- package/dist/components/GidsSwitchGroup/GidsSwitchGroup.js +8 -0
- package/dist/components/GidsSwitchGroup/GidsSwitchGroup.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 +14 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +14 -2
- package/dist/index.js.map +1 -1
- package/package.json +4 -4
- package/src/components/GidsCheckbox/GidsCheckbox.ts +76 -0
- package/src/components/GidsCheckboxGroup/GidsCheckboxGroup.ts +21 -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/GidsRadioGroup/GidsRadioGroup.ts +14 -0
- package/src/components/GidsSwitch/GidsSwitch.ts +70 -0
- package/src/components/GidsSwitchGroup/GidsSwitchGroup.ts +14 -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 +14 -2
|
@@ -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,25 @@
|
|
|
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';
|
|
20
|
+
export * from './components/GidsCheckboxGroup/GidsCheckboxGroup';
|
|
21
|
+
export * from './components/GidsRadioGroup/GidsRadioGroup';
|
|
22
|
+
export * from './components/GidsSwitchGroup/GidsSwitchGroup';
|
|
11
23
|
|
|
12
24
|
/**
|
|
13
25
|
* Utilities
|