@hemerson/design-system 0.7.0 → 0.9.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/BarChart/BarChart.d.ts +34 -0
- package/dist/components/DateInput/DateInput.d.ts +3 -1
- package/dist/components/Input/Input.d.ts +2 -0
- package/dist/components/Select/Select.d.ts +2 -0
- package/dist/components/Typeahead/Typeahead.d.ts +3 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.js +294 -187
- package/dist/index.js.map +1 -1
- package/dist/styles.css +154 -0
- package/package.json +1 -1
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { type ReactNode } from "react";
|
|
2
|
+
export type ChartTone = "accent" | "secondary" | "success" | "warning" | "danger" | "neutral";
|
|
3
|
+
export interface ChartSeries {
|
|
4
|
+
name: string;
|
|
5
|
+
/** Default: accent, then secondary, warning and so on, in order. */
|
|
6
|
+
tone?: ChartTone;
|
|
7
|
+
}
|
|
8
|
+
export interface ChartDatum {
|
|
9
|
+
label: string;
|
|
10
|
+
/** One value per series, in the same order. */
|
|
11
|
+
values: number[];
|
|
12
|
+
}
|
|
13
|
+
export interface BarChartProps {
|
|
14
|
+
/** Names the chart: shown above it and used as the accessible name. */
|
|
15
|
+
title: ReactNode;
|
|
16
|
+
data: ChartDatum[];
|
|
17
|
+
/** One series by default; several stack in each bar, with a legend. */
|
|
18
|
+
series?: ChartSeries[];
|
|
19
|
+
/** `vertical`: bars rise from a baseline, for time. `horizontal`: one row per label, for rankings. Default `vertical`. */
|
|
20
|
+
orientation?: "vertical" | "horizontal";
|
|
21
|
+
/** How values read in labels and in the data table. Default: the number in pt-BR. */
|
|
22
|
+
formatValue?: (value: number) => string;
|
|
23
|
+
/** Shown instead of the bars when there is no data. Default "Nada para mostrar.". */
|
|
24
|
+
empty?: ReactNode;
|
|
25
|
+
/** Height of the bar area in vertical charts, in px. Default 200. */
|
|
26
|
+
height?: number;
|
|
27
|
+
className?: string;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Bars for comparing a few values: a vertical chart over time, or a horizontal ranking.
|
|
31
|
+
* Several series stack in each bar. The bars are drawn for sighted users and hidden from
|
|
32
|
+
* screen readers, which get the same numbers as a table.
|
|
33
|
+
*/
|
|
34
|
+
export declare function BarChart({ title, data, series, orientation, formatValue, empty, height, className, }: BarChartProps): import("react").JSX.Element;
|
|
@@ -19,9 +19,11 @@ export interface DateInputProps extends Omit<InputHTMLAttributes<HTMLInputElemen
|
|
|
19
19
|
calendarLabel?: string;
|
|
20
20
|
previousMonthLabel?: string;
|
|
21
21
|
nextMonthLabel?: string;
|
|
22
|
+
/** Keeps the label for screen readers only, e.g. for a field inside a table cell. */
|
|
23
|
+
hideLabel?: boolean;
|
|
22
24
|
}
|
|
23
25
|
/**
|
|
24
26
|
* A date field: type day/month/year, or pick from a glass calendar. The value is "yyyy-mm-dd",
|
|
25
27
|
* and with `name` a hidden input carries it, so forms read it like a native date input.
|
|
26
28
|
*/
|
|
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;
|
|
29
|
+
export declare function DateInput({ label, value, defaultValue, onChange, min, max, hint, error, locale, weekStartsOn, calendarLabel, previousMonthLabel, nextMonthLabel, hideLabel, name, id, disabled, required, placeholder, className, ...rest }: DateInputProps): import("react").JSX.Element;
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { type InputHTMLAttributes, type ReactNode } from "react";
|
|
2
2
|
export interface InputProps extends InputHTMLAttributes<HTMLInputElement> {
|
|
3
|
+
/** Keeps the label for screen readers only, e.g. for a field inside a table cell. */
|
|
4
|
+
hideLabel?: boolean;
|
|
3
5
|
/** Always visible, written as a noun ("Beneficiário"). */
|
|
4
6
|
label: ReactNode;
|
|
5
7
|
hint?: ReactNode;
|
|
@@ -5,6 +5,8 @@ export interface SelectOption {
|
|
|
5
5
|
disabled?: boolean;
|
|
6
6
|
}
|
|
7
7
|
export interface SelectProps extends SelectHTMLAttributes<HTMLSelectElement> {
|
|
8
|
+
/** Keeps the label for screen readers only, e.g. for a field inside a table cell. */
|
|
9
|
+
hideLabel?: boolean;
|
|
8
10
|
label: ReactNode;
|
|
9
11
|
options: SelectOption[];
|
|
10
12
|
/** Shown as a disabled first option. */
|
|
@@ -13,8 +13,10 @@ export interface TypeaheadProps extends Omit<InputHTMLAttributes<HTMLInputElemen
|
|
|
13
13
|
error?: ReactNode;
|
|
14
14
|
/** Locale for matching without case. Default "pt-BR". */
|
|
15
15
|
locale?: string;
|
|
16
|
+
/** Keeps the label for screen readers only, e.g. for a field inside a table cell. */
|
|
17
|
+
hideLabel?: boolean;
|
|
16
18
|
}
|
|
17
19
|
/** The suggestions that contain the text, those that start with it first. */
|
|
18
20
|
export declare function matchSuggestions(suggestions: string[], text: string, locale?: string, max?: number): string[];
|
|
19
21
|
/** A text field that suggests values as you type, in a glass list. Free text is still allowed. */
|
|
20
|
-
export declare function Typeahead({ label, value, defaultValue, onChange, suggestions, maxSuggestions, hint, error, locale, id, className, disabled, ...rest }: TypeaheadProps): import("react").JSX.Element;
|
|
22
|
+
export declare function Typeahead({ label, value, defaultValue, onChange, suggestions, maxSuggestions, hint, error, locale, hideLabel, id, className, disabled, ...rest }: TypeaheadProps): import("react").JSX.Element;
|
package/dist/index.d.ts
CHANGED
|
@@ -24,6 +24,8 @@ export { Select } from "./components/Select/Select";
|
|
|
24
24
|
export { DateInput } from "./components/DateInput/DateInput";
|
|
25
25
|
export type { DateInputProps } from "./components/DateInput/DateInput";
|
|
26
26
|
export { Typeahead } from "./components/Typeahead/Typeahead";
|
|
27
|
+
export { BarChart } from "./components/BarChart/BarChart";
|
|
28
|
+
export type { BarChartProps, ChartDatum, ChartSeries, ChartTone } from "./components/BarChart/BarChart";
|
|
27
29
|
export type { TypeaheadProps } from "./components/Typeahead/Typeahead";
|
|
28
30
|
export type { SelectOption, SelectProps } from "./components/Select/Select";
|
|
29
31
|
export { Checkbox } from "./components/Checkbox/Checkbox";
|