@homecode/ui 5.0.0 → 5.1.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/dist/esm/index.js +3 -0
- package/dist/esm/src/components/Autocomplete/Autocomplete.js +4 -0
- package/dist/esm/src/components/DropZone/DropZone.js +112 -0
- package/dist/esm/src/components/DropZone/DropZone.styl.js +7 -0
- package/dist/esm/src/components/InputFile/InputFile.js +4 -0
- package/dist/esm/src/components/RadioButton/RadioButton.js +33 -0
- package/dist/esm/src/components/RadioButton/RadioButton.styl.js +7 -0
- package/dist/esm/src/components/RadioGroup/RadioGroup.js +31 -0
- package/dist/esm/src/components/RadioGroup/RadioGroup.styl.js +7 -0
- package/dist/esm/src/components/RadioGroup/RadioGroupContext.js +8 -0
- package/dist/esm/types/src/components/DropZone/DropZone.d.ts +3 -0
- package/dist/esm/types/src/components/DropZone/DropZone.types.d.ts +18 -0
- package/dist/esm/types/src/components/RadioButton/RadioButton.d.ts +3 -0
- package/dist/esm/types/src/components/RadioButton/RadioButton.types.d.ts +12 -0
- package/dist/esm/types/src/components/RadioGroup/RadioGroup.d.ts +3 -0
- package/dist/esm/types/src/components/RadioGroup/RadioGroup.types.d.ts +30 -0
- package/dist/esm/types/src/components/RadioGroup/RadioGroupContext.d.ts +3 -0
- package/dist/esm/types/src/components/Scroll/Scroll.d.ts +1 -1
- package/dist/esm/types/src/components/index.d.ts +3 -0
- package/package.json +1 -1
package/dist/esm/index.js
CHANGED
|
@@ -12,6 +12,7 @@ export { DatePickerInput } from './src/components/DatePickerInput/DatePickerInpu
|
|
|
12
12
|
export { DateTime, formatDate } from './src/components/DateTime/DateTime.js';
|
|
13
13
|
export { Dialogue } from './src/components/Dialogue/Dialogue.js';
|
|
14
14
|
export { Draggable } from './src/components/Draggable/Draggable.js';
|
|
15
|
+
export { DropZone } from './src/components/DropZone/DropZone.js';
|
|
15
16
|
export { Expand } from './src/components/Expand/Expand.js';
|
|
16
17
|
export { Flex } from './src/components/Flex/Flex.js';
|
|
17
18
|
export { Form } from './src/components/Form/Form.js';
|
|
@@ -32,6 +33,8 @@ export { Portal } from './src/components/Portal/Portal.js';
|
|
|
32
33
|
export { PopupMenu } from './src/components/PopupMenu/PopupMenu.js';
|
|
33
34
|
export { Progress } from './src/components/Progress/Progress.js';
|
|
34
35
|
export { ProgressCircular } from './src/components/ProgressCircular/ProgressCircular.js';
|
|
36
|
+
export { RadioButton } from './src/components/RadioButton/RadioButton.js';
|
|
37
|
+
export { RadioGroup } from './src/components/RadioGroup/RadioGroup.js';
|
|
35
38
|
export { Router, RouterContext, RouterStore } from './src/components/Router/Router.js';
|
|
36
39
|
export { RequiredStar } from './src/components/RequiredStar/RequiredStar.js';
|
|
37
40
|
export { Select, SelectHelpers } from './src/components/Select/Select.js';
|
|
@@ -36,6 +36,7 @@ import '../DatePickerInput/DatePickerInput.styl.js';
|
|
|
36
36
|
import '../Dialogue/Dialogue.js';
|
|
37
37
|
import '../../tools/queryParams.js';
|
|
38
38
|
import '../Draggable/Draggable.styl.js';
|
|
39
|
+
import '../DropZone/DropZone.styl.js';
|
|
39
40
|
import '../Expand/Expand.styl.js';
|
|
40
41
|
import '../Flex/Flex.styl.js';
|
|
41
42
|
import '../Form/Form.styl.js';
|
|
@@ -55,6 +56,9 @@ import '../Notifications/Notifications.styl.js';
|
|
|
55
56
|
import '../PopupMenu/PopupMenu.styl.js';
|
|
56
57
|
import '../Progress/Progress.styl.js';
|
|
57
58
|
import '../ProgressCircular/ProgressCircular.styl.js';
|
|
59
|
+
import '../RadioGroup/RadioGroupContext.js';
|
|
60
|
+
import '../RadioButton/RadioButton.styl.js';
|
|
61
|
+
import '../RadioGroup/RadioGroup.styl.js';
|
|
58
62
|
import '../Router/Router.js';
|
|
59
63
|
import '../Table/Table.styl.js';
|
|
60
64
|
import '../Tabs/Tabs.styl.js';
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
2
|
+
import { useState, useRef, useCallback, useEffect } from 'react';
|
|
3
|
+
import cn from 'classnames';
|
|
4
|
+
import { generateUID } from '../../tools/uid.js';
|
|
5
|
+
import S from './DropZone.styl.js';
|
|
6
|
+
|
|
7
|
+
function matchesAcceptPart(file, part) {
|
|
8
|
+
const p = part.trim().toLowerCase();
|
|
9
|
+
if (!p)
|
|
10
|
+
return false;
|
|
11
|
+
if (p.startsWith('.')) {
|
|
12
|
+
return file.name.toLowerCase().endsWith(p);
|
|
13
|
+
}
|
|
14
|
+
if (p.includes('/')) {
|
|
15
|
+
const t = file.type.toLowerCase();
|
|
16
|
+
if (p.endsWith('/*')) {
|
|
17
|
+
const prefix = p.slice(0, -1);
|
|
18
|
+
return t.startsWith(prefix);
|
|
19
|
+
}
|
|
20
|
+
return t === p;
|
|
21
|
+
}
|
|
22
|
+
return false;
|
|
23
|
+
}
|
|
24
|
+
function matchesAccept(file, accept) {
|
|
25
|
+
const trimmed = accept.trim();
|
|
26
|
+
if (!trimmed)
|
|
27
|
+
return true;
|
|
28
|
+
const parts = trimmed
|
|
29
|
+
.split(',')
|
|
30
|
+
.map(s => s.trim())
|
|
31
|
+
.filter(Boolean);
|
|
32
|
+
if (parts.length === 0)
|
|
33
|
+
return true;
|
|
34
|
+
return parts.some(part => matchesAcceptPart(file, part));
|
|
35
|
+
}
|
|
36
|
+
function DropZone(props) {
|
|
37
|
+
const { accept, label, error, disabled = false, ghost = false, id, className, } = props;
|
|
38
|
+
const [isDragging, setIsDragging] = useState(false);
|
|
39
|
+
const dropAreaRef = useRef(null);
|
|
40
|
+
const fallbackInputIdRef = useRef(generateUID());
|
|
41
|
+
const inputId = id ?? fallbackInputIdRef.current;
|
|
42
|
+
const handleDrop = useCallback((e) => {
|
|
43
|
+
e.preventDefault();
|
|
44
|
+
setIsDragging(false);
|
|
45
|
+
if (disabled)
|
|
46
|
+
return;
|
|
47
|
+
const list = Array.from(e.dataTransfer.files).filter(f => matchesAccept(f, accept));
|
|
48
|
+
if (props.multiple === true) {
|
|
49
|
+
if (list.length > 0) {
|
|
50
|
+
props.onFiles(list);
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
else {
|
|
54
|
+
const file = list[0];
|
|
55
|
+
if (file) {
|
|
56
|
+
props.onFile(file);
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
}, [accept, disabled, props]);
|
|
60
|
+
const handleFileInput = useCallback((e) => {
|
|
61
|
+
if (disabled)
|
|
62
|
+
return;
|
|
63
|
+
const raw = e.target.files;
|
|
64
|
+
if (!raw?.length)
|
|
65
|
+
return;
|
|
66
|
+
const list = Array.from(raw).filter(f => matchesAccept(f, accept));
|
|
67
|
+
if (props.multiple === true) {
|
|
68
|
+
if (list.length > 0) {
|
|
69
|
+
props.onFiles(list);
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
else {
|
|
73
|
+
const file = list[0];
|
|
74
|
+
if (file) {
|
|
75
|
+
props.onFile(file);
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
e.target.value = '';
|
|
79
|
+
}, [accept, disabled, props]);
|
|
80
|
+
useEffect(() => {
|
|
81
|
+
const dialog = dropAreaRef.current?.closest('[role="dialog"]');
|
|
82
|
+
const targetElement = dialog || document.body;
|
|
83
|
+
const handleGlobalDragOver = (e) => {
|
|
84
|
+
e.preventDefault();
|
|
85
|
+
setIsDragging(true);
|
|
86
|
+
};
|
|
87
|
+
const handleGlobalDragLeave = (e) => {
|
|
88
|
+
if (!e.relatedTarget ||
|
|
89
|
+
!targetElement.contains(e.relatedTarget)) {
|
|
90
|
+
setIsDragging(false);
|
|
91
|
+
}
|
|
92
|
+
};
|
|
93
|
+
const handleGlobalDrop = () => {
|
|
94
|
+
setIsDragging(false);
|
|
95
|
+
};
|
|
96
|
+
targetElement.addEventListener('dragover', handleGlobalDragOver);
|
|
97
|
+
targetElement.addEventListener('dragleave', handleGlobalDragLeave);
|
|
98
|
+
targetElement.addEventListener('drop', handleGlobalDrop);
|
|
99
|
+
return () => {
|
|
100
|
+
targetElement.removeEventListener('dragover', handleGlobalDragOver);
|
|
101
|
+
targetElement.removeEventListener('dragleave', handleGlobalDragLeave);
|
|
102
|
+
targetElement.removeEventListener('drop', handleGlobalDrop);
|
|
103
|
+
};
|
|
104
|
+
}, []);
|
|
105
|
+
const shouldShowDropArea = !ghost || isDragging;
|
|
106
|
+
const multiple = props.multiple === true;
|
|
107
|
+
return (jsxs("div", { className: cn(S.root, className), children: [shouldShowDropArea && (jsxs("div", { ref: dropAreaRef, className: cn(S.dropArea, isDragging && S.isDragging, disabled && S.disabled), onDrop: handleDrop, children: [jsx("input", { type: "file", accept: accept, multiple: multiple, onChange: handleFileInput, className: S.fileInput, id: inputId, disabled: disabled }), jsx("label", { htmlFor: inputId, className: S.label, style: {
|
|
108
|
+
cursor: disabled ? 'not-allowed' : 'pointer',
|
|
109
|
+
}, children: label })] })), error && jsx("div", { className: S.error, children: error })] }));
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
export { DropZone };
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import styleInject from '../../../node_modules/style-inject/dist/style-inject.es.js';
|
|
2
|
+
|
|
3
|
+
var css_248z = ".DropZone_root__gk-Ef{display:flex;flex-direction:column;gap:var(--p-2)}.DropZone_dropArea__u-8Ye{background-color:var(--accent-color-alpha-100);border:2px dashed var(--decent-color-alpha-200);border-radius:var(--p-4);cursor:pointer;padding:var(--p-4);position:relative;text-align:center;transition:all .2s ease}.DropZone_dropArea__u-8Ye label:before{border-radius:var(--p-4);content:\"\";height:100%;left:0;position:absolute;top:0;width:100%}.DropZone_dropArea__u-8Ye.DropZone_isDragging__S-aQp,.DropZone_dropArea__u-8Ye:hover:not(.DropZone_disabled__qsAf6){border:2px dashed var(--active-color-alpha-500)}.DropZone_dropArea__u-8Ye:hover:not(.DropZone_disabled__qsAf6){background-color:var(--accent-color-alpha-50)}.DropZone_dropArea__u-8Ye.DropZone_isDragging__S-aQp{align-items:center;-webkit-backdrop-filter:blur(10px);backdrop-filter:blur(10px);background-color:var(--decent-color-alpha-900)!important;display:flex;height:calc(100% - var(--p-2));justify-content:center;left:var(--p-1);position:fixed;top:var(--p-1);width:calc(100% - var(--p-2));z-index:9999}.DropZone_dropArea__u-8Ye.DropZone_disabled__qsAf6{cursor:not-allowed;opacity:.6}.DropZone_fileInput__E8DeE{display:none}.DropZone_label__u7-Pb{cursor:pointer}.DropZone_error__vSiwM{color:var(--danger-color);font-size:.875rem;padding:var(--p-1) var(--p-2)}";
|
|
4
|
+
var S = {"root":"DropZone_root__gk-Ef","dropArea":"DropZone_dropArea__u-8Ye","disabled":"DropZone_disabled__qsAf6","isDragging":"DropZone_isDragging__S-aQp","fileInput":"DropZone_fileInput__E8DeE","label":"DropZone_label__u7-Pb","error":"DropZone_error__vSiwM"};
|
|
5
|
+
styleInject(css_248z);
|
|
6
|
+
|
|
7
|
+
export { S as default };
|
|
@@ -39,6 +39,7 @@ import 'moment';
|
|
|
39
39
|
import '../DatePickerInput/DatePickerInput.styl.js';
|
|
40
40
|
import '../Dialogue/Dialogue.js';
|
|
41
41
|
import { Draggable } from '../Draggable/Draggable.js';
|
|
42
|
+
import '../DropZone/DropZone.styl.js';
|
|
42
43
|
import '../Expand/Expand.styl.js';
|
|
43
44
|
import '../Flex/Flex.styl.js';
|
|
44
45
|
import '../Form/Form.styl.js';
|
|
@@ -54,6 +55,9 @@ import '../Notifications/Notifications.styl.js';
|
|
|
54
55
|
import '../PopupMenu/PopupMenu.styl.js';
|
|
55
56
|
import '../Progress/Progress.styl.js';
|
|
56
57
|
import '../ProgressCircular/ProgressCircular.styl.js';
|
|
58
|
+
import '../RadioGroup/RadioGroupContext.js';
|
|
59
|
+
import '../RadioButton/RadioButton.styl.js';
|
|
60
|
+
import '../RadioGroup/RadioGroup.styl.js';
|
|
57
61
|
import '../Router/Router.js';
|
|
58
62
|
import '../Table/Table.styl.js';
|
|
59
63
|
import '../Tabs/Tabs.styl.js';
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
2
|
+
import cn from 'classnames';
|
|
3
|
+
import 'react';
|
|
4
|
+
import 'timen';
|
|
5
|
+
import { useToggleState } from '../../hooks/useToggleState.js';
|
|
6
|
+
import { useRadioGroup } from '../RadioGroup/RadioGroupContext.js';
|
|
7
|
+
import S from './RadioButton.styl.js';
|
|
8
|
+
|
|
9
|
+
const RadioButton = ({ className, label = '', size: sizeProp, variant: variantProp, error: errorProp, value, checked: checkedProp, disabled: disabledProp, name: nameProp, onChange, id, onFocus, onBlur, ...props }) => {
|
|
10
|
+
const group = useRadioGroup();
|
|
11
|
+
const size = sizeProp ?? group?.size ?? 'm';
|
|
12
|
+
const variant = variantProp ?? group?.variant ?? 'default';
|
|
13
|
+
const error = errorProp ?? group?.error;
|
|
14
|
+
const disabled = Boolean(disabledProp || group?.disabled);
|
|
15
|
+
const name = group ? group.name : nameProp;
|
|
16
|
+
const checked = group
|
|
17
|
+
? group.value !== undefined && group.value === value
|
|
18
|
+
: Boolean(checkedProp);
|
|
19
|
+
const { id: componentId, isActive, isFocused, handlers, } = useToggleState({
|
|
20
|
+
id,
|
|
21
|
+
onFocus,
|
|
22
|
+
onBlur,
|
|
23
|
+
});
|
|
24
|
+
const handleChange = (e) => {
|
|
25
|
+
if (group)
|
|
26
|
+
group.onChange(value);
|
|
27
|
+
onChange?.(e);
|
|
28
|
+
};
|
|
29
|
+
const classes = cn(S.root, S[`size-${size}`], S[`variant-${variant}`], checked && S.checked, disabled && S.disabled, error && S.hasError, isActive && S.isActive, isFocused && S.isFocused, className);
|
|
30
|
+
return (jsxs("label", { className: classes, onPointerDown: handlers.onPointerDown, onPointerUp: handlers.onPointerUp, children: [jsxs("div", { className: S.controlWrapper, children: [jsx("input", { className: S.control, ...props, onChange: handleChange, onFocus: handlers.onFocus, onBlur: handlers.onBlur, id: componentId, type: "radio", name: name, value: String(value), checked: checked, disabled: disabled, tabIndex: 0 }), jsx("span", { className: S.dot, "aria-hidden": true })] }), label] }));
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
export { RadioButton };
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import styleInject from '../../../node_modules/style-inject/dist/style-inject.es.js';
|
|
2
|
+
|
|
3
|
+
var css_248z = ".RadioButton_root__-zReK{align-items:center;box-sizing:border-box;color:inherit;cursor:pointer;display:inline-flex;text-decoration:none;-webkit-user-select:none;-moz-user-select:none;user-select:none}.RadioButton_disabled__OuVm5{opacity:.4;pointer-events:none}.RadioButton_controlWrapper__xtZkJ{display:block;margin-right:1em;position:relative;transition:.2s ease-out;transition-property:opacity,box-shadow}.RadioButton_variant-default__r2D0X .RadioButton_controlWrapper__xtZkJ{background-color:var(--accent-color-alpha-100)}.RadioButton_variant-outlined__ZE2em .RadioButton_controlWrapper__xtZkJ{background-color:transparent;box-shadow:inset 0 0 0 2px var(--accent-color)}.RadioButton_root__-zReK:hover .RadioButton_controlWrapper__xtZkJ{background-color:var(--active-color-alpha-100)}.RadioButton_isActive__hAdvm .RadioButton_controlWrapper__xtZkJ,.RadioButton_isFocused__pQaTx .RadioButton_controlWrapper__xtZkJ{box-shadow:inset 0 0 0 2px var(--active-color)!important}.RadioButton_hasError__SFhRz .RadioButton_controlWrapper__xtZkJ{box-shadow:inset 0 0 0 2px var(--danger-color)!important}.RadioButton_isActive__hAdvm .RadioButton_controlWrapper__xtZkJ{background-color:var(--active-color-alpha-100);opacity:.7}.RadioButton_control__RLcpz{-webkit-appearance:none;-moz-appearance:none;appearance:none;box-shadow:inset 0 0 0 2px none;box-sizing:border-box;cursor:pointer;transition:.2s ease-out;transition-property:background-color,box-shadow,opacity;transition:.1s ease-out;transition-property:background-color,color}.RadioButton_control__RLcpz:focus,.RadioButton_control__RLcpz:hover{background-color:var(--active-color-alpha-100)}.RadioButton_control__RLcpz[disabled]{background-color:var(--accent-color-alpha-100);opacity:.4;pointer-events:none}.RadioButton_dot__m6MWL{background-color:var(--active-color);border-radius:50%;height:42%;left:50%;opacity:0;pointer-events:none;position:absolute;top:50%;transform:translate(-50%,-50%) scale(.4);transition:.1s ease-in;transition-property:transform,opacity;width:42%}.RadioButton_checked__X45GC .RadioButton_dot__m6MWL{opacity:1;transform:translate(-50%,-50%) scale(1.8)}.RadioButton_size-xs__gBuwV{font-size:14px}.RadioButton_size-xs__gBuwV .RadioButton_controlWrapper__xtZkJ{border-radius:4px;border-radius:12px;min-height:24px;min-width:24px}.RadioButton_size-s__2fKr7{font-size:16px}.RadioButton_size-s__2fKr7 .RadioButton_controlWrapper__xtZkJ{border-radius:4px;border-radius:16px;min-height:32px;min-width:32px}.RadioButton_size-m__cQ-gf{font-size:18px}.RadioButton_size-m__cQ-gf .RadioButton_controlWrapper__xtZkJ{border-radius:6px;border-radius:20px;min-height:40px;min-width:40px}.RadioButton_size-l__h3Alz{font-size:22px}.RadioButton_size-l__h3Alz .RadioButton_controlWrapper__xtZkJ{border-radius:8px;border-radius:24px;min-height:48px;min-width:48px}.RadioButton_size-xl__evU9a{font-size:26px}.RadioButton_size-xl__evU9a .RadioButton_controlWrapper__xtZkJ{border-radius:10px;border-radius:28px;min-height:56px;min-width:56px}";
|
|
4
|
+
var S = {"root":"RadioButton_root__-zReK","disabled":"RadioButton_disabled__OuVm5","controlWrapper":"RadioButton_controlWrapper__xtZkJ","variant-default":"RadioButton_variant-default__r2D0X","variant-outlined":"RadioButton_variant-outlined__ZE2em","isActive":"RadioButton_isActive__hAdvm","isFocused":"RadioButton_isFocused__pQaTx","hasError":"RadioButton_hasError__SFhRz","control":"RadioButton_control__RLcpz","dot":"RadioButton_dot__m6MWL","checked":"RadioButton_checked__X45GC","size-xs":"RadioButton_size-xs__gBuwV","size-s":"RadioButton_size-s__2fKr7","size-m":"RadioButton_size-m__cQ-gf","size-l":"RadioButton_size-l__h3Alz","size-xl":"RadioButton_size-xl__evU9a"};
|
|
5
|
+
styleInject(css_248z);
|
|
6
|
+
|
|
7
|
+
export { S as default };
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
2
|
+
import { useId, useState, useCallback, useMemo } from 'react';
|
|
3
|
+
import cn from 'classnames';
|
|
4
|
+
import { RadioGroupContext } from './RadioGroupContext.js';
|
|
5
|
+
import S from './RadioGroup.styl.js';
|
|
6
|
+
|
|
7
|
+
const RadioGroup = ({ className, children, label, value, defaultValue, onChange, name: nameProp, size = 'm', variant = 'default', error, disabled, orientation = 'vertical', ...rest }) => {
|
|
8
|
+
const reactId = useId();
|
|
9
|
+
const name = nameProp ?? `radio${reactId.replace(/:/g, '')}`;
|
|
10
|
+
const [uncontrolled, setUncontrolled] = useState(defaultValue);
|
|
11
|
+
const isControlled = value !== undefined;
|
|
12
|
+
const selectedValue = isControlled ? value : uncontrolled;
|
|
13
|
+
const setValue = useCallback((next) => {
|
|
14
|
+
if (!isControlled)
|
|
15
|
+
setUncontrolled(next);
|
|
16
|
+
onChange?.(next);
|
|
17
|
+
}, [isControlled, onChange]);
|
|
18
|
+
const contextValue = useMemo(() => ({
|
|
19
|
+
name,
|
|
20
|
+
value: selectedValue,
|
|
21
|
+
onChange: setValue,
|
|
22
|
+
size,
|
|
23
|
+
variant,
|
|
24
|
+
error,
|
|
25
|
+
disabled,
|
|
26
|
+
}), [name, selectedValue, setValue, size, variant, error, disabled]);
|
|
27
|
+
const inner = (jsx("div", { className: cn(S.inner, orientation === 'horizontal' && S.horizontal), children: jsx(RadioGroupContext.Provider, { value: contextValue, children: children }) }));
|
|
28
|
+
return (jsxs("fieldset", { className: cn(S.root, className), disabled: disabled, ...rest, children: [label != null && label !== '' && (jsx("legend", { className: S.legend, children: label })), inner] }));
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
export { RadioGroup };
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import styleInject from '../../../node_modules/style-inject/dist/style-inject.es.js';
|
|
2
|
+
|
|
3
|
+
var css_248z = ".RadioGroup_root__f0yTC{border:none;margin:0;min-width:0;padding:0}.RadioGroup_legend__Fq1Yg{margin:0 0 .5em;padding:0}.RadioGroup_inner__GZ2--{align-items:flex-start;display:flex;flex-direction:column;gap:.5em}.RadioGroup_inner__GZ2--.RadioGroup_horizontal__72oyb{align-items:center;flex-direction:row;flex-wrap:wrap}";
|
|
4
|
+
var S = {"root":"RadioGroup_root__f0yTC","legend":"RadioGroup_legend__Fq1Yg","inner":"RadioGroup_inner__GZ2--","horizontal":"RadioGroup_horizontal__72oyb"};
|
|
5
|
+
styleInject(css_248z);
|
|
6
|
+
|
|
7
|
+
export { S as default };
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export interface DropZoneBaseProps {
|
|
2
|
+
accept: string;
|
|
3
|
+
label: string;
|
|
4
|
+
error?: string | null;
|
|
5
|
+
disabled?: boolean;
|
|
6
|
+
ghost?: boolean;
|
|
7
|
+
id?: string;
|
|
8
|
+
className?: string;
|
|
9
|
+
}
|
|
10
|
+
export interface DropZoneSingleProps extends DropZoneBaseProps {
|
|
11
|
+
multiple?: false;
|
|
12
|
+
onFile: (file: File) => void;
|
|
13
|
+
}
|
|
14
|
+
export interface DropZoneMultiProps extends DropZoneBaseProps {
|
|
15
|
+
multiple: true;
|
|
16
|
+
onFiles: (files: File[]) => void;
|
|
17
|
+
}
|
|
18
|
+
export type Props = DropZoneSingleProps | DropZoneMultiProps;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { ReactNode, InputHTMLAttributes } from 'react';
|
|
2
|
+
import { Size, ComponentType } from '../../types';
|
|
3
|
+
export type Props = Omit<InputHTMLAttributes<HTMLInputElement>, 'size' | 'type' | 'value'> & ComponentType & {
|
|
4
|
+
label?: ReactNode;
|
|
5
|
+
/** Option value; compared to the group’s `value` when inside `RadioGroup` */
|
|
6
|
+
value: string | number;
|
|
7
|
+
checked?: boolean;
|
|
8
|
+
disabled?: boolean;
|
|
9
|
+
error?: string | boolean;
|
|
10
|
+
size?: Size;
|
|
11
|
+
variant?: 'default' | 'outlined';
|
|
12
|
+
};
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { ReactNode, HTMLAttributes } from 'react';
|
|
2
|
+
import { Size, ComponentType } from '../../types';
|
|
3
|
+
export type RadioGroupContextValue = {
|
|
4
|
+
name: string;
|
|
5
|
+
value: string | number | undefined;
|
|
6
|
+
onChange: (value: string | number) => void;
|
|
7
|
+
size: Size;
|
|
8
|
+
variant: 'default' | 'outlined';
|
|
9
|
+
error?: string | boolean;
|
|
10
|
+
disabled?: boolean;
|
|
11
|
+
};
|
|
12
|
+
export type Props = Omit<HTMLAttributes<HTMLFieldSetElement>, 'onChange'> & ComponentType & {
|
|
13
|
+
children: ReactNode;
|
|
14
|
+
/** Current value when controlled */
|
|
15
|
+
value?: string | number;
|
|
16
|
+
/** Initial value when uncontrolled */
|
|
17
|
+
defaultValue?: string | number;
|
|
18
|
+
/** Called when the selected option changes */
|
|
19
|
+
onChange?: (value: string | number) => void;
|
|
20
|
+
/** Shared `name` for native radio inputs; generated if omitted */
|
|
21
|
+
name?: string;
|
|
22
|
+
/** Group heading; renders as `legend` */
|
|
23
|
+
label?: ReactNode;
|
|
24
|
+
/** Size passed to `RadioButton` children via context */
|
|
25
|
+
size?: Size;
|
|
26
|
+
variant?: 'default' | 'outlined';
|
|
27
|
+
error?: string | boolean;
|
|
28
|
+
disabled?: boolean;
|
|
29
|
+
orientation?: 'vertical' | 'horizontal';
|
|
30
|
+
};
|
|
@@ -13,7 +13,7 @@ export declare const Scroll: import("react").ForwardRefExoticComponent<import(".
|
|
|
13
13
|
x?: boolean;
|
|
14
14
|
y?: boolean;
|
|
15
15
|
size?: import("../../types").Size;
|
|
16
|
-
fadeSize?: import("../../types").Size
|
|
16
|
+
fadeSize?: import("../../types").Size;
|
|
17
17
|
smooth?: boolean;
|
|
18
18
|
autoHide?: boolean;
|
|
19
19
|
offset?: {
|
|
@@ -12,6 +12,7 @@ export * from './DatePickerInput/DatePickerInput';
|
|
|
12
12
|
export * from './DateTime/DateTime';
|
|
13
13
|
export * from './Dialogue';
|
|
14
14
|
export * from './Draggable/Draggable';
|
|
15
|
+
export * from './DropZone/DropZone';
|
|
15
16
|
export * from './Expand/Expand';
|
|
16
17
|
export * from './Flex/Flex';
|
|
17
18
|
export * from './Form/Form';
|
|
@@ -32,6 +33,8 @@ export * from './Portal/Portal';
|
|
|
32
33
|
export * from './PopupMenu/PopupMenu';
|
|
33
34
|
export * from './Progress/Progress';
|
|
34
35
|
export * from './ProgressCircular/ProgressCircular';
|
|
36
|
+
export * from './RadioButton/RadioButton';
|
|
37
|
+
export * from './RadioGroup/RadioGroup';
|
|
35
38
|
export * from './Router/Router';
|
|
36
39
|
export * from './RequiredStar/RequiredStar';
|
|
37
40
|
export * from './Select/Select';
|