@joralvmel/cosmos-react 0.1.0 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,8 @@
1
+ import { CosmIcon } from '@joralvmel/cosmos-elements/icon';
2
+ import * as React from 'react';
3
+ /** The icon contract has no events. */
4
+ export declare const iconEvents: {};
5
+ /** React wrapper of `<cosm-icon>`. */
6
+ export declare const Icon: import("@lit/react").ReactWebComponent<CosmIcon, {}>;
7
+ export type IconProps = React.ComponentProps<typeof Icon>;
8
+ //# sourceMappingURL=icon.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"icon.d.ts","sourceRoot":"","sources":["../../src/components/icon.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,iCAAiC,CAAC;AAE3D,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,uCAAuC;AACvC,eAAO,MAAM,UAAU,IAAK,CAAC;AAE7B,sCAAsC;AACtC,eAAO,MAAM,IAAI,sDAMf,CAAC;AAEH,MAAM,MAAM,SAAS,GAAG,KAAK,CAAC,cAAc,CAAC,OAAO,IAAI,CAAC,CAAC"}
@@ -0,0 +1,14 @@
1
+ import { CosmIcon } from '@joralvmel/cosmos-elements/icon';
2
+ import { createComponent } from '@lit/react';
3
+ import * as React from 'react';
4
+ /** The icon contract has no events. */
5
+ export const iconEvents = {};
6
+ /** React wrapper of `<cosm-icon>`. */
7
+ export const Icon = createComponent({
8
+ tagName: 'cosm-icon',
9
+ elementClass: CosmIcon,
10
+ react: React,
11
+ events: iconEvents,
12
+ displayName: 'Icon',
13
+ });
14
+ //# sourceMappingURL=icon.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"icon.js","sourceRoot":"","sources":["../../src/components/icon.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,iCAAiC,CAAC;AAC3D,OAAO,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAC7C,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,uCAAuC;AACvC,MAAM,CAAC,MAAM,UAAU,GAAG,EAAE,CAAC;AAE7B,sCAAsC;AACtC,MAAM,CAAC,MAAM,IAAI,GAAG,eAAe,CAAC;IAClC,OAAO,EAAE,WAAW;IACpB,YAAY,EAAE,QAAQ;IACtB,KAAK,EAAE,KAAK;IACZ,MAAM,EAAE,UAAU;IAClB,WAAW,EAAE,MAAM;CACpB,CAAC,CAAC"}
package/dist/index.d.ts CHANGED
@@ -1,3 +1,4 @@
1
1
  export type { ButtonPressDetail, PressSource } from '@joralvmel/cosmos-core';
2
2
  export { Button, type ButtonProps, buttonEvents } from './components/button.js';
3
+ export { Icon, type IconProps, iconEvents } from './components/icon.js';
3
4
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,iBAAiB,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAC7E,OAAO,EAAE,MAAM,EAAE,KAAK,WAAW,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,iBAAiB,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAC7E,OAAO,EAAE,MAAM,EAAE,KAAK,WAAW,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAChF,OAAO,EAAE,IAAI,EAAE,KAAK,SAAS,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC"}
package/dist/index.js CHANGED
@@ -1,2 +1,3 @@
1
1
  export { Button, buttonEvents } from './components/button.js';
2
+ export { Icon, iconEvents } from './components/icon.js';
2
3
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAoB,YAAY,EAAE,MAAM,wBAAwB,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAoB,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAChF,OAAO,EAAE,IAAI,EAAkB,UAAU,EAAE,MAAM,sBAAsB,CAAC"}
package/llms.md CHANGED
@@ -111,6 +111,32 @@ export function Example() {
111
111
  );
112
112
  }
113
113
  ```
114
+ ### `Icon`
115
+
116
+ Renders a structured SVG icon. Decorative icons are hidden from assistive technology; informative icons require a text label.
117
+
118
+ | Prop | Type | Default | Description |
119
+ | --- | --- | --- | --- |
120
+ | `icon` | IconDefinition | Required | Structured icon definition, commonly imported from @joralvmel/cosmos-icons. |
121
+ | `size` | 'sm' \| 'md' \| 'lg' \| number | `md` | Semantic size (16, 20 or 24) or a positive finite number in pixels / native units. |
122
+ | `stroke` | string | `currentColor` | Stroke paint; currentColor inherits on web and resolves to the theme foreground on native. |
123
+ | `fill` | string | `none` | Root fill paint. Explicit node fills take precedence. |
124
+ | `strokeWidth` | number | `2` | Finite nonnegative stroke width in SVG viewBox units. |
125
+ | `label` | string | — | Accessible name required when decorative is false. |
126
+ | `decorative` | boolean | `true` | Hides the icon from assistive technology when true. |
127
+
128
+ Events: none.
129
+
130
+ ```tsx
131
+ import { Icon } from '@joralvmel/cosmos-react';
132
+ import { house } from '@joralvmel/cosmos-icons/house';
133
+
134
+ export function Example() {
135
+ return (
136
+ <Icon icon={house}></Icon>
137
+ );
138
+ }
139
+ ```
114
140
 
115
141
  ## Themes
116
142
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@joralvmel/cosmos-react",
3
- "version": "0.1.0",
3
+ "version": "0.2.0",
4
4
  "description": "React wrappers for the Cosmos UI Web Components (React 19, Vite, Next.js).",
5
5
  "keywords": [
6
6
  "react",
@@ -42,8 +42,8 @@
42
42
  "clean": "node -e \"require('node:fs').rmSync('dist',{recursive:true,force:true})\""
43
43
  },
44
44
  "dependencies": {
45
- "@joralvmel/cosmos-core": "^0.1.0",
46
- "@joralvmel/cosmos-elements": "^0.1.0",
45
+ "@joralvmel/cosmos-core": "^0.2.0",
46
+ "@joralvmel/cosmos-elements": "^0.2.0",
47
47
  "@lit/react": "^1.0.8"
48
48
  },
49
49
  "peerDependencies": {