@1doc/1ds-react 0.0.1 → 0.0.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.
package/CHANGELOG.md ADDED
@@ -0,0 +1,8 @@
1
+ # @1doc/1ds-react
2
+
3
+ ## 0.0.2
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies
8
+ - @1doc/1ds-tokens@0.1.0
package/README.md CHANGED
@@ -10,13 +10,14 @@ pnpm add @1doc/1ds-react @1doc/1ds-tokens
10
10
 
11
11
  ## Configuração
12
12
 
13
- Importe o CSS dos tokens no seu arquivo principal (`App.tsx` ou `main.tsx`):
13
+ > [!IMPORTANT]
14
+ > Para que os componentes sejam renderizados corretamente, você **deve** importar o CSS dos tokens e da biblioteca de ícones no ponto de entrada da sua aplicação (geralmente `App.tsx` ou `main.tsx`). Sem esses imports, os estilos e ícones não serão aplicados.
14
15
 
15
16
  ```tsx
16
17
  import "@1doc/1ds-tokens/dist/css/primitives.css";
17
18
  import "@1doc/1ds-tokens/dist/css/semantic.css";
18
19
  import "@1doc/1ds-tokens/dist/css/theme-1doc.css";
19
- import "iconoir/css/iconoir.css";
20
+ // Icons are loaded via Icon component
20
21
  ```
21
22
 
22
23
  ## Uso
@@ -3,11 +3,25 @@
3
3
  align-items: center;
4
4
  justify-content: center;
5
5
  line-height: 1;
6
+ position: relative;
6
7
  }
7
8
 
8
9
  .umds-icon svg {
10
+ display: inline-block;
9
11
  width: 1em;
10
12
  height: 1em;
13
+ vertical-align: -0.125em;
14
+ margin-right: 0;
15
+ }
16
+
17
+ .umds-icon svg.svg-inline--fa {
18
+ font-family: var(--fa-font-awesome);
19
+ font-weight: 900;
20
+ font-style: normal;
21
+ font-variant: normal;
22
+ text-rendering: auto;
23
+ -webkit-font-smoothing: antialiased;
24
+ -moz-osx-font-smoothing: grayscale;
11
25
  }
12
26
 
13
27
  /* Sizes */
@@ -38,4 +52,4 @@
38
52
 
39
53
  .umds-icon--inherit {
40
54
  color: inherit;
41
- }
55
+ }
@@ -1,6 +1,7 @@
1
1
  import './Icon.css';
2
2
  export interface IconProps {
3
3
  name?: string;
4
+ prefix?: "fas" | "far" | "fal" | "fat" | "fad";
4
5
  component?: any;
5
6
  size?: "sm" | "md" | "lg";
6
7
  customSize?: string;
@@ -1,10 +1,22 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
1
+ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import './Icon.css';
3
+ import { library, findIconDefinition } from "@fortawesome/fontawesome-svg-core";
4
+ import { fas } from "@fortawesome/pro-solid-svg-icons";
5
+ import { far } from "@fortawesome/pro-regular-svg-icons";
6
+ import { fal } from "@fortawesome/pro-light-svg-icons";
7
+ import { fat } from "@fortawesome/pro-thin-svg-icons";
8
+ import { fad } from "@fortawesome/pro-duotone-svg-icons";
9
+ library.add(fas, far, fal, fat, fad);
3
10
  function Icon(props) {
11
+ function iconDefinition() {
12
+ if (!props.name)
13
+ return null;
14
+ const prefix = props.prefix ?? "fas";
15
+ return findIconDefinition({ prefix, iconName: props.name }) ?? null;
16
+ }
4
17
  function classes() {
5
18
  return [
6
19
  "umds-icon",
7
- props.name ? `iconoir-${props.name}` : "",
8
20
  // Only apply size class if customSize is not provided
9
21
  props.customSize ? "" : `umds-icon--${props.size || "md"}`,
10
22
  `umds-icon--${props.variant || "inherit"}`,
@@ -24,6 +36,6 @@ function Icon(props) {
24
36
  }
25
37
  return undefined;
26
38
  }
27
- return (_jsx("span", { style: style(), ...props, className: classes(), children: props.component ? _jsx(props.component, {}) : null }));
39
+ return (_jsxs("span", { style: style(), "data-icon": props.name, ...props, className: classes(), children: [iconDefinition() ? (_jsx("svg", { xmlns: "http://www.w3.org/2000/svg", className: "svg-inline--fa", viewBox: `0 0 ${iconDefinition().icon[0]} ${iconDefinition().icon[1]}`, children: Array.isArray(iconDefinition().icon[4]) ? (_jsxs(_Fragment, { children: [_jsx("path", { fill: "currentColor", className: "fa-secondary", opacity: 0.4, d: iconDefinition().icon[4][0] }), _jsx("path", { fill: "currentColor", className: "fa-primary", d: iconDefinition().icon[4][1] })] })) : (_jsx(_Fragment, { children: _jsx("path", { fill: "currentColor", d: iconDefinition().icon[4] }) })) })) : null, props.component ? _jsx(props.component, {}) : null] }));
28
40
  }
29
41
  export default Icon;
package/package.json CHANGED
@@ -1,17 +1,35 @@
1
1
  {
2
2
  "name": "@1doc/1ds-react",
3
- "version": "0.0.1",
3
+ "version": "0.0.2",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "dependencies": {
7
- "iconoir": "^7.11.0",
8
- "@1doc/1ds-tokens": "0.0.1"
7
+ "@fortawesome/duotone-light-svg-icons": "^7.2.0",
8
+ "@fortawesome/duotone-regular-svg-icons": "^7.2.0",
9
+ "@fortawesome/duotone-thin-svg-icons": "^7.2.0",
10
+ "@fortawesome/fontawesome-svg-core": "^6.5.0",
11
+ "@fortawesome/free-solid-svg-icons": "^6.5.0",
12
+ "@fortawesome/pro-duotone-svg-icons": "^7.2.0",
13
+ "@fortawesome/pro-light-svg-icons": "^7.2.0",
14
+ "@fortawesome/pro-regular-svg-icons": "^7.2.0",
15
+ "@fortawesome/pro-solid-svg-icons": "^7.2.0",
16
+ "@fortawesome/pro-thin-svg-icons": "^7.2.0",
17
+ "@fortawesome/sharp-duotone-light-svg-icons": "^7.2.0",
18
+ "@fortawesome/sharp-duotone-regular-svg-icons": "^7.2.0",
19
+ "@fortawesome/sharp-duotone-solid-svg-icons": "^7.2.0",
20
+ "@fortawesome/sharp-duotone-thin-svg-icons": "^7.2.0",
21
+ "@fortawesome/sharp-light-svg-icons": "^7.2.0",
22
+ "@fortawesome/sharp-regular-svg-icons": "^7.2.0",
23
+ "@fortawesome/sharp-solid-svg-icons": "^7.2.0",
24
+ "@fortawesome/sharp-thin-svg-icons": "^7.2.0",
25
+ "@fortawesome/vue-fontawesome": "^3.1.0",
26
+ "@1doc/1ds-tokens": "0.1.0"
9
27
  },
10
28
  "devDependencies": {
11
29
  "@types/react": "^18.0.0",
12
30
  "react": "^18.0.0",
13
31
  "typescript": "^5.0.0",
14
- "@1doc/1ds-core": "0.0.1"
32
+ "@1doc/1ds-core": "0.0.2"
15
33
  },
16
34
  "peerDependencies": {
17
35
  "react": ">=18"