smartsell-ui-kit 0.1.4 → 0.1.6
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/index.cjs +92 -47
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +9 -9
- package/dist/index.d.ts +9 -9
- package/dist/index.js +92 -47
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -47,10 +47,10 @@ interface CheckboxProps extends Omit<InputHTMLAttributes<HTMLInputElement>, 'dan
|
|
|
47
47
|
label?: ReactNode;
|
|
48
48
|
hint?: ReactNode;
|
|
49
49
|
error?: ReactNode;
|
|
50
|
-
|
|
50
|
+
size?: ControlSize;
|
|
51
51
|
indeterminate?: boolean;
|
|
52
52
|
}
|
|
53
|
-
declare function Checkbox({ label, hint, error,
|
|
53
|
+
declare function Checkbox({ label, hint, error, size, id, checked, defaultChecked, disabled, indeterminate, required, className, style, onChange, onFocus, onBlur, ...rest }: CheckboxProps): react_jsx_runtime.JSX.Element;
|
|
54
54
|
|
|
55
55
|
interface ModalSlotIds {
|
|
56
56
|
header: string;
|
|
@@ -110,7 +110,7 @@ interface DatePickerProps extends Omit<InputHTMLAttributes<HTMLInputElement>, 'd
|
|
|
110
110
|
label?: ReactNode;
|
|
111
111
|
hint?: ReactNode;
|
|
112
112
|
error?: ReactNode;
|
|
113
|
-
|
|
113
|
+
size?: ControlSize;
|
|
114
114
|
value?: DatePickerValue;
|
|
115
115
|
defaultValue?: DatePickerValue;
|
|
116
116
|
onChange?: (value: string | null, context: DatePickerChangeContext) => void;
|
|
@@ -129,18 +129,18 @@ interface DatePickerProps extends Omit<InputHTMLAttributes<HTMLInputElement>, 'd
|
|
|
129
129
|
pickerButtonLabel?: string;
|
|
130
130
|
clearButtonLabel?: string;
|
|
131
131
|
}
|
|
132
|
-
declare function DatePicker({ label, hint, error,
|
|
132
|
+
declare function DatePicker({ label, hint, error, size, value, defaultValue, onChange, mode, format, allowPastDates, allowFutureDates, minDate, maxDate, minuteStep, clearable, showPickerButton, isDateUnavailable, invalidDateMessage, unavailableDateMessage, pickerButtonLabel, clearButtonLabel, id, name, disabled, readOnly, required, style, className, placeholder, onBlur, onClick, onFocus, onKeyDown, ...rest }: DatePickerProps): react_jsx_runtime.JSX.Element;
|
|
133
133
|
|
|
134
134
|
interface InputProps extends Omit<InputHTMLAttributes<HTMLInputElement>, 'dangerouslySetInnerHTML' | 'size'> {
|
|
135
135
|
label?: ReactNode;
|
|
136
136
|
hint?: ReactNode;
|
|
137
137
|
error?: ReactNode;
|
|
138
|
-
|
|
138
|
+
size?: ControlSize;
|
|
139
139
|
showPasswordToggle?: boolean;
|
|
140
140
|
fileButtonLabel?: ReactNode;
|
|
141
141
|
icon?: ReactNode;
|
|
142
142
|
}
|
|
143
|
-
declare function Input({ label, hint, error,
|
|
143
|
+
declare function Input({ label, hint, error, size, className, showPasswordToggle, fileButtonLabel, icon, id, disabled, placeholder, onChange, style, type, ...rest }: InputProps): react_jsx_runtime.JSX.Element;
|
|
144
144
|
|
|
145
145
|
type ModalActionAppearance = 'text' | 'outlined' | 'contained' | 'link';
|
|
146
146
|
type ModalThemeColors = {
|
|
@@ -208,7 +208,7 @@ interface SharedSelectProps extends Omit<SelectHTMLAttributes<HTMLSelectElement>
|
|
|
208
208
|
hint?: ReactNode;
|
|
209
209
|
error?: ReactNode;
|
|
210
210
|
placeholder?: ReactNode;
|
|
211
|
-
|
|
211
|
+
size?: ControlSize;
|
|
212
212
|
isMulti?: boolean;
|
|
213
213
|
isFilterable?: boolean;
|
|
214
214
|
}
|
|
@@ -367,8 +367,8 @@ interface TextareaProps extends Omit<TextareaHTMLAttributes<HTMLTextAreaElement>
|
|
|
367
367
|
label?: ReactNode;
|
|
368
368
|
hint?: ReactNode;
|
|
369
369
|
error?: ReactNode;
|
|
370
|
-
|
|
370
|
+
size?: ControlSize;
|
|
371
371
|
}
|
|
372
|
-
declare function Textarea({ label, hint, error,
|
|
372
|
+
declare function Textarea({ label, hint, error, size, id, disabled, style, rows, ...rest }: TextareaProps): react_jsx_runtime.JSX.Element;
|
|
373
373
|
|
|
374
374
|
export { Button, type ButtonProps, Card, type CardProps, CardSmall, type CardSmallProps, Checkbox, type CheckboxProps, ComposableModal, type ComposableModalProps, type ComposableModalSlotRenderProps, type ComposableModalSlotRenderer, type ControlSize, DatePicker, type DatePickerChangeContext, type DatePickerChangeReason, type DatePickerMode, type DatePickerProps, type DatePickerValue, Input, type InputProps, Modal, type ModalAction, type ModalProps, type ModalSlotContext, type ModalSlotIds, type ModalTheme, type ModalThemeSource, Select, SelectAsync, type SelectAsyncLoadContext, type SelectAsyncLoadResult, type SelectAsyncOption, type SelectAsyncOptionValue, type SelectAsyncProps, type SelectProps, Separator, type SeparatorOrientation, type SeparatorProps, type SharedTableProps, type StandardModalProps, Table, type TableAction, type TableActionSource, type TableActionTone, TableAsync, type TableAsyncLoadContext, type TableAsyncLoadResult, type TableAsyncProps, type TableColumn, type TableColumnAlign, type TableColumnType, type TableLabels, type TableProps, Textarea, type TextareaProps, type UiKitTheme, createModalSlotIds, useUiKitTheme };
|
package/dist/index.d.ts
CHANGED
|
@@ -47,10 +47,10 @@ interface CheckboxProps extends Omit<InputHTMLAttributes<HTMLInputElement>, 'dan
|
|
|
47
47
|
label?: ReactNode;
|
|
48
48
|
hint?: ReactNode;
|
|
49
49
|
error?: ReactNode;
|
|
50
|
-
|
|
50
|
+
size?: ControlSize;
|
|
51
51
|
indeterminate?: boolean;
|
|
52
52
|
}
|
|
53
|
-
declare function Checkbox({ label, hint, error,
|
|
53
|
+
declare function Checkbox({ label, hint, error, size, id, checked, defaultChecked, disabled, indeterminate, required, className, style, onChange, onFocus, onBlur, ...rest }: CheckboxProps): react_jsx_runtime.JSX.Element;
|
|
54
54
|
|
|
55
55
|
interface ModalSlotIds {
|
|
56
56
|
header: string;
|
|
@@ -110,7 +110,7 @@ interface DatePickerProps extends Omit<InputHTMLAttributes<HTMLInputElement>, 'd
|
|
|
110
110
|
label?: ReactNode;
|
|
111
111
|
hint?: ReactNode;
|
|
112
112
|
error?: ReactNode;
|
|
113
|
-
|
|
113
|
+
size?: ControlSize;
|
|
114
114
|
value?: DatePickerValue;
|
|
115
115
|
defaultValue?: DatePickerValue;
|
|
116
116
|
onChange?: (value: string | null, context: DatePickerChangeContext) => void;
|
|
@@ -129,18 +129,18 @@ interface DatePickerProps extends Omit<InputHTMLAttributes<HTMLInputElement>, 'd
|
|
|
129
129
|
pickerButtonLabel?: string;
|
|
130
130
|
clearButtonLabel?: string;
|
|
131
131
|
}
|
|
132
|
-
declare function DatePicker({ label, hint, error,
|
|
132
|
+
declare function DatePicker({ label, hint, error, size, value, defaultValue, onChange, mode, format, allowPastDates, allowFutureDates, minDate, maxDate, minuteStep, clearable, showPickerButton, isDateUnavailable, invalidDateMessage, unavailableDateMessage, pickerButtonLabel, clearButtonLabel, id, name, disabled, readOnly, required, style, className, placeholder, onBlur, onClick, onFocus, onKeyDown, ...rest }: DatePickerProps): react_jsx_runtime.JSX.Element;
|
|
133
133
|
|
|
134
134
|
interface InputProps extends Omit<InputHTMLAttributes<HTMLInputElement>, 'dangerouslySetInnerHTML' | 'size'> {
|
|
135
135
|
label?: ReactNode;
|
|
136
136
|
hint?: ReactNode;
|
|
137
137
|
error?: ReactNode;
|
|
138
|
-
|
|
138
|
+
size?: ControlSize;
|
|
139
139
|
showPasswordToggle?: boolean;
|
|
140
140
|
fileButtonLabel?: ReactNode;
|
|
141
141
|
icon?: ReactNode;
|
|
142
142
|
}
|
|
143
|
-
declare function Input({ label, hint, error,
|
|
143
|
+
declare function Input({ label, hint, error, size, className, showPasswordToggle, fileButtonLabel, icon, id, disabled, placeholder, onChange, style, type, ...rest }: InputProps): react_jsx_runtime.JSX.Element;
|
|
144
144
|
|
|
145
145
|
type ModalActionAppearance = 'text' | 'outlined' | 'contained' | 'link';
|
|
146
146
|
type ModalThemeColors = {
|
|
@@ -208,7 +208,7 @@ interface SharedSelectProps extends Omit<SelectHTMLAttributes<HTMLSelectElement>
|
|
|
208
208
|
hint?: ReactNode;
|
|
209
209
|
error?: ReactNode;
|
|
210
210
|
placeholder?: ReactNode;
|
|
211
|
-
|
|
211
|
+
size?: ControlSize;
|
|
212
212
|
isMulti?: boolean;
|
|
213
213
|
isFilterable?: boolean;
|
|
214
214
|
}
|
|
@@ -367,8 +367,8 @@ interface TextareaProps extends Omit<TextareaHTMLAttributes<HTMLTextAreaElement>
|
|
|
367
367
|
label?: ReactNode;
|
|
368
368
|
hint?: ReactNode;
|
|
369
369
|
error?: ReactNode;
|
|
370
|
-
|
|
370
|
+
size?: ControlSize;
|
|
371
371
|
}
|
|
372
|
-
declare function Textarea({ label, hint, error,
|
|
372
|
+
declare function Textarea({ label, hint, error, size, id, disabled, style, rows, ...rest }: TextareaProps): react_jsx_runtime.JSX.Element;
|
|
373
373
|
|
|
374
374
|
export { Button, type ButtonProps, Card, type CardProps, CardSmall, type CardSmallProps, Checkbox, type CheckboxProps, ComposableModal, type ComposableModalProps, type ComposableModalSlotRenderProps, type ComposableModalSlotRenderer, type ControlSize, DatePicker, type DatePickerChangeContext, type DatePickerChangeReason, type DatePickerMode, type DatePickerProps, type DatePickerValue, Input, type InputProps, Modal, type ModalAction, type ModalProps, type ModalSlotContext, type ModalSlotIds, type ModalTheme, type ModalThemeSource, Select, SelectAsync, type SelectAsyncLoadContext, type SelectAsyncLoadResult, type SelectAsyncOption, type SelectAsyncOptionValue, type SelectAsyncProps, type SelectProps, Separator, type SeparatorOrientation, type SeparatorProps, type SharedTableProps, type StandardModalProps, Table, type TableAction, type TableActionSource, type TableActionTone, TableAsync, type TableAsyncLoadContext, type TableAsyncLoadResult, type TableAsyncProps, type TableColumn, type TableColumnAlign, type TableColumnType, type TableLabels, type TableProps, Textarea, type TextareaProps, type UiKitTheme, createModalSlotIds, useUiKitTheme };
|
package/dist/index.js
CHANGED
|
@@ -114,6 +114,16 @@ var DISABLED_FIELD_OPACITY = 0.7;
|
|
|
114
114
|
|
|
115
115
|
// src/foundation/controlSize.ts
|
|
116
116
|
var CONTROL_LEADING_ICON_SHIFT = 5;
|
|
117
|
+
var CONTROL_TEXT_VERTICAL_SHIFT = 1;
|
|
118
|
+
var SELECT_TEXT_VERTICAL_SHIFT_REDUCTION = 1;
|
|
119
|
+
var getControlTextVerticalPadding = (size, shift = CONTROL_TEXT_VERTICAL_SHIFT) => {
|
|
120
|
+
const metrics = getControlMetrics(size);
|
|
121
|
+
return {
|
|
122
|
+
top: Math.max(0, metrics.paddingY - shift),
|
|
123
|
+
bottom: metrics.paddingY + shift
|
|
124
|
+
};
|
|
125
|
+
};
|
|
126
|
+
var getSelectTextVerticalShift = () => Math.max(0, CONTROL_TEXT_VERTICAL_SHIFT - SELECT_TEXT_VERTICAL_SHIFT_REDUCTION);
|
|
117
127
|
var CONTROL_METRICS_BY_SIZE = {
|
|
118
128
|
sm: {
|
|
119
129
|
height: 30,
|
|
@@ -154,6 +164,23 @@ var getControlLeadingIconInset = (size) => {
|
|
|
154
164
|
var getControlLeadingAdornmentWidth = (size, iconSize) => {
|
|
155
165
|
return getControlLeadingIconInset(size) + iconSize;
|
|
156
166
|
};
|
|
167
|
+
var getTextInputPadding = (size, options = {}) => {
|
|
168
|
+
var _a, _b;
|
|
169
|
+
const metrics = getControlMetrics(size);
|
|
170
|
+
const { top, bottom } = getControlTextVerticalPadding(size);
|
|
171
|
+
const leadingPadding = (_a = options.leadingPadding) != null ? _a : metrics.paddingX;
|
|
172
|
+
const trailingPadding = (_b = options.trailingPadding) != null ? _b : metrics.paddingX;
|
|
173
|
+
return `${top}px ${trailingPadding}px ${bottom}px ${leadingPadding}px`;
|
|
174
|
+
};
|
|
175
|
+
var getSelectControlPadding = (size) => {
|
|
176
|
+
const metrics = getControlMetrics(size);
|
|
177
|
+
const { top, bottom } = getControlTextVerticalPadding(size, getSelectTextVerticalShift());
|
|
178
|
+
return `${top}px ${metrics.selectPaddingRight}px ${bottom}px ${metrics.paddingX}px`;
|
|
179
|
+
};
|
|
180
|
+
var getControlTextNudgeStyle = (shift = CONTROL_TEXT_VERTICAL_SHIFT) => ({
|
|
181
|
+
transform: `translateY(-${shift}px)`
|
|
182
|
+
});
|
|
183
|
+
var getSelectTextNudgeStyle = () => getControlTextNudgeStyle(getSelectTextVerticalShift());
|
|
157
184
|
var getSelectIndicatorOffset = (size) => getControlMetrics(size).selectIndicatorOffset;
|
|
158
185
|
|
|
159
186
|
// src/foundation/shadow.ts
|
|
@@ -484,7 +511,7 @@ function CardSmall({
|
|
|
484
511
|
// src/components/Checkbox.tsx
|
|
485
512
|
import { useEffect as useEffect2, useId, useRef, useState } from "react";
|
|
486
513
|
import { jsx as jsx3, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
487
|
-
var
|
|
514
|
+
var CHECKBOX_SIZE_BY_SIZE = {
|
|
488
515
|
sm: 14,
|
|
489
516
|
md: 16,
|
|
490
517
|
lg: 20
|
|
@@ -494,7 +521,7 @@ var CHECKBOX_LABEL_CLASSNAMES = {
|
|
|
494
521
|
md: "text-sm leading-[18px]",
|
|
495
522
|
lg: "text-[15px] leading-[18px]"
|
|
496
523
|
};
|
|
497
|
-
var getCheckboxSize = (
|
|
524
|
+
var getCheckboxSize = (size) => CHECKBOX_SIZE_BY_SIZE[size];
|
|
498
525
|
var hasNodeContent = (value) => {
|
|
499
526
|
if (Array.isArray(value)) {
|
|
500
527
|
return value.some(hasNodeContent);
|
|
@@ -566,7 +593,7 @@ function Checkbox({
|
|
|
566
593
|
label,
|
|
567
594
|
hint,
|
|
568
595
|
error,
|
|
569
|
-
|
|
596
|
+
size = "sm",
|
|
570
597
|
id,
|
|
571
598
|
checked,
|
|
572
599
|
defaultChecked,
|
|
@@ -582,7 +609,7 @@ function Checkbox({
|
|
|
582
609
|
}) {
|
|
583
610
|
const theme = useUiKitTheme();
|
|
584
611
|
const mutedText = theme.colors.textLight;
|
|
585
|
-
const indicatorSize = getCheckboxSize(
|
|
612
|
+
const indicatorSize = getCheckboxSize(size);
|
|
586
613
|
const hasLabel = hasNodeContent(label);
|
|
587
614
|
const hasHint = hasNodeContent(hint);
|
|
588
615
|
const hasError = hasNodeContent(error);
|
|
@@ -676,7 +703,7 @@ function Checkbox({
|
|
|
676
703
|
hasSecondaryContent ? "justify-start" : "justify-center"
|
|
677
704
|
),
|
|
678
705
|
children: [
|
|
679
|
-
label ? /* @__PURE__ */ jsxs4("span", { className: cx("font-semibold text-[var(--theme-text)]", CHECKBOX_LABEL_CLASSNAMES[
|
|
706
|
+
label ? /* @__PURE__ */ jsxs4("span", { className: cx("font-semibold text-[var(--theme-text)]", CHECKBOX_LABEL_CLASSNAMES[size]), children: [
|
|
680
707
|
label,
|
|
681
708
|
required ? /* @__PURE__ */ jsx3("span", { className: "ml-1 text-[var(--theme-negative)]", children: "*" }) : null
|
|
682
709
|
] }) : null,
|
|
@@ -1525,7 +1552,7 @@ function Input({
|
|
|
1525
1552
|
label,
|
|
1526
1553
|
hint,
|
|
1527
1554
|
error,
|
|
1528
|
-
|
|
1555
|
+
size = "sm",
|
|
1529
1556
|
className,
|
|
1530
1557
|
showPasswordToggle = true,
|
|
1531
1558
|
fileButtonLabel,
|
|
@@ -1539,8 +1566,8 @@ function Input({
|
|
|
1539
1566
|
...rest
|
|
1540
1567
|
}) {
|
|
1541
1568
|
useUiKitTheme();
|
|
1542
|
-
const controlMetrics = getControlMetrics(
|
|
1543
|
-
const passwordToggleMetrics = getPasswordToggleMetrics(
|
|
1569
|
+
const controlMetrics = getControlMetrics(size);
|
|
1570
|
+
const passwordToggleMetrics = getPasswordToggleMetrics(size);
|
|
1544
1571
|
const generatedId = useId2();
|
|
1545
1572
|
const inputId = id != null ? id : generatedId;
|
|
1546
1573
|
const fileInputRef = useRef2(null);
|
|
@@ -1574,15 +1601,16 @@ function Input({
|
|
|
1574
1601
|
const showUploadLabel = hasFileButtonLabel && !hasSelectedFiles;
|
|
1575
1602
|
const passwordLockIconSize = passwordToggleMetrics.iconSize + 2;
|
|
1576
1603
|
const leadingContentGap = Math.max(0, Math.round(controlMetrics.paddingX / 3));
|
|
1577
|
-
const leadingIconInset = getControlLeadingIconInset(
|
|
1604
|
+
const leadingIconInset = getControlLeadingIconInset(size);
|
|
1605
|
+
const controlTextNudgeStyle = getControlTextNudgeStyle();
|
|
1578
1606
|
const hasExternalError = error !== void 0 && error !== null && error !== "";
|
|
1579
1607
|
const resolvedError = hasExternalError ? error : validationError;
|
|
1580
1608
|
const hasResolvedError = resolvedError !== void 0 && resolvedError !== null && resolvedError !== "";
|
|
1581
1609
|
const fileSelectionText = selectedFileNames.length === 0 ? placeholder != null ? placeholder : "" : selectedFileNames.length === 1 ? selectedFileNames[0] : `${selectedFileNames.length} files selected`;
|
|
1582
1610
|
const fileIconSize = Math.max(controlMetrics.fontSize + 3, 16);
|
|
1583
|
-
const fileTriggerWidth = getControlLeadingAdornmentWidth(
|
|
1584
|
-
const leadingAdornmentWidth = getControlLeadingAdornmentWidth(
|
|
1585
|
-
const passwordAdornmentWidth = getControlLeadingAdornmentWidth(
|
|
1611
|
+
const fileTriggerWidth = getControlLeadingAdornmentWidth(size, fileIconSize);
|
|
1612
|
+
const leadingAdornmentWidth = getControlLeadingAdornmentWidth(size, fileIconSize);
|
|
1613
|
+
const passwordAdornmentWidth = getControlLeadingAdornmentWidth(size, passwordLockIconSize);
|
|
1586
1614
|
const defaultLeadingIcon = isEmailField ? /* @__PURE__ */ jsx6(EmailIcon, { size: fileIconSize }) : isLoginField ? /* @__PURE__ */ jsx6(LoginIcon, { size: fileIconSize }) : null;
|
|
1587
1615
|
const resolvedLeadingIcon = icon != null ? icon : defaultLeadingIcon;
|
|
1588
1616
|
const hasLeadingIcon = isRenderableNode(resolvedLeadingIcon);
|
|
@@ -1593,8 +1621,8 @@ function Input({
|
|
|
1593
1621
|
"w-full box-border rounded-2xl border border-solid bg-[var(--theme-surface)]",
|
|
1594
1622
|
"text-[var(--theme-text)] outline-none transition-[border-color,box-shadow,background-color]",
|
|
1595
1623
|
"duration-150 placeholder:text-[var(--theme-textLight)]",
|
|
1596
|
-
FIELD_HEIGHT_CLASSNAMES[
|
|
1597
|
-
FIELD_TEXT_CLASSNAMES[
|
|
1624
|
+
FIELD_HEIGHT_CLASSNAMES[size],
|
|
1625
|
+
FIELD_TEXT_CLASSNAMES[size],
|
|
1598
1626
|
hasResolvedError ? "border-[var(--theme-negative)]" : "border-[var(--theme-textLight)]",
|
|
1599
1627
|
disabled ? "cursor-not-allowed opacity-70" : "cursor-text"
|
|
1600
1628
|
);
|
|
@@ -1604,15 +1632,15 @@ function Input({
|
|
|
1604
1632
|
"border border-solid bg-[var(--theme-surface)] text-[var(--theme-text)] text-left",
|
|
1605
1633
|
"transition-[border-color,box-shadow,background-color] duration-150",
|
|
1606
1634
|
"shadow-[0px_4px_5px_var(--theme-shadow)]",
|
|
1607
|
-
FIELD_HEIGHT_CLASSNAMES[
|
|
1608
|
-
FIELD_TEXT_CLASSNAMES[
|
|
1635
|
+
FIELD_HEIGHT_CLASSNAMES[size],
|
|
1636
|
+
FIELD_TEXT_CLASSNAMES[size],
|
|
1609
1637
|
hasResolvedError ? "border-[var(--theme-negative)]" : "border-[var(--theme-textLight)]",
|
|
1610
1638
|
disabled ? "opacity-70" : null
|
|
1611
1639
|
);
|
|
1612
1640
|
const adornedInputClassName = cx(
|
|
1613
1641
|
"h-full min-w-0 flex-1 border-0 bg-transparent text-[var(--theme-text)] outline-none",
|
|
1614
1642
|
"placeholder:text-[var(--theme-textLight)]",
|
|
1615
|
-
FIELD_TEXT_CLASSNAMES[
|
|
1643
|
+
FIELD_TEXT_CLASSNAMES[size],
|
|
1616
1644
|
disabled ? "cursor-not-allowed" : "cursor-text"
|
|
1617
1645
|
);
|
|
1618
1646
|
const adornmentColorClassName = hasResolvedError ? "text-[var(--theme-negative)]" : "text-[var(--theme-textLight)]";
|
|
@@ -1676,7 +1704,7 @@ function Input({
|
|
|
1676
1704
|
className: cx(
|
|
1677
1705
|
"inline-flex shrink-0 self-stretch whitespace-nowrap border-0 bg-transparent",
|
|
1678
1706
|
"items-center text-[var(--theme-text)] appearance-none",
|
|
1679
|
-
FIELD_TEXT_CLASSNAMES[
|
|
1707
|
+
FIELD_TEXT_CLASSNAMES[size],
|
|
1680
1708
|
disabled ? "cursor-not-allowed" : "cursor-pointer",
|
|
1681
1709
|
showUploadLabel ? "justify-start font-bold" : "justify-center"
|
|
1682
1710
|
),
|
|
@@ -1702,7 +1730,7 @@ function Input({
|
|
|
1702
1730
|
children: resolvedFileIcon
|
|
1703
1731
|
}
|
|
1704
1732
|
),
|
|
1705
|
-
showUploadLabel ? fileButtonLabel : null
|
|
1733
|
+
showUploadLabel ? /* @__PURE__ */ jsx6("span", { style: controlTextNudgeStyle, children: fileButtonLabel }) : null
|
|
1706
1734
|
]
|
|
1707
1735
|
}
|
|
1708
1736
|
),
|
|
@@ -1724,10 +1752,13 @@ function Input({
|
|
|
1724
1752
|
{
|
|
1725
1753
|
className: cx(
|
|
1726
1754
|
"flex h-full min-w-0 flex-1 items-center overflow-hidden text-ellipsis whitespace-nowrap",
|
|
1727
|
-
FIELD_TEXT_CLASSNAMES[
|
|
1755
|
+
FIELD_TEXT_CLASSNAMES[size],
|
|
1728
1756
|
hasSelectedFiles ? "text-[var(--theme-text)]" : "text-[var(--theme-textLight)]"
|
|
1729
1757
|
),
|
|
1730
|
-
style: {
|
|
1758
|
+
style: {
|
|
1759
|
+
padding: `0 ${controlMetrics.paddingX}px 0 ${leadingContentGap}px`,
|
|
1760
|
+
...controlTextNudgeStyle
|
|
1761
|
+
},
|
|
1731
1762
|
children: fileSelectionText
|
|
1732
1763
|
}
|
|
1733
1764
|
) : null
|
|
@@ -1781,7 +1812,9 @@ function Input({
|
|
|
1781
1812
|
onChange: handleValidatedInputChange,
|
|
1782
1813
|
className: cx(adornedInputClassName, className),
|
|
1783
1814
|
"aria-invalid": hasResolvedError,
|
|
1784
|
-
style: {
|
|
1815
|
+
style: {
|
|
1816
|
+
padding: getTextInputPadding(size, { leadingPadding: leadingContentGap })
|
|
1817
|
+
}
|
|
1785
1818
|
}
|
|
1786
1819
|
)
|
|
1787
1820
|
]
|
|
@@ -1820,7 +1853,9 @@ function Input({
|
|
|
1820
1853
|
onChange: handleValidatedInputChange,
|
|
1821
1854
|
className: cx(adornedInputClassName, className),
|
|
1822
1855
|
"aria-invalid": hasResolvedError,
|
|
1823
|
-
style: {
|
|
1856
|
+
style: {
|
|
1857
|
+
padding: getTextInputPadding(size, { leadingPadding: leadingContentGap })
|
|
1858
|
+
}
|
|
1824
1859
|
}
|
|
1825
1860
|
)
|
|
1826
1861
|
]
|
|
@@ -1835,8 +1870,12 @@ function Input({
|
|
|
1835
1870
|
disabled,
|
|
1836
1871
|
onChange: handleValidatedInputChange,
|
|
1837
1872
|
"aria-invalid": hasResolvedError,
|
|
1838
|
-
className: cx(fieldBaseClassName, FIELD_PADDING_X_CLASSNAMES[
|
|
1839
|
-
style: {
|
|
1873
|
+
className: cx(fieldBaseClassName, FIELD_PADDING_X_CLASSNAMES[size], className),
|
|
1874
|
+
style: {
|
|
1875
|
+
boxShadow: "0px 4px 5px var(--theme-shadow)",
|
|
1876
|
+
padding: getTextInputPadding(size),
|
|
1877
|
+
...style
|
|
1878
|
+
}
|
|
1840
1879
|
}
|
|
1841
1880
|
);
|
|
1842
1881
|
return /* @__PURE__ */ jsx6(
|
|
@@ -2081,7 +2120,7 @@ function DatePicker({
|
|
|
2081
2120
|
label,
|
|
2082
2121
|
hint,
|
|
2083
2122
|
error,
|
|
2084
|
-
|
|
2123
|
+
size = "sm",
|
|
2085
2124
|
value,
|
|
2086
2125
|
defaultValue,
|
|
2087
2126
|
onChange,
|
|
@@ -2115,8 +2154,8 @@ function DatePicker({
|
|
|
2115
2154
|
}) {
|
|
2116
2155
|
var _a;
|
|
2117
2156
|
useUiKitTheme();
|
|
2118
|
-
const controlMetrics = getControlMetrics(
|
|
2119
|
-
const accessoryMetrics = ACCESSORY_METRICS_BY_SIZE[
|
|
2157
|
+
const controlMetrics = getControlMetrics(size);
|
|
2158
|
+
const accessoryMetrics = ACCESSORY_METRICS_BY_SIZE[size];
|
|
2120
2159
|
const generatedIdRef = useRef3();
|
|
2121
2160
|
const visibleInputRef = useRef3(null);
|
|
2122
2161
|
const nativeInputRef = useRef3(null);
|
|
@@ -2174,8 +2213,8 @@ function DatePicker({
|
|
|
2174
2213
|
const canOpenPicker = !disabled && !readOnly && !hasConfigurationConflict;
|
|
2175
2214
|
const canClear = clearable && !disabled && !readOnly && !required && hasAnyValue;
|
|
2176
2215
|
const leadingContentGap = Math.max(0, Math.round(controlMetrics.paddingX / 3));
|
|
2177
|
-
const leadingIconInset = getControlLeadingIconInset(
|
|
2178
|
-
const pickerAdornmentWidth = getControlLeadingAdornmentWidth(
|
|
2216
|
+
const leadingIconInset = getControlLeadingIconInset(size);
|
|
2217
|
+
const pickerAdornmentWidth = getControlLeadingAdornmentWidth(size, accessoryMetrics.iconSize);
|
|
2179
2218
|
const trailingButtonCount = Number(canClear);
|
|
2180
2219
|
const trailingInset = trailingButtonCount > 0 ? Math.max(
|
|
2181
2220
|
0,
|
|
@@ -2187,8 +2226,8 @@ function DatePicker({
|
|
|
2187
2226
|
"w-full box-border rounded-2xl border border-solid bg-[var(--theme-surface)]",
|
|
2188
2227
|
"text-[var(--theme-text)] outline-none transition-[border-color,box-shadow,background-color]",
|
|
2189
2228
|
"duration-150 placeholder:text-[var(--theme-textLight)]",
|
|
2190
|
-
FIELD_HEIGHT_CLASSNAMES2[
|
|
2191
|
-
FIELD_TEXT_CLASSNAMES2[
|
|
2229
|
+
FIELD_HEIGHT_CLASSNAMES2[size],
|
|
2230
|
+
FIELD_TEXT_CLASSNAMES2[size],
|
|
2192
2231
|
resolvedError ? "border-[var(--theme-negative)]" : "border-[var(--theme-textLight)]",
|
|
2193
2232
|
disabled ? "cursor-not-allowed" : readOnly ? "cursor-default" : "cursor-text"
|
|
2194
2233
|
);
|
|
@@ -2196,15 +2235,15 @@ function DatePicker({
|
|
|
2196
2235
|
"box-border flex w-full items-center gap-0 overflow-hidden rounded-2xl",
|
|
2197
2236
|
"bg-[var(--theme-surface)] text-[var(--theme-text)]",
|
|
2198
2237
|
"transition-[border-color,box-shadow,background-color] duration-150",
|
|
2199
|
-
FIELD_HEIGHT_CLASSNAMES2[
|
|
2200
|
-
FIELD_TEXT_CLASSNAMES2[
|
|
2238
|
+
FIELD_HEIGHT_CLASSNAMES2[size],
|
|
2239
|
+
FIELD_TEXT_CLASSNAMES2[size],
|
|
2201
2240
|
disabled ? "cursor-not-allowed" : readOnly ? "cursor-default" : "cursor-text"
|
|
2202
2241
|
);
|
|
2203
2242
|
const integratedFieldBoxShadow = getInsetBorderShadow(fieldBorderColor, resolvedError ? { outerShadow: "0 0 0 3px var(--theme-negative)", componentShadow: "0px 4px 5px var(--theme-shadow)" } : { componentShadow: "0px 4px 5px var(--theme-shadow)" });
|
|
2204
2243
|
const integratedInputClassName = cx(
|
|
2205
2244
|
"h-full w-full box-border border-0 bg-transparent text-[var(--theme-text)]",
|
|
2206
2245
|
"outline-none placeholder:text-[var(--theme-textLight)]",
|
|
2207
|
-
FIELD_TEXT_CLASSNAMES2[
|
|
2246
|
+
FIELD_TEXT_CLASSNAMES2[size],
|
|
2208
2247
|
disabled ? "cursor-not-allowed" : readOnly ? "cursor-default" : "cursor-text"
|
|
2209
2248
|
);
|
|
2210
2249
|
const pickerAdornmentClassName = cx(
|
|
@@ -2449,7 +2488,10 @@ function DatePicker({
|
|
|
2449
2488
|
...visibleInputProps,
|
|
2450
2489
|
className: cx(integratedInputClassName, className),
|
|
2451
2490
|
style: {
|
|
2452
|
-
padding:
|
|
2491
|
+
padding: getTextInputPadding(size, {
|
|
2492
|
+
leadingPadding: leadingContentGap,
|
|
2493
|
+
trailingPadding: controlMetrics.paddingX + trailingInset
|
|
2494
|
+
})
|
|
2453
2495
|
}
|
|
2454
2496
|
}
|
|
2455
2497
|
),
|
|
@@ -2463,9 +2505,11 @@ function DatePicker({
|
|
|
2463
2505
|
"input",
|
|
2464
2506
|
{
|
|
2465
2507
|
...visibleInputProps,
|
|
2466
|
-
className: cx(fieldBaseClassName, FIELD_PADDING_X_CLASSNAMES2[
|
|
2508
|
+
className: cx(fieldBaseClassName, FIELD_PADDING_X_CLASSNAMES2[size], className),
|
|
2467
2509
|
style: {
|
|
2468
|
-
|
|
2510
|
+
padding: getTextInputPadding(size, {
|
|
2511
|
+
trailingPadding: controlMetrics.paddingX + trailingInset
|
|
2512
|
+
}),
|
|
2469
2513
|
boxShadow: resolvedError ? "0 0 0 3px var(--theme-negative), 0px 4px 5px var(--theme-shadow)" : "0px 4px 5px var(--theme-shadow)",
|
|
2470
2514
|
...style,
|
|
2471
2515
|
...disabledFieldStyle
|
|
@@ -2600,7 +2644,7 @@ function SelectBase({
|
|
|
2600
2644
|
hint,
|
|
2601
2645
|
error,
|
|
2602
2646
|
placeholder,
|
|
2603
|
-
|
|
2647
|
+
size = "sm",
|
|
2604
2648
|
id,
|
|
2605
2649
|
disabled,
|
|
2606
2650
|
style,
|
|
@@ -2673,8 +2717,8 @@ function SelectBase({
|
|
|
2673
2717
|
const visibleEnabledValues = visibleEnabledOptions.map((option) => option.value);
|
|
2674
2718
|
const selectedValuesKey = selectedValues.join("\0");
|
|
2675
2719
|
const visibleEnabledValuesKey = visibleEnabledValues.join("\0");
|
|
2676
|
-
const indicatorOffset = getSelectIndicatorOffset(
|
|
2677
|
-
const
|
|
2720
|
+
const indicatorOffset = getSelectIndicatorOffset(size);
|
|
2721
|
+
const controlTextNudgeStyle = getSelectTextNudgeStyle();
|
|
2678
2722
|
const listboxId = `${resolvedId}-listbox`;
|
|
2679
2723
|
const searchInputId = `${resolvedId}-search`;
|
|
2680
2724
|
const scrollbarThumbColor = theme.colors.secondary;
|
|
@@ -2693,8 +2737,8 @@ function SelectBase({
|
|
|
2693
2737
|
"m-0 box-border flex w-full min-w-0 items-center justify-between gap-3 rounded-2xl border-0 appearance-none",
|
|
2694
2738
|
"bg-[var(--theme-surface)] outline-none transition-[border-color,box-shadow,background-color]",
|
|
2695
2739
|
"duration-150 text-left",
|
|
2696
|
-
FIELD_HEIGHT_CLASSNAMES3[
|
|
2697
|
-
FIELD_TEXT_CLASSNAMES3[
|
|
2740
|
+
FIELD_HEIGHT_CLASSNAMES3[size],
|
|
2741
|
+
FIELD_TEXT_CLASSNAMES3[size],
|
|
2698
2742
|
hasSelection ? "text-[var(--theme-text)]" : "text-[var(--theme-textLight)]",
|
|
2699
2743
|
isTriggerDisabled ? "cursor-not-allowed" : "cursor-pointer"
|
|
2700
2744
|
);
|
|
@@ -3084,7 +3128,7 @@ function SelectBase({
|
|
|
3084
3128
|
onBlur: handleTriggerBlur,
|
|
3085
3129
|
onKeyDown: handleTriggerKeyDown,
|
|
3086
3130
|
style: {
|
|
3087
|
-
padding:
|
|
3131
|
+
padding: getSelectControlPadding(size),
|
|
3088
3132
|
boxShadow: triggerBoxShadow,
|
|
3089
3133
|
...style,
|
|
3090
3134
|
...isTriggerDisabled ? { opacity: DISABLED_FIELD_OPACITY } : {}
|
|
@@ -3094,6 +3138,7 @@ function SelectBase({
|
|
|
3094
3138
|
"span",
|
|
3095
3139
|
{
|
|
3096
3140
|
className: "block min-w-0 flex-1 overflow-hidden text-ellipsis whitespace-nowrap",
|
|
3141
|
+
style: controlTextNudgeStyle,
|
|
3097
3142
|
children: displayContent
|
|
3098
3143
|
}
|
|
3099
3144
|
),
|
|
@@ -3290,7 +3335,7 @@ function SelectBase({
|
|
|
3290
3335
|
className: cx(
|
|
3291
3336
|
"flex w-full min-w-0 items-center justify-between gap-3 rounded-xl box-border",
|
|
3292
3337
|
"transition-[background-color,color] duration-150",
|
|
3293
|
-
OPTION_PADDING_CLASSNAMES[
|
|
3338
|
+
OPTION_PADDING_CLASSNAMES[size],
|
|
3294
3339
|
option.disabled ? "cursor-not-allowed text-[var(--theme-secondary)]" : "cursor-pointer",
|
|
3295
3340
|
!option.disabled && isActive ? "text-[var(--theme-onPrimary)]" : null,
|
|
3296
3341
|
!option.disabled && !isActive ? "text-[var(--theme-text)]" : null,
|
|
@@ -5229,7 +5274,7 @@ function Textarea({
|
|
|
5229
5274
|
label,
|
|
5230
5275
|
hint,
|
|
5231
5276
|
error,
|
|
5232
|
-
|
|
5277
|
+
size = "sm",
|
|
5233
5278
|
id,
|
|
5234
5279
|
disabled,
|
|
5235
5280
|
style,
|
|
@@ -5250,7 +5295,7 @@ function Textarea({
|
|
|
5250
5295
|
"duration-150 placeholder:opacity-100 disabled:cursor-not-allowed",
|
|
5251
5296
|
"placeholder:text-[var(--theme-textLight)]",
|
|
5252
5297
|
error ? "border-[var(--theme-negative)]" : "border-[var(--theme-textLight)]",
|
|
5253
|
-
TEXTAREA_SIZE_CLASSNAMES[
|
|
5298
|
+
TEXTAREA_SIZE_CLASSNAMES[size]
|
|
5254
5299
|
),
|
|
5255
5300
|
style: {
|
|
5256
5301
|
boxShadow: error ? "0 0 0 3px var(--theme-negative), 0px 4px 5px var(--theme-shadow)" : "0px 4px 5px var(--theme-shadow)",
|