@cypress-design/react-statusicon 0.4.15 → 0.4.17

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.
@@ -8,5 +8,5 @@ $ rollup -c ./rollup.config.mjs
8
8
  index.ts
9
9
 
10
10
  Consumers of your bundle will have to use chunk.default to access their default export, which may not be what you want. Use `output.exports: "named"` to disable this warning.
11
- created ./dist/index.umd.js, ./dist/index.es.mjs in 14.4s
11
+ created ./dist/index.umd.js, ./dist/index.es.mjs in 14.5s
12
12
  $ tsc --project ./tsconfig.build.json
package/CHANGELOG.md CHANGED
@@ -1,5 +1,19 @@
1
1
  # @cypress-design/react-statusicon
2
2
 
3
+ ## 0.4.17
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies [[`7f9ebbb`](https://github.com/cypress-io/cypress-design/commit/7f9ebbb83744d4109498f921f7de5539ccc3b479), [`2f984a0`](https://github.com/cypress-io/cypress-design/commit/2f984a02807f344a878ac65ac9fab62bc0c9442d)]:
8
+ - @cypress-design/react-icon@0.32.0
9
+
10
+ ## 0.4.16
11
+
12
+ ### Patch Changes
13
+
14
+ - Updated dependencies [[`04bd296`](https://github.com/cypress-io/cypress-design/commit/04bd296f515ad300450deb2f838dc3ac6bae26f7)]:
15
+ - @cypress-design/react-icon@0.31.0
16
+
3
17
  ## 0.4.15
4
18
 
5
19
  ### Patch Changes
package/ReadMe.md CHANGED
@@ -20,15 +20,17 @@ import StatusIcon from '@cypress-design/react-statusicon'
20
20
 
21
21
  The simple way of using the StatusIcon component
22
22
 
23
- ```tsx
23
+ ```tsx live
24
24
  import StatusIcon from '@cypress-design/react-statusicon'
25
25
 
26
- export default () => <StatusIcon size="16" status="failed" variant="solid" />
26
+ export default () => {
27
+ return <StatusIcon size="16" status="failed" variant="solid" />
28
+ }
27
29
  ```
28
30
 
29
31
  The tree-shakable way (more optimized)
30
32
 
31
- ```tsx
33
+ ```tsx live
32
34
  import { SolidStatusIcon } from '@cypress-design/react-statusicon'
33
35
 
34
36
  export default () => <SolidStatusIcon size="16" status="failed" />
@@ -5,7 +5,7 @@ import { statuses } from '../constants'
5
5
 
6
6
  const sizes = ['4', '8', '12', '16', '24']
7
7
 
8
- export default () => (
8
+ export const Story = () => (
9
9
  <table className="w-full">
10
10
  <thead>
11
11
  <tr key="h0">
@@ -30,54 +30,46 @@ export default () => (
30
30
  </tr>
31
31
  </thead>
32
32
  <tbody>
33
- {Object.entries(statuses).map(([status, statusInfo]) => {
34
- return (
35
- <>
36
- {statusInfo.variants.map((variant, i) => {
37
- return (
38
- <tr
39
- className={clsx(i === 0 && 'border-t')}
40
- key={`${status}-${variant}`}
41
- >
42
- {i === 0 ? (
43
- <td>
44
- {statusInfo.link ? (
45
- <a
46
- href={statusInfo.link}
47
- className="text-indigo-500 underline"
48
- target="_blank"
49
- >
50
- {status}
51
- </a>
52
- ) : (
53
- status
54
- )}
55
- </td>
56
- ) : (
57
- <td />
58
- )}
33
+ {Object.entries(statuses).map(([status, statusInfo]) =>
34
+ statusInfo.variants.map((variant, i) => (
35
+ <tr
36
+ className={clsx(i === 0 && 'border-t')}
37
+ key={`${status}-${variant}`}
38
+ >
39
+ {i === 0 ? (
40
+ <td>
41
+ {statusInfo.link ? (
42
+ <a
43
+ href={statusInfo.link}
44
+ className="text-indigo-500 underline"
45
+ target="_blank"
46
+ >
47
+ {status}
48
+ </a>
49
+ ) : (
50
+ status
51
+ )}
52
+ </td>
53
+ ) : (
54
+ <td />
55
+ )}
59
56
 
60
- <td>{variant}</td>
61
- {sizes.map((size) => {
62
- return (
63
- <td key={`${status}-${size}-${variant}`} className="py-2">
64
- <StatusIcon
65
- status={status as any}
66
- size={size as any}
67
- variant={variant}
68
- />
69
- </td>
70
- )
71
- })}
72
- <td className="py-2 align-top">
73
- {i === 0 ? statusInfo.use : ''}
74
- </td>
75
- </tr>
57
+ <td>{variant}</td>
58
+ {sizes.map((size) => {
59
+ return (
60
+ <td key={`${status}-${size}-${variant}`} className="py-2">
61
+ <StatusIcon
62
+ status={status as any}
63
+ size={size as any}
64
+ variant={variant}
65
+ />
66
+ </td>
76
67
  )
77
68
  })}
78
- </>
79
- )
80
- })}
69
+ <td className="py-2 align-top">{i === 0 ? statusInfo.use : ''}</td>
70
+ </tr>
71
+ )),
72
+ )}
81
73
  </tbody>
82
74
  </table>
83
75
  )
@@ -3,15 +3,25 @@
3
3
  import * as React from 'react'
4
4
  import { mount } from 'cypress/react18'
5
5
  import StatusIcon from './StatusIcon'
6
- import StatusIconStory from './StatusIcon.rootstory'
6
+ import { Story as StatusIconStory } from './StatusIcon.rootstory'
7
7
 
8
8
  describe('StatusIcon', () => {
9
9
  it('defaults to a variant that exists if the one provided does not exist', () => {
10
10
  mount(
11
11
  <div>
12
- <StatusIcon variant="simple" size="16" status="placeholder" />
13
- <StatusIcon variant="solid" size="16" status="placeholder" />
14
- </div>
12
+ <StatusIcon
13
+ key="simple"
14
+ variant="simple"
15
+ size="16"
16
+ status="placeholder"
17
+ />
18
+ <StatusIcon
19
+ key="solid"
20
+ variant="solid"
21
+ size="16"
22
+ status="placeholder"
23
+ />
24
+ </div>,
15
25
  )
16
26
 
17
27
  cy.get('svg').first().invoke('html').as('firstIcon')
@@ -24,9 +34,14 @@ describe('StatusIcon', () => {
24
34
  it('displays a placeholder icon if no status is passed', () => {
25
35
  mount(
26
36
  <div>
27
- <StatusIcon variant="simple" size="16" />
28
- <StatusIcon variant="solid" size="16" status="placeholder" />
29
- </div>
37
+ <StatusIcon key="simple" variant="simple" size="16" />
38
+ <StatusIcon
39
+ key="solid"
40
+ variant="solid"
41
+ size="16"
42
+ status="placeholder"
43
+ />
44
+ </div>,
30
45
  )
31
46
 
32
47
  cy.get('svg').first().invoke('html').as('firstIcon')
@@ -39,9 +54,14 @@ describe('StatusIcon', () => {
39
54
  it('displays a placeholder icon if null status is passed', () => {
40
55
  mount(
41
56
  <div>
42
- <StatusIcon variant="simple" size="16" status={null} />
43
- <StatusIcon variant="simple" size="16" status="placeholder" />
44
- </div>
57
+ <StatusIcon key="simple-1" variant="simple" size="16" status={null} />
58
+ <StatusIcon
59
+ key="simple-2"
60
+ variant="simple"
61
+ size="16"
62
+ status="placeholder"
63
+ />
64
+ </div>,
45
65
  )
46
66
 
47
67
  cy.get('svg').first().invoke('html').as('firstIcon')
package/dist/index.es.mjs CHANGED
@@ -482,7 +482,7 @@ typeof SuppressedError === "function" ? SuppressedError : function (error, suppr
482
482
  };
483
483
 
484
484
  var compileReactIconProperties = function (_a) {
485
- var body = _a.body, defs = _a.defs, compiledClasses = _a.compiledClasses, size = _a.size, name = _a.name, attributes = __rest(_a, ["body", "defs", "compiledClasses", "size", "name"]);
485
+ var body = _a.body, defs = _a.defs, compiledClasses = _a.compiledClasses, size = _a.size, name = _a.name, alt = _a.alt, attributes = __rest(_a, ["body", "defs", "compiledClasses", "size", "name", "alt"]);
486
486
  var filteredAttributes = Object.keys(attributes).reduce(function (newAttributes, attrName) {
487
487
  if (!ICON_COLOR_PROP_NAMES.includes(attrName) &&
488
488
  attrName !== 'name') {
@@ -509,7 +509,11 @@ var compileReactIconProperties = function (_a) {
509
509
  }
510
510
  }, [defs, name, size]);
511
511
  var componentProps = __assign({ width: size, height: size, viewBox: "0 0 ".concat(size, " ").concat(size), fill: 'none', dangerouslySetInnerHTML: {
512
- __html: body,
512
+ __html: alt
513
+ ? "<title>".concat(alt.replace(/[><]/g, function (s) {
514
+ return s === '>' ? '&gt;' : '&lt;';
515
+ }), "</title>").concat(body)
516
+ : body,
513
517
  }, className: undefined }, filteredAttributes);
514
518
  if (attributes.className) {
515
519
  compiledClasses.push(attributes.className);
@@ -521,7 +525,7 @@ var compileReactIconProperties = function (_a) {
521
525
  };
522
526
 
523
527
 
524
- /* <wind-keep class="filter icon-light-secondary icon-dark-secondary"> */
528
+ /* <wind-keep class="filter icon-light-secondary icon-dark-secondary h-1 h-2"> */
525
529
 
526
530
  var compileProps = function (_a) {
527
531
  var status = _a.status, statuses = _a.statuses, className = _a.className, size = _a.size, variantName = _a.variantName;