@scripso-homepad/ui 0.4.17 → 0.4.19

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.
@@ -28875,6 +28875,25 @@ function renderInputIcon(icon, color) {
28875
28875
  }
28876
28876
  return icon;
28877
28877
  }
28878
+ var INTEGER_KEYBOARD_TYPES = /* @__PURE__ */ new Set([
28879
+ "numeric",
28880
+ "number-pad",
28881
+ "phone-pad"
28882
+ ]);
28883
+ function sanitizeNumericInput(value, keyboardType) {
28884
+ if (keyboardType === "decimal-pad") {
28885
+ const normalized = value.replace(/,/g, ".").replace(/[^\d.]/g, "");
28886
+ const separatorIndex = normalized.indexOf(".");
28887
+ if (separatorIndex === -1) {
28888
+ return normalized;
28889
+ }
28890
+ return normalized.slice(0, separatorIndex + 1) + normalized.slice(separatorIndex + 1).replace(/\./g, "");
28891
+ }
28892
+ if (keyboardType && INTEGER_KEYBOARD_TYPES.has(keyboardType)) {
28893
+ return value.replace(/\D/g, "");
28894
+ }
28895
+ return value;
28896
+ }
28878
28897
  function Input({
28879
28898
  label,
28880
28899
  leftIcon,
@@ -28897,6 +28916,8 @@ function Input({
28897
28916
  showPasswordToggle,
28898
28917
  onFocus,
28899
28918
  onBlur,
28919
+ onChangeText,
28920
+ keyboardType,
28900
28921
  multiline,
28901
28922
  textAlignVertical,
28902
28923
  ...props
@@ -28931,6 +28952,9 @@ function Input({
28931
28952
  setFocused(false);
28932
28953
  onBlur?.(event);
28933
28954
  }
28955
+ function handleChangeText(value) {
28956
+ onChangeText?.(sanitizeNumericInput(value, keyboardType));
28957
+ }
28934
28958
  const helperMessage = error ?? hint;
28935
28959
  function togglePasswordVisibility() {
28936
28960
  if (!isDisabled) {
@@ -28981,6 +29005,7 @@ function Input({
28981
29005
  ],
28982
29006
  placeholderTextColor: fieldStyles.placeholder,
28983
29007
  editable,
29008
+ keyboardType,
28984
29009
  multiline,
28985
29010
  secureTextEntry: effectiveSecureTextEntry,
28986
29011
  textAlign: "left",
@@ -28988,7 +29013,8 @@ function Input({
28988
29013
  onFocus: handleFocus,
28989
29014
  onBlur: handleBlur,
28990
29015
  accessibilityState: { disabled: isDisabled },
28991
- ...props
29016
+ ...props,
29017
+ onChangeText: handleChangeText
28992
29018
  }
28993
29019
  ),
28994
29020
  trailingIcon ? /* @__PURE__ */ jsxRuntime.jsx(reactNative.View, { style: styles2.iconSlot, children: trailingIcon }) : null
@@ -29839,7 +29865,7 @@ function TableSortIcon({ direction = null, className }) {
29839
29865
  fill: "none",
29840
29866
  xmlns: "http://www.w3.org/2000/svg",
29841
29867
  "aria-hidden": true,
29842
- className: cn("shrink-0", className),
29868
+ className,
29843
29869
  children: [
29844
29870
  /* @__PURE__ */ jsxRuntime.jsx(
29845
29871
  "path",
@@ -30583,7 +30609,7 @@ function TableActionsMenu({
30583
30609
  {
30584
30610
  ref: triggerRef,
30585
30611
  variant: "menu",
30586
- icon: /* @__PURE__ */ jsxRuntime.jsx(TableMoreIcon, { className: "size-6" }),
30612
+ icon: /* @__PURE__ */ jsxRuntime.jsx(TableMoreIcon, { className: "size-5" }),
30587
30613
  ariaLabel: triggerAriaLabel,
30588
30614
  onClick: () => setOpen((current) => !current),
30589
30615
  "aria-expanded": open,
@@ -30997,7 +31023,8 @@ var styles3 = reactNative.StyleSheet.create({
30997
31023
  justifyContent: "center"
30998
31024
  },
30999
31025
  withIcon: {
31000
- justifyContent: "space-between"
31026
+ justifyContent: "space-between",
31027
+ gap: 24
31001
31028
  },
31002
31029
  disabled: {
31003
31030
  opacity: 0.6
@@ -31011,8 +31038,7 @@ var styles3 = reactNative.StyleSheet.create({
31011
31038
  },
31012
31039
  labelWithIcon: {
31013
31040
  flex: 1,
31014
- flexShrink: 1,
31015
- marginRight: 8
31041
+ flexShrink: 1
31016
31042
  },
31017
31043
  iconContainer: {
31018
31044
  alignItems: "center",
@@ -31196,6 +31222,8 @@ function Drawer({
31196
31222
  open,
31197
31223
  title,
31198
31224
  subtitle,
31225
+ subtitleClassName,
31226
+ headerBottom,
31199
31227
  children,
31200
31228
  footer,
31201
31229
  onClose,
@@ -31282,39 +31310,42 @@ function Drawer({
31282
31310
  /* @__PURE__ */ jsxRuntime.jsxs(
31283
31311
  "header",
31284
31312
  {
31285
- className: cn(
31286
- "flex h-[87px] shrink-0 items-start justify-between border-b border-storm-gray-50 pt-6 pr-6 pb-4 pl-6",
31287
- headerClassName
31288
- ),
31313
+ className: cn("shrink-0 border-b border-storm-gray-50", headerClassName),
31289
31314
  children: [
31290
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "min-w-0 flex flex-col gap-1", children: [
31315
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-start justify-between pt-6 pr-6 pb-4 pl-6", children: [
31316
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "min-w-0 flex flex-col gap-1", children: [
31317
+ /* @__PURE__ */ jsxRuntime.jsx(
31318
+ "h2",
31319
+ {
31320
+ id: "homepad-drawer-title",
31321
+ className: "typography-title-sm tracking-normal text-black",
31322
+ children: title
31323
+ }
31324
+ ),
31325
+ subtitle ? /* @__PURE__ */ jsxRuntime.jsx(
31326
+ "p",
31327
+ {
31328
+ id: "homepad-drawer-subtitle",
31329
+ className: cn(
31330
+ "typography-body tracking-normal text-storm-gray-400",
31331
+ subtitleClassName
31332
+ ),
31333
+ children: subtitle
31334
+ }
31335
+ ) : null
31336
+ ] }),
31291
31337
  /* @__PURE__ */ jsxRuntime.jsx(
31292
- "h2",
31338
+ "button",
31293
31339
  {
31294
- id: "homepad-drawer-title",
31295
- className: "typography-title-sm tracking-normal text-black",
31296
- children: title
31340
+ type: "button",
31341
+ "aria-label": closeAriaLabel,
31342
+ className: "flex size-8 shrink-0 cursor-pointer items-center justify-center rounded-lg text-storm-gray-400 transition-colors hover:bg-storm-gray-50 hover:text-storm-gray-600",
31343
+ onClick: onClose,
31344
+ children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.X, { className: "size-5", strokeWidth: 1.75 })
31297
31345
  }
31298
- ),
31299
- subtitle ? /* @__PURE__ */ jsxRuntime.jsx(
31300
- "p",
31301
- {
31302
- id: "homepad-drawer-subtitle",
31303
- className: "typography-body tracking-normal text-storm-gray-400",
31304
- children: subtitle
31305
- }
31306
- ) : null
31346
+ )
31307
31347
  ] }),
31308
- /* @__PURE__ */ jsxRuntime.jsx(
31309
- "button",
31310
- {
31311
- type: "button",
31312
- "aria-label": closeAriaLabel,
31313
- className: "flex size-8 shrink-0 cursor-pointer items-center justify-center rounded-lg text-storm-gray-400 transition-colors hover:bg-storm-gray-50 hover:text-storm-gray-600",
31314
- onClick: onClose,
31315
- children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.X, { className: "size-5", strokeWidth: 1.75 })
31316
- }
31317
- )
31348
+ headerBottom ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "border-t border-storm-gray-50 px-6", children: headerBottom }) : null
31318
31349
  ]
31319
31350
  }
31320
31351
  ),