@popsure/dirty-swan 0.34.0 → 0.36.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.
Files changed (129) hide show
  1. package/dist/cjs/index.d.ts +1 -1
  2. package/dist/cjs/index.js +159 -114
  3. package/dist/cjs/index.js.map +1 -1
  4. package/dist/cjs/lib/components/badge/index.d.ts +10 -0
  5. package/dist/cjs/lib/components/badge/index.stories.d.ts +34 -0
  6. package/dist/cjs/lib/components/badge/index.test.d.ts +1 -0
  7. package/dist/cjs/lib/components/cards/cardWithLeftIcon/index.d.ts +6 -3
  8. package/dist/cjs/lib/components/cards/cardWithLeftIcon/index.stories.d.ts +13 -2
  9. package/dist/cjs/lib/components/chip/index.d.ts +2 -1
  10. package/dist/cjs/lib/components/informationBox/index.d.ts +12 -0
  11. package/dist/cjs/lib/components/informationBox/index.stories.d.ts +35 -0
  12. package/dist/cjs/lib/components/informationBox/index.test.d.ts +1 -0
  13. package/dist/cjs/lib/components/input/autoSuggestInput/index.d.ts +7 -7
  14. package/dist/cjs/lib/components/input/autoSuggestInput/index.stories.d.ts +84 -0
  15. package/dist/cjs/lib/components/input/autoSuggestMultiSelect/index.d.ts +7 -7
  16. package/dist/cjs/lib/components/input/autoSuggestMultiSelect/index.stories.d.ts +77 -0
  17. package/dist/cjs/lib/components/link/index.d.ts +2 -0
  18. package/dist/cjs/lib/components/link/index.stories.d.ts +26 -0
  19. package/dist/cjs/lib/index.d.ts +6 -3
  20. package/dist/esm/components/autocompleteAddress/index.test.js +1 -1
  21. package/dist/esm/components/badge/index.js +27 -0
  22. package/dist/esm/components/badge/index.js.map +1 -0
  23. package/dist/esm/components/badge/index.stories.js +39 -0
  24. package/dist/esm/components/badge/index.stories.js.map +1 -0
  25. package/dist/esm/components/badge/index.test.js +21 -0
  26. package/dist/esm/components/badge/index.test.js.map +1 -0
  27. package/dist/esm/components/cards/cardButton/index.js +2 -1
  28. package/dist/esm/components/cards/cardButton/index.js.map +1 -1
  29. package/dist/esm/components/cards/cardButton/index.stories.js +2 -1
  30. package/dist/esm/components/cards/cardButton/index.stories.js.map +1 -1
  31. package/dist/esm/components/cards/cardWithLeftIcon/index.js +2 -1
  32. package/dist/esm/components/cards/cardWithLeftIcon/index.js.map +1 -1
  33. package/dist/esm/components/cards/cardWithLeftIcon/index.stories.js +15 -3
  34. package/dist/esm/components/cards/cardWithLeftIcon/index.stories.js.map +1 -1
  35. package/dist/esm/components/cards/cardWithTopIcon/index.js +2 -1
  36. package/dist/esm/components/cards/cardWithTopIcon/index.js.map +1 -1
  37. package/dist/esm/components/cards/cardWithTopIcon/index.stories.js +2 -1
  38. package/dist/esm/components/cards/cardWithTopIcon/index.stories.js.map +1 -1
  39. package/dist/esm/components/cards/cardWithTopLeftIcon/index.js +2 -1
  40. package/dist/esm/components/cards/cardWithTopLeftIcon/index.js.map +1 -1
  41. package/dist/esm/components/cards/cardWithTopLeftIcon/index.stories.js +2 -1
  42. package/dist/esm/components/cards/cardWithTopLeftIcon/index.stories.js.map +1 -1
  43. package/dist/esm/components/cards/index.js +7 -5
  44. package/dist/esm/components/cards/index.js.map +1 -1
  45. package/dist/esm/components/cards/infoCard/index.js +2 -1
  46. package/dist/esm/components/cards/infoCard/index.js.map +1 -1
  47. package/dist/esm/components/cards/infoCard/index.stories.js +2 -1
  48. package/dist/esm/components/cards/infoCard/index.stories.js.map +1 -1
  49. package/dist/esm/components/chip/index.js +2 -2
  50. package/dist/esm/components/chip/index.js.map +1 -1
  51. package/dist/esm/components/comparisonTable/components/TableButton/index.test.js +2 -2
  52. package/dist/esm/components/comparisonTable/components/TableRowHeader/index.test.js +2 -2
  53. package/dist/esm/components/dateSelector/index.test.js +1 -1
  54. package/dist/esm/components/informationBox/index.js +19 -0
  55. package/dist/esm/components/informationBox/index.js.map +1 -0
  56. package/dist/esm/components/informationBox/index.stories.js +42 -0
  57. package/dist/esm/components/informationBox/index.stories.js.map +1 -0
  58. package/dist/esm/components/informationBox/index.test.js +49 -0
  59. package/dist/esm/components/informationBox/index.test.js.map +1 -0
  60. package/dist/esm/components/input/autoSuggestInput/index.js +3 -3
  61. package/dist/esm/components/input/autoSuggestInput/index.js.map +1 -1
  62. package/dist/esm/components/input/autoSuggestInput/index.stories.js +131 -0
  63. package/dist/esm/components/input/autoSuggestInput/index.stories.js.map +1 -0
  64. package/dist/esm/components/input/autoSuggestMultiSelect/index.js +17 -13
  65. package/dist/esm/components/input/autoSuggestMultiSelect/index.js.map +1 -1
  66. package/dist/esm/components/input/autoSuggestMultiSelect/index.stories.js +107 -0
  67. package/dist/esm/components/input/autoSuggestMultiSelect/index.stories.js.map +1 -0
  68. package/dist/esm/components/input/checkbox/index.test.js +1 -1
  69. package/dist/esm/components/input/currency/index.test.js +1 -1
  70. package/dist/esm/components/link/index.js +11 -0
  71. package/dist/esm/components/link/index.js.map +1 -0
  72. package/dist/esm/components/link/index.stories.js +33 -0
  73. package/dist/esm/components/link/index.stories.js.map +1 -0
  74. package/dist/esm/components/multiDropzone/index.test.js +2 -2
  75. package/dist/esm/components/segmentedControl/index.test.js +1 -1
  76. package/dist/esm/{customRender-4157fcff.js → customRender-20b5f7ec.js} +3 -3
  77. package/dist/esm/{customRender-4157fcff.js.map → customRender-20b5f7ec.js.map} +1 -1
  78. package/dist/esm/{extend-expect-46bdce4a.js → extend-expect-25e5049d.js} +2 -2
  79. package/dist/esm/{extend-expect-46bdce4a.js.map → extend-expect-25e5049d.js.map} +1 -1
  80. package/dist/esm/feather-logo-a3f07990.js +4 -0
  81. package/dist/esm/feather-logo-a3f07990.js.map +1 -0
  82. package/dist/esm/{index-47663d39.js → index-29ac387a.js} +3 -4
  83. package/dist/esm/index-29ac387a.js.map +1 -0
  84. package/dist/esm/index.d.ts +1 -1
  85. package/dist/esm/index.js +7 -3
  86. package/dist/esm/index.js.map +1 -1
  87. package/dist/esm/lib/components/badge/index.d.ts +10 -0
  88. package/dist/esm/lib/components/badge/index.stories.d.ts +34 -0
  89. package/dist/esm/lib/components/badge/index.test.d.ts +1 -0
  90. package/dist/esm/lib/components/cards/cardWithLeftIcon/index.d.ts +6 -3
  91. package/dist/esm/lib/components/cards/cardWithLeftIcon/index.stories.d.ts +13 -2
  92. package/dist/esm/lib/components/chip/index.d.ts +2 -1
  93. package/dist/esm/lib/components/informationBox/index.d.ts +12 -0
  94. package/dist/esm/lib/components/informationBox/index.stories.d.ts +35 -0
  95. package/dist/esm/lib/components/informationBox/index.test.d.ts +1 -0
  96. package/dist/esm/lib/components/input/autoSuggestInput/index.d.ts +7 -7
  97. package/dist/esm/lib/components/input/autoSuggestInput/index.stories.d.ts +84 -0
  98. package/dist/esm/lib/components/input/autoSuggestMultiSelect/index.d.ts +7 -7
  99. package/dist/esm/lib/components/input/autoSuggestMultiSelect/index.stories.d.ts +77 -0
  100. package/dist/esm/lib/components/link/index.d.ts +2 -0
  101. package/dist/esm/lib/components/link/index.stories.d.ts +26 -0
  102. package/dist/esm/lib/index.d.ts +6 -3
  103. package/dist/esm/util/testUtils/customRender.js +1 -1
  104. package/package.json +1 -1
  105. package/src/index.tsx +3 -0
  106. package/src/lib/components/badge/index.stories.tsx +45 -0
  107. package/src/lib/components/badge/index.test.tsx +11 -0
  108. package/src/lib/components/badge/index.tsx +54 -0
  109. package/src/lib/components/badge/style.module.scss +13 -0
  110. package/src/lib/components/cards/cardWithLeftIcon/index.stories.tsx +15 -0
  111. package/src/lib/components/cards/cardWithLeftIcon/index.tsx +19 -5
  112. package/src/lib/components/chip/index.tsx +3 -1
  113. package/src/lib/components/informationBox/index.stories.tsx +51 -0
  114. package/src/lib/components/informationBox/index.test.tsx +55 -0
  115. package/src/lib/components/informationBox/index.tsx +65 -0
  116. package/src/lib/components/informationBox/info.svg +11 -0
  117. package/src/lib/components/informationBox/style.module.scss +62 -0
  118. package/src/lib/components/input/autoSuggestInput/index.stories.tsx +162 -0
  119. package/src/lib/components/input/autoSuggestInput/index.tsx +15 -13
  120. package/src/lib/components/input/autoSuggestMultiSelect/index.stories.tsx +125 -0
  121. package/src/lib/components/input/autoSuggestMultiSelect/index.tsx +42 -29
  122. package/src/lib/components/input/autoSuggestMultiSelect/style.module.scss +6 -0
  123. package/src/lib/components/link/index.stories.tsx +29 -0
  124. package/src/lib/components/link/index.tsx +9 -0
  125. package/src/lib/index.tsx +8 -2
  126. package/dist/esm/index-47663d39.js.map +0 -1
  127. package/src/lib/components/input/autoSuggestInput/index.stories.mdx +0 -138
  128. package/src/lib/components/input/autoSuggestMultiSelect/index.stories.mdx +0 -115
  129. package/src/lib/scss/private/components/badge.stories.mdx +0 -43
@@ -0,0 +1,125 @@
1
+ import { useState } from 'react';
2
+ import { AutoSuggestMultiSelect, AutoSuggestMultiSelectProps } from '.';
3
+ import { Option } from '../../../models/autoSuggestInput';
4
+ import featherLogo from '../../cards/icons/feather-logo.svg';
5
+
6
+ const story = {
7
+ title: 'JSX/Inputs/AutoSuggestMultiSelect',
8
+ subtitle: 'sgsg',
9
+ component: AutoSuggestMultiSelect,
10
+ argTypes: {
11
+ options: {
12
+ description: 'List of all options available to search from',
13
+ defaultValue: [
14
+ { value: 'feather', leftIcon: featherLogo },
15
+ { value: 'feather2', leftIcon: featherLogo },
16
+ {
17
+ value: 'feather3',
18
+ leftIcon: featherLogo,
19
+ },
20
+ {
21
+ value: 'dirtyswan',
22
+ leftIcon: featherLogo,
23
+ },
24
+ {
25
+ value: 'test value',
26
+ leftIcon: featherLogo,
27
+ },
28
+ ],
29
+ table: {
30
+ type: {
31
+ summary: 'Option[]'
32
+ },
33
+ },
34
+ },
35
+ selectedValues: {
36
+ description: 'List of all selected values',
37
+ defaultValue: [
38
+ { value: 'feather', leftIcon: featherLogo },
39
+ { value: 'feather2', leftIcon: featherLogo },
40
+ ],
41
+ table: {
42
+ type: {
43
+ summary: 'Option[]'
44
+ },
45
+ },
46
+ },
47
+ placeholder: {
48
+ defaultValue: 'Placeholder',
49
+ description: 'Placeholder for DirtySwan Input component'
50
+ },
51
+ chipsListClassName: {
52
+ defaultValue: '',
53
+ description: 'Class name for the most parent element of the Chip component',
54
+ control: { type: 'text' }
55
+ },
56
+ multiSelectClassName: {
57
+ defaultValue: '',
58
+ description: 'Class name for the most parent element of the AutoSuggestInput component',
59
+ control: { type: 'text' }
60
+ },
61
+ wrapText: {
62
+ defaultValue: false,
63
+ description: 'Wether or not wrap the entries in the dropdown or hide overflown text',
64
+ },
65
+ setValues: {
66
+ description: 'Function that runs when selecting values',
67
+ action: true,
68
+ table: {
69
+ category: 'Callbacks',
70
+ },
71
+ },
72
+ },
73
+ parameters: {
74
+ componentSubtitle: 'AutoSuggestMultiSelect is a combination of the AutoSuggestInput and Chip components',
75
+ docs: {
76
+ description: {
77
+ component: `This component allows quick search via the input field to find an option for selection.
78
+ \nUpon selecting an option, the option is displayed above the input field as a chip.
79
+ \nThe chip can be removed by clicking on the X button. Multi options can be selected as well.
80
+ \nProp \`setValues\` function must be provided to keep track of removed and added option selections.`
81
+ },
82
+ },
83
+ customTypes: {
84
+ Option: `interface Option {
85
+ value: string; // value of option to be stored and displayed on UI
86
+ leftIcon?: string; // image of the provided option to be displayed on UI
87
+ }`
88
+ }
89
+ },
90
+ };
91
+
92
+ export const AutoSuggestMultiSelectStory = ({
93
+ options,
94
+ selectedValues,
95
+ setValues,
96
+ placeholder,
97
+ chipsListClassName,
98
+ multiSelectClassName,
99
+ wrapText,
100
+ }: AutoSuggestMultiSelectProps) => {
101
+ const [values, setSelectedValues] = useState(selectedValues);
102
+
103
+ const handleSetValues = (options: Option[]) => {
104
+ setValues(options);
105
+ setSelectedValues(options);
106
+ }
107
+
108
+ return (
109
+ <div style={{ minHeight: '240px' }}>
110
+ <AutoSuggestMultiSelect
111
+ options={options}
112
+ selectedValues={values}
113
+ setValues={handleSetValues}
114
+ placeholder={placeholder}
115
+ chipsListClassName={chipsListClassName}
116
+ multiSelectClassName={multiSelectClassName}
117
+ wrapText={wrapText}
118
+ />
119
+ </div>
120
+ );
121
+ };
122
+
123
+ AutoSuggestMultiSelectStory.storyName = "AutoSuggestMultiSelect";
124
+
125
+ export default story;
@@ -2,18 +2,11 @@ import { useState } from 'react';
2
2
 
3
3
  import { Option } from '../../../models/autoSuggestInput';
4
4
  import Chip from '../../chip';
5
- import AutoSuggestInput from '../autoSuggestInput';
5
+ import { AutoSuggestInput } from '../autoSuggestInput';
6
6
  import styles from './style.module.scss';
7
+ import classNames from 'classnames';
7
8
 
8
- export default ({
9
- options,
10
- selectedValues,
11
- setValues,
12
- placeholder,
13
- chipsListClassName,
14
- multiSelectClassName,
15
- wrapText,
16
- }: {
9
+ export interface AutoSuggestMultiSelectProps {
17
10
  options: Option[];
18
11
  selectedValues?: Option[];
19
12
  setValues: (values: Option[]) => void;
@@ -21,30 +14,50 @@ export default ({
21
14
  chipsListClassName?: string;
22
15
  multiSelectClassName?: string;
23
16
  wrapText?: boolean;
24
- }) => {
17
+ }
18
+
19
+ export const AutoSuggestMultiSelect = ({
20
+ options,
21
+ selectedValues,
22
+ setValues,
23
+ placeholder,
24
+ chipsListClassName,
25
+ multiSelectClassName,
26
+ wrapText,
27
+ }: AutoSuggestMultiSelectProps) => {
25
28
  const [suggestions, setSuggestions] = useState<Option[]>([]);
26
29
  const [currentOption, setCurrentOption] = useState('');
30
+ const hasChips = Boolean(selectedValues && selectedValues.length > 0);
27
31
 
28
32
  return (
29
33
  <>
30
- {selectedValues && selectedValues.length > 0 && (
31
- <div
32
- className={`mb8 ${styles['chip-container']} ${chipsListClassName}`}
33
- >
34
- {selectedValues.map((value, index) => (
35
- <Chip
36
- key={`${value.value}-${index}`}
37
- value={value}
38
- onRemove={(value: Option) => {
39
- const newValues = [...selectedValues].filter(
40
- (selectedValue) => selectedValue.value !== value.value
41
- );
42
- setValues(newValues);
43
- }}
44
- />
45
- ))}
46
- </div>
47
- )}
34
+ <div
35
+ className={classNames(
36
+ styles['chip-container'],
37
+ chipsListClassName,
38
+ {
39
+ [styles.appearIn]: hasChips
40
+ },
41
+ )}
42
+ >
43
+ {selectedValues && hasChips && (
44
+ <>
45
+ {selectedValues.map((value, index) => (
46
+ <Chip
47
+ key={`${value.value}-${index}`}
48
+ className="mb16"
49
+ value={value}
50
+ onRemove={(value: Option) => {
51
+ const newValues = [...selectedValues].filter(
52
+ (selectedValue) => selectedValue.value !== value.value
53
+ );
54
+ setValues(newValues);
55
+ }}
56
+ />
57
+ ))}
58
+ </>
59
+ )}
60
+ </div>
48
61
  <AutoSuggestInput
49
62
  className={multiSelectClassName}
50
63
  placeholder={placeholder}
@@ -1,4 +1,10 @@
1
1
  .chip-container {
2
2
  display: flex;
3
3
  flex-wrap: wrap;
4
+ max-height: 10px;
5
+ transition: 0.7s ease-in;
6
+ }
7
+
8
+ .appearIn {
9
+ max-height: 300px;
4
10
  }
@@ -0,0 +1,29 @@
1
+ import { Link, LinkProps } from '.';
2
+
3
+ const story = {
4
+ title: 'JSX/Link',
5
+ component: Link,
6
+ argTypes: {
7
+ children: {
8
+ control: 'text',
9
+ defaultValue: 'Click here to go to Feather Insurance',
10
+ description: 'Content that is displayed as clickable inside the link',
11
+ },
12
+ href: {
13
+ control: 'text',
14
+ defaultValue: 'https://feather-insurance.com',
15
+ description: 'Specifies the URL of the page the link goes to',
16
+ },
17
+ },
18
+ parameters: {
19
+ componentSubtitle: 'Links are a styled helper component for anchor (<a />) tags.',
20
+ },
21
+ };
22
+
23
+ export const LinkStory = ({ children, href, ...rest }: LinkProps) => (
24
+ <Link href={href} {...rest}>{children}</Link>
25
+ );
26
+
27
+ LinkStory.storyName = "Link";
28
+
29
+ export default story;
@@ -0,0 +1,9 @@
1
+ import classnames from 'classnames';
2
+
3
+ export type LinkProps = JSX.IntrinsicElements['a'];
4
+
5
+ export const Link = ({ children, className, ...rest }: LinkProps) => (
6
+ <a className={classnames(className, 'p-a c-pointer')} {...rest}>
7
+ {children}
8
+ </a>
9
+ );
package/src/lib/index.tsx CHANGED
@@ -10,8 +10,10 @@ import {
10
10
  UploadStatus
11
11
  } from './components/multiDropzone';
12
12
  import { DownloadButton } from './components/downloadButton';
13
+ import { InformationBox } from './components/informationBox';
13
14
  import IbanInput from './components/input/iban';
14
15
  import CurrencyInput from './components/input/currency';
16
+ import { Badge } from './components/badge';
15
17
  import { Checkbox } from './components/input/checkbox';
16
18
  import {
17
19
  BottomModal,
@@ -26,9 +28,9 @@ import {
26
28
  CardButton,
27
29
  } from './components/cards';
28
30
  import Button from './components/button';
29
- import AutoSuggestMultiSelect from './components/input/autoSuggestMultiSelect';
31
+ import { AutoSuggestMultiSelect } from './components/input/autoSuggestMultiSelect';
30
32
  import Chip from './components/chip';
31
- import AutoSuggestInput from './components/input/autoSuggestInput';
33
+ import { AutoSuggestInput } from './components/input/autoSuggestInput';
32
34
  import {
33
35
  ComparisonTable,
34
36
  TableRating,
@@ -40,6 +42,7 @@ import {
40
42
  } from './components/comparisonTable';
41
43
  import { SegmentedControl } from './components/segmentedControl';
42
44
  import { Markdown } from './components/markdown';
45
+ import { Link } from './components/link';
43
46
  import { images } from './util/images';
44
47
 
45
48
  export {
@@ -72,6 +75,9 @@ export {
72
75
  SegmentedControl,
73
76
  Markdown,
74
77
  Checkbox,
78
+ Link,
79
+ InformationBox,
80
+ Badge,
75
81
  images,
76
82
  };
77
83
 
@@ -1 +0,0 @@
1
- {"version":3,"file":"index-47663d39.js","sources":["../../src/lib/components/cards/icons/arrow-right.svg","../../src/lib/components/cards/icons/feather-logo.svg","../../src/lib/components/cards/icons/info.svg","../../src/lib/components/cards/icons/chevron-right.svg","../../../src/lib/components/cards/icons/index.ts","../../../src/lib/components/cards/cardButton/index.tsx"],"sourcesContent":["export default \"data:image/svg+xml,%3Csvg%20width%3D%2224%22%20height%3D%2224%22%20viewBox%3D%220%200%2024%2024%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%3Cpath%20d%3D%22M5%2012H19%22%20stroke%3D%22%238E8CEE%22%20strokeWidth%3D%222%22%20strokeLinecap%3D%22round%22%20strokeLinejoin%3D%22round%22%2F%3E%3Cpath%20d%3D%22M12%205L19%2012L12%2019%22%20stroke%3D%22%238E8CEE%22%20strokeWidth%3D%222%22%20strokeLinecap%3D%22round%22%20strokeLinejoin%3D%22round%22%2F%3E%3C%2Fsvg%3E\"","export default \"data:image/svg+xml,%3Csvg%20width%3D%2228%22%20height%3D%2228%22%20viewBox%3D%220%200%2028%2028%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%3Cmask%20id%3D%22mask0%22%20mask-type%3D%22alpha%22%20maskUnits%3D%22userSpaceOnUse%22%20x%3D%223%22%20y%3D%220%22%20width%3D%2222%22%20height%3D%2228%22%3E%3Cpath%20d%3D%22M23.8761%200C14.4485%204.03927%205.77595%2019.2529%203.53731%2026.0756C3.04003%2027.5912%202.60201%2029.2504%204.03812%2026.6043C4.89889%2025.0183%207.02902%2022.7858%2011.8864%2021.9848C15.7724%2021.344%2017.3995%2020.5116%2019.8916%2017.6795C18.7427%2018.0914%2017.2587%2018.9525%2014.0909%2017.9656C18.4837%2018.3512%2021.5108%2015.748%2022.6934%2012.044C19.7931%2013.3599%2017.3385%2012.4392%2016.6956%2012.1007C20.6519%2012.2002%2023.9887%209.68393%2024.7913%205.49304C25.2591%203.05005%2024.5097%200.800979%2023.8761%200Z%22%20fill%3D%22%236160A2%22%2F%3E%3C%2Fmask%3E%3Cg%20mask%3D%22url%28%23mask0%29%22%3E%3Cpath%20d%3D%22M21.1875%201.45451C12.8431%206.88225%205.56109%2019.9077%203.53731%2026.0756C3.04003%2027.5912%202.60201%2029.2504%204.03812%2026.6043C4.89889%2025.0183%207.02902%2022.7858%2011.8864%2021.9848C15.1146%2021.4525%2016.784%2020.7879%2018.6853%2018.9545C19.0219%2018.63%2019.1998%2017.9565%2018.7553%2018.1015C18.24%2018.2696%2017.709%2017.5612%2018.205%2017.3425C19.7521%2016.6603%2020.976%2015.4887%2021.8303%2014.0102C22.2446%2013.2932%2020.7231%2012.6796%2019.8955%2012.7075C18.8859%2012.7415%2019.6982%2011.6399%2020.6391%2011.2723C21.8973%2010.7807%2023.0427%2010.0842%2023.7916%209.26859C24.7617%208.21223%2024.48%207.11878%2024.7913%205.49304C24.969%204.56516%2024.971%203.66526%2024.8706%202.86204C24.6464%201.06951%2022.7019%200.469502%2021.1875%201.45451Z%22%20fill%3D%22%236160A2%22%2F%3E%3Cpath%20fill-rule%3D%22evenodd%22%20clip-rule%3D%22evenodd%22%20d%3D%22M30.4837%205.72996C30.4837%2014.8734%2023.1695%2022.4039%2014.0022%2022.4039C4.83493%2022.4039%20-2.47925%2014.8734%20-2.47925%205.72996C-2.47925%20-3.4135%204.83493%20-10.944%2014.0022%20-10.944C23.1695%20-10.944%2030.4837%20-3.4135%2030.4837%205.72996ZM14.0022%2018.0289C20.6884%2018.0289%2026.1087%2012.5225%2026.1087%205.72996C26.1087%20-1.06259%2020.6884%20-6.56903%2014.0022%20-6.56903C7.316%20-6.56903%201.89575%20-1.06259%201.89575%205.72996C1.89575%2012.5225%207.316%2018.0289%2014.0022%2018.0289Z%22%20fill%3D%22%2390DF9B%22%2F%3E%3Cpath%20d%3D%22M26.1087%205.72995C26.1087%2012.5225%2020.6884%2018.0289%2014.0022%2018.0289C7.316%2018.0289%201.89575%2012.5225%201.89575%205.72995C1.89575%20-1.06259%207.316%20-6.56903%2014.0022%20-6.56903C20.6884%20-6.56903%2026.1087%20-1.06259%2026.1087%205.72995Z%22%20fill%3D%22%238E8CEE%22%2F%3E%3C%2Fg%3E%3C%2Fsvg%3E\"","export default \"data:image/svg+xml,%3Csvg%20width%3D%2220%22%20height%3D%2220%22%20viewBox%3D%220%200%2020%2020%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%3Cg%20clip-path%3D%22url%28%23clip0%29%22%3E%3Cpath%20d%3D%22M10%2018.3334C14.6024%2018.3334%2018.3334%2014.6024%2018.3334%2010C18.3334%205.39765%2014.6024%201.66669%2010%201.66669C5.39765%201.66669%201.66669%205.39765%201.66669%2010C1.66669%2014.6024%205.39765%2018.3334%2010%2018.3334Z%22%20stroke%3D%22%238E8CEE%22%20strokeWidth%3D%222%22%20strokeLinecap%3D%22round%22%20strokeLinejoin%3D%22round%22%2F%3E%3Cpath%20d%3D%22M10%2013.3333V10%22%20stroke%3D%22%238E8CEE%22%20strokeWidth%3D%222%22%20strokeLinecap%3D%22round%22%20strokeLinejoin%3D%22round%22%2F%3E%3Ccircle%20cx%3D%2210%22%20cy%3D%226.66665%22%20r%3D%220.833333%22%20fill%3D%22%238E8CEE%22%2F%3E%3C%2Fg%3E%3Cdefs%3E%3CclipPath%20id%3D%22clip0%22%3E%3Crect%20width%3D%2220%22%20height%3D%2220%22%20fill%3D%22white%22%2F%3E%3C%2FclipPath%3E%3C%2Fdefs%3E%3C%2Fsvg%3E\"","export default \"data:image/svg+xml,%3Csvg%20width%3D%2224%22%20height%3D%2224%22%20viewBox%3D%220%200%2024%2024%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%3Cpath%20d%3D%22M9%2018L15%2012L9%206%22%20stroke%3D%22%238E8CEE%22%20strokeWidth%3D%222%22%20strokeLinecap%3D%22round%22%20strokeLinejoin%3D%22round%22%2F%3E%3C%2Fsvg%3E\"","import arrowRightImage from './arrow-right.svg';\nimport featherLogoImage from './feather-logo.svg';\nimport infoImage from './info.svg';\nimport chevronRightImage from './chevron-right.svg';\n\nexport interface Icon {\n src: string;\n alt: string;\n}\n\nexport interface IconSize {\n width: number;\n height: number;\n}\n\nconst arrowRight: Icon = {\n src: arrowRightImage,\n alt: 'arrow pointing right',\n};\n\nconst featherLogo: Icon = {\n src: featherLogoImage,\n alt: 'feather logo',\n};\n\nconst info: Icon = {\n src: infoImage,\n alt: 'circle with the letter i inside for information',\n};\n\nconst chevronRight: Icon = {\n src: chevronRightImage,\n alt: 'chevron facing right',\n};\n\nexport { arrowRight, featherLogo, info, chevronRight };\n","import { FormEvent, createElement, ReactNode } from 'react';\n\nimport styles from './style.module.scss';\nimport { chevronRight } from '../icons';\n\n\ntype ActionProps =\n | { href: string; onClick?: (e: FormEvent) => void }\n | { href?: string; onClick: (e: FormEvent) => void };\n\nexport type CardButtonProps = {\n title: string;\n description: string | ReactNode;\n disabled?: boolean;\n className?: string;\n} & ActionProps;\n\nconst CardContent = ({\n title,\n description,\n}: {\n title: string;\n description: string | ReactNode;\n}) => (\n <>\n <div>\n <div className=\"p-p--small\">{title}</div>\n {typeof description === 'string' ? (\n <div className=\"tc-primary-500 p-p\">{description}</div>\n ) : (\n description\n )}\n </div>\n <img {...chevronRight} alt=\"Expander icon\" />\n </>\n);\n\nexport const CardButton = ({\n title,\n description,\n disabled = false,\n onClick,\n href,\n className,\n}: CardButtonProps) => {\n const component = href ? 'a' : 'button';\n return (\n <>\n {createElement(component, {\n className: `c-pointer ta-left w100 ${styles.container} ${\n className ?? ''\n }\n `,\n children: <CardContent title={title} description={description} />,\n disabled,\n ...(component === 'a' ? { href } : { onClick }),\n })}\n </>\n );\n};\n"],"names":["_jsxs","_jsx"],"mappings":";;;;;;;;;AAAA,sBAAe;;ACAf,uBAAe;;ACAf,gBAAe;;ACAf,wBAAe;;ICeT,UAAU,GAAS;IACvB,GAAG,EAAE,eAAe;IACpB,GAAG,EAAE,sBAAsB;EAC3B;IAEI,WAAW,GAAS;IACxB,GAAG,EAAE,gBAAgB;IACrB,GAAG,EAAE,cAAc;EACnB;IAEI,IAAI,GAAS;IACjB,GAAG,EAAE,SAAS;IACd,GAAG,EAAE,iDAAiD;EACtD;AAEF,IAAM,YAAY,GAAS;IACzB,GAAG,EAAE,iBAAiB;IACtB,GAAG,EAAE,sBAAsB;CAC5B;;AChBD,IAAM,WAAW,GAAG,UAAC,EAMpB;QALC,KAAK,WAAA,EACL,WAAW,iBAAA;IAIP,QACJA,4BACEA,yBACEC,sBAAK,SAAS,EAAC,YAAY,gBAAE,KAAK,YAAO;oBACxC,OAAO,WAAW,KAAK,QAAQ,IAC9BA,sBAAK,SAAS,EAAC,oBAAoB,gBAAE,WAAW,YAAO,KAEvD,WAAW,CACZ,YACG;YACNA,wBAAS,YAAY,IAAE,GAAG,EAAC,eAAe,YAAG,YAC5C;AAXC,CAYL,CAAC;IAEW,UAAU,GAAG,UAAC,EAOT;QANhB,KAAK,WAAA,EACL,WAAW,iBAAA,EACX,gBAAgB,EAAhB,QAAQ,mBAAG,KAAK,KAAA,EAChB,OAAO,aAAA,EACP,IAAI,UAAA,EACJ,SAAS,eAAA;IAET,IAAM,SAAS,GAAG,IAAI,GAAG,GAAG,GAAG,QAAQ,CAAC;IACxC,QACEA,0BACG,aAAa,CAAC,SAAS,aACtB,SAAS,EAAE,4BAA0B,MAAM,CAAC,SAAS,UACnD,SAAS,aAAT,SAAS,cAAT,SAAS,GAAI,EAAE,gBAEhB,EACD,QAAQ,EAAEA,IAAC,WAAW,IAAC,KAAK,EAAE,KAAK,EAAE,WAAW,EAAE,WAAW,WAAI,EACjE,QAAQ,UAAA,KACJ,SAAS,KAAK,GAAG,GAAG,EAAE,IAAI,MAAA,EAAE,GAAG,EAAE,OAAO,SAAA,EAAE,GAC9C,WACD,EACH;AACJ;;;;"}
@@ -1,138 +0,0 @@
1
- import { useState } from 'react';
2
- import { Meta } from '@storybook/addon-docs/blocks';
3
-
4
- import AutoSuggestInput from '.';
5
- import featherLogo from '../../cards/icons/feather-logo.svg';
6
-
7
- <Meta title="JSX/Inputs/AutoSuggestInput" />
8
-
9
- # AutoSuggestInput
10
-
11
- This component allows quick search via the input field to find an option for selection.
12
-
13
- ## Types
14
-
15
- ```typescript
16
- export interface Option {
17
- value: string; // value of option to be stored and displayed on UI
18
- leftIcon?: string; // image of the provided option to be displayed on UI
19
- }
20
- ```
21
-
22
- ## Arguments
23
-
24
- | attribute | unit | description | default value | required |
25
- | ---------------------------- | -------- | ----------------------------------------------------------------------------------------- | ------------- | -------- |
26
- | currentOption | string | Current input of the component by user | n/a | true |
27
- | suggestions | Option | List of suggestions that should be displayed to the respective input | n/a | true |
28
- | onChange | function | Function that is called when value of current input changes | n/a | true |
29
- | handleSuggestionSelected | function | Functon that runs when a suggestion is selected from the dropdown | n/a | true |
30
- | handleSuggestionFetchRequest | function | Function that allows control of which suggestions should be displayed | n/a | true |
31
- | handleSuggestionClearRequest | function | Function that runs when suggestions are cleared (eg. input removal, selecting suggestion) | n/a | true |
32
- | placeholder | string | Placeholder for DirtySwan Input component | n/a | true |
33
- | className | string | Class name for the most parent element | undefined | false |
34
- | wrapText | boolean | Wether or not wrap the entries in the dropdown or hide overflown text | false | false |
35
- | inputProps | InputHTMLAttributes | Pass through arbitrary props to the input. | n/a | false |
36
-
37
- ## Example
38
-
39
- Following component has five options to search from: `feather`, `feather2`, `feather3`,`dirtyswan`, `test value`
40
-
41
- export const AutoSuggestInputStory = () => {
42
- const [selectedValues, setSelectedValues] = useState([]);
43
- const [currentOption, setCurrentOption] = useState('');
44
- const [suggestions, setSuggestions] = useState([]);
45
- const options = [
46
- { value: 'feather', leftIcon: featherLogo },
47
- { value: 'feather2', leftIcon: featherLogo },
48
- {
49
- value: 'feather3',
50
- leftIcon: featherLogo,
51
- },
52
- {
53
- value: 'dirtyswan',
54
- leftIcon: featherLogo,
55
- },
56
- {
57
- value: 'test value',
58
- leftIcon: featherLogo,
59
- },
60
- ];
61
- return (
62
- <AutoSuggestInput
63
- className="wmx5"
64
- placeholder="Placeholder"
65
- currentOption={currentOption}
66
- suggestions={suggestions}
67
- onChange={(value) => {
68
- setCurrentOption(value);
69
- }}
70
- handleSuggestionSelected={(value) => {
71
- const newSelectedOptions = [...selectedValues];
72
- newSelectedOptions.push(value);
73
- setSelectedValues(newSelectedOptions);
74
- setCurrentOption(value.value);
75
- }}
76
- handleSuggestionFetchRequest={({ value }) => {
77
- const filteredOptions = options.filter((option) =>
78
- option.value.toLowerCase().startsWith(value.toLowerCase())
79
- );
80
- setSuggestions(filteredOptions);
81
- }}
82
- handleSuggestionClearRequest={() => setSuggestions([])}
83
- />
84
- );
85
- };
86
-
87
- <AutoSuggestInputStory />
88
-
89
- ```typescript
90
- import React, { useState } from 'react';
91
- import { AutoSuggestInput } from '@popsure/dirty-swan';
92
-
93
- export default () => {
94
- const [selectedValues, setSelectedValues] = useState([]);
95
- const [currentOption, setCurrentOption] = useState('');
96
- const [suggestions, setSuggestions] = useState([]);
97
- const options = [
98
- { value: 'feather', leftIcon: featherLogo },
99
- { value: 'feather2', leftIcon: featherLogo },
100
- {
101
- value: 'feather3',
102
- leftIcon: featherLogo,
103
- },
104
- {
105
- value: 'dirtyswan',
106
- leftIcon: featherLogo,
107
- },
108
- {
109
- value: 'test value',
110
- leftIcon: featherLogo,
111
- },
112
- ];
113
- return (
114
- <AutoSuggestInput
115
- className="wmx5"
116
- placeholder="Placeholder"
117
- currentOption={currentOption}
118
- suggestions={suggestions}
119
- onChange={(value) => {
120
- setCurrentOption(value);
121
- }}
122
- handleSuggestionSelected={(value) => {
123
- const newSelectedOptions = [...selectedValues];
124
- newSelectedOptions.push(value);
125
- setSelectedValues(newSelectedOptions);
126
- setCurrentOption(value.value);
127
- }}
128
- handleSuggestionFetchRequest={({ value }) => {
129
- const filteredOptions = options.filter((option) =>
130
- option.value.toLowerCase().startsWith(value.toLowerCase())
131
- );
132
- setSuggestions(filteredOptions);
133
- }}
134
- handleSuggestionClearRequest={() => setSuggestions([])}
135
- />
136
- );
137
- };
138
- ```
@@ -1,115 +0,0 @@
1
- import { useState } from 'react';
2
- import { Meta, Preview } from '@storybook/addon-docs/blocks';
3
-
4
- import AutoSuggestMultiSelect from '.';
5
- import featherLogo from '../../cards/icons/feather-logo.svg';
6
-
7
- <Meta title="JSX/Inputs/AutoSuggestMultiSelect" />
8
-
9
- ## AutoSuggestMultiSelect
10
-
11
- AutoSuggestMultiSelect is a combination of the AutoSuggestInput and Chip components.
12
-
13
- This component allows quick search via the input field to find an option for selection.
14
-
15
- Upon selecting an option, the option is displayed above the input field as a chip.
16
-
17
- The chip can be removed by clicking on the X button. Multi options can be selected as well.
18
-
19
- Prop `setValues` function must be provided to keep track of removed and added option selections.
20
-
21
- ## Types
22
-
23
- ```typescript
24
- export interface Option {
25
- value: string; // value of option to be stored and displayed on UI
26
- leftIcon?: string; // image of the provided option to be displayed on UI
27
- }
28
- ```
29
-
30
- ## Arguments
31
-
32
- | attribute | unit | description | default value | required |
33
- | -------------------- | -------- | ------------------------------------------------------------------------ | ------------- | -------- |
34
- | options | Option[] | List of all options available to search from | n/a | true |
35
- | selectedValues | Option[] | List of all selected values | n/a | true |
36
- | setValues | function | Function that runs when selecting values | n/a | true |
37
- | placeholder | string | Placeholder for DirtySwan Input component | n/a | true |
38
- | chipsListClassName | string | Class name for the most parent element of the Chip component | undefined | false |
39
- | multiSelectClassName | string | Class name for the most parent element of the AutoSuggestInput component | undefined | false |
40
- | wrapText | boolean | Wether or not wrap the entries in the dropdown or hide overflown text | false | false |
41
-
42
- ## Example
43
-
44
- Following component has five options to search from: `feather`, `feather2`, `feather3`,`dirtyswan`. `test value`
45
-
46
- export const AutoSuggestMultiSelectStory = () => {
47
- const [selectedValues, setSelectedValues] = useState([]);
48
- const [suggestions, setSuggestions] = useState([]);
49
- const [currentOption, setCurrentOption] = useState('');
50
- const options = [
51
- { value: 'feather', leftIcon: featherLogo },
52
- { value: 'feather2', leftIcon: featherLogo },
53
- {
54
- value: 'feather3',
55
- leftIcon: featherLogo,
56
- },
57
- {
58
- value: 'dirtyswan',
59
- leftIcon: featherLogo,
60
- },
61
- {
62
- value: 'test value',
63
- leftIcon: featherLogo,
64
- },
65
- ];
66
- return (
67
- <AutoSuggestMultiSelect
68
- options={options}
69
- selectedValues={selectedValues}
70
- setValues={setSelectedValues}
71
- placeholder="Placeholder"
72
- chipsListClassName="wmx7"
73
- multiSelectClassName="wmx5"
74
- />
75
- );
76
- };
77
-
78
- <AutoSuggestMultiSelectStory />
79
-
80
- ```typescript
81
- import React, { useState } from 'react';
82
- import { AutoSuggestMultiSelect } from '@popsure/dirty-swan';
83
-
84
- export default () => {
85
- const [selectedValues, setSelectedValues] = useState([]);
86
- const [suggestions, setSuggestions] = useState([]);
87
- const [currentOption, setCurrentOption] = useState('');
88
- const options = [
89
- { value: 'feather', leftIcon: featherLogo },
90
- { value: 'feather2', leftIcon: featherLogo },
91
- {
92
- value: 'feather3',
93
- leftIcon: featherLogo,
94
- },
95
- {
96
- value: 'dirtyswan',
97
- leftIcon: featherLogo,
98
- },
99
- {
100
- value: 'test value',
101
- leftIcon: featherLogo,
102
- },
103
- ];
104
- return (
105
- <AutoSuggestMultiSelect
106
- options={options}
107
- selectedValues={selectedValues}
108
- setValues={setSelectedValues}
109
- placeholder="Placeholder"
110
- chipsListClassName="wmx7"
111
- multiSelectClassName="wmx5"
112
- />
113
- );
114
- };
115
- ```
@@ -1,43 +0,0 @@
1
- import { Meta, Preview } from '@storybook/addon-docs/blocks';
2
-
3
- <Meta title="CSS/Components/Badge" />
4
-
5
- # Badges
6
-
7
- Badges are label used for flags.
8
-
9
- ## Active
10
-
11
- <Preview>
12
- <div className="p-badge--active">Active badge</div>
13
- </Preview>
14
-
15
- ## Pending
16
-
17
- <Preview>
18
- <div className="p-badge--pending">Pending badge</div>
19
- </Preview>
20
-
21
- ## Inactive
22
-
23
- <Preview>
24
- <div className="p-badge--inactive">Inactive badge</div>
25
- </Preview>
26
-
27
- ## Danger
28
-
29
- <Preview>
30
- <div className="p-badge--danger">Danger badge</div>
31
- </Preview>
32
-
33
- ## Info
34
-
35
- <Preview>
36
- <div className="p-badge--info">Info badge</div>
37
- </Preview>
38
-
39
- ## Default
40
-
41
- <Preview>
42
- <div className="p-badge--default">Default badge</div>
43
- </Preview>