mgh-components 2.0.2 → 2.1.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 +53 -2
- package/dist/components/MGHDatePicker/MGHDateCalendar.d.ts +8 -0
- package/dist/components/MGHDatePicker/MGHDatePicker.d.ts +11 -0
- package/dist/components/MGHDatePicker/MGHDatePicker.styles.d.ts +9 -0
- package/dist/components/MGHDatePicker/MGHDatePicker.types.d.ts +140 -0
- package/dist/components/MGHDatePicker/index.d.ts +7 -0
- package/dist/components/MGHDatePicker/utils.d.ts +36 -0
- package/dist/components/MGHDateRangePicker/MGHDateRangePicker.styles.d.ts +1 -1
- package/dist/components/MGHDateRangePicker/icons.d.ts +2 -0
- package/dist/components/MGHDateRangePicker/primitives.d.ts +39 -0
- package/dist/components/index.d.ts +1 -0
- package/dist/index.cjs +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.esm.js +1 -1
- package/dist/index.esm.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -2,12 +2,14 @@
|
|
|
2
2
|
|
|
3
3
|
Metrolina Greenhouses (MGH) component library for React applications.
|
|
4
4
|
|
|
5
|
-
This package ships two data grids and
|
|
5
|
+
This package ships two data grids and two date pickers:
|
|
6
6
|
|
|
7
7
|
- **`MGHGrid`** – a self-contained data grid with **no MUI dependency** (and therefore no
|
|
8
8
|
`@mui/x-data-grid-premium` license). This is the grid to use going forward.
|
|
9
9
|
- **`MGHDateRangePicker`** – a MUI-free port of MUI X Pro's `DateRangePicker` (no
|
|
10
10
|
`@mui/x-date-pickers-pro` license).
|
|
11
|
+
- **`MGHDatePicker`** – a MUI-free port of MUI X's `DatePicker` (single date, with the year /
|
|
12
|
+
month views behind the header dropdown).
|
|
11
13
|
|
|
12
14
|
Plus a few helpers built on MUI (`Label`, `ConfirmDialog`, `ExportingDialog`, `Iconify`).
|
|
13
15
|
|
|
@@ -21,7 +23,7 @@ pnpm add mgh-components
|
|
|
21
23
|
|
|
22
24
|
## Peer Dependencies
|
|
23
25
|
|
|
24
|
-
`MGHGrid` and `
|
|
26
|
+
`MGHGrid`, `MGHDateRangePicker` and `MGHDatePicker` only need:
|
|
25
27
|
|
|
26
28
|
- `react`
|
|
27
29
|
- `react-dom`
|
|
@@ -322,6 +324,54 @@ Or globally in your CSS:
|
|
|
322
324
|
|
|
323
325
|
---
|
|
324
326
|
|
|
327
|
+
## MGHDatePicker (MUI-free)
|
|
328
|
+
|
|
329
|
+
A port of MUI X's `DatePicker` (desktop variant) for picking a **single date**, with no MUI
|
|
330
|
+
dependency. Values are `Dayjs | null`, so existing `DatePicker<Dayjs>` state works unchanged. It
|
|
331
|
+
shares the text field, popover and stylesheet with `MGHDateRangePicker`, so the two look identical
|
|
332
|
+
side by side and are themed through the same `--mgh-drp-*` variables.
|
|
333
|
+
|
|
334
|
+
```tsx
|
|
335
|
+
import { useState } from 'react';
|
|
336
|
+
import type { Dayjs } from 'dayjs';
|
|
337
|
+
import { MGHDatePicker, MGH_DATE_PICKER_DEFAULT_SHORTCUTS } from 'mgh-components';
|
|
338
|
+
|
|
339
|
+
export default function Example() {
|
|
340
|
+
const [date, setDate] = useState<Dayjs | null>(null);
|
|
341
|
+
|
|
342
|
+
return (
|
|
343
|
+
<MGHDatePicker
|
|
344
|
+
label="Ship date"
|
|
345
|
+
value={date}
|
|
346
|
+
onChange={(value) => setDate(value)}
|
|
347
|
+
onAccept={(value) => refetch(value)} // fires once a date is picked / accepted
|
|
348
|
+
shortcuts={MGH_DATE_PICKER_DEFAULT_SHORTCUTS} // Today, Yesterday, Tomorrow, Start of Week, Start / End of Month, Reset
|
|
349
|
+
clearable
|
|
350
|
+
/>
|
|
351
|
+
);
|
|
352
|
+
}
|
|
353
|
+
```
|
|
354
|
+
|
|
355
|
+
### Props
|
|
356
|
+
|
|
357
|
+
| Area | Details |
|
|
358
|
+
| --- | --- |
|
|
359
|
+
| Value | `value` / `defaultValue` / `onChange(value, { validationError, shortcut })`, `onAccept(value)`, `onError(error, value)` |
|
|
360
|
+
| Field | `label`, `format` (`'MM/DD/YYYY'`), `size` (`'small'` \| `'medium'`), `fullWidth`, `clearable`, `placeholder`, `helperText`, `error`, `required`, `disabled`, `readOnly`, `name`, `id`, `inputRef` |
|
|
361
|
+
| Opening | Calendar icon button (like MUI), `openOnClick` to also open from the text, `disableOpenPicker`, controlled `open` / `onOpen` / `onClose`, `placement` |
|
|
362
|
+
| Views | `views` (default `['year', 'day']`, add `'month'` for a month grid), `openTo` (default `'day'`), controlled `view` / `onViewChange`, `yearsPerRow`, `monthsPerRow`. The ▾ next to the month name switches between the day and year views, exactly like MUI |
|
|
363
|
+
| Calendar | `referenceDate`, `showDaysOutsideCurrentMonth`, `fixedWeekNumber`, `dayOfWeekFormatter`, `disableHighlightToday`, `onMonthChange`, `onYearChange` |
|
|
364
|
+
| Validation | `minDate`, `maxDate`, `disablePast`, `disableFuture`, `shouldDisableDate(day)`, `shouldDisableMonth(month)`, `shouldDisableYear(year)`; errors: `invalidDate`, `minDate`, `maxDate`, `disablePast`, `disableFuture`, `shouldDisableDate`, `shouldDisableMonth`, `shouldDisableYear` |
|
|
365
|
+
| Selection | `closeOnSelect` (default `true`, `false` when `actions` contains `'accept'`). Picking a year / month moves to the next view (`'partial'`); picking a day finishes and closes |
|
|
366
|
+
| Layout | `shortcuts` (`{ label, getValue }`, same shape as MUI `slotProps.shortcuts.items`), `actions` (`'clear'`, `'today'`, `'cancel'`, `'accept'`), `showToolbar` (+ `toolbarFormat`, default `'ddd, MMM D'`) |
|
|
367
|
+
| Theming | `themeMode="light" \| "dark"` (inherits from a surrounding `MGHGrid` card when omitted), `themeVars` (any `--mgh-drp-*` variable), `className` / `style`, `popoverClassName` / `popoverStyle`, `localeText` |
|
|
368
|
+
| Keyboard | Type a date directly (strict `format` plus `M/D/YYYY`, `YYYY-MM-DD` fallbacks), **↓** opens the calendar, arrows / Home / End / PageUp / PageDown move between days (or years / months in those views), Enter or Space selects, Escape closes |
|
|
369
|
+
|
|
370
|
+
`MGHDateCalendar` (the calendar without the field / popover) is exported for inline use, e.g.
|
|
371
|
+
`<MGHDateCalendar value={date} onChange={(v) => setDate(v)} />`.
|
|
372
|
+
|
|
373
|
+
---
|
|
374
|
+
|
|
325
375
|
## Legacy: MGHDataGrid (MUI X Premium)
|
|
326
376
|
|
|
327
377
|
```tsx
|
|
@@ -339,6 +389,7 @@ import { MGHDataGrid } from 'mgh-components';
|
|
|
339
389
|
## Components
|
|
340
390
|
|
|
341
391
|
- `MGHDateRangePicker` (+ `MGHDateRangeCalendar`, `MGH_DATE_RANGE_DEFAULT_SHORTCUTS`, `MGHDateRangeIcons`, `useMGHDateRangePickerStyles`)
|
|
392
|
+
- `MGHDatePicker` (+ `MGHDateCalendar`, `MGH_DATE_PICKER_DEFAULT_SHORTCUTS`, `MGHDatePickerIcons`, `useMGHDatePickerStyles`)
|
|
342
393
|
- `MGHGrid` (+ `MGHGridDefaultToolbar`, `MGHGridQuickFilter`, `MGHGridExportMenu`, `MGHGridExportMenuItem`,
|
|
343
394
|
`MGHGridActionsCellItem`, `MGHGridNoRowsOverlay`, `MGHGridIcons`, `useMGHGridApiRef`, `useMGHGridApiContext`)
|
|
344
395
|
- `MGHDataGrid`, `MGHGridToolbar`, `DataGridQuickFilter`, `CustomNoRowsOverlay`, `CustomGridToolbarExport` (legacy, MUI)
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { MGHDateCalendarProps } from './MGHDatePicker.types';
|
|
3
|
+
/**
|
|
4
|
+
* Pure-React port of MUI X's `DateCalendar`: a single month with a header whose ▾ button switches
|
|
5
|
+
* to the year (and optionally month) view, keyboard navigation and min/max/disabled validation.
|
|
6
|
+
*/
|
|
7
|
+
export declare function MGHDateCalendar({ value: valueProp, defaultValue, onChange, referenceDate, views: viewsProp, openTo, view: viewProp, onViewChange, minDate, maxDate, disablePast, disableFuture, shouldDisableDate, shouldDisableMonth, shouldDisableYear, disabled, readOnly, showDaysOutsideCurrentMonth, fixedWeekNumber, dayOfWeekFormatter, disableHighlightToday, yearsPerRow, monthsPerRow, autoFocus, onMonthChange, onYearChange, localeText, themeMode, className, style, }: MGHDateCalendarProps): React.JSX.Element;
|
|
8
|
+
export default MGHDateCalendar;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { MGHDatePickerLocaleText, MGHDatePickerProps } from './MGHDatePicker.types';
|
|
3
|
+
export declare const MGH_DATE_PICKER_DEFAULT_LOCALE_TEXT: MGHDatePickerLocaleText;
|
|
4
|
+
/**
|
|
5
|
+
* MUI-free port of MUI X's `DatePicker` (desktop variant): an outlined text field with a calendar
|
|
6
|
+
* button that opens a single-month calendar (with the year view behind the ▾ in the header),
|
|
7
|
+
* optional shortcuts and an action bar. Values are `Dayjs | null`, so existing MUI state works unchanged.
|
|
8
|
+
* Shares its field, popover and stylesheet with `MGHDateRangePicker`.
|
|
9
|
+
*/
|
|
10
|
+
export declare const MGHDatePicker: React.ForwardRefExoticComponent<MGHDatePickerProps & React.RefAttributes<HTMLDivElement>>;
|
|
11
|
+
export default MGHDatePicker;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export declare const MGH_DATE_PICKER_STYLE_ID = "mgh-dp-styles";
|
|
2
|
+
/**
|
|
3
|
+
* Extra rules for MGHDatePicker. The field, popover, buttons, day grid and the `--mgh-drp-*`
|
|
4
|
+
* colour variables come from the MGHDateRangePicker stylesheet, which is injected alongside.
|
|
5
|
+
* Dimensions follow MUI X's `DateCalendar` (320 × 334, 72 × 36 month / year buttons).
|
|
6
|
+
*/
|
|
7
|
+
export declare const MGH_DATE_PICKER_CSS = "\n[class*=\"mgh-dp-\"], [class*=\"mgh-dp-\"]::before, [class*=\"mgh-dp-\"]::after { box-sizing: border-box; }\n.mgh-dp .mgh-drp-field:not(.mgh-drp-field--full-width) { width: 240px; }\n\n/* ---- calendar ---- */\n.mgh-dp-calendar { display: flex; flex-direction: column; width: 320px; min-height: 334px; max-width: 100%; overflow: hidden; }\n.mgh-dp-header { display: flex; align-items: center; min-height: 40px; max-height: 40px; margin: 12px 0 8px; padding: 0 12px 0 24px; }\n.mgh-dp-header-label-wrap { display: flex; align-items: center; overflow: hidden; margin-right: auto; cursor: pointer; border-radius: 4px; }\n.mgh-dp-header-label-wrap--static, .mgh-dp-calendar--disabled .mgh-dp-header-label-wrap { cursor: default; }\n.mgh-dp-header-label { margin-right: 6px; font-size: 1rem; font-weight: 500; line-height: 1.75; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }\n.mgh-dp-header-switch { color: var(--mgh-drp-fg-secondary); }\n.mgh-dp-header-switch .mgh-drp-icon { transition: transform .2s ease; will-change: transform; }\n.mgh-dp-header-switch--open .mgh-drp-icon { transform: rotate(180deg); }\n.mgh-dp-header-nav { display: flex; align-items: center; flex: 0 0 auto; }\n.mgh-dp-header-nav .mgh-drp-btn--icon { color: var(--mgh-drp-fg-secondary); }\n.mgh-dp-header-nav-spacer { width: 24px; flex: 0 0 auto; }\n\n.mgh-dp-view { display: flex; flex-direction: column; flex: 1 1 auto; min-height: 0; }\n.mgh-dp-view--day { padding-bottom: 8px; }\n\n/* ---- month / year grids ---- */\n.mgh-dp-months, .mgh-dp-years { position: relative; display: flex; flex-direction: row; flex-wrap: wrap; align-content: flex-start; width: 100%; padding: 0 4px; }\n.mgh-dp-years { overflow-y: auto; max-height: 280px; }\n.mgh-dp-cell { display: flex; align-items: center; justify-content: center; flex-basis: 33.3333%; }\n.mgh-dp-cell--per-row-4 { flex-basis: 25%; }\n.mgh-dp-pill { position: relative; display: inline-flex; align-items: center; justify-content: center; width: 72px; height: 36px; margin: 8px 0; border: 0; border-radius: 18px; background: transparent; color: var(--mgh-drp-fg); font: inherit; font-size: 1rem; font-weight: 400; line-height: 1.75; letter-spacing: .00938em; cursor: pointer; transition: background-color .15s, color .15s; }\n.mgh-dp-years .mgh-dp-pill { margin: 6px 0; }\n.mgh-dp-pill:hover { background: var(--mgh-drp-hover); }\n.mgh-dp-pill:focus-visible { outline: 2px solid var(--mgh-drp-focus); outline-offset: -1px; }\n.mgh-dp-pill--current:not(.mgh-dp-pill--selected) { border: 1px solid var(--mgh-drp-fg-secondary); }\n.mgh-dp-pill--disabled, .mgh-dp-pill--disabled:hover { color: var(--mgh-drp-fg-disabled); background: transparent; cursor: default; }\n.mgh-dp-pill--selected, .mgh-dp-pill--selected:hover { background: var(--mgh-drp-primary); color: var(--mgh-drp-primary-contrast); font-weight: 500; }\n.mgh-dp-pill--selected:focus-visible { outline-offset: 2px; }\n.mgh-dp-calendar--disabled .mgh-dp-pill, .mgh-dp-calendar--read-only .mgh-dp-pill { cursor: default; }\n.mgh-dp-calendar--disabled .mgh-dp-pill { color: var(--mgh-drp-fg-disabled); }\n.mgh-dp-calendar--disabled .mgh-dp-pill--selected { opacity: .6; }\n.mgh-dp-calendar--disabled .mgh-drp-day { color: var(--mgh-drp-fg-disabled); cursor: default; }\n.mgh-dp-calendar--disabled .mgh-drp-day--selected { opacity: .6; }\n.mgh-dp-calendar--read-only .mgh-drp-day { cursor: default; }\n\n/* ---- toolbar (MUI DatePickerToolbar) ---- */\n.mgh-dp-toolbar-date { display: flex; align-items: center; min-height: 40px; font-size: 2.125rem; font-weight: 400; line-height: 1.235; letter-spacing: .00735em; }\n\n@media (max-width: 599.95px) {\n .mgh-dp-calendar { width: 100%; max-width: 320px; }\n}\n";
|
|
8
|
+
/** Injects the MGHDateRangePicker + MGHDatePicker stylesheets once per document. Safe on the server (no-op). */
|
|
9
|
+
export declare const useMGHDatePickerStyles: () => void;
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
import type React from 'react';
|
|
2
|
+
import type { Dayjs } from 'dayjs';
|
|
3
|
+
/** A single date – the same shape as MUI's `PickerValue` for a `DatePicker<Dayjs>`. */
|
|
4
|
+
export type MGHDateValue = Dayjs | null;
|
|
5
|
+
export type MGHDateThemeMode = 'light' | 'dark';
|
|
6
|
+
export type MGHDateView = 'day' | 'month' | 'year';
|
|
7
|
+
/** `'partial'` while more views are pending (e.g. a year was picked, the day is next), `'finish'` on the last one. */
|
|
8
|
+
export type MGHDateSelectionState = 'partial' | 'finish';
|
|
9
|
+
export type MGHDateValidationError = 'invalidDate' | 'minDate' | 'maxDate' | 'disablePast' | 'disableFuture' | 'shouldDisableDate' | 'shouldDisableMonth' | 'shouldDisableYear' | null;
|
|
10
|
+
export type MGHDateAction = 'clear' | 'today' | 'cancel' | 'accept';
|
|
11
|
+
export interface MGHDateShortcut {
|
|
12
|
+
label: string;
|
|
13
|
+
/** Return the date to apply (or `null` to clear). `isValid` reports whether a date passes the picker's validation. */
|
|
14
|
+
getValue: (context: {
|
|
15
|
+
isValid: (value: MGHDateValue) => boolean;
|
|
16
|
+
}) => MGHDateValue;
|
|
17
|
+
id?: string;
|
|
18
|
+
}
|
|
19
|
+
export interface MGHDateChangeContext {
|
|
20
|
+
validationError: MGHDateValidationError;
|
|
21
|
+
/** Set when the change came from a shortcut. */
|
|
22
|
+
shortcut?: MGHDateShortcut;
|
|
23
|
+
}
|
|
24
|
+
export interface MGHDatePickerLocaleText {
|
|
25
|
+
/** Placeholder shown in the empty field, e.g. `MM/DD/YYYY`. Defaults to the `format`. */
|
|
26
|
+
datePlaceholder?: string;
|
|
27
|
+
/** Label of the calendar button. Receives the formatted value (MUI: `openDatePickerDialogue`). */
|
|
28
|
+
openPicker: (formattedDate: string | null) => string;
|
|
29
|
+
clear: string;
|
|
30
|
+
today: string;
|
|
31
|
+
cancel: string;
|
|
32
|
+
accept: string;
|
|
33
|
+
previousMonth: string;
|
|
34
|
+
nextMonth: string;
|
|
35
|
+
/** Label of the ▾ button in the calendar header that switches between the day and year views. */
|
|
36
|
+
calendarViewSwitchingButtonAriaLabel: (currentView: MGHDateView) => string;
|
|
37
|
+
/** Title shown in the toolbar, e.g. "Select date". */
|
|
38
|
+
toolbarTitle: string;
|
|
39
|
+
/** Shown in the toolbar while no date is selected. @default '––' */
|
|
40
|
+
toolbarPlaceholder: string;
|
|
41
|
+
}
|
|
42
|
+
export interface MGHDateCalendarProps {
|
|
43
|
+
value?: MGHDateValue;
|
|
44
|
+
defaultValue?: MGHDateValue;
|
|
45
|
+
/**
|
|
46
|
+
* Fires on every selection. `selectionState` is `'finish'` when the last view was completed
|
|
47
|
+
* (the picker closes on it), `'partial'` after a year / month was picked and the next view opens.
|
|
48
|
+
*/
|
|
49
|
+
onChange?: (value: MGHDateValue, selectionState: MGHDateSelectionState, view: MGHDateView) => void;
|
|
50
|
+
/** Date used to position the calendar (and as the base for year / month picks) when nothing is selected. @default today */
|
|
51
|
+
referenceDate?: Dayjs;
|
|
52
|
+
/** Available views, in the order they are stepped through. @default ['year', 'day'] */
|
|
53
|
+
views?: MGHDateView[];
|
|
54
|
+
/** View opened first. @default 'day' */
|
|
55
|
+
openTo?: MGHDateView;
|
|
56
|
+
/** Controlled view. */
|
|
57
|
+
view?: MGHDateView;
|
|
58
|
+
onViewChange?: (view: MGHDateView) => void;
|
|
59
|
+
minDate?: Dayjs | null;
|
|
60
|
+
maxDate?: Dayjs | null;
|
|
61
|
+
disablePast?: boolean;
|
|
62
|
+
disableFuture?: boolean;
|
|
63
|
+
shouldDisableDate?: (day: Dayjs) => boolean;
|
|
64
|
+
shouldDisableMonth?: (month: Dayjs) => boolean;
|
|
65
|
+
shouldDisableYear?: (year: Dayjs) => boolean;
|
|
66
|
+
disabled?: boolean;
|
|
67
|
+
readOnly?: boolean;
|
|
68
|
+
/** Render the days of the previous / next month in the empty cells. @default false */
|
|
69
|
+
showDaysOutsideCurrentMonth?: boolean;
|
|
70
|
+
/** Always render this many week rows (MUI: `fixedWeekNumber`). */
|
|
71
|
+
fixedWeekNumber?: number;
|
|
72
|
+
/** Weekday header formatter. @default first letter of the weekday */
|
|
73
|
+
dayOfWeekFormatter?: (day: Dayjs) => string;
|
|
74
|
+
/** Do not outline today's date. @default false */
|
|
75
|
+
disableHighlightToday?: boolean;
|
|
76
|
+
/** Years per row in the year view. @default 3 */
|
|
77
|
+
yearsPerRow?: 3 | 4;
|
|
78
|
+
/** Months per row in the month view. @default 3 */
|
|
79
|
+
monthsPerRow?: 3 | 4;
|
|
80
|
+
/** Focus the selected (or current) day when the calendar mounts. */
|
|
81
|
+
autoFocus?: boolean;
|
|
82
|
+
/** Called when the visible month changes. */
|
|
83
|
+
onMonthChange?: (month: Dayjs) => void;
|
|
84
|
+
/** Called when a year is picked in the year view. */
|
|
85
|
+
onYearChange?: (year: Dayjs) => void;
|
|
86
|
+
localeText?: Partial<Pick<MGHDatePickerLocaleText, 'previousMonth' | 'nextMonth' | 'calendarViewSwitchingButtonAriaLabel'>>;
|
|
87
|
+
themeMode?: MGHDateThemeMode;
|
|
88
|
+
className?: string;
|
|
89
|
+
style?: React.CSSProperties;
|
|
90
|
+
}
|
|
91
|
+
export interface MGHDatePickerProps extends Omit<MGHDateCalendarProps, 'onChange' | 'autoFocus' | 'className' | 'style' | 'localeText'> {
|
|
92
|
+
onChange?: (value: MGHDateValue, context: MGHDateChangeContext) => void;
|
|
93
|
+
/** Fires when a date is committed (picking a day, the Accept action, a shortcut, Enter / blur in the field). */
|
|
94
|
+
onAccept?: (value: MGHDateValue) => void;
|
|
95
|
+
/** Fires when the validation error changes. */
|
|
96
|
+
onError?: (error: MGHDateValidationError, value: MGHDateValue) => void;
|
|
97
|
+
open?: boolean;
|
|
98
|
+
onOpen?: () => void;
|
|
99
|
+
onClose?: () => void;
|
|
100
|
+
label?: React.ReactNode;
|
|
101
|
+
/** dayjs display / parse format. @default 'MM/DD/YYYY' */
|
|
102
|
+
format?: string;
|
|
103
|
+
size?: 'small' | 'medium';
|
|
104
|
+
fullWidth?: boolean;
|
|
105
|
+
/** Show a clear (×) button when a value is set. @default false */
|
|
106
|
+
clearable?: boolean;
|
|
107
|
+
/** Open the calendar when the text field itself is clicked (MUI only opens from the icon button). @default false */
|
|
108
|
+
openOnClick?: boolean;
|
|
109
|
+
/** Hide the calendar icon button. @default false */
|
|
110
|
+
disableOpenPicker?: boolean;
|
|
111
|
+
/** Close the popover as soon as a day is picked. @default true (false when `actions` includes 'accept') */
|
|
112
|
+
closeOnSelect?: boolean;
|
|
113
|
+
/** Quick dates listed on the left of the calendar (MUI `slotProps.shortcuts.items`). */
|
|
114
|
+
shortcuts?: MGHDateShortcut[];
|
|
115
|
+
/** Buttons in the action bar under the calendar (MUI `slotProps.actionBar.actions`). @default [] */
|
|
116
|
+
actions?: MGHDateAction[];
|
|
117
|
+
/** Show the "Select date / Wed, Sep 16" toolbar above the calendar. @default false */
|
|
118
|
+
showToolbar?: boolean;
|
|
119
|
+
/** dayjs format of the date shown in the toolbar. @default 'ddd, MMM D' */
|
|
120
|
+
toolbarFormat?: string;
|
|
121
|
+
localeText?: Partial<MGHDatePickerLocaleText>;
|
|
122
|
+
name?: string;
|
|
123
|
+
id?: string;
|
|
124
|
+
placeholder?: string;
|
|
125
|
+
required?: boolean;
|
|
126
|
+
/** Force the error state. Validation errors from the value are shown automatically. */
|
|
127
|
+
error?: boolean;
|
|
128
|
+
helperText?: React.ReactNode;
|
|
129
|
+
autoFocus?: boolean;
|
|
130
|
+
inputRef?: React.Ref<HTMLInputElement>;
|
|
131
|
+
themeMode?: MGHDateThemeMode;
|
|
132
|
+
/** Override any `--mgh-drp-*` CSS variable for this instance (the stylesheet is shared with MGHDateRangePicker). */
|
|
133
|
+
themeVars?: Record<string, string>;
|
|
134
|
+
className?: string;
|
|
135
|
+
style?: React.CSSProperties;
|
|
136
|
+
popoverClassName?: string;
|
|
137
|
+
popoverStyle?: React.CSSProperties;
|
|
138
|
+
/** Placement of the popover relative to the field. @default 'bottom-start' */
|
|
139
|
+
placement?: 'bottom-start' | 'bottom-end' | 'bottom';
|
|
140
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export { default } from './MGHDatePicker';
|
|
2
|
+
export { MGHDatePicker, MGH_DATE_PICKER_DEFAULT_LOCALE_TEXT } from './MGHDatePicker';
|
|
3
|
+
export { MGHDateCalendar } from './MGHDateCalendar';
|
|
4
|
+
export * from './MGHDatePicker.types';
|
|
5
|
+
export { MGH_DATE_PICKER_CSS, MGH_DATE_PICKER_STYLE_ID, useMGHDatePickerStyles } from './MGHDatePicker.styles';
|
|
6
|
+
export { MGH_DATE_PICKER_DEFAULT_SHORTCUTS, validateDate as mghDateValidate, isDateEqual as mghDateIsEqual, findClosestEnabledDate as mghDateFindClosestEnabled, } from './utils';
|
|
7
|
+
export * as MGHDatePickerIcons from '../MGHDateRangePicker/icons';
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import dayjs, { Dayjs } from 'dayjs';
|
|
2
|
+
import type { MGHDateShortcut, MGHDateValidationError, MGHDateValue } from './MGHDatePicker.types';
|
|
3
|
+
/** MUI's default calendar bounds; used for the year grid when no `minDate` / `maxDate` is given. */
|
|
4
|
+
export declare const MGH_DATE_PICKER_DEFAULT_MIN_DATE: dayjs.Dayjs;
|
|
5
|
+
export declare const MGH_DATE_PICKER_DEFAULT_MAX_DATE: dayjs.Dayjs;
|
|
6
|
+
export declare const normalizeDate: (value: unknown) => MGHDateValue;
|
|
7
|
+
export declare const isDateEqual: (a: MGHDateValue | undefined, b: MGHDateValue | undefined) => boolean;
|
|
8
|
+
/** `date`'s calendar day with `time`'s time of day (MUI `mergeDateAndTime`). */
|
|
9
|
+
export declare const mergeDateAndTime: (date: Dayjs, time: Dayjs | null | undefined) => dayjs.Dayjs;
|
|
10
|
+
/** `date` moved to `year`, clamping the day (Feb 29 → Feb 28) instead of overflowing into the next month. */
|
|
11
|
+
export declare const setYear: (date: Dayjs, year: number) => dayjs.Dayjs;
|
|
12
|
+
/** `date` moved to `month` (0–11), clamping the day (Jan 31 → Feb 28) instead of overflowing. */
|
|
13
|
+
export declare const setMonth: (date: Dayjs, month: number) => dayjs.Dayjs;
|
|
14
|
+
export interface DateValidationOptions {
|
|
15
|
+
minDate?: Dayjs | null;
|
|
16
|
+
maxDate?: Dayjs | null;
|
|
17
|
+
disablePast?: boolean;
|
|
18
|
+
disableFuture?: boolean;
|
|
19
|
+
shouldDisableDate?: (day: Dayjs) => boolean;
|
|
20
|
+
shouldDisableMonth?: (month: Dayjs) => boolean;
|
|
21
|
+
shouldDisableYear?: (year: Dayjs) => boolean;
|
|
22
|
+
}
|
|
23
|
+
export declare const validateDate: (value: MGHDateValue, options: DateValidationOptions, now?: Dayjs) => MGHDateValidationError;
|
|
24
|
+
export declare const isDateDisabled: (day: Dayjs, options: DateValidationOptions, now?: Dayjs) => boolean;
|
|
25
|
+
/** A month is disabled when every day in it is out of bounds (MUI `MonthCalendar` semantics). */
|
|
26
|
+
export declare const isMonthDisabled: (month: Dayjs, options: DateValidationOptions, now?: Dayjs) => boolean;
|
|
27
|
+
/** A year is disabled when every day in it is out of bounds (MUI `YearCalendar` semantics). */
|
|
28
|
+
export declare const isYearDisabled: (year: Dayjs, options: DateValidationOptions, now?: Dayjs) => boolean;
|
|
29
|
+
/**
|
|
30
|
+
* Nearest enabled day to `date`, searching forwards and backwards at the same time within
|
|
31
|
+
* `minDate` / `maxDate` (MUI `findClosestEnabledDate`). Returns `null` when nothing is enabled.
|
|
32
|
+
*/
|
|
33
|
+
export declare const findClosestEnabledDate: (date: Dayjs, options: DateValidationOptions, now?: Dayjs) => Dayjs | null;
|
|
34
|
+
/** Years listed in the year view. */
|
|
35
|
+
export declare const getYearRange: (minDate?: Dayjs | null, maxDate?: Dayjs | null) => number[];
|
|
36
|
+
export declare const MGH_DATE_PICKER_DEFAULT_SHORTCUTS: MGHDateShortcut[];
|
|
@@ -4,6 +4,6 @@ export declare const MGH_DATE_RANGE_PICKER_STYLE_ID = "mgh-drp-styles";
|
|
|
4
4
|
* Colours are CSS variables (`--mgh-drp-*`). When the picker is rendered inside an MGHGrid card
|
|
5
5
|
* it inherits the grid palette (`--mgh-grid-*`) automatically.
|
|
6
6
|
*/
|
|
7
|
-
export declare const MGH_DATE_RANGE_PICKER_CSS = "\n.mgh-drp, .mgh-drp-popover, .mgh-drp-calendars {\n --mgh-drp-font-family: var(--mgh-grid-font-family, inherit);\n --mgh-drp-font-size: var(--mgh-grid-font-size, 14px);\n --mgh-drp-paper: var(--mgh-grid-paper, #ffffff);\n --mgh-drp-fg: var(--mgh-grid-fg, rgba(0, 0, 0, 0.87));\n --mgh-drp-fg-secondary: var(--mgh-grid-fg-secondary, rgba(0, 0, 0, 0.6));\n --mgh-drp-fg-disabled: var(--mgh-grid-fg-disabled, rgba(0, 0, 0, 0.38));\n --mgh-drp-border: var(--mgh-grid-border, rgba(224, 224, 224, 1));\n --mgh-drp-input-border: var(--mgh-grid-input-border, rgba(0, 0, 0, 0.23));\n --mgh-drp-hover: var(--mgh-grid-hover, rgba(0, 0, 0, 0.04));\n --mgh-drp-primary: var(--mgh-grid-primary, #1976d2);\n --mgh-drp-primary-contrast: var(--mgh-grid-primary-contrast, #ffffff);\n --mgh-drp-focus: var(--mgh-grid-focus, #1976d2);\n --mgh-drp-selected: var(--mgh-grid-selected, rgba(25, 118, 210, 0.12));\n --mgh-drp-preview: rgba(0, 0, 0, 0.06);\n --mgh-drp-error: #d32f2f;\n --mgh-drp-radius: 4px;\n --mgh-drp-popover-radius: 8px;\n --mgh-drp-popover-shadow: var(--mgh-grid-popover-shadow, 0 5px 5px -3px rgba(0,0,0,.2), 0 8px 10px 1px rgba(0,0,0,.14), 0 3px 14px 2px rgba(0,0,0,.12));\n --mgh-drp-day-size: 36px;\n --mgh-drp-day-margin: 2px;\n font-family: var(--mgh-drp-font-family);\n font-size: var(--mgh-drp-font-size);\n color: var(--mgh-drp-fg);\n line-height: 1.5;\n}\n/* Dark values also apply to a calendar nested inside a dark picker / popover, so the calendar's own\n defaults (declared above for standalone use) never reset the colours back to light. */\n.mgh-drp[data-mgh-theme=\"dark\"], .mgh-drp-popover[data-mgh-theme=\"dark\"], .mgh-drp-calendars[data-mgh-theme=\"dark\"],\n.mgh-drp[data-mgh-theme=\"dark\"] .mgh-drp-calendars, .mgh-drp-popover[data-mgh-theme=\"dark\"] .mgh-drp-calendars {\n --mgh-drp-paper: #212b36;\n --mgh-drp-fg: #ffffff;\n --mgh-drp-fg-secondary: rgba(255, 255, 255, 0.7);\n --mgh-drp-fg-disabled: rgba(255, 255, 255, 0.5);\n --mgh-drp-border: rgba(81, 81, 81, 1);\n --mgh-drp-input-border: rgba(255, 255, 255, 0.23);\n --mgh-drp-hover: rgba(255, 255, 255, 0.08);\n --mgh-drp-primary: #90caf9;\n --mgh-drp-primary-contrast: rgba(0, 0, 0, 0.87);\n --mgh-drp-focus: #90caf9;\n --mgh-drp-selected: rgba(144, 202, 249, 0.16);\n --mgh-drp-preview: rgba(255, 255, 255, 0.08);\n --mgh-drp-error: #f44336;\n}\n[class*=\"mgh-drp\"], [class*=\"mgh-drp\"]::before, [class*=\"mgh-drp\"]::after { box-sizing: border-box; }\n\n/* ---- root / multi-input layout ---- */\n.mgh-drp { display: inline-flex; flex-direction: column; vertical-align: top; min-width: 0; }\n.mgh-drp--full-width { display: flex; width: 100%; }\n.mgh-drp-fields { display: flex; align-items: flex-start; gap: 8px; min-width: 0; }\n.mgh-drp-fields .mgh-drp-field { flex: 1 1 0; min-width: 0; }\n.mgh-drp-fields-separator { align-self: center; color: var(--mgh-drp-fg-secondary); padding: 0 2px; }\n\n/* ---- outlined text field (MUI TextField look-alike) ---- */\n.mgh-drp-field { position: relative; display: inline-flex; align-items: center; min-width: 0; width: 100%; border-radius: var(--mgh-drp-radius); color: var(--mgh-drp-fg); }\n.mgh-drp-field--medium { height: 56px; }\n.mgh-drp-field--small { height: 40px; }\n.mgh-drp-field:not(.mgh-drp-field--full-width) { width: 260px; }\n.mgh-drp-field--multi:not(.mgh-drp-field--full-width) { width: 170px; }\n.mgh-drp-field--full-width { width: 100%; }\n.mgh-drp-input { flex: 1 1 auto; min-width: 0; width: 100%; height: 100%; margin: 0; border: 0; outline: none; background: transparent; color: inherit; font: inherit; font-size: 1rem; letter-spacing: inherit; padding: 16.5px 14px; }\n.mgh-drp-field--small .mgh-drp-input { padding: 8.5px 14px; }\n.mgh-drp-field--adorned .mgh-drp-input { padding-right: 0; }\n.mgh-drp-input::placeholder { color: var(--mgh-drp-fg-disabled); opacity: 1; }\n.mgh-drp-input::-webkit-calendar-picker-indicator { display: none; }\n.mgh-drp-field--disabled .mgh-drp-input { color: var(--mgh-drp-fg-disabled); -webkit-text-fill-color: var(--mgh-drp-fg-disabled); }\n.mgh-drp-field--disabled { cursor: default; }\n.mgh-drp-field--clickable .mgh-drp-input { cursor: pointer; }\n.mgh-drp-adornment { display: flex; align-items: center; gap: 0; margin-right: 6px; flex: 0 0 auto; color: var(--mgh-drp-fg-secondary); }\n.mgh-drp-field--small .mgh-drp-adornment { margin-right: 4px; }\n\n/* notched outline */\n.mgh-drp-outline { position: absolute; inset: -5px 0 0 0; margin: 0; padding: 0 8px; pointer-events: none; border: 1px solid var(--mgh-drp-input-border); border-radius: inherit; min-width: 0; overflow: hidden; text-align: left; transition: border-color .15s; }\n.mgh-drp-outline legend { float: unset; width: auto; padding: 0; height: 11px; font-size: 0.75em; visibility: hidden; max-width: 0.01px; white-space: nowrap; transition: max-width 50ms cubic-bezier(0.0, 0, 0.2, 1) 0ms; overflow: hidden; display: block; line-height: 11px; }\n.mgh-drp-outline legend > span { padding-left: 5px; padding-right: 5px; display: inline-block; opacity: 0; visibility: visible; }\n.mgh-drp-field--shrink .mgh-drp-outline legend { max-width: 100%; transition: max-width 100ms cubic-bezier(0.0, 0, 0.2, 1) 50ms; }\n.mgh-drp-field--no-label .mgh-drp-outline legend { display: none; }\n/* Without a label there is no legend notch, so the fieldset must sit on the field box instead of 5px above it;\n otherwise the visible border is 5px taller than with a label and the field looks off-centre. */\n.mgh-drp-field--no-label .mgh-drp-outline { inset: 0; }\n.mgh-drp-field:hover:not(.mgh-drp-field--disabled) .mgh-drp-outline { border-color: var(--mgh-drp-fg); }\n.mgh-drp-field--focused .mgh-drp-outline, .mgh-drp-field--focused:hover .mgh-drp-outline { border-color: var(--mgh-drp-focus); border-width: 2px; }\n.mgh-drp-field--error .mgh-drp-outline, .mgh-drp-field--error:hover .mgh-drp-outline { border-color: var(--mgh-drp-error); }\n.mgh-drp-field--disabled .mgh-drp-outline { border-color: var(--mgh-drp-fg-disabled); }\n\n/* floating label */\n.mgh-drp-label { position: absolute; left: 0; top: 0; transform-origin: top left; transform: translate(14px, 16px) scale(1); color: var(--mgh-drp-fg-secondary); font-size: 1rem; line-height: 1.4375em; pointer-events: none; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: calc(100% - 24px); transition: color .15s, transform .15s cubic-bezier(0.0, 0, 0.2, 1), max-width .15s; z-index: 1; }\n.mgh-drp-field--small .mgh-drp-label { transform: translate(14px, 9px) scale(1); }\n.mgh-drp-field--shrink .mgh-drp-label, .mgh-drp-field--small.mgh-drp-field--shrink .mgh-drp-label { transform: translate(14px, -9px) scale(0.75); max-width: calc(133% - 32px); }\n.mgh-drp-field--focused .mgh-drp-label { color: var(--mgh-drp-focus); }\n.mgh-drp-field--error .mgh-drp-label { color: var(--mgh-drp-error); }\n.mgh-drp-field--disabled .mgh-drp-label { color: var(--mgh-drp-fg-disabled); }\n.mgh-drp-label-asterisk { margin-left: 2px; }\n\n.mgh-drp-helper { margin: 3px 14px 0; font-size: 0.75rem; line-height: 1.66; color: var(--mgh-drp-fg-secondary); }\n.mgh-drp-helper--error { color: var(--mgh-drp-error); }\n\n/* ---- buttons ---- */\n.mgh-drp-btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; border: 0; margin: 0; background: transparent; color: var(--mgh-drp-fg-secondary); font: inherit; font-size: 0.8125rem; font-weight: 500; line-height: 1.75; letter-spacing: .02em; padding: 4px 8px; border-radius: 4px; cursor: pointer; user-select: none; transition: background-color .15s, color .15s; white-space: nowrap; text-transform: uppercase; }\n.mgh-drp-btn:hover { background: var(--mgh-drp-hover); color: var(--mgh-drp-fg); }\n.mgh-drp-btn:focus-visible { outline: 2px solid var(--mgh-drp-focus); outline-offset: 1px; }\n.mgh-drp-btn:disabled { color: var(--mgh-drp-fg-disabled); cursor: default; background: transparent; }\n.mgh-drp-btn--primary { color: var(--mgh-drp-primary); }\n.mgh-drp-btn--primary:hover { background: var(--mgh-drp-selected); color: var(--mgh-drp-primary); }\n.mgh-drp-btn--icon { padding: 8px; border-radius: 50%; width: 40px; height: 40px; text-transform: none; }\n.mgh-drp-btn--icon.mgh-drp-btn--small { width: 32px; height: 32px; padding: 4px; }\n.mgh-drp-icon { flex: 0 0 auto; }\n\n/* ---- popover ---- */\n.mgh-drp-popover { position: fixed; z-index: 1300; display: flex; flex-direction: column; background: var(--mgh-drp-paper); color: var(--mgh-drp-fg); border-radius: var(--mgh-drp-popover-radius); box-shadow: var(--mgh-drp-popover-shadow); outline: none; max-height: calc(100vh - 16px); max-width: calc(100vw - 16px); overflow: auto; animation: mgh-drp-pop .12s ease-out; }\n@keyframes mgh-drp-pop { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }\n.mgh-drp-layout { display: flex; flex-direction: row; align-items: stretch; }\n.mgh-drp-layout--with-toolbar { flex-direction: column; }\n.mgh-drp-layout-main { display: flex; flex-direction: row; align-items: stretch; }\n.mgh-drp-toolbar { padding: 16px 24px 0; }\n.mgh-drp-toolbar-title { font-size: 0.75rem; text-transform: uppercase; letter-spacing: .08em; color: var(--mgh-drp-fg-secondary); margin: 0 0 8px; }\n.mgh-drp-toolbar-range { display: flex; align-items: center; gap: 8px; font-size: 1.5rem; font-weight: 400; line-height: 1.334; }\n.mgh-drp-toolbar-range button { border: 0; background: transparent; padding: 0 2px; font: inherit; color: var(--mgh-drp-fg-secondary); cursor: pointer; border-radius: 4px; }\n.mgh-drp-toolbar-range button.mgh-drp-toolbar-range--active { color: var(--mgh-drp-fg); }\n.mgh-drp-toolbar-range button:hover { background: var(--mgh-drp-hover); }\n\n/* shortcuts (left column) */\n.mgh-drp-shortcuts { list-style: none; margin: 0; padding: 8px 0; min-width: 140px; max-height: 340px; overflow: auto; border-right: 1px solid var(--mgh-drp-border); display: flex; flex-direction: column; gap: 4px; padding-left: 8px; padding-right: 8px; }\n.mgh-drp-shortcut { display: inline-flex; align-items: center; height: 32px; padding: 0 12px; border-radius: 16px; border: 1px solid var(--mgh-drp-input-border); background: transparent; color: var(--mgh-drp-fg); font: inherit; font-size: 0.8125rem; cursor: pointer; white-space: nowrap; justify-content: flex-start; transition: background-color .15s; }\n.mgh-drp-shortcut:hover { background: var(--mgh-drp-hover); }\n.mgh-drp-shortcut:focus-visible { outline: 2px solid var(--mgh-drp-focus); outline-offset: 1px; }\n.mgh-drp-shortcut:disabled { color: var(--mgh-drp-fg-disabled); cursor: default; }\n.mgh-drp-shortcut--selected { background: var(--mgh-drp-selected); border-color: var(--mgh-drp-primary); color: var(--mgh-drp-primary); }\n\n/* ---- calendars ---- */\n.mgh-drp-calendars { display: flex; flex-direction: row; align-items: flex-start; }\n.mgh-drp-calendar { display: flex; flex-direction: column; width: calc(7 * (var(--mgh-drp-day-size) + 2 * var(--mgh-drp-day-margin)) + 24px); padding: 0 12px 8px; }\n.mgh-drp-calendar + .mgh-drp-calendar { border-left: 1px solid var(--mgh-drp-border); }\n.mgh-drp-calendar-header { display: flex; align-items: center; justify-content: space-between; min-height: 40px; margin: 12px 0 8px; padding: 0 4px; }\n.mgh-drp-calendar-label { flex: 1 1 auto; text-align: center; font-size: 1rem; font-weight: 500; }\n.mgh-drp-calendar-header .mgh-drp-btn--icon { color: var(--mgh-drp-fg-secondary); }\n.mgh-drp-calendar-nav-spacer { width: 40px; height: 40px; flex: 0 0 auto; }\n.mgh-drp-weekdays, .mgh-drp-week { display: flex; justify-content: center; }\n.mgh-drp-weekday { width: var(--mgh-drp-day-size); height: 40px; margin: 0 var(--mgh-drp-day-margin); display: flex; align-items: center; justify-content: center; font-size: 0.75rem; color: var(--mgh-drp-fg-secondary); font-weight: 400; }\n.mgh-drp-weeks { display: flex; flex-direction: column; min-height: calc(6 * (var(--mgh-drp-day-size) + 2 * var(--mgh-drp-day-margin))); }\n.mgh-drp-week { margin: var(--mgh-drp-day-margin) 0; }\n\n/* day cell: the outer wrapper carries the range highlight, the inner button the day itself */\n.mgh-drp-day-wrap { position: relative; width: calc(var(--mgh-drp-day-size) + 2 * var(--mgh-drp-day-margin)); height: var(--mgh-drp-day-size); display: flex; align-items: center; justify-content: center; }\n.mgh-drp-day-wrap--in-range { background: var(--mgh-drp-selected); }\n.mgh-drp-day-wrap--range-start { border-top-left-radius: 50%; border-bottom-left-radius: 50%; }\n.mgh-drp-day-wrap--range-end { border-top-right-radius: 50%; border-bottom-right-radius: 50%; }\n.mgh-drp-day-wrap--preview { border-top: 1px dashed var(--mgh-drp-fg-secondary); border-bottom: 1px dashed var(--mgh-drp-fg-secondary); }\n.mgh-drp-day-wrap--preview-start { border-left: 1px dashed var(--mgh-drp-fg-secondary); border-top-left-radius: 50%; border-bottom-left-radius: 50%; }\n.mgh-drp-day-wrap--preview-end { border-right: 1px dashed var(--mgh-drp-fg-secondary); border-top-right-radius: 50%; border-bottom-right-radius: 50%; }\n.mgh-drp-day-wrap--first-visible.mgh-drp-day-wrap--in-range:not(.mgh-drp-day-wrap--range-start) { border-top-left-radius: 50%; border-bottom-left-radius: 50%; }\n.mgh-drp-day-wrap--last-visible.mgh-drp-day-wrap--in-range:not(.mgh-drp-day-wrap--range-end) { border-top-right-radius: 50%; border-bottom-right-radius: 50%; }\n.mgh-drp-day-wrap--first-visible.mgh-drp-day-wrap--preview:not(.mgh-drp-day-wrap--preview-start) { border-top-left-radius: 50%; border-bottom-left-radius: 50%; border-left: 1px dashed var(--mgh-drp-fg-secondary); }\n.mgh-drp-day-wrap--last-visible.mgh-drp-day-wrap--preview:not(.mgh-drp-day-wrap--preview-end) { border-top-right-radius: 50%; border-bottom-right-radius: 50%; border-right: 1px dashed var(--mgh-drp-fg-secondary); }\n.mgh-drp-day { width: var(--mgh-drp-day-size); height: var(--mgh-drp-day-size); border-radius: 50%; border: 0; margin: 0; padding: 0; background: transparent; color: var(--mgh-drp-fg); font: inherit; font-size: 0.75rem; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; transition: background-color .15s, color .15s; position: relative; }\n.mgh-drp-day:hover { background: var(--mgh-drp-hover); }\n.mgh-drp-day:focus-visible { outline: 2px solid var(--mgh-drp-focus); outline-offset: -1px; }\n.mgh-drp-day--today:not(.mgh-drp-day--selected) { border: 1px solid var(--mgh-drp-fg-secondary); }\n.mgh-drp-day--outside { color: var(--mgh-drp-fg-secondary); opacity: .6; }\n.mgh-drp-day--hidden { visibility: hidden; pointer-events: none; }\n.mgh-drp-day--disabled, .mgh-drp-day--disabled:hover { color: var(--mgh-drp-fg-disabled); cursor: default; background: transparent; }\n.mgh-drp-day--selected, .mgh-drp-day--selected:hover { background: var(--mgh-drp-primary); color: var(--mgh-drp-primary-contrast); font-weight: 500; }\n.mgh-drp-day--selected:focus-visible { outline-offset: 2px; }\n.mgh-drp-calendar--read-only .mgh-drp-day, .mgh-drp-calendar--disabled .mgh-drp-day { cursor: default; }\n.mgh-drp-calendar--disabled .mgh-drp-day { color: var(--mgh-drp-fg-disabled); }\n.mgh-drp-calendar--disabled .mgh-drp-day--selected { opacity: .6; }\n\n/* ---- action bar ---- */\n.mgh-drp-actions { display: flex; align-items: center; justify-content: flex-end; gap: 8px; padding: 8px; border-top: 1px solid var(--mgh-drp-border); }\n.mgh-drp-actions--spread { justify-content: space-between; }\n.mgh-drp-actions-group { display: flex; gap: 8px; }\n\n@media (max-width: 599.95px) {\n .mgh-drp-layout-main { flex-direction: column; }\n .mgh-drp-shortcuts { flex-direction: row; flex-wrap: wrap; border-right: 0; border-bottom: 1px solid var(--mgh-drp-border); max-height: none; }\n .mgh-drp-calendars { flex-direction: column; align-items: center; }\n .mgh-drp-calendar + .mgh-drp-calendar { border-left: 0; border-top: 1px solid var(--mgh-drp-border); }\n}\n";
|
|
7
|
+
export declare const MGH_DATE_RANGE_PICKER_CSS = "\n.mgh-drp, .mgh-drp-popover, .mgh-drp-calendars, .mgh-dp-calendar {\n --mgh-drp-font-family: var(--mgh-grid-font-family, inherit);\n --mgh-drp-font-size: var(--mgh-grid-font-size, 14px);\n --mgh-drp-paper: var(--mgh-grid-paper, #ffffff);\n --mgh-drp-fg: var(--mgh-grid-fg, rgba(0, 0, 0, 0.87));\n --mgh-drp-fg-secondary: var(--mgh-grid-fg-secondary, rgba(0, 0, 0, 0.6));\n --mgh-drp-fg-disabled: var(--mgh-grid-fg-disabled, rgba(0, 0, 0, 0.38));\n --mgh-drp-border: var(--mgh-grid-border, rgba(224, 224, 224, 1));\n --mgh-drp-input-border: var(--mgh-grid-input-border, rgba(0, 0, 0, 0.23));\n --mgh-drp-hover: var(--mgh-grid-hover, rgba(0, 0, 0, 0.04));\n --mgh-drp-primary: var(--mgh-grid-primary, #1976d2);\n --mgh-drp-primary-contrast: var(--mgh-grid-primary-contrast, #ffffff);\n --mgh-drp-focus: var(--mgh-grid-focus, #1976d2);\n --mgh-drp-selected: var(--mgh-grid-selected, rgba(25, 118, 210, 0.12));\n --mgh-drp-preview: rgba(0, 0, 0, 0.06);\n --mgh-drp-error: #d32f2f;\n --mgh-drp-radius: 4px;\n --mgh-drp-popover-radius: 8px;\n --mgh-drp-popover-shadow: var(--mgh-grid-popover-shadow, 0 5px 5px -3px rgba(0,0,0,.2), 0 8px 10px 1px rgba(0,0,0,.14), 0 3px 14px 2px rgba(0,0,0,.12));\n --mgh-drp-day-size: 36px;\n --mgh-drp-day-margin: 2px;\n font-family: var(--mgh-drp-font-family);\n font-size: var(--mgh-drp-font-size);\n color: var(--mgh-drp-fg);\n line-height: 1.5;\n}\n/* Dark values also apply to a calendar nested inside a dark picker / popover, so the calendar's own\n defaults (declared above for standalone use) never reset the colours back to light.\n .mgh-dp-calendar is MGHDatePicker's calendar, which shares this stylesheet. */\n.mgh-drp[data-mgh-theme=\"dark\"], .mgh-drp-popover[data-mgh-theme=\"dark\"], .mgh-drp-calendars[data-mgh-theme=\"dark\"], .mgh-dp-calendar[data-mgh-theme=\"dark\"],\n.mgh-drp[data-mgh-theme=\"dark\"] .mgh-drp-calendars, .mgh-drp-popover[data-mgh-theme=\"dark\"] .mgh-drp-calendars,\n.mgh-drp[data-mgh-theme=\"dark\"] .mgh-dp-calendar, .mgh-drp-popover[data-mgh-theme=\"dark\"] .mgh-dp-calendar {\n --mgh-drp-paper: #212b36;\n --mgh-drp-fg: #ffffff;\n --mgh-drp-fg-secondary: rgba(255, 255, 255, 0.7);\n --mgh-drp-fg-disabled: rgba(255, 255, 255, 0.5);\n --mgh-drp-border: rgba(81, 81, 81, 1);\n --mgh-drp-input-border: rgba(255, 255, 255, 0.23);\n --mgh-drp-hover: rgba(255, 255, 255, 0.08);\n --mgh-drp-primary: #90caf9;\n --mgh-drp-primary-contrast: rgba(0, 0, 0, 0.87);\n --mgh-drp-focus: #90caf9;\n --mgh-drp-selected: rgba(144, 202, 249, 0.16);\n --mgh-drp-preview: rgba(255, 255, 255, 0.08);\n --mgh-drp-error: #f44336;\n}\n[class*=\"mgh-drp\"], [class*=\"mgh-drp\"]::before, [class*=\"mgh-drp\"]::after { box-sizing: border-box; }\n\n/* ---- root / multi-input layout ---- */\n.mgh-drp { display: inline-flex; flex-direction: column; vertical-align: top; min-width: 0; }\n.mgh-drp--full-width { display: flex; width: 100%; }\n.mgh-drp-fields { display: flex; align-items: flex-start; gap: 8px; min-width: 0; }\n.mgh-drp-fields .mgh-drp-field { flex: 1 1 0; min-width: 0; }\n.mgh-drp-fields-separator { align-self: center; color: var(--mgh-drp-fg-secondary); padding: 0 2px; }\n\n/* ---- outlined text field (MUI TextField look-alike) ---- */\n.mgh-drp-field { position: relative; display: inline-flex; align-items: center; min-width: 0; width: 100%; border-radius: var(--mgh-drp-radius); color: var(--mgh-drp-fg); }\n.mgh-drp-field--medium { height: 56px; }\n.mgh-drp-field--small { height: 40px; }\n.mgh-drp-field:not(.mgh-drp-field--full-width) { width: 260px; }\n.mgh-drp-field--multi:not(.mgh-drp-field--full-width) { width: 170px; }\n.mgh-drp-field--full-width { width: 100%; }\n.mgh-drp-input { flex: 1 1 auto; min-width: 0; width: 100%; height: 100%; margin: 0; border: 0; outline: none; background: transparent; color: inherit; font: inherit; font-size: 1rem; letter-spacing: inherit; padding: 16.5px 14px; }\n.mgh-drp-field--small .mgh-drp-input { padding: 8.5px 14px; }\n.mgh-drp-field--adorned .mgh-drp-input { padding-right: 0; }\n.mgh-drp-input::placeholder { color: var(--mgh-drp-fg-disabled); opacity: 1; }\n.mgh-drp-input::-webkit-calendar-picker-indicator { display: none; }\n.mgh-drp-field--disabled .mgh-drp-input { color: var(--mgh-drp-fg-disabled); -webkit-text-fill-color: var(--mgh-drp-fg-disabled); }\n.mgh-drp-field--disabled { cursor: default; }\n.mgh-drp-field--clickable .mgh-drp-input { cursor: pointer; }\n.mgh-drp-adornment { display: flex; align-items: center; gap: 0; margin-right: 6px; flex: 0 0 auto; color: var(--mgh-drp-fg-secondary); }\n.mgh-drp-field--small .mgh-drp-adornment { margin-right: 4px; }\n\n/* notched outline */\n.mgh-drp-outline { position: absolute; inset: -5px 0 0 0; margin: 0; padding: 0 8px; pointer-events: none; border: 1px solid var(--mgh-drp-input-border); border-radius: inherit; min-width: 0; overflow: hidden; text-align: left; transition: border-color .15s; }\n.mgh-drp-outline legend { float: unset; width: auto; padding: 0; height: 11px; font-size: 0.75em; visibility: hidden; max-width: 0.01px; white-space: nowrap; transition: max-width 50ms cubic-bezier(0.0, 0, 0.2, 1) 0ms; overflow: hidden; display: block; line-height: 11px; }\n.mgh-drp-outline legend > span { padding-left: 5px; padding-right: 5px; display: inline-block; opacity: 0; visibility: visible; }\n.mgh-drp-field--shrink .mgh-drp-outline legend { max-width: 100%; transition: max-width 100ms cubic-bezier(0.0, 0, 0.2, 1) 50ms; }\n.mgh-drp-field--no-label .mgh-drp-outline legend { display: none; }\n/* Without a label there is no legend notch, so the fieldset must sit on the field box instead of 5px above it;\n otherwise the visible border is 5px taller than with a label and the field looks off-centre. */\n.mgh-drp-field--no-label .mgh-drp-outline { inset: 0; }\n.mgh-drp-field:hover:not(.mgh-drp-field--disabled) .mgh-drp-outline { border-color: var(--mgh-drp-fg); }\n.mgh-drp-field--focused .mgh-drp-outline, .mgh-drp-field--focused:hover .mgh-drp-outline { border-color: var(--mgh-drp-focus); border-width: 2px; }\n.mgh-drp-field--error .mgh-drp-outline, .mgh-drp-field--error:hover .mgh-drp-outline { border-color: var(--mgh-drp-error); }\n.mgh-drp-field--disabled .mgh-drp-outline { border-color: var(--mgh-drp-fg-disabled); }\n\n/* floating label */\n.mgh-drp-label { position: absolute; left: 0; top: 0; transform-origin: top left; transform: translate(14px, 16px) scale(1); color: var(--mgh-drp-fg-secondary); font-size: 1rem; line-height: 1.4375em; pointer-events: none; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: calc(100% - 24px); transition: color .15s, transform .15s cubic-bezier(0.0, 0, 0.2, 1), max-width .15s; z-index: 1; }\n.mgh-drp-field--small .mgh-drp-label { transform: translate(14px, 9px) scale(1); }\n.mgh-drp-field--shrink .mgh-drp-label, .mgh-drp-field--small.mgh-drp-field--shrink .mgh-drp-label { transform: translate(14px, -9px) scale(0.75); max-width: calc(133% - 32px); }\n.mgh-drp-field--focused .mgh-drp-label { color: var(--mgh-drp-focus); }\n.mgh-drp-field--error .mgh-drp-label { color: var(--mgh-drp-error); }\n.mgh-drp-field--disabled .mgh-drp-label { color: var(--mgh-drp-fg-disabled); }\n.mgh-drp-label-asterisk { margin-left: 2px; }\n\n.mgh-drp-helper { margin: 3px 14px 0; font-size: 0.75rem; line-height: 1.66; color: var(--mgh-drp-fg-secondary); }\n.mgh-drp-helper--error { color: var(--mgh-drp-error); }\n\n/* ---- buttons ---- */\n.mgh-drp-btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; border: 0; margin: 0; background: transparent; color: var(--mgh-drp-fg-secondary); font: inherit; font-size: 0.8125rem; font-weight: 500; line-height: 1.75; letter-spacing: .02em; padding: 4px 8px; border-radius: 4px; cursor: pointer; user-select: none; transition: background-color .15s, color .15s; white-space: nowrap; text-transform: uppercase; }\n.mgh-drp-btn:hover { background: var(--mgh-drp-hover); color: var(--mgh-drp-fg); }\n.mgh-drp-btn:focus-visible { outline: 2px solid var(--mgh-drp-focus); outline-offset: 1px; }\n.mgh-drp-btn:disabled { color: var(--mgh-drp-fg-disabled); cursor: default; background: transparent; }\n.mgh-drp-btn--primary { color: var(--mgh-drp-primary); }\n.mgh-drp-btn--primary:hover { background: var(--mgh-drp-selected); color: var(--mgh-drp-primary); }\n.mgh-drp-btn--icon { padding: 8px; border-radius: 50%; width: 40px; height: 40px; text-transform: none; }\n.mgh-drp-btn--icon.mgh-drp-btn--small { width: 32px; height: 32px; padding: 4px; }\n.mgh-drp-icon { flex: 0 0 auto; }\n\n/* ---- popover ---- */\n.mgh-drp-popover { position: fixed; z-index: 1300; display: flex; flex-direction: column; background: var(--mgh-drp-paper); color: var(--mgh-drp-fg); border-radius: var(--mgh-drp-popover-radius); box-shadow: var(--mgh-drp-popover-shadow); outline: none; max-height: calc(100vh - 16px); max-width: calc(100vw - 16px); overflow: auto; animation: mgh-drp-pop .12s ease-out; }\n@keyframes mgh-drp-pop { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }\n.mgh-drp-layout { display: flex; flex-direction: row; align-items: stretch; }\n.mgh-drp-layout--with-toolbar { flex-direction: column; }\n.mgh-drp-layout-main { display: flex; flex-direction: row; align-items: stretch; }\n.mgh-drp-toolbar { padding: 16px 24px 0; }\n.mgh-drp-toolbar-title { font-size: 0.75rem; text-transform: uppercase; letter-spacing: .08em; color: var(--mgh-drp-fg-secondary); margin: 0 0 8px; }\n.mgh-drp-toolbar-range { display: flex; align-items: center; gap: 8px; font-size: 1.5rem; font-weight: 400; line-height: 1.334; }\n.mgh-drp-toolbar-range button { border: 0; background: transparent; padding: 0 2px; font: inherit; color: var(--mgh-drp-fg-secondary); cursor: pointer; border-radius: 4px; }\n.mgh-drp-toolbar-range button.mgh-drp-toolbar-range--active { color: var(--mgh-drp-fg); }\n.mgh-drp-toolbar-range button:hover { background: var(--mgh-drp-hover); }\n\n/* shortcuts (left column) */\n.mgh-drp-shortcuts { list-style: none; margin: 0; padding: 8px 0; min-width: 140px; max-height: 340px; overflow: auto; border-right: 1px solid var(--mgh-drp-border); display: flex; flex-direction: column; gap: 4px; padding-left: 8px; padding-right: 8px; }\n.mgh-drp-shortcut { display: inline-flex; align-items: center; height: 32px; padding: 0 12px; border-radius: 16px; border: 1px solid var(--mgh-drp-input-border); background: transparent; color: var(--mgh-drp-fg); font: inherit; font-size: 0.8125rem; cursor: pointer; white-space: nowrap; justify-content: flex-start; transition: background-color .15s; }\n.mgh-drp-shortcut:hover { background: var(--mgh-drp-hover); }\n.mgh-drp-shortcut:focus-visible { outline: 2px solid var(--mgh-drp-focus); outline-offset: 1px; }\n.mgh-drp-shortcut:disabled { color: var(--mgh-drp-fg-disabled); cursor: default; }\n.mgh-drp-shortcut--selected { background: var(--mgh-drp-selected); border-color: var(--mgh-drp-primary); color: var(--mgh-drp-primary); }\n\n/* ---- calendars ---- */\n.mgh-drp-calendars { display: flex; flex-direction: row; align-items: flex-start; }\n.mgh-drp-calendar { display: flex; flex-direction: column; width: calc(7 * (var(--mgh-drp-day-size) + 2 * var(--mgh-drp-day-margin)) + 24px); padding: 0 12px 8px; }\n.mgh-drp-calendar + .mgh-drp-calendar { border-left: 1px solid var(--mgh-drp-border); }\n.mgh-drp-calendar-header { display: flex; align-items: center; justify-content: space-between; min-height: 40px; margin: 12px 0 8px; padding: 0 4px; }\n.mgh-drp-calendar-label { flex: 1 1 auto; text-align: center; font-size: 1rem; font-weight: 500; }\n.mgh-drp-calendar-header .mgh-drp-btn--icon { color: var(--mgh-drp-fg-secondary); }\n.mgh-drp-calendar-nav-spacer { width: 40px; height: 40px; flex: 0 0 auto; }\n.mgh-drp-weekdays, .mgh-drp-week { display: flex; justify-content: center; }\n.mgh-drp-weekday { width: var(--mgh-drp-day-size); height: 40px; margin: 0 var(--mgh-drp-day-margin); display: flex; align-items: center; justify-content: center; font-size: 0.75rem; color: var(--mgh-drp-fg-secondary); font-weight: 400; }\n.mgh-drp-weeks { display: flex; flex-direction: column; min-height: calc(6 * (var(--mgh-drp-day-size) + 2 * var(--mgh-drp-day-margin))); }\n.mgh-drp-week { margin: var(--mgh-drp-day-margin) 0; }\n\n/* day cell: the outer wrapper carries the range highlight, the inner button the day itself */\n.mgh-drp-day-wrap { position: relative; width: calc(var(--mgh-drp-day-size) + 2 * var(--mgh-drp-day-margin)); height: var(--mgh-drp-day-size); display: flex; align-items: center; justify-content: center; }\n.mgh-drp-day-wrap--in-range { background: var(--mgh-drp-selected); }\n.mgh-drp-day-wrap--range-start { border-top-left-radius: 50%; border-bottom-left-radius: 50%; }\n.mgh-drp-day-wrap--range-end { border-top-right-radius: 50%; border-bottom-right-radius: 50%; }\n.mgh-drp-day-wrap--preview { border-top: 1px dashed var(--mgh-drp-fg-secondary); border-bottom: 1px dashed var(--mgh-drp-fg-secondary); }\n.mgh-drp-day-wrap--preview-start { border-left: 1px dashed var(--mgh-drp-fg-secondary); border-top-left-radius: 50%; border-bottom-left-radius: 50%; }\n.mgh-drp-day-wrap--preview-end { border-right: 1px dashed var(--mgh-drp-fg-secondary); border-top-right-radius: 50%; border-bottom-right-radius: 50%; }\n.mgh-drp-day-wrap--first-visible.mgh-drp-day-wrap--in-range:not(.mgh-drp-day-wrap--range-start) { border-top-left-radius: 50%; border-bottom-left-radius: 50%; }\n.mgh-drp-day-wrap--last-visible.mgh-drp-day-wrap--in-range:not(.mgh-drp-day-wrap--range-end) { border-top-right-radius: 50%; border-bottom-right-radius: 50%; }\n.mgh-drp-day-wrap--first-visible.mgh-drp-day-wrap--preview:not(.mgh-drp-day-wrap--preview-start) { border-top-left-radius: 50%; border-bottom-left-radius: 50%; border-left: 1px dashed var(--mgh-drp-fg-secondary); }\n.mgh-drp-day-wrap--last-visible.mgh-drp-day-wrap--preview:not(.mgh-drp-day-wrap--preview-end) { border-top-right-radius: 50%; border-bottom-right-radius: 50%; border-right: 1px dashed var(--mgh-drp-fg-secondary); }\n.mgh-drp-day { width: var(--mgh-drp-day-size); height: var(--mgh-drp-day-size); border-radius: 50%; border: 0; margin: 0; padding: 0; background: transparent; color: var(--mgh-drp-fg); font: inherit; font-size: 0.75rem; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; transition: background-color .15s, color .15s; position: relative; }\n.mgh-drp-day:hover { background: var(--mgh-drp-hover); }\n.mgh-drp-day:focus-visible { outline: 2px solid var(--mgh-drp-focus); outline-offset: -1px; }\n.mgh-drp-day--today:not(.mgh-drp-day--selected) { border: 1px solid var(--mgh-drp-fg-secondary); }\n.mgh-drp-day--outside { color: var(--mgh-drp-fg-secondary); opacity: .6; }\n.mgh-drp-day--hidden { visibility: hidden; pointer-events: none; }\n.mgh-drp-day--disabled, .mgh-drp-day--disabled:hover { color: var(--mgh-drp-fg-disabled); cursor: default; background: transparent; }\n.mgh-drp-day--selected, .mgh-drp-day--selected:hover { background: var(--mgh-drp-primary); color: var(--mgh-drp-primary-contrast); font-weight: 500; }\n.mgh-drp-day--selected:focus-visible { outline-offset: 2px; }\n.mgh-drp-calendar--read-only .mgh-drp-day, .mgh-drp-calendar--disabled .mgh-drp-day { cursor: default; }\n.mgh-drp-calendar--disabled .mgh-drp-day { color: var(--mgh-drp-fg-disabled); }\n.mgh-drp-calendar--disabled .mgh-drp-day--selected { opacity: .6; }\n\n/* ---- action bar ---- */\n.mgh-drp-actions { display: flex; align-items: center; justify-content: flex-end; gap: 8px; padding: 8px; border-top: 1px solid var(--mgh-drp-border); }\n.mgh-drp-actions--spread { justify-content: space-between; }\n.mgh-drp-actions-group { display: flex; gap: 8px; }\n\n@media (max-width: 599.95px) {\n .mgh-drp-layout-main { flex-direction: column; }\n .mgh-drp-shortcuts { flex-direction: row; flex-wrap: wrap; border-right: 0; border-bottom: 1px solid var(--mgh-drp-border); max-height: none; }\n .mgh-drp-calendars { flex-direction: column; align-items: center; }\n .mgh-drp-calendar + .mgh-drp-calendar { border-left: 0; border-top: 1px solid var(--mgh-drp-border); }\n}\n";
|
|
8
8
|
/** Injects the MGHDateRangePicker stylesheet once per document. Safe on the server (no-op). */
|
|
9
9
|
export declare const useMGHDateRangePickerStyles: () => void;
|
|
@@ -6,3 +6,5 @@ export declare const DateRangeIcon: React.ForwardRefExoticComponent<Omit<MGHDate
|
|
|
6
6
|
export declare const ChevronLeftIcon: React.ForwardRefExoticComponent<Omit<MGHDateRangeIconProps, "ref"> & React.RefAttributes<SVGSVGElement>>;
|
|
7
7
|
export declare const ChevronRightIcon: React.ForwardRefExoticComponent<Omit<MGHDateRangeIconProps, "ref"> & React.RefAttributes<SVGSVGElement>>;
|
|
8
8
|
export declare const CloseIcon: React.ForwardRefExoticComponent<Omit<MGHDateRangeIconProps, "ref"> & React.RefAttributes<SVGSVGElement>>;
|
|
9
|
+
export declare const CalendarIcon: React.ForwardRefExoticComponent<Omit<MGHDateRangeIconProps, "ref"> & React.RefAttributes<SVGSVGElement>>;
|
|
10
|
+
export declare const ArrowDropDownIcon: React.ForwardRefExoticComponent<Omit<MGHDateRangeIconProps, "ref"> & React.RefAttributes<SVGSVGElement>>;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
export interface PopoverProps {
|
|
3
|
+
open: boolean;
|
|
4
|
+
anchorEl: HTMLElement | null;
|
|
5
|
+
placement: 'bottom-start' | 'bottom-end' | 'bottom';
|
|
6
|
+
onDismiss: (reason: 'backdrop' | 'escape') => void;
|
|
7
|
+
themeMode?: 'light' | 'dark';
|
|
8
|
+
className?: string;
|
|
9
|
+
style?: React.CSSProperties;
|
|
10
|
+
labelledBy?: string;
|
|
11
|
+
children: React.ReactNode;
|
|
12
|
+
}
|
|
13
|
+
export declare function Popover({ open, anchorEl, placement, onDismiss, themeMode, className, style, labelledBy, children, }: PopoverProps): React.ReactPortal | null;
|
|
14
|
+
export interface TextFieldProps {
|
|
15
|
+
id: string;
|
|
16
|
+
label?: React.ReactNode;
|
|
17
|
+
value: string;
|
|
18
|
+
placeholder?: string;
|
|
19
|
+
size: 'small' | 'medium';
|
|
20
|
+
fullWidth?: boolean;
|
|
21
|
+
multi?: boolean;
|
|
22
|
+
disabled?: boolean;
|
|
23
|
+
readOnly?: boolean;
|
|
24
|
+
required?: boolean;
|
|
25
|
+
error?: boolean;
|
|
26
|
+
focused?: boolean;
|
|
27
|
+
clickable?: boolean;
|
|
28
|
+
name?: string;
|
|
29
|
+
autoFocus?: boolean;
|
|
30
|
+
inputRef?: React.Ref<HTMLInputElement>;
|
|
31
|
+
adornment?: React.ReactNode;
|
|
32
|
+
ariaLabel?: string;
|
|
33
|
+
onChange: (text: string) => void;
|
|
34
|
+
onFocus: () => void;
|
|
35
|
+
onBlur: () => void;
|
|
36
|
+
onClick?: () => void;
|
|
37
|
+
onKeyDown?: (event: React.KeyboardEvent<HTMLInputElement>) => void;
|
|
38
|
+
}
|
|
39
|
+
export declare const TextField: React.ForwardRefExoticComponent<TextFieldProps & React.RefAttributes<HTMLDivElement>>;
|