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.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
@@ -1575,6 +1602,7 @@ function Input({
1575
1602
  const passwordLockIconSize = passwordToggleMetrics.iconSize + 2;
1576
1603
  const leadingContentGap = Math.max(0, Math.round(controlMetrics.paddingX / 3));
1577
1604
  const leadingIconInset = getControlLeadingIconInset(controlSize);
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 !== "";
@@ -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
  ),
@@ -1727,7 +1755,10 @@ function Input({
1727
1755
  FIELD_TEXT_CLASSNAMES[controlSize],
1728
1756
  hasSelectedFiles ? "text-[var(--theme-text)]" : "text-[var(--theme-textLight)]"
1729
1757
  ),
1730
- style: { padding: `0 ${controlMetrics.paddingX}px 0 ${leadingContentGap}px` },
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: { padding: `0 ${controlMetrics.paddingX}px 0 ${leadingContentGap}px` }
1815
+ style: {
1816
+ padding: getTextInputPadding(controlSize, { 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: { padding: `0 ${controlMetrics.paddingX}px 0 ${leadingContentGap}px` }
1856
+ style: {
1857
+ padding: getTextInputPadding(controlSize, { leadingPadding: leadingContentGap })
1858
+ }
1824
1859
  }
1825
1860
  )
1826
1861
  ]
@@ -1836,7 +1871,11 @@ function Input({
1836
1871
  onChange: handleValidatedInputChange,
1837
1872
  "aria-invalid": hasResolvedError,
1838
1873
  className: cx(fieldBaseClassName, FIELD_PADDING_X_CLASSNAMES[controlSize], className),
1839
- style: { boxShadow: "0px 4px 5px var(--theme-shadow)", ...style }
1874
+ style: {
1875
+ boxShadow: "0px 4px 5px var(--theme-shadow)",
1876
+ padding: getTextInputPadding(controlSize),
1877
+ ...style
1878
+ }
1840
1879
  }
1841
1880
  );
1842
1881
  return /* @__PURE__ */ jsx6(
@@ -2449,7 +2488,10 @@ function DatePicker({
2449
2488
  ...visibleInputProps,
2450
2489
  className: cx(integratedInputClassName, className),
2451
2490
  style: {
2452
- padding: `${controlMetrics.paddingY}px ${controlMetrics.paddingX + trailingInset}px ${controlMetrics.paddingY}px ${leadingContentGap}px`
2491
+ padding: getTextInputPadding(controlSize, {
2492
+ leadingPadding: leadingContentGap,
2493
+ trailingPadding: controlMetrics.paddingX + trailingInset
2494
+ })
2453
2495
  }
2454
2496
  }
2455
2497
  ),
@@ -2465,7 +2507,9 @@ function DatePicker({
2465
2507
  ...visibleInputProps,
2466
2508
  className: cx(fieldBaseClassName, FIELD_PADDING_X_CLASSNAMES2[controlSize], className),
2467
2509
  style: {
2468
- paddingRight: controlMetrics.paddingX + trailingInset,
2510
+ padding: getTextInputPadding(controlSize, {
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
@@ -2674,7 +2718,7 @@ function SelectBase({
2674
2718
  const selectedValuesKey = selectedValues.join("\0");
2675
2719
  const visibleEnabledValuesKey = visibleEnabledValues.join("\0");
2676
2720
  const indicatorOffset = getSelectIndicatorOffset(controlSize);
2677
- const controlMetrics = getControlMetrics(controlSize);
2721
+ const controlTextNudgeStyle = getSelectTextNudgeStyle();
2678
2722
  const listboxId = `${resolvedId}-listbox`;
2679
2723
  const searchInputId = `${resolvedId}-search`;
2680
2724
  const scrollbarThumbColor = theme.colors.secondary;
@@ -3084,7 +3128,7 @@ function SelectBase({
3084
3128
  onBlur: handleTriggerBlur,
3085
3129
  onKeyDown: handleTriggerKeyDown,
3086
3130
  style: {
3087
- padding: `${controlMetrics.paddingY}px ${controlMetrics.selectPaddingRight}px ${controlMetrics.paddingY}px ${controlMetrics.paddingX}px`,
3131
+ padding: getSelectControlPadding(controlSize),
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
  ),