@woosmap/ui 2.48.0 → 2.49.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@woosmap/ui",
3
- "version": "2.48.0",
3
+ "version": "2.49.0",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/WebGeoServices/ui.git"
@@ -25,12 +25,14 @@ export default class Button extends Component {
25
25
  active,
26
26
  children,
27
27
  testId,
28
+ iconRight,
28
29
  ...rest
29
30
  } = this.props;
30
31
  const classes = cl(
31
32
  'btn',
32
33
  { 'btn--has-icon': icon || isLoading },
33
34
  { 'btn--icon': isBtnIcon || (icon && !label) },
35
+ { 'btn--icon-right': iconRight },
34
36
  size ? `btn--${size}` : null,
35
37
  type ? `btn--${type}` : null,
36
38
  { active },
@@ -54,8 +56,9 @@ export default class Button extends Component {
54
56
  className={classes}
55
57
  data-testid={testId}
56
58
  >
57
- {iconComponent}
59
+ {!iconRight ? iconComponent : null}
58
60
  {label && <span className="btn__label">{isLoading ? tr('Loading...') : label}</span>}
61
+ {iconRight ? iconComponent : null}
59
62
  {children}
60
63
  </button>
61
64
  );
@@ -76,6 +79,7 @@ Button.defaultProps = {
76
79
  isLoading: false,
77
80
  active: false,
78
81
  onClick: null,
82
+ iconRight: false,
79
83
  };
80
84
 
81
85
  Button.propTypes = {
@@ -104,10 +108,11 @@ Button.propTypes = {
104
108
  ]),
105
109
  isLoading: PropTypes.bool,
106
110
  active: PropTypes.bool,
107
- label: PropTypes.oneOfType(PropTypes.string, PropTypes.node),
111
+ label: PropTypes.oneOfType([PropTypes.string, PropTypes.node]),
108
112
  icon: PropTypes.string,
109
113
  iconSize: PropTypes.number,
110
114
  className: PropTypes.string,
111
115
  onClick: PropTypes.func,
112
116
  children: PropTypes.node,
117
+ iconRight: PropTypes.bool,
113
118
  };
@@ -23,7 +23,7 @@ const Template = (args) => {
23
23
  <div className="flex mbi">
24
24
  <Button icon="add" />
25
25
  <Button label={label} />
26
- <Button label={label} icon="marker" />
26
+ <Button label={label} icon="marker" iconRight />
27
27
  <Button label={label} isLoading />
28
28
  <Button label={label} disabled />
29
29
  </div>
@@ -82,7 +82,7 @@ const Template = (args) => {
82
82
  </span>
83
83
  <span>
84
84
  There is a labeled and iconed button link here : &nbsp;
85
- <Button label={label} icon="marker" type="link" />
85
+ <Button label={label} icon="marker" iconRight type="link" />
86
86
  </span>
87
87
  <span>
88
88
  There is a iconed button link here : &nbsp; <Button label={label} icon="clock" type="link" />
@@ -396,7 +396,7 @@ Dropdown.propTypes = {
396
396
  disabled: PropTypes.bool,
397
397
  disableCloseOutside: PropTypes.bool,
398
398
  openOnMouseEnter: PropTypes.bool,
399
- label: PropTypes.oneOfType(PropTypes.string, PropTypes.node),
399
+ label: PropTypes.oneOfType([PropTypes.string, PropTypes.node]),
400
400
  testId: PropTypes.string,
401
401
  children: PropTypes.node.isRequired,
402
402
  className: PropTypes.string,
@@ -16,6 +16,7 @@ import { ReactComponent as ArrowBotton } from '../../icons/arrow-bottom.svg';
16
16
  import { ReactComponent as ArrowLeft } from '../../icons/arrow-left.svg';
17
17
  import { ReactComponent as ArrowRight } from '../../icons/arrow-right.svg';
18
18
  import { ReactComponent as ArrowTop } from '../../icons/arrow-top.svg';
19
+ import { ReactComponent as ArrowLink } from '../../icons/arrow-link.svg';
19
20
  import { ReactComponent as Asset } from '../../icons/asset.svg';
20
21
  import { ReactComponent as AssetAddFile } from '../../icons/asset-add-file.svg';
21
22
  import { ReactComponent as AssetAdd } from '../../icons/asset-add.svg';
@@ -134,6 +135,7 @@ const Icons = {
134
135
  'arrow-left': ArrowLeft,
135
136
  'arrow-right': ArrowRight,
136
137
  'arrow-top': ArrowTop,
138
+ 'arrow-link': ArrowLink,
137
139
  asset: Asset,
138
140
  'asset-add-file': AssetAddFile,
139
141
  'asset-add': AssetAdd,
@@ -0,0 +1 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="m20.217 11.6-4.708-4.7a.56.56 0 1 0-.792.792l3.753 3.748H4.179a.56.56 0 1 0 0 1.12H18.47l-3.753 3.752a.56.56 0 0 0 .792.792l4.708-4.704a.559.559 0 0 0 0-.8Z"/></svg>
@@ -256,8 +256,12 @@
256
256
  padding 0
257
257
  text-decoration none
258
258
  &.btn--has-icon
259
- .icon
260
- margin-right .3rem
259
+ &:not(.btn--icon-right)
260
+ .icon
261
+ margin-right .3rem
262
+ &.btn--icon-right
263
+ .icon
264
+ margin-left .3rem
261
265
  &--link
262
266
  &--link-primary
263
267
  &--link-info
@@ -265,15 +269,28 @@
265
269
  trans()
266
270
  position relative
267
271
  top .7rem
268
- left -.3rem
269
- &.btn--small
272
+ &:not(.btn--icon-right)
270
273
  .icon
271
- top .5rem
272
274
  left -.3rem
273
- &.btn--large
275
+ &.btn--small
276
+ .icon
277
+ top .5rem
278
+ left -.3rem
279
+ &.btn--large
280
+ .icon
281
+ top 1.2rem
282
+ left -.3rem
283
+ &.btn--icon-right
274
284
  .icon
275
- top 1.2rem
276
- left -.3rem
285
+ right -.3rem
286
+ &.btn--small
287
+ .icon
288
+ top .5rem
289
+ rigth -.3rem
290
+ &.btn--large
291
+ .icon
292
+ top 1.2rem
293
+ rigth -.3rem
277
294
  &--link-flex
278
295
  &--link-flex-info
279
296
  display flex
@@ -340,8 +357,11 @@
340
357
  trans()
341
358
 
342
359
  &--has-icon
343
- &:not(.btn--icon):not(.btn--link):not(.btn--link-primary):not(.btn--link-info):not(.btn--link-flex):not(.btn--link-flex-info):not(.btn--loading):not(.btn--mini):not(.btn--small):not(.btn--large):not(.btn--dropdown-item):not(.btn--tab):not(.btn--sidebar-link)
360
+ &:not(.btn--icon):not(.btn--link):not(.btn--link-primary):not(.btn--link-info):not(.btn--link-flex):not(.btn--link-flex-info):not(.btn--loading):not(.btn--mini):not(.btn--small):not(.btn--large):not(.btn--dropdown-item):not(.btn--tab):not(.btn--sidebar-link):not(.btn--icon-right)
344
361
  padding 0 $padding 0 $padding - .6
362
+ &:not(.btn--icon):not(.btn--link):not(.btn--link-primary):not(.btn--link-info):not(.btn--link-flex):not(.btn--link-flex-info):not(.btn--loading):not(.btn--mini):not(.btn--small):not(.btn--large):not(.btn--dropdown-item):not(.btn--tab):not(.btn--sidebar-link)
363
+ &.btn--icon-right
364
+ padding 0 $padding - .6 0 $padding
345
365
  &--loading
346
366
  &:not(.btn--icon):not(.btn--mini):not(.btn--small):not(.btn--large):not(.btn--sidebar-link)
347
367
  padding-left $padding - .4