@infonomic/uikit 6.0.3 → 6.0.4
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/dist/components/forms/checkbox-group.d.ts.map +1 -1
- package/dist/components/forms/checkbox-group.js +2 -1
- package/dist/components/forms/checkbox-group.module.css +16 -0
- package/dist/components/forms/checkbox-group.module.js +6 -0
- package/dist/components/forms/checkbox-group_module.css +10 -0
- package/package.json +1 -1
- package/src/components/forms/checkbox-group.module.css +16 -0
- package/src/components/forms/checkbox-group.stories.tsx +47 -0
- package/src/components/forms/checkbox-group.tsx +2 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"checkbox-group.d.ts","sourceRoot":"","sources":["../../../src/components/forms/checkbox-group.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;
|
|
1
|
+
{"version":3,"file":"checkbox-group.d.ts","sourceRoot":"","sources":["../../../src/components/forms/checkbox-group.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAQ9B,MAAM,WAAW,kBAAkB;IACjC,SAAS,EAAE,MAAM,CAAA;IACjB,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,eAAe,CAAC,EAAE,MAAM,CAAA;IACxB,UAAU,EAAE;QAAE,EAAE,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,EAAE,CAAA;IAC3C,aAAa,CAAC,EAAE,MAAM,EAAE,CAAA;IACxB,eAAe,CAAC,EAAE,MAAM,CAAA;IACxB,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,QAAQ,CAAC,EAAE,CAAC,aAAa,EAAE,MAAM,EAAE,KAAK,IAAI,CAAA;CAC7C;AAED,eAAO,MAAM,aAAa,EAAE,KAAK,CAAC,EAAE,CAAC,kBAAkB,CAgEtD,CAAA"}
|
|
@@ -3,6 +3,7 @@ import { jsx } from "react/jsx-runtime";
|
|
|
3
3
|
import { useEffect, useState } from "react";
|
|
4
4
|
import classnames from "classnames";
|
|
5
5
|
import { Checkbox } from "./checkbox.js";
|
|
6
|
+
import checkbox_group_module from "./checkbox-group.module.js";
|
|
6
7
|
const CheckboxGroup = ({ groupName, className, checkBoxClasses, checkBoxes, defaultValues, controlledValue, disabled = false, onChange })=>{
|
|
7
8
|
let initialValue = [];
|
|
8
9
|
if (void 0 !== controlledValue && controlledValue.length > 0) initialValue = controlledValue.split(',');
|
|
@@ -29,7 +30,7 @@ const CheckboxGroup = ({ groupName, className, checkBoxClasses, checkBoxes, defa
|
|
|
29
30
|
onChange?.(s);
|
|
30
31
|
};
|
|
31
32
|
return /*#__PURE__*/ jsx("div", {
|
|
32
|
-
className: classnames('infonomic-checkbox-group', className),
|
|
33
|
+
className: classnames('infonomic-checkbox-group', checkbox_group_module["checkbox-group"], className),
|
|
33
34
|
children: checkBoxes.map((cb)=>/*#__PURE__*/ jsx(Checkbox, {
|
|
34
35
|
id: `${groupName}-${cb.id}`,
|
|
35
36
|
name: `${groupName}-${cb.id}`,
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
@layer infonomic-base,
|
|
2
|
+
infonomic-functional,
|
|
3
|
+
infonomic-utilities,
|
|
4
|
+
infonomic-theme,
|
|
5
|
+
infonomic-typography,
|
|
6
|
+
infonomic-components;
|
|
7
|
+
|
|
8
|
+
@layer infonomic-components {
|
|
9
|
+
|
|
10
|
+
:global(.infonomic-checkbox-group),
|
|
11
|
+
.checkbox-group {
|
|
12
|
+
display: flex;
|
|
13
|
+
flex-direction: column;
|
|
14
|
+
gap: var(--spacing-8);
|
|
15
|
+
}
|
|
16
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
@layer infonomic-base, infonomic-functional, infonomic-utilities, infonomic-theme, infonomic-typography;
|
|
2
|
+
|
|
3
|
+
@layer infonomic-components {
|
|
4
|
+
:is(.infonomic-checkbox-group, .checkbox-group-Qh9Trn) {
|
|
5
|
+
gap: var(--spacing-8);
|
|
6
|
+
flex-direction: column;
|
|
7
|
+
display: flex;
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
|
package/package.json
CHANGED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
@layer infonomic-base,
|
|
2
|
+
infonomic-functional,
|
|
3
|
+
infonomic-utilities,
|
|
4
|
+
infonomic-theme,
|
|
5
|
+
infonomic-typography,
|
|
6
|
+
infonomic-components;
|
|
7
|
+
|
|
8
|
+
@layer infonomic-components {
|
|
9
|
+
|
|
10
|
+
:global(.infonomic-checkbox-group),
|
|
11
|
+
.checkbox-group {
|
|
12
|
+
display: flex;
|
|
13
|
+
flex-direction: column;
|
|
14
|
+
gap: var(--spacing-8);
|
|
15
|
+
}
|
|
16
|
+
}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
2
|
+
import type React from 'react'
|
|
3
|
+
import { useState } from 'react'
|
|
4
|
+
|
|
5
|
+
import { CheckboxGroup } from './checkbox-group.js'
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
export default {
|
|
9
|
+
title: 'Components/Forms/CheckboxGroup',
|
|
10
|
+
component: CheckboxGroup,
|
|
11
|
+
argTypes: {},
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export const Default = (): React.JSX.Element => {
|
|
15
|
+
const [checked, setChecked] = useState(false)
|
|
16
|
+
|
|
17
|
+
const handleOnClick = (): void => {
|
|
18
|
+
console.log('clicked')
|
|
19
|
+
setChecked(!checked)
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
return (
|
|
23
|
+
<div style={{ maxWidth: '800px', margin: '2rem auto 2rem' }}>
|
|
24
|
+
<h2 className="text-xl" style={{ marginBottom: '1rem' }}>
|
|
25
|
+
Checkbox Group
|
|
26
|
+
</h2>
|
|
27
|
+
<div className="grid gap-4 grid-cols-3">
|
|
28
|
+
<div className="control">
|
|
29
|
+
<CheckboxGroup
|
|
30
|
+
groupName="roles"
|
|
31
|
+
// TODO: Nullability of role.name
|
|
32
|
+
checkBoxes={[
|
|
33
|
+
{ id: 'admin', label: 'Admin' },
|
|
34
|
+
{ id: 'editor', label: 'Editor' },
|
|
35
|
+
{ id: 'viewer', label: 'Viewer' },
|
|
36
|
+
]}
|
|
37
|
+
// onChange={(selected) => {
|
|
38
|
+
// handleOnClick(selected)
|
|
39
|
+
// }}
|
|
40
|
+
/>
|
|
41
|
+
</div>
|
|
42
|
+
</div>
|
|
43
|
+
</div>
|
|
44
|
+
)
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
|
|
@@ -6,6 +6,7 @@ import { useEffect, useState } from 'react'
|
|
|
6
6
|
import cx from 'classnames'
|
|
7
7
|
|
|
8
8
|
import { Checkbox } from './checkbox.js'
|
|
9
|
+
import styles from './checkbox-group.module.css'
|
|
9
10
|
|
|
10
11
|
export interface CheckboxGroupProps {
|
|
11
12
|
groupName: string
|
|
@@ -67,7 +68,7 @@ export const CheckboxGroup: React.FC<CheckboxGroupProps> = ({
|
|
|
67
68
|
}
|
|
68
69
|
|
|
69
70
|
return (
|
|
70
|
-
<div className={cx('infonomic-checkbox-group', className)}>
|
|
71
|
+
<div className={cx('infonomic-checkbox-group', styles['checkbox-group'], className)}>
|
|
71
72
|
{checkBoxes.map((cb) => (
|
|
72
73
|
<Checkbox
|
|
73
74
|
key={cb.id}
|