@astryxdesign/core 0.1.6-canary.eba4f34 → 0.1.6-canary.ef814e0
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/Chat/ChatLayout.d.ts +0 -10
- package/dist/Chat/ChatLayout.d.ts.map +1 -1
- package/dist/Chat/ChatLayout.js +0 -2
- package/dist/CheckboxInput/CheckboxInput.d.ts.map +1 -1
- package/dist/CheckboxInput/CheckboxInput.js +4 -2
- package/dist/CodeBlock/CodeBlock.d.ts.map +1 -1
- package/dist/CodeBlock/CodeBlock.js +67 -51
- package/dist/EmptyState/EmptyState.d.ts +4 -1
- package/dist/EmptyState/EmptyState.d.ts.map +1 -1
- package/dist/Pagination/Pagination.d.ts +1 -1
- package/dist/Pagination/Pagination.d.ts.map +1 -1
- package/dist/Pagination/Pagination.js +38 -11
- package/dist/Switch/Switch.d.ts.map +1 -1
- package/dist/Switch/Switch.js +4 -2
- package/dist/Table/plugins/groupedRows/useTableGroupedRows.d.ts +1 -1
- package/dist/Table/plugins/groupedRows/useTableGroupedRows.js +1 -1
- package/dist/Table/plugins/rowIndex/useTableRowIndex.d.ts +1 -1
- package/dist/Table/plugins/rowIndex/useTableRowIndex.js +1 -1
- package/dist/astryx.css +17 -1
- package/dist/astryx.umd.js +57 -55
- package/dist/astryx.umd.js.map +4 -4
- package/dist/i18n/InternationalizationContext.d.ts +12 -0
- package/dist/i18n/InternationalizationContext.d.ts.map +1 -0
- package/dist/i18n/InternationalizationContext.js +29 -0
- package/dist/i18n/InternationalizationProvider.d.ts +62 -0
- package/dist/i18n/InternationalizationProvider.d.ts.map +1 -0
- package/dist/i18n/InternationalizationProvider.js +44 -0
- package/dist/i18n/index.d.ts +24 -0
- package/dist/i18n/index.d.ts.map +1 -0
- package/dist/i18n/index.js +21 -0
- package/dist/i18n/resolve.d.ts +22 -0
- package/dist/i18n/resolve.d.ts.map +1 -0
- package/dist/i18n/resolve.js +141 -0
- package/dist/i18n/translator.d.ts +25 -0
- package/dist/i18n/translator.d.ts.map +1 -0
- package/dist/i18n/translator.js +1 -0
- package/dist/i18n/types.d.ts +47 -0
- package/dist/i18n/types.d.ts.map +1 -0
- package/dist/i18n/types.js +1 -0
- package/dist/i18n/useTranslator.d.ts +15 -0
- package/dist/i18n/useTranslator.d.ts.map +1 -0
- package/dist/i18n/useTranslator.js +39 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -0
- package/locales/en.json +38 -0
- package/locales/pseudo.json +29 -0
- package/package.json +13 -2
- package/src/AlertDialog/AlertDialog.doc.mjs +5 -0
- package/src/Chat/ChatLayout.tsx +0 -11
- package/src/CheckboxInput/CheckboxInput.test.tsx +16 -0
- package/src/CheckboxInput/CheckboxInput.tsx +4 -2
- package/src/CheckboxList/CheckboxList.doc.mjs +5 -0
- package/src/CodeBlock/CodeBlock.tsx +87 -38
- package/src/EmptyState/EmptyState.doc.mjs +3 -3
- package/src/EmptyState/EmptyState.tsx +4 -1
- package/src/Layer/useLayer.doc.mjs +2 -2
- package/src/Pagination/Pagination.tsx +35 -12
- package/src/PowerSearch/PowerSearch.doc.mjs +5 -0
- package/src/Switch/Switch.test.tsx +16 -0
- package/src/Switch/Switch.tsx +4 -2
- package/src/Table/plugins/groupedRows/useTableGroupedRows.tsx +1 -1
- package/src/Table/plugins/rowIndex/useTableRowIndex.tsx +1 -1
- package/src/Table/useTableGroupedRows.doc.mjs +3 -3
- package/src/i18n/InternationalizationContext.ts +39 -0
- package/src/i18n/InternationalizationProvider.doc.mjs +72 -0
- package/src/i18n/InternationalizationProvider.tsx +83 -0
- package/src/i18n/__tests__/e2e-pagination.test.tsx +172 -0
- package/src/i18n/__tests__/resolve.test.ts +284 -0
- package/src/i18n/index.ts +32 -0
- package/src/i18n/resolve.ts +165 -0
- package/src/i18n/translator.ts +31 -0
- package/src/i18n/types.ts +53 -0
- package/src/i18n/useTranslator.doc.mjs +42 -0
- package/src/i18n/useTranslator.ts +50 -0
- package/src/index.ts +3 -0
|
@@ -20,16 +20,6 @@
|
|
|
20
20
|
import { type ReactNode } from 'react';
|
|
21
21
|
import type { BaseProps } from '../BaseProps';
|
|
22
22
|
type Density = 'compact' | 'balanced' | 'spacious';
|
|
23
|
-
/** Imperative handle for ChatLayout scroll controls. */
|
|
24
|
-
export interface ChatLayoutHandle {
|
|
25
|
-
/** Scroll a message to the top and unlock for stream-in. */
|
|
26
|
-
/** Scroll to bottom and re-lock. */
|
|
27
|
-
scrollToBottom: () => void;
|
|
28
|
-
/** Navigate to a message, no lock change. */
|
|
29
|
-
scrollToMessage: (el: HTMLElement) => void;
|
|
30
|
-
/** Scroll to the last message. */
|
|
31
|
-
scrollToLastMessage: () => void;
|
|
32
|
-
}
|
|
33
23
|
export interface ChatLayoutProps extends BaseProps<HTMLDivElement> {
|
|
34
24
|
/** Ref forwarded to the root element. */
|
|
35
25
|
ref?: React.Ref<HTMLDivElement>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ChatLayout.d.ts","sourceRoot":"","sources":["../../src/Chat/ChatLayout.tsx"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,OAAO,EAAC,KAAK,SAAS,EAAkB,MAAM,OAAO,CAAC;AAGtD,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,cAAc,CAAC;AAY5C,KAAK,OAAO,GAAG,SAAS,GAAG,UAAU,GAAG,UAAU,CAAC;AAEnD,
|
|
1
|
+
{"version":3,"file":"ChatLayout.d.ts","sourceRoot":"","sources":["../../src/Chat/ChatLayout.tsx"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,OAAO,EAAC,KAAK,SAAS,EAAkB,MAAM,OAAO,CAAC;AAGtD,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,cAAc,CAAC;AAY5C,KAAK,OAAO,GAAG,SAAS,GAAG,UAAU,GAAG,UAAU,CAAC;AAEnD,MAAM,WAAW,eAAgB,SAAQ,SAAS,CAAC,cAAc,CAAC;IAChE,yCAAyC;IACzC,GAAG,CAAC,EAAE,KAAK,CAAC,GAAG,CAAC,cAAc,CAAC,CAAC;IAEhC;;;OAGG;IACH,QAAQ,EAAE,SAAS,CAAC;IAEpB;;;OAGG;IACH,QAAQ,EAAE,SAAS,CAAC;IAEpB;;OAEG;IACH,UAAU,CAAC,EAAE,SAAS,CAAC;IAEvB;;;;OAIG;IACH,YAAY,CAAC,EAAE,SAAS,GAAG,IAAI,CAAC;IAEhC;;;;;;;;;;;OAWG;IACH,SAAS,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC,WAAW,GAAG,IAAI,CAAC,CAAC;IAEhD;;;;OAIG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AA8JD,wBAAgB,UAAU,CAAC,EACzB,QAAQ,EACR,QAAQ,EACR,OAAoB,EACpB,UAAU,EACV,YAAY,EACZ,SAAS,EAAE,iBAAiB,EAC5B,MAAM,EACN,SAAS,EACT,KAAK,EACL,aAAa,EAAE,MAAM,EACrB,GAAG,GACJ,EAAE,eAAe,+BAwGjB;yBApHe,UAAU"}
|
package/dist/Chat/ChatLayout.js
CHANGED
|
@@ -35,8 +35,6 @@ import { themeProps } from "../utils/themeProps.js";
|
|
|
35
35
|
// =============================================================================
|
|
36
36
|
// Types
|
|
37
37
|
// =============================================================================
|
|
38
|
-
|
|
39
|
-
/** Imperative handle for ChatLayout scroll controls. */
|
|
40
38
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
41
39
|
// =============================================================================
|
|
42
40
|
// Styles
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CheckboxInput.d.ts","sourceRoot":"","sources":["../../src/CheckboxInput/CheckboxInput.tsx"],"names":[],"mappings":"AAIA;;;;;;;;;;;;GAYG;AAEH,OAAO,EAML,KAAK,WAAW,EAChB,KAAK,UAAU,EACf,KAAK,SAAS,EACf,MAAM,OAAO,CAAC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;;;OAKG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB;;;OAGG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB;;;OAGG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB;;;;OAIG;IACH,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB;;;;;OAKG;IACH,IAAI,CAAC,EAAE,iBAAiB,CAAC;IACzB;;OAEG;IACH,OAAO,CAAC,EAAE,CAAC,CAAC,EAAE,UAAU,CAAC,gBAAgB,CAAC,KAAK,IAAI,CAAC;IACpD;;OAEG;IACH,MAAM,CAAC,EAAE,CAAC,CAAC,EAAE,UAAU,CAAC,gBAAgB,CAAC,KAAK,IAAI,CAAC;IACnD;;OAEG;IACH,SAAS,CAAC,EAAE,SAAS,GAAG,QAAQ,CAAC;IACjC;;;OAGG;IACH,MAAM,CAAC,EAAE,WAAW,CAAC;CACtB;AAOD;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,aAAa,CAAC,EAC5B,KAAK,EACL,aAAqB,EACrB,WAAW,EACX,QAAQ,EACR,YAAY,EACZ,SAAiB,EACjB,KAAK,EACL,UAAkB,EAClB,QAAQ,EACR,eAAe,EACf,UAAkB,EAClB,UAAkB,EAClB,UAAkB,EAClB,IAAW,EACX,OAAO,EACP,MAAM,EACN,SAAS,EACT,MAAM,EACN,KAAK,EACL,MAAM,EACN,SAAS,EACT,KAAK,EACL,GAAG,EACH,GAAG,IAAI,EACR,EAAE,kBAAkB,+
|
|
1
|
+
{"version":3,"file":"CheckboxInput.d.ts","sourceRoot":"","sources":["../../src/CheckboxInput/CheckboxInput.tsx"],"names":[],"mappings":"AAIA;;;;;;;;;;;;GAYG;AAEH,OAAO,EAML,KAAK,WAAW,EAChB,KAAK,UAAU,EACf,KAAK,SAAS,EACf,MAAM,OAAO,CAAC;AACf,OAAO,KAAK,MAAM,MAAM,kBAAkB,CAAC;AAY3C,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,cAAc,C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ACrB;;;OAGG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB;;;;OAIG;IACH,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB;;;;;OAKG;IACH,IAAI,CAAC,EAAE,iBAAiB,CAAC;IACzB;;OAEG;IACH,OAAO,CAAC,EAAE,CAAC,CAAC,EAAE,UAAU,CAAC,gBAAgB,CAAC,KAAK,IAAI,CAAC;IACpD;;OAEG;IACH,MAAM,CAAC,EAAE,CAAC,CAAC,EAAE,UAAU,CAAC,gBAAgB,CAAC,KAAK,IAAI,CAAC;IACnD;;OAEG;IACH,SAAS,CAAC,EAAE,SAAS,GAAG,QAAQ,CAAC;IACjC;;;OAGG;IACH,MAAM,CAAC,EAAE,WAAW,CAAC;CACtB;AAOD;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,aAAa,CAAC,EAC5B,KAAK,EACL,aAAqB,EACrB,WAAW,EACX,QAAQ,EACR,YAAY,EACZ,SAAiB,EACjB,KAAK,EACL,UAAkB,EAClB,QAAQ,EACR,eAAe,EACf,UAAkB,EAClB,UAAkB,EAClB,UAAkB,EAClB,IAAW,EACX,OAAO,EACP,MAAM,EACN,SAAS,EACT,MAAM,EACN,KAAK,EACL,MAAM,EACN,SAAS,EACT,KAAK,EACL,GAAG,EACH,GAAG,IAAI,EACR,EAAE,kBAAkB,+BA0NpB;yBAnPe,aAAa"}
|
|
@@ -263,9 +263,11 @@ export function CheckboxInput({
|
|
|
263
263
|
}, [isIndeterminate]);
|
|
264
264
|
|
|
265
265
|
// Build aria-describedby from description and status message
|
|
266
|
-
// Only include descriptionID when the element actually renders
|
|
266
|
+
// Only include descriptionID when the element actually renders.
|
|
267
|
+
// FieldLabel renders the description (with descriptionID) even when the
|
|
268
|
+
// label is visually hidden — it's sr-only, so keep it linked.
|
|
267
269
|
const describedByParts = [];
|
|
268
|
-
if (description
|
|
270
|
+
if (description) {
|
|
269
271
|
describedByParts.push(descriptionID);
|
|
270
272
|
}
|
|
271
273
|
if (status?.message) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CodeBlock.d.ts","sourceRoot":"","sources":["../../src/CodeBlock/CodeBlock.tsx"],"names":[],"mappings":"AAoBA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,cAAc,CAAC;AA0B5C,OAAO,EAAc,KAAK,qBAAqB,EAAC,MAAM,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"CodeBlock.d.ts","sourceRoot":"","sources":["../../src/CodeBlock/CodeBlock.tsx"],"names":[],"mappings":"AAoBA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,cAAc,CAAC;AA0B5C,OAAO,EAAc,KAAK,qBAAqB,EAAC,MAAM,iBAAiB,CAAC;AA4VxE,MAAM,WAAW,cAAe,SAAQ,SAAS,CAAC,cAAc,CAAC;IAC/D,GAAG,CAAC,EAAE,KAAK,CAAC,GAAG,CAAC,cAAc,CAAC,CAAC;IAChC,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,cAAc,CAAC,EAAE,MAAM,EAAE,CAAC;IAC1B,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,MAAM,CAAC,EAAE,MAAM,IAAI,CAAC;IACpB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,SAAS,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IAC5B,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAC9B,IAAI,CAAC,EAAE,IAAI,GAAG,IAAI,CAAC;IACnB;;;;;;OAMG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;;;;;;;OAQG;IACH,SAAS,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC/B,SAAS,CAAC,EAAE,CACV,IAAI,EAAE,MAAM,EACZ,QAAQ,EAAE,MAAM,KACb;QAAC,IAAI,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAC;QAAC,GAAG,EAAE,MAAM,CAAA;KAAC,EAAE,CAAC;IAClD,aAAa,CAAC,EAAE,MAAM,GAAG,QAAQ,GAAG,OAAO,CAAC;IAC5C;;;;;;OAMG;IACH,WAAW,CAAC,EAAE,qBAAqB,CAAC;CACrC;AAqPD;;;;;;;;GAQG;AACH,wBAAgB,SAAS,CAAC,EACxB,IAAI,EACJ,QAAsB,EACtB,KAAK,EACL,gBAAuB,EACvB,cAAsB,EACtB,cAAc,EACd,aAAoB,EACpB,MAAM,EACN,SAAiB,EACjB,SAAS,EACT,aAAqB,EACrB,oBAAyB,EACzB,IAAW,EACX,KAAK,EAAE,SAAyB,EAChC,SAAkB,EAClB,SAAS,EAAE,eAAe,EAC1B,aAAsB,EACtB,WAAW,EACX,MAAM,EACN,SAAS,EACT,KAAK,EACL,GAAG,EACH,GAAG,KAAK,EACT,EAAE,cAAc,qBA8NhB;yBAtPe,SAAS"}
|
|
@@ -43,6 +43,10 @@ const containerStyles = {
|
|
|
43
43
|
$$css: true
|
|
44
44
|
}
|
|
45
45
|
};
|
|
46
|
+
const _temp = {
|
|
47
|
+
"--_codeblock-gutter-width": "xtk08jq",
|
|
48
|
+
"$$css": true
|
|
49
|
+
};
|
|
46
50
|
const dynamicStyles = {
|
|
47
51
|
width: value => [{
|
|
48
52
|
kzqmXN: value != null ? "x5lhr3w" : value,
|
|
@@ -53,6 +57,9 @@ const dynamicStyles = {
|
|
|
53
57
|
"--x-width": (val => typeof val === "number" ? val + "px" : val != null ? val : undefined)(value),
|
|
54
58
|
"--x-minWidth": (val => typeof val === "number" ? val + "px" : val != null ? val : undefined)(value === 'fit-content' ? 'min(100%, 400px)' : null),
|
|
55
59
|
"--x-maxWidth": (val => typeof val === "number" ? val + "px" : val != null ? val : undefined)(value === 'fit-content' ? '100%' : null)
|
|
60
|
+
}],
|
|
61
|
+
gutterWidth: digits => [_temp, {
|
|
62
|
+
"--x---_codeblock-gutter-width": `${digits}ch` != null ? `${digits}ch` : undefined
|
|
56
63
|
}]
|
|
57
64
|
};
|
|
58
65
|
const styles = {
|
|
@@ -66,19 +73,6 @@ const styles = {
|
|
|
66
73
|
kVQacm: "xb3r6kr",
|
|
67
74
|
$$css: true
|
|
68
75
|
},
|
|
69
|
-
gutter: {
|
|
70
|
-
kmuXW: "x2lah0s",
|
|
71
|
-
k8WAf4: "x8o8v82",
|
|
72
|
-
kZCmMZ: "x1rey3nv",
|
|
73
|
-
kwRFfy: "x1t818jl",
|
|
74
|
-
k9WMMc: "xp4054r",
|
|
75
|
-
kfSwDN: "x87ps6o",
|
|
76
|
-
kMwMTN: "xt5rlkq",
|
|
77
|
-
kWqL5O: "x1pcaw5z",
|
|
78
|
-
kSWEuD: "x32b0ac",
|
|
79
|
-
k26BEO: "xtgwc6q",
|
|
80
|
-
$$css: true
|
|
81
|
-
},
|
|
82
76
|
code: {
|
|
83
77
|
k1xSpc: "x1lliihq",
|
|
84
78
|
kUk6DE: "x98rzlu",
|
|
@@ -99,19 +93,24 @@ const styles = {
|
|
|
99
93
|
kHjlTd: "x1mzt3pk",
|
|
100
94
|
$$css: true
|
|
101
95
|
},
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
96
|
+
codeNumbered: {
|
|
97
|
+
kVAEAm: "x1n2onr6",
|
|
98
|
+
k5JduY: "x1s928wv",
|
|
99
|
+
kwXMNM: "x1j6awrg",
|
|
100
|
+
kSy8m5: "xd54j2p",
|
|
101
|
+
kc1e00: "x1km86hw",
|
|
102
|
+
kkgrvl: "xkj6t0a",
|
|
103
|
+
kQlJh0: "x1p96cux",
|
|
104
|
+
k6vLHU: "xvsnedh",
|
|
105
|
+
kkQ525: "xnnzo76",
|
|
106
|
+
kloYau: "x2q1x1w",
|
|
108
107
|
$$css: true
|
|
109
108
|
},
|
|
110
|
-
|
|
109
|
+
sizeSm: {
|
|
111
110
|
kGuDYH: "x141an7d",
|
|
112
111
|
$$css: true
|
|
113
112
|
},
|
|
114
|
-
|
|
113
|
+
sizeMd: {
|
|
115
114
|
kGuDYH: "xp03k98",
|
|
116
115
|
$$css: true
|
|
117
116
|
}
|
|
@@ -131,7 +130,8 @@ const CodeChunk = /*#__PURE__*/React.memo(function CodeChunk({
|
|
|
131
130
|
lines,
|
|
132
131
|
startIndex,
|
|
133
132
|
highlightSet,
|
|
134
|
-
renderLineContent
|
|
133
|
+
renderLineContent,
|
|
134
|
+
lineNumbers
|
|
135
135
|
}) {
|
|
136
136
|
return /*#__PURE__*/_jsx(_Fragment, {
|
|
137
137
|
children: lines.map((line, j) => {
|
|
@@ -142,23 +142,30 @@ const CodeChunk = /*#__PURE__*/React.memo(function CodeChunk({
|
|
|
142
142
|
0: {
|
|
143
143
|
className: "x17iicif"
|
|
144
144
|
},
|
|
145
|
+
2: {
|
|
146
|
+
className: "x17iicif xrvj5dj x1xx4m37 xf5zn4v x46gnpd x17gn2l9 x19ds33d x1wnbjh8 xtkarl4 x1rbqspl x3nzp0f"
|
|
147
|
+
},
|
|
145
148
|
1: {
|
|
146
149
|
className: "x17iicif xgcxg3y x1ng9b9t x1pzlopt"
|
|
150
|
+
},
|
|
151
|
+
3: {
|
|
152
|
+
className: "x17iicif xrvj5dj x1xx4m37 xf5zn4v x46gnpd x17gn2l9 x19ds33d x1wnbjh8 xtkarl4 x1rbqspl x3nzp0f xgcxg3y x1ng9b9t x1pzlopt"
|
|
147
153
|
}
|
|
148
|
-
}[!!(highlightSet?.has(i + 1) ?? false) << 0],
|
|
154
|
+
}[!!lineNumbers << 1 | !!(highlightSet?.has(i + 1) ?? false) << 0],
|
|
149
155
|
children: renderLineContent(line, i)
|
|
150
156
|
}, i);
|
|
151
157
|
})
|
|
152
158
|
});
|
|
153
159
|
});
|
|
154
|
-
function renderLines(lines, highlightSet, renderLineContent, chunkSize = LINE_CHUNK_SIZE) {
|
|
160
|
+
function renderLines(lines, highlightSet, renderLineContent, lineNumbers, chunkSize = LINE_CHUNK_SIZE) {
|
|
155
161
|
chunkSize = Math.max(1, Math.floor(chunkSize));
|
|
156
162
|
if (lines.length < LINE_CHUNK_THRESHOLD) {
|
|
157
163
|
return /*#__PURE__*/_jsx(CodeChunk, {
|
|
158
164
|
lines: lines,
|
|
159
165
|
startIndex: 0,
|
|
160
166
|
highlightSet: highlightSet,
|
|
161
|
-
renderLineContent: renderLineContent
|
|
167
|
+
renderLineContent: renderLineContent,
|
|
168
|
+
lineNumbers: lineNumbers
|
|
162
169
|
});
|
|
163
170
|
}
|
|
164
171
|
const chunks = [];
|
|
@@ -178,7 +185,8 @@ function renderLines(lines, highlightSet, renderLineContent, chunkSize = LINE_CH
|
|
|
178
185
|
lines: chunkLines,
|
|
179
186
|
startIndex: start,
|
|
180
187
|
highlightSet: highlightSet,
|
|
181
|
-
renderLineContent: renderLineContent
|
|
188
|
+
renderLineContent: renderLineContent,
|
|
189
|
+
lineNumbers: lineNumbers
|
|
182
190
|
})
|
|
183
191
|
}, start));
|
|
184
192
|
}
|
|
@@ -294,18 +302,27 @@ function SpanCodeContent({
|
|
|
294
302
|
tokenLines,
|
|
295
303
|
highlightSet,
|
|
296
304
|
isWrapped,
|
|
297
|
-
sizeStyle
|
|
305
|
+
sizeStyle,
|
|
306
|
+
hasLineNumbers,
|
|
307
|
+
maxDigits
|
|
298
308
|
}) {
|
|
299
309
|
useInsertionEffect(() => {
|
|
300
310
|
ensureHighlightStyles();
|
|
301
311
|
}, []);
|
|
302
312
|
const renderLineContent = useCallback((line, lineIndex) => {
|
|
303
313
|
const tokens = tokenLines[lineIndex] ?? [];
|
|
304
|
-
|
|
314
|
+
// Wrap tokens in a single element so they occupy one grid cell when line
|
|
315
|
+
// numbers are on (see `lineNumbered`); an inline span is a no-op when off.
|
|
316
|
+
return /*#__PURE__*/_jsx("span", {
|
|
317
|
+
...{
|
|
318
|
+
className: "xeuugli"
|
|
319
|
+
},
|
|
320
|
+
children: buildSpanLine(line, tokens)
|
|
321
|
+
});
|
|
305
322
|
}, [tokenLines]);
|
|
306
323
|
return /*#__PURE__*/_jsx("code", {
|
|
307
|
-
...stylex.props(styles.code, sizeStyle, isWrapped && styles.codeWrapped),
|
|
308
|
-
children: renderLines(lines, highlightSet, renderLineContent)
|
|
324
|
+
...stylex.props(styles.code, sizeStyle, isWrapped && styles.codeWrapped, hasLineNumbers && styles.codeNumbered, hasLineNumbers && dynamicStyles.gutterWidth(maxDigits)),
|
|
325
|
+
children: renderLines(lines, highlightSet, renderLineContent, hasLineNumbers)
|
|
309
326
|
});
|
|
310
327
|
}
|
|
311
328
|
|
|
@@ -318,7 +335,9 @@ function RangeCodeContent({
|
|
|
318
335
|
tokenLines,
|
|
319
336
|
highlightSet,
|
|
320
337
|
isWrapped,
|
|
321
|
-
sizeStyle
|
|
338
|
+
sizeStyle,
|
|
339
|
+
hasLineNumbers,
|
|
340
|
+
maxDigits
|
|
322
341
|
}) {
|
|
323
342
|
const codeRef = useRef(null);
|
|
324
343
|
useEffect(() => {
|
|
@@ -332,11 +351,15 @@ function RangeCodeContent({
|
|
|
332
351
|
}
|
|
333
352
|
return applyHighlightRangesChunked(codeEl, tokenLines);
|
|
334
353
|
}, [tokenLines]);
|
|
354
|
+
|
|
355
|
+
// Range mode keeps the line's text as a bare text node (its firstChild) so
|
|
356
|
+
// applyHighlightRangesChunked can map token offsets onto it \u2014 no wrapper. The
|
|
357
|
+
// number ::before is a pseudo-element, so it never becomes a child node here.
|
|
335
358
|
const renderLineContent = useCallback(line => line || '\u200b', []);
|
|
336
359
|
return /*#__PURE__*/_jsx("code", {
|
|
337
360
|
ref: codeRef,
|
|
338
|
-
...stylex.props(styles.code, sizeStyle, isWrapped && styles.codeWrapped),
|
|
339
|
-
children: renderLines(lines, highlightSet, renderLineContent)
|
|
361
|
+
...stylex.props(styles.code, sizeStyle, isWrapped && styles.codeWrapped, hasLineNumbers && styles.codeNumbered, hasLineNumbers && dynamicStyles.gutterWidth(maxDigits)),
|
|
362
|
+
children: renderLines(lines, highlightSet, renderLineContent, hasLineNumbers)
|
|
340
363
|
});
|
|
341
364
|
}
|
|
342
365
|
|
|
@@ -422,7 +445,8 @@ export function CodeBlock({
|
|
|
422
445
|
}
|
|
423
446
|
}, [code, onCopy, announce]);
|
|
424
447
|
const sizeStyle = size === 'sm' ? styles.sizeSm : styles.sizeMd;
|
|
425
|
-
|
|
448
|
+
// Digits in the largest line number — sizes the gutter column width.
|
|
449
|
+
const maxLineDigits = String(lines.length).length;
|
|
426
450
|
const languageLabel = hasLanguageLabel && language !== 'plaintext' ? language : null;
|
|
427
451
|
const showHeader = title != null || languageLabel != null;
|
|
428
452
|
const canCollapse = isCollapsible && lines.length >= collapsibleThreshold;
|
|
@@ -525,7 +549,7 @@ export function CodeBlock({
|
|
|
525
549
|
}, {
|
|
526
550
|
style: scrollStyle
|
|
527
551
|
}),
|
|
528
|
-
children: /*#__PURE__*/
|
|
552
|
+
children: /*#__PURE__*/_jsx("div", {
|
|
529
553
|
...{
|
|
530
554
|
0: {
|
|
531
555
|
className: "x78zum5 x1pshirs"
|
|
@@ -534,31 +558,23 @@ export function CodeBlock({
|
|
|
534
558
|
className: "x78zum5 x1pshirs x1ajqlyv"
|
|
535
559
|
}
|
|
536
560
|
}[!!(showHeader && !hasLineNumbers) << 0],
|
|
537
|
-
children:
|
|
538
|
-
...stylex.props(styles.gutter, gutterSizeStyle),
|
|
539
|
-
"aria-hidden": "true",
|
|
540
|
-
children: lines.map((_, i) =>
|
|
541
|
-
/*#__PURE__*/
|
|
542
|
-
// eslint-disable-next-line @eslint-react/no-array-index-key -- gutter line numbers are positional by definition
|
|
543
|
-
_jsx("div", {
|
|
544
|
-
...{
|
|
545
|
-
className: "x9m5x89 x17iicif"
|
|
546
|
-
},
|
|
547
|
-
children: i + 1
|
|
548
|
-
}, i))
|
|
549
|
-
}), useSpans ? /*#__PURE__*/_jsx(SpanCodeContent, {
|
|
561
|
+
children: useSpans ? /*#__PURE__*/_jsx(SpanCodeContent, {
|
|
550
562
|
lines: lines,
|
|
551
563
|
tokenLines: tokenLines,
|
|
552
564
|
highlightSet: highlightSet,
|
|
553
565
|
isWrapped: isWrapped,
|
|
554
|
-
sizeStyle: sizeStyle
|
|
566
|
+
sizeStyle: sizeStyle,
|
|
567
|
+
hasLineNumbers: hasLineNumbers,
|
|
568
|
+
maxDigits: maxLineDigits
|
|
555
569
|
}) : /*#__PURE__*/_jsx(RangeCodeContent, {
|
|
556
570
|
lines: lines,
|
|
557
571
|
tokenLines: tokenLines,
|
|
558
572
|
highlightSet: highlightSet,
|
|
559
573
|
isWrapped: isWrapped,
|
|
560
|
-
sizeStyle: sizeStyle
|
|
561
|
-
|
|
574
|
+
sizeStyle: sizeStyle,
|
|
575
|
+
hasLineNumbers: hasLineNumbers,
|
|
576
|
+
maxDigits: maxLineDigits
|
|
577
|
+
})
|
|
562
578
|
})
|
|
563
579
|
});
|
|
564
580
|
const block = /*#__PURE__*/_jsxs("pre", {
|
|
@@ -36,7 +36,10 @@ export interface EmptyStateProps extends BaseProps<HTMLDivElement> {
|
|
|
36
36
|
actions?: ReactNode;
|
|
37
37
|
/**
|
|
38
38
|
* Semantic heading level for the title element.
|
|
39
|
-
* Controls the rendered HTML tag (h1–h6)
|
|
39
|
+
* Controls only the rendered HTML tag (h1–h6) so the title fits the
|
|
40
|
+
* document outline. This is a semantic change for accessibility and does
|
|
41
|
+
* not change the visual size of the title, which stays fixed regardless
|
|
42
|
+
* of level.
|
|
40
43
|
* @default 3
|
|
41
44
|
*/
|
|
42
45
|
headingLevel?: 1 | 2 | 3 | 4 | 5 | 6;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EmptyState.d.ts","sourceRoot":"","sources":["../../src/EmptyState/EmptyState.tsx"],"names":[],"mappings":"AAEA;;;;;;;;;;;;GAYG;AAEH,OAAO,EAAC,KAAK,SAAS,EAAgB,MAAM,OAAO,CAAC;AAQpD,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,cAAc,CAAC;AA4D5C,MAAM,WAAW,eAAgB,SAAQ,SAAS,CAAC,cAAc,CAAC;IAChE,wCAAwC;IACxC,GAAG,CAAC,EAAE,KAAK,CAAC,GAAG,CAAC,cAAc,CAAC,CAAC;IAChC;;OAEG;IACH,KAAK,EAAE,MAAM,CAAC;IACd;;OAEG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB;;;OAGG;IACH,IAAI,CAAC,EAAE,SAAS,CAAC;IACjB;;;OAGG;IACH,OAAO,CAAC,EAAE,SAAS,CAAC;IACpB
|
|
1
|
+
{"version":3,"file":"EmptyState.d.ts","sourceRoot":"","sources":["../../src/EmptyState/EmptyState.tsx"],"names":[],"mappings":"AAEA;;;;;;;;;;;;GAYG;AAEH,OAAO,EAAC,KAAK,SAAS,EAAgB,MAAM,OAAO,CAAC;AAQpD,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,cAAc,CAAC;AA4D5C,MAAM,WAAW,eAAgB,SAAQ,SAAS,CAAC,cAAc,CAAC;IAChE,wCAAwC;IACxC,GAAG,CAAC,EAAE,KAAK,CAAC,GAAG,CAAC,cAAc,CAAC,CAAC;IAChC;;OAEG;IACH,KAAK,EAAE,MAAM,CAAC;IACd;;OAEG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB;;;OAGG;IACH,IAAI,CAAC,EAAE,SAAS,CAAC;IACjB;;;OAGG;IACH,OAAO,CAAC,EAAE,SAAS,CAAC;IACpB;;;;;;;OAOG;IACH,YAAY,CAAC,EAAE,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;IACrC;;;OAGG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB;AAED;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAgB,UAAU,CAAC,EACzB,KAAK,EACL,WAAW,EACX,IAAI,EACJ,OAAO,EACP,YAAgB,EAChB,SAAiB,EACjB,MAAM,EACN,SAAS,EACT,KAAK,EACL,GAAG,EACH,GAAG,KAAK,EACT,EAAE,eAAe,+BA8CjB;yBA1De,UAAU"}
|
|
@@ -116,7 +116,7 @@ export declare function generatePageRange(currentPage: number, totalPages: numbe
|
|
|
116
116
|
* />
|
|
117
117
|
* ```
|
|
118
118
|
*/
|
|
119
|
-
export declare function Pagination({ page, onChange, changeAction, totalItems, totalPages: totalPagesProp, hasMore, pageSize: pageSizeProp, pageSizeOptions, onPageSizeChange, variant, siblingCount, size, isDisabled, label, 'data-testid': testId, xstyle, className, style, ref, ...rest }: PaginationProps): import("react").JSX.Element | null;
|
|
119
|
+
export declare function Pagination({ page, onChange, changeAction, totalItems, totalPages: totalPagesProp, hasMore, pageSize: pageSizeProp, pageSizeOptions, onPageSizeChange, variant, siblingCount, size, isDisabled, label: labelFromProps, 'data-testid': testId, xstyle, className, style, ref, ...rest }: PaginationProps): import("react").JSX.Element | null;
|
|
120
120
|
export declare namespace Pagination {
|
|
121
121
|
var displayName: string;
|
|
122
122
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Pagination.d.ts","sourceRoot":"","sources":["../../src/Pagination/Pagination.tsx"],"names":[],"mappings":"AAuCA,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"Pagination.d.ts","sourceRoot":"","sources":["../../src/Pagination/Pagination.tsx"],"names":[],"mappings":"AAuCA,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,cAAc,CAAC;AAQ5C;;;;;;;;;;;;GAYG;AACH,MAAM,WAAW,oBAAoB;IACnC,KAAK,EAAE,IAAI,CAAC;IACZ,KAAK,EAAE,IAAI,CAAC;IACZ,OAAO,EAAE,IAAI,CAAC;IACd,IAAI,E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M,CAAC;CACxB;AAiGD;;;;;;;;;;GAUG;AACH,wBAAgB,iBAAiB,CAC/B,WAAW,EAAE,MAAM,EACnB,UAAU,EAAE,MAAM,EAClB,YAAY,EAAE,MAAM,GACnB,CAAC,MAAM,GAAG,KAAK,CAAC,EAAE,CA6CpB;AAMD;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,UAAU,CAAC,EACzB,IAAI,EACJ,QAAQ,EACR,YAAY,EACZ,UAAU,EACV,UAAU,EAAE,cAAc,EAC1B,OAAO,EACP,QAAQ,EAAE,YAAiB,EAC3B,eAAe,EACf,gBAAgB,EAChB,OAAiB,EACjB,YAAgB,EAChB,IAAW,EACX,UAAkB,EAClB,KAAK,EAAE,cAAc,EACrB,aAAa,EAAE,MAAM,EACrB,MAAM,EACN,SAAS,EACT,KAAK,EACL,GAAG,EACH,GAAG,IAAI,EACR,EAAE,eAAe,sCA2UjB;yBAhWe,UAAU"}
|
|
@@ -30,6 +30,7 @@ import { useAnnounce } from "../hooks/useAnnounce.js";
|
|
|
30
30
|
import { useListFocus } from "../hooks/useListFocus.js";
|
|
31
31
|
import { mergeProps } from "../utils/index.js";
|
|
32
32
|
import { themeProps } from "../utils/themeProps.js";
|
|
33
|
+
import { useTranslator } from "../i18n/useTranslator.js";
|
|
33
34
|
|
|
34
35
|
// =============================================================================
|
|
35
36
|
// Types
|
|
@@ -168,7 +169,7 @@ export function Pagination({
|
|
|
168
169
|
siblingCount = 1,
|
|
169
170
|
size = 'md',
|
|
170
171
|
isDisabled = false,
|
|
171
|
-
label
|
|
172
|
+
label: labelFromProps,
|
|
172
173
|
'data-testid': testId,
|
|
173
174
|
xstyle,
|
|
174
175
|
className,
|
|
@@ -178,6 +179,14 @@ export function Pagination({
|
|
|
178
179
|
}) {
|
|
179
180
|
const [, startTransition] = useTransition();
|
|
180
181
|
|
|
182
|
+
// Resolve system strings once per render. Prop overrides win.
|
|
183
|
+
const t = useTranslator();
|
|
184
|
+
const label = labelFromProps ?? t('@astryx.pagination.label');
|
|
185
|
+
const previousLabel = t('@astryx.pagination.previous');
|
|
186
|
+
const nextLabel = t('@astryx.pagination.next');
|
|
187
|
+
const pageIndicatorsLabel = t('@astryx.pagination.pageIndicators');
|
|
188
|
+
const itemsPerPageLabel = t('@astryx.pagination.itemsPerPage');
|
|
189
|
+
|
|
181
190
|
// pageSize is typed as number, so 0, NaN, and negatives are valid at the
|
|
182
191
|
// type level but yield Infinity/NaN page counts, and
|
|
183
192
|
// Array.from({length: Infinity}) crashes the dots variant. Coerce to a
|
|
@@ -232,7 +241,12 @@ export function Pagination({
|
|
|
232
241
|
// Keep onChange urgent so controlled page state updates in the same commit
|
|
233
242
|
// as the click; only the optimistic indicator and changeAction defer.
|
|
234
243
|
onChange(newPage);
|
|
235
|
-
announce(computedTotalPages != null ?
|
|
244
|
+
announce(computedTotalPages != null ? t('@astryx.pagination.pageOfTotal', {
|
|
245
|
+
current: newPage,
|
|
246
|
+
total: computedTotalPages
|
|
247
|
+
}) : t('@astryx.pagination.pageAnnounce', {
|
|
248
|
+
current: newPage
|
|
249
|
+
}));
|
|
236
250
|
startTransition(async () => {
|
|
237
251
|
setOptimisticPage(newPage);
|
|
238
252
|
await changeAction?.(newPage);
|
|
@@ -308,8 +322,12 @@ export function Pagination({
|
|
|
308
322
|
}
|
|
309
323
|
const isActive = item === optimisticPage;
|
|
310
324
|
return /*#__PURE__*/_jsx(Button, {
|
|
311
|
-
label:
|
|
312
|
-
|
|
325
|
+
label: t('@astryx.pagination.goToPage', {
|
|
326
|
+
page: item
|
|
327
|
+
}),
|
|
328
|
+
"aria-label": t('@astryx.pagination.goToPage', {
|
|
329
|
+
page: item
|
|
330
|
+
}),
|
|
313
331
|
variant: "ghost",
|
|
314
332
|
size: buttonSize,
|
|
315
333
|
onClick: () => handlePageChange(item),
|
|
@@ -334,7 +352,11 @@ export function Pagination({
|
|
|
334
352
|
type: "body",
|
|
335
353
|
size: "sm",
|
|
336
354
|
color: "secondary",
|
|
337
|
-
children:
|
|
355
|
+
children: t('@astryx.pagination.count', {
|
|
356
|
+
from: rangeStart,
|
|
357
|
+
to: rangeEnd,
|
|
358
|
+
total: totalItems
|
|
359
|
+
})
|
|
338
360
|
})
|
|
339
361
|
});
|
|
340
362
|
}
|
|
@@ -351,7 +373,10 @@ export function Pagination({
|
|
|
351
373
|
type: "body",
|
|
352
374
|
size: "sm",
|
|
353
375
|
color: "secondary",
|
|
354
|
-
children:
|
|
376
|
+
children: t('@astryx.pagination.pageOfTotal', {
|
|
377
|
+
current: optimisticPage,
|
|
378
|
+
total: computedTotalPages
|
|
379
|
+
})
|
|
355
380
|
})
|
|
356
381
|
});
|
|
357
382
|
}
|
|
@@ -366,7 +391,7 @@ export function Pagination({
|
|
|
366
391
|
className: "x78zum5 x6s0dn4 xzye2dw"
|
|
367
392
|
},
|
|
368
393
|
role: "group",
|
|
369
|
-
"aria-label":
|
|
394
|
+
"aria-label": pageIndicatorsLabel,
|
|
370
395
|
onKeyDown: handleDotsKeyDown,
|
|
371
396
|
onFocus: handleDotsFocus,
|
|
372
397
|
children: Array.from({
|
|
@@ -376,7 +401,9 @@ export function Pagination({
|
|
|
376
401
|
return /*#__PURE__*/_jsx("button", {
|
|
377
402
|
type: "button",
|
|
378
403
|
"data-page": i + 1,
|
|
379
|
-
"aria-label":
|
|
404
|
+
"aria-label": t('@astryx.pagination.goToPage', {
|
|
405
|
+
page: i + 1
|
|
406
|
+
}),
|
|
380
407
|
"aria-current": isActive ? 'page' : undefined
|
|
381
408
|
// The active dot is the single roving tab stop; useListFocus
|
|
382
409
|
// maintains it as focus and the active page move.
|
|
@@ -444,7 +471,7 @@ export function Pagination({
|
|
|
444
471
|
className: "x1dmp6jm"
|
|
445
472
|
},
|
|
446
473
|
children: /*#__PURE__*/_jsx(Selector, {
|
|
447
|
-
label:
|
|
474
|
+
label: itemsPerPageLabel,
|
|
448
475
|
isLabelHidden: true,
|
|
449
476
|
options: pageSizeOptions.map(opt => String(opt)),
|
|
450
477
|
value: String(pageSize),
|
|
@@ -458,7 +485,7 @@ export function Pagination({
|
|
|
458
485
|
className: "x78zum5 x6s0dn4 xzye2dw"
|
|
459
486
|
},
|
|
460
487
|
children: [/*#__PURE__*/_jsx(Button, {
|
|
461
|
-
label:
|
|
488
|
+
label: previousLabel,
|
|
462
489
|
variant: "ghost",
|
|
463
490
|
size: buttonSize,
|
|
464
491
|
icon: /*#__PURE__*/_jsx(Icon, {
|
|
@@ -469,7 +496,7 @@ export function Pagination({
|
|
|
469
496
|
isDisabled: isDisabled || !hasPrevious,
|
|
470
497
|
isIconOnly: true
|
|
471
498
|
}), renderIndicator(), /*#__PURE__*/_jsx(Button, {
|
|
472
|
-
label:
|
|
499
|
+
label: nextLabel,
|
|
473
500
|
variant: "ghost",
|
|
474
501
|
size: buttonSize,
|
|
475
502
|
icon: /*#__PURE__*/_jsx(Icon, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Switch.d.ts","sourceRoot":"","sources":["../../src/Switch/Switch.tsx"],"names":[],"mappings":"AAIA;;;;;;;;;;;;GAYG;AAEH,OAAO,EAIL,KAAK,WAAW,EAChB,KAAK,UAAU,EACf,KAAK,SAAS,EACf,MAAM,OAAO,CAAC;AAaf,OAAO,KAAK,EAAC,QAAQ,EAAC,MAAM,SAAS,CAAC;AACtC,OAAO,KAAK,EAAC,WAAW,EAAC,MAAM,gBAAgB,CAAC;AAKhD,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,cAAc,CAAC;AAC5C,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,gBAAgB,CAAC;AA4I9C,MAAM,MAAM,mBAAmB,GAAG,OAAO,GAAG,KAAK,CAAC;AAElD,MAAM,MAAM,kBAAkB,GAC1B,KAAK,GACL,QAAQ;AACV,uCAAuC;GACrC,SAAS,CAAC;AAEd,MAAM,WAAW,WAAY,SAAQ,IAAI,CAAC,SAAS,EAAE,UAAU,CAAC;IAC9D,wCAAwC;IACxC,GAAG,CAAC,EAAE,KAA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AM,CAAC,EAAE,WAAW,CAAC;CACtB;AAOD;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,MAAM,CAAC,EACrB,KAAK,EACL,aAAqB,EACrB,WAAW,EACX,QAAQ,EACR,YAAY,EACZ,SAAiB,EACjB,KAAK,EACL,UAAkB,EAClB,QAAQ,EACR,eAAe,EACf,UAAkB,EAClB,UAAkB,EAClB,OAAO,EACP,MAAM,EACN,SAAS,EACT,YAAY,EACZ,aAAqB,EACrB,YAAoB,EACpB,MAAM,EACN,KAAK,EACL,MAAM,EACN,SAAS,EACT,KAAK,EACL,GAAG,EACH,GAAG,IAAI,EACR,EAAE,WAAW,+BA0Lb;yBApNe,MAAM"}
|
package/dist/Switch/Switch.js
CHANGED
|
@@ -133,9 +133,11 @@ export function Switch({
|
|
|
133
133
|
});
|
|
134
134
|
|
|
135
135
|
// Build aria-describedby from description and status message
|
|
136
|
-
// Only include descriptionID when the element actually renders
|
|
136
|
+
// Only include descriptionID when the element actually renders.
|
|
137
|
+
// FieldLabel renders the description (with descriptionID) even when the
|
|
138
|
+
// label is visually hidden — it's sr-only, so keep it linked.
|
|
137
139
|
const describedByParts = [];
|
|
138
|
-
if (description
|
|
140
|
+
if (description) {
|
|
139
141
|
describedByParts.push(descriptionID);
|
|
140
142
|
}
|
|
141
143
|
if (status?.message) {
|
|
@@ -52,7 +52,7 @@ export interface UseTableGroupedRowsResult<T extends Record<string, unknown>> {
|
|
|
52
52
|
* pass all three to `<Table>`.
|
|
53
53
|
*
|
|
54
54
|
* @example
|
|
55
|
-
* ```
|
|
55
|
+
* ```
|
|
56
56
|
* const [collapsed, setCollapsed] = useState<Set<string>>(new Set());
|
|
57
57
|
* const grouped = useTableGroupedRows({
|
|
58
58
|
* data: rows,
|
|
@@ -41,7 +41,7 @@ export interface UseTableRowIndexConfig<T extends Record<string, unknown>> {
|
|
|
41
41
|
* so it reflects the current sort / filter / pagination view.
|
|
42
42
|
*
|
|
43
43
|
* @example
|
|
44
|
-
* ```
|
|
44
|
+
* ```
|
|
45
45
|
* const rowIndex = useTableRowIndex({data});
|
|
46
46
|
* <Table data={data} columns={columns} idKey="id" plugins={{rowIndex}} />;
|
|
47
47
|
* ```
|
|
@@ -37,7 +37,7 @@ const INDEX_COLUMN_WIDTH = {
|
|
|
37
37
|
* so it reflects the current sort / filter / pagination view.
|
|
38
38
|
*
|
|
39
39
|
* @example
|
|
40
|
-
* ```
|
|
40
|
+
* ```
|
|
41
41
|
* const rowIndex = useTableRowIndex({data});
|
|
42
42
|
* <Table data={data} columns={columns} idKey="id" plugins={{rowIndex}} />;
|
|
43
43
|
* ```
|