@xqmsg/ui-core 0.14.3 → 0.14.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/dist/components/input/StackedCheckbox/StackedCheckbox.d.ts +10 -0
- package/dist/theme/provider/index.d.ts +1 -1
- package/dist/ui-core.cjs.development.js +22 -20
- package/dist/ui-core.cjs.development.js.map +1 -1
- package/dist/ui-core.cjs.production.min.js +1 -1
- package/dist/ui-core.cjs.production.min.js.map +1 -1
- package/dist/ui-core.esm.js +22 -20
- package/dist/ui-core.esm.js.map +1 -1
- package/package.json +1 -1
- package/src/components/input/Input.stories.tsx +6 -0
- package/src/components/input/StackedCheckbox/StackedCheckbox.tsx +27 -0
- package/src/components/input/StackedSelect/StackedSelect.tsx +1 -0
- package/src/components/input/StackedSwitch/index.tsx +2 -0
- package/src/components/input/index.tsx +5 -3
- package/src/components/table/index.tsx +2 -7
- package/src/theme/provider/index.tsx +1 -1
- package/dist/components/input/StackedCheckbox/StackedCheckboxGroup.d.ts +0 -10
- package/src/components/input/StackedCheckbox/StackedCheckboxGroup.tsx +0 -29
package/package.json
CHANGED
|
@@ -144,6 +144,12 @@ const Template: Story<InputProps<StoryFormSchema>> = args => {
|
|
|
144
144
|
inputType="switch"
|
|
145
145
|
setValue={form.setValue}
|
|
146
146
|
/>
|
|
147
|
+
<Input
|
|
148
|
+
{...args}
|
|
149
|
+
name="prop6"
|
|
150
|
+
inputType="checkbox"
|
|
151
|
+
setValue={form.setValue}
|
|
152
|
+
/>
|
|
147
153
|
</Form>
|
|
148
154
|
);
|
|
149
155
|
};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Checkbox } from '@chakra-ui/react';
|
|
3
|
+
import { SelectFieldProps } from '../InputTypes';
|
|
4
|
+
|
|
5
|
+
export interface StackedCheckboxProps extends SelectFieldProps {
|
|
6
|
+
label: string;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* A functional React component utilized to render the `StackedCheckbox` component.
|
|
11
|
+
*/
|
|
12
|
+
const StackedCheckbox = React.forwardRef<
|
|
13
|
+
HTMLInputElement,
|
|
14
|
+
StackedCheckboxProps
|
|
15
|
+
>(({ value, label, defaultValue }, _ref) => {
|
|
16
|
+
return (
|
|
17
|
+
<Checkbox
|
|
18
|
+
ref={_ref}
|
|
19
|
+
value={String(value)}
|
|
20
|
+
defaultChecked={Boolean(defaultValue)}
|
|
21
|
+
>
|
|
22
|
+
{label}
|
|
23
|
+
</Checkbox>
|
|
24
|
+
);
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
export default StackedCheckbox;
|
|
@@ -8,6 +8,8 @@ export interface StackedSwitchProps extends SwitchProps {}
|
|
|
8
8
|
*/
|
|
9
9
|
const StackedSwitch = React.forwardRef<HTMLInputElement, StackedSwitchProps>(
|
|
10
10
|
({ isRequired, onChange, value }, _ref) => {
|
|
11
|
+
if (value === null) return null;
|
|
12
|
+
|
|
11
13
|
return (
|
|
12
14
|
<Switch
|
|
13
15
|
size="lg"
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import
|
|
2
|
+
import StackedCheckBox from './StackedCheckbox/StackedCheckbox';
|
|
3
3
|
import StackedInput from './StackedInput/StackedInput';
|
|
4
4
|
import StackedRadioGroup from './StackedRadio/StackedRadioGroup';
|
|
5
5
|
import StackedSelect from './StackedSelect/StackedSelect';
|
|
@@ -147,17 +147,18 @@ export function Input<T extends FieldValues>({
|
|
|
147
147
|
);
|
|
148
148
|
case 'checkbox':
|
|
149
149
|
return (
|
|
150
|
-
<
|
|
150
|
+
<StackedCheckBox
|
|
151
151
|
className={`input-${inputType} ${className ?? ''}`}
|
|
152
152
|
name={name}
|
|
153
153
|
id={name}
|
|
154
154
|
isInvalid={isInvalid}
|
|
155
|
-
options={options as FieldOptions}
|
|
156
155
|
onChange={onChange}
|
|
157
156
|
onBlur={onBlur}
|
|
158
157
|
ref={ref}
|
|
159
158
|
disabled={disabled}
|
|
160
159
|
value={value}
|
|
160
|
+
defaultValue={defaultValue}
|
|
161
|
+
label={label as string}
|
|
161
162
|
/>
|
|
162
163
|
);
|
|
163
164
|
case 'multi-select':
|
|
@@ -212,6 +213,7 @@ export function Input<T extends FieldValues>({
|
|
|
212
213
|
onBlur={onBlur}
|
|
213
214
|
ref={ref}
|
|
214
215
|
value={value}
|
|
216
|
+
defaultValue={defaultValue}
|
|
215
217
|
/>
|
|
216
218
|
);
|
|
217
219
|
default:
|
|
@@ -44,15 +44,10 @@ export function Table<T extends ReadonlyTableColumns>({
|
|
|
44
44
|
const columnsAsConst = generateTableColumnsAsConst(columns);
|
|
45
45
|
|
|
46
46
|
return (
|
|
47
|
-
<TableContainer
|
|
48
|
-
border="none"
|
|
49
|
-
overflowX="auto"
|
|
50
|
-
bg="white"
|
|
51
|
-
width="fit-content"
|
|
52
|
-
>
|
|
47
|
+
<TableContainer border="none" overflowX="auto" bg="white" width="100%">
|
|
53
48
|
<ChakraTable
|
|
54
49
|
variant="unstyled"
|
|
55
|
-
width="
|
|
50
|
+
width="100%"
|
|
56
51
|
style={{
|
|
57
52
|
borderCollapse: 'separate',
|
|
58
53
|
borderSpacing: '0px',
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { FieldOptions, SelectFieldProps } from '../InputTypes';
|
|
3
|
-
export interface StackedCheckboxGroupProps extends SelectFieldProps {
|
|
4
|
-
options: FieldOptions;
|
|
5
|
-
}
|
|
6
|
-
/**
|
|
7
|
-
* A functional React component utilized to render the `StackedCheckbox` component.
|
|
8
|
-
*/
|
|
9
|
-
declare const StackedCheckboxGroup: React.ForwardRefExoticComponent<StackedCheckboxGroupProps & React.RefAttributes<HTMLInputElement>>;
|
|
10
|
-
export default StackedCheckboxGroup;
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { Flex, InputGroup, Checkbox } from '@chakra-ui/react';
|
|
3
|
-
import { FieldOptions, SelectFieldProps } from '../InputTypes';
|
|
4
|
-
|
|
5
|
-
export interface StackedCheckboxGroupProps extends SelectFieldProps {
|
|
6
|
-
options: FieldOptions;
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
/**
|
|
10
|
-
* A functional React component utilized to render the `StackedCheckbox` component.
|
|
11
|
-
*/
|
|
12
|
-
const StackedCheckboxGroup = React.forwardRef<
|
|
13
|
-
HTMLInputElement,
|
|
14
|
-
StackedCheckboxGroupProps
|
|
15
|
-
>(({ options }, _ref) => {
|
|
16
|
-
return (
|
|
17
|
-
<InputGroup>
|
|
18
|
-
{options.map(option => (
|
|
19
|
-
<Flex mr="30px" alignItems="center" key={option.value}>
|
|
20
|
-
<Checkbox ref={_ref} value={option.value}>
|
|
21
|
-
{option.label}
|
|
22
|
-
</Checkbox>
|
|
23
|
-
</Flex>
|
|
24
|
-
))}
|
|
25
|
-
</InputGroup>
|
|
26
|
-
);
|
|
27
|
-
});
|
|
28
|
-
|
|
29
|
-
export default StackedCheckboxGroup;
|