@popsure/dirty-swan 0.31.2 → 0.32.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 (45) hide show
  1. package/dist/cjs/index.d.ts +2 -2
  2. package/dist/cjs/index.js +14 -2
  3. package/dist/cjs/index.js.map +1 -1
  4. package/dist/cjs/lib/components/autocompleteAddress/index.d.ts +15 -14
  5. package/dist/cjs/lib/components/autocompleteAddress/index.stories.d.ts +66 -0
  6. package/dist/cjs/lib/components/segmentedControl/index.stories.d.ts +1 -5
  7. package/dist/cjs/lib/index.d.ts +3 -2
  8. package/dist/cjs/lib/util/images/index.d.ts +11 -0
  9. package/dist/cjs/lib/util/images/index.stories.d.ts +12 -0
  10. package/dist/esm/components/autocompleteAddress/index.js +2 -2
  11. package/dist/esm/components/autocompleteAddress/index.js.map +1 -1
  12. package/dist/esm/components/autocompleteAddress/index.stories.js +110 -0
  13. package/dist/esm/components/autocompleteAddress/index.stories.js.map +1 -0
  14. package/dist/esm/components/autocompleteAddress/index.test.js +2 -2
  15. package/dist/esm/components/autocompleteAddress/index.test.js.map +1 -1
  16. package/dist/esm/components/segmentedControl/index.stories.js +1 -5
  17. package/dist/esm/components/segmentedControl/index.stories.js.map +1 -1
  18. package/dist/esm/index-db2e797f.js +13 -0
  19. package/dist/esm/index-db2e797f.js.map +1 -0
  20. package/dist/esm/index.d.ts +2 -2
  21. package/dist/esm/index.js +2 -1
  22. package/dist/esm/index.js.map +1 -1
  23. package/dist/esm/lib/components/autocompleteAddress/index.d.ts +15 -14
  24. package/dist/esm/lib/components/autocompleteAddress/index.stories.d.ts +66 -0
  25. package/dist/esm/lib/components/segmentedControl/index.stories.d.ts +1 -5
  26. package/dist/esm/lib/index.d.ts +3 -2
  27. package/dist/esm/lib/util/images/index.d.ts +11 -0
  28. package/dist/esm/lib/util/images/index.stories.d.ts +12 -0
  29. package/dist/esm/util/images/index.stories.js +23 -0
  30. package/dist/esm/util/images/index.stories.js.map +1 -0
  31. package/package.json +1 -1
  32. package/src/index.tsx +2 -1
  33. package/src/lib/components/autocompleteAddress/index.stories.tsx +147 -0
  34. package/src/lib/components/autocompleteAddress/index.test.tsx +2 -2
  35. package/src/lib/components/autocompleteAddress/index.tsx +11 -9
  36. package/src/lib/components/segmentedControl/index.stories.tsx +1 -5
  37. package/src/lib/index.tsx +3 -1
  38. package/src/lib/util/images/index.stories.tsx +27 -0
  39. package/src/lib/util/images/index.ts +12 -0
  40. package/dist/cjs/lib/components/autocompleteAddress/demo.d.ts +0 -4
  41. package/dist/esm/components/autocompleteAddress/demo.js +0 -64
  42. package/dist/esm/components/autocompleteAddress/demo.js.map +0 -1
  43. package/dist/esm/lib/components/autocompleteAddress/demo.d.ts +0 -4
  44. package/src/lib/components/autocompleteAddress/demo.tsx +0 -88
  45. package/src/lib/components/autocompleteAddress/index.stories.mdx +0 -53
@@ -0,0 +1,110 @@
1
+ import { jsx } from 'react/jsx-runtime';
2
+ import { useState } from 'react';
3
+ import { AutocompleteAddress } from './index.js';
4
+ import '../../tslib.es6-5bc94358.js';
5
+ import '../../index-e9e37a34.js';
6
+ import '../../index-1463d5e9.js';
7
+ import '../../_commonjsHelpers-e7f67fd8.js';
8
+ import '../input/index.js';
9
+ import '../../index-fb46adf9.js';
10
+ import '../../style-inject.es-1f59c1d0.js';
11
+
12
+ var story = {
13
+ title: 'JSX/AutocompleteAddress',
14
+ component: AutocompleteAddress,
15
+ argTypes: {
16
+ address: {
17
+ description: 'The address properties',
18
+ table: {
19
+ type: {
20
+ summary: 'Partial<Address>'
21
+ },
22
+ },
23
+ },
24
+ apiKey: {
25
+ defaultValue: 'AIzaSyDg0DSrjYKt5smmsjkVasDz7c4T5rbOXT8',
26
+ description: 'Your private API key for the [Google Places API](https://developers.google.com/maps/documentation/places/web-service/overview)',
27
+ table: {
28
+ type: {
29
+ summary: 'Partial<Address>'
30
+ },
31
+ },
32
+ },
33
+ onAddressChange: {
34
+ description: 'Callback with the updated address, this function will get called everytime the address gets updated',
35
+ action: true,
36
+ table: {
37
+ category: "Callbacks",
38
+ },
39
+ },
40
+ manualAddressEntryTexts: {
41
+ description: 'The CTA that enables manual address entry and the text preceding it',
42
+ table: {
43
+ type: {
44
+ summary: '{ preText?: string; cta: string?; }'
45
+ }
46
+ }
47
+ },
48
+ placeholders: {
49
+ description: 'Placeholder text',
50
+ table: {
51
+ type: {
52
+ summary: '{ manualAddressEntry?: string; street: string?; houseNumber?: string; additionalInformation?: string; postcode?: string; city?: string; }'
53
+ }
54
+ }
55
+ }
56
+ },
57
+ parameters: {
58
+ componentSubtitle: 'Autocomplete Address are user interface elements which allow users start typing an address and get autocompletion suggestions on the address.',
59
+ docs: {
60
+ description: {
61
+ component: 'This component is for now only restricted to "address" types and will restrict every query to Germany.',
62
+ },
63
+ },
64
+ customTypes: {
65
+ Address: "interface Address {\n street: string;\n houseNumber: string;\n postcode: string;\n city: string;\n additionalInformation?: string;\n country: string;\n }"
66
+ }
67
+ },
68
+ };
69
+ var AutocompleteAddressStory = function (_a) {
70
+ var defaultAddress = _a.address, apiKey = _a.apiKey, manualAddressEntryTexts = _a.manualAddressEntryTexts, onAddressChange = _a.onAddressChange, placeholders = _a.placeholders;
71
+ var _b = useState(defaultAddress), address = _b[0], setAddress = _b[1];
72
+ var handleOnAddressChange = function (newAddress) {
73
+ onAddressChange(newAddress);
74
+ setAddress(newAddress);
75
+ };
76
+ return (jsx(AutocompleteAddress, { address: address, apiKey: apiKey, manualAddressEntryTexts: manualAddressEntryTexts, onAddressChange: handleOnAddressChange, placeholders: placeholders }, void 0));
77
+ };
78
+ AutocompleteAddressStory.storyName = "AutocompleteAddress";
79
+ var WithAddress = function (_a) {
80
+ var apiKey = _a.apiKey, onAddressChange = _a.onAddressChange; _a.placeholders;
81
+ return (jsx(AutocompleteAddress, { address: {
82
+ street: 'Lohmuehlenstraße',
83
+ houseNumber: '65',
84
+ city: 'Berlin',
85
+ country: 'DE',
86
+ additionalInformation: 'c/o Factory',
87
+ }, apiKey: apiKey, onAddressChange: onAddressChange }, void 0));
88
+ };
89
+ var WithLocalisationEntryText = function (_a) {
90
+ var apiKey = _a.apiKey, onAddressChange = _a.onAddressChange;
91
+ return (jsx(AutocompleteAddress, { apiKey: apiKey, manualAddressEntryTexts: {
92
+ preText: 'Oder ',
93
+ cta: 'Adresse direkt eingeben',
94
+ }, onAddressChange: onAddressChange }, void 0));
95
+ };
96
+ var WithLocalisationPlaceholders = function (_a) {
97
+ var apiKey = _a.apiKey, onAddressChange = _a.onAddressChange;
98
+ return (jsx(AutocompleteAddress, { address: {}, apiKey: apiKey, placeholders: {
99
+ manualAddressEntry: 'Adresse suchen',
100
+ street: 'Straße',
101
+ houseNumber: 'Hausnummer',
102
+ additionalInformation: 'Adresszusatz (c/o, z.Hd., o.V.i.A, ...)',
103
+ postcode: 'PLZ',
104
+ city: 'Stadt',
105
+ }, onAddressChange: onAddressChange }, void 0));
106
+ };
107
+
108
+ export default story;
109
+ export { AutocompleteAddressStory, WithAddress, WithLocalisationEntryText, WithLocalisationPlaceholders };
110
+ //# sourceMappingURL=index.stories.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.stories.js","sources":["../../../../../src/lib/components/autocompleteAddress/index.stories.tsx"],"sourcesContent":["import { Address } from '@popsure/public-models';\nimport { useState } from 'react';\nimport { AutocompleteAddress, AutocompleteAddressProps } from '.';\n\nconst story = {\n title: 'JSX/AutocompleteAddress',\n component: AutocompleteAddress,\n argTypes: {\n address: {\n description: 'The address properties',\n table: {\n type: { \n summary: 'Partial<Address>'\n },\n },\n },\n apiKey: {\n defaultValue: 'AIzaSyDg0DSrjYKt5smmsjkVasDz7c4T5rbOXT8',\n description: 'Your private API key for the [Google Places API](https://developers.google.com/maps/documentation/places/web-service/overview)',\n table: {\n type: { \n summary: 'Partial<Address>'\n },\n },\n },\n onAddressChange: {\n description: 'Callback with the updated address, this function will get called everytime the address gets updated',\n action: true,\n table: {\n category: \"Callbacks\",\n },\n },\n manualAddressEntryTexts: {\n description: 'The CTA that enables manual address entry and the text preceding it',\n table: {\n type: {\n summary: '{ preText?: string; cta: string?; }'\n }\n }\n },\n placeholders: {\n description: 'Placeholder text',\n table: {\n type: {\n summary: '{ manualAddressEntry?: string; street: string?; houseNumber?: string; additionalInformation?: string; postcode?: string; city?: string; }'\n }\n }\n }\n },\n parameters: {\n componentSubtitle: 'Autocomplete Address are user interface elements which allow users start typing an address and get autocompletion suggestions on the address.',\n docs: {\n description: {\n component: 'This component is for now only restricted to \"address\" types and will restrict every query to Germany.',\n },\n },\n customTypes: {\n Address: `interface Address {\n street: string;\n houseNumber: string;\n postcode: string;\n city: string;\n additionalInformation?: string;\n country: string;\n }`\n }\n },\n};\n\nexport const AutocompleteAddressStory = ({\n address: defaultAddress,\n apiKey,\n manualAddressEntryTexts,\n onAddressChange,\n placeholders,\n}: AutocompleteAddressProps) => {\n const [address, setAddress] = useState<Partial<Address> | undefined>(defaultAddress);\n const handleOnAddressChange = (newAddress: Partial<Address>) => {\n onAddressChange(newAddress);\n setAddress(newAddress);\n };\n\n return (\n <AutocompleteAddress\n address={address}\n apiKey={apiKey}\n manualAddressEntryTexts={manualAddressEntryTexts}\n onAddressChange={handleOnAddressChange}\n placeholders={placeholders}\n />\n );\n};\n\nAutocompleteAddressStory.storyName = \"AutocompleteAddress\";\n\nexport const WithAddress = ({\n apiKey,\n onAddressChange,\n placeholders,\n}: AutocompleteAddressProps) => (\n <AutocompleteAddress\n address={{\n street: 'Lohmuehlenstraße',\n houseNumber: '65',\n city: 'Berlin',\n country: 'DE',\n additionalInformation: 'c/o Factory',\n }}\n apiKey={apiKey}\n onAddressChange={onAddressChange}\n />\n);\n\nexport const WithLocalisationEntryText = ({\n apiKey,\n onAddressChange,\n}: AutocompleteAddressProps) => (\n <AutocompleteAddress\n apiKey={apiKey}\n manualAddressEntryTexts={{\n preText: 'Oder ',\n cta: 'Adresse direkt eingeben',\n }}\n onAddressChange={onAddressChange}\n />\n);\n\nexport const WithLocalisationPlaceholders = ({\n apiKey,\n onAddressChange,\n}: AutocompleteAddressProps) => (\n <AutocompleteAddress\n address={{}}\n apiKey={apiKey}\n placeholders={{\n manualAddressEntry: 'Adresse suchen',\n street: 'Straße',\n houseNumber: 'Hausnummer',\n additionalInformation: 'Adresszusatz (c/o, z.Hd., o.V.i.A, ...)',\n postcode: 'PLZ',\n city: 'Stadt',\n }}\n onAddressChange={onAddressChange}\n />\n);\n\nexport default story;\n"],"names":["_jsx"],"mappings":";;;;;;;;;;;IAIM,KAAK,GAAG;IACZ,KAAK,EAAE,yBAAyB;IAChC,SAAS,EAAE,mBAAmB;IAC9B,QAAQ,EAAE;QACR,OAAO,EAAE;YACP,WAAW,EAAE,wBAAwB;YACrC,KAAK,EAAE;gBACL,IAAI,EAAE;oBACJ,OAAO,EAAE,kBAAkB;iBAC5B;aACF;SACF;QACD,MAAM,EAAE;YACN,YAAY,EAAE,yCAAyC;YACvD,WAAW,EAAE,gIAAgI;YAC7I,KAAK,EAAE;gBACL,IAAI,EAAE;oBACJ,OAAO,EAAE,kBAAkB;iBAC5B;aACF;SACF;QACD,eAAe,EAAE;YACf,WAAW,EAAE,qGAAqG;YAClH,MAAM,EAAE,IAAI;YACZ,KAAK,EAAE;gBACL,QAAQ,EAAE,WAAW;aACtB;SACF;QACD,uBAAuB,EAAE;YACvB,WAAW,EAAE,qEAAqE;YAClF,KAAK,EAAE;gBACL,IAAI,EAAE;oBACF,OAAO,EAAE,qCAAqC;iBACjD;aACF;SACF;QACD,YAAY,EAAE;YACZ,WAAW,EAAE,kBAAkB;YAC/B,KAAK,EAAE;gBACL,IAAI,EAAE;oBACF,OAAO,EAAE,2IAA2I;iBACvJ;aACF;SACF;KACF;IACD,UAAU,EAAE;QACV,iBAAiB,EAAE,+IAA+I;QAClK,IAAI,EAAE;YACJ,WAAW,EAAE;gBACT,SAAS,EAAE,wGAAwG;aACtH;SACF;QACD,WAAW,EAAE;YACX,OAAO,EAAE,sNAOP;SACH;KACF;EACD;IAEW,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E,EACX,MAAM,EAAE,MAAM,EACd,YAAY,EAAE;YACZ,kBAAkB,EAAE,gBAAgB;YACpC,MAAM,EAAE,QAAQ;YAChB,WAAW,EAAE,YAAY;YACzB,qBAAqB,EAAE,yCAAyC;YAChE,QAAQ,EAAE,KAAK;YACf,IAAI,EAAE,OAAO;SACd,EACD,eAAe,EAAE,eAAe,WAChC;AAb4B;;;;;"}
@@ -1,7 +1,7 @@
1
1
  import { b as __awaiter, c as __generator } from '../../tslib.es6-5bc94358.js';
2
2
  import { jsx } from 'react/jsx-runtime';
3
3
  import { c as customRender, f as fireEvent } from '../../customRender-4157fcff.js';
4
- import AutoCompleteAddress from './index.js';
4
+ import { AutocompleteAddress } from './index.js';
5
5
  import 'react';
6
6
  import 'react-dom';
7
7
  import '../../_commonjsHelpers-e7f67fd8.js';
@@ -22,7 +22,7 @@ var address = {
22
22
  var setup = function (address, onAddressChange) {
23
23
  if (address === void 0) { address = undefined; }
24
24
  if (onAddressChange === void 0) { onAddressChange = function () { }; }
25
- return customRender(jsx(AutoCompleteAddress, { address: address, apiKey: '', onAddressChange: onAddressChange }, void 0));
25
+ return customRender(jsx(AutocompleteAddress, { address: address, apiKey: '', onAddressChange: onAddressChange }, void 0));
26
26
  };
27
27
  var inputTestId = 'ds-input-input';
28
28
  describe('AutocompleteAddress component', function () {
@@ -1 +1 @@
1
- {"version":3,"file":"index.test.js","sources":["../../../../../src/lib/components/autocompleteAddress/index.test.tsx"],"sourcesContent":["import { Address } from '@popsure/public-models';\nimport { fireEvent, render } from '../../util/testUtils';\n\nimport AutoCompleteAddress from '.';\n\nconst address = {\n street: 'Köpeniker Strasse',\n houseNumber: '4000',\n postcode: '10179',\n city: 'Berlin',\n country: 'DE',\n};\n\nconst setup = (\n address: Partial<Address> | undefined = undefined,\n onAddressChange: (address: Partial<Address>) => void = () => {}\n) => {\n return render(\n <AutoCompleteAddress\n address={address}\n apiKey={''}\n onAddressChange={onAddressChange}\n />\n );\n};\n\nconst inputTestId = 'ds-input-input';\n\ndescribe('AutocompleteAddress component', () => {\n it('Should show all address fields once a search is completed', async () => {\n // @ts-ignore\n window.google.maps.places.Autocomplete = class {\n reference: HTMLElement;\n constructor(reference: HTMLElement) {\n this.reference = reference;\n }\n // @ts-ignore\n addListener(_action, callback) {\n this.reference.addEventListener('change', (e: Event) =>\n (e.target as HTMLInputElement).value !== ''\n ? callback({\n geometry: {\n location: class {},\n },\n address_components: [\n {\n long_name: 'Köpeniker Strasse',\n short_name: 'Köpeniker Strasse',\n types: ['route'],\n },\n ],\n })\n : null\n );\n }\n };\n\n const { getAllByTestId, getByDisplayValue, getByTestId } = setup();\n\n fireEvent.change(getByTestId(inputTestId), {\n target: { value: 'Köpeniker' },\n });\n\n expect(getAllByTestId(inputTestId).length).toEqual(5);\n expect(getByDisplayValue(\"Köpeniker Strasse\")).toBeVisible();\n });\n\n it('Should enable to enter the address manually', async () => {\n const callback = jest.fn();\n const { findByText, getAllByTestId, user } = setup(undefined, callback);\n const btn = await findByText('Enter address manually');\n\n await user.click(btn);\n\n // fill out all fields\n const inputs = getAllByTestId(inputTestId);\n\n await user.type(inputs[0], 'Köpeniker Strasse');\n await user.type(inputs[1], '4000');\n await user.type(inputs[3], '10179');\n await user.type(inputs[4], 'Berlin');\n\n // callback should be called with a complete address\n expect(callback).toHaveBeenCalledWith(address);\n });\n\n it('Should prefill fields if an address is provided', async () => {\n const { getByDisplayValue } = setup(address);\n\n expect(getByDisplayValue(\"Köpeniker Strasse\")).toBeVisible();\n expect(getByDisplayValue(\"4000\")).toBeVisible();\n expect(getByDisplayValue(\"10179\")).toBeVisible();\n expect(getByDisplayValue(\"Berlin\")).toBeVisible();\n });\n});\n"],"names":["render","_jsx"],"mappings":";;;;;;;;;;;;;;AAKA,IAAM,OAAO,GAAG;IACd,MAAM,EAAE,mBAAmB;IAC3B,WAAW,EAAE,MAAM;IACnB,QAAQ,EAAE,OAAO;IACjB,IAAI,EAAE,QAAQ;IACd,OAAO,EAAE,IAAI;CACd,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AE7C,MAAM,CAAC,iBAAiB,CAAC,mBAAmB,CAAC,CAAC,CAAC,WAAW,EAAE,CAAC;YAC7D,MAAM,CAAC,iBAAiB,CAAC,MAAM,CAAC,CAAC,CAAC,WAAW,EAAE,CAAC;YAChD,MAAM,CAAC,iBAAiB,CAAC,OAAO,CAAC,CAAC,CAAC,WAAW,EAAE,CAAC;YACjD,MAAM,CAAC,iBAAiB,CAAC,QAAQ,CAAC,CAAC,CAAC,WAAW,EAAE,CAAC;;;SACnD,CAAC,CAAC;AACL,CAAC,CAAC"}
1
+ {"version":3,"file":"index.test.js","sources":["../../../../../src/lib/components/autocompleteAddress/index.test.tsx"],"sourcesContent":["import { Address } from '@popsure/public-models';\nimport { fireEvent, render } from '../../util/testUtils';\n\nimport { AutocompleteAddress } from '.';\n\nconst address = {\n street: 'Köpeniker Strasse',\n houseNumber: '4000',\n postcode: '10179',\n city: 'Berlin',\n country: 'DE',\n};\n\nconst setup = (\n address: Partial<Address> | undefined = undefined,\n onAddressChange: (address: Partial<Address>) => void = () => {}\n) => {\n return render(\n <AutocompleteAddress\n address={address}\n apiKey={''}\n onAddressChange={onAddressChange}\n />\n );\n};\n\nconst inputTestId = 'ds-input-input';\n\ndescribe('AutocompleteAddress component', () => {\n it('Should show all address fields once a search is completed', async () => {\n // @ts-ignore\n window.google.maps.places.Autocomplete = class {\n reference: HTMLElement;\n constructor(reference: HTMLElement) {\n this.reference = reference;\n }\n // @ts-ignore\n addListener(_action, callback) {\n this.reference.addEventListener('change', (e: Event) =>\n (e.target as HTMLInputElement).value !== ''\n ? callback({\n geometry: {\n location: class {},\n },\n address_components: [\n {\n long_name: 'Köpeniker Strasse',\n short_name: 'Köpeniker Strasse',\n types: ['route'],\n },\n ],\n })\n : null\n );\n }\n };\n\n const { getAllByTestId, getByDisplayValue, getByTestId } = setup();\n\n fireEvent.change(getByTestId(inputTestId), {\n target: { value: 'Köpeniker' },\n });\n\n expect(getAllByTestId(inputTestId).length).toEqual(5);\n expect(getByDisplayValue(\"Köpeniker Strasse\")).toBeVisible();\n });\n\n it('Should enable to enter the address manually', async () => {\n const callback = jest.fn();\n const { findByText, getAllByTestId, user } = setup(undefined, callback);\n const btn = await findByText('Enter address manually');\n\n await user.click(btn);\n\n // fill out all fields\n const inputs = getAllByTestId(inputTestId);\n\n await user.type(inputs[0], 'Köpeniker Strasse');\n await user.type(inputs[1], '4000');\n await user.type(inputs[3], '10179');\n await user.type(inputs[4], 'Berlin');\n\n // callback should be called with a complete address\n expect(callback).toHaveBeenCalledWith(address);\n });\n\n it('Should prefill fields if an address is provided', async () => {\n const { getByDisplayValue } = setup(address);\n\n expect(getByDisplayValue(\"Köpeniker Strasse\")).toBeVisible();\n expect(getByDisplayValue(\"4000\")).toBeVisible();\n expect(getByDisplayValue(\"10179\")).toBeVisible();\n expect(getByDisplayValue(\"Berlin\")).toBeVisible();\n });\n});\n"],"names":["render","_jsx"],"mappings":";;;;;;;;;;;;;;AAKA,IAAM,OAAO,GAAG;IACd,MAAM,EAAE,mBAAmB;IAC3B,WAAW,EAAE,MAAM;IACnB,QAAQ,EAAE,OAAO;IACjB,IAAI,EAAE,QAAQ;IACd,OAAO,EAAE,IAAI;CACd,CAAC;AAEF,IAAM,KAAK,GAAG,UACZ,OAAiD,EACjD,eAA+D;IAD/D,wBAAA,EAAA,mBAAiD;IACjD,gCAAA,EAAA,iCAA+D;IAE/D,OAAOA,YAAM,CACXC,IAAC,mBAAmB,IAClB,OAAO,EAAE,OAAO,EAChB,MAAM,EAAE,EAAE,EACV,eAAe,EAAE,eAAe,WAChC,CACH,CAAC;AACJ,CAAC,CAAC;AAEF,IAAM,WAAW,GAAG,gBAAgB,CAAC;AAErC,QAAQ,CAAC,+BAA+B,EAAE;IACxC,EAAE,CAAC,2DAA2D,EAAE;;;;YAE9D,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,YAAY;gBAEpC,iBAAY,SAAsB;oBAChC,IAAI,CAAC,SAAS,GAAG,SAAS,CAA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C,KAAK,CAAC,GAAG,CAAC,EAAA;;oBAArB,SAAqB,CAAC;oBAGhB,MAAM,GAAG,cAAc,CAAC,WAAW,CAAC,CAAC;oBAE3C,qBAAM,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,mBAAmB,CAAC,EAAA;;oBAA/C,SAA+C,CAAC;oBAChD,qBAAM,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,MAAM,CAAC,EAAA;;oBAAlC,SAAkC,CAAC;oBACnC,qBAAM,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,OAAO,CAAC,EAAA;;oBAAnC,SAAmC,CAAC;oBACpC,qBAAM,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,QAAQ,CAAC,EAAA;;oBAApC,SAAoC,CAAC;;oBAGrC,MAAM,CAAC,QAAQ,CAAC,CAAC,oBAAoB,CAAC,OAAO,CAAC,CAAC;;;;SAChD,CAAC,CAAC;IAEH,EAAE,CAAC,iDAAiD,EAAE;;;YAC5C,iBAAiB,GAAK,KAAK,CAAC,OAAO,CAAC,kBAAnB,CAAoB;YAE7C,MAAM,CAAC,iBAAiB,CAAC,mBAAmB,CAAC,CAAC,CAAC,WAAW,EAAE,CAAC;YAC7D,MAAM,CAAC,iBAAiB,CAAC,MAAM,CAAC,CAAC,CAAC,WAAW,EAAE,CAAC;YAChD,MAAM,CAAC,iBAAiB,CAAC,OAAO,CAAC,CAAC,CAAC,WAAW,EAAE,CAAC;YACjD,MAAM,CAAC,iBAAiB,CAAC,QAAQ,CAAC,CAAC,CAAC,WAAW,EAAE,CAAC;;;SACnD,CAAC,CAAC;AACL,CAAC,CAAC"}
@@ -31,11 +31,7 @@ var story = {
31
31
  selectedIndex: 0,
32
32
  },
33
33
  parameters: {
34
- docs: {
35
- description: {
36
- component: 'A segmented control is a linear set of two or more segments, each of which functions as a mutually exclusive button.',
37
- },
38
- },
34
+ componentSubtitle: 'A segmented control is a linear set of two or more segments, each of which functions as a mutually exclusive button.',
39
35
  },
40
36
  };
41
37
  var SegmentedControlStory = function (_a) {
@@ -1 +1 @@
1
- {"version":3,"file":"index.stories.js","sources":["../../../../../src/lib/components/segmentedControl/index.stories.tsx"],"sourcesContent":["import { useState } from 'react';\nimport { SegmentedControl, SegmentedControlProps } from '.';\n\nconst story = {\n title: 'JSX/SegmentedControl',\n component: SegmentedControl,\n argTypes: {\n values: {\n description: 'Array containing the text that needs to be displayed',\n table: {\n type: { \n summary: 'string[] OR { title: string; subtitle: string;}[]'\n },\n },\n },\n selectedIndex: {\n description: 'The currently selected index',\n },\n onChange: {\n action: true,\n table: {\n category: \"Callbacks\",\n },\n },\n },\n args: {\n values: ['Earth', 'Sun', 'Moon'],\n selectedIndex: 0,\n },\n parameters: {\n docs: {\n description: {\n component: 'A segmented control is a linear set of two or more segments, each of which functions as a mutually exclusive button.',\n },\n },\n },\n};\n\nexport const SegmentedControlStory = ({\n onChange,\n selectedIndex,\n values\n}: SegmentedControlProps) => {\n const [index, setIndex] = useState(selectedIndex);\n\n const handleOnChange = (newIndex: number) => {\n onChange?.(newIndex);\n setIndex(newIndex);\n };\n\n return (\n <SegmentedControl\n values={values}\n selectedIndex={index}\n onChange={handleOnChange}\n />\n );\n};\n\nSegmentedControlStory.storyName = \"SegmentedControl\";\n\nexport const SegmentedControlWithSubtitle = ({\n onChange,\n selectedIndex,\n values\n}: SegmentedControlProps) => {\n const [index, setIndex] = useState(selectedIndex);\n\n const handleOnChange = (newIndex: number) => {\n onChange?.(newIndex);\n setIndex(newIndex);\n };\n\n return (\n <SegmentedControl\n values={[\n { title: 'Basic', subtitle: '€288,65' },\n { title: 'Premium', subtitle: '€288,65' },\n ]}\n selectedIndex={index}\n onChange={handleOnChange}\n />\n );\n};\n\nexport default story;\n"],"names":["_jsx"],"mappings":";;;;;;IAGM,KAAK,GAAG;IACZ,KAAK,EAAE,sBAAsB;IAC7B,SAAS,EAAE,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uBAAR,QAAQ,CAAG,QAAQ,CAAC,CAAC;QACrB,QAAQ,CAAC,QAAQ,CAAC,CAAC;KACpB,CAAC;IAEF,QACEA,IAAC,gBAAgB,IACf,MAAM,EAAE;YACN,EAAE,KAAK,EAAE,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE;YACvC,EAAE,KAAK,EAAE,SAAS,EAAE,QAAQ,EAAE,SAAS,EAAE;SAC1C,EACD,aAAa,EAAE,KAAK,EACpB,QAAQ,EAAE,cAAc,WACxB,EACF;AACJ;;;;;"}
1
+ {"version":3,"file":"index.stories.js","sources":["../../../../../src/lib/components/segmentedControl/index.stories.tsx"],"sourcesContent":["import { useState } from 'react';\nimport { SegmentedControl, SegmentedControlProps } from '.';\n\nconst story = {\n title: 'JSX/SegmentedControl',\n component: SegmentedControl,\n argTypes: {\n values: {\n description: 'Array containing the text that needs to be displayed',\n table: {\n type: { \n summary: 'string[] OR { title: string; subtitle: string;}[]'\n },\n },\n },\n selectedIndex: {\n description: 'The currently selected index',\n },\n onChange: {\n action: true,\n table: {\n category: \"Callbacks\",\n },\n },\n },\n args: {\n values: ['Earth', 'Sun', 'Moon'],\n selectedIndex: 0,\n },\n parameters: {\n componentSubtitle: 'A segmented control is a linear set of two or more segments, each of which functions as a mutually exclusive button.',\n },\n};\n\nexport const SegmentedControlStory = ({\n onChange,\n selectedIndex,\n values\n}: SegmentedControlProps) => {\n const [index, setIndex] = useState(selectedIndex);\n\n const handleOnChange = (newIndex: number) => {\n onChange?.(newIndex);\n setIndex(newIndex);\n };\n\n return (\n <SegmentedControl\n values={values}\n selectedIndex={index}\n onChange={handleOnChange}\n />\n );\n};\n\nSegmentedControlStory.storyName = \"SegmentedControl\";\n\nexport const SegmentedControlWithSubtitle = ({\n onChange,\n selectedIndex,\n values\n}: SegmentedControlProps) => {\n const [index, setIndex] = useState(selectedIndex);\n\n const handleOnChange = (newIndex: number) => {\n onChange?.(newIndex);\n setIndex(newIndex);\n };\n\n return (\n <SegmentedControl\n values={[\n { title: 'Basic', subtitle: '€288,65' },\n { title: 'Premium', subtitle: '€288,65' },\n ]}\n selectedIndex={index}\n onChange={handleOnChange}\n />\n );\n};\n\nexport default story;\n"],"names":["_jsx"],"mappings":";;;;;;IAGM,KAAK,GAAG;IACZ,KAAK,EAAE,sBAAsB;IAC7B,SAAS,EAAE,gBAAgB;IAC3B,QAAQ,EAAE;QACR,MAAM,EAAE;YACN,WAAW,EAAE,sDAAsD;YACnE,KAAK,EAAE;gBACL,IAAI,EAAE;oBACJ,OAAO,EAAE,mDAAmD;iBAC7D;aACF;SACF;QACD,aAAa,EAAE;YACb,WAAW,EAAE,8BAA8B;SAC5C;QACD,QAAQ,EAAE;YACR,MAAM,EAAE,IAAI;YACZ,KAAK,EAAE;gBACL,QAAQ,EAAE,WAAW;aACtB;SACF;KACF;IACD,IAAI,EAAE;QACJ,MAAM,EAAE,CAAC,OAAO,EAAE,KAAK,EAAE,MAAM,CAAC;QAChC,aAAa,EAAE,CAAC;KACjB;IACD,UAAU,EAAE;QACV,iBAAiB,EAAE,sHAAsH;KAC1I;EACD;IAEW,qBAAqB,GAAG,UAAC,EAId;QAHtB,QAAQ,cAAA,EACR,aAAa,mBAAA,EACb,MAAM,YAAA;IAEA,IAAA,KAAoB,QAAQ,CAAC,aAAa,CAAC,EAA1C,KAAK,QAAA,EAAE,QAAQ,QAA2B,CAAC;IAElD,IAAM,cAAc,GAAG,UAAC,QAAgB;QACtC,QAAQ,aAAR,QAAQ,uBAAR,QAAQ,CAAG,QAAQ,CAAC,CAAC;QACrB,QAAQ,CAAC,QAAQ,CAAC,CAAC;KACpB,CAAC;IAEF,QACEA,IAAC,gBAAgB,IACf,MAAM,EAAE,MAAM,EACd,aAAa,EAAE,KAAK,EACpB,QAAQ,EAAE,cAAc,WACxB,EACF;AACJ,EAAE;AAEF,qBAAqB,CAAC,SAAS,GAAG,kBAAkB,CAAC;IAExC,4BAA4B,GAAG,UAAC,EAIrB;QAHtB,QAAQ,cAAA,EACR,aAAa,mBAAA;IAGP,IAAA,KAAoB,QAAQ,CAAC,aAAa,CAAC,EAA1C,KAAK,QAAA,EAAE,QAAQ,QAA2B,CAAC;IAElD,IAAM,cAAc,GAAG,UAAC,QAAgB;QACtC,QAAQ,aAAR,QAAQ,uBAAR,QAAQ,CAAG,QAAQ,CAAC,CAAC;QACrB,QAAQ,CAAC,QAAQ,CAAC,CAAC;KACpB,CAAC;IAEF,QACEA,IAAC,gBAAgB,IACf,MAAM,EAAE;YACN,EAAE,KAAK,EAAE,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE;YACvC,EAAE,KAAK,EAAE,SAAS,EAAE,QAAQ,EAAE,SAAS,EAAE;SAC1C,EACD,aAAa,EAAE,KAAK,EACpB,QAAQ,EAAE,cAAc,WACxB,EACF;AACJ;;;;;"}
@@ -0,0 +1,13 @@
1
+ var images = {
2
+ aid: 'https://assets.cdn.feather-insurance.com/assets/images/aid.svg',
3
+ bed: 'https://assets.cdn.feather-insurance.com/assets/images/bed.svg',
4
+ bigDog: 'https://assets.cdn.feather-insurance.com/assets/images/bigDog.svg',
5
+ brokenAquarium: 'https://assets.cdn.feather-insurance.com/assets/images/brokenAquarium.svg',
6
+ brokenGlass: 'https://assets.cdn.feather-insurance.com/assets/images/brokenGlass.svg',
7
+ damagedLaptop: 'https://assets.cdn.feather-insurance.com/assets/images/damagedLaptop.svg',
8
+ moneyIncome: 'https://assets.cdn.feather-insurance.com/assets/images/moneyIncome.svg',
9
+ washingMachine: 'https://assets.cdn.feather-insurance.com/assets/images/washingMachine.svg',
10
+ };
11
+
12
+ export { images as i };
13
+ //# sourceMappingURL=index-db2e797f.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index-db2e797f.js","sources":["../../../src/lib/util/images/index.ts"],"sourcesContent":["const images = {\n aid: 'https://assets.cdn.feather-insurance.com/assets/images/aid.svg',\n bed: 'https://assets.cdn.feather-insurance.com/assets/images/bed.svg',\n bigDog: 'https://assets.cdn.feather-insurance.com/assets/images/bigDog.svg',\n brokenAquarium: 'https://assets.cdn.feather-insurance.com/assets/images/brokenAquarium.svg',\n brokenGlass: 'https://assets.cdn.feather-insurance.com/assets/images/brokenGlass.svg',\n damagedLaptop: 'https://assets.cdn.feather-insurance.com/assets/images/damagedLaptop.svg',\n moneyIncome: 'https://assets.cdn.feather-insurance.com/assets/images/moneyIncome.svg',\n washingMachine: 'https://assets.cdn.feather-insurance.com/assets/images/washingMachine.svg',\n} as const;\n\nexport { images };"],"names":[],"mappings":"IAAM,MAAM,GAAG;IACb,GAAG,EAAE,gEAAgE;IACrE,GAAG,EAAE,gEAAgE;IACrE,MAAM,EAAE,mEAAmE;IAC3E,cAAc,EAAE,2EAA2E;IAC3F,WAAW,EAAE,wEAAwE;IACrF,aAAa,EAAE,0EAA0E;IACzF,WAAW,EAAE,wEAAwE;IACrF,cAAc,EAAE,2EAA2E;;;;;"}
@@ -1,2 +1,2 @@
1
- export { DateSelector, SignaturePad, AutocompleteAddress, Input, MultiDropzone, IbanInput, CurrencyInput, BottomModal, RegularModal, BottomOrRegularModal, CardWithTopLeftIcon, CardWithLeftIcon, CardWithTopIcon, InfoCard, CardButton, Button, AutoSuggestMultiSelect, Chip, AutoSuggestInput, ComparisonTable, TableRating, TableTrueFalse, TableRowHeader, TableButton, TableInfoButton, SegmentedControl, DownloadButton, Markdown, } from './lib';
2
- export type { DownloadStatus, FileType, MultiDropzoneProps, TableHeader, UploadedFile, UploadStatus } from './lib';
1
+ export { DateSelector, SignaturePad, AutocompleteAddress, Input, MultiDropzone, IbanInput, CurrencyInput, BottomModal, RegularModal, BottomOrRegularModal, CardWithTopLeftIcon, CardWithLeftIcon, CardWithTopIcon, InfoCard, CardButton, Button, AutoSuggestMultiSelect, Chip, AutoSuggestInput, ComparisonTable, TableRating, TableTrueFalse, TableRowHeader, TableButton, TableInfoButton, SegmentedControl, DownloadButton, Markdown, images } from './lib';
2
+ export type { DownloadStatus, FileType, MultiDropzoneProps, TableHeader, UploadedFile, UploadStatus, } from './lib';
package/dist/esm/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  export { default as DateSelector } from './components/dateSelector/index.js';
2
2
  export { default as SignaturePad } from './components/signaturePad/index.js';
3
- export { default as AutocompleteAddress } from './components/autocompleteAddress/index.js';
3
+ export { AutocompleteAddress } from './components/autocompleteAddress/index.js';
4
4
  export { default as Input } from './components/input/index.js';
5
5
  export { default as MultiDropzone } from './components/multiDropzone/index.js';
6
6
  export { default as DownloadButton } from './components/downloadButton/index.js';
@@ -18,6 +18,7 @@ export { default as AutoSuggestInput } from './components/input/autoSuggestInput
18
18
  export { ComparisonTable } from './components/comparisonTable/index.js';
19
19
  export { SegmentedControl } from './components/segmentedControl/index.js';
20
20
  export { default as Markdown } from './components/markdown/index.js';
21
+ export { i as images } from './index-db2e797f.js';
21
22
  export { default as TableRating } from './components/comparisonTable/components/TableRating/index.js';
22
23
  export { default as TableTrueFalse } from './components/comparisonTable/components/TableTrueFalse.js';
23
24
  export { default as TableRowHeader } from './components/comparisonTable/components/TableRowHeader/index.js';
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -1,19 +1,20 @@
1
1
  import { Address } from '@popsure/public-models';
2
- declare const AutoCompleteAddress: ({ apiKey, address: initialAddress, onAddressChange, placeholders, manualAddressEntryTexts, }: {
2
+ export interface AutocompleteAddressProps {
3
3
  apiKey: string;
4
- address?: Partial<Address> | undefined;
4
+ address?: Partial<Address>;
5
5
  onAddressChange: (address: Partial<Address>) => void;
6
6
  placeholders?: {
7
- manualAddressEntry?: string | undefined;
8
- street?: string | undefined;
9
- houseNumber?: string | undefined;
10
- additionalInformation?: string | undefined;
11
- postcode?: string | undefined;
12
- city?: string | undefined;
13
- } | undefined;
7
+ manualAddressEntry?: string;
8
+ street?: string;
9
+ houseNumber?: string;
10
+ additionalInformation?: string;
11
+ postcode?: string;
12
+ city?: string;
13
+ };
14
14
  manualAddressEntryTexts?: {
15
- preText?: string | undefined;
16
- cta?: string | undefined;
17
- } | undefined;
18
- }) => JSX.Element;
19
- export default AutoCompleteAddress;
15
+ preText?: string;
16
+ cta?: string;
17
+ };
18
+ }
19
+ declare const AutocompleteAddress: ({ apiKey, address: initialAddress, onAddressChange, placeholders, manualAddressEntryTexts, }: AutocompleteAddressProps) => JSX.Element;
20
+ export { AutocompleteAddress };
@@ -0,0 +1,66 @@
1
+ import { AutocompleteAddressProps } from '.';
2
+ declare const story: {
3
+ title: string;
4
+ component: ({ apiKey, address: initialAddress, onAddressChange, placeholders, manualAddressEntryTexts, }: AutocompleteAddressProps) => JSX.Element;
5
+ argTypes: {
6
+ address: {
7
+ description: string;
8
+ table: {
9
+ type: {
10
+ summary: string;
11
+ };
12
+ };
13
+ };
14
+ apiKey: {
15
+ defaultValue: string;
16
+ description: string;
17
+ table: {
18
+ type: {
19
+ summary: string;
20
+ };
21
+ };
22
+ };
23
+ onAddressChange: {
24
+ description: string;
25
+ action: boolean;
26
+ table: {
27
+ category: string;
28
+ };
29
+ };
30
+ manualAddressEntryTexts: {
31
+ description: string;
32
+ table: {
33
+ type: {
34
+ summary: string;
35
+ };
36
+ };
37
+ };
38
+ placeholders: {
39
+ description: string;
40
+ table: {
41
+ type: {
42
+ summary: string;
43
+ };
44
+ };
45
+ };
46
+ };
47
+ parameters: {
48
+ componentSubtitle: string;
49
+ docs: {
50
+ description: {
51
+ component: string;
52
+ };
53
+ };
54
+ customTypes: {
55
+ Address: string;
56
+ };
57
+ };
58
+ };
59
+ export declare const AutocompleteAddressStory: {
60
+ ({ address: defaultAddress, apiKey, manualAddressEntryTexts, onAddressChange, placeholders, }: AutocompleteAddressProps): JSX.Element;
61
+ storyName: string;
62
+ };
63
+ export declare const WithAddress: ({ apiKey, onAddressChange, placeholders, }: AutocompleteAddressProps) => JSX.Element;
64
+ export declare const WithLocalisationEntryText: ({ apiKey, onAddressChange, }: AutocompleteAddressProps) => JSX.Element;
65
+ export declare const WithLocalisationPlaceholders: ({ apiKey, onAddressChange, }: AutocompleteAddressProps) => JSX.Element;
66
+ export default story;
@@ -26,11 +26,7 @@ declare const story: {
26
26
  selectedIndex: number;
27
27
  };
28
28
  parameters: {
29
- docs: {
30
- description: {
31
- component: string;
32
- };
33
- };
29
+ componentSubtitle: string;
34
30
  };
35
31
  };
36
32
  export declare const SegmentedControlStory: {
@@ -1,6 +1,6 @@
1
1
  import DateSelector from './components/dateSelector';
2
2
  import SignaturePad from './components/signaturePad';
3
- import AutocompleteAddress from './components/autocompleteAddress';
3
+ import { AutocompleteAddress } from './components/autocompleteAddress';
4
4
  import Input from './components/input';
5
5
  import MultiDropzone, { FileType, MultiDropzoneProps, UploadedFile, UploadStatus } from './components/multiDropzone';
6
6
  import DownloadButton from './components/downloadButton';
@@ -15,6 +15,7 @@ import AutoSuggestInput from './components/input/autoSuggestInput';
15
15
  import { ComparisonTable, TableRating, TableTrueFalse, TableRowHeader, TableButton, TableInfoButton, TableHeader } from './components/comparisonTable';
16
16
  import { SegmentedControl } from './components/segmentedControl';
17
17
  import Markdown from './components/markdown';
18
- export { DateSelector, SignaturePad, AutocompleteAddress, Input, MultiDropzone, DownloadButton, IbanInput, BottomModal, RegularModal, BottomOrRegularModal, CardWithTopLeftIcon, CardWithLeftIcon, CardWithTopIcon, InfoCard, CardButton, Button, CurrencyInput, AutoSuggestMultiSelect, Chip, AutoSuggestInput, ComparisonTable, TableRating, TableTrueFalse, TableRowHeader, TableButton, TableInfoButton, SegmentedControl, Markdown, };
18
+ import { images } from './util/images';
19
+ export { DateSelector, SignaturePad, AutocompleteAddress, Input, MultiDropzone, DownloadButton, IbanInput, BottomModal, RegularModal, BottomOrRegularModal, CardWithTopLeftIcon, CardWithLeftIcon, CardWithTopIcon, InfoCard, CardButton, Button, CurrencyInput, AutoSuggestMultiSelect, Chip, AutoSuggestInput, ComparisonTable, TableRating, TableTrueFalse, TableRowHeader, TableButton, TableInfoButton, SegmentedControl, Markdown, images, };
19
20
  export type { FileType, MultiDropzoneProps, TableHeader, UploadedFile, UploadStatus };
20
21
  export type { DownloadStatus } from './models/download';
@@ -0,0 +1,11 @@
1
+ declare const images: {
2
+ readonly aid: "https://assets.cdn.feather-insurance.com/assets/images/aid.svg";
3
+ readonly bed: "https://assets.cdn.feather-insurance.com/assets/images/bed.svg";
4
+ readonly bigDog: "https://assets.cdn.feather-insurance.com/assets/images/bigDog.svg";
5
+ readonly brokenAquarium: "https://assets.cdn.feather-insurance.com/assets/images/brokenAquarium.svg";
6
+ readonly brokenGlass: "https://assets.cdn.feather-insurance.com/assets/images/brokenGlass.svg";
7
+ readonly damagedLaptop: "https://assets.cdn.feather-insurance.com/assets/images/damagedLaptop.svg";
8
+ readonly moneyIncome: "https://assets.cdn.feather-insurance.com/assets/images/moneyIncome.svg";
9
+ readonly washingMachine: "https://assets.cdn.feather-insurance.com/assets/images/washingMachine.svg";
10
+ };
11
+ export { images };
@@ -0,0 +1,12 @@
1
+ declare const story: {
2
+ title: string;
3
+ parameters: {
4
+ docs: {
5
+ description: {
6
+ component: string;
7
+ };
8
+ };
9
+ };
10
+ };
11
+ export declare const Images: () => JSX.Element;
12
+ export default story;
@@ -0,0 +1,23 @@
1
+ import { _ as __assign } from '../../tslib.es6-5bc94358.js';
2
+ import { jsx, jsxs } from 'react/jsx-runtime';
3
+ import { i as images } from '../../index-db2e797f.js';
4
+
5
+ var story = {
6
+ title: 'Utils/Images',
7
+ parameters: {
8
+ docs: {
9
+ description: {
10
+ component: 'Use the `images` object export to access our list of available images.',
11
+ },
12
+ },
13
+ }
14
+ };
15
+ var Images = function () { return (jsx("div", __assign({ className: 'd-flex gap8 f-wrap' }, { children: Object.entries(images).map(function (_a) {
16
+ var key = _a[0], value = _a[1];
17
+ return (jsxs("div", __assign({ className: "ws3 d-flex fd-column ai-center br4 p24 pt16 pb16 bg-grey-100" }, { children: [jsx("span", __assign({ className: 'p-p--small mb8' }, { children: key }), void 0),
18
+ jsx("img", { alt: key, src: value }, void 0)] }), key));
19
+ }) }), void 0)); };
20
+
21
+ export default story;
22
+ export { Images };
23
+ //# sourceMappingURL=index.stories.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.stories.js","sources":["../../../../../src/lib/util/images/index.stories.tsx"],"sourcesContent":["import { images } from \"../../util/images\";\n\nconst story = {\n title: 'Utils/Images',\n parameters: {\n docs: {\n description: {\n component: 'Use the `images` object export to access our list of available images.',\n },\n },\n }\n};\n\n\nexport const Images = () => (\n <div className='d-flex gap8 f-wrap'>\n {Object.entries(images).map(([key, value]) => (\n <div key={key} className=\"ws3 d-flex fd-column ai-center br4 p24 pt16 pb16 bg-grey-100\">\n <span className='p-p--small mb8'>{key}</span>\n \n <img alt={key} src={value} />\n </div>\n ))}\n </div>\n);\n\nexport default story;\n"],"names":["_jsx","_jsxs"],"mappings":";;;;IAEM,KAAK,GAAG;IACZ,KAAK,EAAE,cAAc;IACrB,UAAU,EAAE;QACV,IAAI,EAAE;YACJ,WAAW,EAAE;gBACX,SAAS,EAAE,wEAAwE;aACpF;SACF;KACF;EACD;IAGW,MAAM,GAAG,cAAM,QAC1BA,sBAAK,SAAS,EAAC,oBAAoB,gBAChC,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,GAAG,CAAC,UAAC,EAAY;YAAX,GAAG,QAAA,EAAE,KAAK,QAAA;QAAM,QAC5CC,uBAAe,SAAS,EAAC,8DAA8D,iBACrFD,uBAAM,SAAS,EAAC,gBAAgB,gBAAE,GAAG,YAAQ;gBAE7CA,aAAK,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,KAAK,WAAI,MAHrB,GAAG,CAIP;KACP,CAAC,YACE;;;;;"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@popsure/dirty-swan",
3
- "version": "0.31.2",
3
+ "version": "0.32.0",
4
4
  "author": "Vincent Audoire <vincent@getpopsure.com>",
5
5
  "license": "MIT",
6
6
  "private": false,
package/src/index.tsx CHANGED
@@ -30,6 +30,7 @@ export {
30
30
  SegmentedControl,
31
31
  DownloadButton,
32
32
  Markdown,
33
+ images
33
34
  } from './lib';
34
35
 
35
36
  export type {
@@ -38,7 +39,7 @@ export type {
38
39
  MultiDropzoneProps,
39
40
  TableHeader,
40
41
  UploadedFile,
41
- UploadStatus
42
+ UploadStatus,
42
43
  } from './lib';
43
44
 
44
45
  ReactDOM.render(<App />, document.getElementById('root'));
@@ -0,0 +1,147 @@
1
+ import { Address } from '@popsure/public-models';
2
+ import { useState } from 'react';
3
+ import { AutocompleteAddress, AutocompleteAddressProps } from '.';
4
+
5
+ const story = {
6
+ title: 'JSX/AutocompleteAddress',
7
+ component: AutocompleteAddress,
8
+ argTypes: {
9
+ address: {
10
+ description: 'The address properties',
11
+ table: {
12
+ type: {
13
+ summary: 'Partial<Address>'
14
+ },
15
+ },
16
+ },
17
+ apiKey: {
18
+ defaultValue: 'AIzaSyDg0DSrjYKt5smmsjkVasDz7c4T5rbOXT8',
19
+ description: 'Your private API key for the [Google Places API](https://developers.google.com/maps/documentation/places/web-service/overview)',
20
+ table: {
21
+ type: {
22
+ summary: 'Partial<Address>'
23
+ },
24
+ },
25
+ },
26
+ onAddressChange: {
27
+ description: 'Callback with the updated address, this function will get called everytime the address gets updated',
28
+ action: true,
29
+ table: {
30
+ category: "Callbacks",
31
+ },
32
+ },
33
+ manualAddressEntryTexts: {
34
+ description: 'The CTA that enables manual address entry and the text preceding it',
35
+ table: {
36
+ type: {
37
+ summary: '{ preText?: string; cta: string?; }'
38
+ }
39
+ }
40
+ },
41
+ placeholders: {
42
+ description: 'Placeholder text',
43
+ table: {
44
+ type: {
45
+ summary: '{ manualAddressEntry?: string; street: string?; houseNumber?: string; additionalInformation?: string; postcode?: string; city?: string; }'
46
+ }
47
+ }
48
+ }
49
+ },
50
+ parameters: {
51
+ componentSubtitle: 'Autocomplete Address are user interface elements which allow users start typing an address and get autocompletion suggestions on the address.',
52
+ docs: {
53
+ description: {
54
+ component: 'This component is for now only restricted to "address" types and will restrict every query to Germany.',
55
+ },
56
+ },
57
+ customTypes: {
58
+ Address: `interface Address {
59
+ street: string;
60
+ houseNumber: string;
61
+ postcode: string;
62
+ city: string;
63
+ additionalInformation?: string;
64
+ country: string;
65
+ }`
66
+ }
67
+ },
68
+ };
69
+
70
+ export const AutocompleteAddressStory = ({
71
+ address: defaultAddress,
72
+ apiKey,
73
+ manualAddressEntryTexts,
74
+ onAddressChange,
75
+ placeholders,
76
+ }: AutocompleteAddressProps) => {
77
+ const [address, setAddress] = useState<Partial<Address> | undefined>(defaultAddress);
78
+ const handleOnAddressChange = (newAddress: Partial<Address>) => {
79
+ onAddressChange(newAddress);
80
+ setAddress(newAddress);
81
+ };
82
+
83
+ return (
84
+ <AutocompleteAddress
85
+ address={address}
86
+ apiKey={apiKey}
87
+ manualAddressEntryTexts={manualAddressEntryTexts}
88
+ onAddressChange={handleOnAddressChange}
89
+ placeholders={placeholders}
90
+ />
91
+ );
92
+ };
93
+
94
+ AutocompleteAddressStory.storyName = "AutocompleteAddress";
95
+
96
+ export const WithAddress = ({
97
+ apiKey,
98
+ onAddressChange,
99
+ placeholders,
100
+ }: AutocompleteAddressProps) => (
101
+ <AutocompleteAddress
102
+ address={{
103
+ street: 'Lohmuehlenstraße',
104
+ houseNumber: '65',
105
+ city: 'Berlin',
106
+ country: 'DE',
107
+ additionalInformation: 'c/o Factory',
108
+ }}
109
+ apiKey={apiKey}
110
+ onAddressChange={onAddressChange}
111
+ />
112
+ );
113
+
114
+ export const WithLocalisationEntryText = ({
115
+ apiKey,
116
+ onAddressChange,
117
+ }: AutocompleteAddressProps) => (
118
+ <AutocompleteAddress
119
+ apiKey={apiKey}
120
+ manualAddressEntryTexts={{
121
+ preText: 'Oder ',
122
+ cta: 'Adresse direkt eingeben',
123
+ }}
124
+ onAddressChange={onAddressChange}
125
+ />
126
+ );
127
+
128
+ export const WithLocalisationPlaceholders = ({
129
+ apiKey,
130
+ onAddressChange,
131
+ }: AutocompleteAddressProps) => (
132
+ <AutocompleteAddress
133
+ address={{}}
134
+ apiKey={apiKey}
135
+ placeholders={{
136
+ manualAddressEntry: 'Adresse suchen',
137
+ street: 'Straße',
138
+ houseNumber: 'Hausnummer',
139
+ additionalInformation: 'Adresszusatz (c/o, z.Hd., o.V.i.A, ...)',
140
+ postcode: 'PLZ',
141
+ city: 'Stadt',
142
+ }}
143
+ onAddressChange={onAddressChange}
144
+ />
145
+ );
146
+
147
+ export default story;
@@ -1,7 +1,7 @@
1
1
  import { Address } from '@popsure/public-models';
2
2
  import { fireEvent, render } from '../../util/testUtils';
3
3
 
4
- import AutoCompleteAddress from '.';
4
+ import { AutocompleteAddress } from '.';
5
5
 
6
6
  const address = {
7
7
  street: 'Köpeniker Strasse',
@@ -16,7 +16,7 @@ const setup = (
16
16
  onAddressChange: (address: Partial<Address>) => void = () => {}
17
17
  ) => {
18
18
  return render(
19
- <AutoCompleteAddress
19
+ <AutocompleteAddress
20
20
  address={address}
21
21
  apiKey={''}
22
22
  onAddressChange={onAddressChange}