@astryxdesign/core 0.4.4 → 0.4.5-canary.1dc3e5d
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/CHANGELOG.md +39 -0
- package/dist/BottomSheet/BottomSheet.d.ts +11 -2
- package/dist/BottomSheet/BottomSheet.d.ts.map +1 -1
- package/dist/BottomSheet/BottomSheet.js +4 -0
- package/dist/BottomSheet/BottomSheetPanel.d.ts +5 -2
- package/dist/BottomSheet/BottomSheetPanel.d.ts.map +1 -1
- package/dist/BottomSheet/BottomSheetPanel.js +56 -13
- package/dist/BottomSheet/index.d.ts +1 -1
- package/dist/BottomSheet/index.d.ts.map +1 -1
- package/dist/BottomSheet/snapOffsets.d.ts +57 -20
- package/dist/BottomSheet/snapOffsets.d.ts.map +1 -1
- package/dist/BottomSheet/snapOffsets.js +106 -30
- package/dist/BottomSheet/useSheetGestures.d.ts +13 -8
- package/dist/BottomSheet/useSheetGestures.d.ts.map +1 -1
- package/dist/BottomSheet/useSheetGestures.js +160 -64
- package/dist/Calendar/Calendar.d.ts +17 -0
- package/dist/Calendar/Calendar.d.ts.map +1 -1
- package/dist/Calendar/Calendar.js +34 -3
- package/dist/Calendar/getStandaloneShortWeekdayNames.d.ts +14 -0
- package/dist/Calendar/getStandaloneShortWeekdayNames.d.ts.map +1 -0
- package/dist/Calendar/getStandaloneShortWeekdayNames.js +26 -0
- package/dist/Calendar/hooks/useCalendarConstraints.d.ts +22 -1
- package/dist/Calendar/hooks/useCalendarConstraints.d.ts.map +1 -1
- package/dist/Calendar/hooks/useCalendarConstraints.js +26 -4
- package/dist/Calendar/hooks/useCalendarDays.d.ts.map +1 -1
- package/dist/Calendar/hooks/useCalendarDays.js +14 -10
- package/dist/Calendar/standaloneShortWeekdayNames.generated.d.ts +47 -0
- package/dist/Calendar/standaloneShortWeekdayNames.generated.d.ts.map +1 -0
- package/dist/Calendar/standaloneShortWeekdayNames.generated.js +40 -0
- package/dist/CheckboxInput/CheckboxInput.d.ts.map +1 -1
- package/dist/CheckboxInput/CheckboxInput.js +9 -0
- package/dist/ComplexSelector/ComplexSelector.d.ts.map +1 -1
- package/dist/ComplexSelector/ComplexSelector.js +6 -1
- package/dist/DateInput/DateInput.d.ts.map +1 -1
- package/dist/DateInput/DateInput.js +6 -1
- package/dist/DateRangeInput/DateRangeInput.d.ts +23 -1
- package/dist/DateRangeInput/DateRangeInput.d.ts.map +1 -1
- package/dist/DateRangeInput/DateRangeInput.js +38 -3
- package/dist/DateTimeInput/DateTimeInput.d.ts.map +1 -1
- package/dist/DateTimeInput/DateTimeInput.js +7 -2
- package/dist/Field/FieldLabel.d.ts +2 -1
- package/dist/Field/FieldLabel.d.ts.map +1 -1
- package/dist/Field/FieldLabel.js +21 -3
- package/dist/Field/InputClearButton.d.ts +2 -1
- package/dist/Field/InputClearButton.d.ts.map +1 -1
- package/dist/Field/InputClearButton.js +6 -1
- package/dist/FormLayout/FormLayout.d.ts +24 -2
- package/dist/FormLayout/FormLayout.d.ts.map +1 -1
- package/dist/FormLayout/FormLayout.js +7 -2
- package/dist/FormLayout/FormLayoutContext.d.ts +15 -2
- package/dist/FormLayout/FormLayoutContext.d.ts.map +1 -1
- package/dist/FormLayout/FormLayoutContext.js +19 -4
- package/dist/FormLayout/index.d.ts +1 -1
- package/dist/FormLayout/index.d.ts.map +1 -1
- package/dist/Markdown/Markdown.d.ts +8 -0
- package/dist/Markdown/Markdown.d.ts.map +1 -1
- package/dist/Markdown/Markdown.js +31 -3
- package/dist/Markdown/parser.d.ts +14 -2
- package/dist/Markdown/parser.d.ts.map +1 -1
- package/dist/Markdown/parser.js +50 -2
- package/dist/MultiSelector/MultiSelector.d.ts.map +1 -1
- package/dist/MultiSelector/MultiSelector.js +6 -1
- package/dist/NumberInput/NumberInput.d.ts.map +1 -1
- package/dist/NumberInput/NumberInput.js +6 -1
- package/dist/Outline/parseOutlineFromMarkdown.d.ts +2 -0
- package/dist/Outline/parseOutlineFromMarkdown.d.ts.map +1 -1
- package/dist/Outline/parseOutlineFromMarkdown.js +5 -31
- package/dist/RadioList/RadioList.d.ts.map +1 -1
- package/dist/RadioList/RadioList.js +12 -1
- package/dist/Selector/Selector.d.ts.map +1 -1
- package/dist/Selector/Selector.js +6 -1
- package/dist/StatusDot/StatusDot.d.ts +43 -3
- package/dist/StatusDot/StatusDot.d.ts.map +1 -1
- package/dist/StatusDot/StatusDot.js +42 -5
- package/dist/Switch/Switch.d.ts.map +1 -1
- package/dist/Switch/Switch.js +9 -0
- package/dist/Table/plugins/rowExpansion/useTableRowExpansion.d.ts.map +1 -1
- package/dist/Table/plugins/rowExpansion/useTableRowExpansion.js +7 -2
- package/dist/TextArea/TextArea.d.ts.map +1 -1
- package/dist/TextArea/TextArea.js +6 -1
- package/dist/TextInput/TextInput.d.ts.map +1 -1
- package/dist/TextInput/TextInput.js +6 -1
- package/dist/TimeInput/TimeInput.d.ts.map +1 -1
- package/dist/TimeInput/TimeInput.js +6 -1
- package/dist/hooks/useResolvedRequired.d.ts +19 -0
- package/dist/hooks/useResolvedRequired.d.ts.map +1 -0
- package/dist/hooks/useResolvedRequired.js +40 -0
- package/dist/utils/plainDate.d.ts +6 -0
- package/dist/utils/plainDate.d.ts.map +1 -1
- package/dist/utils/plainDate.js +12 -0
- package/locales/af-ZA.json +958 -0
- package/locales/ar-SA.json +998 -0
- package/locales/ca-ES.json +974 -0
- package/locales/cs-CZ.json +990 -0
- package/locales/da-DK.json +966 -0
- package/locales/de-DE.json +966 -0
- package/locales/el-GR.json +990 -0
- package/locales/en.json +4 -0
- package/locales/es-ES.json +978 -0
- package/locales/fi-FI.json +990 -0
- package/locales/fr-FR.json +928 -0
- package/locales/he-IL.json +990 -0
- package/locales/hu-HU.json +990 -0
- package/locales/it-IT.json +978 -0
- package/locales/ja-JP.json +998 -0
- package/locales/ko-KR.json +990 -0
- package/locales/nl-NL.json +954 -0
- package/locales/no-NO.json +978 -0
- package/locales/pl-PL.json +982 -0
- package/locales/pseudo.json +3 -0
- package/locales/pt-BR.json +982 -0
- package/locales/pt-PT.json +982 -0
- package/locales/ro-RO.json +982 -0
- package/locales/ru-RU.json +990 -0
- package/locales/sr-SP.json +990 -0
- package/locales/sv-SE.json +986 -0
- package/locales/tr-TR.json +990 -0
- package/locales/uk-UA.json +990 -0
- package/locales/vi-VN.json +986 -0
- package/locales/zh-CN.json +998 -0
- package/locales/zh-TW.json +998 -0
- package/package.json +3 -3
- package/src/BottomSheet/BottomSheet.doc.mjs +36 -3
- package/src/BottomSheet/BottomSheet.test.tsx +153 -2
- package/src/BottomSheet/BottomSheet.tsx +16 -2
- package/src/BottomSheet/BottomSheetPanel.tsx +67 -13
- package/src/BottomSheet/index.ts +5 -1
- package/src/BottomSheet/snapOffsets.test.ts +114 -47
- package/src/BottomSheet/snapOffsets.ts +119 -33
- package/src/BottomSheet/useSheetGestures.test.ts +113 -15
- package/src/BottomSheet/useSheetGestures.ts +196 -100
- package/src/Calendar/Calendar.doc.mjs +16 -0
- package/src/Calendar/Calendar.test.tsx +137 -0
- package/src/Calendar/Calendar.tsx +65 -2
- package/src/Calendar/getStandaloneShortWeekdayNames.test.ts +54 -0
- package/src/Calendar/getStandaloneShortWeekdayNames.ts +38 -0
- package/src/Calendar/hooks/useCalendarConstraints.ts +54 -3
- package/src/Calendar/hooks/useCalendarDays.ts +13 -10
- package/src/Calendar/standaloneShortWeekdayNames.generated.ts +50 -0
- package/src/CheckboxInput/CheckboxInput.tsx +6 -0
- package/src/ComplexSelector/ComplexSelector.tsx +3 -1
- package/src/DateInput/DateInput.tsx +3 -1
- package/src/DateRangeInput/DateRangeInput.doc.mjs +16 -0
- package/src/DateRangeInput/DateRangeInput.test.tsx +81 -1
- package/src/DateRangeInput/DateRangeInput.tsx +72 -1
- package/src/DateTimeInput/DateTimeInput.tsx +4 -2
- package/src/Field/Field.doc.mjs +1 -0
- package/src/Field/FieldLabel.tsx +20 -4
- package/src/Field/InputClearButton.test.tsx +25 -0
- package/src/Field/InputClearButton.tsx +4 -1
- package/src/FormLayout/FormLayout.doc.mjs +13 -0
- package/src/FormLayout/FormLayout.test.tsx +181 -4
- package/src/FormLayout/FormLayout.tsx +33 -2
- package/src/FormLayout/FormLayoutContext.ts +22 -7
- package/src/FormLayout/index.ts +1 -1
- package/src/Markdown/Markdown.doc.mjs +3 -0
- package/src/Markdown/Markdown.test.tsx +78 -0
- package/src/Markdown/Markdown.tsx +41 -1
- package/src/Markdown/parser.ts +60 -2
- package/src/MultiSelector/MultiSelector.tsx +3 -1
- package/src/NumberInput/NumberInput.tsx +3 -1
- package/src/Outline/Outline.doc.mjs +2 -0
- package/src/Outline/parseOutlineFromMarkdown.ts +10 -40
- package/src/RadioList/RadioList.tsx +9 -1
- package/src/Selector/Selector.tsx +3 -1
- package/src/StatusDot/StatusDot.doc.mjs +13 -0
- package/src/StatusDot/StatusDot.test.tsx +115 -8
- package/src/StatusDot/StatusDot.tsx +74 -9
- package/src/Switch/Switch.tsx +6 -0
- package/src/Table/plugins/rowExpansion/useTableRowExpansion.tsx +20 -2
- package/src/TextArea/TextArea.tsx +3 -1
- package/src/TextInput/TextInput.tsx +3 -1
- package/src/TimeInput/TimeInput.tsx +3 -1
- package/src/hooks/useResolvedRequired.ts +42 -0
- package/src/utils/plainDate.test.ts +50 -0
- package/src/utils/plainDate.ts +12 -0
package/dist/Field/FieldLabel.js
CHANGED
|
@@ -4,17 +4,18 @@
|
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* @file FieldLabel.tsx
|
|
7
|
-
* @input Uses React, Icon, IconType, useTranslator
|
|
7
|
+
* @input Uses React, Icon, IconType, useTranslator, FormLayoutContext
|
|
8
8
|
* @output Exports FieldLabel component, FieldLabelProps
|
|
9
9
|
* @position Core label implementation; used by Field, CheckboxInput, Switch
|
|
10
10
|
*
|
|
11
11
|
* SYNC: When modified, update these files to stay in sync:
|
|
12
12
|
* - /packages/core/src/Field/Field.doc.mjs (props table, features, implementation notes)
|
|
13
13
|
* - /packages/core/src/Field/index.ts (exports if types change)
|
|
14
|
+
* - /packages/core/src/FormLayout/FormLayoutContext.ts (defaultOptionality drives the indicator)
|
|
14
15
|
* - /packages/cli/assets/templates/blocks/components/Field/ (showcase blocks)
|
|
15
16
|
* - /packages/core/locales/en.json (@astryx.field.required / @astryx.field.optional)
|
|
16
17
|
*/
|
|
17
|
-
import { useMemo, useRef } from 'react';
|
|
18
|
+
import { use, useMemo, useRef } from 'react';
|
|
18
19
|
import * as stylex from '@stylexjs/stylex';
|
|
19
20
|
import { mergeProps } from "../utils/index.js";
|
|
20
21
|
import "../theme/tokens.stylex.js";
|
|
@@ -24,6 +25,7 @@ import { Tooltip } from "../Tooltip/index.js";
|
|
|
24
25
|
import { useTranslator } from "../i18n/index.js";
|
|
25
26
|
import { themeProps } from "../utils/themeProps.js";
|
|
26
27
|
import { useInputContainer } from "../hooks/index.js";
|
|
28
|
+
import { FormLayoutContext } from "../FormLayout/FormLayoutContext.js";
|
|
27
29
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
28
30
|
const styles = {
|
|
29
31
|
label: {
|
|
@@ -93,7 +95,23 @@ export function FieldLabel({
|
|
|
93
95
|
...rest
|
|
94
96
|
}) {
|
|
95
97
|
const t = useTranslator();
|
|
96
|
-
const
|
|
98
|
+
const {
|
|
99
|
+
defaultOptionality
|
|
100
|
+
} = use(FormLayoutContext);
|
|
101
|
+
|
|
102
|
+
// A form-level `defaultOptionality` means "only the exception is marked": a
|
|
103
|
+
// field that merely restates the form's default shows no indicator, and only
|
|
104
|
+
// a deviation from it does. This is the *visible indicator* only; the
|
|
105
|
+
// matching `aria-required` is resolved on each control (see
|
|
106
|
+
// useResolvedRequired) so the unmarked majority is still announced.
|
|
107
|
+
//
|
|
108
|
+
// defaultOptionality isRequired isOptional
|
|
109
|
+
// 'optional' → required indicator → (matches default, hidden)
|
|
110
|
+
// 'required' → (matches, hidden) → optional indicator
|
|
111
|
+
// unset → required indicator → optional indicator
|
|
112
|
+
const showRequired = isRequired && defaultOptionality !== 'required';
|
|
113
|
+
const showOptional = isOptional && defaultOptionality !== 'optional';
|
|
114
|
+
const statusText = showOptional ? t('@astryx.field.optional') : showRequired ? t('@astryx.field.required') : null;
|
|
97
115
|
|
|
98
116
|
// A group label (e.g. for a radiogroup) must not be a literal `<label>`
|
|
99
117
|
// element: a `<label>` semantically names a single form control and can't be
|
|
@@ -7,7 +7,8 @@
|
|
|
7
7
|
* TextInput, NumberInput, TimeInput, DateInput, DateTimeInput,
|
|
8
8
|
* DateRangeInput, Selector, MultiSelector, Typeahead, Tokenizer, FileInput —
|
|
9
9
|
* routes it through here, so the glyph is themed in one place via the
|
|
10
|
-
* `astryx-input-clear-icon` target
|
|
10
|
+
* `astryx-input-clear-icon` target and the button wrapper is themed via the
|
|
11
|
+
* `astryx-input-clear-button` target.
|
|
11
12
|
*/
|
|
12
13
|
import type { ReactNode } from 'react';
|
|
13
14
|
import * as stylex from '@stylexjs/stylex';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"InputClearButton.d.ts","sourceRoot":"","sources":["../../src/Field/InputClearButton.tsx"],"names":[],"mappings":"AAIA
|
|
1
|
+
{"version":3,"file":"InputClearButton.d.ts","sourceRoot":"","sources":["../../src/Field/InputClearButton.tsx"],"names":[],"mappings":"AAIA;;;;;;;;;;;GAWG;AAEH,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,OAAO,CAAC;AACrC,OAAO,KAAK,MAAM,MAAM,kBAAkB,CAAC;AAY3C,MAAM,WAAW,qBAAqB;IACpC,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,CAAC,CAAC,EAAE,KAAK,CAAC,UAAU,CAAC,iBAAiB,CAAC,KAAK,IAAI,CAAC;IAC1D,MAAM,CAAC,EAAE,MAAM,CAAC,YAAY,CAAC;IAC7B;;;;;;OAMG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AAED,wBAAgB,gBAAgB,CAAC,EAC/B,KAAK,EACL,OAAO,EACP,MAAM,EACN,aAAa,GACd,EAAE,qBAAqB,GAAG,SAAS,CA0BnC;yBA/Be,gBAAgB"}
|
|
@@ -11,7 +11,8 @@
|
|
|
11
11
|
* TextInput, NumberInput, TimeInput, DateInput, DateTimeInput,
|
|
12
12
|
* DateRangeInput, Selector, MultiSelector, Typeahead, Tokenizer, FileInput —
|
|
13
13
|
* routes it through here, so the glyph is themed in one place via the
|
|
14
|
-
* `astryx-input-clear-icon` target
|
|
14
|
+
* `astryx-input-clear-icon` target and the button wrapper is themed via the
|
|
15
|
+
* `astryx-input-clear-button` target.
|
|
15
16
|
*/
|
|
16
17
|
import * as stylex from '@stylexjs/stylex';
|
|
17
18
|
import { Button } from "../Button/index.js";
|
|
@@ -34,10 +35,14 @@ export function InputClearButton({
|
|
|
34
35
|
const {
|
|
35
36
|
className: iconTargetClassName
|
|
36
37
|
} = themeProps('input-clear-icon');
|
|
38
|
+
const {
|
|
39
|
+
className: buttonTargetClassName
|
|
40
|
+
} = themeProps('input-clear-button');
|
|
37
41
|
return /*#__PURE__*/_jsx(Button, {
|
|
38
42
|
variant: "ghost",
|
|
39
43
|
size: "sm",
|
|
40
44
|
label: label,
|
|
45
|
+
className: buttonTargetClassName,
|
|
41
46
|
icon: /*#__PURE__*/_jsx(Icon, {
|
|
42
47
|
icon: "close",
|
|
43
48
|
size: "sm",
|
|
@@ -6,13 +6,16 @@
|
|
|
6
6
|
*
|
|
7
7
|
* SYNC: When modified, update these files to stay in sync:
|
|
8
8
|
* - /packages/core/src/FormLayout/FormLayout.test.tsx (tests for new/changed behavior)
|
|
9
|
+
* - /packages/core/src/FormLayout/FormLayoutContext.ts (context value shape)
|
|
10
|
+
* - /packages/core/src/FormLayout/FormLayout.doc.mjs (props table)
|
|
9
11
|
* - /packages/core/src/FormLayout/index.ts (exports if types change)
|
|
12
|
+
* - /packages/core/src/Field/FieldLabel.tsx (defaultOptionality indicator resolution)
|
|
10
13
|
* - /apps/storybook/stories/FormLayout.stories.tsx (storybook stories)
|
|
11
14
|
* - /packages/cli/assets/templates/blocks/components/FormLayout/ (showcase blocks)
|
|
12
15
|
*/
|
|
13
16
|
import { type ReactNode } from 'react';
|
|
14
17
|
import type { BaseProps } from '../BaseProps';
|
|
15
|
-
import { type FormLayoutDirection } from './FormLayoutContext';
|
|
18
|
+
import { type FormLayoutDirection, type FormOptionality } from './FormLayoutContext';
|
|
16
19
|
export interface FormLayoutProps extends BaseProps<HTMLDivElement> {
|
|
17
20
|
/** Ref forwarded to the root element */
|
|
18
21
|
ref?: React.Ref<HTMLDivElement>;
|
|
@@ -33,6 +36,25 @@ export interface FormLayoutProps extends BaseProps<HTMLDivElement> {
|
|
|
33
36
|
* @default 'vertical'
|
|
34
37
|
*/
|
|
35
38
|
direction?: FormLayoutDirection;
|
|
39
|
+
/**
|
|
40
|
+
* Which state the form treats as its default, so only the *exception*
|
|
41
|
+
* carries a visible optional/required indicator. It also resolves each
|
|
42
|
+
* field's `aria-required` so the unmarked majority is still announced
|
|
43
|
+
* correctly — but only `aria-required`, never the native `required`
|
|
44
|
+
* attribute, so a layout default can't switch on browser validation.
|
|
45
|
+
*
|
|
46
|
+
* - `'optional'` — fields read as optional; only a field with `isRequired`
|
|
47
|
+
* shows an indicator (the "required" one).
|
|
48
|
+
* - `'required'` — fields read as required; only a field with `isOptional`
|
|
49
|
+
* shows an indicator (the "optional" one). Fields without `isOptional`
|
|
50
|
+
* expose `aria-required` even though they show no indicator.
|
|
51
|
+
* - unset — today's behavior: `isRequired` and `isOptional` each show their
|
|
52
|
+
* own indicator independently.
|
|
53
|
+
*
|
|
54
|
+
* A field that merely restates the default (e.g. `isOptional` under
|
|
55
|
+
* `'optional'`) shows nothing. An inner `FormLayout` shadows an outer one.
|
|
56
|
+
*/
|
|
57
|
+
defaultOptionality?: FormOptionality;
|
|
36
58
|
}
|
|
37
59
|
/**
|
|
38
60
|
* Spatial layout container for form fields.
|
|
@@ -52,7 +74,7 @@ export interface FormLayoutProps extends BaseProps<HTMLDivElement> {
|
|
|
52
74
|
* </FormLayout>
|
|
53
75
|
* ```
|
|
54
76
|
*/
|
|
55
|
-
export declare function FormLayout({ children, direction, xstyle, className, style, ref, ...props }: FormLayoutProps): import("react").JSX.Element;
|
|
77
|
+
export declare function FormLayout({ children, direction, defaultOptionality, xstyle, className, style, ref, ...props }: FormLayoutProps): import("react").JSX.Element;
|
|
56
78
|
export declare namespace FormLayout {
|
|
57
79
|
var displayName: string;
|
|
58
80
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FormLayout.d.ts","sourceRoot":"","sources":["../../src/FormLayout/FormLayout.tsx"],"names":[],"mappings":"AAIA
|
|
1
|
+
{"version":3,"file":"FormLayout.d.ts","sourceRoot":"","sources":["../../src/FormLayout/FormLayout.tsx"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAU,KAAK,SAAS,EAAC,MAAM,OAAO,CAAC;AAC9C,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,cAAc,CAAC;AAG5C,OAAO,EAEL,KAAK,mBAAmB,EACxB,KAAK,eAAe,EACrB,MAAM,qBAAqB,CAAC;AA0C7B,MAAM,WAAW,eAAgB,SAAQ,SAAS,CAAC,cAAc,CAAC;IAChE,wCAAwC;IACxC,GAAG,CAAC,EAAE,KAAK,CAAC,GAAG,CAAC,cAAc,CAAC,CAAC;IAChC;;;OAGG;IACH,QAAQ,CAAC,EAAE,SAAS,CAAC;IAErB;;;;;;;;;;OAUG;IACH,SAAS,CAAC,EAAE,mBAAmB,CAAC;IAEhC;;;;;;;;;;;;;;;;;OAiBG;IACH,kBAAkB,CAAC,EAAE,eAAe,CAAC;CACtC;AAMD;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,UAAU,CAAC,EACzB,QAAQ,EACR,SAAsB,EACtB,kBAAkB,EAClB,MAAM,EACN,SAAS,EACT,KAAK,EACL,GAAG,EACH,GAAG,KAAK,EACT,EAAE,eAAe,+BA0BjB;yBAnCe,UAAU"}
|
|
@@ -10,7 +10,10 @@
|
|
|
10
10
|
*
|
|
11
11
|
* SYNC: When modified, update these files to stay in sync:
|
|
12
12
|
* - /packages/core/src/FormLayout/FormLayout.test.tsx (tests for new/changed behavior)
|
|
13
|
+
* - /packages/core/src/FormLayout/FormLayoutContext.ts (context value shape)
|
|
14
|
+
* - /packages/core/src/FormLayout/FormLayout.doc.mjs (props table)
|
|
13
15
|
* - /packages/core/src/FormLayout/index.ts (exports if types change)
|
|
16
|
+
* - /packages/core/src/Field/FieldLabel.tsx (defaultOptionality indicator resolution)
|
|
14
17
|
* - /apps/storybook/stories/FormLayout.stories.tsx (storybook stories)
|
|
15
18
|
* - /packages/cli/assets/templates/blocks/components/FormLayout/ (showcase blocks)
|
|
16
19
|
*/
|
|
@@ -86,6 +89,7 @@ const styles = {
|
|
|
86
89
|
export function FormLayout({
|
|
87
90
|
children,
|
|
88
91
|
direction = 'vertical',
|
|
92
|
+
defaultOptionality,
|
|
89
93
|
xstyle,
|
|
90
94
|
className,
|
|
91
95
|
style,
|
|
@@ -93,8 +97,9 @@ export function FormLayout({
|
|
|
93
97
|
...props
|
|
94
98
|
}) {
|
|
95
99
|
const contextValue = useMemo(() => ({
|
|
96
|
-
direction
|
|
97
|
-
|
|
100
|
+
direction,
|
|
101
|
+
defaultOptionality
|
|
102
|
+
}), [direction, defaultOptionality]);
|
|
98
103
|
return /*#__PURE__*/_jsx(FormLayoutContext, {
|
|
99
104
|
value: contextValue,
|
|
100
105
|
children: /*#__PURE__*/_jsx("div", {
|
|
@@ -8,10 +8,23 @@
|
|
|
8
8
|
*/
|
|
9
9
|
export type FormLayoutDirection = 'vertical' | 'horizontal' | 'horizontal-labels';
|
|
10
10
|
/**
|
|
11
|
-
*
|
|
12
|
-
*
|
|
11
|
+
* Which state a form treats as its default, so only the *exception* carries a
|
|
12
|
+
* visible optional/required indicator.
|
|
13
|
+
*
|
|
14
|
+
* - `'optional'` — fields are optional unless a field opts into `isRequired`;
|
|
15
|
+
* only required fields show an indicator.
|
|
16
|
+
* - `'required'` — fields are required unless a field opts into `isOptional`;
|
|
17
|
+
* only optional fields show an indicator.
|
|
18
|
+
*/
|
|
19
|
+
export type FormOptionality = 'optional' | 'required';
|
|
20
|
+
/**
|
|
21
|
+
* Context for detecting which form layout a component is rendered in. Children
|
|
22
|
+
* can use this to adapt their rendering based on the parent layout — direction
|
|
23
|
+
* for spatial arrangement, and `defaultOptionality` so a field can suppress the
|
|
24
|
+
* indicator that merely restates the form-wide default.
|
|
13
25
|
*/
|
|
14
26
|
export declare const FormLayoutContext: import("react").Context<{
|
|
15
27
|
direction: FormLayoutDirection;
|
|
28
|
+
defaultOptionality?: FormOptionality;
|
|
16
29
|
}>;
|
|
17
30
|
//# sourceMappingURL=FormLayoutContext.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FormLayoutContext.d.ts","sourceRoot":"","sources":["../../src/FormLayout/FormLayoutContext.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"FormLayoutContext.d.ts","sourceRoot":"","sources":["../../src/FormLayout/FormLayoutContext.ts"],"names":[],"mappings":"AAkBA;;;;;;;GAOG;AACH,MAAM,MAAM,mBAAmB,GAC7B,UAAU,GAAG,YAAY,GAAG,mBAAmB,CAAC;AAElD;;;;;;;;GAQG;AACH,MAAM,MAAM,eAAe,GAAG,UAAU,GAAG,UAAU,CAAC;AAEtD;;;;;GAKG;AACH,eAAO,MAAM,iBAAiB;eACjB,mBAAmB;yBACT,eAAe;EACX,CAAC"}
|
|
@@ -5,10 +5,13 @@
|
|
|
5
5
|
/**
|
|
6
6
|
* @file FormLayoutContext.ts
|
|
7
7
|
* @input Uses React createContext
|
|
8
|
-
* @output Exports FormLayoutContext and
|
|
9
|
-
* @position Context for form layout direction detection
|
|
8
|
+
* @output Exports FormLayoutContext, FormLayoutDirection, and FormOptionality types
|
|
9
|
+
* @position Context for form layout direction + default-optionality detection
|
|
10
10
|
*
|
|
11
11
|
* SYNC: When modified, update these files to stay in sync:
|
|
12
|
+
* - /packages/core/src/FormLayout/FormLayout.tsx (prop + context value)
|
|
13
|
+
* - /packages/core/src/Field/FieldLabel.tsx (indicator resolution)
|
|
14
|
+
* - /packages/core/src/FormLayout/index.ts (exports if types change)
|
|
12
15
|
*/
|
|
13
16
|
import { createContext } from 'react';
|
|
14
17
|
|
|
@@ -22,8 +25,20 @@ import { createContext } from 'react';
|
|
|
22
25
|
*/
|
|
23
26
|
|
|
24
27
|
/**
|
|
25
|
-
*
|
|
26
|
-
*
|
|
28
|
+
* Which state a form treats as its default, so only the *exception* carries a
|
|
29
|
+
* visible optional/required indicator.
|
|
30
|
+
*
|
|
31
|
+
* - `'optional'` — fields are optional unless a field opts into `isRequired`;
|
|
32
|
+
* only required fields show an indicator.
|
|
33
|
+
* - `'required'` — fields are required unless a field opts into `isOptional`;
|
|
34
|
+
* only optional fields show an indicator.
|
|
35
|
+
*/
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* Context for detecting which form layout a component is rendered in. Children
|
|
39
|
+
* can use this to adapt their rendering based on the parent layout — direction
|
|
40
|
+
* for spatial arrangement, and `defaultOptionality` so a field can suppress the
|
|
41
|
+
* indicator that merely restates the form-wide default.
|
|
27
42
|
*/
|
|
28
43
|
export const FormLayoutContext = /*#__PURE__*/createContext({
|
|
29
44
|
direction: 'vertical'
|
|
@@ -8,6 +8,6 @@
|
|
|
8
8
|
*/
|
|
9
9
|
export { FormLayout } from './FormLayout';
|
|
10
10
|
export type { FormLayoutProps } from './FormLayout';
|
|
11
|
-
export type { FormLayoutDirection } from './FormLayoutContext';
|
|
11
|
+
export type { FormLayoutDirection, FormOptionality } from './FormLayoutContext';
|
|
12
12
|
export { FormLayoutContext } from './FormLayoutContext';
|
|
13
13
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/FormLayout/index.ts"],"names":[],"mappings":"AAIA;;;;;;;GAOG;AAEH,OAAO,EAAC,UAAU,EAAC,MAAM,cAAc,CAAC;AACxC,YAAY,EAAC,eAAe,EAAC,MAAM,cAAc,CAAC;AAClD,YAAY,EAAC,mBAAmB,EAAC,MAAM,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/FormLayout/index.ts"],"names":[],"mappings":"AAIA;;;;;;;GAOG;AAEH,OAAO,EAAC,UAAU,EAAC,MAAM,cAAc,CAAC;AACxC,YAAY,EAAC,eAAe,EAAC,MAAM,cAAc,CAAC;AAClD,YAAY,EAAC,mBAAmB,EAAE,eAAe,EAAC,MAAM,qBAAqB,CAAC;AAC9E,OAAO,EAAC,iBAAiB,EAAC,MAAM,qBAAqB,CAAC"}
|
|
@@ -50,6 +50,14 @@ export interface MarkdownComponents {
|
|
|
50
50
|
heading?: React.ComponentType<{
|
|
51
51
|
level: 1 | 2 | 3 | 4 | 5 | 6;
|
|
52
52
|
children: React.ReactNode;
|
|
53
|
+
/**
|
|
54
|
+
* Generated slug for this heading, matching the ids produced by
|
|
55
|
+
* useOutlineFromMarkdown / parseOutlineFromMarkdown. Render it as the
|
|
56
|
+
* element's `id` to keep Outline hash navigation working. Undefined for
|
|
57
|
+
* headings nested inside blockquotes or list items (the outline only
|
|
58
|
+
* lists top-level headings).
|
|
59
|
+
*/
|
|
60
|
+
id?: string;
|
|
53
61
|
}>;
|
|
54
62
|
paragraph?: React.ComponentType<{
|
|
55
63
|
children: React.ReactNode;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Markdown.d.ts","sourceRoot":"","sources":["../../src/Markdown/Markdown.tsx"],"names":[],"mappings":"AAYA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAe/B,OAAO,KAAK,EAAC,WAAW,EAAC,MAAM,gBAAgB,CAAC;AAgBhD,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,cAAc,CAAC;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E,CACZ,IAAI,EAAE,MAAM,EACZ,KAAK,EAAE,KAAK,CAAC,UAAU,CAAC,iBAAiB,CAAC,KACvC,IAAI,GAAG,KAAK,CAAC;IAClB;;;OAGG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,cAAc,CAAC,CAAC;IACzC;;;;;OAKG;IACH,aAAa,CAAC,EAAE,OAAO,GAAG,QAAQ,CAAC;IACnC;;;;;;;;;OASG;IACH,YAAY,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IAC/B;;;;;;OAMG;IACH,YAAY,CAAC,EAAE,OAAO,GAAG,QAAQ,CAAC;IAClC,UAAU,CAAC,EAAE,OAAO,CAAC,kBAAkB,CAAC,CAAC;IACzC;;;;;OAKG;IACH,aAAa,CAAC,EAAE,oBAAoB,EAAE,CAAC;IACvC;;;;;;;;;;;OAWG;IACH,QAAQ,CAAC,EAAE,KAAK,CAAC;CAClB;AA+2CD;;;;;;;;;;GAUG;AACH,wBAAgB,QAAQ,CAAC,EACvB,GAAG,EACH,QAAQ,EACR,OAAiB,EACjB,OAAmB,EACnB,iBAAqB,EACrB,WAAmB,EACnB,WAAW,EACX,OAAO,EACP,aAAuB,EACvB,YAAkB,EAClB,YAAsB,EACtB,UAAU,EACV,aAAa,EACb,QAAQ,EACR,MAAM,EACN,SAAS,EACT,KAAK,EACL,aAAa,EAAE,MAAM,GACtB,EAAE,aAAa,GAAG,KAAK,CAAC,YAAY,CAmMpC;yBAtNe,QAAQ"}
|
|
@@ -31,7 +31,7 @@ import { computeBoundaries, computeSegments } from "./streaming.js";
|
|
|
31
31
|
import { useTheme } from "../theme/useTheme.js";
|
|
32
32
|
import { Citation } from "../Citation/Citation.js";
|
|
33
33
|
import { useLinkComponent } from "../Link/useLinkComponent.js";
|
|
34
|
-
import { parseInline, parseMarkdown, parseMarkdownIncremental, createIncrementalState, trimStreamingArtifacts } from "./parser.js";
|
|
34
|
+
import { parseInline, parseMarkdown, parseMarkdownIncremental, createIncrementalState, trimStreamingArtifacts, inlineText, slugify, uniqueSlug } from "./parser.js";
|
|
35
35
|
import { themeProps } from "../utils/themeProps.js";
|
|
36
36
|
import { useTranslator } from "../i18n/index.js";
|
|
37
37
|
|
|
@@ -763,7 +763,7 @@ function computeTableColumnMinWidths(node) {
|
|
|
763
763
|
return maxLen <= 6 ? 60 : maxLen <= 15 ? 80 : 120;
|
|
764
764
|
});
|
|
765
765
|
}
|
|
766
|
-
function renderBlock(node, index, blockCount, density, headingLevelStart, onLinkClick, cursor, citationCtx, contentWidthValue, contentAlign, linkComponent = 'a', inlinePlugins, components, t) {
|
|
766
|
+
function renderBlock(node, index, blockCount, density, headingLevelStart, onLinkClick, cursor, citationCtx, contentWidthValue, contentAlign, linkComponent = 'a', inlinePlugins, components, t, headingIdMap) {
|
|
767
767
|
const blockAlignMargin = BLOCK_ALIGN_MARGIN[contentAlign];
|
|
768
768
|
const blockAlignStyle = blockAlignMargin != null ? dynamicStyles.blockAlign(blockAlignMargin) : null;
|
|
769
769
|
const spacing = getElementSpacing(node, density);
|
|
@@ -774,15 +774,22 @@ function renderBlock(node, index, blockCount, density, headingLevelStart, onLink
|
|
|
774
774
|
{
|
|
775
775
|
const level = Math.min(node.level + headingLevelStart - 1, 6);
|
|
776
776
|
const headingChildren = node.children.map((c, i) => renderInline(c, i, onLinkClick, cursor, citationCtx, linkComponent, inlinePlugins, components));
|
|
777
|
+
// Only top-level headings get an id: the map is built from the same
|
|
778
|
+
// traversal parseOutlineFromMarkdown uses (which skips headings nested
|
|
779
|
+
// in blockquotes / list items), so rendered ids and outline ids stay
|
|
780
|
+
// identical — including duplicate-slug numbering.
|
|
781
|
+
const headingId = headingIdMap?.get(node);
|
|
777
782
|
const HeadingComp = components?.heading;
|
|
778
783
|
if (HeadingComp) {
|
|
779
784
|
return /*#__PURE__*/_jsx(HeadingComp, {
|
|
780
785
|
level: level,
|
|
786
|
+
id: headingId,
|
|
781
787
|
children: headingChildren
|
|
782
788
|
}, index);
|
|
783
789
|
}
|
|
784
790
|
const Tag = `h${level}`;
|
|
785
791
|
return /*#__PURE__*/_jsx(Tag, {
|
|
792
|
+
id: headingId,
|
|
786
793
|
...mergeProps(themeProps('markdown-heading', {
|
|
787
794
|
density,
|
|
788
795
|
level
|
|
@@ -1088,6 +1095,27 @@ export function Markdown({
|
|
|
1088
1095
|
}
|
|
1089
1096
|
return parseMarkdown(children, parseOptions);
|
|
1090
1097
|
}, [display, smoothedText, children, isStreaming, parseOptions]);
|
|
1098
|
+
|
|
1099
|
+
// Assign each top-level heading the slug that parseOutlineFromMarkdown
|
|
1100
|
+
// would derive for it, so Outline hash links built from the same source
|
|
1101
|
+
// always find a matching DOM id. Mirrors that function's traversal exactly:
|
|
1102
|
+
// top-level blocks only, one shared duplicate-numbering sequence.
|
|
1103
|
+
// NOTE: must stay above the `display === 'inline'` early return below —
|
|
1104
|
+
// hooks cannot be conditional.
|
|
1105
|
+
const headingIdMap = useMemo(() => {
|
|
1106
|
+
if (display === 'inline' || blocks.length === 0) {
|
|
1107
|
+
return undefined;
|
|
1108
|
+
}
|
|
1109
|
+
const map = new Map();
|
|
1110
|
+
const counts = new Map();
|
|
1111
|
+
for (const block of blocks) {
|
|
1112
|
+
if (block.type === 'heading') {
|
|
1113
|
+
const label = inlineText(block.children).trim();
|
|
1114
|
+
map.set(block, uniqueSlug(slugify(label), counts));
|
|
1115
|
+
}
|
|
1116
|
+
}
|
|
1117
|
+
return map;
|
|
1118
|
+
}, [display, blocks]);
|
|
1091
1119
|
const inlineNodes = useMemo(() => {
|
|
1092
1120
|
if (display !== 'inline') {
|
|
1093
1121
|
return [];
|
|
@@ -1158,7 +1186,7 @@ export function Markdown({
|
|
|
1158
1186
|
...mergeProps(themeProps('markdown', {
|
|
1159
1187
|
density
|
|
1160
1188
|
}), stylex.props(styles.root, xstyle), className, style),
|
|
1161
|
-
children: blocks.map((block, i) => renderBlock(block, i, blocks.length, density, headingLevelStart, onLinkClick, cursor, citationCtx, contentWidth ? typeof contentWidth === 'number' ? `${contentWidth}px` : contentWidth : null, contentAlign, LinkComponent, inlinePlugins, components, t))
|
|
1189
|
+
children: blocks.map((block, i) => renderBlock(block, i, blocks.length, density, headingLevelStart, onLinkClick, cursor, citationCtx, contentWidth ? typeof contentWidth === 'number' ? `${contentWidth}px` : contentWidth : null, contentAlign, LinkComponent, inlinePlugins, components, t, headingIdMap))
|
|
1162
1190
|
});
|
|
1163
1191
|
|
|
1164
1192
|
// Store current blocks for next render's boundary calculation.
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @file parser.ts
|
|
3
3
|
* @input Markdown string
|
|
4
|
-
* @output Array of MarkdownNode AST nodes
|
|
5
|
-
*
|
|
4
|
+
* @output Array of MarkdownNode AST nodes; heading slug helpers
|
|
5
|
+
* (inlineText, slugify, uniqueSlug) shared by Markdown rendering and
|
|
6
|
+
* Outline's parseOutlineFromMarkdown
|
|
7
|
+
* @position Core parser; consumed by Markdown.tsx and Outline
|
|
6
8
|
*/
|
|
7
9
|
export type InlineNode = {
|
|
8
10
|
type: 'text';
|
|
@@ -131,4 +133,14 @@ export declare function createIncrementalState(): IncrementalState;
|
|
|
131
133
|
export declare function trimStreamingArtifacts(input: string): string;
|
|
132
134
|
export declare function parseMarkdownIncremental(input: string, state: IncrementalState, sourceIds?: ReadonlySet<string>): BlockNode[];
|
|
133
135
|
export declare function parseMarkdownIncremental(input: string, state: IncrementalState, options: ParseOptions): BlockNode[];
|
|
136
|
+
/** Flatten inline nodes into their plain text content. */
|
|
137
|
+
export declare function inlineText(nodes: InlineNode[]): string;
|
|
138
|
+
/** Turn heading text into a URL-safe slug (lowercase, hyphen-separated). */
|
|
139
|
+
export declare function slugify(value: string): string;
|
|
140
|
+
/**
|
|
141
|
+
* Disambiguate repeated slugs with a numeric suffix (`setup`, `setup-1`, …).
|
|
142
|
+
* Empty slugs fall back to `section`. The caller owns the counts map so one
|
|
143
|
+
* document shares a single numbering sequence.
|
|
144
|
+
*/
|
|
145
|
+
export declare function uniqueSlug(baseSlug: string, counts: Map<string, number>): string;
|
|
134
146
|
//# sourceMappingURL=parser.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"parser.d.ts","sourceRoot":"","sources":["../../src/Markdown/parser.ts"],"names":[],"mappings":"AAEA
|
|
1
|
+
{"version":3,"file":"parser.d.ts","sourceRoot":"","sources":["../../src/Markdown/parser.ts"],"names":[],"mappings":"AAEA;;;;;;;GAOG;AAMH,MAAM,MAAM,UAAU,GAClB;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAC,GAC/B;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,UAAU,EAAE,CAAA;CAAC,GACtC;IAAC,IAAI,EAAE,QAAQ,CAAC;IAAC,QAAQ,EAAE,UAAU,EAAE,CAAA;CAAC,GACxC;IAAC,IAAI,EAAE,eAAe,CAAC;IAAC,QAAQ,EAAE,UAAU,EAAE,CAAA;CAAC,GAC/C;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAC,GAC/B;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,UAAU,EAAE,CAAA;CAAC,GACpD;IAAC,IAAI,EAAE,OAAO,CAAC;IAAC,GAAG,EAAE,MAAM,CAAC;IAAC,GAAG,EAAE,MAAM,CAAA;CAAC,GACzC;IAAC,IAAI,EAAE,UAAU,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAA;CAAC,GACpC;IAAC,IAAI,EAAE,OAAO,CAAA;CAAC,CAAC;AAEpB,MAAM,MAAM,SAAS,GACjB;IAAC,IAAI,EAAE,SAAS,CAAC;IAAC,KAAK,EAAE,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;IAAC,QAAQ,EAAE,UAAU,EAAE,CAAA;CAA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5E,wBAAgB,OAAO,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAO7C;AAED;;;;GAIG;AACH,wBAAgB,UAAU,CACxB,QAAQ,EAAE,MAAM,EAChB,MAAM,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,GAC1B,MAAM,CAKR"}
|
package/dist/Markdown/parser.js
CHANGED
|
@@ -3,8 +3,10 @@
|
|
|
3
3
|
/**
|
|
4
4
|
* @file parser.ts
|
|
5
5
|
* @input Markdown string
|
|
6
|
-
* @output Array of MarkdownNode AST nodes
|
|
7
|
-
*
|
|
6
|
+
* @output Array of MarkdownNode AST nodes; heading slug helpers
|
|
7
|
+
* (inlineText, slugify, uniqueSlug) shared by Markdown rendering and
|
|
8
|
+
* Outline's parseOutlineFromMarkdown
|
|
9
|
+
* @position Core parser; consumed by Markdown.tsx and Outline
|
|
8
10
|
*/
|
|
9
11
|
|
|
10
12
|
// ---------------------------------------------------------------------------
|
|
@@ -1625,4 +1627,50 @@ export function parseMarkdownIncremental(input, state, arg) {
|
|
|
1625
1627
|
state.settledUpTo = boundary;
|
|
1626
1628
|
state.prevInput = input;
|
|
1627
1629
|
return mergeSettledBlocks(settledBlocks, unsettledBlocks);
|
|
1630
|
+
}
|
|
1631
|
+
|
|
1632
|
+
// ---------------------------------------------------------------------------
|
|
1633
|
+
// Heading slugs
|
|
1634
|
+
// ---------------------------------------------------------------------------
|
|
1635
|
+
// Single source of truth for the heading id contract: Markdown renders these
|
|
1636
|
+
// slugs as `id` attributes on h1–h6, and Outline's parseOutlineFromMarkdown
|
|
1637
|
+
// derives its item ids from the same functions, so outline hash links always
|
|
1638
|
+
// resolve to a rendered heading by construction.
|
|
1639
|
+
|
|
1640
|
+
/** Flatten inline nodes into their plain text content. */
|
|
1641
|
+
export function inlineText(nodes) {
|
|
1642
|
+
return nodes.map(node => {
|
|
1643
|
+
switch (node.type) {
|
|
1644
|
+
case 'text':
|
|
1645
|
+
case 'code':
|
|
1646
|
+
return node.content;
|
|
1647
|
+
case 'bold':
|
|
1648
|
+
case 'italic':
|
|
1649
|
+
case 'strikethrough':
|
|
1650
|
+
case 'link':
|
|
1651
|
+
return inlineText(node.children);
|
|
1652
|
+
case 'image':
|
|
1653
|
+
return node.alt;
|
|
1654
|
+
case 'citation':
|
|
1655
|
+
case 'break':
|
|
1656
|
+
return '';
|
|
1657
|
+
}
|
|
1658
|
+
}).join('');
|
|
1659
|
+
}
|
|
1660
|
+
|
|
1661
|
+
/** Turn heading text into a URL-safe slug (lowercase, hyphen-separated). */
|
|
1662
|
+
export function slugify(value) {
|
|
1663
|
+
return value.trim().toLowerCase().replace(/['"]/g, '').replace(/[^a-z0-9]+/g, '-').replace(/^-+|-+$/g, '');
|
|
1664
|
+
}
|
|
1665
|
+
|
|
1666
|
+
/**
|
|
1667
|
+
* Disambiguate repeated slugs with a numeric suffix (`setup`, `setup-1`, …).
|
|
1668
|
+
* Empty slugs fall back to `section`. The caller owns the counts map so one
|
|
1669
|
+
* document shares a single numbering sequence.
|
|
1670
|
+
*/
|
|
1671
|
+
export function uniqueSlug(baseSlug, counts) {
|
|
1672
|
+
const fallbackSlug = baseSlug || 'section';
|
|
1673
|
+
const count = counts.get(fallbackSlug) ?? 0;
|
|
1674
|
+
counts.set(fallbackSlug, count + 1);
|
|
1675
|
+
return count === 0 ? fallbackSlug : `${fallbackSlug}-${count}`;
|
|
1628
1676
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MultiSelector.d.ts","sourceRoot":"","sources":["../../src/MultiSelector/MultiSelector.tsx"],"names":[],"mappings":"AAIA;;;;;;;;;;;;GAYG;AAEH,OAAO,KAAK,EAAE,EASZ,KAAK,SAAS,EACf,MAAM,OAAO,CAAC;AAIf,OAAO,EAAuB,KAAK,QAAQ,EAAC,MAAM,SAAS,CAAC;AAE5D,OAAO,EAML,KAAK,kBAAkB,EACxB,MAAM,UAAU,CAAC;AAKlB,OAAO,KAAK,EAAC,iBAAiB,EAAC,MAAM,c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3B;;;;;;OAMG;IACH,cAAc,CAAC,EAAE,OAAO,GAAG,QAAQ,GAAG,QAAQ,CAAC;IAE/C;;;;OAIG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IAEnB;;;OAGG;IACH,YAAY,CAAC,EAAE,CAAC,MAAM,EAAE,uBAAuB,KAAK,SAAS,CAAC;IAE9D;;;;OAIG;IACH,iBAAiB,CAAC,EAAE,iBAAiB,CAAC;IAEtC;;;;OAIG;IACH,aAAa,CAAC,EAAE,OAAO,CAAC;IAExB;;OAEG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AA+BD;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,aAAa,CAAC,CAAC,SAAS,uBAAuB,EAAE,EAC/D,KAAK,EACL,aAAqB,EACrB,WAAW,EACX,UAAkB,EAClB,UAAkB,EAClB,UAAkB,EAClB,eAAe,EACf,OAAO,EACP,KAAK,EACL,QAAQ,EACR,YAAY,EACZ,SAAiB,EACjB,WAAW,EAAE,oBAAoB,EACjC,IAAI,EAAE,QAAQ,EACd,OAAiB,EACjB,MAAM,EACN,aAA0B,EAC1B,YAAY,EACZ,SAAS,EACT,QAAgB,EAChB,YAAoB,EACpB,cAAc,EAAE,uBAAuB,EACvC,SAAiB,EACjB,iBAAiB,EAAE,0BAA0B,EAC7C,cAAwB,EACxB,SAAa,EACb,YAAY,EACZ,iBAA2B,EAC3B,aAAqB,EACrB,aAAa,EAAE,MAAM,EACrB,QAAQ,EACR,KAAK,EACL,MAAM,EACN,SAAS,EACT,KAAK,GACN,EAAE,kBAAkB,CAAC,CAAC,CAAC,qBAm+BvB;yBAvgCe,aAAa"}
|
|
@@ -32,6 +32,7 @@ import { isOptionData, isDivider, isSection, normalizeOption, getSelectableOptio
|
|
|
32
32
|
import { useMultiCombobox } from "./hooks.js";
|
|
33
33
|
import { getInputARIA, isImeKeyEvent, mergeProps } from "../utils/index.js";
|
|
34
34
|
import { useAnnounce } from "../hooks/useAnnounce.js";
|
|
35
|
+
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 { focusOutlineStyles } from "../utils/focusOutline.stylex.js";
|
|
@@ -287,6 +288,10 @@ export function MultiSelector({
|
|
|
287
288
|
style
|
|
288
289
|
}) {
|
|
289
290
|
const t = useTranslator();
|
|
291
|
+
const isEffectivelyRequired = useResolvedRequired({
|
|
292
|
+
isRequired,
|
|
293
|
+
isOptional
|
|
294
|
+
});
|
|
290
295
|
const placeholder = placeholderFromProps ?? t('@astryx.multiSelector.selectPlaceholder');
|
|
291
296
|
const selectAllLabel = selectAllLabelFromProps ?? t('@astryx.multiSelector.selectAll');
|
|
292
297
|
const searchPlaceholder = searchPlaceholderFromProps ?? t('@astryx.multiSelector.searchPlaceholder');
|
|
@@ -905,7 +910,7 @@ export function MultiSelector({
|
|
|
905
910
|
"aria-activedescendant": !hasSearch && popover.isOpen && highlightedIndex >= 0 ? getItemId(highlightedIndex) : undefined,
|
|
906
911
|
"aria-describedby": ariaDescribedBy,
|
|
907
912
|
"aria-labelledby": ariaLabelledBy,
|
|
908
|
-
"aria-required":
|
|
913
|
+
"aria-required": isEffectivelyRequired ? 'true' : undefined,
|
|
909
914
|
"aria-invalid": status?.type === 'error' ? 'true' : undefined,
|
|
910
915
|
"aria-busy": isBusy || undefined
|
|
911
916
|
// With a disabledMessage the trigger keeps focusability via
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NumberInput.d.ts","sourceRoot":"","sources":["../../src/NumberInput/NumberInput.tsx"],"names":[],"mappings":"AAIA;;;;;;;;;;;;GAYG;AAEH,OAAO,EAML,KAAK,UAAU,EACf,KAAK,aAAa,EAClB,KAAK,SAAS,EACf,MAAM,OAAO,CAAC;AACf,OAAO,KAAK,MAAM,MAAM,kBAAkB,CAAC;AAU3C,OAAO,EAGL,KAAK,WAAW,EAKhB,KAAK,kBA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ACN,SAAS,EACT,KAAK,EACL,GAAG,EACH,GAAG,IAAI,EACR,EAAE,gBAAgB,+BA8elB;yBAthBe,WAAW"}
|
|
@@ -27,6 +27,7 @@ import { getInputARIA } from "../utils/index.js";
|
|
|
27
27
|
import { useSize } from "../SizeContext/SizeContext.js";
|
|
28
28
|
import { useInputContainer } from "../hooks/useInputContainer.js";
|
|
29
29
|
import { useInputStatusIcon } from "../hooks/useInputStatusIcon.js";
|
|
30
|
+
import { useResolvedRequired } from "../hooks/useResolvedRequired.js";
|
|
30
31
|
import { useInputGroup } from "../InputGroup/InputGroupContext.js";
|
|
31
32
|
const styles = {
|
|
32
33
|
wrapper: {
|
|
@@ -202,6 +203,10 @@ export function NumberInput({
|
|
|
202
203
|
...rest
|
|
203
204
|
}) {
|
|
204
205
|
const t = useTranslator();
|
|
206
|
+
const isEffectivelyRequired = useResolvedRequired({
|
|
207
|
+
isRequired,
|
|
208
|
+
isOptional
|
|
209
|
+
});
|
|
205
210
|
const size = useSize(sizeProp, 'md');
|
|
206
211
|
const id = useId();
|
|
207
212
|
const inputLabelID = useId();
|
|
@@ -509,7 +514,7 @@ export function NumberInput({
|
|
|
509
514
|
"aria-valuenow": value ?? undefined,
|
|
510
515
|
"aria-valuetext": value == null || !formatValue ? undefined : formattedValue,
|
|
511
516
|
"aria-describedby": ariaDescribedBy,
|
|
512
|
-
"aria-required":
|
|
517
|
+
"aria-required": isEffectivelyRequired ? 'true' : undefined,
|
|
513
518
|
"aria-invalid": status?.type === 'error' || !isInputValid ? 'true' : undefined,
|
|
514
519
|
"aria-labelledby": ariaLabelledBy,
|
|
515
520
|
...{
|
|
@@ -4,6 +4,8 @@ import type { OutlineItem } from './types';
|
|
|
4
4
|
*
|
|
5
5
|
* Uses Markdown's parser so fenced code blocks, tables, lists, and inline
|
|
6
6
|
* formatting are interpreted consistently with rendered Markdown output.
|
|
7
|
+
* Ids come from the parser's shared slug helpers, so they always match the
|
|
8
|
+
* `id` attributes Markdown renders on its headings.
|
|
7
9
|
*/
|
|
8
10
|
export declare function parseOutlineFromMarkdown(markdown: string): OutlineItem[];
|
|
9
11
|
//# sourceMappingURL=parseOutlineFromMarkdown.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"parseOutlineFromMarkdown.d.ts","sourceRoot":"","sources":["../../src/Outline/parseOutlineFromMarkdown.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"parseOutlineFromMarkdown.d.ts","sourceRoot":"","sources":["../../src/Outline/parseOutlineFromMarkdown.ts"],"names":[],"mappings":"AAoBA,OAAO,KAAK,EAAC,WAAW,EAAC,MAAM,SAAS,CAAC;AAEzC;;;;;;;GAOG;AACH,wBAAgB,wBAAwB,CAAC,QAAQ,EAAE,MAAM,GAAG,WAAW,EAAE,CAYxE"}
|