@godxjp/ui 28.7.0 → 28.9.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.
Files changed (119) hide show
  1. package/dist/components/data-display/index.d.ts +2 -0
  2. package/dist/components/data-display/index.js +2 -0
  3. package/dist/components/data-display/marquee.d.ts +16 -0
  4. package/dist/components/data-display/marquee.js +155 -0
  5. package/dist/components/general/reveal.d.ts +23 -2
  6. package/dist/components/general/reveal.js +37 -7
  7. package/dist/components/general/typography.d.ts +4 -1
  8. package/dist/components/general/typography.js +14 -1
  9. package/dist/components/layout/affix.d.ts +86 -0
  10. package/dist/components/layout/affix.js +187 -0
  11. package/dist/components/layout/index.d.ts +4 -0
  12. package/dist/components/layout/index.js +4 -0
  13. package/dist/components/layout/legal-document-shell.js +4 -3
  14. package/dist/components/layout/masonry.d.ts +74 -0
  15. package/dist/components/layout/masonry.js +214 -0
  16. package/dist/components/layout/page-container.js +5 -20
  17. package/dist/components/navigation/anchor.d.ts +64 -0
  18. package/dist/components/navigation/anchor.js +284 -0
  19. package/dist/components/navigation/index.d.ts +4 -0
  20. package/dist/components/navigation/index.js +4 -0
  21. package/dist/components/navigation/mega-menu.d.ts +21 -0
  22. package/dist/components/navigation/mega-menu.js +526 -0
  23. package/dist/contracts/measurement.json +1 -1
  24. package/dist/i18n/messages/en.json +517 -0
  25. package/dist/i18n/messages/ja.json +513 -0
  26. package/dist/i18n/messages/vi.json +513 -0
  27. package/dist/lib/hooks.d.ts +68 -0
  28. package/dist/lib/hooks.js +52 -0
  29. package/dist/lib/platform.d.ts +14 -0
  30. package/dist/lib/platform.js +10 -1
  31. package/dist/lib/utils.d.ts +1 -1
  32. package/dist/lib/utils.js +3 -2
  33. package/dist/lib/variants.js +4 -1
  34. package/dist/props/components/data-display.prop.d.ts +95 -1
  35. package/dist/props/components/general.prop.d.ts +47 -3
  36. package/dist/props/components/layout.prop.d.ts +194 -0
  37. package/dist/props/components/navigation.prop.d.ts +263 -0
  38. package/dist/props/registry.d.ts +359 -4
  39. package/dist/props/registry.js +472 -3
  40. package/dist/props/vocabulary/index.d.ts +1 -1
  41. package/dist/props/vocabulary/interaction.prop.d.ts +39 -2
  42. package/dist/props/vocabulary/layout.prop.d.ts +1 -1
  43. package/dist/styles/base.css +47 -14
  44. package/dist/styles/card-layout.css +2 -2
  45. package/dist/styles/chart-layout.css +6 -6
  46. package/dist/styles/control.css +15 -10
  47. package/dist/styles/data-display-layout.css +22 -6
  48. package/dist/styles/density.css +6 -0
  49. package/dist/styles/dialog-layout.css +4 -1
  50. package/dist/styles/focus-ring.css +4 -1
  51. package/dist/styles/layout.css +92 -3
  52. package/dist/styles/motion.css +121 -1
  53. package/dist/styles/navigation-layout.css +397 -1
  54. package/dist/styles/shell-layout.css +28 -21
  55. package/dist/styles/text-layout.css +134 -15
  56. package/dist/tokens/base.css +5 -0
  57. package/dist/tokens/components/activity.css +13 -4
  58. package/dist/tokens/components/affix.css +7 -0
  59. package/dist/tokens/components/anchor.css +17 -0
  60. package/dist/tokens/components/attachments.css +1 -1
  61. package/dist/tokens/components/badge.css +1 -1
  62. package/dist/tokens/components/card.css +28 -7
  63. package/dist/tokens/components/chart.css +4 -1
  64. package/dist/tokens/components/chat-composer.css +4 -1
  65. package/dist/tokens/components/control.css +72 -33
  66. package/dist/tokens/components/conversations.css +4 -1
  67. package/dist/tokens/components/data-display.css +42 -15
  68. package/dist/tokens/components/data-entry.css +8 -2
  69. package/dist/tokens/components/descriptions.css +1 -1
  70. package/dist/tokens/components/feedback.css +8 -5
  71. package/dist/tokens/components/float-button.css +8 -2
  72. package/dist/tokens/components/form.css +1 -1
  73. package/dist/tokens/components/legal-document.css +12 -3
  74. package/dist/tokens/components/logo.css +15 -6
  75. package/dist/tokens/components/marquee.css +7 -0
  76. package/dist/tokens/components/masonry.css +6 -0
  77. package/dist/tokens/components/mega-menu.css +71 -0
  78. package/dist/tokens/components/navigation.css +37 -13
  79. package/dist/tokens/components/segmented.css +4 -1
  80. package/dist/tokens/components/separator.css +4 -1
  81. package/dist/tokens/components/shell.css +99 -31
  82. package/dist/tokens/components/table.css +11 -5
  83. package/dist/tokens/components/thought-chain.css +4 -1
  84. package/dist/tokens/components/toggle.css +4 -1
  85. package/dist/tokens/components/tree.css +1 -1
  86. package/dist/tokens/components/upload.css +21 -9
  87. package/dist/tokens/foundation.css +35 -30
  88. package/dist/tokens/semantic/layout.css +26 -5
  89. package/docs/COMPOSITION-VS-COMPONENT.md +19 -1
  90. package/docs/DESIGN-AUTHORITY.md +99 -18
  91. package/docs/FRAME-COVERAGE-REPORT.md +7 -2
  92. package/docs/TOKENS.md +16 -1
  93. package/docs/data-display/marquee.tsx +254 -0
  94. package/docs/foundation/_theme-editor-scope.ts +222 -0
  95. package/docs/foundation/density.tsx +12 -2
  96. package/docs/foundation/spacing.tsx +5 -0
  97. package/docs/foundation/theme-editor.tsx +645 -0
  98. package/docs/general/activity.tsx +65 -0
  99. package/docs/general/reveal.tsx +290 -22
  100. package/docs/general/typography.tsx +91 -1
  101. package/docs/layout/affix.tsx +209 -0
  102. package/docs/layout/masonry.tsx +291 -0
  103. package/docs/navigation/anchor.tsx +285 -0
  104. package/docs/navigation/mega-menu-panel.tsx +86 -0
  105. package/docs/navigation/mega-menu.tsx +254 -0
  106. package/docs/roadmap/website-components.md +779 -0
  107. package/docs/showcase/acme-website.tsx +75 -39
  108. package/docs/showcase/case4-login.tsx +10 -2
  109. package/docs/showcase/case5-shift-calendar.tsx +1 -1
  110. package/docs/showcase/case6-agency-handy.tsx +6 -6
  111. package/docs/showcase/futurelastic-web.tsx +89 -49
  112. package/docs/showcase/marketing-page.tsx +885 -0
  113. package/docs/showcase/table-expandable-rows.tsx +4 -1
  114. package/docs/showcase/table-footer-totals.tsx +12 -2
  115. package/docs/showcase/theme-customization.tsx +1259 -0
  116. package/package.json +6 -3
  117. package/scripts/brand-accent.generated.mjs +27 -0
  118. package/scripts/ui-audit.mjs +66 -0
  119. 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
+ };