@clubmed/trident-ui 1.0.0-alpha.35 → 1.0.0-alpha.37
Sign up to get free protection for your applications and to get access to all the features.
- package/CHANGELOG.md +15 -0
- package/README.md +56 -28
- package/atoms/Icons/Icon.js +8 -7
- package/atoms/Icons/IconsResolver.d.ts +4 -43
- package/atoms/Icons/IconsResolver.js +15 -36
- package/atoms/Icons/contexts/IconsContext.d.ts +43 -0
- package/atoms/Icons/contexts/IconsContext.js +46 -0
- package/atoms/Icons/fonts/Actions.d.ts +2 -1
- package/atoms/Icons/fonts/Actions.js +112 -106
- package/atoms/Icons/fonts/Activities.d.ts +2 -1
- package/atoms/Icons/fonts/Activities.js +144 -138
- package/atoms/Icons/fonts/Brand.d.ts +2 -1
- package/atoms/Icons/fonts/Brand.js +91 -85
- package/atoms/Icons/fonts/Covid.d.ts +2 -1
- package/atoms/Icons/fonts/Covid.js +60 -54
- package/atoms/Icons/fonts/FontIconResolver.d.ts +1 -1
- package/atoms/Icons/fonts/FontIconResolver.js +6 -7
- package/atoms/Icons/fonts/Food.d.ts +2 -1
- package/atoms/Icons/fonts/Food.js +105 -99
- package/atoms/Icons/fonts/HappyToCare.d.ts +2 -1
- package/atoms/Icons/fonts/HappyToCare.js +57 -51
- package/atoms/Icons/fonts/Places.d.ts +2 -1
- package/atoms/Icons/fonts/Places.js +60 -54
- package/atoms/Icons/fonts/Room.d.ts +2 -1
- package/atoms/Icons/fonts/Room.js +114 -108
- package/atoms/Icons/fonts/Services.d.ts +2 -1
- package/atoms/Icons/fonts/Services.js +72 -66
- package/atoms/Icons/fonts/Socials.d.ts +2 -1
- package/atoms/Icons/fonts/Socials.js +72 -66
- package/atoms/Icons/fonts/Transports.d.ts +2 -1
- package/atoms/Icons/fonts/Transports.js +48 -42
- package/atoms/Icons/fonts/Utilities.d.ts +2 -1
- package/atoms/Icons/fonts/Utilities.js +153 -147
- package/atoms/Icons/fonts/index.js +4 -4
- package/atoms/Icons/hooks/useIcon.d.ts +2 -0
- package/atoms/Icons/hooks/useIcon.js +16 -0
- package/atoms/Icons/index.js +9 -8
- package/atoms/Icons/svg/Actions.d.ts +2 -1
- package/atoms/Icons/svg/Actions.js +145 -139
- package/atoms/Icons/svg/Activities.d.ts +2 -1
- package/atoms/Icons/svg/Activities.js +189 -183
- package/atoms/Icons/svg/Brand.d.ts +2 -1
- package/atoms/Icons/svg/Brand.js +90 -84
- package/atoms/Icons/svg/Covid.d.ts +2 -1
- package/atoms/Icons/svg/Covid.js +77 -71
- package/atoms/Icons/svg/Food.d.ts +2 -1
- package/atoms/Icons/svg/Food.js +137 -131
- package/atoms/Icons/svg/HappyToCare.d.ts +2 -1
- package/atoms/Icons/svg/HappyToCare.js +73 -67
- package/atoms/Icons/svg/Places.d.ts +2 -1
- package/atoms/Icons/svg/Places.js +77 -71
- package/atoms/Icons/svg/ResortFill-EC.d.ts +2 -1
- package/atoms/Icons/svg/ResortFill-EC.js +135 -129
- package/atoms/Icons/svg/ResortFill.d.ts +2 -1
- package/atoms/Icons/svg/ResortFill.js +399 -393
- package/atoms/Icons/svg/ResortOutline-EC.d.ts +2 -1
- package/atoms/Icons/svg/ResortOutline-EC.js +135 -129
- package/atoms/Icons/svg/ResortOutline.d.ts +2 -1
- package/atoms/Icons/svg/ResortOutline.js +399 -393
- package/atoms/Icons/svg/Room.d.ts +2 -1
- package/atoms/Icons/svg/Room.js +149 -143
- package/atoms/Icons/svg/Services.d.ts +2 -1
- package/atoms/Icons/svg/Services.js +93 -87
- package/atoms/Icons/svg/Socials.d.ts +2 -1
- package/atoms/Icons/svg/Socials.js +83 -77
- package/atoms/Icons/svg/SvgIconResolver.d.ts +1 -2
- package/atoms/Icons/svg/SvgIconResolver.js +6 -8
- package/atoms/Icons/svg/Transports.d.ts +2 -1
- package/atoms/Icons/svg/Transports.js +61 -55
- package/atoms/Icons/svg/Utilities.d.ts +2 -1
- package/atoms/Icons/svg/Utilities.js +201 -195
- package/atoms/Icons/svg/index.js +3 -2
- package/atoms/Icons/svg-use/Actions.d.ts +2 -1
- package/atoms/Icons/svg-use/Actions.js +156 -150
- package/atoms/Icons/svg-use/Activities.d.ts +2 -1
- package/atoms/Icons/svg-use/Activities.js +195 -189
- package/atoms/Icons/svg-use/Brand.d.ts +2 -1
- package/atoms/Icons/svg-use/Brand.js +97 -91
- package/atoms/Icons/svg-use/Covid.d.ts +2 -1
- package/atoms/Icons/svg-use/Covid.js +80 -74
- package/atoms/Icons/svg-use/Food.d.ts +2 -1
- package/atoms/Icons/svg-use/Food.js +145 -139
- package/atoms/Icons/svg-use/HappyToCare.d.ts +2 -1
- package/atoms/Icons/svg-use/HappyToCare.js +78 -72
- package/atoms/Icons/svg-use/Places.d.ts +2 -1
- package/atoms/Icons/svg-use/Places.js +83 -77
- package/atoms/Icons/svg-use/ResortFill-EC.d.ts +2 -1
- package/atoms/Icons/svg-use/ResortFill-EC.js +141 -135
- package/atoms/Icons/svg-use/ResortFill.d.ts +2 -1
- package/atoms/Icons/svg-use/ResortFill.js +410 -404
- package/atoms/Icons/svg-use/ResortOutline-EC.d.ts +2 -1
- package/atoms/Icons/svg-use/ResortOutline-EC.js +144 -138
- package/atoms/Icons/svg-use/ResortOutline.d.ts +2 -1
- package/atoms/Icons/svg-use/ResortOutline.js +408 -402
- package/atoms/Icons/svg-use/Room.d.ts +2 -1
- package/atoms/Icons/svg-use/Room.js +159 -153
- package/atoms/Icons/svg-use/Services.d.ts +2 -1
- package/atoms/Icons/svg-use/Services.js +97 -91
- package/atoms/Icons/svg-use/Socials.d.ts +2 -1
- package/atoms/Icons/svg-use/Socials.js +85 -79
- package/atoms/Icons/svg-use/SvgUseIconResolver.d.ts +1 -2
- package/atoms/Icons/svg-use/SvgUseIconResolver.js +8 -10
- package/atoms/Icons/svg-use/Transports.d.ts +2 -1
- package/atoms/Icons/svg-use/Transports.js +67 -61
- package/atoms/Icons/svg-use/Utilities.d.ts +2 -1
- package/atoms/Icons/svg-use/Utilities.js +212 -206
- package/atoms/Icons/svg-use/index.js +3 -2
- package/atoms/Icons/utils/getIcons.d.ts +4 -0
- package/atoms/Icons/utils/getIcons.js +21 -0
- package/fonts/Actions/tui-actions.css +6 -6
- package/fonts/Actions/tui-actions.eot +0 -0
- package/fonts/Actions/tui-actions.less +6 -6
- package/fonts/Actions/tui-actions.module.less +6 -6
- package/fonts/Actions/tui-actions.scss +6 -6
- package/fonts/Actions/tui-actions.styl +6 -6
- package/fonts/Actions/tui-actions.ttf +0 -0
- package/fonts/Actions/tui-actions.woff +0 -0
- package/fonts/Actions/tui-actions.woff2 +0 -0
- package/fonts/Activities/tui-activities.css +6 -6
- package/fonts/Activities/tui-activities.eot +0 -0
- package/fonts/Activities/tui-activities.less +6 -6
- package/fonts/Activities/tui-activities.module.less +6 -6
- package/fonts/Activities/tui-activities.scss +6 -6
- package/fonts/Activities/tui-activities.styl +6 -6
- package/fonts/Activities/tui-activities.ttf +0 -0
- package/fonts/Activities/tui-activities.woff +0 -0
- package/fonts/Activities/tui-activities.woff2 +0 -0
- package/fonts/Brand/tui-brand.css +6 -6
- package/fonts/Brand/tui-brand.eot +0 -0
- package/fonts/Brand/tui-brand.less +6 -6
- package/fonts/Brand/tui-brand.module.less +6 -6
- package/fonts/Brand/tui-brand.scss +6 -6
- package/fonts/Brand/tui-brand.styl +6 -6
- package/fonts/Brand/tui-brand.ttf +0 -0
- package/fonts/Brand/tui-brand.woff +0 -0
- package/fonts/Brand/tui-brand.woff2 +0 -0
- package/fonts/Covid/tui-covid.css +6 -6
- package/fonts/Covid/tui-covid.eot +0 -0
- package/fonts/Covid/tui-covid.less +6 -6
- package/fonts/Covid/tui-covid.module.less +6 -6
- package/fonts/Covid/tui-covid.scss +6 -6
- package/fonts/Covid/tui-covid.styl +6 -6
- package/fonts/Covid/tui-covid.ttf +0 -0
- package/fonts/Covid/tui-covid.woff +0 -0
- package/fonts/Covid/tui-covid.woff2 +0 -0
- package/fonts/Food/tui-food.css +6 -6
- package/fonts/Food/tui-food.eot +0 -0
- package/fonts/Food/tui-food.less +6 -6
- package/fonts/Food/tui-food.module.less +6 -6
- package/fonts/Food/tui-food.scss +6 -6
- package/fonts/Food/tui-food.styl +6 -6
- package/fonts/Food/tui-food.ttf +0 -0
- package/fonts/Food/tui-food.woff +0 -0
- package/fonts/Food/tui-food.woff2 +0 -0
- package/fonts/HappyToCare/tui-happy-to-care.css +6 -6
- package/fonts/HappyToCare/tui-happy-to-care.eot +0 -0
- package/fonts/HappyToCare/tui-happy-to-care.less +6 -6
- package/fonts/HappyToCare/tui-happy-to-care.module.less +6 -6
- package/fonts/HappyToCare/tui-happy-to-care.scss +6 -6
- package/fonts/HappyToCare/tui-happy-to-care.styl +6 -6
- package/fonts/HappyToCare/tui-happy-to-care.ttf +0 -0
- package/fonts/HappyToCare/tui-happy-to-care.woff +0 -0
- package/fonts/HappyToCare/tui-happy-to-care.woff2 +0 -0
- package/fonts/Places/tui-places.css +6 -6
- package/fonts/Places/tui-places.eot +0 -0
- package/fonts/Places/tui-places.less +6 -6
- package/fonts/Places/tui-places.module.less +6 -6
- package/fonts/Places/tui-places.scss +6 -6
- package/fonts/Places/tui-places.styl +6 -6
- package/fonts/Places/tui-places.ttf +0 -0
- package/fonts/Places/tui-places.woff +0 -0
- package/fonts/Places/tui-places.woff2 +0 -0
- package/fonts/Room/tui-room.css +6 -6
- package/fonts/Room/tui-room.eot +0 -0
- package/fonts/Room/tui-room.less +6 -6
- package/fonts/Room/tui-room.module.less +6 -6
- package/fonts/Room/tui-room.scss +6 -6
- package/fonts/Room/tui-room.styl +6 -6
- package/fonts/Room/tui-room.ttf +0 -0
- package/fonts/Room/tui-room.woff +0 -0
- package/fonts/Room/tui-room.woff2 +0 -0
- package/fonts/Services/tui-services.css +6 -6
- package/fonts/Services/tui-services.eot +0 -0
- package/fonts/Services/tui-services.less +6 -6
- package/fonts/Services/tui-services.module.less +6 -6
- package/fonts/Services/tui-services.scss +6 -6
- package/fonts/Services/tui-services.styl +6 -6
- package/fonts/Services/tui-services.ttf +0 -0
- package/fonts/Services/tui-services.woff +0 -0
- package/fonts/Services/tui-services.woff2 +0 -0
- package/fonts/Socials/tui-socials.css +6 -6
- package/fonts/Socials/tui-socials.eot +0 -0
- package/fonts/Socials/tui-socials.less +6 -6
- package/fonts/Socials/tui-socials.module.less +6 -6
- package/fonts/Socials/tui-socials.scss +6 -6
- package/fonts/Socials/tui-socials.styl +6 -6
- package/fonts/Socials/tui-socials.ttf +0 -0
- package/fonts/Socials/tui-socials.woff +0 -0
- package/fonts/Socials/tui-socials.woff2 +0 -0
- package/fonts/Transports/tui-transports.css +6 -6
- package/fonts/Transports/tui-transports.eot +0 -0
- package/fonts/Transports/tui-transports.less +6 -6
- package/fonts/Transports/tui-transports.module.less +6 -6
- package/fonts/Transports/tui-transports.scss +6 -6
- package/fonts/Transports/tui-transports.styl +6 -6
- package/fonts/Transports/tui-transports.ttf +0 -0
- package/fonts/Transports/tui-transports.woff +0 -0
- package/fonts/Transports/tui-transports.woff2 +0 -0
- package/fonts/Utilities/tui-utilities.css +6 -6
- package/fonts/Utilities/tui-utilities.eot +0 -0
- package/fonts/Utilities/tui-utilities.less +6 -6
- package/fonts/Utilities/tui-utilities.module.less +6 -6
- package/fonts/Utilities/tui-utilities.scss +6 -6
- package/fonts/Utilities/tui-utilities.styl +6 -6
- package/fonts/Utilities/tui-utilities.ttf +0 -0
- package/fonts/Utilities/tui-utilities.woff +0 -0
- package/fonts/Utilities/tui-utilities.woff2 +0 -0
- package/molecules/Breadcrumb.js +5 -4
- package/molecules/Buttons/ButtonContent.js +5 -4
- package/molecules/Card.js +7 -6
- package/molecules/Forms/Checkbox.js +8 -7
- package/molecules/Forms/DateField.js +3 -2
- package/molecules/Forms/Filter.js +15 -14
- package/molecules/Forms/FormControl.js +9 -8
- package/molecules/Forms/NumberField.d.ts +2 -2
- package/molecules/Forms/TextField.js +11 -10
- package/molecules/Link.js +8 -7
- package/package.json +19 -17
- package/styles/globals.css +0 -323
package/CHANGELOG.md
CHANGED
@@ -1,5 +1,20 @@
|
|
1
1
|
# ClubMed React UI components changelog
|
2
2
|
|
3
|
+
# [1.0.0-alpha.37](https://scm.clubmed.com/clubmed/cm-trident-ui/compare/v1.0.0-alpha.36...v1.0.0-alpha.37) (2024-04-09)
|
4
|
+
|
5
|
+
|
6
|
+
### Bug Fixes
|
7
|
+
|
8
|
+
* **icons:** use context to trigger change when icons are loaded ([4774acc](https://scm.clubmed.com/clubmed/cm-trident-ui/-/commit/4774acc2b2da16bb85ad5ba88fec11e36f1f7a09))
|
9
|
+
|
10
|
+
# [1.0.0-alpha.36](https://scm.clubmed.com/clubmed/cm-trident-ui/compare/v1.0.0-alpha.35...v1.0.0-alpha.36) (2024-04-08)
|
11
|
+
|
12
|
+
|
13
|
+
### Bug Fixes
|
14
|
+
|
15
|
+
* fix storybook preview WIP, problem with icons ([0ffe9c1](https://scm.clubmed.com/clubmed/cm-trident-ui/-/commit/0ffe9c179e9d40e272e213039a184ee25d8a21a8))
|
16
|
+
* **icons:** fix undefined of .get when the getIcon is used during the icon loading state ([4069be1](https://scm.clubmed.com/clubmed/cm-trident-ui/-/commit/4069be13b2a4d737162ed5e3d458b798715018c3))
|
17
|
+
|
3
18
|
# [1.0.0-alpha.35](https://scm.clubmed.com/clubmed/cm-trident-ui/compare/v1.0.0-alpha.34...v1.0.0-alpha.35) (2024-04-03)
|
4
19
|
|
5
20
|
|
package/README.md
CHANGED
@@ -114,6 +114,8 @@ import App from './App';
|
|
114
114
|
import React from 'react';
|
115
115
|
import { createRoot } from 'react-dom/client';
|
116
116
|
import { TridentUIConfigProvider } from '@clubmed/trident-ui';
|
117
|
+
import { IconsProvider } from '@clubmed/trident-ui/atoms/icons/contexts/IconsContext.js';
|
118
|
+
import Actions from '@clubmed/trident-ui/atoms/icons/svg/Actions';
|
117
119
|
|
118
120
|
const baseName = (window as any).basename || '/';
|
119
121
|
|
@@ -124,7 +126,9 @@ createRoot(document.getElementById('root')!).render(
|
|
124
126
|
locale: 'fr-FR',
|
125
127
|
}}
|
126
128
|
>
|
127
|
-
<
|
129
|
+
<IconsProvider icons={[Actions]}>
|
130
|
+
<App />
|
131
|
+
</IconsProvider>
|
128
132
|
</TridentUIConfigProvider>
|
129
133
|
</React.StrictMode>,
|
130
134
|
);
|
@@ -164,31 +168,53 @@ By default, no icons provider is set. You have to import a subset icons in your
|
|
164
168
|
Svg mode:
|
165
169
|
|
166
170
|
```tsx
|
167
|
-
import '@clubmed/trident-ui/atoms/Icons/svg/Actions'; // load only the Actions subset using SVG mode
|
171
|
+
import Actions from '@clubmed/trident-ui/atoms/Icons/svg/Actions'; // load only the Actions subset using SVG mode
|
172
|
+
import { Icon } from '@clubmed/trident-ui/atoms/Icons/Icon';
|
173
|
+
|
174
|
+
function App() {
|
175
|
+
return (
|
176
|
+
<IconsProvider icons={[Actions]}>
|
177
|
+
<Icon name="ArrowDefaultLeft" />
|
178
|
+
</IconsProvider>
|
179
|
+
);
|
180
|
+
}
|
168
181
|
```
|
169
182
|
|
170
183
|
Fonts mode:
|
171
184
|
|
172
185
|
```tsx
|
173
|
-
import '@clubmed/trident-ui/atoms/Icons/fonts/Actions'; // load the Actions subset
|
186
|
+
import Actions from '@clubmed/trident-ui/atoms/Icons/fonts/Actions'; // load the Actions subset
|
174
187
|
import '@clubmed/trident-ui/fonts/tui-actions.css'; // load css rules for Actions
|
188
|
+
import { Icon } from '@clubmed/trident-ui/atoms/Icons/Icon';
|
189
|
+
|
190
|
+
function App() {
|
191
|
+
return (
|
192
|
+
<IconsProvider icons={[Actions]}>
|
193
|
+
<Icon name="ArrowDefaultLeft" />
|
194
|
+
</IconsProvider>
|
195
|
+
);
|
196
|
+
}
|
175
197
|
```
|
176
198
|
|
177
199
|
You can mix usage of SVG and fonts mode:
|
178
200
|
|
179
201
|
```tsx
|
180
|
-
import '@clubmed/trident-ui/atoms/Icons/fonts/Actions'; // load the Actions subset
|
202
|
+
import Actions from '@clubmed/trident-ui/atoms/Icons/fonts/Actions'; // load the Actions subset
|
181
203
|
import '@clubmed/trident-ui/fonts/tui-actions.css'; // load css rules for Actions
|
182
|
-
import '@clubmed/trident-ui/Icons/svg/Brand';
|
183
|
-
```
|
204
|
+
import Brand from '@clubmed/trident-ui/Icons/svg/Brand';
|
184
205
|
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
<Icon name="ArrowDefaultLeft" />
|
189
|
-
<Icon name="ClubMed" />
|
206
|
+
function App() {
|
207
|
+
return (
|
208
|
+
<IconsProvider icons={[Actions, Brand]}>
|
209
|
+
<Icon name="ArrowDefaultLeft" />
|
210
|
+
<Icon name="ClubMed" />
|
211
|
+
</IconsProvider>
|
212
|
+
);
|
213
|
+
}
|
190
214
|
```
|
191
215
|
|
216
|
+
> In this case, Icon component will automatically use the appropriate IconResolver to load and display the icon.
|
217
|
+
|
192
218
|
### Extra configuration for Svg use
|
193
219
|
|
194
220
|
If you are using the `SvgUseIconProvider`, you have to instrument your bundler tool to resolve the url of the icons:
|
@@ -214,24 +240,26 @@ Trident UI provide function to register any external Svg icons (or font) without
|
|
214
240
|
a custom Icon component. Just use `registerSvgIcon` or `registerFontIcon` to add your new icon:
|
215
241
|
|
216
242
|
```tsx
|
217
|
-
import {
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
|
222
|
-
|
223
|
-
|
224
|
-
|
225
|
-
|
226
|
-
|
243
|
+
import { resolver } from '@/atoms/Icons/svg/SvgIconResolver';
|
244
|
+
|
245
|
+
const CustomIcons = resolver([
|
246
|
+
{
|
247
|
+
name: 'MyCustomIcon',
|
248
|
+
group: 'custom',
|
249
|
+
element: lazy(() => import('./MyCustomIcon.svg?react')),
|
250
|
+
// viewBox: '0 0 30 30', // default '0 0 30 30'
|
251
|
+
// aspectRatio: 1, // default '1'
|
252
|
+
// orientation: 'left' // apply rotation to the icon
|
253
|
+
},
|
254
|
+
]);
|
227
255
|
|
228
|
-
|
229
|
-
|
230
|
-
|
231
|
-
|
232
|
-
|
233
|
-
|
234
|
-
}
|
256
|
+
function App() {
|
257
|
+
return (
|
258
|
+
<IconsProvider icons={[CustomIcons]}>
|
259
|
+
<Icon name="MyCustomIcon" />
|
260
|
+
</IconsProvider>
|
261
|
+
);
|
262
|
+
}
|
235
263
|
```
|
236
264
|
|
237
265
|
### Generate fonts from icons (dev)
|
package/atoms/Icons/Icon.js
CHANGED
@@ -1,12 +1,13 @@
|
|
1
|
-
import { jsx as
|
2
|
-
import {
|
3
|
-
|
4
|
-
|
1
|
+
import { jsx as s } from "react/jsx-runtime";
|
2
|
+
import { c as t } from "../../index-Cu0xwYjD.js";
|
3
|
+
import { useIcon as e } from "./hooks/useIcon.js";
|
4
|
+
function l(n) {
|
5
|
+
const o = e(n.name, n.type);
|
5
6
|
if (o === void 0)
|
6
7
|
return null;
|
7
|
-
const { component:
|
8
|
-
return /* @__PURE__ */
|
8
|
+
const { component: m, ...c } = o;
|
9
|
+
return /* @__PURE__ */ s(m, { ...n, ...c, className: t(c.className, n.className) });
|
9
10
|
}
|
10
11
|
export {
|
11
|
-
|
12
|
+
l as Icon
|
12
13
|
};
|
@@ -1,47 +1,8 @@
|
|
1
|
-
import {
|
2
|
-
|
3
|
-
import { IconOrientationProps } from './hooks/useIconOrientation.js';
|
4
|
-
export interface IconProps extends IconOrientationProps {
|
5
|
-
name: string;
|
6
|
-
type?: string;
|
7
|
-
/**
|
8
|
-
* Width of the icon
|
9
|
-
*/
|
10
|
-
width?: string | null;
|
11
|
-
/**
|
12
|
-
* Color
|
13
|
-
*/
|
14
|
-
color?: string;
|
15
|
-
/**
|
16
|
-
* Additional class names
|
17
|
-
*/
|
18
|
-
className?: string;
|
19
|
-
/**
|
20
|
-
* Additional styles
|
21
|
-
*/
|
22
|
-
style?: {
|
23
|
-
[key: string]: string | number | SpringValue<string> | SpringValue<number> | Interpolation<string, string> | CSS.Properties;
|
24
|
-
};
|
25
|
-
}
|
26
|
-
export type IconResolverProps<Props extends IconProps = IconProps> = Props & {
|
27
|
-
name: string;
|
28
|
-
group?: string;
|
29
|
-
withOrientation?: boolean;
|
30
|
-
component: FunctionComponent<Props>;
|
31
|
-
};
|
32
|
-
export type IconsRegistryValue<Props extends IconProps = IconProps> = IconResolverProps<Props> & {
|
33
|
-
key: string;
|
34
|
-
};
|
35
|
-
/**
|
36
|
-
* Register an icon in the registry
|
37
|
-
*/
|
38
|
-
export declare function registerIcon<Props extends IconProps = IconProps>(props: IconResolverProps<Props>): void;
|
1
|
+
import { IconProps, IconResolverProps } from './contexts/IconsContext.js';
|
2
|
+
export * from './contexts/IconsContext.js';
|
39
3
|
/**
|
40
4
|
* create function to register multiple icons at once.
|
41
5
|
* It generates also the orientation for each icon if withOrientation is true
|
42
|
-
* @param
|
6
|
+
* @param resolver
|
43
7
|
*/
|
44
|
-
export declare function
|
45
|
-
export declare function getIcon<Props extends IconProps = IconProps>(key: string, type?: string): IconsRegistryValue<Props>;
|
46
|
-
export declare function getIcons(type: string): IconsRegistryValue<IconProps>[];
|
47
|
-
export declare function getIconsByType(type: string): Map<string, IconsRegistryValue>;
|
8
|
+
export declare function resolverIconsFactory<Props extends IconProps = IconProps>(resolver: (props: Omit<IconResolverProps<Props>, 'component'>) => IconResolverProps<Props>): (group: string, icons: Omit<IconResolverProps<Props>, 'component'>[]) => IconResolverProps<Props>[];
|
@@ -1,40 +1,19 @@
|
|
1
1
|
import { ORIENTATIONS as a } from "./hooks/useIconOrientation.js";
|
2
|
-
|
3
|
-
function I(
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
}
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
...s,
|
13
|
-
name: n,
|
14
|
-
orientation: u
|
15
|
-
}))).forEach((n) => t({
|
16
|
-
...n,
|
17
|
-
group: e
|
18
|
-
}));
|
19
|
-
};
|
20
|
-
}
|
21
|
-
function m(t, e = "default") {
|
22
|
-
return e === "default" && (e = o.keys().next().value), c(e).get(t);
|
23
|
-
}
|
24
|
-
function p(t) {
|
25
|
-
const e = c(t);
|
26
|
-
return e ? [...e.values()] : [];
|
27
|
-
}
|
28
|
-
function c(t) {
|
29
|
-
return o.get(t);
|
30
|
-
}
|
31
|
-
function f(t) {
|
32
|
-
return t ? t.charAt(0).toUpperCase() + t.slice(1) : "";
|
2
|
+
import { IconTypesRegistry as f, IconsContext as y, IconsProvider as l, loadIcons as x } from "./contexts/IconsContext.js";
|
3
|
+
function I(r) {
|
4
|
+
return (t, n) => n.flatMap(({ name: o, withOrientation: e, ...s }) => (e ? Object.keys(a) : [""]).map((c) => ({
|
5
|
+
...s,
|
6
|
+
name: o,
|
7
|
+
orientation: c
|
8
|
+
}))).map((o) => r({
|
9
|
+
...o,
|
10
|
+
group: t
|
11
|
+
}));
|
33
12
|
}
|
34
13
|
export {
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
14
|
+
f as IconTypesRegistry,
|
15
|
+
y as IconsContext,
|
16
|
+
l as IconsProvider,
|
17
|
+
x as loadIcons,
|
18
|
+
I as resolverIconsFactory
|
40
19
|
};
|
@@ -0,0 +1,43 @@
|
|
1
|
+
import { FunctionComponent, PropsWithChildren } from 'react';
|
2
|
+
import { IconOrientationProps } from '../hooks/useIconOrientation.js';
|
3
|
+
import type { CSS, Interpolation, SpringValue } from '@react-spring/web';
|
4
|
+
export interface IconProps extends IconOrientationProps {
|
5
|
+
name: string;
|
6
|
+
type?: string;
|
7
|
+
/**
|
8
|
+
* Width of the icon
|
9
|
+
*/
|
10
|
+
width?: string | null;
|
11
|
+
/**
|
12
|
+
* Color
|
13
|
+
*/
|
14
|
+
color?: string;
|
15
|
+
/**
|
16
|
+
* Additional class names
|
17
|
+
*/
|
18
|
+
className?: string;
|
19
|
+
/**
|
20
|
+
* Additional styles
|
21
|
+
*/
|
22
|
+
style?: {
|
23
|
+
[key: string]: string | number | SpringValue<string> | SpringValue<number> | Interpolation<string, string> | CSS.Properties;
|
24
|
+
};
|
25
|
+
}
|
26
|
+
export type IconsRegistryValue<Props extends IconProps = IconProps> = IconResolverProps<Props> & {
|
27
|
+
key: string;
|
28
|
+
};
|
29
|
+
export type IconResolverProps<Props extends IconProps = IconProps> = Props & {
|
30
|
+
name: string;
|
31
|
+
group?: string;
|
32
|
+
withOrientation?: boolean;
|
33
|
+
component: FunctionComponent<Props>;
|
34
|
+
};
|
35
|
+
export declare const IconTypesRegistry: Map<string, Map<string, IconsRegistryValue<IconProps>>>;
|
36
|
+
export declare function loadIcons<Props extends IconProps = IconProps>(icons: IconResolverProps<Props>[] | IconResolverProps<Props>[][]): Map<string, Map<string, IconsRegistryValue<IconProps>>>;
|
37
|
+
export declare const IconsContext: import("react").Context<{
|
38
|
+
container: Map<string, Map<string, IconsRegistryValue>>;
|
39
|
+
updateContainer: (_: IconResolverProps[] | IconResolverProps[][]) => void;
|
40
|
+
}>;
|
41
|
+
export declare function IconsProvider<Props extends IconProps = IconProps>({ icons, children, }: PropsWithChildren<{
|
42
|
+
icons: IconResolverProps<Props>[] | IconResolverProps<Props>[][];
|
43
|
+
}>): import("react/jsx-runtime").JSX.Element;
|
@@ -0,0 +1,46 @@
|
|
1
|
+
import { jsx as i } from "react/jsx-runtime";
|
2
|
+
import { createContext as s, useState as u } from "react";
|
3
|
+
const r = /* @__PURE__ */ new Map();
|
4
|
+
function f(t) {
|
5
|
+
return t ? t.charAt(0).toUpperCase() + t.slice(1) : "";
|
6
|
+
}
|
7
|
+
function d(t) {
|
8
|
+
const e = t.type || "default", n = r.get(e) || /* @__PURE__ */ new Map();
|
9
|
+
r.set(e, n);
|
10
|
+
const o = t.name + f(t.orientation);
|
11
|
+
n.set(o, { ...t, type: e, key: o });
|
12
|
+
}
|
13
|
+
function c(t) {
|
14
|
+
return t.flat().forEach((e) => {
|
15
|
+
d(e);
|
16
|
+
}), r;
|
17
|
+
}
|
18
|
+
const p = s({
|
19
|
+
container: r,
|
20
|
+
updateContainer: () => {
|
21
|
+
}
|
22
|
+
});
|
23
|
+
function l({
|
24
|
+
icons: t,
|
25
|
+
children: e
|
26
|
+
}) {
|
27
|
+
const [n, o] = u(() => c(t));
|
28
|
+
return /* @__PURE__ */ i(
|
29
|
+
p.Provider,
|
30
|
+
{
|
31
|
+
value: {
|
32
|
+
container: n,
|
33
|
+
updateContainer: (a) => {
|
34
|
+
o(c(a));
|
35
|
+
}
|
36
|
+
},
|
37
|
+
children: e
|
38
|
+
}
|
39
|
+
);
|
40
|
+
}
|
41
|
+
export {
|
42
|
+
r as IconTypesRegistry,
|
43
|
+
p as IconsContext,
|
44
|
+
l as IconsProvider,
|
45
|
+
c as loadIcons
|
46
|
+
};
|
@@ -1 +1,2 @@
|
|
1
|
-
|
1
|
+
declare const _default: import("..").IconResolverProps<import("./FontIcon").FontIconProps>[];
|
2
|
+
export default _default;
|
@@ -1,106 +1,112 @@
|
|
1
|
-
import {
|
2
|
-
e(
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
1
|
+
import { resolver as e } from "./FontIconResolver.js";
|
2
|
+
const n = e(
|
3
|
+
"actions",
|
4
|
+
[
|
5
|
+
{
|
6
|
+
name: "ArrowDefault",
|
7
|
+
withOrientation: !0
|
8
|
+
},
|
9
|
+
{
|
10
|
+
name: "ArrowFilled",
|
11
|
+
withOrientation: !0
|
12
|
+
},
|
13
|
+
{
|
14
|
+
name: "ArrowOutlined",
|
15
|
+
withOrientation: !0
|
16
|
+
},
|
17
|
+
{
|
18
|
+
name: "ArrowTail",
|
19
|
+
withOrientation: !0
|
20
|
+
},
|
21
|
+
{
|
22
|
+
name: "CheckDefault"
|
23
|
+
},
|
24
|
+
{
|
25
|
+
name: "CheckFilled"
|
26
|
+
},
|
27
|
+
{
|
28
|
+
name: "CheckOutlined"
|
29
|
+
},
|
30
|
+
{
|
31
|
+
name: "Clipboard"
|
32
|
+
},
|
33
|
+
{
|
34
|
+
name: "Compare"
|
35
|
+
},
|
36
|
+
{
|
37
|
+
name: "CrossDefault"
|
38
|
+
},
|
39
|
+
{
|
40
|
+
name: "CrossFilled"
|
41
|
+
},
|
42
|
+
{
|
43
|
+
name: "CrossOutlined"
|
44
|
+
},
|
45
|
+
{
|
46
|
+
name: "Delete"
|
47
|
+
},
|
48
|
+
{
|
49
|
+
name: "Download"
|
50
|
+
},
|
51
|
+
{
|
52
|
+
name: "Edit"
|
53
|
+
},
|
54
|
+
{
|
55
|
+
name: "Error"
|
56
|
+
},
|
57
|
+
{
|
58
|
+
name: "Expand"
|
59
|
+
},
|
60
|
+
{
|
61
|
+
name: "HeartFilled"
|
62
|
+
},
|
63
|
+
{
|
64
|
+
name: "HeartOutlined"
|
65
|
+
},
|
66
|
+
{
|
67
|
+
name: "Information"
|
68
|
+
},
|
69
|
+
{
|
70
|
+
name: "MinusDefault"
|
71
|
+
},
|
72
|
+
{
|
73
|
+
name: "MinusFilled"
|
74
|
+
},
|
75
|
+
{
|
76
|
+
name: "MinusOutlined"
|
77
|
+
},
|
78
|
+
{
|
79
|
+
name: "New"
|
80
|
+
},
|
81
|
+
{
|
82
|
+
name: "PlusDefault"
|
83
|
+
},
|
84
|
+
{
|
85
|
+
name: "PlusFilled"
|
86
|
+
},
|
87
|
+
{
|
88
|
+
name: "PlusOutlined"
|
89
|
+
},
|
90
|
+
{
|
91
|
+
name: "Reduce"
|
92
|
+
},
|
93
|
+
{
|
94
|
+
name: "Reload"
|
95
|
+
},
|
96
|
+
{
|
97
|
+
name: "Search"
|
98
|
+
},
|
99
|
+
{
|
100
|
+
name: "Share"
|
101
|
+
},
|
102
|
+
{
|
103
|
+
name: "StarFilled"
|
104
|
+
},
|
105
|
+
{
|
106
|
+
name: "StarOutlined"
|
107
|
+
}
|
108
|
+
]
|
109
|
+
);
|
110
|
+
export {
|
111
|
+
n as default
|
112
|
+
};
|
@@ -1 +1,2 @@
|
|
1
|
-
|
1
|
+
declare const _default: import("..").IconResolverProps<import("./FontIcon").FontIconProps>[];
|
2
|
+
export default _default;
|