uibee 2.12.1 → 2.12.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/dist/src/components/inputs/checkbox.d.ts +1 -0
- package/dist/src/components/inputs/checkbox.js +3 -3
- package/dist/src/components/inputs/input.d.ts +1 -0
- package/dist/src/components/inputs/input.js +2 -2
- package/dist/src/components/inputs/radio.d.ts +1 -0
- package/dist/src/components/inputs/radio.js +3 -3
- package/dist/src/components/inputs/range.d.ts +1 -0
- package/dist/src/components/inputs/range.js +2 -2
- package/dist/src/components/inputs/select.d.ts +2 -1
- package/dist/src/components/inputs/select.js +2 -2
- package/dist/src/components/inputs/shared/fieldWrapper.d.ts +2 -1
- package/dist/src/components/inputs/shared/fieldWrapper.js +2 -2
- package/dist/src/components/inputs/switch.d.ts +1 -0
- package/dist/src/components/inputs/switch.js +2 -2
- package/dist/src/components/inputs/tagInput.d.ts +2 -1
- package/dist/src/components/inputs/tagInput.js +2 -2
- package/dist/src/components/inputs/textarea.d.ts +1 -0
- package/dist/src/components/inputs/textarea.js +2 -2
- package/dist/src/globals.css +8 -0
- package/package.json +1 -1
- package/src/components/inputs/checkbox.tsx +5 -1
- package/src/components/inputs/input.tsx +3 -1
- package/src/components/inputs/radio.tsx +5 -1
- package/src/components/inputs/range.tsx +3 -1
- package/src/components/inputs/select.tsx +3 -0
- package/src/components/inputs/shared/fieldWrapper.tsx +3 -1
- package/src/components/inputs/switch.tsx +3 -1
- package/src/components/inputs/tagInput.tsx +3 -0
- package/src/components/inputs/textarea.tsx +3 -1
|
@@ -12,5 +12,6 @@ export type CheckboxProps = Omit<React.ComponentProps<'input'>, 'name' | 'onChan
|
|
|
12
12
|
options: CheckboxOption[];
|
|
13
13
|
value?: (string | number)[];
|
|
14
14
|
onChange?: (value: (string | number)[]) => void;
|
|
15
|
+
textSize?: 'sm' | 'md';
|
|
15
16
|
};
|
|
16
17
|
export default function Checkbox(props: CheckboxProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -2,9 +2,9 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
2
2
|
import { Check } from 'lucide-react';
|
|
3
3
|
import { FieldWrapper, InputLabel } from './shared';
|
|
4
4
|
export default function Checkbox(props) {
|
|
5
|
-
const { options, onChange, value, label, description, error, info, name, className, ...rest } = props;
|
|
5
|
+
const { options, onChange, value, label, description, error, info, name, className, textSize = 'sm', ...rest } = props;
|
|
6
6
|
const selectedValues = Array.isArray(value) ? value : [];
|
|
7
|
-
return (_jsx(FieldWrapper, { label: label, name: name, required: rest.required, info: info, description: description, error: error, className: className, children: _jsx("div", { className: 'flex flex-col gap-2', children: options.map((option) => (_jsx(CheckboxItem, { name: name, value: option.value, label: option.label, checked: selectedValues.includes(option.value), disabled: rest.disabled, onChange: (e) => {
|
|
7
|
+
return (_jsx(FieldWrapper, { label: label, name: name, required: rest.required, info: info, description: description, error: error, textSize: textSize, className: className, children: _jsx("div", { className: 'flex flex-col gap-2', children: options.map((option) => (_jsx(CheckboxItem, { name: name, value: option.value, label: option.label, checked: selectedValues.includes(option.value), disabled: rest.disabled, onChange: (e) => {
|
|
8
8
|
if (!onChange)
|
|
9
9
|
return;
|
|
10
10
|
const isChecked = e.target.checked;
|
|
@@ -33,5 +33,5 @@ function CheckboxItem(props) {
|
|
|
33
33
|
absolute left-1/2 top-1/2 -translate-x-1/2 -translate-y-1/2
|
|
34
34
|
w-3.5 h-3.5 pointer-events-none text-white opacity-0
|
|
35
35
|
peer-checked:opacity-100 transition-opacity duration-200
|
|
36
|
-
` })] }), label && (_jsx(InputLabel, { label: label, name: name, className: 'select-none cursor-pointer' }))] }));
|
|
36
|
+
` })] }), label && (_jsx(InputLabel, { label: label, name: name, disabled: inputProps.disabled, className: 'select-none cursor-pointer' }))] }));
|
|
37
37
|
}
|
|
@@ -6,7 +6,7 @@ import DateTimePickerPopup from './shared/dateTimePickerPopup';
|
|
|
6
6
|
import ColorPickerPopup from './shared/colorPickerPopup';
|
|
7
7
|
import useClickOutside from '../../hooks/useClickOutside';
|
|
8
8
|
export default function Input(props) {
|
|
9
|
-
const { name, label, error, className, icon, info, description, ...inputProps } = props;
|
|
9
|
+
const { name, label, error, className, icon, info, description, textSize = 'sm', ...inputProps } = props;
|
|
10
10
|
const { type = 'text', value } = inputProps;
|
|
11
11
|
const localRef = useRef(null);
|
|
12
12
|
const [isOpen, setIsOpen] = useState(false);
|
|
@@ -105,7 +105,7 @@ export default function Input(props) {
|
|
|
105
105
|
return `${dd}.${MM}.${yyyy} ${hh}:${mm}`;
|
|
106
106
|
return value;
|
|
107
107
|
}
|
|
108
|
-
return (_jsx(FieldWrapper, { label: label, name: name, required: inputProps.required, info: info, error: error, description: description, className: className, children: _jsxs("div", { className: 'relative flex items-center', ref: containerRef, children: [displayIcon && (_jsx("div", { className: `
|
|
108
|
+
return (_jsx(FieldWrapper, { label: label, name: name, required: inputProps.required, info: info, error: error, description: description, textSize: textSize, className: className, children: _jsxs("div", { className: 'relative flex items-center', ref: containerRef, children: [displayIcon && (_jsx("div", { className: `
|
|
109
109
|
absolute left-3 text-login-200
|
|
110
110
|
${isClickableType && !inputProps.disabled ? 'cursor-pointer hover:text-login-text' : 'pointer-events-none'}
|
|
111
111
|
`, onClick: handleIconClick, children: displayIcon })), _jsx("input", { ...inputProps, ref: localRef, id: name, name: isClickableType ? undefined : name, type: isClickableType ? 'text' : type, value: isDateType ? getDateDisplayValue() : value, readOnly: isClickableType, onClick: () => isClickableType && !inputProps.disabled && setIsOpen(true), title: label, "aria-invalid": !!error, "aria-describedby": error ? `${name}-error` : undefined, className: `
|
|
@@ -12,5 +12,6 @@ export type RadioProps = Omit<React.ComponentProps<'input'>, 'name' | 'onChange'
|
|
|
12
12
|
options: RadioOption[];
|
|
13
13
|
value?: string | number | null;
|
|
14
14
|
onChange?: (value: string | number) => void;
|
|
15
|
+
textSize?: 'sm' | 'md';
|
|
15
16
|
};
|
|
16
17
|
export default function Radio(props: RadioProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { FieldWrapper, InputLabel } from './shared';
|
|
3
3
|
export default function Radio(props) {
|
|
4
|
-
const { options, onChange, value, label, description, error, info, name, className, ...rest } = props;
|
|
5
|
-
return (_jsx(FieldWrapper, { label: label, name: name, required: rest.required, info: info, description: description, error: error, className: className, children: _jsx("div", { className: 'flex flex-col gap-2', children: options.map((option) => (_jsx(RadioItem, { name: name, value: option.value, label: option.label, checked: value === option.value, disabled: rest.disabled, onChange: () => {
|
|
4
|
+
const { options, onChange, value, label, description, error, info, name, className, textSize = 'sm', ...rest } = props;
|
|
5
|
+
return (_jsx(FieldWrapper, { label: label, name: name, required: rest.required, info: info, description: description, error: error, textSize: textSize, className: className, children: _jsx("div", { className: 'flex flex-col gap-2', children: options.map((option) => (_jsx(RadioItem, { name: name, value: option.value, label: option.label, checked: value === option.value, disabled: rest.disabled, onChange: () => {
|
|
6
6
|
if (onChange)
|
|
7
7
|
onChange(option.value);
|
|
8
8
|
}, className: 'mb-0' }, option.value))) }) }));
|
|
@@ -23,5 +23,5 @@ function RadioItem(props) {
|
|
|
23
23
|
absolute left-1/2 top-1/2 -translate-x-1/2 -translate-y-1/2
|
|
24
24
|
w-2 h-2 rounded-full bg-white pointer-events-none opacity-0
|
|
25
25
|
peer-checked:opacity-100 transition-opacity duration-200
|
|
26
|
-
` })] }), label && (_jsx(InputLabel, { label: label, name: name, className: 'select-none cursor-pointer' }))] }));
|
|
26
|
+
` })] }), label && (_jsx(InputLabel, { label: label, name: name, disabled: inputProps.disabled, className: 'select-none cursor-pointer' }))] }));
|
|
27
27
|
}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { FieldWrapper } from './shared';
|
|
3
3
|
export default function Range(props) {
|
|
4
|
-
const { name, label, error, className, info, description, showValue = true, ...inputProps } = props;
|
|
4
|
+
const { name, label, error, className, info, description, showValue = true, textSize = 'sm', ...inputProps } = props;
|
|
5
5
|
const { min = 0, max = 100, step = 1, value = 0 } = inputProps;
|
|
6
|
-
return (_jsx(FieldWrapper, { label: label, name: name, required: inputProps.required, info: info, description: description, error: error, className: className, children: _jsxs("div", { className: 'flex items-center gap-4', children: [_jsx("input", { ...inputProps, id: name, name: name, type: 'range', min: min, max: max, step: step, value: value, title: label, "aria-invalid": !!error, "aria-describedby": error ? `${name}-error` : undefined, className: `
|
|
6
|
+
return (_jsx(FieldWrapper, { label: label, name: name, required: inputProps.required, info: info, description: description, error: error, textSize: textSize, className: className, children: _jsxs("div", { className: 'flex items-center gap-4', children: [_jsx("input", { ...inputProps, id: name, name: name, type: 'range', min: min, max: max, step: step, value: value, title: label, "aria-invalid": !!error, "aria-describedby": error ? `${name}-error` : undefined, className: `
|
|
7
7
|
flex-1 h-2 bg-login-500 rounded-lg appearance-none cursor-pointer
|
|
8
8
|
accent-login
|
|
9
9
|
[&::-webkit-slider-thumb]:appearance-none
|
|
@@ -18,5 +18,6 @@ export type SelectProps = {
|
|
|
18
18
|
description?: string;
|
|
19
19
|
clearable?: boolean;
|
|
20
20
|
searchable?: boolean;
|
|
21
|
+
textSize?: 'sm' | 'md';
|
|
21
22
|
};
|
|
22
|
-
export default function Select({ label, name, value, onChange, options, error, className, disabled, required, placeholder, info, description, clearable, searchable, }: SelectProps): import("react/jsx-runtime").JSX.Element;
|
|
23
|
+
export default function Select({ label, name, value, onChange, options, error, className, disabled, required, placeholder, info, description, clearable, searchable, textSize, }: SelectProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -5,7 +5,7 @@ import Image from 'next/image';
|
|
|
5
5
|
import { useClickOutside } from '../../hooks';
|
|
6
6
|
import { ChevronDown, X, Search } from 'lucide-react';
|
|
7
7
|
import { FieldWrapper } from './shared';
|
|
8
|
-
export default function Select({ label, name, value, onChange, options, error, className, disabled, required, placeholder = 'Select an option', info, description, clearable = true, searchable = true, }) {
|
|
8
|
+
export default function Select({ label, name, value, onChange, options, error, className, disabled, required, placeholder = 'Select an option', info, description, clearable = true, searchable = true, textSize = 'sm', }) {
|
|
9
9
|
const [isOpen, setIsOpen] = useState(false);
|
|
10
10
|
const [searchTerm, setSearchTerm] = useState('');
|
|
11
11
|
const [selectedOption, setSelectedOption] = useState(options.find(opt => opt.value === value));
|
|
@@ -37,7 +37,7 @@ export default function Select({ label, name, value, onChange, options, error, c
|
|
|
37
37
|
}
|
|
38
38
|
}
|
|
39
39
|
const filteredOptions = options.filter(option => option.label.toLowerCase().includes(searchTerm.toLowerCase()));
|
|
40
|
-
return (_jsxs(FieldWrapper, { label: label, name: name, required: required, info: info, description: description, error: error, className: className, children: [_jsxs("div", { className: 'relative', ref: containerRef, children: [_jsxs("button", { type: 'button', onClick: () => !disabled && setIsOpen(!isOpen), disabled: disabled, "aria-haspopup": 'listbox', "aria-expanded": isOpen, "aria-labelledby": label ? undefined : name, className: `
|
|
40
|
+
return (_jsxs(FieldWrapper, { label: label, name: name, required: required, info: info, description: description, error: error, textSize: textSize, className: className, children: [_jsxs("div", { className: 'relative', ref: containerRef, children: [_jsxs("button", { type: 'button', onClick: () => !disabled && setIsOpen(!isOpen), disabled: disabled, "aria-haspopup": 'listbox', "aria-expanded": isOpen, "aria-labelledby": label ? undefined : name, className: `
|
|
41
41
|
w-full rounded-md bg-login-500/50 border border-login-500
|
|
42
42
|
text-login-text text-left
|
|
43
43
|
focus:outline-none focus:border-login focus:ring-1 focus:ring-login
|
|
@@ -6,8 +6,9 @@ interface FieldWrapperProps {
|
|
|
6
6
|
info?: string;
|
|
7
7
|
error?: string;
|
|
8
8
|
description?: string;
|
|
9
|
+
textSize?: 'sm' | 'md';
|
|
9
10
|
children: ReactNode;
|
|
10
11
|
className?: string;
|
|
11
12
|
}
|
|
12
|
-
export default function FieldWrapper({ label, name, required, info, error, description, children, className, }: FieldWrapperProps): import("react/jsx-runtime").JSX.Element;
|
|
13
|
+
export default function FieldWrapper({ label, name, required, info, error, description, textSize, children, className, }: FieldWrapperProps): import("react/jsx-runtime").JSX.Element;
|
|
13
14
|
export {};
|
|
@@ -2,6 +2,6 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
2
2
|
import InputLabel from './inputLabel';
|
|
3
3
|
import InputInfo from './inputInfo';
|
|
4
4
|
import InputError from './inputError';
|
|
5
|
-
export default function FieldWrapper({ label, name, required, info, error, description, children, className, }) {
|
|
6
|
-
return (_jsxs("div", { className: `flex flex-col gap-1 w-full relative ${className || ''}`, children: [(label || info) && (_jsxs("div", { className: 'flex items-center justify-between mb-1', children: [label && (_jsx(InputLabel, { label: label, name: name, required: required, className:
|
|
5
|
+
export default function FieldWrapper({ label, name, required, info, error, description, textSize = 'sm', children, className, }) {
|
|
6
|
+
return (_jsxs("div", { className: `flex flex-col gap-1 w-full relative ${className || ''}`, children: [(label || info) && (_jsxs("div", { className: 'flex items-center justify-between mb-1', children: [label && (_jsx(InputLabel, { label: label, name: name, required: required, className: `ml-1 ${textSize === 'sm' ? 'text-sm!' : 'text-base!'}` })), info && _jsx(InputInfo, { info: info })] })), description && (_jsx("p", { className: 'text-sm text-login-100 ml-1 mb-1', children: description })), children, _jsx(InputError, { error: error, id: `${name}-error` })] }));
|
|
7
7
|
}
|
|
@@ -6,5 +6,6 @@ export type SwitchProps = Omit<React.ComponentProps<'input'>, 'name'> & {
|
|
|
6
6
|
description?: string;
|
|
7
7
|
className?: string;
|
|
8
8
|
switchOnly?: boolean;
|
|
9
|
+
textSize?: 'sm' | 'md';
|
|
9
10
|
};
|
|
10
11
|
export default function Switch(props: SwitchProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { FieldWrapper } from './shared';
|
|
3
3
|
export default function Switch(props) {
|
|
4
|
-
const { name, label, error, info, description, className, switchOnly, ...inputProps } = props;
|
|
5
|
-
return (_jsx(FieldWrapper, { label: label, name: name, required: inputProps.required, info: info, error: error, description: description, className: className, children: _jsxs("label", { className: `relative inline-flex items-center cursor-pointer ${switchOnly ? 'h-fit' : 'h-10.5'}`, children: [_jsx("input", { ...inputProps, type: 'checkbox', id: name, name: name, className: 'sr-only peer' }), _jsx("div", { className: `
|
|
4
|
+
const { name, label, error, info, description, className, switchOnly, textSize = 'sm', ...inputProps } = props;
|
|
5
|
+
return (_jsx(FieldWrapper, { label: label, name: name, required: inputProps.required, info: info, error: error, description: description, textSize: textSize, className: className, children: _jsxs("label", { className: `relative inline-flex items-center cursor-pointer ${switchOnly ? 'h-fit' : 'h-10.5'}`, children: [_jsx("input", { ...inputProps, type: 'checkbox', id: name, name: name, className: 'sr-only peer' }), _jsx("div", { className: `
|
|
6
6
|
w-11 h-6 bg-login-500/50 rounded-full peer
|
|
7
7
|
peer-checked:after:translate-x-full peer-checked:after:border-white
|
|
8
8
|
after:content-[''] after:absolute ${switchOnly ? 'after:top-0.5' : 'after:top-2.75'} after:left-0.5
|
|
@@ -10,5 +10,6 @@ export type TagInputProps = {
|
|
|
10
10
|
required?: boolean;
|
|
11
11
|
info?: string;
|
|
12
12
|
description?: string;
|
|
13
|
+
textSize?: 'sm' | 'md';
|
|
13
14
|
};
|
|
14
|
-
export default function TagInput({ label, name, value, onChange, placeholder, error, className, disabled, required, info, description, }: TagInputProps): import("react/jsx-runtime").JSX.Element;
|
|
15
|
+
export default function TagInput({ label, name, value, onChange, placeholder, error, className, disabled, required, info, description, textSize, }: TagInputProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -3,7 +3,7 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
3
3
|
import { useState } from 'react';
|
|
4
4
|
import { X } from 'lucide-react';
|
|
5
5
|
import { FieldWrapper } from './shared';
|
|
6
|
-
export default function TagInput({ label, name, value = [], onChange, placeholder = 'Add...', error, className, disabled, required, info, description, }) {
|
|
6
|
+
export default function TagInput({ label, name, value = [], onChange, placeholder = 'Add...', error, className, disabled, required, info, description, textSize = 'sm', }) {
|
|
7
7
|
const [inputValue, setInputValue] = useState('');
|
|
8
8
|
function handleKeyDown(e) {
|
|
9
9
|
if ((e.key === 'Enter' || e.key === ',') && inputValue.trim()) {
|
|
@@ -29,7 +29,7 @@ export default function TagInput({ label, name, value = [], onChange, placeholde
|
|
|
29
29
|
if (onChange)
|
|
30
30
|
onChange(newValue);
|
|
31
31
|
}
|
|
32
|
-
return (_jsxs(FieldWrapper, { label: label, name: name, required: required, info: info, description: description, error: error, className: className, children: [_jsxs("div", { className: `
|
|
32
|
+
return (_jsxs(FieldWrapper, { label: label, name: name, required: required, info: info, description: description, error: error, className: className, textSize: textSize, children: [_jsxs("div", { className: `
|
|
33
33
|
flex flex-wrap gap-2 p-2 rounded-md bg-login-500/50 border border-login-500
|
|
34
34
|
text-login-text min-h-10.5
|
|
35
35
|
focus-within:border-login focus-within:ring-1 focus-within:ring-login
|
|
@@ -6,5 +6,6 @@ export type TextareaProps = Omit<React.ComponentProps<'textarea'>, 'name'> & {
|
|
|
6
6
|
info?: string;
|
|
7
7
|
description?: string;
|
|
8
8
|
type?: 'markdown' | 'json' | 'text';
|
|
9
|
+
textSize?: 'sm' | 'md';
|
|
9
10
|
};
|
|
10
11
|
export default function Textarea(props: TextareaProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -13,12 +13,12 @@ function isValidJson(str) {
|
|
|
13
13
|
}
|
|
14
14
|
}
|
|
15
15
|
export default function Textarea(props) {
|
|
16
|
-
const { name, label, error, className, info, description, type = 'text', rows = 4, ...textareaProps } = props;
|
|
16
|
+
const { name, label, error, className, info, description, type = 'text', rows = 4, textSize = 'sm', ...textareaProps } = props;
|
|
17
17
|
const { value } = textareaProps;
|
|
18
18
|
const [preview, setPreview] = useState(false);
|
|
19
19
|
const jsonError = type === 'json' && value ? isValidJson(value) : undefined;
|
|
20
20
|
const displayError = jsonError || error;
|
|
21
|
-
return (_jsx(FieldWrapper, { label: label, name: name, required: textareaProps.required, info: info, description: description, error: displayError, className: className, children: _jsxs("div", { className: 'relative', children: [type === 'markdown' && (_jsx("div", { className: 'absolute right-2 top-2 z-10 flex gap-2', children: _jsx("button", { type: 'button', onClick: () => setPreview(!preview), className: 'p-1 rounded hover:bg-login-500/50 text-login-text transition-colors', title: preview ? 'Edit' : 'Preview', children: preview ? _jsx(Pencil, { size: 16 }) : _jsx(Eye, { size: 16 }) }) })), type === 'markdown' && preview ? (_jsx("div", { className: `
|
|
21
|
+
return (_jsx(FieldWrapper, { label: label, name: name, required: textareaProps.required, info: info, description: description, error: displayError, textSize: textSize, className: className, children: _jsxs("div", { className: 'relative', children: [type === 'markdown' && (_jsx("div", { className: 'absolute right-2 top-2 z-10 flex gap-2', children: _jsx("button", { type: 'button', onClick: () => setPreview(!preview), className: 'p-1 rounded hover:bg-login-500/50 text-login-text transition-colors', title: preview ? 'Edit' : 'Preview', children: preview ? _jsx(Pencil, { size: 16 }) : _jsx(Eye, { size: 16 }) }) })), type === 'markdown' && preview ? (_jsx("div", { className: `
|
|
22
22
|
w-full rounded-md bg-login-500/50 border border-login-500
|
|
23
23
|
text-login-text
|
|
24
24
|
p-3
|
package/dist/src/globals.css
CHANGED
|
@@ -1904,6 +1904,10 @@
|
|
|
1904
1904
|
font-size: var(--text-base);
|
|
1905
1905
|
line-height: var(--tw-leading, var(--text-base--line-height));
|
|
1906
1906
|
}
|
|
1907
|
+
.text-base\! {
|
|
1908
|
+
font-size: var(--text-base) !important;
|
|
1909
|
+
line-height: var(--tw-leading, var(--text-base--line-height)) !important;
|
|
1910
|
+
}
|
|
1907
1911
|
.text-lg {
|
|
1908
1912
|
font-size: var(--text-lg);
|
|
1909
1913
|
line-height: var(--tw-leading, var(--text-lg--line-height));
|
|
@@ -1912,6 +1916,10 @@
|
|
|
1912
1916
|
font-size: var(--text-sm);
|
|
1913
1917
|
line-height: var(--tw-leading, var(--text-sm--line-height));
|
|
1914
1918
|
}
|
|
1919
|
+
.text-sm\! {
|
|
1920
|
+
font-size: var(--text-sm) !important;
|
|
1921
|
+
line-height: var(--tw-leading, var(--text-sm--line-height)) !important;
|
|
1922
|
+
}
|
|
1915
1923
|
.text-xl {
|
|
1916
1924
|
font-size: var(--text-xl);
|
|
1917
1925
|
line-height: var(--tw-leading, var(--text-xl--line-height));
|
package/package.json
CHANGED
|
@@ -13,6 +13,7 @@ type CheckboxItemProps = Omit<React.ComponentProps<'input'>, 'name'> & {
|
|
|
13
13
|
info?: string
|
|
14
14
|
description?: string
|
|
15
15
|
className?: string
|
|
16
|
+
textSize?: 'sm' | 'md'
|
|
16
17
|
}
|
|
17
18
|
|
|
18
19
|
export type CheckboxProps = Omit<React.ComponentProps<'input'>, 'name' | 'onChange' | 'value'> & {
|
|
@@ -25,10 +26,11 @@ export type CheckboxProps = Omit<React.ComponentProps<'input'>, 'name' | 'onChan
|
|
|
25
26
|
options: CheckboxOption[]
|
|
26
27
|
value?: (string | number)[]
|
|
27
28
|
onChange?: (value: (string | number)[]) => void
|
|
29
|
+
textSize?: 'sm' | 'md'
|
|
28
30
|
}
|
|
29
31
|
|
|
30
32
|
export default function Checkbox(props: CheckboxProps) {
|
|
31
|
-
const { options, onChange, value, label, description, error, info, name, className, ...rest } = props
|
|
33
|
+
const { options, onChange, value, label, description, error, info, name, className, textSize = 'sm', ...rest } = props
|
|
32
34
|
const selectedValues = Array.isArray(value) ? value : []
|
|
33
35
|
|
|
34
36
|
return (
|
|
@@ -39,6 +41,7 @@ export default function Checkbox(props: CheckboxProps) {
|
|
|
39
41
|
info={info}
|
|
40
42
|
description={description}
|
|
41
43
|
error={error}
|
|
44
|
+
textSize={textSize}
|
|
42
45
|
className={className}
|
|
43
46
|
>
|
|
44
47
|
<div className='flex flex-col gap-2'>
|
|
@@ -103,6 +106,7 @@ function CheckboxItem(props: CheckboxItemProps) {
|
|
|
103
106
|
<InputLabel
|
|
104
107
|
label={label}
|
|
105
108
|
name={name}
|
|
109
|
+
disabled={inputProps.disabled}
|
|
106
110
|
className='select-none cursor-pointer'
|
|
107
111
|
/>
|
|
108
112
|
)}
|
|
@@ -13,10 +13,11 @@ export type InputProps = Omit<React.ComponentProps<'input'>, 'name'> & {
|
|
|
13
13
|
icon?: JSX.Element
|
|
14
14
|
info?: string
|
|
15
15
|
description?: string
|
|
16
|
+
textSize?: 'sm' | 'md'
|
|
16
17
|
}
|
|
17
18
|
|
|
18
19
|
export default function Input(props: InputProps) {
|
|
19
|
-
const { name, label, error, className, icon, info, description, ...inputProps } = props
|
|
20
|
+
const { name, label, error, className, icon, info, description, textSize = 'sm', ...inputProps } = props
|
|
20
21
|
const { type = 'text', value } = inputProps
|
|
21
22
|
const localRef = useRef<HTMLInputElement>(null)
|
|
22
23
|
const [isOpen, setIsOpen] = useState(false)
|
|
@@ -132,6 +133,7 @@ export default function Input(props: InputProps) {
|
|
|
132
133
|
info={info}
|
|
133
134
|
error={error}
|
|
134
135
|
description={description}
|
|
136
|
+
textSize={textSize}
|
|
135
137
|
className={className}
|
|
136
138
|
>
|
|
137
139
|
<div className='relative flex items-center' ref={containerRef}>
|
|
@@ -12,6 +12,7 @@ type RadioItemProps = Omit<React.ComponentProps<'input'>, 'name'> & {
|
|
|
12
12
|
info?: string
|
|
13
13
|
description?: string
|
|
14
14
|
className?: string
|
|
15
|
+
textSize?: 'sm' | 'md'
|
|
15
16
|
}
|
|
16
17
|
|
|
17
18
|
export type RadioProps = Omit<React.ComponentProps<'input'>, 'name' | 'onChange' | 'value'> & {
|
|
@@ -24,10 +25,11 @@ export type RadioProps = Omit<React.ComponentProps<'input'>, 'name' | 'onChange'
|
|
|
24
25
|
options: RadioOption[]
|
|
25
26
|
value?: string | number | null
|
|
26
27
|
onChange?: (value: string | number) => void
|
|
28
|
+
textSize?: 'sm' | 'md'
|
|
27
29
|
}
|
|
28
30
|
|
|
29
31
|
export default function Radio(props: RadioProps) {
|
|
30
|
-
const { options, onChange, value, label, description, error, info, name, className, ...rest } = props
|
|
32
|
+
const { options, onChange, value, label, description, error, info, name, className, textSize = 'sm', ...rest } = props
|
|
31
33
|
|
|
32
34
|
return (
|
|
33
35
|
<FieldWrapper
|
|
@@ -37,6 +39,7 @@ export default function Radio(props: RadioProps) {
|
|
|
37
39
|
info={info}
|
|
38
40
|
description={description}
|
|
39
41
|
error={error}
|
|
42
|
+
textSize={textSize}
|
|
40
43
|
className={className}
|
|
41
44
|
>
|
|
42
45
|
<div className='flex flex-col gap-2'>
|
|
@@ -92,6 +95,7 @@ function RadioItem(props: RadioItemProps) {
|
|
|
92
95
|
<InputLabel
|
|
93
96
|
label={label}
|
|
94
97
|
name={name}
|
|
98
|
+
disabled={inputProps.disabled}
|
|
95
99
|
className='select-none cursor-pointer'
|
|
96
100
|
/>
|
|
97
101
|
)}
|
|
@@ -8,10 +8,11 @@ export type RangeProps = Omit<React.ComponentProps<'input'>, 'name'> & {
|
|
|
8
8
|
info?: string
|
|
9
9
|
description?: string
|
|
10
10
|
showValue?: boolean
|
|
11
|
+
textSize?: 'sm' | 'md'
|
|
11
12
|
}
|
|
12
13
|
|
|
13
14
|
export default function Range(props: RangeProps) {
|
|
14
|
-
const { name, label, error, className, info, description, showValue = true, ...inputProps } = props
|
|
15
|
+
const { name, label, error, className, info, description, showValue = true, textSize = 'sm', ...inputProps } = props
|
|
15
16
|
const { min = 0, max = 100, step = 1, value = 0 } = inputProps
|
|
16
17
|
|
|
17
18
|
return (
|
|
@@ -22,6 +23,7 @@ export default function Range(props: RangeProps) {
|
|
|
22
23
|
info={info}
|
|
23
24
|
description={description}
|
|
24
25
|
error={error}
|
|
26
|
+
textSize={textSize}
|
|
25
27
|
className={className}
|
|
26
28
|
>
|
|
27
29
|
<div className='flex items-center gap-4'>
|
|
@@ -27,6 +27,7 @@ export type SelectProps = {
|
|
|
27
27
|
description?: string
|
|
28
28
|
clearable?: boolean
|
|
29
29
|
searchable?: boolean
|
|
30
|
+
textSize?: 'sm' | 'md'
|
|
30
31
|
}
|
|
31
32
|
|
|
32
33
|
export default function Select({
|
|
@@ -44,6 +45,7 @@ export default function Select({
|
|
|
44
45
|
description,
|
|
45
46
|
clearable = true,
|
|
46
47
|
searchable = true,
|
|
48
|
+
textSize = 'sm',
|
|
47
49
|
}: SelectProps) {
|
|
48
50
|
const [isOpen, setIsOpen] = useState(false)
|
|
49
51
|
const [searchTerm, setSearchTerm] = useState('')
|
|
@@ -93,6 +95,7 @@ export default function Select({
|
|
|
93
95
|
info={info}
|
|
94
96
|
description={description}
|
|
95
97
|
error={error}
|
|
98
|
+
textSize={textSize}
|
|
96
99
|
className={className}
|
|
97
100
|
>
|
|
98
101
|
<div className='relative' ref={containerRef}>
|
|
@@ -10,6 +10,7 @@ interface FieldWrapperProps {
|
|
|
10
10
|
info?: string
|
|
11
11
|
error?: string
|
|
12
12
|
description?: string
|
|
13
|
+
textSize?: 'sm' | 'md'
|
|
13
14
|
children: ReactNode
|
|
14
15
|
className?: string
|
|
15
16
|
}
|
|
@@ -21,6 +22,7 @@ export default function FieldWrapper({
|
|
|
21
22
|
info,
|
|
22
23
|
error,
|
|
23
24
|
description,
|
|
25
|
+
textSize = 'sm',
|
|
24
26
|
children,
|
|
25
27
|
className,
|
|
26
28
|
}: FieldWrapperProps) {
|
|
@@ -33,7 +35,7 @@ export default function FieldWrapper({
|
|
|
33
35
|
label={label}
|
|
34
36
|
name={name}
|
|
35
37
|
required={required}
|
|
36
|
-
className=
|
|
38
|
+
className={`ml-1 ${textSize === 'sm' ? 'text-sm!' : 'text-base!'}`}
|
|
37
39
|
/>
|
|
38
40
|
)}
|
|
39
41
|
{info && <InputInfo info={info} />}
|
|
@@ -8,10 +8,11 @@ export type SwitchProps = Omit<React.ComponentProps<'input'>, 'name'> & {
|
|
|
8
8
|
description?: string
|
|
9
9
|
className?: string
|
|
10
10
|
switchOnly?: boolean
|
|
11
|
+
textSize?: 'sm' | 'md'
|
|
11
12
|
}
|
|
12
13
|
|
|
13
14
|
export default function Switch(props: SwitchProps) {
|
|
14
|
-
const { name, label, error, info, description, className, switchOnly, ...inputProps } = props
|
|
15
|
+
const { name, label, error, info, description, className, switchOnly, textSize = 'sm', ...inputProps } = props
|
|
15
16
|
|
|
16
17
|
return (
|
|
17
18
|
<FieldWrapper
|
|
@@ -21,6 +22,7 @@ export default function Switch(props: SwitchProps) {
|
|
|
21
22
|
info={info}
|
|
22
23
|
error={error}
|
|
23
24
|
description={description}
|
|
25
|
+
textSize={textSize}
|
|
24
26
|
className={className}
|
|
25
27
|
>
|
|
26
28
|
<label className={`relative inline-flex items-center cursor-pointer ${switchOnly ? 'h-fit' : 'h-10.5'}`}>
|
|
@@ -16,6 +16,7 @@ export type TagInputProps = {
|
|
|
16
16
|
required?: boolean
|
|
17
17
|
info?: string
|
|
18
18
|
description?: string
|
|
19
|
+
textSize?: 'sm' | 'md'
|
|
19
20
|
}
|
|
20
21
|
|
|
21
22
|
export default function TagInput({
|
|
@@ -30,6 +31,7 @@ export default function TagInput({
|
|
|
30
31
|
required,
|
|
31
32
|
info,
|
|
32
33
|
description,
|
|
34
|
+
textSize = 'sm',
|
|
33
35
|
}: TagInputProps) {
|
|
34
36
|
const [inputValue, setInputValue] = useState('')
|
|
35
37
|
|
|
@@ -63,6 +65,7 @@ export default function TagInput({
|
|
|
63
65
|
description={description}
|
|
64
66
|
error={error}
|
|
65
67
|
className={className}
|
|
68
|
+
textSize={textSize}
|
|
66
69
|
>
|
|
67
70
|
<div
|
|
68
71
|
className={`
|
|
@@ -11,6 +11,7 @@ export type TextareaProps = Omit<React.ComponentProps<'textarea'>, 'name'> & {
|
|
|
11
11
|
info?: string
|
|
12
12
|
description?: string
|
|
13
13
|
type?: 'markdown' | 'json' | 'text'
|
|
14
|
+
textSize?: 'sm' | 'md'
|
|
14
15
|
}
|
|
15
16
|
|
|
16
17
|
function isValidJson(str: string): string | null {
|
|
@@ -23,7 +24,7 @@ function isValidJson(str: string): string | null {
|
|
|
23
24
|
}
|
|
24
25
|
|
|
25
26
|
export default function Textarea(props: TextareaProps) {
|
|
26
|
-
const { name, label, error, className, info, description, type = 'text', rows = 4, ...textareaProps } = props
|
|
27
|
+
const { name, label, error, className, info, description, type = 'text', rows = 4, textSize = 'sm', ...textareaProps } = props
|
|
27
28
|
const { value } = textareaProps
|
|
28
29
|
const [preview, setPreview] = useState(false)
|
|
29
30
|
|
|
@@ -38,6 +39,7 @@ export default function Textarea(props: TextareaProps) {
|
|
|
38
39
|
info={info}
|
|
39
40
|
description={description}
|
|
40
41
|
error={displayError}
|
|
42
|
+
textSize={textSize}
|
|
41
43
|
className={className}
|
|
42
44
|
>
|
|
43
45
|
<div className='relative'>
|