@astryxdesign/core 0.4.7-canary.b7fc8b1 → 0.4.7-canary.d334c4a
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/AspectRatio/AspectRatio.d.ts +24 -0
- package/dist/AspectRatio/AspectRatio.d.ts.map +1 -1
- package/dist/AspectRatio/AspectRatio.js +23 -4
- package/dist/Breadcrumbs/BreadcrumbItem.d.ts.map +1 -1
- package/dist/Breadcrumbs/BreadcrumbItem.js +5 -5
- package/dist/ButtonGroup/ButtonGroup.d.ts.map +1 -1
- package/dist/ButtonGroup/ButtonGroup.js +9 -1
- package/dist/Calendar/Calendar.d.ts +3 -1
- package/dist/Calendar/Calendar.d.ts.map +1 -1
- package/dist/Calendar/Calendar.js +13 -14
- package/dist/Calendar/getInitialFocusDate.d.ts +46 -0
- package/dist/Calendar/getInitialFocusDate.d.ts.map +1 -0
- package/dist/Calendar/getInitialFocusDate.js +62 -0
- package/dist/Chat/ChatMessageList.d.ts +22 -3
- package/dist/Chat/ChatMessageList.d.ts.map +1 -1
- package/dist/Chat/ChatMessageList.js +6 -3
- package/dist/Dialog/Dialog.d.ts +7 -1
- package/dist/Dialog/Dialog.d.ts.map +1 -1
- package/dist/Dialog/Dialog.js +85 -55
- package/dist/Heading/Heading.d.ts.map +1 -1
- package/dist/Heading/Heading.js +6 -2
- package/dist/HoverCard/HoverCard.d.ts +6 -0
- package/dist/HoverCard/HoverCard.d.ts.map +1 -1
- package/dist/HoverCard/useHoverCard.d.ts +5 -0
- package/dist/HoverCard/useHoverCard.d.ts.map +1 -1
- package/dist/HoverCard/useHoverCard.js +67 -25
- package/dist/Layer/LayerDepthContext.d.ts +52 -0
- package/dist/Layer/LayerDepthContext.d.ts.map +1 -0
- package/dist/Layer/LayerDepthContext.js +66 -0
- package/dist/Layer/index.d.ts +3 -0
- package/dist/Layer/index.d.ts.map +1 -1
- package/dist/Layer/index.js +4 -0
- package/dist/Layer/layerStack.d.ts +98 -0
- package/dist/Layer/layerStack.d.ts.map +1 -0
- package/dist/Layer/layerStack.js +306 -0
- package/dist/Layer/useLayerDismissal.d.ts +93 -0
- package/dist/Layer/useLayerDismissal.d.ts.map +1 -0
- package/dist/Layer/useLayerDismissal.js +91 -0
- package/dist/Lightbox/Lightbox.d.ts +1 -0
- package/dist/Lightbox/Lightbox.d.ts.map +1 -1
- package/dist/Lightbox/Lightbox.js +99 -78
- package/dist/Markdown/index.d.ts +1 -1
- package/dist/Markdown/index.d.ts.map +1 -1
- package/dist/Markdown/parser.d.ts +38 -1
- package/dist/Markdown/parser.d.ts.map +1 -1
- package/dist/Markdown/parser.js +149 -23
- package/dist/MobileNav/MobileNav.d.ts +6 -1
- package/dist/MobileNav/MobileNav.d.ts.map +1 -1
- package/dist/MobileNav/MobileNav.js +58 -33
- package/dist/MultiSelector/MultiSelector.d.ts +15 -1
- package/dist/MultiSelector/MultiSelector.d.ts.map +1 -1
- package/dist/MultiSelector/MultiSelector.js +11 -6
- package/dist/MultiSelector/index.d.ts +1 -1
- package/dist/MultiSelector/index.d.ts.map +1 -1
- package/dist/Popover/usePopover.d.ts.map +1 -1
- package/dist/Popover/usePopover.js +20 -17
- package/dist/Stepper/Step.d.ts +140 -0
- package/dist/Stepper/Step.d.ts.map +1 -0
- package/dist/Stepper/Step.js +1045 -0
- package/dist/Stepper/StepStatus.d.ts +24 -0
- package/dist/Stepper/StepStatus.d.ts.map +1 -0
- package/dist/Stepper/StepStatus.js +1 -0
- package/dist/Stepper/Stepper.d.ts +93 -0
- package/dist/Stepper/Stepper.d.ts.map +1 -0
- package/dist/Stepper/Stepper.js +184 -0
- package/dist/Stepper/StepperContext.d.ts +41 -0
- package/dist/Stepper/StepperContext.d.ts.map +1 -0
- package/dist/Stepper/StepperContext.js +34 -0
- package/dist/Stepper/index.d.ts +8 -0
- package/dist/Stepper/index.d.ts.map +1 -0
- package/dist/Stepper/index.js +7 -0
- package/dist/Stepper/stepper.stylex.d.ts +15 -0
- package/dist/Stepper/stepper.stylex.d.ts.map +1 -0
- package/dist/Stepper/stepper.stylex.js +20 -0
- package/dist/Table/plugins/pagination/useTablePagination.d.ts +3 -0
- package/dist/Table/plugins/pagination/useTablePagination.d.ts.map +1 -1
- package/dist/Table/plugins/pagination/useTablePagination.js +21 -4
- package/dist/Table/plugins/rowExpansion/useTableRowExpansion.d.ts.map +1 -1
- package/dist/Table/plugins/rowExpansion/useTableRowExpansion.js +7 -2
- package/dist/Table/plugins/rowStatus/useTableRowStatus.d.ts.map +1 -1
- package/dist/Table/plugins/rowStatus/useTableRowStatus.js +10 -3
- package/dist/Text/Text.d.ts.map +1 -1
- package/dist/Text/Text.js +6 -2
- package/dist/Tooltip/Tooltip.d.ts +5 -0
- package/dist/Tooltip/Tooltip.d.ts.map +1 -1
- package/dist/Tooltip/useTooltip.d.ts +5 -0
- package/dist/Tooltip/useTooltip.d.ts.map +1 -1
- package/dist/Tooltip/useTooltip.js +39 -24
- package/dist/astryx.css +39 -1
- package/dist/hooks/index.d.ts +1 -0
- package/dist/hooks/index.d.ts.map +1 -1
- package/dist/hooks/index.js +1 -0
- package/dist/hooks/useFocusTrap.d.ts +7 -4
- package/dist/hooks/useFocusTrap.d.ts.map +1 -1
- package/dist/hooks/useFocusTrap.js +52 -91
- package/dist/hooks/useMergedRefs.d.ts +18 -0
- package/dist/hooks/useMergedRefs.d.ts.map +1 -0
- package/dist/hooks/useMergedRefs.js +25 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/utils/timeParser.d.ts +1 -1
- package/dist/utils/timeParser.d.ts.map +1 -1
- package/dist/utils/timeParser.js +26 -12
- package/locales/en.json +27 -7
- package/locales/pseudo.json +15 -0
- package/package.json +7 -2
- package/src/AspectRatio/AspectRatio.doc.mjs +6 -3
- package/src/AspectRatio/AspectRatio.test.tsx +57 -10
- package/src/AspectRatio/AspectRatio.tsx +40 -1
- package/src/Breadcrumbs/BreadcrumbItem.tsx +2 -1
- package/src/Button/Button.doc.mjs +22 -0
- package/src/ButtonGroup/ButtonGroup.doc.mjs +7 -1
- package/src/ButtonGroup/ButtonGroup.test.tsx +185 -1
- package/src/ButtonGroup/ButtonGroup.tsx +8 -1
- package/src/Calendar/Calendar.doc.mjs +4 -3
- package/src/Calendar/Calendar.test.tsx +52 -0
- package/src/Calendar/Calendar.tsx +18 -15
- package/src/Calendar/getInitialFocusDate.test.ts +94 -0
- package/src/Calendar/getInitialFocusDate.ts +93 -0
- package/src/Chat/ChatMessageList.doc.mjs +9 -1
- package/src/Chat/ChatMessageList.test.tsx +46 -0
- package/src/Chat/ChatMessageList.tsx +28 -4
- package/src/CodeBlock/CodeBlock.doc.mjs +6 -0
- package/src/ContextMenu/ContextMenu.doc.mjs +5 -0
- package/src/Dialog/Dialog.doc.mjs +8 -3
- package/src/Dialog/Dialog.test.tsx +261 -1
- package/src/Dialog/Dialog.tsx +104 -56
- package/src/DropdownMenu/DropdownMenu.doc.mjs +6 -0
- package/src/Field/Field.doc.mjs +11 -0
- package/src/Heading/Heading.test.tsx +23 -1
- package/src/Heading/Heading.tsx +6 -2
- package/src/HoverCard/HoverCard.doc.mjs +5 -0
- package/src/HoverCard/HoverCard.tsx +6 -0
- package/src/HoverCard/useHoverCard.tsx +81 -30
- package/src/Layer/LayerDepthContext.tsx +62 -0
- package/src/Layer/index.ts +9 -0
- package/src/Layer/layerDismissalFamilies.test.tsx +359 -0
- package/src/Layer/layerDismissalInvariants.test.tsx +417 -0
- package/src/Layer/layerStack.ts +362 -0
- package/src/Layer/useLayerDismissal.test.tsx +469 -0
- package/src/Layer/useLayerDismissal.ts +173 -0
- package/src/Layout/Layout.doc.mjs +2 -2
- package/src/Lightbox/Lightbox.doc.mjs +12 -0
- package/src/Lightbox/Lightbox.tsx +120 -100
- package/src/Link/Link.doc.mjs +39 -0
- package/src/Markdown/index.ts +1 -0
- package/src/Markdown/parser.perf.test.ts +71 -1
- package/src/Markdown/parser.test.ts +145 -2
- package/src/Markdown/parser.ts +208 -22
- package/src/MobileNav/MobileNav.tsx +59 -34
- package/src/MoreMenu/MoreMenu.doc.mjs +7 -1
- package/src/MultiSelector/MultiSelector.doc.mjs +27 -0
- package/src/MultiSelector/MultiSelector.test.tsx +84 -0
- package/src/MultiSelector/MultiSelector.tsx +40 -5
- package/src/MultiSelector/index.ts +1 -0
- package/src/NumberInput/NumberInput.doc.mjs +5 -0
- package/src/Popover/usePopover.tsx +31 -28
- package/src/PowerSearch/PowerSearch.doc.mjs +26 -0
- package/src/Selector/Selector.doc.mjs +11 -0
- package/src/Stepper/Step.doc.mjs +98 -0
- package/src/Stepper/Step.tsx +1638 -0
- package/src/Stepper/StepStatus.ts +26 -0
- package/src/Stepper/Stepper.doc.mjs +370 -0
- package/src/Stepper/Stepper.test.tsx +1024 -0
- package/src/Stepper/Stepper.tsx +258 -0
- package/src/Stepper/StepperContext.ts +71 -0
- package/src/Stepper/index.ts +18 -0
- package/src/Stepper/stepper.stylex.ts +19 -0
- package/src/Table/plugins/pagination/useTablePagination.test.tsx +34 -4
- package/src/Table/plugins/pagination/useTablePagination.tsx +35 -3
- package/src/Table/plugins/rowExpansion/useTableRowExpansion.tsx +9 -2
- package/src/Table/plugins/rowStatus/useTableRowStatus.test.tsx +13 -7
- package/src/Table/plugins/rowStatus/useTableRowStatus.tsx +12 -3
- package/src/Table/useTablePagination.doc.mjs +7 -0
- package/src/Table/useTableRowStatus.doc.mjs +1 -1
- package/src/Text/Text.test.tsx +23 -1
- package/src/Text/Text.tsx +6 -2
- package/src/TextInput/TextInput.doc.mjs +10 -0
- package/src/Toast/Toast.doc.mjs +6 -0
- package/src/Tokenizer/Tokenizer.doc.mjs +16 -0
- package/src/Toolbar/Toolbar.doc.mjs +5 -0
- package/src/Tooltip/Tooltip.doc.mjs +5 -0
- package/src/Tooltip/Tooltip.test.tsx +32 -0
- package/src/Tooltip/Tooltip.tsx +5 -0
- package/src/Tooltip/useTooltip.tsx +47 -24
- package/src/Typeahead/Typeahead.doc.mjs +5 -0
- package/src/__tests__/complexComponentContract.test.tsx +81 -0
- package/src/hooks/index.ts +2 -0
- package/src/hooks/useFocusTrap.ts +54 -107
- package/src/hooks/useFocusTrapEscapeShim.test.tsx +165 -0
- package/src/hooks/useMergedRefs.doc.mjs +79 -0
- package/src/hooks/useMergedRefs.test.tsx +62 -0
- package/src/hooks/useMergedRefs.ts +36 -0
- package/src/index.ts +1 -0
- package/src/utils/timeParser.test.ts +6 -1
- package/src/utils/timeParser.ts +35 -13
- package/src/__tests__/inputWidthContract.test.tsx +0 -69
|
@@ -34,6 +34,25 @@ export interface AspectRatioProps extends BaseProps<HTMLDivElement> {
|
|
|
34
34
|
ref?: React.Ref<HTMLDivElement>;
|
|
35
35
|
/**
|
|
36
36
|
* The aspect ratio as width/height (e.g., 16/9 = 1.777..., 4/3 = 1.333..., 1 for square).
|
|
37
|
+
*
|
|
38
|
+
* The ratio is emitted as a class-level declaration — never an inline
|
|
39
|
+
* style — so it can be made responsive:
|
|
40
|
+
* - StyleX consumers pass an `aspect-ratio` rule via `xstyle`, including
|
|
41
|
+
* under `@media`/`@container` conditions.
|
|
42
|
+
* - Plain-CSS/Tailwind consumers override `aspect-ratio` from their own
|
|
43
|
+
* (unlayered) rules: the compiled component styles live in the
|
|
44
|
+
* `astryx-base` cascade layer, and unlayered CSS wins over layered
|
|
45
|
+
* rules regardless of specificity.
|
|
46
|
+
*
|
|
47
|
+
* @example
|
|
48
|
+
* ```
|
|
49
|
+
* // 3:1 hero that becomes 3:2 when its container stacks
|
|
50
|
+
* <AspectRatio ratio={3 / 1} className="gallery-hero">…</AspectRatio>
|
|
51
|
+
*
|
|
52
|
+
* // CSS: @container gallery (max-width: 720px) {
|
|
53
|
+
* // .gallery-hero { aspect-ratio: 3 / 2; }
|
|
54
|
+
* // }
|
|
55
|
+
* ```
|
|
37
56
|
*/
|
|
38
57
|
ratio: number;
|
|
39
58
|
/**
|
|
@@ -102,6 +121,11 @@ export interface AspectRatioProps extends BaseProps<HTMLDivElement> {
|
|
|
102
121
|
* `ratio={1}` or an oval at other ratios. Both shapes respect the provided
|
|
103
122
|
* `ratio`.
|
|
104
123
|
*
|
|
124
|
+
* The ratio is a class-level declaration (not an inline style), so it can be
|
|
125
|
+
* overridden responsively — via `xstyle` for StyleX consumers, or with a
|
|
126
|
+
* plain unlayered `aspect-ratio` rule for plain-CSS consumers (component
|
|
127
|
+
* styles live in the `astryx-base` cascade layer, which unlayered CSS beats).
|
|
128
|
+
*
|
|
105
129
|
* Sizing: the box takes its width from its container and derives its height
|
|
106
130
|
* from the ratio, so it needs an ancestor with a definite width. Two
|
|
107
131
|
* consequences are worth knowing. Constraining only the height (`height` or
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AspectRatio.d.ts","sourceRoot":"","sources":["../../src/AspectRatio/AspectRatio.tsx"],"names":[],"mappings":"AAEA;;;;;;;;;;;;GAYG;AAEH,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,OAAO,CAAC;AAErC,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,cAAc,CAAC;AAI5C;;;;;GAKG;AACH,MAAM,MAAM,gBAAgB,GAAG,WAAW,GAAG,SAAS,CAAC;AAEvD;;;;;;;GAOG;AACH,MAAM,MAAM,cAAc,GAAG,OAAO,GAAG,SAAS,GAAG,QAAQ,CAAC;AAE5D,MAAM,WAAW,gBAAiB,SAAQ,SAAS,CAAC,cAAc,CAAC;IACjE,wCAAwC;IACxC,GAAG,CAAC,EAAE,KAAK,CAAC,GAAG,CAAC,cAAc,CAAC,CAAC;IAChC
|
|
1
|
+
{"version":3,"file":"AspectRatio.d.ts","sourceRoot":"","sources":["../../src/AspectRatio/AspectRatio.tsx"],"names":[],"mappings":"AAEA;;;;;;;;;;;;GAYG;AAEH,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,OAAO,CAAC;AAErC,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,cAAc,CAAC;AAI5C;;;;;GAKG;AACH,MAAM,MAAM,gBAAgB,GAAG,WAAW,GAAG,SAAS,CAAC;AAEvD;;;;;;;GAOG;AACH,MAAM,MAAM,cAAc,GAAG,OAAO,GAAG,SAAS,GAAG,QAAQ,CAAC;AAE5D,MAAM,WAAW,gBAAiB,SAAQ,SAAS,CAAC,cAAc,CAAC;IACjE,wCAAwC;IACxC,GAAG,CAAC,EAAE,KAAK,CAAC,GAAG,CAAC,cAAc,CAAC,CAAC;IAChC;;;;;;;;;;;;;;;;;;;;;OAqBG;IACH,KAAK,EAAE,MAAM,CAAC;IAEd;;;;;;;;;;;;;;;OAeG;IACH,KAAK,CAAC,EAAE,gBAAgB,CAAC;IAEzB;;;;;;;;;;;;;;;;;;;;;;OAsBG;IACH,GAAG,CAAC,EAAE,cAAc,CAAC;IAErB;;;;;;;OAOG;IACH,QAAQ,EAAE,SAAS,CAAC;CACrB;AAgDD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA0CG;AACH,wBAAgB,WAAW,CAAC,EAC1B,KAAK,EACL,KAAmB,EACnB,GAAG,EACH,QAAQ,EACR,MAAM,EACN,SAAS,EACT,KAAK,EACL,GAAG,EACH,GAAG,KAAK,EACT,EAAE,gBAAgB,+BA4BlB;yBAtCe,WAAW"}
|
|
@@ -49,6 +49,23 @@ const styles = {
|
|
|
49
49
|
}
|
|
50
50
|
};
|
|
51
51
|
|
|
52
|
+
// The ratio compiles to a CSS variable + a class-level declaration
|
|
53
|
+
// (aspect-ratio: var(--x)) instead of a raw inline style, so consumer
|
|
54
|
+
// overrides — `xstyle` rules, including ones inside @media/@container
|
|
55
|
+
// queries — can still win. A raw inline `aspect-ratio` would beat any class
|
|
56
|
+
// (same rationale as Grid's dynamic track values). Non-StyleX consumers
|
|
57
|
+
// don't need a dedicated hook: the compiled declaration sits in the
|
|
58
|
+
// `astryx-base` cascade layer, so any unlayered consumer rule wins
|
|
59
|
+
// regardless of specificity.
|
|
60
|
+
const dynamicStyles = {
|
|
61
|
+
ratio: ratio => [{
|
|
62
|
+
kOBAk4: ratio != null ? "x10y9f9r" : ratio,
|
|
63
|
+
$$css: true
|
|
64
|
+
}, {
|
|
65
|
+
"--x-aspectRatio": ratio != null ? ratio : undefined
|
|
66
|
+
}]
|
|
67
|
+
};
|
|
68
|
+
|
|
52
69
|
/**
|
|
53
70
|
* AspectRatio component for maintaining a specific aspect ratio for its children.
|
|
54
71
|
*
|
|
@@ -64,6 +81,11 @@ const styles = {
|
|
|
64
81
|
* `ratio={1}` or an oval at other ratios. Both shapes respect the provided
|
|
65
82
|
* `ratio`.
|
|
66
83
|
*
|
|
84
|
+
* The ratio is a class-level declaration (not an inline style), so it can be
|
|
85
|
+
* overridden responsively — via `xstyle` for StyleX consumers, or with a
|
|
86
|
+
* plain unlayered `aspect-ratio` rule for plain-CSS consumers (component
|
|
87
|
+
* styles live in the `astryx-base` cascade layer, which unlayered CSS beats).
|
|
88
|
+
*
|
|
67
89
|
* Sizing: the box takes its width from its container and derives its height
|
|
68
90
|
* from the ratio, so it needs an ancestor with a definite width. Two
|
|
69
91
|
* consequences are worth knowing. Constraining only the height (`height` or
|
|
@@ -102,10 +124,7 @@ export function AspectRatio({
|
|
|
102
124
|
ref: ref,
|
|
103
125
|
...mergeProps(themeProps('aspect-ratio', {
|
|
104
126
|
shape
|
|
105
|
-
}), stylex.props(styles.container, shape === 'ellipse' && styles.ellipse, xstyle), className,
|
|
106
|
-
...style,
|
|
107
|
-
aspectRatio: ratio
|
|
108
|
-
}),
|
|
127
|
+
}), stylex.props(styles.container, dynamicStyles.ratio(ratio), shape === 'ellipse' && styles.ellipse, xstyle), className, style),
|
|
109
128
|
...props,
|
|
110
129
|
children: /*#__PURE__*/_jsx("div", {
|
|
111
130
|
"data-astryx-aspect-ratio-override": fit,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BreadcrumbItem.d.ts","sourceRoot":"","sources":["../../src/Breadcrumbs/BreadcrumbItem.tsx"],"names":[],"mappings":"A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AaG;AACH,wBAAgB,cAAc,CAAC,EAC7B,GAAG,EACH,EAAE,EACF,QAAQ,EACR,IAAI,EACJ,OAAO,EACP,SAAS,EAAE,aAAa,EACxB,SAAS,EACT,IAAI,EACJ,QAAQ,EACR,MAAM,EACN,SAAS,EACT,KAAK,EACL,aAAa,EAAE,MAAM,EACrB,GAAG,IAAI,EACR,EAAE,mBAAmB,qBAoMrB;yBAnNe,cAAc"}
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
import React, { use, useCallback, useId, useMemo, useRef, useEffect } from 'react';
|
|
25
25
|
import * as stylex from '@stylexjs/stylex';
|
|
26
26
|
import "../theme/tokens.stylex.js";
|
|
27
|
-
import { colorVars, spacingVars, typeScaleVars, radiusVars } from "../theme/tokens.stylex.js";
|
|
27
|
+
import { colorVars, spacingVars, typeScaleVars, radiusVars, fontWeightVars } from "../theme/tokens.stylex.js";
|
|
28
28
|
import { BreadcrumbContext } from "./Breadcrumbs.js";
|
|
29
29
|
import { useLinkComponent } from "../Link/useLinkComponent.js";
|
|
30
30
|
import { mergeProps, mergeRefs } from "../utils/index.js";
|
|
@@ -240,10 +240,10 @@ export function BreadcrumbItem({
|
|
|
240
240
|
}) : /*#__PURE__*/_jsx("span", {
|
|
241
241
|
...{
|
|
242
242
|
0: {
|
|
243
|
-
className: "x78zum5 x6s0dn4 xzye2dw
|
|
243
|
+
className: "x78zum5 x6s0dn4 xzye2dw x2mo6ok x1tgivj0"
|
|
244
244
|
},
|
|
245
245
|
1: {
|
|
246
|
-
className: "x78zum5 x6s0dn4 xzye2dw
|
|
246
|
+
className: "x78zum5 x6s0dn4 xzye2dw x2mo6ok xv1l7n4"
|
|
247
247
|
}
|
|
248
248
|
}[!!isSupporting << 0],
|
|
249
249
|
"aria-current": "page",
|
|
@@ -290,10 +290,10 @@ export function BreadcrumbItem({
|
|
|
290
290
|
ref: contentRef,
|
|
291
291
|
...{
|
|
292
292
|
0: {
|
|
293
|
-
className: "x78zum5 x6s0dn4 xzye2dw
|
|
293
|
+
className: "x78zum5 x6s0dn4 xzye2dw x2mo6ok x1tgivj0"
|
|
294
294
|
},
|
|
295
295
|
1: {
|
|
296
|
-
className: "x78zum5 x6s0dn4 xzye2dw
|
|
296
|
+
className: "x78zum5 x6s0dn4 xzye2dw x2mo6ok xv1l7n4"
|
|
297
297
|
}
|
|
298
298
|
}[!!isSupporting << 0],
|
|
299
299
|
children: content
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ButtonGroup.d.ts","sourceRoot":"","sources":["../../src/ButtonGroup/ButtonGroup.tsx"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;;;;;GAiBG;AAEH,OAAO,EAAU,KAAK,SAAS,EAAC,MAAM,OAAO,CAAC;AAE9C,OAAO,KAAK,EAAC,UAAU,EAAC,MAAM,WAAW,CAAC;AAE1C,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,gBAAgB,CAAC;AAI9C,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,cAAc,CAAC;AAE5C,OAAO,KAAK,EAAC,sBAAsB,EAAC,MAAM,sBAAsB,CAAC;AAOjE,MAAM,WAAW,gBAAiB,SAAQ,SAAS,CAAC,cAAc,CAAC;IACjE,yCAAyC;IACzC,GAAG,CAAC,EAAE,KAAK,CAAC,GAAG,CAAC,cAAc,CAAC,CAAC;IAEhC;;OAEG;IACH,QAAQ,EAAE,SAAS,CAAC;IAEpB;;OAEG;IACH,KAAK,EAAE,MAAM,CAAC;IAEd;;;OAGG;IACH,WAAW,CAAC,EAAE,sBAAsB,CAAC;IAErC;;;;OAIG;IACH,IAAI,CAAC,EAAE,UAAU,CAAC;IAElB;;;;;OAKG;IACH,SAAS,CAAC,EAAE,SAAS,CAAC;IAEtB;;;OAGG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC;IAErB;;OAEG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AAwCD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,wB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K,EACL,WAA0B,EAC1B,IAAI,EAAE,QAAQ,EACd,UAAkB,EAClB,SAAkB,EAClB,MAAM,EACN,SAAS,EACT,KAAK,EACL,GAAG,EACH,aAAa,EAAE,MAAM,EACrB,SAAS,EACT,GAAG,KAAK,EACT,EAAE,gBAAgB,GAAG,SAAS,CA+C9B;yBA7De,WAAW"}
|
|
@@ -131,6 +131,13 @@ export function ButtonGroup({
|
|
|
131
131
|
handleKeyDown
|
|
132
132
|
} = useListFocus({
|
|
133
133
|
itemSelector: 'button, [tabindex="0"]',
|
|
134
|
+
// A member's layer renders inline inside the group (useLayer does not
|
|
135
|
+
// portal it), so a key pressed in an open DropdownMenu bubbles here. The
|
|
136
|
+
// boundary is the group's own root or any layer, whichever is nearer to
|
|
137
|
+
// the target. Naming the group's own root is what keeps a group rendered
|
|
138
|
+
// inside a Popover or Toast working: bailing on any [popover] ancestor
|
|
139
|
+
// instead would swallow every arrow key it owns.
|
|
140
|
+
boundarySelector: '[role="group"], [popover]',
|
|
134
141
|
orientation
|
|
135
142
|
});
|
|
136
143
|
const contextValue = useMemo(() => ({
|
|
@@ -146,7 +153,8 @@ export function ButtonGroup({
|
|
|
146
153
|
...props,
|
|
147
154
|
...mergeProps(themeProps('button-group', {
|
|
148
155
|
size,
|
|
149
|
-
orientation
|
|
156
|
+
orientation,
|
|
157
|
+
elevation
|
|
150
158
|
}), stylex.props(styles.group, orientation === 'vertical' && styles.vertical, elevationStyles[elevation], xstyle), className, style),
|
|
151
159
|
role: "group",
|
|
152
160
|
"aria-label": label,
|
|
@@ -41,7 +41,9 @@ interface CalendarBaseProps extends Omit<BaseProps<HTMLDivElement>, 'onChange' |
|
|
|
41
41
|
minRangeSpan?: number;
|
|
42
42
|
/**
|
|
43
43
|
* Controlled focus date (which month is visible).
|
|
44
|
-
* If not provided, defaults to selected date
|
|
44
|
+
* If not provided, defaults to the selected date, else today clamped into
|
|
45
|
+
* the `min`/`max` window (so a window that excludes today opens on the
|
|
46
|
+
* bound nearest to it, not on an all-disabled month).
|
|
45
47
|
*/
|
|
46
48
|
focusDate?: ISODateString;
|
|
47
49
|
/** Callback when visible month changes via navigation */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Calendar.d.ts","sourceRoot":"","sources":["../../src/Calendar/Calendar.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Calendar.d.ts","sourceRoot":"","sources":["../../src/Calendar/Calendar.tsx"],"names":[],"mappings":"AA6BA,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,cAAc,CAAC;AAgD5C,YAAY,EACV,aAAa,EACb,SAAS,EACT,aAAa,EACb,SAAS,GACV,MAAM,oBAAoB,CAAC;AAC5B,OAAO,KAAK,EACV,aAAa,EACb,SAAS,EACT,aAAa,EACb,SAAS,EACV,MAAM,oBAAoB,CAAC;AAK5B,+CAA+C;AAE/C,MAAM,WAAW,cAAc;IAC7B,wEAAwE;IACxE,UAAU,EAAE,CAAC,IAAI,EAAE,aAAa,KAAK,IAAI,CAAC;CAC3C;AAID,UAAU,iBAAkB,SAAQ,IAAI,CACtC,SAAS,CAAC,cAAc,CAAC,EACzB,UAAU,GAAG,cAAc,CAC5B;IACC,kDAAkD;IAClD,GAAG,CAAC,EAAE,KAAK,CAAC,GAAG,CAAC,cAAc,CAAC,CAAC;IAChC,qDAAqD;IACrD,SAAS,CAAC,EAAE,KAAK,CAAC,GAAG,CAAC,cAAc,CAAC,CAAC;IACtC,+CAA+C;IAC/C,cAAc,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC;IAEvB,4CAA4C;IAC5C,GAAG,CAAC,EAAE,aAAa,CAAC;IAEpB,4CAA4C;IAC5C,GAAG,CAAC,EAAE,aAAa,CAAC;IAEpB;;;OAGG;IACH,eAAe,CAAC,EAAE,aAAa,CAAC,CAAC,IAAI,EAAE,IAAI,KAAK,OAAO,CAAC,CAAC;IAEzD;;;;;;;OAOG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;IAEtB;;;;;;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stay in sync:
|
|
13
13
|
* - /packages/core/src/Calendar/Calendar.doc.mjs (props table, features, implementation notes)
|
|
14
|
+
* - /packages/core/src/Calendar/getInitialFocusDate.ts (which month the calendar opens on)
|
|
14
15
|
* - /packages/core/src/Calendar/Calendar.test.tsx (tests for new/changed behavior)
|
|
15
16
|
* - /packages/core/src/Calendar/index.ts (exports if types change)
|
|
16
17
|
* - /apps/storybook/stories/Calendar.stories.tsx (storybook stories)
|
|
@@ -26,6 +27,7 @@ import { calendarStyles, monthGridStyles, dayCellStyles, dayCellTheme } from "./
|
|
|
26
27
|
import { plainDateFromISO, plainDateToISO, plainDateToDate, plainDateToday, plainDateSetFirstOfMonth, plainDateAddMonths, plainDateAddDays, plainDateIsBefore, plainDateIsEqual, plainDateGetWeekNumber, plainDateFormat, DATE_FORMAT_WITH_WEEKDAY, DATE_FORMAT_MONTH_YEAR } from "../utils/plainDate.js";
|
|
27
28
|
import { mergeProps, composeEventHandlers, rtlStyles } from "../utils/index.js";
|
|
28
29
|
import { focusOutlineProps } from "../utils/focusOutline.stylex.js";
|
|
30
|
+
import { getInitialFocusDate } from "./getInitialFocusDate.js";
|
|
29
31
|
import { computeDayCellState, computeRangeRounding, computePreviewRounding, computeDayNeighborContinuity, isEndpoint } from "./dayCellUtils.js";
|
|
30
32
|
|
|
31
33
|
// =============================================================================
|
|
@@ -114,20 +116,17 @@ export function Calendar({
|
|
|
114
116
|
// Determine effective value
|
|
115
117
|
const effectiveValue = value !== undefined ? value : internalValue;
|
|
116
118
|
|
|
117
|
-
// Focus date state (which month is visible)
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
}
|
|
129
|
-
return plainDateToday();
|
|
130
|
-
});
|
|
119
|
+
// Focus date state (which month is visible). Falls back to today, clamped
|
|
120
|
+
// into the min/max window so a window that doesn't contain today doesn't
|
|
121
|
+
// open on an all-disabled month.
|
|
122
|
+
const [internalFocusDate, setInternalFocusDate] = useState(() => getInitialFocusDate({
|
|
123
|
+
focusDate: focusDateProp,
|
|
124
|
+
value: effectiveValue,
|
|
125
|
+
min,
|
|
126
|
+
max,
|
|
127
|
+
numberOfMonths,
|
|
128
|
+
today
|
|
129
|
+
}));
|
|
131
130
|
|
|
132
131
|
// Use controlled focusDate if callback is provided, otherwise use internal state
|
|
133
132
|
const isControlledFocus = focusDateProp !== undefined && onFocusDateChange !== undefined;
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file getInitialFocusDate.ts
|
|
3
|
+
* @input PlainDate utilities, min/max bounds, today
|
|
4
|
+
* @output Exports getInitialFocusDate — the month Calendar opens on
|
|
5
|
+
* @position Calendar-specific helper; used by Calendar.tsx
|
|
6
|
+
*
|
|
7
|
+
* SYNC: When modified, update:
|
|
8
|
+
* - /packages/core/src/Calendar/getInitialFocusDate.test.ts
|
|
9
|
+
* - /packages/core/src/Calendar/Calendar.tsx (the only caller)
|
|
10
|
+
*/
|
|
11
|
+
import type { ISODateString, DateRange } from '../utils/dateTypes';
|
|
12
|
+
import { type PlainDate } from '../utils/plainDate';
|
|
13
|
+
export interface InitialFocusDateOptions {
|
|
14
|
+
/** Controlled visible month, if the consumer supplied one. */
|
|
15
|
+
focusDate?: ISODateString;
|
|
16
|
+
/** Selected value (single date or range), controlled or uncontrolled. */
|
|
17
|
+
value?: ISODateString | DateRange;
|
|
18
|
+
/** Earliest selectable date. */
|
|
19
|
+
min?: ISODateString;
|
|
20
|
+
/** Latest selectable date. */
|
|
21
|
+
max?: ISODateString;
|
|
22
|
+
/** How many month panes the calendar renders (1 or 2). */
|
|
23
|
+
numberOfMonths: number;
|
|
24
|
+
/** Today, injected so the caller keeps a single memoized source of "now". */
|
|
25
|
+
today: PlainDate;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Picks the date whose month the calendar opens on.
|
|
29
|
+
*
|
|
30
|
+
* An explicit `focusDate` wins, then the selected value — both are the
|
|
31
|
+
* consumer's own instruction about where to look, so neither is second-guessed
|
|
32
|
+
* against `min`/`max`.
|
|
33
|
+
*
|
|
34
|
+
* Otherwise the calendar opens on today, clamped into the `min`/`max` window.
|
|
35
|
+
* Without the clamp a window that doesn't contain today (a 2019 audit range, a
|
|
36
|
+
* booking window opening next spring) opened on today's month with every day
|
|
37
|
+
* disabled, leaving prev/next clicking as the only way in.
|
|
38
|
+
*
|
|
39
|
+
* When clamping forward to `min`, that month leads: the whole selectable window
|
|
40
|
+
* runs ahead of it. When clamping back to `max`, the last pane lands on `max`'s
|
|
41
|
+
* month instead — with `numberOfMonths={2}` opening on `[max, max + 1]` would
|
|
42
|
+
* spend half the calendar on a month that is entirely out of bounds. That
|
|
43
|
+
* shift never crosses `min`'s month.
|
|
44
|
+
*/
|
|
45
|
+
export declare function getInitialFocusDate(options: InitialFocusDateOptions): PlainDate;
|
|
46
|
+
//# sourceMappingURL=getInitialFocusDate.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getInitialFocusDate.d.ts","sourceRoot":"","sources":["../../src/Calendar/getInitialFocusDate.ts"],"names":[],"mappings":"AAEA;;;;;;;;;GASG;AAEH,OAAO,KAAK,EAAC,aAAa,EAAE,SAAS,EAAC,MAAM,oBAAoB,CAAC;AACjE,OAAO,EACL,KAAK,SAAS,EAMf,MAAM,oBAAoB,CAAC;AAE5B,MAAM,WAAW,uBAAuB;IACtC,8DAA8D;IAC9D,SAAS,CAAC,EAAE,aAAa,CAAC;IAC1B,yEAAyE;IACzE,KAAK,CAAC,EAAE,aAAa,GAAG,SAAS,CAAC;IAClC,gCAAgC;IAChC,GAAG,CAAC,EAAE,aAAa,CAAC;IACpB,8BAA8B;IAC9B,GAAG,CAAC,EAAE,aAAa,CAAC;IACpB,0DAA0D;IAC1D,cAAc,EAAE,MAAM,CAAC;IACvB,6EAA6E;IAC7E,KAAK,EAAE,SAAS,CAAC;CAClB;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,mBAAmB,CACjC,OAAO,EAAE,uBAAuB,GAC/B,SAAS,CAkCX"}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
// Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* @file getInitialFocusDate.ts
|
|
5
|
+
* @input PlainDate utilities, min/max bounds, today
|
|
6
|
+
* @output Exports getInitialFocusDate — the month Calendar opens on
|
|
7
|
+
* @position Calendar-specific helper; used by Calendar.tsx
|
|
8
|
+
*
|
|
9
|
+
* SYNC: When modified, update:
|
|
10
|
+
* - /packages/core/src/Calendar/getInitialFocusDate.test.ts
|
|
11
|
+
* - /packages/core/src/Calendar/Calendar.tsx (the only caller)
|
|
12
|
+
*/
|
|
13
|
+
|
|
14
|
+
import { plainDateFromISO, plainDateSetFirstOfMonth, plainDateAddMonths, plainDateIsBefore, plainDateIsAfter } from "../utils/plainDate.js";
|
|
15
|
+
/**
|
|
16
|
+
* Picks the date whose month the calendar opens on.
|
|
17
|
+
*
|
|
18
|
+
* An explicit `focusDate` wins, then the selected value — both are the
|
|
19
|
+
* consumer's own instruction about where to look, so neither is second-guessed
|
|
20
|
+
* against `min`/`max`.
|
|
21
|
+
*
|
|
22
|
+
* Otherwise the calendar opens on today, clamped into the `min`/`max` window.
|
|
23
|
+
* Without the clamp a window that doesn't contain today (a 2019 audit range, a
|
|
24
|
+
* booking window opening next spring) opened on today's month with every day
|
|
25
|
+
* disabled, leaving prev/next clicking as the only way in.
|
|
26
|
+
*
|
|
27
|
+
* When clamping forward to `min`, that month leads: the whole selectable window
|
|
28
|
+
* runs ahead of it. When clamping back to `max`, the last pane lands on `max`'s
|
|
29
|
+
* month instead — with `numberOfMonths={2}` opening on `[max, max + 1]` would
|
|
30
|
+
* spend half the calendar on a month that is entirely out of bounds. That
|
|
31
|
+
* shift never crosses `min`'s month.
|
|
32
|
+
*/
|
|
33
|
+
export function getInitialFocusDate(options) {
|
|
34
|
+
const {
|
|
35
|
+
focusDate,
|
|
36
|
+
value,
|
|
37
|
+
min,
|
|
38
|
+
max,
|
|
39
|
+
numberOfMonths,
|
|
40
|
+
today
|
|
41
|
+
} = options;
|
|
42
|
+
if (focusDate) {
|
|
43
|
+
return plainDateFromISO(focusDate);
|
|
44
|
+
}
|
|
45
|
+
if (value) {
|
|
46
|
+
return plainDateFromISO(typeof value === 'string' ? value : value.start);
|
|
47
|
+
}
|
|
48
|
+
const minDate = min ? plainDateFromISO(min) : null;
|
|
49
|
+
const maxDate = max ? plainDateFromISO(max) : null;
|
|
50
|
+
if (minDate && plainDateIsBefore(today, minDate)) {
|
|
51
|
+
return minDate;
|
|
52
|
+
}
|
|
53
|
+
if (maxDate && plainDateIsAfter(today, maxDate)) {
|
|
54
|
+
const lastPaneOffset = Math.max(0, numberOfMonths - 1);
|
|
55
|
+
const shifted = plainDateAddMonths(plainDateSetFirstOfMonth(maxDate), -lastPaneOffset);
|
|
56
|
+
if (minDate && plainDateIsBefore(shifted, plainDateSetFirstOfMonth(minDate))) {
|
|
57
|
+
return minDate;
|
|
58
|
+
}
|
|
59
|
+
return shifted;
|
|
60
|
+
}
|
|
61
|
+
return today;
|
|
62
|
+
}
|
|
@@ -6,7 +6,8 @@
|
|
|
6
6
|
*
|
|
7
7
|
* Renders a container with role="log" for chat message histories.
|
|
8
8
|
* Handles density context, configurable gap, empty state,
|
|
9
|
-
* a spacer that pushes messages to the bottom,
|
|
9
|
+
* a configurable spacer (align) that pushes messages to the bottom,
|
|
10
|
+
* and an infinite scroll sentinel.
|
|
10
11
|
*
|
|
11
12
|
* Auto-scroll and the scroll-to-bottom button are owned by
|
|
12
13
|
* ChatLayout. When used standalone (without a layout), the list
|
|
@@ -52,6 +53,23 @@ export interface ChatMessageListProps extends BaseProps<HTMLDivElement> {
|
|
|
52
53
|
* be grouped) and row spacing should be tuned separately from density.
|
|
53
54
|
*/
|
|
54
55
|
gap?: SpacingStep;
|
|
56
|
+
/**
|
|
57
|
+
* Vertical alignment of messages when the list is shorter than its
|
|
58
|
+
* container.
|
|
59
|
+
*
|
|
60
|
+
* - `'bottom'` (default): a spacer fills the free space and pushes
|
|
61
|
+
* messages to the bottom, so a short conversation sits just above the
|
|
62
|
+
* composer — the familiar messaging-app layout.
|
|
63
|
+
* - `'top'`: the spacer is omitted, so messages start at the top and grow
|
|
64
|
+
* downward — better for document-style or log-style lists.
|
|
65
|
+
*
|
|
66
|
+
* This only changes the resting position of a non-full list. Once messages
|
|
67
|
+
* overflow the container the spacer collapses to zero in both modes, so
|
|
68
|
+
* ChatLayout auto-scroll-to-bottom behavior is identical either way.
|
|
69
|
+
*
|
|
70
|
+
* @default 'bottom'
|
|
71
|
+
*/
|
|
72
|
+
align?: 'top' | 'bottom';
|
|
55
73
|
/**
|
|
56
74
|
* Whether an assistant message is actively streaming into the list.
|
|
57
75
|
*
|
|
@@ -71,7 +89,8 @@ export interface ChatMessageListProps extends BaseProps<HTMLDivElement> {
|
|
|
71
89
|
*
|
|
72
90
|
* Renders messages in a flex column with density-based spacing.
|
|
73
91
|
* Override gap to tune row spacing separately from density.
|
|
74
|
-
*
|
|
92
|
+
* By default a spacer pushes content to the bottom when the list isn't full;
|
|
93
|
+
* set `align='top'` to start messages at the top instead.
|
|
75
94
|
* Supports loading older messages via `scrollToTopAction`.
|
|
76
95
|
*
|
|
77
96
|
* Auto-scroll and the scroll-to-bottom button are owned by
|
|
@@ -86,7 +105,7 @@ export interface ChatMessageListProps extends BaseProps<HTMLDivElement> {
|
|
|
86
105
|
* </ChatMessageList>
|
|
87
106
|
* ```
|
|
88
107
|
*/
|
|
89
|
-
export declare function ChatMessageList({ children, emptyState, scrollToTopAction, density, gap, isStreaming, xstyle, className, style, 'data-testid': testId, ref, ...rest }: ChatMessageListProps): import("react").JSX.Element;
|
|
108
|
+
export declare function ChatMessageList({ children, emptyState, scrollToTopAction, density, gap, align, isStreaming, xstyle, className, style, 'data-testid': testId, ref, ...rest }: ChatMessageListProps): import("react").JSX.Element;
|
|
90
109
|
export declare namespace ChatMessageList {
|
|
91
110
|
var displayName: string;
|
|
92
111
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ChatMessageList.d.ts","sourceRoot":"","sources":["../../src/Chat/ChatMessageList.tsx"],"names":[],"mappings":"AAIA
|
|
1
|
+
{"version":3,"file":"ChatMessageList.d.ts","sourceRoot":"","sources":["../../src/Chat/ChatMessageList.tsx"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,EAAC,KAAK,SAAS,EAA4C,MAAM,OAAO,CAAC;AAGhF,OAAO,EAEL,KAAK,WAAW,EAEjB,MAAM,eAAe,CAAC;AAGvB,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,cAAc,CAAC;AAC5C,OAAO,KAAK,EAAC,WAAW,EAAC,MAAM,gBAAgB,CAAC;AAGhD,MAAM,WAAW,oBAAqB,SAAQ,SAAS,CAAC,cAAc,CAAC;IACrE,wCAAwC;IACxC,GAAG,CAAC,EAAE,KAAK,CAAC,GAAG,CAAC,cAAc,CAAC,CAAC;IAEhC;;;OAGG;IACH,QAAQ,EAAE,SAAS,CAAC;IAEpB;;OAEG;IACH,UAAU,CAAC,EAAE,SAAS,CAAC;IAEvB;;;;OAIG;IACH,iBAAiB,CAAC,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;IAExC;;;;OAIG;IACH,OAAO,CAAC,EAAE,WAAW,CAAC;IAEtB;;;;;OAKG;IACH,GAAG,CAAC,EAAE,WAAW,CAAC;IAElB;;;;;;;;;;;;;;;OAeG;IACH,KAAK,CAAC,EAAE,KAAK,GAAG,QAAQ,CAAC;IAEzB;;;;;;;;;;;OAWG;IACH,WAAW,CAAC,EAAE,OAAO,CAAC;CACvB;AA4FD;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAgB,eAAe,CAAC,EAC9B,QAAQ,EACR,UAAU,EACV,iBAAiB,EACjB,OAAoB,EACpB,GAAG,EACH,KAAgB,EAChB,WAAmB,EACnB,MAAM,EACN,SAAS,EACT,KAAK,EACL,aAAa,EAAE,MAAM,EACrB,GAAG,EACH,GAAG,IAAI,EACR,EAAE,oBAAoB,+BAgGtB;yBA9Ge,eAAe"}
|
|
@@ -10,7 +10,8 @@
|
|
|
10
10
|
*
|
|
11
11
|
* Renders a container with role="log" for chat message histories.
|
|
12
12
|
* Handles density context, configurable gap, empty state,
|
|
13
|
-
* a spacer that pushes messages to the bottom,
|
|
13
|
+
* a configurable spacer (align) that pushes messages to the bottom,
|
|
14
|
+
* and an infinite scroll sentinel.
|
|
14
15
|
*
|
|
15
16
|
* Auto-scroll and the scroll-to-bottom button are owned by
|
|
16
17
|
* ChatLayout. When used standalone (without a layout), the list
|
|
@@ -124,7 +125,8 @@ const gapStyles = {
|
|
|
124
125
|
*
|
|
125
126
|
* Renders messages in a flex column with density-based spacing.
|
|
126
127
|
* Override gap to tune row spacing separately from density.
|
|
127
|
-
*
|
|
128
|
+
* By default a spacer pushes content to the bottom when the list isn't full;
|
|
129
|
+
* set `align='top'` to start messages at the top instead.
|
|
128
130
|
* Supports loading older messages via `scrollToTopAction`.
|
|
129
131
|
*
|
|
130
132
|
* Auto-scroll and the scroll-to-bottom button are owned by
|
|
@@ -145,6 +147,7 @@ export function ChatMessageList({
|
|
|
145
147
|
scrollToTopAction,
|
|
146
148
|
density = 'balanced',
|
|
147
149
|
gap,
|
|
150
|
+
align = 'bottom',
|
|
148
151
|
isStreaming = false,
|
|
149
152
|
xstyle,
|
|
150
153
|
className,
|
|
@@ -217,7 +220,7 @@ export function ChatMessageList({
|
|
|
217
220
|
children: /*#__PURE__*/_jsx(Spinner, {
|
|
218
221
|
size: "md"
|
|
219
222
|
})
|
|
220
|
-
}), /*#__PURE__*/_jsx("div", {
|
|
223
|
+
}), align === 'bottom' && /*#__PURE__*/_jsx("div", {
|
|
221
224
|
...{
|
|
222
225
|
className: "x98rzlu x2lwn1j"
|
|
223
226
|
},
|
package/dist/Dialog/Dialog.d.ts
CHANGED
|
@@ -4,6 +4,12 @@
|
|
|
4
4
|
* @output Exports Dialog component, DialogProps, DialogVariant, DialogPurpose types
|
|
5
5
|
* @position Core implementation; consumed by index.ts, tested by Dialog.test.tsx
|
|
6
6
|
*
|
|
7
|
+
* The standard variant treats `width` as the preferred surface width, then
|
|
8
|
+
* clamps it to the dynamic viewport with spacing-token gutters so narrow
|
|
9
|
+
* viewports keep content and controls on screen without changing the public API.
|
|
10
|
+
* Fullscreen dialogs preserve the same padding floor while honoring safe-area
|
|
11
|
+
* insets, and fade in without the centered-dialog translate/scale motion.
|
|
12
|
+
*
|
|
7
13
|
* SYNC: When modified, update these files to stay in sync:
|
|
8
14
|
* - /packages/core/src/Dialog/Dialog.doc.mjs (props table, features, implementation notes)
|
|
9
15
|
* - /packages/core/src/Dialog/Dialog.test.tsx (tests for new/changed behavior)
|
|
@@ -99,7 +105,7 @@ export interface DialogProps extends BaseProps<HTMLDialogElement> {
|
|
|
99
105
|
* The actual height will be the height of its content.
|
|
100
106
|
* Numbers are treated as pixels, strings are used as-is.
|
|
101
107
|
* Ignored when variant is 'fullscreen'.
|
|
102
|
-
* @default '
|
|
108
|
+
* @default '75dvh'
|
|
103
109
|
*/
|
|
104
110
|
maxHeight?: number | string;
|
|
105
111
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Dialog.d.ts","sourceRoot":"","sources":["../../src/Dialog/Dialog.tsx"],"names":[],"mappings":"AAIA
|
|
1
|
+
{"version":3,"file":"Dialog.d.ts","sourceRoot":"","sources":["../../src/Dialog/Dialog.tsx"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,OAAO,EAML,KAAK,SAAS,EACf,MAAM,OAAO,CAAC;AACf,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,cAAc,CAAC;AAuB5C,OAAO,KAAK,EAAC,WAAW,EAAC,MAAM,g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