smartsell-ui-kit 0.1.5 → 0.1.7
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 +56 -71
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +14 -9
- package/dist/index.d.ts +14 -9
- package/dist/index.js +56 -71
- package/dist/index.js.map +1 -1
- package/package.json +5 -5
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
|
}
|
|
@@ -320,6 +320,11 @@ interface SharedTableProps<TItem> {
|
|
|
320
320
|
actions?: TableActionSource<TItem>;
|
|
321
321
|
stickyActionsColumn?: boolean;
|
|
322
322
|
maxInlineActions?: number;
|
|
323
|
+
/**
|
|
324
|
+
* Viewport width (in px) below which the table switches from the desktop
|
|
325
|
+
* table layout to the stacked mobile card layout. Defaults to 768 so the
|
|
326
|
+
* table collapses in sync with the host app's mobile breakpoint.
|
|
327
|
+
*/
|
|
323
328
|
collapseBelow?: number;
|
|
324
329
|
searchable?: boolean;
|
|
325
330
|
showSearch?: boolean;
|
|
@@ -367,8 +372,8 @@ interface TextareaProps extends Omit<TextareaHTMLAttributes<HTMLTextAreaElement>
|
|
|
367
372
|
label?: ReactNode;
|
|
368
373
|
hint?: ReactNode;
|
|
369
374
|
error?: ReactNode;
|
|
370
|
-
|
|
375
|
+
size?: ControlSize;
|
|
371
376
|
}
|
|
372
|
-
declare function Textarea({ label, hint, error,
|
|
377
|
+
declare function Textarea({ label, hint, error, size, id, disabled, style, rows, ...rest }: TextareaProps): react_jsx_runtime.JSX.Element;
|
|
373
378
|
|
|
374
379
|
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
|
}
|
|
@@ -320,6 +320,11 @@ interface SharedTableProps<TItem> {
|
|
|
320
320
|
actions?: TableActionSource<TItem>;
|
|
321
321
|
stickyActionsColumn?: boolean;
|
|
322
322
|
maxInlineActions?: number;
|
|
323
|
+
/**
|
|
324
|
+
* Viewport width (in px) below which the table switches from the desktop
|
|
325
|
+
* table layout to the stacked mobile card layout. Defaults to 768 so the
|
|
326
|
+
* table collapses in sync with the host app's mobile breakpoint.
|
|
327
|
+
*/
|
|
323
328
|
collapseBelow?: number;
|
|
324
329
|
searchable?: boolean;
|
|
325
330
|
showSearch?: boolean;
|
|
@@ -367,8 +372,8 @@ interface TextareaProps extends Omit<TextareaHTMLAttributes<HTMLTextAreaElement>
|
|
|
367
372
|
label?: ReactNode;
|
|
368
373
|
hint?: ReactNode;
|
|
369
374
|
error?: ReactNode;
|
|
370
|
-
|
|
375
|
+
size?: ControlSize;
|
|
371
376
|
}
|
|
372
|
-
declare function Textarea({ label, hint, error,
|
|
377
|
+
declare function Textarea({ label, hint, error, size, id, disabled, style, rows, ...rest }: TextareaProps): react_jsx_runtime.JSX.Element;
|
|
373
378
|
|
|
374
379
|
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
|
@@ -511,7 +511,7 @@ function CardSmall({
|
|
|
511
511
|
// src/components/Checkbox.tsx
|
|
512
512
|
import { useEffect as useEffect2, useId, useRef, useState } from "react";
|
|
513
513
|
import { jsx as jsx3, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
514
|
-
var
|
|
514
|
+
var CHECKBOX_SIZE_BY_SIZE = {
|
|
515
515
|
sm: 14,
|
|
516
516
|
md: 16,
|
|
517
517
|
lg: 20
|
|
@@ -521,7 +521,7 @@ var CHECKBOX_LABEL_CLASSNAMES = {
|
|
|
521
521
|
md: "text-sm leading-[18px]",
|
|
522
522
|
lg: "text-[15px] leading-[18px]"
|
|
523
523
|
};
|
|
524
|
-
var getCheckboxSize = (
|
|
524
|
+
var getCheckboxSize = (size) => CHECKBOX_SIZE_BY_SIZE[size];
|
|
525
525
|
var hasNodeContent = (value) => {
|
|
526
526
|
if (Array.isArray(value)) {
|
|
527
527
|
return value.some(hasNodeContent);
|
|
@@ -593,7 +593,7 @@ function Checkbox({
|
|
|
593
593
|
label,
|
|
594
594
|
hint,
|
|
595
595
|
error,
|
|
596
|
-
|
|
596
|
+
size = "sm",
|
|
597
597
|
id,
|
|
598
598
|
checked,
|
|
599
599
|
defaultChecked,
|
|
@@ -609,7 +609,7 @@ function Checkbox({
|
|
|
609
609
|
}) {
|
|
610
610
|
const theme = useUiKitTheme();
|
|
611
611
|
const mutedText = theme.colors.textLight;
|
|
612
|
-
const indicatorSize = getCheckboxSize(
|
|
612
|
+
const indicatorSize = getCheckboxSize(size);
|
|
613
613
|
const hasLabel = hasNodeContent(label);
|
|
614
614
|
const hasHint = hasNodeContent(hint);
|
|
615
615
|
const hasError = hasNodeContent(error);
|
|
@@ -703,7 +703,7 @@ function Checkbox({
|
|
|
703
703
|
hasSecondaryContent ? "justify-start" : "justify-center"
|
|
704
704
|
),
|
|
705
705
|
children: [
|
|
706
|
-
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: [
|
|
707
707
|
label,
|
|
708
708
|
required ? /* @__PURE__ */ jsx3("span", { className: "ml-1 text-[var(--theme-negative)]", children: "*" }) : null
|
|
709
709
|
] }) : null,
|
|
@@ -1552,7 +1552,7 @@ function Input({
|
|
|
1552
1552
|
label,
|
|
1553
1553
|
hint,
|
|
1554
1554
|
error,
|
|
1555
|
-
|
|
1555
|
+
size = "sm",
|
|
1556
1556
|
className,
|
|
1557
1557
|
showPasswordToggle = true,
|
|
1558
1558
|
fileButtonLabel,
|
|
@@ -1566,8 +1566,8 @@ function Input({
|
|
|
1566
1566
|
...rest
|
|
1567
1567
|
}) {
|
|
1568
1568
|
useUiKitTheme();
|
|
1569
|
-
const controlMetrics = getControlMetrics(
|
|
1570
|
-
const passwordToggleMetrics = getPasswordToggleMetrics(
|
|
1569
|
+
const controlMetrics = getControlMetrics(size);
|
|
1570
|
+
const passwordToggleMetrics = getPasswordToggleMetrics(size);
|
|
1571
1571
|
const generatedId = useId2();
|
|
1572
1572
|
const inputId = id != null ? id : generatedId;
|
|
1573
1573
|
const fileInputRef = useRef2(null);
|
|
@@ -1601,16 +1601,16 @@ function Input({
|
|
|
1601
1601
|
const showUploadLabel = hasFileButtonLabel && !hasSelectedFiles;
|
|
1602
1602
|
const passwordLockIconSize = passwordToggleMetrics.iconSize + 2;
|
|
1603
1603
|
const leadingContentGap = Math.max(0, Math.round(controlMetrics.paddingX / 3));
|
|
1604
|
-
const leadingIconInset = getControlLeadingIconInset(
|
|
1604
|
+
const leadingIconInset = getControlLeadingIconInset(size);
|
|
1605
1605
|
const controlTextNudgeStyle = getControlTextNudgeStyle();
|
|
1606
1606
|
const hasExternalError = error !== void 0 && error !== null && error !== "";
|
|
1607
1607
|
const resolvedError = hasExternalError ? error : validationError;
|
|
1608
1608
|
const hasResolvedError = resolvedError !== void 0 && resolvedError !== null && resolvedError !== "";
|
|
1609
1609
|
const fileSelectionText = selectedFileNames.length === 0 ? placeholder != null ? placeholder : "" : selectedFileNames.length === 1 ? selectedFileNames[0] : `${selectedFileNames.length} files selected`;
|
|
1610
1610
|
const fileIconSize = Math.max(controlMetrics.fontSize + 3, 16);
|
|
1611
|
-
const fileTriggerWidth = getControlLeadingAdornmentWidth(
|
|
1612
|
-
const leadingAdornmentWidth = getControlLeadingAdornmentWidth(
|
|
1613
|
-
const passwordAdornmentWidth = getControlLeadingAdornmentWidth(
|
|
1611
|
+
const fileTriggerWidth = getControlLeadingAdornmentWidth(size, fileIconSize);
|
|
1612
|
+
const leadingAdornmentWidth = getControlLeadingAdornmentWidth(size, fileIconSize);
|
|
1613
|
+
const passwordAdornmentWidth = getControlLeadingAdornmentWidth(size, passwordLockIconSize);
|
|
1614
1614
|
const defaultLeadingIcon = isEmailField ? /* @__PURE__ */ jsx6(EmailIcon, { size: fileIconSize }) : isLoginField ? /* @__PURE__ */ jsx6(LoginIcon, { size: fileIconSize }) : null;
|
|
1615
1615
|
const resolvedLeadingIcon = icon != null ? icon : defaultLeadingIcon;
|
|
1616
1616
|
const hasLeadingIcon = isRenderableNode(resolvedLeadingIcon);
|
|
@@ -1621,8 +1621,8 @@ function Input({
|
|
|
1621
1621
|
"w-full box-border rounded-2xl border border-solid bg-[var(--theme-surface)]",
|
|
1622
1622
|
"text-[var(--theme-text)] outline-none transition-[border-color,box-shadow,background-color]",
|
|
1623
1623
|
"duration-150 placeholder:text-[var(--theme-textLight)]",
|
|
1624
|
-
FIELD_HEIGHT_CLASSNAMES[
|
|
1625
|
-
FIELD_TEXT_CLASSNAMES[
|
|
1624
|
+
FIELD_HEIGHT_CLASSNAMES[size],
|
|
1625
|
+
FIELD_TEXT_CLASSNAMES[size],
|
|
1626
1626
|
hasResolvedError ? "border-[var(--theme-negative)]" : "border-[var(--theme-textLight)]",
|
|
1627
1627
|
disabled ? "cursor-not-allowed opacity-70" : "cursor-text"
|
|
1628
1628
|
);
|
|
@@ -1632,15 +1632,15 @@ function Input({
|
|
|
1632
1632
|
"border border-solid bg-[var(--theme-surface)] text-[var(--theme-text)] text-left",
|
|
1633
1633
|
"transition-[border-color,box-shadow,background-color] duration-150",
|
|
1634
1634
|
"shadow-[0px_4px_5px_var(--theme-shadow)]",
|
|
1635
|
-
FIELD_HEIGHT_CLASSNAMES[
|
|
1636
|
-
FIELD_TEXT_CLASSNAMES[
|
|
1635
|
+
FIELD_HEIGHT_CLASSNAMES[size],
|
|
1636
|
+
FIELD_TEXT_CLASSNAMES[size],
|
|
1637
1637
|
hasResolvedError ? "border-[var(--theme-negative)]" : "border-[var(--theme-textLight)]",
|
|
1638
1638
|
disabled ? "opacity-70" : null
|
|
1639
1639
|
);
|
|
1640
1640
|
const adornedInputClassName = cx(
|
|
1641
1641
|
"h-full min-w-0 flex-1 border-0 bg-transparent text-[var(--theme-text)] outline-none",
|
|
1642
1642
|
"placeholder:text-[var(--theme-textLight)]",
|
|
1643
|
-
FIELD_TEXT_CLASSNAMES[
|
|
1643
|
+
FIELD_TEXT_CLASSNAMES[size],
|
|
1644
1644
|
disabled ? "cursor-not-allowed" : "cursor-text"
|
|
1645
1645
|
);
|
|
1646
1646
|
const adornmentColorClassName = hasResolvedError ? "text-[var(--theme-negative)]" : "text-[var(--theme-textLight)]";
|
|
@@ -1704,7 +1704,7 @@ function Input({
|
|
|
1704
1704
|
className: cx(
|
|
1705
1705
|
"inline-flex shrink-0 self-stretch whitespace-nowrap border-0 bg-transparent",
|
|
1706
1706
|
"items-center text-[var(--theme-text)] appearance-none",
|
|
1707
|
-
FIELD_TEXT_CLASSNAMES[
|
|
1707
|
+
FIELD_TEXT_CLASSNAMES[size],
|
|
1708
1708
|
disabled ? "cursor-not-allowed" : "cursor-pointer",
|
|
1709
1709
|
showUploadLabel ? "justify-start font-bold" : "justify-center"
|
|
1710
1710
|
),
|
|
@@ -1752,7 +1752,7 @@ function Input({
|
|
|
1752
1752
|
{
|
|
1753
1753
|
className: cx(
|
|
1754
1754
|
"flex h-full min-w-0 flex-1 items-center overflow-hidden text-ellipsis whitespace-nowrap",
|
|
1755
|
-
FIELD_TEXT_CLASSNAMES[
|
|
1755
|
+
FIELD_TEXT_CLASSNAMES[size],
|
|
1756
1756
|
hasSelectedFiles ? "text-[var(--theme-text)]" : "text-[var(--theme-textLight)]"
|
|
1757
1757
|
),
|
|
1758
1758
|
style: {
|
|
@@ -1813,7 +1813,7 @@ function Input({
|
|
|
1813
1813
|
className: cx(adornedInputClassName, className),
|
|
1814
1814
|
"aria-invalid": hasResolvedError,
|
|
1815
1815
|
style: {
|
|
1816
|
-
padding: getTextInputPadding(
|
|
1816
|
+
padding: getTextInputPadding(size, { leadingPadding: leadingContentGap })
|
|
1817
1817
|
}
|
|
1818
1818
|
}
|
|
1819
1819
|
)
|
|
@@ -1854,7 +1854,7 @@ function Input({
|
|
|
1854
1854
|
className: cx(adornedInputClassName, className),
|
|
1855
1855
|
"aria-invalid": hasResolvedError,
|
|
1856
1856
|
style: {
|
|
1857
|
-
padding: getTextInputPadding(
|
|
1857
|
+
padding: getTextInputPadding(size, { leadingPadding: leadingContentGap })
|
|
1858
1858
|
}
|
|
1859
1859
|
}
|
|
1860
1860
|
)
|
|
@@ -1870,10 +1870,10 @@ function Input({
|
|
|
1870
1870
|
disabled,
|
|
1871
1871
|
onChange: handleValidatedInputChange,
|
|
1872
1872
|
"aria-invalid": hasResolvedError,
|
|
1873
|
-
className: cx(fieldBaseClassName, FIELD_PADDING_X_CLASSNAMES[
|
|
1873
|
+
className: cx(fieldBaseClassName, FIELD_PADDING_X_CLASSNAMES[size], className),
|
|
1874
1874
|
style: {
|
|
1875
1875
|
boxShadow: "0px 4px 5px var(--theme-shadow)",
|
|
1876
|
-
padding: getTextInputPadding(
|
|
1876
|
+
padding: getTextInputPadding(size),
|
|
1877
1877
|
...style
|
|
1878
1878
|
}
|
|
1879
1879
|
}
|
|
@@ -2120,7 +2120,7 @@ function DatePicker({
|
|
|
2120
2120
|
label,
|
|
2121
2121
|
hint,
|
|
2122
2122
|
error,
|
|
2123
|
-
|
|
2123
|
+
size = "sm",
|
|
2124
2124
|
value,
|
|
2125
2125
|
defaultValue,
|
|
2126
2126
|
onChange,
|
|
@@ -2154,8 +2154,8 @@ function DatePicker({
|
|
|
2154
2154
|
}) {
|
|
2155
2155
|
var _a;
|
|
2156
2156
|
useUiKitTheme();
|
|
2157
|
-
const controlMetrics = getControlMetrics(
|
|
2158
|
-
const accessoryMetrics = ACCESSORY_METRICS_BY_SIZE[
|
|
2157
|
+
const controlMetrics = getControlMetrics(size);
|
|
2158
|
+
const accessoryMetrics = ACCESSORY_METRICS_BY_SIZE[size];
|
|
2159
2159
|
const generatedIdRef = useRef3();
|
|
2160
2160
|
const visibleInputRef = useRef3(null);
|
|
2161
2161
|
const nativeInputRef = useRef3(null);
|
|
@@ -2213,8 +2213,8 @@ function DatePicker({
|
|
|
2213
2213
|
const canOpenPicker = !disabled && !readOnly && !hasConfigurationConflict;
|
|
2214
2214
|
const canClear = clearable && !disabled && !readOnly && !required && hasAnyValue;
|
|
2215
2215
|
const leadingContentGap = Math.max(0, Math.round(controlMetrics.paddingX / 3));
|
|
2216
|
-
const leadingIconInset = getControlLeadingIconInset(
|
|
2217
|
-
const pickerAdornmentWidth = getControlLeadingAdornmentWidth(
|
|
2216
|
+
const leadingIconInset = getControlLeadingIconInset(size);
|
|
2217
|
+
const pickerAdornmentWidth = getControlLeadingAdornmentWidth(size, accessoryMetrics.iconSize);
|
|
2218
2218
|
const trailingButtonCount = Number(canClear);
|
|
2219
2219
|
const trailingInset = trailingButtonCount > 0 ? Math.max(
|
|
2220
2220
|
0,
|
|
@@ -2226,8 +2226,8 @@ function DatePicker({
|
|
|
2226
2226
|
"w-full box-border rounded-2xl border border-solid bg-[var(--theme-surface)]",
|
|
2227
2227
|
"text-[var(--theme-text)] outline-none transition-[border-color,box-shadow,background-color]",
|
|
2228
2228
|
"duration-150 placeholder:text-[var(--theme-textLight)]",
|
|
2229
|
-
FIELD_HEIGHT_CLASSNAMES2[
|
|
2230
|
-
FIELD_TEXT_CLASSNAMES2[
|
|
2229
|
+
FIELD_HEIGHT_CLASSNAMES2[size],
|
|
2230
|
+
FIELD_TEXT_CLASSNAMES2[size],
|
|
2231
2231
|
resolvedError ? "border-[var(--theme-negative)]" : "border-[var(--theme-textLight)]",
|
|
2232
2232
|
disabled ? "cursor-not-allowed" : readOnly ? "cursor-default" : "cursor-text"
|
|
2233
2233
|
);
|
|
@@ -2235,15 +2235,15 @@ function DatePicker({
|
|
|
2235
2235
|
"box-border flex w-full items-center gap-0 overflow-hidden rounded-2xl",
|
|
2236
2236
|
"bg-[var(--theme-surface)] text-[var(--theme-text)]",
|
|
2237
2237
|
"transition-[border-color,box-shadow,background-color] duration-150",
|
|
2238
|
-
FIELD_HEIGHT_CLASSNAMES2[
|
|
2239
|
-
FIELD_TEXT_CLASSNAMES2[
|
|
2238
|
+
FIELD_HEIGHT_CLASSNAMES2[size],
|
|
2239
|
+
FIELD_TEXT_CLASSNAMES2[size],
|
|
2240
2240
|
disabled ? "cursor-not-allowed" : readOnly ? "cursor-default" : "cursor-text"
|
|
2241
2241
|
);
|
|
2242
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)" });
|
|
2243
2243
|
const integratedInputClassName = cx(
|
|
2244
2244
|
"h-full w-full box-border border-0 bg-transparent text-[var(--theme-text)]",
|
|
2245
2245
|
"outline-none placeholder:text-[var(--theme-textLight)]",
|
|
2246
|
-
FIELD_TEXT_CLASSNAMES2[
|
|
2246
|
+
FIELD_TEXT_CLASSNAMES2[size],
|
|
2247
2247
|
disabled ? "cursor-not-allowed" : readOnly ? "cursor-default" : "cursor-text"
|
|
2248
2248
|
);
|
|
2249
2249
|
const pickerAdornmentClassName = cx(
|
|
@@ -2488,7 +2488,7 @@ function DatePicker({
|
|
|
2488
2488
|
...visibleInputProps,
|
|
2489
2489
|
className: cx(integratedInputClassName, className),
|
|
2490
2490
|
style: {
|
|
2491
|
-
padding: getTextInputPadding(
|
|
2491
|
+
padding: getTextInputPadding(size, {
|
|
2492
2492
|
leadingPadding: leadingContentGap,
|
|
2493
2493
|
trailingPadding: controlMetrics.paddingX + trailingInset
|
|
2494
2494
|
})
|
|
@@ -2505,9 +2505,9 @@ function DatePicker({
|
|
|
2505
2505
|
"input",
|
|
2506
2506
|
{
|
|
2507
2507
|
...visibleInputProps,
|
|
2508
|
-
className: cx(fieldBaseClassName, FIELD_PADDING_X_CLASSNAMES2[
|
|
2508
|
+
className: cx(fieldBaseClassName, FIELD_PADDING_X_CLASSNAMES2[size], className),
|
|
2509
2509
|
style: {
|
|
2510
|
-
padding: getTextInputPadding(
|
|
2510
|
+
padding: getTextInputPadding(size, {
|
|
2511
2511
|
trailingPadding: controlMetrics.paddingX + trailingInset
|
|
2512
2512
|
}),
|
|
2513
2513
|
boxShadow: resolvedError ? "0 0 0 3px var(--theme-negative), 0px 4px 5px var(--theme-shadow)" : "0px 4px 5px var(--theme-shadow)",
|
|
@@ -2644,7 +2644,7 @@ function SelectBase({
|
|
|
2644
2644
|
hint,
|
|
2645
2645
|
error,
|
|
2646
2646
|
placeholder,
|
|
2647
|
-
|
|
2647
|
+
size = "sm",
|
|
2648
2648
|
id,
|
|
2649
2649
|
disabled,
|
|
2650
2650
|
style,
|
|
@@ -2717,7 +2717,7 @@ function SelectBase({
|
|
|
2717
2717
|
const visibleEnabledValues = visibleEnabledOptions.map((option) => option.value);
|
|
2718
2718
|
const selectedValuesKey = selectedValues.join("\0");
|
|
2719
2719
|
const visibleEnabledValuesKey = visibleEnabledValues.join("\0");
|
|
2720
|
-
const indicatorOffset = getSelectIndicatorOffset(
|
|
2720
|
+
const indicatorOffset = getSelectIndicatorOffset(size);
|
|
2721
2721
|
const controlTextNudgeStyle = getSelectTextNudgeStyle();
|
|
2722
2722
|
const listboxId = `${resolvedId}-listbox`;
|
|
2723
2723
|
const searchInputId = `${resolvedId}-search`;
|
|
@@ -2737,8 +2737,8 @@ function SelectBase({
|
|
|
2737
2737
|
"m-0 box-border flex w-full min-w-0 items-center justify-between gap-3 rounded-2xl border-0 appearance-none",
|
|
2738
2738
|
"bg-[var(--theme-surface)] outline-none transition-[border-color,box-shadow,background-color]",
|
|
2739
2739
|
"duration-150 text-left",
|
|
2740
|
-
FIELD_HEIGHT_CLASSNAMES3[
|
|
2741
|
-
FIELD_TEXT_CLASSNAMES3[
|
|
2740
|
+
FIELD_HEIGHT_CLASSNAMES3[size],
|
|
2741
|
+
FIELD_TEXT_CLASSNAMES3[size],
|
|
2742
2742
|
hasSelection ? "text-[var(--theme-text)]" : "text-[var(--theme-textLight)]",
|
|
2743
2743
|
isTriggerDisabled ? "cursor-not-allowed" : "cursor-pointer"
|
|
2744
2744
|
);
|
|
@@ -3128,7 +3128,7 @@ function SelectBase({
|
|
|
3128
3128
|
onBlur: handleTriggerBlur,
|
|
3129
3129
|
onKeyDown: handleTriggerKeyDown,
|
|
3130
3130
|
style: {
|
|
3131
|
-
padding: getSelectControlPadding(
|
|
3131
|
+
padding: getSelectControlPadding(size),
|
|
3132
3132
|
boxShadow: triggerBoxShadow,
|
|
3133
3133
|
...style,
|
|
3134
3134
|
...isTriggerDisabled ? { opacity: DISABLED_FIELD_OPACITY } : {}
|
|
@@ -3335,7 +3335,7 @@ function SelectBase({
|
|
|
3335
3335
|
className: cx(
|
|
3336
3336
|
"flex w-full min-w-0 items-center justify-between gap-3 rounded-xl box-border",
|
|
3337
3337
|
"transition-[background-color,color] duration-150",
|
|
3338
|
-
OPTION_PADDING_CLASSNAMES[
|
|
3338
|
+
OPTION_PADDING_CLASSNAMES[size],
|
|
3339
3339
|
option.disabled ? "cursor-not-allowed text-[var(--theme-secondary)]" : "cursor-pointer",
|
|
3340
3340
|
!option.disabled && isActive ? "text-[var(--theme-onPrimary)]" : null,
|
|
3341
3341
|
!option.disabled && !isActive ? "text-[var(--theme-text)]" : null,
|
|
@@ -3804,7 +3804,7 @@ import { useEffect as useEffect8, useId as useId4, useRef as useRef6, useState a
|
|
|
3804
3804
|
|
|
3805
3805
|
// src/componentsBase/table/utils.ts
|
|
3806
3806
|
import { isValidElement as isValidElement3 } from "react";
|
|
3807
|
-
var DEFAULT_COLLAPSE_BELOW =
|
|
3807
|
+
var DEFAULT_COLLAPSE_BELOW = 768;
|
|
3808
3808
|
var DEFAULT_MAX_INLINE_ACTIONS = 2;
|
|
3809
3809
|
var DEFAULT_PAGE_SIZE = 10;
|
|
3810
3810
|
var DEFAULT_PAGE_SIZE_OPTIONS = [10, 20, 50];
|
|
@@ -4327,7 +4327,7 @@ function TableBase({
|
|
|
4327
4327
|
const alternateSurfaceColor = theme.colors.background;
|
|
4328
4328
|
const scrollRegionId = useId4().replace(/:/g, "");
|
|
4329
4329
|
const containerRef = useRef6(null);
|
|
4330
|
-
const [
|
|
4330
|
+
const [viewportWidth, setViewportWidth] = useState7(null);
|
|
4331
4331
|
const [isSettingsModalOpen, setIsSettingsModalOpen] = useState7(false);
|
|
4332
4332
|
const resolvedLabels = mergeTableLabels({
|
|
4333
4333
|
...labels != null ? labels : {},
|
|
@@ -4335,8 +4335,8 @@ function TableBase({
|
|
|
4335
4335
|
});
|
|
4336
4336
|
const normalizedPage = clampPage(page, totalPages);
|
|
4337
4337
|
const normalizedPageSizeOptions = sanitizePageSizeOptions(pageSizeOptions, pageSize);
|
|
4338
|
-
const isCollapsed =
|
|
4339
|
-
const mobileGridColumnCount =
|
|
4338
|
+
const isCollapsed = viewportWidth !== null ? viewportWidth < collapseBelow : false;
|
|
4339
|
+
const mobileGridColumnCount = viewportWidth !== null && viewportWidth < 520 ? 1 : 2;
|
|
4340
4340
|
const canGoToPreviousPage = normalizedPage > 1;
|
|
4341
4341
|
const canGoToNextPage = normalizedPage < Math.max(1, totalPages);
|
|
4342
4342
|
const canGoToFirstPage = canGoToPreviousPage;
|
|
@@ -4371,31 +4371,16 @@ function TableBase({
|
|
|
4371
4371
|
borderLeft: `1px solid ${softBorderColor}`
|
|
4372
4372
|
});
|
|
4373
4373
|
useEffect8(() => {
|
|
4374
|
-
|
|
4375
|
-
if (!element) {
|
|
4374
|
+
if (typeof window === "undefined") {
|
|
4376
4375
|
return;
|
|
4377
4376
|
}
|
|
4378
|
-
const
|
|
4379
|
-
|
|
4380
|
-
setContainerWidth(measuredWidth > 0 ? measuredWidth : null);
|
|
4377
|
+
const updateViewportWidth = () => {
|
|
4378
|
+
setViewportWidth(window.innerWidth);
|
|
4381
4379
|
};
|
|
4382
|
-
|
|
4383
|
-
|
|
4384
|
-
const handleResize = () => {
|
|
4385
|
-
setWidthFromElement(window.innerWidth);
|
|
4386
|
-
};
|
|
4387
|
-
window.addEventListener("resize", handleResize);
|
|
4388
|
-
return () => {
|
|
4389
|
-
window.removeEventListener("resize", handleResize);
|
|
4390
|
-
};
|
|
4391
|
-
}
|
|
4392
|
-
const observer = new ResizeObserver((entries) => {
|
|
4393
|
-
const [entry] = entries;
|
|
4394
|
-
setWidthFromElement(entry == null ? void 0 : entry.contentRect.width);
|
|
4395
|
-
});
|
|
4396
|
-
observer.observe(element);
|
|
4380
|
+
updateViewportWidth();
|
|
4381
|
+
window.addEventListener("resize", updateViewportWidth);
|
|
4397
4382
|
return () => {
|
|
4398
|
-
|
|
4383
|
+
window.removeEventListener("resize", updateViewportWidth);
|
|
4399
4384
|
};
|
|
4400
4385
|
}, []);
|
|
4401
4386
|
const actionButtonBaseStyle = (tone, disabled, iconOnly) => ({
|
|
@@ -4652,7 +4637,7 @@ function TableBase({
|
|
|
4652
4637
|
!hasRows && (!loading || error) ? renderEmptyState() : null,
|
|
4653
4638
|
hasRows ? isCollapsed ? /* @__PURE__ */ jsx13("div", { role: "list", "aria-label": ariaLabel, className: "flex flex-col gap-3.5", children: items.map((item, rowIndex) => {
|
|
4654
4639
|
const rowActions = renderActions(item, rowIndex);
|
|
4655
|
-
const rowBackgroundColor =
|
|
4640
|
+
const rowBackgroundColor = theme.colors.surface;
|
|
4656
4641
|
return /* @__PURE__ */ jsxs11(
|
|
4657
4642
|
"article",
|
|
4658
4643
|
{
|
|
@@ -4824,7 +4809,7 @@ function TableBase({
|
|
|
4824
4809
|
width: column.width,
|
|
4825
4810
|
minWidth: column.minWidth
|
|
4826
4811
|
},
|
|
4827
|
-
children: column.label
|
|
4812
|
+
children: !column.hideLabel ? column.label : null
|
|
4828
4813
|
},
|
|
4829
4814
|
getColumnKey(column, columnIndex)
|
|
4830
4815
|
);
|
|
@@ -5274,7 +5259,7 @@ function Textarea({
|
|
|
5274
5259
|
label,
|
|
5275
5260
|
hint,
|
|
5276
5261
|
error,
|
|
5277
|
-
|
|
5262
|
+
size = "sm",
|
|
5278
5263
|
id,
|
|
5279
5264
|
disabled,
|
|
5280
5265
|
style,
|
|
@@ -5295,7 +5280,7 @@ function Textarea({
|
|
|
5295
5280
|
"duration-150 placeholder:opacity-100 disabled:cursor-not-allowed",
|
|
5296
5281
|
"placeholder:text-[var(--theme-textLight)]",
|
|
5297
5282
|
error ? "border-[var(--theme-negative)]" : "border-[var(--theme-textLight)]",
|
|
5298
|
-
TEXTAREA_SIZE_CLASSNAMES[
|
|
5283
|
+
TEXTAREA_SIZE_CLASSNAMES[size]
|
|
5299
5284
|
),
|
|
5300
5285
|
style: {
|
|
5301
5286
|
boxShadow: error ? "0 0 0 3px var(--theme-negative), 0px 4px 5px var(--theme-shadow)" : "0px 4px 5px var(--theme-shadow)",
|