@scripso-homepad/ui 0.4.2 → 0.4.3

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 (81) hide show
  1. package/dist/{chunk-WDSMJWKC.js → chunk-66WR57JJ.js} +35 -3
  2. package/dist/chunk-66WR57JJ.js.map +1 -0
  3. package/dist/index.cjs +2260 -385
  4. package/dist/index.cjs.map +1 -1
  5. package/dist/index.d.cts +133 -1
  6. package/dist/index.d.ts +133 -1
  7. package/dist/index.js +1960 -97
  8. package/dist/index.js.map +1 -1
  9. package/dist/web/index.cjs +30650 -1009
  10. package/dist/web/index.cjs.map +1 -1
  11. package/dist/web/index.css +78 -0
  12. package/dist/web/index.css.map +1 -0
  13. package/dist/web/index.d.cts +267 -6
  14. package/dist/web/index.d.ts +267 -6
  15. package/dist/web/index.js +30179 -601
  16. package/dist/web/index.js.map +1 -1
  17. package/package.json +5 -4
  18. package/src/components/Calendar.stories.tsx +337 -0
  19. package/src/components/Calendar.tsx +441 -0
  20. package/src/components/DatePicker.stories.tsx +219 -0
  21. package/src/components/DatePicker.tsx +366 -0
  22. package/src/components/Select.stories.tsx +134 -0
  23. package/src/components/Select.tsx +462 -0
  24. package/src/css.d.ts +1 -0
  25. package/src/icons/CalendarIcon.tsx +28 -0
  26. package/src/icons/CalendarIcon.web.tsx +34 -0
  27. package/src/icons/ChevronDownIcon.tsx +11 -4
  28. package/src/icons/ChevronDownIcon.web.tsx +6 -4
  29. package/src/icons/ChevronNavIcons.tsx +44 -0
  30. package/src/icons/ChevronNavIcons.web.tsx +57 -0
  31. package/src/icons/calendarIconPaths.ts +2 -0
  32. package/src/icons/chevronDownPath.ts +1 -0
  33. package/src/icons/chevronNavPaths.ts +2 -0
  34. package/src/index.ts +41 -0
  35. package/src/theme/calendar.ts +357 -0
  36. package/src/theme/select.ts +249 -0
  37. package/src/utils/calendarDays.ts +273 -0
  38. package/src/utils/calendarLocaleContext.tsx +95 -0
  39. package/src/utils/calendarLocalization.ts +187 -0
  40. package/src/utils/countryDropdownScrollStyles.ts +53 -13
  41. package/src/utils/formatMultiSelectDisplay.ts +56 -0
  42. package/src/web/components/Badge.stories.tsx +43 -0
  43. package/src/web/components/Badge.tsx +35 -0
  44. package/src/web/components/Pagination.stories.tsx +78 -0
  45. package/src/web/components/Pagination.tsx +153 -0
  46. package/src/web/components/StatusBadge.tsx +20 -0
  47. package/src/web/components/Table.stories.tsx +415 -0
  48. package/src/web/components/Table.tsx +3 -0
  49. package/src/web/components/TableActionButton.tsx +67 -0
  50. package/src/web/components/TableActionsMenu.tsx +208 -0
  51. package/src/web/components/TableIconText.tsx +23 -0
  52. package/src/web/components/TableRowStatusActions.tsx +33 -0
  53. package/src/web/components/TableStatusActionsCell.tsx +29 -0
  54. package/src/web/components/pagination-utils.ts +39 -0
  55. package/src/web/components/table/DataTable.tsx +123 -0
  56. package/src/web/components/table/TablePrimitives.tsx +214 -0
  57. package/src/web/components/table/TableScrollArea.tsx +51 -0
  58. package/src/web/components/table/constants.ts +59 -0
  59. package/src/web/components/table/data-table-class-names.ts +26 -0
  60. package/src/web/components/table/index.ts +44 -0
  61. package/src/web/components/table/table-row-context.tsx +19 -0
  62. package/src/web/components/table/use-horizontal-scroll-state.ts +72 -0
  63. package/src/web/components/table-scroll.css +81 -0
  64. package/src/web/hooks/useOnClickOutside.ts +20 -5
  65. package/src/web/icons/TableMenuActivateIcon.tsx +27 -0
  66. package/src/web/icons/TableMenuCheckIcon.tsx +27 -0
  67. package/src/web/icons/TableMenuCloseIcon.tsx +27 -0
  68. package/src/web/icons/TableMenuEditIcon.tsx +27 -0
  69. package/src/web/icons/TableMenuInfoIcon.tsx +27 -0
  70. package/src/web/icons/TableMenuRefreshIcon.tsx +27 -0
  71. package/src/web/icons/TableMenuSuspendIcon.tsx +34 -0
  72. package/src/web/icons/TableMenuTrashIcon.tsx +27 -0
  73. package/src/web/icons/TableMoreIcon.tsx +41 -0
  74. package/src/web/icons/TableSortIcon.tsx +37 -0
  75. package/src/web/index.ts +74 -0
  76. package/src/web/layout/AppHeader.stories.tsx +2 -0
  77. package/src/web/layout/AppHeader.tsx +18 -14
  78. package/src/web/layout/DashboardLayout.stories.tsx +1 -0
  79. package/src/web/layout/DashboardLayout.tsx +4 -4
  80. package/src/web/layout/story-helpers.tsx +10 -2
  81. package/dist/chunk-WDSMJWKC.js.map +0 -1
package/dist/index.d.cts CHANGED
@@ -48,6 +48,41 @@ interface InputProps extends TextInputProps {
48
48
  }
49
49
  declare function Input({ label, leftIcon, rightIcon, error, invalid, hint, containerStyle, style, className, fieldClassName, fieldStyle, labelClassName, inputClassName, errorClassName, hintClassName, editable, secureTextEntry, showPasswordToggle, onFocus, onBlur, ...props }: InputProps): react.JSX.Element;
50
50
 
51
+ type SelectOption = {
52
+ value: string;
53
+ label: string;
54
+ disabled?: boolean;
55
+ };
56
+ interface SelectBaseProps {
57
+ label?: string;
58
+ placeholder?: string;
59
+ options: SelectOption[];
60
+ leftIcon?: ReactNode;
61
+ disabled?: boolean;
62
+ error?: string;
63
+ invalid?: boolean;
64
+ hint?: string;
65
+ containerStyle?: StyleProp<ViewStyle>;
66
+ className?: string;
67
+ fieldClassName?: string;
68
+ menuClassName?: string;
69
+ labelClassName?: string;
70
+ errorClassName?: string;
71
+ hintClassName?: string;
72
+ }
73
+ interface SingleSelectProps extends SelectBaseProps {
74
+ multiple?: false;
75
+ value?: string;
76
+ onValueChange?: (value: string) => void;
77
+ }
78
+ interface MultipleSelectProps extends SelectBaseProps {
79
+ multiple: true;
80
+ value?: string[];
81
+ onValueChange?: (value: string[]) => void;
82
+ }
83
+ type SelectProps = SingleSelectProps | MultipleSelectProps;
84
+ declare function Select({ label, placeholder, value, onValueChange, options, leftIcon, multiple, disabled, error, invalid, hint, containerStyle, className, fieldClassName, menuClassName, labelClassName, errorClassName, hintClassName, }: SelectProps): react.JSX.Element;
85
+
51
86
  interface PhoneInputProps extends Omit<TextInputProps, "style"> {
52
87
  label?: string;
53
88
  countryCode?: string;
@@ -84,6 +119,103 @@ interface CountryCodeSelectorProps {
84
119
  }
85
120
  declare function CountryCodeSelector({ value, onValueChange, options, disabled, style, className, }: CountryCodeSelectorProps): react.JSX.Element;
86
121
 
122
+ type DateRange = {
123
+ start: Date;
124
+ end?: Date;
125
+ };
126
+
127
+ type CalendarLocale = "hy-AM" | "en-US" | "ru-RU";
128
+ type CalendarTranslationKey$1 = "datePlaceholder" | "rangePlaceholder" | "previousMonth" | "nextMonth" | "previousYear" | "nextYear" | "previousYears" | "nextYears" | "selectMonth" | "selectYear" | "closeCalendar";
129
+ type CalendarTranslations = Record<CalendarTranslationKey$1, string> & {
130
+ /** Weekday labels in Monday-first order. */
131
+ weekdays: string[];
132
+ /** Short month labels used in compact calendar headers and month picker cells. */
133
+ monthsShort: string[];
134
+ /** Full month labels available for consumers that need long-form display. */
135
+ monthsLong: string[];
136
+ };
137
+ declare const calendarTranslations: Record<CalendarLocale, CalendarTranslations>;
138
+ declare function resolveCalendarLocale(locale: string): CalendarLocale;
139
+ declare function getCalendarTranslations(locale: string): CalendarTranslations;
140
+ declare function resolveWeekdayLabels(locale: string): string[];
141
+ declare function getCalendarMonthLabels(locale: string, width?: "short" | "long"): string[];
142
+ declare function formatLocalizedCalendarMonthYear(date: Date, locale: string): string;
143
+
144
+ type CalendarLabels = Partial<Pick<CalendarTranslations, CalendarTranslationKey>> & {
145
+ weekdays?: string[];
146
+ formatMonthYear?: (date: Date) => string;
147
+ };
148
+ type CalendarTranslationKey = "previousMonth" | "nextMonth" | "previousYear" | "nextYear" | "previousYears" | "nextYears" | "selectMonth" | "selectYear" | "closeCalendar";
149
+ type CalendarBaseProps = {
150
+ viewDate?: Date;
151
+ defaultViewDate?: Date;
152
+ onViewDateChange?: (date: Date) => void;
153
+ locale?: string;
154
+ labels?: CalendarLabels;
155
+ minDate?: Date;
156
+ maxDate?: Date;
157
+ today?: Date;
158
+ style?: StyleProp<ViewStyle>;
159
+ className?: string;
160
+ };
161
+ type CalendarSingleProps = CalendarBaseProps & {
162
+ mode?: "single";
163
+ value?: Date;
164
+ onChange?: (date: Date) => void;
165
+ };
166
+ type CalendarRangeProps = CalendarBaseProps & {
167
+ mode: "range";
168
+ value?: DateRange;
169
+ onChange?: (range: DateRange) => void;
170
+ };
171
+ type CalendarProps = CalendarSingleProps | CalendarRangeProps;
172
+ declare function Calendar(props: CalendarProps): react.JSX.Element;
173
+
174
+ type CalendarLocaleProviderProps = {
175
+ locale: string;
176
+ children: ReactNode;
177
+ };
178
+ declare function CalendarLocaleProvider({ locale, children }: CalendarLocaleProviderProps): react.JSX.Element;
179
+ declare function useCalendarLocale(locale?: string): CalendarLocale;
180
+
181
+ type DatePickerFieldProps = {
182
+ label?: string;
183
+ placeholder?: string;
184
+ disabled?: boolean;
185
+ error?: string;
186
+ invalid?: boolean;
187
+ hint?: string;
188
+ containerStyle?: StyleProp<ViewStyle>;
189
+ className?: string;
190
+ fieldClassName?: string;
191
+ panelClassName?: string;
192
+ labelClassName?: string;
193
+ errorClassName?: string;
194
+ hintClassName?: string;
195
+ /** Opens the calendar popup on mount (useful for Storybook previews). */
196
+ defaultOpen?: boolean;
197
+ /** Closes the popup after a complete range is selected. Defaults to true in range mode. */
198
+ closeOnRangeComplete?: boolean;
199
+ };
200
+ type DatePickerSingleProps = Omit<CalendarSingleProps, "style" | "className"> & DatePickerFieldProps & {
201
+ mode?: "single";
202
+ formatDate?: (date: Date) => string;
203
+ };
204
+ type DatePickerRangeProps = Omit<CalendarRangeProps, "style" | "className"> & DatePickerFieldProps & {
205
+ mode: "range";
206
+ formatRange?: (range: DateRange) => string;
207
+ rangeSeparator?: string;
208
+ };
209
+ type DatePickerProps = DatePickerSingleProps | DatePickerRangeProps;
210
+ declare function DatePicker(props: DatePickerProps): react.JSX.Element;
211
+
212
+ interface CalendarIconProps {
213
+ size?: number;
214
+ color?: string;
215
+ strokeWidth?: number;
216
+ }
217
+ declare function CalendarIcon({ size, color, strokeWidth, }: CalendarIconProps): react.JSX.Element;
218
+
87
219
  interface LabelProps extends TextProps {
88
220
  children: ReactNode;
89
221
  /** Render as a required field indicator. */
@@ -348,4 +480,4 @@ declare const shadows: {
348
480
  };
349
481
  };
350
482
 
351
- export { Button, type ButtonProps, type ButtonSize, type ButtonVariant, type Country, CountryCodeSelector, type CountryCodeSelectorProps, type EmeraldGreenStep, Input, type InputProps, Label, type LabelProps, LockIcon, type NavyStep, PhoneInput, type PhoneInputProps, type RubyRedStep, type StormGrayStep, brand, buttonTypography, colors, countries, defaultCountry, emeraldGreen, findCountry, fontSize, fontWeight, fonts, labelTypography, navy, radii, rubyRed, shadows, spacing, stormGray };
483
+ export { Button, type ButtonProps, type ButtonSize, type ButtonVariant, Calendar, CalendarIcon, type CalendarLabels, type CalendarLocale, CalendarLocaleProvider, type CalendarLocaleProviderProps, type CalendarProps, type CalendarRangeProps, type CalendarSingleProps, type CalendarTranslationKey$1 as CalendarTranslationKey, type CalendarTranslations, type Country, CountryCodeSelector, type CountryCodeSelectorProps, DatePicker, type DatePickerProps, type DatePickerRangeProps, type DatePickerSingleProps, type DateRange, type EmeraldGreenStep, Input, type InputProps, Label, type LabelProps, LockIcon, type MultipleSelectProps, type NavyStep, PhoneInput, type PhoneInputProps, type RubyRedStep, Select, type SelectOption, type SelectProps, type SingleSelectProps, type StormGrayStep, brand, buttonTypography, calendarTranslations, colors, countries, defaultCountry, emeraldGreen, findCountry, fontSize, fontWeight, fonts, formatLocalizedCalendarMonthYear, getCalendarMonthLabels, getCalendarTranslations, labelTypography, navy, radii, resolveCalendarLocale, resolveWeekdayLabels, rubyRed, shadows, spacing, stormGray, useCalendarLocale };
package/dist/index.d.ts CHANGED
@@ -48,6 +48,41 @@ interface InputProps extends TextInputProps {
48
48
  }
49
49
  declare function Input({ label, leftIcon, rightIcon, error, invalid, hint, containerStyle, style, className, fieldClassName, fieldStyle, labelClassName, inputClassName, errorClassName, hintClassName, editable, secureTextEntry, showPasswordToggle, onFocus, onBlur, ...props }: InputProps): react.JSX.Element;
50
50
 
51
+ type SelectOption = {
52
+ value: string;
53
+ label: string;
54
+ disabled?: boolean;
55
+ };
56
+ interface SelectBaseProps {
57
+ label?: string;
58
+ placeholder?: string;
59
+ options: SelectOption[];
60
+ leftIcon?: ReactNode;
61
+ disabled?: boolean;
62
+ error?: string;
63
+ invalid?: boolean;
64
+ hint?: string;
65
+ containerStyle?: StyleProp<ViewStyle>;
66
+ className?: string;
67
+ fieldClassName?: string;
68
+ menuClassName?: string;
69
+ labelClassName?: string;
70
+ errorClassName?: string;
71
+ hintClassName?: string;
72
+ }
73
+ interface SingleSelectProps extends SelectBaseProps {
74
+ multiple?: false;
75
+ value?: string;
76
+ onValueChange?: (value: string) => void;
77
+ }
78
+ interface MultipleSelectProps extends SelectBaseProps {
79
+ multiple: true;
80
+ value?: string[];
81
+ onValueChange?: (value: string[]) => void;
82
+ }
83
+ type SelectProps = SingleSelectProps | MultipleSelectProps;
84
+ declare function Select({ label, placeholder, value, onValueChange, options, leftIcon, multiple, disabled, error, invalid, hint, containerStyle, className, fieldClassName, menuClassName, labelClassName, errorClassName, hintClassName, }: SelectProps): react.JSX.Element;
85
+
51
86
  interface PhoneInputProps extends Omit<TextInputProps, "style"> {
52
87
  label?: string;
53
88
  countryCode?: string;
@@ -84,6 +119,103 @@ interface CountryCodeSelectorProps {
84
119
  }
85
120
  declare function CountryCodeSelector({ value, onValueChange, options, disabled, style, className, }: CountryCodeSelectorProps): react.JSX.Element;
86
121
 
122
+ type DateRange = {
123
+ start: Date;
124
+ end?: Date;
125
+ };
126
+
127
+ type CalendarLocale = "hy-AM" | "en-US" | "ru-RU";
128
+ type CalendarTranslationKey$1 = "datePlaceholder" | "rangePlaceholder" | "previousMonth" | "nextMonth" | "previousYear" | "nextYear" | "previousYears" | "nextYears" | "selectMonth" | "selectYear" | "closeCalendar";
129
+ type CalendarTranslations = Record<CalendarTranslationKey$1, string> & {
130
+ /** Weekday labels in Monday-first order. */
131
+ weekdays: string[];
132
+ /** Short month labels used in compact calendar headers and month picker cells. */
133
+ monthsShort: string[];
134
+ /** Full month labels available for consumers that need long-form display. */
135
+ monthsLong: string[];
136
+ };
137
+ declare const calendarTranslations: Record<CalendarLocale, CalendarTranslations>;
138
+ declare function resolveCalendarLocale(locale: string): CalendarLocale;
139
+ declare function getCalendarTranslations(locale: string): CalendarTranslations;
140
+ declare function resolveWeekdayLabels(locale: string): string[];
141
+ declare function getCalendarMonthLabels(locale: string, width?: "short" | "long"): string[];
142
+ declare function formatLocalizedCalendarMonthYear(date: Date, locale: string): string;
143
+
144
+ type CalendarLabels = Partial<Pick<CalendarTranslations, CalendarTranslationKey>> & {
145
+ weekdays?: string[];
146
+ formatMonthYear?: (date: Date) => string;
147
+ };
148
+ type CalendarTranslationKey = "previousMonth" | "nextMonth" | "previousYear" | "nextYear" | "previousYears" | "nextYears" | "selectMonth" | "selectYear" | "closeCalendar";
149
+ type CalendarBaseProps = {
150
+ viewDate?: Date;
151
+ defaultViewDate?: Date;
152
+ onViewDateChange?: (date: Date) => void;
153
+ locale?: string;
154
+ labels?: CalendarLabels;
155
+ minDate?: Date;
156
+ maxDate?: Date;
157
+ today?: Date;
158
+ style?: StyleProp<ViewStyle>;
159
+ className?: string;
160
+ };
161
+ type CalendarSingleProps = CalendarBaseProps & {
162
+ mode?: "single";
163
+ value?: Date;
164
+ onChange?: (date: Date) => void;
165
+ };
166
+ type CalendarRangeProps = CalendarBaseProps & {
167
+ mode: "range";
168
+ value?: DateRange;
169
+ onChange?: (range: DateRange) => void;
170
+ };
171
+ type CalendarProps = CalendarSingleProps | CalendarRangeProps;
172
+ declare function Calendar(props: CalendarProps): react.JSX.Element;
173
+
174
+ type CalendarLocaleProviderProps = {
175
+ locale: string;
176
+ children: ReactNode;
177
+ };
178
+ declare function CalendarLocaleProvider({ locale, children }: CalendarLocaleProviderProps): react.JSX.Element;
179
+ declare function useCalendarLocale(locale?: string): CalendarLocale;
180
+
181
+ type DatePickerFieldProps = {
182
+ label?: string;
183
+ placeholder?: string;
184
+ disabled?: boolean;
185
+ error?: string;
186
+ invalid?: boolean;
187
+ hint?: string;
188
+ containerStyle?: StyleProp<ViewStyle>;
189
+ className?: string;
190
+ fieldClassName?: string;
191
+ panelClassName?: string;
192
+ labelClassName?: string;
193
+ errorClassName?: string;
194
+ hintClassName?: string;
195
+ /** Opens the calendar popup on mount (useful for Storybook previews). */
196
+ defaultOpen?: boolean;
197
+ /** Closes the popup after a complete range is selected. Defaults to true in range mode. */
198
+ closeOnRangeComplete?: boolean;
199
+ };
200
+ type DatePickerSingleProps = Omit<CalendarSingleProps, "style" | "className"> & DatePickerFieldProps & {
201
+ mode?: "single";
202
+ formatDate?: (date: Date) => string;
203
+ };
204
+ type DatePickerRangeProps = Omit<CalendarRangeProps, "style" | "className"> & DatePickerFieldProps & {
205
+ mode: "range";
206
+ formatRange?: (range: DateRange) => string;
207
+ rangeSeparator?: string;
208
+ };
209
+ type DatePickerProps = DatePickerSingleProps | DatePickerRangeProps;
210
+ declare function DatePicker(props: DatePickerProps): react.JSX.Element;
211
+
212
+ interface CalendarIconProps {
213
+ size?: number;
214
+ color?: string;
215
+ strokeWidth?: number;
216
+ }
217
+ declare function CalendarIcon({ size, color, strokeWidth, }: CalendarIconProps): react.JSX.Element;
218
+
87
219
  interface LabelProps extends TextProps {
88
220
  children: ReactNode;
89
221
  /** Render as a required field indicator. */
@@ -348,4 +480,4 @@ declare const shadows: {
348
480
  };
349
481
  };
350
482
 
351
- export { Button, type ButtonProps, type ButtonSize, type ButtonVariant, type Country, CountryCodeSelector, type CountryCodeSelectorProps, type EmeraldGreenStep, Input, type InputProps, Label, type LabelProps, LockIcon, type NavyStep, PhoneInput, type PhoneInputProps, type RubyRedStep, type StormGrayStep, brand, buttonTypography, colors, countries, defaultCountry, emeraldGreen, findCountry, fontSize, fontWeight, fonts, labelTypography, navy, radii, rubyRed, shadows, spacing, stormGray };
483
+ export { Button, type ButtonProps, type ButtonSize, type ButtonVariant, Calendar, CalendarIcon, type CalendarLabels, type CalendarLocale, CalendarLocaleProvider, type CalendarLocaleProviderProps, type CalendarProps, type CalendarRangeProps, type CalendarSingleProps, type CalendarTranslationKey$1 as CalendarTranslationKey, type CalendarTranslations, type Country, CountryCodeSelector, type CountryCodeSelectorProps, DatePicker, type DatePickerProps, type DatePickerRangeProps, type DatePickerSingleProps, type DateRange, type EmeraldGreenStep, Input, type InputProps, Label, type LabelProps, LockIcon, type MultipleSelectProps, type NavyStep, PhoneInput, type PhoneInputProps, type RubyRedStep, Select, type SelectOption, type SelectProps, type SingleSelectProps, type StormGrayStep, brand, buttonTypography, calendarTranslations, colors, countries, defaultCountry, emeraldGreen, findCountry, fontSize, fontWeight, fonts, formatLocalizedCalendarMonthYear, getCalendarMonthLabels, getCalendarTranslations, labelTypography, navy, radii, resolveCalendarLocale, resolveWeekdayLabels, rubyRed, shadows, spacing, stormGray, useCalendarLocale };