@worldresources/wri-design-systems 2.186.2 → 2.187.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/index.d.ts CHANGED
@@ -1,8 +1,8 @@
1
1
  import * as _chakra_ui_react from '@chakra-ui/react';
2
2
  import { ButtonProps as ButtonProps$1, Checkbox as Checkbox$1, RadioCardRootProps, RadioGroup as RadioGroup$1, Slider as Slider$1, Switch as Switch$1, SelectRootProps, SliderRootProps, TextareaProps as TextareaProps$1, InputProps, Tag as Tag$1, Accordion, Table as Table$1, Tabs } from '@chakra-ui/react';
3
- import * as React$1 from 'react';
4
- import React__default, { ReactElement, Ref } from 'react';
5
3
  import * as react_jsx_runtime from 'react/jsx-runtime';
4
+ import * as React$1 from 'react';
5
+ import React__default, { ReactNode, ReactElement, Ref } from 'react';
6
6
  import * as _emotion_react_jsx_runtime from '@emotion/react/jsx-runtime';
7
7
  import { Placement } from '@floating-ui/react';
8
8
 
@@ -10,8 +10,138 @@ declare const designSystemStylesForTailwind: Record<string, string>;
10
10
  declare const designSystemStyles: _chakra_ui_react.SystemContext;
11
11
  declare const getThemedColor: (variant: "neutral" | "primary" | "secondary" | "success" | "warning" | "error" | "accessible", index: 100 | 200 | 300 | 400 | 500 | 600 | 700 | 800 | 900 | "text-on-primary-mids" | "text-on-secondary-mids" | "controls-on-neutral-lights" | "controls-on-neutral-darks") => string;
12
12
 
13
+ /**
14
+ * Use for label keys that are rendered as visible JSX text (children of elements).
15
+ * Consumers can pass strings, elements, or fragments.
16
+ *
17
+ * Keys used directly as `aria-label` / `aria-roledescription` or inside
18
+ * template literals fed to ARIA attributes must stay typed as `string` — the
19
+ * HTML spec requires those values to be plain strings.
20
+ */
21
+ type ReactNodeLabel = ReactNode;
22
+ /**
23
+ * Labels for CheckboxList internal UI strings.
24
+ * Override any key to provide translations.
25
+ */
26
+ type CheckboxListLabels = {
27
+ /**
28
+ * Text on the toggle button when the list is collapsed.
29
+ * Rendered as JSX child — accepts ReactNode.
30
+ * Default: "Expand"
31
+ */
32
+ expandLabel: ReactNodeLabel;
33
+ /**
34
+ * Text on the toggle button when the list is expanded.
35
+ * Rendered as JSX child — accepts ReactNode.
36
+ * Default: "Hide"
37
+ */
38
+ hideLabel: ReactNodeLabel;
39
+ /** Appended to the group aria-label when the field is required. Must be string (aria-label). Default: "Required." */
40
+ requiredLabel: string;
41
+ /** Appended to the group aria-label when the field is optional. Must be string (aria-label). Default: "Optional" */
42
+ optionalLabel: string;
43
+ /** Prefix prepended to error messages in the group aria-label. Must be string (aria-label). Default: "Error:" */
44
+ errorPrefix: string;
45
+ /** Accessible label for the required (*) symbol. Must be string (aria-label). Default: "required" */
46
+ requiredSymbolLabel: string;
47
+ };
48
+ /**
49
+ * Labels for Password internal UI strings.
50
+ * Override any key to provide translations.
51
+ */
52
+ type PasswordLabels = {
53
+ /** Button label when password is hidden. Must be string (passed to Button.label: string). Default: "Show" */
54
+ showLabel: string;
55
+ /** Button label when password is visible. Must be string (passed to Button.label: string). Default: "Hide" */
56
+ hideLabel: string;
57
+ /** Aria-label for the reveal button when password is hidden. Must be string (aria-label). Default: "Show password" */
58
+ showPasswordLabel: string;
59
+ /** Aria-label for the reveal button when password is visible. Must be string (aria-label). Default: "Hide password" */
60
+ hidePasswordLabel: string;
61
+ /**
62
+ * Text prefix before the strength value.
63
+ * Rendered as JSX child — accepts ReactNode.
64
+ * Default: "Password Strength:"
65
+ */
66
+ strengthPrefix: ReactNodeLabel;
67
+ /**
68
+ * Displayed label for each strength level — rendered as JSX children.
69
+ * All five accept ReactNode.
70
+ */
71
+ strengthVeryWeak: ReactNodeLabel;
72
+ strengthWeak: ReactNodeLabel;
73
+ strengthMedium: ReactNodeLabel;
74
+ strengthStrong: ReactNodeLabel;
75
+ strengthVeryStrong: ReactNodeLabel;
76
+ /** Appended to a rule's aria-label when satisfied. Must be string (aria-label template). Default: "Requirement met." */
77
+ requirementMet: string;
78
+ /** Appended to a rule's aria-label when not satisfied. Must be string (aria-label template). Default: "Requirement not met." */
79
+ requirementNotMet: string;
80
+ /**
81
+ * Dual-use: rendered as `<p>` text AND inside an aria-label template.
82
+ * Must be string to satisfy the aria-label constraint.
83
+ * Default: (min) => `Use a minimum of ${min} characters`
84
+ */
85
+ minLengthRule: (min: number) => string;
86
+ /** Dual-use (p + aria-label). Must be string. Default: "Use an uppercase letter" */
87
+ uppercaseRule: string;
88
+ /** Dual-use (p + aria-label). Must be string. Default: "Use a lowercase letter" */
89
+ lowercaseRule: string;
90
+ /** Dual-use (p + aria-label). Must be string. Default: "Use a number" */
91
+ numberRule: string;
92
+ /** Dual-use (p + aria-label). Must be string. Default: "Use a special character" */
93
+ specialCharRule: string;
94
+ };
95
+ /**
96
+ * Labels for TextInput internal UI strings.
97
+ * Override any key to provide translations.
98
+ */
99
+ type TextInputLabels = {
100
+ /** Accessible label for the required (*) indicator. Must be string (aria-label). Default: "required" */
101
+ requiredSymbolLabel: string;
102
+ /**
103
+ * Suffix appended after the field label when the field is optional.
104
+ * Rendered as JSX child inside a <span> — accepts ReactNode.
105
+ * Default: " (Optional)"
106
+ */
107
+ optionalSuffix: ReactNodeLabel;
108
+ };
109
+ /**
110
+ * Top-level labels map for the design system.
111
+ * Consumers can provide partial overrides for any component via
112
+ * `DesignSystemLocaleProvider` or directly via each component's `labels` prop.
113
+ *
114
+ * Add new component entries here as i18n support is rolled out.
115
+ */
116
+ type DesignSystemLabels = {
117
+ CheckboxList?: Partial<CheckboxListLabels>;
118
+ Password?: Partial<PasswordLabels>;
119
+ TextInput?: Partial<TextInputLabels>;
120
+ };
121
+
122
+ type DesignSystemLocaleProviderProps = {
123
+ /** Partial label overrides for any supported component. */
124
+ labels: DesignSystemLabels;
125
+ children: ReactNode;
126
+ };
127
+ /**
128
+ * Provides translated label overrides to all child design system components.
129
+ * Works with any i18n library (react-intl, react-i18next, etc.) — consumers
130
+ * pass pre-translated strings.
131
+ *
132
+ * @example
133
+ * ```tsx
134
+ * <DesignSystemLocaleProvider labels={{
135
+ * CheckboxList: { expandLabel: 'Mostrar', hideLabel: 'Ocultar' },
136
+ * }}>
137
+ * <App />
138
+ * </DesignSystemLocaleProvider>
139
+ * ```
140
+ */
141
+ declare const DesignSystemLocaleProvider: ({ labels, children, }: DesignSystemLocaleProviderProps) => react_jsx_runtime.JSX.Element;
142
+
13
143
  /** @jsxImportSource @emotion/react */
14
- declare const Button: React$1.ForwardRefExoticComponent<Omit<_chakra_ui_react.ButtonProps, "size" | "variant" | "colorPalette" | "children"> & {
144
+ declare const Button: React$1.ForwardRefExoticComponent<Omit<_chakra_ui_react.ButtonProps, "children" | "size" | "variant" | "colorPalette"> & {
15
145
  label?: string;
16
146
  loading?: boolean;
17
147
  variant?: "primary" | "secondary" | "borderless" | "outline";
@@ -256,9 +386,11 @@ type CheckboxListProps = {
256
386
  required?: boolean;
257
387
  hideCheckedCounter?: boolean;
258
388
  hideExpandToggle?: boolean;
389
+ /** Override internal UI labels for internationalization support. */
390
+ labels?: Partial<CheckboxListLabels>;
259
391
  };
260
392
 
261
- declare const CheckboxList: ({ label, caption, checkboxes, defaultValues, onCheckedChange, errorMessage, horizontal, required, hideCheckedCounter, hideExpandToggle, }: CheckboxListProps) => _emotion_react_jsx_runtime.JSX.Element;
393
+ declare const CheckboxList: ({ label, caption, checkboxes, defaultValues, onCheckedChange, errorMessage, horizontal, required, hideCheckedCounter, hideExpandToggle, labels, }: CheckboxListProps) => _emotion_react_jsx_runtime.JSX.Element;
262
394
 
263
395
  type InputWithUnitsProps = {
264
396
  label: string;
@@ -299,9 +431,11 @@ type PasswordProps = {
299
431
  };
300
432
  minLength?: number;
301
433
  hideValidations?: boolean;
434
+ /** Override internal UI labels for internationalization support. */
435
+ labels?: Partial<PasswordLabels>;
302
436
  };
303
437
 
304
- declare const Password: ({ label, caption, required, disabledRules, onChange, minLength, hideValidations, }: PasswordProps) => _emotion_react_jsx_runtime.JSX.Element;
438
+ declare const Password: ({ label, caption, required, disabledRules, onChange, minLength, hideValidations, labels, }: PasswordProps) => _emotion_react_jsx_runtime.JSX.Element;
305
439
 
306
440
  type RadioListProps = {
307
441
  label: string;
@@ -396,9 +530,11 @@ type TextInputProps = Omit<InputProps, 'size' | 'variant' | 'colorPalette' | 'de
396
530
  noMarginBottom?: boolean;
397
531
  defaultValue?: string;
398
532
  onChange?: (e: React.ChangeEvent<HTMLInputElement>) => void;
533
+ /** Override internal UI labels for internationalization support. */
534
+ labels?: Partial<TextInputLabels>;
399
535
  };
400
536
 
401
- declare const TextInput: ({ label, caption, placeholder, errorMessage, required, disabled, size, noMarginBottom, defaultValue, onChange, ...rest }: TextInputProps) => _emotion_react_jsx_runtime.JSX.Element;
537
+ declare const TextInput: ({ label, caption, placeholder, errorMessage, required, disabled, size, noMarginBottom, defaultValue, onChange, labels, ...rest }: TextInputProps) => _emotion_react_jsx_runtime.JSX.Element;
402
538
 
403
539
  type TagProps = Omit<Tag$1.RootProps, 'size' | 'variant' | 'colorPalette' | 'children'> & {
404
540
  label: string;
@@ -927,4 +1063,4 @@ type ToastProps = {
927
1063
 
928
1064
  declare const showToast: (props: ToastProps) => void;
929
1065
 
930
- export { AnalysisWidget, Avatar, Badge, BaseMap, Breadcrumb, Button, Checkbox, CheckboxList, CheckboxOptionCard, CloseButton, ClusterPoint, ExtendableCard, Footer, IconButton, InlineMessage, InputWithUnits, ItemCount, LayerGroup, LayerGroupContainer, LayerItem, LayerParameters, LegendItem, List, MapControlsToolbar, MapMarker, MapMarkers, MapPopUp, Menu, MobileTabBar, Modal, MultiActionButton, Navbar, NavigationRail, OptionCard, Pagination, Panel, Password, ProgressBar, QualitativeAttribute, Radio, RadioGroup, RadioList, SSOButtons, ScaleBar, Search, Select, Sheet, SimpleMapPin, Slider, SliderInput, StepProgressIndicator, Switch, TabBar, Table, TableCell, TableRow, Tag, TextInput, Textarea, Toast, Toolbar, Tooltip, designSystemStyles, designSystemStylesForTailwind, getThemedColor, showToast };
1066
+ export { AnalysisWidget, Avatar, Badge, BaseMap, Breadcrumb, Button, Checkbox, CheckboxList, type CheckboxListLabels, CheckboxOptionCard, CloseButton, ClusterPoint, type DesignSystemLabels, DesignSystemLocaleProvider, type DesignSystemLocaleProviderProps, ExtendableCard, Footer, IconButton, InlineMessage, InputWithUnits, ItemCount, LayerGroup, LayerGroupContainer, LayerItem, LayerParameters, LegendItem, List, MapControlsToolbar, MapMarker, MapMarkers, MapPopUp, Menu, MobileTabBar, Modal, MultiActionButton, Navbar, NavigationRail, OptionCard, Pagination, Panel, Password, type PasswordLabels, ProgressBar, QualitativeAttribute, Radio, RadioGroup, RadioList, SSOButtons, ScaleBar, Search, Select, Sheet, SimpleMapPin, Slider, SliderInput, StepProgressIndicator, Switch, TabBar, Table, TableCell, TableRow, Tag, TextInput, type TextInputLabels, Textarea, Toast, Toolbar, Tooltip, designSystemStyles, designSystemStylesForTailwind, getThemedColor, showToast };