@eui/eds-react 22.0.0-alpha.14 → 22.0.0-alpha.16
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/eds-datepicker/eds-date-adapter.d.ts +56 -0
- package/eds-datepicker/eds-date-adapter.d.ts.map +1 -0
- package/eds-datepicker/eds-date-adapter.js +69 -0
- package/eds-datepicker/eds-date-adapter.js.map +1 -0
- package/eds-datepicker/eds-datepicker.css +137 -0
- package/eds-datepicker/eds-datepicker.d.ts +67 -0
- package/eds-datepicker/eds-datepicker.d.ts.map +1 -0
- package/eds-datepicker/eds-datepicker.js +203 -0
- package/eds-datepicker/eds-datepicker.js.map +1 -0
- package/eds-datepicker/eds-luxon-date-adapter.d.ts +33 -0
- package/eds-datepicker/eds-luxon-date-adapter.d.ts.map +1 -0
- package/eds-datepicker/eds-luxon-date-adapter.js +90 -0
- package/eds-datepicker/eds-luxon-date-adapter.js.map +1 -0
- package/eds-datepicker/eds-timepicker.css +69 -0
- package/eds-datepicker/eds-timepicker.d.ts +44 -0
- package/eds-datepicker/eds-timepicker.d.ts.map +1 -0
- package/eds-datepicker/eds-timepicker.js +122 -0
- package/eds-datepicker/eds-timepicker.js.map +1 -0
- package/eds-datepicker/index.d.ts +8 -0
- package/eds-datepicker/index.d.ts.map +1 -0
- package/eds-datepicker/index.js +5 -0
- package/eds-datepicker/index.js.map +1 -0
- package/eds-label/eds-label.css +19 -0
- package/eds-label/eds-label.d.ts +22 -0
- package/eds-label/eds-label.d.ts.map +1 -0
- package/eds-label/eds-label.js +15 -0
- package/eds-label/eds-label.js.map +1 -0
- package/eds-label/index.d.ts +3 -0
- package/eds-label/index.d.ts.map +1 -0
- package/eds-label/index.js +2 -0
- package/eds-label/index.js.map +1 -0
- package/eds-shell/eds-shell-sidebar.css +1 -0
- package/eds-shell/eds-shell.css +2 -1
- package/eds-table/eds-table-context.d.ts +56 -0
- package/eds-table/eds-table-context.d.ts.map +1 -0
- package/eds-table/eds-table-context.js +12 -0
- package/eds-table/eds-table-context.js.map +1 -0
- package/eds-table/eds-table-expandable-row.d.ts +22 -0
- package/eds-table/eds-table-expandable-row.d.ts.map +1 -0
- package/eds-table/eds-table-expandable-row.js +25 -0
- package/eds-table/eds-table-expandable-row.js.map +1 -0
- package/eds-table/eds-table-filter.d.ts +38 -0
- package/eds-table/eds-table-filter.d.ts.map +1 -0
- package/eds-table/eds-table-filter.js +66 -0
- package/eds-table/eds-table-filter.js.map +1 -0
- package/eds-table/eds-table-highlight.d.ts +38 -0
- package/eds-table/eds-table-highlight.d.ts.map +1 -0
- package/eds-table/eds-table-highlight.js +81 -0
- package/eds-table/eds-table-highlight.js.map +1 -0
- package/eds-table/eds-table-selectable-header.d.ts +19 -0
- package/eds-table/eds-table-selectable-header.d.ts.map +1 -0
- package/eds-table/eds-table-selectable-header.js +38 -0
- package/eds-table/eds-table-selectable-header.js.map +1 -0
- package/eds-table/eds-table-selectable-row.d.ts +21 -0
- package/eds-table/eds-table-selectable-row.d.ts.map +1 -0
- package/eds-table/eds-table-selectable-row.js +92 -0
- package/eds-table/eds-table-selectable-row.js.map +1 -0
- package/eds-table/eds-table-sort.model.d.ts +11 -0
- package/eds-table/eds-table-sort.model.d.ts.map +1 -0
- package/eds-table/eds-table-sort.model.js +5 -0
- package/eds-table/eds-table-sort.model.js.map +1 -0
- package/eds-table/eds-table-sortable-col.d.ts +32 -0
- package/eds-table/eds-table-sortable-col.d.ts.map +1 -0
- package/eds-table/eds-table-sortable-col.js +65 -0
- package/eds-table/eds-table-sortable-col.js.map +1 -0
- package/eds-table/eds-table-sticky-col.d.ts +25 -0
- package/eds-table/eds-table-sticky-col.d.ts.map +1 -0
- package/eds-table/eds-table-sticky-col.js +23 -0
- package/eds-table/eds-table-sticky-col.js.map +1 -0
- package/eds-table/eds-table.css +410 -0
- package/eds-table/eds-table.d.ts +92 -0
- package/eds-table/eds-table.d.ts.map +1 -0
- package/eds-table/eds-table.js +353 -0
- package/eds-table/eds-table.js.map +1 -0
- package/eds-table/index.d.ts +20 -0
- package/eds-table/index.d.ts.map +1 -0
- package/eds-table/index.js +10 -0
- package/eds-table/index.js.map +1 -0
- package/index.d.ts +6 -0
- package/index.d.ts.map +1 -1
- package/index.js +3 -0
- package/index.js.map +1 -1
- package/package.json +22 -2
- package/showcase/doc-page.d.ts +56 -0
- package/showcase/doc-page.d.ts.map +1 -0
- package/showcase/doc-page.js +104 -0
- package/showcase/doc-page.js.map +1 -0
- package/showcase/index.d.ts +7 -0
- package/showcase/index.d.ts.map +1 -0
- package/showcase/index.js +7 -0
- package/showcase/index.js.map +1 -0
- package/showcase/jsx-to-string.d.ts +15 -0
- package/showcase/jsx-to-string.d.ts.map +1 -0
- package/showcase/jsx-to-string.js +98 -0
- package/showcase/jsx-to-string.js.map +1 -0
- package/showcase/shared.d.ts +64 -0
- package/showcase/shared.d.ts.map +1 -0
- package/showcase/shared.js +43 -0
- package/showcase/shared.js.map +1 -0
- package/showcase/showcase.css +407 -0
- package/styles.css +4 -0
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
// Luxon is expected to be available as a peer dependency. It is accessed off the global scope
|
|
2
|
+
// (loaded via import in the consumer app); call setLuxonDateTime(DateTime) before using the adapter.
|
|
3
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
4
|
+
let luxonDateTime = null;
|
|
5
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
6
|
+
function getLuxonDateTime() {
|
|
7
|
+
if (!luxonDateTime) {
|
|
8
|
+
throw new Error('Luxon DateTime not available. Ensure luxon is imported in your application and call ' +
|
|
9
|
+
'setLuxonDateTime(DateTime) before using EdsLuxonDateAdapter.');
|
|
10
|
+
}
|
|
11
|
+
return luxonDateTime;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Call this function to provide the Luxon `DateTime` class to the adapter.
|
|
15
|
+
*
|
|
16
|
+
* @example
|
|
17
|
+
* ```ts
|
|
18
|
+
* import { DateTime } from 'luxon';
|
|
19
|
+
* import { setLuxonDateTime } from '@eui/eds-react/eds-datepicker';
|
|
20
|
+
* setLuxonDateTime(DateTime);
|
|
21
|
+
* ```
|
|
22
|
+
*/
|
|
23
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
24
|
+
export function setLuxonDateTime(dt) {
|
|
25
|
+
luxonDateTime = dt;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Luxon `DateTime` adapter for `EdsDatepicker` (ported 1:1 from the Angular `EdsLuxonDateAdapter`).
|
|
29
|
+
* Requires the `luxon` package and a prior `setLuxonDateTime(DateTime)` call.
|
|
30
|
+
*/
|
|
31
|
+
export class EdsLuxonDateAdapter {
|
|
32
|
+
create(year, month, day) {
|
|
33
|
+
const DT = getLuxonDateTime();
|
|
34
|
+
// Luxon months are 1-based
|
|
35
|
+
return DT.local(year, month + 1, day);
|
|
36
|
+
}
|
|
37
|
+
today() {
|
|
38
|
+
return getLuxonDateTime().now();
|
|
39
|
+
}
|
|
40
|
+
getYear(date) {
|
|
41
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
42
|
+
return date.year;
|
|
43
|
+
}
|
|
44
|
+
getMonth(date) {
|
|
45
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
46
|
+
return date.month - 1;
|
|
47
|
+
}
|
|
48
|
+
getDate(date) {
|
|
49
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
50
|
+
return date.day;
|
|
51
|
+
}
|
|
52
|
+
getDayOfWeek(date) {
|
|
53
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
54
|
+
return date.weekday;
|
|
55
|
+
}
|
|
56
|
+
getDaysInMonth(date) {
|
|
57
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
58
|
+
return date.daysInMonth;
|
|
59
|
+
}
|
|
60
|
+
addMonths(date, months) {
|
|
61
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
62
|
+
return date.plus({ months }).startOf('month');
|
|
63
|
+
}
|
|
64
|
+
format(date, formatStr) {
|
|
65
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
66
|
+
return date.toFormat(formatStr || 'dd/MM/yyyy');
|
|
67
|
+
}
|
|
68
|
+
parse(value, formatStr) {
|
|
69
|
+
const DT = getLuxonDateTime();
|
|
70
|
+
const parsed = DT.fromFormat(value, formatStr || 'dd/MM/yyyy');
|
|
71
|
+
return parsed.isValid ? parsed : null;
|
|
72
|
+
}
|
|
73
|
+
isBefore(date, compare) {
|
|
74
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
75
|
+
return date < compare;
|
|
76
|
+
}
|
|
77
|
+
isAfter(date, compare) {
|
|
78
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
79
|
+
return date > compare;
|
|
80
|
+
}
|
|
81
|
+
isSameDay(a, b) {
|
|
82
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
83
|
+
return a.hasSame(b, 'day');
|
|
84
|
+
}
|
|
85
|
+
isValid(date) {
|
|
86
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
87
|
+
return date != null && date.isValid === true;
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
//# sourceMappingURL=eds-luxon-date-adapter.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"eds-luxon-date-adapter.js","sourceRoot":"","sources":["../../src/eds-datepicker/eds-luxon-date-adapter.ts"],"names":[],"mappings":"AAEA,8FAA8F;AAC9F,qGAAqG;AACrG,8DAA8D;AAC9D,IAAI,aAAa,GAAQ,IAAI,CAAC;AAE9B,8DAA8D;AAC9D,SAAS,gBAAgB;IACrB,IAAI,CAAC,aAAa,EAAE,CAAC;QACjB,MAAM,IAAI,KAAK,CACX,sFAAsF;YAClF,8DAA8D,CACrE,CAAC;IACN,CAAC;IACD,OAAO,aAAa,CAAC;AACzB,CAAC;AAED;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,EAAE,GAAG,gBAAgB,EAAE,CAAC;QAC9B,MAAM,MAAM,GAAG,EAAE,CAAC,UAAU,CAAC,KAAK,EAAE,SAAS,IAAI,YAAY,CAAC,CAAC;QAC/D,OAAO,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC;IAC1C,CAAC;IAED,QAAQ,CAAC,IAAa,EAAE,OAAgB;QACpC,8DAA8D;QAC9D,OAAQ,IAAY,GAAI,OAAe,CAAC;IAC5C,CAAC;IAED,OAAO,CAAC,IAAa,EAAE,OAAgB;QACnC,8DAA8D;QAC9D,OAAQ,IAAY,GAAI,OAAe,CAAC;IAC5C,CAAC;IAED,SAAS,CAAC,CAAU,EAAE,CAAU;QAC5B,8DAA8D;QAC9D,OAAQ,CAAS,CAAC,OAAO,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC;IACxC,CAAC;IAED,OAAO,CAAC,IAAa;QACjB,8DAA8D;QAC9D,OAAO,IAAI,IAAI,IAAI,IAAK,IAAY,CAAC,OAAO,KAAK,IAAI,CAAC;IAC1D,CAAC;CACJ"}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
/* Pure-React port of eds-timepicker.scss (1:1). `:host` -> `.eds-timepicker`; the `.eui-21`
|
|
2
|
+
* wrapper is dropped. Child element classes nested as descendants. Tokens verbatim. */
|
|
3
|
+
|
|
4
|
+
.eds-timepicker {
|
|
5
|
+
display: inline-flex;
|
|
6
|
+
align-items: center;
|
|
7
|
+
gap: var(--eds-sp-3xs);
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
.eds-timepicker .eds-timepicker__field {
|
|
11
|
+
display: flex;
|
|
12
|
+
flex-direction: column;
|
|
13
|
+
align-items: center;
|
|
14
|
+
gap: var(--eds-sp-3xs);
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
.eds-timepicker .eds-timepicker__input {
|
|
18
|
+
width: 44px;
|
|
19
|
+
height: var(--eds-si-xl);
|
|
20
|
+
text-align: center;
|
|
21
|
+
font: var(--eds-f-paragraph-m);
|
|
22
|
+
border: var(--eds-bw-xs) solid var(--eds-c-border-neutral);
|
|
23
|
+
border-radius: var(--eds-br-xs);
|
|
24
|
+
background-color: var(--eds-c-surface-elevation);
|
|
25
|
+
color: var(--eds-c-foreground-default);
|
|
26
|
+
padding: 0;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
.eds-timepicker .eds-timepicker__input:focus-visible {
|
|
30
|
+
outline: 2px solid var(--eds-c-focus-default, #0e47cb);
|
|
31
|
+
outline-offset: 1px;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
.eds-timepicker .eds-timepicker__input:disabled {
|
|
35
|
+
opacity: var(--eds-op-50);
|
|
36
|
+
pointer-events: none;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
.eds-timepicker .eds-timepicker__btn {
|
|
40
|
+
background: none;
|
|
41
|
+
border: none;
|
|
42
|
+
cursor: pointer;
|
|
43
|
+
font-size: 10px;
|
|
44
|
+
line-height: 1;
|
|
45
|
+
padding: var(--eds-sp-3xs);
|
|
46
|
+
border-radius: var(--eds-br-xs);
|
|
47
|
+
color: var(--eds-c-foreground-subtle);
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
.eds-timepicker .eds-timepicker__btn:hover:not(:disabled) {
|
|
51
|
+
background-color: var(--eds-c-surface-neutral-subtler);
|
|
52
|
+
color: var(--eds-c-foreground-default);
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
.eds-timepicker .eds-timepicker__btn:focus-visible {
|
|
56
|
+
outline: 2px solid var(--eds-c-focus-default, #0e47cb);
|
|
57
|
+
outline-offset: 1px;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
.eds-timepicker .eds-timepicker__btn:disabled {
|
|
61
|
+
opacity: var(--eds-op-50);
|
|
62
|
+
cursor: default;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
.eds-timepicker .eds-timepicker__separator {
|
|
66
|
+
font: var(--eds-f-label-m-semi-bold);
|
|
67
|
+
color: var(--eds-c-foreground-default);
|
|
68
|
+
padding-top: var(--eds-sp-m);
|
|
69
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* Time value shape (ported 1:1 from the Angular `EdsTime` model in `eds-timepicker/eds-time.model.ts`).
|
|
4
|
+
* `seconds` is optional and only populated/emitted when `hasSeconds` is set.
|
|
5
|
+
*/
|
|
6
|
+
export interface EdsTime {
|
|
7
|
+
hours: number | null;
|
|
8
|
+
minutes: number | null;
|
|
9
|
+
seconds?: number | null;
|
|
10
|
+
}
|
|
11
|
+
export interface EdsTimepickerProps extends Omit<React.HTMLAttributes<HTMLDivElement>, 'onChange' | 'defaultValue'> {
|
|
12
|
+
/** Data attribute for e2e testing. Applied as `data-e2e`. @default 'eds-timepicker' */
|
|
13
|
+
e2eAttr?: string;
|
|
14
|
+
/** Step for hour increment/decrement. @default 1 */
|
|
15
|
+
stepHours?: number;
|
|
16
|
+
/** Step for minute increment/decrement. @default 1 */
|
|
17
|
+
stepMinutes?: number;
|
|
18
|
+
/** Step for second increment/decrement. @default 1 */
|
|
19
|
+
stepSeconds?: number;
|
|
20
|
+
/** Whether to show the seconds field. @default false */
|
|
21
|
+
hasSeconds?: boolean;
|
|
22
|
+
/** Whether the component is disabled. @default false */
|
|
23
|
+
disabled?: boolean;
|
|
24
|
+
/** Whether the component is readonly. @default false */
|
|
25
|
+
readonly?: boolean;
|
|
26
|
+
/** Controlled time value (mirrors the Angular CVA `writeValue`). */
|
|
27
|
+
value?: EdsTime | null;
|
|
28
|
+
/** Initial time value for the uncontrolled case. */
|
|
29
|
+
defaultValue?: EdsTime | null;
|
|
30
|
+
/** Emitted when the time value changes (mirrors the Angular `(timeChange)` output). */
|
|
31
|
+
onTimeChange?: (time: EdsTime) => void;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* `EdsTimepicker` — pure React port of the Angular `eds-timepicker`, colocated inside the
|
|
35
|
+
* `eds-datepicker` folder because the datepicker's datetime branch composes it
|
|
36
|
+
* (`<eds-timepicker [hasSeconds] [disabled] (timeChange)>`). The Angular component is a
|
|
37
|
+
* `ControlValueAccessor`; React has no CVA, so this exposes controlled `value` + `onTimeChange`
|
|
38
|
+
* and uncontrolled `defaultValue`. The rounding/wrap arithmetic (hours mod 24, minute/second
|
|
39
|
+
* carry into the next unit) is ported verbatim from `eds-timepicker.ts`.
|
|
40
|
+
*
|
|
41
|
+
* NOTE: this is a datepicker-internal projection, NOT a standalone published `@eui/eds-react/eds-timepicker`.
|
|
42
|
+
*/
|
|
43
|
+
export declare const EdsTimepicker: React.ForwardRefExoticComponent<EdsTimepickerProps & React.RefAttributes<HTMLDivElement>>;
|
|
44
|
+
//# sourceMappingURL=eds-timepicker.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"eds-timepicker.d.ts","sourceRoot":"","sources":["../../src/eds-datepicker/eds-timepicker.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAG/B;;;GAGG;AACH,MAAM,WAAW,OAAO;IACpB,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IACvB,OAAO,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CAC3B;AAED,MAAM,WAAW,kBACb,SAAQ,IAAI,CAAC,KAAK,CAAC,cAAc,CAAC,cAAc,CAAC,EAAE,UAAU,GAAG,cAAc,CAAC;IAC/E,uFAAuF;IACvF,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,oDAAoD;IACpD,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,sDAAsD;IACtD,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,sDAAsD;IACtD,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,wDAAwD;IACxD,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,wDAAwD;IACxD,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,wDAAwD;IACxD,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,oEAAoE;IACpE,KAAK,CAAC,EAAE,OAAO,GAAG,IAAI,CAAC;IACvB,oDAAoD;IACpD,YAAY,CAAC,EAAE,OAAO,GAAG,IAAI,CAAC;IAC9B,uFAAuF;IACvF,YAAY,CAAC,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,IAAI,CAAC;CAC1C;AAED;;;;;;;;;GASG;AACH,eAAO,MAAM,aAAa,2FAyQxB,CAAC"}
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
import { useCallback, useEffect, useRef, useState } from 'react';
|
|
4
|
+
/**
|
|
5
|
+
* `EdsTimepicker` — pure React port of the Angular `eds-timepicker`, colocated inside the
|
|
6
|
+
* `eds-datepicker` folder because the datepicker's datetime branch composes it
|
|
7
|
+
* (`<eds-timepicker [hasSeconds] [disabled] (timeChange)>`). The Angular component is a
|
|
8
|
+
* `ControlValueAccessor`; React has no CVA, so this exposes controlled `value` + `onTimeChange`
|
|
9
|
+
* and uncontrolled `defaultValue`. The rounding/wrap arithmetic (hours mod 24, minute/second
|
|
10
|
+
* carry into the next unit) is ported verbatim from `eds-timepicker.ts`.
|
|
11
|
+
*
|
|
12
|
+
* NOTE: this is a datepicker-internal projection, NOT a standalone published `@eui/eds-react/eds-timepicker`.
|
|
13
|
+
*/
|
|
14
|
+
export const EdsTimepicker = React.forwardRef(function EdsTimepicker({ e2eAttr = 'eds-timepicker', stepHours = 1, stepMinutes = 1, stepSeconds = 1, hasSeconds = false, disabled = false, readonly = false, value, defaultValue, onTimeChange, className, ...rest }, ref) {
|
|
15
|
+
const isControlled = value !== undefined;
|
|
16
|
+
const [hours, setHours] = useState(value?.hours ?? defaultValue?.hours ?? 0);
|
|
17
|
+
const [minutes, setMinutes] = useState(value?.minutes ?? defaultValue?.minutes ?? 0);
|
|
18
|
+
const [seconds, setSeconds] = useState(value?.seconds ?? defaultValue?.seconds ?? 0);
|
|
19
|
+
// Sync controlled value → internal state (CVA writeValue analog).
|
|
20
|
+
useEffect(() => {
|
|
21
|
+
if (isControlled) {
|
|
22
|
+
setHours(value?.hours ?? 0);
|
|
23
|
+
setMinutes(value?.minutes ?? 0);
|
|
24
|
+
setSeconds(value?.seconds ?? 0);
|
|
25
|
+
}
|
|
26
|
+
}, [isControlled, value?.hours, value?.minutes, value?.seconds]);
|
|
27
|
+
const padded = (val) => String(val ?? 0).padStart(2, '0');
|
|
28
|
+
const emit = useCallback((h, m, s) => {
|
|
29
|
+
const time = {
|
|
30
|
+
hours: h,
|
|
31
|
+
minutes: m,
|
|
32
|
+
seconds: hasSeconds ? s : undefined,
|
|
33
|
+
};
|
|
34
|
+
onTimeChange?.(time);
|
|
35
|
+
}, [hasSeconds, onTimeChange]);
|
|
36
|
+
// Ported verbatim from eds-timepicker.ts; returns the new {h,m,s} after carry so the emit
|
|
37
|
+
// sees the final values (React state setters are async).
|
|
38
|
+
const applyHours = (h, step) => ((h + step + 24) % 24);
|
|
39
|
+
const changeHours = useCallback((step) => {
|
|
40
|
+
const h = applyHours(hours, step);
|
|
41
|
+
setHours(h);
|
|
42
|
+
emit(h, minutes, seconds);
|
|
43
|
+
}, [hours, minutes, seconds, emit]);
|
|
44
|
+
const changeMinutes = useCallback((step) => {
|
|
45
|
+
let m = minutes + step;
|
|
46
|
+
let h = hours;
|
|
47
|
+
if (m >= 60) {
|
|
48
|
+
m = m % 60;
|
|
49
|
+
h = applyHours(h, 1);
|
|
50
|
+
}
|
|
51
|
+
else if (m < 0) {
|
|
52
|
+
m = 60 + (m % 60);
|
|
53
|
+
h = applyHours(h, -1);
|
|
54
|
+
}
|
|
55
|
+
setHours(h);
|
|
56
|
+
setMinutes(m);
|
|
57
|
+
emit(h, m, seconds);
|
|
58
|
+
}, [hours, minutes, seconds, emit]);
|
|
59
|
+
const changeSeconds = useCallback((step) => {
|
|
60
|
+
let s = seconds + step;
|
|
61
|
+
let m = minutes;
|
|
62
|
+
let h = hours;
|
|
63
|
+
if (s >= 60) {
|
|
64
|
+
s = s % 60;
|
|
65
|
+
// carry into minutes (which may carry into hours)
|
|
66
|
+
m = minutes + 1;
|
|
67
|
+
if (m >= 60) {
|
|
68
|
+
m = m % 60;
|
|
69
|
+
h = applyHours(h, 1);
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
else if (s < 0) {
|
|
73
|
+
s = 60 + (s % 60);
|
|
74
|
+
m = minutes - 1;
|
|
75
|
+
if (m < 0) {
|
|
76
|
+
m = 60 + (m % 60);
|
|
77
|
+
h = applyHours(h, -1);
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
setHours(h);
|
|
81
|
+
setMinutes(m);
|
|
82
|
+
setSeconds(s);
|
|
83
|
+
emit(h, m, s);
|
|
84
|
+
}, [hours, minutes, seconds, emit]);
|
|
85
|
+
const onHoursInput = (event) => {
|
|
86
|
+
const val = parseInt(event.target.value, 10);
|
|
87
|
+
if (!isNaN(val)) {
|
|
88
|
+
const h = ((val % 24) + 24) % 24;
|
|
89
|
+
setHours(h);
|
|
90
|
+
emit(h, minutes, seconds);
|
|
91
|
+
}
|
|
92
|
+
};
|
|
93
|
+
const onMinutesInput = (event) => {
|
|
94
|
+
const val = parseInt(event.target.value, 10);
|
|
95
|
+
if (!isNaN(val)) {
|
|
96
|
+
const m = ((val % 60) + 60) % 60;
|
|
97
|
+
setMinutes(m);
|
|
98
|
+
emit(hours, m, seconds);
|
|
99
|
+
}
|
|
100
|
+
};
|
|
101
|
+
const onSecondsInput = (event) => {
|
|
102
|
+
const val = parseInt(event.target.value, 10);
|
|
103
|
+
if (!isNaN(val)) {
|
|
104
|
+
const s = ((val % 60) + 60) % 60;
|
|
105
|
+
setSeconds(s);
|
|
106
|
+
emit(hours, minutes, s);
|
|
107
|
+
}
|
|
108
|
+
};
|
|
109
|
+
// Suppress unused-ref lint by attaching the forwarded ref to the root.
|
|
110
|
+
const rootRef = useRef(null);
|
|
111
|
+
const setRefs = useCallback((node) => {
|
|
112
|
+
rootRef.current = node;
|
|
113
|
+
if (typeof ref === 'function') {
|
|
114
|
+
ref(node);
|
|
115
|
+
}
|
|
116
|
+
else if (ref) {
|
|
117
|
+
ref.current = node;
|
|
118
|
+
}
|
|
119
|
+
}, [ref]);
|
|
120
|
+
return (_jsxs("div", { ref: setRefs, className: className ? `eds-timepicker ${className}` : 'eds-timepicker', "data-e2e": e2eAttr, ...rest, children: [_jsxs("div", { className: "eds-timepicker__field", children: [!readonly && (_jsx("button", { className: "eds-timepicker__btn", type: "button", disabled: disabled, onClick: () => changeHours(stepHours), "aria-label": "Increase hours", children: '\u25B2' })), _jsx("input", { className: "eds-timepicker__input", type: "text", value: padded(hours), disabled: disabled, readOnly: readonly, onChange: onHoursInput, "aria-label": "Hours" }), !readonly && (_jsx("button", { className: "eds-timepicker__btn", type: "button", disabled: disabled, onClick: () => changeHours(-stepHours), "aria-label": "Decrease hours", children: '\u25BC' }))] }), _jsx("span", { className: "eds-timepicker__separator", children: ":" }), _jsxs("div", { className: "eds-timepicker__field", children: [!readonly && (_jsx("button", { className: "eds-timepicker__btn", type: "button", disabled: disabled, onClick: () => changeMinutes(stepMinutes), "aria-label": "Increase minutes", children: '\u25B2' })), _jsx("input", { className: "eds-timepicker__input", type: "text", value: padded(minutes), disabled: disabled, readOnly: readonly, onChange: onMinutesInput, "aria-label": "Minutes" }), !readonly && (_jsx("button", { className: "eds-timepicker__btn", type: "button", disabled: disabled, onClick: () => changeMinutes(-stepMinutes), "aria-label": "Decrease minutes", children: '\u25BC' }))] }), hasSeconds && (_jsxs(_Fragment, { children: [_jsx("span", { className: "eds-timepicker__separator", children: ":" }), _jsxs("div", { className: "eds-timepicker__field", children: [!readonly && (_jsx("button", { className: "eds-timepicker__btn", type: "button", disabled: disabled, onClick: () => changeSeconds(stepSeconds), "aria-label": "Increase seconds", children: '\u25B2' })), _jsx("input", { className: "eds-timepicker__input", type: "text", value: padded(seconds), disabled: disabled, readOnly: readonly, onChange: onSecondsInput, "aria-label": "Seconds" }), !readonly && (_jsx("button", { className: "eds-timepicker__btn", type: "button", disabled: disabled, onClick: () => changeSeconds(-stepSeconds), "aria-label": "Decrease seconds", children: '\u25BC' }))] })] }))] }));
|
|
121
|
+
});
|
|
122
|
+
//# sourceMappingURL=eds-timepicker.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"eds-timepicker.js","sourceRoot":"","sources":["../../src/eds-datepicker/eds-timepicker.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAoCjE;;;;;;;;;GASG;AACH,MAAM,CAAC,MAAM,aAAa,GAAG,KAAK,CAAC,UAAU,CAAqC,SAAS,aAAa,CACpG,EACI,OAAO,GAAG,gBAAgB,EAC1B,SAAS,GAAG,CAAC,EACb,WAAW,GAAG,CAAC,EACf,WAAW,GAAG,CAAC,EACf,UAAU,GAAG,KAAK,EAClB,QAAQ,GAAG,KAAK,EAChB,QAAQ,GAAG,KAAK,EAChB,KAAK,EACL,YAAY,EACZ,YAAY,EACZ,SAAS,EACT,GAAG,IAAI,EACV,EACD,GAAG;IAEH,MAAM,YAAY,GAAG,KAAK,KAAK,SAAS,CAAC;IAEzC,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,GAAG,QAAQ,CAAS,KAAK,EAAE,KAAK,IAAI,YAAY,EAAE,KAAK,IAAI,CAAC,CAAC,CAAC;IACrF,MAAM,CAAC,OAAO,EAAE,UAAU,CAAC,GAAG,QAAQ,CAAS,KAAK,EAAE,OAAO,IAAI,YAAY,EAAE,OAAO,IAAI,CAAC,CAAC,CAAC;I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,QAAQ,EAAE,cAAc,gBACb,SAAS,GACtB,EACD,CAAC,QAAQ,IAAI,CACV,iBACI,SAAS,EAAC,qBAAqB,EAC/B,IAAI,EAAC,QAAQ,EACb,QAAQ,EAAE,QAAQ,EAClB,OAAO,EAAE,GAAG,EAAE,CAAC,aAAa,CAAC,CAAC,WAAW,CAAC,gBAC/B,kBAAkB,YAE5B,QAAQ,GACJ,CACZ,IACC,EAEL,UAAU,IAAI,CACX,8BACI,eAAM,SAAS,EAAC,2BAA2B,kBAAS,EAEpD,eAAK,SAAS,EAAC,uBAAuB,aACjC,CAAC,QAAQ,IAAI,CACV,iBACI,SAAS,EAAC,qBAAqB,EAC/B,IAAI,EAAC,QAAQ,EACb,QAAQ,EAAE,QAAQ,EAClB,OAAO,EAAE,GAAG,EAAE,CAAC,aAAa,CAAC,WAAW,CAAC,gBAC9B,kBAAkB,YAE5B,QAAQ,GACJ,CACZ,EACD,gBACI,SAAS,EAAC,uBAAuB,EACjC,IAAI,EAAC,MAAM,EACX,KAAK,EAAE,MAAM,CAAC,OAAO,CAAC,EACtB,QAAQ,EAAE,QAAQ,EAClB,QAAQ,EAAE,QAAQ,EAClB,QAAQ,EAAE,cAAc,gBACb,SAAS,GACtB,EACD,CAAC,QAAQ,IAAI,CACV,iBACI,SAAS,EAAC,qBAAqB,EAC/B,IAAI,EAAC,QAAQ,EACb,QAAQ,EAAE,QAAQ,EAClB,OAAO,EAAE,GAAG,EAAE,CAAC,aAAa,CAAC,CAAC,WAAW,CAAC,gBAC/B,kBAAkB,YAE5B,QAAQ,GACJ,CACZ,IACC,IACP,CACN,IACC,CACT,CAAC;AACN,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export { EdsDatepicker } from './eds-datepicker.js';
|
|
2
|
+
export type { EdsDatepickerProps, EdsDatepickerValue } from './eds-datepicker.js';
|
|
3
|
+
export { EdsTimepicker } from './eds-timepicker.js';
|
|
4
|
+
export type { EdsTimepickerProps, EdsTime } from './eds-timepicker.js';
|
|
5
|
+
export { EdsNativeDateAdapter } from './eds-date-adapter.js';
|
|
6
|
+
export type { EdsDateAdapter } from './eds-date-adapter.js';
|
|
7
|
+
export { EdsLuxonDateAdapter, setLuxonDateTime } from './eds-luxon-date-adapter.js';
|
|
8
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/eds-datepicker/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACpD,YAAY,EAAE,kBAAkB,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AAElF,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACpD,YAAY,EAAE,kBAAkB,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAEvE,OAAO,EAAE,oBAAoB,EAAE,MAAM,uBAAuB,CAAC;AAC7D,YAAY,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAE5D,OAAO,EAAE,mBAAmB,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export { EdsDatepicker } from './eds-datepicker.js';
|
|
2
|
+
export { EdsTimepicker } from './eds-timepicker.js';
|
|
3
|
+
export { EdsNativeDateAdapter } from './eds-date-adapter.js';
|
|
4
|
+
export { EdsLuxonDateAdapter, setLuxonDateTime } from './eds-luxon-date-adapter.js';
|
|
5
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/eds-datepicker/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAGpD,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAGpD,OAAO,EAAE,oBAAoB,EAAE,MAAM,uBAAuB,CAAC;AAG7D,OAAO,EAAE,mBAAmB,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
.eds-label {
|
|
2
|
+
display: inline-block;
|
|
3
|
+
font: var(--eds-f-label-m-semi-bold);
|
|
4
|
+
color: var(--eds-c-foreground);
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
.eds-label.eds-label--required::after {
|
|
8
|
+
color: var(--eds-c-foreground-critical);
|
|
9
|
+
content: ' *';
|
|
10
|
+
font: var(--eds-f-label-m-semi-bold);
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
.eds-label.eds-label--neutral {
|
|
14
|
+
color: var(--eds-c-foreground);
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
.eds-label.eds-label--critical {
|
|
18
|
+
color: var(--eds-c-foreground-critical);
|
|
19
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* Color tokens accepted by EdsLabel (mirrors the Angular EdsColorDirective's
|
|
4
|
+
* `edsColorVariant` union). Only `neutral` and `critical` are styled; other
|
|
5
|
+
* values resolve to the corresponding `eds-label--<color>` modifier class.
|
|
6
|
+
*/
|
|
7
|
+
export type EdsLabelColor = 'primary' | 'brand' | 'neutral' | 'neutral-subtle' | 'neutral-subtler' | 'highlight' | 'info' | 'success' | 'warning' | 'critical' | 'disabled';
|
|
8
|
+
export interface EdsLabelProps extends Omit<React.LabelHTMLAttributes<HTMLLabelElement>, 'color'> {
|
|
9
|
+
/**
|
|
10
|
+
* Color variant. Resolves to the `eds-label--<color>` modifier class.
|
|
11
|
+
* @default 'neutral'
|
|
12
|
+
*/
|
|
13
|
+
color?: EdsLabelColor;
|
|
14
|
+
/**
|
|
15
|
+
* Marks the label as required (appends a red asterisk via CSS).
|
|
16
|
+
* @default false
|
|
17
|
+
*/
|
|
18
|
+
required?: boolean;
|
|
19
|
+
children?: React.ReactNode;
|
|
20
|
+
}
|
|
21
|
+
export declare const EdsLabel: React.ForwardRefExoticComponent<EdsLabelProps & React.RefAttributes<HTMLLabelElement>>;
|
|
22
|
+
//# sourceMappingURL=eds-label.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"eds-label.d.ts","sourceRoot":"","sources":["../../src/eds-label/eds-label.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B;;;;GAIG;AACH,MAAM,MAAM,aAAa,GACnB,SAAS,GACT,OAAO,GACP,SAAS,GACT,gBAAgB,GAChB,iBAAiB,GACjB,WAAW,GACX,MAAM,GACN,SAAS,GACT,SAAS,GACT,UAAU,GACV,UAAU,CAAC;AAEjB,MAAM,WAAW,aAAc,SAAQ,IAAI,CAAC,KAAK,CAAC,mBAAmB,CAAC,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC7F;;;OAGG;IACH,KAAK,CAAC,EAAE,aAAa,CAAC;IACtB;;;OAGG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;CAC9B;AAED,eAAO,MAAM,QAAQ,wFAmBnB,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
export const EdsLabel = React.forwardRef(function EdsLabel({ color = 'neutral', required = false, children, className, ...rest }, ref) {
|
|
4
|
+
// Angular hostClasses(): 'eds-label' + (colorClass || 'eds-label--neutral') + (required ? 'eds-label--required' : '')
|
|
5
|
+
const classes = [
|
|
6
|
+
'eds-label',
|
|
7
|
+
color ? `eds-label--${color}` : 'eds-label--neutral',
|
|
8
|
+
required ? 'eds-label--required' : '',
|
|
9
|
+
className,
|
|
10
|
+
]
|
|
11
|
+
.filter(Boolean)
|
|
12
|
+
.join(' ');
|
|
13
|
+
return (_jsx("label", { ref: ref, className: classes, ...rest, children: children }));
|
|
14
|
+
});
|
|
15
|
+
//# sourceMappingURL=eds-label.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"eds-label.js","sourceRoot":"","sources":["../../src/eds-label/eds-label.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAkC/B,MAAM,CAAC,MAAM,QAAQ,GAAG,KAAK,CAAC,UAAU,CAAkC,SAAS,QAAQ,CACvF,EAAE,KAAK,GAAG,SAAS,EAAE,QAAQ,GAAG,KAAK,EAAE,QAAQ,EAAE,SAAS,EAAE,GAAG,IAAI,EAAE,EACrE,GAAG;IAEH,sHAAsH;IACtH,MAAM,OAAO,GAAG;QACZ,WAAW;QACX,KAAK,CAAC,CAAC,CAAC,cAAc,KAAK,EAAE,CAAC,CAAC,CAAC,oBAAoB;QACpD,QAAQ,CAAC,CAAC,CAAC,qBAAqB,CAAC,CAAC,CAAC,EAAE;QACrC,SAAS;KACZ;SACI,MAAM,CAAC,OAAO,CAAC;SACf,IAAI,CAAC,GAAG,CAAC,CAAC;IAEf,OAAO,CACH,gBAAO,GAAG,EAAE,GAAG,EAAE,SAAS,EAAE,OAAO,KAAM,IAAI,YACxC,QAAQ,GACL,CACX,CAAC;AACN,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/eds-label/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAC1C,YAAY,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/eds-label/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC"}
|
package/eds-shell/eds-shell.css
CHANGED
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
height: 100%;
|
|
34
34
|
display: flex;
|
|
35
35
|
flex-direction: column;
|
|
36
|
-
background: var(--eds-c-surface-elevation);
|
|
36
|
+
background: var(--eds-c-surface-elevation-inset);
|
|
37
37
|
border-right: var(--eds-bw-xs) solid var(--eds-c-border-divider);
|
|
38
38
|
transition: width 0.3s ease, min-width 0.3s ease, transform 0.3s ease;
|
|
39
39
|
overflow: hidden;
|
|
@@ -88,6 +88,7 @@
|
|
|
88
88
|
overflow-y: auto;
|
|
89
89
|
overflow-x: hidden;
|
|
90
90
|
min-width: 0;
|
|
91
|
+
background-color: #fbfbfb;
|
|
91
92
|
}
|
|
92
93
|
|
|
93
94
|
@media (min-width: 768px) and (max-width: 1139px) {
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { EdsTableSort, EdsTableSortOrder } from './eds-table-sort.model.js';
|
|
2
|
+
/**
|
|
3
|
+
* `EdsTableContext` — the React reimplementation of the two Angular DI services that `eds-table`
|
|
4
|
+
* provided (`EdsTableSortService` + `EdsTableSelectableService`). In Angular those were injected
|
|
5
|
+
* shared state consumed by `th[edsSortable]`, `tr[edsDataSelectable]`, and
|
|
6
|
+
* `tr[edsHeaderSelectable]`. React has no per-instance DI, so `EdsTable` owns the state and
|
|
7
|
+
* publishes it through this context; the sub-components consume it with {@link useEdsTable}.
|
|
8
|
+
*
|
|
9
|
+
* The public inputs/outputs are preserved 1:1 by `EdsTable`: `sortChange` emits `EdsTableSort[]`,
|
|
10
|
+
* `rowsSelect` emits the selected rows array.
|
|
11
|
+
*/
|
|
12
|
+
export interface EdsTableContextValue<DATA = unknown> {
|
|
13
|
+
/** Current sort configuration (mirrors `EdsTableSortService.sorts`). */
|
|
14
|
+
readonly sorts: EdsTableSort[];
|
|
15
|
+
/**
|
|
16
|
+
* Set (cycle) the ordering for a given column — mirrors `EdsTableSortService.setSort`,
|
|
17
|
+
* including multi-sort accumulation semantics.
|
|
18
|
+
*/
|
|
19
|
+
setSort(sort: string, order: EdsTableSortOrder, isMultiSortable: boolean): void;
|
|
20
|
+
/** Replace the full list of sorts (mirrors `EdsTableSortService.setSorts`). */
|
|
21
|
+
setSorts(sorts: EdsTableSort[]): void;
|
|
22
|
+
/** Currently selected rows (mirrors `EdsTableSelectableService.selectedRows`). */
|
|
23
|
+
readonly selectedRows: DATA[];
|
|
24
|
+
/** Whether all registered rows are selected (mirrors `isAllRowsSelected`). */
|
|
25
|
+
readonly isAllRowsSelected: boolean;
|
|
26
|
+
/** Whether some — but not all — rows are selected (mirrors `isIndeterminate`). */
|
|
27
|
+
readonly isIndeterminate: boolean;
|
|
28
|
+
/** The property name identifying rows uniquely (mirrors `getPropId`). */
|
|
29
|
+
readonly propId: string;
|
|
30
|
+
/** Whether a given row is currently selected. */
|
|
31
|
+
isRowSelected(row: DATA): boolean;
|
|
32
|
+
/** Add a row to the selection (mirrors `selectRow`). */
|
|
33
|
+
selectRow(row: DATA): void;
|
|
34
|
+
/** Replace the selection with a single row (mirrors `selectSingleRow`). */
|
|
35
|
+
selectSingleRow(row: DATA): void;
|
|
36
|
+
/** Remove a row from the selection (mirrors `unselectRow`). */
|
|
37
|
+
unselectRow(row: DATA): void;
|
|
38
|
+
/** Replace the whole selection with the given rows (mirrors `selectRows`). */
|
|
39
|
+
selectRows(rows: DATA[]): void;
|
|
40
|
+
/** Select every registered row (mirrors `selectAllRows`). */
|
|
41
|
+
selectAllRows(): void;
|
|
42
|
+
/** Clear the selection (mirrors `unselectAllRows`). */
|
|
43
|
+
unselectAllRows(): void;
|
|
44
|
+
/** The list of registered (currently rendered/filtered) rows (mirrors `getRows`). */
|
|
45
|
+
getRows(): DATA[];
|
|
46
|
+
/** The last row that was selected, used by shift-click range selection (mirrors `getLastSelectedRow`). */
|
|
47
|
+
getLastSelectedRow(): DATA | null;
|
|
48
|
+
}
|
|
49
|
+
export declare const EdsTableContext: import("react").Context<EdsTableContextValue<any> | null>;
|
|
50
|
+
/**
|
|
51
|
+
* Hook to read the {@link EdsTableContext} published by the enclosing `EdsTable`. Used by the
|
|
52
|
+
* sortable-col / selectable-row / selectable-header sub-components. Returns `null` when used
|
|
53
|
+
* outside an `EdsTable` (the sub-components degrade gracefully in that case).
|
|
54
|
+
*/
|
|
55
|
+
export declare function useEdsTable<DATA = unknown>(): EdsTableContextValue<DATA> | null;
|
|
56
|
+
//# sourceMappingURL=eds-table-context.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"eds-table-context.d.ts","sourceRoot":"","sources":["../../src/eds-table/eds-table-context.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,YAAY,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AAE5E;;;;;;;;;GASG;AACH,MAAM,WAAW,oBAAoB,CAAC,IAAI,GAAG,OAAO;IAEhD,wEAAwE;IACxE,QAAQ,CAAC,KAAK,EAAE,YAAY,EAAE,CAAC;IAC/B;;;OAGG;IACH,OAAO,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,iBAAiB,EAAE,eAAe,EAAE,OAAO,GAAG,IAAI,CAAC;IAChF,+EAA+E;IAC/E,QAAQ,CAAC,KAAK,EAAE,YAAY,EAAE,GAAG,IAAI,CAAC;IAGtC,kFAAkF;IAClF,QAAQ,CAAC,YAAY,EAAE,IAAI,EAAE,CAAC;IAC9B,8EAA8E;IAC9E,QAAQ,CAAC,iBAAiB,EAAE,OAAO,CAAC;IACpC,kFAAkF;IAClF,QAAQ,CAAC,eAAe,EAAE,OAAO,CAAC;IAClC,yEAAyE;IACzE,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,iDAAiD;IACjD,aAAa,CAAC,GAAG,EAAE,IAAI,GAAG,OAAO,CAAC;IAClC,wDAAwD;IACxD,SAAS,CAAC,GAAG,EAAE,IAAI,GAAG,IAAI,CAAC;IAC3B,2EAA2E;IAC3E,eAAe,CAAC,GAAG,EAAE,IAAI,GAAG,IAAI,CAAC;IACjC,+DAA+D;IAC/D,WAAW,CAAC,GAAG,EAAE,IAAI,GAAG,IAAI,CAAC;IAC7B,8EAA8E;IAC9E,UAAU,CAAC,IAAI,EAAE,IAAI,EAAE,GAAG,IAAI,CAAC;IAC/B,6DAA6D;IAC7D,aAAa,IAAI,IAAI,CAAC;IACtB,uDAAuD;IACvD,eAAe,IAAI,IAAI,CAAC;IACxB,qFAAqF;IACrF,OAAO,IAAI,IAAI,EAAE,CAAC;IAClB,0GAA0G;IAC1G,kBAAkB,IAAI,IAAI,GAAG,IAAI,CAAC;CACrC;AAGD,eAAO,MAAM,eAAe,2DAAwD,CAAC;AAErF;;;;GAIG;AACH,wBAAgB,WAAW,CAAC,IAAI,GAAG,OAAO,KAAK,oBAAoB,CAAC,IAAI,CAAC,GAAG,IAAI,CAE/E"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { createContext, useContext } from 'react';
|
|
2
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
3
|
+
export const EdsTableContext = createContext(null);
|
|
4
|
+
/**
|
|
5
|
+
* Hook to read the {@link EdsTableContext} published by the enclosing `EdsTable`. Used by the
|
|
6
|
+
* sortable-col / selectable-row / selectable-header sub-components. Returns `null` when used
|
|
7
|
+
* outside an `EdsTable` (the sub-components degrade gracefully in that case).
|
|
8
|
+
*/
|
|
9
|
+
export function useEdsTable() {
|
|
10
|
+
return useContext(EdsTableContext);
|
|
11
|
+
}
|
|
12
|
+
//# sourceMappingURL=eds-table-context.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"eds-table-context.js","sourceRoot":"","sources":["../../src/eds-table/eds-table-context.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AAuDlD,8DAA8D;AAC9D,MAAM,CAAC,MAAM,eAAe,GAAG,aAAa,CAAmC,IAAI,CAAC,CAAC;AAErF;;;;GAIG;AACH,MAAM,UAAU,WAAW;IACvB,OAAO,UAAU,CAAC,eAAe,CAAsC,CAAC;AAC5E,CAAC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
export interface EdsTableExpandableRowProps extends React.HTMLAttributes<HTMLTableRowElement> {
|
|
3
|
+
children?: React.ReactNode;
|
|
4
|
+
}
|
|
5
|
+
/**
|
|
6
|
+
* `EdsTableExpandableRow` — pure React port of the Angular `tr[edsExpandableRow]` directive.
|
|
7
|
+
* Activates the expandable feature on a table row by adding the `eds-table__expandable-row`
|
|
8
|
+
* class (the directive's sole behavior — `host: { class: 'eds-table__expandable-row' }`). The
|
|
9
|
+
* consumer controls visibility (whether the expandable `<tr>` is rendered) exactly as in Angular,
|
|
10
|
+
* where the row was placed inside a conditional block.
|
|
11
|
+
*
|
|
12
|
+
* @example
|
|
13
|
+
* ```tsx
|
|
14
|
+
* {expanded && (
|
|
15
|
+
* <EdsTableExpandableRow>
|
|
16
|
+
* <td colSpan={4}>Extra detail…</td>
|
|
17
|
+
* </EdsTableExpandableRow>
|
|
18
|
+
* )}
|
|
19
|
+
* ```
|
|
20
|
+
*/
|
|
21
|
+
export declare const EdsTableExpandableRow: React.ForwardRefExoticComponent<EdsTableExpandableRowProps & React.RefAttributes<HTMLTableRowElement>>;
|
|
22
|
+
//# sourceMappingURL=eds-table-expandable-row.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"eds-table-expandable-row.d.ts","sourceRoot":"","sources":["../../src/eds-table/eds-table-expandable-row.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,MAAM,WAAW,0BACb,SAAQ,KAAK,CAAC,cAAc,CAAC,mBAAmB,CAAC;IACjD,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;CAC9B;AAED;;;;;;;;;;;;;;;GAeG;AACH,eAAO,MAAM,qBAAqB,wGAWjC,CAAC"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
/**
|
|
4
|
+
* `EdsTableExpandableRow` — pure React port of the Angular `tr[edsExpandableRow]` directive.
|
|
5
|
+
* Activates the expandable feature on a table row by adding the `eds-table__expandable-row`
|
|
6
|
+
* class (the directive's sole behavior — `host: { class: 'eds-table__expandable-row' }`). The
|
|
7
|
+
* consumer controls visibility (whether the expandable `<tr>` is rendered) exactly as in Angular,
|
|
8
|
+
* where the row was placed inside a conditional block.
|
|
9
|
+
*
|
|
10
|
+
* @example
|
|
11
|
+
* ```tsx
|
|
12
|
+
* {expanded && (
|
|
13
|
+
* <EdsTableExpandableRow>
|
|
14
|
+
* <td colSpan={4}>Extra detail…</td>
|
|
15
|
+
* </EdsTableExpandableRow>
|
|
16
|
+
* )}
|
|
17
|
+
* ```
|
|
18
|
+
*/
|
|
19
|
+
export const EdsTableExpandableRow = React.forwardRef(function EdsTableExpandableRow({ className, children, ...rest }, ref) {
|
|
20
|
+
const rootClass = className
|
|
21
|
+
? `eds-table__expandable-row ${className}`
|
|
22
|
+
: 'eds-table__expandable-row';
|
|
23
|
+
return (_jsx("tr", { ref: ref, className: rootClass, ...rest, children: children }));
|
|
24
|
+
});
|
|
25
|
+
//# sourceMappingURL=eds-table-expandable-row.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"eds-table-expandable-row.js","sourceRoot":"","sources":["../../src/eds-table/eds-table-expandable-row.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAO/B;;;;;;;;;;;;;;;GAeG;AACH,MAAM,CAAC,MAAM,qBAAqB,GAAG,KAAK,CAAC,UAAU,CACjD,SAAS,qBAAqB,CAAC,EAAE,SAAS,EAAE,QAAQ,EAAE,GAAG,IAAI,EAAE,EAAE,GAAG;IAChE,MAAM,SAAS,GAAG,SAAS;QACvB,CAAC,CAAC,6BAA6B,SAAS,EAAE;QAC1C,CAAC,CAAC,2BAA2B,CAAC;IAClC,OAAO,CACH,aAAI,GAAG,EAAE,GAAG,EAAE,SAAS,EAAE,SAAS,KAAM,IAAI,YACvC,QAAQ,GACR,CACR,CAAC;AACN,CAAC,CACJ,CAAC"}
|