@hjmds/react 1.7.0 → 1.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 (96) hide show
  1. package/README.md +21 -0
  2. package/THIRD_PARTY_NOTICES.md +57 -0
  3. package/dist/advanced-display.d.ts +3 -1
  4. package/dist/advanced-display.d.ts.map +1 -1
  5. package/dist/advanced-display.js +2 -2
  6. package/dist/advanced-display.js.map +1 -1
  7. package/dist/affix.d.ts +10 -0
  8. package/dist/affix.d.ts.map +1 -0
  9. package/dist/affix.js +51 -0
  10. package/dist/affix.js.map +1 -0
  11. package/dist/carousel-motion.d.ts +13 -0
  12. package/dist/carousel-motion.d.ts.map +1 -0
  13. package/dist/carousel-motion.js +35 -0
  14. package/dist/carousel-motion.js.map +1 -0
  15. package/dist/celebration.d.ts +8 -0
  16. package/dist/celebration.d.ts.map +1 -0
  17. package/dist/celebration.js +51 -0
  18. package/dist/celebration.js.map +1 -0
  19. package/dist/color-picker.d.ts +18 -0
  20. package/dist/color-picker.d.ts.map +1 -0
  21. package/dist/color-picker.js +40 -0
  22. package/dist/color-picker.js.map +1 -0
  23. package/dist/content-transition.d.ts +18 -0
  24. package/dist/content-transition.d.ts.map +1 -0
  25. package/dist/content-transition.js +33 -0
  26. package/dist/content-transition.js.map +1 -0
  27. package/dist/context-menu.d.ts.map +1 -1
  28. package/dist/context-menu.js +36 -9
  29. package/dist/context-menu.js.map +1 -1
  30. package/dist/date-picker.d.ts.map +1 -1
  31. package/dist/date-picker.js +39 -1
  32. package/dist/date-picker.js.map +1 -1
  33. package/dist/evidence.d.ts +106 -2
  34. package/dist/evidence.d.ts.map +1 -1
  35. package/dist/evidence.js +136 -64
  36. package/dist/evidence.js.map +1 -1
  37. package/dist/layout.d.ts.map +1 -1
  38. package/dist/layout.js +3 -2
  39. package/dist/layout.js.map +1 -1
  40. package/dist/masonry.d.ts +14 -0
  41. package/dist/masonry.d.ts.map +1 -0
  42. package/dist/masonry.js +13 -0
  43. package/dist/masonry.js.map +1 -0
  44. package/dist/menu-morph.d.ts +12 -0
  45. package/dist/menu-morph.d.ts.map +1 -0
  46. package/dist/menu-morph.js +80 -0
  47. package/dist/menu-morph.js.map +1 -0
  48. package/dist/menubar.d.ts.map +1 -1
  49. package/dist/menubar.js +24 -15
  50. package/dist/menubar.js.map +1 -1
  51. package/dist/modal.d.ts +1 -0
  52. package/dist/modal.d.ts.map +1 -1
  53. package/dist/modal.js.map +1 -1
  54. package/dist/navigation.d.ts.map +1 -1
  55. package/dist/navigation.js +13 -1
  56. package/dist/navigation.js.map +1 -1
  57. package/dist/overlays.d.ts.map +1 -1
  58. package/dist/overlays.js +33 -2
  59. package/dist/overlays.js.map +1 -1
  60. package/dist/qr-code.d.ts +11 -0
  61. package/dist/qr-code.d.ts.map +1 -0
  62. package/dist/qr-code.js +14 -0
  63. package/dist/qr-code.js.map +1 -0
  64. package/dist/sortable.d.ts +14 -0
  65. package/dist/sortable.d.ts.map +1 -0
  66. package/dist/sortable.js +87 -0
  67. package/dist/sortable.js.map +1 -0
  68. package/dist/statistic-motion.d.ts +12 -0
  69. package/dist/statistic-motion.d.ts.map +1 -0
  70. package/dist/statistic-motion.js +23 -0
  71. package/dist/statistic-motion.js.map +1 -0
  72. package/dist/styles.css +166 -134
  73. package/dist/styles.layered.css +166 -134
  74. package/dist/swipe-actions.d.ts +13 -0
  75. package/dist/swipe-actions.d.ts.map +1 -0
  76. package/dist/swipe-actions.js +25 -0
  77. package/dist/swipe-actions.js.map +1 -0
  78. package/dist/theme.d.ts.map +1 -1
  79. package/dist/theme.js +2 -1
  80. package/dist/theme.js.map +1 -1
  81. package/dist/thinking-orb.d.ts +9 -0
  82. package/dist/thinking-orb.d.ts.map +1 -0
  83. package/dist/thinking-orb.js +86 -0
  84. package/dist/thinking-orb.js.map +1 -0
  85. package/dist/tree.d.ts.map +1 -1
  86. package/dist/tree.js +14 -3
  87. package/dist/tree.js.map +1 -1
  88. package/dist/virtual-list.d.ts +14 -0
  89. package/dist/virtual-list.d.ts.map +1 -0
  90. package/dist/virtual-list.js +48 -0
  91. package/dist/virtual-list.js.map +1 -0
  92. package/dist/watermark.d.ts +12 -0
  93. package/dist/watermark.d.ts.map +1 -0
  94. package/dist/watermark.js +10 -0
  95. package/dist/watermark.js.map +1 -0
  96. package/package.json +122 -5
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sortable.js","sourceRoot":"","sources":["../src/sortable.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,WAAW,EAAE,eAAe,EAAE,MAAM,EAAE,QAAQ,EAAE,OAAO,EAAkB,MAAM,OAAO,CAAC;AAChG,OAAO,EAAE,aAAa,EAA0C,MAAM,cAAc,CAAC;AACrF,OAAO,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAClD,OAAO,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAClE,OAAO,EAAE,aAAa,EAAE,aAAa,EAA8D,MAAM,yDAAyD,CAAC;AACnK,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AACtC,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAO5C,SAAS,GAAG,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,QAAQ,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,KAAK,EAG3E;IACC,MAAM,EAAE,GAAG,EAAE,SAAS,EAAE,GAAG,WAAW,CAAC,EAAE,EAAE,EAAE,IAAI,CAAC,EAAE,EAAE,KAAK,EAAE,QAAQ,EAAE,QAAQ,IAAI,IAAI,CAAC,QAAQ,KAAK,IAAI;QACvG,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,UAAU,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC;IAC9C,OAAO,cAAI,GAAG,EAAE,GAAG,kBAAgB,IAAI,CAAC,EAAE,EAAE,KAAK,EAAE,EAAE,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AAC,IAF1B,IAAI,CAAC,EAAE,CAE0B,CAAC,GAC3E,EACL,eAAM,IAAI,EAAC,QAAQ,EAAC,KAAK,EAAE,EAAE,QAAQ,EAAE,UAAU,EAAE,KAAK,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,QAAQ,EAAE,QAAQ,EAAE,QAAQ,EAAE,YAAY,EAAE,YAAG,YAAY,GAAQ,IAC1H,CAAC;AACtB,CAAC","sourcesContent":["import { useCallback, useLayoutEffect, useRef, useState, useMemo, type ReactNode } from \"react\";\nimport { Accessibility, type DragStartEvent, type DragEndEvent } from \"@dnd-kit/dom\";\nimport { DragDropProvider } from \"@dnd-kit/react\";\nimport { useSortable, isSortable } from \"@dnd-kit/react/sortable\";\nimport { reorderIntent, validateItems, type SortableItem, type SortableLabels, type ReorderIntent } from \"@hjmds/design-contracts/components/interaction-adapters\";\nimport { Button } from \"./actions.js\";\nimport { useHjmTheme } from \"./provider.js\";\n\nexport type SortableCollectionProps = {\n items: readonly SortableItem[]; label: string; labels: SortableLabels;\n renderItem(item: SortableItem): ReactNode;\n onCommit(intent: ReorderIntent): void; onCancel?(): void; disabled?: boolean;\n};\nfunction Row({ item, index, children, disabled, reduced, labels, move, count }: {\n item: SortableItem; index: number; children: ReactNode; disabled: boolean; reduced: boolean;\n labels: SortableLabels; move(to: number): void; count: number;\n}) {\n const { ref, handleRef } = useSortable({ id: item.id, index, disabled: disabled || item.disabled === true,\n ...(reduced ? { transition: null } : {}) });\n return <li ref={ref} data-item-id={item.id} style={{ display: \"grid\", gridTemplateColumns: \"auto minmax(0, 1fr)\", alignItems: \"center\", gap: \"var(--hjm-space-sm)\", paddingBlock: \"var(--hjm-space-xs)\" }}>\n <Button ref={handleRef} tone=\"ghost\" type=\"button\" disabled={disabled || item.disabled} aria-label={labels.handle(item)}\n style={{ minWidth: 44, minHeight: 44, touchAction: \"none\", cursor: \"grab\" }}>⠿</Button>\n <div style={{ minWidth: 0, overflowWrap: \"anywhere\" }}>{children}</div>\n {/* Separate action line preserves readable item labels at 200% text in narrow hosts. */}\n <div style={{ gridColumn: \"1 / -1\", display: \"flex\", flexWrap: \"wrap\", gap: \"var(--hjm-space-xs)\" }}>\n <Button tone=\"ghost\" disabled={disabled || item.disabled || index === 0} onClick={() => move(index - 1)}>{labels.previous(item)}</Button>\n <Button tone=\"ghost\" disabled={disabled || item.disabled || index === count - 1} onClick={() => move(index + 1)}>{labels.next(item)}</Button>\n </div>\n </li>;\n}\n/** Small controlled collections only; persistence and rollback belong to the host. */\nexport function SortableCollection(props: SortableCollectionProps) {\n validateItems(props.items);\n if (!props.label.trim()) throw new TypeError(\"SortableCollection needs a label\");\n const { environment } = useHjmTheme();\n const [announcement, setAnnouncement] = useState(\"\");\n const latest = useRef(props); latest.current = props;\n const accessibility = useMemo(() => Accessibility.configure({\n screenReaderInstructions: { draggable: props.labels.instructions },\n announcements: {\n dragstart: ({ operation }: DragStartEvent) => {\n const item = latest.current.items.find(i => i.id === operation.source?.id);\n return item ? latest.current.labels.dragStart(item) : undefined;\n },\n dragend: ({ canceled }: DragEndEvent) => canceled ? latest.current.labels.dragCancel : undefined,\n // HJM emits the accepted controlled position, never raw upstream IDs.\n dragover: () => undefined, dragmove: () => undefined,\n },\n }), [props.labels.instructions]);\n const plugins = useCallback((defaults: readonly unknown[]) => [...defaults.filter(plugin => plugin !== Accessibility), accessibility],\n // A fresh function every render made the provider reassign manager.plugins on each render (2026-09-30 review).\n [accessibility]) as unknown as NonNullable<Parameters<typeof DragDropProvider>[0][\"plugins\"]>;\n const list = useRef<HTMLUListElement>(null);\n // Moving a row re-parents its DOM node, and an edge move disables the pressed button: both dropped focus to\n // <body> after a keyboard reorder. Refocus the moved row once the host has accepted the new order.\n const refocus = useRef<{ id: string; direction: \"previous\" | \"next\" } | null>(null);\n const snapshot = useRef(\"\");\n const signature = JSON.stringify(props.items);\n useLayoutEffect(() => {\n const pending = refocus.current;\n if (!pending) return;\n const row = list.current?.querySelector<HTMLElement>(`[data-item-id=\"${CSS.escape(pending.id)}\"]`);\n if (!row) return;\n refocus.current = null;\n const [handle, previous, next] = [...row.querySelectorAll<HTMLButtonElement>(\"button\")];\n const preferred = pending.direction === \"previous\" ? previous : next;\n const fallback = pending.direction === \"previous\" ? next : previous;\n (preferred && !preferred.disabled ? preferred : fallback && !fallback.disabled ? fallback : handle)?.focus();\n // Announce only once the controlled order reflects the move, never a proposed position.\n const index = props.items.findIndex(item => item.id === pending.id);\n if (index >= 0) setAnnouncement(props.labels.position(props.items[index]!, index + 1, props.items.length));\n }, [signature]); // eslint-disable-line react-hooks/exhaustive-deps\n const commit = (id: string, to: number, source: ReorderIntent[\"source\"]) => {\n if (props.disabled) return;\n const intent = reorderIntent(props.items, id, to, source);\n if (!intent) {\n // A rejected drag (fixed row in range, same index) must still end the host's drag session.\n if (source === \"drag\") props.onCancel?.();\n return;\n }\n if (source === \"keyboard\") refocus.current = { id, direction: intent.toIndex < intent.fromIndex ? \"previous\" : \"next\" };\n else refocus.current = { id, direction: \"next\" };\n props.onCommit(intent);\n };\n return <DragDropProvider plugins={plugins} onDragStart={() => { snapshot.current = signature; }} onDragEnd={event => {\n if (event.canceled || snapshot.current !== signature) { props.onCancel?.(); return; }\n const source = event.operation.source;\n if (source && isSortable(source)) commit(String(source.id), source.index, \"drag\");\n }}>\n <ul ref={list} aria-label={props.label} style={{ listStyle: \"none\", margin: 0, padding: 0 }}>\n {props.items.map((item, index) => <Row key={item.id} item={item} index={index} count={props.items.length}\n disabled={props.disabled ?? false} reduced={environment.reducedMotion} labels={props.labels}\n move={to => commit(item.id, to, \"keyboard\")}>{props.renderItem(item)}</Row>)}\n </ul>\n <span role=\"status\" style={{ position: \"absolute\", width: 1, height: 1, overflow: \"hidden\", clipPath: \"inset(50%)\" }}>{announcement}</span>\n </DragDropProvider>;\n}\n"]}
@@ -0,0 +1,12 @@
1
+ import { type StatisticProps } from "./advanced-display.js";
2
+ export type AnimatedStatisticProps = Omit<StatisticProps, "descriptor" | "renderValue"> & {
3
+ descriptor: Omit<StatisticProps["descriptor"], "value">;
4
+ value: number;
5
+ /** Explicit locale keeps server/client formatting deterministic. */
6
+ locale: string;
7
+ format?: Intl.NumberFormatOptions;
8
+ animated?: boolean;
9
+ };
10
+ /** NumberFlow stays outside the base Statistic graph and its accessible text. */
11
+ export declare function AnimatedStatistic({ descriptor, value, locale, format, animated, ...props }: AnimatedStatisticProps): import("react").JSX.Element;
12
+ //# sourceMappingURL=statistic-motion.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"statistic-motion.d.ts","sourceRoot":"","sources":["../src/statistic-motion.tsx"],"names":[],"mappings":"AACA,OAAO,EAAa,KAAK,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAGvE,MAAM,MAAM,sBAAsB,GAAG,IAAI,CAAC,cAAc,EAAE,YAAY,GAAG,aAAa,CAAC,GAAG;IACxF,UAAU,EAAE,IAAI,CAAC,cAAc,CAAC,YAAY,CAAC,EAAE,OAAO,CAAC,CAAC;IACxD,KAAK,EAAE,MAAM,CAAC;IACd,oEAAoE;IACpE,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,IAAI,CAAC,mBAAmB,CAAC;IAClC,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB,CAAC;AAEF,iFAAiF;AACjF,wBAAgB,iBAAiB,CAAC,EAAE,UAAU,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,QAAe,EAAE,GAAG,KAAK,EAAE,EAAE,sBAAsB,+BAgBzH"}
@@ -0,0 +1,23 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import NumberFlow from "@number-flow/react";
3
+ import { Statistic } from "./advanced-display.js";
4
+ import { useHjmTheme } from "./provider.js";
5
+ /** NumberFlow stays outside the base Statistic graph and its accessible text. */
6
+ export function AnimatedStatistic({ descriptor, value, locale, format, animated = true, ...props }) {
7
+ const theme = useHjmTheme();
8
+ if (!Number.isFinite(value))
9
+ throw new TypeError("AnimatedStatistic value must be finite");
10
+ const formatter = new Intl.NumberFormat(locale, format);
11
+ const text = formatter.format(value);
12
+ // Upstream cannot animate non-Latin digits, RTL or exponent notation reliably.
13
+ // Preserve Intl output instead of transliterating the user's number format.
14
+ const canAnimate = animated && !theme.environment.reducedMotion &&
15
+ theme.environment.direction !== "rtl" && formatter.resolvedOptions().numberingSystem === "latn" &&
16
+ !/^(ar|fa|he|ur)(-|$)/i.test(locale) &&
17
+ !["scientific", "engineering"].includes(format?.notation ?? "standard");
18
+ const animatedFormat = { ...format, notation: format?.notation === "compact" ? "compact" : "standard" };
19
+ return _jsx(Statistic, { ...props, descriptor: { ...descriptor, value: text }, renderValue: () => canAnimate
20
+ ? _jsx(NumberFlow, { value: value, locales: locale, format: animatedFormat, respectMotionPreference: true })
21
+ : text });
22
+ }
23
+ //# sourceMappingURL=statistic-motion.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"statistic-motion.js","sourceRoot":"","sources":["../src/statistic-motion.tsx"],"names":[],"mappings":";AAAA,OAAO,UAAU,MAAM,oBAAoB,CAAC;AAC5C,OAAO,EAAE,SAAS,EAAuB,MAAM,uBAAuB,CAAC;AACvE,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAW5C,iFAAiF;AACjF,MAAM,UAAU,iBAAiB,CAAC,EAAE,UAAU,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,QAAQ,GAAG,IAAI,EAAE,GAAG,KAAK,EAA0B;IACxH,MAAM,KAAK,GAAG,WAAW,EAAE,CAAC;IAC5B,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC;QAAE,MAAM,IAAI,SAAS,CAAC,wCAAwC,CAAC,CAAC;IAC3F,MAAM,SAAS,GAAG,IAAI,IAAI,CAAC,YAAY,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACxD,MAAM,IAAI,GAAG,SAAS,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;IACrC,+EAA+E;IAC/E,4EAA4E;IAC5E,MAAM,UAAU,GAAG,QAAQ,IAAI,CAAC,KAAK,CAAC,WAAW,CAAC,aAAa;QAC7D,KAAK,CAAC,WAAW,CAAC,SAAS,KAAK,KAAK,IAAI,SAAS,CAAC,eAAe,EAAE,CAAC,eAAe,KAAK,MAAM;QAC/F,CAAC,sBAAsB,CAAC,IAAI,CAAC,MAAM,CAAC;QACpC,CAAC,CAAC,YAAY,EAAE,aAAa,CAAC,CAAC,QAAQ,CAAC,MAAM,EAAE,QAAQ,IAAI,UAAU,CAAC,CAAC;IAC1E,MAAM,cAAc,GAAG,EAAE,GAAG,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,QAAQ,KAAK,SAAS,CAAC,CAAC,CAAC,SAAkB,CAAC,CAAC,CAAC,UAAmB,EAAE,CAAC;IAC1H,OAAO,KAAC,SAAS,OAAK,KAAK,EAAE,UAAU,EAAE,EAAE,GAAG,UAAU,EAAE,KAAK,EAAE,IAAI,EAAE,EACrE,WAAW,EAAE,GAAG,EAAE,CAAC,UAAU;YAC3B,CAAC,CAAC,KAAC,UAAU,IAAC,KAAK,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,cAAc,EAAE,uBAAuB,SAAG;YAC/F,CAAC,CAAC,IAAI,GAAI,CAAC;AACjB,CAAC","sourcesContent":["import NumberFlow from \"@number-flow/react\";\nimport { Statistic, type StatisticProps } from \"./advanced-display.js\";\nimport { useHjmTheme } from \"./provider.js\";\n\nexport type AnimatedStatisticProps = Omit<StatisticProps, \"descriptor\" | \"renderValue\"> & {\n descriptor: Omit<StatisticProps[\"descriptor\"], \"value\">;\n value: number;\n /** Explicit locale keeps server/client formatting deterministic. */\n locale: string;\n format?: Intl.NumberFormatOptions;\n animated?: boolean;\n};\n\n/** NumberFlow stays outside the base Statistic graph and its accessible text. */\nexport function AnimatedStatistic({ descriptor, value, locale, format, animated = true, ...props }: AnimatedStatisticProps) {\n const theme = useHjmTheme();\n if (!Number.isFinite(value)) throw new TypeError(\"AnimatedStatistic value must be finite\");\n const formatter = new Intl.NumberFormat(locale, format);\n const text = formatter.format(value);\n // Upstream cannot animate non-Latin digits, RTL or exponent notation reliably.\n // Preserve Intl output instead of transliterating the user's number format.\n const canAnimate = animated && !theme.environment.reducedMotion &&\n theme.environment.direction !== \"rtl\" && formatter.resolvedOptions().numberingSystem === \"latn\" &&\n !/^(ar|fa|he|ur)(-|$)/i.test(locale) &&\n ![\"scientific\", \"engineering\"].includes(format?.notation ?? \"standard\");\n const animatedFormat = { ...format, notation: format?.notation === \"compact\" ? \"compact\" as const : \"standard\" as const };\n return <Statistic {...props} descriptor={{ ...descriptor, value: text }}\n renderValue={() => canAnimate\n ? <NumberFlow value={value} locales={locale} format={animatedFormat} respectMotionPreference />\n : text} />;\n}\n"]}