@astryxdesign/core 0.7.6-canary.d34e843 → 0.7.6-canary.d3a0f46
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/Field/index.d.ts +3 -1
- package/dist/Field/index.d.ts.map +1 -1
- package/dist/Field/index.js +2 -1
- package/dist/Field/textEntryTraits.d.ts +86 -0
- package/dist/Field/textEntryTraits.d.ts.map +1 -0
- package/dist/Field/textEntryTraits.js +81 -0
- package/dist/NavMenu/NavHeadingMenuItem.d.ts.map +1 -1
- package/dist/NavMenu/NavHeadingMenuItem.js +2 -1
- package/dist/Stack/Stack.d.ts +1 -1
- package/dist/Stack/stack.stylex.d.ts +1 -1
- package/dist/Stack/stack.stylex.js +1 -1
- package/dist/TextArea/TextArea.d.ts +5 -3
- package/dist/TextArea/TextArea.d.ts.map +1 -1
- package/dist/TextArea/TextArea.js +14 -3
- package/dist/TextInput/TextInput.d.ts +20 -6
- package/dist/TextInput/TextInput.d.ts.map +1 -1
- package/dist/TextInput/TextInput.js +24 -2
- package/dist/TopNav/TopNav.d.ts.map +1 -1
- package/dist/TopNav/TopNav.js +14 -10
- package/dist/TopNav/TopNavHeading.d.ts.map +1 -1
- package/dist/TopNav/TopNavHeading.js +9 -8
- package/dist/TopNav/TopNavMegaMenuItem.d.ts.map +1 -1
- package/dist/TopNav/TopNavMegaMenuItem.js +3 -2
- package/dist/TopNav/TopNavMenu.d.ts.map +1 -1
- package/dist/TopNav/TopNavMenu.js +2 -1
- package/package.json +4 -4
- package/src/Field/index.ts +3 -1
- package/src/Field/textEntryTraits.ts +116 -0
- package/src/NavMenu/NavHeadingMenuItem.tsx +2 -1
- package/src/Stack/Stack.doc.mjs +59 -2
- package/src/Stack/Stack.tsx +1 -1
- package/src/Stack/stack.stylex.ts +1 -1
- package/src/TextArea/TextArea.doc.mjs +65 -1
- package/src/TextArea/TextArea.tsx +20 -5
- package/src/TextInput/TextInput.doc.mjs +70 -6
- package/src/TextInput/TextInput.tsx +39 -8
- package/src/TopNav/TopNav.tsx +16 -11
- package/src/TopNav/TopNavHeading.tsx +15 -8
- package/src/TopNav/TopNavMegaMenuItem.tsx +7 -2
- package/src/TopNav/TopNavMenu.tsx +2 -1
package/dist/Field/index.d.ts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @file index.ts
|
|
3
3
|
* @input Imports Field component and types from Field.tsx, FieldLabel from FieldLabel.tsx, FieldStatus from FieldStatus.tsx
|
|
4
|
-
* @output Exports Field, FieldProps, FieldStatusInput, FieldStatusType, FieldLabel, FieldLabelProps, FieldStatus component
|
|
4
|
+
* @output Exports Field, FieldProps, FieldStatusInput, FieldStatusType, FieldLabel, FieldLabelProps, FieldStatus component,
|
|
5
|
+
* and the shared input types (including the text-entry keyboard trait types)
|
|
5
6
|
* @position Component entry point; re-exported by /packages/core/src/index.ts
|
|
6
7
|
*
|
|
7
8
|
* SYNC: When modified, update this header and /packages/core/src/Field/Field.doc.mjs
|
|
@@ -15,6 +16,7 @@ export type { FieldStatusProps, FieldStatusVariant, FieldStatusVariantMap, } fro
|
|
|
15
16
|
export type { FieldStatusPlacement } from './fieldStatusPlacement.js';
|
|
16
17
|
export type { InputStatus, InputStatusType, InputSize } from './types.js';
|
|
17
18
|
export type { FieldInputBaseProps, FieldContainerStyleProps, FieldControlStyleProps, FieldPartStyleProps, } from './fieldParts.js';
|
|
19
|
+
export type { AutoCapitalize, EnterKeyHint, InputMode } from './textEntryTraits.js';
|
|
18
20
|
export { inputWrapperStyles, inputStatusBorderStyles, inputStatusHoverShadowStyles, inputStatusFocusWithinStyles, inputStatusFocusStyles, } from './inputStyles.stylex.js';
|
|
19
21
|
export { InputClearButton } from './InputClearButton.js';
|
|
20
22
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/Field/index.ts"],"names":[],"mappings":"AAIA
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/Field/index.ts"],"names":[],"mappings":"AAIA;;;;;;;;GAQG;AAEH,OAAO,EAAC,KAAK,EAAC,MAAM,SAAS,CAAC;AAC9B,YAAY,EAAC,UAAU,EAAE,gBAAgB,EAAE,eAAe,EAAC,MAAM,SAAS,CAAC;AAC3E,OAAO,EAAC,UAAU,EAAC,MAAM,cAAc,CAAC;AACxC,YAAY,EAAC,eAAe,EAAC,MAAM,cAAc,CAAC;AAClD,OAAO,EAAC,WAAW,EAAC,MAAM,gBAAgB,CAAC;AAC3C,YAAY,EACV,gBAAgB,EAChB,kBAAkB,EAClB,qBAAqB,GACtB,MAAM,gBAAgB,CAAC;AACxB,YAAY,EAAC,oBAAoB,EAAC,MAAM,wBAAwB,CAAC;AAGjE,YAAY,EAAC,WAAW,EAAE,eAAe,EAAE,SAAS,EAAC,MAAM,SAAS,CAAC;AACrE,YAAY,EACV,mBAAmB,EACnB,wBAAwB,EACxB,sBAAsB,EACtB,mBAAmB,GACpB,MAAM,cAAc,CAAC;AACtB,YAAY,EAAC,cAAc,EAAE,YAAY,EAAE,SAAS,EAAC,MAAM,mBAAmB,CAAC;AAG/E,OAAO,EACL,kBAAkB,EAClB,uBAAuB,EACvB,4BAA4B,EAC5B,4BAA4B,EAC5B,sBAAsB,GACvB,MAAM,sBAAsB,CAAC;AAG9B,OAAO,EAAC,gBAAgB,EAAC,MAAM,oBAAoB,CAAC"}
|
package/dist/Field/index.js
CHANGED
|
@@ -5,7 +5,8 @@
|
|
|
5
5
|
/**
|
|
6
6
|
* @file index.ts
|
|
7
7
|
* @input Imports Field component and types from Field.tsx, FieldLabel from FieldLabel.tsx, FieldStatus from FieldStatus.tsx
|
|
8
|
-
* @output Exports Field, FieldProps, FieldStatusInput, FieldStatusType, FieldLabel, FieldLabelProps, FieldStatus component
|
|
8
|
+
* @output Exports Field, FieldProps, FieldStatusInput, FieldStatusType, FieldLabel, FieldLabelProps, FieldStatus component,
|
|
9
|
+
* and the shared input types (including the text-entry keyboard trait types)
|
|
9
10
|
* @position Component entry point; re-exported by /packages/core/src/index.ts
|
|
10
11
|
*
|
|
11
12
|
* SYNC: When modified, update this header and /packages/core/src/Field/Field.doc.mjs
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file textEntryTraits.ts
|
|
3
|
+
* @input The keyboard-trait props a text field accepts
|
|
4
|
+
* @output Exports the closed value unions EnterKeyHint, InputMode and
|
|
5
|
+
* AutoCapitalize (the package entry exports these three), the fields' prop
|
|
6
|
+
* mixin TextEntryTraitProps, and textEntryTraitAttributes, which maps the
|
|
7
|
+
* props onto the native attributes of the editable element
|
|
8
|
+
* @position Shared by TextInput and TextArea: the one place that says how a
|
|
9
|
+
* field tells a touch keyboard what it holds
|
|
10
|
+
*
|
|
11
|
+
* SYNC: When modified, update:
|
|
12
|
+
* - /packages/core/src/TextInput/TextInput.tsx and TextInput.doc.mjs
|
|
13
|
+
* - /packages/core/src/TextArea/TextArea.tsx and TextArea.doc.mjs
|
|
14
|
+
* - /packages/core/src/Field/index.ts (type exports)
|
|
15
|
+
*/
|
|
16
|
+
/**
|
|
17
|
+
* What the Return key of a touch keyboard says. iOS gives `done`, `go`,
|
|
18
|
+
* `next`, `search` and `send` their own key (a glyph on iOS 26: a checkmark,
|
|
19
|
+
* an arrow, a chevron, a magnifier, an up arrow); `enter` and `previous` keep
|
|
20
|
+
* the plain Return key. Chrome on Android (Gboard) gives every value its own
|
|
21
|
+
* key; with no hint, a single-line field's key reads Next while another field
|
|
22
|
+
* follows and a multi-line field's keeps Return, and a `type="url"` field
|
|
23
|
+
* shows Next instead of `go` while another field follows.
|
|
24
|
+
*/
|
|
25
|
+
export type EnterKeyHint = 'enter' | 'done' | 'go' | 'next' | 'previous' | 'search' | 'send';
|
|
26
|
+
/**
|
|
27
|
+
* Which touch keyboard a field asks for, by the HTML standard's `inputmode`
|
|
28
|
+
* values. `numeric` brings up the number pad, and on iOS `search` brings up
|
|
29
|
+
* the web-search keyboard (a period key and a Go key, whatever
|
|
30
|
+
* `enterKeyHint` says).
|
|
31
|
+
*/
|
|
32
|
+
export type InputMode = 'none' | 'text' | 'tel' | 'url' | 'email' | 'numeric' | 'decimal' | 'search';
|
|
33
|
+
/**
|
|
34
|
+
* When a touch keyboard capitalizes as you type: `off` and `none` never,
|
|
35
|
+
* `on` and `sentences` at the start of each sentence (the HTML standard names
|
|
36
|
+
* each of these two states twice), `words` at the start of each word, and
|
|
37
|
+
* `characters` every letter.
|
|
38
|
+
*/
|
|
39
|
+
export type AutoCapitalize = 'off' | 'none' | 'on' | 'sentences' | 'words' | 'characters';
|
|
40
|
+
/**
|
|
41
|
+
* Keyboard traits of a text field: a prop mixin for TextInput and TextArea,
|
|
42
|
+
* not a component's props. A touch keyboard reads these traits from the
|
|
43
|
+
* focused element. An absent prop renders no attribute, so the browser keeps
|
|
44
|
+
* its own default (on iOS a field capitalizes sentences, except a URL field).
|
|
45
|
+
*/
|
|
46
|
+
export interface TextEntryTraitProps {
|
|
47
|
+
/**
|
|
48
|
+
* What the Return key of a touch keyboard says (the native `enterkeyhint`).
|
|
49
|
+
* It only labels the key: what Enter does stays with the field's own
|
|
50
|
+
* handlers.
|
|
51
|
+
*/
|
|
52
|
+
enterKeyHint?: EnterKeyHint;
|
|
53
|
+
/**
|
|
54
|
+
* Which touch keyboard the field asks for (the native `inputmode`),
|
|
55
|
+
* without changing what the field accepts.
|
|
56
|
+
*/
|
|
57
|
+
inputMode?: InputMode;
|
|
58
|
+
/**
|
|
59
|
+
* When a touch keyboard capitalizes as you type (the native
|
|
60
|
+
* `autocapitalize`).
|
|
61
|
+
*/
|
|
62
|
+
autoCapitalize?: AutoCapitalize;
|
|
63
|
+
/**
|
|
64
|
+
* Whether a touch keyboard corrects words as you type (the native
|
|
65
|
+
* `autocorrect`).
|
|
66
|
+
*/
|
|
67
|
+
hasAutoCorrect?: boolean;
|
|
68
|
+
}
|
|
69
|
+
/** The native attributes the traits render as. */
|
|
70
|
+
export interface TextEntryTraitAttributes {
|
|
71
|
+
enterKeyHint?: EnterKeyHint;
|
|
72
|
+
inputMode?: InputMode;
|
|
73
|
+
autoCapitalize?: AutoCapitalize;
|
|
74
|
+
autoCorrect?: 'on' | 'off';
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* Maps keyboard-trait props onto the native attributes for the editable
|
|
78
|
+
* element. Absent props produce no attribute.
|
|
79
|
+
*
|
|
80
|
+
* @example
|
|
81
|
+
* ```
|
|
82
|
+
* <input {...textEntryTraitAttributes({enterKeyHint: 'search', hasAutoCorrect: false})} />
|
|
83
|
+
* ```
|
|
84
|
+
*/
|
|
85
|
+
export declare function textEntryTraitAttributes({ enterKeyHint, inputMode, autoCapitalize, hasAutoCorrect, }: TextEntryTraitProps): TextEntryTraitAttributes;
|
|
86
|
+
//# sourceMappingURL=textEntryTraits.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"textEntryTraits.d.ts","sourceRoot":"","sources":["../../src/Field/textEntryTraits.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;GAcG;AAEH;;;;;;;;GAQG;AACH,MAAM,MAAM,YAAY,GACtB,OAAO,GAAG,MAAM,GAAG,IAAI,GAAG,MAAM,GAAG,UAAU,GAAG,QAAQ,GAAG,MAAM,CAAC;AAEpE;;;;;GAKG;AACH,MAAM,MAAM,SAAS,GACnB,MAAM,GAAG,MAAM,GAAG,KAAK,GAAG,KAAK,GAAG,OAAO,GAAG,SAAS,GAAG,SAAS,GAAG,QAAQ,CAAC;AAE/E;;;;;GAKG;AACH,MAAM,MAAM,cAAc,GACxB,KAAK,GAAG,MAAM,GAAG,IAAI,GAAG,WAAW,GAAG,OAAO,GAAG,YAAY,CAAC;AAE/D;;;;;GAKG;AACH,MAAM,WAAW,mBAAmB;IAClC;;;;OAIG;IACH,YAAY,CAAC,EAAE,YAAY,CAAC;IAC5B;;;OAGG;IACH,SAAS,CAAC,EAAE,SAAS,CAAC;IACtB;;;OAGG;IACH,cAAc,CAAC,EAAE,cAAc,CAAC;IAChC;;;OAGG;IACH,cAAc,CAAC,EAAE,OAAO,CAAC;CAC1B;AAED,kDAAkD;AAClD,MAAM,WAAW,wBAAwB;IACvC,YAAY,CAAC,EAAE,YAAY,CAAC;IAC5B,SAAS,CAAC,EAAE,SAAS,CAAC;IACtB,cAAc,CAAC,EAAE,cAAc,CAAC;IAChC,WAAW,CAAC,EAAE,IAAI,GAAG,KAAK,CAAC;CAC5B;AAED;;;;;;;;GAQG;AACH,wBAAgB,wBAAwB,CAAC,EACvC,YAAY,EACZ,SAAS,EACT,cAAc,EACd,cAAc,GACf,EAAE,mBAAmB,GAAG,wBAAwB,CAehD"}
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
// Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* @file textEntryTraits.ts
|
|
5
|
+
* @input The keyboard-trait props a text field accepts
|
|
6
|
+
* @output Exports the closed value unions EnterKeyHint, InputMode and
|
|
7
|
+
* AutoCapitalize (the package entry exports these three), the fields' prop
|
|
8
|
+
* mixin TextEntryTraitProps, and textEntryTraitAttributes, which maps the
|
|
9
|
+
* props onto the native attributes of the editable element
|
|
10
|
+
* @position Shared by TextInput and TextArea: the one place that says how a
|
|
11
|
+
* field tells a touch keyboard what it holds
|
|
12
|
+
*
|
|
13
|
+
* SYNC: When modified, update:
|
|
14
|
+
* - /packages/core/src/TextInput/TextInput.tsx and TextInput.doc.mjs
|
|
15
|
+
* - /packages/core/src/TextArea/TextArea.tsx and TextArea.doc.mjs
|
|
16
|
+
* - /packages/core/src/Field/index.ts (type exports)
|
|
17
|
+
*/
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* What the Return key of a touch keyboard says. iOS gives `done`, `go`,
|
|
21
|
+
* `next`, `search` and `send` their own key (a glyph on iOS 26: a checkmark,
|
|
22
|
+
* an arrow, a chevron, a magnifier, an up arrow); `enter` and `previous` keep
|
|
23
|
+
* the plain Return key. Chrome on Android (Gboard) gives every value its own
|
|
24
|
+
* key; with no hint, a single-line field's key reads Next while another field
|
|
25
|
+
* follows and a multi-line field's keeps Return, and a `type="url"` field
|
|
26
|
+
* shows Next instead of `go` while another field follows.
|
|
27
|
+
*/
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* Which touch keyboard a field asks for, by the HTML standard's `inputmode`
|
|
31
|
+
* values. `numeric` brings up the number pad, and on iOS `search` brings up
|
|
32
|
+
* the web-search keyboard (a period key and a Go key, whatever
|
|
33
|
+
* `enterKeyHint` says).
|
|
34
|
+
*/
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* When a touch keyboard capitalizes as you type: `off` and `none` never,
|
|
38
|
+
* `on` and `sentences` at the start of each sentence (the HTML standard names
|
|
39
|
+
* each of these two states twice), `words` at the start of each word, and
|
|
40
|
+
* `characters` every letter.
|
|
41
|
+
*/
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* Keyboard traits of a text field: a prop mixin for TextInput and TextArea,
|
|
45
|
+
* not a component's props. A touch keyboard reads these traits from the
|
|
46
|
+
* focused element. An absent prop renders no attribute, so the browser keeps
|
|
47
|
+
* its own default (on iOS a field capitalizes sentences, except a URL field).
|
|
48
|
+
*/
|
|
49
|
+
|
|
50
|
+
/** The native attributes the traits render as. */
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* Maps keyboard-trait props onto the native attributes for the editable
|
|
54
|
+
* element. Absent props produce no attribute.
|
|
55
|
+
*
|
|
56
|
+
* @example
|
|
57
|
+
* ```
|
|
58
|
+
* <input {...textEntryTraitAttributes({enterKeyHint: 'search', hasAutoCorrect: false})} />
|
|
59
|
+
* ```
|
|
60
|
+
*/
|
|
61
|
+
export function textEntryTraitAttributes({
|
|
62
|
+
enterKeyHint,
|
|
63
|
+
inputMode,
|
|
64
|
+
autoCapitalize,
|
|
65
|
+
hasAutoCorrect
|
|
66
|
+
}) {
|
|
67
|
+
const attributes = {};
|
|
68
|
+
if (enterKeyHint != null) {
|
|
69
|
+
attributes.enterKeyHint = enterKeyHint;
|
|
70
|
+
}
|
|
71
|
+
if (inputMode != null) {
|
|
72
|
+
attributes.inputMode = inputMode;
|
|
73
|
+
}
|
|
74
|
+
if (autoCapitalize != null) {
|
|
75
|
+
attributes.autoCapitalize = autoCapitalize;
|
|
76
|
+
}
|
|
77
|
+
if (hasAutoCorrect != null) {
|
|
78
|
+
attributes.autoCorrect = hasAutoCorrect ? 'on' : 'off';
|
|
79
|
+
}
|
|
80
|
+
return attributes;
|
|
81
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NavHeadingMenuItem.d.ts","sourceRoot":"","sources":["../../src/NavMenu/NavHeadingMenuItem.tsx"],"names":[],"mappings":"AAIA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EAAE,EAAc,KAAK,SAAS,EAAC,MAAM,OAAO,CAAC;AAEzD,OAAO,EAAiB,KAAK,QAAQ,EAAC,MAAM,SAAS,CAAC;AAWtD,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"NavHeadingMenuItem.d.ts","sourceRoot":"","sources":["../../src/NavMenu/NavHeadingMenuItem.tsx"],"names":[],"mappings":"AAIA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EAAE,EAAc,KAAK,SAAS,EAAC,MAAM,OAAO,CAAC;AAEzD,OAAO,EAAiB,KAAK,QAAQ,EAAC,MAAM,SAAS,CAAC;AAWtD,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,cAAc,CAAC;AAgE5C,MAAM,WAAW,uBAAwB,SAAQ,IAAI,CACnD,SAAS,CAAC,WAAW,CAAC,EACtB,SAAS,CACV;IACC,GAAG,CAAC,EAAE,KAAK,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC;IAC7B,wCAAwC;IACxC,IAAI,CAAC,EAAE,SAAS,GAAG,QAAQ,CAAC;IAC5B,0BAA0B;IAC1B,KAAK,EAAE,SAAS,CAAC;IACjB,4DAA4D;IAC5D,WAAW,CAAC,EAAE,SAAS,CAAC;IACxB,sEAAsE;IACtE,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,0CAA0C;IAC1C,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB,mDAAmD;IACnD,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,kBAAkB,CAAC,EACjC,GAAG,EACH,IAAI,EACJ,KAAK,EACL,WAAW,EACX,IAAI,EACJ,OAAO,EACP,UAAkB,EAClB,MAAM,EACN,SAAS,EACT,KAAK,EACL,aAAa,EAAE,MAAM,EACrB,GAAG,SAAS,EACb,EAAE,uBAAuB,qBAqEzB;yBAlFe,kBAAkB"}
|
|
@@ -22,6 +22,7 @@ import { useFocusAcrossSwap } from "../utils/useFocusAcrossSwap.js";
|
|
|
22
22
|
import { useNavHeadingMenuContext } from "./NavMenuContext.js";
|
|
23
23
|
import { useLinkComponent } from "../Link/useLinkComponent.js";
|
|
24
24
|
import { themeProps } from "../utils/themeProps.js";
|
|
25
|
+
import { isRenderable } from "../utils/isRenderable.js";
|
|
25
26
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
26
27
|
const styles = {
|
|
27
28
|
root: {
|
|
@@ -148,7 +149,7 @@ export function NavHeadingMenuItem({
|
|
|
148
149
|
type: "body",
|
|
149
150
|
maxLines: 1,
|
|
150
151
|
children: label
|
|
151
|
-
}) : label, description && /*#__PURE__*/_jsx(Text, {
|
|
152
|
+
}) : label, isRenderable(description) && /*#__PURE__*/_jsx(Text, {
|
|
152
153
|
type: "supporting",
|
|
153
154
|
maxLines: 1,
|
|
154
155
|
children: description
|
package/dist/Stack/Stack.d.ts
CHANGED
|
@@ -29,7 +29,7 @@ export interface StackProps extends BaseProps<HTMLElement> {
|
|
|
29
29
|
ref?: React.Ref<HTMLElement>;
|
|
30
30
|
/**
|
|
31
31
|
* Direction of the stack layout.
|
|
32
|
-
* - `horizontal`: Items flow
|
|
32
|
+
* - `horizontal`: Items flow along the inline axis, right to left in RTL (like HStack)
|
|
33
33
|
* - `vertical`: Items flow top-to-bottom (like VStack)
|
|
34
34
|
* @default 'vertical'
|
|
35
35
|
*/
|
|
@@ -64,7 +64,7 @@ declare const directionStyles: Readonly<{
|
|
|
64
64
|
}>;
|
|
65
65
|
/**
|
|
66
66
|
* Stack direction.
|
|
67
|
-
* - `horizontal`: Items flow
|
|
67
|
+
* - `horizontal`: Items flow along the inline axis, right to left in RTL (HStack)
|
|
68
68
|
* - `vertical`: Items flow top-to-bottom (VStack)
|
|
69
69
|
*/
|
|
70
70
|
export type StackDirection = keyof typeof directionStyles;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @file TextArea.tsx
|
|
3
|
-
* @input Uses React, useId, ChangeEvent, ClipboardEvent, FocusEvent, Field, Icon, Spinner
|
|
3
|
+
* @input Uses React, useId, ChangeEvent, ClipboardEvent, FocusEvent, Field, Icon, Spinner,
|
|
4
|
+
* textEntryTraits (the touch-keyboard trait props)
|
|
4
5
|
* @output Exports TextArea component, TextAreaProps, TextAreaStatus, TextAreaStatusType
|
|
5
6
|
* @position Core implementation; consumed by index.ts, tested by TextArea.test.tsx
|
|
6
7
|
*
|
|
@@ -15,6 +16,7 @@ import { type ChangeEvent, type ClipboardEvent, type FocusEvent, type ReactNode
|
|
|
15
16
|
import { type IconType } from '../Icon/index.js';
|
|
16
17
|
import { type FieldInputBaseProps } from '../Field/fieldParts.js';
|
|
17
18
|
import type { SizeValue } from '../utils/types.js';
|
|
19
|
+
import { type TextEntryTraitProps } from '../Field/textEntryTraits.js';
|
|
18
20
|
import type { FieldStatusPlacement } from '../Field/fieldStatusPlacement.js';
|
|
19
21
|
export type TextAreaStatusType = 'warning' | 'error' | 'success';
|
|
20
22
|
export type TextAreaSize = 'sm' | 'md' | 'lg';
|
|
@@ -28,7 +30,7 @@ export interface TextAreaStatus {
|
|
|
28
30
|
*/
|
|
29
31
|
message?: string;
|
|
30
32
|
}
|
|
31
|
-
export interface TextAreaProps extends Omit<FieldInputBaseProps, 'onChange' | 'defaultValue'
|
|
33
|
+
export interface TextAreaProps extends Omit<FieldInputBaseProps, 'onChange' | 'defaultValue'>, TextEntryTraitProps {
|
|
32
34
|
/** Ref forwarded to the root element */
|
|
33
35
|
ref?: React.Ref<HTMLTextAreaElement>;
|
|
34
36
|
/**
|
|
@@ -201,7 +203,7 @@ export interface TextAreaProps extends Omit<FieldInputBaseProps, 'onChange' | 'd
|
|
|
201
203
|
* <TextArea label="Notes" rows={5} value={notes} onChange={setNotes} />
|
|
202
204
|
* ```
|
|
203
205
|
*/
|
|
204
|
-
export declare function TextArea({ label, isLabelHidden, description, isOptional, isRequired, onChange, changeAction, isLoading, value, placeholder, rows, isDisabled, isReadOnly, disabledMessage, status, statusVariant, labelTooltip, startIcon, hasSpellCheck, onPaste, maxLength, hasAutoFocus, size: sizeProp, htmlName, onFocus, onBlur, width, containerXstyle, containerClassName, containerStyle, controlXstyle, controlClassName, controlStyle, ref, id: idProp, 'aria-describedby': ariaDescribedByProp, 'aria-labelledby': ariaLabelledByProp, ...restProps }: TextAreaProps): import("react").JSX.Element;
|
|
206
|
+
export declare function TextArea({ label, isLabelHidden, description, isOptional, isRequired, onChange, changeAction, isLoading, value, placeholder, rows, isDisabled, isReadOnly, disabledMessage, status, statusVariant, labelTooltip, startIcon, hasSpellCheck, enterKeyHint, inputMode, autoCapitalize, hasAutoCorrect, onPaste, maxLength, hasAutoFocus, size: sizeProp, htmlName, onFocus, onBlur, width, containerXstyle, containerClassName, containerStyle, controlXstyle, controlClassName, controlStyle, ref, id: idProp, 'aria-describedby': ariaDescribedByProp, 'aria-labelledby': ariaLabelledByProp, ...restProps }: TextAreaProps): import("react").JSX.Element;
|
|
205
207
|
export declare namespace TextArea {
|
|
206
208
|
var displayName: string;
|
|
207
209
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TextArea.d.ts","sourceRoot":"","sources":["../../src/TextArea/TextArea.tsx"],"names":[],"mappings":"AAIA
|
|
1
|
+
{"version":3,"file":"TextArea.d.ts","sourceRoot":"","sources":["../../src/TextArea/TextArea.tsx"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;GAaG;AAEH,OAAO,EAOL,KAAK,WAAW,EAChB,KAAK,cAAc,EACnB,KAAK,UAAU,EACf,KAAK,SAAS,EACf,MAAM,OAAO,CAAC;AAef,OAAO,EAAuB,KAAK,QAAQ,EAAC,MAAM,SAAS,CAAC;AAO5D,OAAO,EACL,KAAK,mBAAmB,EAEzB,MAAM,qBAAqB,CAAC;AAE7B,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,gBAAgB,CAAC;AAQ9C,OAAO,EAEL,KAAK,mBAAmB,EACzB,MAAM,0BAA0B,CAAC;AAIlC,OAAO,KAAK,EAAC,oBAAoB,EAAC,MAAM,+BAA+B,CAAC;AAgIxE,MAAM,MAAM,kBAAkB,GAAG,SAAS,GAAG,OAAO,GAAG,SAAS,CAAC;AAEjE,MAAM,MAAM,YAAY,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC;AAE9C,MAAM,WAAW,cAAc;IAC7B;;OAEG;IACH,IAAI,EAAE,kBAAkB,CAAC;IACzB;;OAEG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,WAAW,aACf,SACE,IAAI,CAAC,mBAAmB,EAAE,UAAU,GAAG,cAAc,CAAC,EACtD,mBAAmB;IACrB,wCAAwC;IACxC,GAAG,CAAC,EAAE,KAAK,CAAC,GAAG,CAAC,mBAAmB,CAAC,CAAC;IACrC;;OAEG;IACH,KAAK,EAAE,MAAM,CAAC;IACd;;;OAGG;IACH,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB;;OAEG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IACr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inner
|
|
7
|
+
* @input Uses React, useId, ChangeEvent, ClipboardEvent, FocusEvent, Field, Icon, Spinner,
|
|
8
|
+
* textEntryTraits (the touch-keyboard trait props)
|
|
8
9
|
* @output Exports TextArea component, TextAreaProps, TextAreaStatus, TextAreaStatusType
|
|
9
10
|
* @position Core implementation; consumed by index.ts, tested by TextArea.test.tsx
|
|
10
11
|
*
|
|
@@ -35,6 +36,7 @@ import { useResolvedRequired } from "../hooks/useResolvedRequired.js";
|
|
|
35
36
|
import { useSize } from "../SizeContext/SizeContext.js";
|
|
36
37
|
import { themeProps } from "../utils/themeProps.js";
|
|
37
38
|
import { characterCount } from "../utils/characters.js";
|
|
39
|
+
import { textEntryTraitAttributes } from "../Field/textEntryTraits.js";
|
|
38
40
|
import { useMergedRefs } from "../hooks/useMergedRefs.js";
|
|
39
41
|
import { useBusyAnnouncement } from "../hooks/useBusyAnnouncement.js";
|
|
40
42
|
import { registerEnglishFallback, useComponentTranslator } from "../i18n/useComponentTranslator.js";
|
|
@@ -132,6 +134,10 @@ export function TextArea({
|
|
|
132
134
|
labelTooltip,
|
|
133
135
|
startIcon,
|
|
134
136
|
hasSpellCheck = true,
|
|
137
|
+
enterKeyHint,
|
|
138
|
+
inputMode,
|
|
139
|
+
autoCapitalize,
|
|
140
|
+
hasAutoCorrect,
|
|
135
141
|
onPaste,
|
|
136
142
|
maxLength,
|
|
137
143
|
hasAutoFocus = false,
|
|
@@ -331,12 +337,17 @@ export function TextArea({
|
|
|
331
337
|
onFocus: onFocus,
|
|
332
338
|
onBlur: onBlur,
|
|
333
339
|
placeholder: placeholder,
|
|
334
|
-
rows: rows
|
|
340
|
+
rows: rows,
|
|
341
|
+
...textEntryTraitAttributes({
|
|
342
|
+
enterKeyHint,
|
|
343
|
+
inputMode,
|
|
344
|
+
autoCapitalize,
|
|
345
|
+
hasAutoCorrect
|
|
346
|
+
}),
|
|
335
347
|
// A disabled textarea keeps its place in the tab order
|
|
336
348
|
// (spec:AST-085): aria-disabled instead of the native attribute,
|
|
337
349
|
// with readOnly + the handleChange guard keeping the value from
|
|
338
350
|
// changing.
|
|
339
|
-
,
|
|
340
351
|
"aria-disabled": isDisabled ? 'true' : undefined,
|
|
341
352
|
readOnly: isReadOnly || isDisabled || undefined,
|
|
342
353
|
spellCheck: hasSpellCheck,
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @file TextInput.tsx
|
|
3
|
-
* @input Uses React, useId, ChangeEvent, Field, Icon, InputGroupContext
|
|
4
|
-
*
|
|
3
|
+
* @input Uses React, useId, ChangeEvent, Field, Icon, InputGroupContext,
|
|
4
|
+
* textEntryTraits (the touch-keyboard trait props)
|
|
5
|
+
* @output Exports TextInput component, TextInputProps, TextInputType
|
|
5
6
|
* @position Core implementation; consumed by index.ts, tested by TextInput.test.tsx
|
|
6
7
|
*
|
|
7
8
|
* SYNC: When modified, update these files to stay in sync:
|
|
@@ -15,6 +16,7 @@ import { type ChangeEvent, type KeyboardEvent, type ReactNode } from 'react';
|
|
|
15
16
|
import * as stylex from '@stylexjs/stylex';
|
|
16
17
|
import { type InputStatus } from '../Field/index.js';
|
|
17
18
|
import { type IconType } from '../Icon/index.js';
|
|
19
|
+
import { type TextEntryTraitProps } from '../Field/textEntryTraits.js';
|
|
18
20
|
declare const sizeStyles: Readonly<{
|
|
19
21
|
readonly sm: Readonly<{
|
|
20
22
|
readonly height: stylex.StyleXClassNameFor<"height", "28px">;
|
|
@@ -31,12 +33,19 @@ export type { InputStatus as TextInputStatus, InputStatusType as TextInputStatus
|
|
|
31
33
|
import { type FieldInputBaseProps } from '../Field/fieldParts.js';
|
|
32
34
|
import type { SizeValue } from '../utils/types.js';
|
|
33
35
|
import type { FieldStatusPlacement } from '../Field/fieldStatusPlacement.js';
|
|
34
|
-
|
|
35
|
-
|
|
36
|
+
/**
|
|
37
|
+
* The HTML input type. Beyond their meaning, `email`, `tel`, `url` and
|
|
38
|
+
* `password` choose a touch keyboard (email, phone pad, URL) and its
|
|
39
|
+
* capitalization; `search` makes the field a search box.
|
|
40
|
+
*/
|
|
41
|
+
export type TextInputType = 'text' | 'password' | 'email' | 'search' | 'tel' | 'url';
|
|
42
|
+
export interface TextInputProps extends Omit<FieldInputBaseProps, 'onChange' | 'defaultValue'>, TextEntryTraitProps {
|
|
36
43
|
/** Ref forwarded to the root element */
|
|
37
44
|
ref?: React.Ref<HTMLInputElement>;
|
|
38
45
|
/**
|
|
39
|
-
* The HTML input type.
|
|
46
|
+
* The HTML input type. `email`, `tel` and `url` also bring up the matching
|
|
47
|
+
* touch keyboard (email, phone pad, URL); `search` makes the field a search
|
|
48
|
+
* box (pair it with `enterKeyHint="search"` for a Search key).
|
|
40
49
|
* @default 'text'
|
|
41
50
|
*/
|
|
42
51
|
type?: TextInputType;
|
|
@@ -183,6 +192,11 @@ export interface TextInputProps extends Omit<FieldInputBaseProps, 'onChange' | '
|
|
|
183
192
|
* session-scoped field that must not reuse a prior value).
|
|
184
193
|
*/
|
|
185
194
|
autoComplete?: React.InputHTMLAttributes<HTMLInputElement>['autoComplete'];
|
|
195
|
+
/**
|
|
196
|
+
* Whether misspelled words are underlined (the native `spellcheck`).
|
|
197
|
+
* Unset, the browser decides.
|
|
198
|
+
*/
|
|
199
|
+
hasSpellCheck?: boolean;
|
|
186
200
|
}
|
|
187
201
|
/**
|
|
188
202
|
* A text input component for collecting user input.
|
|
@@ -193,7 +207,7 @@ export interface TextInputProps extends Omit<FieldInputBaseProps, 'onChange' | '
|
|
|
193
207
|
* <TextInput label="Search" isLabelHidden value={query} onChange={setQuery} />
|
|
194
208
|
* ```
|
|
195
209
|
*/
|
|
196
|
-
export declare function TextInput({ type, label, isLabelHidden, description, isOptional, isRequired, isDisabled: isDisabledProp, isReadOnly, disabledMessage, startIcon, status, statusVariant, size: sizeProp, onChange, changeAction, isLoading, value, placeholder, labelTooltip, hasClear, hasAutoFocus, htmlName, onEnter, onKeyDown, width, containerXstyle, containerClassName, containerStyle, controlXstyle, controlClassName, controlStyle, ref, id: idProp, 'aria-describedby': ariaDescribedByProp, 'aria-labelledby': ariaLabelledByProp, ...restProps }: TextInputProps): import("react").JSX.Element;
|
|
210
|
+
export declare function TextInput({ type, label, isLabelHidden, description, isOptional, isRequired, isDisabled: isDisabledProp, isReadOnly, disabledMessage, startIcon, status, statusVariant, size: sizeProp, onChange, changeAction, isLoading, value, placeholder, labelTooltip, hasClear, hasAutoFocus, htmlName, onEnter, onKeyDown, enterKeyHint, inputMode, autoCapitalize, hasAutoCorrect, hasSpellCheck, width, containerXstyle, containerClassName, containerStyle, controlXstyle, controlClassName, controlStyle, ref, id: idProp, 'aria-describedby': ariaDescribedByProp, 'aria-labelledby': ariaLabelledByProp, ...restProps }: TextInputProps): import("react").JSX.Element;
|
|
197
211
|
export declare namespace TextInput {
|
|
198
212
|
var displayName: string;
|
|
199
213
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TextInput.d.ts","sourceRoot":"","sources":["../../src/TextInput/TextInput.tsx"],"names":[],"mappings":"AAIA
|
|
1
|
+
{"version":3,"file":"TextInput.d.ts","sourceRoot":"","sources":["../../src/TextInput/TextInput.tsx"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;GAaG;AAEH,OAAO,EAOL,KAAK,WAAW,EAChB,KAAK,aAAa,EAClB,KAAK,SAAS,EACf,MAAM,OAAO,CAAC;AACf,OAAO,KAAK,MAAM,MAAM,kBAAkB,CAAC;AAO3C,OAAO,EAGL,KAAK,WAAW,EAKjB,MAAM,UAAU,CAAC;AAClB,OAAO,EAAiB,KAAK,QAAQ,EAAC,MAAM,SAAS,CAAC;AAMtD,OAAO,EAEL,KAAK,mBAAmB,EACzB,MAAM,0BAA0B,CAAC;AAkClC,QAAA,MAAM,UAAU;;;;;;;;;;EAUd,CAAC;AAEH,MAAM,MAAM,aAAa,GAAG,MAAM,OAAO,UAAU,CAAC;AAMpD,YAAY,EACV,WAAW,IAAI,eAAe,EAC9B,eAAe,IAAI,mBAAmB,GAC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,QAAgB,EAChB,YAAoB,EACpB,QAAQ,EACR,OAAO,EACP,SAAS,EACT,YAAY,EACZ,SAAS,EACT,cAAc,EACd,cAAc,EACd,aAAa,EACb,KAAK,EACL,eAAe,EACf,kBAAkB,EAClB,cAAc,EACd,aAAa,EACb,gBAAgB,EAChB,YAAY,EACZ,GAAG,EACH,EAAE,EAAE,MAAM,EACV,kBAAkB,EAAE,mBAAmB,EACvC,iBAAiB,EAAE,kBAAkB,EACrC,GAAG,SAAS,EACb,EAAE,cAAc,+BA+QhB;yBAzTe,SAAS"}
|
|
@@ -4,8 +4,9 @@
|
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* @file TextInput.tsx
|
|
7
|
-
* @input Uses React, useId, ChangeEvent, Field, Icon, InputGroupContext
|
|
8
|
-
*
|
|
7
|
+
* @input Uses React, useId, ChangeEvent, Field, Icon, InputGroupContext,
|
|
8
|
+
* textEntryTraits (the touch-keyboard trait props)
|
|
9
|
+
* @output Exports TextInput component, TextInputProps, TextInputType
|
|
9
10
|
* @position Core implementation; consumed by index.ts, tested by TextInput.test.tsx
|
|
10
11
|
*
|
|
11
12
|
* SYNC: When modified, update these files to stay in sync:
|
|
@@ -26,6 +27,7 @@ import { Spinner } from "../Spinner/index.js";
|
|
|
26
27
|
import { useTooltip } from "../Tooltip/index.js";
|
|
27
28
|
import { VisuallyHidden } from "../VisuallyHidden/index.js";
|
|
28
29
|
import { getInputARIA, isImeKeyEvent } from "../utils/index.js";
|
|
30
|
+
import { textEntryTraitAttributes } from "../Field/textEntryTraits.js";
|
|
29
31
|
import { joinAriaIDs } from "../utils/inputAria.js";
|
|
30
32
|
const sizeStyles = {
|
|
31
33
|
sm: {
|
|
@@ -61,6 +63,12 @@ import { registerEnglishFallback, useComponentTranslator } from "../i18n/useComp
|
|
|
61
63
|
import english from "../i18n/generated-english/TextInput/TextInput.generated.js";
|
|
62
64
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
63
65
|
registerEnglishFallback(english);
|
|
66
|
+
/**
|
|
67
|
+
* The HTML input type. Beyond their meaning, `email`, `tel`, `url` and
|
|
68
|
+
* `password` choose a touch keyboard (email, phone pad, URL) and its
|
|
69
|
+
* capitalization; `search` makes the field a search box.
|
|
70
|
+
*/
|
|
71
|
+
|
|
64
72
|
/**
|
|
65
73
|
* A text input component for collecting user input.
|
|
66
74
|
*
|
|
@@ -95,6 +103,11 @@ export function TextInput({
|
|
|
95
103
|
htmlName,
|
|
96
104
|
onEnter,
|
|
97
105
|
onKeyDown,
|
|
106
|
+
enterKeyHint,
|
|
107
|
+
inputMode,
|
|
108
|
+
autoCapitalize,
|
|
109
|
+
hasAutoCorrect,
|
|
110
|
+
hasSpellCheck,
|
|
98
111
|
width,
|
|
99
112
|
containerXstyle,
|
|
100
113
|
containerClassName,
|
|
@@ -248,6 +261,15 @@ export function TextInput({
|
|
|
248
261
|
id: id,
|
|
249
262
|
name: isDisabled ? undefined : htmlName,
|
|
250
263
|
type: type,
|
|
264
|
+
...textEntryTraitAttributes({
|
|
265
|
+
enterKeyHint,
|
|
266
|
+
inputMode,
|
|
267
|
+
autoCapitalize,
|
|
268
|
+
hasAutoCorrect
|
|
269
|
+
}),
|
|
270
|
+
...(hasSpellCheck != null ? {
|
|
271
|
+
spellCheck: hasSpellCheck
|
|
272
|
+
} : {}),
|
|
251
273
|
value: optimisticValue,
|
|
252
274
|
onChange: handleChange,
|
|
253
275
|
onKeyDown: isDisabled || onEnter || onKeyDown ? e => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TopNav.d.ts","sourceRoot":"","sources":["../../src/TopNav/TopNav.tsx"],"names":[],"mappings":"AAIA;;;;;;;;;;;;GAYG;AAEH,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,OAAO,CAAC;AACrC,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"TopNav.d.ts","sourceRoot":"","sources":["../../src/TopNav/TopNav.tsx"],"names":[],"mappings":"AAIA;;;;;;;;;;;;GAYG;AAEH,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,OAAO,CAAC;AACrC,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,cAAc,CAAC;AA8G5C,MAAM,WAAW,WAAY,SAAQ,SAAS,CAAC,WAAW,CAAC;IACzD,wCAAwC;IACxC,GAAG,CAAC,EAAE,KAAK,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC;IAC7B;;;OAGG;IACH,OAAO,CAAC,EAAE,SAAS,CAAC;IACpB;;;OAGG;IACH,YAAY,CAAC,EAAE,SAAS,CAAC;IACzB;;;;;;OAMG;IACH,QAAQ,CAAC,EAAE,SAAS,CAAC;IACrB;;;;;OAKG;IACH,aAAa,CAAC,EAAE,SAAS,CAAC;IAC1B;;;OAGG;IACH,UAAU,CAAC,EAAE,SAAS,CAAC;IACvB;;;;OAIG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,MAAM,CAAC,EACrB,OAAO,EACP,YAAY,EACZ,QAAQ,EACR,aAAa,EACb,UAAU,EACV,KAAK,EAAE,cAAc,EACrB,MAAM,EACN,SAAS,EACT,KAAK,EACL,GAAG,EACH,GAAG,KAAK,EACT,EAAE,WAAW,sCA4Hb;yBAxIe,MAAM"}
|
package/dist/TopNav/TopNav.js
CHANGED
|
@@ -29,6 +29,7 @@ import { useAppShellMobile } from "../AppShell/AppShellMobileContext.js";
|
|
|
29
29
|
import { themeProps } from "../utils/themeProps.js";
|
|
30
30
|
import { registerEnglishFallback, useComponentTranslator } from "../i18n/useComponentTranslator.js";
|
|
31
31
|
import english from "../i18n/generated-english/TopNav/TopNav.generated.js";
|
|
32
|
+
import { isRenderable } from "../utils/isRenderable.js";
|
|
32
33
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
33
34
|
registerEnglishFallback(english);
|
|
34
35
|
|
|
@@ -105,10 +106,13 @@ export function TopNav({
|
|
|
105
106
|
hasAutoToggle
|
|
106
107
|
} = useAppShellMobile();
|
|
107
108
|
const resolvedStartContent = startContent ?? children;
|
|
108
|
-
|
|
109
|
-
const
|
|
109
|
+
// The layout flags use the same test as the slots they gate.
|
|
110
|
+
const hasCenterContent = isRenderable(centerContent);
|
|
111
|
+
const hasStartContent = isRenderable(resolvedStartContent);
|
|
112
|
+
const hasMobileContent = isRenderable(mobileContent);
|
|
113
|
+
const hasCollapsibleContent = hasStartContent || hasCenterContent;
|
|
110
114
|
// Show mobile toggle when there's ANY drawer content — own items OR SideNav via context
|
|
111
|
-
const hasMobileDrawerContent = hasCollapsibleContent ||
|
|
115
|
+
const hasMobileDrawerContent = hasCollapsibleContent || hasMobileContent;
|
|
112
116
|
|
|
113
117
|
// =========================================================================
|
|
114
118
|
// Mobile bar mode — heading + endContent + toggle, hide nav items.
|
|
@@ -124,7 +128,7 @@ export function TopNav({
|
|
|
124
128
|
mode: 'mobile-bar'
|
|
125
129
|
}), stylex.props(styles.mobileBar, xstyle), className, style),
|
|
126
130
|
...props,
|
|
127
|
-
children: [heading && /*#__PURE__*/_jsx("div", {
|
|
131
|
+
children: [isRenderable(heading) && /*#__PURE__*/_jsx("div", {
|
|
128
132
|
...{
|
|
129
133
|
className: "x78zum5 x6s0dn4 xkz0k9k xeuugli"
|
|
130
134
|
},
|
|
@@ -144,7 +148,7 @@ export function TopNav({
|
|
|
144
148
|
// =========================================================================
|
|
145
149
|
if (renderMode === 'drawer') {
|
|
146
150
|
// Only render if there are collapsible items or extra content
|
|
147
|
-
if (!hasCollapsibleContent && !
|
|
151
|
+
if (!hasCollapsibleContent && !hasMobileContent) {
|
|
148
152
|
return null;
|
|
149
153
|
}
|
|
150
154
|
return /*#__PURE__*/_jsxs(MobileNav, {
|
|
@@ -154,9 +158,9 @@ export function TopNav({
|
|
|
154
158
|
className: "x78zum5 xdt5ytf x1lsbc85"
|
|
155
159
|
},
|
|
156
160
|
children: [resolvedStartContent, centerContent]
|
|
157
|
-
}), hasCollapsibleContent &&
|
|
161
|
+
}), hasCollapsibleContent && hasMobileContent && /*#__PURE__*/_jsx(Divider, {
|
|
158
162
|
xstyle: styles.drawerDivider
|
|
159
|
-
}),
|
|
163
|
+
}), hasMobileContent && /*#__PURE__*/_jsx("div", {
|
|
160
164
|
...{},
|
|
161
165
|
children: mobileContent
|
|
162
166
|
})]
|
|
@@ -177,12 +181,12 @@ export function TopNav({
|
|
|
177
181
|
...{
|
|
178
182
|
className: "x78zum5 x6s0dn4 x18g69wz x845mor xeuugli"
|
|
179
183
|
},
|
|
180
|
-
children: [heading && /*#__PURE__*/_jsx("div", {
|
|
184
|
+
children: [isRenderable(heading) && /*#__PURE__*/_jsx("div", {
|
|
181
185
|
...{
|
|
182
186
|
className: "x78zum5 x6s0dn4 x2lah0s"
|
|
183
187
|
},
|
|
184
188
|
children: heading
|
|
185
|
-
}),
|
|
189
|
+
}), hasStartContent && /*#__PURE__*/_jsx(TopNavSlotContext, {
|
|
186
190
|
value: "start",
|
|
187
191
|
children: /*#__PURE__*/_jsx("div", {
|
|
188
192
|
...{
|
|
@@ -207,7 +211,7 @@ export function TopNav({
|
|
|
207
211
|
value: "end",
|
|
208
212
|
children: endContent
|
|
209
213
|
})
|
|
210
|
-
}) : endContent && /*#__PURE__*/_jsx("div", {
|
|
214
|
+
}) : isRenderable(endContent) && /*#__PURE__*/_jsx("div", {
|
|
211
215
|
...{
|
|
212
216
|
className: "x78zum5 x6s0dn4 xzye2dw x2lah0s xvc5jky"
|
|
213
217
|
},
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TopNavHeading.d.ts","sourceRoot":"","sources":["../../src/TopNav/TopNavHeading.tsx"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,EAAkB,KAAK,SAAS,EAAC,MAAM,OAAO,CAAC;AAatD,OAAO,KAAK,EAAC,iBAAiB,EAAC,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