@hjmds/react 1.46.0 → 1.47.0
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/actions.d.ts +2 -2
- package/dist/activity-chip.d.ts +1 -1
- package/dist/advanced-display.d.ts +6 -0
- package/dist/advanced-display.d.ts.map +1 -1
- package/dist/advanced-display.js +4 -2
- package/dist/advanced-display.js.map +1 -1
- package/dist/advanced-forms.d.ts +2 -2
- package/dist/auth-screen.d.ts +1 -1
- package/dist/bottom-navigation.d.ts.map +1 -1
- package/dist/bottom-navigation.js +1 -1
- package/dist/bottom-navigation.js.map +1 -1
- package/dist/calendar.d.ts.map +1 -1
- package/dist/calendar.js +31 -24
- package/dist/calendar.js.map +1 -1
- package/dist/carousel.d.ts +5 -1
- package/dist/carousel.d.ts.map +1 -1
- package/dist/carousel.js +2 -2
- package/dist/carousel.js.map +1 -1
- package/dist/clipboard.d.ts +2 -2
- package/dist/color-picker.d.ts +33 -3
- package/dist/color-picker.d.ts.map +1 -1
- package/dist/color-picker.js +73 -10
- package/dist/color-picker.js.map +1 -1
- package/dist/communication.d.ts +6 -1
- package/dist/communication.d.ts.map +1 -1
- package/dist/communication.js +2 -2
- package/dist/communication.js.map +1 -1
- package/dist/conversation-row.d.ts +7 -1
- package/dist/conversation-row.d.ts.map +1 -1
- package/dist/conversation-row.js +4 -2
- package/dist/conversation-row.js.map +1 -1
- package/dist/date-range.d.ts +24 -3
- package/dist/date-range.d.ts.map +1 -1
- package/dist/date-range.js +38 -17
- package/dist/date-range.js.map +1 -1
- package/dist/display.d.ts +28 -0
- package/dist/display.d.ts.map +1 -1
- package/dist/display.js +11 -9
- package/dist/display.js.map +1 -1
- package/dist/evidence.d.ts +1 -1
- package/dist/evidence.js +1 -1
- package/dist/evidence.js.map +1 -1
- package/dist/feedback.d.ts +1 -1
- package/dist/floating-action-button.d.ts +1 -1
- package/dist/follow-list.d.ts +58 -0
- package/dist/follow-list.d.ts.map +1 -0
- package/dist/follow-list.js +25 -0
- package/dist/follow-list.js.map +1 -0
- package/dist/forms.d.ts +3 -3
- package/dist/image-viewer.d.ts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js.map +1 -1
- package/dist/internal/calendar-paint.d.ts +12 -0
- package/dist/internal/calendar-paint.d.ts.map +1 -0
- package/dist/internal/calendar-paint.js +3 -0
- package/dist/internal/calendar-paint.js.map +1 -0
- package/dist/internal/identity-action.d.ts +12 -0
- package/dist/internal/identity-action.d.ts.map +1 -0
- package/dist/internal/identity-action.js +10 -0
- package/dist/internal/identity-action.js.map +1 -0
- package/dist/internal.d.ts +1 -1
- package/dist/layout.d.ts +1 -1
- package/dist/overlays.d.ts +4 -0
- package/dist/overlays.d.ts.map +1 -1
- package/dist/overlays.js +3 -3
- package/dist/overlays.js.map +1 -1
- package/dist/provider-button.d.ts +1 -1
- package/dist/public-exports.generated.d.ts +3 -0
- package/dist/public-exports.generated.d.ts.map +1 -1
- package/dist/public-exports.generated.js +9 -0
- package/dist/public-exports.generated.js.map +1 -1
- package/dist/screen-flows.d.ts +33 -4
- package/dist/screen-flows.d.ts.map +1 -1
- package/dist/screen-flows.js +25 -10
- package/dist/screen-flows.js.map +1 -1
- package/dist/screens.d.ts +38 -6
- package/dist/screens.d.ts.map +1 -1
- package/dist/screens.js +26 -12
- package/dist/screens.js.map +1 -1
- package/dist/selection.d.ts +1 -1
- package/dist/social-compositions.d.ts +10 -0
- package/dist/social-compositions.d.ts.map +1 -1
- package/dist/social-compositions.js +3 -2
- package/dist/social-compositions.js.map +1 -1
- package/dist/styles.css +108 -46
- package/dist/styles.layered.css +108 -46
- package/dist/toast.d.ts +1 -1
- package/dist/top-bar.d.ts +1 -1
- package/package.json +8 -3
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bottom-navigation.js","sourceRoot":"","sources":["../src/bottom-navigation.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb,OAAO,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AAC,qBAAqB,CAKxC,CAAC","sourcesContent":["\"use client\";\n\nimport {\n resolveBottomNavigationActivation,\n resolveBottomNavigationConfiguration,\n resolveBottomNavigationDescriptor,\n validateBottomNavigationProminence,\n type BottomNavigationActivation,\n type BottomNavigationConfiguration,\n type BottomNavigationDescriptor,\n type ResolvedBottomNavigationItemDescriptor,\n} from \"@hjmds/design-contracts/components/bottom-navigation\";\nimport {\n bottomNavigationRecipe,\n iconRecipe,\n} from \"@hjmds/design-contracts/recipes\";\nimport {\n createContext,\n forwardRef,\n useContext,\n useEffect,\n useMemo,\n useRef,\n useState,\n type AnchorHTMLAttributes,\n type CSSProperties,\n type ForwardedRef,\n type HTMLAttributes,\n type MouseEvent,\n type ReactElement,\n type ReactNode,\n type RefAttributes,\n} from \"react\";\nimport { assignRef, classNames } from \"./internal.js\";\nimport type { HjmCompositionStyleProp } from \"./composition-style.js\";\nimport { useOptionalHjmTheme } from \"./provider.js\";\n\nconst virtualKeyboardMinimumOcclusion = 120;\n\n/**\n * Height of the viewport bottom covered by the fixed bar (safe area and a raised center circle included); 0 when\n * there is no bar or it is hidden for the keyboard. The provider also exposes it as `--hjm-bottom-navigation-inset`,\n * which ScreenLayout's last region adds to its bottom padding, so products stop hand-keeping a bottom spacer\n * (2026-10-18; Native shares the same API for its `placement=\"overlay\"` bar).\n */\nconst BottomNavigationInsetContext = createContext(0);\nconst BottomNavigationInsetReporterContext = createContext<((height: number) => void) | null>(null);\n\nexport type BottomNavigationInsetProviderProps = Readonly<{ children: ReactNode }>;\n\n/** Wrap the app shell that holds both the screens and the BottomNavigation. */\nexport function BottomNavigationInsetProvider({ children }: BottomNavigationInsetProviderProps) {\n const [inset, setInset] = useState(0);\n const report = useMemo(() => (height: number) => {\n const next = Number.isFinite(height) && height > 0 ? height : 0;\n setInset(current => current === next ? current : next);\n }, []);\n return (\n <BottomNavigationInsetReporterContext.Provider value={report}>\n <BottomNavigationInsetContext.Provider value={inset}>\n {/* `display: contents` adds no box; the custom property still inherits to every screen below. */}\n <div style={{ display: \"contents\", \"--hjm-bottom-navigation-inset\": `${inset}px` } as CSSProperties}>{children}</div>\n </BottomNavigationInsetContext.Provider>\n </BottomNavigationInsetReporterContext.Provider>\n );\n}\n\n/**\n * Bottom height covered by the BottomNavigation inside the nearest provider; 0 outside one. For layouts that are not\n * a ScreenLayout: inside one the shell already pads by it, so adding it again doubles the space.\n */\nexport function useBottomNavigationInset(): number {\n return useContext(BottomNavigationInsetContext);\n}\n\nexport type BottomNavigationIconRenderProps<\n Key extends string = string,\n IconName extends string = string,\n> = Readonly<{\n item: ResolvedBottomNavigationItemDescriptor<Key, IconName>;\n name: IconName;\n selected: boolean;\n color: \"currentColor\";\n size: number;\n strokeWidth: number;\n scale: number;\n}>;\n\nexport type BottomNavigationLinkRenderProps = AnchorHTMLAttributes<HTMLAnchorElement> &\n Readonly<{\n href: string;\n children: ReactNode;\n \"data-state\": \"idle\" | \"selected\";\n }>;\n\nexport type BottomNavigationProps<\n Key extends string = string,\n IconName extends string = string,\n> = Omit<\n HTMLAttributes<HTMLElement>,\n \"aria-label\" | \"aria-labelledby\" | \"children\" | \"dir\" | \"onChange\" | \"role\"\n> &\n Readonly<{\n descriptor: BottomNavigationDescriptor<Key, IconName>;\n configuration?: BottomNavigationConfiguration;\n getHref: (item: ResolvedBottomNavigationItemDescriptor<Key, IconName>) => string;\n renderIcon: (props: BottomNavigationIconRenderProps<Key, IconName>) => ReactNode;\n /** Framework navigation adapter, for example Next.js Link. */\n renderLink?: (props: BottomNavigationLinkRenderProps) => ReactElement;\n primaryAction?: ReactNode;\n onActivate?: (activation: BottomNavigationActivation<Key>) => void;\n /** Canonical layout-only placement on the root element. Controlled visual keys are excluded. */\n layoutStyle?: HjmCompositionStyleProp;\n }>;\n\nexport function isUnmodifiedPrimaryBottomNavigationClick(\n event: Pick<\n MouseEvent<HTMLAnchorElement>,\n \"altKey\" | \"button\" | \"ctrlKey\" | \"defaultPrevented\" | \"metaKey\" | \"shiftKey\"\n >,\n): boolean {\n return (\n !event.defaultPrevented &&\n event.button === 0 &&\n !event.metaKey &&\n !event.ctrlKey &&\n !event.shiftKey &&\n !event.altKey\n );\n}\n\nexport function shouldHideBottomNavigationForKeyboard(input: Readonly<{\n behavior: \"hide\" | \"remain\";\n layoutViewportHeight: number;\n visualViewportHeight: number;\n visualViewportOffsetTop?: number;\n visualViewportScale?: number;\n}>): boolean {\n if (input.behavior !== \"hide\") return false;\n if ((input.visualViewportScale ?? 1) !== 1) return false;\n const visibleBottom =\n input.visualViewportHeight + (input.visualViewportOffsetTop ?? 0);\n return layoutViewportHeightIsValid(input.layoutViewportHeight) &&\n input.layoutViewportHeight - visibleBottom >= virtualKeyboardMinimumOcclusion;\n}\n\nfunction layoutViewportHeightIsValid(value: number): boolean {\n return Number.isFinite(value) && value >= 0;\n}\n\nexport function getBottomNavigationGridColumn(\n index: number,\n itemCount: number,\n distribution: \"equal\" | \"center-gap\",\n): number | undefined {\n if (distribution !== \"center-gap\") return undefined;\n const middle = itemCount / 2;\n return index < middle ? index + 1 : index + 2;\n}\n\nfunction useKeyboardHidden(behavior: \"hide\" | \"remain\"): boolean {\n const [hidden, setHidden] = useState(false);\n useEffect(() => {\n const viewport = window.visualViewport;\n if (!viewport) return;\n const update = () => {\n setHidden(\n shouldHideBottomNavigationForKeyboard({\n behavior,\n layoutViewportHeight: window.innerHeight,\n visualViewportHeight: viewport.height,\n visualViewportOffsetTop: viewport.offsetTop,\n visualViewportScale: viewport.scale,\n }),\n );\n };\n update();\n viewport.addEventListener(\"resize\", update);\n viewport.addEventListener(\"scroll\", update);\n return () => {\n viewport.removeEventListener(\"resize\", update);\n viewport.removeEventListener(\"scroll\", update);\n };\n }, [behavior]);\n return hidden;\n}\n\nfunction BottomNavigationInner<\n Key extends string = string,\n IconName extends string = string,\n>(\n {\n descriptor,\n configuration = {},\n getHref,\n renderIcon,\n renderLink,\n primaryAction,\n onActivate,\n className,\n style,\n layoutStyle,\n ...props\n }: BottomNavigationProps<Key, IconName>,\n ref: ForwardedRef<HTMLElement>,\n) {\n const resolved = resolveBottomNavigationDescriptor(descriptor);\n const theme = useOptionalHjmTheme();\n const direction = configuration.direction ?? theme?.environment.direction;\n const presentation = resolveBottomNavigationConfiguration(\n {\n ...configuration,\n ...(direction === undefined ? {} : { direction }),\n },\n resolved.items.length,\n );\n validateBottomNavigationProminence(resolved.items, presentation);\n const hidden = useKeyboardHidden(presentation.keyboardBehavior);\n const density = bottomNavigationRecipe.density[presentation.density];\n const presentationRecipe =\n bottomNavigationRecipe.presentations[presentation.presentation];\n const centerGap =\n bottomNavigationRecipe.distributions[presentation.distribution].centerGap;\n const iconSize = presentation.iconSize === \"standard\"\n ? iconRecipe.sizes[density.icon]\n : bottomNavigationRecipe.iconSizes[presentation.iconSize];\n // `shape` reframes the floating surface (radius + inner padding); `standard` keeps the presentation recipe.\n const shapeRecipe = presentation.shape === \"standard\"\n ? null\n : bottomNavigationRecipe.shapes[presentation.shape];\n const liftRecipe = bottomNavigationRecipe.icon.liftEmphasis;\n const prominentRecipe = bottomNavigationRecipe.prominentDestination;\n // Lifting by (diameter - indicator height) keeps the prominent label on the other labels' line; an app-icon\n // slot taller than the indicator minimum raises that height.\n const prominentLift = prominentRecipe.diameter - Math.max(bottomNavigationRecipe.indicator.minHeight, iconSize);\n // The part of the circle above the nav box still covers content, so the reported inset includes it.\n const prominentOverflow = resolved.items.some((item) => item.prominent)\n ? Math.max(0, prominentLift - density.padding - presentationRecipe.outerPaddingTop)\n : 0;\n const navRef = useRef<HTMLElement | null>(null);\n const reportInset = useContext(BottomNavigationInsetReporterContext);\n useEffect(() => {\n const nav = navRef.current;\n if (!reportInset) return;\n if (hidden || !nav) {\n reportInset(0);\n return;\n }\n const update = () => reportInset(nav.getBoundingClientRect().height + prominentOverflow);\n update();\n const observer = new ResizeObserver(update);\n observer.observe(nav);\n return () => {\n observer.disconnect();\n reportInset(0);\n };\n }, [reportInset, hidden, prominentOverflow]);\n\n if (hidden) return null;\n\n return (\n <nav\n {...props}\n ref={(node) => {\n navRef.current = node;\n assignRef(ref, node);\n }}\n aria-label={resolved.accessibilityLabel}\n className={classNames(\"hjm-bottom-navigation\", className)}\n data-expanded-labels={(theme?.environment.textScale ?? 1) >= 1.5 || resolved.items.length > 4 ? \"true\" : \"false\"}\n data-density={presentation.density}\n data-distribution={presentation.distribution}\n data-keyboard-behavior={presentation.keyboardBehavior}\n data-labels={presentation.labels}\n data-selection={presentation.selection}\n data-surface={presentation.surface}\n data-presentation={presentation.presentation}\n data-shape={presentation.shape}\n data-icon-emphasis={presentation.iconEmphasis}\n dir={presentation.direction}\n style={{\n \"--hjm-bottom-navigation-center-gap\": `${centerGap}px`,\n \"--hjm-bottom-navigation-columns\": resolved.items.length,\n \"--hjm-bottom-navigation-half-columns\": resolved.items.length / 2,\n \"--hjm-bottom-navigation-item-gap\": `${density.gap}px`,\n \"--hjm-bottom-navigation-item-min-height\": `${density.itemMinHeight}px`,\n \"--hjm-bottom-navigation-item-min-width\": `${density.itemMinWidth}px`,\n \"--hjm-bottom-navigation-item-padding\": `${density.padding}px`,\n \"--hjm-bottom-navigation-max-width\": presentationRecipe.maxWidth\n ? `${presentationRecipe.maxWidth}px`\n : \"none\",\n \"--hjm-bottom-navigation-content-max-width\": presentationRecipe.contentMaxWidth\n ? `${presentationRecipe.contentMaxWidth}px`\n : \"none\",\n \"--hjm-bottom-navigation-outer-inline\": `${presentationRecipe.outerPaddingHorizontal}px`,\n \"--hjm-bottom-navigation-outer-top\": `${presentationRecipe.outerPaddingTop}px`,\n \"--hjm-bottom-navigation-prominent-diameter\": `${prominentRecipe.diameter}px`,\n \"--hjm-bottom-navigation-prominent-lift\": `${prominentLift}px`,\n ...(shapeRecipe ? {\n \"--hjm-bottom-navigation-shape-radius\": `var(--hjm-radius-${shapeRecipe.radius})`,\n \"--hjm-bottom-navigation-shape-padding\": `${shapeRecipe.surfacePadding}px`,\n } : {}),\n ...(presentation.iconEmphasis === \"lift\" ? {\n \"--hjm-bottom-navigation-lift-offset\": `${liftRecipe.translateY}px`,\n \"--hjm-bottom-navigation-lift-idle-opacity\": liftRecipe.idleOpacity,\n } : {}),\n ...style,\n ...layoutStyle,\n } as CSSProperties}\n >\n <div className=\"hjm-bottom-navigation__surface\">\n <ul className=\"hjm-bottom-navigation__list\">\n {resolved.items.map((item, index) => {\n const selected = item.id === resolved.selectedKey;\n const content = (\n <>\n <span\n aria-hidden=\"true\"\n className=\"hjm-bottom-navigation__indicator\"\n data-state={selected ? \"selected\" : \"idle\"}\n >\n {renderIcon({\n item,\n name: item.icon.name,\n selected,\n color: \"currentColor\",\n size: item.prominent ? iconRecipe.sizes[prominentRecipe.icon] : iconSize,\n strokeWidth: selected\n ? bottomNavigationRecipe.icon.selectedEmphasis.strokeWidth.selected\n : bottomNavigationRecipe.icon.selectedEmphasis.strokeWidth.idle,\n scale: selected\n ? bottomNavigationRecipe.icon.selectedEmphasis.scale.selected\n : bottomNavigationRecipe.icon.selectedEmphasis.scale.idle,\n })}\n {item.badge ? (\n <span aria-hidden=\"true\" className=\"hjm-bottom-navigation__badge\">\n {item.badge.visibleLabel}\n </span>\n ) : null}\n </span>\n {/* Hidden labels are not rendered: the item link already carries\n resolvedAccessibilityLabel, so a visually-hidden copy would only duplicate it. */}\n {presentation.labels === \"visible\" ? (\n <span className=\"hjm-bottom-navigation__label\">{item.label}</span>\n ) : null}\n </>\n );\n const itemStyle = {\n gridColumn: getBottomNavigationGridColumn(\n index,\n resolved.items.length,\n presentation.distribution,\n ),\n };\n if (item.disabled) {\n return (\n <li key={item.id} style={itemStyle} data-selected=\"false\" data-prominent={item.prominent || undefined}>\n <span\n aria-disabled=\"true\"\n aria-label={item.resolvedAccessibilityLabel}\n className=\"hjm-bottom-navigation__item\"\n data-state=\"disabled\"\n role=\"link\"\n >\n {content}\n </span>\n </li>\n );\n }\n const href = getHref(item);\n if (!href.trim()) {\n throw new TypeError(`BottomNavigation href must not be empty: ${item.id}`);\n }\n const linkProps: BottomNavigationLinkRenderProps = {\n \"aria-current\": selected ? \"page\" : undefined,\n \"aria-label\": item.resolvedAccessibilityLabel,\n className: \"hjm-bottom-navigation__item\",\n \"data-state\": selected ? \"selected\" : \"idle\",\n href,\n onClick: (event) => {\n if (!isUnmodifiedPrimaryBottomNavigationClick(event)) return;\n const activation = resolveBottomNavigationActivation(descriptor, item.id);\n if (activation) onActivate?.(activation);\n },\n children: content,\n };\n return (\n <li key={item.id} style={itemStyle} data-selected={selected} data-prominent={item.prominent || undefined}>\n {renderLink ? renderLink(linkProps) : <a {...linkProps} />}\n </li>\n );\n })}\n </ul>\n {primaryAction ? (\n <div className=\"hjm-bottom-navigation__primary-action\">{primaryAction}</div>\n ) : null}\n </div>\n </nav>\n );\n}\n\nexport const BottomNavigation = forwardRef(BottomNavigationInner) as <\n Key extends string = string,\n IconName extends string = string,\n>(\n props: BottomNavigationProps<Key, IconName> & RefAttributes<HTMLElement>,\n) => ReactElement | null;\n"]}
|
|
1
|
+
{"version":3,"file":"bottom-navigation.js","sourceRoot":"","sources":["../src/bottom-navigation.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb,OAAO,EACL,iCAAiC,EACjC,oCAAoC,EACpC,iCAAiC,EACjC,kCAAkC,GAKnC,MAAM,sDAAsD,CAAC;AAC9D,OAAO,EACL,sBAAsB,EACtB,UAAU,GACX,MAAM,iCAAiC,CAAC;AACzC,OAAO,EACL,aAAa,EACb,UAAU,EACV,UAAU,EACV,SAAS,EACT,OAAO,EACP,MAAM,EACN,QAAQ,GAST,MAAM,OAAO,CAAC;AACf,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAEtD,OAAO,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAC;AAEpD,MAAM,+BAA+B,GAAG,GAAG,CAAC;AAE5C;;;;;GAKG;AACH,MAAM,4BAA4B,GAAG,aAAa,CAAC,CAAC,CAAC,CAAC;AACtD,MAAM,oCAAoC,GAAG,aAAa,CAAoC,IAAI,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AE,CAAC,KAAK,EAAE,EAAE;gCACjB,IAAI,CAAC,wCAAwC,CAAC,KAAK,CAAC;oCAAE,OAAO;gCAC7D,MAAM,UAAU,GAAG,iCAAiC,CAAC,UAAU,EAAE,IAAI,CAAC,EAAE,CAAC,CAAC;gCAC1E,IAAI,UAAU;oCAAE,UAAU,EAAE,CAAC,UAAU,CAAC,CAAC;4BAC3C,CAAC;4BACD,QAAQ,EAAE,OAAO;yBAClB,CAAC;wBACF,OAAO,CACL,aAAkB,KAAK,EAAE,SAAS,mBAAiB,QAAQ,oBAAkB,IAAI,CAAC,SAAS,IAAI,SAAS,YACrG,UAAU,CAAC,CAAC,CAAC,UAAU,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,eAAO,SAAS,GAAI,IADnD,IAAI,CAAC,EAAE,CAEX,CACN,CAAC;oBACJ,CAAC,CAAC,GACC,EACJ,aAAa,CAAC,CAAC,CAAC,CACf,cAAK,SAAS,EAAC,uCAAuC,YAAE,aAAa,GAAO,CAC7E,CAAC,CAAC,CAAC,IAAI,IACJ,GACF,CACP,CAAC;AACJ,CAAC;AAED,MAAM,CAAC,MAAM,gBAAgB,GAAG,UAAU,CAAC,qBAAqB,CAKxC,CAAC","sourcesContent":["\"use client\";\n\nimport {\n resolveBottomNavigationActivation,\n resolveBottomNavigationConfiguration,\n resolveBottomNavigationDescriptor,\n validateBottomNavigationProminence,\n type BottomNavigationActivation,\n type BottomNavigationConfiguration,\n type BottomNavigationDescriptor,\n type ResolvedBottomNavigationItemDescriptor,\n} from \"@hjmds/design-contracts/components/bottom-navigation\";\nimport {\n bottomNavigationRecipe,\n iconRecipe,\n} from \"@hjmds/design-contracts/recipes\";\nimport {\n createContext,\n forwardRef,\n useContext,\n useEffect,\n useMemo,\n useRef,\n useState,\n type AnchorHTMLAttributes,\n type CSSProperties,\n type ForwardedRef,\n type HTMLAttributes,\n type MouseEvent,\n type ReactElement,\n type ReactNode,\n type RefAttributes,\n} from \"react\";\nimport { assignRef, classNames } from \"./internal.js\";\nimport type { HjmCompositionStyleProp } from \"./composition-style.js\";\nimport { useOptionalHjmTheme } from \"./provider.js\";\n\nconst virtualKeyboardMinimumOcclusion = 120;\n\n/**\n * Height of the viewport bottom covered by the fixed bar (safe area and a raised center circle included); 0 when\n * there is no bar or it is hidden for the keyboard. The provider also exposes it as `--hjm-bottom-navigation-inset`,\n * which ScreenLayout's last region adds to its bottom padding, so products stop hand-keeping a bottom spacer\n * (2026-10-18; Native shares the same API for its `placement=\"overlay\"` bar).\n */\nconst BottomNavigationInsetContext = createContext(0);\nconst BottomNavigationInsetReporterContext = createContext<((height: number) => void) | null>(null);\n\nexport type BottomNavigationInsetProviderProps = Readonly<{ children: ReactNode }>;\n\n/** Wrap the app shell that holds both the screens and the BottomNavigation. */\nexport function BottomNavigationInsetProvider({ children }: BottomNavigationInsetProviderProps) {\n const [inset, setInset] = useState(0);\n const report = useMemo(() => (height: number) => {\n const next = Number.isFinite(height) && height > 0 ? height : 0;\n setInset(current => current === next ? current : next);\n }, []);\n return (\n <BottomNavigationInsetReporterContext.Provider value={report}>\n <BottomNavigationInsetContext.Provider value={inset}>\n {/* `display: contents` adds no box; the custom property still inherits to every screen below. */}\n <div style={{ display: \"contents\", \"--hjm-bottom-navigation-inset\": `${inset}px` } as CSSProperties}>{children}</div>\n </BottomNavigationInsetContext.Provider>\n </BottomNavigationInsetReporterContext.Provider>\n );\n}\n\n/**\n * Bottom height covered by the BottomNavigation inside the nearest provider; 0 outside one. For layouts that are not\n * a ScreenLayout: inside one the shell already pads by it, so adding it again doubles the space.\n */\nexport function useBottomNavigationInset(): number {\n return useContext(BottomNavigationInsetContext);\n}\n\nexport type BottomNavigationIconRenderProps<\n Key extends string = string,\n IconName extends string = string,\n> = Readonly<{\n item: ResolvedBottomNavigationItemDescriptor<Key, IconName>;\n name: IconName;\n selected: boolean;\n color: \"currentColor\";\n size: number;\n strokeWidth: number;\n scale: number;\n}>;\n\nexport type BottomNavigationLinkRenderProps = AnchorHTMLAttributes<HTMLAnchorElement> &\n Readonly<{\n href: string;\n children: ReactNode;\n \"data-state\": \"idle\" | \"selected\";\n }>;\n\nexport type BottomNavigationProps<\n Key extends string = string,\n IconName extends string = string,\n> = Omit<\n HTMLAttributes<HTMLElement>,\n \"aria-label\" | \"aria-labelledby\" | \"children\" | \"dir\" | \"onChange\" | \"role\"\n> &\n Readonly<{\n descriptor: BottomNavigationDescriptor<Key, IconName>;\n configuration?: BottomNavigationConfiguration;\n getHref: (item: ResolvedBottomNavigationItemDescriptor<Key, IconName>) => string;\n renderIcon: (props: BottomNavigationIconRenderProps<Key, IconName>) => ReactNode;\n /** Framework navigation adapter, for example Next.js Link. */\n renderLink?: (props: BottomNavigationLinkRenderProps) => ReactElement;\n primaryAction?: ReactNode;\n onActivate?: (activation: BottomNavigationActivation<Key>) => void;\n /** Canonical layout-only placement on the root element. Controlled visual keys are excluded. */\n layoutStyle?: HjmCompositionStyleProp;\n }>;\n\nexport function isUnmodifiedPrimaryBottomNavigationClick(\n event: Pick<\n MouseEvent<HTMLAnchorElement>,\n \"altKey\" | \"button\" | \"ctrlKey\" | \"defaultPrevented\" | \"metaKey\" | \"shiftKey\"\n >,\n): boolean {\n return (\n !event.defaultPrevented &&\n event.button === 0 &&\n !event.metaKey &&\n !event.ctrlKey &&\n !event.shiftKey &&\n !event.altKey\n );\n}\n\nexport function shouldHideBottomNavigationForKeyboard(input: Readonly<{\n behavior: \"hide\" | \"remain\";\n layoutViewportHeight: number;\n visualViewportHeight: number;\n visualViewportOffsetTop?: number;\n visualViewportScale?: number;\n}>): boolean {\n if (input.behavior !== \"hide\") return false;\n if ((input.visualViewportScale ?? 1) !== 1) return false;\n const visibleBottom =\n input.visualViewportHeight + (input.visualViewportOffsetTop ?? 0);\n return layoutViewportHeightIsValid(input.layoutViewportHeight) &&\n input.layoutViewportHeight - visibleBottom >= virtualKeyboardMinimumOcclusion;\n}\n\nfunction layoutViewportHeightIsValid(value: number): boolean {\n return Number.isFinite(value) && value >= 0;\n}\n\nexport function getBottomNavigationGridColumn(\n index: number,\n itemCount: number,\n distribution: \"equal\" | \"center-gap\",\n): number | undefined {\n if (distribution !== \"center-gap\") return undefined;\n const middle = itemCount / 2;\n return index < middle ? index + 1 : index + 2;\n}\n\nfunction useKeyboardHidden(behavior: \"hide\" | \"remain\"): boolean {\n const [hidden, setHidden] = useState(false);\n useEffect(() => {\n const viewport = window.visualViewport;\n if (!viewport) return;\n const update = () => {\n setHidden(\n shouldHideBottomNavigationForKeyboard({\n behavior,\n layoutViewportHeight: window.innerHeight,\n visualViewportHeight: viewport.height,\n visualViewportOffsetTop: viewport.offsetTop,\n visualViewportScale: viewport.scale,\n }),\n );\n };\n update();\n viewport.addEventListener(\"resize\", update);\n viewport.addEventListener(\"scroll\", update);\n return () => {\n viewport.removeEventListener(\"resize\", update);\n viewport.removeEventListener(\"scroll\", update);\n };\n }, [behavior]);\n return hidden;\n}\n\nfunction BottomNavigationInner<\n Key extends string = string,\n IconName extends string = string,\n>(\n {\n descriptor,\n configuration = {},\n getHref,\n renderIcon,\n renderLink,\n primaryAction,\n onActivate,\n className,\n style,\n layoutStyle,\n ...props\n }: BottomNavigationProps<Key, IconName>,\n ref: ForwardedRef<HTMLElement>,\n) {\n const resolved = resolveBottomNavigationDescriptor(descriptor);\n const theme = useOptionalHjmTheme();\n const direction = configuration.direction ?? theme?.environment.direction;\n const presentation = resolveBottomNavigationConfiguration(\n {\n ...configuration,\n ...(direction === undefined ? {} : { direction }),\n },\n resolved.items.length,\n );\n validateBottomNavigationProminence(resolved.items, presentation);\n const hidden = useKeyboardHidden(presentation.keyboardBehavior);\n const density = bottomNavigationRecipe.density[presentation.density];\n const presentationRecipe =\n bottomNavigationRecipe.presentations[presentation.presentation];\n const centerGap =\n bottomNavigationRecipe.distributions[presentation.distribution].centerGap;\n const iconSize = presentation.iconSize === \"standard\"\n ? iconRecipe.sizes[density.icon]\n : bottomNavigationRecipe.iconSizes[presentation.iconSize];\n // `shape` reframes the floating surface (radius + inner padding); `standard` keeps the presentation recipe.\n const shapeRecipe = presentation.shape === \"standard\"\n ? null\n : bottomNavigationRecipe.shapes[presentation.shape];\n const liftRecipe = bottomNavigationRecipe.icon.liftEmphasis;\n const prominentRecipe = bottomNavigationRecipe.prominentDestination;\n // Lifting by (diameter - indicator height) keeps the prominent label on the other labels' line; an app-icon\n // slot taller than the indicator minimum raises that height.\n const prominentLift = prominentRecipe.diameter - Math.max(bottomNavigationRecipe.indicator.minHeight, iconSize);\n // The part of the circle above the nav box still covers content, so the reported inset includes it.\n const prominentOverflow = resolved.items.some((item) => item.prominent)\n ? Math.max(0, prominentLift - density.padding - presentationRecipe.outerPaddingTop)\n : 0;\n const navRef = useRef<HTMLElement | null>(null);\n const reportInset = useContext(BottomNavigationInsetReporterContext);\n useEffect(() => {\n const nav = navRef.current;\n if (!reportInset) return;\n if (hidden || !nav) {\n reportInset(0);\n return;\n }\n const update = () => reportInset(nav.getBoundingClientRect().height + prominentOverflow);\n update();\n const observer = new ResizeObserver(update);\n observer.observe(nav);\n return () => {\n observer.disconnect();\n reportInset(0);\n };\n }, [reportInset, hidden, prominentOverflow]);\n\n if (hidden) return null;\n\n return (\n <nav\n {...props}\n ref={(node) => {\n navRef.current = node;\n assignRef(ref, node);\n }}\n aria-label={resolved.accessibilityLabel}\n className={classNames(\"hjm-bottom-navigation\", className)}\n data-expanded-labels={(theme?.environment.textScale ?? 1) >= 1.5 || resolved.items.length > 4 ? \"true\" : \"false\"}\n data-density={presentation.density}\n data-distribution={presentation.distribution}\n data-keyboard-behavior={presentation.keyboardBehavior}\n data-labels={presentation.labels}\n data-selection={presentation.selection}\n data-surface={presentation.surface}\n data-tone={presentation.tone}\n data-presentation={presentation.presentation}\n data-shape={presentation.shape}\n data-icon-emphasis={presentation.iconEmphasis}\n dir={presentation.direction}\n style={{\n \"--hjm-bottom-navigation-center-gap\": `${centerGap}px`,\n \"--hjm-bottom-navigation-columns\": resolved.items.length,\n \"--hjm-bottom-navigation-half-columns\": resolved.items.length / 2,\n \"--hjm-bottom-navigation-item-gap\": `${density.gap}px`,\n \"--hjm-bottom-navigation-item-min-height\": `${density.itemMinHeight}px`,\n \"--hjm-bottom-navigation-item-min-width\": `${density.itemMinWidth}px`,\n \"--hjm-bottom-navigation-item-padding\": `${density.padding}px`,\n \"--hjm-bottom-navigation-max-width\": presentationRecipe.maxWidth\n ? `${presentationRecipe.maxWidth}px`\n : \"none\",\n \"--hjm-bottom-navigation-content-max-width\": presentationRecipe.contentMaxWidth\n ? `${presentationRecipe.contentMaxWidth}px`\n : \"none\",\n \"--hjm-bottom-navigation-outer-inline\": `${presentationRecipe.outerPaddingHorizontal}px`,\n \"--hjm-bottom-navigation-outer-top\": `${presentationRecipe.outerPaddingTop}px`,\n \"--hjm-bottom-navigation-prominent-diameter\": `${prominentRecipe.diameter}px`,\n \"--hjm-bottom-navigation-prominent-lift\": `${prominentLift}px`,\n ...(shapeRecipe ? {\n \"--hjm-bottom-navigation-shape-radius\": `var(--hjm-radius-${shapeRecipe.radius})`,\n \"--hjm-bottom-navigation-shape-padding\": `${shapeRecipe.surfacePadding}px`,\n } : {}),\n ...(presentation.iconEmphasis === \"lift\" ? {\n \"--hjm-bottom-navigation-lift-offset\": `${liftRecipe.translateY}px`,\n \"--hjm-bottom-navigation-lift-idle-opacity\": liftRecipe.idleOpacity,\n } : {}),\n ...style,\n ...layoutStyle,\n } as CSSProperties}\n >\n <div className=\"hjm-bottom-navigation__surface\">\n <ul className=\"hjm-bottom-navigation__list\">\n {resolved.items.map((item, index) => {\n const selected = item.id === resolved.selectedKey;\n const content = (\n <>\n <span\n aria-hidden=\"true\"\n className=\"hjm-bottom-navigation__indicator\"\n data-state={selected ? \"selected\" : \"idle\"}\n >\n {renderIcon({\n item,\n name: item.icon.name,\n selected,\n color: \"currentColor\",\n size: item.prominent ? iconRecipe.sizes[prominentRecipe.icon] : iconSize,\n strokeWidth: selected\n ? bottomNavigationRecipe.icon.selectedEmphasis.strokeWidth.selected\n : bottomNavigationRecipe.icon.selectedEmphasis.strokeWidth.idle,\n scale: selected\n ? bottomNavigationRecipe.icon.selectedEmphasis.scale.selected\n : bottomNavigationRecipe.icon.selectedEmphasis.scale.idle,\n })}\n {item.badge ? (\n <span aria-hidden=\"true\" className=\"hjm-bottom-navigation__badge\">\n {item.badge.visibleLabel}\n </span>\n ) : null}\n </span>\n {/* Hidden labels are not rendered: the item link already carries\n resolvedAccessibilityLabel, so a visually-hidden copy would only duplicate it. */}\n {presentation.labels === \"visible\" ? (\n <span className=\"hjm-bottom-navigation__label\">{item.label}</span>\n ) : null}\n </>\n );\n const itemStyle = {\n gridColumn: getBottomNavigationGridColumn(\n index,\n resolved.items.length,\n presentation.distribution,\n ),\n };\n if (item.disabled) {\n return (\n <li key={item.id} style={itemStyle} data-selected=\"false\" data-prominent={item.prominent || undefined}>\n <span\n aria-disabled=\"true\"\n aria-label={item.resolvedAccessibilityLabel}\n className=\"hjm-bottom-navigation__item\"\n data-state=\"disabled\"\n role=\"link\"\n >\n {content}\n </span>\n </li>\n );\n }\n const href = getHref(item);\n if (!href.trim()) {\n throw new TypeError(`BottomNavigation href must not be empty: ${item.id}`);\n }\n const linkProps: BottomNavigationLinkRenderProps = {\n \"aria-current\": selected ? \"page\" : undefined,\n \"aria-label\": item.resolvedAccessibilityLabel,\n className: \"hjm-bottom-navigation__item\",\n \"data-state\": selected ? \"selected\" : \"idle\",\n href,\n onClick: (event) => {\n if (!isUnmodifiedPrimaryBottomNavigationClick(event)) return;\n const activation = resolveBottomNavigationActivation(descriptor, item.id);\n if (activation) onActivate?.(activation);\n },\n children: content,\n };\n return (\n <li key={item.id} style={itemStyle} data-selected={selected} data-prominent={item.prominent || undefined}>\n {renderLink ? renderLink(linkProps) : <a {...linkProps} />}\n </li>\n );\n })}\n </ul>\n {primaryAction ? (\n <div className=\"hjm-bottom-navigation__primary-action\">{primaryAction}</div>\n ) : null}\n </div>\n </nav>\n );\n}\n\nexport const BottomNavigation = forwardRef(BottomNavigationInner) as <\n Key extends string = string,\n IconName extends string = string,\n>(\n props: BottomNavigationProps<Key, IconName> & RefAttributes<HTMLElement>,\n) => ReactElement | null;\n"]}
|
package/dist/calendar.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"calendar.d.ts","sourceRoot":"","sources":["../src/calendar.tsx"],"names":[],"mappings":"AAEA,OAAO,
|
|
1
|
+
{"version":3,"file":"calendar.d.ts","sourceRoot":"","sources":["../src/calendar.tsx"],"names":[],"mappings":"AAEA,OAAO,EAA2F,KAAK,SAAS,EAAE,KAAK,GAAG,EAAE,MAAM,OAAO,CAAC;AAC1I,OAAO,EAGL,KAAK,kBAAkB,EAAE,KAAK,YAAY,EAAE,KAAK,wBAAwB,EACzE,KAAK,6BAA6B,EAAE,KAAK,wBAAwB,EAClE,MAAM,6CAA6C,CAAC;AAKrD,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,wBAAwB,CAAC;AAEtE,MAAM,MAAM,mBAAmB,GAAG,QAAQ,CAAC;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,CAAC,CAAC;AAC7E,MAAM,MAAM,cAAc,GAAG,QAAQ,CAAC;IAAE,SAAS,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAAA;CAAE,CAAC,CAAC;AACzE,MAAM,MAAM,gBAAgB,GAAG,QAAQ,CAAC;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,wBAAwB,CAAC;IAAC,QAAQ,EAAE,QAAQ,GAAG,OAAO,CAAA;CAAE,CAAC,CAAC;AAC1H,MAAM,MAAM,aAAa,CAAC,OAAO,GAAG,OAAO,IAAI,QAAQ,CAAC;IACtD,UAAU,EAAE,kBAAkB,CAAC,OAAO,CAAC,CAAC;IACxC,qBAAqB,EAAE,6BAA6B,CAAC,OAAO,CAAC,CAAC;IAC9D,aAAa,CAAC,EAAE,mBAAmB,CAAC;IACpC,SAAS,CAAC,EAAE,mBAAmB,CAAC;IAChC,iGAAiG;IACjG,oBAAoB,CAAC,EAAE,CAAC,MAAM,EAAE,gBAAgB,EAAE,SAAS,EAAE,cAAc,CAAC,WAAW,CAAC,KAAK,IAAI,CAAC;IAClG,iBAAiB,CAAC,EAAE,CAAC,IAAI,EAAE,wBAAwB,CAAC,OAAO,CAAC,KAAK,SAAS,CAAC;IAC3E,IAAI,CAAC,EAAE,YAAY,CAAC;IACpB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,GAAG,CAAC,EAAE,GAAG,CAAC,cAAc,CAAC,CAAC;IAC1B,gGAAgG;IAChG,WAAW,CAAC,EAAE,uBAAuB,CAAC;CACvC,CAAC,CAAC;AAEH,wFAAwF;AACxF,wBAAgB,QAAQ,CAAC,OAAO,EAAE,EAAE,UAAU,EAAE,qBAAqB,EAAE,aAAa,EAAE,SAAS,EAC7F,oBAAoB,EAAE,iBAAiB,EAAE,IAAe,EAAE,SAAiB,EAAE,SAAS,EAAE,WAAW,EAAE,GAAG,EAAE,EAAE,aAAa,CAAC,OAAO,CAAC,+BA4FnI"}
|
package/dist/calendar.js
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
-
import { useEffect, useId, useImperativeHandle, useRef, useState } from "react";
|
|
3
|
+
import { useContext, useEffect, useId, useImperativeHandle, useRef, useState } from "react";
|
|
4
4
|
import { calendarRecipe as recipe, assertIsoCalendarMonth, validateCalendarDescriptor, resolveCalendarGridDescriptor, getCalendarNavigationIntent, getCalendarNavigationTarget, } from "@hjmds/design-contracts/components/calendar";
|
|
5
5
|
import { classNames, useControllableState } from "./internal.js";
|
|
6
|
+
import { CalendarPaintContext } from "./internal/calendar-paint.js";
|
|
7
|
+
import { Icon } from "./supplemental-display.js";
|
|
6
8
|
import { useOptionalHjmTheme } from "./provider.js";
|
|
7
9
|
/** Inline single-date grid shared with DatePicker; month data remains product-owned. */
|
|
8
10
|
export function Calendar({ descriptor, composeAccessibleName, previousMonth, nextMonth, onNavigateBeyondGrid, renderCellContent, size = "medium", autoFocus = false, className, layoutStyle, ref }) {
|
|
@@ -15,6 +17,7 @@ export function Calendar({ descriptor, composeAccessibleName, previousMonth, nex
|
|
|
15
17
|
throw new TypeError("Calendar month action label must not be empty");
|
|
16
18
|
}
|
|
17
19
|
const theme = useOptionalHjmTheme();
|
|
20
|
+
const rangePaint = useContext(CalendarPaintContext);
|
|
18
21
|
const [selected, setSelected] = useControllableState({
|
|
19
22
|
...(descriptor.selectedDate === undefined ? {} : { value: descriptor.selectedDate }),
|
|
20
23
|
defaultValue: descriptor.defaultSelectedDate ?? null,
|
|
@@ -51,29 +54,33 @@ export function Calendar({ descriptor, composeAccessibleName, previousMonth, nex
|
|
|
51
54
|
return _jsxs("div", { ref: root, className: classNames("hjm-calendar", className), "data-size": size, style: { "--hjm-calendar-max-width": `${recipe.maxWidth}px`, ...layoutStyle, "--hjm-calendar-cell-size": `${recipe.sizes[size].cellDiameter}px`,
|
|
52
55
|
"--hjm-calendar-indicator-size": `${recipe.sizes[size].indicatorDiameter}px`,
|
|
53
56
|
"--hjm-calendar-disabled-opacity": recipe.day.disabledOpacity,
|
|
54
|
-
"--hjm-calendar-outside-opacity": recipe.day.outsideFocusedMonthOpacity }, children: [_jsxs("div", { className: "hjm-calendar__header", children: [previousMonth ? _jsx("button", { type: "button", "aria-label": previousMonth.label, disabled: !descriptor.onFocusedMonthChange, onClick: () => descriptor.onFocusedMonthChange?.(previousMonth.month, "previous"), children: _jsx(
|
|
57
|
+
"--hjm-calendar-outside-opacity": recipe.day.outsideFocusedMonthOpacity }, children: [_jsxs("div", { className: "hjm-calendar__header", children: [previousMonth ? _jsx("button", { type: "button", "aria-label": previousMonth.label, disabled: !descriptor.onFocusedMonthChange, onClick: () => descriptor.onFocusedMonthChange?.(previousMonth.month, "previous"), children: _jsx(Icon, { name: recipe.header.navIcon.previous, size: recipe.sizes[size].glyph, tone: "secondary", decorative: true }) }) : _jsx("span", {}), _jsx("strong", { id: titleId, "aria-live": "polite", "aria-atomic": "true", children: descriptor.monthLabel }), nextMonth ? _jsx("button", { type: "button", "aria-label": nextMonth.label, disabled: !descriptor.onFocusedMonthChange, onClick: () => descriptor.onFocusedMonthChange?.(nextMonth.month, "next"), children: _jsx(Icon, { name: recipe.header.navIcon.next, size: recipe.sizes[size].glyph, tone: "secondary", decorative: true }) }) : _jsx("span", {})] }), _jsx("div", { className: "hjm-calendar__viewport", children: _jsxs("div", { role: "grid", "aria-labelledby": titleId, className: "hjm-calendar__grid", children: [_jsx("div", { role: "row", className: "hjm-calendar__week", children: descriptor.grid.weekdayLabels.map((label, index) => _jsx("span", { role: "columnheader", className: "hjm-calendar__weekday", children: label }, index)) }), Array.from({ length: cells.length / 7 }, (_, row) => _jsx("div", { role: "row", className: "hjm-calendar__week", children: cells.slice(row * 7, row * 7 + 7).map((cell, column) => "filler" in cell
|
|
55
58
|
? _jsx("span", { role: "gridcell", "aria-hidden": "true" }, `filler-${column}`)
|
|
56
|
-
:
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
59
|
+
: (() => {
|
|
60
|
+
const range = rangePaint?.paint(cell.date);
|
|
61
|
+
const filled = range ? range.edge : cell.isSelected;
|
|
62
|
+
return _jsxs("button", { type: "button", role: "gridcell", className: "hjm-calendar__day", "data-date": cell.date, "data-focus-date": cell.date === active || undefined, "data-today": cell.isToday || undefined, "data-selected": filled || undefined, "data-range-band": range && range.band !== "none" ? range.band : undefined, "data-disabled": !cell.selectable || undefined, "data-outside": cell.outsideFocusedMonth || undefined, "aria-label": cell.accessibleName, "aria-selected": filled, "aria-disabled": !cell.selectable || undefined, "aria-current": cell.isToday ? "date" : undefined, tabIndex: cell.date === active ? 0 : -1, onMouseEnter: rangePaint ? () => rangePaint.onDayHover(cell.date) : undefined, onFocus: () => setFocused(cell.date), onClick: () => {
|
|
63
|
+
if (!cell.selectable)
|
|
64
|
+
return;
|
|
65
|
+
// Range completion and DatePicker confirmation still need activation
|
|
66
|
+
// when the date already equals Calendar's single selected value.
|
|
67
|
+
if (cell.date === selected)
|
|
68
|
+
descriptor.onSelectionChange?.(cell.date);
|
|
69
|
+
else
|
|
70
|
+
setSelected(cell.date);
|
|
71
|
+
}, onKeyDown: (event) => {
|
|
72
|
+
if (event.altKey || event.ctrlKey || event.metaKey)
|
|
73
|
+
return;
|
|
74
|
+
const intent = getCalendarNavigationIntent(event.key, theme?.environment.direction ?? "ltr");
|
|
75
|
+
if (!intent)
|
|
76
|
+
return;
|
|
77
|
+
event.preventDefault();
|
|
78
|
+
const target = getCalendarNavigationTarget(descriptor.grid, cell.date, intent);
|
|
79
|
+
if (target.date)
|
|
80
|
+
focusDate(target.date);
|
|
81
|
+
else if (target.overflow)
|
|
82
|
+
onNavigateBeyondGrid?.({ date: cell.date, intent, overflow: target.overflow }, focusDate);
|
|
83
|
+
}, children: [range && range.band !== "none" ? _jsx("span", { "aria-hidden": "true", className: "hjm-calendar__band" }) : null, _jsx("span", { "aria-hidden": "true", className: "hjm-calendar__day-label", children: Number(cell.date.slice(-2)) }), renderCellContent ? _jsx("span", { "aria-hidden": "true", className: "hjm-calendar__content", children: renderCellContent(cell) }) : null] }, cell.date);
|
|
84
|
+
})()) }, row))] }) })] });
|
|
78
85
|
}
|
|
79
86
|
//# sourceMappingURL=calendar.js.map
|
package/dist/calendar.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"calendar.js","sourceRoot":"","sources":["../src/calendar.tsx"],"names":[],"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EAAE,MAAM,CAAC,QAAQ,EAAE,EAAE,SAAS,CAAC,CAAC;oCACtH,CAAC,aACD,8BAAkB,MAAM,EAAC,SAAS,EAAC,yBAAyB,YAAE,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,GAAQ,EAChG,iBAAiB,CAAC,CAAC,CAAC,8BAAkB,MAAM,EAAC,SAAS,EAAC,uBAAuB,YAAE,iBAAiB,CAAC,IAAI,CAAC,GAAQ,CAAC,CAAC,CAAC,IAAI,KAvB5E,IAAI,CAAC,IAAI,CAwB7C,CAAC,IA3B4F,GAAG,CA4BvG,CAAC,IACH,GACF,IACF,CAAC;AACT,CAAC","sourcesContent":["\"use client\";\n\nimport { useEffect, useId, useImperativeHandle, useRef, useState, type CSSProperties, type ReactNode, type Ref } from \"react\";\nimport {\n calendarRecipe as recipe, assertIsoCalendarMonth, validateCalendarDescriptor, resolveCalendarGridDescriptor,\n getCalendarNavigationIntent, getCalendarNavigationTarget,\n type CalendarDescriptor, type CalendarSize, type CalendarNavigationIntent,\n type ComposeCalendarAccessibleName, type ResolvedCalendarDateCell,\n} from \"@hjmds/design-contracts/components/calendar\";\nimport { classNames, useControllableState } from \"./internal.js\";\nimport { useOptionalHjmTheme } from \"./provider.js\";\nimport type { HjmCompositionStyleProp } from \"./composition-style.js\";\n\nexport type CalendarMonthAction = Readonly<{ month: string; label: string }>;\nexport type CalendarHandle = Readonly<{ focusDate(date: string): void }>;\nexport type CalendarOverflow = Readonly<{ date: string; intent: CalendarNavigationIntent; overflow: \"before\" | \"after\" }>;\nexport type CalendarProps<Content = unknown> = Readonly<{\n descriptor: CalendarDescriptor<Content>;\n composeAccessibleName: ComposeCalendarAccessibleName<Content>;\n previousMonth?: CalendarMonthAction;\n nextMonth?: CalendarMonthAction;\n /** The product owns adjacent month/date arithmetic. Call focusDate after requesting its page. */\n onNavigateBeyondGrid?: (detail: CalendarOverflow, focusDate: CalendarHandle[\"focusDate\"]) => void;\n renderCellContent?: (cell: ResolvedCalendarDateCell<Content>) => ReactNode;\n size?: CalendarSize;\n autoFocus?: boolean;\n className?: string;\n ref?: Ref<CalendarHandle>;\n /** Canonical layout-only placement on the root element. Controlled visual keys are excluded. */\n layoutStyle?: HjmCompositionStyleProp;\n}>;\n\n/** Inline single-date grid shared with DatePicker; month data remains product-owned. */\nexport function Calendar<Content>({ descriptor, composeAccessibleName, previousMonth, nextMonth,\n onNavigateBeyondGrid, renderCellContent, size = \"medium\", autoFocus = false, className, layoutStyle, ref }: CalendarProps<Content>) {\n validateCalendarDescriptor(descriptor);\n for (const action of [previousMonth, nextMonth]) {\n if (!action) continue;\n assertIsoCalendarMonth(action.month, \"month action\");\n if (!action.label.trim()) throw new TypeError(\"Calendar month action label must not be empty\");\n }\n const theme = useOptionalHjmTheme();\n const [selected, setSelected] = useControllableState<string | null>({\n ...(descriptor.selectedDate === undefined ? {} : { value: descriptor.selectedDate }),\n defaultValue: descriptor.defaultSelectedDate ?? null,\n ...(descriptor.onSelectionChange ? { onChange: descriptor.onSelectionChange } : {}),\n });\n const cells = resolveCalendarGridDescriptor(descriptor.grid, selected, { composeAccessibleName });\n const dates = cells.filter((cell): cell is ResolvedCalendarDateCell<Content> => !(\"filler\" in cell));\n const initial = dates.find((cell) => cell.isSelected) ?? dates.find((cell) => cell.isToday) ?? dates[0];\n const [focused, setFocused] = useState(initial?.date);\n const active = dates.some((cell) => cell.date === focused) ? focused : initial?.date;\n const root = useRef<HTMLDivElement>(null);\n const pending = useRef<string | undefined>(undefined);\n const [request, setRequest] = useState(0);\n const focusDate = (date: string) => { pending.current = date; setFocused(date); setRequest((value) => value + 1); };\n useImperativeHandle(ref, () => ({ focusDate }), []);\n const gridKey = dates.map((cell) => cell.date).join(\",\");\n const mountedFocus = useRef(false);\n useEffect(() => {\n if (autoFocus && !mountedFocus.current && active) pending.current = active;\n mountedFocus.current = true;\n const date = pending.current;\n if (!date) return;\n // A requested adjacent date may arrive in a later render; retain it until that page exists.\n const button = Array.from(root.current?.querySelectorAll<HTMLButtonElement>(\"[data-date]\") ?? []).find((node) => node.dataset.date === date);\n if (button) { button.focus(); setFocused(date); pending.current = undefined; }\n }, [gridKey, request, autoFocus, active]);\n const titleId = `hjm-calendar-${useId()}`;\n return <div ref={root} className={classNames(\"hjm-calendar\", className)} data-size={size}\n style={{ \"--hjm-calendar-max-width\": `${recipe.maxWidth}px`, ...layoutStyle, \"--hjm-calendar-cell-size\": `${recipe.sizes[size].cellDiameter}px`,\n \"--hjm-calendar-indicator-size\": `${recipe.sizes[size].indicatorDiameter}px`,\n \"--hjm-calendar-disabled-opacity\": recipe.day.disabledOpacity,\n \"--hjm-calendar-outside-opacity\": recipe.day.outsideFocusedMonthOpacity } as CSSProperties}>\n <div className=\"hjm-calendar__header\">\n {previousMonth ? <button type=\"button\" aria-label={previousMonth.label} disabled={!descriptor.onFocusedMonthChange}\n onClick={() => descriptor.onFocusedMonthChange?.(previousMonth.month, \"previous\")}><span aria-hidden=\"true\">{theme?.environment.direction === \"rtl\" ? \"›\" : \"‹\"}</span></button> : <span />}\n <strong id={titleId} aria-live=\"polite\" aria-atomic=\"true\">{descriptor.monthLabel}</strong>\n {nextMonth ? <button type=\"button\" aria-label={nextMonth.label} disabled={!descriptor.onFocusedMonthChange}\n onClick={() => descriptor.onFocusedMonthChange?.(nextMonth.month, \"next\")}><span aria-hidden=\"true\">{theme?.environment.direction === \"rtl\" ? \"‹\" : \"›\"}</span></button> : <span />}\n </div>\n <div className=\"hjm-calendar__viewport\">\n <div role=\"grid\" aria-labelledby={titleId} className=\"hjm-calendar__grid\">\n <div role=\"row\" className=\"hjm-calendar__week\">\n {descriptor.grid.weekdayLabels.map((label, index) => <span role=\"columnheader\" className=\"hjm-calendar__weekday\" key={index}>{label}</span>)}\n </div>\n {Array.from({ length: cells.length / 7 }, (_, row) => <div role=\"row\" className=\"hjm-calendar__week\" key={row}>\n {cells.slice(row * 7, row * 7 + 7).map((cell, column) => \"filler\" in cell\n ? <span role=\"gridcell\" aria-hidden=\"true\" key={`filler-${column}`} />\n : <button type=\"button\" role=\"gridcell\" key={cell.date} className=\"hjm-calendar__day\"\n data-date={cell.date} data-focus-date={cell.date === active || undefined}\n data-today={cell.isToday || undefined} data-selected={cell.isSelected || undefined}\n data-disabled={!cell.selectable || undefined} data-outside={cell.outsideFocusedMonth || undefined}\n aria-label={cell.accessibleName} aria-selected={cell.isSelected} aria-disabled={!cell.selectable || undefined}\n aria-current={cell.isToday ? \"date\" : undefined} tabIndex={cell.date === active ? 0 : -1}\n onFocus={() => setFocused(cell.date)} onClick={() => {\n if (!cell.selectable) return;\n // Range completion and DatePicker confirmation still need activation\n // when the date already equals Calendar's single selected value.\n if (cell.date === selected) descriptor.onSelectionChange?.(cell.date);\n else setSelected(cell.date);\n }}\n onKeyDown={(event) => {\n if (event.altKey || event.ctrlKey || event.metaKey) return;\n const intent = getCalendarNavigationIntent(event.key as Parameters<typeof getCalendarNavigationIntent>[0], theme?.environment.direction ?? \"ltr\");\n if (!intent) return;\n event.preventDefault();\n const target = getCalendarNavigationTarget(descriptor.grid, cell.date, intent);\n if (target.date) focusDate(target.date);\n else if (target.overflow) onNavigateBeyondGrid?.({ date: cell.date, intent, overflow: target.overflow }, focusDate);\n }}>\n <span aria-hidden=\"true\" className=\"hjm-calendar__day-label\">{Number(cell.date.slice(-2))}</span>\n {renderCellContent ? <span aria-hidden=\"true\" className=\"hjm-calendar__content\">{renderCellContent(cell)}</span> : null}\n </button>)}\n </div>)}\n </div>\n </div>\n </div>;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"calendar.js","sourceRoot":"","sources":["../src/calendar.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,KAAK,EAAE,mBAAmB,EAAE,MAAM,EAAE,QAAQ,EAAgD,MAAM,OAAO,CAAC;AAC1I,OAAO,EACL,cAAc,IAAI,MAAM,EAAE,sBAAsB,EAAE,0BAA0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AK,CAAC,OAAO;gDAAE,OAAO;4CAC3D,MAAM,MAAM,GAAG,2BAA2B,CAAC,KAAK,CAAC,GAAwD,EAAE,KAAK,EAAE,WAAW,CAAC,SAAS,IAAI,KAAK,CAAC,CAAC;4CAClJ,IAAI,CAAC,MAAM;gDAAE,OAAO;4CACpB,KAAK,CAAC,cAAc,EAAE,CAAC;4CACvB,MAAM,MAAM,GAAG,2BAA2B,CAAC,UAAU,CAAC,IAAI,EAAE,IAAI,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;4CAC/E,IAAI,MAAM,CAAC,IAAI;gDAAE,SAAS,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;iDACnC,IAAI,MAAM,CAAC,QAAQ;gDAAE,oBAAoB,EAAE,CAAC,EAAE,IAAI,EAAE,IAAI,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,CAAC,QAAQ,EAAE,EAAE,SAAS,CAAC,CAAC;wCACtH,CAAC,aACA,KAAK,IAAI,KAAK,CAAC,IAAI,KAAK,MAAM,CAAC,CAAC,CAAC,8BAAkB,MAAM,EAAC,SAAS,EAAC,oBAAoB,GAAG,CAAC,CAAC,CAAC,IAAI,EACnG,8BAAkB,MAAM,EAAC,SAAS,EAAC,yBAAyB,YAAE,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,GAAQ,EAChG,iBAAiB,CAAC,CAAC,CAAC,8BAAkB,MAAM,EAAC,SAAS,EAAC,uBAAuB,YAAE,iBAAiB,CAAC,IAAI,CAAC,GAAQ,CAAC,CAAC,CAAC,IAAI,KA1BrE,IAAI,CAAC,IAAI,CA2BpD,CAAC;gCACV,CAAC,CAAC,EAAE,CAAC,IAlCiG,GAAG,CAmCvG,CAAC,IACH,GACF,IACF,CAAC;AACT,CAAC","sourcesContent":["\"use client\";\n\nimport { useContext, useEffect, useId, useImperativeHandle, useRef, useState, type CSSProperties, type ReactNode, type Ref } from \"react\";\nimport {\n calendarRecipe as recipe, assertIsoCalendarMonth, validateCalendarDescriptor, resolveCalendarGridDescriptor,\n getCalendarNavigationIntent, getCalendarNavigationTarget,\n type CalendarDescriptor, type CalendarSize, type CalendarNavigationIntent,\n type ComposeCalendarAccessibleName, type ResolvedCalendarDateCell,\n} from \"@hjmds/design-contracts/components/calendar\";\nimport { classNames, useControllableState } from \"./internal.js\";\nimport { CalendarPaintContext } from \"./internal/calendar-paint.js\";\nimport { Icon } from \"./supplemental-display.js\";\nimport { useOptionalHjmTheme } from \"./provider.js\";\nimport type { HjmCompositionStyleProp } from \"./composition-style.js\";\n\nexport type CalendarMonthAction = Readonly<{ month: string; label: string }>;\nexport type CalendarHandle = Readonly<{ focusDate(date: string): void }>;\nexport type CalendarOverflow = Readonly<{ date: string; intent: CalendarNavigationIntent; overflow: \"before\" | \"after\" }>;\nexport type CalendarProps<Content = unknown> = Readonly<{\n descriptor: CalendarDescriptor<Content>;\n composeAccessibleName: ComposeCalendarAccessibleName<Content>;\n previousMonth?: CalendarMonthAction;\n nextMonth?: CalendarMonthAction;\n /** The product owns adjacent month/date arithmetic. Call focusDate after requesting its page. */\n onNavigateBeyondGrid?: (detail: CalendarOverflow, focusDate: CalendarHandle[\"focusDate\"]) => void;\n renderCellContent?: (cell: ResolvedCalendarDateCell<Content>) => ReactNode;\n size?: CalendarSize;\n autoFocus?: boolean;\n className?: string;\n ref?: Ref<CalendarHandle>;\n /** Canonical layout-only placement on the root element. Controlled visual keys are excluded. */\n layoutStyle?: HjmCompositionStyleProp;\n}>;\n\n/** Inline single-date grid shared with DatePicker; month data remains product-owned. */\nexport function Calendar<Content>({ descriptor, composeAccessibleName, previousMonth, nextMonth,\n onNavigateBeyondGrid, renderCellContent, size = \"medium\", autoFocus = false, className, layoutStyle, ref }: CalendarProps<Content>) {\n validateCalendarDescriptor(descriptor);\n for (const action of [previousMonth, nextMonth]) {\n if (!action) continue;\n assertIsoCalendarMonth(action.month, \"month action\");\n if (!action.label.trim()) throw new TypeError(\"Calendar month action label must not be empty\");\n }\n const theme = useOptionalHjmTheme();\n const rangePaint = useContext(CalendarPaintContext);\n const [selected, setSelected] = useControllableState<string | null>({\n ...(descriptor.selectedDate === undefined ? {} : { value: descriptor.selectedDate }),\n defaultValue: descriptor.defaultSelectedDate ?? null,\n ...(descriptor.onSelectionChange ? { onChange: descriptor.onSelectionChange } : {}),\n });\n const cells = resolveCalendarGridDescriptor(descriptor.grid, selected, { composeAccessibleName });\n const dates = cells.filter((cell): cell is ResolvedCalendarDateCell<Content> => !(\"filler\" in cell));\n const initial = dates.find((cell) => cell.isSelected) ?? dates.find((cell) => cell.isToday) ?? dates[0];\n const [focused, setFocused] = useState(initial?.date);\n const active = dates.some((cell) => cell.date === focused) ? focused : initial?.date;\n const root = useRef<HTMLDivElement>(null);\n const pending = useRef<string | undefined>(undefined);\n const [request, setRequest] = useState(0);\n const focusDate = (date: string) => { pending.current = date; setFocused(date); setRequest((value) => value + 1); };\n useImperativeHandle(ref, () => ({ focusDate }), []);\n const gridKey = dates.map((cell) => cell.date).join(\",\");\n const mountedFocus = useRef(false);\n useEffect(() => {\n if (autoFocus && !mountedFocus.current && active) pending.current = active;\n mountedFocus.current = true;\n const date = pending.current;\n if (!date) return;\n // A requested adjacent date may arrive in a later render; retain it until that page exists.\n const button = Array.from(root.current?.querySelectorAll<HTMLButtonElement>(\"[data-date]\") ?? []).find((node) => node.dataset.date === date);\n if (button) { button.focus(); setFocused(date); pending.current = undefined; }\n }, [gridKey, request, autoFocus, active]);\n const titleId = `hjm-calendar-${useId()}`;\n return <div ref={root} className={classNames(\"hjm-calendar\", className)} data-size={size}\n style={{ \"--hjm-calendar-max-width\": `${recipe.maxWidth}px`, ...layoutStyle, \"--hjm-calendar-cell-size\": `${recipe.sizes[size].cellDiameter}px`,\n \"--hjm-calendar-indicator-size\": `${recipe.sizes[size].indicatorDiameter}px`,\n \"--hjm-calendar-disabled-opacity\": recipe.day.disabledOpacity,\n \"--hjm-calendar-outside-opacity\": recipe.day.outsideFocusedMonthOpacity } as CSSProperties}>\n <div className=\"hjm-calendar__header\">\n {previousMonth ? <button type=\"button\" aria-label={previousMonth.label} disabled={!descriptor.onFocusedMonthChange}\n onClick={() => descriptor.onFocusedMonthChange?.(previousMonth.month, \"previous\")}><Icon name={recipe.header.navIcon.previous} size={recipe.sizes[size].glyph} tone=\"secondary\" decorative /></button> : <span />}\n <strong id={titleId} aria-live=\"polite\" aria-atomic=\"true\">{descriptor.monthLabel}</strong>\n {nextMonth ? <button type=\"button\" aria-label={nextMonth.label} disabled={!descriptor.onFocusedMonthChange}\n onClick={() => descriptor.onFocusedMonthChange?.(nextMonth.month, \"next\")}><Icon name={recipe.header.navIcon.next} size={recipe.sizes[size].glyph} tone=\"secondary\" decorative /></button> : <span />}\n </div>\n <div className=\"hjm-calendar__viewport\">\n <div role=\"grid\" aria-labelledby={titleId} className=\"hjm-calendar__grid\">\n <div role=\"row\" className=\"hjm-calendar__week\">\n {descriptor.grid.weekdayLabels.map((label, index) => <span role=\"columnheader\" className=\"hjm-calendar__weekday\" key={index}>{label}</span>)}\n </div>\n {Array.from({ length: cells.length / 7 }, (_, row) => <div role=\"row\" className=\"hjm-calendar__week\" key={row}>\n {cells.slice(row * 7, row * 7 + 7).map((cell, column) => \"filler\" in cell\n ? <span role=\"gridcell\" aria-hidden=\"true\" key={`filler-${column}`} />\n : (() => {\n const range = rangePaint?.paint(cell.date);\n const filled = range ? range.edge : cell.isSelected;\n return <button type=\"button\" role=\"gridcell\" key={cell.date} className=\"hjm-calendar__day\"\n data-date={cell.date} data-focus-date={cell.date === active || undefined}\n data-today={cell.isToday || undefined} data-selected={filled || undefined}\n data-range-band={range && range.band !== \"none\" ? range.band : undefined}\n data-disabled={!cell.selectable || undefined} data-outside={cell.outsideFocusedMonth || undefined}\n aria-label={cell.accessibleName} aria-selected={filled} aria-disabled={!cell.selectable || undefined}\n aria-current={cell.isToday ? \"date\" : undefined} tabIndex={cell.date === active ? 0 : -1}\n onMouseEnter={rangePaint ? () => rangePaint.onDayHover(cell.date) : undefined}\n onFocus={() => setFocused(cell.date)} onClick={() => {\n if (!cell.selectable) return;\n // Range completion and DatePicker confirmation still need activation\n // when the date already equals Calendar's single selected value.\n if (cell.date === selected) descriptor.onSelectionChange?.(cell.date);\n else setSelected(cell.date);\n }}\n onKeyDown={(event) => {\n if (event.altKey || event.ctrlKey || event.metaKey) return;\n const intent = getCalendarNavigationIntent(event.key as Parameters<typeof getCalendarNavigationIntent>[0], theme?.environment.direction ?? \"ltr\");\n if (!intent) return;\n event.preventDefault();\n const target = getCalendarNavigationTarget(descriptor.grid, cell.date, intent);\n if (target.date) focusDate(target.date);\n else if (target.overflow) onNavigateBeyondGrid?.({ date: cell.date, intent, overflow: target.overflow }, focusDate);\n }}>\n {range && range.band !== \"none\" ? <span aria-hidden=\"true\" className=\"hjm-calendar__band\" /> : null}\n <span aria-hidden=\"true\" className=\"hjm-calendar__day-label\">{Number(cell.date.slice(-2))}</span>\n {renderCellContent ? <span aria-hidden=\"true\" className=\"hjm-calendar__content\">{renderCellContent(cell)}</span> : null}\n </button>;\n })())}\n </div>)}\n </div>\n </div>\n </div>;\n}\n"]}
|
package/dist/carousel.d.ts
CHANGED
|
@@ -30,6 +30,8 @@ export type PageIndicatorProps = Omit<HTMLAttributes<HTMLDivElement>, "children"
|
|
|
30
30
|
maxVisibleDots?: number;
|
|
31
31
|
/** Position-only dots when separate pager controls own navigation. Default true retains 44pt dot targets. */
|
|
32
32
|
interactive?: boolean;
|
|
33
|
+
/** Compact dots retain full target height with narrower, non-overlapping horizontal targets. */
|
|
34
|
+
density?: "comfortable" | "compact";
|
|
33
35
|
/** Requested page from a dot or an arrow key. It can repeat the current index. */
|
|
34
36
|
onCurrentIndexChange: (index: number) => void;
|
|
35
37
|
composeAccessibleName: ComposePageIndicatorAccessibleName;
|
|
@@ -40,7 +42,7 @@ export type PageIndicatorProps = Omit<HTMLAttributes<HTMLDivElement>, "children"
|
|
|
40
42
|
* Carousel's position dots for a product-owned pager (scroll-snap row, virtualized pager). Arrow keys on a dot move
|
|
41
43
|
* one page in reading direction, as in Carousel's controls.
|
|
42
44
|
*/
|
|
43
|
-
export declare const PageIndicator: import("react").ForwardRefExoticComponent<Omit<HTMLAttributes<HTMLDivElement>, "
|
|
45
|
+
export declare const PageIndicator: import("react").ForwardRefExoticComponent<Omit<HTMLAttributes<HTMLDivElement>, "children" | "onChange"> & Readonly<{
|
|
44
46
|
/** Name of the paged region (e.g. "Home pages"); the group's accessible name. */
|
|
45
47
|
label: string;
|
|
46
48
|
count: number;
|
|
@@ -50,6 +52,8 @@ export declare const PageIndicator: import("react").ForwardRefExoticComponent<Om
|
|
|
50
52
|
maxVisibleDots?: number;
|
|
51
53
|
/** Position-only dots when separate pager controls own navigation. Default true retains 44pt dot targets. */
|
|
52
54
|
interactive?: boolean;
|
|
55
|
+
/** Compact dots retain full target height with narrower, non-overlapping horizontal targets. */
|
|
56
|
+
density?: "comfortable" | "compact";
|
|
53
57
|
/** Requested page from a dot or an arrow key. It can repeat the current index. */
|
|
54
58
|
onCurrentIndexChange: (index: number) => void;
|
|
55
59
|
composeAccessibleName: ComposePageIndicatorAccessibleName;
|
package/dist/carousel.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"carousel.d.ts","sourceRoot":"","sources":["../src/carousel.tsx"],"names":[],"mappings":"AAEA,OAAO,EAA4D,KAAK,cAAc,EAAE,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AACtH,OAAO,EAGL,KAAK,uBAAuB,EAAE,KAAK,iBAAiB,EAAE,KAAK,sBAAsB,EACjF,KAAK,6BAA6B,EAAE,KAAK,kCAAkC,EAC5E,MAAM,6CAA6C,CAAC;AAMrD,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,wBAAwB,CAAC;AAEtE,MAAM,MAAM,cAAc,GAAG,QAAQ,CAAC;IAAE,QAAQ,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,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E,MAAM,CAAC;IACrB,6EAA6E;IAC7E,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,6GAA6G;IAC7G,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,gGAAgG;IAChG,OAAO,CAAC,EAAE,aAAa,GAAG,SAAS,CAAC;IACpC,kFAAkF;IAClF,oBAAoB,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IAC9C,qBAAqB,EAAE,kCAAkC,CAAC;IAC1D,gGAAgG;IAChG,WAAW,CAAC,EAAE,uBAAuB,CAAC;CACvC,CAAC,CAAC;AAeH;;;GAGG;AACH,eAAO,MAAM,aAAa;IAnCxB,iFAAiF;WAC1E,MAAM;WACN,MAAM;IACb,0DAA0D;kBAC5C,MAAM;IACpB,6EAA6E;qBAC5D,MAAM;IACvB,6GAA6G;kBAC/F,OAAO;IACrB,gGAAgG;cACtF,aAAa,GAAG,SAAS;IACnC,kFAAkF;0BAC5D,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI;2BACtB,kCAAkC;IACzD,gGAAgG;kBAClF,uBAAuB;mDAsDrC,CAAC;AAEH,+EAA+E;AAC/E,eAAO,MAAM,QAAQ,0GAsGnB,CAAC"}
|
package/dist/carousel.js
CHANGED
|
@@ -15,7 +15,7 @@ function PageDots({ dots, onSelect, dotClassName, keys }) {
|
|
|
15
15
|
* Carousel's position dots for a product-owned pager (scroll-snap row, virtualized pager). Arrow keys on a dot move
|
|
16
16
|
* one page in reading direction, as in Carousel's controls.
|
|
17
17
|
*/
|
|
18
|
-
export const PageIndicator = forwardRef(function PageIndicator({ label, count, currentIndex, maxVisibleDots, interactive = true, onCurrentIndexChange, composeAccessibleName, className, onKeyDown, onFocusCapture, layoutStyle, ...props }, ref) {
|
|
18
|
+
export const PageIndicator = forwardRef(function PageIndicator({ label, count, currentIndex, maxVisibleDots, interactive = true, density = "comfortable", onCurrentIndexChange, composeAccessibleName, className, onKeyDown, onFocusCapture, layoutStyle, ...props }, ref) {
|
|
19
19
|
const theme = useOptionalHjmTheme();
|
|
20
20
|
const host = useRef(null);
|
|
21
21
|
const lastFocused = useRef(null);
|
|
@@ -31,7 +31,7 @@ export const PageIndicator = forwardRef(function PageIndicator({ label, count, c
|
|
|
31
31
|
const descriptor = { count, currentIndex, ...(maxVisibleDots === undefined ? {} : { maxVisibleDots }) };
|
|
32
32
|
const dots = resolvePageIndicator(descriptor, composeAccessibleName);
|
|
33
33
|
const current = dots.find(dot => dot.current);
|
|
34
|
-
return _jsx("div", { ...props, ref: node => { host.current = node; assignRef(ref, node); }, style: { ...props.style, ...layoutStyle }, role: interactive ? "group" : "img", "aria-label": interactive ? label : current.accessibleName, "data-interactive": interactive, className: classNames("hjm-page-indicator", className), onFocusCapture: event => {
|
|
34
|
+
return _jsx("div", { ...props, ref: node => { host.current = node; assignRef(ref, node); }, style: { ...props.style, ...layoutStyle }, role: interactive ? "group" : "img", "aria-label": interactive ? label : current.accessibleName, "data-interactive": interactive, "data-density": density, className: classNames("hjm-page-indicator", className), onFocusCapture: event => {
|
|
35
35
|
lastFocused.current = event.target instanceof HTMLElement ? event.target : null;
|
|
36
36
|
onFocusCapture?.(event);
|
|
37
37
|
}, onKeyDown: (event) => {
|
package/dist/carousel.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"carousel.js","sourceRoot":"","sources":["../src/carousel.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb,OAAO,EAAE,SAAS,EAAE,eAAe,EAAE,MAAM,EAAE,QAAQ,EAAE,UAAU,EAAuC,MAAM,OAAO,CAAC;AACtH,OAAO,EACL,yBAAyB,EAAE,2BAA2B,EAAE,wBAAwB,EAChF,oBAAoB,EAAE,sBAAsB,GAG7C,MAAM,6CAA6C,CAAC;AACrD,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAClD,OAAO,EAAE,IAAI,EAAE,MAAM,2BAA2B,CAAC;AACjD,OAAO,EAAE,gBAAgB,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CAAC,CAAC,CAAE,CAAC,EAAE,EAAE,OAAO,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC,UAAU,CAAC,YAAE,KAAC,IAAI,IAAC,IAAI,EAAC,cAAc,GAAG,GAAa,EACrK,cAAK,SAAS,EAAC,oBAAoB,YACjC,KAAC,QAAQ,IAAC,YAAY,EAAC,mBAAmB,EAAC,IAAI,EAAE,MAAM,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,EAAE,CAAC,EAAE,QAAQ,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,MAAM,CAAC,MAAM,CAAC,KAAK,CAAE,CAAC,EAAE,CAAC,EAC9H,IAAI,EAAE,oBAAoB,CAAC,EAAE,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,YAAY,EAAE,QAAQ,CAAC,SAAS,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,OAAO,CAAC,EAAE,EAC7G,CAAC,EAAE,QAAQ,EAAE,EAAE,EAAE,CAAC,QAAQ,CAAC,QAAQ,GAAG,CAAC,CAAE,CAAC,cAAc,CAAC,GAAI,GAC7D,EACN,KAAC,UAAU,IAAC,KAAK,EAAE,MAAM,CAAC,IAAI,EAAE,IAAI,EAAC,OAAO,mBAAgB,IAAI,EAAE,OAAO,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC,MAAM,CAAC,YAAE,KAAC,IAAI,IAAC,IAAI,EAAC,YAAY,GAAG,GAAa,IAClI,IACF,CAAC;AACT,CAAC,CAAC,CAAC","sourcesContent":["\"use client\";\n\nimport { useEffect, useLayoutEffect, useRef, useState, forwardRef, type HTMLAttributes, type ReactNode } from \"react\";\nimport {\n resolveCarouselDescriptor, getCarouselNavigationTarget, isCarouselAutoplayActive,\n resolvePageIndicator, getPageIndicatorTarget,\n type CarouselSlideDescriptor, type CarouselSelection, type CarouselAutoplayConfig,\n type ComposeCarouselAccessibleName, type ComposePageIndicatorAccessibleName, type ResolvedPageIndicatorDot,\n} from \"@hjmds/design-contracts/components/carousel\";\nimport { Button, IconButton } from \"./actions.js\";\nimport { Icon } from \"./supplemental-display.js\";\nimport { isLargeTextScale } from \"@hjmds/design-contracts/components/design-system-provider\";\nimport { assignRef, classNames, useControllableState } from \"./internal.js\";\nimport { useOptionalHjmTheme } from \"./provider.js\";\nimport type { HjmCompositionStyleProp } from \"./composition-style.js\";\n\nexport type CarouselLabels = Readonly<{ previous: string; next: string; pause: string; resume: string; navigation: string }>;\nexport type CarouselProps = Omit<HTMLAttributes<HTMLDivElement>, \"children\" | \"onChange\"> & CarouselSelection & Readonly<{\n label: string;\n slides: readonly CarouselSlideDescriptor[];\n renderSlide: (slide: CarouselSlideDescriptor) => ReactNode;\n composeAccessibleName: ComposeCarouselAccessibleName;\n labels: CarouselLabels;\n autoplay?: CarouselAutoplayConfig;\n /** Available content height in a bounded host. Navigation stays outside the scrolling slide. */\n slideMaxHeight?: number;\n /** Canonical layout-only placement on the root element. Controlled visual keys are excluded. */\n layoutStyle?: HjmCompositionStyleProp;\n}>;\n\nexport type PageIndicatorProps = Omit<HTMLAttributes<HTMLDivElement>, \"children\" | \"onChange\"> & Readonly<{\n /** Name of the paged region (e.g. \"Home pages\"); the group's accessible name. */\n label: string;\n count: number;\n /** Zero-based current page; the product pager owns it. */\n currentIndex: number;\n /** Limit visible dots while retaining absolute page names and navigation. */\n maxVisibleDots?: number;\n /** Position-only dots when separate pager controls own navigation. Default true retains 44pt dot targets. */\n interactive?: boolean;\n /** Requested page from a dot or an arrow key. It can repeat the current index. */\n onCurrentIndexChange: (index: number) => void;\n composeAccessibleName: ComposePageIndicatorAccessibleName;\n /** Canonical layout-only placement on the root element. Controlled visual keys are excluded. */\n layoutStyle?: HjmCompositionStyleProp;\n}>;\n\n/** The dot buttons shared by Carousel and PageIndicator, so both rows keep one markup and one recipe. */\nfunction PageDots({ dots, onSelect, dotClassName, keys }: Readonly<{\n dots: readonly ResolvedPageIndicatorDot[];\n onSelect: (index: number) => void;\n dotClassName: string;\n /** Carousel keys dots by slide id so removing a slide removes its own (possibly focused) dot. */\n keys?: readonly string[];\n}>) {\n return <>{dots.map((dot) => <button key={keys?.[dot.index] ?? dot.index} type=\"button\" aria-label={dot.accessibleName}\n aria-disabled={dot.current} data-current={dot.current} className={dotClassName}\n onClick={() => onSelect(dot.index)}><span aria-hidden=\"true\" /></button>)}</>;\n}\n\n/**\n * Carousel's position dots for a product-owned pager (scroll-snap row, virtualized pager). Arrow keys on a dot move\n * one page in reading direction, as in Carousel's controls.\n */\nexport const PageIndicator = forwardRef<HTMLDivElement, PageIndicatorProps>(function PageIndicator({\n label, count, currentIndex, maxVisibleDots, interactive = true, onCurrentIndexChange, composeAccessibleName, className, onKeyDown, onFocusCapture, layoutStyle, ...props\n}, ref) {\n const theme = useOptionalHjmTheme();\n const host = useRef<HTMLDivElement | null>(null);\n const lastFocused = useRef<HTMLElement | null>(null);\n useLayoutEffect(() => {\n // Moving the bounded window can remove the focused dot. Recover within the same control only when\n // removal left focus on body; a user who moved elsewhere keeps that focus.\n if (interactive && lastFocused.current && !lastFocused.current.isConnected && document.activeElement === document.body) {\n host.current?.querySelector<HTMLButtonElement>('.hjm-page-indicator__dot[data-current=\"true\"]')?.focus();\n }\n }, [interactive, count, currentIndex, maxVisibleDots]);\n if (!label.trim()) throw new TypeError(\"PageIndicator label must not be empty\");\n const descriptor = { count, currentIndex, ...(maxVisibleDots === undefined ? {} : { maxVisibleDots }) };\n const dots = resolvePageIndicator(descriptor, composeAccessibleName);\n const current = dots.find(dot => dot.current)!;\n return <div {...props} ref={node => { host.current = node; assignRef(ref, node); }} style={{ ...props.style, ...layoutStyle }} role={interactive ? \"group\" : \"img\"} aria-label={interactive ? label : current.accessibleName} data-interactive={interactive}\n className={classNames(\"hjm-page-indicator\", className)}\n onFocusCapture={event => {\n lastFocused.current = event.target instanceof HTMLElement ? event.target : null;\n onFocusCapture?.(event);\n }}\n onKeyDown={(event) => {\n onKeyDown?.(event);\n if (!interactive || event.defaultPrevented || event.altKey || event.ctrlKey || event.metaKey) return;\n if (event.key !== \"ArrowLeft\" && event.key !== \"ArrowRight\") return;\n event.preventDefault();\n onCurrentIndexChange(getPageIndicatorTarget(descriptor,\n (event.key === \"ArrowRight\") !== (theme?.environment.direction === \"rtl\") ? \"next\" : \"previous\"));\n }}>\n {interactive ? <PageDots dots={dots} onSelect={onCurrentIndexChange} dotClassName=\"hjm-page-indicator__dot\" />\n : dots.map(dot => <span key={dot.index} aria-hidden=\"true\" data-current={dot.current} className=\"hjm-page-indicator__marker\"><span /></span>)}\n </div>;\n});\n\n/** Finite keyed cards. Hidden slides stay mounted but cannot receive focus. */\nexport const Carousel = forwardRef<HTMLDivElement, CarouselProps>(function Carousel({\n label, slides, renderSlide, composeAccessibleName, labels, autoplay,\n currentKey, defaultCurrentKey, onCurrentKeyChange, className,\n onFocusCapture, onMouseEnter, onMouseLeave, onKeyDown, layoutStyle, slideMaxHeight, ...props\n}, ref) {\n const theme = useOptionalHjmTheme();\n const [storedCurrent, setCurrent] = useControllableState({\n ...(currentKey === undefined ? {} : { value: currentKey }),\n defaultValue: defaultCurrentKey ?? slides[0]?.id ?? \"\",\n ...(onCurrentKeyChange === undefined ? {} : { onChange: onCurrentKeyChange }),\n });\n const previousIndex = useRef<number | null>(null);\n const host = useRef<HTMLDivElement | null>(null);\n const lastFocused = useRef<HTMLElement | null>(null);\n // A host can delete the current uncontrolled slide after mount. Keep its place\n // in the collection (or the new last slide); explicit invalid keys still fail validation.\n const recovering = currentKey === undefined && previousIndex.current !== null && !slides.some(slide => slide.id === storedCurrent);\n const current = recovering ? slides[Math.min(previousIndex.current!, slides.length - 1)]?.id ?? storedCurrent : storedCurrent;\n useLayoutEffect(() => {\n previousIndex.current = slides.findIndex(slide => slide.id === current);\n if (recovering) {\n setCurrent(current);\n // A removed dot/card can strand focus on body; retained controls keep their focus.\n if (lastFocused.current && !lastFocused.current.isConnected && document.activeElement === document.body) {\n host.current?.querySelector<HTMLButtonElement>('.hjm-carousel__dot[data-current=\"true\"]')?.focus();\n }\n }\n }, [current, recovering, slides, setCurrent]);\n const descriptor = { slides, currentKey: current, ...(autoplay ? { autoplay } : {}) };\n const resolved = resolveCarouselDescriptor(descriptor, { composeAccessibleName });\n if (!label.trim() || Object.values(labels).some((value) => !value.trim())) throw new TypeError(\"Carousel labels must not be empty\");\n if (slideMaxHeight !== undefined && (!Number.isFinite(slideMaxHeight) || slideMaxHeight <= 0)) throw new TypeError(\"Carousel slideMaxHeight must be finite and positive\");\n const [rotating, setRotating] = useState(autoplay !== undefined);\n const [hovered, setHovered] = useState(false);\n const [hidden, setHidden] = useState(false);\n const pointerRotation = useRef<boolean | null>(null);\n const last = current === slides.at(-1)!.id;\n const playing = isCarouselAutoplayActive(autoplay, {\n reducedMotion: theme?.environment.reducedMotion ?? false,\n paused: !rotating || hovered || hidden || last,\n });\n useEffect(() => {\n const update = () => setHidden(document.hidden);\n update(); document.addEventListener(\"visibilitychange\", update);\n return () => document.removeEventListener(\"visibilitychange\", update);\n }, []);\n useEffect(() => {\n if (!playing || !autoplay) return;\n const timer = setTimeout(() => setCurrent(getCarouselNavigationTarget(descriptor, \"next\")), autoplay.intervalMs);\n return () => clearTimeout(timer);\n }, [playing, autoplay?.intervalMs, current, slides, setCurrent]);\n function select(key: string) { setRotating(false); if (key !== current) setCurrent(key); }\n function move(intent: \"next\" | \"previous\") { select(getCarouselNavigationTarget(descriptor, intent)); }\n const rotationRequested = rotating && !last && !theme?.environment.reducedMotion;\n return <div {...props} style={{ ...props.style, ...layoutStyle }} ref={node => { host.current = node; assignRef(ref, node); }} role=\"region\" aria-label={label} aria-roledescription=\"carousel\"\n className={classNames(\"hjm-carousel\", className)} data-large-text={isLargeTextScale(theme?.environment.textScale ?? 1)}\n onFocusCapture={(event) => {\n lastFocused.current = event.target instanceof HTMLElement ? event.target : null;\n // APG: leaving focus must not silently restart rotation. Explicit resume is required.\n if (!event.currentTarget.contains(event.relatedTarget)) setRotating(false);\n onFocusCapture?.(event);\n }}\n onMouseEnter={(event) => { setHovered(true); onMouseEnter?.(event); }}\n onMouseLeave={(event) => { setHovered(false); onMouseLeave?.(event); }}\n onKeyDown={(event) => {\n onKeyDown?.(event);\n if (event.defaultPrevented || event.altKey || event.ctrlKey || event.metaKey) return;\n // Do not steal editing/navigation keys from links, inputs or widgets inside a card.\n if (!(event.target instanceof Element) || !event.target.closest(\"[data-carousel-controls]\")) return;\n if (event.key !== \"ArrowLeft\" && event.key !== \"ArrowRight\") return;\n event.preventDefault();\n move((event.key === \"ArrowRight\") !== (theme?.environment.direction === \"rtl\") ? \"next\" : \"previous\");\n }}>\n {autoplay ? <Button tone=\"ghost\" className=\"hjm-carousel__rotation\" disabled={theme?.environment.reducedMotion}\n onPointerDown={() => { pointerRotation.current = !rotationRequested; }}\n onPointerCancel={() => { pointerRotation.current = null; }}\n onClick={(event) => {\n // An abandoned pointer gesture must not override a later keyboard activation.\n const next = event.detail > 0 ? pointerRotation.current ?? !rotationRequested : !rotationRequested;\n pointerRotation.current = null;\n if (next && last) setCurrent(slides[0]!.id);\n setRotating(next);\n }}>{rotationRequested ? labels.pause : labels.resume}</Button> : null}\n <div className=\"hjm-carousel__track\" aria-live={playing ? \"off\" : \"polite\"} aria-atomic={false}>\n {resolved.map((slide) => <div key={slide.id} className=\"hjm-carousel__slide\" role=\"group\"\n aria-roledescription=\"slide\" aria-label={slide.accessibleName} hidden={slide.inert} inert={slide.inert}\n tabIndex={slideMaxHeight === undefined ? undefined : 0}\n style={slideMaxHeight === undefined ? undefined : { maxHeight: slideMaxHeight, overflowY: \"auto\" }}>\n {renderSlide(slide)}\n </div>)}\n </div>\n <div className=\"hjm-carousel__controls\" data-carousel-controls role=\"group\" aria-label={labels.navigation}>\n {/* Previous/next are tool actions: icon buttons named by the localized label (2026-10-17 review E9). */}\n <IconButton label={labels.previous} tone=\"ghost\" aria-disabled={current === slides[0]!.id} onClick={() => move(\"previous\")}><Icon name=\"chevronStart\" /></IconButton>\n <div className=\"hjm-carousel__dots\">\n <PageDots dotClassName=\"hjm-carousel__dot\" keys={slides.map((slide) => slide.id)} onSelect={(index) => select(slides[index]!.id)}\n dots={resolvePageIndicator({ count: slides.length, currentIndex: resolved.findIndex((slide) => slide.current) },\n ({ position }) => resolved[position - 1]!.accessibleName)} />\n </div>\n <IconButton label={labels.next} tone=\"ghost\" aria-disabled={last} onClick={() => move(\"next\")}><Icon name=\"chevronEnd\" /></IconButton>\n </div>\n </div>;\n});\n"]}
|
|
1
|
+
{"version":3,"file":"carousel.js","sourceRoot":"","sources":["../src/carousel.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb,OAAO,EAAE,SAAS,EAAE,eAAe,EAAE,MAAM,EAAE,QAAQ,EAAE,UAAU,EAAuC,MAAM,OAAO,CAAC;AACtH,OAAO,EACL,yBAAyB,EAAE,2BAA2B,EAAE,wBAAwB,EAChF,oBAAoB,EAAE,sBAAsB,GAG7C,MAAM,6CAA6C,CAAC;AACrD,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAClD,OAAO,EAAE,IAAI,EAAE,MAAM,2BAA2B,CAAC;AACjD,OAAO,EAAE,gBAAgB,EAAE,MAAM,2DAA2D,CAAC;AAC7F,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,oBAAoB,EAAE,MAAM,eAAe,CAAC;AAC5E,OAAO,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAC;AAoCpD,yGAAyG;AACzG,SAAS,QAAQ,CAAC,EAAE,IAAI,EAAE,QAAQ,EAAE,YAAY,EAAE,IAAI,EAMpD;IACA,OAAO,4BAAG,IAAI,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,iBAA6C,IAAI,EAAC,QAAQ,gBAAa,GAAG,CAAC,cAAc,mBACpG,GAAG,CAAC,OAAO,kBAAgB,GAAG,CAAC,OAAO,EAAE,SAAS,EAAE,YAAY,EAC9E,OAAO,EAAE,GAAG,EAAE,CAA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CAAC,EAAE,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,YAAY,EAAE,QAAQ,CAAC,SAAS,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,OAAO,CAAC,EAAE,EAC7G,CAAC,EAAE,QAAQ,EAAE,EAAE,EAAE,CAAC,QAAQ,CAAC,QAAQ,GAAG,CAAC,CAAE,CAAC,cAAc,CAAC,GAAI,GAC7D,EACN,KAAC,UAAU,IAAC,KAAK,EAAE,MAAM,CAAC,IAAI,EAAE,IAAI,EAAC,OAAO,mBAAgB,IAAI,EAAE,OAAO,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC,MAAM,CAAC,YAAE,KAAC,IAAI,IAAC,IAAI,EAAC,YAAY,GAAG,GAAa,IAClI,IACF,CAAC;AACT,CAAC,CAAC,CAAC","sourcesContent":["\"use client\";\n\nimport { useEffect, useLayoutEffect, useRef, useState, forwardRef, type HTMLAttributes, type ReactNode } from \"react\";\nimport {\n resolveCarouselDescriptor, getCarouselNavigationTarget, isCarouselAutoplayActive,\n resolvePageIndicator, getPageIndicatorTarget,\n type CarouselSlideDescriptor, type CarouselSelection, type CarouselAutoplayConfig,\n type ComposeCarouselAccessibleName, type ComposePageIndicatorAccessibleName, type ResolvedPageIndicatorDot,\n} from \"@hjmds/design-contracts/components/carousel\";\nimport { Button, IconButton } from \"./actions.js\";\nimport { Icon } from \"./supplemental-display.js\";\nimport { isLargeTextScale } from \"@hjmds/design-contracts/components/design-system-provider\";\nimport { assignRef, classNames, useControllableState } from \"./internal.js\";\nimport { useOptionalHjmTheme } from \"./provider.js\";\nimport type { HjmCompositionStyleProp } from \"./composition-style.js\";\n\nexport type CarouselLabels = Readonly<{ previous: string; next: string; pause: string; resume: string; navigation: string }>;\nexport type CarouselProps = Omit<HTMLAttributes<HTMLDivElement>, \"children\" | \"onChange\"> & CarouselSelection & Readonly<{\n label: string;\n slides: readonly CarouselSlideDescriptor[];\n renderSlide: (slide: CarouselSlideDescriptor) => ReactNode;\n composeAccessibleName: ComposeCarouselAccessibleName;\n labels: CarouselLabels;\n autoplay?: CarouselAutoplayConfig;\n /** Available content height in a bounded host. Navigation stays outside the scrolling slide. */\n slideMaxHeight?: number;\n /** Canonical layout-only placement on the root element. Controlled visual keys are excluded. */\n layoutStyle?: HjmCompositionStyleProp;\n}>;\n\nexport type PageIndicatorProps = Omit<HTMLAttributes<HTMLDivElement>, \"children\" | \"onChange\"> & Readonly<{\n /** Name of the paged region (e.g. \"Home pages\"); the group's accessible name. */\n label: string;\n count: number;\n /** Zero-based current page; the product pager owns it. */\n currentIndex: number;\n /** Limit visible dots while retaining absolute page names and navigation. */\n maxVisibleDots?: number;\n /** Position-only dots when separate pager controls own navigation. Default true retains 44pt dot targets. */\n interactive?: boolean;\n /** Compact dots retain full target height with narrower, non-overlapping horizontal targets. */\n density?: \"comfortable\" | \"compact\";\n /** Requested page from a dot or an arrow key. It can repeat the current index. */\n onCurrentIndexChange: (index: number) => void;\n composeAccessibleName: ComposePageIndicatorAccessibleName;\n /** Canonical layout-only placement on the root element. Controlled visual keys are excluded. */\n layoutStyle?: HjmCompositionStyleProp;\n}>;\n\n/** The dot buttons shared by Carousel and PageIndicator, so both rows keep one markup and one recipe. */\nfunction PageDots({ dots, onSelect, dotClassName, keys }: Readonly<{\n dots: readonly ResolvedPageIndicatorDot[];\n onSelect: (index: number) => void;\n dotClassName: string;\n /** Carousel keys dots by slide id so removing a slide removes its own (possibly focused) dot. */\n keys?: readonly string[];\n}>) {\n return <>{dots.map((dot) => <button key={keys?.[dot.index] ?? dot.index} type=\"button\" aria-label={dot.accessibleName}\n aria-disabled={dot.current} data-current={dot.current} className={dotClassName}\n onClick={() => onSelect(dot.index)}><span aria-hidden=\"true\" /></button>)}</>;\n}\n\n/**\n * Carousel's position dots for a product-owned pager (scroll-snap row, virtualized pager). Arrow keys on a dot move\n * one page in reading direction, as in Carousel's controls.\n */\nexport const PageIndicator = forwardRef<HTMLDivElement, PageIndicatorProps>(function PageIndicator({\n label, count, currentIndex, maxVisibleDots, interactive = true, density = \"comfortable\", onCurrentIndexChange, composeAccessibleName, className, onKeyDown, onFocusCapture, layoutStyle, ...props\n}, ref) {\n const theme = useOptionalHjmTheme();\n const host = useRef<HTMLDivElement | null>(null);\n const lastFocused = useRef<HTMLElement | null>(null);\n useLayoutEffect(() => {\n // Moving the bounded window can remove the focused dot. Recover within the same control only when\n // removal left focus on body; a user who moved elsewhere keeps that focus.\n if (interactive && lastFocused.current && !lastFocused.current.isConnected && document.activeElement === document.body) {\n host.current?.querySelector<HTMLButtonElement>('.hjm-page-indicator__dot[data-current=\"true\"]')?.focus();\n }\n }, [interactive, count, currentIndex, maxVisibleDots]);\n if (!label.trim()) throw new TypeError(\"PageIndicator label must not be empty\");\n const descriptor = { count, currentIndex, ...(maxVisibleDots === undefined ? {} : { maxVisibleDots }) };\n const dots = resolvePageIndicator(descriptor, composeAccessibleName);\n const current = dots.find(dot => dot.current)!;\n return <div {...props} ref={node => { host.current = node; assignRef(ref, node); }} style={{ ...props.style, ...layoutStyle }} role={interactive ? \"group\" : \"img\"} aria-label={interactive ? label : current.accessibleName} data-interactive={interactive} data-density={density}\n className={classNames(\"hjm-page-indicator\", className)}\n onFocusCapture={event => {\n lastFocused.current = event.target instanceof HTMLElement ? event.target : null;\n onFocusCapture?.(event);\n }}\n onKeyDown={(event) => {\n onKeyDown?.(event);\n if (!interactive || event.defaultPrevented || event.altKey || event.ctrlKey || event.metaKey) return;\n if (event.key !== \"ArrowLeft\" && event.key !== \"ArrowRight\") return;\n event.preventDefault();\n onCurrentIndexChange(getPageIndicatorTarget(descriptor,\n (event.key === \"ArrowRight\") !== (theme?.environment.direction === \"rtl\") ? \"next\" : \"previous\"));\n }}>\n {interactive ? <PageDots dots={dots} onSelect={onCurrentIndexChange} dotClassName=\"hjm-page-indicator__dot\" />\n : dots.map(dot => <span key={dot.index} aria-hidden=\"true\" data-current={dot.current} className=\"hjm-page-indicator__marker\"><span /></span>)}\n </div>;\n});\n\n/** Finite keyed cards. Hidden slides stay mounted but cannot receive focus. */\nexport const Carousel = forwardRef<HTMLDivElement, CarouselProps>(function Carousel({\n label, slides, renderSlide, composeAccessibleName, labels, autoplay,\n currentKey, defaultCurrentKey, onCurrentKeyChange, className,\n onFocusCapture, onMouseEnter, onMouseLeave, onKeyDown, layoutStyle, slideMaxHeight, ...props\n}, ref) {\n const theme = useOptionalHjmTheme();\n const [storedCurrent, setCurrent] = useControllableState({\n ...(currentKey === undefined ? {} : { value: currentKey }),\n defaultValue: defaultCurrentKey ?? slides[0]?.id ?? \"\",\n ...(onCurrentKeyChange === undefined ? {} : { onChange: onCurrentKeyChange }),\n });\n const previousIndex = useRef<number | null>(null);\n const host = useRef<HTMLDivElement | null>(null);\n const lastFocused = useRef<HTMLElement | null>(null);\n // A host can delete the current uncontrolled slide after mount. Keep its place\n // in the collection (or the new last slide); explicit invalid keys still fail validation.\n const recovering = currentKey === undefined && previousIndex.current !== null && !slides.some(slide => slide.id === storedCurrent);\n const current = recovering ? slides[Math.min(previousIndex.current!, slides.length - 1)]?.id ?? storedCurrent : storedCurrent;\n useLayoutEffect(() => {\n previousIndex.current = slides.findIndex(slide => slide.id === current);\n if (recovering) {\n setCurrent(current);\n // A removed dot/card can strand focus on body; retained controls keep their focus.\n if (lastFocused.current && !lastFocused.current.isConnected && document.activeElement === document.body) {\n host.current?.querySelector<HTMLButtonElement>('.hjm-carousel__dot[data-current=\"true\"]')?.focus();\n }\n }\n }, [current, recovering, slides, setCurrent]);\n const descriptor = { slides, currentKey: current, ...(autoplay ? { autoplay } : {}) };\n const resolved = resolveCarouselDescriptor(descriptor, { composeAccessibleName });\n if (!label.trim() || Object.values(labels).some((value) => !value.trim())) throw new TypeError(\"Carousel labels must not be empty\");\n if (slideMaxHeight !== undefined && (!Number.isFinite(slideMaxHeight) || slideMaxHeight <= 0)) throw new TypeError(\"Carousel slideMaxHeight must be finite and positive\");\n const [rotating, setRotating] = useState(autoplay !== undefined);\n const [hovered, setHovered] = useState(false);\n const [hidden, setHidden] = useState(false);\n const pointerRotation = useRef<boolean | null>(null);\n const last = current === slides.at(-1)!.id;\n const playing = isCarouselAutoplayActive(autoplay, {\n reducedMotion: theme?.environment.reducedMotion ?? false,\n paused: !rotating || hovered || hidden || last,\n });\n useEffect(() => {\n const update = () => setHidden(document.hidden);\n update(); document.addEventListener(\"visibilitychange\", update);\n return () => document.removeEventListener(\"visibilitychange\", update);\n }, []);\n useEffect(() => {\n if (!playing || !autoplay) return;\n const timer = setTimeout(() => setCurrent(getCarouselNavigationTarget(descriptor, \"next\")), autoplay.intervalMs);\n return () => clearTimeout(timer);\n }, [playing, autoplay?.intervalMs, current, slides, setCurrent]);\n function select(key: string) { setRotating(false); if (key !== current) setCurrent(key); }\n function move(intent: \"next\" | \"previous\") { select(getCarouselNavigationTarget(descriptor, intent)); }\n const rotationRequested = rotating && !last && !theme?.environment.reducedMotion;\n return <div {...props} style={{ ...props.style, ...layoutStyle }} ref={node => { host.current = node; assignRef(ref, node); }} role=\"region\" aria-label={label} aria-roledescription=\"carousel\"\n className={classNames(\"hjm-carousel\", className)} data-large-text={isLargeTextScale(theme?.environment.textScale ?? 1)}\n onFocusCapture={(event) => {\n lastFocused.current = event.target instanceof HTMLElement ? event.target : null;\n // APG: leaving focus must not silently restart rotation. Explicit resume is required.\n if (!event.currentTarget.contains(event.relatedTarget)) setRotating(false);\n onFocusCapture?.(event);\n }}\n onMouseEnter={(event) => { setHovered(true); onMouseEnter?.(event); }}\n onMouseLeave={(event) => { setHovered(false); onMouseLeave?.(event); }}\n onKeyDown={(event) => {\n onKeyDown?.(event);\n if (event.defaultPrevented || event.altKey || event.ctrlKey || event.metaKey) return;\n // Do not steal editing/navigation keys from links, inputs or widgets inside a card.\n if (!(event.target instanceof Element) || !event.target.closest(\"[data-carousel-controls]\")) return;\n if (event.key !== \"ArrowLeft\" && event.key !== \"ArrowRight\") return;\n event.preventDefault();\n move((event.key === \"ArrowRight\") !== (theme?.environment.direction === \"rtl\") ? \"next\" : \"previous\");\n }}>\n {autoplay ? <Button tone=\"ghost\" className=\"hjm-carousel__rotation\" disabled={theme?.environment.reducedMotion}\n onPointerDown={() => { pointerRotation.current = !rotationRequested; }}\n onPointerCancel={() => { pointerRotation.current = null; }}\n onClick={(event) => {\n // An abandoned pointer gesture must not override a later keyboard activation.\n const next = event.detail > 0 ? pointerRotation.current ?? !rotationRequested : !rotationRequested;\n pointerRotation.current = null;\n if (next && last) setCurrent(slides[0]!.id);\n setRotating(next);\n }}>{rotationRequested ? labels.pause : labels.resume}</Button> : null}\n <div className=\"hjm-carousel__track\" aria-live={playing ? \"off\" : \"polite\"} aria-atomic={false}>\n {resolved.map((slide) => <div key={slide.id} className=\"hjm-carousel__slide\" role=\"group\"\n aria-roledescription=\"slide\" aria-label={slide.accessibleName} hidden={slide.inert} inert={slide.inert}\n tabIndex={slideMaxHeight === undefined ? undefined : 0}\n style={slideMaxHeight === undefined ? undefined : { maxHeight: slideMaxHeight, overflowY: \"auto\" }}>\n {renderSlide(slide)}\n </div>)}\n </div>\n <div className=\"hjm-carousel__controls\" data-carousel-controls role=\"group\" aria-label={labels.navigation}>\n {/* Previous/next are tool actions: icon buttons named by the localized label (2026-10-17 review E9). */}\n <IconButton label={labels.previous} tone=\"ghost\" aria-disabled={current === slides[0]!.id} onClick={() => move(\"previous\")}><Icon name=\"chevronStart\" /></IconButton>\n <div className=\"hjm-carousel__dots\">\n <PageDots dotClassName=\"hjm-carousel__dot\" keys={slides.map((slide) => slide.id)} onSelect={(index) => select(slides[index]!.id)}\n dots={resolvePageIndicator({ count: slides.length, currentIndex: resolved.findIndex((slide) => slide.current) },\n ({ position }) => resolved[position - 1]!.accessibleName)} />\n </div>\n <IconButton label={labels.next} tone=\"ghost\" aria-disabled={last} onClick={() => move(\"next\")}><Icon name=\"chevronEnd\" /></IconButton>\n </div>\n </div>;\n});\n"]}
|
package/dist/clipboard.d.ts
CHANGED
|
@@ -18,7 +18,7 @@ export type ClipboardButtonProps = Omit<ButtonProps, "children" | "onClick" | "o
|
|
|
18
18
|
* The last one is the part that was always missing — a label that only changes
|
|
19
19
|
* visually tells a non-sighted user nothing happened.
|
|
20
20
|
*/
|
|
21
|
-
export declare const ClipboardButton: import("react").ForwardRefExoticComponent<Omit<ButtonProps, "children" | "
|
|
21
|
+
export declare const ClipboardButton: import("react").ForwardRefExoticComponent<Omit<ButtonProps, "children" | "onClick" | "onCopy"> & Readonly<{
|
|
22
22
|
value: string;
|
|
23
23
|
/** Localized copy for both states; the renderer invents neither. */
|
|
24
24
|
labels: Readonly<{
|
|
@@ -45,7 +45,7 @@ export type ClipboardIconButtonProps = Omit<IconButtonProps, "children" | "label
|
|
|
45
45
|
* Copy as a tool action (a code block or share-link header): an icon button named by the localized label, copy → check
|
|
46
46
|
* while the copied state lasts. A bordered text button there read as a form action (2026-10-17 review E10).
|
|
47
47
|
*/
|
|
48
|
-
export declare const ClipboardIconButton: import("react").ForwardRefExoticComponent<Omit<IconButtonProps, "
|
|
48
|
+
export declare const ClipboardIconButton: import("react").ForwardRefExoticComponent<Omit<IconButtonProps, "children" | "label" | "onClick" | "onCopy" | "selected"> & Readonly<{
|
|
49
49
|
value: string;
|
|
50
50
|
/** Localized accessible names for both states; the icon carries no visible text. */
|
|
51
51
|
labels: Readonly<{
|
package/dist/color-picker.d.ts
CHANGED
|
@@ -1,9 +1,13 @@
|
|
|
1
1
|
import type { HjmCompositionStyleProp } from "./composition-style.js";
|
|
2
2
|
export type ColorPickerLabels = Readonly<{
|
|
3
|
-
color: string;
|
|
4
3
|
hex: string;
|
|
4
|
+
hue: string;
|
|
5
|
+
saturation: string;
|
|
6
|
+
brightness: string;
|
|
5
7
|
opacity: string;
|
|
6
8
|
invalid: string;
|
|
9
|
+
/** Group name of the preset swatches; required when `presets` is not empty. */
|
|
10
|
+
presets?: string;
|
|
7
11
|
}>;
|
|
8
12
|
export type ColorPickerProps = Readonly<{
|
|
9
13
|
label: string;
|
|
@@ -13,9 +17,35 @@ export type ColorPickerProps = Readonly<{
|
|
|
13
17
|
alpha?: boolean;
|
|
14
18
|
disabled?: boolean;
|
|
15
19
|
presets?: readonly string[];
|
|
20
|
+
/** Accessible name of a preset swatch. Defaults to its HEX code; products pass a localized colour name when they have one. */
|
|
21
|
+
getPresetLabel?: (color: string) => string;
|
|
16
22
|
/** Canonical layout-only placement on the root `<fieldset>`. Controlled visual keys are excluded. */
|
|
17
23
|
layoutStyle?: HjmCompositionStyleProp;
|
|
18
24
|
}>;
|
|
19
|
-
/**
|
|
20
|
-
|
|
25
|
+
/**
|
|
26
|
+
* Controlled sRGB HEX value edited as HSV: a saturation/brightness area, a hue bar, an optional opacity bar, HEX text
|
|
27
|
+
* and preset swatches. Invalid text stays local until corrected or escaped.
|
|
28
|
+
*/
|
|
29
|
+
export declare function ColorPicker({ label, labels, value, onValueChange, alpha, disabled, presets, getPresetLabel, layoutStyle }: ColorPickerProps): import("react").JSX.Element;
|
|
30
|
+
export type ColorSwatchPickerProps = Readonly<{
|
|
31
|
+
/** Group name. Visible by default; `labelVisibility="hidden"` keeps it for assistive technology only. */
|
|
32
|
+
label: string;
|
|
33
|
+
colors: readonly string[];
|
|
34
|
+
/** Selected colour, or `null` when the current colour is not one of the swatches. */
|
|
35
|
+
value: string | null;
|
|
36
|
+
onValueChange: (value: string) => void;
|
|
37
|
+
alpha?: boolean;
|
|
38
|
+
disabled?: boolean;
|
|
39
|
+
/** Accessible name of a swatch. Defaults to its HEX code. */
|
|
40
|
+
getColorLabel?: (color: string) => string;
|
|
41
|
+
/** `wrap` (default) flows into rows; `scroll` keeps one horizontally scrolling row for toolbars. */
|
|
42
|
+
layout?: "wrap" | "scroll";
|
|
43
|
+
labelVisibility?: "visible" | "hidden";
|
|
44
|
+
layoutStyle?: HjmCompositionStyleProp;
|
|
45
|
+
}>;
|
|
46
|
+
/**
|
|
47
|
+
* A single choice among colour swatches with native radio semantics (arrow keys move the selection). Shared by
|
|
48
|
+
* ColorPicker presets and quick colour rows such as a drawing toolbar, so products do not rebuild swatch buttons.
|
|
49
|
+
*/
|
|
50
|
+
export declare function ColorSwatchPicker({ label, colors, value, onValueChange, alpha, disabled, getColorLabel, layout, labelVisibility, layoutStyle }: ColorSwatchPickerProps): import("react").JSX.Element;
|
|
21
51
|
//# sourceMappingURL=color-picker.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"color-picker.d.ts","sourceRoot":"","sources":["../src/color-picker.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,wBAAwB,CAAC;
|
|
1
|
+
{"version":3,"file":"color-picker.d.ts","sourceRoot":"","sources":["../src/color-picker.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,wBAAwB,CAAC;AAMtE,MAAM,MAAM,iBAAiB,GAAG,QAAQ,CAAC;IACvC,GAAG,EAAE,MAAM,CAAC;IAAC,GAAG,EAAE,MAAM,CAAC;IAAC,UAAU,EAAE,MAAM,CAAC;IAAC,UAAU,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAC;IACnG,+EAA+E;IAC/E,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB,CAAC,CAAC;AACH,MAAM,MAAM,gBAAgB,GAAG,QAAQ,CAAC;IACtC,KAAK,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,iBAAiB,CAAC;IAAC,KAAK,EAAE,MAAM,CAAC;IAAC,aAAa,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IAChG,KAAK,CAAC,EAAE,OAAO,CAAC;IAAC,QAAQ,CAAC,EAAE,OAAO,CAAC;IAAC,OAAO,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IACjE,8HAA8H;IAC9H,cAAc,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,MAAM,CAAC;IAC3C,qGAAqG;IACrG,WAAW,CAAC,EA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