agroptima-design-system 1.2.29 → 1.2.30

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "agroptima-design-system",
3
- "version": "1.2.29",
3
+ "version": "1.2.30",
4
4
  "scripts": {
5
5
  "dev": "npm run storybook",
6
6
  "storybook": "storybook dev -p 6006 --ci",
@@ -13,8 +13,7 @@ type HtmlButtonProps = ButtonHTMLAttributes<HTMLButtonElement>
13
13
  type AnchorProps = AnchorHTMLAttributes<HTMLAnchorElement> & LinkProps
14
14
 
15
15
  export type BaseButtonProps =
16
- | (HtmlButtonProps & CommonProps)
17
- | (AnchorProps & CommonProps)
16
+ (HtmlButtonProps & CommonProps) | (AnchorProps & CommonProps)
18
17
 
19
18
  const hasHref = (
20
19
  props: HtmlButtonProps | AnchorProps,
@@ -1,6 +1,6 @@
1
1
  import './Icon.scss'
2
2
  import type { ReactNode } from 'react'
3
- import * as icons from '../icons'
3
+ import { icons } from '../icons'
4
4
  import { classNames } from '../utils/classNames'
5
5
  export type IconType = keyof typeof icons
6
6
 
@@ -33,10 +33,12 @@ export const Icon: React.FC<IconProps> = ({
33
33
  rotate: name === 'Loading',
34
34
  })
35
35
 
36
+ const IconComponent = icons[name]
37
+
36
38
  if (decorative) {
37
39
  return (
38
40
  <span aria-hidden="true" className={cssClasses}>
39
- {icons[name](props) as ReactNode}
41
+ {IconComponent ? ((<IconComponent {...props} />) as ReactNode) : null}
40
42
  </span>
41
43
  )
42
44
  }
@@ -48,7 +50,7 @@ export const Icon: React.FC<IconProps> = ({
48
50
  title={accessibilityLabel || name}
49
51
  className={cssClasses}
50
52
  >
51
- {icons[name](props) as ReactNode}
53
+ {IconComponent ? ((<IconComponent {...props} />) as ReactNode) : null}
52
54
  </span>
53
55
  )
54
56
  }
@@ -13,12 +13,7 @@ import {
13
13
  } from '.'
14
14
 
15
15
  export type Variant =
16
- | 'info'
17
- | 'success'
18
- | 'warning'
19
- | 'error'
20
- | 'discard'
21
- | 'details'
16
+ 'info' | 'success' | 'warning' | 'error' | 'discard' | 'details'
22
17
 
23
18
  export interface ModalProps {
24
19
  id: string
@@ -73,7 +73,7 @@ import UserMenu from './user-menu.svg'
73
73
  import ValidateInvoice from './validate-invoice.svg'
74
74
  import Warning from './warning.svg'
75
75
 
76
- export {
76
+ export const icons = {
77
77
  Add,
78
78
  AddCircle,
79
79
  AngleDown,
@@ -148,4 +148,4 @@ export {
148
148
  UserMenu,
149
149
  ValidateInvoice,
150
150
  Warning,
151
- }
151
+ } as const
@@ -4,6 +4,10 @@ import { Meta } from "@storybook/addon-docs/blocks";
4
4
 
5
5
  # Changelog
6
6
 
7
+ ## 1.2.30
8
+
9
+ * Fix Webpack icons exports bug
10
+
7
11
  ## 1.2.29
8
12
 
9
13
  * Fix Collapsible styles not updating when closing a default-open collapsible
@@ -1,5 +1,5 @@
1
1
  import { Meta, Title, IconGallery, IconItem } from '@storybook/addon-docs/blocks'
2
- import * as Icons from '../icons'
2
+ import { icons } from '../icons'
3
3
 
4
4
  <Meta title="Design System/Styles/Icons" tags={['Styles', 'Documentation','!Components']} />
5
5
 
@@ -11,7 +11,7 @@ import * as Icons from '../icons'
11
11
 
12
12
  <IconGallery>
13
13
  {
14
- Object.values(Icons).map((Icon) => {
14
+ Object.values(icons).map((Icon) => {
15
15
  return(
16
16
  <IconItem name={Icon['name'].substring(3)}>
17
17
  <Icon />