@openmrs/esm-styleguide 6.3.1-pre.3045 → 6.3.1-pre.3055
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/.turbo/turbo-build.log +2 -2
- package/dist/datepicker/DatePicker.d.ts +7 -0
- package/dist/datepicker/DatePickerIcon.d.ts +6 -0
- package/dist/datepicker/DatePickerInput.d.ts +11 -0
- package/dist/datepicker/DateSegment.d.ts +10 -0
- package/dist/datepicker/MonthYear.d.ts +10 -0
- package/dist/datepicker/OpenmrsDatePicker.d.ts +48 -0
- package/dist/datepicker/hooks.d.ts +820 -0
- package/dist/datepicker/index.d.ts +1 -48
- package/dist/datepicker/locale-context.d.ts +3 -0
- package/dist/datepicker/utils.d.ts +15 -0
- package/dist/openmrs-esm-styleguide.css +1 -1
- package/dist/openmrs-esm-styleguide.css.map +1 -1
- package/dist/openmrs-esm-styleguide.js +1 -1
- package/dist/openmrs-esm-styleguide.js.map +1 -1
- package/package.json +12 -12
- package/src/datepicker/DatePicker.tsx +146 -0
- package/src/datepicker/DatePickerIcon.tsx +17 -0
- package/src/datepicker/DatePickerInput.tsx +71 -0
- package/src/datepicker/DateSegment.tsx +72 -0
- package/src/datepicker/MonthYear.tsx +87 -0
- package/src/datepicker/OpenmrsDatePicker.tsx +233 -0
- package/src/datepicker/datepicker.module.scss +11 -1
- package/src/datepicker/hooks.ts +98 -0
- package/src/datepicker/index.tsx +1 -736
- package/src/datepicker/locale-context.ts +5 -0
- package/src/datepicker/utils.ts +75 -0
package/.turbo/turbo-build.log
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
[0]
|
|
5
5
|
[0] WARNING in ⚠ entrypoint size limit: The following entrypoint(s) combined asset size exceeds the recommended limit (244.141 KiB). This can impact web performance.
|
|
6
6
|
[0] │ Entrypoints:
|
|
7
|
-
[0] │ main (3.
|
|
7
|
+
[0] │ main (3.157 MiB)
|
|
8
8
|
[0] │ openmrs-esm-styleguide.css
|
|
9
9
|
[0] │ openmrs-esm-styleguide.js
|
|
10
10
|
[0]
|
|
@@ -12,6 +12,6 @@
|
|
|
12
12
|
[0] │ You can limit the size of your bundles by using import() to lazy load some parts of your application.
|
|
13
13
|
[0] │ For more info visit https://www.rspack.dev/guide/optimization/code-splitting
|
|
14
14
|
[0]
|
|
15
|
-
[0] Rspack compiled with 3 warnings in 6.
|
|
15
|
+
[0] Rspack compiled with 3 warnings in 6.48 s
|
|
16
16
|
[0] rspack --mode=production exited with code 0
|
|
17
17
|
[1] tsc --project tsconfig.build.json exited with code 0
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { type DatePickerProps, type DateValue } from 'react-aria-components';
|
|
3
|
+
/**
|
|
4
|
+
* This is a lightly-customized version of the DatePicker component from react-aria-components.
|
|
5
|
+
* Primarily, it handles closing the calendar when clicking outside of the DatePicker.
|
|
6
|
+
*/
|
|
7
|
+
export declare const DatePicker: React.ForwardRefExoticComponent<DatePickerProps<DateValue> & React.RefAttributes<HTMLDivElement>>;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* Component to render the Calendar icon for the DatePicker component with the same styling as
|
|
4
|
+
* the Carbon DatePicker component.
|
|
5
|
+
*/
|
|
6
|
+
export declare const DatePickerIcon: React.ForwardRefExoticComponent<React.RefAttributes<SVGSVGElement>>;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { type DateInputProps } from 'react-aria-components';
|
|
3
|
+
interface OpenmrsDateInputProps {
|
|
4
|
+
id?: string;
|
|
5
|
+
}
|
|
6
|
+
/**
|
|
7
|
+
* This is just the standard React Aria Components DatePickerInput with an added `onClick` handler to open
|
|
8
|
+
* the calendar when the group is clicked. This is used to emulate Carbon's behaviour in the DatePicker.
|
|
9
|
+
*/
|
|
10
|
+
export declare const DatePickerInput: React.ForwardRefExoticComponent<DateInputProps & OpenmrsDateInputProps & React.RefAttributes<HTMLDivElement>>;
|
|
11
|
+
export {};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { type DateSegmentProps } from 'react-aria-components';
|
|
3
|
+
/**
|
|
4
|
+
* This component represents a part of the displayed date in the date picker.
|
|
5
|
+
*
|
|
6
|
+
* This is lightly-modified from the react-aria-components DateSegment component. It prevents click events
|
|
7
|
+
* from propagating to the parent `DatePickerInput` so that the calendar doesn't open when editing a date
|
|
8
|
+
* segment.
|
|
9
|
+
*/
|
|
10
|
+
export declare const DateSegment: React.ForwardRefExoticComponent<DateSegmentProps & React.RefAttributes<HTMLDivElement>>;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* Custom component to render the month and year on the DatePicker and provide the standard Carbon
|
|
4
|
+
* UI to change them.
|
|
5
|
+
*
|
|
6
|
+
* Should work with any calendar system supported by the @internationalized/date package.
|
|
7
|
+
*/
|
|
8
|
+
export declare const MonthYear: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLSpanElement> & {
|
|
9
|
+
children?: React.ReactNode;
|
|
10
|
+
} & React.RefAttributes<HTMLSpanElement>>;
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import React, { type ReactElement } from 'react';
|
|
2
|
+
import { type Argument } from 'classnames';
|
|
3
|
+
import { type CalendarDate, type CalendarDateTime, type ZonedDateTime } from '@internationalized/date';
|
|
4
|
+
import { type DateValue } from 'react-aria';
|
|
5
|
+
import { type DatePickerProps } from 'react-aria-components';
|
|
6
|
+
import { type ConfigType as DayjsConfigType } from 'dayjs';
|
|
7
|
+
/** A type for any of the acceptable date formats */
|
|
8
|
+
export type DateInputValue = CalendarDate | CalendarDateTime | ZonedDateTime | DayjsConfigType;
|
|
9
|
+
/**
|
|
10
|
+
* Properties for the OpenmrsDatePicker
|
|
11
|
+
*/
|
|
12
|
+
export interface OpenmrsDatePickerProps extends Omit<DatePickerProps<CalendarDate>, 'className' | 'onChange' | 'defaultValue' | 'value'> {
|
|
13
|
+
/** Any CSS classes to add to the outer div of the date picker */
|
|
14
|
+
className?: Argument;
|
|
15
|
+
/** The default value (uncontrolled) */
|
|
16
|
+
defaultValue?: DateInputValue;
|
|
17
|
+
/** Whether the input value is invalid. */
|
|
18
|
+
invalid?: boolean;
|
|
19
|
+
/** Text to show if the input is invalid e.g. an error message */
|
|
20
|
+
invalidText?: string;
|
|
21
|
+
/**
|
|
22
|
+
* The label for this DatePicker element
|
|
23
|
+
* @deprecated Use labelText instead
|
|
24
|
+
*/
|
|
25
|
+
label?: string | ReactElement;
|
|
26
|
+
/** The label for this DatePicker element. */
|
|
27
|
+
labelText?: string | ReactElement;
|
|
28
|
+
/** 'true' to use the light version. */
|
|
29
|
+
light?: boolean;
|
|
30
|
+
/** The latest date it is possible to select */
|
|
31
|
+
maxDate?: DateInputValue;
|
|
32
|
+
/** The earliest date it is possible to select */
|
|
33
|
+
minDate?: DateInputValue;
|
|
34
|
+
/** Handler that is called when the value changes. */
|
|
35
|
+
onChange?: (value: Date | null | undefined) => void;
|
|
36
|
+
/** Handler that is called when the value changes. Note that this provides types from @internationalized/date. */
|
|
37
|
+
onChangeRaw?: (value: DateValue | null) => void;
|
|
38
|
+
/** Specifies the size of the input. Currently supports either `sm`, `md`, or `lg` as an option */
|
|
39
|
+
size?: 'sm' | 'md' | 'lg';
|
|
40
|
+
/** 'true' to use the short version. */
|
|
41
|
+
short?: boolean;
|
|
42
|
+
/** The value (controlled) */
|
|
43
|
+
value?: DateInputValue;
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* A date picker component to select a single date. Based on React Aria, but styled to look like Carbon.
|
|
47
|
+
*/
|
|
48
|
+
export declare const OpenmrsDatePicker: React.ForwardRefExoticComponent<OpenmrsDatePickerProps & React.RefAttributes<HTMLDivElement>>;
|