reshaped 3.9.0-canary.1 → 3.9.0-canary.3
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/bundle.css +1 -1
- package/dist/bundle.js +2 -31
- package/dist/cli/theming/index.js +4 -4
- package/dist/cli/theming/reshaped.config.js +1 -1
- package/dist/components/Accordion/Accordion.types.d.ts +1 -1
- package/dist/components/Accordion/AccordionControlled.js +2 -2
- package/dist/components/Accordion/AccordionTrigger.js +2 -2
- package/dist/components/Accordion/index.d.ts +1 -1
- package/dist/components/Accordion/index.js +1 -1
- package/dist/components/ActionBar/ActionBar.js +1 -1
- package/dist/components/ActionBar/ActionBar.types.d.ts +1 -1
- package/dist/components/Actionable/Actionable.js +1 -1
- package/dist/components/Alert/Alert.js +1 -1
- package/dist/components/Alert/Alert.types.d.ts +1 -1
- package/dist/components/Autocomplete/Autocomplete.js +6 -6
- package/dist/components/Autocomplete/Autocomplete.types.d.ts +3 -3
- package/dist/components/Avatar/Avatar.js +2 -2
- package/dist/components/Badge/Badge.js +4 -4
- package/dist/components/Badge/Badge.types.d.ts +1 -1
- package/dist/components/Breadcrumbs/Breadcrumbs.js +3 -3
- package/dist/components/Breadcrumbs/Breadcrumbs.types.d.ts +1 -1
- package/dist/components/Breadcrumbs/BreadcrumbsItem.js +1 -1
- package/dist/components/Button/Button.js +2 -2
- package/dist/components/Button/Button.types.d.ts +3 -3
- package/dist/components/Calendar/Calendar.types.d.ts +22 -5
- package/dist/components/Calendar/CalendarControlled.js +45 -10
- package/dist/components/Calendar/CalendarControls.js +11 -11
- package/dist/components/Calendar/CalendarDate.js +5 -5
- package/dist/components/Calendar/CalendarMonth.js +3 -3
- package/dist/components/Calendar/CalendarYear.js +1 -1
- package/dist/components/Calendar/useCalendarKeyboardNavigation.js +1 -1
- package/dist/components/Card/Card.js +2 -2
- package/dist/components/Card/Card.types.d.ts +1 -1
- package/dist/components/Carousel/Carousel.js +4 -4
- package/dist/components/Carousel/Carousel.types.d.ts +1 -1
- package/dist/components/Carousel/CarouselControl.d.ts +1 -1
- package/dist/components/Carousel/CarouselControl.js +3 -3
- package/dist/components/Checkbox/Checkbox.js +3 -3
- package/dist/components/CheckboxGroup/CheckboxGroup.types.d.ts +1 -1
- package/dist/components/Container/Container.js +1 -1
- package/dist/components/Container/Container.types.d.ts +1 -1
- package/dist/components/ContextMenu/ContextMenu.js +1 -1
- package/dist/components/Dismissible/Dismissible.js +1 -1
- package/dist/components/Divider/Divider.d.ts +1 -1
- package/dist/components/Divider/Divider.js +1 -1
- package/dist/components/DropdownMenu/DropdownMenu.js +5 -5
- package/dist/components/DropdownMenu/DropdownMenu.types.d.ts +4 -4
- package/dist/components/FileUpload/FileUpload.js +2 -2
- package/dist/components/FileUpload/FileUpload.types.d.ts +1 -1
- package/dist/components/Flyout/Flyout.js +1 -1
- package/dist/components/Flyout/Flyout.module.css +1 -1
- package/dist/components/Flyout/Flyout.types.d.ts +3 -1
- package/dist/components/Flyout/FlyoutContent.js +6 -5
- package/dist/components/Flyout/FlyoutControlled.js +8 -7
- package/dist/components/Flyout/index.d.ts +1 -1
- package/dist/components/Flyout/index.js +1 -1
- package/dist/components/Flyout/useFlyout.d.ts +1 -1
- package/dist/components/Flyout/useFlyout.js +1 -1
- package/dist/components/Flyout/utilities/flyout.d.ts +1 -1
- package/dist/components/Flyout/utilities/flyout.js +1 -1
- package/dist/components/FormControl/FormControlCaption.js +1 -1
- package/dist/components/FormControl/FormControlLabel.js +1 -1
- package/dist/components/FormControl/index.d.ts +2 -2
- package/dist/components/FormControl/index.js +2 -2
- package/dist/components/Grid/Grid.js +1 -1
- package/dist/components/Grid/Grid.types.d.ts +2 -2
- package/dist/components/Icon/Icon.js +1 -1
- package/dist/components/Image/Image.js +1 -1
- package/dist/components/Image/Image.types.d.ts +1 -1
- package/dist/components/Link/Link.js +1 -1
- package/dist/components/MenuItem/MenuItem.js +1 -1
- package/dist/components/MenuItem/MenuItem.types.d.ts +2 -2
- package/dist/components/Modal/Modal.js +7 -7
- package/dist/components/Modal/Modal.types.d.ts +1 -1
- package/dist/components/NumberField/NumberFieldControlled.js +7 -7
- package/dist/components/Overlay/Overlay.js +8 -8
- package/dist/components/PinField/PinFieldControlled.js +4 -4
- package/dist/components/Popover/Popover.js +3 -3
- package/dist/components/Popover/Popover.module.css +1 -1
- package/dist/components/Popover/Popover.types.d.ts +2 -2
- package/dist/components/Radio/Radio.js +3 -3
- package/dist/components/RadioGroup/RadioGroup.types.d.ts +1 -1
- package/dist/components/Reshaped/Reshaped.js +4 -4
- package/dist/components/Reshaped/Reshaped.types.d.ts +1 -1
- package/dist/components/Resizable/Resizable.js +2 -2
- package/dist/components/Resizable/Resizable.types.d.ts +1 -1
- package/dist/components/Resizable/ResizableHandle.js +1 -1
- package/dist/components/ScrollArea/ScrollArea.js +4 -4
- package/dist/components/Select/Select.types.d.ts +3 -3
- package/dist/components/Select/SelectCustomControlled.js +6 -3
- package/dist/components/Select/SelectEndContent.js +1 -1
- package/dist/components/Select/SelectGroup.js +1 -1
- package/dist/components/Select/SelectNative.js +2 -2
- package/dist/components/Select/SelectRoot.js +1 -1
- package/dist/components/Select/SelectTrigger.js +1 -1
- package/dist/components/Select/index.d.ts +1 -1
- package/dist/components/Select/index.js +1 -1
- package/dist/components/Skeleton/Skeleton.js +1 -1
- package/dist/components/Slider/SliderControlled.js +7 -7
- package/dist/components/Slider/SliderThumb.js +3 -3
- package/dist/components/Stepper/Stepper.js +4 -4
- package/dist/components/Switch/Switch.js +1 -1
- package/dist/components/Table/Table.js +2 -2
- package/dist/components/Tabs/Tabs.types.d.ts +1 -1
- package/dist/components/Tabs/TabsItem.js +2 -2
- package/dist/components/Tabs/TabsList.js +8 -8
- package/dist/components/Tabs/TabsPanel.js +2 -2
- package/dist/components/Text/Text.js +1 -1
- package/dist/components/Text/Text.module.css +1 -1
- package/dist/components/TextArea/TextArea.js +1 -1
- package/dist/components/TextArea/TextArea.types.d.ts +1 -1
- package/dist/components/TextField/TextField.js +2 -2
- package/dist/components/TextField/TextField.types.d.ts +2 -2
- package/dist/components/Theme/GlobalColorMode.js +1 -1
- package/dist/components/Theme/Theme.js +2 -2
- package/dist/components/Timeline/Timeline.js +1 -1
- package/dist/components/Toast/Toast.js +2 -2
- package/dist/components/Toast/Toast.types.d.ts +1 -1
- package/dist/components/Toast/ToastContainer.js +3 -3
- package/dist/components/Toast/ToastProvider.js +1 -1
- package/dist/components/Toast/ToastRegion.js +2 -2
- package/dist/components/ToggleButtonGroup/ToggleButtonGroup.types.d.ts +1 -1
- package/dist/components/ToggleButtonGroup/ToggleButtonGroupControlled.js +1 -1
- package/dist/components/Tooltip/Tooltip.js +5 -3
- package/dist/components/View/View.js +2 -2
- package/dist/components/View/View.types.d.ts +1 -1
- package/dist/components/_private/Expandable/Expandable.js +2 -2
- package/dist/components/_private/Portal/Portal.js +1 -1
- package/dist/config/tailwind.js +2 -2
- package/dist/hooks/_private/useDrag.js +4 -4
- package/dist/hooks/_private/useFadeSide.js +1 -1
- package/dist/hooks/useResponsiveClientValue.js +1 -1
- package/dist/styles/mixin.js +1 -1
- package/dist/tests/ThemesPlayground.js +16 -16
- package/dist/themes/_generator/definitions/slate.js +1 -1
- package/dist/themes/_generator/tokens/color/utilities/generateColors.d.ts +1 -1
- package/dist/themes/_generator/tokens/color/utilities/generateMetaColors.d.ts +1 -1
- package/dist/themes/_generator/tokens/color/utilities/generateMetaColors.js +1 -1
- package/dist/themes/_generator/tokens/font/font.types.d.ts +2 -2
- package/dist/themes/_generator/tokens/transforms.js +1 -1
- package/dist/themes/_generator/tokens/types.d.ts +3 -3
- package/dist/themes/_generator/transform.d.ts +1 -1
- package/dist/themes/_generator/transform.js +3 -3
- package/dist/themes/index.d.ts +1 -1
- package/dist/types/config.d.ts +1 -1
- package/dist/utilities/a11y/TrapFocus.js +4 -4
- package/dist/utilities/scroll/lock.js +1 -1
- package/dist/utilities/scroll/lockStandard.js +1 -1
- package/dist/utilities/storybook/Example.js +1 -1
- package/package.json +4 -2
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import fs from "fs";
|
|
2
|
-
import path from "path";
|
|
1
|
+
import fs from "node:fs";
|
|
2
|
+
import path from "node:path";
|
|
3
3
|
import chalk from "chalk";
|
|
4
|
-
import mergeDefinitions from "../../themes/_generator/utilities/mergeDefinitions.js";
|
|
5
|
-
import transform from "../../themes/_generator/transform.js";
|
|
6
4
|
import reshapedDefinition from "../../themes/_generator/definitions/reshaped.js";
|
|
5
|
+
import transform from "../../themes/_generator/transform.js";
|
|
6
|
+
import mergeDefinitions from "../../themes/_generator/utilities/mergeDefinitions.js";
|
|
7
7
|
import { transformToTailwind } from "./tailwind.js";
|
|
8
8
|
const transformDefinition = (name, definition, options) => {
|
|
9
9
|
const { isFragment, outputPath } = options;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import reshapedDefinition from "../../themes/_generator/definitions/reshaped.js";
|
|
2
1
|
import figmaDefinition from "../../themes/_generator/definitions/figma.js";
|
|
2
|
+
import reshapedDefinition from "../../themes/_generator/definitions/reshaped.js";
|
|
3
3
|
import slateDefinition from "../../themes/_generator/definitions/slate.js";
|
|
4
4
|
const config = {
|
|
5
5
|
themes: {
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
3
|
import React from "react";
|
|
4
|
-
import { classNames } from "../../utilities/props.js";
|
|
5
4
|
import useElementId from "../../hooks/useElementId.js";
|
|
6
|
-
import AccordionContext from "./Accordion.context.js";
|
|
7
5
|
import useHandlerRef from "../../hooks/useHandlerRef.js";
|
|
6
|
+
import { classNames } from "../../utilities/props.js";
|
|
7
|
+
import AccordionContext from "./Accordion.context.js";
|
|
8
8
|
const AccordionControlled = (props) => {
|
|
9
9
|
const { children, onToggle, active, iconPosition, iconSize, gap, className, attributes } = props;
|
|
10
10
|
const rootClassNames = classNames(className);
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
3
|
import React from "react";
|
|
4
|
-
import { classNames } from "../../utilities/props.js";
|
|
5
4
|
import Actionable from "../Actionable/index.js";
|
|
6
|
-
import View from "../View/index.js";
|
|
7
5
|
import Icon from "../Icon/index.js";
|
|
6
|
+
import View from "../View/index.js";
|
|
8
7
|
import IconChevronDown from "../../icons/ChevronDown.js";
|
|
8
|
+
import { classNames } from "../../utilities/props.js";
|
|
9
9
|
import AccordionContext from "./Accordion.context.js";
|
|
10
10
|
import s from "./Accordion.module.css";
|
|
11
11
|
const AccordionTrigger = (props) => {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import Accordion from "./Accordion";
|
|
2
|
-
import AccordionTrigger from "./AccordionTrigger";
|
|
3
2
|
import AccordionContent from "./AccordionContent";
|
|
3
|
+
import AccordionTrigger from "./AccordionTrigger";
|
|
4
4
|
declare const AccordionRoot: typeof Accordion & {
|
|
5
5
|
Trigger: typeof AccordionTrigger;
|
|
6
6
|
Content: typeof AccordionContent;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import Accordion from "./Accordion.js";
|
|
2
|
-
import AccordionTrigger from "./AccordionTrigger.js";
|
|
3
2
|
import AccordionContent from "./AccordionContent.js";
|
|
3
|
+
import AccordionTrigger from "./AccordionTrigger.js";
|
|
4
4
|
const AccordionRoot = Accordion;
|
|
5
5
|
AccordionRoot.Trigger = AccordionTrigger;
|
|
6
6
|
AccordionRoot.Content = AccordionContent;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { classNames, responsiveVariables } from "../../utilities/props.js";
|
|
3
2
|
import View from "../View/index.js";
|
|
3
|
+
import { classNames, responsiveVariables } from "../../utilities/props.js";
|
|
4
4
|
import s from "./ActionBar.module.css";
|
|
5
5
|
const fullWidthPositions = ["top", "bottom"];
|
|
6
6
|
const ActionBar = (props) => {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type React from "react";
|
|
2
1
|
import type { ViewProps } from "../View";
|
|
2
|
+
import type React from "react";
|
|
3
3
|
import type * as G from "../../types/global";
|
|
4
4
|
export type Props = Pick<ViewProps, "paddingBlock" | "paddingInline" | "padding"> & {
|
|
5
5
|
/** Show or hide the component */
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
3
|
import { forwardRef } from "react";
|
|
4
|
-
import { classNames } from "../../utilities/props.js";
|
|
5
4
|
import * as keys from "../../constants/keys.js";
|
|
5
|
+
import { classNames } from "../../utilities/props.js";
|
|
6
6
|
import s from "./Actionable.module.css";
|
|
7
7
|
const Actionable = forwardRef((props, ref) => {
|
|
8
8
|
const { children, render, href, onClick, type, disabled, insetFocus, disableFocusRing, borderRadius, as, stopPropagation, fullWidth, touchHitbox, className, attributes, } = props;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import Icon from "../Icon/index.js";
|
|
3
|
-
import View from "../View/index.js";
|
|
4
3
|
import Text from "../Text/index.js";
|
|
4
|
+
import View from "../View/index.js";
|
|
5
5
|
import s from "./Alert.module.css";
|
|
6
6
|
const Alert = (props) => {
|
|
7
7
|
const { title, children, icon, actionsSlot, color = "neutral", inline, bleed, className, attributes, } = props;
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
3
|
import React from "react";
|
|
4
|
-
import TextField from "../TextField/index.js";
|
|
5
4
|
import DropdownMenu from "../DropdownMenu/index.js";
|
|
5
|
+
import TextField from "../TextField/index.js";
|
|
6
6
|
import * as keys from "../../constants/keys.js";
|
|
7
|
-
import useHotkeys from "../../hooks/useHotkeys.js";
|
|
8
|
-
import useHandlerRef from "../../hooks/useHandlerRef.js";
|
|
9
|
-
import s from "./Autocomplete.module.css";
|
|
10
7
|
import useElementId from "../../hooks/useElementId.js";
|
|
8
|
+
import useHandlerRef from "../../hooks/useHandlerRef.js";
|
|
9
|
+
import useHotkeys from "../../hooks/useHotkeys.js";
|
|
11
10
|
import useIsomorphicLayoutEffect from "../../hooks/useIsomorphicLayoutEffect.js";
|
|
11
|
+
import s from "./Autocomplete.module.css";
|
|
12
12
|
const AutocompleteContext = React.createContext({});
|
|
13
13
|
const Autocomplete = (props) => {
|
|
14
|
-
const { children, onChange, onInput, onItemSelect, name, containerRef, instanceRef, onBackspace, onEnter, active, onOpen, onClose, fallbackAdjustLayout, fallbackMinWidth, fallbackMinHeight, ...textFieldProps } = props;
|
|
14
|
+
const { children, onChange, onInput, onItemSelect, name, containerRef, instanceRef, onBackspace, onEnter, active, onOpen, onClose, fallbackAdjustLayout, fallbackMinWidth, fallbackMinHeight, contentMaxHeight, ...textFieldProps } = props;
|
|
15
15
|
const [highlightedId, setHighlightedId] = React.useState();
|
|
16
16
|
const onBackspaceRef = useHandlerRef(onBackspace);
|
|
17
17
|
const contentRef = React.useRef(null);
|
|
@@ -120,7 +120,7 @@ const Autocomplete = (props) => {
|
|
|
120
120
|
highlightedId,
|
|
121
121
|
setHighlightedId,
|
|
122
122
|
}), [highlightedId, handleItemClick]);
|
|
123
|
-
return (_jsx(AutocompleteContext.Provider, { value: contextValue, children: _jsxs(DropdownMenu, { position: "bottom", width: "trigger", triggerType: "focus", trapFocusMode: false, active: isDropdownActive, onClose: handleClose, onOpen: handleOpen, containerRef: containerRef, fallbackAdjustLayout: fallbackAdjustLayout, fallbackMinWidth: fallbackMinWidth, fallbackMinHeight: fallbackMinHeight, disableHideAnimation: true, instanceRef: instanceRef, children: [_jsx(DropdownMenu.Trigger, { children: ({ ref, ...attributes }) => (_jsx(TextField, { ...textFieldProps, name: name, onChange: handleChange, focused: isDropdownActive, attributes: {
|
|
123
|
+
return (_jsx(AutocompleteContext.Provider, { value: contextValue, children: _jsxs(DropdownMenu, { position: "bottom", width: "trigger", triggerType: "focus", trapFocusMode: false, active: isDropdownActive, onClose: handleClose, onOpen: handleOpen, containerRef: containerRef, fallbackAdjustLayout: fallbackAdjustLayout, fallbackMinWidth: fallbackMinWidth, fallbackMinHeight: fallbackMinHeight, contentMaxHeight: contentMaxHeight, disableHideAnimation: true, instanceRef: instanceRef, children: [_jsx(DropdownMenu.Trigger, { children: ({ ref, ...attributes }) => (_jsx(TextField, { ...textFieldProps, name: name, onChange: handleChange, focused: isDropdownActive, attributes: {
|
|
124
124
|
...textFieldProps.attributes,
|
|
125
125
|
// Ignoring the type check since TS can't infer the correct html element type
|
|
126
126
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import type { TextFieldProps } from "../TextField";
|
|
2
|
-
import type { MenuItemProps } from "../MenuItem";
|
|
3
1
|
import type { DropdownMenuProps, DropdownMenuInstance } from "../DropdownMenu";
|
|
2
|
+
import type { MenuItemProps } from "../MenuItem";
|
|
3
|
+
import type { TextFieldProps } from "../TextField";
|
|
4
4
|
type SelectArgs = {
|
|
5
5
|
/** Value that will be passed to the input on selection */
|
|
6
6
|
value: string;
|
|
7
7
|
/** Additional data that will be passed to the onItemSelect callback */
|
|
8
8
|
data?: unknown;
|
|
9
9
|
};
|
|
10
|
-
export type Props = TextFieldProps & Pick<DropdownMenuProps, "containerRef" | "instanceRef" | "active" | "onOpen" | "onClose" | "fallbackAdjustLayout" | "fallbackMinWidth" | "fallbackMinHeight"> & {
|
|
10
|
+
export type Props = TextFieldProps & Pick<DropdownMenuProps, "containerRef" | "instanceRef" | "active" | "onOpen" | "onClose" | "fallbackAdjustLayout" | "fallbackMinWidth" | "fallbackMinHeight" | "contentMaxHeight"> & {
|
|
11
11
|
/** Callback for when value changes from user input */
|
|
12
12
|
onInput?: TextFieldProps["onChange"];
|
|
13
13
|
/** Callback for when an item is selected in the dropdown */
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { classNames, responsivePropDependency } from "../../utilities/props.js";
|
|
3
|
-
import { resolveMixin } from "../../styles/mixin.js";
|
|
4
2
|
import Icon from "../Icon/index.js";
|
|
5
3
|
import View from "../View/index.js";
|
|
4
|
+
import { resolveMixin } from "../../styles/mixin.js";
|
|
5
|
+
import { classNames, responsivePropDependency } from "../../utilities/props.js";
|
|
6
6
|
import s from "./Avatar.module.css";
|
|
7
7
|
const Avatar = (props) => {
|
|
8
8
|
const { color = "neutral", variant, src, size = 12, squared, initials, icon, className, renderImage, imageAttributes: passedImageAttributes, attributes, } = props;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import {
|
|
3
|
-
import
|
|
2
|
+
import { forwardRef } from "react";
|
|
3
|
+
import Actionable from "../Actionable/index.js";
|
|
4
4
|
import Icon from "../Icon/index.js";
|
|
5
|
+
import Text from "../Text/index.js";
|
|
5
6
|
import IconClose from "../../icons/Close.js";
|
|
6
|
-
import
|
|
7
|
+
import { classNames } from "../../utilities/props.js";
|
|
7
8
|
import s from "./Badge.module.css";
|
|
8
|
-
import { forwardRef } from "react";
|
|
9
9
|
const Badge = forwardRef((props, ref) => {
|
|
10
10
|
const { children, color, rounded, size = "medium", icon, endIcon, variant, hidden, highlighted, href, onClick, onDismiss, dismissAriaLabel, className, attributes, } = props;
|
|
11
11
|
const isActionable = !!(onClick || href);
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
3
|
import React from "react";
|
|
4
|
-
import
|
|
5
|
-
import View from "../View/index.js";
|
|
4
|
+
import Button from "../Button/index.js";
|
|
6
5
|
import Icon from "../Icon/index.js";
|
|
7
6
|
import Text from "../Text/index.js";
|
|
8
|
-
import
|
|
7
|
+
import View from "../View/index.js";
|
|
9
8
|
import IconChevronRight from "../../icons/ChevronRight.js";
|
|
10
9
|
import IconDotsHorizontal from "../../icons/DotsHorizontal.js";
|
|
10
|
+
import { classNames } from "../../utilities/props.js";
|
|
11
11
|
const Breadcrumbs = (props) => {
|
|
12
12
|
const { children, separator, color, defaultVisibleItems, expandAriaLabel, disableExpand, ariaLabel, className, attributes, } = props;
|
|
13
13
|
const visibleItems = defaultVisibleItems && defaultVisibleItems >= 2 ? defaultVisibleItems : null;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import Text from "../Text/index.js";
|
|
3
2
|
import Link from "../Link/index.js";
|
|
3
|
+
import Text from "../Text/index.js";
|
|
4
4
|
const BreadcrumbsItem = (props) => {
|
|
5
5
|
const { children, onClick, href, icon, disabled } = props;
|
|
6
6
|
if (!href && !onClick && !disabled) {
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { forwardRef } from "react";
|
|
3
|
-
import
|
|
3
|
+
import Actionable from "../Actionable/index.js";
|
|
4
4
|
import Icon from "../Icon/index.js";
|
|
5
5
|
import Loader from "../Loader/index.js";
|
|
6
|
-
import
|
|
6
|
+
import { classNames, responsiveClassNames, responsivePropDependency } from "../../utilities/props.js";
|
|
7
7
|
import s from "./Button.module.css";
|
|
8
8
|
const Button = forwardRef((props, ref) => {
|
|
9
9
|
const { variant = "solid", color = "neutral", elevated, highlighted, fullWidth, loading, loadingAriaLabel, disabled, type, href, size = "medium", children, rounded, onClick, icon, endIcon, stopPropagation, as, render, className, attributes, } = props;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import type React from "react";
|
|
2
|
-
import type { IconProps } from "../Icon";
|
|
3
|
-
import type { ActionableProps } from "../Actionable";
|
|
4
1
|
import type { AlignerProps as BaseAlignerProps } from "../_private/Aligner";
|
|
2
|
+
import type { ActionableProps } from "../Actionable";
|
|
3
|
+
import type { IconProps } from "../Icon";
|
|
4
|
+
import type React from "react";
|
|
5
5
|
import type * as G from "../../types/global";
|
|
6
6
|
export type Size = "xlarge" | "large" | "medium" | "small";
|
|
7
7
|
export type Props = Pick<ActionableProps, "attributes" | "className" | "disabled" | "children" | "href" | "onClick" | "type" | "as" | "stopPropagation" | "render"> & {
|
|
@@ -1,13 +1,23 @@
|
|
|
1
1
|
export type SelectionMode = "date" | "month";
|
|
2
2
|
export type BaseProps = {
|
|
3
|
-
/** Default month to display
|
|
3
|
+
/** Default month to display. Used in uncontrolled mode to provide the initial month and then updated by the component internally
|
|
4
4
|
* @default Date.now()
|
|
5
5
|
*/
|
|
6
6
|
defaultMonth?: Date;
|
|
7
|
+
/** Month to display. Used in controlled mode and should be updated using the `onMonthChange` callback */
|
|
8
|
+
month?: Date;
|
|
9
|
+
/** Callback when the month changes */
|
|
10
|
+
onMonthChange?: (args: {
|
|
11
|
+
date: Date;
|
|
12
|
+
}) => void;
|
|
7
13
|
/** Minimum date that can be selected */
|
|
8
14
|
min?: Date;
|
|
9
15
|
/** Maximum date that can be selected */
|
|
10
16
|
max?: Date;
|
|
17
|
+
/** Number of months to render at the same time
|
|
18
|
+
* @default 1
|
|
19
|
+
*/
|
|
20
|
+
monthsToRender?: number;
|
|
11
21
|
/** First day of the week
|
|
12
22
|
* @default 1, Monday
|
|
13
23
|
*/
|
|
@@ -28,6 +38,11 @@ export type BaseProps = {
|
|
|
28
38
|
month: number;
|
|
29
39
|
date: Date;
|
|
30
40
|
}) => string;
|
|
41
|
+
/** Render a custom date slot content under the date number */
|
|
42
|
+
renderDateSlot?: (args: {
|
|
43
|
+
date: Date;
|
|
44
|
+
selected: boolean;
|
|
45
|
+
}) => React.ReactNode;
|
|
31
46
|
/** Aria label for the previous month button */
|
|
32
47
|
previousMonthAriaLabel?: string;
|
|
33
48
|
nextMonthAriaLabel?: string;
|
|
@@ -106,7 +121,7 @@ export type MonthProps = {
|
|
|
106
121
|
hoveredDate: Date | null;
|
|
107
122
|
onDateHover: (date: Date) => void;
|
|
108
123
|
onDateHoverEnd: (date: Date) => void;
|
|
109
|
-
} & Pick<BaseProps, "max" | "min" | "firstWeekDay" | "selectedDates" | "renderMonthLabel" | "renderWeekDay" | "renderSelectedMonthLabel" | "renderDateAriaLabel"> & Pick<ControlledProps, "value" | "onChange" | "range">;
|
|
124
|
+
} & Pick<BaseProps, "max" | "min" | "firstWeekDay" | "selectedDates" | "renderMonthLabel" | "renderWeekDay" | "renderSelectedMonthLabel" | "renderDateAriaLabel" | "renderDateSlot"> & Pick<ControlledProps, "value" | "onChange" | "range">;
|
|
110
125
|
export type YearProps = {
|
|
111
126
|
monthDate: Date;
|
|
112
127
|
onMonthClick: (month: number) => void;
|
|
@@ -119,16 +134,18 @@ export type DateProps = {
|
|
|
119
134
|
startValue: Date | null;
|
|
120
135
|
endValue: Date | null;
|
|
121
136
|
renderAriaLabel?: MonthProps["renderDateAriaLabel"];
|
|
137
|
+
renderSlot?: MonthProps["renderDateSlot"];
|
|
122
138
|
onDateFocus: (date: Date) => void;
|
|
123
139
|
} & Pick<MonthProps, "hoveredDate" | "onDateHover" | "onDateHoverEnd" | "onChange" | "range" | "min" | "max" | "selectedDates">;
|
|
124
140
|
export type ControlsProps = {
|
|
125
141
|
selectionMode: SelectionMode;
|
|
142
|
+
monthsToRender: number;
|
|
126
143
|
onMonthTitleClick: () => void;
|
|
127
|
-
monthTitleRef
|
|
144
|
+
monthTitleRef?: React.RefObject<HTMLButtonElement | null>;
|
|
128
145
|
monthDate: Date;
|
|
129
146
|
renderSelectedMonthLabel?: BaseProps["renderSelectedMonthLabel"];
|
|
130
|
-
|
|
131
|
-
|
|
147
|
+
hidePrevious?: boolean;
|
|
148
|
+
hideNext?: boolean;
|
|
132
149
|
onNextClick: () => void;
|
|
133
150
|
onPreviousClick: () => void;
|
|
134
151
|
} & Pick<BaseProps, "nextMonthAriaLabel" | "nextYearAriaLabel" | "previousMonthAriaLabel" | "previousYearAriaLabel" | "monthSelectionAriaLabel">;
|
|
@@ -4,14 +4,14 @@ import React from "react";
|
|
|
4
4
|
import View from "../View/index.js";
|
|
5
5
|
import { onNextFrame } from "../../utilities/animation.js";
|
|
6
6
|
import { setMonthToPrevious, setMonthToNext, setMonthTo, setYearToNext, setYearToPrevious, applyNavigationBounds, } from "./Calendar.utils.js";
|
|
7
|
-
import
|
|
7
|
+
import CalendarControls from "./CalendarControls.js";
|
|
8
8
|
import CalendarMonth from "./CalendarMonth.js";
|
|
9
9
|
import CalendarYear from "./CalendarYear.js";
|
|
10
|
-
import
|
|
10
|
+
import useCalendarKeyboardNavigation from "./useCalendarKeyboardNavigation.js";
|
|
11
11
|
const CalendarControlled = (props) => {
|
|
12
|
-
const { value, onChange, defaultMonth, min, max, range, firstWeekDay, selectedDates, renderMonthLabel, renderSelectedMonthLabel, renderWeekDay, previousMonthAriaLabel, previousYearAriaLabel, nextMonthAriaLabel, nextYearAriaLabel, monthSelectionAriaLabel, renderMonthAriaLabel, renderDateAriaLabel, } = props;
|
|
12
|
+
const { value, onChange, defaultMonth, month, onMonthChange, min, max, range, firstWeekDay, selectedDates, monthsToRender = 1, renderMonthLabel, renderSelectedMonthLabel, renderWeekDay, previousMonthAriaLabel, previousYearAriaLabel, nextMonthAriaLabel, nextYearAriaLabel, monthSelectionAriaLabel, renderMonthAriaLabel, renderDateAriaLabel, renderDateSlot, } = props;
|
|
13
13
|
const [selectionMode, setSelectionMode] = React.useState("date");
|
|
14
|
-
const [monthDate, setMonthDate] = React.useState(defaultMonth || new Date());
|
|
14
|
+
const [monthDate, setMonthDate] = React.useState(month || defaultMonth || new Date());
|
|
15
15
|
const [hoveredDate, setHoveredDate] = React.useState(null);
|
|
16
16
|
const monthTitleRef = React.useRef(null);
|
|
17
17
|
const prevSelectionModeRef = React.useRef(selectionMode);
|
|
@@ -19,23 +19,38 @@ const CalendarControlled = (props) => {
|
|
|
19
19
|
const selectionRootRef = React.useRef(null);
|
|
20
20
|
const handlePreviousClick = () => {
|
|
21
21
|
if (selectionMode === "month") {
|
|
22
|
-
|
|
22
|
+
const updatedMonth = setYearToPrevious(monthDate);
|
|
23
|
+
onMonthChange?.({ date: updatedMonth });
|
|
24
|
+
if (month === undefined)
|
|
25
|
+
setMonthDate(updatedMonth);
|
|
23
26
|
return;
|
|
24
27
|
}
|
|
25
|
-
|
|
28
|
+
const updatedMonth = setMonthToPrevious(monthDate);
|
|
29
|
+
onMonthChange?.({ date: updatedMonth });
|
|
30
|
+
if (month === undefined)
|
|
31
|
+
setMonthDate(updatedMonth);
|
|
26
32
|
};
|
|
27
33
|
const handleNextClick = () => {
|
|
28
34
|
if (selectionMode === "month") {
|
|
29
|
-
|
|
35
|
+
const updatedMonth = setYearToNext(monthDate);
|
|
36
|
+
onMonthChange?.({ date: updatedMonth });
|
|
37
|
+
if (month === undefined)
|
|
38
|
+
setMonthDate(updatedMonth);
|
|
30
39
|
return;
|
|
31
40
|
}
|
|
32
|
-
|
|
41
|
+
const updatedMonth = setMonthToNext(monthDate);
|
|
42
|
+
onMonthChange?.({ date: updatedMonth });
|
|
43
|
+
if (month === undefined)
|
|
44
|
+
setMonthDate(updatedMonth);
|
|
33
45
|
};
|
|
34
46
|
const handleMonthTitleClick = () => {
|
|
35
47
|
setSelectionMode("month");
|
|
36
48
|
};
|
|
37
49
|
const handleMonthClick = (i) => {
|
|
38
|
-
|
|
50
|
+
const updatedMonth = setMonthTo(monthDate, i);
|
|
51
|
+
onMonthChange?.({ date: updatedMonth });
|
|
52
|
+
if (month === undefined)
|
|
53
|
+
setMonthDate(updatedMonth);
|
|
39
54
|
setSelectionMode("date");
|
|
40
55
|
};
|
|
41
56
|
const handleDateHover = (date) => {
|
|
@@ -53,6 +68,14 @@ const CalendarControlled = (props) => {
|
|
|
53
68
|
}
|
|
54
69
|
prevSelectionModeRef.current = selectionMode;
|
|
55
70
|
}, [selectionMode]);
|
|
71
|
+
/**
|
|
72
|
+
* Handle rendering in controlled mode
|
|
73
|
+
*/
|
|
74
|
+
React.useEffect(() => {
|
|
75
|
+
if (!month)
|
|
76
|
+
return;
|
|
77
|
+
setMonthDate(month);
|
|
78
|
+
}, [month]);
|
|
56
79
|
useCalendarKeyboardNavigation({
|
|
57
80
|
monthDate,
|
|
58
81
|
rootRef: selectionRootRef,
|
|
@@ -63,7 +86,19 @@ const CalendarControlled = (props) => {
|
|
|
63
86
|
min,
|
|
64
87
|
max,
|
|
65
88
|
});
|
|
66
|
-
return (_jsxs(View, { gap: 2, children: [_jsx(
|
|
89
|
+
return (_jsxs(View, { gap: 2, children: [_jsx(View, { direction: "row", gap: 4, children: Array.from({ length: selectionMode === "date" ? monthsToRender : 1 }).map((_, index) => {
|
|
90
|
+
const hidePrevious = bounds.isFirstMonth || (monthsToRender > 0 && index > 0);
|
|
91
|
+
const hideNext = bounds.isLastMonth ||
|
|
92
|
+
(selectionMode === "date" && monthsToRender > 0 && index < monthsToRender - 1);
|
|
93
|
+
const currentMonthDate = new Date(monthDate);
|
|
94
|
+
currentMonthDate.setMonth(currentMonthDate.getMonth() + index);
|
|
95
|
+
return (_jsx(View.Item, { grow: true, children: _jsx(CalendarControls, { renderSelectedMonthLabel: renderSelectedMonthLabel, monthDate: currentMonthDate, selectionMode: selectionMode, hidePrevious: hidePrevious, hideNext: hideNext, monthTitleRef: index === 0 ? monthTitleRef : undefined, onMonthTitleClick: handleMonthTitleClick, onNextClick: handleNextClick, onPreviousClick: handlePreviousClick, previousMonthAriaLabel: previousMonthAriaLabel, previousYearAriaLabel: previousYearAriaLabel, nextMonthAriaLabel: nextMonthAriaLabel, nextYearAriaLabel: nextYearAriaLabel, monthSelectionAriaLabel: monthSelectionAriaLabel, monthsToRender: monthsToRender }) }, index));
|
|
96
|
+
}) }), _jsxs(View, { direction: "row", gap: 4, attributes: { ref: selectionRootRef }, children: [selectionMode === "date" &&
|
|
97
|
+
Array.from({ length: monthsToRender }).map((_, index) => {
|
|
98
|
+
const currentMonthDate = new Date(monthDate);
|
|
99
|
+
currentMonthDate.setMonth(currentMonthDate.getMonth() + index);
|
|
100
|
+
return (_jsx(View.Item, { grow: true, children: _jsx(CalendarMonth, { date: currentMonthDate, value: value, onChange: onChange, min: min, max: max, range: range, firstWeekDay: firstWeekDay, hoveredDate: hoveredDate, selectedDates: selectedDates, onDateHover: handleDateHover, onDateHoverEnd: handleDateHoverEnd, renderWeekDay: renderWeekDay, renderDateAriaLabel: renderDateAriaLabel, renderDateSlot: renderDateSlot }) }, index));
|
|
101
|
+
}), selectionMode === "month" && (_jsx(CalendarYear, { monthDate: monthDate, onMonthClick: handleMonthClick, renderMonthLabel: renderMonthLabel, renderMonthAriaLabel: renderMonthAriaLabel, min: min, max: max }))] })] }));
|
|
67
102
|
};
|
|
68
103
|
CalendarControlled.displayName = "CalendarControlled";
|
|
69
104
|
export default CalendarControlled;
|
|
@@ -1,44 +1,44 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import React from "react";
|
|
3
3
|
import Button from "../Button/index.js";
|
|
4
|
-
import View from "../View/index.js";
|
|
5
4
|
import Hidden from "../Hidden/index.js";
|
|
6
|
-
import Text from "../Text/index.js";
|
|
7
5
|
import HiddenVisually from "../HiddenVisually/index.js";
|
|
6
|
+
import Text from "../Text/index.js";
|
|
7
|
+
import View from "../View/index.js";
|
|
8
8
|
import IconChevronLeft from "../../icons/ChevronLeft.js";
|
|
9
9
|
import IconChevronRight from "../../icons/ChevronRight.js";
|
|
10
10
|
import { onNextFrame } from "../../utilities/animation.js";
|
|
11
11
|
import s from "./Calendar.module.css";
|
|
12
12
|
const CalendarControls = (props) => {
|
|
13
|
-
const { selectionMode, onMonthTitleClick, monthTitleRef, monthDate, renderSelectedMonthLabel,
|
|
13
|
+
const { selectionMode, onMonthTitleClick, monthTitleRef, monthDate, renderSelectedMonthLabel, hidePrevious, hideNext, onNextClick, onPreviousClick, monthSelectionAriaLabel = "Select a month", previousMonthAriaLabel = "Previous month", previousYearAriaLabel = "Previous year", nextMonthAriaLabel = "Next month", nextYearAriaLabel = "Next year", } = props;
|
|
14
14
|
const prevRef = React.useRef(null);
|
|
15
15
|
const nextRef = React.useRef(null);
|
|
16
16
|
React.useEffect(() => {
|
|
17
|
-
if (!
|
|
17
|
+
if (!hidePrevious)
|
|
18
18
|
return;
|
|
19
19
|
if (document.activeElement !== prevRef.current)
|
|
20
20
|
return;
|
|
21
|
-
const targetEl = nextRef.current || monthTitleRef
|
|
21
|
+
const targetEl = nextRef.current || monthTitleRef?.current;
|
|
22
22
|
onNextFrame(() => {
|
|
23
23
|
targetEl?.focus();
|
|
24
24
|
});
|
|
25
|
-
}, [
|
|
25
|
+
}, [hidePrevious, monthTitleRef]);
|
|
26
26
|
React.useEffect(() => {
|
|
27
|
-
if (!
|
|
27
|
+
if (!hideNext)
|
|
28
28
|
return;
|
|
29
29
|
if (document.activeElement !== nextRef.current)
|
|
30
30
|
return;
|
|
31
|
-
const targetEl = prevRef.current || monthTitleRef
|
|
31
|
+
const targetEl = prevRef.current || monthTitleRef?.current;
|
|
32
32
|
onNextFrame(() => {
|
|
33
33
|
targetEl?.focus();
|
|
34
34
|
});
|
|
35
|
-
}, [
|
|
36
|
-
return (_jsxs(View, { direction: "row", gap: 2, align: "center", children: [_jsx(Hidden, { visibility: true, hide:
|
|
35
|
+
}, [hideNext, monthTitleRef]);
|
|
36
|
+
return (_jsxs(View, { direction: "row", gap: 2, align: "center", children: [_jsx(Hidden, { visibility: true, hide: hidePrevious, children: _jsx("div", { className: s.control, children: _jsx(Button, { variant: "ghost", icon: IconChevronLeft, onClick: onPreviousClick, attributes: {
|
|
37
37
|
ref: prevRef,
|
|
38
38
|
"aria-label": selectionMode === "date" ? previousMonthAriaLabel : previousYearAriaLabel,
|
|
39
39
|
} }) }) }), _jsxs(View.Item, { grow: true, children: [selectionMode === "date" && (_jsxs(Button, { fullWidth: true, variant: "ghost", onClick: onMonthTitleClick, attributes: { ref: monthTitleRef }, children: [renderSelectedMonthLabel
|
|
40
40
|
? renderSelectedMonthLabel({ date: monthDate })
|
|
41
|
-
: monthDate.toLocaleDateString("en-US", { month: "long", year: "numeric" }), _jsx(HiddenVisually, { children: monthSelectionAriaLabel })] })), selectionMode === "month" && (_jsx(Text, { align: "center", weight: "medium", children: monthDate.toLocaleDateString("en-US", { year: "numeric" }) }))] }), _jsx(Hidden, { visibility: true, hide:
|
|
41
|
+
: monthDate.toLocaleDateString("en-US", { month: "long", year: "numeric" }), _jsx(HiddenVisually, { children: monthSelectionAriaLabel })] })), selectionMode === "month" && (_jsx(Text, { align: "center", weight: "medium", children: monthDate.toLocaleDateString("en-US", { year: "numeric" }) }))] }), _jsx(Hidden, { visibility: true, hide: hideNext, children: _jsx("div", { className: s.control, children: _jsx(Button, { variant: "ghost", icon: IconChevronRight, onClick: onNextClick, attributes: {
|
|
42
42
|
ref: nextRef,
|
|
43
43
|
"aria-label": selectionMode === "date" ? nextMonthAriaLabel : nextYearAriaLabel,
|
|
44
44
|
} }) }) })] }));
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
3
|
import Actionable from "../Actionable/index.js";
|
|
4
4
|
import { classNames } from "../../utilities/props.js";
|
|
5
|
-
import { getLocalISODate } from "./Calendar.utils.js";
|
|
6
5
|
import s from "./Calendar.module.css";
|
|
6
|
+
import { getLocalISODate } from "./Calendar.utils.js";
|
|
7
7
|
const CalendarDate = (props) => {
|
|
8
|
-
const { date, isoDate, startValue, endValue, disabled, focusable, onChange, range, hoveredDate, onDateHover, onDateHoverEnd, onDateFocus, renderAriaLabel,
|
|
8
|
+
const { date, isoDate, startValue, endValue, disabled, focusable, onChange, range, hoveredDate, onDateHover, onDateHoverEnd, onDateFocus, selectedDates, renderAriaLabel, renderSlot, } = props;
|
|
9
9
|
if (!date)
|
|
10
10
|
return _jsx("td", { className: s.cell, "aria-hidden": "true" });
|
|
11
11
|
const isoStartValue = startValue && getLocalISODate({ date: startValue });
|
|
@@ -61,7 +61,7 @@ const CalendarDate = (props) => {
|
|
|
61
61
|
handleMouseEnter();
|
|
62
62
|
onDateFocus(date);
|
|
63
63
|
};
|
|
64
|
-
return (_jsx("td", { className: dateClassNames, role: disabled ? "presentation" : "gridcell", children:
|
|
64
|
+
return (_jsx("td", { className: dateClassNames, role: disabled ? "presentation" : "gridcell", children: _jsxs(Actionable, { fullWidth: true, insetFocus: true, className: s["cell-button"], disabled: disabled, onClick: handleClick, attributes: {
|
|
65
65
|
role: "checkbox",
|
|
66
66
|
tabIndex: focusable ? 0 : -1,
|
|
67
67
|
"aria-hidden": disabled,
|
|
@@ -74,7 +74,7 @@ const CalendarDate = (props) => {
|
|
|
74
74
|
onMouseLeave: handleMouseLeave,
|
|
75
75
|
onFocus: handleFocus,
|
|
76
76
|
onBlur: handleMouseLeave,
|
|
77
|
-
}, children: date.getDate() }) }));
|
|
77
|
+
}, children: [date.getDate(), renderSlot?.({ date, selected: Boolean(selection && selection !== "range") })] }) }));
|
|
78
78
|
};
|
|
79
79
|
CalendarDate.displayName = "CalendarDate";
|
|
80
80
|
export default CalendarDate;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
3
|
import { useState } from "react";
|
|
4
|
+
import s from "./Calendar.module.css";
|
|
4
5
|
import { getMonthWeeks, getWeekdayNames, getLocalISODate, isDateFocusable } from "./Calendar.utils.js";
|
|
5
6
|
import CalendarDate from "./CalendarDate.js";
|
|
6
|
-
import s from "./Calendar.module.css";
|
|
7
7
|
const CalendarMonth = (props) => {
|
|
8
|
-
const { date, value, onChange, min, max, range, firstWeekDay, selectedDates, hoveredDate, onDateHover, onDateHoverEnd, renderWeekDay, renderDateAriaLabel, } = props;
|
|
8
|
+
const { date, value, onChange, min, max, range, firstWeekDay, selectedDates, hoveredDate, onDateHover, onDateHoverEnd, renderWeekDay, renderDateAriaLabel, renderDateSlot, } = props;
|
|
9
9
|
let foundFocusableDate = false;
|
|
10
10
|
const [lastFocusedDate, setLastFocusedDate] = useState();
|
|
11
11
|
const month = date.getMonth();
|
|
@@ -26,7 +26,7 @@ const CalendarMonth = (props) => {
|
|
|
26
26
|
// eslint-disable-next-line react-hooks/immutability
|
|
27
27
|
if (focusable)
|
|
28
28
|
foundFocusableDate = true;
|
|
29
|
-
return (_jsx(CalendarDate, { date: date, isoDate: isoDate, disabled: disabled, range: range, focusable: focusable, startValue: startValue, endValue: endValue, onChange: onChange, hoveredDate: hoveredDate, onDateHover: onDateHover, onDateHoverEnd: onDateHoverEnd, onDateFocus: setLastFocusedDate, renderAriaLabel: renderDateAriaLabel, selectedDates: selectedDates }, index));
|
|
29
|
+
return (_jsx(CalendarDate, { date: date, isoDate: isoDate, disabled: disabled, range: range, focusable: focusable, startValue: startValue, endValue: endValue, onChange: onChange, hoveredDate: hoveredDate, onDateHover: onDateHover, onDateHoverEnd: onDateHoverEnd, onDateFocus: setLastFocusedDate, renderAriaLabel: renderDateAriaLabel, selectedDates: selectedDates, renderSlot: renderDateSlot }, index));
|
|
30
30
|
}) }, key));
|
|
31
31
|
}) })] }));
|
|
32
32
|
};
|
|
@@ -2,8 +2,8 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
2
2
|
import React from "react";
|
|
3
3
|
import Actionable from "../Actionable/index.js";
|
|
4
4
|
import { onNextFrame } from "../../utilities/animation.js";
|
|
5
|
-
import { getMonthNames } from "./Calendar.utils.js";
|
|
6
5
|
import s from "./Calendar.module.css";
|
|
6
|
+
import { getMonthNames } from "./Calendar.utils.js";
|
|
7
7
|
const MONTHS_PER_ROW = 3;
|
|
8
8
|
const CalendarYear = (props) => {
|
|
9
9
|
const { renderMonthLabel, renderMonthAriaLabel, monthDate, min, max, onMonthClick } = props;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import useHotkeys from "../../hooks/useHotkeys.js";
|
|
3
2
|
import * as keys from "../../constants/keys.js";
|
|
3
|
+
import useHotkeys from "../../hooks/useHotkeys.js";
|
|
4
4
|
import { getFocusableDates } from "./Calendar.utils.js";
|
|
5
5
|
const useCalendarKeyboardNavigation = (props) => {
|
|
6
6
|
const { rootRef, changeToNextMonth, changeToPreviousMonth, monthDate, verticalDelta, min, max } = props;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import { forwardRef } from "react";
|
|
3
|
-
import { classNames } from "../../utilities/props.js";
|
|
4
3
|
import Actionable from "../Actionable/index.js";
|
|
5
|
-
import s from "./Card.module.css";
|
|
6
4
|
import { resolveMixin } from "../../styles/mixin.js";
|
|
5
|
+
import { classNames } from "../../utilities/props.js";
|
|
6
|
+
import s from "./Card.module.css";
|
|
7
7
|
const Card = forwardRef((props, ref) => {
|
|
8
8
|
const { padding = 4 } = props;
|
|
9
9
|
const { selected, elevated, bleed, height, onClick, href, children, className, attributes,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type React from "react";
|
|
2
1
|
import type { ActionableProps } from "../Actionable";
|
|
3
2
|
import type { ViewProps } from "../View";
|
|
3
|
+
import type React from "react";
|
|
4
4
|
import type * as G from "../../types/global";
|
|
5
5
|
export type Props<TagName extends keyof React.JSX.IntrinsicElements = "div"> = {
|
|
6
6
|
/** Component padding, base unit multiplier */
|