@baseline-ui/icons 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.
package/8/index.js ADDED
@@ -0,0 +1,258 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+
20
+ // src/8/index.ts
21
+ var __exports = {};
22
+ __export(__exports, {
23
+ CaretRightIcon: () => CaretRightIcon_default,
24
+ ChevronDownIcon: () => ChevronDownIcon_default,
25
+ ChevronRightIcon: () => ChevronRightIcon_default,
26
+ EllipseIcon: () => EllipseIcon_default,
27
+ MinusIcon: () => MinusIcon_default,
28
+ PlusIcon: () => PlusIcon_default,
29
+ XIcon: () => XIcon_default
30
+ });
31
+ module.exports = __toCommonJS(__exports);
32
+
33
+ // src/8/CaretRightIcon.tsx
34
+ var import_jsx_runtime = require("react/jsx-runtime");
35
+ var SvgCaretRightIcon = ({
36
+ title,
37
+ titleId,
38
+ ...props
39
+ }) => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
40
+ "svg",
41
+ {
42
+ xmlns: "http://www.w3.org/2000/svg",
43
+ width: props.size || "1em",
44
+ height: props.size || "1em",
45
+ fill: "none",
46
+ viewBox: "0 0 8 8",
47
+ "aria-labelledby": titleId,
48
+ ...props,
49
+ children: [
50
+ title ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)("title", { id: titleId, children: title }) : null,
51
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
52
+ "path",
53
+ {
54
+ fill: "currentColor",
55
+ fillRule: "evenodd",
56
+ d: "M2.47 1.47a.75.75 0 0 0 0 1.06L3.94 4 2.47 5.47a.75.75 0 0 0 1.06 1.06l2-2a.75.75 0 0 0 0-1.06l-2-2a.75.75 0 0 0-1.06 0Z",
57
+ clipRule: "evenodd"
58
+ }
59
+ )
60
+ ]
61
+ }
62
+ );
63
+ var CaretRightIcon_default = SvgCaretRightIcon;
64
+
65
+ // src/8/ChevronDownIcon.tsx
66
+ var import_jsx_runtime2 = require("react/jsx-runtime");
67
+ var SvgChevronDownIcon = ({
68
+ title,
69
+ titleId,
70
+ ...props
71
+ }) => /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
72
+ "svg",
73
+ {
74
+ xmlns: "http://www.w3.org/2000/svg",
75
+ width: props.size || "1em",
76
+ height: props.size || "1em",
77
+ fill: "none",
78
+ viewBox: "0 0 8 8",
79
+ "aria-labelledby": titleId,
80
+ ...props,
81
+ children: [
82
+ title ? /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("title", { id: titleId, children: title }) : null,
83
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
84
+ "path",
85
+ {
86
+ fill: "currentColor",
87
+ fillRule: "evenodd",
88
+ d: "M6.53 2.47a.75.75 0 0 0-1.06 0L4 3.94 2.53 2.47a.75.75 0 0 0-1.06 1.06l2 2a.75.75 0 0 0 1.06 0l2-2a.75.75 0 0 0 0-1.06Z",
89
+ clipRule: "evenodd"
90
+ }
91
+ )
92
+ ]
93
+ }
94
+ );
95
+ var ChevronDownIcon_default = SvgChevronDownIcon;
96
+
97
+ // src/8/ChevronRightIcon.tsx
98
+ var import_jsx_runtime3 = require("react/jsx-runtime");
99
+ var SvgChevronRightIcon = ({
100
+ title,
101
+ titleId,
102
+ ...props
103
+ }) => /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
104
+ "svg",
105
+ {
106
+ xmlns: "http://www.w3.org/2000/svg",
107
+ width: props.size || "1em",
108
+ height: props.size || "1em",
109
+ fill: "none",
110
+ viewBox: "0 0 8 8",
111
+ "aria-labelledby": titleId,
112
+ ...props,
113
+ children: [
114
+ title ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("title", { id: titleId, children: title }) : null,
115
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("path", { fill: "currentColor", d: "M1 8V0l6 4-6 4Z" })
116
+ ]
117
+ }
118
+ );
119
+ var ChevronRightIcon_default = SvgChevronRightIcon;
120
+
121
+ // src/8/EllipseIcon.tsx
122
+ var import_jsx_runtime4 = require("react/jsx-runtime");
123
+ var SvgEllipseIcon = ({
124
+ title,
125
+ titleId,
126
+ ...props
127
+ }) => /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
128
+ "svg",
129
+ {
130
+ xmlns: "http://www.w3.org/2000/svg",
131
+ width: props.size || "1em",
132
+ height: props.size || "1em",
133
+ fill: "none",
134
+ viewBox: "0 0 8 8",
135
+ "aria-labelledby": titleId,
136
+ ...props,
137
+ children: [
138
+ title ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("title", { id: titleId, children: title }) : null,
139
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
140
+ "path",
141
+ {
142
+ fill: "currentColor",
143
+ fillRule: "evenodd",
144
+ d: "M4 6.5a2.5 2.5 0 1 0 0-5 2.5 2.5 0 0 0 0 5ZM4 8a4 4 0 1 0 0-8 4 4 0 0 0 0 8Z",
145
+ clipRule: "evenodd"
146
+ }
147
+ )
148
+ ]
149
+ }
150
+ );
151
+ var EllipseIcon_default = SvgEllipseIcon;
152
+
153
+ // src/8/MinusIcon.tsx
154
+ var import_jsx_runtime5 = require("react/jsx-runtime");
155
+ var SvgMinusIcon = ({
156
+ title,
157
+ titleId,
158
+ ...props
159
+ }) => /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
160
+ "svg",
161
+ {
162
+ xmlns: "http://www.w3.org/2000/svg",
163
+ width: props.size || "1em",
164
+ height: props.size || "1em",
165
+ fill: "none",
166
+ viewBox: "0 0 8 8",
167
+ "aria-labelledby": titleId,
168
+ ...props,
169
+ children: [
170
+ title ? /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("title", { id: titleId, children: title }) : null,
171
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
172
+ "path",
173
+ {
174
+ fill: "currentColor",
175
+ fillRule: "evenodd",
176
+ d: "M7.75 4a.75.75 0 0 1-.75.75H1a.75.75 0 0 1 0-1.5h6a.75.75 0 0 1 .75.75Z",
177
+ clipRule: "evenodd"
178
+ }
179
+ )
180
+ ]
181
+ }
182
+ );
183
+ var MinusIcon_default = SvgMinusIcon;
184
+
185
+ // src/8/PlusIcon.tsx
186
+ var import_jsx_runtime6 = require("react/jsx-runtime");
187
+ var SvgPlusIcon = ({
188
+ title,
189
+ titleId,
190
+ ...props
191
+ }) => /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
192
+ "svg",
193
+ {
194
+ xmlns: "http://www.w3.org/2000/svg",
195
+ width: props.size || "1em",
196
+ height: props.size || "1em",
197
+ fill: "none",
198
+ viewBox: "0 0 8 8",
199
+ "aria-labelledby": titleId,
200
+ ...props,
201
+ children: [
202
+ title ? /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("title", { id: titleId, children: title }) : null,
203
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
204
+ "path",
205
+ {
206
+ fill: "currentColor",
207
+ fillRule: "evenodd",
208
+ d: "M4 .25a.75.75 0 0 1 .75.75v2.25H7a.75.75 0 0 1 0 1.5H4.75V7a.75.75 0 0 1-1.5 0V4.75H1a.75.75 0 0 1 0-1.5h2.25V1A.75.75 0 0 1 4 .25Z",
209
+ clipRule: "evenodd"
210
+ }
211
+ )
212
+ ]
213
+ }
214
+ );
215
+ var PlusIcon_default = SvgPlusIcon;
216
+
217
+ // src/8/XIcon.tsx
218
+ var import_jsx_runtime7 = require("react/jsx-runtime");
219
+ var SvgXIcon = ({
220
+ title,
221
+ titleId,
222
+ ...props
223
+ }) => /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
224
+ "svg",
225
+ {
226
+ xmlns: "http://www.w3.org/2000/svg",
227
+ width: props.size || "1em",
228
+ height: props.size || "1em",
229
+ fill: "none",
230
+ viewBox: "0 0 8 8",
231
+ "aria-labelledby": titleId,
232
+ ...props,
233
+ children: [
234
+ title ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("title", { id: titleId, children: title }) : null,
235
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("g", { clipPath: "url(#x-icon_svg__a)", children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
236
+ "path",
237
+ {
238
+ fill: "currentColor",
239
+ fillRule: "evenodd",
240
+ d: "M.288 7.712a.75.75 0 0 1 0-1.06L2.94 4 .288 1.348a.75.75 0 1 1 1.06-1.06L4 2.939 6.652.288a.75.75 0 0 1 1.06 1.06L5.062 4l2.652 2.652a.75.75 0 0 1-1.061 1.06L4 5.061 1.35 7.712a.75.75 0 0 1-1.061 0Z",
241
+ clipRule: "evenodd"
242
+ }
243
+ ) }),
244
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("defs", { children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("clipPath", { id: "x-icon_svg__a", children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("path", { fill: "transparent", d: "M0 0h8v8H0z" }) }) })
245
+ ]
246
+ }
247
+ );
248
+ var XIcon_default = SvgXIcon;
249
+ // Annotate the CommonJS export names for ESM import in node:
250
+ 0 && (module.exports = {
251
+ CaretRightIcon,
252
+ ChevronDownIcon,
253
+ ChevronRightIcon,
254
+ EllipseIcon,
255
+ MinusIcon,
256
+ PlusIcon,
257
+ XIcon
258
+ });
package/8/index.mjs ADDED
@@ -0,0 +1,225 @@
1
+ // src/8/CaretRightIcon.tsx
2
+ import { jsx, jsxs } from "react/jsx-runtime";
3
+ var SvgCaretRightIcon = ({
4
+ title,
5
+ titleId,
6
+ ...props
7
+ }) => /* @__PURE__ */ jsxs(
8
+ "svg",
9
+ {
10
+ xmlns: "http://www.w3.org/2000/svg",
11
+ width: props.size || "1em",
12
+ height: props.size || "1em",
13
+ fill: "none",
14
+ viewBox: "0 0 8 8",
15
+ "aria-labelledby": titleId,
16
+ ...props,
17
+ children: [
18
+ title ? /* @__PURE__ */ jsx("title", { id: titleId, children: title }) : null,
19
+ /* @__PURE__ */ jsx(
20
+ "path",
21
+ {
22
+ fill: "currentColor",
23
+ fillRule: "evenodd",
24
+ d: "M2.47 1.47a.75.75 0 0 0 0 1.06L3.94 4 2.47 5.47a.75.75 0 0 0 1.06 1.06l2-2a.75.75 0 0 0 0-1.06l-2-2a.75.75 0 0 0-1.06 0Z",
25
+ clipRule: "evenodd"
26
+ }
27
+ )
28
+ ]
29
+ }
30
+ );
31
+ var CaretRightIcon_default = SvgCaretRightIcon;
32
+
33
+ // src/8/ChevronDownIcon.tsx
34
+ import { jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
35
+ var SvgChevronDownIcon = ({
36
+ title,
37
+ titleId,
38
+ ...props
39
+ }) => /* @__PURE__ */ jsxs2(
40
+ "svg",
41
+ {
42
+ xmlns: "http://www.w3.org/2000/svg",
43
+ width: props.size || "1em",
44
+ height: props.size || "1em",
45
+ fill: "none",
46
+ viewBox: "0 0 8 8",
47
+ "aria-labelledby": titleId,
48
+ ...props,
49
+ children: [
50
+ title ? /* @__PURE__ */ jsx2("title", { id: titleId, children: title }) : null,
51
+ /* @__PURE__ */ jsx2(
52
+ "path",
53
+ {
54
+ fill: "currentColor",
55
+ fillRule: "evenodd",
56
+ d: "M6.53 2.47a.75.75 0 0 0-1.06 0L4 3.94 2.53 2.47a.75.75 0 0 0-1.06 1.06l2 2a.75.75 0 0 0 1.06 0l2-2a.75.75 0 0 0 0-1.06Z",
57
+ clipRule: "evenodd"
58
+ }
59
+ )
60
+ ]
61
+ }
62
+ );
63
+ var ChevronDownIcon_default = SvgChevronDownIcon;
64
+
65
+ // src/8/ChevronRightIcon.tsx
66
+ import { jsx as jsx3, jsxs as jsxs3 } from "react/jsx-runtime";
67
+ var SvgChevronRightIcon = ({
68
+ title,
69
+ titleId,
70
+ ...props
71
+ }) => /* @__PURE__ */ jsxs3(
72
+ "svg",
73
+ {
74
+ xmlns: "http://www.w3.org/2000/svg",
75
+ width: props.size || "1em",
76
+ height: props.size || "1em",
77
+ fill: "none",
78
+ viewBox: "0 0 8 8",
79
+ "aria-labelledby": titleId,
80
+ ...props,
81
+ children: [
82
+ title ? /* @__PURE__ */ jsx3("title", { id: titleId, children: title }) : null,
83
+ /* @__PURE__ */ jsx3("path", { fill: "currentColor", d: "M1 8V0l6 4-6 4Z" })
84
+ ]
85
+ }
86
+ );
87
+ var ChevronRightIcon_default = SvgChevronRightIcon;
88
+
89
+ // src/8/EllipseIcon.tsx
90
+ import { jsx as jsx4, jsxs as jsxs4 } from "react/jsx-runtime";
91
+ var SvgEllipseIcon = ({
92
+ title,
93
+ titleId,
94
+ ...props
95
+ }) => /* @__PURE__ */ jsxs4(
96
+ "svg",
97
+ {
98
+ xmlns: "http://www.w3.org/2000/svg",
99
+ width: props.size || "1em",
100
+ height: props.size || "1em",
101
+ fill: "none",
102
+ viewBox: "0 0 8 8",
103
+ "aria-labelledby": titleId,
104
+ ...props,
105
+ children: [
106
+ title ? /* @__PURE__ */ jsx4("title", { id: titleId, children: title }) : null,
107
+ /* @__PURE__ */ jsx4(
108
+ "path",
109
+ {
110
+ fill: "currentColor",
111
+ fillRule: "evenodd",
112
+ d: "M4 6.5a2.5 2.5 0 1 0 0-5 2.5 2.5 0 0 0 0 5ZM4 8a4 4 0 1 0 0-8 4 4 0 0 0 0 8Z",
113
+ clipRule: "evenodd"
114
+ }
115
+ )
116
+ ]
117
+ }
118
+ );
119
+ var EllipseIcon_default = SvgEllipseIcon;
120
+
121
+ // src/8/MinusIcon.tsx
122
+ import { jsx as jsx5, jsxs as jsxs5 } from "react/jsx-runtime";
123
+ var SvgMinusIcon = ({
124
+ title,
125
+ titleId,
126
+ ...props
127
+ }) => /* @__PURE__ */ jsxs5(
128
+ "svg",
129
+ {
130
+ xmlns: "http://www.w3.org/2000/svg",
131
+ width: props.size || "1em",
132
+ height: props.size || "1em",
133
+ fill: "none",
134
+ viewBox: "0 0 8 8",
135
+ "aria-labelledby": titleId,
136
+ ...props,
137
+ children: [
138
+ title ? /* @__PURE__ */ jsx5("title", { id: titleId, children: title }) : null,
139
+ /* @__PURE__ */ jsx5(
140
+ "path",
141
+ {
142
+ fill: "currentColor",
143
+ fillRule: "evenodd",
144
+ d: "M7.75 4a.75.75 0 0 1-.75.75H1a.75.75 0 0 1 0-1.5h6a.75.75 0 0 1 .75.75Z",
145
+ clipRule: "evenodd"
146
+ }
147
+ )
148
+ ]
149
+ }
150
+ );
151
+ var MinusIcon_default = SvgMinusIcon;
152
+
153
+ // src/8/PlusIcon.tsx
154
+ import { jsx as jsx6, jsxs as jsxs6 } from "react/jsx-runtime";
155
+ var SvgPlusIcon = ({
156
+ title,
157
+ titleId,
158
+ ...props
159
+ }) => /* @__PURE__ */ jsxs6(
160
+ "svg",
161
+ {
162
+ xmlns: "http://www.w3.org/2000/svg",
163
+ width: props.size || "1em",
164
+ height: props.size || "1em",
165
+ fill: "none",
166
+ viewBox: "0 0 8 8",
167
+ "aria-labelledby": titleId,
168
+ ...props,
169
+ children: [
170
+ title ? /* @__PURE__ */ jsx6("title", { id: titleId, children: title }) : null,
171
+ /* @__PURE__ */ jsx6(
172
+ "path",
173
+ {
174
+ fill: "currentColor",
175
+ fillRule: "evenodd",
176
+ d: "M4 .25a.75.75 0 0 1 .75.75v2.25H7a.75.75 0 0 1 0 1.5H4.75V7a.75.75 0 0 1-1.5 0V4.75H1a.75.75 0 0 1 0-1.5h2.25V1A.75.75 0 0 1 4 .25Z",
177
+ clipRule: "evenodd"
178
+ }
179
+ )
180
+ ]
181
+ }
182
+ );
183
+ var PlusIcon_default = SvgPlusIcon;
184
+
185
+ // src/8/XIcon.tsx
186
+ import { jsx as jsx7, jsxs as jsxs7 } from "react/jsx-runtime";
187
+ var SvgXIcon = ({
188
+ title,
189
+ titleId,
190
+ ...props
191
+ }) => /* @__PURE__ */ jsxs7(
192
+ "svg",
193
+ {
194
+ xmlns: "http://www.w3.org/2000/svg",
195
+ width: props.size || "1em",
196
+ height: props.size || "1em",
197
+ fill: "none",
198
+ viewBox: "0 0 8 8",
199
+ "aria-labelledby": titleId,
200
+ ...props,
201
+ children: [
202
+ title ? /* @__PURE__ */ jsx7("title", { id: titleId, children: title }) : null,
203
+ /* @__PURE__ */ jsx7("g", { clipPath: "url(#x-icon_svg__a)", children: /* @__PURE__ */ jsx7(
204
+ "path",
205
+ {
206
+ fill: "currentColor",
207
+ fillRule: "evenodd",
208
+ d: "M.288 7.712a.75.75 0 0 1 0-1.06L2.94 4 .288 1.348a.75.75 0 1 1 1.06-1.06L4 2.939 6.652.288a.75.75 0 0 1 1.06 1.06L5.062 4l2.652 2.652a.75.75 0 0 1-1.061 1.06L4 5.061 1.35 7.712a.75.75 0 0 1-1.061 0Z",
209
+ clipRule: "evenodd"
210
+ }
211
+ ) }),
212
+ /* @__PURE__ */ jsx7("defs", { children: /* @__PURE__ */ jsx7("clipPath", { id: "x-icon_svg__a", children: /* @__PURE__ */ jsx7("path", { fill: "transparent", d: "M0 0h8v8H0z" }) }) })
213
+ ]
214
+ }
215
+ );
216
+ var XIcon_default = SvgXIcon;
217
+ export {
218
+ CaretRightIcon_default as CaretRightIcon,
219
+ ChevronDownIcon_default as ChevronDownIcon,
220
+ ChevronRightIcon_default as ChevronRightIcon,
221
+ EllipseIcon_default as EllipseIcon,
222
+ MinusIcon_default as MinusIcon,
223
+ PlusIcon_default as PlusIcon,
224
+ XIcon_default as XIcon
225
+ };
package/dist/index.css ADDED
@@ -0,0 +1,4 @@
1
+ /* vanilla-extract-css-ns:src/Icon.css.ts.vanilla.css?source=Lkljb25faWNvbldyYXBwZXJfXzFybDhvcGUwIHsKICBkaXNwbGF5OiBjb250ZW50czsKfQ== */
2
+ .Icon_iconWrapper__1rl8ope0 {
3
+ display: contents;
4
+ }
@@ -0,0 +1,44 @@
1
+ import React, { CSSProperties, SVGProps } from 'react';
2
+
3
+ declare const Icon: React.ForwardRefExoticComponent<{
4
+ svg: string;
5
+ } & {
6
+ className?: string | undefined;
7
+ size?: string | number | undefined;
8
+ style?: React.CSSProperties | undefined;
9
+ title?: string | undefined;
10
+ } & React.RefAttributes<HTMLSpanElement>>;
11
+
12
+ type SharedProps = {
13
+ /** The `className` property assigned to the SVG element of the component. */
14
+ className?: string;
15
+ /**
16
+ * The `width` and `height` of the icon. This can be a string or a number. If
17
+ * you want to set the width and height to different values, you can pass
18
+ * `width` and `height` as separate props.
19
+ *
20
+ * @default "1em"
21
+ */
22
+ size?: string | number;
23
+ /** The style applicable to the SVG element of the component. */
24
+ style?: React.CSSProperties;
25
+ title?: string;
26
+ };
27
+ type IconComponentProps = {
28
+ /**
29
+ * The SVG string of the icon to render. This is useful if you want to render
30
+ * an icon that is not in the catalog of icons provided in the list above. You
31
+ * can use the `createIcon` function to create an icon from an SVG string.
32
+ *
33
+ * @default undefined
34
+ */
35
+ svg: string;
36
+ } & SharedProps;
37
+ type SVGRProps = {
38
+ title?: string;
39
+ titleId?: string;
40
+ size?: CSSProperties["width"];
41
+ };
42
+ type IconProps = SVGRProps & SVGProps<SVGSVGElement>;
43
+
44
+ export { Icon, IconComponentProps, IconProps, SVGRProps };
@@ -0,0 +1,44 @@
1
+ import React, { CSSProperties, SVGProps } from 'react';
2
+
3
+ declare const Icon: React.ForwardRefExoticComponent<{
4
+ svg: string;
5
+ } & {
6
+ className?: string | undefined;
7
+ size?: string | number | undefined;
8
+ style?: React.CSSProperties | undefined;
9
+ title?: string | undefined;
10
+ } & React.RefAttributes<HTMLSpanElement>>;
11
+
12
+ type SharedProps = {
13
+ /** The `className` property assigned to the SVG element of the component. */
14
+ className?: string;
15
+ /**
16
+ * The `width` and `height` of the icon. This can be a string or a number. If
17
+ * you want to set the width and height to different values, you can pass
18
+ * `width` and `height` as separate props.
19
+ *
20
+ * @default "1em"
21
+ */
22
+ size?: string | number;
23
+ /** The style applicable to the SVG element of the component. */
24
+ style?: React.CSSProperties;
25
+ title?: string;
26
+ };
27
+ type IconComponentProps = {
28
+ /**
29
+ * The SVG string of the icon to render. This is useful if you want to render
30
+ * an icon that is not in the catalog of icons provided in the list above. You
31
+ * can use the `createIcon` function to create an icon from an SVG string.
32
+ *
33
+ * @default undefined
34
+ */
35
+ svg: string;
36
+ } & SharedProps;
37
+ type SVGRProps = {
38
+ title?: string;
39
+ titleId?: string;
40
+ size?: CSSProperties["width"];
41
+ };
42
+ type IconProps = SVGRProps & SVGProps<SVGSVGElement>;
43
+
44
+ export { Icon, IconComponentProps, IconProps, SVGRProps };
package/dist/index.js ADDED
@@ -0,0 +1,114 @@
1
+ "use strict";
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __export = (target, all) => {
9
+ for (var name in all)
10
+ __defProp(target, name, { get: all[name], enumerable: true });
11
+ };
12
+ var __copyProps = (to, from, except, desc) => {
13
+ if (from && typeof from === "object" || typeof from === "function") {
14
+ for (let key of __getOwnPropNames(from))
15
+ if (!__hasOwnProp.call(to, key) && key !== except)
16
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
+ }
18
+ return to;
19
+ };
20
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
+ // If the importer is in node compatibility mode or this is not an ESM
22
+ // file that has been converted to a CommonJS file using a Babel-
23
+ // compatible transform (i.e. "__esModule" has not been set), then set
24
+ // "default" to the CommonJS "module.exports" for node compatibility.
25
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
+ mod
27
+ ));
28
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
+
30
+ // src/index.ts
31
+ var src_exports = {};
32
+ __export(src_exports, {
33
+ Icon: () => Icon
34
+ });
35
+ module.exports = __toCommonJS(src_exports);
36
+
37
+ // src/Icon.tsx
38
+ var Dompurify = __toESM(require("dompurify"));
39
+ var import_react = __toESM(require("react"));
40
+ var import_react_aria = require("react-aria");
41
+ var import_utils = require("@baseline-ui/utils");
42
+
43
+ // src/Icon.css.ts
44
+ var iconWrapper = "Icon_iconWrapper__1rl8ope0";
45
+
46
+ // src/Icon.tsx
47
+ var import_jsx_runtime = require("react/jsx-runtime");
48
+ var setSizeAttributes = (svgElement, size) => {
49
+ svgElement.setAttribute(
50
+ "height",
51
+ typeof size === "number" ? `${size}px` : size
52
+ );
53
+ svgElement.setAttribute(
54
+ "width",
55
+ typeof size === "number" ? `${size}px` : size
56
+ );
57
+ };
58
+ var updateSvgTitle = (svgElement, title, id) => {
59
+ const titleElement = svgElement.querySelector("title");
60
+ if (titleElement) {
61
+ titleElement.textContent = title;
62
+ titleElement.setAttribute("id", id);
63
+ } else {
64
+ const newTitleElement = document.createElement("title");
65
+ newTitleElement.textContent = title;
66
+ newTitleElement.setAttribute("id", id);
67
+ svgElement.prepend(newTitleElement);
68
+ }
69
+ };
70
+ var setClassName = (svgElement, className) => {
71
+ if (className) {
72
+ svgElement.classList.add(className);
73
+ }
74
+ };
75
+ var getSanitizedSvgElement = (_svg) => {
76
+ const span = document.createElement("span");
77
+ span.innerHTML = Dompurify.default.sanitize(_svg);
78
+ const svgElement = span.querySelector("svg");
79
+ (0, import_utils.invariant)(svgElement, "Icon: svg prop must be a valid svg string");
80
+ return svgElement;
81
+ };
82
+ var Icon = import_react.default.forwardRef(
83
+ ({ size, title, className, style, ...rest }, ref) => {
84
+ const id = (0, import_react_aria.useId)();
85
+ const _svg = "svg" in rest ? rest.svg : void 0;
86
+ const svgString = import_react.default.useMemo(() => {
87
+ if (_svg) {
88
+ const svgElement = getSanitizedSvgElement(_svg);
89
+ if (size) {
90
+ setSizeAttributes(svgElement, size);
91
+ }
92
+ if (title) {
93
+ updateSvgTitle(svgElement, title, id);
94
+ }
95
+ setClassName(svgElement, className);
96
+ return svgElement.outerHTML;
97
+ }
98
+ }, [_svg, size, title, className, id]);
99
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
100
+ "span",
101
+ {
102
+ className: (0, import_utils.classNames)(iconWrapper, className),
103
+ ref,
104
+ style,
105
+ dangerouslySetInnerHTML: svgString ? { __html: svgString } : void 0
106
+ }
107
+ );
108
+ }
109
+ );
110
+ Icon.displayName = "Icon";
111
+ // Annotate the CommonJS export names for ESM import in node:
112
+ 0 && (module.exports = {
113
+ Icon
114
+ });