@cdx-ui/components 0.3.2 → 0.3.3

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 (66) hide show
  1. package/README.md +2 -2
  2. package/coverage.svg +1 -1
  3. package/docs/components/content.md +2 -0
  4. package/docs/components/data-grid/content.md +125 -1
  5. package/docs/components/insight/content.md +644 -0
  6. package/docs/components/insight-stack/content.md +231 -0
  7. package/docs/foundations/styles/tokens/all-tokens/content.md +23 -3
  8. package/docs/llms.txt +3 -0
  9. package/docs/patterns/forms/content.md +255 -0
  10. package/docs/resources/release-notes/0.3.2/content.md +17 -0
  11. package/docs/resources/release-notes/content.md +1 -0
  12. package/lib/commonjs/components/Insight/index.js +438 -0
  13. package/lib/commonjs/components/Insight/index.js.map +1 -0
  14. package/lib/commonjs/components/Insight/insetRadius.js +35 -0
  15. package/lib/commonjs/components/Insight/insetRadius.js.map +1 -0
  16. package/lib/commonjs/components/Insight/styles.js +186 -0
  17. package/lib/commonjs/components/Insight/styles.js.map +1 -0
  18. package/lib/commonjs/components/InsightStack/index.js +93 -0
  19. package/lib/commonjs/components/InsightStack/index.js.map +1 -0
  20. package/lib/commonjs/components/InsightStack/styles.js +61 -0
  21. package/lib/commonjs/components/InsightStack/styles.js.map +1 -0
  22. package/lib/commonjs/components/index.js +24 -0
  23. package/lib/commonjs/components/index.js.map +1 -1
  24. package/lib/commonjs/figma/Insight.figma.js +73 -0
  25. package/lib/commonjs/figma/Insight.figma.js.map +1 -0
  26. package/lib/commonjs/figma/InsightStack.figma.js +39 -0
  27. package/lib/commonjs/figma/InsightStack.figma.js.map +1 -0
  28. package/lib/module/components/Insight/index.js +433 -0
  29. package/lib/module/components/Insight/index.js.map +1 -0
  30. package/lib/module/components/Insight/insetRadius.js +30 -0
  31. package/lib/module/components/Insight/insetRadius.js.map +1 -0
  32. package/lib/module/components/Insight/styles.js +183 -0
  33. package/lib/module/components/Insight/styles.js.map +1 -0
  34. package/lib/module/components/InsightStack/index.js +89 -0
  35. package/lib/module/components/InsightStack/index.js.map +1 -0
  36. package/lib/module/components/InsightStack/styles.js +58 -0
  37. package/lib/module/components/InsightStack/styles.js.map +1 -0
  38. package/lib/module/components/index.js +2 -0
  39. package/lib/module/components/index.js.map +1 -1
  40. package/lib/module/figma/Insight.figma.js +67 -0
  41. package/lib/module/figma/Insight.figma.js.map +1 -0
  42. package/lib/module/figma/InsightStack.figma.js +33 -0
  43. package/lib/module/figma/InsightStack.figma.js.map +1 -0
  44. package/lib/typescript/components/Insight/index.d.ts +87 -0
  45. package/lib/typescript/components/Insight/index.d.ts.map +1 -0
  46. package/lib/typescript/components/Insight/insetRadius.d.ts +8 -0
  47. package/lib/typescript/components/Insight/insetRadius.d.ts.map +1 -0
  48. package/lib/typescript/components/Insight/styles.d.ts +33 -0
  49. package/lib/typescript/components/Insight/styles.d.ts.map +1 -0
  50. package/lib/typescript/components/InsightStack/index.d.ts +21 -0
  51. package/lib/typescript/components/InsightStack/index.d.ts.map +1 -0
  52. package/lib/typescript/components/InsightStack/styles.d.ts +11 -0
  53. package/lib/typescript/components/InsightStack/styles.d.ts.map +1 -0
  54. package/lib/typescript/components/index.d.ts +2 -0
  55. package/lib/typescript/components/index.d.ts.map +1 -1
  56. package/lib/typescript/figma/Insight.figma.d.ts +8 -0
  57. package/lib/typescript/figma/Insight.figma.d.ts.map +1 -0
  58. package/lib/typescript/figma/InsightStack.figma.d.ts +8 -0
  59. package/lib/typescript/figma/InsightStack.figma.d.ts.map +1 -0
  60. package/package.json +5 -5
  61. package/src/components/Insight/index.tsx +531 -0
  62. package/src/components/Insight/insetRadius.ts +30 -0
  63. package/src/components/Insight/styles.ts +193 -0
  64. package/src/components/InsightStack/index.tsx +86 -0
  65. package/src/components/InsightStack/styles.ts +61 -0
  66. package/src/components/index.ts +2 -0
@@ -0,0 +1,183 @@
1
+ "use strict";
2
+
3
+ import { cva } from '@cdx-ui/utils';
4
+ import { DISABLED_CURSOR } from '../../styles/constants';
5
+
6
+ /** Ring width in px; must match the frame's `p-0.5`. */
7
+ export const FRAME_WIDTH = 2;
8
+
9
+ // Fallback for when `--border-radius-default` can't be read; the surface style overrides it.
10
+ const SURFACE_RADIUS = 'rounded-[calc(var(--border-radius-default)-2px)]';
11
+
12
+ // Figma measures padding from inside the 2px stroke, and the frame's `p-0.5` is that stroke, so
13
+ // these are the Figma values as-is. `min-h-14` is the natural one-line height: 12 + 32 + 12.
14
+ const SUMMARY_BODY = 'flex-row items-start gap-2.5 min-h-14 pt-2.5 pb-3 ps-2.5 pe-3';
15
+
16
+ // The standard web focus ring (2px `stroke-focus`, 2px clear of the card's edge) and disabled
17
+ // cursor, on whichever element takes focus. That element sits inside the 2px frame, and a
18
+ // `ring-offset` would paint its offset colour over the frame, so the ring is an outline: its
19
+ // offset stays transparent and it follows the surface radius. Figma has no hover or press tint
20
+ // for the card; the press scale is its only press feedback.
21
+ const PRESS_REGION_STATE = ['web:outline-none', DISABLED_CURSOR, 'web:data-[focus-visible=true]:outline-2 web:data-[focus-visible=true]:outline-solid web:data-[focus-visible=true]:outline-stroke-focus web:data-[focus-visible=true]:outline-offset-4'].join(' ');
22
+
23
+ // ── Frame ───────────────────────────────────────────────────
24
+
25
+ // The frame dims as a whole when disabled: dimming only the surface would let the frame's fill
26
+ // show through it.
27
+ export const insightFrameVariants = cva(['relative p-0.5', 'rounded-[var(--border-radius-default)]', 'data-[disabled=true]:opacity-[var(--opacity-disabled)]'], {
28
+ variants: {
29
+ layout: {
30
+ summary: '',
31
+ // Reserves the tag overhang (11px above the outer edge) so a scroll container's top
32
+ // edge does not clip it.
33
+ detail: 'mt-[11px]'
34
+ },
35
+ color: {
36
+ info: '',
37
+ warning: '',
38
+ danger: ''
39
+ },
40
+ aiGenerated: {
41
+ true: 'bg-gradient-to-r from-stroke-ai-start to-stroke-ai-end',
42
+ false: ''
43
+ }
44
+ },
45
+ compoundVariants: [{
46
+ aiGenerated: false,
47
+ color: 'info',
48
+ className: 'bg-stroke-info-subtle'
49
+ }, {
50
+ aiGenerated: false,
51
+ color: 'warning',
52
+ className: 'bg-stroke-warning-subtle'
53
+ }, {
54
+ aiGenerated: false,
55
+ color: 'danger',
56
+ className: 'bg-stroke-danger-subtle'
57
+ },
58
+ // The AI glow takes the insight's colour; the gradient ring does not.
59
+ {
60
+ aiGenerated: true,
61
+ color: 'info',
62
+ className: 'shadow-[0_0_3px_var(--color-surface-info-subtle)]'
63
+ }, {
64
+ aiGenerated: true,
65
+ color: 'warning',
66
+ className: 'shadow-[0_0_3px_var(--color-surface-warning-subtle)]'
67
+ }, {
68
+ aiGenerated: true,
69
+ color: 'danger',
70
+ className: 'shadow-[0_0_3px_var(--color-surface-danger-subtle)]'
71
+ }],
72
+ defaultVariants: {
73
+ layout: 'summary',
74
+ color: 'info',
75
+ aiGenerated: false
76
+ }
77
+ });
78
+
79
+ // ── Surface ─────────────────────────────────────────────────
80
+
81
+ export const insightSurfaceVariants = cva(['bg-surface-primary', SURFACE_RADIUS], {
82
+ variants: {
83
+ layout: {
84
+ summary: '',
85
+ detail: 'pt-5 px-3 pb-3 gap-4'
86
+ },
87
+ // A split summary moves the body layout onto the press region.
88
+ split: {
89
+ true: '',
90
+ false: ''
91
+ }
92
+ },
93
+ // A split summary's surface only mirrors the press region's state, so the region styles it.
94
+ compoundVariants: [{
95
+ layout: 'summary',
96
+ split: false,
97
+ className: [SUMMARY_BODY, PRESS_REGION_STATE]
98
+ }],
99
+ defaultVariants: {
100
+ layout: 'summary',
101
+ split: false
102
+ }
103
+ });
104
+
105
+ // Web-only radius: the region has no fill, so the radius only shapes the web focus outline, and
106
+ // on native a runtime `px` override turns the `calc()` into NaN.
107
+ export const insightPressRegionVariants = cva([SUMMARY_BODY, 'web:rounded-[calc(var(--border-radius-default)-2px)]', PRESS_REGION_STATE]);
108
+
109
+ // ── Summary medallion icon ──────────────────────────────────
110
+
111
+ // `size-5` overrides Avatar md's `size-4`: the Figma medallion glyph is 20px.
112
+ export const insightIconVariants = cva(['size-5'], {
113
+ variants: {
114
+ color: {
115
+ info: 'text-content-info-on-subtle',
116
+ warning: 'text-content-warning-on-subtle',
117
+ danger: 'text-content-danger-on-subtle'
118
+ }
119
+ },
120
+ defaultVariants: {
121
+ color: 'info'
122
+ }
123
+ });
124
+
125
+ // ── Summary text column ─────────────────────────────────────
126
+
127
+ // Figma's text row is a 32px-min band, centred, starting 2px below the medallion's top. One line
128
+ // sits centred against the medallion; longer copy grows downward while the medallion stays put.
129
+ export const insightSummaryTextVariants = cva(['flex-1 min-w-0 mt-0.5 min-h-8 justify-center'], {
130
+ variants: {
131
+ hasClose: {
132
+ true: 'pe-7',
133
+ false: ''
134
+ }
135
+ },
136
+ defaultVariants: {
137
+ hasClose: false
138
+ }
139
+ });
140
+
141
+ // ── Tag ─────────────────────────────────────────────────────
142
+
143
+ // Positioned against the frame's outer edge: the 24px chip centres on the 2px stroke (-11px) and
144
+ // starts 12px from the outer start edge.
145
+ export const insightTagVariants = cva(['absolute z-10 -top-[11px] start-3']);
146
+ export const insightTagIconVariants = cva([], {
147
+ variants: {
148
+ color: {
149
+ info: 'text-content-info-on-subtle',
150
+ warning: 'text-content-warning-on-subtle',
151
+ danger: 'text-content-danger-on-subtle'
152
+ }
153
+ },
154
+ defaultVariants: {
155
+ color: 'info'
156
+ }
157
+ });
158
+
159
+ // ── Close ───────────────────────────────────────────────────
160
+
161
+ // Positioned against the surface (inside the ring): 4px from its top and end, as in Figma.
162
+ export const insightCloseVariants = cva(['absolute top-1 end-1']);
163
+
164
+ // ── Header / Title / Description / Content / Footer ─────────
165
+
166
+ export const insightHeaderVariants = cva(['gap-0.5 min-h-8 justify-center']);
167
+ export const insightTitleVariants = cva(['heading-sm text-content-primary'], {
168
+ variants: {
169
+ hasClose: {
170
+ true: 'pe-7',
171
+ false: ''
172
+ }
173
+ },
174
+ defaultVariants: {
175
+ hasClose: false
176
+ }
177
+ });
178
+ export const insightDescriptionVariants = cva(['body-md text-content-primary']);
179
+ export const insightContentVariants = cva([]);
180
+
181
+ // Wraps so actions keep their natural widths at narrow widths instead of overflowing the start edge.
182
+ export const insightFooterVariants = cva(['flex-row flex-wrap items-center justify-end gap-2']);
183
+ //# sourceMappingURL=styles.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["cva","DISABLED_CURSOR","FRAME_WIDTH","SURFACE_RADIUS","SUMMARY_BODY","PRESS_REGION_STATE","join","insightFrameVariants","variants","layout","summary","detail","color","info","warning","danger","aiGenerated","true","false","compoundVariants","className","defaultVariants","insightSurfaceVariants","split","insightPressRegionVariants","insightIconVariants","insightSummaryTextVariants","hasClose","insightTagVariants","insightTagIconVariants","insightCloseVariants","insightHeaderVariants","insightTitleVariants","insightDescriptionVariants","insightContentVariants","insightFooterVariants"],"sourceRoot":"../../../../src","sources":["components/Insight/styles.ts"],"mappings":";;AAAA,SAASA,GAAG,QAA2B,eAAe;AACtD,SAASC,eAAe,QAAQ,wBAAwB;;AAExD;AACA,OAAO,MAAMC,WAAW,GAAG,CAAC;;AAE5B;AACA,MAAMC,cAAc,GAAG,kDAAkD;;AAEzE;AACA;AACA,MAAMC,YAAY,GAAG,+DAA+D;;AAEpF;AACA;AACA;AACA;AACA;AACA,MAAMC,kBAAkB,GAAG,CACzB,kBAAkB,EAClBJ,eAAe,EACf,uLAAuL,CACxL,CAACK,IAAI,CAAC,GAAG,CAAC;;AAEX;;AAEA;AACA;AACA,OAAO,MAAMC,oBAAoB,GAAGP,GAAG,CACrC,CACE,gBAAgB,EAChB,wCAAwC,EACxC,wDAAwD,CACzD,EACD;EACEQ,QAAQ,EAAE;IACRC,MAAM,EAAE;MACNC,OAAO,EAAE,EAAE;MACX;MACA;MACAC,MAAM,EAAE;IACV,CAAC;IACDC,KAAK,EAAE;MACLC,IAAI,EAAE,EAAE;MACRC,OAAO,EAAE,EAAE;MACXC,MAAM,EAAE;IACV,CAAC;IACDC,WAAW,EAAE;MACXC,IAAI,EAAE,wDAAwD;MAC9DC,KAAK,EAAE;IACT;EACF,CAAC;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ACRV,IAAI,EAAE,MAAM;MACZC,KAAK,EAAE;IACT;EACF,CAAC;EACDG,eAAe,EAAE;IACfM,QAAQ,EAAE;EACZ;AACF,CAAC,CAAC;AAEF,OAAO,MAAMM,0BAA0B,GAAGjC,GAAG,CAAC,CAAC,8BAA8B,CAAC,CAAC;AAE/E,OAAO,MAAMkC,sBAAsB,GAAGlC,GAAG,CAAC,EAAE,CAAC;;AAE7C;AACA,OAAO,MAAMmC,qBAAqB,GAAGnC,GAAG,CAAC,CAAC,mDAAmD,CAAC,CAAC","ignoreList":[]}
@@ -0,0 +1,89 @@
1
+ "use strict";
2
+
3
+ import { cloneElement, forwardRef, isValidElement } from 'react';
4
+ import { View } from 'react-native';
5
+ import { Slot, dataAttributes, mergeDataAttributes } from '@cdx-ui/primitives';
6
+ import { cn } from '@cdx-ui/utils';
7
+ import { insightStackFrontVariants, insightStackLayerVariants, insightStackRootVariants } from './styles';
8
+ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
9
+ const layerCountFor = count => count >= 3 ? 2 : count >= 2 ? 1 : 0;
10
+ function InsightStackLayer({
11
+ depth,
12
+ layers
13
+ }) {
14
+ return /*#__PURE__*/_jsx(View, {
15
+ "aria-hidden": true,
16
+ accessibilityElementsHidden: true,
17
+ importantForAccessibility: "no-hide-descendants",
18
+ className: insightStackLayerVariants({
19
+ depth,
20
+ layers
21
+ }),
22
+ ...dataAttributes({
23
+ slot: 'insight-stack-layer'
24
+ })
25
+ });
26
+ }
27
+ function InsightStackBody({
28
+ layers,
29
+ children
30
+ }) {
31
+ return /*#__PURE__*/_jsxs(_Fragment, {
32
+ children: [layers === 2 ? /*#__PURE__*/_jsx(InsightStackLayer, {
33
+ depth: 2,
34
+ layers: 2
35
+ }) : null, layers === 0 ? null : /*#__PURE__*/_jsx(InsightStackLayer, {
36
+ depth: 1,
37
+ layers: layers
38
+ }), /*#__PURE__*/_jsx(View, {
39
+ className: insightStackFrontVariants(),
40
+ children: children
41
+ })]
42
+ });
43
+ }
44
+
45
+ /**
46
+ * Draws up to two decorative cards behind a summary Insight to show that more insights exist.
47
+ * The root adds no role, so the front Insight stays the only interactive element.
48
+ */
49
+ export const InsightStack = /*#__PURE__*/forwardRef(({
50
+ count,
51
+ asChild = false,
52
+ className,
53
+ style,
54
+ children,
55
+ ...props
56
+ }, ref) => {
57
+ const layers = layerCountFor(count);
58
+ const rootProps = {
59
+ className: cn(insightStackRootVariants({
60
+ layers
61
+ }), className),
62
+ style,
63
+ ...props,
64
+ ...mergeDataAttributes(props, dataAttributes({
65
+ slot: 'insight-stack'
66
+ }))
67
+ };
68
+ if (asChild && /*#__PURE__*/isValidElement(children)) {
69
+ const child = children;
70
+ return /*#__PURE__*/_jsx(Slot, {
71
+ ref: ref,
72
+ ...rootProps,
73
+ children: /*#__PURE__*/cloneElement(child, undefined, /*#__PURE__*/_jsx(InsightStackBody, {
74
+ layers: layers,
75
+ children: child.props.children
76
+ }))
77
+ });
78
+ }
79
+ return /*#__PURE__*/_jsx(View, {
80
+ ref: ref,
81
+ ...rootProps,
82
+ children: /*#__PURE__*/_jsx(InsightStackBody, {
83
+ layers: layers,
84
+ children: children
85
+ })
86
+ });
87
+ });
88
+ InsightStack.displayName = 'InsightStack';
89
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["cloneElement","forwardRef","isValidElement","View","Slot","dataAttributes","mergeDataAttributes","cn","insightStackFrontVariants","insightStackLayerVariants","insightStackRootVariants","jsx","_jsx","Fragment","_Fragment","jsxs","_jsxs","layerCountFor","count","InsightStackLayer","depth","layers","accessibilityElementsHidden","importantForAccessibility","className","slot","InsightStackBody","children","InsightStack","asChild","style","props","ref","rootProps","child","undefined","displayName"],"sourceRoot":"../../../../src","sources":["components/InsightStack/index.tsx"],"mappings":";;AAAA,SAASA,YAAY,EAAEC,UAAU,EAAEC,cAAc,QAA2C,OAAO;AACnG,SAASC,IAAI,QAAwB,cAAc;AACnD,SAASC,IAAI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C,CAAC;EAAEiB,KAAK;EAAEW,OAAO,GAAG,KAAK;EAAEL,SAAS;EAAEM,KAAK;EAAEH,QAAQ;EAAE,GAAGI;AAAM,CAAC,EAAEC,GAAG,KAAK;EACzE,MAAMX,MAAM,GAAGJ,aAAa,CAACC,KAAK,CAAC;EACnC,MAAMe,SAAS,GAAG;IAChBT,SAAS,EAAEjB,EAAE,CAACG,wBAAwB,CAAC;MAAEW;IAAO,CAAC,CAAC,EAAEG,SAAS,CAAC;IAC9DM,KAAK;IACL,GAAGC,KAAK;IACR,GAAGzB,mBAAmB,CAACyB,KAAK,EAAE1B,cAAc,CAAC;MAAEoB,IAAI,EAAE;IAAgB,CAAC,CAAC;EACzE,CAAC;EAED,IAAII,OAAO,iBAAI3B,cAAc,CAACyB,QAAQ,CAAC,EAAE;IACvC,MAAMO,KAAK,GAAGP,QAAkD;IAChE,oBACEf,IAAA,CAACR,IAAI;MAAC4B,GAAG,EAAEA,GAAI;MAAA,GAAKC,SAAS;MAAAN,QAAA,eAC1B3B,YAAY,CACXkC,KAAK,EACLC,SAAS,eACTvB,IAAA,CAACc,gBAAgB;QAACL,MAAM,EAAEA,MAAO;QAAAM,QAAA,EAAEO,KAAK,CAACH,KAAK,CAACJ;MAAQ,CAAmB,CAC5E;IAAC,CACG,CAAC;EAEX;EAEA,oBACEf,IAAA,CAACT,IAAI;IAAC6B,GAAG,EAAEA,GAAI;IAAA,GAAKC,SAAS;IAAAN,QAAA,eAC3Bf,IAAA,CAACc,gBAAgB;MAACL,MAAM,EAAEA,MAAO;MAAAM,QAAA,EAAEA;IAAQ,CAAmB;EAAC,CAC3D,CAAC;AAEX,CACF,CAAC;AAEDC,YAAY,CAACQ,WAAW,GAAG,cAAc","ignoreList":[]}
@@ -0,0 +1,58 @@
1
+ "use strict";
2
+
3
+ import { cva } from '@cdx-ui/utils';
4
+
5
+ // ── Root ────────────────────────────────────────────────────
6
+
7
+ // The bottom padding is the room the layers peek into: 6px per layer, matching Figma.
8
+ export const insightStackRootVariants = cva(['relative'], {
9
+ variants: {
10
+ layers: {
11
+ 0: '',
12
+ 1: 'pb-1.5',
13
+ 2: 'pb-3'
14
+ }
15
+ },
16
+ defaultVariants: {
17
+ layers: 0
18
+ }
19
+ });
20
+
21
+ // ── Front ───────────────────────────────────────────────────
22
+
23
+ // Keeps the front Insight painted above the layers on Android.
24
+ export const insightStackFrontVariants = cva(['relative z-10']);
25
+
26
+ // ── Layer ───────────────────────────────────────────────────
27
+
28
+ // Each layer is anchored to the root's bottom, so it peeks 6px per depth below the front card
29
+ // whatever that card's height. Both start at `top-5`, below where any front card begins: a detail
30
+ // Insight's frame sits 11px down (its tag reserve), and the layer's 6px glow needs room above
31
+ // that, so the layer tops stay hidden behind the opaque front card (at least 60px tall). The insets
32
+ // are symmetric, so RTL needs no mirroring.
33
+ export const insightStackLayerVariants = cva(['absolute', 'bg-surface-primary', 'border-2 border-stroke-secondary', 'rounded-[var(--border-radius-default)]', 'shadow-[0_0_6px_var(--color-surface-neutral-subtle)]'], {
34
+ variants: {
35
+ depth: {
36
+ 1: 'inset-x-1 top-5',
37
+ 2: 'inset-x-2 top-5 bottom-0'
38
+ },
39
+ layers: {
40
+ 1: '',
41
+ 2: ''
42
+ }
43
+ },
44
+ compoundVariants: [{
45
+ depth: 1,
46
+ layers: 1,
47
+ className: 'bottom-0'
48
+ }, {
49
+ depth: 1,
50
+ layers: 2,
51
+ className: 'bottom-1.5'
52
+ }],
53
+ defaultVariants: {
54
+ depth: 1,
55
+ layers: 1
56
+ }
57
+ });
58
+ //# sourceMappingURL=styles.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["cva","insightStackRootVariants","variants","layers","defaultVariants","insightStackFrontVariants","insightStackLayerVariants","depth","compoundVariants","className"],"sourceRoot":"../../../../src","sources":["components/InsightStack/styles.ts"],"mappings":";;AAAA,SAASA,GAAG,QAA2B,eAAe;;AAEtD;;AAEA;AACA,OAAO,MAAMC,wBAAwB,GAAGD,GAAG,CAAC,CAAC,UAAU,CAAC,EAAE;EACxDE,QAAQ,EAAE;IACRC,MAAM,EAAE;MACN,CAAC,EAAE,EAAE;MACL,CAAC,EAAE,QAAQ;MACX,CAAC,EAAE;IACL;EACF,CAAC;EACDC,eAAe,EAAE;IACfD,MAAM,EAAE;EACV;AACF,CAAC,CAAC;;AAEF;;AAEA;AACA,OAAO,MAAME,yBAAyB,GAAGL,GAAG,CAAC,CAAC,eAAe,CAAC,CAAC;;AAE/D;;AAEA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMM,yBAAyB,GAAGN,GAAG,CAC1C,CACE,UAAU,EACV,oBAAoB,EACpB,kCAAkC,EAClC,wCAAwC,EACxC,sDAAsD,CACvD,EACD;EACEE,QAAQ,EAAE;IACRK,KAAK,EAAE;MACL,CAAC,EAAE,iBAAiB;MACpB,CAAC,EAAE;IACL,CAAC;IACDJ,MAAM,EAAE;MACN,CAAC,EAAE,EAAE;MACL,CAAC,EAAE;IACL;EACF,CAAC;EACDK,gBAAgB,EAAE,CAChB;IAAED,KAAK,EAAE,CAAC;IAAEJ,MAAM,EAAE,CAAC;IAAEM,SAAS,EAAE;EAAW,CAAC,EAC9C;IAAEF,KAAK,EAAE,CAAC;IAAEJ,MAAM,EAAE,CAAC;IAAEM,SAAS,EAAE;EAAa,CAAC,CACjD;EACDL,eAAe,EAAE;IACfG,KAAK,EAAE,CAAC;IACRJ,MAAM,EAAE;EACV;AACF,CACF,CAAC","ignoreList":[]}
@@ -36,6 +36,8 @@ export * from './Field';
36
36
  export * from './Form';
37
37
  export * from './FullScreenDialog';
38
38
  export * from './Image';
39
+ export * from './Insight';
40
+ export * from './InsightStack';
39
41
  export * from './InsuranceDisclosure';
40
42
  export * from './Input';
41
43
  export * from './OtpInput';
@@ -1 +1 @@
1
- {"version":3,"names":["ColorSwatch","HStack","VStack"],"sourceRoot":"../../../src","sources":["components/index.ts"],"mappings":";;AAAA,cAAc,SAAS;AACvB,cAAc,eAAe;AAC7B,cAAc,UAAU;AACxB,cA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ACtB,cAAc,QAAQ;AACtB,cAAc,cAAc;AAC5B,cAAc,qBAAqB","ignoreList":[]}
1
+ {"version":3,"names":["ColorSwatch","HStack","VStack"],"sourceRoot":"../../../src","sources":["components/index.ts"],"mappings":";;AAAA,cAAc,SAAS;AACvB,cAAc,eAAe;AAC7B,cAAc,UAAU;AACxB,cAAc,SAAS;AACvB,cAAc,eAAe;AAC7B,cAAc,OAAO;AACrB,cAAc,eAAe;AAC7B,cAAc,UAAU;AACxB,cAAc,QAAQ;AACtB,cAAc,YAAY;AAC1B,cAAc,YAAY;AAC1B,cAAc,QAAQ;AACtB,cAAc,aAAa;AAC3B,cAAc,cAAc;AAC5B,cAAc,eAAe;AAC7B,cAAc,eAAe;AAC7B,SAASA,WAAW,QAA6D,eAAe;AAChG,cAAc,qBAAqB;AACnC,cAAc,iBAAiB;AAC/B,cAAc,aAAa;AAC3B,cAAc,YAAY;AAC1B,cAAc,iBAAiB;AAC/B,cAAc,iBAAiB;AAC/B,cAAc,cAAc;AAC5B,cAAc,mBAAmB;AACjC,cAAc,eAAe;AAC7B,cAAc,iBAAiB;AAC/B,cAAc,gBAAgB;AAC9B,cAAc,kBAAkB;AAChC,cAAc,UAAU;AACxB,cAAc,WAAW;AACzB,cAAc,UAAU;AACxB,cAAc,SAAS;AACvB,cAAc,QAAQ;AACtB,cAAc,oBAAoB;AAClC,cAAc,SAAS;AACvB,cAAc,WAAW;AACzB,cAAc,gBAAgB;AAC9B,cAAc,uBAAuB;AACrC,cAAc,SAAS;AACvB,cAAc,YAAY;AAC1B,cAAc,mBAAmB;AACjC,cAAc,QAAQ;AACtB,cAAc,YAAY;AAC1B,cAAc,aAAa;AAC3B,cAAc,QAAQ;AACtB,cAAc,eAAe;AAC7B,cAAc,kBAAkB;AAChC,cAAc,YAAY;AAC1B,cAAc,qBAAqB;AACnC,cAAc,SAAS;AACvB,cAAc,eAAe;AAC7B,cAAc,gBAAgB;AAC9B,cAAc,UAAU;AACxB,cAAc,UAAU;AACxB,cAAc,mBAAmB;AAMjC,cAAc,UAAU;AACxB,cAAc,QAAQ;AACtB,cAAc,SAAS;AACvB,cAAc,YAAY;AAC1B,cAAc,QAAQ;AACtB,cAAc,gBAAgB;AAC9B,cAAc,SAAS;AACvB,cAAc,WAAW;AACzB,SAASC,MAAM,EAAEC,MAAM,QAAQ,SAAS;AACxC,cAAc,WAAW;AACzB,cAAc,QAAQ;AACtB,cAAc,QAAQ;AACtB,cAAc,cAAc;AAC5B,cAAc,qBAAqB","ignoreList":[]}
@@ -0,0 +1,67 @@
1
+ "use strict";
2
+
3
+ // url=https://www.figma.com/design/0lEVMVlLj8ZS4fgItr3pmd/%E2%AD%90-Forge-DS--Components?node-id=13158-18419
4
+ // source=packages/components/src/components/Insight/index.tsx
5
+ // component=Insight
6
+ import figma from 'figma';
7
+ const instance = figma.selectedInstance;
8
+
9
+ // Figma `severity` is `color` in code: Insight drives no ARIA semantics or status icon (DEVEX-6446).
10
+ const color = instance.getEnum('severity', {
11
+ info: undefined,
12
+ warning: 'warning',
13
+ danger: 'danger'
14
+ });
15
+ const colorProp = figma.helpers.react.renderProp('color', color);
16
+
17
+ // Figma `size` switches slot structure, not size; code names it `layout`.
18
+ const layout = instance.getEnum('size', {
19
+ default: undefined,
20
+ expanded: 'detail'
21
+ });
22
+ const isDetail = layout === 'detail';
23
+
24
+ // Figma `intelligence` is `aiGenerated` in code. VARIANT with "true"/"false" strings.
25
+ const aiGenerated = instance.getEnum('intelligence', {
26
+ true: true,
27
+ false: undefined
28
+ });
29
+ const aiGeneratedProp = figma.helpers.react.renderProp('aiGenerated', aiGenerated);
30
+ const showCloseButton = instance.getBoolean('showCloseButton');
31
+ const onCloseProp = showCloseButton ? figma.helpers.react.renderProp('onClose', figma.helpers.react.function('() => {}')) : '';
32
+ const showContent = isDetail && instance.getBoolean('showContent');
33
+ const showActions = isDetail && instance.getBoolean('showActions');
34
+
35
+ // Text layers are read by position inside the named slot frames, not by layer name.
36
+ const textsIn = slot => instance.findLayers(node => node.type === 'TEXT', {
37
+ path: [slot],
38
+ traverseInstances: true
39
+ }).flatMap(node => node.type === 'TEXT' ? [node.textContent] : []);
40
+ const tagText = isDetail ? textsIn('Insight.Indicator')[0] ?? 'Category' : '';
41
+ const headerTexts = isDetail ? textsIn('Insight.Header') : [];
42
+ const title = headerTexts[0] ?? 'Title';
43
+ const detailDescription = headerTexts[1] ?? 'Description';
44
+ const summaryDescription = isDetail ? '' : textsIn('Insight.Summary')[0] ?? 'Description';
45
+ const actionSnippets = showActions ? instance.findConnectedInstances(node => node.codeConnectId() === 'button', {
46
+ path: ['Insight.Footer']
47
+ }).flatMap(button => button.type === 'INSTANCE' ? button.executeTemplate().example : []) : [];
48
+ export default {
49
+ id: 'insight',
50
+ imports: ["import { Insight } from '@cdx-ui/components'"],
51
+ example: isDetail ? figma.code`
52
+ <Insight layout="detail"${colorProp}${aiGeneratedProp}${onCloseProp}>
53
+ <Insight.Tag>${tagText}</Insight.Tag>
54
+ <Insight.Header>
55
+ <Insight.Title>${title}</Insight.Title>
56
+ <Insight.Description>${detailDescription}</Insight.Description>
57
+ </Insight.Header>
58
+ ${showContent ? figma.code`<Insight.Content>{/* content */}</Insight.Content>` : null}
59
+ ${showActions ? figma.code`<Insight.Footer>
60
+ ${actionSnippets}
61
+ </Insight.Footer>` : null}
62
+ </Insight>` : figma.code`
63
+ <Insight${colorProp}${aiGeneratedProp}${onCloseProp}>
64
+ <Insight.Description>${summaryDescription}</Insight.Description>
65
+ </Insight>`
66
+ };
67
+ //# sourceMappingURL=Insight.figma.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["figma","instance","selectedInstance","color","getEnum","info","undefined","warning","danger","colorProp","helpers","react","renderProp","layout","default","expanded","isDetail","aiGenerated","true","false","aiGeneratedProp","showCloseButton","getBoolean","onCloseProp","function","showContent","showActions","textsIn","slot","findLayers","node","type","path","traverseInstances","flatMap","textContent","tagText","headerTexts","title","detailDescription","summaryDescription","actionSnippets","findConnectedInstances","codeConnectId","button","executeTemplate","example","id","imports","code"],"sourceRoot":"../../../src","sources":["figma/Insight.figma.ts"],"mappings":";;AAAA;AACA;AACA;AACA,OAAOA,KAAK,MAAM,OAAO;AAEzB,MAAMC,QAAQ,GAAGD,KAAK,CAACE,gBAAgB;;AAEvC;AACA,MAAMC,KAAK,GAAGF,QAAQ,CAACG,OAAO,CAAC,UAAU,EAAE;EACzCC,IAAI,EAAEC,SAAS;EACfC,OAAO,EAAE,SAAS;EAClBC,MAAM,EAAE;AACV,CAAC,CAAC;AACF,MAAMC,SAAS,GAAGT,KAAK,CAACU,OAAO,CAACC,KAAK,CAACC,UAAU,CAAC,OAAO,EAAET,KAAK,CAAC;;AAEhE;AACA,MAAMU,MAAM,GAAGZ,QAAQ,CAACG,OAAO,CAAC,MAAM,EAAE;EACtCU,OAAO,EAAER,SAAS;EAClBS,QAAQ,EAAE;AACZ,CAAC,CAAC;AACF,MAAMC,QAAQ,GAAGH,MAAM,KAAK,QAAQ;;AAEpC;AACA,MAAMI,WAAW,GAAGhB,QAAQ,CAACG,OAAO,CAAC,cAAc,EAAE;EACnDc,IAAI,EAAE,IAAI;EACVC,KAAK,EAAEb;AACT,CAAC,CAAC;AACF,MAAMc,eAAe,GAAGpB,KAAK,CAACU,OAAO,CAACC,KAAK,CAACC,UAAU,CAAC,aAAa,EAAEK,WAAW,CAAC;AAElF,MAAMI,eAAe,GAAGpB,QAAQ,CAACqB,UAAU,CAAC,iBAAiB,CAAC;AAC9D,MAAMC,WAAW,GAAGF,eAAe,GAC/BrB,KAAK,CAACU,OAAO,CAACC,KAAK,CAACC,UAAU,CAAC,SAAS,EAAEZ,KAAK,CAACU,OAAO,CAACC,KAAK,CAACa,QAAQ,CAAC,UAAU,CAAC,CAAC,GACnF,EAAE;AAEN,MAAMC,WAAW,GAAGT,QAAQ,IAAIf,QAAQ,CAACqB,UAAU,CAAC,aAAa,CAAC;AAClE,MAAMI,WAAW,GAAGV,QAAQ,IAAIf,QAAQ,CAACqB,UAAU,CA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;AAChB,0BAA0BxC,SAAS,GAAGW,eAAe,GAAGG,WAAW;AACnE,iBAAiBa,OAAO;AACxB;AACA,qBAAqBE,KAAK;AAC1B,2BAA2BC,iBAAiB;AAC5C;AACA,IAAId,WAAW,GAAGzB,KAAK,CAACiD,IAAI,oDAAoD,GAAG,IAAI;AACvF,IACIvB,WAAW,GACP1B,KAAK,CAACiD,IAAI;AAClB,MAAMR,cAAc;AACpB,oBAAoB,GACZ,IAAI;AACZ,WACW,GACLzC,KAAK,CAACiD,IAAI;AAChB,UAAUxC,SAAS,GAAGW,eAAe,GAAGG,WAAW;AACnD,yBAAyBiB,kBAAkB;AAC3C;AACA,CAAC","ignoreList":[]}
@@ -0,0 +1,33 @@
1
+ "use strict";
2
+
3
+ // url=https://www.figma.com/design/0lEVMVlLj8ZS4fgItr3pmd/%E2%AD%90-Forge-DS--Components?node-id=13652-32306
4
+ // source=packages/components/src/components/InsightStack/index.tsx
5
+ // component=InsightStack
6
+ import figma from 'figma';
7
+ const instance = figma.selectedInstance;
8
+
9
+ // Figma's `3+` bucket becomes the smallest count that draws both layers; code takes a number.
10
+ const count = instance.getEnum('count', {
11
+ '1': 1,
12
+ '2': 2,
13
+ '3+': 3
14
+ });
15
+ const countProp = figma.helpers.react.renderProp('count', count);
16
+
17
+ // Found by Code Connect id, so the front card's layer name does not matter.
18
+ const frontInsight = instance.findConnectedInstance('insight', {
19
+ traverseInstances: true
20
+ });
21
+ const frontSnippet = frontInsight?.type === 'INSTANCE' ? frontInsight.executeTemplate().example : figma.code`<Insight layout="summary">
22
+ <Insight.Description>Description</Insight.Description>
23
+ </Insight>`;
24
+ export default {
25
+ id: 'insight-stack',
26
+ // Separate strings so the nested Insight template's identical import is deduped.
27
+ imports: ["import { InsightStack } from '@cdx-ui/components'", "import { Insight } from '@cdx-ui/components'"],
28
+ example: figma.code`
29
+ <InsightStack${countProp}>
30
+ ${frontSnippet}
31
+ </InsightStack>`
32
+ };
33
+ //# sourceMappingURL=InsightStack.figma.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["figma","instance","selectedInstance","count","getEnum","countProp","helpers","react","renderProp","frontInsight","findConnectedInstance","traverseInstances","frontSnippet","type","executeTemplate","example","code","id","imports"],"sourceRoot":"../../../src","sources":["figma/InsightStack.figma.ts"],"mappings":";;AAAA;AACA;AACA;AACA,OAAOA,KAAK,MAAM,OAAO;AAEzB,MAAMC,QAAQ,GAAGD,KAAK,CAACE,gBAAgB;;AAEvC;AACA,MAAMC,KAAK,GAAGF,QAAQ,CAACG,OAAO,CAAC,OAAO,EAAE;EACtC,GAAG,EAAE,CAAC;EACN,GAAG,EAAE,CAAC;EACN,IAAI,EAAE;AACR,CAAC,CAAC;AACF,MAAMC,SAAS,GAAGL,KAAK,CAACM,OAAO,CAACC,KAAK,CAACC,UAAU,CAAC,OAAO,EAAEL,KAAK,CAAC;;AAEhE;AACA,MAAMM,YAAY,GAAGR,QAAQ,CAACS,qBAAqB,CAAC,SAAS,EAAE;EAAEC,iBAAiB,EAAE;AAAK,CAAC,CAAC;AAC3F,MAAMC,YAAY,GAChBH,YAAY,EAAEI,IAAI,KAAK,UAAU,GAC7BJ,YAAY,CAACK,eAAe,CAAC,CAAC,CAACC,OAAO,GACtCf,KAAK,CAACgB,IAAI;AAChB;AACA,aAAa;AAEb,eAAe;EACbC,EAAE,EAAE,eAAe;EACnB;EACAC,OAAO,EAAE,CACP,mDAAmD,EACnD,8CAA8C,CAC/C;EACDH,OAAO,EAAEf,KAAK,CAACgB,IAAI;AACrB,eAAeX,SAAS;AACxB,IAAIO,YAAY;AAChB;AACA,CAAC","ignoreList":[]}
@@ -0,0 +1,87 @@
1
+ import { type ReactNode } from 'react';
2
+ import { Text, View, type TextProps, type ViewProps } from 'react-native';
3
+ import { type IInsightDetailProps, type IInsightSummaryProps } from '@cdx-ui/primitives';
4
+ interface InsightStyleProps {
5
+ /**
6
+ * Tints the border, the summary medallion, and the detail tag. Visual only: any meaning it
7
+ * carries must also be in the text.
8
+ * @default 'info'
9
+ */
10
+ color?: 'info' | 'warning' | 'danger';
11
+ /**
12
+ * Swaps the `color` border for the AI gradient border.
13
+ * @default false
14
+ */
15
+ aiGenerated?: boolean;
16
+ /** Renders a dismiss button at the top-end corner. In `summary`, it sits beside the press region, not inside it. */
17
+ onClose?: () => void;
18
+ /**
19
+ * Accessible name for the dismiss button.
20
+ * @default 'Dismiss insight'
21
+ */
22
+ closeAccessibilityLabel?: string;
23
+ }
24
+ /**
25
+ * `className` and `style` style the outer frame (the border). `asChild` replaces the inner
26
+ * surface element. `onPress` exists only on `layout="summary"`.
27
+ *
28
+ * `ref` targets the element that takes focus: the press region of a summary with `onPress`
29
+ * (the surface, or the region beside the dismiss button when `onClose` is also set), so
30
+ * `ref.current?.focus()` moves focus to the card. A static Insight puts `ref` on its surface.
31
+ */
32
+ export type InsightProps = (Omit<IInsightSummaryProps, 'accessory' | 'pressableClassName'> & InsightStyleProps) | (Omit<IInsightDetailProps, 'accessory' | 'pressableClassName'> & InsightStyleProps);
33
+ declare const InsightRootStyled: import("react").ForwardRefExoticComponent<InsightProps & import("react").RefAttributes<View>>;
34
+ export interface InsightTagProps extends ViewProps {
35
+ /** Merges the label props onto a single text child instead of rendering `Text`. */
36
+ asChild?: boolean;
37
+ /** Classes for the positioned tag wrapper. */
38
+ className?: string;
39
+ /** The insight's category, read before the title. */
40
+ children?: ReactNode;
41
+ }
42
+ /**
43
+ * The detail layout's category tag. Insight renders it as a Sparkle chip straddling the top
44
+ * border, ahead of the header in reading order, wherever it appears among the children.
45
+ */
46
+ declare const InsightTag: import("react").ForwardRefExoticComponent<InsightTagProps & import("react").RefAttributes<View>>;
47
+ export interface InsightHeaderProps extends ViewProps {
48
+ asChild?: boolean;
49
+ className?: string;
50
+ children?: ReactNode;
51
+ }
52
+ declare const InsightHeader: import("react").ForwardRefExoticComponent<InsightHeaderProps & import("react").RefAttributes<View>>;
53
+ export interface InsightTitleProps extends TextProps {
54
+ asChild?: boolean;
55
+ className?: string;
56
+ children?: ReactNode;
57
+ }
58
+ declare const InsightTitle: import("react").ForwardRefExoticComponent<InsightTitleProps & import("react").RefAttributes<Text>>;
59
+ export interface InsightDescriptionProps extends TextProps {
60
+ asChild?: boolean;
61
+ className?: string;
62
+ children?: ReactNode;
63
+ }
64
+ declare const InsightDescription: import("react").ForwardRefExoticComponent<InsightDescriptionProps & import("react").RefAttributes<Text>>;
65
+ export interface InsightContentProps extends ViewProps {
66
+ asChild?: boolean;
67
+ className?: string;
68
+ children?: ReactNode;
69
+ }
70
+ declare const InsightContent: import("react").ForwardRefExoticComponent<InsightContentProps & import("react").RefAttributes<View>>;
71
+ export interface InsightFooterProps extends ViewProps {
72
+ asChild?: boolean;
73
+ className?: string;
74
+ children?: ReactNode;
75
+ }
76
+ declare const InsightFooter: import("react").ForwardRefExoticComponent<InsightFooterProps & import("react").RefAttributes<View>>;
77
+ type InsightCompoundComponent = typeof InsightRootStyled & {
78
+ Tag: typeof InsightTag;
79
+ Header: typeof InsightHeader;
80
+ Title: typeof InsightTitle;
81
+ Description: typeof InsightDescription;
82
+ Content: typeof InsightContent;
83
+ Footer: typeof InsightFooter;
84
+ };
85
+ export declare const Insight: InsightCompoundComponent;
86
+ export {};
87
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/Insight/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAWL,KAAK,SAAS,EAEf,MAAM,OAAO,CAAC;AACf,OAAO,EAAY,IAAI,EAAE,IAAI,EAAE,KAAK,SAAS,EAAE,KAAK,SAAS,EAAE,MAAM,cAAc,CAAC;AAQpF,OAAO,EAML,KAAK,mBAAmB,EAExB,KAAK,oBAAoB,EAC1B,MAAM,oBAAoB,CAAC;AAwD5B,UAAU,iBAAiB;IACzB;;;;OAIG;IACH,KAAK,CAAC,EAAE,MAAM,GAAG,SAAS,GAAG,QAAQ,CAAC;IACtC;;;OAGG;IACH,WAAW,CAAC,E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,MAAM,WAAW,mBAAoB,SAAQ,SAAS;IACpD,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,EAAE,SAAS,CAAC;CACtB;AAED,QAAA,MAAM,cAAc,sGAgBnB,CAAC;AAQF,MAAM,WAAW,kBAAmB,SAAQ,SAAS;IACnD,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,EAAE,SAAS,CAAC;CACtB;AAED,QAAA,MAAM,aAAa,qGAgBlB,CAAC;AAQF,KAAK,wBAAwB,GAAG,OAAO,iBAAiB,GAAG;IACzD,GAAG,EAAE,OAAO,UAAU,CAAC;IACvB,MAAM,EAAE,OAAO,aAAa,CAAC;IAC7B,KAAK,EAAE,OAAO,YAAY,CAAC;IAC3B,WAAW,EAAE,OAAO,kBAAkB,CAAC;IACvC,OAAO,EAAE,OAAO,cAAc,CAAC;IAC/B,MAAM,EAAE,OAAO,aAAa,CAAC;CAC9B,CAAC;AAEF,eAAO,MAAM,OAAO,EAOd,wBAAwB,CAAC"}
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Converts a resolved CSS variable (a number, or a `px`/`rem` string) to pixels. Native resolves
3
+ * built-in tokens to numbers, while runtime theme overrides and the web resolve to strings.
4
+ */
5
+ export declare function cssLengthToPx(value: string | number | undefined): number | undefined;
6
+ /** The radius of a surface inset `inset` px inside a frame with radius `outer`, or `undefined` when `outer` is not a length. */
7
+ export declare function insetRadius(outer: string | number | undefined, inset: number): number | undefined;
8
+ //# sourceMappingURL=insetRadius.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"insetRadius.d.ts","sourceRoot":"","sources":["../../../../src/components/Insight/insetRadius.ts"],"names":[],"mappings":"AAIA;;;GAGG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,GAAG,MAAM,GAAG,SAAS,CAepF;AAED,gIAAgI;AAChI,wBAAgB,WAAW,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAGjG"}
@@ -0,0 +1,33 @@
1
+ import { type VariantProps } from '@cdx-ui/utils';
2
+ /** Ring width in px; must match the frame's `p-0.5`. */
3
+ export declare const FRAME_WIDTH = 2;
4
+ export declare const insightFrameVariants: (props?: ({
5
+ layout?: "summary" | "detail" | null | undefined;
6
+ color?: "danger" | "warning" | "info" | null | undefined;
7
+ aiGenerated?: boolean | null | undefined;
8
+ } & import("class-variance-authority/types").ClassProp) | undefined) => string;
9
+ export declare const insightSurfaceVariants: (props?: ({
10
+ layout?: "summary" | "detail" | null | undefined;
11
+ split?: boolean | null | undefined;
12
+ } & import("class-variance-authority/types").ClassProp) | undefined) => string;
13
+ export declare const insightPressRegionVariants: (props?: import("class-variance-authority/types").ClassProp | undefined) => string;
14
+ export declare const insightIconVariants: (props?: ({
15
+ color?: "danger" | "warning" | "info" | null | undefined;
16
+ } & import("class-variance-authority/types").ClassProp) | undefined) => string;
17
+ export declare const insightSummaryTextVariants: (props?: ({
18
+ hasClose?: boolean | null | undefined;
19
+ } & import("class-variance-authority/types").ClassProp) | undefined) => string;
20
+ export declare const insightTagVariants: (props?: import("class-variance-authority/types").ClassProp | undefined) => string;
21
+ export declare const insightTagIconVariants: (props?: ({
22
+ color?: "danger" | "warning" | "info" | null | undefined;
23
+ } & import("class-variance-authority/types").ClassProp) | undefined) => string;
24
+ export declare const insightCloseVariants: (props?: import("class-variance-authority/types").ClassProp | undefined) => string;
25
+ export declare const insightHeaderVariants: (props?: import("class-variance-authority/types").ClassProp | undefined) => string;
26
+ export declare const insightTitleVariants: (props?: ({
27
+ hasClose?: boolean | null | undefined;
28
+ } & import("class-variance-authority/types").ClassProp) | undefined) => string;
29
+ export declare const insightDescriptionVariants: (props?: import("class-variance-authority/types").ClassProp | undefined) => string;
30
+ export declare const insightContentVariants: (props?: import("class-variance-authority/types").ClassProp | undefined) => string;
31
+ export declare const insightFooterVariants: (props?: import("class-variance-authority/types").ClassProp | undefined) => string;
32
+ export type InsightFrameVariantProps = VariantProps<typeof insightFrameVariants>;
33
+ //# sourceMappingURL=styles.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"styles.d.ts","sourceRoot":"","sources":["../../../../src/components/Insight/styles.ts"],"names":[],"mappings":"AAAA,OAAO,EAAO,KAAK,YAAY,EAAE,MAAM,eAAe,CAAC;AAGvD,wDAAwD;AACxD,eAAO,MAAM,WAAW,IAAI,CAAC;AAwB7B,eAAO,MAAM,oBAAoB;;;;8EAmDhC,CAAC;AAIF,eAAO,MAAM,sBAAsB;;;8EAoBjC,CAAC;AAIH,eAAO,MAAM,0BAA0B,oFAIrC,CAAC;AAKH,eAAO,MAAM,mBAAmB;;8EAW9B,CAAC;AAMH,eAAO,MAAM,0BAA0B;;8EAUrC,CAAC;AAMH,eAAO,MAAM,kBAAkB,oFAA6C,CAAC;AAE7E,eAAO,MAAM,sBAAsB;;8EAWjC,CAAC;AAKH,eAAO,MAAM,oBAAoB,oFAAgC,CAAC;AAIlE,eAAO,MAAM,qBAAqB,oFAA0C,CAAC;AAE7E,eAAO,MAAM,oBAAoB;;8EAU/B,CAAC;AAEH,eAAO,MAAM,0BAA0B,oFAAwC,CAAC;AAEhF,eAAO,MAAM,sBAAsB,oFAAU,CAAC;AAG9C,eAAO,MAAM,qBAAqB,oFAA6D,CAAC;AAEhG,MAAM,MAAM,wBAAwB,GAAG,YAAY,CAAC,OAAO,oBAAoB,CAAC,CAAC"}