@astryxdesign/core 0.1.4-canary.39ffd21 → 0.1.4-canary.3d64ef2
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/Banner/Banner.d.ts.map +1 -1
- package/dist/Banner/Banner.js +8 -1
- package/dist/Calendar/Calendar.d.ts.map +1 -1
- package/dist/Calendar/Calendar.js +31 -11
- package/dist/Calendar/styles.d.ts +2 -2
- package/dist/Calendar/styles.d.ts.map +1 -1
- package/dist/Calendar/styles.js +2 -2
- package/dist/Card/Card.d.ts +4 -2
- package/dist/Card/Card.d.ts.map +1 -1
- package/dist/Card/Card.js +15 -7
- package/dist/Carousel/Carousel.d.ts.map +1 -1
- package/dist/Carousel/Carousel.js +1 -0
- package/dist/Chat/ChatToolCalls.d.ts.map +1 -1
- package/dist/Chat/ChatToolCalls.js +8 -1
- package/dist/CheckboxInput/CheckboxInput.d.ts +1 -1
- package/dist/CheckboxInput/CheckboxInput.d.ts.map +1 -1
- package/dist/CheckboxInput/CheckboxInput.js +3 -1
- package/dist/ClickableCard/ClickableCard.d.ts.map +1 -1
- package/dist/ClickableCard/ClickableCard.js +26 -3
- package/dist/CodeBlock/CodeBlock.d.ts +10 -1
- package/dist/CodeBlock/CodeBlock.d.ts.map +1 -1
- package/dist/CodeBlock/CodeBlock.js +23 -5
- package/dist/Collapsible/Collapsible.d.ts +9 -3
- package/dist/Collapsible/Collapsible.d.ts.map +1 -1
- package/dist/Collapsible/Collapsible.js +101 -13
- package/dist/Collapsible/CollapsibleGroup.d.ts +39 -7
- package/dist/Collapsible/CollapsibleGroup.d.ts.map +1 -1
- package/dist/Collapsible/CollapsibleGroup.js +70 -9
- package/dist/Collapsible/CollapsibleGroupContext.d.ts +31 -0
- package/dist/Collapsible/CollapsibleGroupContext.d.ts.map +1 -1
- package/dist/Collapsible/CollapsibleGroupContext.js +33 -3
- package/dist/Collapsible/index.d.ts +1 -0
- package/dist/Collapsible/index.d.ts.map +1 -1
- package/dist/ContextMenu/ContextMenu.d.ts.map +1 -1
- package/dist/ContextMenu/ContextMenu.js +2 -0
- package/dist/DateTimeInput/DateTimeInput.d.ts.map +1 -1
- package/dist/DateTimeInput/DateTimeInput.js +2 -0
- package/dist/Grid/Grid.d.ts +4 -3
- package/dist/Grid/Grid.d.ts.map +1 -1
- package/dist/Grid/Grid.js +26 -9
- package/dist/Icon/Icon.d.ts.map +1 -1
- package/dist/Icon/Icon.js +5 -1
- package/dist/InputGroup/InputGroup.js +2 -2
- package/dist/Item/Item.js +1 -1
- package/dist/Lightbox/Lightbox.d.ts.map +1 -1
- package/dist/Lightbox/Lightbox.js +26 -2
- package/dist/NumberInput/NumberInput.d.ts.map +1 -1
- package/dist/NumberInput/NumberInput.js +32 -16
- package/dist/Pagination/Pagination.d.ts.map +1 -1
- package/dist/Pagination/Pagination.js +87 -36
- package/dist/PowerSearch/PowerSearch.d.ts.map +1 -1
- package/dist/PowerSearch/PowerSearch.js +39 -21
- package/dist/ProgressBar/ProgressBar.d.ts.map +1 -1
- package/dist/ProgressBar/ProgressBar.js +2 -1
- package/dist/Resizable/ResizeHandle.d.ts.map +1 -1
- package/dist/Resizable/ResizeHandle.js +10 -2
- package/dist/SideNav/SideNav.d.ts.map +1 -1
- package/dist/SideNav/SideNav.js +6 -2
- package/dist/TabList/TabMenu.d.ts.map +1 -1
- package/dist/TabList/TabMenu.js +34 -7
- package/dist/Table/BaseTable.d.ts.map +1 -1
- package/dist/Table/BaseTable.js +14 -3
- package/dist/Table/plugins/columnResize/useTableColumnResize.d.ts.map +1 -1
- package/dist/Table/plugins/columnResize/useTableColumnResize.js +5 -2
- package/dist/Table/plugins/pagination/paginateData.d.ts.map +1 -1
- package/dist/Table/plugins/pagination/paginateData.js +5 -1
- package/dist/Table/plugins/selection/useTableSelectionState.d.ts.map +1 -1
- package/dist/Table/plugins/selection/useTableSelectionState.js +11 -1
- package/dist/Table/plugins/sortable/useTableSortableState.d.ts.map +1 -1
- package/dist/Table/plugins/sortable/useTableSortableState.js +8 -4
- package/dist/Thumbnail/Thumbnail.d.ts +3 -2
- package/dist/Thumbnail/Thumbnail.d.ts.map +1 -1
- package/dist/Thumbnail/Thumbnail.js +1 -0
- package/dist/TimeInput/TimeInput.d.ts.map +1 -1
- package/dist/TimeInput/TimeInput.js +6 -1
- package/dist/Toast/Toast.d.ts.map +1 -1
- package/dist/Toast/Toast.js +11 -3
- package/dist/Toast/ToastViewport.d.ts.map +1 -1
- package/dist/Toast/ToastViewport.js +12 -0
- package/dist/Typeahead/BaseTypeahead.d.ts.map +1 -1
- package/dist/Typeahead/BaseTypeahead.js +5 -2
- package/dist/astryx.css +7 -0
- package/dist/astryx.umd.js +48 -48
- package/dist/astryx.umd.js.map +4 -4
- package/dist/hooks/focusableSelector.d.ts +1 -1
- package/dist/hooks/focusableSelector.d.ts.map +1 -1
- package/dist/hooks/focusableSelector.js +1 -1
- package/dist/hooks/useFocusTrap.d.ts +3 -0
- package/dist/hooks/useFocusTrap.d.ts.map +1 -1
- package/dist/hooks/useFocusTrap.js +38 -1
- package/dist/theme/defineTheme.d.ts +1 -1
- package/dist/theme/defineTheme.d.ts.map +1 -1
- package/dist/theme/expandColorScale.d.ts.map +1 -1
- package/dist/theme/expandColorScale.js +10 -3
- package/dist/theme/hct.d.ts +0 -15
- package/dist/theme/hct.d.ts.map +1 -1
- package/dist/theme/hct.js +9 -9
- package/dist/theme/tokens.d.ts +10 -2
- package/dist/theme/tokens.d.ts.map +1 -1
- package/dist/theme/tokens.js +220 -4
- package/dist/utils/color.d.ts +42 -0
- package/dist/utils/color.d.ts.map +1 -0
- package/dist/utils/color.js +150 -0
- package/dist/utils/index.d.ts +2 -0
- package/dist/utils/index.d.ts.map +1 -1
- package/dist/utils/index.js +2 -1
- package/dist/utils/timeParser.d.ts.map +1 -1
- package/dist/utils/timeParser.js +8 -5
- package/package.json +1 -1
- package/src/Avatar/Avatar.doc.mjs +11 -0
- package/src/Banner/Banner.doc.mjs +8 -0
- package/src/Banner/Banner.test.tsx +38 -0
- package/src/Banner/Banner.tsx +8 -1
- package/src/Calendar/Calendar.doc.mjs +1 -1
- package/src/Calendar/Calendar.test.tsx +112 -4
- package/src/Calendar/Calendar.tsx +26 -5
- package/src/Calendar/styles.ts +12 -2
- package/src/Card/Card.tsx +16 -6
- package/src/Carousel/Carousel.doc.mjs +12 -12
- package/src/Carousel/Carousel.test.tsx +13 -0
- package/src/Carousel/Carousel.tsx +1 -0
- package/src/Chat/Chat.doc.mjs +1 -1
- package/src/Chat/ChatToolCalls.test.tsx +55 -0
- package/src/Chat/ChatToolCalls.tsx +10 -12
- package/src/CheckboxInput/CheckboxInput.doc.mjs +3 -3
- package/src/CheckboxInput/CheckboxInput.test.tsx +71 -4
- package/src/CheckboxInput/CheckboxInput.tsx +2 -0
- package/src/Citation/Citation.doc.mjs +5 -0
- package/src/ClickableCard/ClickableCard.tsx +45 -2
- package/src/CodeBlock/CodeBlock.doc.mjs +7 -2
- package/src/CodeBlock/CodeBlock.test.tsx +87 -3
- package/src/CodeBlock/CodeBlock.tsx +43 -3
- package/src/Collapsible/Collapsible.doc.mjs +8 -4
- package/src/Collapsible/Collapsible.tsx +86 -10
- package/src/Collapsible/CollapsibleGroup.doc.mjs +27 -3
- package/src/Collapsible/CollapsibleGroup.test.tsx +288 -0
- package/src/Collapsible/CollapsibleGroup.tsx +107 -9
- package/src/Collapsible/CollapsibleGroupContext.tsx +42 -2
- package/src/Collapsible/index.ts +4 -0
- package/src/CommandPalette/CommandPaletteEmpty.doc.mjs +5 -0
- package/src/CommandPalette/CommandPaletteGroup.doc.mjs +10 -0
- package/src/CommandPalette/CommandPaletteInput.doc.mjs +6 -0
- package/src/CommandPalette/CommandPaletteItem.doc.mjs +6 -0
- package/src/CommandPalette/CommandPaletteList.doc.mjs +9 -0
- package/src/ContextMenu/ContextMenu.doc.mjs +15 -0
- package/src/ContextMenu/ContextMenu.test.tsx +15 -0
- package/src/ContextMenu/ContextMenu.tsx +2 -0
- package/src/ContextMenu/ContextMenuItem.doc.mjs +6 -0
- package/src/DateTimeInput/DateTimeInput.test.tsx +70 -0
- package/src/DateTimeInput/DateTimeInput.tsx +2 -0
- package/src/Dialog/DialogHeader.doc.mjs +45 -0
- package/src/DropdownMenu/DropdownMenu.doc.mjs +1 -1
- package/src/Field/FieldLabel.test.tsx +2 -2
- package/src/FormLayout/__snapshots__/FormLayout.test.tsx.snap +0 -3
- package/src/Grid/Grid.test.tsx +43 -18
- package/src/Grid/Grid.tsx +26 -9
- package/src/Icon/Icon.test.tsx +41 -29
- package/src/Icon/Icon.tsx +6 -2
- package/src/InputGroup/InputGroup.tsx +2 -2
- package/src/Item/Item.tsx +1 -1
- package/src/Layout/LayoutContent.doc.mjs +12 -0
- package/src/Layout/LayoutPanel.doc.mjs +40 -0
- package/src/Lightbox/Lightbox.doc.mjs +5 -0
- package/src/Lightbox/Lightbox.test.tsx +123 -2
- package/src/Lightbox/Lightbox.tsx +29 -1
- package/src/NavMenu/NavMenu.doc.mjs +15 -0
- package/src/NumberInput/NumberInput.test.tsx +48 -3
- package/src/NumberInput/NumberInput.tsx +32 -15
- package/src/Overlay/Overlay.doc.mjs +6 -0
- package/src/Pagination/Pagination.test.tsx +143 -0
- package/src/Pagination/Pagination.tsx +75 -23
- package/src/Popover/Popover.test.tsx +65 -0
- package/src/PowerSearch/PowerSearch.doc.mjs +2 -2
- package/src/PowerSearch/PowerSearch.test.tsx +109 -1
- package/src/PowerSearch/PowerSearch.tsx +37 -16
- package/src/ProgressBar/ProgressBar.test.tsx +10 -0
- package/src/ProgressBar/ProgressBar.tsx +2 -1
- package/src/Resizable/ResizeHandle.test.tsx +180 -0
- package/src/Resizable/ResizeHandle.tsx +10 -2
- package/src/SegmentedControl/SegmentedControl.doc.mjs +1 -1
- package/src/SelectableCard/SelectableCard.doc.mjs +1 -1
- package/src/SideNav/SideNav.doc.mjs +7 -1
- package/src/SideNav/SideNav.test.tsx +20 -0
- package/src/SideNav/SideNav.tsx +6 -2
- package/src/TabList/TabList.test.tsx +185 -1
- package/src/TabList/TabMenu.tsx +45 -9
- package/src/Table/BaseTable.tsx +13 -2
- package/src/Table/Table.test.tsx +51 -0
- package/src/Table/plugins/columnResize/useTableColumnResize.test.tsx +13 -0
- package/src/Table/plugins/columnResize/useTableColumnResize.tsx +3 -1
- package/src/Table/plugins/pagination/paginateData.ts +5 -1
- package/src/Table/plugins/pagination/useTablePagination.test.tsx +13 -0
- package/src/Table/plugins/selection/useTableSelectionState.test.tsx +23 -0
- package/src/Table/plugins/selection/useTableSelectionState.tsx +11 -6
- package/src/Table/plugins/sortable/useTableSortableState.test.tsx +35 -1
- package/src/Table/plugins/sortable/useTableSortableState.tsx +8 -4
- package/src/TextArea/TextArea.test.tsx +3 -3
- package/src/TextInput/TextInput.test.tsx +3 -3
- package/src/Thumbnail/Thumbnail.test.tsx +36 -2
- package/src/Thumbnail/Thumbnail.tsx +4 -2
- package/src/TimeInput/TimeInput.test.tsx +37 -0
- package/src/TimeInput/TimeInput.tsx +11 -1
- package/src/Timestamp/Timestamp.doc.mjs +1 -1
- package/src/Toast/Toast.tsx +11 -3
- package/src/Toast/ToastViewport.test.tsx +64 -0
- package/src/Toast/ToastViewport.tsx +12 -0
- package/src/ToggleButton/ToggleButton.doc.mjs +1 -0
- package/src/Tokenizer/Tokenizer.doc.mjs +2 -2
- package/src/TopNav/TopNav.doc.mjs +1 -1
- package/src/TreeList/TreeList.doc.mjs +2 -2
- package/src/Typeahead/BaseTypeahead.doc.mjs +19 -0
- package/src/Typeahead/BaseTypeahead.tsx +5 -2
- package/src/Typeahead/Typeahead.doc.mjs +1 -1
- package/src/Typeahead/Typeahead.test.tsx +45 -1
- package/src/__tests__/TestIcon.tsx +26 -0
- package/src/docPropReferences.test.ts +178 -0
- package/src/hooks/focusableSelector.ts +1 -1
- package/src/hooks/useFocusTrap.doc.mjs +4 -2
- package/src/hooks/useFocusTrap.test.tsx +149 -1
- package/src/hooks/useFocusTrap.ts +50 -1
- package/src/theme/SyntaxTheme.doc.mjs +4 -4
- package/src/theme/defineTheme.ts +4 -13
- package/src/theme/derivedVarRegistry.test.ts +2 -2
- package/src/theme/expandColorScale.test.ts +29 -0
- package/src/theme/expandColorScale.ts +11 -6
- package/src/theme/hct.ts +9 -17
- package/src/theme/tokens.test.ts +182 -9
- package/src/theme/tokens.ts +239 -4
- package/src/theme/useTheme.test.tsx +20 -0
- package/src/utils/color.test.ts +133 -0
- package/src/utils/color.ts +148 -0
- package/src/utils/index.ts +3 -0
- package/src/utils/timeParser.test.ts +13 -0
- package/src/utils/timeParser.ts +8 -5
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Collapsible.d.ts","sourceRoot":"","sources":["../../src/Collapsible/Collapsible.tsx"],"names":[],"mappings":"AAIA
|
|
1
|
+
{"version":3,"file":"Collapsible.d.ts","sourceRoot":"","sources":["../../src/Collapsible/Collapsible.tsx"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAEH,OAAO,EAAa,KAAK,SAAS,EAAC,MAAM,OAAO,CAAC;AAgBjD,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,cAAc,CAAC;AAkG5C,MAAM,WAAW,gBAAiB,SAAQ,SAAS;IACjD,wCAAwC;IACxC,GAAG,CAAC,EAAE,KAAK,CAAC,GAAG,CAAC,cAAc,CAAC,CAAC;IAChC;;;OAGG;IACH,OAAO,EAAE,SAAS,CAAC;IAEnB;;OAEG;IACH,QAAQ,CAAC,EAAE,SAAS,CAAC;IAErB;;;OAGG;IACH,aAAa,CAAC,EAAE,OAAO,CAAC;IAExB;;OAEG;IACH,MAAM,CAAC,EAAE,OAAO,CAAC;IAEjB;;OAEG;IACH,YAAY,CAAC,EAAE,CAAC,MAAM,EAAE,OAAO,KAAK,IAAI,CAAC;IAEzC;;;OAGG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IAEf;;OAEG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoCG;AACH,wBAAgB,WAAW,CAAC,EAC1B,OAAO,EACP,QAAQ,EACR,aAAa,EACb,MAAM,EAAE,gBAAgB,EACxB,YAAY,EACZ,KAAK,EACL,GAAG,EACH,MAAM,EACN,SAAS,EACT,KAAK,EACL,GAAG,KAAK,EACT,EAAE,gBAAgB,+BAsElB;yBAlFe,WAAW"}
|
|
@@ -4,15 +4,21 @@
|
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* @file Collapsible.tsx
|
|
7
|
-
* @input Uses React, StyleX, useCollapsible hook, getIcon, theme tokens
|
|
7
|
+
* @input Uses React, StyleX, useCollapsible hook, CollapsibleGroupPresentationContext, getIcon, theme tokens
|
|
8
8
|
* @output Exports Collapsible component and CollapsibleProps
|
|
9
9
|
* @position Collapsible content primitive — trigger toggles visibility of children
|
|
10
10
|
*
|
|
11
11
|
* Collapsible is a standalone primitive that makes any content collapsible.
|
|
12
12
|
* It renders a trigger area (always visible) and a content area that toggles.
|
|
13
|
-
* Handles state management, accessibility (aria-expanded
|
|
13
|
+
* Handles state management, accessibility (aria-expanded + aria-controls linking
|
|
14
|
+
* the trigger to its content region), and chevron indicator.
|
|
14
15
|
*
|
|
15
16
|
* Works standalone or coordinated by CollapsibleGroup via the `value` prop.
|
|
17
|
+
* When the surrounding CollapsibleGroup enables `dividers`, each Collapsible
|
|
18
|
+
* draws its own row chrome (borderBlockStart suppressed on :first-child, plus
|
|
19
|
+
* density padding) from CollapsibleGroupPresentationContext — StyleX has no
|
|
20
|
+
* child selectors, so the group cannot draw it from outside. The presentation
|
|
21
|
+
* context is reset around children so nested collapsibles stay chrome-free.
|
|
16
22
|
*
|
|
17
23
|
* SYNC: When modified, update these files to stay in sync:
|
|
18
24
|
* - /packages/core/src/Collapsible/index.ts (exports)
|
|
@@ -20,10 +26,12 @@
|
|
|
20
26
|
* - /apps/storybook/stories/Collapsible.stories.tsx
|
|
21
27
|
* - /packages/cli/templates/blocks/components/Collapsible/ (showcase blocks)
|
|
22
28
|
*/
|
|
29
|
+
import { use, useId } from 'react';
|
|
23
30
|
import * as stylex from '@stylexjs/stylex';
|
|
24
31
|
import "../theme/tokens.stylex.js";
|
|
25
|
-
import { colorVars, typographyVars, fontWeightVars, spacingVars, typeScaleVars, durationVars, easeVars } from "../theme/tokens.stylex.js";
|
|
32
|
+
import { borderVars, colorVars, typographyVars, fontWeightVars, spacingVars, typeScaleVars, durationVars, easeVars } from "../theme/tokens.stylex.js";
|
|
26
33
|
import { useCollapsible } from "./useCollapsible.js";
|
|
34
|
+
import { CollapsibleGroupPresentationContext } from "./CollapsibleGroupContext.js";
|
|
27
35
|
import { getIcon } from "../Icon/globalIconRegistry.js";
|
|
28
36
|
import { mergeProps } from "../utils/index.js";
|
|
29
37
|
import { themeProps } from "../utils/themeProps.js";
|
|
@@ -32,8 +40,79 @@ const styles = {
|
|
|
32
40
|
root: {
|
|
33
41
|
kzqmXN: "xh8yej3",
|
|
34
42
|
$$css: true
|
|
43
|
+
},
|
|
44
|
+
trigger: {
|
|
45
|
+
kB7OPa: "x9f619",
|
|
46
|
+
k1xSpc: "x78zum5",
|
|
47
|
+
kGNEyG: "x6s0dn4",
|
|
48
|
+
kjj79g: "x1qughib",
|
|
49
|
+
kzqmXN: "xh8yej3",
|
|
50
|
+
kkrTdU: "x1ypdohk",
|
|
51
|
+
kMv6JI: "x9ynric",
|
|
52
|
+
kGuDYH: "x18juvz8",
|
|
53
|
+
k63SB2: "x2mo6ok",
|
|
54
|
+
kMwMTN: "x1tgivj0",
|
|
55
|
+
k9WMMc: "x1yc453h",
|
|
56
|
+
k8WAf4: "xt970qd",
|
|
57
|
+
kI3sdo: "x17nn4n9",
|
|
58
|
+
kInvED: "x1wfwxd8 x7s97pk",
|
|
59
|
+
$$css: true
|
|
60
|
+
},
|
|
61
|
+
contentHidden: {
|
|
62
|
+
k1xSpc: "x1s85apg",
|
|
63
|
+
$$css: true
|
|
64
|
+
},
|
|
65
|
+
content: {
|
|
66
|
+
kLKAdn: "xfsso4q",
|
|
67
|
+
$$css: true
|
|
68
|
+
},
|
|
69
|
+
divided: {
|
|
70
|
+
kEafiO: "x11xkdxz x1g31smg",
|
|
71
|
+
kPef9Z: "x13fuv20",
|
|
72
|
+
kLZC3w: "x1pc3f07",
|
|
73
|
+
$$css: true
|
|
35
74
|
}
|
|
36
75
|
};
|
|
76
|
+
|
|
77
|
+
// Density padding for divided/padded accordion rows. paddingBlock mapping
|
|
78
|
+
// follows Table's density scale (spacing-1/2/3); content only pads its end
|
|
79
|
+
// so text doesn't sit on the divider below (block-start stays spacing-1).
|
|
80
|
+
const densityStyles = {
|
|
81
|
+
triggerCompact: {
|
|
82
|
+
k8WAf4: "xu0wf1k",
|
|
83
|
+
$$css: true
|
|
84
|
+
},
|
|
85
|
+
triggerBalanced: {
|
|
86
|
+
k8WAf4: "xce4md1",
|
|
87
|
+
$$css: true
|
|
88
|
+
},
|
|
89
|
+
triggerSpacious: {
|
|
90
|
+
k8WAf4: "x8o8v82",
|
|
91
|
+
$$css: true
|
|
92
|
+
},
|
|
93
|
+
contentCompact: {
|
|
94
|
+
kGO01o: "xy143xn",
|
|
95
|
+
$$css: true
|
|
96
|
+
},
|
|
97
|
+
contentBalanced: {
|
|
98
|
+
kGO01o: "x1wesfrj",
|
|
99
|
+
$$css: true
|
|
100
|
+
},
|
|
101
|
+
contentSpacious: {
|
|
102
|
+
kGO01o: "xvmdzux",
|
|
103
|
+
$$css: true
|
|
104
|
+
}
|
|
105
|
+
};
|
|
106
|
+
const triggerDensity = {
|
|
107
|
+
compact: densityStyles.triggerCompact,
|
|
108
|
+
balanced: densityStyles.triggerBalanced,
|
|
109
|
+
spacious: densityStyles.triggerSpacious
|
|
110
|
+
};
|
|
111
|
+
const contentDensity = {
|
|
112
|
+
compact: densityStyles.contentCompact,
|
|
113
|
+
balanced: densityStyles.contentBalanced,
|
|
114
|
+
spacious: densityStyles.contentSpacious
|
|
115
|
+
};
|
|
37
116
|
/**
|
|
38
117
|
* A primitive that makes any content collapsible.
|
|
39
118
|
*
|
|
@@ -99,18 +178,27 @@ export function Collapsible({
|
|
|
99
178
|
isCollapsible: collapsibleConfig,
|
|
100
179
|
value
|
|
101
180
|
});
|
|
181
|
+
const presentation = use(CollapsibleGroupPresentationContext);
|
|
182
|
+
const isDivided = presentation != null && presentation.dividers !== 'none';
|
|
183
|
+
const density = presentation?.density ?? null;
|
|
102
184
|
const chevronIcon = getIcon('chevronDown');
|
|
185
|
+
|
|
186
|
+
// Links the trigger to the region it shows/hides so assistive tech can move
|
|
187
|
+
// from the button to its controlled content (disclosure pattern).
|
|
188
|
+
const contentId = useId();
|
|
103
189
|
return /*#__PURE__*/_jsxs("div", {
|
|
104
190
|
ref: ref,
|
|
105
|
-
...mergeProps(themeProps('collapsible'
|
|
191
|
+
...mergeProps(themeProps('collapsible', {
|
|
192
|
+
dividers: isDivided ? presentation.dividers : undefined,
|
|
193
|
+
density: density ?? undefined
|
|
194
|
+
}), stylex.props(styles.root, isDivided && styles.divided, xstyle), className, style),
|
|
106
195
|
...props,
|
|
107
196
|
children: [/*#__PURE__*/_jsxs("button", {
|
|
108
197
|
type: "button",
|
|
109
198
|
onClick: toggle,
|
|
110
199
|
"aria-expanded": isOpen,
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
},
|
|
200
|
+
"aria-controls": contentId,
|
|
201
|
+
...stylex.props(styles.trigger, density != null && triggerDensity[density]),
|
|
114
202
|
children: [/*#__PURE__*/_jsx("span", {
|
|
115
203
|
...{
|
|
116
204
|
className: "x1b2iylo xwgcxoh"
|
|
@@ -128,12 +216,12 @@ export function Collapsible({
|
|
|
128
216
|
children: chevronIcon
|
|
129
217
|
})]
|
|
130
218
|
}), /*#__PURE__*/_jsx("div", {
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
219
|
+
id: contentId,
|
|
220
|
+
...stylex.props(styles.content, density != null && contentDensity[density], !isOpen && styles.contentHidden),
|
|
221
|
+
children: presentation != null ? /*#__PURE__*/_jsx(CollapsibleGroupPresentationContext, {
|
|
222
|
+
value: null,
|
|
223
|
+
children: children
|
|
224
|
+
}) : children
|
|
137
225
|
})]
|
|
138
226
|
});
|
|
139
227
|
}
|
|
@@ -1,12 +1,17 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @file CollapsibleGroup.tsx
|
|
3
|
-
* @input Uses React useState, useCallback, CollapsibleGroupContext
|
|
3
|
+
* @input Uses React useState, useCallback, CollapsibleGroupContext, StyleX, theme tokens
|
|
4
4
|
* @output Exports CollapsibleGroup component and CollapsibleGroupProps
|
|
5
|
-
* @position Core collapsible group coordination provider — renders no wrapper
|
|
5
|
+
* @position Core collapsible group coordination provider — renders no wrapper
|
|
6
|
+
* DOM unless `dividers` is enabled
|
|
6
7
|
*
|
|
7
8
|
* CollapsibleGroup groups collapsible components (Card, etc.) with
|
|
8
|
-
* coordinated open/close behavior.
|
|
9
|
-
* DOM element.
|
|
9
|
+
* coordinated open/close behavior. By default it renders only `{children}` —
|
|
10
|
+
* no wrapper DOM element. When `dividers` is 'between' or 'all' it renders a
|
|
11
|
+
* wrapper div that anchors the divider chrome (outer borders, reliable
|
|
12
|
+
* :first-child suppression) and provides dividers/density to items via
|
|
13
|
+
* CollapsibleGroupPresentationContext — each Collapsible draws its own
|
|
14
|
+
* borders since StyleX has no child selectors.
|
|
10
15
|
*
|
|
11
16
|
* In "single" mode (default), only one item can be open at a time.
|
|
12
17
|
* In "multiple" mode, any number of items can be open simultaneously.
|
|
@@ -19,6 +24,7 @@
|
|
|
19
24
|
* - /packages/cli/templates/blocks/components/Collapsible/ (showcase blocks)
|
|
20
25
|
*/
|
|
21
26
|
import React, { type ReactNode } from 'react';
|
|
27
|
+
import type { CollapsibleGroupDensity, CollapsibleGroupDividers } from './CollapsibleGroupContext';
|
|
22
28
|
import type { BaseProps } from '../BaseProps';
|
|
23
29
|
export interface CollapsibleGroupProps extends Omit<BaseProps<HTMLElement>, 'onChange'> {
|
|
24
30
|
ref?: React.Ref<HTMLElement>;
|
|
@@ -41,6 +47,22 @@ export interface CollapsibleGroupProps extends Omit<BaseProps<HTMLElement>, 'onC
|
|
|
41
47
|
* Callback when the open item(s) change.
|
|
42
48
|
*/
|
|
43
49
|
onChange?: (value: string | string[]) => void;
|
|
50
|
+
/**
|
|
51
|
+
* Divider style rendered around the group's items — the accordion row
|
|
52
|
+
* chrome. 'between' draws hairlines between adjacent items; 'all' adds the
|
|
53
|
+
* group's top and bottom edges. When enabled, the group renders a wrapper
|
|
54
|
+
* div (it otherwise renders no DOM) and items get 'balanced' density unless
|
|
55
|
+
* `density` says otherwise. Pair with bare Collapsible children; Card-wrapped
|
|
56
|
+
* items provide their own separation.
|
|
57
|
+
* @default "none"
|
|
58
|
+
*/
|
|
59
|
+
dividers?: CollapsibleGroupDividers;
|
|
60
|
+
/**
|
|
61
|
+
* Row density controlling trigger and content block padding on the group's
|
|
62
|
+
* items. Defaults to 'balanced' when dividers are shown; otherwise items
|
|
63
|
+
* keep their default unpadded look.
|
|
64
|
+
*/
|
|
65
|
+
density?: CollapsibleGroupDensity;
|
|
44
66
|
/**
|
|
45
67
|
* Children — any components that support isCollapsible + value.
|
|
46
68
|
*
|
|
@@ -69,16 +91,26 @@ export interface CollapsibleGroupProps extends Omit<BaseProps<HTMLElement>, 'onC
|
|
|
69
91
|
}
|
|
70
92
|
/**
|
|
71
93
|
* Groups collapsible components with coordinated open/close behavior.
|
|
72
|
-
* Renders no wrapper DOM.
|
|
94
|
+
* Renders no wrapper DOM unless `dividers` is enabled.
|
|
73
95
|
*
|
|
74
96
|
* In "single" mode (default), opening one item closes the others.
|
|
75
97
|
* In "multiple" mode, items toggle independently.
|
|
76
98
|
*
|
|
77
99
|
* @compositionHint Wrap Collapsible instances to coordinate their open/close state.
|
|
78
|
-
* Each Collapsible needs a `value` prop to participate.
|
|
100
|
+
* Each Collapsible needs a `value` prop to participate. For FAQ-style lists,
|
|
101
|
+
* use `dividers` with bare Collapsible children instead of wrapping each item
|
|
102
|
+
* in Card.
|
|
79
103
|
*
|
|
80
104
|
* @example
|
|
81
105
|
* ```
|
|
106
|
+
* <CollapsibleGroup type="single" dividers="between" defaultValue="faq1">
|
|
107
|
+
* <Collapsible trigger="What is Astryx?" value="faq1">
|
|
108
|
+
* Astryx is a design system for building internal tools.
|
|
109
|
+
* </Collapsible>
|
|
110
|
+
* <Collapsible trigger="How do I start?" value="faq2">
|
|
111
|
+
* Install the package and import components.
|
|
112
|
+
* </Collapsible>
|
|
113
|
+
* </CollapsibleGroup>
|
|
82
114
|
* <CollapsibleGroup type="single" defaultValue="faq1">
|
|
83
115
|
* <VStack gap={2}>
|
|
84
116
|
* <Card>
|
|
@@ -95,7 +127,7 @@ export interface CollapsibleGroupProps extends Omit<BaseProps<HTMLElement>, 'onC
|
|
|
95
127
|
* </CollapsibleGroup>
|
|
96
128
|
* ```
|
|
97
129
|
*/
|
|
98
|
-
export declare function CollapsibleGroup({ type, defaultValue, value: controlledValue, onChange, children, }: CollapsibleGroupProps): React.JSX.Element;
|
|
130
|
+
export declare function CollapsibleGroup({ type, defaultValue, value: controlledValue, onChange, dividers, density, children, ref, xstyle, className, style, ...props }: CollapsibleGroupProps): React.JSX.Element;
|
|
99
131
|
export declare namespace CollapsibleGroup {
|
|
100
132
|
var displayName: string;
|
|
101
133
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CollapsibleGroup.d.ts","sourceRoot":"","sources":["../../src/Collapsible/CollapsibleGroup.tsx"],"names":[],"mappings":"AAIA
|
|
1
|
+
{"version":3,"file":"CollapsibleGroup.d.ts","sourceRoot":"","sources":["../../src/Collapsible/CollapsibleGroup.tsx"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AAEH,OAAO,KAAK,EAAE,EAAiC,KAAK,SAAS,EAAC,MAAM,OAAO,CAAC;AAO5E,OAAO,KAAK,EAEV,uBAAuB,EACvB,wBAAwB,EAEzB,MAAM,2BAA2B,CAAC;AAGnC,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,cAAc,CAAC;AAe5C,MAAM,WAAW,qBAAsB,SAAQ,IAAI,CACjD,SAAS,CAAC,WAAW,CAAC,EACtB,UAAU,CACX;IACC,GAAG,CAAC,EAAE,KAAK,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC;IAC7B;;;OAGG;IACH,IAAI,CAAC,EAAE,QAAQ,GAAG,UAAU,CAAC;IAE7B;;;OAGG;IACH,YAAY,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;IAEjC;;;OAGG;IACH,KAAK,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;IAE1B;;OAEG;IACH,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,EAAE,KAAK,IAAI,CAAC;IAE9C;;;;;;;;OAQG;IACH,QAAQ,CAAC,EAAE,wBAAwB,CAAC;IAEpC;;;;OAIG;IACH,OAAO,CAAC,EAAE,uBAAuB,CAAC;IAElC;;;;;;;;;;;;;;;;;;;;;;;OAuBG;IACH,QAAQ,EAAE,SAAS,CAAC;CACrB;AASD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqCG;AACH,wBAAgB,gBAAgB,CAAC,EAC/B,IAAe,EACf,YAAY,EACZ,KAAK,EAAE,eAAe,EACtB,QAAQ,EACR,QAAiB,EACjB,OAAO,EACP,QAAQ,EACR,GAAG,EACH,MAAM,EACN,SAAS,EACT,KAAK,EACL,GAAG,KAAK,EACT,EAAE,qBAAqB,qBAwFvB;yBArGe,gBAAgB"}
|
|
@@ -4,13 +4,18 @@
|
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* @file CollapsibleGroup.tsx
|
|
7
|
-
* @input Uses React useState, useCallback, CollapsibleGroupContext
|
|
7
|
+
* @input Uses React useState, useCallback, CollapsibleGroupContext, StyleX, theme tokens
|
|
8
8
|
* @output Exports CollapsibleGroup component and CollapsibleGroupProps
|
|
9
|
-
* @position Core collapsible group coordination provider — renders no wrapper
|
|
9
|
+
* @position Core collapsible group coordination provider — renders no wrapper
|
|
10
|
+
* DOM unless `dividers` is enabled
|
|
10
11
|
*
|
|
11
12
|
* CollapsibleGroup groups collapsible components (Card, etc.) with
|
|
12
|
-
* coordinated open/close behavior.
|
|
13
|
-
* DOM element.
|
|
13
|
+
* coordinated open/close behavior. By default it renders only `{children}` —
|
|
14
|
+
* no wrapper DOM element. When `dividers` is 'between' or 'all' it renders a
|
|
15
|
+
* wrapper div that anchors the divider chrome (outer borders, reliable
|
|
16
|
+
* :first-child suppression) and provides dividers/density to items via
|
|
17
|
+
* CollapsibleGroupPresentationContext — each Collapsible draws its own
|
|
18
|
+
* borders since StyleX has no child selectors.
|
|
14
19
|
*
|
|
15
20
|
* In "single" mode (default), only one item can be open at a time.
|
|
16
21
|
* In "multiple" mode, any number of items can be open simultaneously.
|
|
@@ -23,8 +28,24 @@
|
|
|
23
28
|
* - /packages/cli/templates/blocks/components/Collapsible/ (showcase blocks)
|
|
24
29
|
*/
|
|
25
30
|
import React, { useCallback, useMemo, useState } from 'react';
|
|
26
|
-
import
|
|
31
|
+
import * as stylex from '@stylexjs/stylex';
|
|
32
|
+
import "../theme/tokens.stylex.js";
|
|
33
|
+
import { borderVars, colorVars } from "../theme/tokens.stylex.js";
|
|
34
|
+
import { CollapsibleGroupContext, CollapsibleGroupPresentationContext } from "./CollapsibleGroupContext.js";
|
|
35
|
+
import { mergeProps } from "../utils/index.js";
|
|
36
|
+
import { themeProps } from "../utils/themeProps.js";
|
|
27
37
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
38
|
+
const styles = {
|
|
39
|
+
wrapperAll: {
|
|
40
|
+
kEafiO: "x11xkdxz",
|
|
41
|
+
kPef9Z: "x13fuv20",
|
|
42
|
+
kLZC3w: "x1pc3f07",
|
|
43
|
+
kt9PQ7: "x92x3c3",
|
|
44
|
+
kfdmCh: "x1q0q8m5",
|
|
45
|
+
kL6WhQ: "xw8gpjh",
|
|
46
|
+
$$css: true
|
|
47
|
+
}
|
|
48
|
+
};
|
|
28
49
|
function normalizeToArray(value) {
|
|
29
50
|
if (value == null) {
|
|
30
51
|
return [];
|
|
@@ -34,16 +55,26 @@ function normalizeToArray(value) {
|
|
|
34
55
|
|
|
35
56
|
/**
|
|
36
57
|
* Groups collapsible components with coordinated open/close behavior.
|
|
37
|
-
* Renders no wrapper DOM.
|
|
58
|
+
* Renders no wrapper DOM unless `dividers` is enabled.
|
|
38
59
|
*
|
|
39
60
|
* In "single" mode (default), opening one item closes the others.
|
|
40
61
|
* In "multiple" mode, items toggle independently.
|
|
41
62
|
*
|
|
42
63
|
* @compositionHint Wrap Collapsible instances to coordinate their open/close state.
|
|
43
|
-
* Each Collapsible needs a `value` prop to participate.
|
|
64
|
+
* Each Collapsible needs a `value` prop to participate. For FAQ-style lists,
|
|
65
|
+
* use `dividers` with bare Collapsible children instead of wrapping each item
|
|
66
|
+
* in Card.
|
|
44
67
|
*
|
|
45
68
|
* @example
|
|
46
69
|
* ```
|
|
70
|
+
* <CollapsibleGroup type="single" dividers="between" defaultValue="faq1">
|
|
71
|
+
* <Collapsible trigger="What is Astryx?" value="faq1">
|
|
72
|
+
* Astryx is a design system for building internal tools.
|
|
73
|
+
* </Collapsible>
|
|
74
|
+
* <Collapsible trigger="How do I start?" value="faq2">
|
|
75
|
+
* Install the package and import components.
|
|
76
|
+
* </Collapsible>
|
|
77
|
+
* </CollapsibleGroup>
|
|
47
78
|
* <CollapsibleGroup type="single" defaultValue="faq1">
|
|
48
79
|
* <VStack gap={2}>
|
|
49
80
|
* <Card>
|
|
@@ -65,7 +96,14 @@ export function CollapsibleGroup({
|
|
|
65
96
|
defaultValue,
|
|
66
97
|
value: controlledValue,
|
|
67
98
|
onChange,
|
|
68
|
-
|
|
99
|
+
dividers = 'none',
|
|
100
|
+
density,
|
|
101
|
+
children,
|
|
102
|
+
ref,
|
|
103
|
+
xstyle,
|
|
104
|
+
className,
|
|
105
|
+
style,
|
|
106
|
+
...props
|
|
69
107
|
}) {
|
|
70
108
|
const isControlled = controlledValue !== undefined;
|
|
71
109
|
const [internalValue, setInternalValue] = useState(() => normalizeToArray(defaultValue));
|
|
@@ -96,9 +134,32 @@ export function CollapsibleGroup({
|
|
|
96
134
|
isOpen,
|
|
97
135
|
toggle
|
|
98
136
|
}), [isOpen, toggle]);
|
|
137
|
+
const hasDividers = dividers !== 'none';
|
|
138
|
+
const resolvedDensity = density ?? (hasDividers ? 'balanced' : null);
|
|
139
|
+
const presentationValue = useMemo(() => ({
|
|
140
|
+
dividers,
|
|
141
|
+
density: resolvedDensity
|
|
142
|
+
}), [dividers, resolvedDensity]);
|
|
143
|
+
|
|
144
|
+
// The wrapper anchors divider chrome: 'all' outer borders live here, and it
|
|
145
|
+
// makes the items' :first-child suppression independent of surrounding
|
|
146
|
+
// siblings. Without dividers the group stays DOM-less (documented contract),
|
|
147
|
+
// so ref/xstyle/className/style only take effect in wrapper mode.
|
|
148
|
+
const content = hasDividers ? /*#__PURE__*/_jsx("div", {
|
|
149
|
+
ref: ref,
|
|
150
|
+
...mergeProps(themeProps('collapsible-group', {
|
|
151
|
+
dividers,
|
|
152
|
+
density: resolvedDensity ?? undefined
|
|
153
|
+
}), stylex.props(dividers === 'all' && styles.wrapperAll, xstyle), className, style),
|
|
154
|
+
...props,
|
|
155
|
+
children: children
|
|
156
|
+
}) : children;
|
|
99
157
|
return /*#__PURE__*/_jsx(CollapsibleGroupContext, {
|
|
100
158
|
value: contextValue,
|
|
101
|
-
children:
|
|
159
|
+
children: /*#__PURE__*/_jsx(CollapsibleGroupPresentationContext, {
|
|
160
|
+
value: presentationValue,
|
|
161
|
+
children: content
|
|
162
|
+
})
|
|
102
163
|
});
|
|
103
164
|
}
|
|
104
165
|
CollapsibleGroup.displayName = 'CollapsibleGroup';
|
|
@@ -12,4 +12,35 @@ export interface CollapsibleGroupContextValue {
|
|
|
12
12
|
* When present, collapsible components defer their open/close state to the group.
|
|
13
13
|
*/
|
|
14
14
|
export declare const CollapsibleGroupContext: import("react").Context<CollapsibleGroupContextValue | null>;
|
|
15
|
+
/**
|
|
16
|
+
* Divider style rendered around the items of a CollapsibleGroup.
|
|
17
|
+
* - 'between': hairlines between adjacent items only.
|
|
18
|
+
* - 'all': hairlines between items plus the group's top and bottom edges.
|
|
19
|
+
* - 'none': no dividers (default).
|
|
20
|
+
*/
|
|
21
|
+
export type CollapsibleGroupDividers = 'between' | 'all' | 'none';
|
|
22
|
+
/**
|
|
23
|
+
* Row density for the items of a CollapsibleGroup, controlling trigger and
|
|
24
|
+
* content block padding. Shares the repo-wide density vocabulary
|
|
25
|
+
* (Table, List, Item).
|
|
26
|
+
*/
|
|
27
|
+
export type CollapsibleGroupDensity = 'compact' | 'balanced' | 'spacious';
|
|
28
|
+
/**
|
|
29
|
+
* Presentation value provided by CollapsibleGroup so each Collapsible can
|
|
30
|
+
* draw its own group chrome (StyleX has no child selectors, so the group
|
|
31
|
+
* cannot style items from the outside).
|
|
32
|
+
*/
|
|
33
|
+
export interface CollapsibleGroupPresentationValue {
|
|
34
|
+
/** Resolved divider style for the group's items. */
|
|
35
|
+
dividers: CollapsibleGroupDividers;
|
|
36
|
+
/** Resolved row density, or null to keep the default (unpadded) look. */
|
|
37
|
+
density: CollapsibleGroupDensity | null;
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Context for collapsible group presentation (dividers, density).
|
|
41
|
+
* Kept separate from CollapsibleGroupContext so the public useCollapsible
|
|
42
|
+
* state API is unaffected. Collapsible resets this context around its
|
|
43
|
+
* children so nested collapsibles never inherit row chrome.
|
|
44
|
+
*/
|
|
45
|
+
export declare const CollapsibleGroupPresentationContext: import("react").Context<CollapsibleGroupPresentationValue | null>;
|
|
15
46
|
//# sourceMappingURL=CollapsibleGroupContext.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CollapsibleGroupContext.d.ts","sourceRoot":"","sources":["../../src/Collapsible/CollapsibleGroupContext.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"CollapsibleGroupContext.d.ts","sourceRoot":"","sources":["../../src/Collapsible/CollapsibleGroupContext.tsx"],"names":[],"mappings":"AAoBA;;GAEG;AACH,MAAM,WAAW,4BAA4B;IAC3C,gDAAgD;IAChD,MAAM,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,OAAO,CAAC;IACnC,8CAA8C;IAC9C,MAAM,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;CACjC;AAED;;;GAGG;AACH,eAAO,MAAM,uBAAuB,8DACsB,CAAC;AAG3D;;;;;GAKG;AACH,MAAM,MAAM,wBAAwB,GAAG,SAAS,GAAG,KAAK,GAAG,MAAM,CAAC;AAElE;;;;GAIG;AACH,MAAM,MAAM,uBAAuB,GAAG,SAAS,GAAG,UAAU,GAAG,UAAU,CAAC;AAE1E;;;;GAIG;AACH,MAAM,WAAW,iCAAiC;IAChD,oDAAoD;IACpD,QAAQ,EAAE,wBAAwB,CAAC;IACnC,yEAAyE;IACzE,OAAO,EAAE,uBAAuB,GAAG,IAAI,CAAC;CACzC;AAED;;;;;GAKG;AACH,eAAO,MAAM,mCAAmC,mEACe,CAAC"}
|
|
@@ -5,8 +5,10 @@
|
|
|
5
5
|
/**
|
|
6
6
|
* @file CollapsibleGroupContext.tsx
|
|
7
7
|
* @input Uses React createContext
|
|
8
|
-
* @output Exports CollapsibleGroupContext
|
|
9
|
-
*
|
|
8
|
+
* @output Exports CollapsibleGroupContext, CollapsibleGroupContextValue,
|
|
9
|
+
* CollapsibleGroupPresentationContext, CollapsibleGroupPresentationValue,
|
|
10
|
+
* CollapsibleGroupDividers, and CollapsibleGroupDensity types
|
|
11
|
+
* @position Context definitions for collapsible group coordination and presentation
|
|
10
12
|
*
|
|
11
13
|
* SYNC: When modified, update these files to stay in sync:
|
|
12
14
|
* - /packages/core/src/Collapsible/CollapsibleGroup.tsx (provider)
|
|
@@ -24,4 +26,32 @@ import { createContext } from 'react';
|
|
|
24
26
|
* When present, collapsible components defer their open/close state to the group.
|
|
25
27
|
*/
|
|
26
28
|
export const CollapsibleGroupContext = /*#__PURE__*/createContext(null);
|
|
27
|
-
CollapsibleGroupContext.displayName = 'CollapsibleGroupContext';
|
|
29
|
+
CollapsibleGroupContext.displayName = 'CollapsibleGroupContext';
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* Divider style rendered around the items of a CollapsibleGroup.
|
|
33
|
+
* - 'between': hairlines between adjacent items only.
|
|
34
|
+
* - 'all': hairlines between items plus the group's top and bottom edges.
|
|
35
|
+
* - 'none': no dividers (default).
|
|
36
|
+
*/
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* Row density for the items of a CollapsibleGroup, controlling trigger and
|
|
40
|
+
* content block padding. Shares the repo-wide density vocabulary
|
|
41
|
+
* (Table, List, Item).
|
|
42
|
+
*/
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* Presentation value provided by CollapsibleGroup so each Collapsible can
|
|
46
|
+
* draw its own group chrome (StyleX has no child selectors, so the group
|
|
47
|
+
* cannot style items from the outside).
|
|
48
|
+
*/
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* Context for collapsible group presentation (dividers, density).
|
|
52
|
+
* Kept separate from CollapsibleGroupContext so the public useCollapsible
|
|
53
|
+
* state API is unaffected. Collapsible resets this context around its
|
|
54
|
+
* children so nested collapsibles never inherit row chrome.
|
|
55
|
+
*/
|
|
56
|
+
export const CollapsibleGroupPresentationContext = /*#__PURE__*/createContext(null);
|
|
57
|
+
CollapsibleGroupPresentationContext.displayName = 'CollapsibleGroupPresentationContext';
|
|
@@ -10,6 +10,7 @@ export { Collapsible } from './Collapsible';
|
|
|
10
10
|
export type { CollapsibleProps } from './Collapsible';
|
|
11
11
|
export { CollapsibleGroup } from './CollapsibleGroup';
|
|
12
12
|
export type { CollapsibleGroupProps } from './CollapsibleGroup';
|
|
13
|
+
export type { CollapsibleGroupDividers, CollapsibleGroupDensity, } from './CollapsibleGroupContext';
|
|
13
14
|
export { useCollapsible } from './useCollapsible';
|
|
14
15
|
export type { CollapsibleConfig, UseCollapsibleOptions, UseCollapsibleReturn, } from './useCollapsible';
|
|
15
16
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/Collapsible/index.ts"],"names":[],"mappings":"AAIA;;;;;;;GAOG;AAEH,OAAO,EAAC,WAAW,EAAC,MAAM,eAAe,CAAC;AAC1C,YAAY,EAAC,gBAAgB,EAAC,MAAM,eAAe,CAAC;AAEpD,OAAO,EAAC,gBAAgB,EAAC,MAAM,oBAAoB,CAAC;AACpD,YAAY,EAAC,qBAAqB,EAAC,MAAM,oBAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/Collapsible/index.ts"],"names":[],"mappings":"AAIA;;;;;;;GAOG;AAEH,OAAO,EAAC,WAAW,EAAC,MAAM,eAAe,CAAC;AAC1C,YAAY,EAAC,gBAAgB,EAAC,MAAM,eAAe,CAAC;AAEpD,OAAO,EAAC,gBAAgB,EAAC,MAAM,oBAAoB,CAAC;AACpD,YAAY,EAAC,qBAAqB,EAAC,MAAM,oBAAoB,CAAC;AAC9D,YAAY,EACV,wBAAwB,EACxB,uBAAuB,GACxB,MAAM,2BAA2B,CAAC;AAEnC,OAAO,EAAC,cAAc,EAAC,MAAM,kBAAkB,CAAC;AAChD,YAAY,EACV,iBAAiB,EACjB,qBAAqB,EACrB,oBAAoB,GACrB,MAAM,kBAAkB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ContextMenu.d.ts","sourceRoot":"","sources":["../../src/ContextMenu/ContextMenu.tsx"],"names":[],"mappings":"AAGA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAEH,OAAO,KAON,MAAM,O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AAI,CAAC,EAAE,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC;IAC1B;;;OAGG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,4EAA4E;IAC5E,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,4CAA4C;IAC5C,YAAY,CAAC,EAAE,CAAC,MAAM,EAAE,OAAO,KAAK,IAAI,CAAC;IACzC,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AAED,UAAU,oBAAqB,SAAQ,oBAAoB;IACzD,gDAAgD;IAChD,KAAK,EAAE,iBAAiB,EAAE,CAAC;IAC3B,WAAW,CAAC,EAAE,SAAS,CAAC;CACzB;AAED,UAAU,wBAAyB,SAAQ,oBAAoB;IAC7D,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB,+CAA+C;IAC/C,WAAW,EAAE,SAAS,CAAC;CACxB;AAED,MAAM,MAAM,gBAAgB,GAAG,oBAAoB,GAAG,wBAAwB,CAAC;AAM/E;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,wBAAgB,WAAW,CAAC,EAC1B,QAAQ,EACR,SAAS,EACT,IAAW,EACX,KAAsB,EACtB,UAAkB,EAClB,YAAY,EACZ,GAAG,EACH,SAAS,EACT,KAAK,EACL,MAAM,EACN,aAAa,EACb,aAAa,EAAE,MAAM,EACrB,GAAG,KAAK,EACT,EAAE,gBAAgB,qBAyOlB;yBAvPe,WAAW"}
|
|
@@ -60,6 +60,7 @@ const styles = {
|
|
|
60
60
|
k1ekBW: "x19991ni",
|
|
61
61
|
kIyJzY: "xuedmi6",
|
|
62
62
|
kAMwcw: "xlr8y92",
|
|
63
|
+
kfSwDN: "x87ps6o",
|
|
63
64
|
$$css: true
|
|
64
65
|
},
|
|
65
66
|
popover: {
|
|
@@ -297,6 +298,7 @@ export function ContextMenu({
|
|
|
297
298
|
role: "menu",
|
|
298
299
|
"aria-label": label,
|
|
299
300
|
onKeyDown: listKeyDown,
|
|
301
|
+
onContextMenu: e => e.preventDefault(),
|
|
300
302
|
...mergeProps(themeProps('context-menu'), stylex.props(styles.menu, xstyle), className, style),
|
|
301
303
|
children: /*#__PURE__*/_jsx(DropdownMenuContext, {
|
|
302
304
|
value: contextValue,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DateTimeInput.d.ts","sourceRoot":"","sources":["../../src/DateTimeInput/DateTimeInput.tsx"],"names":[],"mappings":"AAuCA,OAAO,EAEL,KAAK,WAAW,EAMjB,MAAM,UAAU,CAAC;AA4BlB,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,cAAc,CAAC;AAC5C,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,gBAAgB,CAAC;AAI9C,MAAM,MAAM,iBAAiB,GAAG,MAAM,GAAG;IACvC,QAAQ,CAAC,OAAO,EAAE,mBAAmB,CAAC;CACvC,CAAC;AAEF,MAAM,MAAM,uBAAuB,GAAG,KAAK,GAAG,KAAK,CAAC;AAEpD,MAAM,MAAM,iBAAiB,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC;AAEnD,YAAY,EACV,WAAW,IAAI,mBAAmB,EAClC,eAAe,IAAI,uBAAuB,GAC3C,MAAM,UAAU,CAAC;AAiFlB,MAAM,WAAW,kBAAmB,SAAQ,IAAI,CAC9C,SAAS,EACT,UAAU,GAAG,cAAc,CAC5B;IACC,8CAA8C;IAC9C,GAAG,CAAC,EAAE,KAAK,CAAC,GAAG,CAAC,gBAAgB,CAAC,CAAC;IAElC;;OAEG;IACH,KAAK,EAAE,MAAM,CAAC;IAEd;;;OAGG;IACH,aAAa,CAAC,EAAE,OAAO,CAAC;IAExB;;OAEG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IAErB;;;OAGG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC;IAErB;;;OAGG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC;IAErB;;;OAGG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC;IAErB;;;;;;;;;;;;;;;;;;;;OAoBG;IAC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G;IACH,MAAM,CAAC,EAAE,WAAW,CAAC;IAErB;;;;OAIG;IACH,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB;;OAEG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;IAEtB;;;OAGG;IACH,cAAc,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC;CACxB;AAqCD;;;;;;;;;;;;;GAaG;AACH,wBAAgB,aAAa,CAAC,EAC5B,KAAK,EACL,aAAqB,EACrB,WAAW,EACX,UAAkB,EAClB,UAAkB,EAClB,UAAkB,EAClB,eAAe,EACf,KAAK,EACL,QAAQ,EACR,YAAY,EACZ,SAAiB,EACjB,GAAG,EACH,GAAG,EACH,eAAe,EACf,UAAkB,EAClB,UAAkB,EAClB,aAAiB,EACjB,QAAgB,EAChB,WAA6B,EAC7B,eAAiC,EACjC,SAAS,EACT,IAAI,EAAE,QAAQ,EACd,MAAM,EACN,YAAY,EACZ,cAAkB,EAClB,KAAK,EACL,MAAM,EACN,SAAS,EACT,KAAK,EACL,GAAG,EACH,GAAG,IAAI,EACR,EAAE,kBAAkB,+BAwlBpB;yBAxnBe,aAAa"}
|
|
@@ -598,8 +598,10 @@ export function DateTimeInput({
|
|
|
598
598
|
"aria-disabled": showsDisabledMessage ? 'true' : undefined,
|
|
599
599
|
readOnly: showsDisabledMessage || undefined,
|
|
600
600
|
"aria-label": timeLabel ?? `${label} time`,
|
|
601
|
+
"aria-describedby": ariaDescribedBy,
|
|
601
602
|
"aria-required": isRequired === true ? 'true' : undefined,
|
|
602
603
|
"aria-invalid": status?.type === 'error' || !isTimeInputValid ? 'true' : undefined,
|
|
604
|
+
"aria-busy": isBusy || undefined,
|
|
603
605
|
...{
|
|
604
606
|
0: {
|
|
605
607
|
className: "x1lliihq x98rzlu xeuugli xc342km xng3xce x1717udv x9ynric xjm74w1 x6pjikd xw6l6zx x1tgivj0 xjbqb8w x1a2a7pz xeyghm5"
|
package/dist/Grid/Grid.d.ts
CHANGED
|
@@ -26,9 +26,10 @@ export type GridAlignment = 'start' | 'center' | 'end' | 'stretch';
|
|
|
26
26
|
* - `minWidth` — minimum width (px) for each column track
|
|
27
27
|
* - `repeat` — `'fill'` (default) preserves empty tracks for consistent widths;
|
|
28
28
|
* `'fit'` collapses empty tracks so items stretch to fill
|
|
29
|
-
* - `max` — caps the maximum number of columns
|
|
30
|
-
*
|
|
31
|
-
*
|
|
29
|
+
* - `max` — caps the maximum number of columns. The grid stretches to 100%
|
|
30
|
+
* of its parent and the columns that are present always fill the row, so a
|
|
31
|
+
* layout collapsing to a single column on mobile stretches to full width
|
|
32
|
+
* (no dead space on the right).
|
|
32
33
|
*/
|
|
33
34
|
export type GridColumns = number | {
|
|
34
35
|
minWidth: number;
|
package/dist/Grid/Grid.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Grid.d.ts","sourceRoot":"","sources":["../../src/Grid/Grid.tsx"],"names":[],"mappings":"AAIA;;;;;;;;;;;GAWG;AAEH,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,OAAO,CAAC;AACrC,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,cAAc,CAAC;AAG5C,OAAO,KAAK,EAAC,WAAW,EAAC,MAAM,gBAAgB,CAAC;AAChD,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,gBAAgB,CAAC;AAI9C;;GAEG;AAEH,MAAM,MAAM,aAAa,GAAG,OAAO,GAAG,QAAQ,GAAG,KAAK,GAAG,SAAS,CAAC;AAEnE
|
|
1
|
+
{"version":3,"file":"Grid.d.ts","sourceRoot":"","sources":["../../src/Grid/Grid.tsx"],"names":[],"mappings":"AAIA;;;;;;;;;;;GAWG;AAEH,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,OAAO,CAAC;AACrC,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,cAAc,CAAC;AAG5C,OAAO,KAAK,EAAC,WAAW,EAAC,MAAM,gBAAgB,CAAC;AAChD,OAAO,KAAK,EAAC,SAAS,EA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AAM,EACN,QAAQ,EACR,SAAS,EACT,GAAG,EACH,MAAM,EACN,SAAS,EACT,KAAK,EACL,OAAO,EACP,MAAM,EACN,SAAS,EACT,KAAK,EACL,QAAQ,EACR,GAAG,EACH,GAAG,KAAK,EACT,EAAE,SAAS,+BA2FX;yBA9Ge,IAAI"}
|
package/dist/Grid/Grid.js
CHANGED
|
@@ -32,9 +32,10 @@ import { themeProps } from "../utils/themeProps.js";
|
|
|
32
32
|
* - `minWidth` — minimum width (px) for each column track
|
|
33
33
|
* - `repeat` — `'fill'` (default) preserves empty tracks for consistent widths;
|
|
34
34
|
* `'fit'` collapses empty tracks so items stretch to fill
|
|
35
|
-
* - `max` — caps the maximum number of columns
|
|
36
|
-
*
|
|
37
|
-
*
|
|
35
|
+
* - `max` — caps the maximum number of columns. The grid stretches to 100%
|
|
36
|
+
* of its parent and the columns that are present always fill the row, so a
|
|
37
|
+
* layout collapsing to a single column on mobile stretches to full width
|
|
38
|
+
* (no dead space on the right).
|
|
38
39
|
*/
|
|
39
40
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
40
41
|
const baseStyles = {
|
|
@@ -256,16 +257,32 @@ const spacingVarNames = {
|
|
|
256
257
|
};
|
|
257
258
|
|
|
258
259
|
/**
|
|
259
|
-
* Build a grid-template-columns value that caps
|
|
260
|
-
*
|
|
261
|
-
*
|
|
260
|
+
* Build a grid-template-columns value that caps the column *count* at `max`
|
|
261
|
+
* while still letting the columns that are actually present stretch to fill
|
|
262
|
+
* the row.
|
|
263
|
+
*
|
|
264
|
+
* The cap lives on the track's **min** size, not its max: each track is at
|
|
265
|
+
* least `perColumn = (100% - (max-1) * gap) / max`, so more than `max` columns
|
|
266
|
+
* can never fit. The track **max** stays `1fr`, so whenever fewer than `max`
|
|
267
|
+
* columns fit (most importantly a lone column on mobile) they still grow to
|
|
268
|
+
* fill the whole row — no dead space on the right.
|
|
269
|
+
*
|
|
270
|
+
* The track min is `max(minWidth, perColumn)` so an explicit `minWidth` is
|
|
271
|
+
* still honored, wrapped in `min(100%, …)` so a single column on a viewport
|
|
272
|
+
* narrower than `minWidth`/`perColumn` shrinks to the container instead of
|
|
273
|
+
* overflowing it.
|
|
262
274
|
*/
|
|
263
275
|
function buildCappedTemplate(minWidth, maxCols, repeatMode, gap, columnGap) {
|
|
264
276
|
const gapVar = columnGap != null ? spacingVarNames[columnGap] : gap != null ? spacingVarNames[gap] : null;
|
|
265
277
|
|
|
266
|
-
//
|
|
267
|
-
|
|
268
|
-
|
|
278
|
+
// perColumn = (100% - (maxCols - 1) * gap) / maxCols — the width a track
|
|
279
|
+
// would have if exactly `maxCols` columns were present. Used as a floor so
|
|
280
|
+
// the grid never fits more than `maxCols` columns.
|
|
281
|
+
const perColumn = gapVar ? `calc((100% - ${maxCols - 1} * var(${gapVar})) / ${maxCols})` : `calc(100% / ${maxCols})`;
|
|
282
|
+
|
|
283
|
+
// Track min caps the count; track max stays 1fr so present columns fill.
|
|
284
|
+
const trackMin = `min(100%, max(${minWidth}px, ${perColumn}))`;
|
|
285
|
+
return `repeat(${repeatMode}, minmax(${trackMin}, 1fr))`;
|
|
269
286
|
}
|
|
270
287
|
|
|
271
288
|
/**
|