uiuxicon-react 0.1.0 → 0.1.1
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.
- package/README.md +2 -1
- package/dist/create.js +5 -1
- package/dist/types.d.ts +2 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -11,7 +11,7 @@ import { CartIcon, SearchIcon } from 'uiuxicon-react';
|
|
|
11
11
|
|
|
12
12
|
<CartIcon />
|
|
13
13
|
<SearchIcon size={20} variant="solid" color="#0647f7" />
|
|
14
|
-
<CartIcon size={32} variant="duotone"
|
|
14
|
+
<CartIcon size={32} variant="duotone" color="#175cd3" duoColor="#ff7700" aria-label="Cart" />
|
|
15
15
|
```
|
|
16
16
|
|
|
17
17
|
Each icon is its own module, so a bundler ships only the ones you import. To import one directly:
|
|
@@ -31,6 +31,7 @@ The component name is the icon name in PascalCase plus `Icon`: `payment-failed`
|
|
|
31
31
|
| `strokeWidth` | `1.25` | Stroke in screen px, 0.5 to 3 |
|
|
32
32
|
| `radius` | `2` | Corner radius on the 16-unit grid, 0 to 4 |
|
|
33
33
|
| `color` | text colour | Any CSS colour |
|
|
34
|
+
| `duoColor` | 22% tint of the primary colour | Explicit secondary fill at full opacity for the duotone variant |
|
|
34
35
|
| `gap` | `1` | Gap where one shape cuts another, 0 to 2.5 |
|
|
35
36
|
| `dot` | `1` | Dot scale, 0.5 to 2 |
|
|
36
37
|
| `scaling` | `"constant"` | `"scale"` makes the stroke grow with the icon |
|
package/dist/create.js
CHANGED
|
@@ -8,9 +8,13 @@ const useId = React.useId || (() => '');
|
|
|
8
8
|
|
|
9
9
|
/** Wraps one icon's geometry in a React component. */
|
|
10
10
|
export function createIcon(name, geo, displayName) {
|
|
11
|
-
const Icon = React.forwardRef(function Icon({ size, variant, strokeWidth, radius, color, gap, dot, scaling, ...rest }, ref) {
|
|
11
|
+
const Icon = React.forwardRef(function Icon({ size, variant, strokeWidth, radius, color, duoColor, gap, dot, scaling, ...rest }, ref) {
|
|
12
12
|
const uid = useId().replace(/[^a-zA-Z0-9]/g, '');
|
|
13
13
|
const opts = { size, style: variant, stroke: strokeWidth, radius, color, gap, dot, scaling };
|
|
14
|
+
if (duoColor) {
|
|
15
|
+
opts.duoColor = duoColor;
|
|
16
|
+
opts.duoOpacity = 1;
|
|
17
|
+
}
|
|
14
18
|
for (const k of Object.keys(opts)) if (opts[k] === undefined || opts[k] === null) delete opts[k];
|
|
15
19
|
const tree = iconTree({ els: geo.e, rotate: geo.r }, opts, 'uiux-' + name + (uid ? '-' + uid : ''));
|
|
16
20
|
const labelled = rest['aria-label'] || rest['aria-labelledby'];
|
package/dist/types.d.ts
CHANGED
|
@@ -11,6 +11,8 @@ export interface IconProps extends Omit<SVGProps<SVGSVGElement>, 'ref' | 'radius
|
|
|
11
11
|
radius?: number;
|
|
12
12
|
/** Any CSS colour. Omit to inherit the text colour (currentColor). */
|
|
13
13
|
color?: string;
|
|
14
|
+
/** Secondary fill in the duotone variant. Omit for a 22% tint of the primary colour. */
|
|
15
|
+
duoColor?: string;
|
|
14
16
|
/** Gap where one shape cuts another, 0 to 2.5. Default 1. */
|
|
15
17
|
gap?: number;
|
|
16
18
|
/** Dot scale, 0.5 to 2. Default 1. */
|
package/package.json
CHANGED