@astryxdesign/core 0.1.3 → 0.1.4-canary.02643db
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 +51 -0
- package/dist/Button/Button.d.ts.map +1 -1
- package/dist/Button/Button.js +29 -8
- package/dist/Calendar/Calendar.d.ts.map +1 -1
- package/dist/Calendar/Calendar.js +49 -20
- package/dist/Calendar/dayCellUtils.d.ts +67 -5
- package/dist/Calendar/dayCellUtils.d.ts.map +1 -1
- package/dist/Calendar/dayCellUtils.js +139 -18
- package/dist/CheckboxInput/CheckboxInput.d.ts +6 -1
- package/dist/CheckboxInput/CheckboxInput.d.ts.map +1 -1
- package/dist/CheckboxInput/CheckboxInput.js +7 -1
- package/dist/Code/Code.d.ts +15 -1
- package/dist/Code/Code.d.ts.map +1 -1
- package/dist/Code/Code.js +32 -2
- package/dist/Code/index.d.ts +1 -1
- package/dist/Code/index.d.ts.map +1 -1
- package/dist/CodeBlock/index.d.ts +1 -1
- package/dist/CodeBlock/index.d.ts.map +1 -1
- package/dist/CommandPalette/CommandPaletteEmpty.d.ts +1 -1
- package/dist/CommandPalette/CommandPaletteEmpty.d.ts.map +1 -1
- package/dist/CommandPalette/CommandPaletteEmpty.js +24 -4
- package/dist/ContextMenu/ContextMenu.d.ts +9 -1
- package/dist/ContextMenu/ContextMenu.d.ts.map +1 -1
- package/dist/ContextMenu/ContextMenu.js +6 -3
- package/dist/DateRangeInput/DateRangeInput.js +2 -2
- package/dist/DateTimeInput/DateTimeInput.d.ts +0 -5
- package/dist/DateTimeInput/DateTimeInput.d.ts.map +1 -1
- package/dist/Divider/Divider.d.ts +0 -22
- package/dist/Divider/Divider.d.ts.map +1 -1
- package/dist/Markdown/parser.d.ts +7 -0
- package/dist/Markdown/parser.d.ts.map +1 -1
- package/dist/Markdown/parser.js +300 -6
- package/dist/MultiSelector/MultiSelector.d.ts +7 -1
- package/dist/MultiSelector/MultiSelector.d.ts.map +1 -1
- package/dist/MultiSelector/MultiSelector.js +10 -1
- package/dist/RadioList/RadioList.d.ts +7 -1
- package/dist/RadioList/RadioList.d.ts.map +1 -1
- package/dist/RadioList/RadioList.js +3 -1
- package/dist/RadioList/RadioListItem.d.ts.map +1 -1
- package/dist/RadioList/RadioListItem.js +6 -1
- package/dist/Selector/Selector.d.ts +6 -0
- package/dist/Selector/Selector.d.ts.map +1 -1
- package/dist/Selector/Selector.js +9 -0
- package/dist/Slider/Slider.d.ts +6 -0
- package/dist/Slider/Slider.d.ts.map +1 -1
- package/dist/Slider/Slider.js +10 -1
- package/dist/Spinner/Spinner.d.ts.map +1 -1
- package/dist/Spinner/Spinner.js +1 -1
- package/dist/Switch/Switch.d.ts +6 -1
- package/dist/Switch/Switch.d.ts.map +1 -1
- package/dist/Switch/Switch.js +7 -1
- package/dist/Table/BaseTable.d.ts.map +1 -1
- package/dist/Table/BaseTable.js +8 -1
- package/dist/Table/TableCell.d.ts.map +1 -1
- package/dist/Table/TableCell.js +73 -4
- package/dist/Table/index.d.ts +2 -0
- package/dist/Table/index.d.ts.map +1 -1
- package/dist/Table/index.js +1 -0
- package/dist/Table/plugins/rowExpansion/index.d.ts +3 -0
- package/dist/Table/plugins/rowExpansion/index.d.ts.map +1 -0
- package/dist/Table/plugins/rowExpansion/index.js +3 -0
- package/dist/Table/plugins/rowExpansion/useTableRowExpansion.d.ts +90 -0
- package/dist/Table/plugins/rowExpansion/useTableRowExpansion.d.ts.map +1 -0
- package/dist/Table/plugins/rowExpansion/useTableRowExpansion.js +398 -0
- package/dist/Table/tableContextMenu.d.ts +5 -1
- package/dist/Table/tableContextMenu.d.ts.map +1 -1
- package/dist/Table/tableContextMenu.js +10 -3
- package/dist/Text/Text.d.ts +1 -1
- package/dist/Text/Text.d.ts.map +1 -1
- package/dist/Text/Text.js +4 -3
- package/dist/Text/text.stylex.d.ts +35 -0
- package/dist/Text/text.stylex.d.ts.map +1 -1
- package/dist/Text/text.stylex.js +52 -1
- package/dist/Tokenizer/Tokenizer.d.ts +6 -1
- package/dist/Tokenizer/Tokenizer.d.ts.map +1 -1
- package/dist/Tokenizer/Tokenizer.js +10 -1
- package/dist/astryx.css +16 -0
- package/dist/astryx.umd.js +51 -49
- package/dist/astryx.umd.js.map +4 -4
- package/dist/docs-types.d.ts +12 -0
- package/dist/docs-types.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/AspectRatio/AspectRatio.doc.mjs +1 -1
- package/src/Avatar/Avatar.doc.mjs +2 -2
- package/src/Button/Button.tsx +39 -6
- package/src/ButtonGroup/ButtonGroup.doc.mjs +1 -1
- package/src/Calendar/Calendar.test.tsx +106 -0
- package/src/Calendar/Calendar.tsx +59 -22
- package/src/Calendar/dayCellUtils.test.ts +306 -1
- package/src/Calendar/dayCellUtils.ts +206 -13
- package/src/Card/Card.doc.mjs +1 -1
- package/src/Chat/useChatNewMessages.test.tsx +4 -4
- package/src/CheckboxInput/CheckboxInput.doc.mjs +9 -1
- package/src/CheckboxInput/CheckboxInput.test.tsx +36 -0
- package/src/CheckboxInput/CheckboxInput.tsx +11 -0
- package/src/CheckboxList/CheckboxList.doc.mjs +1 -1
- package/src/Code/Code.test.tsx +54 -0
- package/src/Code/Code.tsx +48 -4
- package/src/Code/index.ts +1 -1
- package/src/CodeBlock/index.ts +1 -1
- package/src/CommandPalette/CommandPaletteEmpty.tsx +15 -1
- package/src/ContextMenu/ContextMenu.tsx +17 -1
- package/src/DateInput/DateInput.doc.mjs +6 -1
- package/src/DateRangeInput/DateRangeInput.doc.mjs +1 -1
- package/src/DateRangeInput/DateRangeInput.tsx +2 -2
- package/src/DateTimeInput/DateTimeInput.doc.mjs +1 -1
- package/src/DateTimeInput/DateTimeInput.tsx +1 -6
- package/src/Divider/Divider.tsx +1 -23
- package/src/DropdownMenu/DropdownMenu.test.tsx +5 -3
- package/src/EmptyState/EmptyState.doc.mjs +1 -1
- package/src/Field/Field.doc.mjs +1 -1
- package/src/FileInput/FileInput.doc.mjs +1 -1
- package/src/FormLayout/__snapshots__/FormLayout.test.tsx.snap +0 -3
- package/src/Grid/Grid.doc.mjs +3 -3
- package/src/Layout/__tests__/edgeCompensation.test.tsx +72 -0
- package/src/Markdown/Markdown.test.tsx +23 -0
- package/src/Markdown/incremental.test.ts +36 -0
- package/src/Markdown/parser.test.ts +210 -0
- package/src/Markdown/parser.ts +301 -6
- package/src/MobileNav/MobileNav.doc.mjs +20 -0
- package/src/MultiSelector/MultiSelector.doc.mjs +14 -1
- package/src/MultiSelector/MultiSelector.test.tsx +33 -0
- package/src/MultiSelector/MultiSelector.tsx +20 -0
- package/src/PowerSearch/PowerSearch.doc.mjs +2 -2
- package/src/RadioList/RadioList.doc.mjs +7 -1
- package/src/RadioList/RadioList.test.tsx +46 -0
- package/src/RadioList/RadioList.tsx +10 -1
- package/src/RadioList/RadioListItem.tsx +4 -0
- package/src/Section/Section.test.tsx +4 -10
- package/src/SegmentedControl/SegmentedControl.doc.mjs +1 -1
- package/src/Selector/Selector.doc.mjs +12 -1
- package/src/Selector/Selector.test.tsx +30 -0
- package/src/Selector/Selector.tsx +18 -0
- package/src/Slider/Slider.doc.mjs +14 -2
- package/src/Slider/Slider.test.tsx +30 -0
- package/src/Slider/Slider.tsx +20 -0
- package/src/Spinner/Spinner.tsx +1 -0
- package/src/Switch/Switch.doc.mjs +14 -2
- package/src/Switch/Switch.test.tsx +38 -0
- package/src/Switch/Switch.tsx +12 -0
- package/src/TabList/TabList.doc.mjs +3 -3
- package/src/Table/BaseTable.tsx +9 -1
- package/src/Table/Table.test.tsx +23 -0
- package/src/Table/TableCell.tsx +87 -8
- package/src/Table/index.ts +5 -0
- package/src/Table/plugins/rowExpansion/index.ts +7 -0
- package/src/Table/plugins/rowExpansion/useTableRowExpansion.test.tsx +155 -0
- package/src/Table/plugins/rowExpansion/useTableRowExpansion.tsx +590 -0
- package/src/Table/tableContextMenu.test.tsx +27 -3
- package/src/Table/tableContextMenu.tsx +20 -2
- package/src/Table/useTablePagination.doc.mjs +4 -1
- package/src/Table/useTableRowExpansion.doc.mjs +80 -0
- package/src/Table/useTableSortable.doc.mjs +4 -1
- package/src/Text/Text.doc.mjs +2 -2
- package/src/Text/Text.test.tsx +11 -0
- package/src/Text/Text.tsx +4 -2
- package/src/Text/text.stylex.ts +41 -0
- package/src/TextArea/TextArea.doc.mjs +1 -1
- package/src/TextInput/TextInput.doc.mjs +1 -1
- package/src/TimeInput/TimeInput.doc.mjs +11 -6
- package/src/Tokenizer/Tokenizer.doc.mjs +14 -2
- package/src/Tokenizer/Tokenizer.test.tsx +33 -0
- package/src/Tokenizer/Tokenizer.tsx +19 -0
- package/src/Toolbar/Toolbar.test.tsx +1 -1
- package/src/Typeahead/BaseTypeahead.doc.mjs +10 -0
- package/src/Typeahead/Typeahead.doc.mjs +6 -1
- package/src/docs-types.ts +12 -0
- package/src/hooks/useKeyboardHint.doc.mjs +6 -6
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,56 @@
|
|
|
1
1
|
# @xds/core
|
|
2
2
|
|
|
3
|
+
# 0.1.4
|
|
4
|
+
|
|
5
|
+
#### New Features
|
|
6
|
+
|
|
7
|
+
- Code: add `color` and `size` props. `color` accepts `'primary' | 'secondary' | 'inherit'` and now defaults to `'primary'` (mirroring Text's color subset); previously the color was left to inherit implicitly. `size="inherit"` makes inline code adopt the surrounding text's `font-size` and `line-height`. Exports `CodeColor` and `CodeSize` types (#2846)
|
|
8
|
+
- Markdown: support CommonMark link reference definitions. Reference-style "footer" links — full `[text][label]`, collapsed `[text][]`, and shortcut `[text]` (plus their `![alt]` image forms) — now resolve against a `[label]: destination "title"` block, which is stripped from the output instead of leaking as a visible paragraph. Labels match case-insensitively with collapsed whitespace; top-level definitions are collected across the document (so a reference can precede its definition, including in the streaming/incremental parser, whose settled-block cache invalidates when definitions change). Footnotes (`[^1]`) are intentionally left untouched. Known limit: a definition nested inside a blockquote/list resolves within that container but is not yet exposed document-wide. (#3621)
|
|
9
|
+
- Native form participation for custom inputs via htmlName (#3343)
|
|
10
|
+
Switch, CheckboxInput, RadioList, Slider, Selector, MultiSelector, and Tokenizer now accept the same `htmlName` prop TextInput and NumberInput already had, so they serialize into native form submission. Components with a real native input (Switch, CheckboxInput, RadioList) forward the name; the synthetic controls render hidden inputs that mirror native semantics — one entry per value for MultiSelector/Tokenizer (like a multi-select), string value for Slider (two entries in range mode), and exclusion from FormData when disabled.
|
|
11
|
+
- Add `useTableRowExpansion` — expand/collapse tree rows inline.
|
|
12
|
+
|
|
13
|
+
#### Fixes
|
|
14
|
+
|
|
15
|
+
- Button: keep edge compensation working when a ghost button also has a tooltip. The tooltip is now attached via the tooltip hook instead of a wrapper element, so the button stays a direct child of its container — no extra DOM node, no layout shift, and containers (Toolbar, Banner) still detect the edge-compensation marker via their direct-child `:has()` selector and pull the button flush to the optical edge. (#2578)
|
|
16
|
+
- Calendar: stop range-highlighting adjacent-month (outside) days, and cap the range highlight where it meets a disabled or adjacent-month day. In the two-month range view the same date renders in both panes, so the spillover copy on the neighbouring month's pane was drawn as part of the selection; outside days now never receive selection, range, or preview state. A highlighted day next to a disabled or outside day now gets a rounded end cap so the run reads as properly terminated instead of running square-edged into the gap. (#2715)
|
|
17
|
+
- Code and CommandPaletteEmpty now forward props correctly (#3620)
|
|
18
|
+
`Code` spreads rest props (`aria-*`, `role`, event handlers) onto the DOM element. `CommandPaletteEmpty` applies the `xstyle`/`className`/`style` escape hatches and theme props.
|
|
19
|
+
- DateRangeInput: use the label type-size token for the trigger field. The trigger was reading the body size/leading tokens (`--text-body-size`/`--text-body-leading`) instead of the label ones (`--text-label-size`/`--text-label-leading`), so its text rendered a step larger than the other date inputs. (#3655)
|
|
20
|
+
- Spinner: promote the canvas to its own compositor layer (`willChange: transform`) so rotation stays smooth on WebKit — fixes wobbly spinning in Safari and Tauri WebViews. (#3628)
|
|
21
|
+
- Text: apply the documented `size` prop as a font-size override (#3615)
|
|
22
|
+
`Text` now reflects `size` in theme props and applies the corresponding typography size token after its type-based baseline styles. The override changes font size while preserving the selected text type's line-height, weight, and family behavior.
|
|
23
|
+
|
|
24
|
+
#### Documentation
|
|
25
|
+
|
|
26
|
+
- MobileNav previews with an open trigger instead of an empty stage: new playground.overlay for full-viewport overlay components, and inline sub-components can declare their own playground (#3616)
|
|
27
|
+
|
|
28
|
+
#### Other Changes
|
|
29
|
+
|
|
30
|
+
- Inherited-columns mode: child rows use the same columns as their parents,
|
|
31
|
+
indented by depth. Injects a chevron column; clicking (or right-click → "Expand/Collapse row") toggles a row's children.
|
|
32
|
+
- Headless: the consumer owns `expandedKeys` state; the plugin provides the UI.
|
|
33
|
+
Pair with `useTableRowExpansionState` to flatten a tree into the visible rows.
|
|
34
|
+
- Optional expand-all header toggle via `isAllExpanded` + `onToggleExpandAll`.
|
|
35
|
+
- Optional `expandOnRowClick` to toggle by clicking anywhere in the row.
|
|
36
|
+
- Contributes a context-menu action for expand/collapse (via the
|
|
37
|
+
`contextMenuActions` system).
|
|
38
|
+
|
|
39
|
+
#### Contributors
|
|
40
|
+
|
|
41
|
+
Thanks to everyone who contributed to this release:
|
|
42
|
+
|
|
43
|
+
- @ahfoysal
|
|
44
|
+
- @arham766
|
|
45
|
+
- @cixzhang
|
|
46
|
+
- @durvesh1992
|
|
47
|
+
- @humbertovirtudes
|
|
48
|
+
- @jiunshinn
|
|
49
|
+
- @lexs
|
|
50
|
+
- @MeGaurav4
|
|
51
|
+
|
|
52
|
+
---
|
|
53
|
+
|
|
3
54
|
# 0.1.3
|
|
4
55
|
|
|
5
56
|
#### Breaking Changes
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Button.d.ts","sourceRoot":"","sources":["../../src/Button/Button.tsx"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAwB,KAAK,SAAS,EAAC,MAAM,OAAO,CAAC;AAC5D,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,cAAc,CAAC;AAC5C,OAAO,KAAK,MAAM,MAAM,kBAAkB,CAAC;AAqB3C,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E,KAAK,CAAC,UAAU,CAAC,iBAAiB,CAAC,KACnC,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAC1B;;OAEG;IACH,IAAI,CAAC,EAAE,SAAS,CAAC;IACjB;;;;OAIG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB;;;OAGG;IACH,QAAQ,CAAC,EAAE,SAAS,CAAC;IACrB;;;;;;OAMG;IACH,UAAU,CAAC,EAAE,SAAS,CAAC;IACvB;;OAEG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB;;;;OAIG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IACd;;;;OAIG;IACH,EAAE,CAAC,EAAE,iBAAiB,CAAC;IACvB;;OAEG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB;;OAEG;IACH,GAAG,CAAC,EAAE,MAAM,CAAC;CACd;AAuHD;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,wBAAgB,MAAM,CAAC,EACrB,KAAK,EACL,OAAqB,EACrB,IAAI,EAAE,QAAQ,EACd,IAAe,EACf,UAAkB,EAClB,SAAiB,EACjB,eAAuB,EACvB,WAAW,EACX,IAAI,EACJ,UAAkB,EAClB,QAAQ,EACR,UAAU,EACV,OAAO,EACP,IAAI,EACJ,EAAE,EACF,MAAM,EACN,GAAG,EACH,MAAM,EACN,SAAS,EACT,KAAK,EACL,GAAG,EACH,GAAG,KAAK,EACT,EAAE,WAAW,GAAG,SAAS,CAqOzB;yBA5Pe,MAAM"}
|
package/dist/Button/Button.js
CHANGED
|
@@ -19,15 +19,15 @@
|
|
|
19
19
|
*/
|
|
20
20
|
import { useRef, useTransition } from 'react';
|
|
21
21
|
import * as stylex from '@stylexjs/stylex';
|
|
22
|
+
import { useTooltip } from "../Tooltip/useTooltip.js";
|
|
22
23
|
import "../theme/tokens.stylex.js";
|
|
23
24
|
import { colorVars, sizeVars, spacingVars, radiusVars, borderVars, durationVars, easeVars, fontWeightVars, typeScaleVars } from "../theme/tokens.stylex.js";
|
|
24
|
-
import { Tooltip } from "../Tooltip/Tooltip.js";
|
|
25
25
|
import { Spinner } from "../Spinner/index.js";
|
|
26
26
|
import { VisuallyHidden } from "../VisuallyHidden/index.js";
|
|
27
27
|
import { EDGE_COMP_ATTR } from "../Layout/edgeCompensation.stylex.js";
|
|
28
28
|
import { useSize } from "../SizeContext/SizeContext.js";
|
|
29
29
|
import { useButtonGroup } from "../ButtonGroup/ButtonGroupContext.js";
|
|
30
|
-
import { mergeProps } from "../utils/index.js";
|
|
30
|
+
import { mergeProps, mergeRefs } from "../utils/index.js";
|
|
31
31
|
import { useLinkComponent } from "../Link/useLinkComponent.js";
|
|
32
32
|
import { themeProps } from "../utils/themeProps.js";
|
|
33
33
|
|
|
@@ -339,6 +339,16 @@ export function Button({
|
|
|
339
339
|
// Use aria-disabled when tooltip is present so the button remains focusable
|
|
340
340
|
// for keyboard users to reach the tooltip. Otherwise use native disabled.
|
|
341
341
|
const useAriaDisabled = tooltip != null && buttonDisabled;
|
|
342
|
+
|
|
343
|
+
// Attach tooltip behavior via the hook rather than wrapping the button in a
|
|
344
|
+
// <Tooltip> element. The hook adds hover/focus triggers to the button itself,
|
|
345
|
+
// so no extra DOM node is inserted — the button stays a direct child of its
|
|
346
|
+
// container (no layout shift, and edge-compensation markers remain
|
|
347
|
+
// discoverable through the container's direct-child `:has()` selector).
|
|
348
|
+
const tooltipHook = useTooltip({
|
|
349
|
+
placement: 'above',
|
|
350
|
+
isEnabled: tooltip != null
|
|
351
|
+
});
|
|
342
352
|
const handleClick = e => {
|
|
343
353
|
// The ref guard dedupes fire-once actions. Interruptible callers skip it so
|
|
344
354
|
// a re-click while pending starts a fresh action that interrupts the prior.
|
|
@@ -429,28 +439,41 @@ export function Button({
|
|
|
429
439
|
const ariaLabelProp = needsAriaLabel ? {
|
|
430
440
|
'aria-label': label
|
|
431
441
|
} : null;
|
|
442
|
+
|
|
443
|
+
// When a tooltip is attached via the hook, point aria-describedby at the
|
|
444
|
+
// tooltip content (composing with any consumer-provided value).
|
|
445
|
+
const describedByProp = tooltip != null ? {
|
|
446
|
+
'aria-describedby': [props['aria-describedby'], tooltipHook.describedBy].filter(Boolean).join(' ') || undefined
|
|
447
|
+
} : null;
|
|
448
|
+
|
|
449
|
+
// Merge the consumer ref with the tooltip hook's trigger ref so both point at
|
|
450
|
+
// the same element. mergeRefs tolerates undefined, so this is a no-op for the
|
|
451
|
+
// tooltip side when no tooltip is set.
|
|
452
|
+
const mergedButtonRef = mergeRefs(ref, tooltip != null ? tooltipHook.ref : undefined);
|
|
432
453
|
let element;
|
|
433
454
|
if (renderAsLink) {
|
|
434
455
|
element = /*#__PURE__*/_jsx(LinkComponent, {
|
|
435
|
-
ref:
|
|
456
|
+
ref: mergedButtonRef,
|
|
436
457
|
href: href,
|
|
437
458
|
target: target,
|
|
438
459
|
rel: rel,
|
|
439
460
|
...sharedMergedProps,
|
|
440
461
|
...props,
|
|
441
462
|
...ariaLabelProp,
|
|
463
|
+
...describedByProp,
|
|
442
464
|
...edgeCompAttr,
|
|
443
465
|
onClick: handleClick,
|
|
444
466
|
children: buttonContent
|
|
445
467
|
});
|
|
446
468
|
} else {
|
|
447
469
|
element = /*#__PURE__*/_jsx("button", {
|
|
448
|
-
ref:
|
|
470
|
+
ref: mergedButtonRef,
|
|
449
471
|
type: type,
|
|
450
472
|
disabled: useAriaDisabled ? undefined : buttonDisabled,
|
|
451
473
|
...sharedMergedProps,
|
|
452
474
|
...props,
|
|
453
475
|
...ariaLabelProp,
|
|
476
|
+
...describedByProp,
|
|
454
477
|
...edgeCompAttr,
|
|
455
478
|
"aria-busy": isLoadingState || undefined,
|
|
456
479
|
"aria-disabled": useAriaDisabled || undefined,
|
|
@@ -462,10 +485,8 @@ export function Button({
|
|
|
462
485
|
});
|
|
463
486
|
}
|
|
464
487
|
if (tooltip) {
|
|
465
|
-
return /*#__PURE__*/
|
|
466
|
-
|
|
467
|
-
placement: "above",
|
|
468
|
-
children: element
|
|
488
|
+
return /*#__PURE__*/_jsxs(_Fragment, {
|
|
489
|
+
children: [element, tooltipHook.renderTooltip(tooltip)]
|
|
469
490
|
});
|
|
470
491
|
}
|
|
471
492
|
return element;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Calendar.d.ts","sourceRoot":"","sources":["../../src/Calendar/Calendar.tsx"],"names":[],"mappings":"AA0BA,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"Calendar.d.ts","sourceRoot":"","sources":["../../src/Calendar/Calendar.tsx"],"names":[],"mappings":"AA0BA,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,cAAc,CAAC;AA8C5C,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;AAI5B,+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,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, dayCellStyles, dayCellTheme } from "./styles.js";
|
|
26
26
|
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
27
|
import { mergeProps } from "../utils/index.js";
|
|
28
|
-
import { computeDayCellState, computeRangeRounding, computePreviewRounding, isEndpoint } from "./dayCellUtils.js";
|
|
28
|
+
import { computeDayCellState, computeRangeRounding, computePreviewRounding, computeDayNeighborContinuity, isEndpoint } from "./dayCellUtils.js";
|
|
29
29
|
|
|
30
30
|
// =============================================================================
|
|
31
31
|
// Types
|
|
@@ -62,7 +62,7 @@ export function Calendar({
|
|
|
62
62
|
value,
|
|
63
63
|
defaultValue,
|
|
64
64
|
onChange,
|
|
65
|
-
numberOfMonths = 1,
|
|
65
|
+
numberOfMonths: numberOfMonthsProp = 1,
|
|
66
66
|
min,
|
|
67
67
|
max,
|
|
68
68
|
dateConstraints,
|
|
@@ -82,6 +82,11 @@ export function Calendar({
|
|
|
82
82
|
// DayOfWeek so all downstream date math keeps working with an index.
|
|
83
83
|
const weekStartsOn = normalizeDayOfWeek(weekStartsOnProp);
|
|
84
84
|
|
|
85
|
+
// `numberOfMonths` is typed `1 | 2`; defensively clamp anything else that
|
|
86
|
+
// slips through at runtime to 1 so `Array.from({length})` can't render an
|
|
87
|
+
// absurd number of month grids (e.g. `numberOfMonths={1000}`).
|
|
88
|
+
const numberOfMonths = numberOfMonthsProp === 2 ? 2 : 1;
|
|
89
|
+
|
|
85
90
|
// Today's date (memoized)
|
|
86
91
|
const today = useMemo(() => plainDateToday(), []);
|
|
87
92
|
|
|
@@ -537,22 +542,39 @@ function MonthGrid({
|
|
|
537
542
|
role: "rowheader",
|
|
538
543
|
...stylex.props(monthGridStyles.weekNumber),
|
|
539
544
|
children: weekNum
|
|
540
|
-
}), week.map((day, dayIndex) =>
|
|
541
|
-
day
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
545
|
+
}), week.map((day, dayIndex) => {
|
|
546
|
+
// Whether the previous/next day in this week row continues the
|
|
547
|
+
// highlighted run (range and preview). A disabled or
|
|
548
|
+
// adjacent-month neighbour breaks continuity, so this day gets
|
|
549
|
+
// an end cap on that side (#2715).
|
|
550
|
+
const neighbors = computeDayNeighborContinuity({
|
|
551
|
+
week,
|
|
552
|
+
dayIndex,
|
|
553
|
+
mode,
|
|
554
|
+
rangeStart,
|
|
555
|
+
rangeEnd,
|
|
556
|
+
previewStart,
|
|
557
|
+
previewEnd,
|
|
558
|
+
isDisabled: isDateDisabled
|
|
559
|
+
});
|
|
560
|
+
return /*#__PURE__*/_jsx(DayCell, {
|
|
561
|
+
day: day,
|
|
562
|
+
dayIndex: dayIndex,
|
|
563
|
+
mode: mode,
|
|
564
|
+
selectedDate: selectedDate,
|
|
565
|
+
rangeStart: rangeStart,
|
|
566
|
+
rangeEnd: rangeEnd,
|
|
567
|
+
previewStart: previewStart,
|
|
568
|
+
previewEnd: previewEnd,
|
|
569
|
+
today: today,
|
|
570
|
+
hasOutsideDays: hasOutsideDays,
|
|
571
|
+
isDisabled: isDateDisabled(day.date),
|
|
572
|
+
neighbors: neighbors,
|
|
573
|
+
isTabbable: day.iso === seedTabbableIso,
|
|
574
|
+
onDayClick: onDayClick,
|
|
575
|
+
onDayHover: onDayHover
|
|
576
|
+
}, day.iso);
|
|
577
|
+
})]
|
|
556
578
|
}, plainDateToISO(weekDate));
|
|
557
579
|
})]
|
|
558
580
|
})
|
|
@@ -575,6 +597,7 @@ function DayCell({
|
|
|
575
597
|
today,
|
|
576
598
|
hasOutsideDays,
|
|
577
599
|
isDisabled,
|
|
600
|
+
neighbors,
|
|
578
601
|
isTabbable: isTabbableDay,
|
|
579
602
|
onDayClick,
|
|
580
603
|
onDayHover
|
|
@@ -606,8 +629,14 @@ function DayCell({
|
|
|
606
629
|
isOutside
|
|
607
630
|
});
|
|
608
631
|
const endpoint = isEndpoint(state);
|
|
609
|
-
const rangeRounding = computeRangeRounding(state
|
|
610
|
-
|
|
632
|
+
const rangeRounding = computeRangeRounding(state, {
|
|
633
|
+
prevInRange: neighbors.prevInRange,
|
|
634
|
+
nextInRange: neighbors.nextInRange
|
|
635
|
+
});
|
|
636
|
+
const previewRounding = computePreviewRounding(state, {
|
|
637
|
+
prevInPreview: neighbors.prevInPreview,
|
|
638
|
+
nextInPreview: neighbors.nextInPreview
|
|
639
|
+
});
|
|
611
640
|
return /*#__PURE__*/_jsxs("div", {
|
|
612
641
|
role: "gridcell",
|
|
613
642
|
...stylex.props(dayCellStyles.cell),
|
|
@@ -25,18 +25,80 @@ export interface DayCellStateInput {
|
|
|
25
25
|
isDisabled: boolean;
|
|
26
26
|
isOutside: boolean;
|
|
27
27
|
}
|
|
28
|
-
/**
|
|
28
|
+
/**
|
|
29
|
+
* Derives all visual/interaction states for a single day cell.
|
|
30
|
+
*
|
|
31
|
+
* Outside (adjacent-month) days never receive selection, range, or preview
|
|
32
|
+
* state: in the two-month layout the same date renders in both panes, and
|
|
33
|
+
* highlighting the spillover copy would duplicate the selection onto the wrong
|
|
34
|
+
* month's pane (#2715).
|
|
35
|
+
*/
|
|
29
36
|
export declare function computeDayCellState(input: DayCellStateInput): DayCellState;
|
|
30
|
-
/**
|
|
31
|
-
export declare function computeRangeRounding(state: DayCellState
|
|
37
|
+
/** Rounding for the committed range background. */
|
|
38
|
+
export declare function computeRangeRounding(state: DayCellState, neighbors?: {
|
|
39
|
+
prevInRange?: boolean;
|
|
40
|
+
nextInRange?: boolean;
|
|
41
|
+
}): {
|
|
32
42
|
roundLeft: boolean;
|
|
33
43
|
roundRight: boolean;
|
|
34
44
|
};
|
|
35
|
-
/**
|
|
36
|
-
export declare function computePreviewRounding(state: DayCellState
|
|
45
|
+
/** Rounding for the hover-preview background. */
|
|
46
|
+
export declare function computePreviewRounding(state: DayCellState, neighbors?: {
|
|
47
|
+
prevInPreview?: boolean;
|
|
48
|
+
nextInPreview?: boolean;
|
|
49
|
+
}): {
|
|
37
50
|
roundLeft: boolean;
|
|
38
51
|
roundRight: boolean;
|
|
39
52
|
};
|
|
40
53
|
/** Whether a day is a selection endpoint (selected, range start, or range end). */
|
|
41
54
|
export declare function isEndpoint(state: DayCellState): boolean;
|
|
55
|
+
/** Whether a day participates in the continuous committed-range highlight. */
|
|
56
|
+
export declare function isRangeHighlighted(input: {
|
|
57
|
+
date: PlainDate;
|
|
58
|
+
mode: 'single' | 'range';
|
|
59
|
+
rangeStart: PlainDate | null;
|
|
60
|
+
rangeEnd: PlainDate | null;
|
|
61
|
+
isDisabled: boolean;
|
|
62
|
+
isOutside: boolean;
|
|
63
|
+
}): boolean;
|
|
64
|
+
/** Whether a day participates in the continuous hover-preview highlight. */
|
|
65
|
+
export declare function isPreviewHighlighted(input: {
|
|
66
|
+
date: PlainDate;
|
|
67
|
+
previewStart: PlainDate | null;
|
|
68
|
+
previewEnd: PlainDate | null;
|
|
69
|
+
isDisabled: boolean;
|
|
70
|
+
isOutside: boolean;
|
|
71
|
+
}): boolean;
|
|
72
|
+
/**
|
|
73
|
+
* Continuity of the highlighted run through a day's immediate neighbours in the
|
|
74
|
+
* same week row, for both the committed range and the hover preview. A day gets
|
|
75
|
+
* an end cap on whichever side its neighbour does not continue the run (see
|
|
76
|
+
* {@link computeRangeRounding} / {@link computePreviewRounding}).
|
|
77
|
+
*/
|
|
78
|
+
export interface DayNeighborContinuity {
|
|
79
|
+
prevInRange: boolean;
|
|
80
|
+
nextInRange: boolean;
|
|
81
|
+
prevInPreview: boolean;
|
|
82
|
+
nextInPreview: boolean;
|
|
83
|
+
}
|
|
84
|
+
/** Minimal shape needed from a week's day cells to derive neighbour continuity. */
|
|
85
|
+
export interface NeighborDay {
|
|
86
|
+
date: PlainDate;
|
|
87
|
+
isOutside: boolean;
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* Derives whether the previous/next day in the same week row continues the
|
|
91
|
+
* highlighted run, for both range and preview. Broken out from the render path
|
|
92
|
+
* so the neighbour logic is unit-testable in isolation.
|
|
93
|
+
*/
|
|
94
|
+
export declare function computeDayNeighborContinuity(input: {
|
|
95
|
+
week: ReadonlyArray<NeighborDay>;
|
|
96
|
+
dayIndex: number;
|
|
97
|
+
mode: 'single' | 'range';
|
|
98
|
+
rangeStart: PlainDate | null;
|
|
99
|
+
rangeEnd: PlainDate | null;
|
|
100
|
+
previewStart: PlainDate | null;
|
|
101
|
+
previewEnd: PlainDate | null;
|
|
102
|
+
isDisabled: (date: PlainDate) => boolean;
|
|
103
|
+
}): DayNeighborContinuity;
|
|
42
104
|
//# sourceMappingURL=dayCellUtils.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dayCellUtils.d.ts","sourceRoot":"","sources":["../../src/Calendar/dayCellUtils.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,oBAAoB,CAAC;AAGlD,MAAM,WAAW,YAAY;IAC3B,mBAAmB,EAAE,OAAO,CAAC;IAC7B,OAAO,EAAE,OAAO,CAAC;IACjB,UAAU,EAAE,OAAO,CAAC;IACpB,SAAS,EAAE,OAAO,CAAC;IACnB,YAAY,EAAE,OAAO,CAAC;IACtB,UAAU,EAAE,OAAO,CAAC;IACpB,WAAW,EAAE,OAAO,CAAC;IACrB,cAAc,EAAE,OAAO,CAAC;IACxB,YAAY,EAAE,OAAO,CAAC;IACtB,aAAa,EAAE,OAAO,CAAC;IACvB,YAAY,EAAE,OAAO,CAAC;CACvB;AAED,MAAM,WAAW,iBAAiB;IAChC,IAAI,EAAE,SAAS,CAAC;IAChB,QAAQ,EAAE,MAAM,CAAC;IACj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B,WAAW,EAAE,OAAO,CAAC;IACrB,aAAa,EAAE,OAAO,CAAC;IACvB,aAAa,EAAE,OAAO,CAAC;CACxB;AAED,mFAAmF;AACnF,MAAM,WAAW,WAAW;IAC1B,IAAI,EAAE,SAAS,CAAC;IAChB,SAAS,EAAE,OAAO,CAAC;CACpB;AAED;;;;GAIG;AACH,wBAAgB,4BAA4B,CAAC,KAAK,EAAE;IAClD,IAAI,EAAE,aAAa,CAAC,WAAW,CAAC,CAAC;IACjC,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,EAAE,QAAQ,GAAG,OAAO,CAAC;IACzB,UAAU,EAAE,SAAS,GAAG,IAAI,CAAC;IAC7B,QAAQ,EAAE,SAAS,GAAG,IAAI,CAAC;IAC3B,YAAY,EAAE,SAAS,GAAG,IAAI,CAAC;IAC/B,UAAU,EAAE,SAAS,GAAG,IAAI,CAAC;IAC7B,UAAU,EAAE,CAAC,IAAI,EAAE,SAAS,KAAK,OAAO,CAAC;CAC1C,GAAG,qBAAqB,CA0CxB"}
|
|
@@ -1,7 +1,14 @@
|
|
|
1
1
|
// Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
2
2
|
|
|
3
3
|
import { plainDateIsEqual, plainDateIsInRange } from "../utils/plainDate.js";
|
|
4
|
-
/**
|
|
4
|
+
/**
|
|
5
|
+
* Derives all visual/interaction states for a single day cell.
|
|
6
|
+
*
|
|
7
|
+
* Outside (adjacent-month) days never receive selection, range, or preview
|
|
8
|
+
* state: in the two-month layout the same date renders in both panes, and
|
|
9
|
+
* highlighting the spillover copy would duplicate the selection onto the wrong
|
|
10
|
+
* month's pane (#2715).
|
|
11
|
+
*/
|
|
5
12
|
export function computeDayCellState(input) {
|
|
6
13
|
const {
|
|
7
14
|
date,
|
|
@@ -19,35 +26,149 @@ export function computeDayCellState(input) {
|
|
|
19
26
|
return {
|
|
20
27
|
effectivelyDisabled: isDisabled || isOutside,
|
|
21
28
|
isToday: plainDateIsEqual(date, today),
|
|
22
|
-
isSelected: !!(mode === 'single' && selectedDate && plainDateIsEqual(date, selectedDate)),
|
|
23
|
-
isInRange: !!(mode === 'range' && rangeStart && rangeEnd && plainDateIsInRange(date, [rangeStart, rangeEnd])),
|
|
24
|
-
isRangeStart: !!(mode === 'range' && rangeStart && plainDateIsEqual(date, rangeStart)),
|
|
25
|
-
isRangeEnd: !!(mode === 'range' && rangeEnd && plainDateIsEqual(date, rangeEnd)),
|
|
26
|
-
isInPreview: !!(previewStart && previewEnd && plainDateIsInRange(date, [previewStart, previewEnd])),
|
|
27
|
-
isPreviewStart: !!(previewStart && plainDateIsEqual(date, previewStart)),
|
|
28
|
-
isPreviewEnd: !!(previewEnd && plainDateIsEqual(date, previewEnd)),
|
|
29
|
+
isSelected: !!(!isOutside && mode === 'single' && selectedDate && plainDateIsEqual(date, selectedDate)),
|
|
30
|
+
isInRange: !!(!isOutside && mode === 'range' && rangeStart && rangeEnd && plainDateIsInRange(date, [rangeStart, rangeEnd])),
|
|
31
|
+
isRangeStart: !!(!isOutside && mode === 'range' && rangeStart && plainDateIsEqual(date, rangeStart)),
|
|
32
|
+
isRangeEnd: !!(!isOutside && mode === 'range' && rangeEnd && plainDateIsEqual(date, rangeEnd)),
|
|
33
|
+
isInPreview: !!(!isOutside && previewStart && previewEnd && plainDateIsInRange(date, [previewStart, previewEnd])),
|
|
34
|
+
isPreviewStart: !!(!isOutside && previewStart && plainDateIsEqual(date, previewStart)),
|
|
35
|
+
isPreviewEnd: !!(!isOutside && previewEnd && plainDateIsEqual(date, previewEnd)),
|
|
29
36
|
isFirstColumn: dayIndex === 0,
|
|
30
37
|
isLastColumn: dayIndex === 6
|
|
31
38
|
};
|
|
32
39
|
}
|
|
33
40
|
|
|
34
|
-
/**
|
|
35
|
-
|
|
41
|
+
/**
|
|
42
|
+
* Generic rounding for a highlight run (range or preview).
|
|
43
|
+
*
|
|
44
|
+
* Rounds at the run's endpoints and the grid row edges, and also caps the
|
|
45
|
+
* highlight where the run meets a break in continuity — a neighbouring cell
|
|
46
|
+
* that is disabled or an adjacent-month (outside) day (#2715).
|
|
47
|
+
*/
|
|
48
|
+
function computeHighlightRounding(input) {
|
|
49
|
+
const prevBreaks = input.prevContinues !== undefined ? !input.prevContinues : false;
|
|
50
|
+
const nextBreaks = input.nextContinues !== undefined ? !input.nextContinues : false;
|
|
36
51
|
return {
|
|
37
|
-
roundLeft:
|
|
38
|
-
roundRight:
|
|
52
|
+
roundLeft: input.isStart || input.isFirstColumn || prevBreaks,
|
|
53
|
+
roundRight: input.isEnd || input.isLastColumn || nextBreaks
|
|
39
54
|
};
|
|
40
55
|
}
|
|
41
56
|
|
|
42
|
-
/**
|
|
43
|
-
export function
|
|
44
|
-
return {
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
57
|
+
/** Rounding for the committed range background. */
|
|
58
|
+
export function computeRangeRounding(state, neighbors) {
|
|
59
|
+
return computeHighlightRounding({
|
|
60
|
+
isStart: state.isRangeStart,
|
|
61
|
+
isEnd: state.isRangeEnd,
|
|
62
|
+
isFirstColumn: state.isFirstColumn,
|
|
63
|
+
isLastColumn: state.isLastColumn,
|
|
64
|
+
prevContinues: neighbors?.prevInRange,
|
|
65
|
+
nextContinues: neighbors?.nextInRange
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
/** Rounding for the hover-preview background. */
|
|
70
|
+
export function computePreviewRounding(state, neighbors) {
|
|
71
|
+
return computeHighlightRounding({
|
|
72
|
+
isStart: state.isPreviewStart,
|
|
73
|
+
isEnd: state.isPreviewEnd,
|
|
74
|
+
isFirstColumn: state.isFirstColumn,
|
|
75
|
+
isLastColumn: state.isLastColumn,
|
|
76
|
+
prevContinues: neighbors?.prevInPreview,
|
|
77
|
+
nextContinues: neighbors?.nextInPreview
|
|
78
|
+
});
|
|
48
79
|
}
|
|
49
80
|
|
|
50
81
|
/** Whether a day is a selection endpoint (selected, range start, or range end). */
|
|
51
82
|
export function isEndpoint(state) {
|
|
52
83
|
return state.isSelected || state.isRangeStart || state.isRangeEnd;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
/**
|
|
87
|
+
* Whether a day is part of an unbroken highlight run (enabled, in-month, inside
|
|
88
|
+
* the given span). Outside and disabled days break the run, producing end caps.
|
|
89
|
+
*/
|
|
90
|
+
function isSpanHighlighted(input) {
|
|
91
|
+
const {
|
|
92
|
+
date,
|
|
93
|
+
spanStart,
|
|
94
|
+
spanEnd,
|
|
95
|
+
isDisabled,
|
|
96
|
+
isOutside
|
|
97
|
+
} = input;
|
|
98
|
+
return !!(!isOutside && !isDisabled && spanStart && spanEnd && plainDateIsInRange(date, [spanStart, spanEnd]));
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
/** Whether a day participates in the continuous committed-range highlight. */
|
|
102
|
+
export function isRangeHighlighted(input) {
|
|
103
|
+
if (input.mode !== 'range') {
|
|
104
|
+
return false;
|
|
105
|
+
}
|
|
106
|
+
return isSpanHighlighted({
|
|
107
|
+
date: input.date,
|
|
108
|
+
spanStart: input.rangeStart,
|
|
109
|
+
spanEnd: input.rangeEnd,
|
|
110
|
+
isDisabled: input.isDisabled,
|
|
111
|
+
isOutside: input.isOutside
|
|
112
|
+
});
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
/** Whether a day participates in the continuous hover-preview highlight. */
|
|
116
|
+
export function isPreviewHighlighted(input) {
|
|
117
|
+
return isSpanHighlighted({
|
|
118
|
+
date: input.date,
|
|
119
|
+
spanStart: input.previewStart,
|
|
120
|
+
spanEnd: input.previewEnd,
|
|
121
|
+
isDisabled: input.isDisabled,
|
|
122
|
+
isOutside: input.isOutside
|
|
123
|
+
});
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
/**
|
|
127
|
+
* Continuity of the highlighted run through a day's immediate neighbours in the
|
|
128
|
+
* same week row, for both the committed range and the hover preview. A day gets
|
|
129
|
+
* an end cap on whichever side its neighbour does not continue the run (see
|
|
130
|
+
* {@link computeRangeRounding} / {@link computePreviewRounding}).
|
|
131
|
+
*/
|
|
132
|
+
|
|
133
|
+
/** Minimal shape needed from a week's day cells to derive neighbour continuity. */
|
|
134
|
+
|
|
135
|
+
/**
|
|
136
|
+
* Derives whether the previous/next day in the same week row continues the
|
|
137
|
+
* highlighted run, for both range and preview. Broken out from the render path
|
|
138
|
+
* so the neighbour logic is unit-testable in isolation.
|
|
139
|
+
*/
|
|
140
|
+
export function computeDayNeighborContinuity(input) {
|
|
141
|
+
const {
|
|
142
|
+
week,
|
|
143
|
+
dayIndex,
|
|
144
|
+
mode,
|
|
145
|
+
rangeStart,
|
|
146
|
+
rangeEnd,
|
|
147
|
+
previewStart,
|
|
148
|
+
previewEnd,
|
|
149
|
+
isDisabled
|
|
150
|
+
} = input;
|
|
151
|
+
const prev = week[dayIndex - 1];
|
|
152
|
+
const next = week[dayIndex + 1];
|
|
153
|
+
const rangeContinues = day => day != null && isRangeHighlighted({
|
|
154
|
+
date: day.date,
|
|
155
|
+
mode,
|
|
156
|
+
rangeStart,
|
|
157
|
+
rangeEnd,
|
|
158
|
+
isDisabled: isDisabled(day.date),
|
|
159
|
+
isOutside: day.isOutside
|
|
160
|
+
});
|
|
161
|
+
const previewContinues = day => day != null && isPreviewHighlighted({
|
|
162
|
+
date: day.date,
|
|
163
|
+
previewStart,
|
|
164
|
+
previewEnd,
|
|
165
|
+
isDisabled: isDisabled(day.date),
|
|
166
|
+
isOutside: day.isOutside
|
|
167
|
+
});
|
|
168
|
+
return {
|
|
169
|
+
prevInRange: rangeContinues(prev),
|
|
170
|
+
nextInRange: rangeContinues(next),
|
|
171
|
+
prevInPreview: previewContinues(prev),
|
|
172
|
+
nextInPreview: previewContinues(next)
|
|
173
|
+
};
|
|
53
174
|
}
|
|
@@ -66,6 +66,11 @@ export interface CheckboxInputProps extends Omit<BaseProps, 'onChange'> {
|
|
|
66
66
|
* @default false
|
|
67
67
|
*/
|
|
68
68
|
isDisabled?: boolean;
|
|
69
|
+
/**
|
|
70
|
+
* The HTML name attribute for the underlying checkbox input.
|
|
71
|
+
* Useful for form submissions.
|
|
72
|
+
*/
|
|
73
|
+
htmlName?: string;
|
|
69
74
|
/**
|
|
70
75
|
* Explains why the checkbox is disabled. When set together with
|
|
71
76
|
* `isDisabled`, the checkbox shows a tooltip with this text on hover and
|
|
@@ -153,7 +158,7 @@ export interface CheckboxInputProps extends Omit<BaseProps, 'onChange'> {
|
|
|
153
158
|
* />
|
|
154
159
|
* ```
|
|
155
160
|
*/
|
|
156
|
-
export declare function CheckboxInput({ label, isLabelHidden, description, onChange, changeAction, isLoading, value, isDisabled, disabledMessage, isReadOnly, isOptional, isRequired, size, onFocus, onBlur, labelIcon, status, width, xstyle, className, style, ref, }: CheckboxInputProps): import("react").JSX.Element;
|
|
161
|
+
export declare function CheckboxInput({ label, isLabelHidden, description, onChange, changeAction, isLoading, value, isDisabled, htmlName, disabledMessage, isReadOnly, isOptional, isRequired, size, onFocus, onBlur, labelIcon, status, width, xstyle, className, style, ref, }: CheckboxInputProps): import("react").JSX.Element;
|
|
157
162
|
export declare namespace CheckboxInput {
|
|
158
163
|
var displayName: string;
|
|
159
164
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CheckboxInput.d.ts","sourceRoot":"","sources":["../../src/CheckboxInput/CheckboxInput.tsx"],"names":[],"mappings":"AAIA;;;;;;;;;;;;GAYG;AAEH,OAAO,EAML,KAAK,WAAW,EAChB,KAAK,UAAU,EACf,KAAK,SAAS,EACf,MAAM,OAAO,CAAC;AACf,OAAO,KAAK,MAAM,MAAM,kBAAkB,CAAC;AAY3C,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,cAAc,CAAC;AAC5C,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,gBAAgB,CAAC;AAG9C,OAAO,KAAK,EAAC,QAAQ,EAAC,MAAM,SAAS,CAAC;AACtC,OAAO,KAAK,EAAC,WAAW,EAAC,MAAM,gBAAgB,CAAC;AA8IhD,QAAA,MAAM,iBAAiB;;;;;;;;;EAS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AAE,iBAAiB,CAAC;IACzB;;OAEG;IACH,OAAO,CAAC,EAAE,CAAC,CAAC,EAAE,UAAU,CAAC,gBAAgB,CAAC,KAAK,IAAI,CAAC;IACpD;;OAEG;IACH,MAAM,CAAC,EAAE,CAAC,CAAC,EAAE,UAAU,CAAC,gBAAgB,CAAC,KAAK,IAAI,CAAC;IACnD;;OAEG;IACH,SAAS,CAAC,EAAE,SAAS,GAAG,QAAQ,CAAC;IACjC;;;OAGG;IACH,MAAM,CAAC,EAAE,WAAW,CAAC;CACtB;AAOD;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,aAAa,CAAC,EAC5B,KAAK,EACL,aAAqB,EACrB,WAAW,EACX,QAAQ,EACR,YAAY,EACZ,SAAiB,EACjB,KAAK,EACL,UAAkB,EAClB,QAAQ,EACR,eAAe,EACf,UAAkB,EAClB,UAAkB,EAClB,UAAkB,EAClB,IAAW,EACX,OAAO,EACP,MAAM,EACN,SAAS,EACT,MAAM,EACN,KAAK,EACL,MAAM,EACN,SAAS,EACT,KAAK,EACL,GAAG,GACJ,EAAE,kBAAkB,+BAuNpB;yBA/Oe,aAAa"}
|
|
@@ -205,6 +205,7 @@ export function CheckboxInput({
|
|
|
205
205
|
isLoading = false,
|
|
206
206
|
value,
|
|
207
207
|
isDisabled = false,
|
|
208
|
+
htmlName,
|
|
208
209
|
disabledMessage,
|
|
209
210
|
isReadOnly = false,
|
|
210
211
|
isOptional = false,
|
|
@@ -293,7 +294,12 @@ export function CheckboxInput({
|
|
|
293
294
|
children: [/*#__PURE__*/_jsx("input", {
|
|
294
295
|
ref: mergeRefs(ref, indeterminateRef, disabledMessageTooltip.positionRef),
|
|
295
296
|
id: id,
|
|
296
|
-
type: "checkbox"
|
|
297
|
+
type: "checkbox"
|
|
298
|
+
// Withhold the name while disabled: with a disabledMessage the
|
|
299
|
+
// input stays focusable (not natively disabled), and a disabled
|
|
300
|
+
// control must not submit.
|
|
301
|
+
,
|
|
302
|
+
name: isDisabled ? undefined : htmlName,
|
|
297
303
|
checked: isChecked
|
|
298
304
|
// With a disabledMessage the checkbox keeps focusability via
|
|
299
305
|
// aria-disabled so the reason is focus-discoverable; toggling is
|
package/dist/Code/Code.d.ts
CHANGED
|
@@ -11,9 +11,23 @@
|
|
|
11
11
|
*/
|
|
12
12
|
import type { ReactNode } from 'react';
|
|
13
13
|
import type { BaseProps } from '../BaseProps';
|
|
14
|
+
/** Text color for {@link Code}, mirroring the primary/secondary/inherit subset of Text. */
|
|
15
|
+
export type CodeColor = 'primary' | 'secondary' | 'inherit';
|
|
16
|
+
/** Font size for {@link Code}. `'inherit'` adopts the surrounding text size. */
|
|
17
|
+
export type CodeSize = 'inherit';
|
|
14
18
|
export interface CodeProps extends BaseProps<HTMLElement> {
|
|
15
19
|
/** Ref forwarded to the root element */
|
|
16
20
|
ref?: React.Ref<HTMLElement>;
|
|
21
|
+
/**
|
|
22
|
+
* Text color. Mirrors the Text color subset.
|
|
23
|
+
* @default 'primary'
|
|
24
|
+
*/
|
|
25
|
+
color?: CodeColor;
|
|
26
|
+
/**
|
|
27
|
+
* Font size. Set to `'inherit'` to adopt the surrounding text's font-size
|
|
28
|
+
* and line-height (useful for inline code inside larger/smaller text).
|
|
29
|
+
*/
|
|
30
|
+
size?: CodeSize;
|
|
17
31
|
/** Code content */
|
|
18
32
|
children: ReactNode;
|
|
19
33
|
}
|
|
@@ -30,7 +44,7 @@ export interface CodeProps extends BaseProps<HTMLElement> {
|
|
|
30
44
|
* </Text>
|
|
31
45
|
* ```
|
|
32
46
|
*/
|
|
33
|
-
export declare function Code({ children, xstyle, className, style, ref, ...props }: CodeProps): import("react").JSX.Element;
|
|
47
|
+
export declare function Code({ children, color, size, xstyle, className, style, ref, ...props }: CodeProps): import("react").JSX.Element;
|
|
34
48
|
export declare namespace Code {
|
|
35
49
|
var displayName: string;
|
|
36
50
|
}
|