@yakit-libs/yakit-ui-icons 0.2.0 → 0.2.2

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,70 @@
1
+ import { jsx as a } from "react/jsx-runtime";
2
+ import { forwardRef as d } from "react";
3
+ const b = /* @__PURE__ */ new Set([
4
+ "children",
5
+ "dangerouslysetinnerhtml",
6
+ "focusable",
7
+ "ref",
8
+ "role",
9
+ "tabindex"
10
+ ]);
11
+ function g(e) {
12
+ const n = e.toLowerCase();
13
+ return b.has(n) || n.startsWith("aria-") || n.startsWith("on");
14
+ }
15
+ function I(e) {
16
+ if (!e) return {};
17
+ const n = {};
18
+ for (const [t, o] of Object.entries(e))
19
+ if (t.toLowerCase(), !g(t)) {
20
+ n[t] = o;
21
+ continue;
22
+ }
23
+ return n;
24
+ }
25
+ const S = (...e) => e.filter(Boolean).join(" "), l = d(
26
+ ({
27
+ Svg: e,
28
+ className: n,
29
+ color: t,
30
+ defaultColor: o,
31
+ onClick: r,
32
+ role: i = "img",
33
+ size: s,
34
+ style: f,
35
+ svgProps: u,
36
+ tabIndex: m,
37
+ ...h
38
+ }, p) => {
39
+ const v = I(u), y = s === void 0 ? void 0 : { height: s, width: s }, c = (t == null ? void 0 : t.trim().toLowerCase()) === "currentcolor", C = {
40
+ "--yakit-icon-default-color": c ? "currentColor" : o,
41
+ ...t && !c ? { color: t } : void 0,
42
+ ...f
43
+ };
44
+ return /* @__PURE__ */ a(
45
+ "span",
46
+ {
47
+ ...h,
48
+ ref: p,
49
+ role: i,
50
+ tabIndex: m ?? (r ? -1 : void 0),
51
+ className: S("anticon", "yakit-icon", n),
52
+ style: C,
53
+ onClick: r,
54
+ children: /* @__PURE__ */ a(e, { ...y, ...v, "aria-hidden": "true", focusable: "false" })
55
+ }
56
+ );
57
+ }
58
+ );
59
+ l.displayName = "IconBase";
60
+ const w = "var(--Colors-Use-Neutral-Text-1-Title, #353639)";
61
+ // @__NO_SIDE_EFFECTS__
62
+ function L(e, n, t = w) {
63
+ const o = e, r = d((i, s) => /* @__PURE__ */ a(l, { ...i, ref: s, Svg: o, defaultColor: t }));
64
+ return r.displayName = n, r;
65
+ }
66
+ export {
67
+ w as D,
68
+ l as I,
69
+ L as c
70
+ };
@@ -1,8 +1,7 @@
1
- import type { ComponentType } from 'react';
2
- import type { IconProps } from './types.js';
1
+ import type { IconComponent } from './types.js';
3
2
  /** Figma `Colors-Use/Neutral/Text 1-Title`, provided by @yakit-libs/color. */
4
3
  export declare const DEFAULT_ICON_COLOR = "var(--Colors-Use-Neutral-Text-1-Title, #353639)";
5
4
  /**
6
5
  * Turns a Figma-exported SVG into an icon component with an Ant Design-like API.
7
6
  */
8
- export declare function createIcon(svg: unknown, displayName: string, defaultColor?: string): ComponentType<IconProps>;
7
+ export declare function createIcon(svg: unknown, displayName: string, defaultColor?: string): IconComponent;
package/dist/icon.css ADDED
@@ -0,0 +1,29 @@
1
+ :where(.anticon.yakit-icon) {
2
+ display: inline-block;
3
+ color: var(
4
+ --yakit-icon-default-color,
5
+ var(--Colors-Use-Neutral-Text-1-Title, #353639)
6
+ );
7
+ font-style: normal;
8
+ line-height: 0;
9
+ text-align: center;
10
+ text-transform: none;
11
+ vertical-align: -0.125em;
12
+ text-rendering: optimizeLegibility;
13
+ -webkit-font-smoothing: antialiased;
14
+ -moz-osx-font-smoothing: grayscale;
15
+ }
16
+
17
+ :where(.anticon.yakit-icon) > svg {
18
+ display: inline-block;
19
+ }
20
+
21
+ :where(.anticon.yakit-icon)[tabindex] {
22
+ cursor: pointer;
23
+ }
24
+
25
+ @keyframes yakitIconLoadingSpin_b1a35c158267 {
26
+ to {
27
+ transform: rotate(360deg);
28
+ }
29
+ }