@wso2/oxygen-ui 0.16.0 → 0.17.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/.claude/skills/oxygen-component/SKILL.md +31 -3
- package/.claude/skills/oxygen-form/SKILL.md +21 -8
- package/.claude/skills/oxygen-layout/SKILL.md +128 -35
- package/dist/components/ListingTable/ListingTable/ListingTable.d.ts +2 -1
- package/dist/components/ListingTable/index.d.ts +2 -1
- package/dist/components/ListingTable/shared/ListingTableFilter.d.ts +80 -0
- package/dist/components/ListingTable/shared/ListingTableFilterMenu.d.ts +47 -0
- package/dist/components/ListingTable/shared/index.d.ts +2 -0
- package/dist/components/TimeRangeFilter/TimeRangeFilter.d.ts +185 -0
- package/dist/components/TimeRangeFilter/index.d.ts +2 -0
- package/dist/components/index.d.ts +3 -1
- package/dist/index.js +1219 -639
- package/dist/index.js.map +4 -4
- package/package.json +2 -2
|
@@ -0,0 +1,185 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import type { ButtonProps } from '@mui/material/Button';
|
|
3
|
+
import type { LocalizationProviderProps } from '@mui/x-date-pickers/LocalizationProvider';
|
|
4
|
+
import type { Locale } from 'date-fns';
|
|
5
|
+
/**
|
|
6
|
+
* A closed time range. `end` is later than `start`.
|
|
7
|
+
*/
|
|
8
|
+
export interface TimeRange {
|
|
9
|
+
start: Date;
|
|
10
|
+
end: Date;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* A quick choice that spans a fixed duration ending now (e.g. "Last 24 hours").
|
|
14
|
+
*/
|
|
15
|
+
export interface TimeRangePreset {
|
|
16
|
+
/** Stable identifier of the preset. */
|
|
17
|
+
id: string;
|
|
18
|
+
/** Text shown in the list. */
|
|
19
|
+
label: string;
|
|
20
|
+
/** Length of the range in milliseconds. */
|
|
21
|
+
durationMs: number;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Props for the TimeRangeFilter component
|
|
25
|
+
*/
|
|
26
|
+
export interface TimeRangeFilterProps extends Omit<ButtonProps, 'onChange' | 'value' | 'children'> {
|
|
27
|
+
/**
|
|
28
|
+
* The selected range, or `null` when no range is selected. The button does not display it, so show
|
|
29
|
+
* it elsewhere (for example in a chip).
|
|
30
|
+
*/
|
|
31
|
+
value: TimeRange | null;
|
|
32
|
+
/**
|
|
33
|
+
* Called with the new range when the user picks a preset or applies a custom range.
|
|
34
|
+
* Clearing the range is up to the consumer (for example, from the remove icon of a chip).
|
|
35
|
+
*/
|
|
36
|
+
onChange: (range: TimeRange) => void;
|
|
37
|
+
/**
|
|
38
|
+
* Presets listed before the custom range.
|
|
39
|
+
* @default Last hour, Last 24 hours, Last 7 days, Last 30 days
|
|
40
|
+
*/
|
|
41
|
+
presets?: TimeRangePreset[];
|
|
42
|
+
/**
|
|
43
|
+
* Longest range, in milliseconds, that a custom range may span. Unlimited when omitted.
|
|
44
|
+
*/
|
|
45
|
+
maxRangeMs?: number;
|
|
46
|
+
/**
|
|
47
|
+
* Text of the trigger button.
|
|
48
|
+
* @default 'Time range'
|
|
49
|
+
*/
|
|
50
|
+
label?: string;
|
|
51
|
+
/**
|
|
52
|
+
* Text of the list item that shows the custom range fields.
|
|
53
|
+
* @default 'Custom'
|
|
54
|
+
*/
|
|
55
|
+
customRangeLabel?: string;
|
|
56
|
+
/**
|
|
57
|
+
* Heading of the custom range fields.
|
|
58
|
+
* @default 'Select date range'
|
|
59
|
+
*/
|
|
60
|
+
panelTitle?: string;
|
|
61
|
+
/**
|
|
62
|
+
* Label of the custom range start. Custom values are read as UTC.
|
|
63
|
+
* @default 'Start from (UTC)'
|
|
64
|
+
*/
|
|
65
|
+
fromLabel?: string;
|
|
66
|
+
/**
|
|
67
|
+
* Label of the custom range end. Custom values are read as UTC.
|
|
68
|
+
* @default 'End on (UTC)'
|
|
69
|
+
*/
|
|
70
|
+
untilLabel?: string;
|
|
71
|
+
/**
|
|
72
|
+
* Label of each date field.
|
|
73
|
+
* @default 'Date'
|
|
74
|
+
*/
|
|
75
|
+
dateLabel?: string;
|
|
76
|
+
/**
|
|
77
|
+
* Label of each time field.
|
|
78
|
+
* @default 'Time'
|
|
79
|
+
*/
|
|
80
|
+
timeLabel?: string;
|
|
81
|
+
/**
|
|
82
|
+
* Text of the button that applies a custom range.
|
|
83
|
+
* @default 'Apply'
|
|
84
|
+
*/
|
|
85
|
+
applyLabel?: string;
|
|
86
|
+
/**
|
|
87
|
+
* Text of the button that closes the picker without applying a custom range.
|
|
88
|
+
* @default 'Cancel'
|
|
89
|
+
*/
|
|
90
|
+
cancelLabel?: string;
|
|
91
|
+
/**
|
|
92
|
+
* Error shown when the custom range is empty or reversed, or a date or time is missing.
|
|
93
|
+
* @default 'Choose a valid time range.'
|
|
94
|
+
*/
|
|
95
|
+
invalidRangeLabel?: string;
|
|
96
|
+
/**
|
|
97
|
+
* Error shown when the custom range is longer than `maxRangeMs`. The default names the limit, for
|
|
98
|
+
* example 'Choose a range of at most 30 days.'; set it to translate that text.
|
|
99
|
+
*/
|
|
100
|
+
rangeTooLongLabel?: string;
|
|
101
|
+
/**
|
|
102
|
+
* The date-fns locale of the date and time fields and their calendars, for example `fr` from
|
|
103
|
+
* `date-fns/locale`. It sets the month names, the first day of the week and the like. The pickers
|
|
104
|
+
* are in English when it is not set.
|
|
105
|
+
*/
|
|
106
|
+
adapterLocale?: Locale;
|
|
107
|
+
/**
|
|
108
|
+
* Text of the pickers' own controls (the calendar buttons, and the OK and Cancel of the dialog
|
|
109
|
+
* shown on touch screens), for example `frFR.components.MuiLocalizationProvider.defaultProps.localeText`
|
|
110
|
+
* from `@mui/x-date-pickers/locales`.
|
|
111
|
+
*/
|
|
112
|
+
localeText?: LocalizationProviderProps<Locale>['localeText'];
|
|
113
|
+
/**
|
|
114
|
+
* Format of the date fields, as a date-fns format string.
|
|
115
|
+
* @default 'dd MMM, yyyy'
|
|
116
|
+
*/
|
|
117
|
+
dateFormat?: string;
|
|
118
|
+
/**
|
|
119
|
+
* Format of the time fields, as a date-fns format string. Keep the seconds in it: the fields pick
|
|
120
|
+
* the hour, the minute and the second.
|
|
121
|
+
* @default 'HH:mm:ss'
|
|
122
|
+
*/
|
|
123
|
+
timeFormat?: string;
|
|
124
|
+
/**
|
|
125
|
+
* Whether the picker is open. Set it, with `onOpen` and `onClose`, to control the picker, for
|
|
126
|
+
* example to reopen it from a chip that shows the range. Leave it out and the picker opens and
|
|
127
|
+
* closes itself.
|
|
128
|
+
*/
|
|
129
|
+
open?: boolean;
|
|
130
|
+
/**
|
|
131
|
+
* Called when the trigger button asks to open the picker.
|
|
132
|
+
*/
|
|
133
|
+
onOpen?: () => void;
|
|
134
|
+
/**
|
|
135
|
+
* Called when the picker asks to close: after a choice is applied, on Cancel, on Escape, and on a
|
|
136
|
+
* click outside.
|
|
137
|
+
*/
|
|
138
|
+
onClose?: () => void;
|
|
139
|
+
/**
|
|
140
|
+
* The element the open picker is placed under. Defaults to the trigger button. Set it when the
|
|
141
|
+
* picker is opened from somewhere else, such as a chip.
|
|
142
|
+
*/
|
|
143
|
+
anchorEl?: HTMLElement | null;
|
|
144
|
+
}
|
|
145
|
+
/**
|
|
146
|
+
* TimeRangeFilter component - A button that opens a list of quick time ranges and, beside it, the
|
|
147
|
+
* fields of a custom range.
|
|
148
|
+
*
|
|
149
|
+
* Custom ranges are entered and read as UTC. The component never fetches data or clears the
|
|
150
|
+
* range itself; it reports choices through `onChange`.
|
|
151
|
+
*
|
|
152
|
+
* The button does not show the selected range: its text stays the same after a choice. Show the
|
|
153
|
+
* range yourself, for example in a chip or as text beside the button, so readers can see which
|
|
154
|
+
* range is applied.
|
|
155
|
+
*
|
|
156
|
+
* @example
|
|
157
|
+
* ```tsx
|
|
158
|
+
* const [range, setRange] = React.useState<TimeRange | null>(null);
|
|
159
|
+
*
|
|
160
|
+
* <TimeRangeFilter value={range} onChange={setRange} maxRangeMs={30 * 24 * 60 * 60 * 1000} />
|
|
161
|
+
* ```
|
|
162
|
+
*
|
|
163
|
+
* @example
|
|
164
|
+
* ```tsx
|
|
165
|
+
* // Reopen the picker from a chip: control `open` and `anchorEl`
|
|
166
|
+
* const [anchor, setAnchor] = React.useState<HTMLElement | null>(null);
|
|
167
|
+
* const [open, setOpen] = React.useState(false);
|
|
168
|
+
*
|
|
169
|
+
* <TimeRangeFilter
|
|
170
|
+
* value={range}
|
|
171
|
+
* onChange={setRange}
|
|
172
|
+
* open={open}
|
|
173
|
+
* anchorEl={anchor}
|
|
174
|
+
* onOpen={() => { setAnchor(null); setOpen(true); }}
|
|
175
|
+
* onClose={() => setOpen(false)}
|
|
176
|
+
* />
|
|
177
|
+
* <Chip
|
|
178
|
+
* label="Time: Last 24 hours"
|
|
179
|
+
* onClick={(event) => { setAnchor(event.currentTarget); setOpen(true); }}
|
|
180
|
+
* onDelete={() => setRange(null)}
|
|
181
|
+
* />
|
|
182
|
+
* ```
|
|
183
|
+
*/
|
|
184
|
+
declare const TimeRangeFilter: React.ForwardRefExoticComponent<Omit<TimeRangeFilterProps, "ref"> & React.RefAttributes<HTMLButtonElement>>;
|
|
185
|
+
export default TimeRangeFilter;
|
|
@@ -36,6 +36,8 @@ export { default as StatCard } from './StatCard';
|
|
|
36
36
|
export type { StatCardProps } from './StatCard';
|
|
37
37
|
export { default as ThemeSwitcher, ThemeSelect } from './ThemeSwitcher';
|
|
38
38
|
export type { ThemeSwitcherProps, ThemeSelectProps } from './ThemeSwitcher';
|
|
39
|
+
export { default as TimeRangeFilter } from './TimeRangeFilter';
|
|
40
|
+
export type { TimeRange, TimeRangeFilterProps, TimeRangePreset, } from './TimeRangeFilter';
|
|
39
41
|
export { default as SearchBarWithAdvancedFilter } from './SearchBar/SearchBarWithAdvancedFilter';
|
|
40
42
|
export type { SearchBarWithAdvancedFilterProps, AdvancedFilterState } from './SearchBar/SearchBarWithAdvancedFilter';
|
|
41
43
|
export { default as SearchBar } from './SearchBar/SearchBar';
|
|
@@ -59,4 +61,4 @@ export { AppShell } from './AppShell';
|
|
|
59
61
|
export type { AppShellProps } from './AppShell';
|
|
60
62
|
export { default as ListingTable } from './ListingTable';
|
|
61
63
|
export { useListingTable, useListingTableRequired, ListingTableContext, ListingTableProvider, } from './ListingTable';
|
|
62
|
-
export type { ListingTableProps, ListingTableContainerProps, ListingTableHeadProps, ListingTableBodyProps, ListingTableFooterProps, ListingTableRowProps, ListingTableCellProps, ListingTableDensity, ListingTableVariant, ListingTableToolbarProps, ListingTableEmptyStateProps, ListingTableDensityControlProps, ListingTableSortLabelProps, ListingSortDirection, ListingTableRowActionsProps, ListingTableCellIconProps, ListingTableContextValue, ListingTableSortDirection, ListingTableProviderProps, ListingTableDataGridProps, } from './ListingTable';
|
|
64
|
+
export type { ListingTableProps, ListingTableContainerProps, ListingTableHeadProps, ListingTableBodyProps, ListingTableFooterProps, ListingTableRowProps, ListingTableCellProps, ListingTableDensity, ListingTableVariant, ListingTableToolbarProps, ListingTableEmptyStateProps, ListingTableDensityControlProps, ListingTableSortLabelProps, ListingSortDirection, ListingTableFilterProps, ListingTableFilterOption, ListingTableRowActionsProps, ListingTableCellIconProps, ListingTableContextValue, ListingTableSortDirection, ListingTableProviderProps, ListingTableDataGridProps, } from './ListingTable';
|