@popsure/dirty-swan 0.59.0-alpha → 0.59.0-beta-2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/index.js +87 -93
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/lib/components/button/index.d.ts +1 -1
- package/dist/cjs/lib/components/cards/card/index.d.ts +4 -1
- package/dist/cjs/lib/components/cards/card/index.stories.d.ts +2 -1
- package/dist/cjs/lib/components/cards/infoCard/index.d.ts +9 -7
- package/dist/cjs/lib/components/cards/infoCard/index.stories.d.ts +23 -17
- package/dist/cjs/lib/components/input/currency/input.stories.d.ts +1 -0
- package/dist/cjs/lib/components/input/input.stories.d.ts +2 -1
- package/dist/cjs/lib/components/input/stories/config.d.ts +1 -0
- package/dist/cjs/lib/components/table/components/TableCell/BaseCell/BaseCell.d.ts +1 -1
- package/dist/cjs/lib/scss/public/borders.stories.d.ts +13 -0
- package/dist/esm/{Calendar-2d7e51b5.js → Calendar-5ad3eccf.js} +2 -2
- package/dist/esm/Calendar-5ad3eccf.js.map +1 -0
- package/dist/esm/{TableSection-5277dae1.js → TableSection-018d8e8f.js} +1 -1
- package/dist/esm/{TableSection-5277dae1.js.map → TableSection-018d8e8f.js.map} +1 -1
- package/dist/esm/components/accordion/index.js +2 -2
- package/dist/esm/components/accordion/index.js.map +1 -1
- package/dist/esm/components/button/index.js +4 -5
- package/dist/esm/components/button/index.js.map +1 -1
- package/dist/esm/components/button/index.stories.js +5 -9
- package/dist/esm/components/button/index.stories.js.map +1 -1
- package/dist/esm/components/cards/card/index.js +6 -6
- package/dist/esm/components/cards/card/index.js.map +1 -1
- package/dist/esm/components/cards/card/index.stories.js +8 -3
- package/dist/esm/components/cards/card/index.stories.js.map +1 -1
- package/dist/esm/components/cards/cardButton/index.js +6 -4
- package/dist/esm/components/cards/cardButton/index.js.map +1 -1
- package/dist/esm/components/cards/cardButton/index.stories.js +2 -2
- package/dist/esm/components/cards/cardButton/index.stories.js.map +1 -1
- package/dist/esm/components/cards/index.js +7 -21
- package/dist/esm/components/cards/index.js.map +1 -1
- package/dist/esm/components/cards/infoCard/index.js +34 -8
- package/dist/esm/components/cards/infoCard/index.js.map +1 -1
- package/dist/esm/components/cards/infoCard/index.stories.js +44 -31
- package/dist/esm/components/cards/infoCard/index.stories.js.map +1 -1
- package/dist/esm/components/comparisonTable/components/AccordionItem/AccordionItem.js +1 -1
- package/dist/esm/components/comparisonTable/components/Chevron.js +1 -1
- package/dist/esm/components/comparisonTable/components/Chevron.js.map +1 -1
- package/dist/esm/components/comparisonTable/components/Row/index.js +1 -1
- package/dist/esm/components/comparisonTable/components/TableArrows/index.js +1 -1
- package/dist/esm/components/comparisonTable/components/TableInfoButton/index.js +3 -3
- package/dist/esm/components/comparisonTable/components/TableInfoButton/index.js.map +1 -1
- package/dist/esm/components/comparisonTable/components/TableRating/index.js +1 -1
- package/dist/esm/components/comparisonTable/components/TableTrueFalse.js +2 -2
- package/dist/esm/components/comparisonTable/components/TableTrueFalse.js.map +1 -1
- package/dist/esm/components/comparisonTable/index.js +2 -2
- package/dist/esm/components/comparisonTable/index.js.map +1 -1
- package/dist/esm/components/dateSelector/components/Calendar.js +1 -1
- package/dist/esm/components/dateSelector/index.js +1 -1
- package/dist/esm/components/dateSelector/index.stories.js +1 -1
- package/dist/esm/components/dateSelector/index.test.js +1 -1
- package/dist/esm/components/icon/icons/BasketballSports.js +2 -2
- package/dist/esm/components/icon/icons/BasketballSports.js.map +1 -1
- package/dist/esm/components/icon/icons/BookOpen.js +2 -2
- package/dist/esm/components/icon/icons/BookOpen.js.map +1 -1
- package/dist/esm/components/icon/icons/Heart.js +2 -2
- package/dist/esm/components/icon/icons/Heart.js.map +1 -1
- package/dist/esm/components/icon/icons/Info.js +2 -2
- package/dist/esm/components/icon/icons/Info.js.map +1 -1
- package/dist/esm/components/icon/icons/Star.js +2 -2
- package/dist/esm/components/icon/icons/Star.js.map +1 -1
- package/dist/esm/components/icon/icons.stories.js +1 -1
- package/dist/esm/components/icon/index.stories.js +1 -1
- package/dist/esm/components/input/currency/input.stories.js +1 -1
- package/dist/esm/components/input/index.js +5 -5
- package/dist/esm/components/input/index.js.map +1 -1
- package/dist/esm/components/input/input.stories.js +3 -3
- package/dist/esm/components/input/input.stories.js.map +1 -1
- package/dist/esm/components/input/toggle/index.js +1 -1
- package/dist/esm/components/modal/index.stories.js +7 -7
- package/dist/esm/components/modal/index.stories.js.map +1 -1
- package/dist/esm/components/segmentedControl/index.js +1 -1
- package/dist/esm/components/table/Table.js +4 -5
- package/dist/esm/components/table/Table.js.map +1 -1
- package/dist/esm/components/table/Table.stories.js +1 -1
- package/dist/esm/components/table/Table.test.js +1 -1
- package/dist/esm/components/table/components/TableCell/BaseCell/BaseCell.js +3 -3
- package/dist/esm/components/table/components/TableCell/BaseCell/BaseCell.js.map +1 -1
- package/dist/esm/components/table/components/TableCell/ButtonCell/ButtonCell.js +2 -2
- package/dist/esm/components/table/components/TableCell/ButtonCell/ButtonCell.js.map +1 -1
- package/dist/esm/components/table/components/TableCell/TableCell.js +1 -1
- package/dist/esm/components/table/components/TableCell/TableCell.js.map +1 -1
- package/dist/esm/components/table/components/TableContents/TableContents.js +6 -5
- package/dist/esm/components/table/components/TableContents/TableContents.js.map +1 -1
- package/dist/esm/components/table/components/TableContents/TableContents.test.js +1 -1
- package/dist/esm/components/table/components/TableControls/TableControls.js +4 -3
- package/dist/esm/components/table/components/TableControls/TableControls.js.map +1 -1
- package/dist/esm/components/table/components/TableSection/TableSection.js +1 -1
- package/dist/esm/components/table/components/TableSection/TableSection.test.js +1 -1
- package/dist/esm/{config-4b5ffe4f.js → config-bc609993.js} +3 -2
- package/dist/esm/config-bc609993.js.map +1 -0
- package/dist/esm/{index-d2e06251.js → index-7427c96f.js} +11 -11
- package/dist/esm/{index-d2e06251.js.map → index-7427c96f.js.map} +1 -1
- package/dist/esm/index.js +3 -3
- package/dist/esm/lib/components/button/index.d.ts +1 -1
- package/dist/esm/lib/components/cards/card/index.d.ts +4 -1
- package/dist/esm/lib/components/cards/card/index.stories.d.ts +2 -1
- package/dist/esm/lib/components/cards/infoCard/index.d.ts +9 -7
- package/dist/esm/lib/components/cards/infoCard/index.stories.d.ts +23 -17
- package/dist/esm/lib/components/input/currency/input.stories.d.ts +1 -0
- package/dist/esm/lib/components/input/input.stories.d.ts +2 -1
- package/dist/esm/lib/components/input/stories/config.d.ts +1 -0
- package/dist/esm/lib/components/table/components/TableCell/BaseCell/BaseCell.d.ts +1 -1
- package/dist/esm/lib/scss/public/borders.stories.d.ts +13 -0
- package/dist/esm/scss/public/borders.stories.js +86 -0
- package/dist/esm/scss/public/borders.stories.js.map +1 -0
- package/dist/index.css +212 -122
- package/dist/index.css.map +1 -1
- package/dist/lib/scss/index.scss +1 -0
- package/dist/lib/scss/private/base/_typography.scss +21 -52
- package/dist/lib/scss/private/borders/_index.scss +1 -0
- package/dist/lib/scss/private/borders/default.scss +61 -0
- package/dist/lib/scss/private/components/_buttons.scss +105 -63
- package/dist/lib/scss/private/components/_cards.scss +2 -1
- package/dist/lib/scss/private/components/_input.scss +32 -26
- package/dist/lib/scss/private/components/_spinner.scss +2 -2
- package/dist/lib/scss/public/borders.stories.tsx +124 -0
- package/dist/lib/scss/public/colors/default.scss +1 -0
- package/dist/lib/scss/public/shadows.scss +5 -5
- package/package.json +1 -1
- package/src/lib/components/accordion/index.tsx +1 -0
- package/src/lib/components/accordion/style.module.scss +0 -4
- package/src/lib/components/button/index.stories.tsx +22 -57
- package/src/lib/components/button/index.tsx +7 -9
- package/src/lib/components/cards/card/index.stories.tsx +60 -1
- package/src/lib/components/cards/card/index.tsx +13 -3
- package/src/lib/components/cards/card/style.module.scss +87 -10
- package/src/lib/components/cards/cardButton/index.stories.tsx +2 -2
- package/src/lib/components/cards/cardButton/index.tsx +4 -2
- package/src/lib/components/cards/cardButton/style.module.scss +4 -0
- package/src/lib/components/cards/infoCard/index.stories.tsx +164 -40
- package/src/lib/components/cards/infoCard/index.tsx +72 -37
- package/src/lib/components/cards/infoCard/style.module.scss +46 -33
- package/src/lib/components/comparisonTable/components/AccordionItem/AccordionItem.module.scss +2 -2
- package/src/lib/components/comparisonTable/components/Chevron.tsx +1 -1
- package/src/lib/components/comparisonTable/components/Row/style.module.scss +0 -4
- package/src/lib/components/comparisonTable/components/TableArrows/style.module.scss +6 -5
- package/src/lib/components/comparisonTable/components/TableInfoButton/index.tsx +2 -2
- package/src/lib/components/comparisonTable/components/TableInfoButton/style.module.scss +3 -4
- package/src/lib/components/comparisonTable/components/TableRating/style.module.scss +2 -2
- package/src/lib/components/comparisonTable/components/TableTrueFalse.tsx +2 -2
- package/src/lib/components/comparisonTable/index.tsx +1 -1
- package/src/lib/components/comparisonTable/style.module.scss +6 -2
- package/src/lib/components/dateSelector/components/Calendar.tsx +1 -1
- package/src/lib/components/input/index.tsx +2 -1
- package/src/lib/components/input/input.stories.tsx +3 -1
- package/src/lib/components/input/stories/config.ts +4 -1
- package/src/lib/components/input/style.module.scss +8 -4
- package/src/lib/components/input/toggle/styles.module.scss +8 -4
- package/src/lib/components/modal/index.stories.tsx +23 -23
- package/src/lib/components/segmentedControl/style.module.scss +1 -1
- package/src/lib/components/table/Table.module.scss +18 -0
- package/src/lib/components/table/Table.tsx +1 -2
- package/src/lib/components/table/components/TableCell/BaseCell/BaseCell.module.scss +0 -10
- package/src/lib/components/table/components/TableCell/BaseCell/BaseCell.tsx +6 -9
- package/src/lib/components/table/components/TableCell/ButtonCell/ButtonCell.module.scss +1 -2
- package/src/lib/components/table/components/TableCell/ButtonCell/ButtonCell.tsx +1 -1
- package/src/lib/components/table/components/TableCell/TableCell.tsx +1 -1
- package/src/lib/components/table/components/TableContents/TableContents.module.scss +19 -0
- package/src/lib/components/table/components/TableContents/TableContents.tsx +3 -1
- package/src/lib/components/table/components/TableControls/TableControls.module.scss +7 -3
- package/src/lib/components/table/components/TableControls/TableControls.tsx +38 -25
- package/src/lib/scss/index.scss +1 -0
- package/src/lib/scss/private/base/_typography.scss +21 -52
- package/src/lib/scss/private/borders/_index.scss +1 -0
- package/src/lib/scss/private/borders/default.scss +61 -0
- package/src/lib/scss/private/components/_buttons.scss +105 -63
- package/src/lib/scss/private/components/_cards.scss +2 -1
- package/src/lib/scss/private/components/_input.scss +32 -26
- package/src/lib/scss/private/components/_spinner.scss +2 -2
- package/src/lib/scss/public/borders.stories.tsx +124 -0
- package/src/lib/scss/public/colors/default.scss +1 -0
- package/src/lib/scss/public/shadows.scss +5 -5
- package/dist/esm/Calendar-2d7e51b5.js.map +0 -1
- package/dist/esm/config-4b5ffe4f.js.map +0 -1
|
@@ -5,9 +5,9 @@ import '../../../tslib.es6-a39f91fc.js';
|
|
|
5
5
|
import '../../../index-6ea95111.js';
|
|
6
6
|
import '../../../style-inject.es-1f59c1d0.js';
|
|
7
7
|
|
|
8
|
-
var
|
|
8
|
+
var StarIcon = (function (props) {
|
|
9
9
|
return createElement(IconWrapper, props, jsx("path", { stroke: "currentColor", strokeLinejoin: "round", strokeWidth: 2, d: "M11.888 2h.129c.502.003.952.313 1.13.78l2.006 5.068 5.679.266c1.128.048 1.59 1.464.703 2.16l-4.433 3.546 1.84 5.653c.286 1.071-.906 1.93-1.84 1.325L12 17l-5 3.798c-.935.608-2.132-.252-1.844-1.325L6.9 13.82l-4.434-3.546c-.886-.696-.425-2.112.703-2.16l5.68-.266 2.021-5.068A1.224 1.224 0 0 1 11.889 2Z" }));
|
|
10
10
|
});
|
|
11
11
|
|
|
12
|
-
export default
|
|
12
|
+
export default StarIcon;
|
|
13
13
|
//# sourceMappingURL=Star.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Star.js","sources":["../../../../../../src/lib/components/icon/icons/Star.tsx"],"sourcesContent":["/* Generated file. Do not modify. */\nimport { createElement } from 'react';\nimport { IconWrapper } from '../IconWrapper';\nimport type { IconWrapperProps } from '../IconWrapper';\nexport default (props: IconWrapperProps) =>\n createElement(\n IconWrapper,\n props,\n <path\n stroke=\"currentColor\"\n strokeLinejoin=\"round\"\n strokeWidth={2}\n d=\"M11.888 2h.129c.502.003.952.313 1.13.78l2.006 5.068 5.679.266c1.128.048 1.59 1.464.703 2.16l-4.433 3.546 1.84 5.653c.286 1.071-.906 1.93-1.84 1.325L12 17l-5 3.798c-.935.608-2.132-.252-1.844-1.325L6.9 13.82l-4.434-3.546c-.886-.696-.425-2.112.703-2.16l5.68-.266 2.021-5.068A1.224 1.224 0 0 1 11.889 2Z\"\n />\n );\n"],"names":["_jsx"],"mappings":";;;;;;;AAIA,
|
|
1
|
+
{"version":3,"file":"Star.js","sources":["../../../../../../src/lib/components/icon/icons/Star.tsx"],"sourcesContent":["/* Generated file. Do not modify. */\nimport { createElement } from 'react';\nimport { IconWrapper } from '../IconWrapper';\nimport type { IconWrapperProps } from '../IconWrapper';\nexport default (props: IconWrapperProps) =>\n createElement(\n IconWrapper,\n props,\n <path\n stroke=\"currentColor\"\n strokeLinejoin=\"round\"\n strokeWidth={2}\n d=\"M11.888 2h.129c.502.003.952.313 1.13.78l2.006 5.068 5.679.266c1.128.048 1.59 1.464.703 2.16l-4.433 3.546 1.84 5.653c.286 1.071-.906 1.93-1.84 1.325L12 17l-5 3.798c-.935.608-2.132-.252-1.844-1.325L6.9 13.82l-4.434-3.546c-.886-.696-.425-2.112.703-2.16l5.68-.266 2.021-5.068A1.224 1.224 0 0 1 11.889 2Z\"\n />\n );\n"],"names":["_jsx"],"mappings":";;;;;;;AAIA,gBAAe,UAAC,KAAuB;IACrC,OAAA,aAAa,CACX,WAAW,EACX,KAAK,EACLA,cACE,MAAM,EAAC,cAAc,EACrB,cAAc,EAAC,OAAO,EACtB,WAAW,EAAE,CAAC,EACd,CAAC,EAAC,6SAA6S,GAC/S,CACH;AATD,CASC;;;;"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
2
2
|
import { useState } from 'react';
|
|
3
3
|
import { Input } from '../input/index.js';
|
|
4
|
-
import { i as icons } from '../../index-
|
|
4
|
+
import { i as icons } from '../../index-7427c96f.js';
|
|
5
5
|
import { Button } from '../button/index.js';
|
|
6
6
|
import { c as classNames } from '../../index-6ea95111.js';
|
|
7
7
|
import { s as styleInject } from '../../style-inject.es-1f59c1d0.js';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx } from 'react/jsx-runtime';
|
|
2
2
|
import { IconWrapper } from './IconWrapper/IconWrapper.js';
|
|
3
|
-
import { i as icons } from '../../index-
|
|
3
|
+
import { i as icons } from '../../index-7427c96f.js';
|
|
4
4
|
import '../../tslib.es6-a39f91fc.js';
|
|
5
5
|
import '../../index-6ea95111.js';
|
|
6
6
|
import '../../style-inject.es-1f59c1d0.js';
|
|
@@ -2,7 +2,7 @@ import { a as __assign } from '../../../tslib.es6-a39f91fc.js';
|
|
|
2
2
|
import { jsx } from 'react/jsx-runtime';
|
|
3
3
|
import { useState } from 'react';
|
|
4
4
|
import { CurrencyInput } from './index.js';
|
|
5
|
-
import { s as sharedConfig } from '../../../config-
|
|
5
|
+
import { s as sharedConfig } from '../../../config-bc609993.js';
|
|
6
6
|
import '../index.js';
|
|
7
7
|
import '../../../index-6ea95111.js';
|
|
8
8
|
import '../../../index-69a46657.js';
|
|
@@ -5,13 +5,13 @@ import { c as classNames } from '../../index-6ea95111.js';
|
|
|
5
5
|
import { g as generateId } from '../../index-69a46657.js';
|
|
6
6
|
import { s as styleInject } from '../../style-inject.es-1f59c1d0.js';
|
|
7
7
|
|
|
8
|
-
var css_248z = ".style-module_container__2L4SP {\n position: relative;\n}\n\n.style-module_prefix__3jAFZ {\n position: absolute;\n left: 16px;\n top: 50%;\n transform: translateY(-50%);\n color: var(--ds-neutral-600);\n transition: 0.3s
|
|
9
|
-
var styles = {"container":"style-module_container__2L4SP","prefix":"style-module_prefix__3jAFZ","prefix--with-error":"style-module_prefix--with-error__1yTTM","prefix--disabled":"style-module_prefix--disabled__2-gcw","input":"style-module_input__1eJO5","placeholder":"style-module_placeholder__1U2z0","input--with-inside-label":"style-module_input--with-inside-label__253bZ","placeholder--with-error":"style-module_placeholder--with-error__2ieRU","input--no-placeholder":"style-module_input--no-placeholder__3EGwh","input--with-prefix":"style-module_input--with-prefix__38e0j","placeholder--with-prefix":"style-module_placeholder--with-prefix__2PquQ","label":"style-module_label__3FEZ1","label--with-error":"style-module_label--with-error__166bP","error":"style-module_error__167Zc"};
|
|
8
|
+
var css_248z = ".style-module_container__2L4SP {\n position: relative;\n}\n\n.style-module_prefix__3jAFZ {\n position: absolute;\n left: 16px;\n top: 50%;\n transform: translateY(-50%);\n color: var(--ds-neutral-600);\n transition: top 0.3s, color 0.3s;\n}\n.style-module_prefix--with-value__2QiEA {\n color: var(--ds-neutral-900);\n}\n.style-module_prefix--with-error__1yTTM {\n color: var(--ds-red-500);\n}\n.style-module_prefix--disabled__2-gcw {\n color: var(--ds-neutral-700);\n}\n\n.style-module_input__1eJO5:not(:placeholder-shown) ~ .style-module_placeholder__1U2z0,\n.style-module_input__1eJO5:focus ~ .style-module_placeholder__1U2z0,\n.style-module_input--with-inside-label__253bZ ~ .style-module_placeholder__1U2z0 {\n top: 7px;\n left: 16px;\n transform: translateY(0);\n font-size: 10px;\n line-height: 12px;\n opacity: 1;\n}\n\n.style-module_input__1eJO5:focus ~ .style-module_placeholder__1U2z0 {\n color: var(--ds-neutral-900);\n}\n.style-module_input__1eJO5:focus ~ .style-module_placeholder--with-error__2ieRU {\n color: var(--ds-red-500);\n}\n\ninput:focus ~ .style-module_prefix__3jAFZ {\n color: var(--ds-neutral-900);\n}\ninput:focus ~ .style-module_prefix--with-error__1yTTM {\n color: var(--ds-red-500);\n}\n\n.style-module_input__1eJO5:not(:placeholder-shown) ~ .style-module_prefix__3jAFZ,\n.style-module_input__1eJO5:focus ~ .style-module_prefix__3jAFZ {\n top: 28px;\n}\n\n.style-module_input--with-inside-label__253bZ ~ .style-module_prefix__3jAFZ,\n.style-module_input--with-inside-label__253bZ:focus ~ .style-module_prefix__3jAFZ,\n.style-module_input--with-inside-label__253bZ:not(:placeholder-shown) ~ .style-module_prefix__3jAFZ {\n top: 29px;\n}\n\n.style-module_input__1eJO5 {\n box-sizing: border-box;\n padding-top: 9px;\n font-family: inherit;\n}\n.style-module_input--no-placeholder__3EGwh {\n padding-top: 0px;\n}\n.style-module_input--with-prefix__38e0j {\n padding-left: 32px !important;\n}\n.style-module_input--with-inside-label__253bZ {\n padding-top: 9px;\n}\n\n.style-module_placeholder__1U2z0 {\n position: absolute;\n pointer-events: none;\n left: 16px;\n top: 50%;\n transform: translateY(-50%);\n transition: 0.3s ease all;\n color: var(--ds-neutral-600);\n}\n.style-module_placeholder--with-prefix__2PquQ {\n left: 32px;\n}\n.style-module_placeholder--with-error__2ieRU {\n color: var(--ds-red-500);\n}\n\n.style-module_label__3FEZ1 {\n display: inline-block;\n margin-bottom: 8px;\n color: var(--ds-neutral-700);\n}\n.style-module_label--with-error__166bP {\n color: var(--ds-red-500);\n}\n\n.style-module_error__167Zc {\n margin-top: 4px;\n}";
|
|
9
|
+
var styles = {"container":"style-module_container__2L4SP","prefix":"style-module_prefix__3jAFZ","prefix--with-value":"style-module_prefix--with-value__2QiEA","prefix--with-error":"style-module_prefix--with-error__1yTTM","prefix--disabled":"style-module_prefix--disabled__2-gcw","input":"style-module_input__1eJO5","placeholder":"style-module_placeholder__1U2z0","input--with-inside-label":"style-module_input--with-inside-label__253bZ","placeholder--with-error":"style-module_placeholder--with-error__2ieRU","input--no-placeholder":"style-module_input--no-placeholder__3EGwh","input--with-prefix":"style-module_input--with-prefix__38e0j","placeholder--with-prefix":"style-module_placeholder--with-prefix__2PquQ","label":"style-module_label__3FEZ1","label--with-error":"style-module_label--with-error__166bP","error":"style-module_error__167Zc"};
|
|
10
10
|
styleInject(css_248z);
|
|
11
11
|
|
|
12
12
|
var Input = React__default.forwardRef(function (_a, ref) {
|
|
13
|
-
var _b, _c, _d, _e, _f, _g;
|
|
14
|
-
var className = _a.className, placeholder = _a.placeholder, label = _a.label, id = _a.id, prefix = _a.prefix, error = _a.error, disabled = _a.disabled,
|
|
13
|
+
var _b, _c, _d, _e, _f, _g, _h;
|
|
14
|
+
var className = _a.className, placeholder = _a.placeholder, label = _a.label, id = _a.id, prefix = _a.prefix, error = _a.error, disabled = _a.disabled, _j = _a.hideLabel, hideLabel = _j === void 0 ? false : _j, _k = _a.labelInsideInput, labelInsideInput = _k === void 0 ? false : _k, props = __rest(_a, ["className", "placeholder", "label", "id", "prefix", "error", "disabled", "hideLabel", "labelInsideInput"]);
|
|
15
15
|
var uniqueId = useState(id !== null && id !== void 0 ? id : generateId())[0];
|
|
16
16
|
return (jsxs("div", { className: "".concat(styles.container, " ").concat(className !== null && className !== void 0 ? className : ''), children: [label && !labelInsideInput && (jsx("label", { htmlFor: uniqueId, className: classNames('p-p', styles.label, (_b = {},
|
|
17
17
|
_b[styles['label--with-error']] = error,
|
|
@@ -23,7 +23,7 @@ var Input = React__default.forwardRef(function (_a, ref) {
|
|
|
23
23
|
: styles['input--no-placeholder'], (_c = {},
|
|
24
24
|
_c[styles['input--with-prefix']] = prefix,
|
|
25
25
|
_c[styles['input--with-inside-label']] = labelInsideInput,
|
|
26
|
-
_c)), placeholder: label || labelInsideInput ? placeholder : ' ', disabled: disabled, "aria-invalid": !!error, "aria-errormessage": error ? "".concat(uniqueId, "-error") : undefined }, props)), prefix && (jsx("span", { className: classNames(styles.prefix, (_d = {}, _d[styles['prefix--with-error']] = error, _d), (_e = {}, _e[styles['prefix--disabled']] = disabled, _e)), children: prefix })), (!label || labelInsideInput) && (jsx("label", { htmlFor: uniqueId, className: classNames(styles.placeholder, (
|
|
26
|
+
_c)), placeholder: label || labelInsideInput ? placeholder : ' ', disabled: disabled, "aria-invalid": !!error, "aria-errormessage": error ? "".concat(uniqueId, "-error") : undefined }, props)), prefix && (jsx("span", { className: classNames(styles.prefix, (_d = {}, _d[styles['prefix--with-error']] = error, _d), (_e = {}, _e[styles['prefix--disabled']] = disabled, _e), (_f = {}, _f[styles['prefix--with-value']] = props.value, _f)), children: prefix })), (!label || labelInsideInput) && (jsx("label", { htmlFor: uniqueId, className: classNames(styles.placeholder, (_g = {}, _g[styles['placeholder--with-prefix']] = prefix, _g), (_h = {}, _h[styles['placeholder--with-error']] = error, _h)), children: labelInsideInput ? label : placeholder }))] }), error && (jsx("p", { id: "".concat(uniqueId, "-error"), className: "p-p--small tc-red-500 w100 ".concat(styles.error), children: error }))] }));
|
|
27
27
|
});
|
|
28
28
|
|
|
29
29
|
export { Input };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../../../../src/lib/components/input/index.tsx"],"sourcesContent":["import React, { useState } from 'react';\nimport classnames from 'classnames';\nimport generateId from '../../util/generateId';\n\nimport styles from './style.module.scss';\n\n// Something weird is going on with enterKeyHint that makes it a required field under certain circumstances. The & Omit<…> and & Pick<…> is a hacky way to go around that.\nexport type InputProps = Omit<JSX.IntrinsicElements['input'], 'enterKeyHint'> &\n Partial<Pick<JSX.IntrinsicElements['input'], 'enterKeyHint'>> & {\n error?: string | boolean;\n prefix?: string;\n label?: string;\n id?: string;\n hideLabel?: boolean;\n labelInsideInput?: boolean;\n };\n\nexport const Input = React.forwardRef(\n (\n {\n className,\n placeholder,\n label,\n id,\n prefix,\n error,\n disabled,\n hideLabel = false,\n labelInsideInput = false,\n ...props\n }: InputProps,\n ref?: React.ForwardedRef<HTMLInputElement>\n ) => {\n const [uniqueId] = useState(id ?? generateId());\n\n return (\n <div className={`${styles.container} ${className ?? ''}`}>\n {label && !labelInsideInput && (\n <label\n htmlFor={uniqueId}\n className={classnames('p-p', styles.label, {\n [styles['label--with-error']]: error,\n 'sr-only': hideLabel,\n })}\n >\n {label}\n </label>\n )}\n <div style={{ position: 'relative' }}>\n <input\n id={uniqueId}\n data-testid=\"ds-input-input\"\n type=\"text\"\n ref={ref}\n className={classnames(\n error ? 'p-input--error' : 'p-input',\n (!label || labelInsideInput) &&\n placeholder &&\n placeholder.length > 0\n ? styles.input\n : styles['input--no-placeholder'],\n {\n [styles['input--with-prefix']]: prefix,\n [styles['input--with-inside-label']]: labelInsideInput,\n }\n )}\n placeholder={label || labelInsideInput ? placeholder : ' '}\n disabled={disabled}\n aria-invalid={!!error}\n aria-errormessage={error ? `${uniqueId}-error` : undefined}\n {...props}\n />\n {prefix && (\n <span\n className={classnames(\n styles.prefix,\n { [styles['prefix--with-error']]: error },\n { [styles['prefix--disabled']]: disabled }\n )}\n >\n {prefix}\n </span>\n )}\n {(!label || labelInsideInput) && (\n <label\n htmlFor={uniqueId}\n className={classnames(\n styles.placeholder,\n { [styles['placeholder--with-prefix']]: prefix },\n { [styles['placeholder--with-error']]: error }\n )}\n >\n {labelInsideInput ? label : placeholder}\n </label>\n )}\n </div>\n {error && (\n <p\n id={`${uniqueId}-error`}\n className={`p-p--small tc-red-500 w100 ${styles.error}`}\n >\n {error}\n </p>\n )}\n </div>\n );\n }\n);\n"],"names":["React","_jsxs","_jsx","classnames"],"mappings":";;;;;;;;;;;IAiBa,KAAK,GAAGA,cAAK,CAAC,UAAU,CACnC,UACE,EAWa,EACb,GAA0C;;IAXxC,IAAA,SAAS,eAAA,EACT,WAAW,iBAAA,EACX,KAAK,WAAA,EACL,EAAE,QAAA,EACF,MAAM,YAAA,EACN,KAAK,WAAA,EACL,QAAQ,cAAA,EACR,iBAAiB,EAAjB,SAAS,mBAAG,KAAK,KAAA,EACjB,wBAAwB,EAAxB,gBAAgB,mBAAG,KAAK,KAAA,EACrB,KAAK,cAVV,2GAWC,CADS;IAIH,IAAA,QAAQ,GAAI,QAAQ,CAAC,EAAE,aAAF,EAAE,cAAF,EAAE,GAAI,UAAU,EAAE,CAAC,GAAhC,CAAiC;IAEhD,QACEC,cAAK,SAAS,EAAE,UAAG,MAAM,CAAC,SAAS,cAAI,SAAS,aAAT,SAAS,cAAT,SAAS,GAAI,EAAE,CAAE,aACrD,KAAK,IAAI,CAAC,gBAAgB,KACzBC,eACE,OAAO,EAAE,QAAQ,EACjB,SAAS,EAAEC,UAAU,CAAC,KAAK,EAAE,MAAM,CAAC,KAAK;oBACvC,GAAC,MAAM,CAAC,mBAAmB,CAAC,IAAG,KAAK;oBACpC,aAAS,GAAE,SAAS;wBACpB,YAED,KAAK,GACA,CACT,EACDF,cAAK,KAAK,EAAE,EAAE,QAAQ,EAAE,UAAU,EAAE,aAClCC,wBACE,EAAE,EAAE,QAAQ,iBACA,gBAAgB,EAC5B,IAAI,EAAC,MAAM,EACX,GAAG,EAAE,GAAG,EACR,SAAS,EAAEC,UAAU,CACnB,KAAK,GAAG,gBAAgB,GAAG,SAAS,EACpC,CAAC,CAAC,KAAK,IAAI,gBAAgB;4BACzB,WAAW;4BACX,WAAW,CAAC,MAAM,GAAG,CAAC;8BACpB,MAAM,CAAC,KAAK;8BACZ,MAAM,CAAC,uBAAuB,CAAC;4BAEjC,GAAC,MAAM,CAAC,oBAAoB,CAAC,IAAG,MAAM;4BACtC,GAAC,MAAM,CAAC,0BAA0B,CAAC,IAAG,gBAAgB;gCAEzD,EACD,WAAW,EAAE,KAAK,IAAI,gBAAgB,GAAG,WAAW,GAAG,GAAG,EAC1D,QAAQ,EAAE,QAAQ,kBACJ,CAAC,CAAC,KAAK,uBACF,KAAK,GAAG,UAAG,QAAQ,WAAQ,GAAG,SAAS,IACtD,KAAK,EACT,EACD,MAAM,KACLD,cACE,SAAS,EAAEC,UAAU,CACnB,MAAM,CAAC,MAAM,YACX,GAAC,MAAM,CAAC,oBAAoB,CAAC,IAAG,KAAK,iBACrC,GAAC,MAAM,CAAC,kBAAkB,CAAC,IAAG,QAAQ,
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../../../src/lib/components/input/index.tsx"],"sourcesContent":["import React, { useState } from 'react';\nimport classnames from 'classnames';\nimport generateId from '../../util/generateId';\n\nimport styles from './style.module.scss';\n\n// Something weird is going on with enterKeyHint that makes it a required field under certain circumstances. The & Omit<…> and & Pick<…> is a hacky way to go around that.\nexport type InputProps = Omit<JSX.IntrinsicElements['input'], 'enterKeyHint'> &\n Partial<Pick<JSX.IntrinsicElements['input'], 'enterKeyHint'>> & {\n error?: string | boolean;\n prefix?: string;\n label?: string;\n id?: string;\n hideLabel?: boolean;\n labelInsideInput?: boolean;\n };\n\nexport const Input = React.forwardRef(\n (\n {\n className,\n placeholder,\n label,\n id,\n prefix,\n error,\n disabled,\n hideLabel = false,\n labelInsideInput = false,\n ...props\n }: InputProps,\n ref?: React.ForwardedRef<HTMLInputElement>\n ) => {\n const [uniqueId] = useState(id ?? generateId());\n\n return (\n <div className={`${styles.container} ${className ?? ''}`}>\n {label && !labelInsideInput && (\n <label\n htmlFor={uniqueId}\n className={classnames('p-p', styles.label, {\n [styles['label--with-error']]: error,\n 'sr-only': hideLabel,\n })}\n >\n {label}\n </label>\n )}\n <div style={{ position: 'relative' }}>\n <input\n id={uniqueId}\n data-testid=\"ds-input-input\"\n type=\"text\"\n ref={ref}\n className={classnames(\n error ? 'p-input--error' : 'p-input',\n (!label || labelInsideInput) &&\n placeholder &&\n placeholder.length > 0\n ? styles.input\n : styles['input--no-placeholder'],\n {\n [styles['input--with-prefix']]: prefix,\n [styles['input--with-inside-label']]: labelInsideInput,\n }\n )}\n placeholder={label || labelInsideInput ? placeholder : ' '}\n disabled={disabled}\n aria-invalid={!!error}\n aria-errormessage={error ? `${uniqueId}-error` : undefined}\n {...props}\n />\n {prefix && (\n <span\n className={classnames(\n styles.prefix,\n { [styles['prefix--with-error']]: error },\n { [styles['prefix--disabled']]: disabled },\n { [styles['prefix--with-value']]: props.value }\n )}\n >\n {prefix}\n </span>\n )}\n {(!label || labelInsideInput) && (\n <label\n htmlFor={uniqueId}\n className={classnames(\n styles.placeholder,\n { [styles['placeholder--with-prefix']]: prefix },\n { [styles['placeholder--with-error']]: error }\n )}\n >\n {labelInsideInput ? label : placeholder}\n </label>\n )}\n </div>\n {error && (\n <p\n id={`${uniqueId}-error`}\n className={`p-p--small tc-red-500 w100 ${styles.error}`}\n >\n {error}\n </p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AoB,CAAC,IAAG,MAAM;4BACtC,GAAC,MAAM,CAAC,0BAA0B,CAAC,IAAG,gBAAgB;gCAEzD,EACD,WAAW,EAAE,KAAK,IAAI,gBAAgB,GAAG,WAAW,GAAG,GAAG,EAC1D,QAAQ,EAAE,QAAQ,kBACJ,CAAC,CAAC,KAAK,uBACF,KAAK,GAAG,UAAG,QAAQ,WAAQ,GAAG,SAAS,IACtD,KAAK,EACT,EACD,MAAM,KACLD,cACE,SAAS,EAAEC,UAAU,CACnB,MAAM,CAAC,MAAM,YACX,GAAC,MAAM,CAAC,oBAAoB,CAAC,IAAG,KAAK,iBACrC,GAAC,MAAM,CAAC,kBAAkB,CAAC,IAAG,QAAQ,iBACtC,GAAC,MAAM,CAAC,oBAAoB,CAAC,IAAG,KAAK,CAAC,KAAK,MAC9C,YAEA,MAAM,GACF,CACR,EACA,CAAC,CAAC,KAAK,IAAI,gBAAgB,MAC1BD,eACE,OAAO,EAAE,QAAQ,EACjB,SAAS,EAAEC,UAAU,CACnB,MAAM,CAAC,WAAW,YAChB,GAAC,MAAM,CAAC,0BAA0B,CAAC,IAAG,MAAM,iBAC5C,GAAC,MAAM,CAAC,yBAAyB,CAAC,IAAG,KAAK,MAC7C,YAEA,gBAAgB,GAAG,KAAK,GAAG,WAAW,GACjC,CACT,IACG,EACL,KAAK,KACJD,WACE,EAAE,EAAE,UAAG,QAAQ,WAAQ,EACvB,SAAS,EAAE,qCAA8B,MAAM,CAAC,KAAK,CAAE,YAEtD,KAAK,GACJ,CACL,IACG,EACN;AACJ,CAAC;;;;"}
|
|
@@ -2,7 +2,7 @@ import { a as __assign } from '../../tslib.es6-a39f91fc.js';
|
|
|
2
2
|
import { jsx } from 'react/jsx-runtime';
|
|
3
3
|
import { useState } from 'react';
|
|
4
4
|
import { Input } from './index.js';
|
|
5
|
-
import { s as sharedConfig } from '../../config-
|
|
5
|
+
import { s as sharedConfig } from '../../config-bc609993.js';
|
|
6
6
|
import '../../index-6ea95111.js';
|
|
7
7
|
import '../../index-69a46657.js';
|
|
8
8
|
import '../../style-inject.es-1f59c1d0.js';
|
|
@@ -11,13 +11,13 @@ var story = __assign(__assign({ title: 'JSX/Inputs/Input', component: Input }, s
|
|
|
11
11
|
componentSubtitle: 'The default input component is used to gather informations from the user.'
|
|
12
12
|
} });
|
|
13
13
|
var InputStory = function (_a) {
|
|
14
|
-
var onChange = _a.onChange, className = _a.className, placeholder = _a.placeholder, value = _a.value, label = _a.label, hideLabel = _a.hideLabel, labelInsideInput = _a.labelInsideInput, prefix = _a.prefix, error = _a.error;
|
|
14
|
+
var onChange = _a.onChange, className = _a.className, placeholder = _a.placeholder, value = _a.value, label = _a.label, hideLabel = _a.hideLabel, labelInsideInput = _a.labelInsideInput, prefix = _a.prefix, error = _a.error, disabled = _a.disabled;
|
|
15
15
|
var _b = useState(value), newValue = _b[0], setValue = _b[1];
|
|
16
16
|
var handleOnChange = function (event) {
|
|
17
17
|
setValue(event.target.value);
|
|
18
18
|
onChange === null || onChange === void 0 ? void 0 : onChange(event);
|
|
19
19
|
};
|
|
20
|
-
return (jsx(Input, { onChange: handleOnChange, value: newValue, className: className, placeholder: placeholder, label: label, hideLabel: hideLabel, labelInsideInput: labelInsideInput, prefix: prefix, error: error }));
|
|
20
|
+
return (jsx(Input, { onChange: handleOnChange, value: newValue, className: className, placeholder: placeholder, label: label, hideLabel: hideLabel, labelInsideInput: labelInsideInput, prefix: prefix, error: error, disabled: disabled }));
|
|
21
21
|
};
|
|
22
22
|
InputStory.storyName = 'Input';
|
|
23
23
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"input.stories.js","sources":["../../../../../src/lib/components/input/input.stories.tsx"],"sourcesContent":["\nimport { ChangeEvent, useState } from 'react';\nimport { Input, InputProps } from '.';\nimport sharedConfig from './stories/config';\n\nconst story = {\n title: 'JSX/Inputs/Input',\n component: Input,\n ...sharedConfig,\n parameters: {\n componentSubtitle: 'The default input component is used to gather informations from the user.'\n }\n};\n\nexport const InputStory = ({ \n onChange,\n className,\n placeholder,\n value,\n label,\n hideLabel,\n labelInsideInput,\n prefix,\n error\n}: InputProps) => {\n const [newValue, setValue] = useState(value);\n\n const handleOnChange = (event: ChangeEvent<HTMLInputElement>) => {\n setValue(event.target.value)\n onChange?.(event);\n }\n\n return (\n <Input \n onChange={handleOnChange}\n value={newValue}\n className={className}\n placeholder={placeholder}\n label={label}\n hideLabel={hideLabel}\n labelInsideInput={labelInsideInput}\n prefix={prefix}\n error={error}\n />\n );\n};\n\nInputStory.storyName = 'Input';\n\nexport default story;\n"],"names":["_jsx"],"mappings":";;;;;;;;;IAKM,KAAK,uBACT,KAAK,EAAE,kBAAkB,EACzB,SAAS,EAAE,KAAK,IACb,YAAY,KACf,UAAU,EAAE;QACV,iBAAiB,EAAE,2EAA2E;KAC/F,IACD;IAEW,UAAU,GAAG,UAAC,
|
|
1
|
+
{"version":3,"file":"input.stories.js","sources":["../../../../../src/lib/components/input/input.stories.tsx"],"sourcesContent":["\nimport { ChangeEvent, useState } from 'react';\nimport { Input, InputProps } from '.';\nimport sharedConfig from './stories/config';\n\nconst story = {\n title: 'JSX/Inputs/Input',\n component: Input,\n ...sharedConfig,\n parameters: {\n componentSubtitle: 'The default input component is used to gather informations from the user.'\n }\n};\n\nexport const InputStory = ({ \n onChange,\n className,\n placeholder,\n value,\n label,\n hideLabel,\n labelInsideInput,\n prefix,\n error,\n disabled\n}: InputProps) => {\n const [newValue, setValue] = useState(value);\n\n const handleOnChange = (event: ChangeEvent<HTMLInputElement>) => {\n setValue(event.target.value)\n onChange?.(event);\n }\n\n return (\n <Input \n onChange={handleOnChange}\n value={newValue}\n className={className}\n placeholder={placeholder}\n label={label}\n hideLabel={hideLabel}\n labelInsideInput={labelInsideInput}\n prefix={prefix}\n error={error}\n disabled={disabled}\n />\n );\n};\n\nInputStory.storyName = 'Input';\n\nexport default story;\n"],"names":["_jsx"],"mappings":";;;;;;;;;IAKM,KAAK,uBACT,KAAK,EAAE,kBAAkB,EACzB,SAAS,EAAE,KAAK,IACb,YAAY,KACf,UAAU,EAAE;QACV,iBAAiB,EAAE,2EAA2E;KAC/F,IACD;IAEW,UAAU,GAAG,UAAC,EAWd;QAVX,QAAQ,cAAA,EACR,SAAS,eAAA,EACT,WAAW,iBAAA,EACX,KAAK,WAAA,EACL,KAAK,WAAA,EACL,SAAS,eAAA,EACT,gBAAgB,sBAAA,EAChB,MAAM,YAAA,EACN,KAAK,WAAA,EACL,QAAQ,cAAA;IAEF,IAAA,KAAuB,QAAQ,CAAC,KAAK,CAAC,EAArC,QAAQ,QAAA,EAAE,QAAQ,QAAmB,CAAC;IAE7C,IAAM,cAAc,GAAG,UAAC,KAAoC;QAC1D,QAAQ,CAAC,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,CAAA;QAC5B,QAAQ,aAAR,QAAQ,uBAAR,QAAQ,CAAG,KAAK,CAAC,CAAC;KACnB,CAAA;IAED,QACEA,IAAC,KAAK,IACJ,QAAQ,EAAE,cAAc,EACxB,KAAK,EAAE,QAAQ,EACf,SAAS,EAAE,SAAS,EACpB,WAAW,EAAE,WAAW,EACxB,KAAK,EAAE,KAAK,EACZ,SAAS,EAAE,SAAS,EACpB,gBAAgB,EAAE,gBAAgB,EAClC,MAAM,EAAE,MAAM,EACd,KAAK,EAAE,KAAK,EACZ,QAAQ,EAAE,QAAQ,GAClB,EACF;AACJ,EAAE;AAEF,UAAU,CAAC,SAAS,GAAG,OAAO;;;;;"}
|
|
@@ -3,7 +3,7 @@ import { jsx, jsxs } from 'react/jsx-runtime';
|
|
|
3
3
|
import { c as classNames } from '../../../index-6ea95111.js';
|
|
4
4
|
import { s as styleInject } from '../../../style-inject.es-1f59c1d0.js';
|
|
5
5
|
|
|
6
|
-
var css_248z = ".styles-module_container__F0d5Q {\n max-width: 100%;\n}\n\n.styles-module_toggleContainer__2yz_j {\n position: relative;\n width: 40px;\n height: 12px;\n}\n\n.styles-module_label__3EAX_ {\n align-items: center;\n}\n\n.styles-module_toggle__2sL88 {\n position: absolute;\n cursor: pointer;\n top: 0;\n left: 0;\n right: 0;\n bottom: 0;\n background: var(--ds-neutral-400);\n transition: all 0.3s ease-in-out;\n border-radius: 100px;\n}\n.styles-module_toggle__2sL88:before {\n position: absolute;\n content: \"\";\n height: 20px;\n width: 20px;\n left: 0;\n bottom: -4px;\n background: var(--ds-neutral-
|
|
6
|
+
var css_248z = ".styles-module_container__F0d5Q {\n max-width: 100%;\n}\n\n.styles-module_toggleContainer__2yz_j {\n position: relative;\n width: 40px;\n height: 12px;\n}\n\n.styles-module_label__3EAX_ {\n align-items: center;\n}\n\n.styles-module_toggle__2sL88 {\n position: absolute;\n cursor: pointer;\n top: 0;\n left: 0;\n right: 0;\n bottom: 0;\n background: var(--ds-neutral-400);\n transition: all 0.3s ease-in-out;\n border-radius: 100px;\n}\n.styles-module_toggle__2sL88:before {\n position: absolute;\n content: \"\";\n height: 20px;\n width: 20px;\n left: 0;\n bottom: -4px;\n background: var(--ds-neutral-500);\n transition: 0.3s ease-in-out;\n transition-property: background-color, outline, transform;\n outline-color: var(--ds-neutral-500);\n border-radius: 50%;\n}\n\n.styles-module_input__2sUF3 {\n opacity: 0;\n}\n.styles-module_input__2sUF3:checked + .styles-module_toggle__2sL88 {\n background: var(--ds-purple-400);\n}\n.styles-module_input__2sUF3:checked + .styles-module_toggle__2sL88:before {\n background: var(--ds-purple-600);\n}\n.styles-module_input__2sUF3:checked:focus-visible ~ .styles-module_toggle__2sL88:before {\n outline: 3px solid var(--ds-purple-500);\n}\n.styles-module_input__2sUF3:disabled + .styles-module_toggle__2sL88 {\n cursor: not-allowed;\n opacity: 0.4;\n}\n.styles-module_input__2sUF3:focus-visible ~ .styles-module_toggle__2sL88:before {\n outline: 3px solid var(--ds-neutral-600);\n}\n.styles-module_input__2sUF3:checked + .styles-module_toggle__2sL88:before {\n transform: translateX(20px);\n}";
|
|
7
7
|
var styles = {"container":"styles-module_container__F0d5Q","toggleContainer":"styles-module_toggleContainer__2yz_j","label":"styles-module_label__3EAX_","toggle":"styles-module_toggle__2sL88","input":"styles-module_input__2sUF3"};
|
|
8
8
|
styleInject(css_248z);
|
|
9
9
|
|
|
@@ -100,7 +100,7 @@ var BottomOrRegularModalStory = function (_a) {
|
|
|
100
100
|
onClose();
|
|
101
101
|
setDisplay(false);
|
|
102
102
|
};
|
|
103
|
-
return (jsxs(Fragment, { children: [jsx(
|
|
103
|
+
return (jsxs(Fragment, { children: [jsx(Button, { className: "wmn2", onClick: function () { return setDisplay(true); }, children: "Click to open modal" }), jsx(BottomOrRegularModal, { dismissible: dismissible, className: className, classNames: classNames, title: title, isOpen: display, size: size, onModalScroll: onModalScroll, onClose: handleOnClose, children: jsxs("div", { style: { padding: '0 24px 24px 24px' }, children: [jsx("div", { children: children }), jsx("button", { className: "p-btn--primary mt24 wmn3", onClick: function () { return setDisplay(false); }, children: "Continue" })] }) })] }));
|
|
104
104
|
};
|
|
105
105
|
BottomOrRegularModalStory.storyName = 'BottomOrRegularModal';
|
|
106
106
|
var RegularModalStory = function (_a) {
|
|
@@ -110,7 +110,7 @@ var RegularModalStory = function (_a) {
|
|
|
110
110
|
onClose();
|
|
111
111
|
setDisplay(false);
|
|
112
112
|
};
|
|
113
|
-
return (jsxs(Fragment, { children: ["Regular modals are primary meant to be used on Desktop or Tablet environment. The modal will appear in the middle of the screen and the user will be able to dismiss them using the top left \"X\" icon. If you want to use it for Mobile only, you should check BottomModal instead. Want to use either Regular Modal or Bottom Modal based on the screen width? You can use Bottom or Regular modal.", jsx(
|
|
113
|
+
return (jsxs(Fragment, { children: ["Regular modals are primary meant to be used on Desktop or Tablet environment. The modal will appear in the middle of the screen and the user will be able to dismiss them using the top left \"X\" icon. If you want to use it for Mobile only, you should check BottomModal instead. Want to use either Regular Modal or Bottom Modal based on the screen width? You can use Bottom or Regular modal.", jsx(Button, { className: "wmn2 mt24", onClick: function () { return setDisplay(true); }, children: "Click to open modal" }), jsx(RegularModal, { title: title, isOpen: display, onClose: handleOnClose, children: jsxs("div", { style: { padding: '0 24px 24px 24px' }, children: [jsx("div", { children: children }), jsx("button", { className: "p-btn--primary mt24 wmn3", onClick: function () { return setDisplay(false); }, children: "Continue" })] }) })] }));
|
|
114
114
|
};
|
|
115
115
|
RegularModalStory.storyName = 'RegularModal';
|
|
116
116
|
var BottomModalStory = function (_a) {
|
|
@@ -120,7 +120,7 @@ var BottomModalStory = function (_a) {
|
|
|
120
120
|
onClose();
|
|
121
121
|
setDisplay(false);
|
|
122
122
|
};
|
|
123
|
-
return (jsxs(Fragment, { children: ["Bottom modals are primary meant to be used on Mobile environment. The modal will appear from the bottom of the screen and the user will be able to dismiss them using the top left \"X\" icon. If you want to use it for Desktop only, you should check Regular modal instead. Want to use either Regular Modal or Bottom Modal based on the screen width? You can use Bottom or Regular modal.", jsx(
|
|
123
|
+
return (jsxs(Fragment, { children: ["Bottom modals are primary meant to be used on Mobile environment. The modal will appear from the bottom of the screen and the user will be able to dismiss them using the top left \"X\" icon. If you want to use it for Desktop only, you should check Regular modal instead. Want to use either Regular Modal or Bottom Modal based on the screen width? You can use Bottom or Regular modal.", jsx(Button, { className: "wmn2 mt24", onClick: function () { return setDisplay(true); }, children: "Click to open modal" }), jsx(BottomModal, { title: title, isOpen: display, onClose: handleOnClose, children: jsxs("div", { style: { padding: '0 24px 24px 24px' }, children: [jsx("div", { children: children }), jsx("button", { className: "p-btn--primary mt24 wmn3", onClick: function () { return setDisplay(false); }, children: "Continue" })] }) })] }));
|
|
124
124
|
};
|
|
125
125
|
BottomModalStory.storyName = 'BottomModal';
|
|
126
126
|
var FullScreenModalStory = function (_a) {
|
|
@@ -130,7 +130,7 @@ var FullScreenModalStory = function (_a) {
|
|
|
130
130
|
onClose();
|
|
131
131
|
setDisplay(false);
|
|
132
132
|
};
|
|
133
|
-
return (jsxs(Fragment, { children: ["Full screen modals are primary meant to be used as blocker screens. The modal will cover the entire screen and the user will be able to dismiss them using the top left \"X\" icon.", jsx(
|
|
133
|
+
return (jsxs(Fragment, { children: ["Full screen modals are primary meant to be used as blocker screens. The modal will cover the entire screen and the user will be able to dismiss them using the top left \"X\" icon.", jsx(Button, { className: "wmn2 mt24", onClick: function () { return setDisplay(true); }, children: "Click to open modal" }), jsx(FullScreenModal, { title: title, isOpen: display, onClose: handleOnClose, children: jsxs("div", { style: { padding: '0 24px 24px 24px' }, children: [jsx("div", { children: children }), jsx("button", { className: "p-btn--primary mt24 wmn3", onClick: function () { return setDisplay(false); }, children: "Continue" })] }) })] }));
|
|
134
134
|
};
|
|
135
135
|
FullScreenModalStory.storyName = 'FullScreenModal';
|
|
136
136
|
var NonDismissibleModal = function (_a) {
|
|
@@ -140,7 +140,7 @@ var NonDismissibleModal = function (_a) {
|
|
|
140
140
|
onClose();
|
|
141
141
|
setDisplay(false);
|
|
142
142
|
};
|
|
143
|
-
return (jsxs(Fragment, { children: ["Setting the dismissible prop to false will hide the close button and prevent the user from closing it using the escape key or clicking outside. This prop can be useful if we want the user to explicitly interact with the modal options.", jsx("strong", { children: "Warning:" }), " a modal with the dismissible prop can only be closed by changing the isOpen prop to false.", jsx(
|
|
143
|
+
return (jsxs(Fragment, { children: ["Setting the dismissible prop to false will hide the close button and prevent the user from closing it using the escape key or clicking outside. This prop can be useful if we want the user to explicitly interact with the modal options.", jsx("strong", { children: "Warning:" }), " a modal with the dismissible prop can only be closed by changing the isOpen prop to false.", jsx(Button, { className: "wmn2 mt24", onClick: function () { return setDisplay(true); }, children: "Click to open modal" }), jsx(BottomOrRegularModal, { dismissible: false, title: title, isOpen: display, onClose: handleOnClose, children: jsxs("div", { style: { padding: '0 24px 24px 24px' }, children: [jsx("div", { children: children }), jsx("button", { className: "p-btn--primary mt24 wmn3", onClick: function () { return setDisplay(false); }, children: "Continue" })] }) })] }));
|
|
144
144
|
};
|
|
145
145
|
var ModalWithFooter = function (_a) {
|
|
146
146
|
var children = _a.children, isOpen = _a.isOpen, onClose = _a.onClose, title = _a.title;
|
|
@@ -149,7 +149,7 @@ var ModalWithFooter = function (_a) {
|
|
|
149
149
|
onClose();
|
|
150
150
|
setDisplay(false);
|
|
151
151
|
};
|
|
152
|
-
return (jsxs(Fragment, { children: [jsx(
|
|
152
|
+
return (jsxs(Fragment, { children: [jsx(Button, { className: "wmn2", onClick: function () { return setDisplay(true); }, children: "Click to open modal" }), jsx(BottomOrRegularModal, { title: title, isOpen: display, onClose: handleOnClose, footer: jsxs("div", { className: "d-flex fd-row gap8", children: [jsx(Button, { variant: "textBlack", className: "w100", onClick: handleOnClose, children: "Skip" }), jsx(Button, { className: "w100", onClick: handleOnClose, children: "Continue" })] }), children: jsx("div", { className: "p24", children: jsx("div", { children: children }) }) })] }));
|
|
153
153
|
};
|
|
154
154
|
var ModalWithFooterAndScroll = function (_a) {
|
|
155
155
|
var children = _a.children, isOpen = _a.isOpen, onClose = _a.onClose, title = _a.title;
|
|
@@ -158,7 +158,7 @@ var ModalWithFooterAndScroll = function (_a) {
|
|
|
158
158
|
onClose();
|
|
159
159
|
setDisplay(false);
|
|
160
160
|
};
|
|
161
|
-
return (jsxs(Fragment, { children: [jsx(
|
|
161
|
+
return (jsxs(Fragment, { children: [jsx(Button, { className: "wmn2", onClick: function () { return setDisplay(true); }, children: "Click to open modal" }), jsx(BottomOrRegularModal, { title: title, isOpen: display, onClose: handleOnClose, footer: jsxs("div", { className: "d-flex fd-row gap8", children: [jsx(Button, { variant: "textBlack", className: "w100", onClick: handleOnClose, children: "Skip" }), jsx(Button, { className: "w100", onClick: handleOnClose, children: "Continue" })] }), children: jsx("div", { className: "p24", children: jsxs("div", { children: ["Lorem ipsum dolor sit amet, consectetur adipiscing elit.", jsx("div", { style: { height: '840px' } }), children] }) }) })] }));
|
|
162
162
|
};
|
|
163
163
|
|
|
164
164
|
export default story;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.stories.js","sources":["../../../../../src/lib/components/modal/index.stories.tsx"],"sourcesContent":["import { useState } from 'react';\nimport { BottomModal, BottomOrRegularModal, Props, RegularModal } from '.';\nimport { Button } from '../button';\nimport { FullScreenModal } from './fullScreenModal';\n\nconst story = {\n title: 'JSX/Modals',\n component: BottomOrRegularModal,\n argTypes: {\n title: {\n description: 'The title that needs to be displayed on the modal',\n },\n isOpen: {\n description:\n 'When set to `true`, the modal is displayed. When set to `false` the modal gets removed',\n },\n dismissible: {\n description: 'The content that gets displayed on the modal',\n },\n className: {\n description: 'Any additional className',\n },\n classNames: {\n description:\n 'Class names for the Modal component and its children elements',\n },\n size: {\n description: 'The size of the modal, either large or default.',\n control: 'radio',\n options: {\n default: 'default',\n large: 'large',\n },\n },\n children: {\n description: 'The content that gets displayed on the modal',\n type: 'text',\n table: {\n type: {\n summary: 'ReactNode',\n },\n },\n },\n onClose: {\n description: 'Callback when the user close the modal',\n action: true,\n table: {\n category: 'Callbacks',\n },\n },\n onModalScroll: {\n description: 'Callback when the user scroll the modal',\n action: true,\n table: {\n category: 'Callbacks',\n },\n },\n },\n args: {\n title: 'Modal title',\n isOpen: false,\n dismissible: true,\n className: '',\n classNames: {\n wrapper: '',\n container: '',\n overlay: '',\n header: '',\n closeButton: '',\n closeButtonIcon: '',\n title: '',\n body: '',\n footer: '',\n },\n children: 'Modal content to be displayed',\n size: 'default',\n },\n parameters: {\n componentSubtitle:\n 'Bottom or Regular modal will automatically choose what’s best to display based on the users screen width.',\n docs: {\n description: {\n component:\n 'Modals are dialog overlays that prevent the user from interacting with the rest of the website until an action is taken or the dialog is dismissed. Modals are purposefully disruptive and should be used thoughtfully and sparingly.',\n },\n },\n },\n};\n\nexport const BottomOrRegularModalStory = ({\n children,\n className,\n classNames,\n dismissible,\n isOpen,\n onClose,\n onModalScroll,\n size,\n title,\n}: Props) => {\n const [display, setDisplay] = useState(isOpen);\n const handleOnClose = () => {\n onClose();\n setDisplay(false);\n };\n\n return (\n <>\n <button\n className=\"d-flex p-btn--primary wmn2\"\n onClick={() => setDisplay(true)}\n >\n Click to open modal\n </button>\n\n <BottomOrRegularModal\n dismissible={dismissible}\n className={className}\n classNames={classNames}\n title={title}\n isOpen={display}\n size={size}\n onModalScroll={onModalScroll}\n onClose={handleOnClose}\n >\n <div style={{ padding: '0 24px 24px 24px' }}>\n <div>{children}</div>\n <button\n className=\"p-btn--primary mt24 wmn3\"\n onClick={() => setDisplay(false)}\n >\n Continue\n </button>\n </div>\n </BottomOrRegularModal>\n </>\n );\n};\n\nBottomOrRegularModalStory.storyName = 'BottomOrRegularModal';\n\nexport const RegularModalStory = ({\n children,\n isOpen,\n onClose,\n title,\n}: Props) => {\n const [display, setDisplay] = useState(isOpen);\n const handleOnClose = () => {\n onClose();\n setDisplay(false);\n };\n\n return (\n <>\n Regular modals are primary meant to be used on Desktop or Tablet\n environment. The modal will appear in the middle of the screen and the\n user will be able to dismiss them using the top left \"X\" icon. If you want\n to use it for Mobile only, you should check BottomModal instead. Want to\n use either Regular Modal or Bottom Modal based on the screen width? You\n can use Bottom or Regular modal.\n <button\n className=\"d-flex p-btn--primary wmn2 mt24\"\n onClick={() => setDisplay(true)}\n >\n Click to open modal\n </button>\n <RegularModal title={title} isOpen={display} onClose={handleOnClose}>\n <div style={{ padding: '0 24px 24px 24px' }}>\n <div>{children}</div>\n <button\n className=\"p-btn--primary mt24 wmn3\"\n onClick={() => setDisplay(false)}\n >\n Continue\n </button>\n </div>\n </RegularModal>\n </>\n );\n};\n\nRegularModalStory.storyName = 'RegularModal';\n\nexport const BottomModalStory = ({\n children,\n isOpen,\n onClose,\n title,\n}: Props) => {\n const [display, setDisplay] = useState(isOpen);\n const handleOnClose = () => {\n onClose();\n setDisplay(false);\n };\n\n return (\n <>\n Bottom modals are primary meant to be used on Mobile environment. The\n modal will appear from the bottom of the screen and the user will be able\n to dismiss them using the top left \"X\" icon. If you want to use it for\n Desktop only, you should check Regular modal instead. Want to use either\n Regular Modal or Bottom Modal based on the screen width? You can use\n Bottom or Regular modal.\n <button\n className=\"d-flex p-btn--primary wmn2 mt24\"\n onClick={() => setDisplay(true)}\n >\n Click to open modal\n </button>\n <BottomModal title={title} isOpen={display} onClose={handleOnClose}>\n <div style={{ padding: '0 24px 24px 24px' }}>\n <div>{children}</div>\n <button\n className=\"p-btn--primary mt24 wmn3\"\n onClick={() => setDisplay(false)}\n >\n Continue\n </button>\n </div>\n </BottomModal>\n </>\n );\n};\n\nBottomModalStory.storyName = 'BottomModal';\n\nexport const FullScreenModalStory = ({\n children,\n isOpen,\n onClose,\n title,\n}: Props) => {\n const [display, setDisplay] = useState(isOpen);\n const handleOnClose = () => {\n onClose();\n setDisplay(false);\n };\n\n return (\n <>\n Full screen modals are primary meant to be used as blocker screens. The\n modal will cover the entire screen and the user will be able to dismiss\n them using the top left \"X\" icon.\n <button\n className=\"d-flex p-btn--primary wmn2 mt24\"\n onClick={() => setDisplay(true)}\n >\n Click to open modal\n </button>\n <FullScreenModal title={title} isOpen={display} onClose={handleOnClose}>\n <div style={{ padding: '0 24px 24px 24px' }}>\n <div>{children}</div>\n\n <button\n className=\"p-btn--primary mt24 wmn3\"\n onClick={() => setDisplay(false)}\n >\n Continue\n </button>\n </div>\n </FullScreenModal>\n </>\n );\n};\n\nFullScreenModalStory.storyName = 'FullScreenModal';\n\nexport const NonDismissibleModal = ({\n children,\n isOpen,\n onClose,\n title,\n}: Props) => {\n const [display, setDisplay] = useState(isOpen);\n const handleOnClose = () => {\n onClose();\n setDisplay(false);\n };\n\n return (\n <>\n Setting the dismissible prop to false will hide the close button and\n prevent the user from closing it using the escape key or clicking outside.\n This prop can be useful if we want the user to explicitly interact with\n the modal options.\n <strong>Warning:</strong> a modal with the dismissible prop can only be\n closed by changing the isOpen prop to false.\n <button\n className=\"d-flex p-btn--primary wmn2 mt24\"\n onClick={() => setDisplay(true)}\n >\n Click to open modal\n </button>\n <BottomOrRegularModal\n dismissible={false}\n title={title}\n isOpen={display}\n onClose={handleOnClose}\n >\n <div style={{ padding: '0 24px 24px 24px' }}>\n <div>{children}</div>\n <button\n className=\"p-btn--primary mt24 wmn3\"\n onClick={() => setDisplay(false)}\n >\n Continue\n </button>\n </div>\n </BottomOrRegularModal>\n </>\n );\n};\n\nexport const ModalWithFooter = ({\n children,\n isOpen,\n onClose,\n title,\n}: Props) => {\n const [display, setDisplay] = useState(isOpen);\n const handleOnClose = () => {\n onClose();\n setDisplay(false);\n };\n\n return (\n <>\n <button\n className=\"d-flex p-btn--primary wmn2\"\n onClick={() => setDisplay(true)}\n >\n Click to open modal\n </button>\n\n <BottomOrRegularModal\n title={title}\n isOpen={display}\n onClose={handleOnClose}\n footer={\n <div className=\"d-flex fd-row gap8\">\n <Button\n variant=\"textColor\"\n className=\"w100\"\n onClick={handleOnClose}\n >\n Skip\n </Button>\n <Button className=\"w100\" onClick={handleOnClose}>\n Continue\n </Button>\n </div>\n }\n >\n <div className=\"p24\">\n <div>{children}</div>\n </div>\n </BottomOrRegularModal>\n </>\n );\n};\n\nexport const ModalWithFooterAndScroll = ({\n children,\n isOpen,\n onClose,\n title,\n}: Props) => {\n const [display, setDisplay] = useState(isOpen);\n const handleOnClose = () => {\n onClose();\n setDisplay(false);\n };\n\n return (\n <>\n <button\n className=\"d-flex p-btn--primary wmn2\"\n onClick={() => setDisplay(true)}\n >\n Click to open modal\n </button>\n\n <BottomOrRegularModal\n title={title}\n isOpen={display}\n onClose={handleOnClose}\n footer={\n <div className=\"d-flex fd-row gap8\">\n <Button\n variant=\"textColor\"\n className=\"w100\"\n onClick={handleOnClose}\n >\n Skip\n </Button>\n <Button className=\"w100\" onClick={handleOnClose}>\n Continue\n </Button>\n </div>\n }\n >\n <div className=\"p24\">\n <div>\n Lorem ipsum dolor sit amet, consectetur adipiscing elit.\n <div style={{ height: '840px' }} />\n {children}\n </div>\n </div>\n </BottomOrRegularModal>\n </>\n );\n};\n\nexport default story;\n"],"names":["_jsxs","_jsx"],"mappings":";;;;;;;;;;;;;;;;IAKM,KAAK,GAAG;IACZ,KAAK,EAAE,YAAY;IACnB,SAAS,EAAE,oBAAoB;IAC/B,QAAQ,EAAE;QACR,KAAK,EAAE;YACL,WAAW,EAAE,mDAAmD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A,EACP,KAAK,WAAA;IAEC,IAAA,KAAwB,QAAQ,CAAC,MAAM,CAAC,EAAvC,OAAO,QAAA,EAAE,UAAU,QAAoB,CAAC;IAC/C,IAAM,aAAa,GAAG;QACpB,OAAO,EAAE,CAAC;QACV,UAAU,CAAC,KAAK,CAAC,CAAC;KACnB,CAAC;IAEF,QACED,4BACEC,gBACE,SAAS,EAAC,4BAA4B,EACtC,OAAO,EAAE,cAAM,OAAA,UAAU,CAAC,IAAI,CAAC,GAAA,oCAGxB,EAETA,IAAC,oBAAoB,IACnB,KAAK,EAAE,KAAK,EACZ,MAAM,EAAE,OAAO,EACf,OAAO,EAAE,aAAa,EACtB,MAAM,EACJD,cAAK,SAAS,EAAC,oBAAoB,aACjCC,IAAC,MAAM,IACL,OAAO,EAAC,WAAW,EACnB,SAAS,EAAC,MAAM,EAChB,OAAO,EAAE,aAAa,qBAGf,EACTA,IAAC,MAAM,IAAC,SAAS,EAAC,MAAM,EAAC,OAAO,EAAE,aAAa,yBAEtC,IACL,YAGRA,aAAK,SAAS,EAAC,KAAK,YAClBD,qFAEEC,aAAK,KAAK,EAAE,EAAE,MAAM,EAAE,OAAO,EAAE,GAAI,EAClC,QAAQ,IACL,GACF,GACe,IACtB,EACH;AACJ;;;;;"}
|
|
1
|
+
{"version":3,"file":"index.stories.js","sources":["../../../../../src/lib/components/modal/index.stories.tsx"],"sourcesContent":["import { useState } from 'react';\nimport { BottomModal, BottomOrRegularModal, Props, RegularModal } from '.';\nimport { Button } from '../button';\nimport { FullScreenModal } from './fullScreenModal';\n\nconst story = {\n title: 'JSX/Modals',\n component: BottomOrRegularModal,\n argTypes: {\n title: {\n description: 'The title that needs to be displayed on the modal',\n },\n isOpen: {\n description:\n 'When set to `true`, the modal is displayed. When set to `false` the modal gets removed',\n },\n dismissible: {\n description: 'The content that gets displayed on the modal',\n },\n className: {\n description: 'Any additional className',\n },\n classNames: {\n description:\n 'Class names for the Modal component and its children elements',\n },\n size: {\n description: 'The size of the modal, either large or default.',\n control: 'radio',\n options: {\n default: 'default',\n large: 'large',\n },\n },\n children: {\n description: 'The content that gets displayed on the modal',\n type: 'text',\n table: {\n type: {\n summary: 'ReactNode',\n },\n },\n },\n onClose: {\n description: 'Callback when the user close the modal',\n action: true,\n table: {\n category: 'Callbacks',\n },\n },\n onModalScroll: {\n description: 'Callback when the user scroll the modal',\n action: true,\n table: {\n category: 'Callbacks',\n },\n },\n },\n args: {\n title: 'Modal title',\n isOpen: false,\n dismissible: true,\n className: '',\n classNames: {\n wrapper: '',\n container: '',\n overlay: '',\n header: '',\n closeButton: '',\n closeButtonIcon: '',\n title: '',\n body: '',\n footer: '',\n },\n children: 'Modal content to be displayed',\n size: 'default',\n },\n parameters: {\n componentSubtitle:\n 'Bottom or Regular modal will automatically choose what’s best to display based on the users screen width.',\n docs: {\n description: {\n component:\n 'Modals are dialog overlays that prevent the user from interacting with the rest of the website until an action is taken or the dialog is dismissed. Modals are purposefully disruptive and should be used thoughtfully and sparingly.',\n },\n },\n },\n};\n\nexport const BottomOrRegularModalStory = ({\n children,\n className,\n classNames,\n dismissible,\n isOpen,\n onClose,\n onModalScroll,\n size,\n title,\n}: Props) => {\n const [display, setDisplay] = useState(isOpen);\n const handleOnClose = () => {\n onClose();\n setDisplay(false);\n };\n\n return (\n <>\n <Button\n className=\"wmn2\"\n onClick={() => setDisplay(true)}\n >\n Click to open modal\n </Button>\n\n <BottomOrRegularModal\n dismissible={dismissible}\n className={className}\n classNames={classNames}\n title={title}\n isOpen={display}\n size={size}\n onModalScroll={onModalScroll}\n onClose={handleOnClose}\n >\n <div style={{ padding: '0 24px 24px 24px' }}>\n <div>{children}</div>\n <button\n className=\"p-btn--primary mt24 wmn3\"\n onClick={() => setDisplay(false)}\n >\n Continue\n </button>\n </div>\n </BottomOrRegularModal>\n </>\n );\n};\n\nBottomOrRegularModalStory.storyName = 'BottomOrRegularModal';\n\nexport const RegularModalStory = ({\n children,\n isOpen,\n onClose,\n title,\n}: Props) => {\n const [display, setDisplay] = useState(isOpen);\n const handleOnClose = () => {\n onClose();\n setDisplay(false);\n };\n\n return (\n <>\n Regular modals are primary meant to be used on Desktop or Tablet\n environment. The modal will appear in the middle of the screen and the\n user will be able to dismiss them using the top left \"X\" icon. If you want\n to use it for Mobile only, you should check BottomModal instead. Want to\n use either Regular Modal or Bottom Modal based on the screen width? You\n can use Bottom or Regular modal.\n <Button\n className=\"wmn2 mt24\"\n onClick={() => setDisplay(true)}\n >\n Click to open modal\n </Button>\n <RegularModal title={title} isOpen={display} onClose={handleOnClose}>\n <div style={{ padding: '0 24px 24px 24px' }}>\n <div>{children}</div>\n <button\n className=\"p-btn--primary mt24 wmn3\"\n onClick={() => setDisplay(false)}\n >\n Continue\n </button>\n </div>\n </RegularModal>\n </>\n );\n};\n\nRegularModalStory.storyName = 'RegularModal';\n\nexport const BottomModalStory = ({\n children,\n isOpen,\n onClose,\n title,\n}: Props) => {\n const [display, setDisplay] = useState(isOpen);\n const handleOnClose = () => {\n onClose();\n setDisplay(false);\n };\n\n return (\n <>\n Bottom modals are primary meant to be used on Mobile environment. The\n modal will appear from the bottom of the screen and the user will be able\n to dismiss them using the top left \"X\" icon. If you want to use it for\n Desktop only, you should check Regular modal instead. Want to use either\n Regular Modal or Bottom Modal based on the screen width? You can use\n Bottom or Regular modal.\n <Button\n className=\"wmn2 mt24\"\n onClick={() => setDisplay(true)}\n >\n Click to open modal\n </Button>\n <BottomModal title={title} isOpen={display} onClose={handleOnClose}>\n <div style={{ padding: '0 24px 24px 24px' }}>\n <div>{children}</div>\n <button\n className=\"p-btn--primary mt24 wmn3\"\n onClick={() => setDisplay(false)}\n >\n Continue\n </button>\n </div>\n </BottomModal>\n </>\n );\n};\n\nBottomModalStory.storyName = 'BottomModal';\n\nexport const FullScreenModalStory = ({\n children,\n isOpen,\n onClose,\n title,\n}: Props) => {\n const [display, setDisplay] = useState(isOpen);\n const handleOnClose = () => {\n onClose();\n setDisplay(false);\n };\n\n return (\n <>\n Full screen modals are primary meant to be used as blocker screens. The\n modal will cover the entire screen and the user will be able to dismiss\n them using the top left \"X\" icon.\n <Button\n className=\"wmn2 mt24\"\n onClick={() => setDisplay(true)}\n >\n Click to open modal\n </Button>\n <FullScreenModal title={title} isOpen={display} onClose={handleOnClose}>\n <div style={{ padding: '0 24px 24px 24px' }}>\n <div>{children}</div>\n\n <button\n className=\"p-btn--primary mt24 wmn3\"\n onClick={() => setDisplay(false)}\n >\n Continue\n </button>\n </div>\n </FullScreenModal>\n </>\n );\n};\n\nFullScreenModalStory.storyName = 'FullScreenModal';\n\nexport const NonDismissibleModal = ({\n children,\n isOpen,\n onClose,\n title,\n}: Props) => {\n const [display, setDisplay] = useState(isOpen);\n const handleOnClose = () => {\n onClose();\n setDisplay(false);\n };\n\n return (\n <>\n Setting the dismissible prop to false will hide the close button and\n prevent the user from closing it using the escape key or clicking outside.\n This prop can be useful if we want the user to explicitly interact with\n the modal options.\n <strong>Warning:</strong> a modal with the dismissible prop can only be\n closed by changing the isOpen prop to false.\n <Button\n className=\"wmn2 mt24\"\n onClick={() => setDisplay(true)}\n >\n Click to open modal\n </Button>\n <BottomOrRegularModal\n dismissible={false}\n title={title}\n isOpen={display}\n onClose={handleOnClose}\n >\n <div style={{ padding: '0 24px 24px 24px' }}>\n <div>{children}</div>\n <button\n className=\"p-btn--primary mt24 wmn3\"\n onClick={() => setDisplay(false)}\n >\n Continue\n </button>\n </div>\n </BottomOrRegularModal>\n </>\n );\n};\n\nexport const ModalWithFooter = ({\n children,\n isOpen,\n onClose,\n title,\n}: Props) => {\n const [display, setDisplay] = useState(isOpen);\n const handleOnClose = () => {\n onClose();\n setDisplay(false);\n };\n\n return (\n <>\n <Button\n className=\"wmn2\"\n onClick={() => setDisplay(true)}\n >\n Click to open modal\n </Button>\n\n <BottomOrRegularModal\n title={title}\n isOpen={display}\n onClose={handleOnClose}\n footer={\n <div className=\"d-flex fd-row gap8\">\n <Button\n variant=\"textBlack\"\n className=\"w100\"\n onClick={handleOnClose}\n >\n Skip\n </Button>\n <Button className=\"w100\" onClick={handleOnClose}>\n Continue\n </Button>\n </div>\n }\n >\n <div className=\"p24\">\n <div>{children}</div>\n </div>\n </BottomOrRegularModal>\n </>\n );\n};\n\nexport const ModalWithFooterAndScroll = ({\n children,\n isOpen,\n onClose,\n title,\n}: Props) => {\n const [display, setDisplay] = useState(isOpen);\n const handleOnClose = () => {\n onClose();\n setDisplay(false);\n };\n\n return (\n <>\n <Button\n className=\"wmn2\"\n onClick={() => setDisplay(true)}\n >\n Click to open modal\n </Button>\n\n <BottomOrRegularModal\n title={title}\n isOpen={display}\n onClose={handleOnClose}\n footer={\n <div className=\"d-flex fd-row gap8\">\n <Button\n variant=\"textBlack\"\n className=\"w100\"\n onClick={handleOnClose}\n >\n Skip\n </Button>\n <Button className=\"w100\" onClick={handleOnClose}>\n Continue\n </Button>\n </div>\n }\n >\n <div className=\"p24\">\n <div>\n Lorem ipsum dolor sit amet, consectetur adipiscing elit.\n <div style={{ height: '840px' }} />\n {children}\n </div>\n </div>\n </BottomOrRegularModal>\n </>\n );\n};\n\nexport default story;\n"],"names":["_jsxs","_jsx"],"mappings":";;;;;;;;;;;;;;;;IAKM,KAAK,GAAG;IACZ,KAAK,EAAE,YAAY;IACnB,SAAS,EAAE,oBAAoB;IAC/B,QAAQ,EAAE;QACR,KAAK,EAAE;YACL,WAAW,EAAE,mDAAmD;SACjE;QACD,MAAM,EAAE;YACN,WAAW,EACT,wFAAwF;SAC3F;QACD,WAAW,EAAE;YACX,WAAW,EAAE,8CAA8C;SAC5D;QACD,SAAS,EAAE;YACT,WAAW,EAAE,0BAA0B;SACxC;QACD,UAAU,EAAE;YACV,WAAW,EACT,+DAA+D;SAClE;QACD,IAAI,EAAE;YACJ,WAAW,EAAE,iDAAiD;YAC9D,OAAO,EAAE,OAAO;YAChB,OAAO,EAAE;gBACP,OAAO,EAAE,SAAS;gBAClB,KAAK,EAAE,OAAO;aACf;SACF;QACD,QAAQ,EAAE;YACR,WAAW,EAAE,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AC,oBAAoB,IACnB,KAAK,EAAE,KAAK,EACZ,MAAM,EAAE,OAAO,EACf,OAAO,EAAE,aAAa,EACtB,MAAM,EACJD,cAAK,SAAS,EAAC,oBAAoB,aACjCC,IAAC,MAAM,IACL,OAAO,EAAC,WAAW,EACnB,SAAS,EAAC,MAAM,EAChB,OAAO,EAAE,aAAa,qBAGf,EACTA,IAAC,MAAM,IAAC,SAAS,EAAC,MAAM,EAAC,OAAO,EAAE,aAAa,yBAEtC,IACL,YAGRA,aAAK,SAAS,EAAC,KAAK,YAClBD,qFAEEC,aAAK,KAAK,EAAE,EAAE,MAAM,EAAE,OAAO,EAAE,GAAI,EAClC,QAAQ,IACL,GACF,GACe,IACtB,EACH;AACJ;;;;;"}
|
|
@@ -2,7 +2,7 @@ import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
|
2
2
|
import { useState, useRef, useEffect } from 'react';
|
|
3
3
|
import { s as styleInject } from '../../style-inject.es-1f59c1d0.js';
|
|
4
4
|
|
|
5
|
-
var css_248z = ".style-module_background-container__2Gjka {\n position: relative;\n display: inline-block;\n background-color: var(--ds-
|
|
5
|
+
var css_248z = ".style-module_background-container__2Gjka {\n position: relative;\n display: inline-block;\n background-color: var(--ds-purple-100);\n border-radius: 8px;\n padding: 0 8px;\n}\n\n.style-module_chip-container__7XeKn {\n display: flex;\n align-items: center;\n}\n\n.style-module_chip__3rgLT {\n cursor: pointer;\n z-index: 2;\n padding-left: 16px;\n padding-right: 16px;\n}\n.style-module_chip__3rgLT:focus {\n outline-color: var(--ds-purple-600);\n outline-offset: 2px;\n}\n\n.style-module_select-chip-background__YCAyw {\n position: absolute;\n background-color: white;\n border-radius: 8px;\n top: 8px;\n z-index: 1;\n transition: width 0.3s, left 0.3s;\n}";
|
|
6
6
|
var styles = {"background-container":"style-module_background-container__2Gjka","chip-container":"style-module_chip-container__7XeKn","chip":"style-module_chip__3rgLT","select-chip-background":"style-module_select-chip-background__YCAyw"};
|
|
7
7
|
styleInject(css_248z);
|
|
8
8
|
|
|
@@ -12,7 +12,7 @@ import { TableContents } from './components/TableContents/TableContents.js';
|
|
|
12
12
|
import { c as classNames } from '../../index-6ea95111.js';
|
|
13
13
|
import { u as useTableNavigation } from '../../useTableNavigation-f929fbc9.js';
|
|
14
14
|
import { TableControls } from './components/TableControls/TableControls.js';
|
|
15
|
-
import { i as isBaseCell, T as TableSection } from '../../TableSection-
|
|
15
|
+
import { i as isBaseCell, T as TableSection } from '../../TableSection-018d8e8f.js';
|
|
16
16
|
import { u as useScrollSync } from '../../useScrollSync-b2d28bed.js';
|
|
17
17
|
import './components/TableCell/BaseCell/BaseCell.js';
|
|
18
18
|
import '../icon/icons/CheckThick.js';
|
|
@@ -40,8 +40,8 @@ import '../modal/regularModal/index.js';
|
|
|
40
40
|
import './components/TableContents/Collapsible.js';
|
|
41
41
|
import '../icon/icons/ChevronLeft.js';
|
|
42
42
|
|
|
43
|
-
var css_248z = ".Table-module_wrapper__2MMNq {\n position: relative;\n}\n\n.Table-module_container__3VFLP {\n overflow-x: auto;\n overflow-y: hidden;\n -ms-overflow-style: none;\n /* IE and Edge */\n scrollbar-width: none;\n /* Firefox */\n -webkit-overflow-scrolling: touch;\n scroll-snap-type: x mandatory;\n}\n.Table-module_container__3VFLP::-webkit-scrollbar {\n display: none;\n}\n@media (min-width: 34rem) {\n .Table-module_container__3VFLP {\n scroll-snap-type: unset;\n }\n}\n\n.Table-module_stickyHeader__2uEpP {\n display: flex;\n position: sticky;\n z-index: 9;\n}\n\n@media (max-width: 34rem) {\n .Table-module_modalContent__1PNgv {\n min-width: initial;\n }\n}";
|
|
44
|
-
var styles = {"wrapper":"Table-module_wrapper__2MMNq","container":"Table-module_container__3VFLP","stickyHeader":"Table-module_stickyHeader__2uEpP","modalContent":"Table-module_modalContent__1PNgv"};
|
|
43
|
+
var css_248z = ".Table-module_wrapper__2MMNq {\n position: relative;\n}\n\n.Table-module_container__3VFLP {\n overflow-x: auto;\n overflow-y: hidden;\n -ms-overflow-style: none;\n /* IE and Edge */\n scrollbar-width: none;\n /* Firefox */\n -webkit-overflow-scrolling: touch;\n scroll-snap-type: x mandatory;\n}\n.Table-module_container__3VFLP::-webkit-scrollbar {\n display: none;\n}\n@media (min-width: 34rem) {\n .Table-module_container__3VFLP {\n scroll-snap-type: unset;\n }\n}\n\n.Table-module_cardButton__3aMuL div {\n background-color: #FAF8F5;\n}\n.Table-module_cardButton__3aMuL:hover div {\n border-color: transparent !important;\n outline-color: transparent !important;\n box-shadow: none !important;\n background-color: #FCF7EF !important;\n}\n.Table-module_cardButton__3aMuL:focus-visible div {\n background-color: #FCF7EF !important;\n}\n\n.Table-module_stickyHeader__2uEpP {\n display: flex;\n position: sticky;\n z-index: 9;\n}\n\n@media (max-width: 34rem) {\n .Table-module_modalContent__1PNgv {\n min-width: initial;\n }\n}";
|
|
44
|
+
var styles = {"wrapper":"Table-module_wrapper__2MMNq","container":"Table-module_container__3VFLP","cardButton":"Table-module_cardButton__3aMuL","stickyHeader":"Table-module_stickyHeader__2uEpP","modalContent":"Table-module_modalContent__1PNgv"};
|
|
45
45
|
styleInject(css_248z);
|
|
46
46
|
|
|
47
47
|
var defaultTextOverrides = {
|
|
@@ -85,9 +85,8 @@ var Table = function (_a) {
|
|
|
85
85
|
},
|
|
86
86
|
}
|
|
87
87
|
: {}), activeCellProps, { imageComponent: imageComponent, isNavigation: true })) })] })) : (jsx("div", { "aria-hidden": true, className: styles.stickyHeader, style: { top: "".concat(stickyHeaderTopOffset, "px") }, children: jsx("div", { className: styles.container, ref: headerRef, children: jsx(TableSection, { cellReplacements: cellReplacements, className: className, hideColumns: hideColumns, hideRows: hideRows, openModal: handleOpenModal, tableCellRows: [(_j = (_h = tableData === null || tableData === void 0 ? void 0 : tableData[0]) === null || _h === void 0 ? void 0 : _h.rows) === null || _j === void 0 ? void 0 : _j[0]], title: title, imageComponent: imageComponent }) }) })), jsx("div", { ref: containerRef, className: classNames(styles.container, 'pb8'), children: jsx(TableContents, { tableData: tableData, title: title, className: className, collapsibleSections: collapsibleSections, hideColumns: hideColumns, hideDetails: hideDetails, hideRows: hideRows, isMobile: isMobile, shouldHideDetails: shouldHideDetails, openModal: handleOpenModal, cellReplacements: cellReplacements, imageComponent: imageComponent }) }), (tableData === null || tableData === void 0 ? void 0 : tableData.length) > 1 && hideDetails && (jsx(Card, { "data-testid": "show-hide-details", classNames: {
|
|
88
|
-
buttonWrapper: 'm8 mt32',
|
|
88
|
+
buttonWrapper: classNames(styles.cardButton, 'm8 mt32'),
|
|
89
89
|
title: 'd-flex gap8 ai-center jc-center fw-bold',
|
|
90
|
-
wrapper: 'bg-neutral-100',
|
|
91
90
|
}, title: jsxs(Fragment, { children: [shouldHideDetails
|
|
92
91
|
? textOverrides.showDetails
|
|
93
92
|
: textOverrides.hideDetails, shouldHideDetails ? (jsx(ChevronDownIcon, { size: 20 })) : (jsx(ChevronUpIcon, { size: 20 }))] }), actionIcon: null, dropShadow: false, titleVariant: "small", density: "compact", onClick: function () { return setShouldHideDetails(function (current) { return !current; }); } })), jsx(BottomOrRegularModal, { isOpen: (infoModalData === null || infoModalData === void 0 ? void 0 : infoModalData.body) ? true : false, title: infoModalData === null || infoModalData === void 0 ? void 0 : infoModalData.title, onClose: function () { return setInfoModalData(null); }, children: jsx("div", { className: classNames(styles.modalContent, "pt8 p24 wmn6"), children: modalContentRenderer
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Table.js","sources":["../../../../../src/lib/components/table/Table.tsx"],"sourcesContent":["import { TableCell } from './components/TableCell/TableCell';\nimport { BottomOrRegularModal } from '../modal';\nimport { ReactNode, useCallback, useRef, useState } from 'react';\nimport { ChevronDownIcon, ChevronUpIcon } from '../icon';\nimport { Card } from '../cards/card';\n\nimport styles from './Table.module.scss';\nimport { useMediaQuery } from '../../hooks/useMediaQuery';\nimport { TableContents } from './components/TableContents/TableContents';\nimport classNames from 'classnames';\nimport { useTableNavigation } from './utils/useTableNavigation/useTableNavigation';\nimport { TableControls } from './components/TableControls/TableControls';\nimport { TableSection } from './components/TableSection/TableSection';\nimport { useScrollSync } from './utils/useScrollSync/useScrollSync';\nimport {\n CellReplacements,\n isBaseCell,\n ModalData,\n ModalFunction,\n TableCellData,\n TableData,\n} from './types';\n\ntype TextOverrides = {\n showDetails?: string;\n hideDetails?: string;\n};\n\nexport interface TableProps {\n cellReplacements?: CellReplacements;\n className?: string;\n collapsibleSections?: boolean;\n hideColumns?: number[];\n hideDetails?: boolean;\n hideRows?: number[];\n imageComponent?: (args: any) => JSX.Element;\n modalContentRenderer?: (content: ReactNode) => ReactNode;\n onModalOpen?: ModalFunction;\n onSelectionChanged?: (index: number) => void;\n stickyHeaderTopOffset?: number;\n tableData: TableData;\n textOverrides?: TextOverrides;\n title: string;\n}\n\nconst defaultTextOverrides = {\n showDetails: 'Show details',\n hideDetails: 'Hide details',\n};\n\nconst Table = ({\n cellReplacements,\n className,\n collapsibleSections,\n hideColumns = [],\n hideDetails,\n hideRows = [],\n imageComponent,\n modalContentRenderer,\n onModalOpen,\n onSelectionChanged,\n stickyHeaderTopOffset = 0,\n tableData,\n textOverrides: definedTextOverrides,\n title,\n}: TableProps) => {\n const textOverrides = { ...defaultTextOverrides, ...definedTextOverrides };\n const isMobile = useMediaQuery('BELOW_MOBILE');\n const [infoModalData, setInfoModalData] = useState<ModalData | null>(null);\n const [shouldHideDetails, setShouldHideDetails] = useState(true);\n const containerRef = useRef<HTMLDivElement | null>(null);\n const headerRef = useRef<HTMLDivElement | null>(null);\n const columnsLength = tableData[0].rows[0].length;\n\n useScrollSync(headerRef, containerRef, !isMobile);\n\n const { activeSection, navigateTable } = useTableNavigation({\n enabled: isMobile,\n containerRef,\n onSelectionChanged,\n });\n\n const titleCell = {\n text: '',\n ...tableData?.[0]?.rows?.[0]?.[0] || {},\n };\n const currentActiveSection = tableData?.[0]?.rows?.[0]?.[activeSection];\n const currentActiveSectionReplacements =\n (currentActiveSection.cellId &&\n cellReplacements?.[currentActiveSection.cellId]) ||\n {};\n\n const activeCellProps = {\n ...currentActiveSection,\n ...currentActiveSectionReplacements,\n } as TableCellData;\n\n const handleOpenModal: ModalFunction = useCallback(({ body, title }) => {\n onModalOpen?.({ body, title });\n setInfoModalData({ body, title });\n }, []);\n\n return (\n <div className={classNames(styles.wrapper, 'bg-white')}>\n {isMobile ? (\n <>\n {titleCell?.text && (\n <TableCell\n {...titleCell}\n align='left'\n isNavigation\n isTopLeftCell\n type={undefined}\n />\n )}\n\n <TableControls\n activeSection={activeSection}\n columnsLength={columnsLength}\n navigateTable={navigateTable}\n stickyHeaderTopOffset={stickyHeaderTopOffset}\n >\n <TableCell\n {...(isBaseCell(currentActiveSection)\n ? {\n openModal: (body: ReactNode) =>\n handleOpenModal({\n body,\n title: currentActiveSection?.text,\n }),\n }\n : {})}\n {...activeCellProps}\n imageComponent={imageComponent}\n isNavigation\n />\n </TableControls>\n </>\n ) : (\n <div\n aria-hidden\n className={styles.stickyHeader}\n style={{ top: `${stickyHeaderTopOffset}px` }}\n >\n <div className={styles.container} ref={headerRef}>\n <TableSection\n cellReplacements={cellReplacements}\n className={className}\n hideColumns={hideColumns}\n hideRows={hideRows}\n openModal={handleOpenModal}\n tableCellRows={[tableData?.[0]?.rows?.[0]]}\n title={title}\n imageComponent={imageComponent}\n />\n </div>\n </div>\n )}\n\n <div ref={containerRef} className={classNames(styles.container, 'pb8')}>\n <TableContents\n tableData={tableData}\n title={title}\n className={className}\n collapsibleSections={collapsibleSections}\n hideColumns={hideColumns}\n hideDetails={hideDetails}\n hideRows={hideRows}\n isMobile={isMobile}\n shouldHideDetails={shouldHideDetails}\n openModal={handleOpenModal}\n cellReplacements={cellReplacements}\n imageComponent={imageComponent}\n />\n </div>\n\n {tableData?.length > 1 && hideDetails && (\n <Card\n data-testid=\"show-hide-details\"\n classNames={{\n buttonWrapper: 'm8 mt32',\n title: 'd-flex gap8 ai-center jc-center fw-bold',\n wrapper: 'bg-neutral-100',\n }}\n title={\n <>\n {shouldHideDetails\n ? textOverrides.showDetails\n : textOverrides.hideDetails}\n {shouldHideDetails ? (\n <ChevronDownIcon size={20} />\n ) : (\n <ChevronUpIcon size={20} />\n )}\n </>\n }\n actionIcon={null}\n dropShadow={false}\n titleVariant=\"small\"\n density=\"compact\"\n onClick={() => setShouldHideDetails((current) => !current)}\n />\n )}\n\n <BottomOrRegularModal\n isOpen={infoModalData?.body ? true : false}\n title={infoModalData?.title}\n onClose={() => setInfoModalData(null)}\n >\n <div className={classNames(styles.modalContent, \"pt8 p24 wmn6\")}>\n {modalContentRenderer\n ? modalContentRenderer(infoModalData?.body)\n : infoModalData?.body}\n </div>\n </BottomOrRegularModal>\n </div>\n );\n};\n\nexport { Table };\n"],"names":["_jsxs","_jsx"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA6CA,IAAM,oBAAoB,GAAG;IAC3B,WAAW,EAAE,cAAc;IAC3B,WAAW,EAAE,cAAc;CAC5B,CAAC;IAEI,KAAK,GAAG,UAAC,EAeF;;QAdX,gBAAgB,sBAAA,EAChB,SAAS,eAAA,EACT,mBAAmB,yBAAA,EACnB,mBAAgB,EAAhB,WAAW,mBAAG,EAAE,KAAA,EAChB,WAAW,iBAAA,EACX,gBAAa,EAAb,QAAQ,mBAAG,EAAE,KAAA,EACb,cAAc,oBAAA,EACd,oBAAoB,0BAAA,EACpB,WAAW,iBAAA,EACX,kBAAkB,wBAAA,EAClB,6BAAyB,EAAzB,qBAAqB,mBAAG,CAAC,KAAA,EACzB,SAAS,eAAA,EACM,oBAAoB,mBAAA,EACnC,KAAK,WAAA;IAEL,IAAM,aAAa,yBAAQ,oBAAoB,GAAK,oBAAoB,CAAE,CAAC;IAC3E,IAAM,QAAQ,GAAG,aAAa,CAAC,cAAc,CAAC,CAAC;IACzC,IAAA,KAAoC,QAAQ,CAAmB,IAAI,CAAC,EAAnE,aAAa,QAAA,EAAE,gBAAgB,QAAoC,CAAC;IACrE,IAAA,KAA4C,QAAQ,CAAC,IAA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Aa,uBAAb,aAAa,CAAE,IAAI,IAAG,IAAI,GAAG,KAAK,EAC1C,KAAK,EAAE,aAAa,aAAb,aAAa,uBAAb,aAAa,CAAE,KAAK,EAC3B,OAAO,EAAE,cAAM,OAAA,gBAAgB,CAAC,IAAI,CAAC,GAAA,YAErCA,aAAK,SAAS,EAAE,UAAU,CAAC,MAAM,CAAC,YAAY,EAAE,cAAc,CAAC,YAC5D,oBAAoB;0BACjB,oBAAoB,CAAC,aAAa,aAAb,aAAa,uBAAb,aAAa,CAAE,IAAI,CAAC;0BACzC,aAAa,aAAb,aAAa,uBAAb,aAAa,CAAE,IAAI,GACnB,GACe,IACnB,EACN;AACJ;;;;"}
|
|
1
|
+
{"version":3,"file":"Table.js","sources":["../../../../../src/lib/components/table/Table.tsx"],"sourcesContent":["import { TableCell } from './components/TableCell/TableCell';\nimport { BottomOrRegularModal } from '../modal';\nimport { ReactNode, useCallback, useRef, useState } from 'react';\nimport { ChevronDownIcon, ChevronUpIcon } from '../icon';\nimport { Card } from '../cards/card';\n\nimport styles from './Table.module.scss';\nimport { useMediaQuery } from '../../hooks/useMediaQuery';\nimport { TableContents } from './components/TableContents/TableContents';\nimport classNames from 'classnames';\nimport { useTableNavigation } from './utils/useTableNavigation/useTableNavigation';\nimport { TableControls } from './components/TableControls/TableControls';\nimport { TableSection } from './components/TableSection/TableSection';\nimport { useScrollSync } from './utils/useScrollSync/useScrollSync';\nimport {\n CellReplacements,\n isBaseCell,\n ModalData,\n ModalFunction,\n TableCellData,\n TableData,\n} from './types';\n\ntype TextOverrides = {\n showDetails?: string;\n hideDetails?: string;\n};\n\nexport interface TableProps {\n cellReplacements?: CellReplacements;\n className?: string;\n collapsibleSections?: boolean;\n hideColumns?: number[];\n hideDetails?: boolean;\n hideRows?: number[];\n imageComponent?: (args: any) => JSX.Element;\n modalContentRenderer?: (content: ReactNode) => ReactNode;\n onModalOpen?: ModalFunction;\n onSelectionChanged?: (index: number) => void;\n stickyHeaderTopOffset?: number;\n tableData: TableData;\n textOverrides?: TextOverrides;\n title: string;\n}\n\nconst defaultTextOverrides = {\n showDetails: 'Show details',\n hideDetails: 'Hide details',\n};\n\nconst Table = ({\n cellReplacements,\n className,\n collapsibleSections,\n hideColumns = [],\n hideDetails,\n hideRows = [],\n imageComponent,\n modalContentRenderer,\n onModalOpen,\n onSelectionChanged,\n stickyHeaderTopOffset = 0,\n tableData,\n textOverrides: definedTextOverrides,\n title,\n}: TableProps) => {\n const textOverrides = { ...defaultTextOverrides, ...definedTextOverrides };\n const isMobile = useMediaQuery('BELOW_MOBILE');\n const [infoModalData, setInfoModalData] = useState<ModalData | null>(null);\n const [shouldHideDetails, setShouldHideDetails] = useState(true);\n const containerRef = useRef<HTMLDivElement | null>(null);\n const headerRef = useRef<HTMLDivElement | null>(null);\n const columnsLength = tableData[0].rows[0].length;\n\n useScrollSync(headerRef, containerRef, !isMobile);\n\n const { activeSection, navigateTable } = useTableNavigation({\n enabled: isMobile,\n containerRef,\n onSelectionChanged,\n });\n\n const titleCell = {\n text: '',\n ...tableData?.[0]?.rows?.[0]?.[0] || {},\n };\n const currentActiveSection = tableData?.[0]?.rows?.[0]?.[activeSection];\n const currentActiveSectionReplacements =\n (currentActiveSection.cellId &&\n cellReplacements?.[currentActiveSection.cellId]) ||\n {};\n\n const activeCellProps = {\n ...currentActiveSection,\n ...currentActiveSectionReplacements,\n } as TableCellData;\n\n const handleOpenModal: ModalFunction = useCallback(({ body, title }) => {\n onModalOpen?.({ body, title });\n setInfoModalData({ body, title });\n }, []);\n\n return (\n <div className={classNames(styles.wrapper, 'bg-white')}>\n {isMobile ? (\n <>\n {titleCell?.text && (\n <TableCell\n {...titleCell}\n align='left'\n isNavigation\n isTopLeftCell\n type={undefined}\n />\n )}\n\n <TableControls\n activeSection={activeSection}\n columnsLength={columnsLength}\n navigateTable={navigateTable}\n stickyHeaderTopOffset={stickyHeaderTopOffset}\n >\n <TableCell\n {...(isBaseCell(currentActiveSection)\n ? {\n openModal: (body: ReactNode) =>\n handleOpenModal({\n body,\n title: currentActiveSection?.text,\n }),\n }\n : {})}\n {...activeCellProps}\n imageComponent={imageComponent}\n isNavigation\n />\n </TableControls>\n </>\n ) : (\n <div\n aria-hidden\n className={styles.stickyHeader}\n style={{ top: `${stickyHeaderTopOffset}px` }}\n >\n <div className={styles.container} ref={headerRef}>\n <TableSection\n cellReplacements={cellReplacements}\n className={className}\n hideColumns={hideColumns}\n hideRows={hideRows}\n openModal={handleOpenModal}\n tableCellRows={[tableData?.[0]?.rows?.[0]]}\n title={title}\n imageComponent={imageComponent}\n />\n </div>\n </div>\n )}\n\n <div ref={containerRef} className={classNames(styles.container, 'pb8')}>\n <TableContents\n tableData={tableData}\n title={title}\n className={className}\n collapsibleSections={collapsibleSections}\n hideColumns={hideColumns}\n hideDetails={hideDetails}\n hideRows={hideRows}\n isMobile={isMobile}\n shouldHideDetails={shouldHideDetails}\n openModal={handleOpenModal}\n cellReplacements={cellReplacements}\n imageComponent={imageComponent}\n />\n </div>\n\n {tableData?.length > 1 && hideDetails && (\n <Card\n data-testid=\"show-hide-details\"\n classNames={{\n buttonWrapper: classNames(styles.cardButton, 'm8 mt32'),\n title: 'd-flex gap8 ai-center jc-center fw-bold',\n }}\n title={\n <>\n {shouldHideDetails\n ? textOverrides.showDetails\n : textOverrides.hideDetails}\n {shouldHideDetails ? (\n <ChevronDownIcon size={20} />\n ) : (\n <ChevronUpIcon size={20} />\n )}\n </>\n }\n actionIcon={null}\n dropShadow={false}\n titleVariant=\"small\"\n density=\"compact\"\n onClick={() => setShouldHideDetails((current) => !current)}\n />\n )}\n\n <BottomOrRegularModal\n isOpen={infoModalData?.body ? true : false}\n title={infoModalData?.title}\n onClose={() => setInfoModalData(null)}\n >\n <div className={classNames(styles.modalContent, \"pt8 p24 wmn6\")}>\n {modalContentRenderer\n ? modalContentRenderer(infoModalData?.body)\n : infoModalData?.body}\n </div>\n </BottomOrRegularModal>\n </div>\n );\n};\n\nexport { Table };\n"],"names":["_jsxs","_j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
@@ -37,7 +37,7 @@ import '../icon/icons/ChevronDown.js';
|
|
|
37
37
|
import '../icon/icons/ChevronUp.js';
|
|
38
38
|
import '../../useMediaQuery-1a3a2432.js';
|
|
39
39
|
import './components/TableContents/TableContents.js';
|
|
40
|
-
import '../../TableSection-
|
|
40
|
+
import '../../TableSection-018d8e8f.js';
|
|
41
41
|
import './components/TableContents/Collapsible.js';
|
|
42
42
|
import '../../useTableNavigation-f929fbc9.js';
|
|
43
43
|
import './components/TableControls/TableControls.js';
|
|
@@ -37,7 +37,7 @@ import '../icon/icons/ChevronDown.js';
|
|
|
37
37
|
import '../icon/icons/ChevronUp.js';
|
|
38
38
|
import '../../useMediaQuery-1a3a2432.js';
|
|
39
39
|
import './components/TableContents/TableContents.js';
|
|
40
|
-
import '../../TableSection-
|
|
40
|
+
import '../../TableSection-018d8e8f.js';
|
|
41
41
|
import './components/TableContents/Collapsible.js';
|
|
42
42
|
import '../../useTableNavigation-f929fbc9.js';
|
|
43
43
|
import './components/TableControls/TableControls.js';
|
|
@@ -15,8 +15,8 @@ import '../../../../../tslib.es6-a39f91fc.js';
|
|
|
15
15
|
import '../../../../../_commonjsHelpers-4730bd53.js';
|
|
16
16
|
import '../../../../icon/icons/Info.js';
|
|
17
17
|
|
|
18
|
-
var css_248z = "@media (max-width: 34rem) {\n .BaseCell-module_maxWidth__14Cly {\n max-width: calc(100% - 64px);\n }\n}\n\n.BaseCell-module_icon__1775U {\n margin: 2px;\n}\n\n.BaseCell-module_description__3_kfe {\n word-break: break-word;\n}
|
|
19
|
-
var styles = {"maxWidth":"BaseCell-module_maxWidth__14Cly","icon":"BaseCell-module_icon__1775U","description":"BaseCell-module_description__3_kfe"
|
|
18
|
+
var css_248z = "@media (max-width: 34rem) {\n .BaseCell-module_maxWidth__14Cly {\n max-width: calc(100% - 64px);\n }\n}\n\n.BaseCell-module_icon__1775U {\n margin: 2px;\n}\n\n.BaseCell-module_description__3_kfe {\n word-break: break-word;\n}";
|
|
19
|
+
var styles = {"maxWidth":"BaseCell-module_maxWidth__14Cly","icon":"BaseCell-module_icon__1775U","description":"BaseCell-module_description__3_kfe"};
|
|
20
20
|
styleInject(css_248z);
|
|
21
21
|
|
|
22
22
|
var progressLookup = {
|
|
@@ -48,7 +48,7 @@ var BaseCell = function (_a) {
|
|
|
48
48
|
'jc-center': align === 'center',
|
|
49
49
|
}), children: jsxs("div", { className: classNames('d-flex fd-column', alignClassName, (_b = {},
|
|
50
50
|
_b[styles.maxWidth] = modalContent && align === 'center',
|
|
51
|
-
_b)), children: [progressBarValue !== undefined && (jsx(MiniProgressBar, { nFilledBars: progressBarValue })), jsxs("div", { className: "d-flex ai-center", children: [(rating === null || rating === void 0 ? void 0 : rating.value) && (jsx("span", { "data-testid": "table-cell-rating", title: "".concat(rating === null || rating === void 0 ? void 0 : rating.value, " out of 3"), children: validRatingValues.map(function (value) { return (jsx(SelectedIcon, { "aria-hidden": "true", color: value <= (rating === null || rating === void 0 ? void 0 : rating.value) ? '
|
|
51
|
+
_b)), children: [progressBarValue !== undefined && (jsx(MiniProgressBar, { nFilledBars: progressBarValue })), jsxs("div", { className: "d-flex ai-center", children: [(rating === null || rating === void 0 ? void 0 : rating.value) && (jsx("span", { "data-testid": "table-cell-rating", title: "".concat(rating === null || rating === void 0 ? void 0 : rating.value, " out of 3"), children: validRatingValues.map(function (value) { return (jsx(SelectedIcon, { "aria-hidden": "true", color: value <= (rating === null || rating === void 0 ? void 0 : rating.value) ? 'neutral-900' : 'neutral-400', className: styles.icon, size: (rating === null || rating === void 0 ? void 0 : rating.type) === 'zap' ? 16 : 14 }, value)); }) })), checkmarkValue !== undefined && (jsx("span", { className: 'd-inline-block mx8', title: checkmarkValue ? 'Yes' : 'No', children: checkmarkValue ? (jsx(CheckThickIcon, { noMargin: true, "data-testid": "table-cell-boolean-yes", size: 24, "aria-hidden": true, color: "neutral-900" })) : (jsx(XIcon, { noMargin: true, "data-testid": "table-cell-boolean-no", size: 24, "aria-hidden": true, color: "neutral-400" })) })), jsxs("div", { className: "d-inline", children: [text && fontVariant === 'NORMAL' && (jsx("div", { className: classNames("p-p d-inline", { 'ml8': align !== 'left' }), "data-testid": "table-cell-text", children: text })), text && fontVariant === 'PRICE' && (jsx("div", { className: "p-h1 p--serif tc-neutral-900", "data-testid": "table-cell-content", children: text })), text && fontVariant === 'TITLE' && (jsx("h2", { "aria-hidden": true, className: "tc-grey-800 p-h2 p--serif", children: text })), modalContent && openModal && (jsx("span", { className: "ml8", children: jsx(TableInfoButton, { onClick: function () {
|
|
52
52
|
return openModal({
|
|
53
53
|
title: modalTitle,
|
|
54
54
|
body: modalContent,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BaseCell.js","sources":["../../../../../../../../src/lib/components/table/components/TableCell/BaseCell/BaseCell.tsx"],"sourcesContent":["import classNames from 'classnames';\nimport {\n CheckThickIcon,\n StarFilledIcon,\n XIcon,\n ZapFilledIcon,\n} from '../../../../icon';\nimport { ReactNode } from 'react';\nimport styles from './BaseCell.module.scss';\nimport { MiniProgressBar } from './MiniProgressBar/MiniProgressBar';\nimport { TableInfoButton } from '../../../../comparisonTable';\nimport { ModalFunction } from '../../../types';\n\nexport type FontVariant = 'NORMAL' | '
|
|
1
|
+
{"version":3,"file":"BaseCell.js","sources":["../../../../../../../../src/lib/components/table/components/TableCell/BaseCell/BaseCell.tsx"],"sourcesContent":["import classNames from 'classnames';\nimport {\n CheckThickIcon,\n StarFilledIcon,\n XIcon,\n ZapFilledIcon,\n} from '../../../../icon';\nimport { ReactNode } from 'react';\nimport styles from './BaseCell.module.scss';\nimport { MiniProgressBar } from './MiniProgressBar/MiniProgressBar';\nimport { TableInfoButton } from '../../../../comparisonTable';\nimport { ModalFunction } from '../../../types';\n\nexport type FontVariant = 'NORMAL' | 'TITLE' | 'PRICE';\n\nconst progressLookup: Record<string, number> = {\n '30%': 1,\n '50%': 2,\n '70%': 3,\n '75%': 4,\n '80%': 4,\n '90%': 4,\n '75%-90%': 4,\n '75%-100%': 4,\n '80%-100%': 4,\n '100%': 5,\n};\n\nexport type Alignment = 'center' | 'left' | 'right';\n\nexport type BaseCellProps = {\n align?: Alignment;\n checkmarkValue?: boolean;\n description?: ReactNode;\n fontVariant?: FontVariant;\n hideProgressBar?: boolean;\n modalTitle?: ReactNode;\n modalContent?: ReactNode;\n openModal?: ModalFunction;\n text?: ReactNode;\n rating?: {\n value: number;\n type: 'zap' | 'star';\n };\n className?: string;\n dataTestId?: string;\n dataCy?: string;\n};\n\nexport const BaseCell = ({\n align = 'center',\n checkmarkValue,\n description = '',\n fontVariant = 'NORMAL',\n hideProgressBar = false,\n modalTitle = '',\n modalContent = '',\n openModal,\n rating,\n text = '',\n className,\n}: BaseCellProps) => {\n const alignClassName = {\n center: 'ta-center jc-center ai-center',\n left: 'ta-left jc-start',\n right: 'ta-right jc-end ai-end',\n }[align];\n\n const validRatingValues: number[] = [1, 2, 3];\n const SelectedIcon = rating?.type === 'zap' ? ZapFilledIcon : StarFilledIcon;\n\n const progressBarValue =\n !hideProgressBar && typeof text === 'string'\n ? progressLookup[text]\n : undefined;\n\n return (\n <div\n className={classNames(\n className,\n 'd-flex gap8 ai-center', {\n 'jc-center': align === 'center',\n })}\n >\n <div\n className={classNames('d-flex fd-column', alignClassName, {\n [styles.maxWidth]: modalContent && align === 'center',\n })}\n >\n {progressBarValue !== undefined && (\n <MiniProgressBar nFilledBars={progressBarValue} />\n )}\n\n <div className=\"d-flex ai-center\">\n {rating?.value && (\n <span\n data-testid=\"table-cell-rating\"\n title={`${rating?.value} out of 3`}\n >\n {validRatingValues.map((value) => (\n <SelectedIcon\n aria-hidden=\"true\"\n key={value}\n color={value <= rating?.value ? 'neutral-900' : 'neutral-400'}\n className={styles.icon}\n size={rating?.type === 'zap' ? 16 : 14}\n />\n ))}\n </span>\n )}\n\n {checkmarkValue !== undefined && (\n <span className='d-inline-block mx8' title={checkmarkValue ? 'Yes' : 'No'}>\n {checkmarkValue ? (\n <CheckThickIcon\n noMargin\n data-testid=\"table-cell-boolean-yes\"\n size={24}\n aria-hidden\n color=\"neutral-900\"\n />\n ) : (\n <XIcon\n noMargin\n data-testid=\"table-cell-boolean-no\"\n size={24}\n aria-hidden\n color=\"neutral-400\"\n />\n )}\n </span>\n )}\n\n <div className=\"d-inline\">\n {text && fontVariant === 'NORMAL' && (\n <div className={classNames(\n \"p-p d-inline\",\n { 'ml8': align !== 'left' }\n )}\n data-testid=\"table-cell-text\"\n >\n {text}\n </div>\n )}\n\n {text && fontVariant === 'PRICE' && (\n <div\n className=\"p-h1 p--serif tc-neutral-900\"\n data-testid=\"table-cell-content\"\n >\n {text}\n </div>\n )}\n\n {text && fontVariant === 'TITLE' && (\n <h2\n aria-hidden\n className=\"tc-grey-800 p-h2 p--serif\"\n >\n {text}\n </h2>\n )}\n\n {modalContent && openModal && (\n <span className=\"ml8\">\n <TableInfoButton\n onClick={() =>\n openModal({\n title: modalTitle,\n body: modalContent,\n })\n }\n />\n </span>\n )}\n </div>\n </div>\n\n {description && (\n <div\n className={classNames(\n styles.description,\n 'd-flex p-p--small tc-neutral-600',\n alignClassName\n )}\n >\n {description}\n </div>\n )}\n </div>\n </div>\n );\n};\n"],"names":["_jsx","_jsxs"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAeA,IAAM,cAAc,GAA2B;IAC7C,KAAK,EAAE,CAAC;IACR,KAAK,EAAE,CAAC;IACR,KAAK,EAAE,CAAC;IACR,KAAK,EAAE,CAAC;IACR,KAAK,EAAE,CAAC;IACR,KAAK,EAAE,CAAC;IACR,SAAS,EAAE,CAAC;IACZ,UAAU,EAAE,CAAC;IACb,UAAU,EAAE,CAAC;IACb,MAAM,EAAE,CAAC;CACV,CAAC;IAuBW,QAAQ,GAAG,UAAC,EAYT;;QAXd,aAAgB,EAAhB,KAAK,mBAAG,QAAQ,KAAA,EAChB,cAAc,oBAAA,EACd,mBAAgB,EAAhB,WAAW,mBAAG,EAAE,KAAA,EAChB,mBAAsB,EAAtB,WAAW,mBAAG,QAAQ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