@_linked/primitives 1.0.9 → 1.2.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 (80) hide show
  1. package/.github/workflows/publish.yml +74 -7
  2. package/CHANGELOG.md +65 -0
  3. package/README.md +62 -0
  4. package/lib/cjs/components/Badge.d.ts +30 -0
  5. package/lib/cjs/components/Badge.js +64 -0
  6. package/lib/cjs/components/Badge.js.map +1 -0
  7. package/lib/cjs/components/Badge.module.css +89 -0
  8. package/lib/cjs/components/Command.d.ts +6 -6
  9. package/lib/cjs/components/ConfirmDialog.d.ts +37 -0
  10. package/lib/cjs/components/ConfirmDialog.js +68 -0
  11. package/lib/cjs/components/ConfirmDialog.js.map +1 -0
  12. package/lib/cjs/components/ConfirmDialog.module.css +22 -0
  13. package/lib/cjs/components/ImageThumb.d.ts +17 -0
  14. package/lib/cjs/components/ImageThumb.js +90 -0
  15. package/lib/cjs/components/ImageThumb.js.map +1 -0
  16. package/lib/cjs/components/ImageThumb.module.css +134 -0
  17. package/lib/cjs/components/MultiSelect.d.ts +4 -4
  18. package/lib/cjs/components/SkeletonLoader.d.ts +14 -0
  19. package/lib/cjs/components/SkeletonLoader.js +71 -0
  20. package/lib/cjs/components/SkeletonLoader.js.map +1 -0
  21. package/lib/cjs/components/SkeletonLoader.module.css +83 -0
  22. package/lib/cjs/components/Slider.js +7 -3
  23. package/lib/cjs/components/Slider.js.map +1 -1
  24. package/lib/cjs/components/Spinner.d.ts +22 -3
  25. package/lib/cjs/components/Spinner.js +55 -3
  26. package/lib/cjs/components/Spinner.js.map +1 -1
  27. package/lib/cjs/components/Spinner.module.css +57 -10
  28. package/lib/cjs/components/TruncatedText.d.ts +16 -0
  29. package/lib/cjs/components/TruncatedText.js +130 -0
  30. package/lib/cjs/components/TruncatedText.js.map +1 -0
  31. package/lib/cjs/components/TruncatedText.module.css +162 -0
  32. package/lib/cjs/hooks/useReducedMotion.d.ts +12 -0
  33. package/lib/cjs/hooks/useReducedMotion.js +35 -0
  34. package/lib/cjs/hooks/useReducedMotion.js.map +1 -0
  35. package/lib/cjs/index.d.ts +6 -0
  36. package/lib/cjs/index.js +22 -0
  37. package/lib/cjs/index.js.map +1 -1
  38. package/lib/cjs/motion.d.ts +219 -0
  39. package/lib/cjs/motion.js +154 -0
  40. package/lib/cjs/motion.js.map +1 -0
  41. package/lib/cjs/package.json +6 -6
  42. package/lib/esm/components/Badge.d.ts +30 -0
  43. package/lib/esm/components/Badge.js +13 -0
  44. package/lib/esm/components/Badge.js.map +1 -0
  45. package/lib/esm/components/Badge.module.css +89 -0
  46. package/lib/esm/components/Command.d.ts +6 -6
  47. package/lib/esm/components/ConfirmDialog.d.ts +37 -0
  48. package/lib/esm/components/ConfirmDialog.js +29 -0
  49. package/lib/esm/components/ConfirmDialog.js.map +1 -0
  50. package/lib/esm/components/ConfirmDialog.module.css +22 -0
  51. package/lib/esm/components/ImageThumb.d.ts +17 -0
  52. package/lib/esm/components/ImageThumb.js +50 -0
  53. package/lib/esm/components/ImageThumb.js.map +1 -0
  54. package/lib/esm/components/ImageThumb.module.css +134 -0
  55. package/lib/esm/components/MultiSelect.d.ts +4 -4
  56. package/lib/esm/components/SkeletonLoader.d.ts +14 -0
  57. package/lib/esm/components/SkeletonLoader.js +31 -0
  58. package/lib/esm/components/SkeletonLoader.js.map +1 -0
  59. package/lib/esm/components/SkeletonLoader.module.css +83 -0
  60. package/lib/esm/components/Slider.js +6 -2
  61. package/lib/esm/components/Slider.js.map +1 -1
  62. package/lib/esm/components/Spinner.d.ts +22 -3
  63. package/lib/esm/components/Spinner.js +22 -3
  64. package/lib/esm/components/Spinner.js.map +1 -1
  65. package/lib/esm/components/Spinner.module.css +57 -10
  66. package/lib/esm/components/TruncatedText.d.ts +16 -0
  67. package/lib/esm/components/TruncatedText.js +83 -0
  68. package/lib/esm/components/TruncatedText.js.map +1 -0
  69. package/lib/esm/components/TruncatedText.module.css +162 -0
  70. package/lib/esm/hooks/useReducedMotion.d.ts +12 -0
  71. package/lib/esm/hooks/useReducedMotion.js +32 -0
  72. package/lib/esm/hooks/useReducedMotion.js.map +1 -0
  73. package/lib/esm/index.d.ts +6 -0
  74. package/lib/esm/index.js +8 -0
  75. package/lib/esm/index.js.map +1 -1
  76. package/lib/esm/motion.d.ts +219 -0
  77. package/lib/esm/motion.js +154 -0
  78. package/lib/esm/motion.js.map +1 -0
  79. package/lib/esm/package.json +6 -6
  80. package/package.json +6 -6
@@ -0,0 +1,16 @@
1
+ import React from 'react';
2
+ interface TruncatedTextProps {
3
+ /** The full text content */
4
+ text: string;
5
+ /** Maximum number of characters to show before truncating (default: 80) */
6
+ maxLength?: number;
7
+ }
8
+ /**
9
+ * TruncatedText - Displays truncated text with hover/tap to show full content
10
+ *
11
+ * For long text fields, shows first N characters with ellipsis.
12
+ * On desktop: hover displays full text in a popover with copy button.
13
+ * On mobile: tap opens a dialog with full text and copy button.
14
+ */
15
+ declare function TruncatedText({ text, maxLength }: TruncatedTextProps): React.JSX.Element;
16
+ export { TruncatedText };
@@ -0,0 +1,130 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
36
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
37
+ return new (P || (P = Promise))(function (resolve, reject) {
38
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
39
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
40
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
41
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
42
+ });
43
+ };
44
+ var __importDefault = (this && this.__importDefault) || function (mod) {
45
+ return (mod && mod.__esModule) ? mod : { "default": mod };
46
+ };
47
+ Object.defineProperty(exports, "__esModule", { value: true });
48
+ exports.TruncatedText = TruncatedText;
49
+ const Dialog_js_1 = require("./Dialog.js");
50
+ const HoverCard_js_1 = require("./HoverCard.js");
51
+ const IconButton_js_1 = require("./IconButton.js");
52
+ const react_1 = __importStar(require("react"));
53
+ const TruncatedText_module_css_1 = __importDefault(require("./TruncatedText.module.css"));
54
+ /**
55
+ * Two inline glyphs rather than a dependency on an icon set.
56
+ *
57
+ * This component needs exactly two, and a library whose contract is "a behaviour source plus
58
+ * a stylesheet" should not make every consumer install an icon package to draw a tick. They
59
+ * inherit `currentColor`, so they follow the button they sit in.
60
+ */
61
+ const CheckGlyph = () => (react_1.default.createElement("svg", { width: "14", height: "14", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": "true" },
62
+ react_1.default.createElement("polyline", { points: "20 6 9 17 4 12" })));
63
+ const CopyGlyph = () => (react_1.default.createElement("svg", { width: "14", height: "14", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": "true" },
64
+ react_1.default.createElement("rect", { x: "9", y: "9", width: "13", height: "13", rx: "2", ry: "2" }),
65
+ react_1.default.createElement("path", { d: "M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1" })));
66
+ /**
67
+ * TruncatedText - Displays truncated text with hover/tap to show full content
68
+ *
69
+ * For long text fields, shows first N characters with ellipsis.
70
+ * On desktop: hover displays full text in a popover with copy button.
71
+ * On mobile: tap opens a dialog with full text and copy button.
72
+ */
73
+ function TruncatedText({ text, maxLength = 80 }) {
74
+ const [copied, setCopied] = (0, react_1.useState)(false);
75
+ const [isMobile, setIsMobile] = (0, react_1.useState)(false);
76
+ (0, react_1.useEffect)(() => {
77
+ // Check for touch device or small screen
78
+ const checkMobile = () => {
79
+ const hasTouchScreen = 'ontouchstart' in window || navigator.maxTouchPoints > 0;
80
+ const isSmallScreen = window.matchMedia('(max-width: 768px)').matches;
81
+ setIsMobile(hasTouchScreen || isSmallScreen);
82
+ };
83
+ checkMobile();
84
+ window.addEventListener('resize', checkMobile);
85
+ return () => window.removeEventListener('resize', checkMobile);
86
+ }, []);
87
+ // If text is short enough, just render it directly
88
+ if (!text || text.length <= maxLength) {
89
+ return react_1.default.createElement("span", null, text || '-');
90
+ }
91
+ const truncatedText = text.slice(0, maxLength) + '...';
92
+ const handleCopy = (e) => __awaiter(this, void 0, void 0, function* () {
93
+ e.stopPropagation();
94
+ try {
95
+ yield navigator.clipboard.writeText(text);
96
+ setCopied(true);
97
+ setTimeout(() => setCopied(false), 2000);
98
+ }
99
+ catch (err) {
100
+ console.error('Failed to copy text:', err);
101
+ }
102
+ });
103
+ // Mobile: Use Dialog triggered by tap
104
+ if (isMobile) {
105
+ return (react_1.default.createElement(Dialog_js_1.Dialog.Root, null,
106
+ react_1.default.createElement(Dialog_js_1.Dialog.Trigger, { asChild: true },
107
+ react_1.default.createElement("span", { className: TruncatedText_module_css_1.default.truncatedText }, truncatedText)),
108
+ react_1.default.createElement(Dialog_js_1.Dialog.Content, { className: TruncatedText_module_css_1.default.dialogContent },
109
+ react_1.default.createElement(Dialog_js_1.Dialog.Header, null,
110
+ react_1.default.createElement(Dialog_js_1.Dialog.Title, null, "Full Text")),
111
+ react_1.default.createElement("div", { className: TruncatedText_module_css_1.default.dialogBody },
112
+ react_1.default.createElement("div", { className: TruncatedText_module_css_1.default.scrollArea },
113
+ react_1.default.createElement("p", { className: TruncatedText_module_css_1.default.fullText }, text))),
114
+ react_1.default.createElement("div", { className: TruncatedText_module_css_1.default.dialogFooter },
115
+ react_1.default.createElement(IconButton_js_1.IconButton, { size: "small", variant: "ghost", className: TruncatedText_module_css_1.default.copyButton, onClick: handleCopy, "aria-label": copied ? 'Copied!' : 'Copy to clipboard' }, copied ? (react_1.default.createElement(CheckGlyph, null)) : (react_1.default.createElement(CopyGlyph, null)))))));
116
+ }
117
+ // Desktop: Use HoverCard triggered by hover
118
+ return (react_1.default.createElement(HoverCard_js_1.HoverCard.Root, { openDelay: 300, closeDelay: 200 },
119
+ react_1.default.createElement(HoverCard_js_1.HoverCard.Trigger, { asChild: true },
120
+ react_1.default.createElement("span", { className: TruncatedText_module_css_1.default.truncatedText }, truncatedText)),
121
+ react_1.default.createElement(HoverCard_js_1.HoverCard.Portal, null,
122
+ react_1.default.createElement(HoverCard_js_1.HoverCard.Content, { side: "top", align: "start", sideOffset: 8, className: TruncatedText_module_css_1.default.hoverContent },
123
+ react_1.default.createElement("div", { className: TruncatedText_module_css_1.default.contentWrapper },
124
+ react_1.default.createElement("div", { className: TruncatedText_module_css_1.default.scrollArea },
125
+ react_1.default.createElement("p", { className: TruncatedText_module_css_1.default.fullText }, text)),
126
+ react_1.default.createElement("div", { className: TruncatedText_module_css_1.default.copyButtonWrapper },
127
+ react_1.default.createElement(IconButton_js_1.IconButton, { size: "small", variant: "ghost", className: TruncatedText_module_css_1.default.copyButton, onClick: handleCopy, "aria-label": copied ? 'Copied!' : 'Copy to clipboard' }, copied ? (react_1.default.createElement(CheckGlyph, null)) : (react_1.default.createElement(CopyGlyph, null))))),
128
+ react_1.default.createElement(HoverCard_js_1.HoverCard.Arrow, { className: TruncatedText_module_css_1.default.arrow })))));
129
+ }
130
+ //# sourceMappingURL=TruncatedText.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TruncatedText.js","sourceRoot":"","sources":["../../../src/components/TruncatedText.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA0JS,sCAAa;AA1JtB,2CAAqC;AACrC,iDAA2C;AAC3C,mDAA6C;AAC7C,+CAAmD;AAEnD,0FAA+C;AAG/C;;;;;;GAMG;AACH,MAAM,UAAU,GAAG,GAAG,EAAE,CAAC,CACvB,uCAAK,KAAK,EAAC,IAAI,EAAC,MAAM,EAAC,IAAI,EAAC,OAAO,EAAC,WAAW,EAAC,IAAI,EAAC,MAAM,EAAC,MAAM,EAAC,cAAc,EAC/E,WAAW,EAAC,GAAG,EAAC,aAAa,EAAC,OAAO,EAAC,cAAc,EAAC,OAAO,iBAAa,MAAM;IAC/E,4CAAU,MAAM,EAAC,gBAAgB,GAAG,CAChC,CACP,CAAC;AAEF,MAAM,SAAS,GAAG,GAAG,EAAE,CAAC,CACtB,uCAAK,KAAK,EAAC,IAAI,EAAC,MAAM,EAAC,IAAI,EAAC,OAAO,EAAC,WAAW,EAAC,IAAI,EAAC,MAAM,EAAC,MAAM,EAAC,cAAc,EAC/E,WAAW,EAAC,GAAG,EAAC,aAAa,EAAC,OAAO,EAAC,cAAc,EAAC,OAAO,iBAAa,MAAM;IAC/E,wCAAM,CAAC,EAAC,GAAG,EAAC,CAAC,EAAC,GAAG,EAAC,KAAK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SAAS,OAAG,CACd,CACU,CACT,CACS,CACL,CACf,CAAC;IACJ,CAAC;IAED,4CAA4C;IAC5C,OAAO,CACL,8BAAC,wBAAS,CAAC,IAAI,IAAC,SAAS,EAAE,GAAG,EAAE,UAAU,EAAE,GAAG;QAC7C,8BAAC,wBAAS,CAAC,OAAO,IAAC,OAAO;YACxB,wCAAM,SAAS,EAAE,kCAAK,CAAC,aAAa,IAAG,aAAa,CAAQ,CAC1C;QACpB,8BAAC,wBAAS,CAAC,MAAM;YACf,8BAAC,wBAAS,CAAC,OAAO,IAChB,IAAI,EAAC,KAAK,EACV,KAAK,EAAC,OAAO,EACb,UAAU,EAAE,CAAC,EACb,SAAS,EAAE,kCAAK,CAAC,YAAY;gBAE7B,uCAAK,SAAS,EAAE,kCAAK,CAAC,cAAc;oBAClC,uCAAK,SAAS,EAAE,kCAAK,CAAC,UAAU;wBAC9B,qCAAG,SAAS,EAAE,kCAAK,CAAC,QAAQ,IAAG,IAAI,CAAK,CACpC;oBACN,uCAAK,SAAS,EAAE,kCAAK,CAAC,iBAAiB;wBACrC,8BAAC,0BAAU,IACT,IAAI,EAAC,OAAO,EACZ,OAAO,EAAC,OAAO,EACf,SAAS,EAAE,kCAAK,CAAC,UAAU,EAC3B,OAAO,EAAE,UAAU,gBACP,MAAM,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,mBAAmB,IAEnD,MAAM,CAAC,CAAC,CAAC,CACR,8BAAC,UAAU,OAAG,CACf,CAAC,CAAC,CAAC,CACF,8BAAC,SAAS,OAAG,CACd,CACU,CACT,CACF;gBACN,8BAAC,wBAAS,CAAC,KAAK,IAAC,SAAS,EAAE,kCAAK,CAAC,KAAK,GAAI,CACzB,CACH,CACJ,CAClB,CAAC;AACJ,CAAC"}
@@ -0,0 +1,162 @@
1
+ @import './helpers/mixins.css';
2
+ @import '@_linked/css/package.css';
3
+
4
+ /* ============================================================================
5
+ TruncatedText.module.css
6
+
7
+ Truncated text component with hover popover for full content.
8
+ Uses semantic tokens from theme.css.
9
+ ============================================================================ */
10
+
11
+ /* === Truncated Text Trigger === */
12
+ .truncatedText {
13
+ cursor: help;
14
+ border-bottom: 1px dotted var(--truncated-text-gray-400, var(--color-gray-400));
15
+ }
16
+
17
+ /* === Hover Card Content === */
18
+ .hoverContent {
19
+ background-color: var(--surface-bg);
20
+ border: 1px solid var(--surface-border);
21
+ border-radius: var(--radius-field);
22
+ box-shadow: var(--surface-shadow);
23
+ padding: var(--space-sm);
24
+ max-width: 400px;
25
+ min-width: 200px;
26
+ z-index: 1000;
27
+ }
28
+
29
+ /* === Content Wrapper === */
30
+ .contentWrapper {
31
+ display: flex;
32
+ flex-direction: column;
33
+ gap: var(--space-xs);
34
+ }
35
+
36
+ /* === Scroll Area === */
37
+ .scrollArea {
38
+ max-height: 150px;
39
+ overflow-y: auto;
40
+ }
41
+
42
+ /* === Full Text === */
43
+ .fullText {
44
+ font-size: var(--typography-small-size);
45
+ color: var(--text-primary);
46
+ line-height: 1.5;
47
+ margin: 0;
48
+ white-space: pre-wrap;
49
+ word-break: break-word;
50
+ }
51
+
52
+ /* === Copy Button Wrapper === */
53
+ .copyButtonWrapper {
54
+ display: flex;
55
+ justify-content: flex-end;
56
+ border-top: 1px solid var(--surface-border);
57
+ padding-top: var(--space-xs);
58
+ margin-top: var(--space-xs);
59
+ }
60
+
61
+ /* === Copy Button === */
62
+ .copyButton {
63
+ color: var(--truncated-text-tertiary-500, var(--color-tertiary-500)) !important;
64
+ padding: var(--space-xs) !important;
65
+ }
66
+
67
+ .copyButton:hover {
68
+ color: var(--truncated-text-tertiary-600, var(--color-tertiary-600)) !important;
69
+ background-color: color-mix(
70
+ in srgb,
71
+ var(--truncated-text-tertiary-500, var(--color-tertiary-500)) 12%,
72
+ transparent
73
+ ) !important;
74
+ }
75
+
76
+ /* === Arrow === */
77
+ .arrow {
78
+ fill: var(--surface-bg);
79
+ }
80
+
81
+ /* ============================================================================
82
+ Mobile Dialog Styles
83
+ ============================================================================ */
84
+
85
+ .dialogContent {
86
+ max-width: 90vw;
87
+ width: 400px;
88
+ background-color: var(--surface-bg);
89
+ border: 1px solid var(--surface-border);
90
+ }
91
+
92
+ .dialogBody {
93
+ padding: var(--space-sm) 0;
94
+ color: var(--text-primary);
95
+ }
96
+
97
+ .dialogFooter {
98
+ display: flex;
99
+ justify-content: flex-end;
100
+ align-items: center;
101
+ padding-top: var(--space-xs);
102
+ border-top: 1px solid var(--surface-border);
103
+ }
104
+
105
+ /* ============================================================================
106
+ Dark Mode
107
+ ============================================================================ */
108
+
109
+ [data-theme='dark'] .truncatedText {
110
+ border-bottom-color: var(--truncated-text-gray-500, var(--color-gray-500));
111
+ }
112
+
113
+ [data-theme='dark'] .hoverContent {
114
+ background-color: var(--surface-bg);
115
+ border-color: var(--surface-border);
116
+ }
117
+
118
+ /* .fullText uses --text-primary which auto-adjusts for dark mode */
119
+
120
+ [data-theme='dark'] .copyButtonWrapper {
121
+ border-top-color: var(--surface-border);
122
+ }
123
+
124
+ [data-theme='dark'] .copyButton {
125
+ color: var(--truncated-text-tertiary-400, var(--color-tertiary-400)) !important;
126
+ }
127
+
128
+ [data-theme='dark'] .copyButton:hover {
129
+ color: var(--truncated-text-tertiary-300, var(--color-tertiary-300)) !important;
130
+ background-color: color-mix(
131
+ in srgb,
132
+ var(--truncated-text-tertiary-500, var(--color-tertiary-500)) 15%,
133
+ transparent
134
+ ) !important;
135
+ }
136
+
137
+ [data-theme='dark'] .arrow {
138
+ fill: var(--surface-bg);
139
+ }
140
+
141
+ [data-theme='dark'] .dialogContent {
142
+ background-color: var(--surface-bg);
143
+ border-color: var(--surface-border);
144
+ }
145
+
146
+ /* .dialogBody uses --text-primary which auto-adjusts for dark mode */
147
+
148
+ [data-theme='dark'] .dialogFooter {
149
+ border-top-color: var(--surface-border);
150
+ }
151
+
152
+ /* Dialog close button in dark mode */
153
+ [data-theme='dark'] .dialogContent button[aria-label="Close"],
154
+ [data-theme='dark'] .dialogContent [class*="Close"] {
155
+ color: var(--truncated-text-gray-400, var(--color-gray-400));
156
+ }
157
+
158
+ [data-theme='dark'] .dialogContent button[aria-label="Close"]:hover,
159
+ [data-theme='dark'] .dialogContent [class*="Close"]:hover {
160
+ color: var(--truncated-text-gray-200, var(--color-gray-200));
161
+ background-color: var(--truncated-text-gray-700, var(--color-gray-700));
162
+ }
@@ -0,0 +1,12 @@
1
+ /**
2
+ * Whether the viewer has asked for reduced motion.
3
+ *
4
+ * Plain `matchMedia`, deliberately: this is the one piece of the motion story that every
5
+ * component needs and that carries no dependency, so it lives here rather than travelling
6
+ * with an animation library.
7
+ *
8
+ * Starts `false` and corrects on mount. Server-rendered markup cannot know the preference,
9
+ * and rendering the still version first would flash into motion for everyone else; erring
10
+ * toward motion and stopping it is the less disruptive order.
11
+ */
12
+ export declare function useReducedMotion(): boolean;
@@ -0,0 +1,35 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.useReducedMotion = useReducedMotion;
4
+ const react_1 = require("react");
5
+ /**
6
+ * Whether the viewer has asked for reduced motion.
7
+ *
8
+ * Plain `matchMedia`, deliberately: this is the one piece of the motion story that every
9
+ * component needs and that carries no dependency, so it lives here rather than travelling
10
+ * with an animation library.
11
+ *
12
+ * Starts `false` and corrects on mount. Server-rendered markup cannot know the preference,
13
+ * and rendering the still version first would flash into motion for everyone else; erring
14
+ * toward motion and stopping it is the less disruptive order.
15
+ */
16
+ function useReducedMotion() {
17
+ const [reduced, setReduced] = (0, react_1.useState)(false);
18
+ (0, react_1.useEffect)(() => {
19
+ if (typeof window === 'undefined' || !window.matchMedia)
20
+ return;
21
+ const query = window.matchMedia('(prefers-reduced-motion: reduce)');
22
+ setReduced(query.matches);
23
+ const onChange = (event) => setReduced(event.matches);
24
+ // `addEventListener` on MediaQueryList is not in older Safari; both are kept because a
25
+ // component library cannot choose its host browser.
26
+ if (query.addEventListener) {
27
+ query.addEventListener('change', onChange);
28
+ return () => query.removeEventListener('change', onChange);
29
+ }
30
+ query.addListener(onChange);
31
+ return () => query.removeListener(onChange);
32
+ }, []);
33
+ return reduced;
34
+ }
35
+ //# sourceMappingURL=useReducedMotion.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useReducedMotion.js","sourceRoot":"","sources":["../../../src/hooks/useReducedMotion.ts"],"names":[],"mappings":";;AAaA,4CAmBC;AAhCD,iCAA0C;AAE1C;;;;;;;;;;GAUG;AACH,SAAgB,gBAAgB;IAC9B,MAAM,CAAC,OAAO,EAAE,UAAU,CAAC,GAAG,IAAA,gBAAQ,EAAC,KAAK,CAAC,CAAC;IAE9C,IAAA,iBAAS,EAAC,GAAG,EAAE;QACb,IAAI,OAAO,MAAM,KAAK,WAAW,IAAI,CAAC,MAAM,CAAC,UAAU;YAAE,OAAO;QAChE,MAAM,KAAK,GAAG,MAAM,CAAC,UAAU,CAAC,kCAAkC,CAAC,CAAC;QACpE,UAAU,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;QAC1B,MAAM,QAAQ,GAAG,CAAC,KAA0B,EAAE,EAAE,CAAC,UAAU,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;QAC3E,uFAAuF;QACvF,oDAAoD;QACpD,IAAI,KAAK,CAAC,gBAAgB,EAAE,CAAC;YAC3B,KAAK,CAAC,gBAAgB,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC;YAC3C,OAAO,GAAG,EAAE,CAAC,KAAK,CAAC,mBAAmB,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC;QAC7D,CAAC;QACD,KAAK,CAAC,WAAW,CAAC,QAAQ,CAAC,CAAC;QAC5B,OAAO,GAAG,EAAE,CAAC,KAAK,CAAC,cAAc,CAAC,QAAQ,CAAC,CAAC;IAC9C,CAAC,EAAE,EAAE,CAAC,CAAC;IAEP,OAAO,OAAO,CAAC;AACjB,CAAC"}
@@ -1,6 +1,7 @@
1
1
  import './theme.css';
2
2
  import './types.js';
3
3
  import './ontologies/primitives.js';
4
+ import './components/Badge.js';
4
5
  import './components/Button.js';
5
6
  import './components/Input.js';
6
7
  import './components/Tabs.js';
@@ -34,6 +35,10 @@ import './components/NavigationMenu.js';
34
35
  import './components/Menubar.js';
35
36
  import './components/MultiSelect.js';
36
37
  import './components/Spinner.js';
38
+ import './components/ConfirmDialog.js';
39
+ import './components/SkeletonLoader.js';
40
+ import './components/ImageThumb.js';
41
+ import './components/TruncatedText.js';
37
42
  import './components/Breadcrumb.js';
38
43
  import './components/Drawer.js';
39
44
  import './components/IconButton.js';
@@ -43,3 +48,4 @@ import './components/Form.js';
43
48
  import './components/Toolbar.js';
44
49
  import './components/VisuallyHidden.js';
45
50
  import './hooks/use-toast.js';
51
+ export * from './motion.js';
package/lib/cjs/index.js CHANGED
@@ -1,4 +1,18 @@
1
1
  "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
2
16
  Object.defineProperty(exports, "__esModule", { value: true });
3
17
  require("./theme.css");
4
18
  require("./types.js");
@@ -6,6 +20,7 @@ require("./ontologies/primitives.js");
6
20
  //SHAPES FIRST
7
21
  // import './shapes/YourShape.js';
8
22
  //THEN COMPONENTS
23
+ require("./components/Badge.js");
9
24
  require("./components/Button.js");
10
25
  require("./components/Input.js");
11
26
  require("./components/Tabs.js");
@@ -39,6 +54,10 @@ require("./components/NavigationMenu.js");
39
54
  require("./components/Menubar.js");
40
55
  require("./components/MultiSelect.js");
41
56
  require("./components/Spinner.js");
57
+ require("./components/ConfirmDialog.js");
58
+ require("./components/SkeletonLoader.js");
59
+ require("./components/ImageThumb.js");
60
+ require("./components/TruncatedText.js");
42
61
  require("./components/Breadcrumb.js");
43
62
  require("./components/Drawer.js");
44
63
  require("./components/IconButton.js");
@@ -48,4 +67,7 @@ require("./components/Form.js");
48
67
  require("./components/Toolbar.js");
49
68
  require("./components/VisuallyHidden.js");
50
69
  require("./hooks/use-toast.js");
70
+ // The motion presets. Reachable from the entry point so tsc emits them: this package's
71
+ // tsconfig compiles what `index.ts` reaches, not the whole src tree.
72
+ __exportStar(require("./motion.js"), exports);
51
73
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;AAAA,uBAAqB;AACrB,sBAAoB;AACpB,sCAAoC;AAEpC,cAAc;AACd,kCAAkC;AAElC,iBAAiB;AACjB,kCAAgC;AAChC,iCAA+B;AAC/B,gCAA8B;AAC9B,kCAAgC;AAChC,oCAAkC;AAClC,sCAAoC;AACpC,kCAAgC;AAChC,iCAA+B;AAC/B,qCAAmC;AACnC,kCAAgC;AAChC,uCAAqC;AACrC,oCAAkC;AAClC,qCAAmC;AACnC,qCAAmC;AACnC,uCAAqC;AACrC,sCAAoC;AACpC,gCAA8B;AAC9B,mCAAiC;AACjC,uCAAqC;AACrC,kCAAgC;AAChC,sCAAoC;AACpC,mCAAiC;AACjC,mCAAiC;AACjC,kCAAgC;AAChC,uCAAqC;AACrC,kCAAgC;AAChC,iCAA+B;AAC/B,mCAAiC;AACjC,oCAAkC;AAClC,0CAAwC;AACxC,mCAAiC;AACjC,uCAAqC;AACrC,mCAAiC;AACjC,sCAAoC;AACpC,kCAAgC;AAChC,sCAAoC;AACpC,wCAAsC;AACtC,uCAAqC;AACrC,gCAA8B;AAC9B,mCAAiC;AACjC,0CAAwC;AAExC,gCAA8B"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,uBAAqB;AACrB,sBAAoB;AACpB,sCAAoC;AAEpC,cAAc;AACd,kCAAkC;AAElC,iBAAiB;AACjB,iCAA+B;AAC/B,kCAAgC;AAChC,iCAA+B;AAC/B,gCAA8B;AAC9B,kCAAgC;AAChC,oCAAkC;AAClC,sCAAoC;AACpC,kCAAgC;AAChC,iCAA+B;AAC/B,qCAAmC;AACnC,kCAAgC;AAChC,uCAAqC;AACrC,oCAAkC;AAClC,qCAAmC;AACnC,qCAAmC;AACnC,uCAAqC;AACrC,sCAAoC;AACpC,gCAA8B;AAC9B,mCAAiC;AACjC,uCAAqC;AACrC,kCAAgC;AAChC,sCAAoC;AACpC,mCAAiC;AACjC,mCAAiC;AACjC,kCAAgC;AAChC,uCAAqC;AACrC,kCAAgC;AAChC,iCAA+B;AAC/B,mCAAiC;AACjC,oCAAkC;AAClC,0CAAwC;AACxC,mCAAiC;AACjC,uCAAqC;AACrC,mCAAiC;AACjC,yCAAuC;AACvC,0CAAwC;AACxC,sCAAoC;AACpC,yCAAuC;AACvC,sCAAoC;AACpC,kCAAgC;AAChC,sCAAoC;AACpC,wCAAsC;AACtC,uCAAqC;AACrC,gCAA8B;AAC9B,mCAAiC;AACjC,0CAAwC;AAExC,gCAA8B;AAE9B,uFAAuF;AACvF,qEAAqE;AACrE,8CAA4B"}
@@ -0,0 +1,219 @@
1
+ /**
2
+ * Motion presets.
3
+ *
4
+ * Design tokens that happen to be objects rather than CSS custom properties, because that is
5
+ * the shape an animation library consumes. Same purpose as a colour token: one definition of
6
+ * "how a list staggers in", so two surfaces cannot disagree about it.
7
+ *
8
+ * This module imports **nothing**, not even types. Every export is a plain object whose type
9
+ * is inferred, and an inferred object literal is structurally assignable to `framer-motion`'s
10
+ * `Variants` and `Transition` at the point of use — so a consumer gets full checking without
11
+ * this package depending on the animation library at all.
12
+ *
13
+ * That matters more than it looks. Naming the types here would mean a devDependency to build
14
+ * and a peer to consume, which is how the workspace ended up with two copies of
15
+ * `framer-motion` and presets from one that were not assignable to the other. A library that
16
+ * animates with CSS should not carry an animation library so it can describe some constants.
17
+ */
18
+ import { useReducedMotion } from './hooks/useReducedMotion.js';
19
+ /**
20
+ * Shared animation variants for consistent motion across the app
21
+ */
22
+ export declare const fadeInUp: {
23
+ initial: {
24
+ opacity: number;
25
+ y: number;
26
+ };
27
+ animate: {
28
+ opacity: number;
29
+ y: number;
30
+ };
31
+ exit: {
32
+ opacity: number;
33
+ y: number;
34
+ };
35
+ };
36
+ export declare const fadeIn: {
37
+ initial: {
38
+ opacity: number;
39
+ };
40
+ animate: {
41
+ opacity: number;
42
+ };
43
+ exit: {
44
+ opacity: number;
45
+ };
46
+ };
47
+ export declare const scaleIn: {
48
+ initial: {
49
+ opacity: number;
50
+ scale: number;
51
+ };
52
+ animate: {
53
+ opacity: number;
54
+ scale: number;
55
+ };
56
+ exit: {
57
+ opacity: number;
58
+ scale: number;
59
+ };
60
+ };
61
+ export declare const slideInRight: {
62
+ initial: {
63
+ x: number;
64
+ opacity: number;
65
+ };
66
+ animate: {
67
+ x: number;
68
+ opacity: number;
69
+ };
70
+ exit: {
71
+ x: number;
72
+ opacity: number;
73
+ };
74
+ };
75
+ /**
76
+ * Easing and transition configurations
77
+ */
78
+ /**
79
+ * A cubic-bezier easing: the four control points, as a tuple.
80
+ *
81
+ * The tuple type is load-bearing. Written inline, `[0.16, 1, 0.3, 1]` infers as `number[]`,
82
+ * which is not assignable to an animation library's easing type — it wants exactly four
83
+ * numbers. Naming it once fixes that and stops the curve being retyped at each use.
84
+ */
85
+ export type Easing = [number, number, number, number];
86
+ /** The shared ease-out curve. Decelerates hard at the end, so motion settles rather than stops. */
87
+ export declare const EASE_OUT_CURVE: Easing;
88
+ export declare const spring: {
89
+ type: string;
90
+ stiffness: number;
91
+ damping: number;
92
+ };
93
+ export declare const easeOut: {
94
+ duration: number;
95
+ ease: Easing;
96
+ };
97
+ export declare const easeSlow: {
98
+ duration: number;
99
+ ease: Easing;
100
+ };
101
+ /**
102
+ * Stagger animation configurations
103
+ */
104
+ export declare const staggerContainer: {
105
+ animate: {
106
+ transition: {
107
+ staggerChildren: number;
108
+ };
109
+ };
110
+ };
111
+ export declare const staggerItem: {
112
+ initial: {
113
+ opacity: number;
114
+ y: number;
115
+ };
116
+ animate: {
117
+ opacity: number;
118
+ y: number;
119
+ };
120
+ };
121
+ /**
122
+ * Slower stagger for table rows - more subtle and elegant
123
+ */
124
+ export declare const tableStaggerContainer: {
125
+ animate: {
126
+ transition: {
127
+ staggerChildren: number;
128
+ delayChildren: number;
129
+ };
130
+ };
131
+ };
132
+ export declare const tableRowItem: {
133
+ initial: {
134
+ opacity: number;
135
+ y: number;
136
+ };
137
+ animate: {
138
+ opacity: number;
139
+ y: number;
140
+ transition: {
141
+ duration: number;
142
+ ease: Easing;
143
+ };
144
+ };
145
+ };
146
+ /**
147
+ * Stagger for card grids - elegant cascade effect
148
+ */
149
+ export declare const cardGridContainer: {
150
+ hidden: {
151
+ opacity: number;
152
+ };
153
+ visible: {
154
+ opacity: number;
155
+ transition: {
156
+ staggerChildren: number;
157
+ delayChildren: number;
158
+ };
159
+ };
160
+ };
161
+ export declare const cardGridItem: {
162
+ hidden: {
163
+ opacity: number;
164
+ y: number;
165
+ scale: number;
166
+ };
167
+ visible: {
168
+ opacity: number;
169
+ y: number;
170
+ scale: number;
171
+ transition: {
172
+ duration: number;
173
+ ease: Easing;
174
+ };
175
+ };
176
+ };
177
+ /**
178
+ * Stagger for list items - subtle slide-in effect
179
+ */
180
+ export declare const listContainer: {
181
+ hidden: {
182
+ opacity: number;
183
+ };
184
+ visible: {
185
+ opacity: number;
186
+ transition: {
187
+ staggerChildren: number;
188
+ delayChildren: number;
189
+ };
190
+ };
191
+ };
192
+ export declare const listItem: {
193
+ hidden: {
194
+ opacity: number;
195
+ x: number;
196
+ };
197
+ visible: {
198
+ opacity: number;
199
+ x: number;
200
+ transition: {
201
+ duration: number;
202
+ ease: Easing;
203
+ };
204
+ };
205
+ };
206
+ /**
207
+ * Re-exported so a component reaching for the motion presets does not have to know that the
208
+ * preference hook lives elsewhere. It carries no animation dependency of its own.
209
+ */
210
+ export { useReducedMotion };
211
+ /**
212
+ * Get appropriate transition based on reduced motion preference
213
+ */
214
+ export declare const getTransition: (reducedMotion: boolean) => {
215
+ duration: number;
216
+ ease: Easing;
217
+ } | {
218
+ duration: number;
219
+ };