@hemerson/design-system 0.4.0 → 0.5.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/dist/components/DateInput/DateInput.d.ts +27 -0
- package/dist/components/DateInput/dates.d.ts +13 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +333 -86
- package/dist/index.js.map +1 -1
- package/dist/internal/Icon.d.ts +3 -0
- package/dist/internal/placement.d.ts +7 -0
- package/dist/styles.css +192 -1
- package/package.json +1 -1
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { type InputHTMLAttributes, type ReactNode } from "react";
|
|
2
|
+
export interface DateInputProps extends Omit<InputHTMLAttributes<HTMLInputElement>, "type" | "value" | "defaultValue" | "onChange" | "min" | "max"> {
|
|
3
|
+
label: ReactNode;
|
|
4
|
+
/** The date as "yyyy-mm-dd", or "" for none: the format of <input type="date">. */
|
|
5
|
+
value?: string;
|
|
6
|
+
defaultValue?: string;
|
|
7
|
+
/** Called with "yyyy-mm-dd" when a whole valid date is typed or picked, and with "" when the field is cleared. */
|
|
8
|
+
onChange?: (value: string) => void;
|
|
9
|
+
/** Earliest and latest dates that can be picked or typed, as "yyyy-mm-dd". */
|
|
10
|
+
min?: string;
|
|
11
|
+
max?: string;
|
|
12
|
+
hint?: ReactNode;
|
|
13
|
+
error?: ReactNode;
|
|
14
|
+
/** Locale of the month and weekday names. Default "pt-BR". */
|
|
15
|
+
locale?: string;
|
|
16
|
+
/** First day of the week, 0 for Sunday. Default 0. */
|
|
17
|
+
weekStartsOn?: number;
|
|
18
|
+
/** Accessible names. Defaults in Brazilian Portuguese. */
|
|
19
|
+
calendarLabel?: string;
|
|
20
|
+
previousMonthLabel?: string;
|
|
21
|
+
nextMonthLabel?: string;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* A date field: type day/month/year, or pick from a glass calendar. The value is "yyyy-mm-dd",
|
|
25
|
+
* and with `name` a hidden input carries it, so forms read it like a native date input.
|
|
26
|
+
*/
|
|
27
|
+
export declare function DateInput({ label, value, defaultValue, onChange, min, max, hint, error, locale, weekStartsOn, calendarLabel, previousMonthLabel, nextMonthLabel, name, id, disabled, required, placeholder, className, ...rest }: DateInputProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/** Calendar dates as "yyyy-mm-dd" strings, the value format of <input type="date">, in local time. */
|
|
2
|
+
export declare function toIso(date: Date): string;
|
|
3
|
+
export declare function fromIso(value: string | undefined): Date | null;
|
|
4
|
+
/** "10/10/2026" from "2026-10-10". */
|
|
5
|
+
export declare function formatTyped(value: string): string;
|
|
6
|
+
/** "2026-10-10" from what was typed as day/month/year ("10/10/2026", "1/2/2026" or "10102026"), or null. */
|
|
7
|
+
export declare function parseTyped(text: string): string | null;
|
|
8
|
+
export declare function addDays(date: Date, days: number): Date;
|
|
9
|
+
/** The same day in another month, or that month's last day when it is shorter. */
|
|
10
|
+
export declare function addMonths(date: Date, months: number): Date;
|
|
11
|
+
/** Six weeks of days covering the month of `date`, each week starting on `weekStartsOn` (0 = Sunday). */
|
|
12
|
+
export declare function monthGrid(date: Date, weekStartsOn: number): Date[][];
|
|
13
|
+
export declare function isWithin(value: string, min?: string, max?: string): boolean;
|
package/dist/index.d.ts
CHANGED
|
@@ -21,6 +21,8 @@ export type { ToastApi, ToastOptions, ToastProviderProps } from "./components/To
|
|
|
21
21
|
export { Input } from "./components/Input/Input";
|
|
22
22
|
export type { InputProps } from "./components/Input/Input";
|
|
23
23
|
export { Select } from "./components/Select/Select";
|
|
24
|
+
export { DateInput } from "./components/DateInput/DateInput";
|
|
25
|
+
export type { DateInputProps } from "./components/DateInput/DateInput";
|
|
24
26
|
export type { SelectOption, SelectProps } from "./components/Select/Select";
|
|
25
27
|
export { Checkbox } from "./components/Checkbox/Checkbox";
|
|
26
28
|
export type { CheckboxProps } from "./components/Checkbox/Checkbox";
|