@emporix/component-library 2.6.0 → 2.8.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.
package/README.md CHANGED
@@ -349,6 +349,62 @@ const [received, setReceived] = useState(false)
349
349
  | className | string | - | Additional CSS class for the root |
350
350
  | data-testid | string | - | Test ID for root and input (suffix `-input`) |
351
351
 
352
+ ### Calendar
353
+
354
+ Date (and optional time) picker wrapping [PrimeReact Calendar](https://primereact.org/calendar/). Input and overlay styles are scoped with CSS Modules (including `panelClassName` on the popup) so host-app `.p-*` rules cannot restyle CL Calendar — including when PrimeReact appends the overlay to `document.body` for table column filters. Pass already-translated `dateFormat` / `placeholder` / `label` — the component does no i18n itself. The change event matches PrimeReact (`{ value, originalEvent, target }`).
355
+
356
+ ```tsx
357
+ import { useState } from 'react'
358
+ import { Calendar } from '@emporix/component-library'
359
+
360
+ const [createdAt, setCreatedAt] = useState<Date | null>(null)
361
+
362
+ <Calendar
363
+ label="Created date"
364
+ value={createdAt}
365
+ dateFormat="mm/dd/yy"
366
+ showButtonBar
367
+ onChange={e => setCreatedAt(e.value instanceof Date ? e.value : null)}
368
+ />
369
+
370
+ // Table column filter — range selection, same overlay
371
+ <Calendar
372
+ selectionMode="range"
373
+ value={range}
374
+ showButtonBar
375
+ style={{ minWidth: '180px' }}
376
+ onChange={e => setRange(Array.isArray(e.value) ? e.value : undefined)}
377
+ />
378
+ ```
379
+
380
+ #### Props
381
+
382
+ | Prop | Type | Default | Description |
383
+ | -------------- | --------------------------------------- | ---------- | -------------------------------------------------------- |
384
+ | value | Date \| Date[] \| string \| null | - | Selected date, range, or list (controlled) |
385
+ | onChange | (e: CalendarChangeEvent) => void | - | Fired when the selection changes |
386
+ | selectionMode | `'single'` \| `'range'` \| `'multiple'` | `'single'` | One date, from/to pair, or a list of dates |
387
+ | dateFormat | string | - | PrimeReact date format tokens (pass a translated string) |
388
+ | showTime | boolean | false | Include a time picker in the overlay |
389
+ | hourFormat | `'12'` \| `'24'` | - | Clock used when `showTime` is set |
390
+ | showButtonBar | boolean | false | Today / Clear buttons in the overlay footer |
391
+ | showIcon | boolean | false | Calendar icon beside the input |
392
+ | inline | boolean | false | Render the datepicker inline instead of as a popup |
393
+ | label | ReactNode | - | Label rendered above the input |
394
+ | tooltip | string | - | Info icon tooltip next to the label |
395
+ | required | boolean | false | Shows an asterisk on the label |
396
+ | error | ReactNode | - | Error text below the input |
397
+ | placeholder | string | - | Shown while no date is selected |
398
+ | inputId | string | - | id for the inner text input |
399
+ | disabled | boolean | false | Disables the input and overlay |
400
+ | readOnly | boolean | false | Blocks typing; the overlay still opens |
401
+ | minDate | Date | - | Earliest selectable date |
402
+ | maxDate | Date | - | Latest selectable date |
403
+ | style | CSSProperties | - | Inline styles on the `.p-calendar` root (e.g. minWidth) |
404
+ | className | string | - | Additional CSS class on the field wrapper |
405
+ | panelClassName | string | - | Additional CSS class on the overlay panel |
406
+ | data-testid | string | - | Test ID for the field wrapper |
407
+
352
408
  ### Dialog
353
409
 
354
410
  A modal dialog built on [PrimeReact Dialog](https://primereact.org/dialog/). Use for focused tasks that need a decision or confirmation. Wraps PrimeReact internally with scoped Emporix styles.
@@ -896,6 +952,7 @@ const tabs: TabItem[] = [
896
952
  | onTabChange | (tabId: string) => void | - | Callback when tab is changed. Not fired for disabled tabs |
897
953
  | keepMounted | boolean | false | Keep all panels mounted and hide inactive ones, so panel state survives switches (like PrimeReact `renderActiveOnly={false}`) |
898
954
  | fullWidth | boolean | false | Stretch tabs to evenly fill the available width |
955
+ | scrollable | boolean | true | Show prev/next scroll buttons when headers overflow (ignored when `fullWidth` is true) |
899
956
  | className | string | - | Additional CSS class |
900
957
  | data-testid | string | - | Test ID for testing |
901
958
 
@@ -0,0 +1,137 @@
1
+ import { CSSProperties, ReactNode, SyntheticEvent } from 'react';
2
+ export type CalendarSelectionMode = 'single' | 'range' | 'multiple';
3
+ export type CalendarHourFormat = '12' | '24';
4
+ export type CalendarValue = Date | Date[] | string | null | undefined;
5
+ export interface CalendarChangeEvent {
6
+ originalEvent: SyntheticEvent;
7
+ value: CalendarValue;
8
+ stopPropagation(): void;
9
+ preventDefault(): void;
10
+ target: {
11
+ name: string;
12
+ id: string;
13
+ value: CalendarValue;
14
+ };
15
+ }
16
+ export interface CalendarProps {
17
+ /**
18
+ * Selected date, date range, or multiple dates (controlled).
19
+ */
20
+ value?: CalendarValue;
21
+ /**
22
+ * Fired when the selection changes. `value` is a `Date`, `Date[]`, or `null`.
23
+ */
24
+ onChange?: (event: CalendarChangeEvent) => void;
25
+ /**
26
+ * `single` for one date, `range` for a from/to pair, `multiple` for a list.
27
+ * @default 'single'
28
+ */
29
+ selectionMode?: CalendarSelectionMode;
30
+ /**
31
+ * PrimeReact date format tokens, e.g. `mm/dd/yy`. Pass already-localized
32
+ * strings — the component does no i18n itself.
33
+ */
34
+ dateFormat?: string;
35
+ /**
36
+ * When true, the overlay includes a time picker.
37
+ * @default false
38
+ */
39
+ showTime?: boolean;
40
+ /**
41
+ * 12- or 24-hour clock when `showTime` is set.
42
+ */
43
+ hourFormat?: CalendarHourFormat;
44
+ /**
45
+ * Shows Today / Clear buttons in the overlay footer.
46
+ * @default false
47
+ */
48
+ showButtonBar?: boolean;
49
+ /**
50
+ * Shows a calendar icon beside the input.
51
+ * @default false
52
+ */
53
+ showIcon?: boolean;
54
+ /**
55
+ * Render the datepicker inline instead of as a popup overlay.
56
+ * @default false
57
+ */
58
+ inline?: boolean;
59
+ /**
60
+ * Label rendered above the input.
61
+ */
62
+ label?: ReactNode;
63
+ /**
64
+ * When set, an info icon with this tooltip is shown next to the label.
65
+ */
66
+ tooltip?: string;
67
+ /**
68
+ * Whether the field is required (shows an asterisk on the label).
69
+ * @default false
70
+ */
71
+ required?: boolean;
72
+ /**
73
+ * Error text rendered below the input.
74
+ */
75
+ error?: ReactNode;
76
+ /**
77
+ * Placeholder shown while no date is selected.
78
+ */
79
+ placeholder?: string;
80
+ /**
81
+ * Id for the inner text input (for label association via htmlFor).
82
+ */
83
+ inputId?: string;
84
+ /**
85
+ * Name attribute forwarded to the inner input.
86
+ */
87
+ name?: string;
88
+ /**
89
+ * Earliest selectable date.
90
+ */
91
+ minDate?: Date;
92
+ /**
93
+ * Latest selectable date.
94
+ */
95
+ maxDate?: Date;
96
+ /**
97
+ * When true, the input cannot be edited and the overlay does not open.
98
+ * @default false
99
+ */
100
+ disabled?: boolean;
101
+ /**
102
+ * When true, typing in the input is blocked; the overlay still opens.
103
+ * @default false
104
+ */
105
+ readOnly?: boolean;
106
+ /**
107
+ * Inline styles on the PrimeReact `.p-calendar` root (e.g. `minWidth`).
108
+ */
109
+ style?: CSSProperties;
110
+ /**
111
+ * Additional CSS class name on the field wrapper.
112
+ */
113
+ className?: string;
114
+ /**
115
+ * Additional CSS class name on the overlay panel (appended to document.body).
116
+ */
117
+ panelClassName?: string;
118
+ /**
119
+ * Test ID for the field wrapper.
120
+ */
121
+ 'data-testid'?: string;
122
+ }
123
+ /**
124
+ * Date (and optional time) picker built on
125
+ * [PrimeReact Calendar](https://primereact.org/calendar/).
126
+ *
127
+ * Overlay styles are scoped via a CSS-module `panelClassName` so host
128
+ * `.p-*` rules cannot restyle this instance, even when PrimeReact appends
129
+ * the popup to `document.body` (required for table column filters, which
130
+ * clip overflow). Pass already-translated `label` / `placeholder` /
131
+ * `dateFormat` — the component is context-free.
132
+ */
133
+ export declare const Calendar: {
134
+ ({ value, onChange, selectionMode, dateFormat, showTime, hourFormat, showButtonBar, showIcon, inline, label, tooltip, required, error, placeholder, inputId: inputIdProp, name, minDate, maxDate, disabled, readOnly, style, className, panelClassName, "data-testid": testId, }: CalendarProps): import("react/jsx-runtime").JSX.Element;
135
+ displayName: string;
136
+ };
137
+ //# sourceMappingURL=Calendar.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Calendar.d.ts","sourceRoot":"","sources":["../../../src/components/calendar/Calendar.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,aAAa,EAAE,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AS,CAAA;IACjB;;OAEG;IACH,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB;;OAEG;IACH,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB;;OAEG;IACH,IAAI,CAAC,EAAE,MAAM,CAAA;IACb;;OAEG;IACH,OAAO,CAAC,EAAE,IAAI,CAAA;IACd;;OAEG;IACH,OAAO,CAAC,EAAE,IAAI,CAAA;IACd;;;OAGG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB;;;OAGG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB;;OAEG;IACH,KAAK,CAAC,EAAE,aAAa,CAAA;IACrB;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB;;OAEG;IACH,cAAc,CAAC,EAAE,MAAM,CAAA;IACvB;;OAEG;IACH,aAAa,CAAC,EAAE,MAAM,CAAA;CACvB;AAED;;;;;;;;;GASG;AACH,eAAO,MAAM,QAAQ;sRAyBlB,aAAa;;CAkDf,CAAA"}
@@ -0,0 +1,3 @@
1
+ export { Calendar } from './Calendar';
2
+ export type { CalendarProps, CalendarChangeEvent, CalendarSelectionMode, CalendarHourFormat, CalendarValue, } from './Calendar';
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/calendar/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAA;AACrC,YAAY,EACV,aAAa,EACb,mBAAmB,EACnB,qBAAqB,EACrB,kBAAkB,EAClB,aAAa,GACd,MAAM,YAAY,CAAA"}
@@ -46,10 +46,16 @@ export interface TabsProps {
46
46
  * Stretch tabs to evenly fill the available width
47
47
  */
48
48
  fullWidth?: boolean;
49
+ /**
50
+ * When true and not `fullWidth`, show prev/next scroll buttons when tab
51
+ * headers overflow the container (management-dashboard / PrimeReact TabView).
52
+ * @default true
53
+ */
54
+ scrollable?: boolean;
49
55
  /**
50
56
  * Test ID for testing
51
57
  */
52
58
  'data-testid'?: string;
53
59
  }
54
- export declare const Tabs: ({ tabs, activeTabId, onTabChange, keepMounted, className, fullWidth, "data-testid": testId, ...props }: TabsProps) => import("react/jsx-runtime").JSX.Element;
60
+ export declare const Tabs: ({ tabs, activeTabId, onTabChange, keepMounted, className, fullWidth, scrollable, "data-testid": testId, ...props }: TabsProps) => import("react/jsx-runtime").JSX.Element;
55
61
  //# sourceMappingURL=Tabs.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Tabs.d.ts","sourceRoot":"","sources":["../../../src/components/tabs/Tabs.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAGjC,MAAM,WAAW,OAAO;IACtB;;OAEG;IACH,EAAE,EAAE,MAAM,CAAA;IACV;;OAEG;IACH,KAAK,EAAE,MAAM,CAAA;IACb;;OAEG;IACH,OAAO,EAAE,SAAS,CAAA;IAClB;;;OAGG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAA;CACnB;AAED,MAAM,WAAW,SAAS;IACxB;;OAEG;IACH,IAAI,EAAE,OAAO,EAAE,CAAA;IACf;;OAEG;IACH,WAAW,EAAE,MAAM,CAAA;IACnB;;OAEG;IACH,WAAW,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAA;IACpC;;;;;OAKG;IACH,WAAW,CAAC,EAAE,OAAO,CAAA;IACrB;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB;;OAEG;IACH,SAAS,CAAC,EAAE,OAAO,CAAA;IACnB;;OAEG;IACH,aAAa,CAAC,EAAE,MAAM,CAAA;CACvB;AAED,eAAO,MAAM,IAAI,GAAI,wGASlB,SAAS,4CAiEX,CAAA"}
1
+ {"version":3,"file":"Tabs.d.ts","sourceRoot":"","sources":["../../../src/components/tabs/Tabs.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAA4C,MAAM,OAAO,CAAA;AAI3E,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