@ssa-ui-kit/core 3.2.0 → 3.3.0

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.
@@ -4,41 +4,142 @@ import { useMask } from '@react-input/mask';
4
4
  import { FieldContextValue } from '../Field/FieldProvider';
5
5
  import { InputProps } from '../Input/types';
6
6
  import type { PickerCalendarType, DateFormat } from '../JsonSchemaForm/utils/dateFormats';
7
+ /**
8
+ * Which side of the range has focus for calendar selection and keyboard flow: **from** or **to**.
9
+ */
7
10
  export type LastFocusedElement = 'from' | 'to';
11
+ /**
12
+ * Calendar granularity: **days**, **months**, or **years** (same as **DatePicker** / shared **PickerCalendarType**).
13
+ */
8
14
  export type RangePickerType = PickerCalendarType;
15
+ /**
16
+ * Mask and parse format for both inputs (e.g. **`mm/dd/yyyy`**, **`dd/mm/yyyy`**, **`mm/yyyy`**, **`yyyy`**).
17
+ */
9
18
  export type Format = DateFormat;
10
19
  /**
11
- * Type for the dates tuple passed to DateRangePicker's onChange callback.
20
+ * Tuple passed to **`onChange`**: **[start, end]** in JavaScript **`Date`**, **`null`**, or **`undefined`**.
12
21
  *
13
- * - Date: A valid date was selected
14
- * - null: "Present" option was selected (end date only)
15
- * - undefined: Date field is empty/unset
22
+ * - **`Date`** valid anchor for that side
23
+ * - **`null`** **end date only**: user chose **“Present”** (open-ended range). **Start** is never **`null`**.
24
+ * - **`undefined`** that side is empty / cleared
16
25
  */
17
26
  export type DateRangePickerOnChangeDates = [
18
27
  Date | null | undefined,
19
28
  Date | null | undefined
20
29
  ];
21
- export type DateRangePickerProps = {
30
+ /**
31
+ * Parsed range as **Luxon** values before emitting JS dates (**`[from, to]`**).
32
+ */
33
+ export type DateTimeTuple = [DateTime | undefined, DateTime | undefined];
34
+ /**
35
+ * Active calendar view: day grid, month grid, or year list (aligned with **rangePickerType** / header navigation).
36
+ */
37
+ export type CalendarType = PickerCalendarType;
38
+ /**
39
+ * Props for **DateRangePicker**
40
+ *
41
+ * Two masked inputs registered as **`${name}From`** and **`${name}To`** under **react-hook-form**
42
+ * **`FormProvider`**. Stored values are **formatted strings**; **`onChange`** receives **`DateRangePickerOnChangeDates`**.
43
+ * Optional **“Present”** applies only to the **end** date (**`showPresentOption`**).
44
+ *
45
+ * @example
46
+ * ```tsx
47
+ * <DateRangePicker
48
+ * name="employment"
49
+ * label="Employment period"
50
+ * messages={{ description: 'Start and end dates' }}
51
+ * onChange={(dates) => console.log(dates)}
52
+ * />
53
+ * ```
54
+ *
55
+ * @example
56
+ * ```tsx
57
+ * <DateRangePicker
58
+ * name="period"
59
+ * rangePickerType="months"
60
+ * format="mm/yyyy"
61
+ * dateMin="01/2020"
62
+ * dateMax="12/2030"
63
+ * showPresentOption
64
+ * />
65
+ * ```
66
+ */
67
+ export interface DateRangePickerProps {
68
+ /**
69
+ * Base field name; registers **`${name}From`** and **`${name}To`** with react-hook-form.
70
+ */
22
71
  name: string;
72
+ /**
73
+ * Optional label (**`Field.Label`**); **`htmlFor`** follows the focused input.
74
+ */
23
75
  label?: string;
76
+ /**
77
+ * Date string format for both fields. Defaults from **`rangePickerType`** if omitted.
78
+ */
24
79
  format?: Format;
80
+ /**
81
+ * Initial open state for the calendar popover (controlled open seed).
82
+ */
25
83
  isOpenState?: boolean;
84
+ /**
85
+ * Controlled tuple of string values matching **format**; **`null`** at index **1** means **“Present”** end.
86
+ */
26
87
  value?: [string | undefined | null, string | undefined | null];
88
+ /**
89
+ * Initial tuple; **`[string, null]`** end means **Present** (open-ended).
90
+ */
27
91
  defaultValue?: [string, string | null] | [string, string];
92
+ /**
93
+ * Options for **`@react-input/mask`** (shared pattern for both inputs).
94
+ */
28
95
  maskOptions?: Parameters<typeof useMask>[0];
96
+ /**
97
+ * Extra props for the underlying **Input** fields.
98
+ */
29
99
  inputProps?: Partial<InputProps>;
100
+ /**
101
+ * Visual status for **`Field.Root`** (**error** / **success** / **basic**).
102
+ */
30
103
  status?: FieldContextValue['status'];
104
+ /**
105
+ * Whether **`messages`** render in **`TriggerStatusArea`** below the inputs.
106
+ * @default true
107
+ */
31
108
  showStatusArea?: boolean;
109
+ /**
110
+ * Inclusive minimum date string (shape matches **format** and **rangePickerType**).
111
+ */
32
112
  dateMin?: string;
113
+ /**
114
+ * Inclusive maximum date string (shape matches **format** and **rangePickerType**).
115
+ */
33
116
  dateMax?: string;
117
+ /**
118
+ * Disables both inputs and the calendar trigger.
119
+ * @default false
120
+ */
34
121
  disabled?: boolean;
122
+ /**
123
+ * Shows the calendar icon button to open the popover.
124
+ * @default true
125
+ */
35
126
  showCalendarIcon?: boolean;
127
+ /**
128
+ * **days** | **months** | **years** — drives default **format**, mask, and calendar chrome.
129
+ * @default 'days'
130
+ */
36
131
  rangePickerType?: RangePickerType;
132
+ /**
133
+ * Optional copy for the status area (description / success / error messaging).
134
+ */
37
135
  messages?: {
38
136
  description?: string;
39
137
  success?: string;
40
138
  error?: string;
41
139
  };
140
+ /**
141
+ * Optional class names for trigger layout, inputs, icon, calendar shell, and label.
142
+ */
42
143
  classNames?: {
43
144
  trigger?: {
44
145
  root?: string;
@@ -51,54 +152,177 @@ export type DateRangePickerProps = {
51
152
  calendar?: string;
52
153
  label?: string;
53
154
  };
155
+ /**
156
+ * Emits **`[start, end]`** as **`Date`**, **`null`** (Present end only), or **`undefined`** per side.
157
+ */
54
158
  onChange?: (dates?: DateRangePickerOnChangeDates) => void;
159
+ /**
160
+ * Calendar popover opened.
161
+ */
55
162
  onOpen?: () => void;
163
+ /**
164
+ * Calendar popover closed.
165
+ */
56
166
  onClose?: () => void;
167
+ /**
168
+ * Validation or parse error: raw input value and message (e.g. invalid / out of range).
169
+ */
57
170
  onError?: (date: unknown, error?: string | null) => void;
171
+ /**
172
+ * Visible month changed (prev/next) while in day view.
173
+ */
58
174
  onMonthChange?: (date: Date) => void;
175
+ /**
176
+ * Year changed from year list or header drill-down.
177
+ */
59
178
  onYearChange?: (date: Date) => void;
179
+ /**
180
+ * Blur handler composed with internal validation.
181
+ */
60
182
  onBlur?: FocusEventHandler<HTMLInputElement>;
183
+ /**
184
+ * If the user picks an end before a start, swap the two dates instead of rejecting.
185
+ * @default false
186
+ */
61
187
  allowReverseSelection?: boolean;
188
+ /**
189
+ * Shows a **Present** control in the calendar (end date only — ongoing range).
190
+ * @default false
191
+ */
62
192
  showPresentOption?: boolean;
63
- };
64
- export type DateTimeTuple = [DateTime | undefined, DateTime | undefined];
65
- export type DateRangePickerContextProps = Omit<DateRangePickerProps, 'dateMin' | 'dateMax'> & {
193
+ }
194
+ /**
195
+ * Context value for **DateRangePicker** (provider + subcomponents). Extends picker props but
196
+ * replaces **`dateMin`** / **`dateMax`** strings with **Luxon** bounds and segment arrays; adds
197
+ * dual field names, refs, range selection step, and **Present** end state.
198
+ *
199
+ * Most apps use **DateRangePicker** only; this documents **useDateRangePickerContext** consumers.
200
+ */
201
+ export interface DateRangePickerContextProps extends Omit<DateRangePickerProps, 'dateMin' | 'dateMax'> {
202
+ /**
203
+ * Registered field name for the **start** input (**`${name}From`**).
204
+ */
66
205
  nameFrom: string;
206
+ /**
207
+ * Registered field name for the **end** input (**`${name}To`**).
208
+ */
67
209
  nameTo: string;
210
+ /**
211
+ * Whether the calendar popover is open.
212
+ */
68
213
  isOpen: boolean;
214
+ /**
215
+ * **Luxon** date for the calendar header / navigation (current visible month or year).
216
+ */
69
217
  currentCalendarViewDT: DateTime;
218
+ /**
219
+ * **`0`** when **from** is focused, **`1`** when **to** is focused.
220
+ */
70
221
  currentIndex: number;
222
+ /**
223
+ * Per-side calendar view anchors (**`[fromView, toView]`**).
224
+ */
71
225
  calendarViewDateTime: DateTimeTuple;
226
+ /**
227
+ * Active popover view: **days**, **months**, or **years**.
228
+ */
72
229
  calendarType: CalendarType;
230
+ /**
231
+ * Watched form value for the **from** field.
232
+ */
73
233
  inputValueFrom?: string;
234
+ /**
235
+ * Watched form value for the **to** field.
236
+ */
74
237
  inputValueTo?: string;
238
+ /**
239
+ * Ref for the **from** masked input (merged).
240
+ */
75
241
  inputFromRef: React.ForwardedRef<HTMLInputElement | null>;
242
+ /**
243
+ * Ref for the **to** masked input (merged).
244
+ */
76
245
  inputToRef: React.ForwardedRef<HTMLInputElement | null>;
246
+ /**
247
+ * Parsed **Luxon** range (**`[from, to]`**).
248
+ */
77
249
  dateTime: DateTimeTuple;
250
+ /**
251
+ * **`dateMin`** split by **`/`** into numeric segments (index **i** matches **format** segment **i**).
252
+ */
78
253
  dateMinParts: number[];
254
+ /**
255
+ * **`dateMax`** split by **`/`** into numeric segments (index **i** matches **format** segment **i**).
256
+ */
79
257
  dateMaxParts: number[];
258
+ /**
259
+ * Inclusive minimum as **DateTime**.
260
+ */
80
261
  dateMinDT: DateTime;
262
+ /**
263
+ * Inclusive maximum as **DateTime**.
264
+ */
81
265
  dateMaxDT: DateTime;
266
+ /**
267
+ * Indices of **dd**, **mm**, **yyyy** in the **format** string.
268
+ */
82
269
  formatIndexes: {
83
270
  day: number;
84
271
  month: number;
85
272
  year: number;
86
273
  };
274
+ /**
275
+ * Which input is focused for calendar and validation.
276
+ */
87
277
  lastFocusedElement: LastFocusedElement;
278
+ /**
279
+ * Last **`onChange`** tuple in **JS** dates (supports **Present** as **`null`** on end).
280
+ */
88
281
  lastChangedDate?: [Date | undefined | null, Date | undefined | null];
282
+ /**
283
+ * Internal change handler (Luxon) used when selecting from the calendar.
284
+ */
89
285
  safeOnChange?: (date?: DateTime) => void;
286
+ /**
287
+ * Sets **from** vs **to** focus.
288
+ */
90
289
  setLastFocusedElement: Dispatch<SetStateAction<LastFocusedElement>>;
290
+ /**
291
+ * Updates last emitted **Date** tuple for parents and highlights.
292
+ */
91
293
  setLastChangedDate: Dispatch<SetStateAction<[Date | undefined | null, Date | undefined | null]>>;
294
+ /**
295
+ * Toggles popover from icon or input (**implementation**-specific rules).
296
+ */
92
297
  handleToggleOpen: MouseEventHandler<HTMLButtonElement | HTMLInputElement>;
298
+ /**
299
+ * Updates one or both calendar view anchors.
300
+ */
93
301
  setCalendarViewDateTime: Dispatch<SetStateAction<DateTimeTuple>>;
302
+ /**
303
+ * Sets the selected **Luxon** range.
304
+ */
94
305
  setDateTime: Dispatch<SetStateAction<DateTimeTuple>>;
306
+ /**
307
+ * Opens or closes the popover.
308
+ */
95
309
  setIsOpen: Dispatch<SetStateAction<boolean>>;
310
+ /**
311
+ * Switches day / month / year surface in the popover.
312
+ */
96
313
  setCalendarType: Dispatch<SetStateAction<CalendarType>>;
314
+ /**
315
+ * **start** → **end** two-step calendar selection, or **null** when not in that flow.
316
+ */
97
317
  rangeSelectionStep: 'start' | 'end' | null;
98
318
  setRangeSelectionStep: Dispatch<SetStateAction<'start' | 'end' | null>>;
319
+ /**
320
+ * Clears **from** or **to** and syncs form state.
321
+ */
99
322
  clearInputValue: (field: 'from' | 'to') => void;
100
- showPresentOption?: boolean;
323
+ /**
324
+ * End field shows **Present** (open-ended); form **to** value may be empty while flag is true.
325
+ */
101
326
  isEndDatePresent: boolean;
102
327
  setIsEndDatePresent: Dispatch<SetStateAction<boolean>>;
103
- };
104
- export type CalendarType = PickerCalendarType;
328
+ }
@@ -0,0 +1,31 @@
1
+ import { HistoryProps } from './types';
2
+ /**
3
+ * History - Vertical timeline component for chronological events.
4
+ *
5
+ * Renders a date column and content column for each item, connected by
6
+ * timeline markers. Marker colors can be set per item or via defaults.
7
+ *
8
+ * ### Color behavior
9
+ * - `item.color` overrides the marker color for a specific row
10
+ * - `defaultColor` is used when `item.color` is not provided
11
+ * - fallback default marker color: `theme.palette.primary.main`
12
+ * - fallback connector color: `theme.colors.greyLighter`
13
+ *
14
+ * ### Alignment behavior
15
+ * The marker is vertically aligned to the first text line and adapts when
16
+ * `circleSize` changes.
17
+ *
18
+ * @category Components
19
+ * @subcategory Display
20
+ *
21
+ * @example
22
+ * ```tsx
23
+ * <History
24
+ * items={[
25
+ * { date: '01.01.2026', content: 'Account created' },
26
+ * { date: '03.01.2026', content: 'Plan upgraded', color: '#10b981' },
27
+ * ]}
28
+ * />
29
+ * ```
30
+ */
31
+ export declare const History: ({ items, defaultColor, lineColor, dateWidth, circleSize, sx, }: HistoryProps) => import("@emotion/react/jsx-runtime").JSX.Element;
@@ -0,0 +1,2 @@
1
+ export * from './History';
2
+ export type * from './types';
@@ -0,0 +1,9 @@
1
+ export declare const FIRST_LINE_TOP_PADDING = 2;
2
+ export declare const FIRST_LINE_HEIGHT = 20;
3
+ export declare const container: import("@emotion/react").SerializedStyles;
4
+ export declare const row: import("@emotion/react").SerializedStyles;
5
+ export declare const leftColumn: (width: number) => import("@emotion/react").SerializedStyles;
6
+ export declare const circle: (color: string, size: number, topOffset: number) => import("@emotion/react").SerializedStyles;
7
+ export declare const connector: (color: string, circleTopOffset: number, circleSize: number) => import("@emotion/react").SerializedStyles;
8
+ export declare const dateColumn: (width: number) => import("@emotion/react").SerializedStyles;
9
+ export declare const contentColumn: import("@emotion/react").SerializedStyles;
@@ -0,0 +1,56 @@
1
+ import React from 'react';
2
+ /**
3
+ * Single timeline row model for `History`.
4
+ */
5
+ export interface HistoryItemType {
6
+ /**
7
+ * Left column value (date/time/period label).
8
+ */
9
+ date: React.ReactNode;
10
+ /**
11
+ * Main row content shown in the right column.
12
+ */
13
+ content: React.ReactNode;
14
+ /**
15
+ * Optional marker color for this row.
16
+ * If omitted, `defaultColor` from `HistoryProps` is used.
17
+ */
18
+ color?: string;
19
+ /**
20
+ * Optional stable React key.
21
+ */
22
+ key?: string | number;
23
+ }
24
+ /**
25
+ * Props for the `History` timeline component.
26
+ */
27
+ export interface HistoryProps {
28
+ /**
29
+ * Timeline rows to render from top to bottom.
30
+ */
31
+ items: HistoryItemType[];
32
+ /**
33
+ * Default marker color for rows without `item.color`.
34
+ * Falls back to `theme.palette.primary.main`.
35
+ */
36
+ defaultColor?: string;
37
+ /**
38
+ * Connector line color between markers.
39
+ * Falls back to `theme.colors.greyLighter`.
40
+ */
41
+ lineColor?: string;
42
+ /**
43
+ * Width of the date column in pixels.
44
+ * @default 120
45
+ */
46
+ dateWidth?: number;
47
+ /**
48
+ * Marker circle diameter in pixels.
49
+ * @default 12
50
+ */
51
+ circleSize?: number;
52
+ /**
53
+ * Inline style for the root container.
54
+ */
55
+ sx?: React.CSSProperties;
56
+ }
@@ -0,0 +1,3 @@
1
+ import { SVGProps } from '../types';
2
+ export declare const SettingClock: ({ fill, size, tooltip, ...props }: SVGProps) => import("@emotion/react/jsx-runtime").JSX.Element;
3
+ export declare const ICON_NAME = "setting-clock";
@@ -98,6 +98,7 @@ export * as Roles from './Roles';
98
98
  export * as Search from './Search';
99
99
  export * as Seniority from './Seniority';
100
100
  export * as Settings from './Settings';
101
+ export * as SettingClock from './SettingClock';
101
102
  export * as Signature from './Signature';
102
103
  export * as Sleep from './Sleep';
103
104
  export * as StaffGrowthCoefficient from './StaffGrowthCoefficient';
@@ -1 +1 @@
1
- export declare const iconsList: ("visible" | "warning" | "archive" | "document" | "link" | "search" | "arrow-down" | "arrow-up" | "clipboard-assessment" | "attention" | "award" | "ban-user" | "bench" | "bin" | "calendar" | "calendar-schedule" | "carrot-down" | "carrot-left" | "carrot-right" | "carrot-up" | "card-text" | "case" | "certification" | "certification-expiring" | "camera" | "change" | "chart" | "check" | "check-circle" | "check-circle-inverted" | "children" | "circle" | "circular" | "clock" | "cogwheel" | "comments" | "briefcase" | "building" | "compensation" | "confirm-email" | "contacts" | "copy" | "copy-link" | "cross" | "delete" | "diamond-ring" | "diet" | "documents" | "edit" | "education" | "email" | "employee" | "employee-profile" | "employee-terminated" | "employee-blackboard" | "excel-download" | "export" | "file-mark" | "file-pdf" | "file-word" | "filter" | "filter-funnel" | "follow-link" | "fte" | "clipboard-form" | "geography" | "gender" | "gift" | "home" | "import" | "information" | "inventory" | "invisible" | "language" | "lock" | "log-in" | "log-out" | "maximize" | "measurements" | "message" | "minus" | "minus-circle" | "minus-circle-inverted" | "more" | "more-vertical" | "notification" | "office-chair" | "open-book" | "pages" | "party" | "plus" | "plus-circle" | "plus-circle-inverted" | "probation-period" | "profiles-changes" | "radio-on" | "clipboard-report" | "clipboard-result" | "robot" | "roles" | "seniority" | "settings" | "signature" | "sleep" | "staff-growth-coefficient" | "staff-turnover-coefficient" | "stats" | "clipboard-summary" | "team" | "clipboard-star" | "time-tracking" | "timeline" | "tennis-ball" | "trainings" | "unarchive" | "union" | "union-circle" | "unlock" | "url" | "user")[];
1
+ export declare const iconsList: ("visible" | "warning" | "archive" | "document" | "link" | "search" | "arrow-down" | "arrow-up" | "clipboard-assessment" | "attention" | "award" | "ban-user" | "bench" | "bin" | "calendar" | "calendar-schedule" | "carrot-down" | "carrot-left" | "carrot-right" | "carrot-up" | "card-text" | "case" | "certification" | "certification-expiring" | "camera" | "change" | "chart" | "check" | "check-circle" | "check-circle-inverted" | "children" | "circle" | "circular" | "clock" | "cogwheel" | "comments" | "briefcase" | "building" | "compensation" | "confirm-email" | "contacts" | "copy" | "copy-link" | "cross" | "delete" | "diamond-ring" | "diet" | "documents" | "edit" | "education" | "email" | "employee" | "employee-profile" | "employee-terminated" | "employee-blackboard" | "excel-download" | "export" | "file-mark" | "file-pdf" | "file-word" | "filter" | "filter-funnel" | "follow-link" | "fte" | "clipboard-form" | "geography" | "gender" | "gift" | "home" | "import" | "information" | "inventory" | "invisible" | "language" | "lock" | "log-in" | "log-out" | "maximize" | "measurements" | "message" | "minus" | "minus-circle" | "minus-circle-inverted" | "more" | "more-vertical" | "notification" | "office-chair" | "open-book" | "pages" | "party" | "plus" | "plus-circle" | "plus-circle-inverted" | "probation-period" | "profiles-changes" | "radio-on" | "clipboard-report" | "clipboard-result" | "robot" | "roles" | "seniority" | "settings" | "setting-clock" | "signature" | "sleep" | "staff-growth-coefficient" | "staff-turnover-coefficient" | "stats" | "clipboard-summary" | "team" | "clipboard-star" | "time-tracking" | "timeline" | "tennis-ball" | "trainings" | "unarchive" | "union" | "union-circle" | "unlock" | "url" | "user")[];
@@ -37,7 +37,6 @@ export { default as MultipleDropdownOptions } from './MultipleDropdownOptions';
37
37
  export * from './Typeahead';
38
38
  export * from './DatePicker';
39
39
  export * from './DateRangePicker';
40
- export type { CalendarType } from './DatePicker/types';
41
40
  export * from './ColorPicker';
42
41
  export * from './SearchBox';
43
42
  export type * from './SearchBox/types';
@@ -111,6 +110,8 @@ export type * from './Stepper/types';
111
110
  export { default as Step } from './Step';
112
111
  export { default as StepConnector } from './StepConnector';
113
112
  export { default as StepLabel } from './StepLabel';
113
+ export * from './History';
114
+ export type * from './History/types';
114
115
  export * from './Pagination';
115
116
  export { default as Link } from './Link';
116
117
  export * from './WithLink';