@popsure/dirty-swan 0.58.2 → 0.58.4

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 (39) hide show
  1. package/dist/cjs/index.js +66 -60
  2. package/dist/cjs/index.js.map +1 -1
  3. package/dist/cjs/lib/components/multiDropzone/index.stories.d.ts +9 -0
  4. package/dist/cjs/lib/components/multiDropzone/types.d.ts +3 -2
  5. package/dist/esm/{TableSection-ebace923.js → TableSection-f41d4248.js} +4 -60
  6. package/dist/esm/TableSection-f41d4248.js.map +1 -0
  7. package/dist/esm/components/input/index.js +1 -1
  8. package/dist/esm/components/multiDropzone/index.js +9 -2
  9. package/dist/esm/components/multiDropzone/index.js.map +1 -1
  10. package/dist/esm/components/multiDropzone/index.stories.js +22 -7
  11. package/dist/esm/components/multiDropzone/index.stories.js.map +1 -1
  12. package/dist/esm/components/multiDropzone/index.test.js +1 -0
  13. package/dist/esm/components/multiDropzone/index.test.js.map +1 -1
  14. package/dist/esm/components/table/Table.js +2 -1
  15. package/dist/esm/components/table/Table.js.map +1 -1
  16. package/dist/esm/components/table/Table.stories.js +2 -1
  17. package/dist/esm/components/table/Table.stories.js.map +1 -1
  18. package/dist/esm/components/table/Table.test.js +2 -1
  19. package/dist/esm/components/table/Table.test.js.map +1 -1
  20. package/dist/esm/components/table/components/TableContents/TableContents.js +2 -1
  21. package/dist/esm/components/table/components/TableContents/TableContents.js.map +1 -1
  22. package/dist/esm/components/table/components/TableContents/TableContents.test.js +2 -1
  23. package/dist/esm/components/table/components/TableContents/TableContents.test.js.map +1 -1
  24. package/dist/esm/components/table/components/TableSection/TableSection.js +2 -1
  25. package/dist/esm/components/table/components/TableSection/TableSection.js.map +1 -1
  26. package/dist/esm/components/table/components/TableSection/TableSection.test.js +2 -1
  27. package/dist/esm/components/table/components/TableSection/TableSection.test.js.map +1 -1
  28. package/dist/esm/index.js +2 -1
  29. package/dist/esm/index.js.map +1 -1
  30. package/dist/esm/lib/components/multiDropzone/index.stories.d.ts +9 -0
  31. package/dist/esm/lib/components/multiDropzone/types.d.ts +3 -2
  32. package/dist/esm/useMediaQuery-1a3a2432.js +61 -0
  33. package/dist/esm/useMediaQuery-1a3a2432.js.map +1 -0
  34. package/package.json +1 -1
  35. package/src/lib/components/input/style.module.scss +4 -0
  36. package/src/lib/components/multiDropzone/index.stories.tsx +49 -19
  37. package/src/lib/components/multiDropzone/index.tsx +13 -1
  38. package/src/lib/components/multiDropzone/types.ts +19 -18
  39. package/dist/esm/TableSection-ebace923.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"TableSection.test.js","sources":["../../../../../../../src/lib/components/table/components/TableSection/TableSection.test.tsx"],"sourcesContent":["import { render, screen } from '../../../../util/testUtils';\nimport { TableSection, TableSectionProps } from './TableSection';\n\nconst tableCellRows: TableSectionProps['tableCellRows'] = [\n [{ text: 'Cell 1.1' }, { text: 'Cell 1.2' }, { text: 'Cell 1.3' }],\n [{ text: 'Cell 2.1' }, { text: 'Cell 2.2' }, { text: 'Cell 2.3' }],\n];\n\nconst mockTitle = 'Test Table';\n\nconst mockOpenModal = jest.fn();\n\nconst defaultProps: TableSectionProps = {\n tableCellRows,\n title: mockTitle,\n openModal: mockOpenModal,\n};\n\ndescribe('TableSection', () => {\n it('renders the table caption', () => {\n render(<TableSection {...defaultProps} />);\n\n expect(screen.getByText(mockTitle)).toBeInTheDocument();\n });\n\n it('renders the table with correct data', () => {\n render(<TableSection {...defaultProps} />);\n\n expect(screen.getByText('Cell 1.1')).toBeInTheDocument();\n expect(screen.getByText('Cell 1.2')).toBeInTheDocument();\n expect(screen.getByText('Cell 1.3')).toBeInTheDocument();\n\n expect(screen.getByText('Cell 2.1')).toBeInTheDocument();\n expect(screen.getByText('Cell 2.2')).toBeInTheDocument();\n expect(screen.getByText('Cell 2.3')).toBeInTheDocument();\n });\n\n it('should render table headers', () => {\n const { container } = render(<TableSection {...defaultProps} />);\n\n const thElements = container.querySelectorAll('th');\n\n expect(thElements.length).toBe(4);\n expect(thElements[0]).toHaveTextContent('Cell 1.1');\n expect(thElements[3]).toHaveTextContent('Cell 2.1');\n });\n\n it('should render table data cells', () => {\n const { container } = render(<TableSection {...defaultProps} />);\n\n const tdElements = container.querySelectorAll('td');\n expect(tdElements.length).toBe(2);\n expect(tdElements[0]).toHaveTextContent('Cell 2.2');\n expect(tdElements[1]).toHaveTextContent('Cell 2.3');\n });\n});\n"],"names":["render","_jsx"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAGA,IAAM,aAAa,GAAuC;IACxD,CAAC,EAAE,IAAI,EAAE,UAAU,EAAE,EAAE,EAAE,IAAI,EAAE,UAAU,EAAE,EAAE,EAAE,IAAI,EAAE,UAAU,EAAE,CAAC;IAClE,CAAC,EAAE,IAAI,EAAE,UAAU,EAAE,EAAE,EAAE,IAAI,EAAE,UAAU,EAAE,EAAE,EAAE,IAAI,EAAE,UAAU,EAAE,CAAC;CACnE,CAAC;AAEF,IAAM,SAAS,GAAG,YAAY,CAAC;AAE/B,IAAM,aAAa,GAAG,IAAI,CAAC,EAAE,EAAE,CAAC;AAEhC,IAAM,YAAY,GAAsB;IACtC,aAAa,eAAA;IACb,KAAK,EAAE,SAAS;IAChB,SAAS,EAAE,aAAa;CACzB,CAAC;AAEF,QAAQ,CAAC,cAAc,EAAE;IACvB,EAAE,CAAC,2BAA2B,EAAE;QAC9BA,YAAM,CAACC,IAAC,YAAY,eAAK,YAAY,EAAI,CAAC,CAAC;QAE3C,MAAM,CAAC,MAAM,CAAC,SAAS,CAAC,SAAS,CAAC,CAAC,CAAC,iBAAiB,EAAE,CAAC;KACzD,CAAC,CAAC;IAEH,EAAE,CAAC,qCAAqC,EAAE;QACxCD,YAAM,CAACC,IAAC,YAAY,eAAK,YAAY,EAAI,CAAC,CAAC;QAE3C,MAAM,CAAC,MAAM,CAAC,SAAS,CAAC,UAAU,CAAC,CAAC,CAAC,iBAAiB,EAAE,CAAC;QACzD,MAAM,CAAC,MA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UAAU,CAAC,CAAC;QACpD,MAAM,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,CAAC,iBAAiB,CAAC,UAAU,CAAC,CAAC;KACrD,CAAC,CAAC;AACL,CAAC,CAAC"}
1
+ {"version":3,"file":"TableSection.test.js","sources":["../../../../../../../src/lib/components/table/components/TableSection/TableSection.test.tsx"],"sourcesContent":["import { render, screen } from '../../../../util/testUtils';\nimport { TableSection, TableSectionProps } from './TableSection';\n\nconst tableCellRows: TableSectionProps['tableCellRows'] = [\n [{ text: 'Cell 1.1' }, { text: 'Cell 1.2' }, { text: 'Cell 1.3' }],\n [{ text: 'Cell 2.1' }, { text: 'Cell 2.2' }, { text: 'Cell 2.3' }],\n];\n\nconst mockTitle = 'Test Table';\n\nconst mockOpenModal = jest.fn();\n\nconst defaultProps: TableSectionProps = {\n tableCellRows,\n title: mockTitle,\n openModal: mockOpenModal,\n};\n\ndescribe('TableSection', () => {\n it('renders the table caption', () => {\n render(<TableSection {...defaultProps} />);\n\n expect(screen.getByText(mockTitle)).toBeInTheDocument();\n });\n\n it('renders the table with correct data', () => {\n render(<TableSection {...defaultProps} />);\n\n expect(screen.getByText('Cell 1.1')).toBeInTheDocument();\n expect(screen.getByText('Cell 1.2')).toBeInTheDocument();\n expect(screen.getByText('Cell 1.3')).toBeInTheDocument();\n\n expect(screen.getByText('Cell 2.1')).toBeInTheDocument();\n expect(screen.getByText('Cell 2.2')).toBeInTheDocument();\n expect(screen.getByText('Cell 2.3')).toBeInTheDocument();\n });\n\n it('should render table headers', () => {\n const { container } = render(<TableSection {...defaultProps} />);\n\n const thElements = container.querySelectorAll('th');\n\n expect(thElements.length).toBe(4);\n expect(thElements[0]).toHaveTextContent('Cell 1.1');\n expect(thElements[3]).toHaveTextContent('Cell 2.1');\n });\n\n it('should render table data cells', () => {\n const { container } = render(<TableSection {...defaultProps} />);\n\n const tdElements = container.querySelectorAll('td');\n expect(tdElements.length).toBe(2);\n expect(tdElements[0]).toHaveTextContent('Cell 2.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
31
  export { Accordion } from './components/accordion/index.js';
32
32
  export { Table } from './components/table/Table.js';
33
33
  import { useCallback, useEffect } from 'react';
34
- export { u as useMediaQuery } from './TableSection-ebace923.js';
34
+ export { u as useMediaQuery } from './useMediaQuery-1a3a2432.js';
35
35
  export { u as useOnClickOutside } from './Calendar-2d7e51b5.js';
36
36
  export { default as Svg1Icon } from './components/icon/icons/1.js';
37
37
  export { default as Svg2Icon } from './components/icon/icons/2.js';
@@ -449,6 +449,7 @@ import './components/table/components/IconRenderer/IconRenderer.js';
449
449
  import './components/table/components/TableCell/CardCell/CardCell.js';
450
450
  import './components/table/components/TableCell/ButtonCell/ButtonCell.js';
451
451
  import './components/table/components/TableContents/TableContents.js';
452
+ import './TableSection-f41d4248.js';
452
453
  import './components/table/components/TableContents/Collapsible.js';
453
454
  import './useTableNavigation-f929fbc9.js';
454
455
  import './components/table/components/TableControls/TableControls.js';
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["../../../src/lib/hooks/useEscapeKey.ts","../../../src/lib/hooks/useFocusWithin.ts"],"sourcesContent":["import { useCallback, useEffect } from 'react';\n\nexport const useEscapeKey = (callback: () => void) => {\n const handleOnEscape = useCallback(\n (e: KeyboardEvent) => {\n if (e.key === 'Escape') {\n callback();\n }\n },\n [callback]\n );\n\n useEffect(() => {\n window.addEventListener('keydown', handleOnEscape);\n\n return () => window.removeEventListener('keydown', handleOnEscape);\n }, [handleOnEscape]);\n};\n","import { useEffect } from 'react';\n\nexport const useFocusWithin = (\n ref: HTMLElement | null,\n callback: (isFocusWithin: boolean) => void\n) => {\n useEffect(() => {\n const handleOnFocusIn = () => {\n if (!ref) {\n return;\n }\n\n const hasFocus = ref?.contains(document.activeElement);\n\n callback(Boolean(hasFocus));\n };\n\n document.addEventListener('focusin', handleOnFocusIn);\n\n return () => document?.removeEventListener('focusin', handleOnFocusIn);\n }, [callback, ref]);\n};\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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;QAEF,QAAQ,CAAC,gBAAgB,CAAC,SAAS,EAAE,eAAe,CAAC,CAAC;QAEtD,OAAO,cAAM,OAAA,QAAQ,aAAR,QAAQ,uBAAR,QAAQ,CAAE,mBAAmB,CAAC,SAAS,EAAE,eAAe,CAAC,GAAA,CAAC;KACxE,EAAE,CAAC,QAAQ,EAAE,GAAG,CAAC,CAAC,CAAC;AACtB;;;;"}
1
+ {"version":3,"file":"index.js","sources":["../../../src/lib/hooks/useEscapeKey.ts","../../../src/lib/hooks/useFocusWithin.ts"],"sourcesContent":["import { useCallback, useEffect } from 'react';\n\nexport const useEscapeKey = (callback: () => void) => {\n const handleOnEscape = useCallback(\n (e: KeyboardEvent) => {\n if (e.key === 'Escape') {\n callback();\n }\n },\n [callback]\n );\n\n useEffect(() => {\n window.addEventListener('keydown', handleOnEscape);\n\n return () => window.removeEventListener('keydown', handleOnEscape);\n }, [handleOnEscape]);\n};\n","import { useEffect } from 'react';\n\nexport const useFocusWithin = (\n ref: HTMLElement | null,\n callback: (isFocusWithin: boolean) => void\n) => {\n useEffect(() => {\n const handleOnFocusIn = () => {\n if (!ref) {\n return;\n }\n\n const hasFocus = ref?.contains(document.activeElement);\n\n callback(Boolean(hasFocus));\n };\n\n document.addEventListener('focusin', handleOnFocusIn);\n\n return () => document?.removeEventListener('focusin', handleOnFocusIn);\n }, [callback, ref]);\n};\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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lyVideos: () => JSX.Element;
78
78
  export declare const LimitingFileSizeTo2MB: () => JSX.Element;
79
79
  export declare const I18nSupport: () => JSX.Element;
80
+ export declare const NonDesktopDevice: {
81
+ (): JSX.Element;
82
+ parameters: {
83
+ viewport: {
84
+ viewports: import("@storybook/addon-viewport").ViewportMap;
85
+ defaultViewport: string;
86
+ };
87
+ };
88
+ };
80
89
  export default story;
@@ -1,4 +1,4 @@
1
- import { Accept } from "react-dropzone";
1
+ import { Accept } from 'react-dropzone';
2
2
  export declare enum FileMimeTypes {
3
3
  avi = "video/x-msvideo",
4
4
  bmp = "image/bmp",
@@ -30,12 +30,13 @@ export interface UploadedFile {
30
30
  showProgressBar?: boolean;
31
31
  showLoadingSpinner?: boolean;
32
32
  }
33
- export type AcceptType = "document" | "image" | "video" | Accept;
33
+ export type AcceptType = 'document' | 'image' | 'video' | Accept;
34
34
  export interface TextOverrides {
35
35
  currentlyUploadingText?: string;
36
36
  fileTypeError?: string;
37
37
  fileTooLargeError?: string;
38
38
  instructionsText?: string;
39
+ instructionsTextMobile?: string;
39
40
  sizeUpToText?: string;
40
41
  supportsText?: string;
41
42
  supportsTextShort?: string;
@@ -0,0 +1,61 @@
1
+ import { useState, useEffect } from 'react';
2
+
3
+ var breakpointLookup = function (breakpoint) {
4
+ if (typeof window === 'undefined') {
5
+ return {
6
+ initialValue: false,
7
+ queryString: '',
8
+ };
9
+ }
10
+ switch (breakpoint) {
11
+ case 'BELOW_TABLET':
12
+ return {
13
+ initialValue: window.innerWidth <= 720, // 45rem = 720px = tablet breakpoint
14
+ queryString: '(max-width: 45rem)',
15
+ };
16
+ case 'BELOW_DESKTOP':
17
+ return {
18
+ initialValue: window.innerWidth <= 1024, // 64rem = 1024px = desktop breakpoint
19
+ queryString: '(max-width: 64rem)',
20
+ };
21
+ case 'ABOVE_MOBILE':
22
+ return {
23
+ initialValue: window.innerWidth >= 544, // 34rem = 544px = mobile breakpoint}
24
+ queryString: '(min-width: 34rem)',
25
+ };
26
+ case 'ABOVE_TABLET':
27
+ return {
28
+ initialValue: window.innerWidth >= 720, // 45rem = 720px = tablet breakpoint
29
+ queryString: '(min-width: 45rem)',
30
+ };
31
+ case 'ABOVE_DESKTOP':
32
+ return {
33
+ initialValue: window.innerWidth >= 1024, // 64rem = 1024px = desktop breakpoint
34
+ queryString: '(min-width: 64rem)',
35
+ };
36
+ case 'BELOW_MOBILE':
37
+ default:
38
+ return {
39
+ initialValue: window.innerWidth <= 544, // 34rem = 544px = mobile breakpoint}
40
+ queryString: '(max-width: 34rem)',
41
+ };
42
+ }
43
+ };
44
+ var useMediaQuery = function (breakpoint) {
45
+ var _a = breakpointLookup(breakpoint), initialValue = _a.initialValue, queryString = _a.queryString;
46
+ var _b = useState(initialValue), matchesBreakpoint = _b[0], setMatchesBreakpoint = _b[1];
47
+ useEffect(function () {
48
+ var mediaQuery = window.matchMedia(queryString);
49
+ var updateMediaQuery = function (e) {
50
+ return setMatchesBreakpoint(e.matches);
51
+ };
52
+ mediaQuery.addEventListener('change', updateMediaQuery);
53
+ return function () {
54
+ mediaQuery.removeEventListener('change', updateMediaQuery);
55
+ };
56
+ }, [queryString]);
57
+ return matchesBreakpoint;
58
+ };
59
+
60
+ export { useMediaQuery as u };
61
+ //# sourceMappingURL=useMediaQuery-1a3a2432.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useMediaQuery-1a3a2432.js","sources":["../../../src/lib/hooks/useMediaQuery.ts"],"sourcesContent":["import { useEffect, useState } from 'react';\n\n// USAGE:\n// const isMobile = useMediaQuery('BELOW_MOBILE');\n\nexport const breakpointsArray = [\n 'ABOVE_MOBILE',\n 'ABOVE_TABLET',\n 'ABOVE_DESKTOP',\n 'BELOW_MOBILE',\n 'BELOW_TABLET',\n 'BELOW_DESKTOP',\n] as const;\n\nexport type Breakpoint = typeof breakpointsArray[number];\nexport type BreakpointData = { initialValue: boolean; queryString: string };\n\nexport const breakpointLookup = (breakpoint: Breakpoint): BreakpointData => {\n if (typeof window === 'undefined') {\n return {\n initialValue: false,\n queryString: '',\n };\n }\n\n switch (breakpoint) {\n case 'BELOW_TABLET':\n return {\n initialValue: window.innerWidth <= 720, // 45rem = 720px = tablet breakpoint\n queryString: '(max-width: 45rem)',\n };\n case 'BELOW_DESKTOP':\n return {\n initialValue: window.innerWidth <= 1024, // 64rem = 1024px = desktop breakpoint\n queryString: '(max-width: 64rem)',\n };\n case 'ABOVE_MOBILE':\n return {\n initialValue: window.innerWidth >= 544, // 34rem = 544px = mobile breakpoint}\n queryString: '(min-width: 34rem)',\n };\n case 'ABOVE_TABLET':\n return {\n initialValue: window.innerWidth >= 720, // 45rem = 720px = tablet breakpoint\n queryString: '(min-width: 45rem)',\n };\n case 'ABOVE_DESKTOP':\n return {\n initialValue: window.innerWidth >= 1024, // 64rem = 1024px = desktop breakpoint\n queryString: '(min-width: 64rem)',\n };\n case 'BELOW_MOBILE':\n default:\n return {\n initialValue: window.innerWidth <= 544, // 34rem = 544px = mobile breakpoint}\n queryString: '(max-width: 34rem)',\n };\n }\n};\n\nexport const useMediaQuery = (breakpoint: Breakpoint) => {\n const { initialValue, queryString } = breakpointLookup(breakpoint);\n\n const [matchesBreakpoint, setMatchesBreakpoint] = useState(initialValue);\n\n useEffect(() => {\n const mediaQuery = window.matchMedia(queryString);\n\n const updateMediaQuery = (e: MediaQueryListEvent) =>\n setMatchesBreakpoint(e.matches);\n\n mediaQuery.addEventListener('change', updateMediaQuery);\n\n return () => {\n mediaQuery.removeEventListener('change', updateMediaQuery);\n };\n }, [queryString]);\n\n return matchesBreakpoint;\n};\n"],"names":[],"mappings":";;AAiBO,IAAM,gBAAgB,GAAG,UAAC,UAAsB;IACrD,IAAI,OAAO,MAAM,KAAK,WAAW,EAAE;QACjC,OAAO;YACL,YAAY,EAAE,KAAK;YACnB,WAAW,EAAE,EAAE;SAChB,CAAC;KACH;IAED,QAAQ,UAAU;QAChB,KAAK,cAAc;YACjB,OAAO;gBACL,YAAY,EAAE,MAAM,CAAC,UAAU,IAA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C;KACH,EAAE,CAAC,WAAW,CAAC,CAAC,CAAC;IAElB,OAAO,iBAAiB,CAAC;AAC3B;;;;"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@popsure/dirty-swan",
3
- "version": "0.58.2",
3
+ "version": "0.58.4",
4
4
  "author": "Vincent Audoire <vincent@getpopsure.com>",
5
5
  "license": "MIT",
6
6
  "private": false,
@@ -77,6 +77,10 @@
77
77
  &--with-prefix {
78
78
  padding-left: 32px !important;
79
79
  }
80
+
81
+ &--with-inside-label {
82
+ padding-top: 9px;
83
+ }
80
84
  }
81
85
 
82
86
  .placeholder {
@@ -2,6 +2,8 @@ import { useState } from 'react';
2
2
  import { MultiDropzone, MultiDropzoneProps } from '.';
3
3
  import { UploadedFile } from './types';
4
4
 
5
+ import { INITIAL_VIEWPORTS } from '@storybook/addon-viewport';
6
+
5
7
  const story = {
6
8
  title: 'JSX/MultiDropzone',
7
9
  component: MultiDropzone,
@@ -11,26 +13,31 @@ const story = {
11
13
  },
12
14
  uploading: {
13
15
  defaultValue: false,
14
- description: 'Property that allows to display component in an uploading state',
16
+ description:
17
+ 'Property that allows to display component in an uploading state',
15
18
  },
16
19
  isCondensed: {
17
20
  defaultValue: false,
18
- description: 'Property that allows to display component in a smaller layout',
21
+ description:
22
+ 'Property that allows to display component in a smaller layout',
19
23
  },
20
24
  maxFiles: {
21
- description: 'Property that allows to display the maximum number of files allowed',
25
+ description:
26
+ 'Property that allows to display the maximum number of files allowed',
22
27
  table: {
23
28
  category: 'File Validation',
24
29
  },
25
30
  },
26
31
  maxSize: {
27
- description: 'Property that allows to display the maximum size of files allowed',
32
+ description:
33
+ 'Property that allows to display the maximum size of files allowed',
28
34
  table: {
29
35
  category: 'File Validation',
30
36
  },
31
37
  },
32
38
  accept: {
33
- description: 'Property that allows to define which file types are accepted',
39
+ description:
40
+ 'Property that allows to define which file types are accepted',
34
41
  table: {
35
42
  category: 'File Validation',
36
43
  },
@@ -54,17 +61,20 @@ const story = {
54
61
  },
55
62
  },
56
63
  args: {
57
- uploadedFiles: [{
58
- id: '123456789',
59
- name: 'my-code-doesnt-work-i-have-no-idea-why-my-code-works.jpg'
60
- }],
64
+ uploadedFiles: [
65
+ {
66
+ id: '123456789',
67
+ name: 'my-code-doesnt-work-i-have-no-idea-why-my-code-works.jpg',
68
+ },
69
+ ],
61
70
  uploading: false,
62
71
  isCondensed: false,
63
72
  textOverrides: {},
64
- maxFiles: 0
73
+ maxFiles: 0,
65
74
  },
66
75
  parameters: {
67
- componentSubtitle: 'MultiDropzone component allows upload of multiple documents / files.',
76
+ componentSubtitle:
77
+ 'MultiDropzone component allows upload of multiple documents / files.',
68
78
  },
69
79
  };
70
80
 
@@ -96,11 +106,11 @@ export const MultiDropzoneStory = ({
96
106
  };
97
107
 
98
108
  return (
99
- <MultiDropzone
100
- onFileSelect={handleOnFileSelect}
101
- onRemoveFile={handleOnRemoveFile}
102
- uploadedFiles={localFiles}
103
- uploading={uploading}
109
+ <MultiDropzone
110
+ onFileSelect={handleOnFileSelect}
111
+ onRemoveFile={handleOnRemoveFile}
112
+ uploadedFiles={localFiles}
113
+ uploading={uploading}
104
114
  isCondensed={isCondensed}
105
115
  maxFiles={maxFiles}
106
116
  maxSize={maxSize}
@@ -109,7 +119,7 @@ export const MultiDropzoneStory = ({
109
119
  );
110
120
  };
111
121
 
112
- MultiDropzoneStory.storyName = "MultiDropzone";
122
+ MultiDropzoneStory.storyName = 'MultiDropzone';
113
123
 
114
124
  export const UploadingState = () => (
115
125
  <MultiDropzone
@@ -148,7 +158,6 @@ export const UploadingState = () => (
148
158
  />
149
159
  );
150
160
 
151
-
152
161
  export const CondensedView = () => (
153
162
  <MultiDropzone
154
163
  uploadedFiles={[
@@ -269,9 +278,30 @@ export const I18nSupport = () => (
269
278
  instructionsText: 'Datei auswählen oder per Drag & Drop platzieren',
270
279
  supportsTextShort: 'Unterstützt werden',
271
280
  currentlyUploadingText:
272
- 'Bitte warten während die Datei hochgeladen wird...'
281
+ 'Bitte warten während die Datei hochgeladen wird...',
282
+ }}
283
+ />
284
+ );
285
+
286
+ export const NonDesktopDevice = () => (
287
+ <MultiDropzone
288
+ uploadedFiles={[]}
289
+ onFileSelect={() => {}}
290
+ uploading={false}
291
+ onRemoveFile={() => {}}
292
+ textOverrides={{
293
+ instructionsTextMobile: 'Tippen Sie, um eine Datei auszuwählen',
294
+ currentlyUploadingText:
295
+ 'Bitte warten, während die Datei hochgeladen wird...',
273
296
  }}
274
297
  />
275
298
  );
276
299
 
300
+ NonDesktopDevice.parameters = {
301
+ viewport: {
302
+ viewports: INITIAL_VIEWPORTS,
303
+ defaultViewport: 'iphone6',
304
+ },
305
+ };
306
+
277
307
  export default story;
@@ -24,6 +24,7 @@ import {
24
24
  } from './types';
25
25
 
26
26
  import { getPlaceholder } from './utils';
27
+ import { useMediaQuery } from '../../hooks/useMediaQuery';
27
28
 
28
29
  interface MultiDropzoneProps {
29
30
  uploadedFiles: UploadedFile[];
@@ -93,6 +94,17 @@ const MultiDropzone = ({
93
94
  onDrop,
94
95
  });
95
96
 
97
+ const isNonDesktopDevice = useMediaQuery('BELOW_TABLET');
98
+
99
+ const instructionsTextDesktop =
100
+ textOverrides?.instructionsText || 'Choose file or drag & drop';
101
+ const instructionsTextMobile =
102
+ textOverrides?.instructionsTextMobile || 'Tap to choose file';
103
+
104
+ const instructionsText = isNonDesktopDevice
105
+ ? instructionsTextMobile
106
+ : instructionsTextDesktop;
107
+
96
108
  return (
97
109
  <div className={styles.container}>
98
110
  <div
@@ -121,7 +133,7 @@ const MultiDropzone = ({
121
133
  {uploading
122
134
  ? textOverrides?.currentlyUploadingText ||
123
135
  'Please wait while uploading file...'
124
- : textOverrides?.instructionsText || 'Choose file or drag & drop'}
136
+ : instructionsText}
125
137
  </div>
126
138
  <div className="p-p--small tc-grey-500">
127
139
  {textOverrides?.supportsText || placeholder}
@@ -1,21 +1,21 @@
1
- import { Accept } from "react-dropzone";
1
+ import { Accept } from 'react-dropzone';
2
2
 
3
3
  export enum FileMimeTypes {
4
- avi = "video/x-msvideo",
5
- bmp = "image/bmp",
6
- doc = "application/msword",
7
- docx = "application/vnd.openxmlformats-officedocument.wordprocessingml.document",
8
- heic = "image/heic",
9
- jpeg = "image/jpeg",
10
- jpg = "image/jpg",
11
- mov = "video/quicktime",
12
- mp4 = "video/mp4",
13
- pdf = "application/pdf",
14
- png = "image/png",
15
- svg = "image/svg+xml",
16
- tif = "image/tiff",
17
- tiff = "image/tiff",
18
- webp = "image/webp",
4
+ avi = 'video/x-msvideo',
5
+ bmp = 'image/bmp',
6
+ doc = 'application/msword',
7
+ docx = 'application/vnd.openxmlformats-officedocument.wordprocessingml.document',
8
+ heic = 'image/heic',
9
+ jpeg = 'image/jpeg',
10
+ jpg = 'image/jpg',
11
+ mov = 'video/quicktime',
12
+ mp4 = 'video/mp4',
13
+ pdf = 'application/pdf',
14
+ png = 'image/png',
15
+ svg = 'image/svg+xml',
16
+ tif = 'image/tiff',
17
+ tiff = 'image/tiff',
18
+ webp = 'image/webp',
19
19
  }
20
20
 
21
21
  // mp4, mov, avi
@@ -34,7 +34,7 @@ export const IMAGE_FILES: FileType[] = [
34
34
  'png',
35
35
  'tiff',
36
36
  'webp',
37
- 'svg'
37
+ 'svg',
38
38
  ];
39
39
 
40
40
  export interface UploadedFile {
@@ -47,13 +47,14 @@ export interface UploadedFile {
47
47
  showLoadingSpinner?: boolean;
48
48
  }
49
49
 
50
- export type AcceptType = "document" | "image" | "video" | Accept;
50
+ export type AcceptType = 'document' | 'image' | 'video' | Accept;
51
51
 
52
52
  export interface TextOverrides {
53
53
  currentlyUploadingText?: string;
54
54
  fileTypeError?: string;
55
55
  fileTooLargeError?: string;
56
56
  instructionsText?: string;
57
+ instructionsTextMobile?: string;
57
58
  sizeUpToText?: string;
58
59
  supportsText?: string;
59
60
  supportsTextShort?: string;
@@ -1 +0,0 @@
1
- {"version":3,"file":"TableSection-ebace923.js","sources":["../../../src/lib/components/table/types.ts","../../../src/lib/hooks/useMediaQuery.ts","../../../src/lib/components/table/components/TableSection/TableSection.tsx"],"sourcesContent":["import { ReactNode } from 'react';\nimport { BaseCellProps } from './components/TableCell/BaseCell/BaseCell';\nimport { CTACellProps } from './components/TableCell/CTACell/CTACell';\nimport { ButtonCellProps } from './components/TableCell/ButtonCell/ButtonCell';\nimport { CardCellProps } from './components/TableCell/CardCell/CardCell';\n\ntype DefaultCellProps = {\n cellId?: string;\n colSpan?: number;\n modalTitle?: ReactNode;\n};\n\ntype BaseCellData = BaseCellProps & { type?: undefined } & DefaultCellProps;\ntype CTACellData = CTACellProps & { type: 'CTA' } & DefaultCellProps;\ntype ButtonCellData = ButtonCellProps & { type: 'BUTTON' } & DefaultCellProps;\ntype CardCellData = CardCellProps & { type: 'CARD' } & DefaultCellProps;\n\nexport type TableCellData =\n | BaseCellData\n | CTACellData\n | ButtonCellData\n | CardCellData;\n\nexport const isBaseCell = (\n tableCellData: TableCellData\n): tableCellData is BaseCellData => {\n return !tableCellData.type;\n};\n\nexport type TableSectionType = {\n title?: string;\n icon?: ReactNode;\n};\n\nexport type ModalData = {\n title?: ReactNode;\n body?: ReactNode;\n};\n\nexport type TableCellRowData = TableCellData[];\n\nexport type TableSectionData = {\n section?: TableSectionType;\n rows: TableCellRowData[];\n};\n\nexport type TableData = TableSectionData[];\n\nexport type ModalFunction = (modalData: ModalData) => void;\n\nexport type CellReplacements = Record<string, Partial<TableCellData>>;\n","import { useEffect, useState } from 'react';\n\n// USAGE:\n// const isMobile = useMediaQuery('BELOW_MOBILE');\n\nexport const breakpointsArray = [\n 'ABOVE_MOBILE',\n 'ABOVE_TABLET',\n 'ABOVE_DESKTOP',\n 'BELOW_MOBILE',\n 'BELOW_TABLET',\n 'BELOW_DESKTOP',\n] as const;\n\nexport type Breakpoint = typeof breakpointsArray[number];\nexport type BreakpointData = { initialValue: boolean; queryString: string };\n\nexport const breakpointLookup = (breakpoint: Breakpoint): BreakpointData => {\n if (typeof window === 'undefined') {\n return {\n initialValue: false,\n queryString: '',\n };\n }\n\n switch (breakpoint) {\n case 'BELOW_TABLET':\n return {\n initialValue: window.innerWidth <= 720, // 45rem = 720px = tablet breakpoint\n queryString: '(max-width: 45rem)',\n };\n case 'BELOW_DESKTOP':\n return {\n initialValue: window.innerWidth <= 1024, // 64rem = 1024px = desktop breakpoint\n queryString: '(max-width: 64rem)',\n };\n case 'ABOVE_MOBILE':\n return {\n initialValue: window.innerWidth >= 544, // 34rem = 544px = mobile breakpoint}\n queryString: '(min-width: 34rem)',\n };\n case 'ABOVE_TABLET':\n return {\n initialValue: window.innerWidth >= 720, // 45rem = 720px = tablet breakpoint\n queryString: '(min-width: 45rem)',\n };\n case 'ABOVE_DESKTOP':\n return {\n initialValue: window.innerWidth >= 1024, // 64rem = 1024px = desktop breakpoint\n queryString: '(min-width: 64rem)',\n };\n case 'BELOW_MOBILE':\n default:\n return {\n initialValue: window.innerWidth <= 544, // 34rem = 544px = mobile breakpoint}\n queryString: '(max-width: 34rem)',\n };\n }\n};\n\nexport const useMediaQuery = (breakpoint: Breakpoint) => {\n const { initialValue, queryString } = breakpointLookup(breakpoint);\n\n const [matchesBreakpoint, setMatchesBreakpoint] = useState(initialValue);\n\n useEffect(() => {\n const mediaQuery = window.matchMedia(queryString);\n\n const updateMediaQuery = (e: MediaQueryListEvent) =>\n setMatchesBreakpoint(e.matches);\n\n mediaQuery.addEventListener('change', updateMediaQuery);\n\n return () => {\n mediaQuery.removeEventListener('change', updateMediaQuery);\n };\n }, [queryString]);\n\n return matchesBreakpoint;\n};\n","import classNames from 'classnames';\n\nimport styles from './TableSection.module.scss';\nimport { TableCell } from '../TableCell/TableCell';\nimport {\n CellReplacements,\n isBaseCell,\n ModalFunction,\n TableCellData,\n TableCellRowData,\n} from '../../types';\nimport { useCallback } from 'react';\nimport { useMediaQuery } from '../../../../hooks/useMediaQuery';\n\nexport interface TableSectionProps {\n className?: string;\n tableCellRows: TableCellRowData[];\n hideColumns?: number[];\n hideHeader?: boolean;\n openModal?: ModalFunction;\n title: string;\n width?: number | string;\n cellReplacements?: CellReplacements;\n imageComponent?: (args: any) => JSX.Element;\n}\n\nconst TableSection = ({\n className,\n tableCellRows,\n hideColumns = [],\n hideHeader,\n openModal,\n title,\n width,\n cellReplacements,\n imageComponent,\n}: TableSectionProps) => {\n const headerRow = tableCellRows?.[0];\n const isBelowDesktop = useMediaQuery('BELOW_DESKTOP');\n\n const getModalTitleFromColumnHeader = (cellIndex: number) => {\n const firstCellInColumn = tableCellRows?.[0]?.[cellIndex];\n let titleFromColumn;\n\n switch (firstCellInColumn.type) {\n case 'BUTTON':\n titleFromColumn = firstCellInColumn.buttonCaption;\n break;\n case 'CTA':\n titleFromColumn = firstCellInColumn.title;\n break;\n case undefined:\n titleFromColumn = firstCellInColumn.text || '';\n break;\n }\n\n return titleFromColumn;\n };\n\n const getModalTitleFromRowHeader = (currentRow: TableCellRowData) => {\n const firstCellInRow = currentRow?.[0];\n const titleFromRow =\n (isBaseCell(firstCellInRow) && firstCellInRow.text) || '';\n\n return titleFromRow;\n };\n\n const isVisibleColumn = useCallback(\n (cellIndex: number) => !hideColumns.includes(cellIndex),\n [hideColumns]\n );\n\n return (\n <table\n className={classNames(className, 'w100', styles.table)}\n width={width}\n >\n <caption className=\"sr-only\">{title}</caption>\n\n {headerRow && (\n <thead className={hideHeader ? 'sr-only' : ''}>\n <tr>\n {headerRow.map((tableCellData, cellIndex) => {\n const isFirstCellInRow = cellIndex === 0;\n const cellReplacementData =\n (tableCellData.cellId &&\n cellReplacements?.[tableCellData.cellId]) ||\n {};\n\n const cellProps = {\n ...tableCellData,\n ...cellReplacementData,\n ...{\n openModal,\n modalTitle:\n (isBaseCell(tableCellData) && tableCellData.text) ||\n getModalTitleFromColumnHeader(cellIndex),\n align: isFirstCellInRow ? 'left' : 'center',\n },\n } as TableCellData;\n\n return (\n isVisibleColumn(cellIndex) && (\n <TableCell\n key={cellIndex}\n isBelowDesktop={isBelowDesktop}\n isHeader\n isFirstCellInRow={isFirstCellInRow}\n isTopLeftCell={isFirstCellInRow}\n {...cellProps}\n imageComponent={imageComponent}\n />\n )\n );\n })}\n </tr>\n </thead>\n )}\n\n <tbody>\n {tableCellRows.map(\n (row, rowIndex) =>\n rowIndex > 0 && (\n <tr key={rowIndex} className={styles.tr}>\n {row.map((tableCellData, cellIndex) => {\n const key = `${rowIndex}-${cellIndex}`;\n const isFirstCellInRow = cellIndex === 0;\n const titleFromRow = getModalTitleFromRowHeader(row);\n\n const cellReplacementData =\n (tableCellData.cellId &&\n cellReplacements?.[tableCellData.cellId]) ||\n {};\n\n const cellProps = {\n ...tableCellData,\n ...cellReplacementData,\n ...{\n openModal,\n modalTitle: tableCellData?.modalTitle || titleFromRow,\n align: isFirstCellInRow ? 'left' : 'center',\n },\n } as TableCellData;\n\n return (\n !hideColumns.includes(cellIndex) && (\n <TableCell\n isBelowDesktop={isBelowDesktop}\n isFirstCellInRow={isFirstCellInRow}\n key={key}\n {...cellProps}\n imageComponent={imageComponent}\n />\n )\n );\n })}\n </tr>\n )\n )}\n </tbody>\n </table>\n );\n};\n\nexport { TableSection };\n"],"names":["_jsxs","_jsx"],"mappings":";;;;;;;;;;;IAuBa,UAAU,GAAG,UACxB,aAA4B;IAE5B,OAAO,CAAC,aAAa,CAAC,IAAI,CAAC;AAC7B;;ACVO,IAAM,gBAAgB,GAAG,UAAC,UAAsB;IACrD,IAAI,OAAO,MAAM,KAAK,WAAW,EAAE;QACjC,OAAO;YACL,YAAY,EAAE,KAAK;YACnB,WAAW,EAAE,EAAE;SAChB,CAAC;KACH;IAED,QAAQ,UAAU;QAChB,KAAK,cAAc;YACjB,OAAO;gBACL,YAAY,EAAE,MAAM,CAAC,UAAU,IAAI,GAAG;gBACtC,WAAW,EAAE,oBAAoB;aAClC,CAAC;QACJ,KAAK,eAAe;YAClB,OAAO;gBACL,YAAY,EAAE,MAAM,CAAC,UAAU,IAAI,IAAI;gBACvC,WAAW,EAAE,oBAAoB;aAClC,CAAC;QACJ,KAAK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