@razorpay/blade 11.6.2 → 11.7.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 (104) hide show
  1. package/build/lib/native/components/Accordion/Accordion.js +2 -2
  2. package/build/lib/native/components/Accordion/Accordion.js.map +1 -1
  3. package/build/lib/native/components/Accordion/AccordionButton.native.js +2 -2
  4. package/build/lib/native/components/Accordion/AccordionButton.native.js.map +1 -1
  5. package/build/lib/native/components/Accordion/AccordionContext.js +2 -2
  6. package/build/lib/native/components/Accordion/AccordionContext.js.map +1 -1
  7. package/build/lib/native/components/Accordion/AccordionItem.js +11 -14
  8. package/build/lib/native/components/Accordion/AccordionItem.js.map +1 -1
  9. package/build/lib/native/components/Accordion/AccordionItemBody.js +24 -0
  10. package/build/lib/native/components/Accordion/AccordionItemBody.js.map +1 -0
  11. package/build/lib/native/components/Accordion/AccordionItemHeader.js +24 -0
  12. package/build/lib/native/components/Accordion/AccordionItemHeader.js.map +1 -0
  13. package/build/lib/native/components/Accordion/commonStyles.js +1 -1
  14. package/build/lib/native/components/Accordion/commonStyles.js.map +1 -1
  15. package/build/lib/native/components/Accordion/componentIds.js +4 -0
  16. package/build/lib/native/components/Accordion/componentIds.js.map +1 -0
  17. package/build/lib/native/components/ActionList/ActionListBox.native.js +1 -4
  18. package/build/lib/native/components/ActionList/ActionListBox.native.js.map +1 -1
  19. package/build/lib/native/components/BaseHeaderFooter/BaseHeader.js +1 -1
  20. package/build/lib/native/components/BaseHeaderFooter/BaseHeader.js.map +1 -1
  21. package/build/lib/native/components/Collapsible/CollapsibleBodyContent.native.js.map +1 -1
  22. package/build/lib/native/components/Dropdown/dropdownUtils.js +1 -1
  23. package/build/lib/native/components/Dropdown/dropdownUtils.js.map +1 -1
  24. package/build/lib/native/components/Dropdown/useDropdown.js +1 -1
  25. package/build/lib/native/components/Dropdown/useDropdown.js.map +1 -1
  26. package/build/lib/native/components/index.js +2 -0
  27. package/build/lib/native/components/index.js.map +1 -1
  28. package/build/lib/native/utils/metaAttribute/metaConstants.js +1 -1
  29. package/build/lib/native/utils/metaAttribute/metaConstants.js.map +1 -1
  30. package/build/lib/web/development/components/Accordion/Accordion.js +57 -6
  31. package/build/lib/web/development/components/Accordion/Accordion.js.map +1 -1
  32. package/build/lib/web/development/components/Accordion/AccordionButton.web.js +21 -25
  33. package/build/lib/web/development/components/Accordion/AccordionButton.web.js.map +1 -1
  34. package/build/lib/web/development/components/Accordion/AccordionContext.js +16 -1
  35. package/build/lib/web/development/components/Accordion/AccordionContext.js.map +1 -1
  36. package/build/lib/web/development/components/Accordion/AccordionItem.js +66 -66
  37. package/build/lib/web/development/components/Accordion/AccordionItem.js.map +1 -1
  38. package/build/lib/web/development/components/Accordion/AccordionItemBody.js +84 -0
  39. package/build/lib/web/development/components/Accordion/AccordionItemBody.js.map +1 -0
  40. package/build/lib/web/development/components/Accordion/AccordionItemHeader.js +71 -0
  41. package/build/lib/web/development/components/Accordion/AccordionItemHeader.js.map +1 -0
  42. package/build/lib/web/development/components/Accordion/StyledAccordionButton.web.js +3 -2
  43. package/build/lib/web/development/components/Accordion/StyledAccordionButton.web.js.map +1 -1
  44. package/build/lib/web/development/components/Accordion/commonStyles.js +8 -6
  45. package/build/lib/web/development/components/Accordion/commonStyles.js.map +1 -1
  46. package/build/lib/web/development/components/Accordion/componentIds.js +8 -0
  47. package/build/lib/web/development/components/Accordion/componentIds.js.map +1 -0
  48. package/build/lib/web/development/components/Accordion/index.js +2 -0
  49. package/build/lib/web/development/components/Accordion/index.js.map +1 -1
  50. package/build/lib/web/development/components/BaseHeaderFooter/BaseHeader.js +131 -68
  51. package/build/lib/web/development/components/BaseHeaderFooter/BaseHeader.js.map +1 -1
  52. package/build/lib/web/development/components/Collapsible/CollapsibleBodyContent.web.js +3 -1
  53. package/build/lib/web/development/components/Collapsible/CollapsibleBodyContent.web.js.map +1 -1
  54. package/build/lib/web/development/components/Dropdown/DropdownOverlay.web.js +4 -2
  55. package/build/lib/web/development/components/Dropdown/DropdownOverlay.web.js.map +1 -1
  56. package/build/lib/web/development/components/Dropdown/dropdownUtils.js +16 -8
  57. package/build/lib/web/development/components/Dropdown/dropdownUtils.js.map +1 -1
  58. package/build/lib/web/development/components/Dropdown/useDropdown.js +1 -1
  59. package/build/lib/web/development/components/Dropdown/useDropdown.js.map +1 -1
  60. package/build/lib/web/development/components/FileUpload/FileUpload.web.js +0 -1
  61. package/build/lib/web/development/components/FileUpload/FileUpload.web.js.map +1 -1
  62. package/build/lib/web/development/components/index.js +2 -0
  63. package/build/lib/web/development/components/index.js.map +1 -1
  64. package/build/lib/web/development/utils/metaAttribute/metaConstants.js +2 -0
  65. package/build/lib/web/development/utils/metaAttribute/metaConstants.js.map +1 -1
  66. package/build/lib/web/production/components/Accordion/Accordion.js +57 -6
  67. package/build/lib/web/production/components/Accordion/Accordion.js.map +1 -1
  68. package/build/lib/web/production/components/Accordion/AccordionButton.web.js +21 -25
  69. package/build/lib/web/production/components/Accordion/AccordionButton.web.js.map +1 -1
  70. package/build/lib/web/production/components/Accordion/AccordionContext.js +16 -1
  71. package/build/lib/web/production/components/Accordion/AccordionContext.js.map +1 -1
  72. package/build/lib/web/production/components/Accordion/AccordionItem.js +66 -66
  73. package/build/lib/web/production/components/Accordion/AccordionItem.js.map +1 -1
  74. package/build/lib/web/production/components/Accordion/AccordionItemBody.js +84 -0
  75. package/build/lib/web/production/components/Accordion/AccordionItemBody.js.map +1 -0
  76. package/build/lib/web/production/components/Accordion/AccordionItemHeader.js +71 -0
  77. package/build/lib/web/production/components/Accordion/AccordionItemHeader.js.map +1 -0
  78. package/build/lib/web/production/components/Accordion/StyledAccordionButton.web.js +3 -2
  79. package/build/lib/web/production/components/Accordion/StyledAccordionButton.web.js.map +1 -1
  80. package/build/lib/web/production/components/Accordion/commonStyles.js +8 -6
  81. package/build/lib/web/production/components/Accordion/commonStyles.js.map +1 -1
  82. package/build/lib/web/production/components/Accordion/componentIds.js +8 -0
  83. package/build/lib/web/production/components/Accordion/componentIds.js.map +1 -0
  84. package/build/lib/web/production/components/Accordion/index.js +2 -0
  85. package/build/lib/web/production/components/Accordion/index.js.map +1 -1
  86. package/build/lib/web/production/components/BaseHeaderFooter/BaseHeader.js +131 -68
  87. package/build/lib/web/production/components/BaseHeaderFooter/BaseHeader.js.map +1 -1
  88. package/build/lib/web/production/components/Collapsible/CollapsibleBodyContent.web.js +3 -1
  89. package/build/lib/web/production/components/Collapsible/CollapsibleBodyContent.web.js.map +1 -1
  90. package/build/lib/web/production/components/Dropdown/DropdownOverlay.web.js +4 -2
  91. package/build/lib/web/production/components/Dropdown/DropdownOverlay.web.js.map +1 -1
  92. package/build/lib/web/production/components/Dropdown/dropdownUtils.js +16 -8
  93. package/build/lib/web/production/components/Dropdown/dropdownUtils.js.map +1 -1
  94. package/build/lib/web/production/components/Dropdown/useDropdown.js +1 -1
  95. package/build/lib/web/production/components/Dropdown/useDropdown.js.map +1 -1
  96. package/build/lib/web/production/components/FileUpload/FileUpload.web.js +0 -1
  97. package/build/lib/web/production/components/FileUpload/FileUpload.web.js.map +1 -1
  98. package/build/lib/web/production/components/index.js +2 -0
  99. package/build/lib/web/production/components/index.js.map +1 -1
  100. package/build/lib/web/production/utils/metaAttribute/metaConstants.js +2 -0
  101. package/build/lib/web/production/utils/metaAttribute/metaConstants.js.map +1 -1
  102. package/build/types/components/index.d.ts +1054 -960
  103. package/build/types/components/index.native.d.ts +1057 -963
  104. package/package.json +2 -2
@@ -0,0 +1,84 @@
1
+ import _defineProperty from '@babel/runtime/helpers/defineProperty';
2
+ import { useAccordion } from './AccordionContext.js';
3
+ import { componentIds } from './componentIds.js';
4
+ import '../Box/BaseBox/index.js';
5
+ import '../Typography/index.js';
6
+ import '../../utils/index.js';
7
+ import '../../utils/makeAccessible/index.js';
8
+ import '../../utils/assignWithoutSideEffects/index.js';
9
+ import '../../utils/metaAttribute/index.js';
10
+ import { jsx, jsxs } from 'react/jsx-runtime';
11
+ import { BaseBox } from '../Box/BaseBox/BaseBox.web.js';
12
+ import { makeAccessible } from '../../utils/makeAccessible/makeAccessible.web.js';
13
+ import { Text } from '../Typography/Text/Text.js';
14
+ import { isReactNative } from '../../utils/platform/isReactNative.js';
15
+ import { metaAttribute } from '../../utils/metaAttribute/metaAttribute.web.js';
16
+ import { MetaConstants } from '../../utils/metaAttribute/metaConstants.js';
17
+ import { assignWithoutSideEffects } from '../../utils/assignWithoutSideEffects/assignWithoutSideEffects.js';
18
+
19
+ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
20
+ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
21
+ var BLANK_SPACE = ' ';
22
+
23
+ /**
24
+ * On React Native if the `AccordionItem` has a lengthy description which renders a `Text` spanning multiple lines,
25
+ * it sometimes messes up the layout calculation (it thinks of multiline as a single line before flowing in the UI).
26
+ * And during the expanding / collapsing animation, text reflows causing words to jump around across lines.
27
+ *
28
+ * Rendering a blank `Text` at the end seems to fix all this 🤯
29
+ */
30
+ var reactNativeMultilineTextOverflowFix =
31
+ /*#__PURE__*/
32
+ // make this hidden from screen readers
33
+ jsx(BaseBox, _objectSpread(_objectSpread({}, makeAccessible({
34
+ hidden: true
35
+ })), {}, {
36
+ children: /*#__PURE__*/jsx(Text, {
37
+ children: BLANK_SPACE
38
+ })
39
+ }));
40
+ var descriptionSizeToken = {
41
+ large: 'medium',
42
+ medium: 'small'
43
+ };
44
+ var _AccordionItemBody = function _AccordionItemBody(_ref) {
45
+ var children = _ref.children,
46
+ _description = _ref._description;
47
+ var _useAccordion = useAccordion(),
48
+ size = _useAccordion.size;
49
+ var childrenElement = typeof children === 'string' || typeof children === 'number' ? /*#__PURE__*/jsx(Text, {
50
+ size: descriptionSizeToken[size],
51
+ color: "surface.text.gray.subtle",
52
+ children: children
53
+ }) : children;
54
+ var descriptionElement = _description && /*#__PURE__*/jsx(Text, {
55
+ size: descriptionSizeToken[size],
56
+ color: "surface.text.gray.subtle",
57
+ children: _description
58
+ });
59
+ var collapsibleBodyContent = isReactNative() ? /*#__PURE__*/jsxs(BaseBox, {
60
+ marginX: "spacing.5",
61
+ children: [descriptionElement, /*#__PURE__*/jsx(BaseBox, {
62
+ marginTop: _description && children ? 'spacing.5' : 'spacing.0',
63
+ children: childrenElement
64
+ }), reactNativeMultilineTextOverflowFix]
65
+ }) : /*#__PURE__*/jsxs(BaseBox, {
66
+ display: "flex",
67
+ flexDirection: "column",
68
+ gap: "spacing.5",
69
+ marginBottom: "spacing.5",
70
+ marginX: "spacing.5",
71
+ children: [descriptionElement, childrenElement]
72
+ });
73
+ return /*#__PURE__*/jsx(BaseBox, _objectSpread(_objectSpread({}, metaAttribute({
74
+ name: MetaConstants.AccordionItemBody
75
+ })), {}, {
76
+ children: collapsibleBodyContent
77
+ }));
78
+ };
79
+ var AccordionItemBody = /*#__PURE__*/assignWithoutSideEffects(_AccordionItemBody, {
80
+ componentId: componentIds.AccordionItemBody
81
+ });
82
+
83
+ export { AccordionItemBody };
84
+ //# sourceMappingURL=AccordionItemBody.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AccordionItemBody.js","sources":["../../../../../../src/components/Accordion/AccordionItemBody.tsx"],"sourcesContent":["import { useAccordion } from './AccordionContext';\nimport { componentIds } from './componentIds';\nimport BaseBox from '~components/Box/BaseBox';\nimport { Text } from '~components/Typography';\nimport { isReactNative } from '~utils';\nimport { makeAccessible } from '~utils/makeAccessible';\nimport type { StringChildrenType } from '~utils/types';\nimport { assignWithoutSideEffects } from '~utils/assignWithoutSideEffects';\nimport { MetaConstants, metaAttribute } from '~utils/metaAttribute';\n\nconst BLANK_SPACE = ' ';\n\n/**\n * On React Native if the `AccordionItem` has a lengthy description which renders a `Text` spanning multiple lines,\n * it sometimes messes up the layout calculation (it thinks of multiline as a single line before flowing in the UI).\n * And during the expanding / collapsing animation, text reflows causing words to jump around across lines.\n *\n * Rendering a blank `Text` at the end seems to fix all this 🤯\n */\nconst reactNativeMultilineTextOverflowFix = (\n // make this hidden from screen readers\n <BaseBox {...makeAccessible({ hidden: true })}>\n <Text>{BLANK_SPACE}</Text>\n </BaseBox>\n);\n\nconst descriptionSizeToken = {\n large: 'medium',\n medium: 'small',\n} as const;\n\nconst _AccordionItemBody = ({\n children,\n _description,\n}: {\n children?: React.ReactNode | StringChildrenType;\n _description?: string;\n}): React.ReactElement => {\n const { size } = useAccordion();\n\n const childrenElement =\n typeof children === 'string' || typeof children === 'number' ? (\n <Text size={descriptionSizeToken[size]} color=\"surface.text.gray.subtle\">\n {children}\n </Text>\n ) : (\n children\n );\n\n const descriptionElement = _description && (\n <Text size={descriptionSizeToken[size]} color=\"surface.text.gray.subtle\">\n {_description}\n </Text>\n );\n\n const collapsibleBodyContent = isReactNative() ? (\n <BaseBox marginX=\"spacing.5\">\n {descriptionElement}\n <BaseBox marginTop={_description && children ? 'spacing.5' : 'spacing.0'}>\n {childrenElement}\n </BaseBox>\n {reactNativeMultilineTextOverflowFix}\n </BaseBox>\n ) : (\n <BaseBox\n display=\"flex\"\n flexDirection=\"column\"\n gap=\"spacing.5\"\n marginBottom=\"spacing.5\"\n marginX=\"spacing.5\"\n >\n {descriptionElement}\n {childrenElement}\n </BaseBox>\n );\n\n return (\n <BaseBox {...metaAttribute({ name: MetaConstants.AccordionItemBody })}>\n {collapsibleBodyContent}\n </BaseBox>\n );\n};\n\nconst AccordionItemBody = assignWithoutSideEffects(_AccordionItemBody, {\n componentId: componentIds.AccordionItemBody,\n});\n\nexport { AccordionItemBody };\n"],"names":["BLANK_SPACE","reactNativeMultilineTextOverflowFix","_jsx","BaseBox","_objectSpread","makeAccessible","hidden","children","Text","descriptionSizeToken","large","medium","_AccordionItemBody","_ref","_description","_useAccordion","useAccordion","size","childrenElement","color","descriptionElement","collapsibleBodyContent","isReactNative","_jsxs","marginX","marginTop","display","flexDirection","gap","marginBottom","metaAttribute","name","MetaConstants","AccordionItemBody","assignWithoutSideEffects","componentId","componentIds"],"mappings":";;;;;;;;;;;;;;;;;;;;AAUA,IAAMA,WAAW,GAAG,GAAG,CAAA;;AAEvB;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAMC,mCAAmC;AAAA;AACvC;AACAC,GAAA,CAACC,OAAO,EAAAC,aAAA,CAAAA,aAAA,CAAA,EAAA,EAAKC,cAAc,CAAC;AAAEC,EAAAA,MAAM,EAAE,IAAA;AAAK,CAAC,CAAC,CAAA,EAAA,EAAA,EAAA;EAAAC,QAAA,eAC3CL,GAAA,CAACM,IAAI,EAAA;AAAAD,IAAAA,QAAA,EAAEP,WAAAA;GAAkB,CAAA;AAAC,CAAA,CACnB,CACV,CAAA;AAED,IAAMS,oBAAoB,GAAG;AAC3BC,EAAAA,KAAK,EAAE,QAAQ;AACfC,EAAAA,MAAM,EAAE,OAAA;AACV,CAAU,CAAA;AAEV,IAAMC,kBAAkB,GAAG,SAArBA,kBAAkBA,CAAAC,IAAA,EAME;AAAA,EAAA,IALxBN,QAAQ,GAAAM,IAAA,CAARN,QAAQ;IACRO,YAAY,GAAAD,IAAA,CAAZC,YAAY,CAAA;AAKZ,EAAA,IAAAC,aAAA,GAAiBC,YAAY,EAAE;IAAvBC,IAAI,GAAAF,aAAA,CAAJE,IAAI,CAAA;AAEZ,EAAA,IAAMC,eAAe,GACnB,OAAOX,QAAQ,KAAK,QAAQ,IAAI,OAAOA,QAAQ,KAAK,QAAQ,gBAC1DL,GAAA,CAACM,IAAI,EAAA;AAACS,IAAAA,IAAI,EAAER,oBAAoB,CAACQ,IAAI,CAAE;AAACE,IAAAA,KAAK,EAAC,0BAA0B;AAAAZ,IAAAA,QAAA,EACrEA,QAAAA;GACG,CAAC,GAEPA,QACD,CAAA;AAEH,EAAA,IAAMa,kBAAkB,GAAGN,YAAY,iBACrCZ,GAAA,CAACM,IAAI,EAAA;AAACS,IAAAA,IAAI,EAAER,oBAAoB,CAACQ,IAAI,CAAE;AAACE,IAAAA,KAAK,EAAC,0BAA0B;AAAAZ,IAAAA,QAAA,EACrEO,YAAAA;AAAY,GACT,CACP,CAAA;EAED,IAAMO,sBAAsB,GAAGC,aAAa,EAAE,gBAC5CC,IAAA,CAACpB,OAAO,EAAA;AAACqB,IAAAA,OAAO,EAAC,WAAW;AAAAjB,IAAAA,QAAA,EACzBa,CAAAA,kBAAkB,eACnBlB,GAAA,CAACC,OAAO,EAAA;AAACsB,MAAAA,SAAS,EAAEX,YAAY,IAAIP,QAAQ,GAAG,WAAW,GAAG,WAAY;AAAAA,MAAAA,QAAA,EACtEW,eAAAA;KACM,CAAC,EACTjB,mCAAmC,CAAA;AAAA,GAC7B,CAAC,gBAEVsB,IAAA,CAACpB,OAAO,EAAA;AACNuB,IAAAA,OAAO,EAAC,MAAM;AACdC,IAAAA,aAAa,EAAC,QAAQ;AACtBC,IAAAA,GAAG,EAAC,WAAW;AACfC,IAAAA,YAAY,EAAC,WAAW;AACxBL,IAAAA,OAAO,EAAC,WAAW;IAAAjB,QAAA,EAAA,CAElBa,kBAAkB,EAClBF,eAAe,CAAA;AAAA,GACT,CACV,CAAA;EAED,oBACEhB,GAAA,CAACC,OAAO,EAAAC,aAAA,CAAAA,aAAA,CAAK0B,EAAAA,EAAAA,aAAa,CAAC;IAAEC,IAAI,EAAEC,aAAa,CAACC,iBAAAA;AAAkB,GAAC,CAAC,CAAA,EAAA,EAAA,EAAA;AAAA1B,IAAAA,QAAA,EAClEc,sBAAAA;AAAsB,GAAA,CAChB,CAAC,CAAA;AAEd,CAAC,CAAA;AAED,IAAMY,iBAAiB,gBAAGC,wBAAwB,CAACtB,kBAAkB,EAAE;EACrEuB,WAAW,EAAEC,YAAY,CAACH,iBAAAA;AAC5B,CAAC;;;;"}
@@ -0,0 +1,71 @@
1
+ import _defineProperty from '@babel/runtime/helpers/defineProperty';
2
+ import { useAccordion, useAccordionItemIndex } from './AccordionContext.js';
3
+ import { componentIds } from './componentIds.js';
4
+ import { BaseHeader } from '../BaseHeaderFooter/BaseHeader.js';
5
+ import '../Typography/index.js';
6
+ import '../Box/BaseBox/index.js';
7
+ import { CollapsibleChevronIcon } from '../Collapsible/CollapsibleChevronIcon.web.js';
8
+ import '../../utils/assignWithoutSideEffects/index.js';
9
+ import '../../utils/metaAttribute/index.js';
10
+ import { jsx, jsxs } from 'react/jsx-runtime';
11
+ import { BaseBox } from '../Box/BaseBox/BaseBox.web.js';
12
+ import { metaAttribute } from '../../utils/metaAttribute/metaAttribute.web.js';
13
+ import { MetaConstants } from '../../utils/metaAttribute/metaConstants.js';
14
+ import { Text } from '../Typography/Text/Text.js';
15
+ import { assignWithoutSideEffects } from '../../utils/assignWithoutSideEffects/assignWithoutSideEffects.js';
16
+
17
+ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
18
+ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
19
+ var _AccordionItemHeader = function _AccordionItemHeader(_ref) {
20
+ var title = _ref.title,
21
+ subtitle = _ref.subtitle,
22
+ leading = _ref.leading,
23
+ children = _ref.children,
24
+ trailing = _ref.trailing,
25
+ titleSuffix = _ref.titleSuffix;
26
+ var _useAccordion = useAccordion(),
27
+ size = _useAccordion.size,
28
+ showNumberPrefix = _useAccordion.showNumberPrefix;
29
+ var _useAccordionItemInde = useAccordionItemIndex(),
30
+ index = _useAccordionItemInde.index,
31
+ isDisabled = _useAccordionItemInde.isDisabled;
32
+ return /*#__PURE__*/jsx(BaseBox, _objectSpread(_objectSpread({}, metaAttribute({
33
+ name: MetaConstants.AccordionItemHeader
34
+ })), {}, {
35
+ flex: "1",
36
+ children: /*#__PURE__*/jsx(BaseHeader, {
37
+ leading: showNumberPrefix && typeof index === 'number' ?
38
+ /*#__PURE__*/
39
+ // we have to add -2px margin to align the number with title of BaseHeader
40
+ jsxs(Text, {
41
+ size: size,
42
+ weight: "semibold",
43
+ marginTop: "-2px",
44
+ as: "span",
45
+ children: [index + 1, "."]
46
+ }) : leading,
47
+ title: title,
48
+ subtitle: subtitle,
49
+ trailing: trailing,
50
+ titleSuffix: titleSuffix,
51
+ isDisabled: isDisabled,
52
+ showBackButton: false,
53
+ showCloseButton: false,
54
+ showDivider: false,
55
+ paddingX: "spacing.5",
56
+ marginY: "spacing.5",
57
+ size: size,
58
+ trailingInteractionElement: /*#__PURE__*/jsx(CollapsibleChevronIcon, {
59
+ color: isDisabled ? 'interactive.icon.gray.disabled' : 'interactive.icon.gray.muted',
60
+ size: "large"
61
+ }),
62
+ children: children
63
+ })
64
+ }));
65
+ };
66
+ var AccordionItemHeader = /*#__PURE__*/assignWithoutSideEffects(_AccordionItemHeader, {
67
+ componentId: componentIds.AccordionItemHeader
68
+ });
69
+
70
+ export { AccordionItemHeader };
71
+ //# sourceMappingURL=AccordionItemHeader.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AccordionItemHeader.js","sources":["../../../../../../src/components/Accordion/AccordionItemHeader.tsx"],"sourcesContent":["import { useAccordion, useAccordionItemIndex } from './AccordionContext';\nimport { componentIds } from './componentIds';\nimport type { BaseHeaderProps } from '~components/BaseHeaderFooter/BaseHeader';\nimport { BaseHeader } from '~components/BaseHeaderFooter/BaseHeader';\nimport { Text } from '~components/Typography';\nimport BaseBox from '~components/Box/BaseBox';\nimport { CollapsibleChevronIcon } from '~components/Collapsible/CollapsibleChevronIcon';\nimport { assignWithoutSideEffects } from '~utils/assignWithoutSideEffects';\nimport { metaAttribute, MetaConstants } from '~utils/metaAttribute';\n\nconst _AccordionItemHeader = ({\n title,\n subtitle,\n leading,\n children,\n trailing,\n titleSuffix,\n}: Pick<\n BaseHeaderProps,\n 'title' | 'subtitle' | 'leading' | 'children' | 'trailing' | 'titleSuffix'\n>): React.ReactElement => {\n const { size, showNumberPrefix } = useAccordion();\n const { index, isDisabled } = useAccordionItemIndex();\n\n return (\n <BaseBox {...metaAttribute({ name: MetaConstants.AccordionItemHeader })} flex=\"1\">\n <BaseHeader\n leading={\n showNumberPrefix && typeof index === 'number' ? (\n // we have to add -2px margin to align the number with title of BaseHeader\n <Text size={size} weight=\"semibold\" marginTop=\"-2px\" as=\"span\">\n {index + 1}.\n </Text>\n ) : (\n leading\n )\n }\n title={title}\n subtitle={subtitle}\n trailing={trailing}\n titleSuffix={titleSuffix}\n isDisabled={isDisabled}\n showBackButton={false}\n showCloseButton={false}\n showDivider={false}\n paddingX=\"spacing.5\"\n marginY=\"spacing.5\"\n size={size}\n trailingInteractionElement={\n <CollapsibleChevronIcon\n color={isDisabled ? 'interactive.icon.gray.disabled' : 'interactive.icon.gray.muted'}\n size=\"large\"\n />\n }\n >\n {children}\n </BaseHeader>\n </BaseBox>\n );\n};\n\nconst AccordionItemHeader = assignWithoutSideEffects(_AccordionItemHeader, {\n componentId: componentIds.AccordionItemHeader,\n});\n\nexport { AccordionItemHeader };\n"],"names":["_AccordionItemHeader","_ref","title","subtitle","leading","children","trailing","titleSuffix","_useAccordion","useAccordion","size","showNumberPrefix","_useAccordionItemInde","useAccordionItemIndex","index","isDisabled","_jsx","BaseBox","_objectSpread","metaAttribute","name","MetaConstants","AccordionItemHeader","flex","BaseHeader","_jsxs","Text","weight","marginTop","as","showBackButton","showCloseButton","showDivider","paddingX","marginY","trailingInteractionElement","CollapsibleChevronIcon","color","assignWithoutSideEffects","componentId","componentIds"],"mappings":";;;;;;;;;;;;;;;;;;AAUA,IAAMA,oBAAoB,GAAG,SAAvBA,oBAAoBA,CAAAC,IAAA,EAUA;AAAA,EAAA,IATxBC,KAAK,GAAAD,IAAA,CAALC,KAAK;IACLC,QAAQ,GAAAF,IAAA,CAARE,QAAQ;IACRC,OAAO,GAAAH,IAAA,CAAPG,OAAO;IACPC,QAAQ,GAAAJ,IAAA,CAARI,QAAQ;IACRC,QAAQ,GAAAL,IAAA,CAARK,QAAQ;IACRC,WAAW,GAAAN,IAAA,CAAXM,WAAW,CAAA;AAKX,EAAA,IAAAC,aAAA,GAAmCC,YAAY,EAAE;IAAzCC,IAAI,GAAAF,aAAA,CAAJE,IAAI;IAAEC,gBAAgB,GAAAH,aAAA,CAAhBG,gBAAgB,CAAA;AAC9B,EAAA,IAAAC,qBAAA,GAA8BC,qBAAqB,EAAE;IAA7CC,KAAK,GAAAF,qBAAA,CAALE,KAAK;IAAEC,UAAU,GAAAH,qBAAA,CAAVG,UAAU,CAAA;EAEzB,oBACEC,GAAA,CAACC,OAAO,EAAAC,aAAA,CAAAA,aAAA,CAAKC,EAAAA,EAAAA,aAAa,CAAC;IAAEC,IAAI,EAAEC,aAAa,CAACC,mBAAAA;AAAoB,GAAC,CAAC,CAAA,EAAA,EAAA,EAAA;AAAEC,IAAAA,IAAI,EAAC,GAAG;IAAAlB,QAAA,eAC/EW,GAAA,CAACQ,UAAU,EAAA;AACTpB,MAAAA,OAAO,EACLO,gBAAgB,IAAI,OAAOG,KAAK,KAAK,QAAQ;AAAA;AAC3C;AACAW,MAAAA,IAAA,CAACC,IAAI,EAAA;AAAChB,QAAAA,IAAI,EAAEA,IAAK;AAACiB,QAAAA,MAAM,EAAC,UAAU;AAACC,QAAAA,SAAS,EAAC,MAAM;AAACC,QAAAA,EAAE,EAAC,MAAM;AAAAxB,QAAAA,QAAA,EAC3DS,CAAAA,KAAK,GAAG,CAAC,EAAC,GACb,CAAA;OAAM,CAAC,GAEPV,OAEH;AACDF,MAAAA,KAAK,EAAEA,KAAM;AACbC,MAAAA,QAAQ,EAAEA,QAAS;AACnBG,MAAAA,QAAQ,EAAEA,QAAS;AACnBC,MAAAA,WAAW,EAAEA,WAAY;AACzBQ,MAAAA,UAAU,EAAEA,UAAW;AACvBe,MAAAA,cAAc,EAAE,KAAM;AACtBC,MAAAA,eAAe,EAAE,KAAM;AACvBC,MAAAA,WAAW,EAAE,KAAM;AACnBC,MAAAA,QAAQ,EAAC,WAAW;AACpBC,MAAAA,OAAO,EAAC,WAAW;AACnBxB,MAAAA,IAAI,EAAEA,IAAK;MACXyB,0BAA0B,eACxBnB,GAAA,CAACoB,sBAAsB,EAAA;AACrBC,QAAAA,KAAK,EAAEtB,UAAU,GAAG,gCAAgC,GAAG,6BAA8B;AACrFL,QAAAA,IAAI,EAAC,OAAA;AAAO,OACb,CACF;AAAAL,MAAAA,QAAA,EAEAA,QAAAA;KACS,CAAA;AAAC,GAAA,CACN,CAAC,CAAA;AAEd,CAAC,CAAA;AAED,IAAMiB,mBAAmB,gBAAGgB,wBAAwB,CAACtC,oBAAoB,EAAE;EACzEuC,WAAW,EAAEC,YAAY,CAAClB,mBAAAA;AAC5B,CAAC;;;;"}
@@ -13,7 +13,8 @@ var StyledAccordionButton = /*#__PURE__*/styled.button.withConfig({
13
13
  componentId: "sc-1qxmqda-0"
14
14
  })(function (props) {
15
15
  var theme = props.theme,
16
- isExpanded = props.isExpanded;
16
+ isExpanded = props.isExpanded,
17
+ disabled = props.disabled;
17
18
  var commonStyles = getCommonAccordionButtonStyles(props);
18
19
  return _objectSpread(_objectSpread({}, commonStyles), {}, {
19
20
  backgroundColor: getBackgroundColor({
@@ -24,7 +25,7 @@ var StyledAccordionButton = /*#__PURE__*/styled.button.withConfig({
24
25
  transitionProperty: 'background-color, box-shadow, border-radius, color',
25
26
  transitionDuration: castWebType(getTransitionDuration(theme)),
26
27
  transitionTimingFunction: castWebType(getTransitionEasing(theme)),
27
- cursor: 'pointer',
28
+ cursor: disabled ? 'not-allowed' : 'pointer',
28
29
  color: theme.colors.interactive.icon.gray[isExpanded ? 'subtle' : 'muted'],
29
30
  width: '100%',
30
31
  border: 'none',
@@ -1 +1 @@
1
- {"version":3,"file":"StyledAccordionButton.web.js","sources":["../../../../../../src/components/Accordion/StyledAccordionButton.web.tsx"],"sourcesContent":["import styled from 'styled-components';\nimport type { StyledAccordionButtonProps } from './types';\nimport {\n getBackgroundColor,\n getCommonAccordionButtonStyles,\n getTransitionDuration,\n getTransitionEasing,\n} from './commonStyles';\nimport { castWebType } from '~utils';\nimport { getFocusRingStyles } from '~utils/getFocusRingStyles';\n\nconst StyledAccordionButton = styled.button<StyledAccordionButtonProps>((props) => {\n const { theme, isExpanded } = props;\n const commonStyles = getCommonAccordionButtonStyles(props);\n return {\n ...commonStyles,\n backgroundColor: getBackgroundColor({ theme, isExpanded, isActive: false }),\n transitionProperty: 'background-color, box-shadow, border-radius, color',\n transitionDuration: castWebType(getTransitionDuration(theme)),\n transitionTimingFunction: castWebType(getTransitionEasing(theme)),\n cursor: 'pointer',\n color: theme.colors.interactive.icon.gray[isExpanded ? 'subtle' : 'muted'],\n width: '100%',\n border: 'none',\n textAlign: 'left',\n\n '&:hover, &:focus-visible': {\n backgroundColor: getBackgroundColor({ theme, isExpanded, isActive: true }),\n color: theme.colors.interactive.icon.gray.subtle,\n },\n '&:focus-visible': {\n ...getFocusRingStyles({ theme }),\n // only need border radius on the focus ring\n borderRadius: theme.border.radius.small,\n },\n };\n});\n\nexport { StyledAccordionButton };\n"],"names":["StyledAccordionButton","styled","button","withConfig","displayName","componentId","props","theme","isExpanded","commonStyles","getCommonAccordionButtonStyles","_objectSpread","backgroundColor","getBackgroundColor","isActive","transitionProperty","transitionDuration","castWebType","getTransitionDuration","transitionTimingFunction","getTransitionEasing","cursor","color","colors","interactive","icon","gray","width","border","textAlign","subtle","getFocusRingStyles","borderRadius","radius","small"],"mappings":";;;;;;;;;;AAWA,IAAMA,qBAAqB,gBAAGC,MAAM,CAACC,MAAM,CAAAC,UAAA,CAAA;EAAAC,WAAA,EAAA,iDAAA;EAAAC,WAAA,EAAA,cAAA;AAAA,CAA6B,CAAA,CAAA,UAACC,KAAK,EAAK;AACjF,EAAA,IAAQC,KAAK,GAAiBD,KAAK,CAA3BC,KAAK;IAAEC,UAAU,GAAKF,KAAK,CAApBE,UAAU,CAAA;AACzB,EAAA,IAAMC,YAAY,GAAGC,8BAA8B,CAACJ,KAAK,CAAC,CAAA;AAC1D,EAAA,OAAAK,aAAA,CAAAA,aAAA,CAAA,EAAA,EACKF,YAAY,CAAA,EAAA,EAAA,EAAA;IACfG,eAAe,EAAEC,kBAAkB,CAAC;AAAEN,MAAAA,KAAK,EAALA,KAAK;AAAEC,MAAAA,UAAU,EAAVA,UAAU;AAAEM,MAAAA,QAAQ,EAAE,KAAA;AAAM,KAAC,CAAC;AAC3EC,IAAAA,kBAAkB,EAAE,oDAAoD;AACxEC,IAAAA,kBAAkB,EAAEC,WAAW,CAACC,qBAAqB,CAACX,KAAK,CAAC,CAAC;AAC7DY,IAAAA,wBAAwB,EAAEF,WAAW,CAACG,mBAAmB,CAACb,KAAK,CAAC,CAAC;AACjEc,IAAAA,MAAM,EAAE,SAAS;AACjBC,IAAAA,KAAK,EAAEf,KAAK,CAACgB,MAAM,CAACC,WAAW,CAACC,IAAI,CAACC,IAAI,CAAClB,UAAU,GAAG,QAAQ,GAAG,OAAO,CAAC;AAC1EmB,IAAAA,KAAK,EAAE,MAAM;AACbC,IAAAA,MAAM,EAAE,MAAM;AACdC,IAAAA,SAAS,EAAE,MAAM;AAEjB,IAAA,0BAA0B,EAAE;MAC1BjB,eAAe,EAAEC,kBAAkB,CAAC;AAAEN,QAAAA,KAAK,EAALA,KAAK;AAAEC,QAAAA,UAAU,EAAVA,UAAU;AAAEM,QAAAA,QAAQ,EAAE,IAAA;AAAK,OAAC,CAAC;MAC1EQ,KAAK,EAAEf,KAAK,CAACgB,MAAM,CAACC,WAAW,CAACC,IAAI,CAACC,IAAI,CAACI,MAAAA;KAC3C;AACD,IAAA,iBAAiB,EAAAnB,aAAA,CAAAA,aAAA,CAAA,EAAA,EACZoB,kBAAkB,CAAC;AAAExB,MAAAA,KAAK,EAALA,KAAAA;AAAM,KAAC,CAAC,CAAA,EAAA,EAAA,EAAA;AAChC;AACAyB,MAAAA,YAAY,EAAEzB,KAAK,CAACqB,MAAM,CAACK,MAAM,CAACC,KAAAA;AAAK,KAAA,CAAA;AACxC,GAAA,CAAA,CAAA;AAEL,CAAC;;;;"}
1
+ {"version":3,"file":"StyledAccordionButton.web.js","sources":["../../../../../../src/components/Accordion/StyledAccordionButton.web.tsx"],"sourcesContent":["import styled from 'styled-components';\nimport type { StyledAccordionButtonProps } from './types';\nimport {\n getBackgroundColor,\n getCommonAccordionButtonStyles,\n getTransitionDuration,\n getTransitionEasing,\n} from './commonStyles';\nimport { castWebType } from '~utils';\nimport { getFocusRingStyles } from '~utils/getFocusRingStyles';\n\nconst StyledAccordionButton = styled.button<StyledAccordionButtonProps>((props) => {\n const { theme, isExpanded, disabled } = props;\n const commonStyles = getCommonAccordionButtonStyles(props);\n return {\n ...commonStyles,\n backgroundColor: getBackgroundColor({ theme, isExpanded, isActive: false }),\n transitionProperty: 'background-color, box-shadow, border-radius, color',\n transitionDuration: castWebType(getTransitionDuration(theme)),\n transitionTimingFunction: castWebType(getTransitionEasing(theme)),\n cursor: disabled ? 'not-allowed' : 'pointer',\n color: theme.colors.interactive.icon.gray[isExpanded ? 'subtle' : 'muted'],\n width: '100%',\n border: 'none',\n textAlign: 'left',\n\n '&:hover, &:focus-visible': {\n backgroundColor: getBackgroundColor({ theme, isExpanded, isActive: true }),\n color: theme.colors.interactive.icon.gray.subtle,\n },\n '&:focus-visible': {\n ...getFocusRingStyles({ theme }),\n // only need border radius on the focus ring\n borderRadius: theme.border.radius.small,\n },\n };\n});\n\nexport { StyledAccordionButton };\n"],"names":["StyledAccordionButton","styled","button","withConfig","displayName","componentId","props","theme","isExpanded","disabled","commonStyles","getCommonAccordionButtonStyles","_objectSpread","backgroundColor","getBackgroundColor","isActive","transitionProperty","transitionDuration","castWebType","getTransitionDuration","transitionTimingFunction","getTransitionEasing","cursor","color","colors","interactive","icon","gray","width","border","textAlign","subtle","getFocusRingStyles","borderRadius","radius","small"],"mappings":";;;;;;;;;;AAWA,IAAMA,qBAAqB,gBAAGC,MAAM,CAACC,MAAM,CAAAC,UAAA,CAAA;EAAAC,WAAA,EAAA,iDAAA;EAAAC,WAAA,EAAA,cAAA;AAAA,CAA6B,CAAA,CAAA,UAACC,KAAK,EAAK;AACjF,EAAA,IAAQC,KAAK,GAA2BD,KAAK,CAArCC,KAAK;IAAEC,UAAU,GAAeF,KAAK,CAA9BE,UAAU;IAAEC,QAAQ,GAAKH,KAAK,CAAlBG,QAAQ,CAAA;AACnC,EAAA,IAAMC,YAAY,GAAGC,8BAA8B,CAACL,KAAK,CAAC,CAAA;AAC1D,EAAA,OAAAM,aAAA,CAAAA,aAAA,CAAA,EAAA,EACKF,YAAY,CAAA,EAAA,EAAA,EAAA;IACfG,eAAe,EAAEC,kBAAkB,CAAC;AAAEP,MAAAA,KAAK,EAALA,KAAK;AAAEC,MAAAA,UAAU,EAAVA,UAAU;AAAEO,MAAAA,QAAQ,EAAE,KAAA;AAAM,KAAC,CAAC;AAC3EC,IAAAA,kBAAkB,EAAE,oDAAoD;AACxEC,IAAAA,kBAAkB,EAAEC,WAAW,CAACC,qBAAqB,CAACZ,KAAK,CAAC,CAAC;AAC7Da,IAAAA,wBAAwB,EAAEF,WAAW,CAACG,mBAAmB,CAACd,KAAK,CAAC,CAAC;AACjEe,IAAAA,MAAM,EAAEb,QAAQ,GAAG,aAAa,GAAG,SAAS;AAC5Cc,IAAAA,KAAK,EAAEhB,KAAK,CAACiB,MAAM,CAACC,WAAW,CAACC,IAAI,CAACC,IAAI,CAACnB,UAAU,GAAG,QAAQ,GAAG,OAAO,CAAC;AAC1EoB,IAAAA,KAAK,EAAE,MAAM;AACbC,IAAAA,MAAM,EAAE,MAAM;AACdC,IAAAA,SAAS,EAAE,MAAM;AAEjB,IAAA,0BAA0B,EAAE;MAC1BjB,eAAe,EAAEC,kBAAkB,CAAC;AAAEP,QAAAA,KAAK,EAALA,KAAK;AAAEC,QAAAA,UAAU,EAAVA,UAAU;AAAEO,QAAAA,QAAQ,EAAE,IAAA;AAAK,OAAC,CAAC;MAC1EQ,KAAK,EAAEhB,KAAK,CAACiB,MAAM,CAACC,WAAW,CAACC,IAAI,CAACC,IAAI,CAACI,MAAAA;KAC3C;AACD,IAAA,iBAAiB,EAAAnB,aAAA,CAAAA,aAAA,CAAA,EAAA,EACZoB,kBAAkB,CAAC;AAAEzB,MAAAA,KAAK,EAALA,KAAAA;AAAM,KAAC,CAAC,CAAA,EAAA,EAAA,EAAA;AAChC;AACA0B,MAAAA,YAAY,EAAE1B,KAAK,CAACsB,MAAM,CAACK,MAAM,CAACC,KAAAA;AAAK,KAAA,CAAA;AACxC,GAAA,CAAA,CAAA;AAEL,CAAC;;;;"}
@@ -15,19 +15,21 @@ var getBackgroundColor = function getBackgroundColor(_ref) {
15
15
  isExpanded = _ref.isExpanded,
16
16
  isActive = _ref.isActive;
17
17
  var gray = theme.colors.interactive.background.gray;
18
- if (isActive) {
18
+ if (isExpanded) {
19
+ if (isActive) {
20
+ return gray.fadedHighlighted;
21
+ }
19
22
  return gray.faded;
20
23
  }
21
- if (isExpanded) {
22
- return gray["default"];
24
+ if (isActive) {
25
+ return gray.faded;
23
26
  }
24
- var TRANSPARENT = 'hsla(0, 0%, 100%, 0)';
25
- return TRANSPARENT;
27
+ return theme.colors.transparent;
26
28
  };
27
29
  var getCommonAccordionButtonStyles = function getCommonAccordionButtonStyles(props) {
28
30
  var theme = props.theme;
29
31
  return {
30
- padding: theme.spacing[5],
32
+ padding: theme.spacing[0],
31
33
  display: 'flex',
32
34
  flexDirection: 'row',
33
35
  alignItems: 'center',
@@ -1 +1 @@
1
- {"version":3,"file":"commonStyles.js","sources":["../../../../../../src/components/Accordion/commonStyles.ts"],"sourcesContent":["import type { CSSObject, StyledProps } from 'styled-components';\nimport type { StyledAccordionButtonProps } from './types';\nimport type { Theme } from '~components/BladeProvider';\nimport { makeMotionTime } from '~utils';\n\n// eslint-disable-next-line @typescript-eslint/explicit-function-return-type\nconst getTransitionDuration = (theme: Theme) => makeMotionTime(theme.motion.duration['2xquick']);\n\n// eslint-disable-next-line @typescript-eslint/explicit-function-return-type\nconst getTransitionEasing = (theme: Theme) => theme.motion.easing.standard.effective;\n\nconst getBackgroundColor = ({\n theme,\n isExpanded,\n isActive,\n}: {\n theme: Theme;\n isExpanded: boolean;\n isActive: boolean;\n}): string => {\n const { gray } = theme.colors.interactive.background;\n\n if (isActive) {\n return gray.faded;\n }\n\n if (isExpanded) {\n return gray.default;\n }\n\n const TRANSPARENT = 'hsla(0, 0%, 100%, 0)';\n return TRANSPARENT;\n};\n\nconst getCommonAccordionButtonStyles = (\n props: StyledProps<StyledAccordionButtonProps>,\n): CSSObject => {\n const { theme } = props;\n\n return {\n padding: theme.spacing[5],\n display: 'flex',\n flexDirection: 'row',\n alignItems: 'center',\n justifyContent: 'space-between',\n };\n};\n\nexport {\n getTransitionDuration,\n getTransitionEasing,\n getBackgroundColor,\n getCommonAccordionButtonStyles,\n};\n"],"names":["getTransitionDuration","theme","makeMotionTime","motion","duration","getTransitionEasing","easing","standard","effective","getBackgroundColor","_ref","isExpanded","isActive","gray","colors","interactive","background","faded","TRANSPARENT","getCommonAccordionButtonStyles","props","padding","spacing","display","flexDirection","alignItems","justifyContent"],"mappings":";;;AAKA;AACA,IAAMA,qBAAqB,GAAG,SAAxBA,qBAAqBA,CAAIC,KAAY,EAAA;EAAA,OAAKC,cAAc,CAACD,KAAK,CAACE,MAAM,CAACC,QAAQ,CAAC,SAAS,CAAC,CAAC,CAAA;AAAA,EAAA;;AAEhG;AACA,IAAMC,mBAAmB,GAAG,SAAtBA,mBAAmBA,CAAIJ,KAAY,EAAA;EAAA,OAAKA,KAAK,CAACE,MAAM,CAACG,MAAM,CAACC,QAAQ,CAACC,SAAS,CAAA;AAAA,EAAA;AAEpF,IAAMC,kBAAkB,GAAG,SAArBA,kBAAkBA,CAAAC,IAAA,EAQV;AAAA,EAAA,IAPZT,KAAK,GAAAS,IAAA,CAALT,KAAK;IACLU,UAAU,GAAAD,IAAA,CAAVC,UAAU;IACVC,QAAQ,GAAAF,IAAA,CAARE,QAAQ,CAAA;EAMR,IAAQC,IAAI,GAAKZ,KAAK,CAACa,MAAM,CAACC,WAAW,CAACC,UAAU,CAA5CH,IAAI,CAAA;AAEZ,EAAA,IAAID,QAAQ,EAAE;IACZ,OAAOC,IAAI,CAACI,KAAK,CAAA;AACnB,GAAA;AAEA,EAAA,IAAIN,UAAU,EAAE;AACd,IAAA,OAAOE,IAAI,CAAQ,SAAA,CAAA,CAAA;AACrB,GAAA;EAEA,IAAMK,WAAW,GAAG,sBAAsB,CAAA;AAC1C,EAAA,OAAOA,WAAW,CAAA;AACpB,EAAC;AAED,IAAMC,8BAA8B,GAAG,SAAjCA,8BAA8BA,CAClCC,KAA8C,EAChC;AACd,EAAA,IAAQnB,KAAK,GAAKmB,KAAK,CAAfnB,KAAK,CAAA;EAEb,OAAO;AACLoB,IAAAA,OAAO,EAAEpB,KAAK,CAACqB,OAAO,CAAC,CAAC,CAAC;AACzBC,IAAAA,OAAO,EAAE,MAAM;AACfC,IAAAA,aAAa,EAAE,KAAK;AACpBC,IAAAA,UAAU,EAAE,QAAQ;AACpBC,IAAAA,cAAc,EAAE,eAAA;GACjB,CAAA;AACH;;;;"}
1
+ {"version":3,"file":"commonStyles.js","sources":["../../../../../../src/components/Accordion/commonStyles.ts"],"sourcesContent":["import type { CSSObject, StyledProps } from 'styled-components';\nimport type { StyledAccordionButtonProps } from './types';\nimport type { Theme } from '~components/BladeProvider';\nimport { makeMotionTime } from '~utils';\n\n// eslint-disable-next-line @typescript-eslint/explicit-function-return-type\nconst getTransitionDuration = (theme: Theme) => makeMotionTime(theme.motion.duration['2xquick']);\n\n// eslint-disable-next-line @typescript-eslint/explicit-function-return-type\nconst getTransitionEasing = (theme: Theme) => theme.motion.easing.standard.effective;\n\nconst getBackgroundColor = ({\n theme,\n isExpanded,\n isActive,\n}: {\n theme: Theme;\n isExpanded: boolean;\n isActive: boolean;\n}): string => {\n const { gray } = theme.colors.interactive.background;\n\n if (isExpanded) {\n if (isActive) {\n return gray.fadedHighlighted;\n }\n\n return gray.faded;\n }\n\n if (isActive) {\n return gray.faded;\n }\n\n return theme.colors.transparent;\n};\n\nconst getCommonAccordionButtonStyles = (\n props: StyledProps<StyledAccordionButtonProps>,\n): CSSObject => {\n const { theme } = props;\n\n return {\n padding: theme.spacing[0],\n display: 'flex',\n flexDirection: 'row',\n alignItems: 'center',\n justifyContent: 'space-between',\n };\n};\n\nexport {\n getTransitionDuration,\n getTransitionEasing,\n getBackgroundColor,\n getCommonAccordionButtonStyles,\n};\n"],"names":["getTransitionDuration","theme","makeMotionTime","motion","duration","getTransitionEasing","easing","standard","effective","getBackgroundColor","_ref","isExpanded","isActive","gray","colors","interactive","background","fadedHighlighted","faded","transparent","getCommonAccordionButtonStyles","props","padding","spacing","display","flexDirection","alignItems","justifyContent"],"mappings":";;;AAKA;AACA,IAAMA,qBAAqB,GAAG,SAAxBA,qBAAqBA,CAAIC,KAAY,EAAA;EAAA,OAAKC,cAAc,CAACD,KAAK,CAACE,MAAM,CAACC,QAAQ,CAAC,SAAS,CAAC,CAAC,CAAA;AAAA,EAAA;;AAEhG;AACA,IAAMC,mBAAmB,GAAG,SAAtBA,mBAAmBA,CAAIJ,KAAY,EAAA;EAAA,OAAKA,KAAK,CAACE,MAAM,CAACG,MAAM,CAACC,QAAQ,CAACC,SAAS,CAAA;AAAA,EAAA;AAEpF,IAAMC,kBAAkB,GAAG,SAArBA,kBAAkBA,CAAAC,IAAA,EAQV;AAAA,EAAA,IAPZT,KAAK,GAAAS,IAAA,CAALT,KAAK;IACLU,UAAU,GAAAD,IAAA,CAAVC,UAAU;IACVC,QAAQ,GAAAF,IAAA,CAARE,QAAQ,CAAA;EAMR,IAAQC,IAAI,GAAKZ,KAAK,CAACa,MAAM,CAACC,WAAW,CAACC,UAAU,CAA5CH,IAAI,CAAA;AAEZ,EAAA,IAAIF,UAAU,EAAE;AACd,IAAA,IAAIC,QAAQ,EAAE;MACZ,OAAOC,IAAI,CAACI,gBAAgB,CAAA;AAC9B,KAAA;IAEA,OAAOJ,IAAI,CAACK,KAAK,CAAA;AACnB,GAAA;AAEA,EAAA,IAAIN,QAAQ,EAAE;IACZ,OAAOC,IAAI,CAACK,KAAK,CAAA;AACnB,GAAA;AAEA,EAAA,OAAOjB,KAAK,CAACa,MAAM,CAACK,WAAW,CAAA;AACjC,EAAC;AAED,IAAMC,8BAA8B,GAAG,SAAjCA,8BAA8BA,CAClCC,KAA8C,EAChC;AACd,EAAA,IAAQpB,KAAK,GAAKoB,KAAK,CAAfpB,KAAK,CAAA;EAEb,OAAO;AACLqB,IAAAA,OAAO,EAAErB,KAAK,CAACsB,OAAO,CAAC,CAAC,CAAC;AACzBC,IAAAA,OAAO,EAAE,MAAM;AACfC,IAAAA,aAAa,EAAE,KAAK;AACpBC,IAAAA,UAAU,EAAE,QAAQ;AACpBC,IAAAA,cAAc,EAAE,eAAA;GACjB,CAAA;AACH;;;;"}
@@ -0,0 +1,8 @@
1
+ var componentIds = {
2
+ AccordionItemHeader: 'AccordionItemHeader',
3
+ AccordionItemBody: 'AccordionItemBody',
4
+ AccordionItem: 'AccordionItem'
5
+ };
6
+
7
+ export { componentIds };
8
+ //# sourceMappingURL=componentIds.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"componentIds.js","sources":["../../../../../../src/components/Accordion/componentIds.ts"],"sourcesContent":["export const componentIds = {\n AccordionItemHeader: 'AccordionItemHeader',\n AccordionItemBody: 'AccordionItemBody',\n AccordionItem: 'AccordionItem',\n};\n"],"names":["componentIds","AccordionItemHeader","AccordionItemBody","AccordionItem"],"mappings":"AAAO,IAAMA,YAAY,GAAG;AAC1BC,EAAAA,mBAAmB,EAAE,qBAAqB;AAC1CC,EAAAA,iBAAiB,EAAE,mBAAmB;AACtCC,EAAAA,aAAa,EAAE,eAAA;AACjB;;;;"}
@@ -1,3 +1,5 @@
1
1
  export { Accordion } from './Accordion.js';
2
+ export { AccordionItemHeader } from './AccordionItemHeader.js';
3
+ export { AccordionItemBody } from './AccordionItemBody.js';
2
4
  export { AccordionItem } from './AccordionItem.js';
3
5
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";"}
1
+ {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;"}
@@ -1,5 +1,5 @@
1
- import _defineProperty from '@babel/runtime/helpers/defineProperty';
2
1
  import _slicedToArray from '@babel/runtime/helpers/slicedToArray';
2
+ import _defineProperty from '@babel/runtime/helpers/defineProperty';
3
3
  import React__default from 'react';
4
4
  import '../Divider/index.js';
5
5
  import '../Box/BaseBox/index.js';
@@ -31,39 +31,78 @@ import { assignWithoutSideEffects } from '../../utils/assignWithoutSideEffects/a
31
31
 
32
32
  function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
33
33
  function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
34
- var centerBoxProps = {
34
+ var commonCenterBoxProps = {
35
35
  display: 'flex',
36
36
  alignItems: 'center',
37
- justifyContent: 'center',
38
- // We want to align title, icon, titleSuffix, trailing, closeButton to baseline
39
- // But we also want to keep them center aligned to each other
40
- // So we add a virtual Box around these slots with 28px and center align them to that box
41
- // We have done similar thing in figma as well (which is where this 28px comes from)
42
- height: '28px'
37
+ justifyContent: 'center'
38
+ };
39
+ var centerBoxProps = {
40
+ large: _objectSpread(_objectSpread({}, commonCenterBoxProps), {}, {
41
+ // We want to align title, icon, titleSuffix, trailing, closeButton to baseline
42
+ // But we also want to keep them center aligned to each other
43
+ // So we add a virtual Box around these slots with 28px and center align them to that box
44
+ // We have done similar thing in figma as well (which is where this 28px comes from)
45
+ height: '28px'
46
+ }),
47
+ medium: _objectSpread(_objectSpread({}, commonCenterBoxProps), {}, {
48
+ height: '20px'
49
+ })
50
+ };
51
+ var sizeTokensMapping = {
52
+ large: {
53
+ title: 'large'
54
+ },
55
+ medium: {
56
+ title: 'medium'
57
+ }
43
58
  };
44
59
 
45
60
  // prop restriction map for corresponding sub components
46
61
  var propRestrictionMap = {
47
- Button: {
48
- size: 'xsmall',
49
- variant: 'tertiary'
50
- },
51
- Badge: {
52
- size: 'medium'
53
- },
54
- Link: {
55
- size: 'medium'
56
- },
57
- Text: {
58
- size: 'medium',
59
- variant: 'body'
62
+ large: {
63
+ Button: {
64
+ size: 'xsmall',
65
+ variant: 'tertiary'
66
+ },
67
+ Badge: {
68
+ size: 'medium'
69
+ },
70
+ Link: {
71
+ size: 'medium'
72
+ },
73
+ Text: {
74
+ size: 'medium',
75
+ variant: 'body'
76
+ },
77
+ Amount: {
78
+ type: 'body',
79
+ size: 'medium'
80
+ }
60
81
  },
61
- Amount: {
62
- type: 'body',
63
- size: 'medium'
82
+ medium: {
83
+ Button: {
84
+ size: 'xsmall',
85
+ variant: 'tertiary'
86
+ },
87
+ Badge: {
88
+ size: 'small'
89
+ },
90
+ Link: {
91
+ size: 'small'
92
+ },
93
+ Text: {
94
+ size: 'small',
95
+ variant: 'body'
96
+ },
97
+ Amount: {
98
+ type: 'body',
99
+ size: 'small'
100
+ }
64
101
  }
65
102
  };
66
- var useTrailingRestriction = function useTrailingRestriction(trailing) {
103
+ var useTrailingRestriction = function useTrailingRestriction(_ref) {
104
+ var trailing = _ref.trailing,
105
+ size = _ref.size;
67
106
  var _React$useState = React__default.useState(null),
68
107
  _React$useState2 = _slicedToArray(_React$useState, 2),
69
108
  validatedTrailingComponent = _React$useState2[0],
@@ -73,8 +112,8 @@ var useTrailingRestriction = function useTrailingRestriction(trailing) {
73
112
  React__default.useEffect(function () {
74
113
  if ( /*#__PURE__*/React__default.isValidElement(trailing)) {
75
114
  var trailingComponentType = getComponentId(trailing);
76
- var restrictedProps = propRestrictionMap[trailingComponentType];
77
- var allowedComponents = Object.keys(propRestrictionMap);
115
+ var restrictedProps = propRestrictionMap[size][trailingComponentType];
116
+ var allowedComponents = Object.keys(propRestrictionMap[size]);
78
117
  if (true) {
79
118
  if (!restrictedProps) {
80
119
  throwBladeError({
@@ -83,7 +122,7 @@ var useTrailingRestriction = function useTrailingRestriction(trailing) {
83
122
  });
84
123
  }
85
124
  }
86
- var restrictedPropKeys = Object.keys(propRestrictionMap[trailingComponentType]);
125
+ var restrictedPropKeys = Object.keys(propRestrictionMap[size][trailingComponentType]);
87
126
  for (var _i = 0, _restrictedPropKeys = restrictedPropKeys; _i < _restrictedPropKeys.length; _i++) {
88
127
  var _trailing$props;
89
128
  var prop = _restrictedPropKeys[_i];
@@ -97,37 +136,46 @@ var useTrailingRestriction = function useTrailingRestriction(trailing) {
97
136
  }
98
137
  setValidatedTrailingComponent( /*#__PURE__*/React__default.cloneElement(trailing, restrictedProps));
99
138
  }
100
- }, [trailing]);
139
+ }, [trailing, size]);
101
140
  return validatedTrailingComponent;
102
141
  };
103
- var _BaseHeader = function _BaseHeader(_ref) {
104
- var title = _ref.title,
105
- subtitle = _ref.subtitle,
106
- leading = _ref.leading,
107
- titleSuffix = _ref.titleSuffix,
108
- trailing = _ref.trailing,
109
- _ref$showDivider = _ref.showDivider,
110
- showDivider = _ref$showDivider === void 0 ? true : _ref$showDivider,
111
- _ref$showBackButton = _ref.showBackButton,
112
- showBackButton = _ref$showBackButton === void 0 ? false : _ref$showBackButton,
113
- _ref$showCloseButton = _ref.showCloseButton,
114
- showCloseButton = _ref$showCloseButton === void 0 ? true : _ref$showCloseButton,
115
- onBackButtonClick = _ref.onBackButtonClick,
116
- onCloseButtonClick = _ref.onCloseButtonClick,
117
- closeButtonRef = _ref.closeButtonRef,
118
- backButtonRef = _ref.backButtonRef,
119
- testID = _ref.testID,
120
- onClickCapture = _ref.onClickCapture,
121
- onKeyDown = _ref.onKeyDown,
122
- onKeyUp = _ref.onKeyUp,
123
- onLostPointerCapture = _ref.onLostPointerCapture,
124
- onPointerCancel = _ref.onPointerCancel,
125
- onPointerDown = _ref.onPointerDown,
126
- onPointerMove = _ref.onPointerMove,
127
- onPointerUp = _ref.onPointerUp,
128
- metaComponentName = _ref.metaComponentName,
129
- children = _ref.children;
130
- var validatedTrailingComponent = useTrailingRestriction(trailing);
142
+ var _BaseHeader = function _BaseHeader(_ref2) {
143
+ var title = _ref2.title,
144
+ subtitle = _ref2.subtitle,
145
+ leading = _ref2.leading,
146
+ titleSuffix = _ref2.titleSuffix,
147
+ trailing = _ref2.trailing,
148
+ _ref2$showDivider = _ref2.showDivider,
149
+ showDivider = _ref2$showDivider === void 0 ? true : _ref2$showDivider,
150
+ _ref2$showBackButton = _ref2.showBackButton,
151
+ showBackButton = _ref2$showBackButton === void 0 ? false : _ref2$showBackButton,
152
+ _ref2$showCloseButton = _ref2.showCloseButton,
153
+ showCloseButton = _ref2$showCloseButton === void 0 ? true : _ref2$showCloseButton,
154
+ onBackButtonClick = _ref2.onBackButtonClick,
155
+ onCloseButtonClick = _ref2.onCloseButtonClick,
156
+ closeButtonRef = _ref2.closeButtonRef,
157
+ backButtonRef = _ref2.backButtonRef,
158
+ testID = _ref2.testID,
159
+ onClickCapture = _ref2.onClickCapture,
160
+ onKeyDown = _ref2.onKeyDown,
161
+ onKeyUp = _ref2.onKeyUp,
162
+ onLostPointerCapture = _ref2.onLostPointerCapture,
163
+ onPointerCancel = _ref2.onPointerCancel,
164
+ onPointerDown = _ref2.onPointerDown,
165
+ onPointerMove = _ref2.onPointerMove,
166
+ onPointerUp = _ref2.onPointerUp,
167
+ metaComponentName = _ref2.metaComponentName,
168
+ paddingX = _ref2.paddingX,
169
+ marginY = _ref2.marginY,
170
+ _ref2$size = _ref2.size,
171
+ size$1 = _ref2$size === void 0 ? 'large' : _ref2$size,
172
+ isDisabled = _ref2.isDisabled,
173
+ children = _ref2.children,
174
+ trailingInteractionElement = _ref2.trailingInteractionElement;
175
+ var validatedTrailingComponent = useTrailingRestriction({
176
+ trailing: trailing,
177
+ size: size$1
178
+ });
131
179
  var shouldWrapTitle = titleSuffix && trailing && showBackButton && showCloseButton;
132
180
  var webOnlyEventHandlers = isReactNative() ? {} : {
133
181
  onClickCapture: onClickCapture,
@@ -144,11 +192,11 @@ var _BaseHeader = function _BaseHeader(_ref) {
144
192
  testID: testID
145
193
  })), {}, {
146
194
  children: [/*#__PURE__*/jsxs(BaseBox, _objectSpread(_objectSpread({
147
- marginY: {
195
+ marginY: marginY !== null && marginY !== void 0 ? marginY : {
148
196
  base: 'spacing.5',
149
197
  m: 'spacing.6'
150
198
  },
151
- paddingX: {
199
+ paddingX: paddingX !== null && paddingX !== void 0 ? paddingX : {
152
200
  base: 'spacing.5',
153
201
  m: 'spacing.6'
154
202
  },
@@ -161,7 +209,7 @@ var _BaseHeader = function _BaseHeader(_ref) {
161
209
  children: [showBackButton ? /*#__PURE__*/jsx(BaseBox, {
162
210
  overflow: "visible",
163
211
  marginRight: "spacing.5",
164
- children: /*#__PURE__*/jsx(Box, _objectSpread(_objectSpread({}, centerBoxProps), {}, {
212
+ children: /*#__PURE__*/jsx(Box, _objectSpread(_objectSpread({}, centerBoxProps[size$1]), {}, {
165
213
  children: /*#__PURE__*/jsx(IconButton, {
166
214
  ref: backButtonRef,
167
215
  size: "large",
@@ -181,7 +229,7 @@ var _BaseHeader = function _BaseHeader(_ref) {
181
229
  alignItems: "flex-start",
182
230
  children: [leading ? /*#__PURE__*/jsx(BaseBox, _objectSpread(_objectSpread({
183
231
  marginRight: "spacing.3"
184
- }, centerBoxProps), {}, {
232
+ }, centerBoxProps[size$1]), {}, {
185
233
  children: leading
186
234
  })) : null, /*#__PURE__*/jsxs(BaseBox, {
187
235
  flex: "auto",
@@ -195,14 +243,14 @@ var _BaseHeader = function _BaseHeader(_ref) {
195
243
  display: "flex",
196
244
  flexDirection: "row",
197
245
  children: [title ? /*#__PURE__*/jsx(Text, {
198
- size: "large",
246
+ size: sizeTokensMapping[size$1].title,
199
247
  marginTop: makeSize(size['1']),
200
248
  weight: "semibold",
201
- color: "surface.text.gray.normal",
249
+ color: isDisabled ? 'surface.text.gray.disabled' : 'surface.text.gray.normal',
202
250
  children: title
203
251
  }) : null, titleSuffix && /*#__PURE__*/jsx(BaseBox, {
204
252
  marginLeft: "spacing.3",
205
- children: /*#__PURE__*/jsx(Box, _objectSpread(_objectSpread({}, centerBoxProps), {}, {
253
+ children: /*#__PURE__*/jsx(Box, _objectSpread(_objectSpread({}, centerBoxProps[size$1]), {}, {
206
254
  children: titleSuffix
207
255
  }))
208
256
  })]
@@ -210,16 +258,16 @@ var _BaseHeader = function _BaseHeader(_ref) {
210
258
  variant: "body",
211
259
  size: "small",
212
260
  weight: "regular",
213
- color: "surface.text.gray.muted",
261
+ color: isDisabled ? 'surface.text.gray.disabled' : 'surface.text.gray.muted',
214
262
  children: subtitle
215
263
  }) : null]
216
264
  })]
217
265
  }), validatedTrailingComponent ? /*#__PURE__*/jsx(BaseBox, {
218
266
  marginRight: "spacing.5",
219
- children: /*#__PURE__*/jsx(Box, _objectSpread(_objectSpread({}, centerBoxProps), {}, {
267
+ children: /*#__PURE__*/jsx(Box, _objectSpread(_objectSpread({}, centerBoxProps[size$1]), {}, {
220
268
  children: validatedTrailingComponent
221
269
  }))
222
- }) : null, showCloseButton ? /*#__PURE__*/jsx(Box, _objectSpread(_objectSpread({}, centerBoxProps), {}, {
270
+ }) : null, showCloseButton ? /*#__PURE__*/jsx(Box, _objectSpread(_objectSpread({}, centerBoxProps[size$1]), {}, {
223
271
  children: /*#__PURE__*/jsx(IconButton, {
224
272
  ref: closeButtonRef,
225
273
  size: "large",
@@ -229,8 +277,23 @@ var _BaseHeader = function _BaseHeader(_ref) {
229
277
  return onCloseButtonClick === null || onCloseButtonClick === void 0 ? void 0 : onCloseButtonClick();
230
278
  }
231
279
  })
280
+ })) : null, trailingInteractionElement && !children ? /*#__PURE__*/jsx(Box, _objectSpread(_objectSpread({}, centerBoxProps[size$1]), {}, {
281
+ children: trailingInteractionElement
282
+ })) : null]
283
+ }), /*#__PURE__*/jsxs(BaseBox, {
284
+ display: "flex",
285
+ width: "100%",
286
+ flexDirection: "row",
287
+ alignItems: "center",
288
+ justifyContent: "space-between",
289
+ children: [/*#__PURE__*/jsx(Box, {
290
+ children: children
291
+ }), trailingInteractionElement && children ? /*#__PURE__*/jsx(Box, _objectSpread(_objectSpread({
292
+ alignSelf: "flex-start"
293
+ }, centerBoxProps[size$1]), {}, {
294
+ children: trailingInteractionElement
232
295
  })) : null]
233
- }), children]
296
+ })]
234
297
  })), showDivider ? /*#__PURE__*/jsx(Divider, {}) : null]
235
298
  }));
236
299
  };