@12-apps/ui 6.24.8 → 6.26.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/_internal/components/data-display/Alert/Alert.helpers.js +5 -1
- package/dist/_internal/components/data-display/Alert/Alert.js +3 -3
- package/dist/_internal/components/data-display/Alert/Alert.styles.js +2 -2
- package/dist/_internal/components/data-display/CardKit/card-actions-context.js +4 -4
- package/dist/_internal/components/data-display/CardKit/use-remove-confirm.js +5 -5
- package/dist/_internal/components/data-display/DataViews/DataViewsGrid.js +19 -19
- package/dist/_internal/components/data-display/DataViews/DataViewsTableBase.js +24 -24
- package/dist/_internal/components/data-display/DataViews/data-views-category-pill.js +15 -15
- package/dist/_internal/components/data-display/DataViews/data-views-filter-panel.js +16 -16
- package/dist/_internal/components/data-display/DataViews/data-views-grid-parts.js +18 -18
- package/dist/_internal/components/data-display/DataViews/data-views-inline-bar.js +16 -16
- package/dist/_internal/components/data-display/DataViews/data-views-table-parts.js +4 -4
- package/dist/_internal/components/data-display/index.js +3 -3
- package/dist/_internal/components/form/CategorySelect/CategoryPanel.js +8 -8
- package/dist/_internal/components/form/CategorySelect/CategoryPanelFoot.js +2 -2
- package/dist/_internal/components/form/CategorySelect/CategoryPanelHead.js +2 -2
- package/dist/_internal/components/form/CategorySelect/CategoryPanelList.js +4 -4
- package/dist/_internal/components/form/CategorySelect/CategoryQuickActions.js +2 -2
- package/dist/_internal/components/form/CategorySelect/CategoryRows.js +7 -9
- package/dist/_internal/components/form/CategorySelect/CategorySelect.js +14 -14
- package/dist/_internal/components/form/CategorySelect/CategorySelect.styles.js +3 -1
- package/dist/_internal/components/form/CategorySelect/CategoryTrigger.js +2 -2
- package/dist/_internal/components/form/CategorySelect/category-keyboard.js +2 -2
- package/dist/_internal/components/form/CategorySelect/category-tree.js +11 -3
- package/dist/_internal/components/form/CategorySelect/useCategoryCommit.js +2 -2
- package/dist/_internal/components/form/CategorySelect/useCategoryKeyHandler.js +3 -3
- package/dist/_internal/components/form/CategorySelect/useCategorySelect.js +2 -2
- package/dist/_internal/components/form/total-form/Fields/CategoryField.js +15 -15
- package/dist/_internal/components/form/total-form/Fields/index.js +16 -16
- package/dist/_internal/components/index.js +3 -3
- package/dist/{chunk-WNMYWQ7D.js → chunk-4Y6SPFKW.js} +10 -8
- package/dist/chunk-4Y6SPFKW.js.map +1 -0
- package/dist/{chunk-KM5O4ICK.js → chunk-7LCXGJN5.js} +2 -2
- package/dist/{chunk-NLJV4CPF.js → chunk-7MN6I5NK.js} +2 -2
- package/dist/{chunk-PN5CQKA2.js → chunk-AXTLFK4T.js} +2 -2
- package/dist/{chunk-4TXIZ5WI.js → chunk-CJUOBTLL.js} +2 -2
- package/dist/{chunk-57Z2ND3N.js → chunk-CXLAJZSE.js} +2 -2
- package/dist/{chunk-E3PUH5IF.js → chunk-EQ7PWGBN.js} +2 -2
- package/dist/{chunk-EJQW2IYW.js → chunk-FPFUXRD2.js} +2 -2
- package/dist/{chunk-KIHQE5YA.js → chunk-GVDJQMFI.js} +2 -2
- package/dist/{chunk-N3QUEBNS.js → chunk-L7VH6IMR.js} +14 -1
- package/dist/chunk-L7VH6IMR.js.map +1 -0
- package/dist/{chunk-OFOYMZRY.js → chunk-NPN7JTRM.js} +22 -47
- package/dist/chunk-NPN7JTRM.js.map +1 -0
- package/dist/{chunk-OVLNF4AZ.js → chunk-P7IVAMAU.js} +24 -35
- package/dist/chunk-P7IVAMAU.js.map +1 -0
- package/dist/chunk-PN4HVM43.js +160 -0
- package/dist/chunk-PN4HVM43.js.map +1 -0
- package/dist/{chunk-WWM2YTW4.js → chunk-R2AZOWEZ.js} +21 -27
- package/dist/chunk-R2AZOWEZ.js.map +1 -0
- package/dist/{chunk-2GB5CIN6.js → chunk-RZVUY2MO.js} +8 -4
- package/dist/chunk-RZVUY2MO.js.map +1 -0
- package/dist/{chunk-FBI6QB3O.js → chunk-TVPPA4RD.js} +3 -3
- package/dist/{chunk-KFWIOFMS.js → chunk-TWY5FOBY.js} +3 -3
- package/dist/{chunk-6ZY5XU4J.js → chunk-UIZH4DAE.js} +2 -2
- package/dist/{chunk-ISH42UC7.js → chunk-USJPZ5Q7.js} +2 -2
- package/dist/{chunk-ZUIJ3N7N.js → chunk-V6Z4XS3I.js} +5 -3
- package/dist/chunk-V6Z4XS3I.js.map +1 -0
- package/dist/{chunk-SYJMI2NP.js → chunk-VNTOBLIB.js} +2 -2
- package/dist/{chunk-JM64OEU6.js → chunk-WAPJ2DL3.js} +10 -13
- package/dist/chunk-WAPJ2DL3.js.map +1 -0
- package/dist/{chunk-ZAB65STX.js → chunk-XHHR6G35.js} +2 -2
- package/dist/{chunk-WIT3Y7JT.js → chunk-Y2B3I3IH.js} +2 -2
- package/dist/{chunk-R6SNYC3D.js → chunk-Y3KRUT7O.js} +2 -2
- package/dist/{chunk-TPLKJHNN.js → chunk-ZC7RQDZ5.js} +8 -7
- package/dist/chunk-ZC7RQDZ5.js.map +1 -0
- package/dist/{chunk-TFO6GBW7.js → chunk-ZS44PY7T.js} +5 -1
- package/dist/chunk-ZS44PY7T.js.map +1 -0
- package/dist/{chunk-AJ6XEO4E.js → chunk-ZUY65MFH.js} +2 -2
- package/dist/data-display/Alert.js +3 -3
- package/dist/data-display/CardKit.js +5 -5
- package/dist/data-display/DataViews.js +24 -24
- package/dist/form/CategorySelect.js +24 -16
- package/dist/form/total-form.js +16 -16
- package/dist/native/data-display/Alert.js +18 -3
- package/dist/native/data-display/Alert.js.map +1 -1
- package/dist/types/components/data-display/Alert/Alert.base.d.ts +28 -2
- package/dist/types/components/data-display/Alert/Alert.base.d.ts.map +1 -1
- package/dist/types/components/data-display/Alert/Alert.helpers.d.ts +39 -0
- package/dist/types/components/data-display/Alert/Alert.helpers.d.ts.map +1 -1
- package/dist/types/components/form/CategorySelect/CategoryPanel.d.ts.map +1 -1
- package/dist/types/components/form/CategorySelect/CategoryPanelList.d.ts +6 -0
- package/dist/types/components/form/CategorySelect/CategoryPanelList.d.ts.map +1 -1
- package/dist/types/components/form/CategorySelect/CategoryQuickActions.d.ts.map +1 -1
- package/dist/types/components/form/CategorySelect/CategoryRows.d.ts +12 -24
- package/dist/types/components/form/CategorySelect/CategoryRows.d.ts.map +1 -1
- package/dist/types/components/form/CategorySelect/CategorySelect.d.ts +10 -7
- package/dist/types/components/form/CategorySelect/CategorySelect.d.ts.map +1 -1
- package/dist/types/components/form/CategorySelect/CategorySelect.styles.d.ts +11 -0
- package/dist/types/components/form/CategorySelect/CategorySelect.styles.d.ts.map +1 -1
- package/dist/types/components/form/CategorySelect/CategorySelect.types.d.ts +10 -2
- package/dist/types/components/form/CategorySelect/CategorySelect.types.d.ts.map +1 -1
- package/dist/types/components/form/CategorySelect/category-keyboard.d.ts.map +1 -1
- package/dist/types/components/form/CategorySelect/category-tree.d.ts +52 -20
- package/dist/types/components/form/CategorySelect/category-tree.d.ts.map +1 -1
- package/dist/types/components/form/CategorySelect/index.d.ts +1 -1
- package/dist/types/components/form/CategorySelect/index.d.ts.map +1 -1
- package/dist/types/components/form/CategorySelect/useCategorySelect.d.ts +2 -0
- package/dist/types/components/form/CategorySelect/useCategorySelect.d.ts.map +1 -1
- package/dist/types-native/components/data-display/Alert/Alert.base.d.ts +28 -2
- package/dist/types-native/components/data-display/Alert/Alert.base.d.ts.map +1 -1
- package/dist/types-native/components/data-display/Alert/Alert.helpers.d.ts +39 -0
- package/dist/types-native/components/data-display/Alert/Alert.helpers.d.ts.map +1 -1
- package/dist/types-native/components/data-display/Alert/Alert.native.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/components/data-display/Alert/Alert.base.ts +29 -2
- package/src/components/data-display/Alert/Alert.helpers.ts +50 -0
- package/src/components/data-display/Alert/Alert.md +29 -1
- package/src/components/data-display/Alert/Alert.native.tsx +8 -4
- package/src/components/data-display/Alert/Alert.tsx +5 -5
- package/src/components/form/CategorySelect/CategoryPanel.tsx +1 -0
- package/src/components/form/CategorySelect/CategoryPanelList.tsx +42 -34
- package/src/components/form/CategorySelect/CategoryQuickActions.tsx +6 -4
- package/src/components/form/CategorySelect/CategoryRows.tsx +45 -81
- package/src/components/form/CategorySelect/CategorySelect.md +47 -13
- package/src/components/form/CategorySelect/CategorySelect.styles.ts +13 -0
- package/src/components/form/CategorySelect/CategorySelect.tsx +16 -14
- package/src/components/form/CategorySelect/CategorySelect.types.ts +10 -2
- package/src/components/form/CategorySelect/category-keyboard.ts +27 -31
- package/src/components/form/CategorySelect/category-tree.ts +143 -63
- package/src/components/form/CategorySelect/index.ts +4 -0
- package/src/components/form/CategorySelect/useCategorySelect.ts +15 -1
- package/dist/chunk-2GB5CIN6.js.map +0 -1
- package/dist/chunk-JM64OEU6.js.map +0 -1
- package/dist/chunk-LR6MSKTT.js +0 -124
- package/dist/chunk-LR6MSKTT.js.map +0 -1
- package/dist/chunk-N3QUEBNS.js.map +0 -1
- package/dist/chunk-OFOYMZRY.js.map +0 -1
- package/dist/chunk-OVLNF4AZ.js.map +0 -1
- package/dist/chunk-TFO6GBW7.js.map +0 -1
- package/dist/chunk-TPLKJHNN.js.map +0 -1
- package/dist/chunk-WNMYWQ7D.js.map +0 -1
- package/dist/chunk-WWM2YTW4.js.map +0 -1
- package/dist/chunk-ZUIJ3N7N.js.map +0 -1
- /package/dist/{chunk-KM5O4ICK.js.map → chunk-7LCXGJN5.js.map} +0 -0
- /package/dist/{chunk-NLJV4CPF.js.map → chunk-7MN6I5NK.js.map} +0 -0
- /package/dist/{chunk-PN5CQKA2.js.map → chunk-AXTLFK4T.js.map} +0 -0
- /package/dist/{chunk-4TXIZ5WI.js.map → chunk-CJUOBTLL.js.map} +0 -0
- /package/dist/{chunk-57Z2ND3N.js.map → chunk-CXLAJZSE.js.map} +0 -0
- /package/dist/{chunk-E3PUH5IF.js.map → chunk-EQ7PWGBN.js.map} +0 -0
- /package/dist/{chunk-EJQW2IYW.js.map → chunk-FPFUXRD2.js.map} +0 -0
- /package/dist/{chunk-KIHQE5YA.js.map → chunk-GVDJQMFI.js.map} +0 -0
- /package/dist/{chunk-FBI6QB3O.js.map → chunk-TVPPA4RD.js.map} +0 -0
- /package/dist/{chunk-KFWIOFMS.js.map → chunk-TWY5FOBY.js.map} +0 -0
- /package/dist/{chunk-6ZY5XU4J.js.map → chunk-UIZH4DAE.js.map} +0 -0
- /package/dist/{chunk-ISH42UC7.js.map → chunk-USJPZ5Q7.js.map} +0 -0
- /package/dist/{chunk-SYJMI2NP.js.map → chunk-VNTOBLIB.js.map} +0 -0
- /package/dist/{chunk-ZAB65STX.js.map → chunk-XHHR6G35.js.map} +0 -0
- /package/dist/{chunk-WIT3Y7JT.js.map → chunk-Y2B3I3IH.js.map} +0 -0
- /package/dist/{chunk-R6SNYC3D.js.map → chunk-Y3KRUT7O.js.map} +0 -0
- /package/dist/{chunk-AJ6XEO4E.js.map → chunk-ZUY65MFH.js.map} +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CategorySelect.types.d.ts","sourceRoot":"","sources":["../../../../../src/components/form/CategorySelect/CategorySelect.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC;AACxD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AAExD;;;;;;GAMG;AACH,MAAM,WAAW,oBAAoB;IACnC,4EAA4E;IAC5E,EAAE,EAAE,MAAM,CAAC;IACX,8EAA8E;IAC9E,IAAI,EAAE,MAAM,CAAC;IACb,qEAAqE;IACrE,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB;;;OAGG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED
|
|
1
|
+
{"version":3,"file":"CategorySelect.types.d.ts","sourceRoot":"","sources":["../../../../../src/components/form/CategorySelect/CategorySelect.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC;AACxD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,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AC3C,+EAA+E;IAC/E,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED;;;;GAIG;AACH,MAAM,WAAW,wBAAyB,SAAQ,uBAAuB;IACvE,kEAAkE;IAClE,IAAI,EAAE,kBAAkB,CAAC;IACzB,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,+CAA+C;IAC/C,KAAK,EAAE,MAAM,EAAE,CAAC;IAChB,kEAAkE;IAClE,QAAQ,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,IAAI,CAAC;CACpC;AAED,iFAAiF;AACjF,MAAM,WAAW,yBAA0B,SAAQ,uBAAuB;IACxE,kEAAkE;IAClE,IAAI,EAAE,kBAAkB,CAAC;IACzB,IAAI,EAAE,QAAQ,CAAC;IACf,wDAAwD;IACxD,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,wDAAwD;IACxD,QAAQ,EAAE,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,KAAK,IAAI,CAAC;CACzC;AAED,MAAM,MAAM,mBAAmB,GAAG,wBAAwB,GAAG,yBAAyB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"category-keyboard.d.ts","sourceRoot":"","sources":["../../../../../src/components/form/CategorySelect/category-keyboard.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"category-keyboard.d.ts","sourceRoot":"","sources":["../../../../../src/components/form/CategorySelect/category-keyboard.ts"],"names":[],"mappings":"AAAA,OAAO,EAAa,KAAK,cAAc,EAAE,MAAM,iBAAiB,CAAC;AACjE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAE5D,wDAAwD;AACxD,MAAM,WAAW,kBAAkB;IACjC,IAAI,EAAE,cAAc,EAAE,CAAC;IACvB,WAAW,EAAE,MAAM,CAAC;IACpB,MAAM,EAAE,aAAa,EAAE,CAAC;IACxB,2EAA2E;IAC3E,MAAM,EAAE,OAAO,CAAC;IAChB,8EAA8E;IAC9E,oBAAoB,EAAE,OAAO,CAAC;IAC9B,cAAc,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IACvC,cAAc,EAAE,CAAC,UAAU,EAAE,MAAM,KAAK,IAAI,CAAC;IAC7C,MAAM,EAAE,CAAC,UAAU,EAAE,MAAM,KAAK,IAAI,CAAC;IACrC,QAAQ,EAAE,CAAC,UAAU,EAAE,MAAM,KAAK,IAAI,CAAC;IACvC,cAAc,EAAE,CAAC,KAAK,EAAE,aAAa,KAAK,IAAI,CAAC;IAC/C,iBAAiB,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,IAAI,CAAC;IACxC,MAAM,EAAE,MAAM,IAAI,CAAC;IACnB,MAAM,EAAE,MAAM,IAAI,CAAC;IACnB,IAAI,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,IAAI,CAAC;CAC5B;AAgHD;;;;;;GAMG;AACH,wBAAgB,qBAAqB,CACnC,GAAG,EAAE,MAAM,EACX,iBAAiB,EAAE,OAAO,EAC1B,OAAO,EAAE,kBAAkB,GAC1B,OAAO,CAMT"}
|
|
@@ -9,15 +9,17 @@ import type { CategoryGroup, CategorySelectionChip, CategorySelectOption } from
|
|
|
9
9
|
*/
|
|
10
10
|
export declare function foldText(text: string): string;
|
|
11
11
|
/**
|
|
12
|
-
*
|
|
12
|
+
* Nest a flat `parentId` list into a tree of ANY depth, preserving input order
|
|
13
|
+
* at every level.
|
|
13
14
|
*
|
|
14
|
-
* An option whose `parentId` names
|
|
15
|
-
* rather than dropped — a category is never invisible just because its
|
|
16
|
-
* was filtered out of the
|
|
15
|
+
* An option whose `parentId` names nothing in the payload is promoted to top
|
|
16
|
+
* level rather than dropped — a category is never invisible just because its
|
|
17
|
+
* parent was filtered out of the response. A duplicate id keeps its first row,
|
|
18
|
+
* so a repeated payload cannot place the same node twice.
|
|
17
19
|
*/
|
|
18
20
|
export declare function buildCategoryGroups(options: CategorySelectOption[]): CategoryGroup[];
|
|
19
21
|
/**
|
|
20
|
-
* Whether this
|
|
22
|
+
* Whether this node IS the leaf, because nothing sits under it.
|
|
21
23
|
*
|
|
22
24
|
* The leaf-only default makes a category a heading and the subcategory the thing
|
|
23
25
|
* you pick — but a childless category has no subcategory to offer instead, so
|
|
@@ -28,10 +30,34 @@ export declare function buildCategoryGroups(options: CategorySelectOption[]): Ca
|
|
|
28
30
|
* filter while `Marcar tudo` could still select it.
|
|
29
31
|
*/
|
|
30
32
|
export declare function isLeafCategory(group: CategoryGroup): boolean;
|
|
31
|
-
/** Every selectable leaf id across
|
|
33
|
+
/** Every selectable leaf id across the whole tree, in display order. */
|
|
32
34
|
export declare function collectLeafIds(groups: CategoryGroup[]): string[];
|
|
33
|
-
/**
|
|
35
|
+
/**
|
|
36
|
+
* The leaves a node stands for — every leaf BELOW it, or itself when childless.
|
|
37
|
+
*
|
|
38
|
+
* Recursive rather than one level down, so a category three levels deep still
|
|
39
|
+
* stands for the items at the bottom of it and not for the subcategories in
|
|
40
|
+
* between: the value a caller receives stays uniformly leaves, which is the
|
|
41
|
+
* property that lets a chip, a tri-state checkbox and `Marcar tudo` agree.
|
|
42
|
+
*/
|
|
34
43
|
export declare function leavesOf(group: CategoryGroup): string[];
|
|
44
|
+
/** Every node that can be unfolded, at any depth — what "Expandir tudo" opens. */
|
|
45
|
+
export declare function collectBranchIds(groups: CategoryGroup[]): string[];
|
|
46
|
+
/** The node carrying `id`, searched at every depth. */
|
|
47
|
+
export declare function findGroup(groups: CategoryGroup[], id: string): CategoryGroup | undefined;
|
|
48
|
+
/**
|
|
49
|
+
* The names from the top-level category down to `id`, or `null` when absent.
|
|
50
|
+
*
|
|
51
|
+
* The single-select trigger reads this back as `Pai › Filha › Item`, so a chosen
|
|
52
|
+
* row keeps the context that tells `Massas` (mercearia) from `Massas` (pratos
|
|
53
|
+
* principais) once the panel has closed over it.
|
|
54
|
+
*/
|
|
55
|
+
export declare function categoryPath(groups: CategoryGroup[], id: string): string[] | null;
|
|
56
|
+
/**
|
|
57
|
+
* How many levels the deepest branch has. A flat list is 1, the classic
|
|
58
|
+
* category/subcategory tree is 2, anything more is a tree with items in it.
|
|
59
|
+
*/
|
|
60
|
+
export declare function treeDepth(groups: CategoryGroup[]): number;
|
|
35
61
|
export type CategoryCheckState = 'off' | 'partial' | 'on';
|
|
36
62
|
/** Whether none, some, or all of a category's leaves are selected. */
|
|
37
63
|
export declare function categoryCheckState(group: CategoryGroup, selected: ReadonlySet<string>): CategoryCheckState;
|
|
@@ -40,23 +66,26 @@ export declare function toggleCategoryLeaves(group: CategoryGroup, selected: Rea
|
|
|
40
66
|
/** Add an id when absent, remove it when present. */
|
|
41
67
|
export declare function toggleLeaf(id: string, selected: ReadonlySet<string>): Set<string>;
|
|
42
68
|
/**
|
|
43
|
-
* Collapse a raw id set into the chips a human reads: a
|
|
44
|
-
* selected becomes ONE chip bearing
|
|
45
|
-
*
|
|
69
|
+
* Collapse a raw id set into the chips a human reads: a node that is fully
|
|
70
|
+
* selected becomes ONE chip bearing its name, rather than one chip per leaf —
|
|
71
|
+
* "Bebidas" instead of six drinks.
|
|
72
|
+
*
|
|
73
|
+
* A partly-selected node hands the question down to its own children, so the
|
|
74
|
+
* chip that appears is always the DEEPEST node that is completely selected.
|
|
46
75
|
*/
|
|
47
76
|
export declare function summarizeSelection(groups: CategoryGroup[], selected: ReadonlySet<string>): CategorySelectionChip[];
|
|
48
77
|
/**
|
|
49
|
-
* Drop the leaves a chip stands for. A
|
|
50
|
-
*
|
|
78
|
+
* Drop the leaves a chip stands for. A chip naming a node removes everything
|
|
79
|
+
* under it; a chip naming nothing in the tree removes just that id.
|
|
51
80
|
*/
|
|
52
81
|
export declare function removeChip(groups: CategoryGroup[], chipId: string, selected: ReadonlySet<string>): Set<string>;
|
|
53
82
|
/**
|
|
54
|
-
* Search
|
|
83
|
+
* Search every level, keeping each hit under its parents.
|
|
55
84
|
*
|
|
56
|
-
* A
|
|
57
|
-
*
|
|
58
|
-
*
|
|
59
|
-
*
|
|
85
|
+
* A node that matches keeps its whole subtree, so "Bebidas" shows the entire
|
|
86
|
+
* group. A node that does not match keeps only the descendants that do — the hit
|
|
87
|
+
* still arrives with its parents visible above it, which is the context that
|
|
88
|
+
* tells "Massas" (mercearia) from "Massas" (pratos principais).
|
|
60
89
|
*/
|
|
61
90
|
export declare function filterCategoryGroups(groups: CategoryGroup[], query: string): CategoryGroup[];
|
|
62
91
|
/** A run of text, flagged when it is the part that matched the query. */
|
|
@@ -74,12 +103,15 @@ interface HighlightSegment {
|
|
|
74
103
|
export declare function highlightSegments(text: string, query: string): HighlightSegment[];
|
|
75
104
|
/** A flattened row, so keyboard navigation can walk what is actually on screen. */
|
|
76
105
|
export interface CategoryRowRef {
|
|
77
|
-
kind: 'category' | 'subcategory';
|
|
78
106
|
id: string;
|
|
79
|
-
/**
|
|
107
|
+
/** 0 for a top-level category, one more for each level below it. */
|
|
108
|
+
depth: number;
|
|
109
|
+
/** True when the row has children to unfold — what → and ← act on. */
|
|
110
|
+
branch: boolean;
|
|
111
|
+
/** Owning node id — lets ← jump from a child back to its parent. */
|
|
80
112
|
parentId?: string;
|
|
81
113
|
}
|
|
82
|
-
/** The visible rows, in order, honouring which
|
|
114
|
+
/** The visible rows, in order, honouring which nodes are expanded. */
|
|
83
115
|
export declare function flattenRows(groups: CategoryGroup[], isExpanded: (categoryId: string) => boolean): CategoryRowRef[];
|
|
84
116
|
export {};
|
|
85
117
|
//# sourceMappingURL=category-tree.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"category-tree.d.ts","sourceRoot":"","sources":["../../../../../src/components/form/CategorySelect/category-tree.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,aAAa,EACb,qBAAqB,EACrB,oBAAoB,EACrB,MAAM,wBAAwB,CAAC;AAEhC;;;;;;;GAOG;AACH,wBAAgB,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAK7C;
|
|
1
|
+
{"version":3,"file":"category-tree.d.ts","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AAc,EAAE,CAUlB"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
export { CategorySelect } from './CategorySelect';
|
|
2
2
|
export type { CategoryGroup, CategoryMultiSelectProps, CategorySelectBaseProps, CategorySelectionChip, CategorySelectOption, CategorySelectProps, CategorySingleSelectProps, } from './CategorySelect.types';
|
|
3
|
-
export { buildCategoryGroups, categoryCheckState, collectLeafIds, filterCategoryGroups, foldText, leavesOf, summarizeSelection, } from './category-tree';
|
|
3
|
+
export { buildCategoryGroups, categoryCheckState, categoryPath, collectBranchIds, collectLeafIds, filterCategoryGroups, findGroup, foldText, leavesOf, summarizeSelection, treeDepth, } from './category-tree';
|
|
4
4
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/form/CategorySelect/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,YAAY,EACV,aAAa,EACb,wBAAwB,EACxB,uBAAuB,EACvB,qBAAqB,EACrB,oBAAoB,EACpB,mBAAmB,EACnB,yBAAyB,GAC1B,MAAM,wBAAwB,CAAC;AAChC,OAAO,EACL,mBAAmB,EACnB,kBAAkB,EAClB,cAAc,EACd,oBAAoB,EACpB,QAAQ,EACR,QAAQ,EACR,kBAAkB,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/form/CategorySelect/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,YAAY,EACV,aAAa,EACb,wBAAwB,EACxB,uBAAuB,EACvB,qBAAqB,EACrB,oBAAoB,EACpB,mBAAmB,EACnB,yBAAyB,GAC1B,MAAM,wBAAwB,CAAC;AAChC,OAAO,EACL,mBAAmB,EACnB,kBAAkB,EAClB,YAAY,EACZ,gBAAgB,EAChB,cAAc,EACd,oBAAoB,EACpB,SAAS,EACT,QAAQ,EACR,QAAQ,EACR,kBAAkB,EAClB,SAAS,GACV,MAAM,iBAAiB,CAAC"}
|
|
@@ -22,6 +22,8 @@ export interface CategorySelectState extends ExpansionState, DraftState {
|
|
|
22
22
|
visibleGroups: CategoryGroup[];
|
|
23
23
|
/** All groups, unfiltered — the basis for chips and "select all". */
|
|
24
24
|
allGroups: CategoryGroup[];
|
|
25
|
+
/** True when the tree runs deeper than category/subcategory. */
|
|
26
|
+
deepTree: boolean;
|
|
25
27
|
rows: CategoryRowRef[];
|
|
26
28
|
activeIndex: number;
|
|
27
29
|
setQuery: (next: string) => void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useCategorySelect.d.ts","sourceRoot":"","sources":["../../../../../src/components/form/CategorySelect/useCategorySelect.ts"],"names":[],"mappings":"AAEA,OAAO,
|
|
1
|
+
{"version":3,"file":"useCategorySelect.d.ts","sourceRoot":"","sources":["../../../../../src/components/form/CategorySelect/useCategorySelect.ts"],"names":[],"mappings":"AAEA,OAAO,EAQL,KAAK,cAAc,EACpB,MAAM,iBAAiB,CAAC;AACzB,OAAO,KAAK,EAAE,aAAa,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAElF,oEAAoE;AACpE,UAAU,cAAc;IACtB,UAAU,EAAE,CAAC,UAAU,EAAE,MAAM,KAAK,OAAO,CAAC;IAC5C,cAAc,EAAE,CAAC,UAAU,EAAE,MAAM,KAAK,IAAI,CAAC;IAC7C,cAAc,EAAE,CAAC,QAAQ,EAAE,OAAO,KAAK,IAAI,CAAC;IAC5C,SAAS,EAAE,CAAC,MAAM,EAAE,aAAa,EAAE,KAAK,IAAI,CAAC;CAC9C;AAiDD,+DAA+D;AAC/D,UAAU,UAAU;IAClB,KAAK,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;IAC3B,QAAQ,EAAE,CAAC,IAAI,EAAE,WAAW,CAAC,MAAM,CAAC,KAAK,IAAI,CAAC;IAC9C,cAAc,EAAE,CAAC,KAAK,EAAE,aAAa,KAAK,IAAI,CAAC;IAC/C,iBAAiB,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,IAAI,CAAC;CACzC;AAkBD,4EAA4E;AAC5E,MAAM,WAAW,mBAAoB,SAAQ,cAAc,EAAE,UAAU;IACrE,IAAI,EAAE,OAAO,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,mEAAmE;IACnE,aAAa,EAAE,aAAa,EAAE,CAAC;IAC/B,qEAAqE;IACrE,SAAS,EAAE,aAAa,EAAE,CAAC;IAC3B,gEAAgE;IAChE,QAAQ,EAAE,OAAO,CAAC;IAClB,IAAI,EAAE,cAAc,EAAE,CAAC;IACvB,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IACjC,cAAc,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IACvC,SAAS,EAAE,MAAM,IAAI,CAAC;IACtB,UAAU,EAAE,MAAM,IAAI,CAAC;IACvB,UAAU,EAAE,KAAK,CAAC,SAAS,CAAC,iBAAiB,GAAG,IAAI,CAAC,CAAC;CACvD;AAED,UAAU,qBAAqB;IAC7B,OAAO,EAAE,oBAAoB,EAAE,CAAC;IAChC,8EAA8E;IAC9E,QAAQ,EAAE,SAAS,MAAM,EAAE,CAAC;CAC7B;AAED;;;;;;;GAOG;AACH,wBAAgB,iBAAiB,CAAC,EAChC,OAAO,EACP,QAAQ,GACT,EAAE,qBAAqB,GAAG,mBAAmB,CAwD7C"}
|
|
@@ -69,11 +69,37 @@ export interface AlertBaseFields {
|
|
|
69
69
|
*/
|
|
70
70
|
animate?: boolean;
|
|
71
71
|
/**
|
|
72
|
-
*
|
|
72
|
+
* Whether this alert INTERRUPTS a screen reader, or waits its turn.
|
|
73
|
+
*
|
|
74
|
+
* Sets `role` and `aria-live` together, which is the whole point of it:
|
|
75
|
+
* those two disagree by default and the disagreement is invisible. An alert
|
|
76
|
+
* gets `role="alert"` from {@link ALERT_DEFAULTS} whatever its variant, and
|
|
77
|
+
* `role="alert"` is IMPLICITLY an assertive live region — so a `polite`
|
|
78
|
+
* `aria-live` beside it is contradicted rather than honoured, and several
|
|
79
|
+
* screen readers interrupt anyway. A caller who wants a quiet announcement
|
|
80
|
+
* has to know that the trick is `role="status"`, which is implicitly polite.
|
|
81
|
+
*
|
|
82
|
+
* `announce` is that knowledge, spelled once:
|
|
83
|
+
*
|
|
84
|
+
* | value | `role` | `aria-live` |
|
|
85
|
+
* |---|---|---|
|
|
86
|
+
* | `'assertive'` | `alert` | `assertive` |
|
|
87
|
+
* | `'polite'` | `status` | `polite` |
|
|
88
|
+
*
|
|
89
|
+
* Unset, nothing changes: the role stays `alert` and the live setting is
|
|
90
|
+
* still derived from the variant ({@link defaultAriaLive}). An explicit
|
|
91
|
+
* `role` or `aria-live` still wins over both, so an existing call site that
|
|
92
|
+
* spells either by hand keeps exactly what it spelled.
|
|
93
|
+
*/
|
|
94
|
+
announce?: 'polite' | 'assertive';
|
|
95
|
+
/**
|
|
96
|
+
* ARIA role for the alert. Prefer {@link AlertBaseFields.announce}, which
|
|
97
|
+
* keeps this and `aria-live` consistent; this overrides it.
|
|
73
98
|
*/
|
|
74
99
|
role?: string;
|
|
75
100
|
/**
|
|
76
|
-
* ARIA live region setting
|
|
101
|
+
* ARIA live region setting. Prefer {@link AlertBaseFields.announce}, which
|
|
102
|
+
* keeps this and `role` consistent; this overrides it.
|
|
77
103
|
*/
|
|
78
104
|
'aria-live'?: 'polite' | 'assertive' | 'off';
|
|
79
105
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Alert.base.d.ts","sourceRoot":"","sources":["../../../../../src/components/data-display/Alert/Alert.base.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,KAAK,MAAM,OAAO,CAAC;AAEpC,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,4BAA4B,CAAC;AAE7D;;;;;;;GAOG;AACH,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GAAG,eAAe,GAAG,YAAY,CAAC"}
|
|
@@ -12,6 +12,45 @@ export type ResolvedAlertProps<P extends AlertBaseFields> = P & Required<Pick<Al
|
|
|
12
12
|
export declare const resolveAlertProps: <P extends AlertBaseFields>(props: P) => ResolvedAlertProps<P>;
|
|
13
13
|
/** `danger` announces itself; everything else waits its turn. */
|
|
14
14
|
export declare const defaultAriaLive: (variant: AlertVariant) => "polite" | "assertive";
|
|
15
|
+
/**
|
|
16
|
+
* The ARIA role each `announce` level is spelled with.
|
|
17
|
+
*
|
|
18
|
+
* Both roles carry an IMPLICIT live setting, and that implicit one is what
|
|
19
|
+
* assistive tech acts on — `alert` is assertive, `status` is polite. Pairing
|
|
20
|
+
* them here is what stops `role` and `aria-live` from contradicting each
|
|
21
|
+
* other, which they do by default: every alert is `role="alert"` regardless of
|
|
22
|
+
* variant, so an `info` alert asks to be polite in one attribute and to
|
|
23
|
+
* interrupt in the other.
|
|
24
|
+
*/
|
|
25
|
+
export declare const ANNOUNCE_ROLE: Record<NonNullable<AlertBaseFields['announce']>, string>;
|
|
26
|
+
/**
|
|
27
|
+
* The two attributes that decide whether an alert interrupts, resolved TOGETHER.
|
|
28
|
+
*
|
|
29
|
+
* Both renderers therefore let `role` and `announce` leave their destructure
|
|
30
|
+
* unused (`_role`, `_announce`) and call this instead — the first because the
|
|
31
|
+
* defaults have already answered it, the second because it must never reach
|
|
32
|
+
* the DOM.
|
|
33
|
+
*
|
|
34
|
+
* Reads the caller's own props rather than the defaulted ones, because the
|
|
35
|
+
* whole question is which of them the caller actually spelled:
|
|
36
|
+
* {@link ALERT_DEFAULTS} supplies `role: 'alert'` for everything, so after the
|
|
37
|
+
* merge there is no longer any difference between an alert that asked to
|
|
38
|
+
* interrupt and one that never mentioned it.
|
|
39
|
+
*
|
|
40
|
+
* Precedence, most specific first — an explicit `role` or `aria-live` beats
|
|
41
|
+
* `announce`, so a call site that already spells either by hand is untouched:
|
|
42
|
+
*
|
|
43
|
+
* 1. `role` / `aria-live` as given;
|
|
44
|
+
* 2. {@link AlertBaseFields.announce}, which supplies both;
|
|
45
|
+
* 3. today's behaviour — `ALERT_DEFAULTS.role` and {@link defaultAriaLive}.
|
|
46
|
+
*
|
|
47
|
+
* With none of the three named, the result is byte-for-byte what it was before
|
|
48
|
+
* `announce` existed.
|
|
49
|
+
*/
|
|
50
|
+
export declare const resolveAnnouncement: (props: Pick<AlertBaseFields, "announce" | "role" | "aria-live">, variant: AlertVariant) => {
|
|
51
|
+
role: string;
|
|
52
|
+
"aria-live": "polite" | "assertive" | "off";
|
|
53
|
+
};
|
|
15
54
|
export declare const testIdFor: (base: string | undefined, suffix: string) => string;
|
|
16
55
|
/**
|
|
17
56
|
* The glyph each semantic variant carries, by the shared icon set's name.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Alert.helpers.d.ts","sourceRoot":"","sources":["../../../../../src/components/data-display/Alert/Alert.helpers.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAClE,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,2BAA2B,CAAC;AAE1D,KAAK,kBAAkB,GAAG,SAAS,GAAG,MAAM,GAAG,OAAO,GAAG,UAAU,GAAG,SAAS,GAAG,MAAM,GAAG,aAAa,CAAC;AAEzG,eAAO,MAAM,cAAc,EAAE,QAAQ,CAAC,IAAI,CAAC,eAAe,EAAE,kBAAkB,CAAC,CAAC,GAAG;IAAE,QAAQ,EAAE,KAAK,CAAA;CASnG,CAAC;AAEF;;;GAGG;AACH,MAAM,MAAM,kBAAkB,CAAC,CAAC,SAAS,eAAe,IAAI,CAAC,GAC3D,QAAQ,CAAC,IAAI,CAAC,eAAe,EAAE,kBAAkB,CAAC,CAAC,CAAC;AAYtD,eAAO,MAAM,iBAAiB,GAAI,CAAC,SAAS,eAAe,EAAE,OAAO,CAAC,KAAG,kBAAkB,CAAC,CAAC,CACP,CAAC;AAEtF,iEAAi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EF;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,eAAO,MAAM,mBAAmB,GAC9B,OAAO,IAAI,CAAC,eAAe,EAAE,UAAU,GAAG,MAAM,GAAG,WAAW,CAAC,EAC/D,SAAS,YAAY,KACpB;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,WAAW,EAAE,QAAQ,GAAG,WAAW,GAAG,KAAK,CAAA;CAM7D,CAAC;AAEF,eAAO,MAAM,SAAS,GAAI,MAAM,MAAM,GAAG,SAAS,EAAE,QAAQ,MAAM,KAAG,MACrB,CAAC;AAEjD;;;;GAIG;AACH,eAAO,MAAM,YAAY,EAAE,OAAO,CAAC,MAAM,CAAC,YAAY,EAAE,QAAQ,CAAC,CAKhE,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Alert.native.d.ts","sourceRoot":"","sources":["../../../../../src/components/data-display/Alert/Alert.native.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EASL,IAAI,EAEL,MAAM,cAAc,CAAC;AActB,OAAO,KAAK,EAAE,UAAU,EAAgB,MAAM,sBAAsB,CAAC;AA4KrE,eAAO,MAAM,KAAK,
|
|
1
|
+
{"version":3,"file":"Alert.native.d.ts","sourceRoot":"","sources":["../../../../../src/components/data-display/Alert/Alert.native.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EASL,IAAI,EAEL,MAAM,cAAc,CAAC;AActB,OAAO,KAAK,EAAE,UAAU,EAAgB,MAAM,sBAAsB,CAAC;AA4KrE,eAAO,MAAM,KAAK,yEA0ChB,CAAC"}
|
package/package.json
CHANGED
|
@@ -76,12 +76,39 @@ export interface AlertBaseFields {
|
|
|
76
76
|
animate?: boolean;
|
|
77
77
|
|
|
78
78
|
/**
|
|
79
|
-
*
|
|
79
|
+
* Whether this alert INTERRUPTS a screen reader, or waits its turn.
|
|
80
|
+
*
|
|
81
|
+
* Sets `role` and `aria-live` together, which is the whole point of it:
|
|
82
|
+
* those two disagree by default and the disagreement is invisible. An alert
|
|
83
|
+
* gets `role="alert"` from {@link ALERT_DEFAULTS} whatever its variant, and
|
|
84
|
+
* `role="alert"` is IMPLICITLY an assertive live region — so a `polite`
|
|
85
|
+
* `aria-live` beside it is contradicted rather than honoured, and several
|
|
86
|
+
* screen readers interrupt anyway. A caller who wants a quiet announcement
|
|
87
|
+
* has to know that the trick is `role="status"`, which is implicitly polite.
|
|
88
|
+
*
|
|
89
|
+
* `announce` is that knowledge, spelled once:
|
|
90
|
+
*
|
|
91
|
+
* | value | `role` | `aria-live` |
|
|
92
|
+
* |---|---|---|
|
|
93
|
+
* | `'assertive'` | `alert` | `assertive` |
|
|
94
|
+
* | `'polite'` | `status` | `polite` |
|
|
95
|
+
*
|
|
96
|
+
* Unset, nothing changes: the role stays `alert` and the live setting is
|
|
97
|
+
* still derived from the variant ({@link defaultAriaLive}). An explicit
|
|
98
|
+
* `role` or `aria-live` still wins over both, so an existing call site that
|
|
99
|
+
* spells either by hand keeps exactly what it spelled.
|
|
100
|
+
*/
|
|
101
|
+
announce?: 'polite' | 'assertive';
|
|
102
|
+
|
|
103
|
+
/**
|
|
104
|
+
* ARIA role for the alert. Prefer {@link AlertBaseFields.announce}, which
|
|
105
|
+
* keeps this and `aria-live` consistent; this overrides it.
|
|
80
106
|
*/
|
|
81
107
|
role?: string;
|
|
82
108
|
|
|
83
109
|
/**
|
|
84
|
-
* ARIA live region setting
|
|
110
|
+
* ARIA live region setting. Prefer {@link AlertBaseFields.announce}, which
|
|
111
|
+
* keeps this and `role` consistent; this overrides it.
|
|
85
112
|
*/
|
|
86
113
|
'aria-live'?: 'polite' | 'assertive' | 'off';
|
|
87
114
|
|
|
@@ -38,6 +38,56 @@ export const resolveAlertProps = <P extends AlertBaseFields>(props: P): Resolved
|
|
|
38
38
|
export const defaultAriaLive = (variant: AlertVariant): 'polite' | 'assertive' =>
|
|
39
39
|
variant === 'danger' ? 'assertive' : 'polite';
|
|
40
40
|
|
|
41
|
+
/**
|
|
42
|
+
* The ARIA role each `announce` level is spelled with.
|
|
43
|
+
*
|
|
44
|
+
* Both roles carry an IMPLICIT live setting, and that implicit one is what
|
|
45
|
+
* assistive tech acts on — `alert` is assertive, `status` is polite. Pairing
|
|
46
|
+
* them here is what stops `role` and `aria-live` from contradicting each
|
|
47
|
+
* other, which they do by default: every alert is `role="alert"` regardless of
|
|
48
|
+
* variant, so an `info` alert asks to be polite in one attribute and to
|
|
49
|
+
* interrupt in the other.
|
|
50
|
+
*/
|
|
51
|
+
export const ANNOUNCE_ROLE: Record<NonNullable<AlertBaseFields['announce']>, string> = {
|
|
52
|
+
assertive: 'alert',
|
|
53
|
+
polite: 'status',
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* The two attributes that decide whether an alert interrupts, resolved TOGETHER.
|
|
58
|
+
*
|
|
59
|
+
* Both renderers therefore let `role` and `announce` leave their destructure
|
|
60
|
+
* unused (`_role`, `_announce`) and call this instead — the first because the
|
|
61
|
+
* defaults have already answered it, the second because it must never reach
|
|
62
|
+
* the DOM.
|
|
63
|
+
*
|
|
64
|
+
* Reads the caller's own props rather than the defaulted ones, because the
|
|
65
|
+
* whole question is which of them the caller actually spelled:
|
|
66
|
+
* {@link ALERT_DEFAULTS} supplies `role: 'alert'` for everything, so after the
|
|
67
|
+
* merge there is no longer any difference between an alert that asked to
|
|
68
|
+
* interrupt and one that never mentioned it.
|
|
69
|
+
*
|
|
70
|
+
* Precedence, most specific first — an explicit `role` or `aria-live` beats
|
|
71
|
+
* `announce`, so a call site that already spells either by hand is untouched:
|
|
72
|
+
*
|
|
73
|
+
* 1. `role` / `aria-live` as given;
|
|
74
|
+
* 2. {@link AlertBaseFields.announce}, which supplies both;
|
|
75
|
+
* 3. today's behaviour — `ALERT_DEFAULTS.role` and {@link defaultAriaLive}.
|
|
76
|
+
*
|
|
77
|
+
* With none of the three named, the result is byte-for-byte what it was before
|
|
78
|
+
* `announce` existed.
|
|
79
|
+
*/
|
|
80
|
+
export const resolveAnnouncement = (
|
|
81
|
+
props: Pick<AlertBaseFields, 'announce' | 'role' | 'aria-live'>,
|
|
82
|
+
variant: AlertVariant,
|
|
83
|
+
): { role: string; 'aria-live': 'polite' | 'assertive' | 'off' } => {
|
|
84
|
+
const announce = props.announce;
|
|
85
|
+
return {
|
|
86
|
+
role: props.role ?? (announce === undefined ? ALERT_DEFAULTS.role : ANNOUNCE_ROLE[announce]),
|
|
87
|
+
'aria-live': props['aria-live'] ?? announce ?? defaultAriaLive(variant),
|
|
88
|
+
};
|
|
89
|
+
};
|
|
90
|
+
|
|
41
91
|
export const testIdFor = (base: string | undefined, suffix: string): string =>
|
|
42
92
|
base ? `${base}-${suffix}` : `alert-${suffix}`;
|
|
43
93
|
|
|
@@ -33,6 +33,7 @@ A beautiful and versatile Alert component with multiple variants, animations, an
|
|
|
33
33
|
| `glow` | `boolean` | `false` | Add a glowing shadow effect |
|
|
34
34
|
| `pulse` | `boolean` | `false` | Add a pulsing animation effect |
|
|
35
35
|
| `animate` | `boolean` | `true` | Whether to animate the alert on mount |
|
|
36
|
+
| `announce` | `'polite' \| 'assertive'` | - | Sets `role` and `aria-live` together — see [Accessibility](#accessibility) |
|
|
36
37
|
| `className` | `string` | - | Additional CSS classes |
|
|
37
38
|
|
|
38
39
|
## Usage Examples
|
|
@@ -136,12 +137,39 @@ import Star from '@mui/icons-material/Star';
|
|
|
136
137
|
The Alert component implements comprehensive accessibility features:
|
|
137
138
|
|
|
138
139
|
- Uses `role="alert"` for immediate screen reader announcement
|
|
139
|
-
-
|
|
140
|
+
- Derives `aria-live` from the variant: **assertive for `danger`, polite for
|
|
141
|
+
every other variant** (`defaultAriaLive`)
|
|
140
142
|
- Proper focus management for closable alerts
|
|
141
143
|
- Keyboard navigation support (Enter/Space to close)
|
|
142
144
|
- High contrast colors meeting WCAG guidelines
|
|
143
145
|
- Screen reader compatible content structure
|
|
144
146
|
|
|
147
|
+
### `announce` — whether the alert interrupts
|
|
148
|
+
|
|
149
|
+
`role` and `aria-live` are two attributes with one meaning between them, and by
|
|
150
|
+
default they disagree. Every alert gets `role="alert"`, whatever its variant,
|
|
151
|
+
and `role="alert"` is **implicitly an assertive live region** — so an `info`
|
|
152
|
+
alert ships `aria-live="polite"` and an implicitly-assertive role together, and
|
|
153
|
+
a reader that honours the role interrupts anyway. The escape is that
|
|
154
|
+
`role="status"` is implicitly polite, which is knowledge a call site should not
|
|
155
|
+
have to carry.
|
|
156
|
+
|
|
157
|
+
`announce` carries it:
|
|
158
|
+
|
|
159
|
+
| `announce` | `role` | `aria-live` |
|
|
160
|
+
|---|---|---|
|
|
161
|
+
| `'assertive'` | `alert` | `assertive` |
|
|
162
|
+
| `'polite'` | `status` | `polite` |
|
|
163
|
+
| unset | `alert` | from the variant, as above |
|
|
164
|
+
|
|
165
|
+
```tsx
|
|
166
|
+
// A sentence worth hearing, that is not worth interrupting for.
|
|
167
|
+
<Alert variant="info" announce="polite" description="Mais 1 pessoa está nesta mesa agora." showIcon={false} />
|
|
168
|
+
```
|
|
169
|
+
|
|
170
|
+
An explicit `role` or `aria-live` still wins over `announce`, so a call site
|
|
171
|
+
that already spells either by hand keeps exactly what it spelled.
|
|
172
|
+
|
|
145
173
|
## Best Practices
|
|
146
174
|
|
|
147
175
|
1. Use appropriate variants for message severity
|
|
@@ -12,7 +12,7 @@ import {
|
|
|
12
12
|
type ViewStyle,
|
|
13
13
|
} from 'react-native';
|
|
14
14
|
|
|
15
|
-
import {
|
|
15
|
+
import { resolveAlertProps, resolveAnnouncement, testIdFor, VARIANT_ICON } from './Alert.helpers';
|
|
16
16
|
import {
|
|
17
17
|
actionSlotStyle,
|
|
18
18
|
alertLook,
|
|
@@ -198,7 +198,10 @@ function useDismiss(onClose: (() => void) | undefined): { open: boolean; gone: b
|
|
|
198
198
|
|
|
199
199
|
export const Alert = React.forwardRef<View, AlertProps>((alertProps, ref) => {
|
|
200
200
|
const {
|
|
201
|
-
variant, color, glow, pulse, icon, showIcon, onClose, title, description, children, animate,
|
|
201
|
+
variant, color, glow, pulse, icon, showIcon, onClose, title, description, children, animate,
|
|
202
|
+
// `role`, `announce` and `aria-live` all leave here and are resolved
|
|
203
|
+
// TOGETHER below, off `alertProps` — see `resolveAnnouncement`.
|
|
204
|
+
role: _role, announce: _announce,
|
|
202
205
|
'aria-atomic': ariaAtomic, 'aria-live': _ariaLive, closable, closeLabel, style, ...others
|
|
203
206
|
} = resolveAlertProps(alertProps);
|
|
204
207
|
const theme = useUiTheme();
|
|
@@ -207,14 +210,15 @@ export const Alert = React.forwardRef<View, AlertProps>((alertProps, ref) => {
|
|
|
207
210
|
const look = alertLook(theme, { variant, color, glow, pulse });
|
|
208
211
|
const fadeIn = useFadeIn(animate);
|
|
209
212
|
const dismiss = useDismiss(onClose);
|
|
213
|
+
const announcement = resolveAnnouncement(alertProps, variant);
|
|
210
214
|
|
|
211
215
|
if (dismiss.gone) return null;
|
|
212
216
|
return (
|
|
213
217
|
<Collapse open={dismiss.open} onCollapsed={dismiss.onCollapsed}>
|
|
214
218
|
<Animated.View
|
|
215
219
|
ref={ref}
|
|
216
|
-
role={role as Role}
|
|
217
|
-
aria-live={
|
|
220
|
+
role={announcement.role as Role}
|
|
221
|
+
aria-live={announcement['aria-live']}
|
|
218
222
|
{...webAria({ 'aria-atomic': ariaAtomic })}
|
|
219
223
|
tabIndex={0}
|
|
220
224
|
testID={testId}
|
|
@@ -8,7 +8,7 @@ import { alpha, styled } from '@mui/material/styles/index.js';
|
|
|
8
8
|
import type { Theme } from '@mui/material/styles/index.js';
|
|
9
9
|
import React from 'react';
|
|
10
10
|
|
|
11
|
-
import {
|
|
11
|
+
import { resolveAlertProps, resolveAnnouncement, testIdFor } from './Alert.helpers';
|
|
12
12
|
import type { AlertPalette } from './Alert.metrics';
|
|
13
13
|
import {
|
|
14
14
|
ACTIVE,
|
|
@@ -301,7 +301,7 @@ export const Alert = React.forwardRef<HTMLDivElement, AlertProps>((alertProps, r
|
|
|
301
301
|
description,
|
|
302
302
|
children,
|
|
303
303
|
animate,
|
|
304
|
-
role,
|
|
304
|
+
role: _role, announce: _announce, // resolved from `alertProps` — see `resolveAnnouncement`
|
|
305
305
|
'aria-atomic': ariaAtomic,
|
|
306
306
|
...others
|
|
307
307
|
} = resolveAlertProps(alertProps);
|
|
@@ -316,7 +316,7 @@ export const Alert = React.forwardRef<HTMLDivElement, AlertProps>((alertProps, r
|
|
|
316
316
|
const props = withoutAlertOnlyProps(withoutTestIdProps(others));
|
|
317
317
|
|
|
318
318
|
// Depends on `variant`, so it cannot live in the static defaults above.
|
|
319
|
-
const
|
|
319
|
+
const announcement = resolveAnnouncement(alertProps, variant);
|
|
320
320
|
const [open, setOpen] = React.useState(true);
|
|
321
321
|
const [isClosing, setIsClosing] = React.useState(false);
|
|
322
322
|
|
|
@@ -356,8 +356,8 @@ export const Alert = React.forwardRef<HTMLDivElement, AlertProps>((alertProps, r
|
|
|
356
356
|
pulse={pulse}
|
|
357
357
|
animate={animate}
|
|
358
358
|
icon={displayIcon}
|
|
359
|
-
role={role}
|
|
360
|
-
aria-live={
|
|
359
|
+
role={announcement.role}
|
|
360
|
+
aria-live={announcement['aria-live']}
|
|
361
361
|
aria-atomic={ariaAtomic}
|
|
362
362
|
tabIndex={0}
|
|
363
363
|
action={dismissButton(alertProps, dataTestId, handleClose)}
|
|
@@ -94,6 +94,7 @@ export function CategoryPanel({
|
|
|
94
94
|
loading={loading}
|
|
95
95
|
showCounts={showCounts}
|
|
96
96
|
allowParentSelection={allowParentSelection}
|
|
97
|
+
deepTree={state.deepTree}
|
|
97
98
|
isExpanded={state.isExpanded}
|
|
98
99
|
onToggleExpanded={state.toggleExpanded}
|
|
99
100
|
onActivateCategory={onActivateCategory}
|