smartsell-ui-kit 0.1.5 → 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 +44 -44
- 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 +44 -44
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -548,7 +548,7 @@ function CardSmall({
|
|
|
548
548
|
// src/components/Checkbox.tsx
|
|
549
549
|
var import_react2 = require("react");
|
|
550
550
|
var import_jsx_runtime4 = require("react/jsx-runtime");
|
|
551
|
-
var
|
|
551
|
+
var CHECKBOX_SIZE_BY_SIZE = {
|
|
552
552
|
sm: 14,
|
|
553
553
|
md: 16,
|
|
554
554
|
lg: 20
|
|
@@ -558,7 +558,7 @@ var CHECKBOX_LABEL_CLASSNAMES = {
|
|
|
558
558
|
md: "text-sm leading-[18px]",
|
|
559
559
|
lg: "text-[15px] leading-[18px]"
|
|
560
560
|
};
|
|
561
|
-
var getCheckboxSize = (
|
|
561
|
+
var getCheckboxSize = (size) => CHECKBOX_SIZE_BY_SIZE[size];
|
|
562
562
|
var hasNodeContent = (value) => {
|
|
563
563
|
if (Array.isArray(value)) {
|
|
564
564
|
return value.some(hasNodeContent);
|
|
@@ -630,7 +630,7 @@ function Checkbox({
|
|
|
630
630
|
label,
|
|
631
631
|
hint,
|
|
632
632
|
error,
|
|
633
|
-
|
|
633
|
+
size = "sm",
|
|
634
634
|
id,
|
|
635
635
|
checked,
|
|
636
636
|
defaultChecked,
|
|
@@ -646,7 +646,7 @@ function Checkbox({
|
|
|
646
646
|
}) {
|
|
647
647
|
const theme = useUiKitTheme();
|
|
648
648
|
const mutedText = theme.colors.textLight;
|
|
649
|
-
const indicatorSize = getCheckboxSize(
|
|
649
|
+
const indicatorSize = getCheckboxSize(size);
|
|
650
650
|
const hasLabel = hasNodeContent(label);
|
|
651
651
|
const hasHint = hasNodeContent(hint);
|
|
652
652
|
const hasError = hasNodeContent(error);
|
|
@@ -740,7 +740,7 @@ function Checkbox({
|
|
|
740
740
|
hasSecondaryContent ? "justify-start" : "justify-center"
|
|
741
741
|
),
|
|
742
742
|
children: [
|
|
743
|
-
label ? /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("span", { className: cx("font-semibold text-[var(--theme-text)]", CHECKBOX_LABEL_CLASSNAMES[
|
|
743
|
+
label ? /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("span", { className: cx("font-semibold text-[var(--theme-text)]", CHECKBOX_LABEL_CLASSNAMES[size]), children: [
|
|
744
744
|
label,
|
|
745
745
|
required ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { className: "ml-1 text-[var(--theme-negative)]", children: "*" }) : null
|
|
746
746
|
] }) : null,
|
|
@@ -1584,7 +1584,7 @@ function Input({
|
|
|
1584
1584
|
label,
|
|
1585
1585
|
hint,
|
|
1586
1586
|
error,
|
|
1587
|
-
|
|
1587
|
+
size = "sm",
|
|
1588
1588
|
className,
|
|
1589
1589
|
showPasswordToggle = true,
|
|
1590
1590
|
fileButtonLabel,
|
|
@@ -1598,8 +1598,8 @@ function Input({
|
|
|
1598
1598
|
...rest
|
|
1599
1599
|
}) {
|
|
1600
1600
|
useUiKitTheme();
|
|
1601
|
-
const controlMetrics = getControlMetrics(
|
|
1602
|
-
const passwordToggleMetrics = getPasswordToggleMetrics(
|
|
1601
|
+
const controlMetrics = getControlMetrics(size);
|
|
1602
|
+
const passwordToggleMetrics = getPasswordToggleMetrics(size);
|
|
1603
1603
|
const generatedId = (0, import_react5.useId)();
|
|
1604
1604
|
const inputId = id != null ? id : generatedId;
|
|
1605
1605
|
const fileInputRef = (0, import_react5.useRef)(null);
|
|
@@ -1633,16 +1633,16 @@ function Input({
|
|
|
1633
1633
|
const showUploadLabel = hasFileButtonLabel && !hasSelectedFiles;
|
|
1634
1634
|
const passwordLockIconSize = passwordToggleMetrics.iconSize + 2;
|
|
1635
1635
|
const leadingContentGap = Math.max(0, Math.round(controlMetrics.paddingX / 3));
|
|
1636
|
-
const leadingIconInset = getControlLeadingIconInset(
|
|
1636
|
+
const leadingIconInset = getControlLeadingIconInset(size);
|
|
1637
1637
|
const controlTextNudgeStyle = getControlTextNudgeStyle();
|
|
1638
1638
|
const hasExternalError = error !== void 0 && error !== null && error !== "";
|
|
1639
1639
|
const resolvedError = hasExternalError ? error : validationError;
|
|
1640
1640
|
const hasResolvedError = resolvedError !== void 0 && resolvedError !== null && resolvedError !== "";
|
|
1641
1641
|
const fileSelectionText = selectedFileNames.length === 0 ? placeholder != null ? placeholder : "" : selectedFileNames.length === 1 ? selectedFileNames[0] : `${selectedFileNames.length} files selected`;
|
|
1642
1642
|
const fileIconSize = Math.max(controlMetrics.fontSize + 3, 16);
|
|
1643
|
-
const fileTriggerWidth = getControlLeadingAdornmentWidth(
|
|
1644
|
-
const leadingAdornmentWidth = getControlLeadingAdornmentWidth(
|
|
1645
|
-
const passwordAdornmentWidth = getControlLeadingAdornmentWidth(
|
|
1643
|
+
const fileTriggerWidth = getControlLeadingAdornmentWidth(size, fileIconSize);
|
|
1644
|
+
const leadingAdornmentWidth = getControlLeadingAdornmentWidth(size, fileIconSize);
|
|
1645
|
+
const passwordAdornmentWidth = getControlLeadingAdornmentWidth(size, passwordLockIconSize);
|
|
1646
1646
|
const defaultLeadingIcon = isEmailField ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(EmailIcon, { size: fileIconSize }) : isLoginField ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(LoginIcon, { size: fileIconSize }) : null;
|
|
1647
1647
|
const resolvedLeadingIcon = icon != null ? icon : defaultLeadingIcon;
|
|
1648
1648
|
const hasLeadingIcon = isRenderableNode(resolvedLeadingIcon);
|
|
@@ -1653,8 +1653,8 @@ function Input({
|
|
|
1653
1653
|
"w-full box-border rounded-2xl border border-solid bg-[var(--theme-surface)]",
|
|
1654
1654
|
"text-[var(--theme-text)] outline-none transition-[border-color,box-shadow,background-color]",
|
|
1655
1655
|
"duration-150 placeholder:text-[var(--theme-textLight)]",
|
|
1656
|
-
FIELD_HEIGHT_CLASSNAMES[
|
|
1657
|
-
FIELD_TEXT_CLASSNAMES[
|
|
1656
|
+
FIELD_HEIGHT_CLASSNAMES[size],
|
|
1657
|
+
FIELD_TEXT_CLASSNAMES[size],
|
|
1658
1658
|
hasResolvedError ? "border-[var(--theme-negative)]" : "border-[var(--theme-textLight)]",
|
|
1659
1659
|
disabled ? "cursor-not-allowed opacity-70" : "cursor-text"
|
|
1660
1660
|
);
|
|
@@ -1664,15 +1664,15 @@ function Input({
|
|
|
1664
1664
|
"border border-solid bg-[var(--theme-surface)] text-[var(--theme-text)] text-left",
|
|
1665
1665
|
"transition-[border-color,box-shadow,background-color] duration-150",
|
|
1666
1666
|
"shadow-[0px_4px_5px_var(--theme-shadow)]",
|
|
1667
|
-
FIELD_HEIGHT_CLASSNAMES[
|
|
1668
|
-
FIELD_TEXT_CLASSNAMES[
|
|
1667
|
+
FIELD_HEIGHT_CLASSNAMES[size],
|
|
1668
|
+
FIELD_TEXT_CLASSNAMES[size],
|
|
1669
1669
|
hasResolvedError ? "border-[var(--theme-negative)]" : "border-[var(--theme-textLight)]",
|
|
1670
1670
|
disabled ? "opacity-70" : null
|
|
1671
1671
|
);
|
|
1672
1672
|
const adornedInputClassName = cx(
|
|
1673
1673
|
"h-full min-w-0 flex-1 border-0 bg-transparent text-[var(--theme-text)] outline-none",
|
|
1674
1674
|
"placeholder:text-[var(--theme-textLight)]",
|
|
1675
|
-
FIELD_TEXT_CLASSNAMES[
|
|
1675
|
+
FIELD_TEXT_CLASSNAMES[size],
|
|
1676
1676
|
disabled ? "cursor-not-allowed" : "cursor-text"
|
|
1677
1677
|
);
|
|
1678
1678
|
const adornmentColorClassName = hasResolvedError ? "text-[var(--theme-negative)]" : "text-[var(--theme-textLight)]";
|
|
@@ -1736,7 +1736,7 @@ function Input({
|
|
|
1736
1736
|
className: cx(
|
|
1737
1737
|
"inline-flex shrink-0 self-stretch whitespace-nowrap border-0 bg-transparent",
|
|
1738
1738
|
"items-center text-[var(--theme-text)] appearance-none",
|
|
1739
|
-
FIELD_TEXT_CLASSNAMES[
|
|
1739
|
+
FIELD_TEXT_CLASSNAMES[size],
|
|
1740
1740
|
disabled ? "cursor-not-allowed" : "cursor-pointer",
|
|
1741
1741
|
showUploadLabel ? "justify-start font-bold" : "justify-center"
|
|
1742
1742
|
),
|
|
@@ -1784,7 +1784,7 @@ function Input({
|
|
|
1784
1784
|
{
|
|
1785
1785
|
className: cx(
|
|
1786
1786
|
"flex h-full min-w-0 flex-1 items-center overflow-hidden text-ellipsis whitespace-nowrap",
|
|
1787
|
-
FIELD_TEXT_CLASSNAMES[
|
|
1787
|
+
FIELD_TEXT_CLASSNAMES[size],
|
|
1788
1788
|
hasSelectedFiles ? "text-[var(--theme-text)]" : "text-[var(--theme-textLight)]"
|
|
1789
1789
|
),
|
|
1790
1790
|
style: {
|
|
@@ -1845,7 +1845,7 @@ function Input({
|
|
|
1845
1845
|
className: cx(adornedInputClassName, className),
|
|
1846
1846
|
"aria-invalid": hasResolvedError,
|
|
1847
1847
|
style: {
|
|
1848
|
-
padding: getTextInputPadding(
|
|
1848
|
+
padding: getTextInputPadding(size, { leadingPadding: leadingContentGap })
|
|
1849
1849
|
}
|
|
1850
1850
|
}
|
|
1851
1851
|
)
|
|
@@ -1886,7 +1886,7 @@ function Input({
|
|
|
1886
1886
|
className: cx(adornedInputClassName, className),
|
|
1887
1887
|
"aria-invalid": hasResolvedError,
|
|
1888
1888
|
style: {
|
|
1889
|
-
padding: getTextInputPadding(
|
|
1889
|
+
padding: getTextInputPadding(size, { leadingPadding: leadingContentGap })
|
|
1890
1890
|
}
|
|
1891
1891
|
}
|
|
1892
1892
|
)
|
|
@@ -1902,10 +1902,10 @@ function Input({
|
|
|
1902
1902
|
disabled,
|
|
1903
1903
|
onChange: handleValidatedInputChange,
|
|
1904
1904
|
"aria-invalid": hasResolvedError,
|
|
1905
|
-
className: cx(fieldBaseClassName, FIELD_PADDING_X_CLASSNAMES[
|
|
1905
|
+
className: cx(fieldBaseClassName, FIELD_PADDING_X_CLASSNAMES[size], className),
|
|
1906
1906
|
style: {
|
|
1907
1907
|
boxShadow: "0px 4px 5px var(--theme-shadow)",
|
|
1908
|
-
padding: getTextInputPadding(
|
|
1908
|
+
padding: getTextInputPadding(size),
|
|
1909
1909
|
...style
|
|
1910
1910
|
}
|
|
1911
1911
|
}
|
|
@@ -2152,7 +2152,7 @@ function DatePicker({
|
|
|
2152
2152
|
label,
|
|
2153
2153
|
hint,
|
|
2154
2154
|
error,
|
|
2155
|
-
|
|
2155
|
+
size = "sm",
|
|
2156
2156
|
value,
|
|
2157
2157
|
defaultValue,
|
|
2158
2158
|
onChange,
|
|
@@ -2186,8 +2186,8 @@ function DatePicker({
|
|
|
2186
2186
|
}) {
|
|
2187
2187
|
var _a;
|
|
2188
2188
|
useUiKitTheme();
|
|
2189
|
-
const controlMetrics = getControlMetrics(
|
|
2190
|
-
const accessoryMetrics = ACCESSORY_METRICS_BY_SIZE[
|
|
2189
|
+
const controlMetrics = getControlMetrics(size);
|
|
2190
|
+
const accessoryMetrics = ACCESSORY_METRICS_BY_SIZE[size];
|
|
2191
2191
|
const generatedIdRef = (0, import_react6.useRef)();
|
|
2192
2192
|
const visibleInputRef = (0, import_react6.useRef)(null);
|
|
2193
2193
|
const nativeInputRef = (0, import_react6.useRef)(null);
|
|
@@ -2245,8 +2245,8 @@ function DatePicker({
|
|
|
2245
2245
|
const canOpenPicker = !disabled && !readOnly && !hasConfigurationConflict;
|
|
2246
2246
|
const canClear = clearable && !disabled && !readOnly && !required && hasAnyValue;
|
|
2247
2247
|
const leadingContentGap = Math.max(0, Math.round(controlMetrics.paddingX / 3));
|
|
2248
|
-
const leadingIconInset = getControlLeadingIconInset(
|
|
2249
|
-
const pickerAdornmentWidth = getControlLeadingAdornmentWidth(
|
|
2248
|
+
const leadingIconInset = getControlLeadingIconInset(size);
|
|
2249
|
+
const pickerAdornmentWidth = getControlLeadingAdornmentWidth(size, accessoryMetrics.iconSize);
|
|
2250
2250
|
const trailingButtonCount = Number(canClear);
|
|
2251
2251
|
const trailingInset = trailingButtonCount > 0 ? Math.max(
|
|
2252
2252
|
0,
|
|
@@ -2258,8 +2258,8 @@ function DatePicker({
|
|
|
2258
2258
|
"w-full box-border rounded-2xl border border-solid bg-[var(--theme-surface)]",
|
|
2259
2259
|
"text-[var(--theme-text)] outline-none transition-[border-color,box-shadow,background-color]",
|
|
2260
2260
|
"duration-150 placeholder:text-[var(--theme-textLight)]",
|
|
2261
|
-
FIELD_HEIGHT_CLASSNAMES2[
|
|
2262
|
-
FIELD_TEXT_CLASSNAMES2[
|
|
2261
|
+
FIELD_HEIGHT_CLASSNAMES2[size],
|
|
2262
|
+
FIELD_TEXT_CLASSNAMES2[size],
|
|
2263
2263
|
resolvedError ? "border-[var(--theme-negative)]" : "border-[var(--theme-textLight)]",
|
|
2264
2264
|
disabled ? "cursor-not-allowed" : readOnly ? "cursor-default" : "cursor-text"
|
|
2265
2265
|
);
|
|
@@ -2267,15 +2267,15 @@ function DatePicker({
|
|
|
2267
2267
|
"box-border flex w-full items-center gap-0 overflow-hidden rounded-2xl",
|
|
2268
2268
|
"bg-[var(--theme-surface)] text-[var(--theme-text)]",
|
|
2269
2269
|
"transition-[border-color,box-shadow,background-color] duration-150",
|
|
2270
|
-
FIELD_HEIGHT_CLASSNAMES2[
|
|
2271
|
-
FIELD_TEXT_CLASSNAMES2[
|
|
2270
|
+
FIELD_HEIGHT_CLASSNAMES2[size],
|
|
2271
|
+
FIELD_TEXT_CLASSNAMES2[size],
|
|
2272
2272
|
disabled ? "cursor-not-allowed" : readOnly ? "cursor-default" : "cursor-text"
|
|
2273
2273
|
);
|
|
2274
2274
|
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)" });
|
|
2275
2275
|
const integratedInputClassName = cx(
|
|
2276
2276
|
"h-full w-full box-border border-0 bg-transparent text-[var(--theme-text)]",
|
|
2277
2277
|
"outline-none placeholder:text-[var(--theme-textLight)]",
|
|
2278
|
-
FIELD_TEXT_CLASSNAMES2[
|
|
2278
|
+
FIELD_TEXT_CLASSNAMES2[size],
|
|
2279
2279
|
disabled ? "cursor-not-allowed" : readOnly ? "cursor-default" : "cursor-text"
|
|
2280
2280
|
);
|
|
2281
2281
|
const pickerAdornmentClassName = cx(
|
|
@@ -2520,7 +2520,7 @@ function DatePicker({
|
|
|
2520
2520
|
...visibleInputProps,
|
|
2521
2521
|
className: cx(integratedInputClassName, className),
|
|
2522
2522
|
style: {
|
|
2523
|
-
padding: getTextInputPadding(
|
|
2523
|
+
padding: getTextInputPadding(size, {
|
|
2524
2524
|
leadingPadding: leadingContentGap,
|
|
2525
2525
|
trailingPadding: controlMetrics.paddingX + trailingInset
|
|
2526
2526
|
})
|
|
@@ -2537,9 +2537,9 @@ function DatePicker({
|
|
|
2537
2537
|
"input",
|
|
2538
2538
|
{
|
|
2539
2539
|
...visibleInputProps,
|
|
2540
|
-
className: cx(fieldBaseClassName, FIELD_PADDING_X_CLASSNAMES2[
|
|
2540
|
+
className: cx(fieldBaseClassName, FIELD_PADDING_X_CLASSNAMES2[size], className),
|
|
2541
2541
|
style: {
|
|
2542
|
-
padding: getTextInputPadding(
|
|
2542
|
+
padding: getTextInputPadding(size, {
|
|
2543
2543
|
trailingPadding: controlMetrics.paddingX + trailingInset
|
|
2544
2544
|
}),
|
|
2545
2545
|
boxShadow: resolvedError ? "0 0 0 3px var(--theme-negative), 0px 4px 5px var(--theme-shadow)" : "0px 4px 5px var(--theme-shadow)",
|
|
@@ -2671,7 +2671,7 @@ function SelectBase({
|
|
|
2671
2671
|
hint,
|
|
2672
2672
|
error,
|
|
2673
2673
|
placeholder,
|
|
2674
|
-
|
|
2674
|
+
size = "sm",
|
|
2675
2675
|
id,
|
|
2676
2676
|
disabled,
|
|
2677
2677
|
style,
|
|
@@ -2744,7 +2744,7 @@ function SelectBase({
|
|
|
2744
2744
|
const visibleEnabledValues = visibleEnabledOptions.map((option) => option.value);
|
|
2745
2745
|
const selectedValuesKey = selectedValues.join("\0");
|
|
2746
2746
|
const visibleEnabledValuesKey = visibleEnabledValues.join("\0");
|
|
2747
|
-
const indicatorOffset = getSelectIndicatorOffset(
|
|
2747
|
+
const indicatorOffset = getSelectIndicatorOffset(size);
|
|
2748
2748
|
const controlTextNudgeStyle = getSelectTextNudgeStyle();
|
|
2749
2749
|
const listboxId = `${resolvedId}-listbox`;
|
|
2750
2750
|
const searchInputId = `${resolvedId}-search`;
|
|
@@ -2764,8 +2764,8 @@ function SelectBase({
|
|
|
2764
2764
|
"m-0 box-border flex w-full min-w-0 items-center justify-between gap-3 rounded-2xl border-0 appearance-none",
|
|
2765
2765
|
"bg-[var(--theme-surface)] outline-none transition-[border-color,box-shadow,background-color]",
|
|
2766
2766
|
"duration-150 text-left",
|
|
2767
|
-
FIELD_HEIGHT_CLASSNAMES3[
|
|
2768
|
-
FIELD_TEXT_CLASSNAMES3[
|
|
2767
|
+
FIELD_HEIGHT_CLASSNAMES3[size],
|
|
2768
|
+
FIELD_TEXT_CLASSNAMES3[size],
|
|
2769
2769
|
hasSelection ? "text-[var(--theme-text)]" : "text-[var(--theme-textLight)]",
|
|
2770
2770
|
isTriggerDisabled ? "cursor-not-allowed" : "cursor-pointer"
|
|
2771
2771
|
);
|
|
@@ -3155,7 +3155,7 @@ function SelectBase({
|
|
|
3155
3155
|
onBlur: handleTriggerBlur,
|
|
3156
3156
|
onKeyDown: handleTriggerKeyDown,
|
|
3157
3157
|
style: {
|
|
3158
|
-
padding: getSelectControlPadding(
|
|
3158
|
+
padding: getSelectControlPadding(size),
|
|
3159
3159
|
boxShadow: triggerBoxShadow,
|
|
3160
3160
|
...style,
|
|
3161
3161
|
...isTriggerDisabled ? { opacity: DISABLED_FIELD_OPACITY } : {}
|
|
@@ -3362,7 +3362,7 @@ function SelectBase({
|
|
|
3362
3362
|
className: cx(
|
|
3363
3363
|
"flex w-full min-w-0 items-center justify-between gap-3 rounded-xl box-border",
|
|
3364
3364
|
"transition-[background-color,color] duration-150",
|
|
3365
|
-
OPTION_PADDING_CLASSNAMES[
|
|
3365
|
+
OPTION_PADDING_CLASSNAMES[size],
|
|
3366
3366
|
option.disabled ? "cursor-not-allowed text-[var(--theme-secondary)]" : "cursor-pointer",
|
|
3367
3367
|
!option.disabled && isActive ? "text-[var(--theme-onPrimary)]" : null,
|
|
3368
3368
|
!option.disabled && !isActive ? "text-[var(--theme-text)]" : null,
|
|
@@ -5301,7 +5301,7 @@ function Textarea({
|
|
|
5301
5301
|
label,
|
|
5302
5302
|
hint,
|
|
5303
5303
|
error,
|
|
5304
|
-
|
|
5304
|
+
size = "sm",
|
|
5305
5305
|
id,
|
|
5306
5306
|
disabled,
|
|
5307
5307
|
style,
|
|
@@ -5322,7 +5322,7 @@ function Textarea({
|
|
|
5322
5322
|
"duration-150 placeholder:opacity-100 disabled:cursor-not-allowed",
|
|
5323
5323
|
"placeholder:text-[var(--theme-textLight)]",
|
|
5324
5324
|
error ? "border-[var(--theme-negative)]" : "border-[var(--theme-textLight)]",
|
|
5325
|
-
TEXTAREA_SIZE_CLASSNAMES[
|
|
5325
|
+
TEXTAREA_SIZE_CLASSNAMES[size]
|
|
5326
5326
|
),
|
|
5327
5327
|
style: {
|
|
5328
5328
|
boxShadow: error ? "0 0 0 3px var(--theme-negative), 0px 4px 5px var(--theme-shadow)" : "0px 4px 5px var(--theme-shadow)",
|