intent-react 0.1.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 (47) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +27 -0
  3. package/dist/components/Badge.d.ts +10 -0
  4. package/dist/components/Badge.d.ts.map +1 -0
  5. package/dist/components/Badge.js +19 -0
  6. package/dist/components/Badge.js.map +1 -0
  7. package/dist/components/Button.d.ts +10 -0
  8. package/dist/components/Button.d.ts.map +1 -0
  9. package/dist/components/Button.js +20 -0
  10. package/dist/components/Button.js.map +1 -0
  11. package/dist/components/Card.d.ts +10 -0
  12. package/dist/components/Card.d.ts.map +1 -0
  13. package/dist/components/Card.js +22 -0
  14. package/dist/components/Card.js.map +1 -0
  15. package/dist/components/Divider.d.ts +10 -0
  16. package/dist/components/Divider.d.ts.map +1 -0
  17. package/dist/components/Divider.js +19 -0
  18. package/dist/components/Divider.js.map +1 -0
  19. package/dist/components/Input.d.ts +10 -0
  20. package/dist/components/Input.d.ts.map +1 -0
  21. package/dist/components/Input.js +19 -0
  22. package/dist/components/Input.js.map +1 -0
  23. package/dist/components/Stack.d.ts +12 -0
  24. package/dist/components/Stack.d.ts.map +1 -0
  25. package/dist/components/Stack.js +27 -0
  26. package/dist/components/Stack.js.map +1 -0
  27. package/dist/components/Surface.d.ts +10 -0
  28. package/dist/components/Surface.d.ts.map +1 -0
  29. package/dist/components/Surface.js +21 -0
  30. package/dist/components/Surface.js.map +1 -0
  31. package/dist/components/Text.d.ts +13 -0
  32. package/dist/components/Text.d.ts.map +1 -0
  33. package/dist/components/Text.js +40 -0
  34. package/dist/components/Text.js.map +1 -0
  35. package/dist/index.d.ts +34 -0
  36. package/dist/index.d.ts.map +1 -0
  37. package/dist/index.js +36 -0
  38. package/dist/index.js.map +1 -0
  39. package/dist/types.d.ts +65 -0
  40. package/dist/types.d.ts.map +1 -0
  41. package/dist/types.js +5 -0
  42. package/dist/types.js.map +1 -0
  43. package/dist/utils/factory.d.ts +12 -0
  44. package/dist/utils/factory.d.ts.map +1 -0
  45. package/dist/utils/factory.js +65 -0
  46. package/dist/utils/factory.js.map +1 -0
  47. package/package.json +59 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2024 Intent Framework Contributors
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,27 @@
1
+ # intent-react
2
+
3
+ React components for the [Intent](https://github.com/mixedmetals/intent-framework) styling framework.
4
+
5
+ ## Installation
6
+
7
+ ```bash
8
+ npm install intent-react intent-core
9
+ npm install -D intent-cli
10
+ ```
11
+
12
+ ## Usage
13
+
14
+ ```tsx
15
+ import { Stack, Button, Text, Surface } from 'intent-react';
16
+
17
+ function App() {
18
+ return (
19
+ <Stack direction="column" gap="relaxed">
20
+ <Text size="lg" weight="bold">Hello Intent</Text>
21
+ <Button importance="primary">Click me</Button>
22
+ </Stack>
23
+ );
24
+ }
25
+ ```
26
+
27
+ See the main repo for full documentation.
@@ -0,0 +1,10 @@
1
+ /**
2
+ * Badge Component
3
+ *
4
+ * Small label for displaying status, count, or category.
5
+ * Replaces: inline-flex, px-*, py-*, rounded-full, text-xs, bg-*, text-*
6
+ */
7
+ import React from 'react';
8
+ import type { BadgeProps } from '../types.js';
9
+ export declare const Badge: React.ForwardRefExoticComponent<BadgeProps & React.RefAttributes<HTMLSpanElement>>;
10
+ //# sourceMappingURL=Badge.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Badge.d.ts","sourceRoot":"","sources":["../../src/components/Badge.tsx"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAqB,MAAM,OAAO,CAAC;AAC1C,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAE9C,eAAO,MAAM,KAAK,oFA6BjB,CAAC"}
@@ -0,0 +1,19 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ /**
3
+ * Badge Component
4
+ *
5
+ * Small label for displaying status, count, or category.
6
+ * Replaces: inline-flex, px-*, py-*, rounded-full, text-xs, bg-*, text-*
7
+ */
8
+ import { forwardRef } from 'react';
9
+ export const Badge = forwardRef(({ children, importance = 'default', size = 'sm', className, style, ...rest }, ref) => {
10
+ const dataAttrs = {
11
+ 'data-importance': importance,
12
+ 'data-size': size,
13
+ };
14
+ const baseClass = 'intent-badge';
15
+ const finalClassName = className ? `${baseClass} ${className}` : baseClass;
16
+ return (_jsx("span", { ref: ref, className: finalClassName, style: style, ...dataAttrs, ...rest, children: children }));
17
+ });
18
+ Badge.displayName = 'Badge';
19
+ //# sourceMappingURL=Badge.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Badge.js","sourceRoot":"","sources":["../../src/components/Badge.tsx"],"names":[],"mappings":";AAAA;;;;;GAKG;AAEH,OAAc,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AAG1C,MAAM,CAAC,MAAM,KAAK,GAAG,UAAU,CAC7B,CAAC,EACC,QAAQ,EACR,UAAU,GAAG,SAAS,EACtB,IAAI,GAAG,IAAI,EACX,SAAS,EACT,KAAK,EACL,GAAG,IAAI,EACR,EAAE,GAAG,EAAE,EAAE;IACR,MAAM,SAAS,GAAG;QAChB,iBAAiB,EAAE,UAAU;QAC7B,WAAW,EAAE,IAAI;KAClB,CAAC;IAEF,MAAM,SAAS,GAAG,cAAc,CAAC;IACjC,MAAM,cAAc,GAAG,SAAS,CAAC,CAAC,CAAC,GAAG,SAAS,IAAI,SAAS,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC;IAE3E,OAAO,CACL,eACE,GAAG,EAAE,GAAG,EACR,SAAS,EAAE,cAAc,EACzB,KAAK,EAAE,KAAK,KACR,SAAS,KACT,IAAI,YAEP,QAAQ,GACJ,CACR,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,KAAK,CAAC,WAAW,GAAG,OAAO,CAAC"}
@@ -0,0 +1,10 @@
1
+ /**
2
+ * Button Component
3
+ *
4
+ * An interactive element that triggers an action.
5
+ * Replaces: bg-*, text-*, px-*, py-*, rounded-*, hover:*, disabled:*
6
+ */
7
+ import React from 'react';
8
+ import type { ButtonProps } from '../types.js';
9
+ export declare const Button: React.ForwardRefExoticComponent<ButtonProps & React.RefAttributes<HTMLButtonElement>>;
10
+ //# sourceMappingURL=Button.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Button.d.ts","sourceRoot":"","sources":["../../src/components/Button.tsx"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAqB,MAAM,OAAO,CAAC;AAC1C,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAE/C,eAAO,MAAM,MAAM,uFAqClB,CAAC"}
@@ -0,0 +1,20 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ /**
3
+ * Button Component
4
+ *
5
+ * An interactive element that triggers an action.
6
+ * Replaces: bg-*, text-*, px-*, py-*, rounded-*, hover:*, disabled:*
7
+ */
8
+ import { forwardRef } from 'react';
9
+ export const Button = forwardRef(({ children, importance = 'primary', size = 'md', state = 'default', type = 'button', onClick, disabled, className, style, ...rest }, ref) => {
10
+ const dataAttrs = {
11
+ 'data-importance': importance,
12
+ 'data-size': size,
13
+ 'data-state': disabled ? 'disabled' : state,
14
+ };
15
+ const baseClass = 'intent-button';
16
+ const finalClassName = className ? `${baseClass} ${className}` : baseClass;
17
+ return (_jsx("button", { ref: ref, type: type, className: finalClassName, style: style, onClick: onClick, disabled: disabled || state === 'disabled', ...dataAttrs, ...rest, children: children }));
18
+ });
19
+ Button.displayName = 'Button';
20
+ //# sourceMappingURL=Button.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Button.js","sourceRoot":"","sources":["../../src/components/Button.tsx"],"names":[],"mappings":";AAAA;;;;;GAKG;AAEH,OAAc,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AAG1C,MAAM,CAAC,MAAM,MAAM,GAAG,UAAU,CAC9B,CAAC,EACC,QAAQ,EACR,UAAU,GAAG,SAAS,EACtB,IAAI,GAAG,IAAI,EACX,KAAK,GAAG,SAAS,EACjB,IAAI,GAAG,QAAQ,EACf,OAAO,EACP,QAAQ,EACR,SAAS,EACT,KAAK,EACL,GAAG,IAAI,EACR,EAAE,GAAG,EAAE,EAAE;IACR,MAAM,SAAS,GAAG;QAChB,iBAAiB,EAAE,UAAU;QAC7B,WAAW,EAAE,IAAI;QACjB,YAAY,EAAE,QAAQ,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,KAAK;KAC5C,CAAC;IAEF,MAAM,SAAS,GAAG,eAAe,CAAC;IAClC,MAAM,cAAc,GAAG,SAAS,CAAC,CAAC,CAAC,GAAG,SAAS,IAAI,SAAS,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC;IAE3E,OAAO,CACL,iBACE,GAAG,EAAE,GAAG,EACR,IAAI,EAAE,IAAI,EACV,SAAS,EAAE,cAAc,EACzB,KAAK,EAAE,KAAK,EACZ,OAAO,EAAE,OAAO,EAChB,QAAQ,EAAE,QAAQ,IAAI,KAAK,KAAK,UAAU,KACtC,SAAS,KACT,IAAI,YAEP,QAAQ,GACF,CACV,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,MAAM,CAAC,WAAW,GAAG,QAAQ,CAAC"}
@@ -0,0 +1,10 @@
1
+ /**
2
+ * Card Component
3
+ *
4
+ * Container for grouping related content and actions.
5
+ * Extends Surface with card-specific defaults.
6
+ */
7
+ import React from 'react';
8
+ import type { CardProps } from '../types.js';
9
+ export declare const Card: React.ForwardRefExoticComponent<CardProps & React.RefAttributes<HTMLDivElement>>;
10
+ //# sourceMappingURL=Card.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Card.d.ts","sourceRoot":"","sources":["../../src/components/Card.tsx"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAqB,MAAM,OAAO,CAAC;AAC1C,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAE7C,eAAO,MAAM,IAAI,kFAmChB,CAAC"}
@@ -0,0 +1,22 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ /**
3
+ * Card Component
4
+ *
5
+ * Container for grouping related content and actions.
6
+ * Extends Surface with card-specific defaults.
7
+ */
8
+ import { forwardRef } from 'react';
9
+ export const Card = forwardRef(({ children, elevation = 'low', padding = 'relaxed', background = 'elevated', radius = 'lg', interactive = false, className, style, ...rest }, ref) => {
10
+ const dataAttrs = {
11
+ 'data-elevation': elevation,
12
+ 'data-padding': padding,
13
+ 'data-background': background,
14
+ 'data-radius': radius,
15
+ 'data-interactive': interactive ? 'true' : undefined,
16
+ };
17
+ const baseClass = 'intent-card';
18
+ const finalClassName = className ? `${baseClass} ${className}` : baseClass;
19
+ return (_jsx("div", { ref: ref, className: finalClassName, style: style, ...dataAttrs, ...rest, children: children }));
20
+ });
21
+ Card.displayName = 'Card';
22
+ //# sourceMappingURL=Card.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Card.js","sourceRoot":"","sources":["../../src/components/Card.tsx"],"names":[],"mappings":";AAAA;;;;;GAKG;AAEH,OAAc,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AAG1C,MAAM,CAAC,MAAM,IAAI,GAAG,UAAU,CAC5B,CAAC,EACC,QAAQ,EACR,SAAS,GAAG,KAAK,EACjB,OAAO,GAAG,SAAS,EACnB,UAAU,GAAG,UAAU,EACvB,MAAM,GAAG,IAAI,EACb,WAAW,GAAG,KAAK,EACnB,SAAS,EACT,KAAK,EACL,GAAG,IAAI,EACR,EAAE,GAAG,EAAE,EAAE;IACR,MAAM,SAAS,GAAG;QAChB,gBAAgB,EAAE,SAAS;QAC3B,cAAc,EAAE,OAAO;QACvB,iBAAiB,EAAE,UAAU;QAC7B,aAAa,EAAE,MAAM;QACrB,kBAAkB,EAAE,WAAW,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,SAAS;KACrD,CAAC;IAEF,MAAM,SAAS,GAAG,aAAa,CAAC;IAChC,MAAM,cAAc,GAAG,SAAS,CAAC,CAAC,CAAC,GAAG,SAAS,IAAI,SAAS,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC;IAE3E,OAAO,CACL,cACE,GAAG,EAAE,GAAG,EACR,SAAS,EAAE,cAAc,EACzB,KAAK,EAAE,KAAK,KACR,SAAS,KACT,IAAI,YAEP,QAAQ,GACL,CACP,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,IAAI,CAAC,WAAW,GAAG,MAAM,CAAC"}
@@ -0,0 +1,10 @@
1
+ /**
2
+ * Divider Component
3
+ *
4
+ * Visual separator between content sections.
5
+ * Replaces: border-t, border-b, w-full, h-px
6
+ */
7
+ import React from 'react';
8
+ import type { DividerProps } from '../types.js';
9
+ export declare const Divider: React.ForwardRefExoticComponent<DividerProps & React.RefAttributes<HTMLHRElement>>;
10
+ //# sourceMappingURL=Divider.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Divider.d.ts","sourceRoot":"","sources":["../../src/components/Divider.tsx"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAqB,MAAM,OAAO,CAAC;AAC1C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAEhD,eAAO,MAAM,OAAO,oFA0BnB,CAAC"}
@@ -0,0 +1,19 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ /**
3
+ * Divider Component
4
+ *
5
+ * Visual separator between content sections.
6
+ * Replaces: border-t, border-b, w-full, h-px
7
+ */
8
+ import { forwardRef } from 'react';
9
+ export const Divider = forwardRef(({ orientation = 'horizontal', weight = 'normal', className, style, ...rest }, ref) => {
10
+ const dataAttrs = {
11
+ 'data-orientation': orientation,
12
+ 'data-weight': weight,
13
+ };
14
+ const baseClass = 'intent-divider';
15
+ const finalClassName = className ? `${baseClass} ${className}` : baseClass;
16
+ return (_jsx("hr", { ref: ref, className: finalClassName, style: style, ...dataAttrs, ...rest }));
17
+ });
18
+ Divider.displayName = 'Divider';
19
+ //# sourceMappingURL=Divider.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Divider.js","sourceRoot":"","sources":["../../src/components/Divider.tsx"],"names":[],"mappings":";AAAA;;;;;GAKG;AAEH,OAAc,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AAG1C,MAAM,CAAC,MAAM,OAAO,GAAG,UAAU,CAC/B,CAAC,EACC,WAAW,GAAG,YAAY,EAC1B,MAAM,GAAG,QAAQ,EACjB,SAAS,EACT,KAAK,EACL,GAAG,IAAI,EACR,EAAE,GAAG,EAAE,EAAE;IACR,MAAM,SAAS,GAAG;QAChB,kBAAkB,EAAE,WAAW;QAC/B,aAAa,EAAE,MAAM;KACtB,CAAC;IAEF,MAAM,SAAS,GAAG,gBAAgB,CAAC;IACnC,MAAM,cAAc,GAAG,SAAS,CAAC,CAAC,CAAC,GAAG,SAAS,IAAI,SAAS,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC;IAE3E,OAAO,CACL,aACE,GAAG,EAAE,GAAG,EACR,SAAS,EAAE,cAAc,EACzB,KAAK,EAAE,KAAK,KACR,SAAS,KACT,IAAI,GACR,CACH,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,OAAO,CAAC,WAAW,GAAG,SAAS,CAAC"}
@@ -0,0 +1,10 @@
1
+ /**
2
+ * Input Component
3
+ *
4
+ * Form control for accepting user text input.
5
+ * Replaces: border-*, bg-*, px-*, py-*, rounded-*, focus:*
6
+ */
7
+ import React from 'react';
8
+ import type { InputProps } from '../types.js';
9
+ export declare const Input: React.ForwardRefExoticComponent<InputProps & React.RefAttributes<HTMLInputElement>>;
10
+ //# sourceMappingURL=Input.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Input.d.ts","sourceRoot":"","sources":["../../src/components/Input.tsx"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAqB,MAAM,OAAO,CAAC;AAC1C,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAE9C,eAAO,MAAM,KAAK,qFAoCjB,CAAC"}
@@ -0,0 +1,19 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ /**
3
+ * Input Component
4
+ *
5
+ * Form control for accepting user text input.
6
+ * Replaces: border-*, bg-*, px-*, py-*, rounded-*, focus:*
7
+ */
8
+ import { forwardRef } from 'react';
9
+ export const Input = forwardRef(({ size = 'md', state = 'default', type = 'text', placeholder, value, onChange, disabled, className, style, ...rest }, ref) => {
10
+ const dataAttrs = {
11
+ 'data-size': size,
12
+ 'data-state': state,
13
+ };
14
+ const baseClass = 'intent-input';
15
+ const finalClassName = className ? `${baseClass} ${className}` : baseClass;
16
+ return (_jsx("input", { ref: ref, type: type, className: finalClassName, style: style, placeholder: placeholder, value: value, onChange: onChange ? (e) => onChange(e.target.value) : undefined, disabled: disabled, ...dataAttrs, ...rest }));
17
+ });
18
+ Input.displayName = 'Input';
19
+ //# sourceMappingURL=Input.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Input.js","sourceRoot":"","sources":["../../src/components/Input.tsx"],"names":[],"mappings":";AAAA;;;;;GAKG;AAEH,OAAc,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AAG1C,MAAM,CAAC,MAAM,KAAK,GAAG,UAAU,CAC7B,CAAC,EACC,IAAI,GAAG,IAAI,EACX,KAAK,GAAG,SAAS,EACjB,IAAI,GAAG,MAAM,EACb,WAAW,EACX,KAAK,EACL,QAAQ,EACR,QAAQ,EACR,SAAS,EACT,KAAK,EACL,GAAG,IAAI,EACR,EAAE,GAAG,EAAE,EAAE;IACR,MAAM,SAAS,GAAG;QAChB,WAAW,EAAE,IAAI;QACjB,YAAY,EAAE,KAAK;KACpB,CAAC;IAEF,MAAM,SAAS,GAAG,cAAc,CAAC;IACjC,MAAM,cAAc,GAAG,SAAS,CAAC,CAAC,CAAC,GAAG,SAAS,IAAI,SAAS,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC;IAE3E,OAAO,CACL,gBACE,GAAG,EAAE,GAAG,EACR,IAAI,EAAE,IAAI,EACV,SAAS,EAAE,cAAc,EACzB,KAAK,EAAE,KAAK,EACZ,WAAW,EAAE,WAAW,EACxB,KAAK,EAAE,KAAK,EACZ,QAAQ,EAAE,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,QAAQ,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,SAAS,EAChE,QAAQ,EAAE,QAAQ,KACd,SAAS,KACT,IAAI,GACR,CACH,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,KAAK,CAAC,WAAW,GAAG,OAAO,CAAC"}
@@ -0,0 +1,12 @@
1
+ /**
2
+ * Stack Component
3
+ *
4
+ * A layout component for distributing children along an axis with consistent spacing.
5
+ * Replaces: flex, flex-col, flex-row, gap-*, items-*, justify-*
6
+ */
7
+ import React from 'react';
8
+ import type { StackProps } from '../types.js';
9
+ export declare const Stack: React.ForwardRefExoticComponent<StackProps & React.RefAttributes<HTMLDivElement>>;
10
+ export declare const VStack: React.ForwardRefExoticComponent<Omit<StackProps, "direction"> & React.RefAttributes<HTMLDivElement>>;
11
+ export declare const HStack: React.ForwardRefExoticComponent<Omit<StackProps, "direction"> & React.RefAttributes<HTMLDivElement>>;
12
+ //# sourceMappingURL=Stack.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Stack.d.ts","sourceRoot":"","sources":["../../src/components/Stack.tsx"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAqB,MAAM,OAAO,CAAC;AAC1C,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAE9C,eAAO,MAAM,KAAK,mFAmCjB,CAAC;AAKF,eAAO,MAAM,MAAM,sGAElB,CAAC;AAGF,eAAO,MAAM,MAAM,sGAElB,CAAC"}
@@ -0,0 +1,27 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ /**
3
+ * Stack Component
4
+ *
5
+ * A layout component for distributing children along an axis with consistent spacing.
6
+ * Replaces: flex, flex-col, flex-row, gap-*, items-*, justify-*
7
+ */
8
+ import { forwardRef } from 'react';
9
+ export const Stack = forwardRef(({ children, direction = 'column', gap = 'normal', align = 'stretch', justify = 'start', wrap = false, className, style, ...rest }, ref) => {
10
+ const dataAttrs = {
11
+ 'data-direction': direction,
12
+ 'data-gap': gap,
13
+ 'data-align': align,
14
+ 'data-justify': justify,
15
+ 'data-wrap': wrap ? 'true' : undefined,
16
+ };
17
+ const baseClass = 'intent-stack';
18
+ const finalClassName = className ? `${baseClass} ${className}` : baseClass;
19
+ return (_jsx("div", { ref: ref, className: finalClassName, style: style, ...dataAttrs, ...rest, children: children }));
20
+ });
21
+ Stack.displayName = 'Stack';
22
+ // Convenience aliases
23
+ export const VStack = forwardRef((props, ref) => _jsx(Stack, { ref: ref, direction: "column", ...props }));
24
+ VStack.displayName = 'VStack';
25
+ export const HStack = forwardRef((props, ref) => _jsx(Stack, { ref: ref, direction: "row", ...props }));
26
+ HStack.displayName = 'HStack';
27
+ //# sourceMappingURL=Stack.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Stack.js","sourceRoot":"","sources":["../../src/components/Stack.tsx"],"names":[],"mappings":";AAAA;;;;;GAKG;AAEH,OAAc,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AAG1C,MAAM,CAAC,MAAM,KAAK,GAAG,UAAU,CAC7B,CAAC,EACC,QAAQ,EACR,SAAS,GAAG,QAAQ,EACpB,GAAG,GAAG,QAAQ,EACd,KAAK,GAAG,SAAS,EACjB,OAAO,GAAG,OAAO,EACjB,IAAI,GAAG,KAAK,EACZ,SAAS,EACT,KAAK,EACL,GAAG,IAAI,EACR,EAAE,GAAG,EAAE,EAAE;IACR,MAAM,SAAS,GAAG;QAChB,gBAAgB,EAAE,SAAS;QAC3B,UAAU,EAAE,GAAG;QACf,YAAY,EAAE,KAAK;QACnB,cAAc,EAAE,OAAO;QACvB,WAAW,EAAE,IAAI,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,SAAS;KACvC,CAAC;IAEF,MAAM,SAAS,GAAG,cAAc,CAAC;IACjC,MAAM,cAAc,GAAG,SAAS,CAAC,CAAC,CAAC,GAAG,SAAS,IAAI,SAAS,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC;IAE3E,OAAO,CACL,cACE,GAAG,EAAE,GAAG,EACR,SAAS,EAAE,cAAc,EACzB,KAAK,EAAE,KAAK,KACR,SAAS,KACT,IAAI,YAEP,QAAQ,GACL,CACP,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,KAAK,CAAC,WAAW,GAAG,OAAO,CAAC;AAE5B,sBAAsB;AACtB,MAAM,CAAC,MAAM,MAAM,GAAG,UAAU,CAC9B,CAAC,KAAK,EAAE,GAAG,EAAE,EAAE,CAAC,KAAC,KAAK,IAAC,GAAG,EAAE,GAAG,EAAE,SAAS,EAAC,QAAQ,KAAK,KAAK,GAAI,CAClE,CAAC;AACF,MAAM,CAAC,WAAW,GAAG,QAAQ,CAAC;AAE9B,MAAM,CAAC,MAAM,MAAM,GAAG,UAAU,CAC9B,CAAC,KAAK,EAAE,GAAG,EAAE,EAAE,CAAC,KAAC,KAAK,IAAC,GAAG,EAAE,GAAG,EAAE,SAAS,EAAC,KAAK,KAAK,KAAK,GAAI,CAC/D,CAAC;AACF,MAAM,CAAC,WAAW,GAAG,QAAQ,CAAC"}
@@ -0,0 +1,10 @@
1
+ /**
2
+ * Surface Component
3
+ *
4
+ * A container providing visual elevation and background treatment.
5
+ * Replaces: bg-*, shadow-*, p-*, rounded-*
6
+ */
7
+ import React from 'react';
8
+ import type { SurfaceProps } from '../types.js';
9
+ export declare const Surface: React.ForwardRefExoticComponent<SurfaceProps & React.RefAttributes<HTMLDivElement>>;
10
+ //# sourceMappingURL=Surface.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Surface.d.ts","sourceRoot":"","sources":["../../src/components/Surface.tsx"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAqB,MAAM,OAAO,CAAC;AAC1C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAEhD,eAAO,MAAM,OAAO,qFAiCnB,CAAC"}
@@ -0,0 +1,21 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ /**
3
+ * Surface Component
4
+ *
5
+ * A container providing visual elevation and background treatment.
6
+ * Replaces: bg-*, shadow-*, p-*, rounded-*
7
+ */
8
+ import { forwardRef } from 'react';
9
+ export const Surface = forwardRef(({ children, elevation = 'none', padding = 'normal', background = 'default', radius = 'md', className, style, ...rest }, ref) => {
10
+ const dataAttrs = {
11
+ 'data-elevation': elevation,
12
+ 'data-padding': padding,
13
+ 'data-background': background,
14
+ 'data-radius': radius,
15
+ };
16
+ const baseClass = 'intent-surface';
17
+ const finalClassName = className ? `${baseClass} ${className}` : baseClass;
18
+ return (_jsx("div", { ref: ref, className: finalClassName, style: style, ...dataAttrs, ...rest, children: children }));
19
+ });
20
+ Surface.displayName = 'Surface';
21
+ //# sourceMappingURL=Surface.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Surface.js","sourceRoot":"","sources":["../../src/components/Surface.tsx"],"names":[],"mappings":";AAAA;;;;;GAKG;AAEH,OAAc,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AAG1C,MAAM,CAAC,MAAM,OAAO,GAAG,UAAU,CAC/B,CAAC,EACC,QAAQ,EACR,SAAS,GAAG,MAAM,EAClB,OAAO,GAAG,QAAQ,EAClB,UAAU,GAAG,SAAS,EACtB,MAAM,GAAG,IAAI,EACb,SAAS,EACT,KAAK,EACL,GAAG,IAAI,EACR,EAAE,GAAG,EAAE,EAAE;IACR,MAAM,SAAS,GAAG;QAChB,gBAAgB,EAAE,SAAS;QAC3B,cAAc,EAAE,OAAO;QACvB,iBAAiB,EAAE,UAAU;QAC7B,aAAa,EAAE,MAAM;KACtB,CAAC;IAEF,MAAM,SAAS,GAAG,gBAAgB,CAAC;IACnC,MAAM,cAAc,GAAG,SAAS,CAAC,CAAC,CAAC,GAAG,SAAS,IAAI,SAAS,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC;IAE3E,OAAO,CACL,cACE,GAAG,EAAE,GAAG,EACR,SAAS,EAAE,cAAc,EACzB,KAAK,EAAE,KAAK,KACR,SAAS,KACT,IAAI,YAEP,QAAQ,GACL,CACP,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,OAAO,CAAC,WAAW,GAAG,SAAS,CAAC"}
@@ -0,0 +1,13 @@
1
+ /**
2
+ * Text Component
3
+ *
4
+ * Typography component for consistent text styling.
5
+ * Replaces: text-*, font-*, text-*-*, leading-*
6
+ */
7
+ import React from 'react';
8
+ import type { TextProps } from '../types.js';
9
+ export declare const Text: React.ForwardRefExoticComponent<TextProps & React.RefAttributes<HTMLElement>>;
10
+ export declare const Heading: React.ForwardRefExoticComponent<Omit<TextProps, "as"> & {
11
+ level?: 1 | 2 | 3 | 4 | 5 | 6;
12
+ } & React.RefAttributes<HTMLHeadingElement>>;
13
+ //# sourceMappingURL=Text.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Text.d.ts","sourceRoot":"","sources":["../../src/components/Text.tsx"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAoC,MAAM,OAAO,CAAC;AACzD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAE7C,eAAO,MAAM,IAAI,+EAkChB,CAAC;AAKF,eAAO,MAAM,OAAO;YAAoE,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC;4CAqB5G,CAAC"}
@@ -0,0 +1,40 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ /**
3
+ * Text Component
4
+ *
5
+ * Typography component for consistent text styling.
6
+ * Replaces: text-*, font-*, text-*-*, leading-*
7
+ */
8
+ import { forwardRef, createElement } from 'react';
9
+ export const Text = forwardRef(({ children, size = 'md', weight = 'normal', color = 'default', align = 'left', as: Component = 'span', className, style, ...rest }, ref) => {
10
+ const dataAttrs = {
11
+ 'data-size': size,
12
+ 'data-weight': weight,
13
+ 'data-color': color,
14
+ 'data-align': align,
15
+ };
16
+ const baseClass = 'intent-text';
17
+ const finalClassName = className ? `${baseClass} ${className}` : baseClass;
18
+ return createElement(Component, {
19
+ ref,
20
+ className: finalClassName,
21
+ style: { ...style, textAlign: align },
22
+ ...dataAttrs,
23
+ ...rest,
24
+ }, children);
25
+ });
26
+ Text.displayName = 'Text';
27
+ // Convenience components for common text types
28
+ export const Heading = forwardRef(({ level = 1, size, weight = 'bold', ...props }, ref) => {
29
+ const sizeMap = {
30
+ 1: '2xl',
31
+ 2: 'xl',
32
+ 3: 'lg',
33
+ 4: 'md',
34
+ 5: 'sm',
35
+ 6: 'xs',
36
+ };
37
+ return (_jsx(Text, { ref: ref, as: `h${level}`, size: size || sizeMap[level], weight: weight, ...props }));
38
+ });
39
+ Heading.displayName = 'Heading';
40
+ //# sourceMappingURL=Text.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Text.js","sourceRoot":"","sources":["../../src/components/Text.tsx"],"names":[],"mappings":";AAAA;;;;;GAKG;AAEH,OAAc,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAGzD,MAAM,CAAC,MAAM,IAAI,GAAG,UAAU,CAC5B,CAAC,EACC,QAAQ,EACR,IAAI,GAAG,IAAI,EACX,MAAM,GAAG,QAAQ,EACjB,KAAK,GAAG,SAAS,EACjB,KAAK,GAAG,MAAM,EACd,EAAE,EAAE,SAAS,GAAG,MAAM,EACtB,SAAS,EACT,KAAK,EACL,GAAG,IAAI,EACR,EAAE,GAAG,EAAE,EAAE;IACR,MAAM,SAAS,GAAG;QAChB,WAAW,EAAE,IAAI;QACjB,aAAa,EAAE,MAAM;QACrB,YAAY,EAAE,KAAK;QACnB,YAAY,EAAE,KAAK;KACpB,CAAC;IAEF,MAAM,SAAS,GAAG,aAAa,CAAC;IAChC,MAAM,cAAc,GAAG,SAAS,CAAC,CAAC,CAAC,GAAG,SAAS,IAAI,SAAS,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC;IAE3E,OAAO,aAAa,CAClB,SAAS,EACT;QACE,GAAG;QACH,SAAS,EAAE,cAAc;QACzB,KAAK,EAAE,EAAE,GAAG,KAAK,EAAE,SAAS,EAAE,KAAK,EAAE;QACrC,GAAG,SAAS;QACZ,GAAG,IAAI;KACR,EACD,QAAQ,CACT,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,IAAI,CAAC,WAAW,GAAG,MAAM,CAAC;AAE1B,+CAA+C;AAC/C,MAAM,CAAC,MAAM,OAAO,GAAG,UAAU,CAC/B,CAAC,EAAE,KAAK,GAAG,CAAC,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM,EAAE,GAAG,KAAK,EAAE,EAAE,GAAG,EAAE,EAAE;IACtD,MAAM,OAAO,GAAsC;QACjD,CAAC,EAAE,KAAK;QACR,CAAC,EAAE,IAAI;QACP,CAAC,EAAE,IAAI;QACP,CAAC,EAAE,IAAI;QACP,CAAC,EAAE,IAAI;QACP,CAAC,EAAE,IAAI;KACR,CAAC;IAEF,OAAO,CACL,KAAC,IAAI,IACH,GAAG,EAAE,GAAG,EACR,EAAE,EAAE,IAAI,KAAK,EAAW,EACxB,IAAI,EAAE,IAAI,IAAI,OAAO,CAAC,KAAK,CAAC,EAC5B,MAAM,EAAE,MAAM,KACV,KAAK,GACT,CACH,CAAC;AACJ,CAAC,CACF,CAAC;AACF,OAAO,CAAC,WAAW,GAAG,SAAS,CAAC"}
@@ -0,0 +1,34 @@
1
+ /**
2
+ * Intent React
3
+ *
4
+ * React integration for the Intent styling framework.
5
+ *
6
+ * @example
7
+ * ```tsx
8
+ * import { Stack, Button, Text } from 'intent-react';
9
+ *
10
+ * function App() {
11
+ * return (
12
+ * <Stack direction="column" gap="relaxed">
13
+ * <Text size="lg" weight="bold">Hello Intent</Text>
14
+ * <Stack direction="row" gap="normal">
15
+ * <Button importance="primary">Save</Button>
16
+ * <Button importance="secondary">Cancel</Button>
17
+ * </Stack>
18
+ * </Stack>
19
+ * );
20
+ * }
21
+ * ```
22
+ */
23
+ export { Stack, VStack, HStack } from './components/Stack.js';
24
+ export { Button } from './components/Button.js';
25
+ export { Surface } from './components/Surface.js';
26
+ export { Text, Heading } from './components/Text.js';
27
+ export { Input } from './components/Input.js';
28
+ export { Card } from './components/Card.js';
29
+ export { Badge } from './components/Badge.js';
30
+ export { Divider } from './components/Divider.js';
31
+ export type { IntentComponentProps, StackProps, ButtonProps, SurfaceProps, TextProps, InputProps, CardProps, BadgeProps, DividerProps, } from './types.js';
32
+ export { intentPropsToDataAttributes, generateIntentClassName, applyDefaultProps, validateProps, } from './utils/factory.js';
33
+ export declare const VERSION = "0.1.0";
34
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAGH,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAC9D,OAAO,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAC;AAChD,OAAO,EAAE,OAAO,EAAE,MAAM,yBAAyB,CAAC;AAClD,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AACrD,OAAO,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAC;AAC9C,OAAO,EAAE,IAAI,EAAE,MAAM,sBAAsB,CAAC;AAC5C,OAAO,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAC;AAC9C,OAAO,EAAE,OAAO,EAAE,MAAM,yBAAyB,CAAC;AAGlD,YAAY,EACV,oBAAoB,EACpB,UAAU,EACV,WAAW,EACX,YAAY,EACZ,SAAS,EACT,UAAU,EACV,SAAS,EACT,UAAU,EACV,YAAY,GACb,MAAM,YAAY,CAAC;AAGpB,OAAO,EACL,2BAA2B,EAC3B,uBAAuB,EACvB,iBAAiB,EACjB,aAAa,GACd,MAAM,oBAAoB,CAAC;AAG5B,eAAO,MAAM,OAAO,UAAU,CAAC"}
package/dist/index.js ADDED
@@ -0,0 +1,36 @@
1
+ /**
2
+ * Intent React
3
+ *
4
+ * React integration for the Intent styling framework.
5
+ *
6
+ * @example
7
+ * ```tsx
8
+ * import { Stack, Button, Text } from 'intent-react';
9
+ *
10
+ * function App() {
11
+ * return (
12
+ * <Stack direction="column" gap="relaxed">
13
+ * <Text size="lg" weight="bold">Hello Intent</Text>
14
+ * <Stack direction="row" gap="normal">
15
+ * <Button importance="primary">Save</Button>
16
+ * <Button importance="secondary">Cancel</Button>
17
+ * </Stack>
18
+ * </Stack>
19
+ * );
20
+ * }
21
+ * ```
22
+ */
23
+ // Components
24
+ export { Stack, VStack, HStack } from './components/Stack.js';
25
+ export { Button } from './components/Button.js';
26
+ export { Surface } from './components/Surface.js';
27
+ export { Text, Heading } from './components/Text.js';
28
+ export { Input } from './components/Input.js';
29
+ export { Card } from './components/Card.js';
30
+ export { Badge } from './components/Badge.js';
31
+ export { Divider } from './components/Divider.js';
32
+ // Utils
33
+ export { intentPropsToDataAttributes, generateIntentClassName, applyDefaultProps, validateProps, } from './utils/factory.js';
34
+ // Version
35
+ export const VERSION = '0.1.0';
36
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAEH,aAAa;AACb,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAC9D,OAAO,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAC;AAChD,OAAO,EAAE,OAAO,EAAE,MAAM,yBAAyB,CAAC;AAClD,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AACrD,OAAO,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAC;AAC9C,OAAO,EAAE,IAAI,EAAE,MAAM,sBAAsB,CAAC;AAC5C,OAAO,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAC;AAC9C,OAAO,EAAE,OAAO,EAAE,MAAM,yBAAyB,CAAC;AAelD,QAAQ;AACR,OAAO,EACL,2BAA2B,EAC3B,uBAAuB,EACvB,iBAAiB,EACjB,aAAa,GACd,MAAM,oBAAoB,CAAC;AAE5B,UAAU;AACV,MAAM,CAAC,MAAM,OAAO,GAAG,OAAO,CAAC"}
@@ -0,0 +1,65 @@
1
+ /**
2
+ * React-specific types for Intent
3
+ */
4
+ import type { ReactNode, ElementType } from 'react';
5
+ export interface IntentComponentProps {
6
+ children?: ReactNode;
7
+ className?: string;
8
+ style?: React.CSSProperties;
9
+ }
10
+ export interface GeneratedComponentProps<T extends Record<string, unknown>> {
11
+ as?: ElementType;
12
+ children?: ReactNode;
13
+ className?: string;
14
+ style?: React.CSSProperties;
15
+ [key: string]: unknown;
16
+ }
17
+ export interface StackProps extends IntentComponentProps {
18
+ direction?: 'row' | 'column';
19
+ gap?: 'none' | 'tight' | 'compact' | 'normal' | 'relaxed' | 'loose';
20
+ align?: 'start' | 'center' | 'end' | 'stretch';
21
+ justify?: 'start' | 'center' | 'end' | 'between' | 'around';
22
+ wrap?: boolean;
23
+ }
24
+ export interface ButtonProps extends IntentComponentProps {
25
+ importance?: 'primary' | 'secondary' | 'ghost' | 'danger';
26
+ size?: 'sm' | 'md' | 'lg';
27
+ state?: 'default' | 'hover' | 'active' | 'disabled';
28
+ type?: 'button' | 'submit' | 'reset';
29
+ onClick?: () => void;
30
+ disabled?: boolean;
31
+ }
32
+ export interface SurfaceProps extends IntentComponentProps {
33
+ elevation?: 'none' | 'low' | 'medium' | 'high';
34
+ padding?: 'none' | 'tight' | 'compact' | 'normal' | 'relaxed' | 'loose';
35
+ background?: 'default' | 'subtle' | 'elevated' | 'inverse';
36
+ radius?: 'none' | 'sm' | 'md' | 'lg';
37
+ }
38
+ export interface TextProps extends IntentComponentProps {
39
+ size?: 'xs' | 'sm' | 'md' | 'lg' | 'xl' | '2xl';
40
+ weight?: 'normal' | 'medium' | 'semibold' | 'bold';
41
+ color?: 'default' | 'subtle' | 'muted' | 'inverse' | 'brand';
42
+ align?: 'left' | 'center' | 'right';
43
+ as?: 'p' | 'span' | 'div' | 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6' | 'label';
44
+ }
45
+ export interface InputProps extends IntentComponentProps {
46
+ size?: 'sm' | 'md' | 'lg';
47
+ state?: 'default' | 'error' | 'success';
48
+ type?: 'text' | 'password' | 'email' | 'number' | 'search';
49
+ placeholder?: string;
50
+ value?: string;
51
+ onChange?: (value: string) => void;
52
+ disabled?: boolean;
53
+ }
54
+ export interface CardProps extends SurfaceProps {
55
+ interactive?: boolean;
56
+ }
57
+ export interface BadgeProps extends IntentComponentProps {
58
+ importance?: 'default' | 'primary' | 'success' | 'warning' | 'error';
59
+ size?: 'sm' | 'md';
60
+ }
61
+ export interface DividerProps extends IntentComponentProps {
62
+ orientation?: 'horizontal' | 'vertical';
63
+ weight?: 'thin' | 'normal' | 'thick';
64
+ }
65
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"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"}
package/dist/types.js ADDED
@@ -0,0 +1,5 @@
1
+ /**
2
+ * React-specific types for Intent
3
+ */
4
+ export {};
5
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;GAEG"}
@@ -0,0 +1,12 @@
1
+ /**
2
+ * Component Factory
3
+ *
4
+ * Creates React components from Intent schemas with proper type safety
5
+ * and data attribute binding.
6
+ */
7
+ import type { ComponentSchema } from 'intent-core';
8
+ export declare function intentPropsToDataAttributes(props: Record<string, unknown>, schema: ComponentSchema): Record<string, string>;
9
+ export declare function applyDefaultProps(props: Record<string, unknown>, schema: ComponentSchema): Record<string, unknown>;
10
+ export declare function generateIntentClassName(componentName: string, prefix?: string): string;
11
+ export declare function validateProps(props: Record<string, unknown>, schema: ComponentSchema, componentName: string): void;
12
+ //# sourceMappingURL=factory.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"factory.d.ts","sourceRoot":"","sources":["../../src/utils/factory.tsx"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAGnD,wBAAgB,2BAA2B,CACzC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC9B,MAAM,EAAE,eAAe,GACtB,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAqBxB;AAGD,wBAAgB,iBAAiB,CAC/B,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC9B,MAAM,EAAE,eAAe,GACtB,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAUzB;AAGD,wBAAgB,uBAAuB,CACrC,aAAa,EAAE,MAAM,EACrB,MAAM,SAAW,GAChB,MAAM,CAER;AAGD,wBAAgB,aAAa,CAC3B,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC9B,MAAM,EAAE,eAAe,EACvB,aAAa,EAAE,MAAM,GACpB,IAAI,CA0BN"}
@@ -0,0 +1,65 @@
1
+ /**
2
+ * Component Factory
3
+ *
4
+ * Creates React components from Intent schemas with proper type safety
5
+ * and data attribute binding.
6
+ */
7
+ // Props extractor - converts Intent props to data attributes
8
+ export function intentPropsToDataAttributes(props, schema) {
9
+ const attrs = {};
10
+ for (const [key, value] of Object.entries(props)) {
11
+ // Skip React-specific props
12
+ if (['children', 'key', 'ref', 'as', 'className', 'style'].includes(key)) {
13
+ continue;
14
+ }
15
+ // Skip event handlers
16
+ if (typeof key === 'string' && key.startsWith('on')) {
17
+ continue;
18
+ }
19
+ // Only include defined schema properties
20
+ if (schema.properties[key]) {
21
+ attrs[`data-${key.toLowerCase()}`] = String(value);
22
+ }
23
+ }
24
+ return attrs;
25
+ }
26
+ // Default props application
27
+ export function applyDefaultProps(props, schema) {
28
+ const result = { ...props };
29
+ for (const [key, definition] of Object.entries(schema.properties)) {
30
+ if (!(key in result) && 'default' in definition) {
31
+ result[key] = definition.default;
32
+ }
33
+ }
34
+ return result;
35
+ }
36
+ // Component class name generator
37
+ export function generateIntentClassName(componentName, prefix = 'intent') {
38
+ return `${prefix}-${componentName.toLowerCase()}`;
39
+ }
40
+ // Validation helper (dev mode only)
41
+ export function validateProps(props, schema, componentName) {
42
+ if (process.env.NODE_ENV === 'production') {
43
+ return;
44
+ }
45
+ // Check required props
46
+ for (const [key, definition] of Object.entries(schema.properties)) {
47
+ if (definition.required && !(key in props)) {
48
+ console.warn(`[Intent] ${componentName}: Required prop "${key}" is missing`);
49
+ }
50
+ }
51
+ // Check for unknown props
52
+ for (const key of Object.keys(props)) {
53
+ if (['children', 'as', 'className', 'style', 'ref', 'key'].includes(key)) {
54
+ continue;
55
+ }
56
+ if (!schema.properties[key]) {
57
+ console.warn(`[Intent] ${componentName}: Unknown prop "${key}". ` +
58
+ `Valid props: ${Object.keys(schema.properties).join(', ')}`);
59
+ }
60
+ }
61
+ }
62
+ // Note: The createIntentComponent factory is complex with TypeScript.
63
+ // For now, components are defined manually in the components/ directory.
64
+ // This utility file provides helper functions for prop handling.
65
+ //# sourceMappingURL=factory.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"factory.js","sourceRoot":"","sources":["../../src/utils/factory.tsx"],"names":[],"mappings":"AAAA;;;;;GAKG;AAKH,6DAA6D;AAC7D,MAAM,UAAU,2BAA2B,CACzC,KAA8B,EAC9B,MAAuB;IAEvB,MAAM,KAAK,GAA2B,EAAE,CAAC;IAEzC,KAAK,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC;QACjD,4BAA4B;QAC5B,IAAI,CAAC,UAAU,EAAE,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE,WAAW,EAAE,OAAO,CAAC,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE,CAAC;YACzE,SAAS;QACX,CAAC;QAED,sBAAsB;QACtB,IAAI,OAAO,GAAG,KAAK,QAAQ,IAAI,GAAG,CAAC,UAAU,CAAC,IAAI,CAAC,EAAE,CAAC;YACpD,SAAS;QACX,CAAC;QAED,yCAAyC;QACzC,IAAI,MAAM,CAAC,UAAU,CAAC,GAAG,CAAC,EAAE,CAAC;YAC3B,KAAK,CAAC,QAAQ,GAAG,CAAC,WAAW,EAAE,EAAE,CAAC,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC;QACrD,CAAC;IACH,CAAC;IAED,OAAO,KAAK,CAAC;AACf,CAAC;AAED,4BAA4B;AAC5B,MAAM,UAAU,iBAAiB,CAC/B,KAA8B,EAC9B,MAAuB;IAEvB,MAAM,MAAM,GAAG,EAAE,GAAG,KAAK,EAAE,CAAC;IAE5B,KAAK,MAAM,CAAC,GAAG,EAAE,UAAU,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,UAAU,CAAC,EAAE,CAAC;QAClE,IAAI,CAAC,CAAC,GAAG,IAAI,MAAM,CAAC,IAAI,SAAS,IAAI,UAAU,EAAE,CAAC;YAChD,MAAM,CAAC,GAAG,CAAC,GAAG,UAAU,CAAC,OAAO,CAAC;QACnC,CAAC;IACH,CAAC;IAED,OAAO,MAAM,CAAC;AAChB,CAAC;AAED,iCAAiC;AACjC,MAAM,UAAU,uBAAuB,CACrC,aAAqB,EACrB,MAAM,GAAG,QAAQ;IAEjB,OAAO,GAAG,MAAM,IAAI,aAAa,CAAC,WAAW,EAAE,EAAE,CAAC;AACpD,CAAC;AAED,oCAAoC;AACpC,MAAM,UAAU,aAAa,CAC3B,KAA8B,EAC9B,MAAuB,EACvB,aAAqB;IAErB,IAAI,OAAO,CAAC,GAAG,CAAC,QAAQ,KAAK,YAAY,EAAE,CAAC;QAC1C,OAAO;IACT,CAAC;IAED,uBAAuB;IACvB,KAAK,MAAM,CAAC,GAAG,EAAE,UAAU,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,UAAU,CAAC,EAAE,CAAC;QAClE,IAAI,UAAU,CAAC,QAAQ,IAAI,CAAC,CAAC,GAAG,IAAI,KAAK,CAAC,EAAE,CAAC;YAC3C,OAAO,CAAC,IAAI,CACV,YAAY,aAAa,oBAAoB,GAAG,cAAc,CAC/D,CAAC;QACJ,CAAC;IACH,CAAC;IAED,0BAA0B;IAC1B,KAAK,MAAM,GAAG,IAAI,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC;QACrC,IAAI,CAAC,UAAU,EAAE,IAAI,EAAE,WAAW,EAAE,OAAO,EAAE,KAAK,EAAE,KAAK,CAAC,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE,CAAC;YACzE,SAAS;QACX,CAAC;QACD,IAAI,CAAC,MAAM,CAAC,UAAU,CAAC,GAAG,CAAC,EAAE,CAAC;YAC5B,OAAO,CAAC,IAAI,CACV,YAAY,aAAa,mBAAmB,GAAG,KAAK;gBACpD,gBAAgB,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAC5D,CAAC;QACJ,CAAC;IACH,CAAC;AACH,CAAC;AAED,sEAAsE;AACtE,yEAAyE;AACzE,iEAAiE"}
package/package.json ADDED
@@ -0,0 +1,59 @@
1
+ {
2
+ "name": "intent-react",
3
+ "version": "0.1.0",
4
+ "description": "React components for Intent styling framework",
5
+ "type": "module",
6
+ "license": "MIT",
7
+ "repository": {
8
+ "type": "git",
9
+ "url": "https://github.com/mixedmetals/intent-framework",
10
+ "directory": "packages/react"
11
+ },
12
+ "keywords": [
13
+ "intent",
14
+ "react",
15
+ "components",
16
+ "design-system",
17
+ "ai",
18
+ "styling"
19
+ ],
20
+ "files": [
21
+ "dist",
22
+ "README.md",
23
+ "LICENSE"
24
+ ],
25
+ "main": "./dist/index.js",
26
+ "module": "./dist/index.js",
27
+ "types": "./dist/index.d.ts",
28
+ "exports": {
29
+ ".": {
30
+ "types": "./dist/index.d.ts",
31
+ "import": "./dist/index.js"
32
+ }
33
+ },
34
+ "scripts": {
35
+ "build": "tsc",
36
+ "dev": "tsc --watch",
37
+ "test": "vitest run",
38
+ "clean": "rm -rf dist"
39
+ },
40
+ "peerDependencies": {
41
+ "react": "^18.0.0 || ^19.0.0",
42
+ "react-dom": "^18.0.0 || ^19.0.0"
43
+ },
44
+ "dependencies": {
45
+ "intent-core": "workspace:^"
46
+ },
47
+ "devDependencies": {
48
+ "@types/node": "^20.10.0",
49
+ "@types/react": "^18.2.0",
50
+ "@types/react-dom": "^18.2.0",
51
+ "react": "^18.2.0",
52
+ "react-dom": "^18.2.0",
53
+ "typescript": "^5.3.0",
54
+ "vitest": "^4.0.0"
55
+ },
56
+ "engines": {
57
+ "node": ">=18.0.0"
58
+ }
59
+ }