@cdx-ui/components 0.3.2 → 0.3.4

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 (125) hide show
  1. package/README.md +2 -2
  2. package/coverage.svg +1 -1
  3. package/docs/components/color-field/content.md +2 -2
  4. package/docs/components/content.md +6 -4
  5. package/docs/components/data-grid/content.md +125 -1
  6. package/docs/components/date-field/content.md +2 -2
  7. package/docs/components/date-time-field/content.md +2 -2
  8. package/docs/components/input/content.md +20 -2
  9. package/docs/components/input/design.md +1 -1
  10. package/docs/components/insight/content.md +644 -0
  11. package/docs/components/insight-stack/content.md +231 -0
  12. package/docs/components/insurance-disclosure/content.md +1 -1
  13. package/docs/components/otp-input/content.md +2 -2
  14. package/docs/components/select/content.md +223 -24
  15. package/docs/components/text/content.md +97 -0
  16. package/docs/foundations/styles/tokens/all-tokens/content.md +23 -3
  17. package/docs/llms.txt +8 -4
  18. package/docs/patterns/forms/content.md +407 -0
  19. package/docs/resources/release-notes/0.3.2/content.md +17 -0
  20. package/docs/resources/release-notes/0.3.3/content.md +23 -0
  21. package/docs/resources/release-notes/content.md +2 -0
  22. package/lib/commonjs/components/Drawer/index.js +1 -1
  23. package/lib/commonjs/components/Drawer/index.js.map +1 -1
  24. package/lib/commonjs/components/Input/index.js.map +1 -1
  25. package/lib/commonjs/components/Input/styles.js +13 -6
  26. package/lib/commonjs/components/Input/styles.js.map +1 -1
  27. package/lib/commonjs/components/Insight/index.js +438 -0
  28. package/lib/commonjs/components/Insight/index.js.map +1 -0
  29. package/lib/commonjs/components/Insight/insetRadius.js +35 -0
  30. package/lib/commonjs/components/Insight/insetRadius.js.map +1 -0
  31. package/lib/commonjs/components/Insight/styles.js +186 -0
  32. package/lib/commonjs/components/Insight/styles.js.map +1 -0
  33. package/lib/commonjs/components/InsightStack/index.js +93 -0
  34. package/lib/commonjs/components/InsightStack/index.js.map +1 -0
  35. package/lib/commonjs/components/InsightStack/styles.js +61 -0
  36. package/lib/commonjs/components/InsightStack/styles.js.map +1 -0
  37. package/lib/commonjs/components/OtpInput/index.js.map +1 -1
  38. package/lib/commonjs/components/Select/index.js +326 -24
  39. package/lib/commonjs/components/Select/index.js.map +1 -1
  40. package/lib/commonjs/components/Select/styles.js +32 -1
  41. package/lib/commonjs/components/Select/styles.js.map +1 -1
  42. package/lib/commonjs/components/index.js +24 -0
  43. package/lib/commonjs/components/index.js.map +1 -1
  44. package/lib/commonjs/components/picker/surfaces.js +18 -3
  45. package/lib/commonjs/components/picker/surfaces.js.map +1 -1
  46. package/lib/commonjs/figma/Insight.figma.js +73 -0
  47. package/lib/commonjs/figma/Insight.figma.js.map +1 -0
  48. package/lib/commonjs/figma/InsightStack.figma.js +39 -0
  49. package/lib/commonjs/figma/InsightStack.figma.js.map +1 -0
  50. package/lib/module/components/Drawer/index.js +1 -1
  51. package/lib/module/components/Drawer/index.js.map +1 -1
  52. package/lib/module/components/Input/index.js.map +1 -1
  53. package/lib/module/components/Input/styles.js +14 -6
  54. package/lib/module/components/Input/styles.js.map +1 -1
  55. package/lib/module/components/Insight/index.js +433 -0
  56. package/lib/module/components/Insight/index.js.map +1 -0
  57. package/lib/module/components/Insight/insetRadius.js +30 -0
  58. package/lib/module/components/Insight/insetRadius.js.map +1 -0
  59. package/lib/module/components/Insight/styles.js +183 -0
  60. package/lib/module/components/Insight/styles.js.map +1 -0
  61. package/lib/module/components/InsightStack/index.js +89 -0
  62. package/lib/module/components/InsightStack/index.js.map +1 -0
  63. package/lib/module/components/InsightStack/styles.js +58 -0
  64. package/lib/module/components/InsightStack/styles.js.map +1 -0
  65. package/lib/module/components/OtpInput/index.js.map +1 -1
  66. package/lib/module/components/Select/index.js +328 -26
  67. package/lib/module/components/Select/index.js.map +1 -1
  68. package/lib/module/components/Select/styles.js +31 -0
  69. package/lib/module/components/Select/styles.js.map +1 -1
  70. package/lib/module/components/index.js +2 -0
  71. package/lib/module/components/index.js.map +1 -1
  72. package/lib/module/components/picker/surfaces.js +17 -3
  73. package/lib/module/components/picker/surfaces.js.map +1 -1
  74. package/lib/module/figma/Insight.figma.js +67 -0
  75. package/lib/module/figma/Insight.figma.js.map +1 -0
  76. package/lib/module/figma/InsightStack.figma.js +33 -0
  77. package/lib/module/figma/InsightStack.figma.js.map +1 -0
  78. package/lib/typescript/components/ColorField/styles.d.ts +4 -2
  79. package/lib/typescript/components/ColorField/styles.d.ts.map +1 -1
  80. package/lib/typescript/components/DateField/styles.d.ts +4 -2
  81. package/lib/typescript/components/DateField/styles.d.ts.map +1 -1
  82. package/lib/typescript/components/Input/index.d.ts +3 -2
  83. package/lib/typescript/components/Input/index.d.ts.map +1 -1
  84. package/lib/typescript/components/Input/styles.d.ts +1 -1
  85. package/lib/typescript/components/Input/styles.d.ts.map +1 -1
  86. package/lib/typescript/components/Insight/index.d.ts +87 -0
  87. package/lib/typescript/components/Insight/index.d.ts.map +1 -0
  88. package/lib/typescript/components/Insight/insetRadius.d.ts +8 -0
  89. package/lib/typescript/components/Insight/insetRadius.d.ts.map +1 -0
  90. package/lib/typescript/components/Insight/styles.d.ts +33 -0
  91. package/lib/typescript/components/Insight/styles.d.ts.map +1 -0
  92. package/lib/typescript/components/InsightStack/index.d.ts +21 -0
  93. package/lib/typescript/components/InsightStack/index.d.ts.map +1 -0
  94. package/lib/typescript/components/InsightStack/styles.d.ts +11 -0
  95. package/lib/typescript/components/InsightStack/styles.d.ts.map +1 -0
  96. package/lib/typescript/components/OtpInput/index.d.ts +3 -2
  97. package/lib/typescript/components/OtpInput/index.d.ts.map +1 -1
  98. package/lib/typescript/components/Select/index.d.ts +73 -6
  99. package/lib/typescript/components/Select/index.d.ts.map +1 -1
  100. package/lib/typescript/components/Select/styles.d.ts +9 -0
  101. package/lib/typescript/components/Select/styles.d.ts.map +1 -1
  102. package/lib/typescript/components/index.d.ts +2 -0
  103. package/lib/typescript/components/index.d.ts.map +1 -1
  104. package/lib/typescript/components/picker/surfaces.d.ts +14 -3
  105. package/lib/typescript/components/picker/surfaces.d.ts.map +1 -1
  106. package/lib/typescript/figma/Insight.figma.d.ts +8 -0
  107. package/lib/typescript/figma/Insight.figma.d.ts.map +1 -0
  108. package/lib/typescript/figma/InsightStack.figma.d.ts +8 -0
  109. package/lib/typescript/figma/InsightStack.figma.d.ts.map +1 -0
  110. package/package.json +5 -5
  111. package/src/components/ColorField/styles.ts +3 -1
  112. package/src/components/DateField/styles.ts +6 -1
  113. package/src/components/Drawer/index.tsx +1 -1
  114. package/src/components/Input/index.tsx +3 -2
  115. package/src/components/Input/styles.ts +35 -15
  116. package/src/components/Insight/index.tsx +531 -0
  117. package/src/components/Insight/insetRadius.ts +30 -0
  118. package/src/components/Insight/styles.ts +193 -0
  119. package/src/components/InsightStack/index.tsx +86 -0
  120. package/src/components/InsightStack/styles.ts +61 -0
  121. package/src/components/OtpInput/index.tsx +3 -2
  122. package/src/components/Select/index.tsx +411 -29
  123. package/src/components/Select/styles.ts +36 -0
  124. package/src/components/index.ts +2 -0
  125. package/src/components/picker/surfaces.tsx +29 -4
@@ -0,0 +1,438 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.Insight = void 0;
7
+ var _react = require("react");
8
+ var _reactNative = require("react-native");
9
+ var _reactNativeReanimated = _interopRequireWildcard(require("react-native-reanimated"));
10
+ var _uniwind = require("uniwind");
11
+ var _primitives = require("@cdx-ui/primitives");
12
+ var _icons = require("@cdx-ui/icons");
13
+ var _utils = require("@cdx-ui/utils");
14
+ var _Avatar = require("../Avatar");
15
+ var _Chip = require("../Chip");
16
+ var _IconButton = require("../IconButton");
17
+ var _animation = require("../../animation");
18
+ var _insetRadius = require("./insetRadius");
19
+ var _styles = require("./styles");
20
+ var _jsxRuntime = require("react/jsx-runtime");
21
+ function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
22
+ const SCOPE = 'INSIGHT';
23
+ const useInsightStyleContext = () => (0, _utils.useStyleContext)(SCOPE);
24
+ const [InsightTagRegistryProvider, useInsightTagRegistry] = (0, _utils.createContext)('InsightTagRegistry');
25
+ let hasWarnedMissingTag = false;
26
+ const PRESSED_SCALE = 0.98;
27
+ const PRESS_SCALE_DURATION_MS = 120;
28
+
29
+ // =============================================================================
30
+ // ROOT
31
+ // =============================================================================
32
+
33
+ /**
34
+ * `className` and `style` style the outer frame (the border). `asChild` replaces the inner
35
+ * surface element. `onPress` exists only on `layout="summary"`.
36
+ *
37
+ * `ref` targets the element that takes focus: the press region of a summary with `onPress`
38
+ * (the surface, or the region beside the dismiss button when `onClose` is also set), so
39
+ * `ref.current?.focus()` moves focus to the card. A static Insight puts `ref` on its surface.
40
+ */
41
+
42
+ /**
43
+ * Press state lives in InsightRoot's context, but the scaled element is the frame around it, so
44
+ * this child of the root writes the frame's shared value.
45
+ */
46
+ function InsightPressScale({
47
+ scale
48
+ }) {
49
+ const {
50
+ isPressed,
51
+ isPressable
52
+ } = (0, _primitives.useInsightContext)();
53
+ const isAllAnimationsDisabled = (0, _animation.useCombinedAnimationDisabledState)(undefined);
54
+ (0, _react.useEffect)(() => {
55
+ if (!isPressable || isAllAnimationsDisabled) {
56
+ scale.set(1);
57
+ return;
58
+ }
59
+ scale.set((0, _reactNativeReanimated.withTiming)(isPressed ? PRESSED_SCALE : 1, {
60
+ duration: PRESS_SCALE_DURATION_MS
61
+ }));
62
+ }, [scale, isPressed, isPressable, isAllAnimationsDisabled]);
63
+ return null;
64
+ }
65
+ function SummaryBody({
66
+ hasClose,
67
+ scale,
68
+ children
69
+ }) {
70
+ const {
71
+ color
72
+ } = useInsightStyleContext();
73
+ return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
74
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(InsightPressScale, {
75
+ scale: scale
76
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
77
+ "aria-hidden": true,
78
+ accessibilityElementsHidden: true,
79
+ importantForAccessibility: "no-hide-descendants",
80
+ ...(0, _primitives.dataAttributes)({
81
+ slot: 'insight-icon'
82
+ }),
83
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_Avatar.Avatar, {
84
+ size: "md",
85
+ variant: "subtle",
86
+ color: color,
87
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_Avatar.Avatar.Icon, {
88
+ as: _icons.Sparkle,
89
+ className: (0, _styles.insightIconVariants)({
90
+ color
91
+ })
92
+ })
93
+ })
94
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
95
+ className: (0, _styles.insightSummaryTextVariants)({
96
+ hasClose
97
+ }),
98
+ children: children
99
+ })]
100
+ });
101
+ }
102
+ const InsightRootStyled = /*#__PURE__*/(0, _react.forwardRef)((props, ref) => {
103
+ const {
104
+ color = 'info',
105
+ aiGenerated = false,
106
+ onClose,
107
+ closeAccessibilityLabel = 'Dismiss insight',
108
+ asChild = false,
109
+ className,
110
+ style,
111
+ children,
112
+ ...rootProps
113
+ } = props;
114
+ const layout = props.layout ?? 'summary';
115
+ const onPress = props.layout !== 'detail' ? props.onPress : undefined;
116
+ const isDisabled = props.layout !== 'detail' && !!props.isDisabled;
117
+ const hasClose = !!onClose;
118
+ const asChildElement = asChild && /*#__PURE__*/(0, _react.isValidElement)(children);
119
+ const isPressable = layout === 'summary' && !!onPress;
120
+ // Mirrors InsightRoot: an accessory splits a pressable or `asChild` root into a container
121
+ // and a press region.
122
+ const isSplit = hasClose && (isPressable || asChildElement);
123
+
124
+ // The frame scales, not the press region, so the border and the close button move with it.
125
+ const scale = (0, _reactNativeReanimated.useSharedValue)(1);
126
+ // Explicit deps for Vite/web without the Reanimated Babel plugin.
127
+ const pressScaleStyle = (0, _reactNativeReanimated.useAnimatedStyle)(() => ({
128
+ transform: [{
129
+ scale: scale.get()
130
+ }]
131
+ }), [scale]);
132
+ const [tag, setTag] = (0, _react.useState)(null);
133
+ const tagOwnerRef = (0, _react.useRef)(null);
134
+ const registerTag = (0, _react.useCallback)((owner, next) => {
135
+ if (next) {
136
+ tagOwnerRef.current = owner;
137
+ setTag(next);
138
+ } else if (tagOwnerRef.current === owner) {
139
+ tagOwnerRef.current = null;
140
+ setTag(null);
141
+ }
142
+ }, []);
143
+ const registry = (0, _react.useMemo)(() => ({
144
+ registerTag
145
+ }), [registerTag]);
146
+ (0, _react.useEffect)(() => {
147
+ if (__DEV__ && layout === 'detail' && tagOwnerRef.current === null && !hasWarnedMissingTag) {
148
+ hasWarnedMissingTag = true;
149
+ console.warn('[Insight] A `layout="detail"` Insight needs an `Insight.Tag` child. The design has no tagless detail layout.');
150
+ }
151
+ }, [layout]);
152
+
153
+ // A runtime override reaches native as a `px` string, which a `calc()` class turns into NaN.
154
+ // Web keeps the `calc()` class, which tracks the root font size and scoped overrides.
155
+ const radiusVariable = (0, _uniwind.useCSSVariable)('--border-radius-default');
156
+ const surfaceRadius = _reactNative.Platform.OS === 'web' ? undefined : (0, _insetRadius.insetRadius)(radiusVariable, _styles.FRAME_WIDTH);
157
+ const surfaceStyle = (0, _react.useMemo)(() => surfaceRadius === undefined ? undefined : {
158
+ borderRadius: surfaceRadius
159
+ }, [surfaceRadius]);
160
+ const parent = (0, _utils.useParentContext)();
161
+ const ctx = (0, _react.useMemo)(() => ({
162
+ ...parent,
163
+ [SCOPE]: {
164
+ layout,
165
+ color,
166
+ hasClose
167
+ }
168
+ }), [parent, layout, color, hasClose]);
169
+ let content = children;
170
+ if (layout === 'summary') {
171
+ content = asChildElement ? (/*#__PURE__*/(0, _react.cloneElement)(children, undefined, /*#__PURE__*/(0, _jsxRuntime.jsx)(SummaryBody, {
172
+ hasClose: hasClose,
173
+ scale: scale,
174
+ children: children.props.children
175
+ }))) : /*#__PURE__*/(0, _jsxRuntime.jsx)(SummaryBody, {
176
+ hasClose: hasClose,
177
+ scale: scale,
178
+ children: children
179
+ });
180
+ }
181
+ const closeButton = onClose ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_IconButton.IconButton, {
182
+ as: _icons.Close,
183
+ variant: "ghost",
184
+ size: "small",
185
+ color: "neutral",
186
+ onPress: onClose,
187
+ accessibilityLabel: closeAccessibilityLabel,
188
+ className: (0, _styles.insightCloseVariants)(),
189
+ ...(0, _primitives.dataAttributes)({
190
+ slot: 'insight-close'
191
+ })
192
+ }) : undefined;
193
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(_utils.ParentContext.Provider, {
194
+ value: ctx,
195
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(InsightTagRegistryProvider, {
196
+ value: registry,
197
+ children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNativeReanimated.default.View, {
198
+ className: (0, _utils.cn)((0, _styles.insightFrameVariants)({
199
+ layout,
200
+ color,
201
+ aiGenerated
202
+ }), className),
203
+ style: isPressable ? [style, pressScaleStyle] : style,
204
+ ...(0, _primitives.dataAttributes)({
205
+ slot: 'insight-frame',
206
+ ...(isPressable && {
207
+ disabled: isDisabled
208
+ })
209
+ }),
210
+ children: [layout === 'detail' && tag ? /*#__PURE__*/(0, _jsxRuntime.jsx)(InsightTagChip, {
211
+ ...tag
212
+ }) : null, /*#__PURE__*/(0, _jsxRuntime.jsx)(_primitives.InsightRoot, {
213
+ ...rootProps,
214
+ ref: ref,
215
+ asChild: asChild,
216
+ style: surfaceStyle,
217
+ accessory: closeButton,
218
+ className: (0, _styles.insightSurfaceVariants)({
219
+ layout,
220
+ split: isSplit
221
+ }),
222
+ pressableClassName: isSplit && layout === 'summary' ? (0, _styles.insightPressRegionVariants)() : undefined,
223
+ ...(0, _primitives.mergeDataAttributes)(rootProps, (0, _primitives.dataAttributes)({
224
+ slot: 'insight'
225
+ })),
226
+ children: content
227
+ })]
228
+ })
229
+ })
230
+ });
231
+ });
232
+ InsightRootStyled.displayName = 'Insight';
233
+
234
+ // =============================================================================
235
+ // TAG
236
+ // =============================================================================
237
+
238
+ function InsightTagChip({
239
+ asChild,
240
+ className,
241
+ style,
242
+ children,
243
+ ref,
244
+ ...props
245
+ }) {
246
+ const {
247
+ color
248
+ } = useInsightStyleContext();
249
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
250
+ ref: ref,
251
+ className: (0, _utils.cn)((0, _styles.insightTagVariants)(), className),
252
+ style: style,
253
+ ...props,
254
+ ...(0, _primitives.mergeDataAttributes)(props, (0, _primitives.dataAttributes)({
255
+ slot: 'insight-tag'
256
+ })),
257
+ children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_Chip.Chip, {
258
+ variant: "subtle",
259
+ size: "small",
260
+ color: color,
261
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_Chip.Chip.Icon, {
262
+ as: _icons.Sparkle,
263
+ position: "leading",
264
+ className: (0, _styles.insightTagIconVariants)({
265
+ color
266
+ })
267
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_Chip.Chip.Label, {
268
+ asChild: asChild,
269
+ children: children
270
+ })]
271
+ })
272
+ });
273
+ }
274
+
275
+ /**
276
+ * The detail layout's category tag. Insight renders it as a Sparkle chip straddling the top
277
+ * border, ahead of the header in reading order, wherever it appears among the children.
278
+ */
279
+ const InsightTag = /*#__PURE__*/(0, _react.forwardRef)((props, ref) => {
280
+ const {
281
+ registerTag
282
+ } = useInsightTagRegistry();
283
+ const [owner] = (0, _react.useState)(() => ({}));
284
+ (0, _react.useLayoutEffect)(() => {
285
+ registerTag(owner, {
286
+ ...props,
287
+ ref
288
+ });
289
+ }, [registerTag, owner, props, ref]);
290
+ (0, _react.useLayoutEffect)(() => () => registerTag(owner, null), [registerTag, owner]);
291
+ return null;
292
+ });
293
+ InsightTag.displayName = 'Insight.Tag';
294
+
295
+ // =============================================================================
296
+ // HEADER
297
+ // =============================================================================
298
+
299
+ const InsightHeader = /*#__PURE__*/(0, _react.forwardRef)(({
300
+ asChild,
301
+ className,
302
+ children,
303
+ style,
304
+ ...props
305
+ }, ref) => {
306
+ const Comp = asChild ? _primitives.Slot : _reactNative.View;
307
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(Comp, {
308
+ ref: ref,
309
+ className: (0, _utils.cn)((0, _styles.insightHeaderVariants)(), className),
310
+ style: style,
311
+ ...props,
312
+ ...(0, _primitives.mergeDataAttributes)(props, (0, _primitives.dataAttributes)({
313
+ slot: 'insight-header'
314
+ })),
315
+ children: children
316
+ });
317
+ });
318
+ InsightHeader.displayName = 'Insight.Header';
319
+
320
+ // =============================================================================
321
+ // TITLE
322
+ // =============================================================================
323
+
324
+ const InsightTitle = /*#__PURE__*/(0, _react.forwardRef)(({
325
+ asChild,
326
+ className,
327
+ children,
328
+ style,
329
+ ...props
330
+ }, ref) => {
331
+ const {
332
+ hasClose
333
+ } = useInsightStyleContext();
334
+ const Comp = asChild ? _primitives.Slot : _reactNative.Text;
335
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(Comp, {
336
+ ref: ref,
337
+ role: "heading",
338
+ className: (0, _utils.cn)((0, _styles.insightTitleVariants)({
339
+ hasClose
340
+ }), className),
341
+ style: style,
342
+ ...props,
343
+ ...(0, _primitives.mergeDataAttributes)(props, (0, _primitives.dataAttributes)({
344
+ slot: 'insight-title'
345
+ })),
346
+ children: children
347
+ });
348
+ });
349
+ InsightTitle.displayName = 'Insight.Title';
350
+
351
+ // =============================================================================
352
+ // DESCRIPTION
353
+ // =============================================================================
354
+
355
+ const InsightDescription = /*#__PURE__*/(0, _react.forwardRef)(({
356
+ asChild,
357
+ className,
358
+ children,
359
+ style,
360
+ ...props
361
+ }, ref) => {
362
+ const Comp = asChild ? _primitives.Slot : _reactNative.Text;
363
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(Comp, {
364
+ ref: ref,
365
+ className: (0, _utils.cn)((0, _styles.insightDescriptionVariants)(), className),
366
+ style: style,
367
+ ...props,
368
+ ...(0, _primitives.mergeDataAttributes)(props, (0, _primitives.dataAttributes)({
369
+ slot: 'insight-description'
370
+ })),
371
+ children: children
372
+ });
373
+ });
374
+ InsightDescription.displayName = 'Insight.Description';
375
+
376
+ // =============================================================================
377
+ // CONTENT
378
+ // =============================================================================
379
+
380
+ const InsightContent = /*#__PURE__*/(0, _react.forwardRef)(({
381
+ asChild,
382
+ className,
383
+ children,
384
+ style,
385
+ ...props
386
+ }, ref) => {
387
+ const Comp = asChild ? _primitives.Slot : _reactNative.View;
388
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(Comp, {
389
+ ref: ref,
390
+ className: (0, _utils.cn)((0, _styles.insightContentVariants)(), className),
391
+ style: style,
392
+ ...props,
393
+ ...(0, _primitives.mergeDataAttributes)(props, (0, _primitives.dataAttributes)({
394
+ slot: 'insight-content'
395
+ })),
396
+ children: children
397
+ });
398
+ });
399
+ InsightContent.displayName = 'Insight.Content';
400
+
401
+ // =============================================================================
402
+ // FOOTER
403
+ // =============================================================================
404
+
405
+ const InsightFooter = /*#__PURE__*/(0, _react.forwardRef)(({
406
+ asChild,
407
+ className,
408
+ children,
409
+ style,
410
+ ...props
411
+ }, ref) => {
412
+ const Comp = asChild ? _primitives.Slot : _reactNative.View;
413
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(Comp, {
414
+ ref: ref,
415
+ className: (0, _utils.cn)((0, _styles.insightFooterVariants)(), className),
416
+ style: style,
417
+ ...props,
418
+ ...(0, _primitives.mergeDataAttributes)(props, (0, _primitives.dataAttributes)({
419
+ slot: 'insight-footer'
420
+ })),
421
+ children: children
422
+ });
423
+ });
424
+ InsightFooter.displayName = 'Insight.Footer';
425
+
426
+ // =============================================================================
427
+ // COMPOUND COMPONENT
428
+ // =============================================================================
429
+
430
+ const Insight = exports.Insight = Object.assign(InsightRootStyled, {
431
+ Tag: InsightTag,
432
+ Header: InsightHeader,
433
+ Title: InsightTitle,
434
+ Description: InsightDescription,
435
+ Content: InsightContent,
436
+ Footer: InsightFooter
437
+ });
438
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_react","require","_reactNative","_reactNativeReanimated","_interopRequireWildcard","_uniwind","_primitives","_icons","_utils","_Avatar","_Chip","_IconButton","_animation","_insetRadius","_styles","_jsxRuntime","e","t","WeakMap","r","n","__esModule","o","i","f","__proto__","default","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","SCOPE","useInsightStyleContext","useStyleContext","InsightTagRegistryProvider","useInsightTagRegistry","createContext","hasWarnedMissingTag","PRESSED_SCALE","PRESS_SCALE_DURATION_MS","InsightPressScale","scale","isPressed","isPressable","useInsightContext","isAllAnimationsDisabled","useCombinedAnimationDisabledState","undefined","useEffect","withTiming","duration","SummaryBody","hasClose","children","color","jsxs","Fragment","jsx","View","accessibilityElementsHidden","importantForAccessibility","dataAttributes","slot","Avatar","size","variant","Icon","as","Sparkle","className","insightIconVariants","insightSummaryTextVariants","InsightRootStyled","forwardRef","props","ref","aiGenerated","onClose","closeAccessibilityLabel","asChild","style","rootProps","layout","onPress","isDisabled","asChildElement","isValidElement","isSplit","useSharedValue","pressScaleStyle","useAnimatedStyle","transform","tag","setTag","useState","tagOwnerRef","useRef","registerTag","useCallback","owner","next","current","registry","useMemo","__DEV__","console","warn","radiusVariable","useCSSVariable","surfaceRadius","Platform","OS","insetRadius","FRAME_WIDTH","surfaceStyle","borderRadius","parent","useParentContext","ctx","content","cloneElement","closeButton","IconButton","Close","accessibilityLabel","insightCloseVariants","ParentContext","Provider","value","cn","insightFrameVariants","disabled","InsightTagChip","InsightRoot","accessory","insightSurfaceVariants","split","pressableClassName","insightPressRegionVariants","mergeDataAttributes","displayName","insightTagVariants","Chip","position","insightTagIconVariants","Label","InsightTag","useLayoutEffect","InsightHeader","Comp","Slot","insightHeaderVariants","InsightTitle","Text","role","insightTitleVariants","InsightDescription","insightDescriptionVariants","InsightContent","insightContentVariants","InsightFooter","insightFooterVariants","Insight","exports","assign","Tag","Header","Title","Description","Content","Footer"],"sourceRoot":"../../../../src","sources":["components/Insight/index.tsx"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AAcA,IAAAC,YAAA,GAAAD,OAAA;AACA,IAAAE,sBAAA,GAAAC,uBAAA,CAAAH,OAAA;AAMA,IAAAI,QAAA,GAAAJ,OAAA;AACA,IAAAK,WAAA,GAAAL,OAAA;AAUA,IAAAM,MAAA,GAAAN,OAAA;AACA,IAAAO,MAAA,GAAAP,OAAA;AACA,IAAAQ,OAAA,GAAAR,OAAA;AACA,IAAAS,KAAA,GAAAT,OAAA;AACA,IAAAU,WAAA,GAAAV,OAAA;AACA,IAAAW,UAAA,GAAAX,OAAA;AACA,IAAAY,YAAA,GAAAZ,OAAA;AACA,IAAAa,OAAA,GAAAb,OAAA;AAekB,IAAAc,WAAA,GAAAd,OAAA;AAAA,SAAAG,wBAAAY,CAAA,EAAAC,CAAA,6BAAAC,OAAA,MAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAd,uBAAA,YAAAA,CAAAY,CAAA,EAAAC,CAAA,SAAAA,CAAA,IAAAD,CAAA,IAAAA,CAAA,CAAAK,UAAA,SAAAL,CAAA,MAAAM,CAAA,EAAAC,CAAA,EAAAC,CAAA,KAAAC,SAAA,QAAAC,OAAA,EAAAV,CAAA,iBAAAA,CAAA,uBAAAA,CAAA,yBAAAA,CAAA,SAAAQ,CAAA,MAAAF,CAAA,GAAAL,CAAA,GAAAG,CAAA,GAAAD,CAAA,QAAAG,CAAA,CAAAK,GAAA,CAAAX,CAAA,UAAAM,CAAA,CAAAM,GAAA,CAAAZ,CAAA,GAAAM,CAAA,CAAAO,GAAA,CAAAb,CAAA,EA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,+BAAmB,EAACjE,KAAK,EAAE,IAAAb,0BAAc,EAAC;MAAEC,IAAI,EAAE;IAAiB,CAAC,CAAC,CAAC;IAAAT,QAAA,EAEzEA;EAAQ,CACL,CAAC;AAEX,CACF,CAAC;AAED2G,aAAa,CAACpB,WAAW,GAAG,gBAAgB;;AAE5C;AACA;AACA;;AAWO,MAAMsB,OAAO,GAAAC,OAAA,CAAAD,OAAA,GAAGtI,MAAM,CAACwI,MAAM,CAAC5F,iBAAiB,EAAE;EACtD6F,GAAG,EAAEnB,UAAU;EACfoB,MAAM,EAAElB,aAAa;EACrBmB,KAAK,EAAEf,YAAY;EACnBgB,WAAW,EAAEZ,kBAAkB;EAC/Ba,OAAO,EAAEX,cAAc;EACvBY,MAAM,EAAEV;AACV,CAAC,CAA6B","ignoreList":[]}
@@ -0,0 +1,35 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.cssLengthToPx = cssLengthToPx;
7
+ exports.insetRadius = insetRadius;
8
+ const ROOT_FONT_SIZE_PX = 16;
9
+ const LENGTH_PATTERN = /^(-?\d*\.?\d+)(px|rem)?$/;
10
+
11
+ /**
12
+ * Converts a resolved CSS variable (a number, or a `px`/`rem` string) to pixels. Native resolves
13
+ * built-in tokens to numbers, while runtime theme overrides and the web resolve to strings.
14
+ */
15
+ function cssLengthToPx(value) {
16
+ if (typeof value === 'number') {
17
+ return Number.isFinite(value) ? value : undefined;
18
+ }
19
+ if (typeof value !== 'string') {
20
+ return undefined;
21
+ }
22
+ const match = LENGTH_PATTERN.exec(value.trim());
23
+ if (!match) {
24
+ return undefined;
25
+ }
26
+ const amount = Number(match[1]);
27
+ return match[2] === 'rem' ? amount * ROOT_FONT_SIZE_PX : amount;
28
+ }
29
+
30
+ /** The radius of a surface inset `inset` px inside a frame with radius `outer`, or `undefined` when `outer` is not a length. */
31
+ function insetRadius(outer, inset) {
32
+ const px = cssLengthToPx(outer);
33
+ return px === undefined ? undefined : Math.max(0, px - inset);
34
+ }
35
+ //# sourceMappingURL=insetRadius.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["ROOT_FONT_SIZE_PX","LENGTH_PATTERN","cssLengthToPx","value","Number","isFinite","undefined","match","exec","trim","amount","insetRadius","outer","inset","px","Math","max"],"sourceRoot":"../../../../src","sources":["components/Insight/insetRadius.ts"],"mappings":";;;;;;;AAAA,MAAMA,iBAAiB,GAAG,EAAE;AAE5B,MAAMC,cAAc,GAAG,0BAA0B;;AAEjD;AACA;AACA;AACA;AACO,SAASC,aAAaA,CAACC,KAAkC,EAAsB;EACpF,IAAI,OAAOA,KAAK,KAAK,QAAQ,EAAE;IAC7B,OAAOC,MAAM,CAACC,QAAQ,CAACF,KAAK,CAAC,GAAGA,KAAK,GAAGG,SAAS;EACnD;EACA,IAAI,OAAOH,KAAK,KAAK,QAAQ,EAAE;IAC7B,OAAOG,SAAS;EAClB;EAEA,MAAMC,KAAK,GAAGN,cAAc,CAACO,IAAI,CAACL,KAAK,CAACM,IAAI,CAAC,CAAC,CAAC;EAC/C,IAAI,CAACF,KAAK,EAAE;IACV,OAAOD,SAAS;EAClB;EAEA,MAAMI,MAAM,GAAGN,MAAM,CAACG,KAAK,CAAC,CAAC,CAAC,CAAC;EAC/B,OAAOA,KAAK,CAAC,CAAC,CAAC,KAAK,KAAK,GAAGG,MAAM,GAAGV,iBAAiB,GAAGU,MAAM;AACjE;;AAEA;AACO,SAASC,WAAWA,CAACC,KAAkC,EAAEC,KAAa,EAAsB;EACjG,MAAMC,EAAE,GAAGZ,aAAa,CAACU,KAAK,CAAC;EAC/B,OAAOE,EAAE,KAAKR,SAAS,GAAGA,SAAS,GAAGS,IAAI,CAACC,GAAG,CAAC,CAAC,EAAEF,EAAE,GAAGD,KAAK,CAAC;AAC/D","ignoreList":[]}