@muraldevkit/ui-toolkit 4.81.0 → 4.83.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (83) hide show
  1. package/dist/cjs/components/grid/MrlCol/MrlCol.js +61 -55
  2. package/dist/cjs/components/grid/MrlCol/MrlCol.js.map +1 -1
  3. package/dist/cjs/components/grid/MrlGrid/MrlGrid.js +8 -5
  4. package/dist/cjs/components/grid/MrlGrid/MrlGrid.js.map +1 -1
  5. package/dist/cjs/components/grid/MrlRow/MrlRow.js +10 -8
  6. package/dist/cjs/components/grid/MrlRow/MrlRow.js.map +1 -1
  7. package/dist/cjs/components/grid/constants.js +47 -9
  8. package/dist/cjs/components/grid/constants.js.map +1 -1
  9. package/dist/cjs/components/multi-filter/MrlMultiFilter/MrlMultiFilter.js +232 -0
  10. package/dist/cjs/components/multi-filter/MrlMultiFilter/MrlMultiFilter.js.map +1 -0
  11. package/dist/cjs/components/multi-filter/MrlMultiFilter/MrlMultiFilter.module.scss.js +8 -0
  12. package/dist/cjs/components/multi-filter/MrlMultiFilter/MrlMultiFilter.module.scss.js.map +1 -0
  13. package/dist/cjs/components/multi-filter/MrlMultiFilterContext/MrlMultiFilterContext.js +302 -0
  14. package/dist/cjs/components/multi-filter/MrlMultiFilterContext/MrlMultiFilterContext.js.map +1 -0
  15. package/dist/cjs/components/multi-filter/MrlMultiFilterField/MrlMultiFilterField.js +122 -0
  16. package/dist/cjs/components/multi-filter/MrlMultiFilterField/MrlMultiFilterField.js.map +1 -0
  17. package/dist/cjs/components/multi-filter/MrlMultiFilterField/MrlMultiFilterField.module.scss.js +8 -0
  18. package/dist/cjs/components/multi-filter/MrlMultiFilterField/MrlMultiFilterField.module.scss.js.map +1 -0
  19. package/dist/cjs/components/multi-filter/MrlMultiFilterTrigger/MrlMultiFilterTrigger.js +83 -0
  20. package/dist/cjs/components/multi-filter/MrlMultiFilterTrigger/MrlMultiFilterTrigger.js.map +1 -0
  21. package/dist/cjs/components/multi-filter/utils.js +30 -0
  22. package/dist/cjs/components/multi-filter/utils.js.map +1 -0
  23. package/dist/cjs/components/popover/MrlPopover/MrlPopover.js +16 -5
  24. package/dist/cjs/components/popover/MrlPopover/MrlPopover.js.map +1 -1
  25. package/dist/cjs/index.js +12 -0
  26. package/dist/cjs/index.js.map +1 -1
  27. package/dist/cjs/version.js +1 -1
  28. package/dist/cjs/version.js.map +1 -1
  29. package/dist/esm/components/grid/MrlCol/MrlCol.js +62 -56
  30. package/dist/esm/components/grid/MrlCol/MrlCol.js.map +1 -1
  31. package/dist/esm/components/grid/MrlGrid/MrlGrid.js +8 -5
  32. package/dist/esm/components/grid/MrlGrid/MrlGrid.js.map +1 -1
  33. package/dist/esm/components/grid/MrlRow/MrlRow.js +10 -8
  34. package/dist/esm/components/grid/MrlRow/MrlRow.js.map +1 -1
  35. package/dist/esm/components/grid/constants.js +46 -9
  36. package/dist/esm/components/grid/constants.js.map +1 -1
  37. package/dist/esm/components/multi-filter/MrlMultiFilter/MrlMultiFilter.js +207 -0
  38. package/dist/esm/components/multi-filter/MrlMultiFilter/MrlMultiFilter.js.map +1 -0
  39. package/dist/esm/components/multi-filter/MrlMultiFilter/MrlMultiFilter.module.scss.js +4 -0
  40. package/dist/esm/components/multi-filter/MrlMultiFilter/MrlMultiFilter.module.scss.js.map +1 -0
  41. package/dist/esm/components/multi-filter/MrlMultiFilterContext/MrlMultiFilterContext.js +276 -0
  42. package/dist/esm/components/multi-filter/MrlMultiFilterContext/MrlMultiFilterContext.js.map +1 -0
  43. package/dist/esm/components/multi-filter/MrlMultiFilterField/MrlMultiFilterField.js +97 -0
  44. package/dist/esm/components/multi-filter/MrlMultiFilterField/MrlMultiFilterField.js.map +1 -0
  45. package/dist/esm/components/multi-filter/MrlMultiFilterField/MrlMultiFilterField.module.scss.js +4 -0
  46. package/dist/esm/components/multi-filter/MrlMultiFilterField/MrlMultiFilterField.module.scss.js.map +1 -0
  47. package/dist/esm/components/multi-filter/MrlMultiFilterTrigger/MrlMultiFilterTrigger.js +58 -0
  48. package/dist/esm/components/multi-filter/MrlMultiFilterTrigger/MrlMultiFilterTrigger.js.map +1 -0
  49. package/dist/esm/components/multi-filter/utils.js +28 -0
  50. package/dist/esm/components/multi-filter/utils.js.map +1 -0
  51. package/dist/esm/components/popover/MrlPopover/MrlPopover.js +16 -5
  52. package/dist/esm/components/popover/MrlPopover/MrlPopover.js.map +1 -1
  53. package/dist/esm/index.js +4 -0
  54. package/dist/esm/index.js.map +1 -1
  55. package/dist/esm/version.js +1 -1
  56. package/dist/esm/version.js.map +1 -1
  57. package/dist/styles/MrlMultiFilter/module.scss +30 -0
  58. package/dist/styles/MrlMultiFilterField/module.scss +7 -0
  59. package/dist/styles/MrlSidebar/module.scss +2 -2
  60. package/dist/styles/grid/global.scss +97 -2
  61. package/dist/styles.css +3 -7
  62. package/dist/types/components/grid/MrlCol/MrlCol.d.ts +4 -6
  63. package/dist/types/components/grid/MrlCol/index.d.ts +1 -1
  64. package/dist/types/components/grid/MrlGrid/MrlGrid.d.ts +9 -4
  65. package/dist/types/components/grid/MrlGrid/index.d.ts +1 -1
  66. package/dist/types/components/grid/MrlRow/MrlRow.d.ts +7 -7
  67. package/dist/types/components/grid/MrlRow/index.d.ts +1 -1
  68. package/dist/types/components/grid/constants.d.ts +56 -13
  69. package/dist/types/components/grid/index.d.ts +1 -1
  70. package/dist/types/components/index.d.ts +1 -0
  71. package/dist/types/components/multi-filter/MrlMultiFilter/MrlMultiFilter.d.ts +166 -0
  72. package/dist/types/components/multi-filter/MrlMultiFilter/index.d.ts +1 -0
  73. package/dist/types/components/multi-filter/MrlMultiFilterContext/MrlMultiFilterContext.d.ts +141 -0
  74. package/dist/types/components/multi-filter/MrlMultiFilterContext/index.d.ts +1 -0
  75. package/dist/types/components/multi-filter/MrlMultiFilterField/MrlMultiFilterField.d.ts +121 -0
  76. package/dist/types/components/multi-filter/MrlMultiFilterField/index.d.ts +1 -0
  77. package/dist/types/components/multi-filter/MrlMultiFilterTrigger/MrlMultiFilterTrigger.d.ts +52 -0
  78. package/dist/types/components/multi-filter/MrlMultiFilterTrigger/index.d.ts +1 -0
  79. package/dist/types/components/multi-filter/index.d.ts +4 -0
  80. package/dist/types/components/multi-filter/utils.d.ts +8 -0
  81. package/dist/types/components/popover/MrlPopover/MrlPopover.d.ts +7 -1
  82. package/package.json +1 -1
  83. package/dist/styles/grid/variables.scss +0 -26
@@ -1 +1 @@
1
- {"version":3,"file":"MrlCol.js","sources":["../../../../../src/components/grid/MrlCol/MrlCol.tsx"],"sourcesContent":["import * as React from 'react';\nimport classnames from 'classnames';\nimport { LayoutComponent } from '../../layout/constants';\nimport { GridSizes, GridColumns } from '../constants';\n\ntype MrlCol = LayoutComponent & GridColumns;\n\nconst getBootstrapClass = (size: string, type: string, val: number | string): string =>\n\tsize === 'col' || size === 'xs' ? `${type}-${val}` : `${type}-${size}-${val}`;\n\n/**\n * Creates the size classes for the grid.\n * @param props - component props\n * @returns an array of size classes based on bootstrap grid API\n */\nconst createSizeClasses = (props: GridColumns): string[] => {\n\tconst classes: string[] = [];\n\n\tfor (const size of GridSizes) {\n\t\t// get the value based on the prop key from the component props\n\t\tconst value = props[size as keyof GridColumns];\n\n\t\t// create the size class based on the value using the bootstrap grid API\n\t\tif (value) {\n\t\t\t// if the value is a number, then it is a column size\n\t\t\tif (typeof value === 'number') {\n\t\t\t\tclasses.push(getBootstrapClass(size, 'col', value));\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\t// if the value is an object, then we need to compose multiple classes\n\t\t\t// based on the keyvalue pairings\n\t\t\tif (value !== null && typeof value === 'object') {\n\t\t\t\tfor (const [key, val] of Object.entries(value)) {\n\t\t\t\t\tif (val === 0 || val === undefined) continue;\n\t\t\t\t\tclasses.push(getBootstrapClass(size, key, val as number));\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\tif (classes.length === 0) classes.push('col');\n\n\treturn classes;\n};\n\n/**\n * Gets the grid size props from the component props.\n * @param props - component props\n * @returns object of grid size props\n */\nconst getGridProps = (props: MrlCol): GridColumns => {\n\tconst { col, xs, sm, md, lg, xl, xxl } = props;\n\n\t// eslint-disable-next-line sort-keys\n\treturn { col, xs, sm, md, lg, xl, xxl };\n};\n\n/**\n * MrlCol React component.\n * @param props - component props\n * @returns a MrlCol React component.\n */\nexport function MrlCol(props: MrlCol): JSX.Element {\n\tconst { children, className = '', ...rest } = props;\n\tconst gridProps = getGridProps(props);\n\n\tconst columnClasses = React.useMemo(() => createSizeClasses(gridProps), [gridProps]);\n\tconst allClasses = classnames(className, columnClasses);\n\n\treturn (\n\t\t<div {...rest} className={allClasses}>\n\t\t\t{children}\n\t\t</div>\n\t);\n}\n"],"names":["getBootstrapClass","size","type","val","concat","createSizeClasses","props","classes","GridSizes","value","push","_ref3","Object","entries","_ref2","_slicedToArray","key","undefined","length","getGridProps","col","xs","sm","md","lg","xl","xxl","MrlCol","children","_props$className","className","rest","_objectWithoutProperties","_excluded","gridProps","columnClasses","React","useMemo","allClasses","classnames","createElement","_extends"],"mappings":";;;;;;AAOA,IAAMA,iBAAiB,GAAGA,CAACC,IAAY,EAAEC,IAAY,EAAEC,GAAoB,KAC1EF,IAAI,KAAK,KAAK,IAAIA,IAAI,KAAK,IAAI,GAAA,EAAA,CAAAG,MAAA,CAAMF,IAAI,OAAAE,MAAA,CAAID,GAAG,CAAA,GAAA,EAAA,CAAAC,MAAA,CAAQF,IAAI,EAAA,GAAA,CAAA,CAAAE,MAAA,CAAIH,IAAI,EAAA,GAAA,CAAA,CAAAG,MAAA,CAAID,GAAG,CAAE;;AAE9E;AACA;AACA;AACA;AACA;AACA,IAAME,iBAAiB,GAAIC,KAAkB,IAAe;EAC3D,IAAMC,OAAiB,GAAG,EAAE;AAE5B,EAAA,KAAK,IAAMN,IAAI,IAAIO,SAAS,EAAE;AAC7B;AACA,IAAA,IAAMC,KAAK,GAAGH,KAAK,CAACL,IAAI,CAAsB;;AAE9C;AACA,IAAA,IAAI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OAAO;IAAEN,GAAG;IAAEC,EAAE;IAAEC,EAAE;IAAEC,EAAE;IAAEC,EAAE;IAAEC,EAAE;AAAEC,IAAAA;GAAK;AACxC,CAAC;;AAED;AACA;AACA;AACA;AACA;AACO,SAASC,MAAMA,CAACrB,KAAa,EAAe;AAClD,EAAA,IAAQsB,QAAQ,GAA8BtB,KAAK,CAA3CsB,QAAQ;IAAAC,gBAAA,GAA8BvB,KAAK,CAAjCwB,SAAS;AAATA,IAAAA,SAAS,GAAAD,gBAAA,KAAA,MAAA,GAAG,EAAE,GAAAA,gBAAA;AAAKE,IAAAA,IAAI,GAAAC,wBAAA,CAAK1B,KAAK,EAAA2B,SAAA,CAAA;AACnD,EAAA,IAAMC,SAAS,GAAGf,YAAY,CAACb,KAAK,CAAC;AAErC,EAAA,IAAM6B,aAAa,GAAGC,KAAK,CAACC,OAAO,CAAC,MAAMhC,iBAAiB,CAAC6B,SAAS,CAAC,EAAE,CAACA,SAAS,CAAC,CAAC;AACpF,EAAA,IAAMI,UAAU,GAAGC,UAAU,CAACT,SAAS,EAAEK,aAAa,CAAC;AAEvD,EAAA,oBACCC,KAAA,CAAAI,aAAA,CAAA,KAAA,EAAAC,QAAA,KAASV,IAAI,EAAA;AAAED,IAAAA,SAAS,EAAEQ;AAAW,GAAA,CAAA,EACnCV,QACG,CAAC;AAER;;;;"}
1
+ {"version":3,"file":"MrlCol.js","sources":["../../../../../src/components/grid/MrlCol/MrlCol.tsx"],"sourcesContent":["import * as React from 'react';\nimport classnames from 'classnames';\nimport { GRID_SIZE_KEYS, GridBaseProps, GridColumns } from '../constants';\n\nexport type MrlColProps = GridColumns & GridBaseProps;\n\n/**\n * Builds a single grid class. The base tier (`col`) and the deprecated `xs`\n * alias are un-prefixed; every other breakpoint carries its infix.\n * @param size - breakpoint key\n * @param type - `col` or `offset`\n * @param val - column count, or `auto`\n * @returns the grid class name\n */\nconst getGridClass = (size: string, type: string, val: number | string): string =>\n\tsize === 'col' || size === 'xs' ? `${type}-${val}` : `${type}-${size}-${val}`;\n\n/*\n * There is no `col-0` class, so a zero span produces nothing. `ColSpan` already\n * rules it out, but this is a published component and JavaScript consumers are\n * not held to that — hence a runtime check rather than a type-level one.\n */\nconst isZeroSpan = (val: unknown): boolean => val === 0;\n\n/**\n * Creates the size classes for the grid.\n *\n * `offset: 0` is kept, because `offset-<size>-0` is how a breakpoint cancels an\n * offset set on a smaller one. `col: 0` is dropped, because there is no\n * `col-0` class — a column always spans at least one track.\n * @param props - component props\n * @returns an array of size classes\n */\nconst createSizeClasses = (props: GridColumns): string[] => {\n\tconst classes: string[] = [];\n\n\tfor (const size of GRID_SIZE_KEYS) {\n\t\t// get the value based on the prop key from the component props\n\t\tconst value = props[size];\n\n\t\t// `null` is not a valid value either, but an untyped caller can still pass\n\t\t// it, and `Object.entries(null)` below would throw.\n\t\tif (value === undefined || value === null) continue;\n\n\t\t// if the value is a number or `auto`, then it is a column size\n\t\tif (typeof value === 'number' || typeof value === 'string') {\n\t\t\tif (!isZeroSpan(value)) classes.push(getGridClass(size, 'col', value));\n\t\t\tcontinue;\n\t\t}\n\n\t\t// if the value is an object, then we need to compose multiple classes\n\t\t// based on the keyvalue pairings\n\t\tfor (const [key, val] of Object.entries(value)) {\n\t\t\tif (val === undefined) continue;\n\t\t\tif (key === 'col' && isZeroSpan(val)) continue;\n\t\t\tclasses.push(getGridClass(size, key, val));\n\t\t}\n\t}\n\n\tif (classes.length === 0) classes.push('col');\n\n\treturn classes;\n};\n\n/**\n * MrlCol React component. Creates a grid column.\n * @param props - component props\n * @returns a MrlCol React component.\n */\nexport function MrlCol({\n\tchildren,\n\tclassName,\n\tcol,\n\tlg,\n\tmd,\n\tsm,\n\txl,\n\txs,\n\txxl,\n\t...rest\n}: MrlColProps): JSX.Element {\n\tconst columnClasses = createSizeClasses({ col, lg, md, sm, xl, xs, xxl });\n\tconst allClasses = classnames('MrlCol', className, columnClasses);\n\n\treturn (\n\t\t<div {...rest} className={allClasses}>\n\t\t\t{children}\n\t\t</div>\n\t);\n}\n"],"names":["getGridClass","size","type","val","concat","isZeroSpan","createSizeClasses","props","classes","GRID_SIZE_KEYS","value","undefined","push","_ref3","Object","entries","_ref2","_slicedToArray","key","length","MrlCol","_ref4","children","className","col","lg","md","sm","xl","xs","xxl","rest","_objectWithoutProperties","_excluded","columnClasses","allClasses","classnames","React","createElement","_extends"],"mappings":";;;;;;AAMA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAMA,YAAY,GAAGA,CAACC,IAAY,EAAEC,IAAY,EAAEC,GAAoB,KACrEF,IAAI,KAAK,KAAK,IAAIA,IAAI,KAAK,IAAI,GAAA,EAAA,CAAAG,MAAA,CAAMF,IAAI,OAAAE,MAAA,CAAID,GAAG,CAAA,GAAA,EAAA,CAAAC,MAAA,CAAQF,IAAI,EAAA,GAAA,CAAA,CAAAE,MAAA,CAAIH,IAAI,EAAA,GAAA,CAAA,CAAAG,MAAA,CAAID,GAAG,CAAE;;AAE9E;AACA;AACA;AACA;AACA;AACA,IAAME,UAAU,GAAIF,GAAY,IAAcA,GAAG,KAAK,CAAC;;AAEvD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAMG,iBAAiB,GAAIC,KAAkB,IAAe;EAC3D,IAAMC,OAAiB,GAAG,EAAE;AAE5B,EAAA,KAAK,IAAMP,IAAI,IAAIQ,cAAc,EAAE;AAClC;AACA,IAAA,IAAMC,KAAK,GAAGH,KAAK,CAACN,IAAI,CAAC;;AAEzB;AACA;AACA,IAAA,IAAIS,KAAK,KAAKC,SAAS,IAAID,KAAK,KAAK,IAAI,EAAE;;AAE3C;IACA,IAAI,OAAOA,KAAK,KAAK,QAAQ,IAAI,OAAOA,KAAK,KAAK,QAAQ,EAAE;AAC3D,MAAA,IAAI,CAACL,UAAU,CAACK,KAAK,CAAC,EAAEF,OAAO,CAACI,IAAI,CAACZ,YAAY,CAACC,IAAI,EAAE,KAAK,EAAES,KAAK,CAAC,CAAC;AACtE,MAAA;A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AAEC,IAAAA;AAAI,GAAC,CAAC;EACzE,IAAMK,UAAU,GAAGC,UAAU,CAAC,QAAQ,EAAEb,SAAS,EAAEW,aAAa,CAAC;AAEjE,EAAA,oBACCG,KAAA,CAAAC,aAAA,CAAA,KAAA,EAAAC,QAAA,KAASR,IAAI,EAAA;AAAER,IAAAA,SAAS,EAAEY;AAAW,GAAA,CAAA,EACnCb,QACG,CAAC;AAER;;;;"}
@@ -3,18 +3,21 @@ import * as React from 'react';
3
3
  import classnames from 'classnames';
4
4
 
5
5
  var _excluded = ["children", "className"];
6
-
7
6
  /**
8
- * MrlGrid React component.
7
+ * MrlGrid React component. Primary container of a 12-column grid built from
8
+ * MrlRow and MrlCol.
9
+ *
10
+ * Breakpoints come from the foundation tokens: sm 600px, md 834px, lg 1024px,
11
+ * xl 1280px and xxl 1440px. The gutter defaults to `--mrl-spacing-07` and can
12
+ * be overridden by setting `--mrl-grid-gutter` on any ancestor.
9
13
  * @param props - component props
10
14
  * @returns a MrlGrid React component.
11
15
  */
12
16
  function MrlGrid(_ref) {
13
17
  var children = _ref.children,
14
- _ref$className = _ref.className,
15
- className = _ref$className === void 0 ? '' : _ref$className,
18
+ className = _ref.className,
16
19
  rest = _objectWithoutProperties(_ref, _excluded);
17
- var allClasses = classnames('container', className);
20
+ var allClasses = classnames('container', 'MrlGrid', className);
18
21
  return /*#__PURE__*/React.createElement("div", _extends({}, rest, {
19
22
  className: allClasses
20
23
  }), children);
@@ -1 +1 @@
1
- {"version":3,"file":"MrlGrid.js","sources":["../../../../../src/components/grid/MrlGrid/MrlGrid.tsx"],"sourcesContent":["import * as React from 'react';\nimport classnames from 'classnames';\nimport { LayoutComponent } from '../../layout/constants';\nimport '../grid.variables.scss';\nimport '../grid.global.scss';\n\n/**\n * MrlGrid React component.\n * @param props - component props\n * @returns a MrlGrid React component.\n */\nexport function MrlGrid({ children, className = '', ...rest }: LayoutComponent): JSX.Element {\n\tconst allClasses = classnames('container', className);\n\n\treturn (\n\t\t<div {...rest} className={allClasses}>\n\t\t\t{children}\n\t\t</div>\n\t);\n}\n"],"names":["MrlGrid","_ref","children","_ref$className","className","rest","_objectWithoutProperties","_excluded","allClasses","classnames","React","createElement","_extends"],"mappings":";;;;;;AAMA;AACA;AACA;AACA;AACA;AACO,SAASA,OAAOA,CAAAC,IAAA,EAAsE;AAAA,EAAA,IAAnEC,QAAQ,GAAAD,IAAA,CAARC,QAAQ;IAAAC,cAAA,GAAAF,IAAA,CAAEG,SAAS;AAATA,IAAAA,SAAS,GAAAD,cAAA,KAAA,MAAA,GAAG,EAAE,GAAAA,cAAA;AAAKE,IAAAA,IAAI,GAAAC,wBAAA,CAAAL,IAAA,EAAAM,SAAA,CAAA;AAC1D,EAAA,IAAMC,UAAU,GAAGC,UAAU,CAAC,WAAW,EAAEL,SAAS,CAAC;AAErD,EAAA,oBACCM,KAAA,CAAAC,aAAA,CAAA,KAAA,EAAAC,QAAA,KAASP,IAAI,EAAA;AAAED,IAAAA,SAAS,EAAEI;AAAW,GAAA,CAAA,EACnCN,QACG,CAAC;AAER;;;;"}
1
+ {"version":3,"file":"MrlGrid.js","sources":["../../../../../src/components/grid/MrlGrid/MrlGrid.tsx"],"sourcesContent":["import * as React from 'react';\nimport classnames from 'classnames';\nimport { GridBaseProps } from '../constants';\nimport '../grid.global.scss';\n\nexport type MrlGridProps = GridBaseProps;\n\n/**\n * MrlGrid React component. Primary container of a 12-column grid built from\n * MrlRow and MrlCol.\n *\n * Breakpoints come from the foundation tokens: sm 600px, md 834px, lg 1024px,\n * xl 1280px and xxl 1440px. The gutter defaults to `--mrl-spacing-07` and can\n * be overridden by setting `--mrl-grid-gutter` on any ancestor.\n * @param props - component props\n * @returns a MrlGrid React component.\n */\nexport function MrlGrid({ children, className, ...rest }: MrlGridProps): JSX.Element {\n\tconst allClasses = classnames('container', 'MrlGrid', className);\n\n\treturn (\n\t\t<div {...rest} className={allClasses}>\n\t\t\t{children}\n\t\t</div>\n\t);\n}\n"],"names":["MrlGrid","_ref","children","className","rest","_objectWithoutProperties","_excluded","allClasses","classnames","React","createElement","_extends"],"mappings":";;;;;AAOA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASA,OAAOA,CAAAC,IAAA,EAA8D;AAAA,EAAA,IAA3DC,QAAQ,GAAAD,IAAA,CAARC,QAAQ;IAAEC,SAAS,GAAAF,IAAA,CAATE,SAAS;AAAKC,IAAAA,IAAI,GAAAC,wBAAA,CAAAJ,IAAA,EAAAK,SAAA,CAAA;EACrD,IAAMC,UAAU,GAAGC,UAAU,CAAC,WAAW,EAAE,SAAS,EAAEL,SAAS,CAAC;AAEhE,EAAA,oBACCM,KAAA,CAAAC,aAAA,CAAA,KAAA,EAAAC,QAAA,KAASP,IAAI,EAAA;AAAED,IAAAA,SAAS,EAAEI;AAAW,GAAA,CAAA,EACnCL,QACG,CAAC;AAER;;;;"}
@@ -1,26 +1,28 @@
1
1
  import { objectWithoutProperties as _objectWithoutProperties, extends as _extends } from '../../../_virtual/_rollupPluginBabelHelpers.js';
2
2
  import * as React from 'react';
3
3
  import classnames from 'classnames';
4
+ import { GUTTER_CLASS } from '../constants.js';
4
5
 
5
- var _excluded = ["align", "children", "className", "justify"];
6
+ var _excluded = ["align", "children", "className", "gutter", "justify"];
6
7
  /**
7
- * MrlRow React component.
8
+ * MrlRow React component. Creates a grid row.
8
9
  * @param props - component props
9
10
  * @returns a MrlRow React component.
10
11
  */
11
12
  function MrlRow(_ref) {
12
13
  var align = _ref.align,
13
14
  children = _ref.children,
14
- _ref$className = _ref.className,
15
- className = _ref$className === void 0 ? '' : _ref$className,
15
+ className = _ref.className,
16
+ _ref$gutter = _ref.gutter,
17
+ gutter = _ref$gutter === void 0 ? 1 : _ref$gutter,
16
18
  justify = _ref.justify,
17
19
  rest = _objectWithoutProperties(_ref, _excluded);
18
- var alignClass = align ? "align-items-".concat(align) : '';
20
+ var alignClass = align && "align-items-".concat(align);
19
21
  var justifyClass = justify && "justify-content-".concat(justify);
20
- var allClasses = classnames('row', className, alignClass, justifyClass);
21
- return /*#__PURE__*/React.createElement("div", _extends({
22
+ var allClasses = classnames('row', 'MrlRow', className, alignClass, justifyClass, GUTTER_CLASS[gutter]);
23
+ return /*#__PURE__*/React.createElement("div", _extends({}, rest, {
22
24
  className: allClasses
23
- }, rest), children);
25
+ }), children);
24
26
  }
25
27
 
26
28
  export { MrlRow };
@@ -1 +1 @@
1
- {"version":3,"file":"MrlRow.js","sources":["../../../../../src/components/grid/MrlRow/MrlRow.tsx"],"sourcesContent":["import * as React from 'react';\nimport classnames from 'classnames';\nimport { LayoutComponent } from '../../layout/constants';\nimport { AlignOptions, GutterSizes, JustifyOptions } from '../constants';\n\ninterface MrlRow extends LayoutComponent {\n\t/**\n\t * Flex alignment of the children within the component.\n\t */\n\talign?: AlignOptions;\n\n\t/**\n\t * Gutter size for columns within the row\n\t */\n\tgutter?: GutterSizes;\n\n\t/**\n\t * Justify content of the children within the component.\n\t */\n\tjustify?: JustifyOptions;\n}\n\n/**\n * MrlRow React component.\n * @param props - component props\n * @returns a MrlRow React component.\n */\nexport function MrlRow({ align, children, className = '', justify, ...rest }: MrlRow): JSX.Element {\n\tconst alignClass = align ? `align-items-${align}` : '';\n\tconst justifyClass = justify && `justify-content-${justify}`;\n\n\tconst allClasses = classnames('row', className, alignClass, justifyClass);\n\n\treturn (\n\t\t<div className={allClasses} {...rest}>\n\t\t\t{children}\n\t\t</div>\n\t);\n}\n"],"names":["MrlRow","_ref","align","children","_ref$className","className","justify","rest","_objectWithoutProperties","_excluded","alignClass","concat","justifyClass","allClasses","classnames","React","createElement","_extends"],"mappings":";;;;;AAsBA;AACA;AACA;AACA;AACA;AACO,SAASA,MAAMA,CAAAC,IAAA,EAA6E;AAAA,EAAA,IAA1EC,KAAK,GAAAD,IAAA,CAALC,KAAK;IAAEC,QAAQ,GAAAF,IAAA,CAARE,QAAQ;IAAAC,cAAA,GAAAH,IAAA,CAAEI,SAAS;AAATA,IAAAA,SAAS,GAAAD,cAAA,KAAA,MAAA,GAAG,EAAE,GAAAA,cAAA;IAAEE,OAAO,GAAAL,IAAA,CAAPK,OAAO;AAAKC,IAAAA,IAAI,GAAAC,wBAAA,CAAAP,IAAA,EAAAQ,SAAA,CAAA;EACzE,IAAMC,UAAU,GAAGR,KAAK,GAAA,cAAA,CAAAS,MAAA,CAAkBT,KAAK,IAAK,EAAE;AACtD,EAAA,IAAMU,YAAY,GAAGN,OAAO,uBAAAK,MAAA,CAAuBL,OAAO,CAAE;EAE5D,IAAMO,UAAU,GAAGC,UAAU,CAAC,KAAK,EAAET,SAAS,EAAEK,UAAU,EAAEE,YAAY,CAAC;AAEzE,EAAA,oBACCG,KAAA,CAAAC,aAAA,CAAA,KAAA,EAAAC,QAAA,CAAA;AAAKZ,IAAAA,SAAS,EAAEQ;GAAW,EAAKN,IAAI,CAAA,EAClCJ,QACG,CAAC;AAER;;;;"}
1
+ {"version":3,"file":"MrlRow.js","sources":["../../../../../src/components/grid/MrlRow/MrlRow.tsx"],"sourcesContent":["import * as React from 'react';\nimport classnames from 'classnames';\nimport {\n\tAlignOptions,\n\tGridBaseProps,\n\tGUTTER_CLASS,\n\tGutterSizes,\n\tJustifyOptions\n} from '../constants';\n\nexport interface MrlRowProps extends GridBaseProps {\n\t/**\n\t * Flex alignment of the children within the component.\n\t */\n\talign?: AlignOptions;\n\n\t/**\n\t * Gutter size for columns within the row.\n\t *\n\t * @default 1\n\t */\n\tgutter?: GutterSizes;\n\n\t/**\n\t * Justify content of the children within the component.\n\t */\n\tjustify?: JustifyOptions;\n}\n\n/**\n * MrlRow React component. Creates a grid row.\n * @param props - component props\n * @returns a MrlRow React component.\n */\nexport function MrlRow({\n\talign,\n\tchildren,\n\tclassName,\n\tgutter = 1,\n\tjustify,\n\t...rest\n}: MrlRowProps): JSX.Element {\n\tconst alignClass = align && `align-items-${align}`;\n\tconst justifyClass = justify && `justify-content-${justify}`;\n\n\tconst allClasses = classnames(\n\t\t'row',\n\t\t'MrlRow',\n\t\tclassName,\n\t\talignClass,\n\t\tjustifyClass,\n\t\tGUTTER_CLASS[gutter]\n\t);\n\n\treturn (\n\t\t<div {...rest} className={allClasses}>\n\t\t\t{children}\n\t\t</div>\n\t);\n}\n"],"names":["MrlRow","_ref","align","children","className","_ref$gutter","gutter","justify","rest","_objectWithoutProperties","_excluded","alignClass","concat","justifyClass","allClasses","classnames","GUTTER_CLASS","React","createElement","_extends"],"mappings":";;;;;;AA6BA;AACA;AACA;AACA;AACA;AACO,SAASA,MAAMA,CAAAC,IAAA,EAOO;AAAA,EAAA,IAN5BC,KAAK,GAAAD,IAAA,CAALC,KAAK;IACLC,QAAQ,GAAAF,IAAA,CAARE,QAAQ;IACRC,SAAS,GAAAH,IAAA,CAATG,SAAS;IAAAC,WAAA,GAAAJ,IAAA,CACTK,MAAM;AAANA,IAAAA,MAAM,GAAAD,WAAA,KAAA,MAAA,GAAG,CAAC,GAAAA,WAAA;IACVE,OAAO,GAAAN,IAAA,CAAPM,OAAO;AACJC,IAAAA,IAAI,GAAAC,wBAAA,CAAAR,IAAA,EAAAS,SAAA,CAAA;AAEP,EAAA,IAAMC,UAAU,GAAGT,KAAK,mBAAAU,MAAA,CAAmBV,KAAK,CAAE;AAClD,EAAA,IAAMW,YAAY,GAAGN,OAAO,uBAAAK,MAAA,CAAuBL,OAAO,CAAE;AAE5D,EAAA,IAAMO,UAAU,GAAGC,UAAU,CAC5B,KAAK,EACL,QAAQ,EACRX,SAAS,EACTO,UAAU,EACVE,YAAY,EACZG,YAAY,CAACV,MAAM,CACpB,CAAC;AAED,EAAA,oBACCW,KAAA,CAAAC,aAAA,CAAA,KAAA,EAAAC,QAAA,KAASX,IAAI,EAAA;AAAEJ,IAAAA,SAAS,EAAEU;AAAW,GAAA,CAAA,EACnCX,QACG,CAAC;AAER;;;;"}
@@ -3,23 +3,22 @@
3
3
  */
4
4
 
5
5
  /**
6
- * Available grid sizes
6
+ * Number of columns a `col` can span. There is no `col-0` class — a column
7
+ * always occupies at least one of the twelve tracks.
7
8
  */
8
- var GridSizes = ['col', 'xs', 'sm', 'md', 'lg', 'xl', 'xxl'];
9
9
 
10
10
  /**
11
- * Number of columns that will be span on the grid.
11
+ * Number of columns an `offset` can skip. `0` is meaningful here: it is how a
12
+ * larger breakpoint cancels an offset inherited from a smaller one.
12
13
  */
13
14
 
14
15
  /**
15
- * The type of classes that can be configured based on the bootstrap API.
16
- * Current supported:
17
- * - columns "col-<size>-<number>"
18
- * - offsets "offset-<size>-<number>""
16
+ * @deprecated Use `ColSpan` for spans or `OffsetSpan` for offsets. This union
17
+ * allowed `col={0}`, which never produced a class.
19
18
  */
20
19
 
21
20
  /**
22
- * Interface of available class selectors based on GridClass
21
+ * Interface of available class selectors per breakpoint.
23
22
  *
24
23
  * Example interface:
25
24
  * {
@@ -32,9 +31,47 @@ var GridSizes = ['col', 'xs', 'sm', 'md', 'lg', 'xl', 'xxl'];
32
31
  * Options to configure the number of columns to span on different screen sizes.
33
32
  */
34
33
 
34
+ /**
35
+ * Breakpoint keys in ascending order. Drives both class generation and the
36
+ * filtering that keeps grid props from reaching the DOM.
37
+ */
38
+ var GRID_SIZE_KEYS = ['col', 'xs', 'sm', 'md', 'lg', 'xl', 'xxl'];
39
+
35
40
  /**
36
41
  * Available gutter sizes for customizing the grid
37
42
  */
38
43
 
39
- export { GridSizes };
44
+ /**
45
+ * Gutter size to modifier class. `1` is the default declared on `.row`, so it
46
+ * needs no class.
47
+ */
48
+ var GUTTER_CLASS = {
49
+ 0: 'MrlRow-gutter--none',
50
+ 1: undefined,
51
+ 2: 'MrlRow-gutter--double'
52
+ };
53
+
54
+ /**
55
+ * Roles a generic layout wrapper may safely carry.
56
+ *
57
+ * Composite widget roles (`grid`, `row`, `gridcell`, `listbox`, `tablist`, …)
58
+ * are deliberately excluded: they promise an APG keyboard contract — roving
59
+ * tabindex or `aria-activedescendant`, arrow-key navigation, selection state —
60
+ * that these divs do not implement. The roles below are structural only and
61
+ * carry no interaction contract, so they are safe to forward.
62
+ *
63
+ * `list`/`listitem` in particular is how a row of columns is announced as
64
+ * "list, N items", and is the standard workaround for Safari/VoiceOver
65
+ * dropping implicit list semantics. `region` needs an accessible name to be
66
+ * exposed as a landmark; the type cannot enforce that.
67
+ *
68
+ * Page landmarks belong to the layout components (MrlMain, MrlPage).
69
+ */
70
+
71
+ /**
72
+ * Shared props for the grid components: every `div` attribute, with `role`
73
+ * narrowed to {@link SafeLayoutRole}.
74
+ */
75
+
76
+ export { GRID_SIZE_KEYS, GUTTER_CLASS };
40
77
  //# sourceMappingURL=constants.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"constants.js","sources":["../../../../src/components/grid/constants.ts"],"sourcesContent":["/**\n * Alignment & justification options for grid containers\n */\nexport type AlignOptions = 'start' | 'center' | 'end';\nexport type JustifyOptions = 'start' | 'center' | 'end' | 'between' | 'around';\n\n/**\n * Available grid sizes\n */\nexport const GridSizes = ['col', 'xs', 'sm', 'md', 'lg', 'xl', 'xxl'];\n\n/**\n * Number of columns that will be span on the grid.\n */\nexport type NumCols = 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12;\n\n/**\n * The type of classes that can be configured based on the bootstrap API.\n * Current supported:\n * - columns \"col-<size>-<number>\"\n * - offsets \"offset-<size>-<number>\"\"\n */\ntype GridClass = 'col' | 'offset';\n\n/**\n * Interface of available class selectors based on GridClass\n *\n * Example interface:\n * {\n * col?: number,\n * offset?: number\n * }\n */\ntype GridClassConfig = {\n\t[key in GridClass]?: NumCols;\n};\n\n/**\n * Options to configure the number of columns to span on different screen sizes.\n */\ntype ColumnConfig = NumCols | 'auto' | GridClassConfig | undefined;\n\nexport interface GridColumns {\n\t/**\n\t * Columns that are the same from the smallest of devices to the largest.\n\t */\n\tcol?: ColumnConfig;\n\n\t/**\n\t * @deprecated xs maps to col. Bootstrap grid removed xs in favor of col.\n\t */\n\txs?: ColumnConfig;\n\n\t/**\n\t * The number of columns to span from the sm breakpoint up.\n\t */\n\tsm?: ColumnConfig;\n\n\t/**\n\t * The number of columns to span from the md breakpoint up.\n\t */\n\tmd?: ColumnConfig;\n\n\t/**\n\t * The number of columns to span from the lg breakpoint up.\n\t */\n\tlg?: ColumnConfig;\n\n\t/**\n\t * The number of columns to span from the xl breakpoint up.\n\t */\n\txl?: ColumnConfig;\n\n\t/**\n\t * The number of columns to span from the xxl breakpoint up.\n\t */\n\txxl?: ColumnConfig;\n}\n\n/**\n * Available gutter sizes for customizing the grid\n */\nexport type GutterSizes = 0 | 1 | 2;\n"],"names":["GridSizes"],"mappings":"AAAA;AACA;AACA;;AAIA;AACA;AACA;IACaA,SAAS,GAAG,CAAC,KAAK,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,KAAK;;AAEpE;AACA;AACA;;AAGA;AACA;AACA;AACA;AACA;AACA;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAKA;AACA;AACA;;AAwCA;AACA;AACA;;;;"}
1
+ {"version":3,"file":"constants.js","sources":["../../../../src/components/grid/constants.ts"],"sourcesContent":["import { DataQa } from '../../utils/dataQa';\n\n/**\n * Alignment & justification options for grid containers\n */\nexport type AlignOptions = 'start' | 'center' | 'end';\nexport type JustifyOptions = 'start' | 'center' | 'end' | 'between' | 'around';\n\n/**\n * Number of columns a `col` can span. There is no `col-0` class — a column\n * always occupies at least one of the twelve tracks.\n */\nexport type ColSpan = 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12;\n\n/**\n * Number of columns an `offset` can skip. `0` is meaningful here: it is how a\n * larger breakpoint cancels an offset inherited from a smaller one.\n */\nexport type OffsetSpan = 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11;\n\n/**\n * @deprecated Use `ColSpan` for spans or `OffsetSpan` for offsets. This union\n * allowed `col={0}`, which never produced a class.\n */\nexport type NumCols = 0 | ColSpan;\n\n/**\n * Interface of available class selectors per breakpoint.\n *\n * Example interface:\n * {\n * col?: number,\n * offset?: number\n * }\n */\ntype GridClassConfig = {\n\tcol?: ColSpan;\n\toffset?: OffsetSpan;\n};\n\n/**\n * Options to configure the number of columns to span on different screen sizes.\n */\ntype ColumnConfig = ColSpan | 'auto' | GridClassConfig | undefined;\n\nexport interface GridColumns {\n\t/**\n\t * Columns that are the same from the smallest of devices to the largest.\n\t */\n\tcol?: ColumnConfig;\n\n\t/**\n\t * @deprecated Alias of `col`, kept for backwards compatibility. It resolves\n\t * to the same un-prefixed tier, so passing both `col` and `xs` emits two\n\t * competing classes and the larger span wins on CSS source order rather\n\t * than the one you wrote last. Pass only one.\n\t */\n\txs?: ColumnConfig;\n\n\t/**\n\t * The number of columns to span from the sm breakpoint up.\n\t */\n\tsm?: ColumnConfig;\n\n\t/**\n\t * The number of columns to span from the md breakpoint up.\n\t */\n\tmd?: ColumnConfig;\n\n\t/**\n\t * The number of columns to span from the lg breakpoint up.\n\t */\n\tlg?: ColumnConfig;\n\n\t/**\n\t * The number of columns to span from the xl breakpoint up.\n\t */\n\txl?: ColumnConfig;\n\n\t/**\n\t * The number of columns to span from the xxl breakpoint up.\n\t */\n\txxl?: ColumnConfig;\n}\n\n/**\n * Breakpoint keys in ascending order. Drives both class generation and the\n * filtering that keeps grid props from reaching the DOM.\n */\nexport const GRID_SIZE_KEYS = ['col', 'xs', 'sm', 'md', 'lg', 'xl', 'xxl'] as const;\n\n/**\n * Available gutter sizes for customizing the grid\n */\nexport type GutterSizes = 0 | 1 | 2;\n\n/**\n * Gutter size to modifier class. `1` is the default declared on `.row`, so it\n * needs no class.\n */\nexport const GUTTER_CLASS: Record<GutterSizes, string | undefined> = {\n\t0: 'MrlRow-gutter--none',\n\t1: undefined,\n\t2: 'MrlRow-gutter--double'\n};\n\n/**\n * Roles a generic layout wrapper may safely carry.\n *\n * Composite widget roles (`grid`, `row`, `gridcell`, `listbox`, `tablist`, …)\n * are deliberately excluded: they promise an APG keyboard contract — roving\n * tabindex or `aria-activedescendant`, arrow-key navigation, selection state —\n * that these divs do not implement. The roles below are structural only and\n * carry no interaction contract, so they are safe to forward.\n *\n * `list`/`listitem` in particular is how a row of columns is announced as\n * \"list, N items\", and is the standard workaround for Safari/VoiceOver\n * dropping implicit list semantics. `region` needs an accessible name to be\n * exposed as a landmark; the type cannot enforce that.\n *\n * Page landmarks belong to the layout components (MrlMain, MrlPage).\n */\nexport type SafeLayoutRole = 'group' | 'list' | 'listitem' | 'none' | 'presentation' | 'region';\n\n/**\n * Shared props for the grid components: every `div` attribute, with `role`\n * narrowed to {@link SafeLayoutRole}.\n */\nexport type GridBaseProps = Omit<React.ComponentPropsWithoutRef<'div'>, 'role'> &\n\tDataQa & {\n\t\t/**\n\t\t * Structural role for the wrapper. Composite widget roles are not\n\t\t * accepted — see {@link SafeLayoutRole}.\n\t\t */\n\t\trole?: SafeLayoutRole;\n\t};\n"],"names":["GRID_SIZE_KEYS","GUTTER_CLASS","undefined"],"mappings":"AAEA;AACA;AACA;;AAIA;AACA;AACA;AACA;;AAGA;AACA;AACA;AACA;;AAGA;AACA;AACA;AACA;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAMA;AACA;AACA;;AA2CA;AACA;AACA;AACA;IACaA,cAAc,GAAG,CAAC,KAAK,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,KAAK;;AAEzE;AACA;AACA;;AAGA;AACA;AACA;AACA;AACO,IAAMC,YAAqD,GAAG;AACpE,EAAA,CAAC,EAAE,qBAAqB;AACxB,EAAA,CAAC,EAAEC,SAAS;AACZ,EAAA,CAAC,EAAE;AACJ;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAGA;AACA;AACA;AACA;;;;"}
@@ -0,0 +1,207 @@
1
+ import * as React from 'react';
2
+ import classnames from 'classnames';
3
+ import styles from './MrlMultiFilter.module.scss.js';
4
+ import { MrlPopover } from '../../popover/MrlPopover/MrlPopover.js';
5
+ import { MrlMultiFilterTrigger } from '../MrlMultiFilterTrigger/MrlMultiFilterTrigger.js';
6
+ import { MrlMultiFilterContextProvider, useMrlMultiFilterContext, isMrlMultiFilterValueEmpty } from '../MrlMultiFilterContext/MrlMultiFilterContext.js';
7
+ import { MrlButton } from '../../button/MrlButton/MrlButton.js';
8
+ import { MrlTextHeading } from '../../text/MrlTextHeading/MrlTextHeading.js';
9
+ import { getUniqueId } from '../../../utils/setAttributes/setAttributes.js';
10
+
11
+ /**
12
+ * Without `transform`, `onApply` receives the draft.
13
+ *
14
+ * Docgen merges the JSDoc of both union members (this one first), so each comment below is
15
+ * written to read on its own and as the first half of the merged description.
16
+ */
17
+
18
+ /**
19
+ * With `transform`, `onApply` receives its result.
20
+ */
21
+
22
+ /**
23
+ * Counts the fields with a value set: not empty and not `false`.
24
+ *
25
+ * @param draft - The draft.
26
+ * @returns The number of fields with a value set.
27
+ */
28
+ var countFieldsWithValue = draft => Object.values(draft).filter(field => field.value !== false && !isMrlMultiFilterValueEmpty(field.value)).length;
29
+
30
+ /**
31
+ * MrlMultiFilter component.
32
+ *
33
+ * A MrlMultiFilterTrigger that opens a MrlPopover holding a heading and several filter
34
+ * fields, followed by a Reset / Cancel / Apply footer. Changes only take effect on Apply: the
35
+ * fields edit a draft, which starts from the applied filters each time the popover opens, so
36
+ * closing without Apply drops unapplied edits, and the trigger badge counts the applied
37
+ * filters. Apply hands the draft to `onApply` (through `transform`, if given) and makes it the
38
+ * applied one; Cancel sets it back to the applied filters; Reset sets it to `resetDraft` and
39
+ * keeps the popover open. Apply is blocked, and the first empty required field focused, while
40
+ * a required field is empty.
41
+ *
42
+ * Uncontrolled by default: the component keeps the applied draft. Pass `appliedDraft` and
43
+ * update it in `onApply` to control it, e.g. to clear or restore the filters from outside.
44
+ *
45
+ * Bind each field with `field={getField('name')}` from the render prop. The popover is a
46
+ * non-modal dialog named by the heading through `aria-labelledby`. It sets
47
+ * `aria-haspopup="dialog"` and `aria-expanded` on the trigger; the latter drives its toggle style. Cancel and Apply return focus to the trigger. Checkboxes inside the
48
+ * fields drop their default checkbox-group spacing.
49
+ *
50
+ * @param props - The component props.
51
+ * @returns The MrlMultiFilter component.
52
+ */
53
+ function MrlMultiFilter(props) {
54
+ return /*#__PURE__*/React.createElement(MrlMultiFilterContextProvider, {
55
+ appliedDraft: props.appliedDraft,
56
+ initialDraft: props.initialDraft
57
+ }, /*#__PURE__*/React.createElement(MrlMultiFilterContent, props));
58
+ }
59
+
60
+ /**
61
+ * Trigger and popover of the MrlMultiFilter. A component of its own so it can read the draft
62
+ * from the context.
63
+ *
64
+ * @param props - The MrlMultiFilter props.
65
+ * @returns The trigger and the popover.
66
+ */
67
+ function MrlMultiFilterContent(props) {
68
+ var _props$alignment = props.alignment,
69
+ alignment = _props$alignment === void 0 ? 'start' : _props$alignment,
70
+ _props$applyText = props.applyText,
71
+ applyText = _props$applyText === void 0 ? 'Apply' : _props$applyText,
72
+ _props$cancelText = props.cancelText,
73
+ cancelText = _props$cancelText === void 0 ? 'Cancel' : _props$cancelText,
74
+ children = props.children,
75
+ className = props.className,
76
+ _props$countActiveFil = props.countActiveFilters,
77
+ countActiveFilters = _props$countActiveFil === void 0 ? countFieldsWithValue : _props$countActiveFil,
78
+ dataQa = props['data-qa'],
79
+ heading = props.heading,
80
+ _props$headingLevel = props.headingLevel,
81
+ headingLevel = _props$headingLevel === void 0 ? '2' : _props$headingLevel,
82
+ initialDraft = props.initialDraft,
83
+ notificationText = props.notificationText,
84
+ _props$offset = props.offset,
85
+ offset = _props$offset === void 0 ? 4 : _props$offset,
86
+ onApply = props.onApply,
87
+ onCancel = props.onCancel,
88
+ _props$position = props.position,
89
+ position = _props$position === void 0 ? 'bottom' : _props$position,
90
+ _props$requiredMessag = props.requiredMessage,
91
+ requiredMessage = _props$requiredMessag === void 0 ? 'This field is required' : _props$requiredMessag,
92
+ resetDraft = props.resetDraft,
93
+ _props$resetText = props.resetText,
94
+ resetText = _props$resetText === void 0 ? 'Reset' : _props$resetText,
95
+ transform = props.transform,
96
+ triggerSize = props.triggerSize,
97
+ triggerState = props.triggerState,
98
+ triggerText = props.triggerText;
99
+ var context = useMrlMultiFilterContext();
100
+ var applied = context.applied,
101
+ draft = context.draft,
102
+ errors = context.errors;
103
+ var triggerRef = React.useRef(null);
104
+ var headingIdRef = React.useRef(getUniqueId('mrl-multi-filter-heading'));
105
+ // Like the context, ignore later changes to initialDraft.
106
+ var initialDraftRef = React.useRef(initialDraft);
107
+ var reset = () => {
108
+ var nextDraft = resetDraft !== null && resetDraft !== void 0 ? resetDraft : initialDraftRef.current;
109
+ // The latest draft, so a reset after an edit in the same handler sees the edit.
110
+ context.reset(typeof nextDraft === 'function' ? nextDraft(context.getDraft()) : nextDraft);
111
+ };
112
+ return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(MrlMultiFilterTrigger, {
113
+ activeFiltersCount: countActiveFilters(applied),
114
+ "data-qa": dataQa,
115
+ notificationText: notificationText,
116
+ ref: triggerRef,
117
+ size: triggerSize,
118
+ state: triggerState,
119
+ text: triggerText
120
+ }), /*#__PURE__*/React.createElement(MrlPopover, {
121
+ alignment: alignment,
122
+ ariaLabelledBy: headingIdRef.current,
123
+ className: classnames(styles['MrlMultiFilter'], 'MrlMultiFilter', className),
124
+ "data-qa": dataQa ? "".concat(dataQa, "-popover") : undefined,
125
+ offset: offset,
126
+ point: false,
127
+ position: position,
128
+ role: "dialog",
129
+ onOpen: context.discard,
130
+ triggerRef: triggerRef
131
+ }, _ref => {
132
+ var closePopover = _ref.closeMenu;
133
+ /**
134
+ * MrlPopover only returns focus to the trigger on Escape. Return it here too, so
135
+ * focus is not lost when the popover content unmounts.
136
+ */
137
+ var closeMenu = () => {
138
+ var _triggerRef$current;
139
+ closePopover();
140
+ (_triggerRef$current = triggerRef.current) === null || _triggerRef$current === void 0 ? void 0 : _triggerRef$current.focus();
141
+ };
142
+ var apply = () => {
143
+ if (!context.validate()) return;
144
+ // The latest draft, not this render's: a render-prop handler may have edited it
145
+ // just before calling apply, e.g. `reset(); apply();`.
146
+ var latestDraft = context.getDraft();
147
+ context.commit();
148
+ if (transform) {
149
+ onApply(transform(latestDraft));
150
+ } else {
151
+ onApply(latestDraft);
152
+ }
153
+ closeMenu();
154
+ };
155
+ var cancel = () => {
156
+ context.discard();
157
+ onCancel === null || onCancel === void 0 ? void 0 : onCancel();
158
+ closeMenu();
159
+ };
160
+ var getField = name => ({
161
+ error: errors[name] ? requiredMessage : undefined,
162
+ name: String(name),
163
+ required: Boolean(draft[name].required),
164
+ setValue: value => context.setFieldValue(name, value),
165
+ value: draft[name].value
166
+ });
167
+ return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(MrlTextHeading, {
168
+ className: classnames(styles['MrlMultiFilter-title'], 'MrlMultiFilter-title'),
169
+ id: headingIdRef.current,
170
+ level: headingLevel,
171
+ kind: "title",
172
+ size: "medium",
173
+ text: heading
174
+ }), /*#__PURE__*/React.createElement("div", {
175
+ className: classnames(styles['MrlMultiFilter-fields'], 'MrlMultiFilter-fields')
176
+ }, typeof children === 'function' ? children({
177
+ apply,
178
+ closeMenu,
179
+ draft,
180
+ getField,
181
+ reset,
182
+ setFieldValue: context.setFieldValue,
183
+ setRequired: context.setRequired
184
+ }) : children), /*#__PURE__*/React.createElement("div", {
185
+ className: classnames(styles['MrlMultiFilter-actions'], 'MrlMultiFilter-actions')
186
+ }, /*#__PURE__*/React.createElement(MrlButton, {
187
+ className: styles['MrlMultiFilter-reset'],
188
+ kind: "ghost",
189
+ onClick: reset,
190
+ size: "small",
191
+ text: resetText
192
+ }), /*#__PURE__*/React.createElement(MrlButton, {
193
+ kind: "ghost",
194
+ onClick: cancel,
195
+ size: "small",
196
+ text: cancelText
197
+ }), /*#__PURE__*/React.createElement(MrlButton, {
198
+ kind: "primary",
199
+ onClick: apply,
200
+ size: "small",
201
+ text: applyText
202
+ })));
203
+ }));
204
+ }
205
+
206
+ export { MrlMultiFilter };
207
+ //# sourceMappingURL=MrlMultiFilter.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"MrlMultiFilter.js","sources":["../../../../../src/components/multi-filter/MrlMultiFilter/MrlMultiFilter.tsx"],"sourcesContent":["import * as React from 'react';\nimport classnames from 'classnames';\nimport styles from './MrlMultiFilter.module.scss';\nimport { MrlPopover, MrlPopoverProps } from '../../popover/MrlPopover/MrlPopover';\nimport {\n\tMrlMultiFilterTrigger,\n\tMrlMultiFilterTriggerProps\n} from '../MrlMultiFilterTrigger/MrlMultiFilterTrigger';\nimport {\n\tisMrlMultiFilterValueEmpty,\n\tMrlMultiFilterContextProvider,\n\tMrlMultiFilterDraft,\n\tMrlMultiFilterValues,\n\tuseMrlMultiFilterContext\n} from '../MrlMultiFilterContext/MrlMultiFilterContext';\nimport { MrlMultiFilterFieldBinding } from '../MrlMultiFilterField/MrlMultiFilterField';\nimport { MrlButton } from '../../button/MrlButton/MrlButton';\nimport { MrlTextHeading } from '../../text/MrlTextHeading/MrlTextHeading';\nimport { LevelType } from '../../text/constants';\nimport { DataQa } from '../../../utils/dataQa';\nimport { getUniqueId } from '../../../utils/setAttributes/setAttributes';\n\nexport type MrlMultiFilterRenderProps<T extends MrlMultiFilterValues> = {\n\t/**\n\t * Validates the draft, then does what the Apply button does. Required fields cannot be\n\t * skipped.\n\t */\n\tapply: () => void;\n\t/**\n\t * Closes the popover and returns focus to the trigger. Unapplied edits are dropped.\n\t */\n\tcloseMenu: () => void;\n\t/**\n\t * The draft being edited.\n\t */\n\tdraft: MrlMultiFilterDraft<T>;\n\t/**\n\t * Returns the binding of one field, to pass to MrlMultiFilterField's `field`. Its value is\n\t * typed from the field name.\n\t */\n\tgetField: <K extends keyof T>(name: K) => MrlMultiFilterFieldBinding<T[K]>;\n\t/**\n\t * Does what the Reset button does.\n\t */\n\treset: () => void;\n\t/**\n\t * Updates one field's value in the draft. Call it from event handlers, not during render.\n\t */\n\tsetFieldValue: <K extends keyof T>(name: K, value: T[K]) => void;\n\t/**\n\t * Marks one field as required or not. Call it from event handlers, not during render.\n\t */\n\tsetRequired: (name: keyof T, required: boolean) => void;\n};\n\n/**\n * Without `transform`, `onApply` receives the draft.\n *\n * Docgen merges the JSDoc of both union members (this one first), so each comment below is\n * written to read on its own and as the first half of the merged description.\n */\ntype MrlMultiFilterApplyDraftProps<T extends MrlMultiFilterValues> = {\n\t/**\n\t * Called when Apply is pressed and every required field has a value, before the popover\n\t * closes. Receives the draft, which becomes the applied draft.\n\t */\n\tonApply: (draft: MrlMultiFilterDraft<T>) => void;\n\t/**\n\t * Reshapes the draft before it is passed to `onApply`, e.g. `getDraftValues`.\n\t */\n\ttransform?: undefined;\n};\n\n/**\n * With `transform`, `onApply` receives its result.\n */\ntype MrlMultiFilterApplyTransformedProps<T extends MrlMultiFilterValues, R> = {\n\t/**\n\t * With `transform`, it receives the transformed draft instead.\n\t */\n\tonApply: (result: R) => void;\n\t/**\n\t * Its result is what `onApply` receives.\n\t */\n\ttransform: (draft: MrlMultiFilterDraft<T>) => R;\n};\n\nexport type MrlMultiFilterProps<T extends MrlMultiFilterValues, R = MrlMultiFilterDraft<T>> = {\n\t/**\n\t * Makes the applied filters controlled: pass the applied draft and store the draft that\n\t * `onApply` receives (so leave out `transform`). When it changes, e.g. when the filters are\n\t * cleared from outside the popover, the draft and the badge follow it. When omitted, the\n\t * component keeps the applied draft itself.\n\t */\n\tappliedDraft?: MrlMultiFilterDraft<T>;\n\t/**\n\t * Label of the Apply button.\n\t */\n\tapplyText?: string;\n\t/**\n\t * Label of the Cancel button.\n\t */\n\tcancelText?: string;\n\t/**\n\t * Content of the popover, usually MrlMultiFilterField elements. Pass a function to read and\n\t * edit the draft: it receives `getField` to bind the fields, plus `draft`, `setFieldValue`,\n\t * `setRequired`, `apply`, `reset` and `closeMenu`. It only runs while the popover is open.\n\t */\n\tchildren: React.ReactNode | ((renderProps: MrlMultiFilterRenderProps<T>) => React.ReactNode);\n\t/**\n\t * Counts the filters shown on the trigger badge. It runs on the applied draft, so the count\n\t * only changes on Apply. Defaults to the fields with a value set (not empty and not `false`).\n\t */\n\tcountActiveFilters?: (applied: MrlMultiFilterDraft<T>) => number;\n\t/**\n\t * Heading shown at the top of the popover. It is also the popover's accessible name.\n\t */\n\theading: string;\n\t/**\n\t * Semantic level of the heading, based on where the filter sits in the page hierarchy.\n\t */\n\theadingLevel?: LevelType;\n\t/**\n\t * The filters the component starts from, unless `appliedDraft` is given: a `value` and an\n\t * optional `required` flag per field. The filter values type is inferred from it. Later\n\t * changes are ignored. Also what Reset goes back to, unless `resetDraft` is given.\n\t */\n\tinitialDraft: MrlMultiFilterDraft<T>;\n\t/**\n\t * Called when the Cancel button is pressed, after the draft is set back to the applied\n\t * draft and before the popover closes.\n\t */\n\tonCancel?: () => void;\n\t/**\n\t * Draft set by the Reset button, or a function that returns it from the current draft.\n\t * Defaults to `initialDraft`. The popover stays open and nothing is applied until Apply.\n\t */\n\tresetDraft?: MrlMultiFilterDraft<T> | ((draft: MrlMultiFilterDraft<T>) => MrlMultiFilterDraft<T>);\n\t/**\n\t * Label of the Reset button.\n\t */\n\tresetText?: string;\n\t/**\n\t * Message shown below a required field left empty on Apply. A field can override it.\n\t */\n\trequiredMessage?: string;\n\t/**\n\t * Size of the trigger button.\n\t */\n\ttriggerSize?: MrlMultiFilterTriggerProps['size'];\n\t/**\n\t * Interaction state of the trigger button. Only `default` and `disabled` apply.\n\t */\n\ttriggerState?: MrlMultiFilterTriggerProps['state'];\n\t/**\n\t * Visible label of the trigger button.\n\t */\n\ttriggerText: MrlMultiFilterTriggerProps['text'];\n} & (MrlMultiFilterApplyDraftProps<T> | MrlMultiFilterApplyTransformedProps<T, R>) &\n\tPick<MrlPopoverProps, 'alignment' | 'className' | 'offset' | 'position'> &\n\tPick<MrlMultiFilterTriggerProps, 'notificationText'> &\n\tDataQa;\n\n/**\n * Counts the fields with a value set: not empty and not `false`.\n *\n * @param draft - The draft.\n * @returns The number of fields with a value set.\n */\nconst countFieldsWithValue = (draft: MrlMultiFilterDraft<MrlMultiFilterValues>): number =>\n\tObject.values(draft).filter(\n\t\t(field) => field.value !== false && !isMrlMultiFilterValueEmpty(field.value)\n\t).length;\n\n/**\n * MrlMultiFilter component.\n *\n * A MrlMultiFilterTrigger that opens a MrlPopover holding a heading and several filter\n * fields, followed by a Reset / Cancel / Apply footer. Changes only take effect on Apply: the\n * fields edit a draft, which starts from the applied filters each time the popover opens, so\n * closing without Apply drops unapplied edits, and the trigger badge counts the applied\n * filters. Apply hands the draft to `onApply` (through `transform`, if given) and makes it the\n * applied one; Cancel sets it back to the applied filters; Reset sets it to `resetDraft` and\n * keeps the popover open. Apply is blocked, and the first empty required field focused, while\n * a required field is empty.\n *\n * Uncontrolled by default: the component keeps the applied draft. Pass `appliedDraft` and\n * update it in `onApply` to control it, e.g. to clear or restore the filters from outside.\n *\n * Bind each field with `field={getField('name')}` from the render prop. The popover is a\n * non-modal dialog named by the heading through `aria-labelledby`. It sets\n * `aria-haspopup=\"dialog\"` and `aria-expanded` on the trigger; the latter drives its toggle style. Cancel and Apply return focus to the trigger. Checkboxes inside the\n * fields drop their default checkbox-group spacing.\n *\n * @param props - The component props.\n * @returns The MrlMultiFilter component.\n */\nexport function MrlMultiFilter<T extends MrlMultiFilterValues, R = MrlMultiFilterDraft<T>>(\n\tprops: MrlMultiFilterProps<T, R>\n): React.ReactElement {\n\treturn (\n\t\t<MrlMultiFilterContextProvider<T>\n\t\t\tappliedDraft={props.appliedDraft}\n\t\t\tinitialDraft={props.initialDraft}\n\t\t>\n\t\t\t<MrlMultiFilterContent<T, R> {...props} />\n\t\t</MrlMultiFilterContextProvider>\n\t);\n}\n\n/**\n * Trigger and popover of the MrlMultiFilter. A component of its own so it can read the draft\n * from the context.\n *\n * @param props - The MrlMultiFilter props.\n * @returns The trigger and the popover.\n */\nfunction MrlMultiFilterContent<T extends MrlMultiFilterValues, R>(\n\tprops: MrlMultiFilterProps<T, R>\n): React.ReactElement {\n\tconst {\n\t\talignment = 'start',\n\t\tapplyText = 'Apply',\n\t\tcancelText = 'Cancel',\n\t\tchildren,\n\t\tclassName,\n\t\tcountActiveFilters = countFieldsWithValue,\n\t\t['data-qa']: dataQa,\n\t\theading,\n\t\theadingLevel = '2',\n\t\tinitialDraft,\n\t\tnotificationText,\n\t\toffset = 4,\n\t\tonApply,\n\t\tonCancel,\n\t\tposition = 'bottom',\n\t\trequiredMessage = 'This field is required',\n\t\tresetDraft,\n\t\tresetText = 'Reset',\n\t\ttransform,\n\t\ttriggerSize,\n\t\ttriggerState,\n\t\ttriggerText\n\t} = props;\n\n\tconst context = useMrlMultiFilterContext<T>();\n\tconst { applied, draft, errors } = context;\n\n\tconst triggerRef = React.useRef<HTMLButtonElement>(null);\n\tconst headingIdRef = React.useRef<string>(getUniqueId('mrl-multi-filter-heading'));\n\t// Like the context, ignore later changes to initialDraft.\n\tconst initialDraftRef = React.useRef(initialDraft);\n\n\tconst reset = () => {\n\t\tconst nextDraft = resetDraft ?? initialDraftRef.current;\n\t\t// The latest draft, so a reset after an edit in the same handler sees the edit.\n\t\tcontext.reset(typeof nextDraft === 'function' ? nextDraft(context.getDraft()) : nextDraft);\n\t};\n\n\treturn (\n\t\t<>\n\t\t\t<MrlMultiFilterTrigger\n\t\t\t\tactiveFiltersCount={countActiveFilters(applied)}\n\t\t\t\tdata-qa={dataQa}\n\t\t\t\tnotificationText={notificationText}\n\t\t\t\tref={triggerRef}\n\t\t\t\tsize={triggerSize}\n\t\t\t\tstate={triggerState}\n\t\t\t\ttext={triggerText}\n\t\t\t/>\n\t\t\t<MrlPopover\n\t\t\t\talignment={alignment}\n\t\t\t\tariaLabelledBy={headingIdRef.current}\n\t\t\t\tclassName={classnames(styles['MrlMultiFilter'], 'MrlMultiFilter', className)}\n\t\t\t\tdata-qa={dataQa ? `${dataQa}-popover` : undefined}\n\t\t\t\toffset={offset}\n\t\t\t\tpoint={false}\n\t\t\t\tposition={position}\n\t\t\t\trole=\"dialog\"\n\t\t\t\tonOpen={context.discard}\n\t\t\t\ttriggerRef={triggerRef}\n\t\t\t>\n\t\t\t\t{({ closeMenu: closePopover }) => {\n\t\t\t\t\t/**\n\t\t\t\t\t * MrlPopover only returns focus to the trigger on Escape. Return it here too, so\n\t\t\t\t\t * focus is not lost when the popover content unmounts.\n\t\t\t\t\t */\n\t\t\t\t\tconst closeMenu = () => {\n\t\t\t\t\t\tclosePopover();\n\t\t\t\t\t\ttriggerRef.current?.focus();\n\t\t\t\t\t};\n\n\t\t\t\t\tconst apply = () => {\n\t\t\t\t\t\tif (!context.validate()) return;\n\t\t\t\t\t\t// The latest draft, not this render's: a render-prop handler may have edited it\n\t\t\t\t\t\t// just before calling apply, e.g. `reset(); apply();`.\n\t\t\t\t\t\tconst latestDraft = context.getDraft();\n\t\t\t\t\t\tcontext.commit();\n\t\t\t\t\t\tif (transform) {\n\t\t\t\t\t\t\t(onApply as (result: R) => void)(transform(latestDraft));\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t(onApply as (draft: MrlMultiFilterDraft<T>) => void)(latestDraft);\n\t\t\t\t\t\t}\n\t\t\t\t\t\tcloseMenu();\n\t\t\t\t\t};\n\n\t\t\t\t\tconst cancel = () => {\n\t\t\t\t\t\tcontext.discard();\n\t\t\t\t\t\tonCancel?.();\n\t\t\t\t\t\tcloseMenu();\n\t\t\t\t\t};\n\n\t\t\t\t\tconst getField = <K extends keyof T>(name: K): MrlMultiFilterFieldBinding<T[K]> => ({\n\t\t\t\t\t\terror: errors[name] ? requiredMessage : undefined,\n\t\t\t\t\t\tname: String(name),\n\t\t\t\t\t\trequired: Boolean(draft[name].required),\n\t\t\t\t\t\tsetValue: (value) => context.setFieldValue(name, value),\n\t\t\t\t\t\tvalue: draft[name].value\n\t\t\t\t\t});\n\n\t\t\t\t\treturn (\n\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t<MrlTextHeading\n\t\t\t\t\t\t\t\tclassName={classnames(styles['MrlMultiFilter-title'], 'MrlMultiFilter-title')}\n\t\t\t\t\t\t\t\tid={headingIdRef.current}\n\t\t\t\t\t\t\t\tlevel={headingLevel}\n\t\t\t\t\t\t\t\tkind=\"title\"\n\t\t\t\t\t\t\t\tsize=\"medium\"\n\t\t\t\t\t\t\t\ttext={heading}\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t<div className={classnames(styles['MrlMultiFilter-fields'], 'MrlMultiFilter-fields')}>\n\t\t\t\t\t\t\t\t{typeof children === 'function'\n\t\t\t\t\t\t\t\t\t? children({\n\t\t\t\t\t\t\t\t\t\t\tapply,\n\t\t\t\t\t\t\t\t\t\t\tcloseMenu,\n\t\t\t\t\t\t\t\t\t\t\tdraft,\n\t\t\t\t\t\t\t\t\t\t\tgetField,\n\t\t\t\t\t\t\t\t\t\t\treset,\n\t\t\t\t\t\t\t\t\t\t\tsetFieldValue: context.setFieldValue,\n\t\t\t\t\t\t\t\t\t\t\tsetRequired: context.setRequired\n\t\t\t\t\t\t\t\t\t\t})\n\t\t\t\t\t\t\t\t\t: children}\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t<div\n\t\t\t\t\t\t\t\tclassName={classnames(styles['MrlMultiFilter-actions'], 'MrlMultiFilter-actions')}\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t<MrlButton\n\t\t\t\t\t\t\t\t\tclassName={styles['MrlMultiFilter-reset']}\n\t\t\t\t\t\t\t\t\tkind=\"ghost\"\n\t\t\t\t\t\t\t\t\tonClick={reset}\n\t\t\t\t\t\t\t\t\tsize=\"small\"\n\t\t\t\t\t\t\t\t\ttext={resetText}\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t<MrlButton kind=\"ghost\" onClick={cancel} size=\"small\" text={cancelText} />\n\t\t\t\t\t\t\t\t<MrlButton kind=\"primary\" onClick={apply} size=\"small\" text={applyText} />\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t</>\n\t\t\t\t\t);\n\t\t\t\t}}\n\t\t\t</MrlPopover>\n\t\t</>\n\t);\n}\n"],"names":["countFieldsWithValue","draft","Object","values","filter","field","value","isMrlMultiFilterValueEmpty","length","MrlMultiFilter","props","React","createElement","MrlMultiFilterContextProvider","appliedDraft","initialDraft","MrlMultiFilterContent","_props$alignment","alignment","_props$applyText","applyText","_props$cancelText","cancelText","children","className","_props$countActiveFil","countActiveFilters","dataQa","heading","_props$headingLevel","headingLevel","notificationText","_props$offset","offset","onApply","onCancel","_props$position","position","_props$requiredMessag","requiredMessage","resetDraft","_props$resetText","resetText","transform","triggerSize","triggerState","triggerText","context","useMrlMultiFilterContext","applied","errors","triggerRef","useRef","headingIdRef","getUniqueId","initialDraftRef","reset","nextDraft","current","getDraft","Fragment","MrlMultiFilterTrigger","activeFiltersCount","ref","size","state","text","MrlPopover","ariaLabelledBy","classnames","styles","concat","undefined","point","role","onOpen","discard","_ref","closePopover","closeMenu","_triggerRef$current","focus","apply","validate","latestDraft","commit","cancel","getField","name","error","String","required","Boolean","setValue","setFieldValue","MrlTextHeading","id","level","kind","setRequired","MrlButton","onClick"],"mappings":";;;;;;;;;;AAuDA;AACA;AACA;AACA;AACA;AACA;;AAaA;AACA;AACA;;AAwFA;AACA;AACA;AACA;AACA;AACA;AACA,IAAMA,oBAAoB,GAAIC,KAAgD,IAC7EC,MAAM,CAACC,MAAM,CAACF,KAAK,CAAC,CAACG,MAAM,CACzBC,KAAK,IAAKA,KAAK,CAACC,KAAK,KAAK,KAAK,IAAI,CAACC,0BAA0B,CAACF,KAAK,CAACC,KAAK,CAC5E,CAAC,CAACE,MAAM;;AAET;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASC,cAAcA,CAC7BC,KAAgC,EACX;AACrB,EAAA,oBACCC,KAAA,CAAAC,aAAA,CAACC,6BAA6B,EAAA;IAC7BC,YAAY,EAAEJ,KAAK,CAACI,YAAa;I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AAA;AAACF,MAAAA,IAAI,EAAC,SAAS;AAACG,MAAAA,OAAO,EAAEnB,KAAM;AAAClB,MAAAA,IAAI,EAAC,OAAO;AAACE,MAAAA,IAAI,EAAE9C;KAAY,CACrE,CACJ,CAAC;AAEL,EAAA,CACW,CACX,CAAC;AAEL;;;;"}
@@ -0,0 +1,4 @@
1
+ var styles = {"MrlMultiFilter":"MrlMultiFilter--zqSCS","MrlMultiFilter-title":"MrlMultiFilter-title--ogr0l","MrlMultiFilter-fields":"MrlMultiFilter-fields--T--TL","MrlMultiFilter-actions":"MrlMultiFilter-actions--vFqBP","MrlMultiFilter-reset":"MrlMultiFilter-reset--tnh1T"};
2
+
3
+ export { styles as default };
4
+ //# sourceMappingURL=MrlMultiFilter.module.scss.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"MrlMultiFilter.module.scss.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;"}