@scripso-homepad/ui 0.4.8 → 0.4.10

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.
Files changed (39) hide show
  1. package/dist/{chunk-DAOLVE64.js → chunk-YSDLHEJ7.js} +204 -14
  2. package/dist/chunk-YSDLHEJ7.js.map +1 -0
  3. package/dist/index.cjs +130 -87
  4. package/dist/index.cjs.map +1 -1
  5. package/dist/index.d.cts +2 -0
  6. package/dist/index.d.ts +2 -0
  7. package/dist/index.js +176 -323
  8. package/dist/index.js.map +1 -1
  9. package/dist/web/index.cjs +882 -30
  10. package/dist/web/index.cjs.map +1 -1
  11. package/dist/web/index.css +161 -0
  12. package/dist/web/index.css.map +1 -1
  13. package/dist/web/index.d.cts +90 -3
  14. package/dist/web/index.d.ts +90 -3
  15. package/dist/web/index.js +645 -19
  16. package/dist/web/index.js.map +1 -1
  17. package/package.json +9 -3
  18. package/src/components/Button.tsx +10 -3
  19. package/src/components/DatePicker.tsx +37 -3
  20. package/src/components/Select.tsx +1 -1
  21. package/src/web/components/ConfirmModal.stories.tsx +55 -0
  22. package/src/web/components/ConfirmModal.tsx +116 -0
  23. package/src/web/components/Drawer.stories.tsx +234 -0
  24. package/src/web/components/Drawer.tsx +169 -0
  25. package/src/web/components/HistoryTimeline.tsx +46 -0
  26. package/src/web/components/Modal.stories.tsx +130 -0
  27. package/src/web/components/Modal.tsx +162 -0
  28. package/src/web/components/TableActionButton.tsx +9 -4
  29. package/src/web/components/Toaster.stories.tsx +106 -0
  30. package/src/web/components/Toaster.tsx +92 -0
  31. package/src/web/components/ToasterProvider.tsx +6 -0
  32. package/src/web/components/drawer-scroll.css +41 -0
  33. package/src/web/components/sonner-toast.css +141 -0
  34. package/src/web/icons/TimelineCheckIcon.tsx +24 -0
  35. package/src/web/icons/ToastIcons.tsx +119 -0
  36. package/src/web/index.ts +26 -0
  37. package/src/web/mutation-toast.ts +33 -0
  38. package/src/web/toast.ts +1 -0
  39. package/dist/chunk-DAOLVE64.js.map +0 -1
package/dist/index.cjs CHANGED
@@ -359,12 +359,16 @@ function Button({
359
359
  const textRef = react.useRef(null);
360
360
  const preset = variantConfig[variant];
361
361
  const metrics = sizeConfig[size];
362
- useApplyWebClassName(containerRef, className);
363
- useApplyWebClassName(textRef, textClassName);
364
362
  const label = typeof children !== "undefined" ? children : title;
365
363
  const hasCustomChildren = typeof children !== "undefined";
366
364
  const customIcon = icon != null && typeof icon !== "boolean" ? icon : void 0;
367
365
  const hasIcon = showIcon || icon === true || customIcon != null;
366
+ const resolvedContainerClassName = [
367
+ reactNative.Platform.OS === "web" ? "max-md:px-4!" : "",
368
+ className
369
+ ].filter(Boolean).join(" ");
370
+ useApplyWebClassName(containerRef, resolvedContainerClassName || void 0);
371
+ useApplyWebClassName(textRef, textClassName);
368
372
  const iconNode = customIcon ?? /* @__PURE__ */ jsxRuntime.jsx(ArrowUpRightIcon, { size: metrics.iconSize, color: preset.iconColor });
369
373
  const containerStyle = [
370
374
  styles.base,
@@ -1232,7 +1236,7 @@ function Select({
1232
1236
  const optionHeight = compact ? SELECT_OPTION_HEIGHT_COMPACT : SELECT_OPTION_HEIGHT;
1233
1237
  const needsScroll = react.useMemo(
1234
1238
  () => resolveSelectDropdownContentHeight(options.length, optionHeight) > SELECT_DROPDOWN_MAX_HEIGHT - SELECT_DROPDOWN_PADDING * 2,
1235
- [compact, optionHeight, options.length]
1239
+ [optionHeight, options.length]
1236
1240
  );
1237
1241
  useApplyWebClassName(wrapperRef, className);
1238
1242
  useApplyWebClassName(triggerRef, fieldClassName);
@@ -2986,6 +2990,8 @@ function DatePicker(props) {
2986
2990
  containerStyle,
2987
2991
  className,
2988
2992
  fieldClassName,
2993
+ fieldStyle,
2994
+ fieldOutlineStyle,
2989
2995
  panelClassName,
2990
2996
  labelClassName,
2991
2997
  errorClassName,
@@ -3079,96 +3085,120 @@ function DatePicker(props) {
3079
3085
  closePicker();
3080
3086
  }
3081
3087
  }
3082
- return /* @__PURE__ */ jsxRuntime.jsxs(reactNative.View, { ref: wrapperRef, style: [styles7.wrapper, containerStyle], children: [
3083
- label ? /* @__PURE__ */ jsxRuntime.jsx(Label, { disabled, style: styles7.label, className: labelClassName, children: label }) : null,
3084
- /* @__PURE__ */ jsxRuntime.jsx(reactNative.View, { style: [fieldStyles.outline, styles7.fieldOutline], children: /* @__PURE__ */ jsxRuntime.jsxs(
3085
- reactNative.Pressable,
3086
- {
3087
- ref: triggerRef,
3088
- accessibilityRole: "button",
3089
- accessibilityState: { disabled, expanded: open },
3090
- disabled,
3091
- onPress: openPicker,
3092
- style: [calendarFieldMetrics.container, fieldStyles.container],
3093
- children: [
3088
+ const isFluidField = Boolean(fieldStyle) || Boolean(fieldOutlineStyle);
3089
+ return /* @__PURE__ */ jsxRuntime.jsxs(
3090
+ reactNative.View,
3091
+ {
3092
+ ref: wrapperRef,
3093
+ style: [styles7.wrapper, isFluidField && styles7.wrapperFluid, containerStyle],
3094
+ children: [
3095
+ label ? /* @__PURE__ */ jsxRuntime.jsx(Label, { disabled, style: styles7.label, className: labelClassName, children: label }) : null,
3096
+ /* @__PURE__ */ jsxRuntime.jsx(
3097
+ reactNative.View,
3098
+ {
3099
+ style: [
3100
+ fieldStyles.outline,
3101
+ styles7.fieldOutline,
3102
+ isFluidField && styles7.fieldOutlineFluid,
3103
+ fieldOutlineStyle
3104
+ ],
3105
+ children: /* @__PURE__ */ jsxRuntime.jsxs(
3106
+ reactNative.Pressable,
3107
+ {
3108
+ ref: triggerRef,
3109
+ accessibilityRole: "button",
3110
+ accessibilityState: { disabled, expanded: open },
3111
+ disabled,
3112
+ onPress: openPicker,
3113
+ style: [
3114
+ calendarFieldMetrics.container,
3115
+ isFluidField && styles7.fieldContainerFluid,
3116
+ fieldStyles.container,
3117
+ fieldStyle
3118
+ ],
3119
+ children: [
3120
+ /* @__PURE__ */ jsxRuntime.jsx(
3121
+ reactNative.Text,
3122
+ {
3123
+ style: [calendarFieldMetrics.value, valueTextStyle],
3124
+ numberOfLines: 1,
3125
+ children: displayValue
3126
+ }
3127
+ ),
3128
+ /* @__PURE__ */ jsxRuntime.jsx(reactNative.View, { style: styles7.iconSlot, children: /* @__PURE__ */ jsxRuntime.jsx(
3129
+ CalendarIcon,
3130
+ {
3131
+ size: CALENDAR_FIELD_ICON_SIZE,
3132
+ color: disabled ? colors.stormGray200 : colors.stormGray150
3133
+ }
3134
+ ) })
3135
+ ]
3136
+ }
3137
+ )
3138
+ }
3139
+ ),
3140
+ helperMessage ? /* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { ref: helperRef, style: error ? styles7.error : styles7.hint, children: helperMessage }) : null,
3141
+ /* @__PURE__ */ jsxRuntime.jsx(reactNative.Modal, { visible: open, transparent: true, animationType: "fade", onRequestClose: closePicker, children: /* @__PURE__ */ jsxRuntime.jsxs(reactNative.View, { style: styles7.modalRoot, children: [
3094
3142
  /* @__PURE__ */ jsxRuntime.jsx(
3095
- reactNative.Text,
3143
+ reactNative.Pressable,
3096
3144
  {
3097
- style: [calendarFieldMetrics.value, valueTextStyle],
3098
- numberOfLines: 1,
3099
- children: displayValue
3145
+ style: styles7.backdrop,
3146
+ onPress: closePicker,
3147
+ accessibilityRole: "button",
3148
+ accessibilityLabel: labels?.closeCalendar ?? translations.closeCalendar
3100
3149
  }
3101
3150
  ),
3102
- /* @__PURE__ */ jsxRuntime.jsx(reactNative.View, { style: styles7.iconSlot, children: /* @__PURE__ */ jsxRuntime.jsx(
3103
- CalendarIcon,
3104
- {
3105
- size: CALENDAR_FIELD_ICON_SIZE,
3106
- color: disabled ? colors.stormGray200 : colors.stormGray150
3107
- }
3108
- ) })
3109
- ]
3110
- }
3111
- ) }),
3112
- helperMessage ? /* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { ref: helperRef, style: error ? styles7.error : styles7.hint, children: helperMessage }) : null,
3113
- /* @__PURE__ */ jsxRuntime.jsx(reactNative.Modal, { visible: open, transparent: true, animationType: "fade", onRequestClose: closePicker, children: /* @__PURE__ */ jsxRuntime.jsxs(reactNative.View, { style: styles7.modalRoot, children: [
3114
- /* @__PURE__ */ jsxRuntime.jsx(
3115
- reactNative.Pressable,
3116
- {
3117
- style: styles7.backdrop,
3118
- onPress: closePicker,
3119
- accessibilityRole: "button",
3120
- accessibilityLabel: labels?.closeCalendar ?? translations.closeCalendar
3121
- }
3122
- ),
3123
- anchor ? /* @__PURE__ */ jsxRuntime.jsx(
3124
- reactNative.View,
3125
- {
3126
- style: [
3127
- styles7.panelPosition,
3128
- {
3129
- top: dropdownTop,
3130
- left: panelLeft,
3131
- width: panelWidth,
3132
- height: CALENDAR_PANEL_HEIGHT
3133
- }
3134
- ],
3135
- children: props.mode === "range" ? /* @__PURE__ */ jsxRuntime.jsx(
3136
- Calendar,
3137
- {
3138
- mode: "range",
3139
- value: props.value,
3140
- onChange: handleRangeSelect,
3141
- viewDate,
3142
- defaultViewDate: resolvedDefaultViewDate,
3143
- onViewDateChange,
3144
- locale: resolvedLocale,
3145
- labels,
3146
- minDate,
3147
- maxDate,
3148
- today,
3149
- className: panelClassName
3150
- }
3151
- ) : /* @__PURE__ */ jsxRuntime.jsx(
3152
- Calendar,
3151
+ anchor ? /* @__PURE__ */ jsxRuntime.jsx(
3152
+ reactNative.View,
3153
3153
  {
3154
- mode: "single",
3155
- value: props.value,
3156
- onChange: handleSingleSelect,
3157
- viewDate,
3158
- defaultViewDate: resolvedDefaultViewDate,
3159
- onViewDateChange,
3160
- locale: resolvedLocale,
3161
- labels,
3162
- minDate,
3163
- maxDate,
3164
- today,
3165
- className: panelClassName
3154
+ style: [
3155
+ styles7.panelPosition,
3156
+ {
3157
+ top: dropdownTop,
3158
+ left: panelLeft,
3159
+ width: panelWidth,
3160
+ height: CALENDAR_PANEL_HEIGHT
3161
+ }
3162
+ ],
3163
+ children: props.mode === "range" ? /* @__PURE__ */ jsxRuntime.jsx(
3164
+ Calendar,
3165
+ {
3166
+ mode: "range",
3167
+ value: props.value,
3168
+ onChange: handleRangeSelect,
3169
+ viewDate,
3170
+ defaultViewDate: resolvedDefaultViewDate,
3171
+ onViewDateChange,
3172
+ locale: resolvedLocale,
3173
+ labels,
3174
+ minDate,
3175
+ maxDate,
3176
+ today,
3177
+ className: panelClassName
3178
+ }
3179
+ ) : /* @__PURE__ */ jsxRuntime.jsx(
3180
+ Calendar,
3181
+ {
3182
+ mode: "single",
3183
+ value: props.value,
3184
+ onChange: handleSingleSelect,
3185
+ viewDate,
3186
+ defaultViewDate: resolvedDefaultViewDate,
3187
+ onViewDateChange,
3188
+ locale: resolvedLocale,
3189
+ labels,
3190
+ minDate,
3191
+ maxDate,
3192
+ today,
3193
+ className: panelClassName
3194
+ }
3195
+ )
3166
3196
  }
3167
- )
3168
- }
3169
- ) : null
3170
- ] }) })
3171
- ] });
3197
+ ) : null
3198
+ ] }) })
3199
+ ]
3200
+ }
3201
+ );
3172
3202
  }
3173
3203
  var styles7 = reactNative.StyleSheet.create({
3174
3204
  wrapper: {
@@ -3176,11 +3206,24 @@ var styles7 = reactNative.StyleSheet.create({
3176
3206
  maxWidth: "100%",
3177
3207
  gap: SELECT_LABEL_GAP
3178
3208
  },
3209
+ wrapperFluid: {
3210
+ width: "100%"
3211
+ },
3179
3212
  fieldOutline: {
3180
3213
  width: CALENDAR_FIELD_WIDTH,
3181
3214
  maxWidth: "100%",
3182
3215
  alignSelf: "flex-start"
3183
3216
  },
3217
+ fieldOutlineFluid: {
3218
+ width: "100%",
3219
+ alignSelf: "stretch"
3220
+ },
3221
+ fieldContainerFluid: {
3222
+ width: "100%",
3223
+ minWidth: 0,
3224
+ maxWidth: "100%",
3225
+ alignSelf: "stretch"
3226
+ },
3184
3227
  label: {
3185
3228
  ...calendarLabelTypography
3186
3229
  },