@godxjp/ui 28.7.0 → 28.8.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/components/data-display/index.d.ts +2 -0
- package/dist/components/data-display/index.js +2 -0
- package/dist/components/data-display/marquee.d.ts +16 -0
- package/dist/components/data-display/marquee.js +155 -0
- package/dist/components/general/reveal.d.ts +23 -2
- package/dist/components/general/reveal.js +37 -7
- package/dist/components/general/typography.d.ts +4 -1
- package/dist/components/general/typography.js +14 -1
- package/dist/components/layout/affix.d.ts +86 -0
- package/dist/components/layout/affix.js +187 -0
- package/dist/components/layout/index.d.ts +4 -0
- package/dist/components/layout/index.js +4 -0
- package/dist/components/layout/legal-document-shell.js +4 -3
- package/dist/components/layout/masonry.d.ts +74 -0
- package/dist/components/layout/masonry.js +214 -0
- package/dist/components/layout/page-container.js +5 -20
- package/dist/components/navigation/anchor.d.ts +64 -0
- package/dist/components/navigation/anchor.js +284 -0
- package/dist/components/navigation/index.d.ts +4 -0
- package/dist/components/navigation/index.js +4 -0
- package/dist/components/navigation/mega-menu.d.ts +21 -0
- package/dist/components/navigation/mega-menu.js +526 -0
- package/dist/contracts/measurement.json +1 -1
- package/dist/i18n/messages/en.json +517 -0
- package/dist/i18n/messages/ja.json +513 -0
- package/dist/i18n/messages/vi.json +513 -0
- package/dist/lib/hooks.d.ts +68 -0
- package/dist/lib/hooks.js +52 -0
- package/dist/lib/platform.d.ts +14 -0
- package/dist/lib/platform.js +10 -1
- package/dist/lib/utils.d.ts +1 -1
- package/dist/lib/utils.js +3 -2
- package/dist/props/components/data-display.prop.d.ts +95 -1
- package/dist/props/components/general.prop.d.ts +47 -3
- package/dist/props/components/layout.prop.d.ts +194 -0
- package/dist/props/components/navigation.prop.d.ts +263 -0
- package/dist/props/registry.d.ts +359 -4
- package/dist/props/registry.js +472 -3
- package/dist/props/vocabulary/index.d.ts +1 -1
- package/dist/props/vocabulary/interaction.prop.d.ts +39 -2
- package/dist/styles/control.css +5 -6
- package/dist/styles/data-display-layout.css +2 -1
- package/dist/styles/density.css +4 -0
- package/dist/styles/layout.css +79 -0
- package/dist/styles/motion.css +121 -1
- package/dist/styles/navigation-layout.css +397 -1
- package/dist/styles/shell-layout.css +3 -0
- package/dist/styles/text-layout.css +52 -4
- package/dist/tokens/base.css +5 -0
- package/dist/tokens/components/affix.css +7 -0
- package/dist/tokens/components/anchor.css +17 -0
- package/dist/tokens/components/control.css +3 -3
- package/dist/tokens/components/form.css +1 -1
- package/dist/tokens/components/marquee.css +7 -0
- package/dist/tokens/components/masonry.css +6 -0
- package/dist/tokens/components/mega-menu.css +62 -0
- package/dist/tokens/components/shell.css +3 -0
- package/dist/tokens/foundation.css +11 -0
- package/dist/tokens/semantic/layout.css +7 -0
- package/docs/COMPOSITION-VS-COMPONENT.md +19 -1
- package/docs/DESIGN-AUTHORITY.md +99 -18
- package/docs/FRAME-COVERAGE-REPORT.md +7 -2
- package/docs/data-display/marquee.tsx +254 -0
- package/docs/foundation/_theme-editor-scope.ts +222 -0
- package/docs/foundation/density.tsx +12 -2
- package/docs/foundation/spacing.tsx +5 -0
- package/docs/foundation/theme-editor.tsx +645 -0
- package/docs/general/activity.tsx +65 -0
- package/docs/general/reveal.tsx +290 -22
- package/docs/general/typography.tsx +91 -1
- package/docs/layout/affix.tsx +209 -0
- package/docs/layout/masonry.tsx +291 -0
- package/docs/navigation/anchor.tsx +285 -0
- package/docs/navigation/mega-menu-panel.tsx +86 -0
- package/docs/navigation/mega-menu.tsx +254 -0
- package/docs/roadmap/website-components.md +779 -0
- package/docs/showcase/acme-website.tsx +75 -39
- package/docs/showcase/futurelastic-web.tsx +91 -49
- package/docs/showcase/marketing-page.tsx +885 -0
- package/docs/showcase/table-footer-totals.tsx +12 -2
- package/docs/showcase/theme-customization.tsx +1259 -0
- package/package.json +5 -3
- package/scripts/brand-accent.generated.mjs +27 -0
- package/scripts/ui-audit.mjs +66 -0
- package/scripts/visual-audit-rules.mjs +46 -2
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
/** Navigation component prop types — @see docs/COMPONENTS.md#navigation */
|
|
2
2
|
import type * as React from "react";
|
|
3
|
+
import type { ReactNode } from "react";
|
|
4
|
+
import type { AffixProp } from "./layout.prop.js";
|
|
3
5
|
import type { ActionsProp, ChildrenProp, ClassNameProp, DisabledProp, ErrorProp, HasActiveFiltersProp, IdProp, LabelProp, OnClearFiltersProp, PendingProp, PlaceholderProp, StickyProp, TextAlignProp } from "../vocabulary/index.js";
|
|
4
6
|
import type { SearchSelectOptionProp } from "./data-entry.prop.js";
|
|
5
7
|
/**
|
|
@@ -666,3 +668,264 @@ export type ConversationsProp = {
|
|
|
666
668
|
id?: IdProp;
|
|
667
669
|
className?: ClassNameProp;
|
|
668
670
|
};
|
|
671
|
+
/**
|
|
672
|
+
* Which pointer action opens a panel. Ant Design `triggerSubMenuAction`, minus antd's third
|
|
673
|
+
* value: `contextMenu` is a Dropdown affordance, and a right-click that opened a site nav panel
|
|
674
|
+
* would shadow the browser's own menu.
|
|
675
|
+
*
|
|
676
|
+
* `click` is the default here where antd defaults to `hover`, and that is the WCAG 2.2 call, not
|
|
677
|
+
* a taste one: a hover-only trigger has no equivalent on a touch screen. `hover` remains
|
|
678
|
+
* available and still accepts click - see `MegaMenuProp.triggerAction`.
|
|
679
|
+
*/
|
|
680
|
+
export type MegaMenuTriggerActionProp = "click" | "hover";
|
|
681
|
+
/** One link inside a panel group. A leaf: it navigates, it never opens anything. */
|
|
682
|
+
export type MegaMenuLinkProp = {
|
|
683
|
+
/** Stable identity. Ant Design `MenuItemType.key`. */
|
|
684
|
+
key: string;
|
|
685
|
+
/** Ant Design `MenuItemType.label`. */
|
|
686
|
+
label: React.ReactNode;
|
|
687
|
+
/** Destination. Omit it and the row reports through `onValueChange` instead (SPA visit). */
|
|
688
|
+
href?: string;
|
|
689
|
+
/** A line under the label. Ant Design `MenuItemType.extra`, given the shape a nav panel uses. */
|
|
690
|
+
description?: React.ReactNode;
|
|
691
|
+
/** Ant Design `MenuItemType.icon`. Decorative - the label is the accessible name. */
|
|
692
|
+
icon?: React.ReactNode;
|
|
693
|
+
/** Ant Design `MenuItemType.disabled`. */
|
|
694
|
+
disabled?: DisabledProp;
|
|
695
|
+
};
|
|
696
|
+
/**
|
|
697
|
+
* One column of a panel. Ant Design `MenuItemGroupType` (`type: "group"`), which is exactly this:
|
|
698
|
+
* a labelled cluster of items that is itself not interactive.
|
|
699
|
+
*/
|
|
700
|
+
export type MegaMenuGroupProp = {
|
|
701
|
+
key: string;
|
|
702
|
+
/** Ant Design `MenuItemGroupType.label`. Omit for a bare column of links with no heading. */
|
|
703
|
+
label?: LabelProp;
|
|
704
|
+
/** A sentence under the group heading. No antd equivalent - antd groups carry a label only. */
|
|
705
|
+
description?: React.ReactNode;
|
|
706
|
+
/** Decorative glyph beside the group heading. */
|
|
707
|
+
icon?: React.ReactNode;
|
|
708
|
+
/** Ant Design `MenuItemGroupType.children`, narrowed to leaves: a panel is one level deep. */
|
|
709
|
+
links: readonly MegaMenuLinkProp[];
|
|
710
|
+
};
|
|
711
|
+
/** The disclosure panel behind one top-level item. Ant Design `SubMenuType.children`. */
|
|
712
|
+
export type MegaMenuPanelProp = {
|
|
713
|
+
/** The columns. Ant Design `SubMenuType.children` restricted to `type: "group"` entries. */
|
|
714
|
+
groups: readonly MegaMenuGroupProp[];
|
|
715
|
+
/** A full-width strip below the columns - a promo, a "see all", a support line. */
|
|
716
|
+
footer?: React.ReactNode;
|
|
717
|
+
};
|
|
718
|
+
/**
|
|
719
|
+
* One top-level bar item. With a `panel` it is a DISCLOSURE BUTTON (Ant Design `SubMenuType`);
|
|
720
|
+
* without one it is a plain link (Ant Design `MenuItemType`) - the "Top-Level Links" half of the
|
|
721
|
+
* APG pattern this implements.
|
|
722
|
+
*/
|
|
723
|
+
export type MegaMenuItemProp = {
|
|
724
|
+
key: string;
|
|
725
|
+
label: React.ReactNode;
|
|
726
|
+
/** Only meaningful without a `panel`: a disclosure button is not a link. */
|
|
727
|
+
href?: string;
|
|
728
|
+
icon?: React.ReactNode;
|
|
729
|
+
disabled?: DisabledProp;
|
|
730
|
+
panel?: MegaMenuPanelProp;
|
|
731
|
+
};
|
|
732
|
+
/**
|
|
733
|
+
* Router link component, same contract as `Sidebar.linkComponent`: it receives `href` plus the
|
|
734
|
+
* row's state props and children, and renders exactly one `<a>`.
|
|
735
|
+
*/
|
|
736
|
+
export type MegaMenuLinkComponentProp = React.ComponentType<React.AnchorHTMLAttributes<HTMLAnchorElement> & {
|
|
737
|
+
href?: string;
|
|
738
|
+
}>;
|
|
739
|
+
/**
|
|
740
|
+
* MegaMenu - a primary site navigation whose top-level items disclose a full-width panel of
|
|
741
|
+
* grouped links.
|
|
742
|
+
*
|
|
743
|
+
* Implements WAI-ARIA APG **Disclosure Navigation with Top-Level Links**, NOT Menubar. A site nav
|
|
744
|
+
* is a set of LINKS to places, not a menu of commands, and `role="menu"` promises assistive
|
|
745
|
+
* technology a command widget it will then navigate as one. That is the classic megamenu a11y
|
|
746
|
+
* error, and it is also why this cannot be `DropdownMenu` + a token: `DropdownMenu` is
|
|
747
|
+
* react-aria-components `Menu`, i.e. `role="menu"` / `role="menuitem"` by construction.
|
|
748
|
+
*/
|
|
749
|
+
export type MegaMenuProp = {
|
|
750
|
+
/** The bar. Ant Design `items`. */
|
|
751
|
+
items: readonly MegaMenuItemProp[];
|
|
752
|
+
/** Key of the open panel, or `null` for none. Ant Design `openKeys`, collapsed to one level. */
|
|
753
|
+
open?: string | null;
|
|
754
|
+
/** Initial uncontrolled open panel. Ant Design `defaultOpenKeys`, collapsed to one level. */
|
|
755
|
+
defaultOpen?: string | null;
|
|
756
|
+
/** Fires with the newly open panel's key, or `null` when everything closed. Ant `onOpenChange`. */
|
|
757
|
+
onOpenChange?: (key: string | null) => void;
|
|
758
|
+
/** Key of the item for the CURRENT ROUTE - renders `aria-current="page"`. Ant `selectedKeys`. */
|
|
759
|
+
value?: string;
|
|
760
|
+
/** Uncontrolled initial current route. Ant Design `defaultSelectedKeys`. */
|
|
761
|
+
defaultValue?: string;
|
|
762
|
+
/**
|
|
763
|
+
* Fires with the activated key (a top-level link, or a panel link). Ant Design `onClick`.
|
|
764
|
+
* Activation always closes the open panel - the "close on route change" half of the contract
|
|
765
|
+
* that does not need a router.
|
|
766
|
+
*/
|
|
767
|
+
onValueChange?: (key: string) => void;
|
|
768
|
+
/** Bar density. The trigger box tracks the matching `--control-height` tier. */
|
|
769
|
+
size?: "xs" | "sm" | "md" | "lg";
|
|
770
|
+
/** Ant Design `triggerSubMenuAction`. `hover` also accepts click, so touch is never stranded. */
|
|
771
|
+
triggerAction?: MegaMenuTriggerActionProp;
|
|
772
|
+
/** Ant Design `subMenuOpenDelay`, in MILLISECONDS (antd uses seconds). `hover` only. */
|
|
773
|
+
openDelay?: number;
|
|
774
|
+
/**
|
|
775
|
+
* Ant Design `subMenuCloseDelay`, in MILLISECONDS. This is the hover-intent grace period: the
|
|
776
|
+
* pointer may leave the bar entirely for this long - crossing a diagonal toward the panel -
|
|
777
|
+
* before anything closes. `hover` only.
|
|
778
|
+
*/
|
|
779
|
+
closeDelay?: number;
|
|
780
|
+
/** Accessible name of the `<nav>` landmark. A plain string: it lands on `aria-label`. */
|
|
781
|
+
label?: string;
|
|
782
|
+
/** Ant Design `expandIcon`. `false` removes the chevron; a node replaces it. */
|
|
783
|
+
expandIcon?: React.ReactNode | false;
|
|
784
|
+
/** Router link component for every `href` in the bar and the panels. */
|
|
785
|
+
linkComponent?: MegaMenuLinkComponentProp;
|
|
786
|
+
id?: IdProp;
|
|
787
|
+
className?: ClassNameProp;
|
|
788
|
+
} & Omit<React.HTMLAttributes<HTMLElement>, "onChange" | "defaultValue" | "children">;
|
|
789
|
+
/**
|
|
790
|
+
* One entry of `Anchor items` — Ant Design `AnchorItem`, field for field.
|
|
791
|
+
*
|
|
792
|
+
* `key` / `href` / `title` / `target` / `children` are antd's, with the same meanings; antd's
|
|
793
|
+
* per-link `targetOffset` (6.4.0) is here under the logical name the component-level prop uses.
|
|
794
|
+
* @see Anchor
|
|
795
|
+
*/
|
|
796
|
+
export type AnchorItemProp = {
|
|
797
|
+
/** Stable identity of the link. Ant Design `AnchorItem.key`. */
|
|
798
|
+
key: React.Key;
|
|
799
|
+
/** The in-page fragment this entry points at — `"#pricing"`. Ant Design `AnchorItem.href`. */
|
|
800
|
+
href: string;
|
|
801
|
+
/** The link's visible content. Ant Design `AnchorItem.title`. */
|
|
802
|
+
title: ReactNode;
|
|
803
|
+
/** `<a target>` — for the rare entry that points off-page. Ant Design `AnchorItem.target`. */
|
|
804
|
+
target?: string;
|
|
805
|
+
/**
|
|
806
|
+
* ONE level of nesting, exactly as Ant Design allows, and — again exactly as Ant Design — it is
|
|
807
|
+
* DROPPED when `direction="horizontal"`, where a nested list has nowhere to go. A horizontal
|
|
808
|
+
* anchor carrying `children` warns in development rather than rendering a second row.
|
|
809
|
+
*/
|
|
810
|
+
children?: AnchorItemProp[];
|
|
811
|
+
/**
|
|
812
|
+
* Replace this entry's `href` in history instead of pushing it. Ant Design `AnchorItem.replace`,
|
|
813
|
+
* default `false`, and it overrides the component-level `replace`.
|
|
814
|
+
*/
|
|
815
|
+
replace?: boolean;
|
|
816
|
+
/**
|
|
817
|
+
* Scroll landing offset for THIS entry, overriding the component's `targetOffsetBlockStart`.
|
|
818
|
+
* Ant Design `AnchorItem.targetOffset` (6.4.0), renamed to its logical axis for the reason
|
|
819
|
+
* `AffixProp.offsetBlockStart` states.
|
|
820
|
+
*/
|
|
821
|
+
targetOffsetBlockStart?: number;
|
|
822
|
+
};
|
|
823
|
+
/** The scroll box an `Anchor` measures its sections in. Ant Design `AnchorContainer`. @see Anchor */
|
|
824
|
+
export type AnchorContainerProp = HTMLElement | Window;
|
|
825
|
+
/**
|
|
826
|
+
* `Anchor`'s own layout axis — Ant Design `direction`, and the word `Separator` / `Flex` /
|
|
827
|
+
* `Toolbar` already use for the same idea here, so antd's spelling and this library's agree.
|
|
828
|
+
* @see Anchor
|
|
829
|
+
*/
|
|
830
|
+
export type AnchorDirectionProp = "vertical" | "horizontal";
|
|
831
|
+
/**
|
|
832
|
+
* @see Anchor — Ant Design's `Anchor`: the in-page section navigation, and the thing that COMPUTES
|
|
833
|
+
* which section is current. `NavList activeId` takes that answer as a prop; nothing else in this
|
|
834
|
+
* library works it out.
|
|
835
|
+
*
|
|
836
|
+
* antd's surface, ported first: `items`, `direction`, `affix`, `bounds`, `getContainer`,
|
|
837
|
+
* `getCurrentAnchor`, `offsetTop`, `targetOffset`, `showInkInFixed`, `replace`, `onChange`,
|
|
838
|
+
* `onClick`. Three renames, each written at its field: the two physical offsets take their
|
|
839
|
+
* logical axis, and antd's `onChange` becomes `onValueChange` because the active href here IS a
|
|
840
|
+
* controlled value (`value` / `defaultValue` / `onValueChange`), which antd has no spelling for
|
|
841
|
+
* at all. All three antd names stay findable — declared `never`, `@deprecated` with the
|
|
842
|
+
* replacement named, and warned about in development.
|
|
843
|
+
*/
|
|
844
|
+
export type AnchorProp = {
|
|
845
|
+
/** The entries, in document order. Ant Design `items`. */
|
|
846
|
+
items?: AnchorItemProp[];
|
|
847
|
+
/** Layout axis. Ant Design `direction`, default `"vertical"`. */
|
|
848
|
+
direction?: AnchorDirectionProp;
|
|
849
|
+
/**
|
|
850
|
+
* Pin the nav with `Affix`. Ant Design `affix`, default `true`, and antd's object form is
|
|
851
|
+
* literally `AffixProps` minus the three fields `Anchor` supplies itself — which is why gh#827
|
|
852
|
+
* lands before gh#828.
|
|
853
|
+
*
|
|
854
|
+
* `false` leaves the nav in the flow. An object is forwarded to `Affix`; `offsetBlockStart`,
|
|
855
|
+
* `target` and `children` come from `Anchor` and are not yours to set there.
|
|
856
|
+
*/
|
|
857
|
+
affix?: boolean | Omit<AffixProp, "offsetBlockStart" | "offsetTop" | "target" | "children">;
|
|
858
|
+
/** Tolerance, in pixels, added to the decision line. Ant Design `bounds`, default `5`. */
|
|
859
|
+
bounds?: number;
|
|
860
|
+
/** The scroll box holding the sections. Ant Design `getContainer`, default `() => window`. */
|
|
861
|
+
getContainer?: () => AnchorContainerProp;
|
|
862
|
+
/**
|
|
863
|
+
* Last word on the highlight, given the one the scroll position resolved. Ant Design
|
|
864
|
+
* `getCurrentAnchor`, kept because it is antd's own escape hatch and it runs INSIDE the
|
|
865
|
+
* resolution, with no render round-trip. A controlled `value` outranks it.
|
|
866
|
+
*/
|
|
867
|
+
getCurrentAnchor?: (activeLink: string) => string;
|
|
868
|
+
/**
|
|
869
|
+
* Where the decision line sits, measured from the scrollport's block-start edge, and the
|
|
870
|
+
* distance `Affix` pins the nav at. Ant Design `offsetTop`, default `0`; renamed to its logical
|
|
871
|
+
* axis for the reason `AffixProp.offsetBlockStart` states.
|
|
872
|
+
*/
|
|
873
|
+
offsetBlockStart?: number;
|
|
874
|
+
/**
|
|
875
|
+
* Where a CLICKED section lands, measured from the scrollport's block-start edge — the room a
|
|
876
|
+
* pinned header needs. Ant Design `targetOffset`, which defaults to `offsetTop`; same default
|
|
877
|
+
* here, against `offsetBlockStart`.
|
|
878
|
+
*
|
|
879
|
+
* antd uses `targetOffset` for the decision line too whenever it is a number, and that is
|
|
880
|
+
* ported: the line a section becomes current at and the line it lands on are the same line, so
|
|
881
|
+
* a click cannot leave the item it just selected unselected.
|
|
882
|
+
*/
|
|
883
|
+
targetOffsetBlockStart?: number;
|
|
884
|
+
/** Draw the ink rail when `affix={false}`. Ant Design `showInkInFixed`, default `false`. */
|
|
885
|
+
showInkInFixed?: boolean;
|
|
886
|
+
/** Replace the hash in history instead of pushing it. Ant Design `replace`, default `false`. */
|
|
887
|
+
replace?: boolean;
|
|
888
|
+
/** Controlled active `href` (the entry carrying `aria-current="location"`). */
|
|
889
|
+
value?: string;
|
|
890
|
+
/** Uncontrolled initial active `href`, before the hash or the scroll position has an opinion. */
|
|
891
|
+
defaultValue?: string;
|
|
892
|
+
/**
|
|
893
|
+
* Fires when the active entry changes — from a click, from the landing hash, and from the
|
|
894
|
+
* scroll position. Ant Design calls this `onChange`; the pair `value`/`defaultValue` makes this
|
|
895
|
+
* the setter half of a controlled value, and the triad's name for that here is `onValueChange`.
|
|
896
|
+
*
|
|
897
|
+
* antd's own note is ported with it: the callback reports the link the SCROLL POSITION resolved,
|
|
898
|
+
* not the one `getCurrentAnchor` substituted for it.
|
|
899
|
+
*/
|
|
900
|
+
onValueChange?: (href: string) => void;
|
|
901
|
+
/**
|
|
902
|
+
* NOT A PROP — Ant Design's name for `onValueChange`.
|
|
903
|
+
*
|
|
904
|
+
* @deprecated Ant Design spells this `onChange`; in `@godxjp/ui` the active href is a controlled
|
|
905
|
+
* value, so it is `onValueChange`, beside `value` and `defaultValue`.
|
|
906
|
+
*/
|
|
907
|
+
onChange?: never;
|
|
908
|
+
/**
|
|
909
|
+
* NOT A PROP — Ant Design's name for `offsetBlockStart`.
|
|
910
|
+
*
|
|
911
|
+
* @deprecated Ant Design spells this `offsetTop`; in `@godxjp/ui` it is `offsetBlockStart`.
|
|
912
|
+
*/
|
|
913
|
+
offsetTop?: never;
|
|
914
|
+
/**
|
|
915
|
+
* NOT A PROP — Ant Design's name for `targetOffsetBlockStart`.
|
|
916
|
+
*
|
|
917
|
+
* @deprecated Ant Design spells this `targetOffset`; in `@godxjp/ui` it is
|
|
918
|
+
* `targetOffsetBlockStart`.
|
|
919
|
+
*/
|
|
920
|
+
targetOffset?: never;
|
|
921
|
+
/** Fires on activation, before the scroll. Ant Design `onClick`. */
|
|
922
|
+
onClick?: (event: React.MouseEvent<HTMLAnchorElement>, item: AnchorItemProp) => void;
|
|
923
|
+
/**
|
|
924
|
+
* Accessible name of the `<nav>` landmark — a plain STRING, because it lands on `aria-label`.
|
|
925
|
+
* antd has no equivalent and ships an unnamed `<div>`; a page routinely carries a breadcrumb, a
|
|
926
|
+
* rail and this, so a localized default ("On this page") applies when omitted.
|
|
927
|
+
*/
|
|
928
|
+
label?: string;
|
|
929
|
+
id?: IdProp;
|
|
930
|
+
className?: ClassNameProp;
|
|
931
|
+
};
|