smartsell-ui-kit 0.1.4 → 0.1.5
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 +54 -9
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +54 -9
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -155,6 +155,16 @@ var DISABLED_FIELD_OPACITY = 0.7;
|
|
|
155
155
|
|
|
156
156
|
// src/foundation/controlSize.ts
|
|
157
157
|
var CONTROL_LEADING_ICON_SHIFT = 5;
|
|
158
|
+
var CONTROL_TEXT_VERTICAL_SHIFT = 1;
|
|
159
|
+
var SELECT_TEXT_VERTICAL_SHIFT_REDUCTION = 1;
|
|
160
|
+
var getControlTextVerticalPadding = (size, shift = CONTROL_TEXT_VERTICAL_SHIFT) => {
|
|
161
|
+
const metrics = getControlMetrics(size);
|
|
162
|
+
return {
|
|
163
|
+
top: Math.max(0, metrics.paddingY - shift),
|
|
164
|
+
bottom: metrics.paddingY + shift
|
|
165
|
+
};
|
|
166
|
+
};
|
|
167
|
+
var getSelectTextVerticalShift = () => Math.max(0, CONTROL_TEXT_VERTICAL_SHIFT - SELECT_TEXT_VERTICAL_SHIFT_REDUCTION);
|
|
158
168
|
var CONTROL_METRICS_BY_SIZE = {
|
|
159
169
|
sm: {
|
|
160
170
|
height: 30,
|
|
@@ -195,6 +205,23 @@ var getControlLeadingIconInset = (size) => {
|
|
|
195
205
|
var getControlLeadingAdornmentWidth = (size, iconSize) => {
|
|
196
206
|
return getControlLeadingIconInset(size) + iconSize;
|
|
197
207
|
};
|
|
208
|
+
var getTextInputPadding = (size, options = {}) => {
|
|
209
|
+
var _a, _b;
|
|
210
|
+
const metrics = getControlMetrics(size);
|
|
211
|
+
const { top, bottom } = getControlTextVerticalPadding(size);
|
|
212
|
+
const leadingPadding = (_a = options.leadingPadding) != null ? _a : metrics.paddingX;
|
|
213
|
+
const trailingPadding = (_b = options.trailingPadding) != null ? _b : metrics.paddingX;
|
|
214
|
+
return `${top}px ${trailingPadding}px ${bottom}px ${leadingPadding}px`;
|
|
215
|
+
};
|
|
216
|
+
var getSelectControlPadding = (size) => {
|
|
217
|
+
const metrics = getControlMetrics(size);
|
|
218
|
+
const { top, bottom } = getControlTextVerticalPadding(size, getSelectTextVerticalShift());
|
|
219
|
+
return `${top}px ${metrics.selectPaddingRight}px ${bottom}px ${metrics.paddingX}px`;
|
|
220
|
+
};
|
|
221
|
+
var getControlTextNudgeStyle = (shift = CONTROL_TEXT_VERTICAL_SHIFT) => ({
|
|
222
|
+
transform: `translateY(-${shift}px)`
|
|
223
|
+
});
|
|
224
|
+
var getSelectTextNudgeStyle = () => getControlTextNudgeStyle(getSelectTextVerticalShift());
|
|
198
225
|
var getSelectIndicatorOffset = (size) => getControlMetrics(size).selectIndicatorOffset;
|
|
199
226
|
|
|
200
227
|
// src/foundation/shadow.ts
|
|
@@ -1607,6 +1634,7 @@ function Input({
|
|
|
1607
1634
|
const passwordLockIconSize = passwordToggleMetrics.iconSize + 2;
|
|
1608
1635
|
const leadingContentGap = Math.max(0, Math.round(controlMetrics.paddingX / 3));
|
|
1609
1636
|
const leadingIconInset = getControlLeadingIconInset(controlSize);
|
|
1637
|
+
const controlTextNudgeStyle = getControlTextNudgeStyle();
|
|
1610
1638
|
const hasExternalError = error !== void 0 && error !== null && error !== "";
|
|
1611
1639
|
const resolvedError = hasExternalError ? error : validationError;
|
|
1612
1640
|
const hasResolvedError = resolvedError !== void 0 && resolvedError !== null && resolvedError !== "";
|
|
@@ -1734,7 +1762,7 @@ function Input({
|
|
|
1734
1762
|
children: resolvedFileIcon
|
|
1735
1763
|
}
|
|
1736
1764
|
),
|
|
1737
|
-
showUploadLabel ? fileButtonLabel : null
|
|
1765
|
+
showUploadLabel ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { style: controlTextNudgeStyle, children: fileButtonLabel }) : null
|
|
1738
1766
|
]
|
|
1739
1767
|
}
|
|
1740
1768
|
),
|
|
@@ -1759,7 +1787,10 @@ function Input({
|
|
|
1759
1787
|
FIELD_TEXT_CLASSNAMES[controlSize],
|
|
1760
1788
|
hasSelectedFiles ? "text-[var(--theme-text)]" : "text-[var(--theme-textLight)]"
|
|
1761
1789
|
),
|
|
1762
|
-
style: {
|
|
1790
|
+
style: {
|
|
1791
|
+
padding: `0 ${controlMetrics.paddingX}px 0 ${leadingContentGap}px`,
|
|
1792
|
+
...controlTextNudgeStyle
|
|
1793
|
+
},
|
|
1763
1794
|
children: fileSelectionText
|
|
1764
1795
|
}
|
|
1765
1796
|
) : null
|
|
@@ -1813,7 +1844,9 @@ function Input({
|
|
|
1813
1844
|
onChange: handleValidatedInputChange,
|
|
1814
1845
|
className: cx(adornedInputClassName, className),
|
|
1815
1846
|
"aria-invalid": hasResolvedError,
|
|
1816
|
-
style: {
|
|
1847
|
+
style: {
|
|
1848
|
+
padding: getTextInputPadding(controlSize, { leadingPadding: leadingContentGap })
|
|
1849
|
+
}
|
|
1817
1850
|
}
|
|
1818
1851
|
)
|
|
1819
1852
|
]
|
|
@@ -1852,7 +1885,9 @@ function Input({
|
|
|
1852
1885
|
onChange: handleValidatedInputChange,
|
|
1853
1886
|
className: cx(adornedInputClassName, className),
|
|
1854
1887
|
"aria-invalid": hasResolvedError,
|
|
1855
|
-
style: {
|
|
1888
|
+
style: {
|
|
1889
|
+
padding: getTextInputPadding(controlSize, { leadingPadding: leadingContentGap })
|
|
1890
|
+
}
|
|
1856
1891
|
}
|
|
1857
1892
|
)
|
|
1858
1893
|
]
|
|
@@ -1868,7 +1903,11 @@ function Input({
|
|
|
1868
1903
|
onChange: handleValidatedInputChange,
|
|
1869
1904
|
"aria-invalid": hasResolvedError,
|
|
1870
1905
|
className: cx(fieldBaseClassName, FIELD_PADDING_X_CLASSNAMES[controlSize], className),
|
|
1871
|
-
style: {
|
|
1906
|
+
style: {
|
|
1907
|
+
boxShadow: "0px 4px 5px var(--theme-shadow)",
|
|
1908
|
+
padding: getTextInputPadding(controlSize),
|
|
1909
|
+
...style
|
|
1910
|
+
}
|
|
1872
1911
|
}
|
|
1873
1912
|
);
|
|
1874
1913
|
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
@@ -2481,7 +2520,10 @@ function DatePicker({
|
|
|
2481
2520
|
...visibleInputProps,
|
|
2482
2521
|
className: cx(integratedInputClassName, className),
|
|
2483
2522
|
style: {
|
|
2484
|
-
padding:
|
|
2523
|
+
padding: getTextInputPadding(controlSize, {
|
|
2524
|
+
leadingPadding: leadingContentGap,
|
|
2525
|
+
trailingPadding: controlMetrics.paddingX + trailingInset
|
|
2526
|
+
})
|
|
2485
2527
|
}
|
|
2486
2528
|
}
|
|
2487
2529
|
),
|
|
@@ -2497,7 +2539,9 @@ function DatePicker({
|
|
|
2497
2539
|
...visibleInputProps,
|
|
2498
2540
|
className: cx(fieldBaseClassName, FIELD_PADDING_X_CLASSNAMES2[controlSize], className),
|
|
2499
2541
|
style: {
|
|
2500
|
-
|
|
2542
|
+
padding: getTextInputPadding(controlSize, {
|
|
2543
|
+
trailingPadding: controlMetrics.paddingX + trailingInset
|
|
2544
|
+
}),
|
|
2501
2545
|
boxShadow: resolvedError ? "0 0 0 3px var(--theme-negative), 0px 4px 5px var(--theme-shadow)" : "0px 4px 5px var(--theme-shadow)",
|
|
2502
2546
|
...style,
|
|
2503
2547
|
...disabledFieldStyle
|
|
@@ -2701,7 +2745,7 @@ function SelectBase({
|
|
|
2701
2745
|
const selectedValuesKey = selectedValues.join("\0");
|
|
2702
2746
|
const visibleEnabledValuesKey = visibleEnabledValues.join("\0");
|
|
2703
2747
|
const indicatorOffset = getSelectIndicatorOffset(controlSize);
|
|
2704
|
-
const
|
|
2748
|
+
const controlTextNudgeStyle = getSelectTextNudgeStyle();
|
|
2705
2749
|
const listboxId = `${resolvedId}-listbox`;
|
|
2706
2750
|
const searchInputId = `${resolvedId}-search`;
|
|
2707
2751
|
const scrollbarThumbColor = theme.colors.secondary;
|
|
@@ -3111,7 +3155,7 @@ function SelectBase({
|
|
|
3111
3155
|
onBlur: handleTriggerBlur,
|
|
3112
3156
|
onKeyDown: handleTriggerKeyDown,
|
|
3113
3157
|
style: {
|
|
3114
|
-
padding:
|
|
3158
|
+
padding: getSelectControlPadding(controlSize),
|
|
3115
3159
|
boxShadow: triggerBoxShadow,
|
|
3116
3160
|
...style,
|
|
3117
3161
|
...isTriggerDisabled ? { opacity: DISABLED_FIELD_OPACITY } : {}
|
|
@@ -3121,6 +3165,7 @@ function SelectBase({
|
|
|
3121
3165
|
"span",
|
|
3122
3166
|
{
|
|
3123
3167
|
className: "block min-w-0 flex-1 overflow-hidden text-ellipsis whitespace-nowrap",
|
|
3168
|
+
style: controlTextNudgeStyle,
|
|
3124
3169
|
children: displayContent
|
|
3125
3170
|
}
|
|
3126
3171
|
),
|