@ntbjs/react-components 3.0.0-rc.1 → 3.0.0-rc.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (139) hide show
  1. package/README.md +34 -0
  2. package/build/data/Alert/Alert.js.map +1 -1
  3. package/build/data/Alert/Alert.styled.js.map +1 -1
  4. package/build/data/Badge/Badge.js.map +1 -1
  5. package/build/data/Badge/Badge.styled.js.map +1 -1
  6. package/build/data/Popover/Popover.js.map +1 -1
  7. package/build/data/Popover/Popover.styled.js.map +1 -1
  8. package/build/data/SeverityBadge/SeverityBadge.js.map +1 -1
  9. package/build/data/Tab/Tab.js.map +1 -1
  10. package/build/data/Tab/Tab.styled.js.map +1 -1
  11. package/build/data/Tabs/Tabs.js.map +1 -1
  12. package/build/data/Tabs/Tabs.styled.js.map +1 -1
  13. package/build/data/Tooltip/Tooltip.js.map +1 -1
  14. package/build/data/Tooltip/Tooltip.styled.js.map +1 -1
  15. package/build/data/VerificationStatusIcon/VerificationStatusIcon.js.map +1 -1
  16. package/build/data/VerificationStatusIcon/VerificationStatusIcon.styled.js.map +1 -1
  17. package/build/data/_shared/FloatingArrow.styled.js.map +1 -1
  18. package/build/hooks/useEventListner.js.map +1 -1
  19. package/build/hooks/useFloatingPopover.js.map +1 -1
  20. package/build/hooks/useIsomorphicLayoutEffect.js.map +1 -1
  21. package/build/hooks/useOnClickOutside.js.map +1 -1
  22. package/build/hooks/useTooltipAutoShow.js.map +1 -1
  23. package/build/inputs/ActionButton/ActionButton.js.map +1 -1
  24. package/build/inputs/ActionButton/ActionButton.styled.js.map +1 -1
  25. package/build/inputs/Button/Button.js.map +1 -1
  26. package/build/inputs/Button/Button.styled.js.map +1 -1
  27. package/build/inputs/Checkbox/Checkbox.js.map +1 -1
  28. package/build/inputs/Checkbox/Checkbox.styled.js.map +1 -1
  29. package/build/inputs/CompactAutocompleteSelect/CompactAutocompleteSelect.js.map +1 -1
  30. package/build/inputs/CompactAutocompleteSelect/CompactAutocompleteSelect.styled.js.map +1 -1
  31. package/build/inputs/CompactStarRating/CompactStarRating.js.map +1 -1
  32. package/build/inputs/CompactStarRating/CompactStarRating.styled.js.map +1 -1
  33. package/build/inputs/CompactTextInput/CompactTextInput.js.map +1 -1
  34. package/build/inputs/CompactTextInput/CompactTextInput.styled.js.map +1 -1
  35. package/build/inputs/MultiLevelCheckbox/MultiLevelCheckbox.js.map +1 -1
  36. package/build/inputs/MultiLevelCheckbox/MultiLevelCheckbox.styled.js.map +1 -1
  37. package/build/inputs/MultiLevelCheckbox/types.js.map +1 -1
  38. package/build/inputs/MultiLevelCheckboxSelect/MultiLevelCheckboxSelect.js.map +1 -1
  39. package/build/inputs/MultiLevelCheckboxSelect/MultiLevelCheckboxSelect.styled.js.map +1 -1
  40. package/build/inputs/MultiSelect/MultiSelect.js.map +1 -1
  41. package/build/inputs/MultiSelect/MultiSelect.styled.js.map +1 -1
  42. package/build/inputs/Radio/Radio.js.map +1 -1
  43. package/build/inputs/Radio/Radio.styled.js.map +1 -1
  44. package/build/inputs/Switch/Switch.styled.js.map +1 -1
  45. package/build/inputs/TextArea/TextArea.js.map +1 -1
  46. package/build/inputs/TextArea/TextArea.styled.js.map +1 -1
  47. package/build/inputs/TextInput/TextInput.js.map +1 -1
  48. package/build/inputs/TextInput/TextInput.styled.js.map +1 -1
  49. package/build/layout/InputGroup/InputGroup.js.map +1 -1
  50. package/build/layout/InputGroup/InputGroup.styled.js.map +1 -1
  51. package/build/layout/SectionSeparator/SectionSeparator.js.map +1 -1
  52. package/build/layout/SectionSeparator/SectionSeparator.styled.js.map +1 -1
  53. package/build/styles/utils/colors-export.d.ts +6 -25
  54. package/build/utils/dateTime.js.map +1 -1
  55. package/build/utils/defaultTheme.js.map +1 -1
  56. package/build/utils/getElementRef.js.map +1 -1
  57. package/build/utils/parseTrigger.js.map +1 -1
  58. package/build/widgets/AssetAction/AssetAction.js.map +1 -1
  59. package/build/widgets/AssetAction/AssetAction.styled.js.map +1 -1
  60. package/build/widgets/AssetActionsBase/AssetActionsBase.js.map +1 -1
  61. package/build/widgets/AssetActionsBase/AssetActionsBase.styled.js.map +1 -1
  62. package/build/widgets/AssetGallery/AssetGallery.js.map +1 -1
  63. package/build/widgets/AssetGallery/AssetGalleryBase/AssetGalleryBase.js.map +1 -1
  64. package/build/widgets/AssetGallery/AssetGalleryBase/AssetGalleryBase.styled.js.map +1 -1
  65. package/build/widgets/AssetGallery/AssetGalleryBase/AssetGalleryCompactCard/AssetGalleryCompactCard.js.map +1 -1
  66. package/build/widgets/AssetGallery/AssetGalleryBase/AssetGalleryCompactCard/AssetGalleryCompactCard.styled.js.map +1 -1
  67. package/build/widgets/AssetGallery/AssetGalleryBase/AssetGalleryGridCard/AssetGalleryGridCard.js.map +1 -1
  68. package/build/widgets/AssetGallery/AssetGalleryBase/AssetGalleryGridCard/AssetGalleryGridCard.styled.js.map +1 -1
  69. package/build/widgets/AssetPreview/AssetPreviewTopBar/AssetPreviewTopBar.js.map +1 -1
  70. package/build/widgets/AssetPreview/AssetPreviewTopBar/AssetPreviewTopBar.styled.js.map +1 -1
  71. package/build/widgets/ContextMenu/ContextMenu.js.map +1 -1
  72. package/build/widgets/ContextMenu/ContextMenu.styled.js.map +1 -1
  73. package/build/widgets/ContextMenu/ContextMenuItem/ContextMenuItem.js.map +1 -1
  74. package/build/widgets/ContextMenu/ContextMenuItem/ContextMenuItem.styled.js.map +1 -1
  75. package/build/widgets/ContextMenu/ContextMenuItemsGroup/ContextMenuItemsGroup.js.map +1 -1
  76. package/build/widgets/ContextMenu/ContextMenuItemsGroup/ContextMenuItemsGroup.styled.js.map +1 -1
  77. package/build/widgets/InfoCard/InfoCard.js.map +1 -1
  78. package/build/widgets/InfoCard/InfoCard.styled.js.map +1 -1
  79. package/build/widgets/InstructionSeverityDisplay/InstructionSeverityDisplay.js.map +1 -1
  80. package/build/widgets/InstructionSeverityDisplay/InstructionSeverityDisplay.styled.js.map +1 -1
  81. package/build/widgets/Instructions/Instructions.js.map +1 -1
  82. package/build/widgets/Instructions/Instructions.styled.js.map +1 -1
  83. package/build/widgets/ProgressBar/ProgressBar.js.map +1 -1
  84. package/build/widgets/ProgressBar/ProgressBar.styled.js.map +1 -1
  85. package/build/widgets/SummaryCard/SummaryCard.js.map +1 -1
  86. package/build/widgets/SummaryCard/SummaryCard.styled.js.map +1 -1
  87. package/package.json +8 -1
  88. package/styles/utils/colors-export.d.ts +6 -25
  89. package/types/components/data/Alert/Alert.styled.d.ts +6 -37
  90. package/types/components/data/Badge/Badge.d.ts +1 -9
  91. package/types/components/data/Badge/Badge.styled.d.ts +0 -99
  92. package/types/components/data/Popover/Popover.d.ts +11 -100
  93. package/types/components/data/Tab/Tab.d.ts +1 -14
  94. package/types/components/data/Tabs/Tabs.styled.d.ts +1 -17
  95. package/types/components/data/Tooltip/Tooltip.d.ts +4 -50
  96. package/types/components/data/VerificationStatusIcon/VerificationStatusIcon.styled.d.ts +3 -22
  97. package/types/components/data/_shared/FloatingArrow.styled.d.ts +1 -101
  98. package/types/components/inputs/ActionButton/ActionButton.styled.d.ts +2 -20
  99. package/types/components/inputs/Button/Button.styled.d.ts +0 -42
  100. package/types/components/inputs/Checkbox/Checkbox.d.ts +0 -9
  101. package/types/components/inputs/Checkbox/Checkbox.styled.d.ts +6 -10
  102. package/types/components/inputs/CompactAutocompleteSelect/CompactAutocompleteSelect.styled.d.ts +4 -57
  103. package/types/components/inputs/CompactStarRating/CompactStarRating.styled.d.ts +3 -55
  104. package/types/components/inputs/CompactTextInput/CompactTextInput.styled.d.ts +4 -32
  105. package/types/components/inputs/MultiLevelCheckbox/MultiLevelCheckbox.styled.d.ts +2 -10
  106. package/types/components/inputs/MultiLevelCheckbox/types.d.ts +3 -46
  107. package/types/components/inputs/MultiSelect/MultiSelect.d.ts +0 -57
  108. package/types/components/inputs/MultiSelect/MultiSelect.styled.d.ts +0 -65
  109. package/types/components/inputs/Radio/Radio.styled.d.ts +3 -3
  110. package/types/components/inputs/Switch/Switch.styled.d.ts +3 -7
  111. package/types/components/inputs/TextArea/TextArea.d.ts +0 -4
  112. package/types/components/inputs/TextArea/TextArea.styled.d.ts +5 -7
  113. package/types/components/inputs/TextInput/TextInput.styled.d.ts +1 -1
  114. package/types/components/layout/SectionSeparator/SectionSeparator.styled.d.ts +2 -9
  115. package/types/components/widgets/AssetAction/AssetAction.styled.d.ts +2 -7
  116. package/types/components/widgets/AssetGallery/AssetGalleryBase/AssetGalleryBase.d.ts +0 -12
  117. package/types/components/widgets/AssetGallery/AssetGalleryBase/AssetGalleryCompactCard/AssetGalleryCompactCard.styled.d.ts +7 -55
  118. package/types/components/widgets/AssetGallery/AssetGalleryBase/AssetGalleryGridCard/AssetGalleryGridCard.styled.d.ts +7 -43
  119. package/types/components/widgets/AssetGallery/asset.types.d.ts +31 -148
  120. package/types/components/widgets/AssetPreview/AssetPreviewTopBar/AssetPreviewTopBar.styled.d.ts +6 -20
  121. package/types/components/widgets/ContextMenu/ContextMenu.d.ts +1 -17
  122. package/types/components/widgets/ContextMenu/ContextMenuItem/ContextMenuItem.styled.d.ts +5 -13
  123. package/types/components/widgets/ContextMenu/ContextMenuItemsGroup/ContextMenuItemsGroup.d.ts +0 -18
  124. package/types/components/widgets/InfoCard/InfoCard.styled.d.ts +2 -19
  125. package/types/components/widgets/InstructionSeverityDisplay/InstructionSeverityDisplay.styled.d.ts +9 -19
  126. package/types/components/widgets/Instructions/Instructions.styled.d.ts +2 -14
  127. package/types/components/widgets/ProgressBar/ProgressBar.styled.d.ts +6 -43
  128. package/types/components/widgets/SummaryCard/SummaryCard.styled.d.ts +7 -46
  129. package/types/hooks/useElementSize.d.ts +3 -14
  130. package/types/hooks/useEventListner.d.ts +6 -38
  131. package/types/hooks/useFloatingPopover.d.ts +9 -90
  132. package/types/hooks/useIsomorphicLayoutEffect.d.ts +0 -23
  133. package/types/hooks/useOnClickOutside.d.ts +5 -23
  134. package/types/hooks/useTooltipAutoShow.d.ts +8 -57
  135. package/types/styles/utils/colors-export.d.ts +6 -25
  136. package/types/utils/dateTime.d.ts +2 -7
  137. package/types/utils/defaultTheme.d.ts +13 -92
  138. package/types/utils/getElementRef.d.ts +0 -19
  139. package/types/utils/parseTrigger.d.ts +8 -78
@@ -1 +1 @@
1
- {"version":3,"file":"SectionSeparator.js","sources":["../../../src/components/layout/SectionSeparator/SectionSeparator.tsx"],"sourcesContent":["import React from 'react';\nimport * as S from './SectionSeparator.styled';\n\ntype SectionSeparatorOwnProps = {\n /**\n * Whether the section separator should be displayed vertically.\n */\n vertical?: boolean;\n /**\n * Padding in pixels to apply to the separator.\n */\n margin?: number;\n};\n\n/*\n * NMB-3998 §C.2: `props` is spread onto `S.SectionSeparator`, so the published type\n * has to admit that target's props too — a closed type here is worse than `any` for the\n * 125 consumer files. Declared members win over the base (`Omit` by `keyof SectionSeparatorOwnProps`);\n * a bare `&` would INTERSECT a colliding member instead of overriding it, which narrows\n * it (measured: `rows?: number | string` & `rows?: number`) or empties it to `never`.\n */\ntype Props = Omit<\n React.ComponentPropsWithoutRef<typeof S.SectionSeparator>,\n keyof SectionSeparatorOwnProps\n> &\n SectionSeparatorOwnProps;\n\n/**\n * Section separators are used to separate sections in the UI.\n * It will fill 100% of the width or height of its parent container by default.\n *\n *\n * ### Import\n *\n * ``` js\n * import { SectionSeparator } from '@ntbjs/react-components/layout'\n * // or\n * import SectionSeparator from '@ntbjs/react-components/layout/SectionSeparator'\n * ```\n *\n */\nconst SectionSeparator = React.forwardRef<any, Props>(function SectionSeparator(\n { vertical = false, margin = 0, ...props },\n forwardedRef\n) {\n return <S.SectionSeparator $vertical={vertical} $margin={margin} ref={forwardedRef} {...props} />;\n});\n\nexport default SectionSeparator;\n"],"names":["SectionSeparator","React","forwardRef","vertical","margin","props","forwardedRef","_jsx","S","$vertical","$margin","ref"],"mappings":";;;;AAyCA,MAAMA,gBAAgB,GAAGC,cAAK,CAACC,UAAU,CAAa,SAASF,gBAAgBA,CAC7E;AAAEG,EAAAA,QAAQ,GAAG,KAAK;AAAEC,EAAAA,MAAM,GAAG,CAAC;EAAE,GAAGC;AAAM,CAAC,EAC1CC,YAAY,EACZ;AACA,EAAA,OAAOC,GAAA,CAACC,kBAAkB,EAAA;AAACC,IAAAA,SAAS,EAAEN,QAAS;AAACO,IAAAA,OAAO,EAAEN,MAAO;AAACO,IAAAA,GAAG,EAAEL,YAAa;IAAA,GAAKD;AAAK,GAAG,CAAC;AACnG,CAAC;;;;"}
1
+ {"version":3,"file":"SectionSeparator.js","sources":["../../../src/components/layout/SectionSeparator/SectionSeparator.tsx"],"sourcesContent":["import React from 'react';\nimport * as S from './SectionSeparator.styled';\n\ntype SectionSeparatorOwnProps = {\n /**\n * Whether the section separator should be displayed vertically.\n */\n vertical?: boolean;\n /**\n * Padding in pixels to apply to the separator.\n */\n margin?: number;\n};\n\n// Props spread onto styled component; use Omit+intersection to widen, not narrow, colliding props.\ntype Props = Omit<\n React.ComponentPropsWithoutRef<typeof S.SectionSeparator>,\n keyof SectionSeparatorOwnProps\n> &\n SectionSeparatorOwnProps;\n\n/**\n * Section separators are used to separate sections in the UI.\n * It will fill 100% of the width or height of its parent container by default.\n *\n *\n * ### Import\n *\n * ``` js\n * import { SectionSeparator } from '@ntbjs/react-components/layout'\n * // or\n * import SectionSeparator from '@ntbjs/react-components/layout/SectionSeparator'\n * ```\n *\n */\nconst SectionSeparator = React.forwardRef<any, Props>(function SectionSeparator(\n { vertical = false, margin = 0, ...props },\n forwardedRef\n) {\n return <S.SectionSeparator $vertical={vertical} $margin={margin} ref={forwardedRef} {...props} />;\n});\n\nexport default SectionSeparator;\n"],"names":["SectionSeparator","React","forwardRef","vertical","margin","props","forwardedRef","_jsx","S","$vertical","$margin","ref"],"mappings":";;;;AAmCA,MAAMA,gBAAgB,GAAGC,cAAK,CAACC,UAAU,CAAa,SAASF,gBAAgBA,CAC7E;AAAEG,EAAAA,QAAQ,GAAG,KAAK;AAAEC,EAAAA,MAAM,GAAG,CAAC;EAAE,GAAGC;AAAM,CAAC,EAC1CC,YAAY,EACZ;AACA,EAAA,OAAOC,GAAA,CAACC,kBAAkB,EAAA;AAACC,IAAAA,SAAS,EAAEN,QAAS;AAACO,IAAAA,OAAO,EAAEN,MAAO;AAACO,IAAAA,GAAG,EAAEL,YAAa;IAAA,GAAKD;AAAK,GAAG,CAAC;AACnG,CAAC;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"SectionSeparator.styled.js","sources":["../../../src/components/layout/SectionSeparator/SectionSeparator.styled.ts"],"sourcesContent":["/**\n * ===========================================================================\n * THE `$`-TRANSIENT-PROP PATTERN — REFERENCE IMPLEMENTATION\n *\n * This is the smallest of the 36 `*.styled.ts` files that has transient props,\n * which is why the rules live here: they and the smallest instance of them fit\n * on one screen. Full derivation, measurements and the two illegal forms are in\n * `scripts/TS-MIGRATION-PLAYBOOK.md` §J. The other two worked examples are\n * `widgets/InstructionSeverityDisplay/InstructionSeverityDisplay.styled.ts`\n * (chain shapes) and `inputs/CompactTextInput/CompactTextInput.styled.ts`\n * (`.attrs()` callbacks, nested `css` blocks, closed unions).\n *\n * 1. WHERE THE GENERIC GOES.\n * chain has `.attrs()` → `.attrs<Props>(applyDefaultTheme)`\n * chain has no `.attrs()` → on the tagged-template call:\n * styled.img.withConfig({…})<Props>`…`\n * NEVER `styled.div<Props>.withConfig({…})` — TS1477, an instantiation\n * expression cannot be followed by a property access. NEVER\n * `withConfig<Props>({…})` — TS2558, `withConfig` is not generic in v6\n * (only `attrs` and the template call are).\n *\n * When there IS an `.attrs()` this is not a preference: a generic on the\n * template call does not reach the `.attrs()` CALLBACK's parameter, so a\n * prop read in there has no fix other than a suppression. §J.2.\n *\n * 2. DECLARE ONLY WHAT THE COMPONENT ACTUALLY PASSES. Here `SectionSeparator.tsx`\n * passes exactly `$vertical` and `$margin`. A key the template reads but the\n * component never passes is a dead branch, not a prop — playbook §E.4.\n *\n * 3. EVERY TRANSIENT PROP IS OPTIONAL. `required` is not a stricter version of\n * this, it is broken: `<X />`, `<X {...props} />` and `styled(X)` all become\n * TS2769. It is also untrue — nothing supplies a default, because\n * `applyDefaultTheme` contributes only `theme`. §J.5.\n *\n * 4. VALUE TYPES COME FROM `propTypes`, NOT FROM `any`. `vertical: PropTypes.bool`\n * → `boolean`; `margin: PropTypes.number` → `number`. Closed unions elsewhere\n * turn a mistyped state string into TS2367 instead of a branch that never\n * fires. §J.6.\n *\n * 5. THIS CANNOT CHANGE RENDERED CSS. `shouldForwardProp` filters on the runtime\n * `$` prefix and the annotations erase to nothing under Babel. `npm run verify`\n * must stay green with `scripts/r19-harness/baseline.json` and all 592 PNGs\n * byte-unchanged. If the render gate moves, a prop's DOM forwarding changed:\n * investigate per §F.2, never re-record. §J.8.\n * ===========================================================================\n */\nimport styled from 'styled-components';\nimport { applyDefaultTheme } from '../../../utils/defaultTheme';\n\n/**\n * Props of the styled root, i.e. `SectionSeparator.tsx`'s `vertical` / `margin`\n * carried across the `shouldForwardProp` boundary.\n */\nexport interface SectionSeparatorStyleProps {\n /** `vertical` — swaps which axis gets the 1px hairline and which gets 100%. */\n $vertical?: boolean;\n /**\n * `margin` — px, interpolated as `${props.$margin}px`, so `number` and not\n * `number | string`: a string here would already render `margin-top: 8pxpx`.\n */\n $margin?: number;\n}\n\n/*\n * SINGLE-ARGUMENT, AND IT STAYS THAT WAY. `package.json#peerDependencies` allows\n * `styled-components: >=5.1.0`, and the second parameter differs between majors\n * (v6 `elementToBeCreated`, v5.1 `defaultValidatorFn`). A one-parameter function\n * is assignable to both, so this form is the only one correct on both — do not\n * annotate it as v6's `ShouldForwardProp<'web'>` and do not read a 2nd argument.\n *\n * `prop` needs the annotation because `withConfig` receives this BY REFERENCE and\n * so gives it no contextual typing; without it, `prop.startsWith` is unchecked.\n */\nconst shouldForwardProp = (prop: string): boolean => {\n return prop !== 'theme' && !prop.startsWith('$');\n};\n\nexport const SectionSeparator = styled.div\n .withConfig({\n shouldForwardProp\n })\n .attrs<SectionSeparatorStyleProps>(applyDefaultTheme)`\n height: ${props => (props.$vertical ? '100%' : '1px')};\n width: ${props => (props.$vertical ? '1px' : '100%')};\n\n ${props =>\n props.$vertical\n ? `margin-left: ${props.$margin}px; margin-right: ${props.$margin}px;`\n : `margin-top: ${props.$margin}px; margin-bottom: ${props.$margin}px;`}\n\n ${props =>\n props.theme.themeProp(\n 'background-color',\n props.theme.getColor('gray-500'),\n props.theme.getColor('gray-200')\n )}\n`;\n"],"names":["shouldForwardProp","prop","startsWith","SectionSeparator","styled","div","withConfig","attrs","applyDefaultTheme","displayName","componentId","props","$vertical","$margin","theme","themeProp","getColor"],"mappings":";;;AAyEA,MAAMA,iBAAiB,GAAIC,IAAY,IAAc;EACnD,OAAOA,IAAI,KAAK,OAAO,IAAI,CAACA,IAAI,CAACC,UAAU,CAAC,GAAG,CAAC;AAClD,CAAC;AAEM,MAAMC,gBAAgB,GAAGC,MAAM,CAACC,GAAG,CACvCC,UAAU,CAAC;AACVN,EAAAA;AACF,CAAC,CAAC,CACDO,KAAK,CAA6BC,iBAAiB,CAAC,CAAAF,UAAA,CAAA;EAAAG,WAAA,EAAA,0CAAA;EAAAC,WAAA,EAAA;AAAA,CAAA,CAAA,CAAA,CAAA,SAAA,EAAA,SAAA,EAAA,GAAA,EAAA,GAAA,EAAA,EAAA,CAAA,EAC3CC,KAAK,IAAKA,KAAK,CAACC,SAAS,GAAG,MAAM,GAAG,KAAM,EAC5CD,KAAK,IAAKA,KAAK,CAACC,SAAS,GAAG,KAAK,GAAG,MAAO,EAElDD,KAAK,IACLA,KAAK,CAACC,SAAS,GACX,CAAA,aAAA,EAAgBD,KAAK,CAACE,OAAO,CAAA,kBAAA,EAAqBF,KAAK,CAACE,OAAO,KAAK,GACpE,CAAA,YAAA,EAAeF,KAAK,CAACE,OAAO,CAAA,mBAAA,EAAsBF,KAAK,CAACE,OAAO,CAAA,GAAA,CAAK,EAExEF,KAAK,IACLA,KAAK,CAACG,KAAK,CAACC,SAAS,CACnB,kBAAkB,EAClBJ,KAAK,CAACG,KAAK,CAACE,QAAQ,CAAC,UAAU,CAAC,EAChCL,KAAK,CAACG,KAAK,CAACE,QAAQ,CAAC,UAAU,CACjC,CAAC;;;;"}
1
+ {"version":3,"file":"SectionSeparator.styled.js","sources":["../../../src/components/layout/SectionSeparator/SectionSeparator.styled.ts"],"sourcesContent":["// Transient props: declare only what component passes; use `.attrs<Props>()` form.\nimport styled from 'styled-components';\nimport { applyDefaultTheme } from '../../../utils/defaultTheme';\n\nexport interface SectionSeparatorStyleProps {\n /** `vertical` — swaps which axis gets the 1px hairline. */\n $vertical?: boolean;\n /** `margin` — px, interpolated so type is `number`. */\n $margin?: number;\n}\n\n// Single-argument only — v5.1 and v6 differ on second parameter.\nconst shouldForwardProp = (prop: string): boolean => {\n return prop !== 'theme' && !prop.startsWith('$');\n};\n\nexport const SectionSeparator = styled.div\n .withConfig({\n shouldForwardProp\n })\n .attrs<SectionSeparatorStyleProps>(applyDefaultTheme)`\n height: ${props => (props.$vertical ? '100%' : '1px')};\n width: ${props => (props.$vertical ? '1px' : '100%')};\n\n ${props =>\n props.$vertical\n ? `margin-left: ${props.$margin}px; margin-right: ${props.$margin}px;`\n : `margin-top: ${props.$margin}px; margin-bottom: ${props.$margin}px;`}\n\n ${props =>\n props.theme.themeProp(\n 'background-color',\n props.theme.getColor('gray-500'),\n props.theme.getColor('gray-200')\n )}\n`;\n"],"names":["shouldForwardProp","prop","startsWith","SectionSeparator","styled","div","withConfig","attrs","applyDefaultTheme","displayName","componentId","props","$vertical","$margin","theme","themeProp","getColor"],"mappings":";;;AAYA,MAAMA,iBAAiB,GAAIC,IAAY,IAAc;EACnD,OAAOA,IAAI,KAAK,OAAO,IAAI,CAACA,IAAI,CAACC,UAAU,CAAC,GAAG,CAAC;AAClD,CAAC;AAEM,MAAMC,gBAAgB,GAAGC,MAAM,CAACC,GAAG,CACvCC,UAAU,CAAC;AACVN,EAAAA;AACF,CAAC,CAAC,CACDO,KAAK,CAA6BC,iBAAiB,CAAC,CAAAF,UAAA,CAAA;EAAAG,WAAA,EAAA,0CAAA;EAAAC,WAAA,EAAA;AAAA,CAAA,CAAA,CAAA,CAAA,SAAA,EAAA,SAAA,EAAA,GAAA,EAAA,GAAA,EAAA,EAAA,CAAA,EAC3CC,KAAK,IAAKA,KAAK,CAACC,SAAS,GAAG,MAAM,GAAG,KAAM,EAC5CD,KAAK,IAAKA,KAAK,CAACC,SAAS,GAAG,KAAK,GAAG,MAAO,EAElDD,KAAK,IACLA,KAAK,CAACC,SAAS,GACX,CAAA,aAAA,EAAgBD,KAAK,CAACE,OAAO,CAAA,kBAAA,EAAqBF,KAAK,CAACE,OAAO,KAAK,GACpE,CAAA,YAAA,EAAeF,KAAK,CAACE,OAAO,CAAA,mBAAA,EAAsBF,KAAK,CAACE,OAAO,CAAA,GAAA,CAAK,EAExEF,KAAK,IACLA,KAAK,CAACG,KAAK,CAACC,SAAS,CACnB,kBAAkB,EAClBJ,KAAK,CAACG,KAAK,CAACE,QAAQ,CAAC,UAAU,CAAC,EAChCL,KAAK,CAACG,KAAK,CAACE,QAAQ,CAAC,UAAU,CACjC,CAAC;;;;"}
@@ -1,31 +1,12 @@
1
1
  /**
2
2
  * Hand-written types for colors-export.js.
3
3
  *
4
- * ============================ WHY BY HAND ================================
5
- * NEVER DERIVE THIS FROM THE .js WITH `keyof typeof`.
6
- *
7
- * It works locally, because the library compiles with `allowJs`. It collapses
8
- * silently in the consumer, which does not: with no `allowJs`, TypeScript cannot
9
- * read colors-export.js at all, `keyof typeof colors` degrades to
10
- * `string | number | symbol` WITH NO DIAGNOSTIC, and `colors[name]` inside a
11
- * template string then emits TS2731 — an error in OUR file, appearing only in
12
- * THEIR build. A hand-written .d.ts resolves under every `moduleResolution` mode
13
- * with or without `allowJs`.
14
- *
15
- * The cost is that this is a THIRD hand-maintained copy of the palette, beside
16
- * src/styles/.config.scss and colors-export.js. That is what
17
- * `npm run verify:palette` (scripts/ts-migration/verify-palette.cjs) is for: it
18
- * makes drift a build failure rather than a silent `undefined` at runtime. Add a
19
- * colour to the .js and this union without the other and the gate names it.
20
- * =========================================================================
21
- *
22
- * src/styles stays .js permanently (playbook §A.1) and rollup copies the whole
23
- * directory verbatim into the published `styles/` and `build/styles/` trees, so
24
- * this file ships NEXT TO its .js and
25
- * `@ntbjs/react-components/styles/utils/colors-export` gains types where it
26
- * previously resolved none. A `.d.ts` is explicitly allowed by
27
- * scripts/assert-no-published-typescript.cjs for exactly this reason; a `.ts`
28
- * there would be raw TypeScript in a published package.
4
+ * Do not derive this from the .js with `keyof typeof`: it works here because the library
5
+ * compiles with `allowJs`, but a consumer without it degrades the key to
6
+ * `string | number | symbol` silently and then emits TS2731 in their build, not ours.
7
+ * The cost is a third hand-maintained copy of the palette beside .config.scss and
8
+ * colors-export.js, so drift is caught by a build gate rather than at runtime.
9
+ * It must stay a `.d.ts` — a `.ts` would ship raw TypeScript in the published package.
29
10
  */
30
11
 
31
12
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"dateTime.js","sources":["../../src/utils/dateTime.ts"],"sourcesContent":["/**\n * Convert time given in miliseconds to a string representation of hours, minutes and seconds\n * in the format HH:MM:SS\n *\n * The hours segment is omitted entirely for durations under an hour, so the\n * result is `MM:SS` there — the `HH:` above is the maximal form, not a promise\n * about width. Both call sites (`AssetGalleryGridCard`,\n * `AssetGalleryCompactCard`) feed it straight into a `Badge`.\n *\n * @param ms duration in milliseconds. `number`, not `number | string`: the body\n * divides it, and a string would produce `NaN:NaN` rather than fail\n */\nexport const convertMsToHMS = (ms: number): string => {\n const seconds = Math.floor(ms / 1000);\n const minutes = Math.floor(seconds / 60);\n const hours = Math.floor(minutes / 60);\n\n const secondsLeft = seconds % 60;\n const minutesLeft = minutes % 60;\n\n let hmsString = '';\n if (hours) {\n hmsString += hours < 10 ? `0${hours}:` : `${hours}:`;\n }\n\n hmsString += `${minutesLeft < 10 ? `0${minutesLeft}` : `${minutesLeft}`}:`;\n hmsString += secondsLeft < 10 ? `0${secondsLeft}` : `${secondsLeft}`;\n\n return hmsString;\n};\n"],"names":["convertMsToHMS","ms","seconds","Math","floor","minutes","hours","secondsLeft","minutesLeft","hmsString"],"mappings":"AAYO,MAAMA,cAAc,GAAIC,EAAU,IAAa;EACpD,MAAMC,OAAO,GAAGC,IAAI,CAACC,KAAK,CAACH,EAAE,GAAG,IAAI,CAAC;EACrC,MAAMI,OAAO,GAAGF,IAAI,CAACC,KAAK,CAACF,OAAO,GAAG,EAAE,CAAC;EACxC,MAAMI,KAAK,GAAGH,IAAI,CAACC,KAAK,CAACC,OAAO,GAAG,EAAE,CAAC;AAEtC,EAAA,MAAME,WAAW,GAAGL,OAAO,GAAG,EAAE;AAChC,EAAA,MAAMM,WAAW,GAAGH,OAAO,GAAG,EAAE;EAEhC,IAAII,SAAS,GAAG,EAAE;AAClB,EAAA,IAAIH,KAAK,EAAE;IACTG,SAAS,IAAIH,KAAK,GAAG,EAAE,GAAG,CAAA,CAAA,EAAIA,KAAK,CAAA,CAAA,CAAG,GAAG,CAAA,EAAGA,KAAK,CAAA,CAAA,CAAG;AACtD,EAAA;AAEAG,EAAAA,SAAS,IAAI,CAAA,EAAGD,WAAW,GAAG,EAAE,GAAG,CAAA,CAAA,EAAIA,WAAW,CAAA,CAAE,GAAG,CAAA,EAAGA,WAAW,EAAE,CAAA,CAAA,CAAG;EAC1EC,SAAS,IAAIF,WAAW,GAAG,EAAE,GAAG,CAAA,CAAA,EAAIA,WAAW,CAAA,CAAE,GAAG,CAAA,EAAGA,WAAW,CAAA,CAAE;AAEpE,EAAA,OAAOE,SAAS;AAClB;;;;"}
1
+ {"version":3,"file":"dateTime.js","sources":["../../src/utils/dateTime.ts"],"sourcesContent":["/**\n * Convert time given in miliseconds to a string representation of hours, minutes and seconds\n * in the format HH:MM:SS\n *\n * Hours are omitted for durations under an hour (result is MM:SS).\n * @param ms duration in milliseconds as number (not string, to avoid NaN)\n */\nexport const convertMsToHMS = (ms: number): string => {\n const seconds = Math.floor(ms / 1000);\n const minutes = Math.floor(seconds / 60);\n const hours = Math.floor(minutes / 60);\n\n const secondsLeft = seconds % 60;\n const minutesLeft = minutes % 60;\n\n let hmsString = '';\n if (hours) {\n hmsString += hours < 10 ? `0${hours}:` : `${hours}:`;\n }\n\n hmsString += `${minutesLeft < 10 ? `0${minutesLeft}` : `${minutesLeft}`}:`;\n hmsString += secondsLeft < 10 ? `0${secondsLeft}` : `${secondsLeft}`;\n\n return hmsString;\n};\n"],"names":["convertMsToHMS","ms","seconds","Math","floor","minutes","hours","secondsLeft","minutesLeft","hmsString"],"mappings":"AAOO,MAAMA,cAAc,GAAIC,EAAU,IAAa;EACpD,MAAMC,OAAO,GAAGC,IAAI,CAACC,KAAK,CAACH,EAAE,GAAG,IAAI,CAAC;EACrC,MAAMI,OAAO,GAAGF,IAAI,CAACC,KAAK,CAACF,OAAO,GAAG,EAAE,CAAC;EACxC,MAAMI,KAAK,GAAGH,IAAI,CAACC,KAAK,CAACC,OAAO,GAAG,EAAE,CAAC;AAEtC,EAAA,MAAME,WAAW,GAAGL,OAAO,GAAG,EAAE;AAChC,EAAA,MAAMM,WAAW,GAAGH,OAAO,GAAG,EAAE;EAEhC,IAAII,SAAS,GAAG,EAAE;AAClB,EAAA,IAAIH,KAAK,EAAE;IACTG,SAAS,IAAIH,KAAK,GAAG,EAAE,GAAG,CAAA,CAAA,EAAIA,KAAK,CAAA,CAAA,CAAG,GAAG,CAAA,EAAGA,KAAK,CAAA,CAAA,CAAG;AACtD,EAAA;AAEAG,EAAAA,SAAS,IAAI,CAAA,EAAGD,WAAW,GAAG,EAAE,GAAG,CAAA,CAAA,EAAIA,WAAW,CAAA,CAAE,GAAG,CAAA,EAAGA,WAAW,EAAE,CAAA,CAAA,CAAG;EAC1EC,SAAS,IAAIF,WAAW,GAAG,EAAE,GAAG,CAAA,CAAA,EAAIA,WAAW,CAAA,CAAE,GAAG,CAAA,EAAGA,WAAW,CAAA,CAAE;AAEpE,EAAA,OAAOE,SAAS;AAClB;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"defaultTheme.js","sources":["../../src/utils/defaultTheme.ts"],"sourcesContent":["/// <reference path=\"../types/assets.d.ts\" />\n/**\n * The theme contract. Fan-in 36 — every `*.styled.ts` file in the library\n * imports from here, and 737 interpolations read `props.theme`.\n *\n * ================== TWO THINGS IN THIS FILE ARE LOAD-BEARING =================\n *\n * 1. THE `/// <reference>` ON LINE 1 IS NOT REDUNDANT WITH tsconfig's `include`.\n * It is what makes src/types/assets.d.ts reachable from the CONSUMER's\n * program. Declarations have to be reachable through the IMPORT GRAPH, not\n * merely present in the repo: the consumer's program roots are its own files\n * and it will never add `<lib>/src/types/*.d.ts` to its `include`. Measured —\n * with the declarations present but unreferenced, the consumer-shaped program\n * still reported all 40 svg and 5 css errors while our own typecheck showed\n * none. This file is the right host because everything reaches it: fan-in 36.\n * `scripts/ts-migration/tsconfig.reachability-probe.json` is the gate.\n *\n * 2. THE `DefaultTheme` AUGMENTATION LIVES HERE, NOT IN A SEPARATE MODULE.\n * styled-components v6 ships `DefaultTheme` as an empty interface\n * (`interface DefaultTheme extends Record<keyof object, any> {}`), which is\n * why all 737 `props.theme.getColor(...)` / `themeProp(...)` reads were\n * TS2339. Augmenting it from a separate `src/types/styled-theme.ts` measured\n * the same (773 vs 774 errors) but needed a side-effect import or a\n * `/// <reference>` in every consumer to be reachable. Here it is reachable\n * BY CONSTRUCTION from all 36 importers, with no scaffolding and no runtime\n * import cycle. See playbook §A.1.\n * ============================================================================\n */\nimport { colors } from '../styles/utils/colors-export';\nimport { css } from 'styled-components';\n\nimport type { ColorName } from '../styles/utils/colors-export';\nimport type { Interpolation, RuleSet } from 'styled-components';\n\nexport type { ColorName };\n\n/**\n * Looks up a design-token colour.\n *\n * Throws at runtime for an unregistered name, which is why the parameter is the\n * closed `ColorName` union rather than `string`: the error moves from a runtime\n * throw inside a styled template to a compile error at the call site.\n */\nexport type GetColor = (name: ColorName) => string;\n\n/**\n * A value `themeProp` interpolates into the generated rule. Widened to\n * styled-components' own `Interpolation` because that is literally what happens\n * to it — six call sites in `Badge.styled.ts` and `Tabs.styled.ts` pass a\n * `() => string` callback rather than a string, and two in `TextInput.styled.ts`\n * pass numbers. The guarantee this type buys is ARITY, not value narrowness.\n */\nexport type ThemePropValue = Interpolation<object>;\n\n/**\n * Emits one declaration three times — for `body.dark-theme`, for\n * `body.light-theme`, and for neither-class-set with a\n * `prefers-color-scheme: dark` fallback — so a single property can differ\n * between themes.\n *\n * TWO REPO CONVENTIONS THE TYPE SYSTEM CANNOT ENFORCE, and both cause real\n * visual bugs when broken:\n *\n * - **Never call `themeProp()` inside an `&::after` / `&::before` block.** The\n * generated `body.dark-theme &&` selector cannot address a pseudo-element from\n * inside one. Write the two rules out explicitly instead:\n * `body.light-theme &::after { … }` and `body.dark-theme &::after { … }`.\n *\n * - **Prefer static `&[data-x='state']` selectors over dynamic\n * `${props => css\\`…\\`}` rules for per-instance state.** Interpolated rules\n * share the component's `componentId`, so two instances in different states\n * collide and one wins for both.\n *\n * @param property the CSS property, e.g. `color`, `background`, or a custom\n * property like `--checkbox-black-box`\n * @param darkMode the value applied under `body.dark-theme`\n * @param lightMode the value applied under `body.light-theme`, and the fallback\n * when neither class is present\n * @param specificity how many `&` to repeat in the generated selector. A NUMBER —\n * the implementation does `Array(specificity).fill('&')`, so a\n * string silently produces a one-element array and specificity\n * 1. Typing it `number` is deliberate: it turns the one site\n * that passes `'!important'` here into a compile error rather\n * than blessing it.\n */\nexport type ThemeProp = (\n property: string,\n darkMode: ThemePropValue,\n lightMode: ThemePropValue,\n specificity?: number\n) => RuleSet<object>;\n\n/**\n * Spacing scale. Consumed by react-select through its own `theme` prop as well\n * as by our styled templates, which is why the member names are react-select's.\n */\nexport interface ThemeSpacing {\n baseUnit: number;\n controlHeight: number;\n menuGutter: number;\n}\n\n/**\n * react-select's colour contract, filled from our palette. These names are\n * react-select's, not ours — do not rename them to design-token names.\n */\nexport interface ThemeColors {\n primary: string;\n primary75: string;\n primary50: string;\n primary25: string;\n danger: string;\n neutral0: string;\n neutral5: string;\n neutral10: string;\n neutral20: string;\n neutral30: string;\n neutral40: string;\n neutral50: string;\n neutral60: string;\n neutral70: string;\n neutral80: string;\n neutral90: string;\n}\n\n/**\n * The whole theme, as a styled template sees it.\n *\n * Every member is REQUIRED, which is the truth inside an interpolation\n * (`props.theme.getColor` is always there) and a constraint at the\n * `<ThemeProvider>` boundary. Nothing in this repo hands over a partial theme —\n * the only `ThemeProvider` is `.storybook/preview.js`, with the full\n * `defaultTheme`. A consumer that wants to override part of it uses\n * `PartialNtbTheme` + `applyDefaultTheme`, which is what every `.styled` file\n * here does.\n */\nexport interface NtbTheme {\n getColor: GetColor;\n primaryFontFamily: string;\n secondaryFontFamily: string;\n themeProp: ThemeProp;\n spacing: ThemeSpacing;\n colors: ThemeColors;\n}\n\n/** A theme override: any subset of `NtbTheme`. */\nexport type PartialNtbTheme = Partial<NtbTheme>;\n\n/**\n * What `applyDefaultTheme` accepts.\n *\n * DELIBERATELY NOT `ExecutionProps & { theme?: PartialNtbTheme }`.\n * `ExecutionProps['theme']` is `DefaultTheme | undefined`, and after the\n * augmentation below `DefaultTheme` is `NtbTheme` with every member required —\n * so intersecting makes the override required again and the function's own\n * `theme = {}` default stops compiling (TS2322). Extra props still flow in\n * fine: this is a parameter position, so a caller passing the full styled\n * execution context is accepted and the runtime spreads the rest through\n * unchanged.\n */\nexport interface ThemedProps {\n theme?: PartialNtbTheme;\n}\n\nexport const defaultTheme = {\n getColor: name => {\n if (!colors[name]) throw Error(`The color \"${name}\" is not registered.`);\n return colors[name];\n },\n primaryFontFamily: \"'Roboto', sans-serif\",\n secondaryFontFamily: \"'Overpass', sans-serif\",\n themeProp,\n spacing: {\n baseUnit: 4,\n controlHeight: 38,\n menuGutter: 8\n },\n colors: {\n primary: colors['emerald-500'],\n primary75: colors['emerald-400'],\n primary50: colors['emerald-300'],\n primary25: colors['emerald-200'],\n danger: colors['red-500'],\n neutral0: colors['white'],\n neutral5: colors['gray-50'],\n neutral10: colors['gray-100'],\n neutral20: colors['gray-300'],\n neutral30: colors['gray-400'],\n neutral40: colors['gray-500'],\n neutral50: colors['gray-600'],\n neutral60: colors['gray-700'],\n neutral70: colors['gray-800'],\n neutral80: colors['gray-900'],\n neutral90: colors['black']\n }\n /*\n * `satisfies`, not `: NtbTheme`. It checks the object against the contract in\n * BOTH directions — a missing member fails assignability and an extra one\n * fails the excess-property check on this fresh literal — while keeping the\n * inferred literal types of the members. That is the drift guard: the runtime\n * object and the published interface cannot disagree.\n *\n * An annotation (`const defaultTheme: NtbTheme = …`) would widen\n * `primaryFontFamily` to `string`, and deriving the contract the other way\n * (`type NtbTheme = typeof defaultTheme`) would give up the per-member JSDoc\n * that surfaces at 737 call sites, the closed `ColorName` parameter on\n * `getColor`, and the nameable `ThemeColors` / `ThemeSpacing` exports.\n */\n} satisfies NtbTheme;\n\n/**\n * Applies a different css property value for dark and light mode.\n *\n * Read `ThemeProp` above before changing the signature — its JSDoc carries the\n * two conventions that the type system cannot enforce and that cause real\n * visual bugs when broken.\n */\nfunction themeProp(\n property: string,\n darkMode: ThemePropValue,\n lightMode: ThemePropValue,\n specificity: number = 2\n): RuleSet<object> {\n const specificityString = Array(specificity).fill('&').join('');\n\n return css`\n body.dark-theme ${specificityString} {\n ${property}: ${darkMode};\n }\n\n body.light-theme ${specificityString} {\n ${property}: ${lightMode};\n }\n\n body:not(.light-theme):not(.dark-theme) ${specificityString} {\n ${property}: ${lightMode};\n\n @media (prefers-color-scheme: dark) {\n ${property}: ${darkMode};\n }\n }\n `;\n}\n\n/**\n * `.attrs()` helper: merges a caller's partial theme over `defaultTheme` so\n * every interpolation can rely on the full contract.\n *\n * THE RETURN TYPE IS `{ theme: NtbTheme }` AND NOT `P & { theme: NtbTheme }`,\n * ON PURPOSE. `attrs` merges its result OVER the incoming props, so a declared\n * type only has to describe what this function CONTRIBUTES. Saying it also\n * returns the caller's props re-declares them from a position that knows nothing\n * about them, which is what produced the measured 25–31 TS2345 `.attrs()`\n * assignability errors. The runtime still spreads the rest through — that part\n * is unchanged, and 36 `.styled` files depend on it.\n */\nexport function applyDefaultTheme({ theme = {}, ...props }: ThemedProps): { theme: NtbTheme } {\n const merged: NtbTheme = {\n ...defaultTheme,\n ...theme,\n getColor: typeof theme.getColor === 'function' ? theme.getColor : defaultTheme.getColor,\n themeProp: typeof theme.themeProp === 'function' ? theme.themeProp : defaultTheme.themeProp,\n primaryFontFamily: theme.primaryFontFamily || defaultTheme.primaryFontFamily,\n secondaryFontFamily: theme.secondaryFontFamily || defaultTheme.secondaryFontFamily,\n spacing: theme.spacing || defaultTheme.spacing,\n colors: theme.colors || defaultTheme.colors\n };\n\n /*\n * Assigned to a local first so the returned object is not a fresh literal at\n * the `return`. The excess-property check would otherwise reject the spread\n * props against the narrow `{ theme: NtbTheme }` return type — and widening\n * the return type to keep the literal is exactly the mistake the JSDoc above\n * is about.\n */\n const attrs = { ...props, theme: merged };\n return attrs;\n}\n\n/*\n * The augmentation. This is the 21 lines that were worth 774 errors: it tells\n * styled-components what `props.theme` is, everywhere, for every `.styled` file\n * and for the consumer.\n *\n * It has to be a module augmentation of 'styled-components' rather than an\n * interface in our own namespace, because `ExecutionContext.theme` is typed as\n * `DefaultTheme` inside styled-components' own declarations and nothing we\n * export can influence that from outside.\n */\ndeclare module 'styled-components' {\n export interface DefaultTheme extends NtbTheme {}\n}\n"],"names":["defaultTheme","getColor","name","colors","Error","primaryFontFamily","secondaryFontFamily","themeProp","spacing","baseUnit","controlHeight","menuGutter","primary","primary75","primary50","primary25","danger","neutral0","neutral5","neutral10","neutral20","neutral30","neutral40","neutral50","neutral60","neutral70","neutral80","neutral90","property","darkMode","lightMode","specificity","specificityString","Array","fill","join","css","applyDefaultTheme","theme","props","merged","attrs"],"mappings":";;;AAoKO,MAAMA,YAAY,GAAG;EAC1BC,QAAQ,EAAEC,IAAI,IAAI;AAChB,IAAA,IAAI,CAACC,MAAM,CAACD,IAAI,CAAC,EAAE,MAAME,KAAK,CAAC,CAAA,WAAA,EAAc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file":"defaultTheme.js","sources":["../../src/utils/defaultTheme.ts"],"sourcesContent":["/// <reference path=\"../types/assets.d.ts\" />\n// Theme contract. Two load-bearing facts:\n// 1. The `/// <reference>` on line 1 makes assets.d.ts reachable to consumers\n// (declarations must flow through the import graph, not just tsconfig include).\n// 2. DefaultTheme augmentation lives here, not separate — reachable by construction\n// from all 36 importers with no import cycle.\nimport { colors } from '../styles/utils/colors-export';\nimport { css } from 'styled-components';\n\nimport type { ColorName } from '../styles/utils/colors-export';\nimport type { Interpolation, RuleSet } from 'styled-components';\n\nexport type { ColorName };\n\n// Throws at runtime for unregistered names. Parameter is closed ColorName union\n// (not string) so the error is compile-time at the call site, not runtime in template.\nexport type GetColor = (name: ColorName) => string;\n\n// Value themeProp interpolates — widened to Interpolation to accept callbacks and numbers.\n// The guarantee is ARITY (it works in css`` templates), not value narrowness.\nexport type ThemePropValue = Interpolation<object>;\n\n/**\n * Emits three declarations: body.dark-theme, body.light-theme, and\n * neither-class with prefers-color-scheme fallback, so one property can\n * differ between themes.\n *\n * Two unenforceable conventions that cause visual bugs: (1) Don't call inside\n * `&::after` / `&::before` — generated selector can't address pseudo-elements;\n * write rules explicitly instead. (2) Use static `&[data-x='state']` selectors,\n * not dynamic `${props => css\\`\\`}` — dynamic rules share componentId, so\n * instances collide.\n *\n * @param property CSS property (e.g. color, background, --custom-prop)\n * @param darkMode value for body.dark-theme\n * @param lightMode value for body.light-theme (also fallback when no class)\n * @param specificity how many `&` to repeat in selector; a number (prevents\n * passing '!important' by mistake)\n */\nexport type ThemeProp = (\n property: string,\n darkMode: ThemePropValue,\n lightMode: ThemePropValue,\n specificity?: number\n) => RuleSet<object>;\n\n// Spacing scale. Member names are react-select's (consumed by their theme prop).\nexport interface ThemeSpacing {\n baseUnit: number;\n controlHeight: number;\n menuGutter: number;\n}\n\n// react-select's color contract. Names are react-select's, not ours — don't rename.\nexport interface ThemeColors {\n primary: string;\n primary75: string;\n primary50: string;\n primary25: string;\n danger: string;\n neutral0: string;\n neutral5: string;\n neutral10: string;\n neutral20: string;\n neutral30: string;\n neutral40: string;\n neutral50: string;\n neutral60: string;\n neutral70: string;\n neutral80: string;\n neutral90: string;\n}\n\n// Whole theme as seen in styled templates. Every member required (truth in interpolations\n// and at ThemeProvider boundary). Consumers override with PartialNtbTheme + applyDefaultTheme.\nexport interface NtbTheme {\n getColor: GetColor;\n primaryFontFamily: string;\n secondaryFontFamily: string;\n themeProp: ThemeProp;\n spacing: ThemeSpacing;\n colors: ThemeColors;\n}\n\nexport type PartialNtbTheme = Partial<NtbTheme>;\n\n// Parameter for applyDefaultTheme. Not `ExecutionProps & ...` — intersection would\n// make theme required again (DefaultTheme is now NtbTheme with all members required).\n// Extra props still accepted and spread through at runtime.\nexport interface ThemedProps {\n theme?: PartialNtbTheme;\n}\n\nexport const defaultTheme = {\n getColor: name => {\n if (!colors[name]) throw Error(`The color \"${name}\" is not registered.`);\n return colors[name];\n },\n primaryFontFamily: \"'Roboto', sans-serif\",\n secondaryFontFamily: \"'Overpass', sans-serif\",\n themeProp,\n spacing: {\n baseUnit: 4,\n controlHeight: 38,\n menuGutter: 8\n },\n colors: {\n primary: colors['emerald-500'],\n primary75: colors['emerald-400'],\n primary50: colors['emerald-300'],\n primary25: colors['emerald-200'],\n danger: colors['red-500'],\n neutral0: colors['white'],\n neutral5: colors['gray-50'],\n neutral10: colors['gray-100'],\n neutral20: colors['gray-300'],\n neutral30: colors['gray-400'],\n neutral40: colors['gray-500'],\n neutral50: colors['gray-600'],\n neutral60: colors['gray-700'],\n neutral70: colors['gray-800'],\n neutral80: colors['gray-900'],\n neutral90: colors['black']\n }\n // satisfies (not : NtbTheme) — checks both directions and keeps literal types.\n // Drift guard: runtime object and interface cannot disagree. Annotation would\n // widen strings; deriving contract would lose JSDoc and named exports.\n} satisfies NtbTheme;\n\n// Applies different CSS values for dark/light mode (see ThemeProp type for conventions).\nfunction themeProp(\n property: string,\n darkMode: ThemePropValue,\n lightMode: ThemePropValue,\n specificity: number = 2\n): RuleSet<object> {\n const specificityString = Array(specificity).fill('&').join('');\n\n return css`\n body.dark-theme ${specificityString} {\n ${property}: ${darkMode};\n }\n\n body.light-theme ${specificityString} {\n ${property}: ${lightMode};\n }\n\n body:not(.light-theme):not(.dark-theme) ${specificityString} {\n ${property}: ${lightMode};\n\n @media (prefers-color-scheme: dark) {\n ${property}: ${darkMode};\n }\n }\n `;\n}\n\n// .attrs() helper: merges caller's partial theme over defaultTheme.\n// Return type { theme: NtbTheme } (not P & ...) describes what this contributes,\n// not what attrs spreads back (avoiding 25-31 TS2345 assignability errors).\nexport function applyDefaultTheme({ theme = {}, ...props }: ThemedProps): { theme: NtbTheme } {\n const merged: NtbTheme = {\n ...defaultTheme,\n ...theme,\n getColor: typeof theme.getColor === 'function' ? theme.getColor : defaultTheme.getColor,\n themeProp: typeof theme.themeProp === 'function' ? theme.themeProp : defaultTheme.themeProp,\n primaryFontFamily: theme.primaryFontFamily || defaultTheme.primaryFontFamily,\n secondaryFontFamily: theme.secondaryFontFamily || defaultTheme.secondaryFontFamily,\n spacing: theme.spacing || defaultTheme.spacing,\n colors: theme.colors || defaultTheme.colors\n };\n\n // Assigned to local so returned object isn't a fresh literal (would fail excess-property check).\n const attrs = { ...props, theme: merged };\n return attrs;\n}\n\n// Module augmentation of styled-components DefaultTheme (not a separate interface).\n// Needed because ExecutionContext.theme is typed as DefaultTheme in styled-components' own declarations.\ndeclare module 'styled-components' {\n export interface DefaultTheme extends NtbTheme {}\n}\n"],"names":["defaultTheme","getColor","name","colors","Error","primaryFontFamily","secondaryFontFamily","themeProp","spacing","baseUnit","controlHeight","menuGutter","primary","primary75","primary50","primary25","danger","neutral0","neutral5","neutral10","neutral20","neutral30","neutral40","neutral50","neutral60","neutral70","neutral80","neutral90","property","darkMode","lightMode","specificity","specificityString","Array","fill","join","css","applyDefaultTheme","theme","props","merged","attrs"],"mappings":";;;AA6FO,MAAMA,YAAY,GAAG;EAC1BC,QAAQ,EAAEC,IAAI,IAAI;AAChB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K;AAAED,IAAAA,KAAK,EAAEE;GAAQ;AACzC,EAAA,OAAOC,KAAK;AACd;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"getElementRef.js","sources":["../../src/utils/getElementRef.ts"],"sourcesContent":["import * as React from 'react';\n\n/**\n * Reads a child element's `ref` across the peer range (`react >= 16.14`).\n *\n * `ref` is a regular prop only from React 19. Before that `createElement` moves it to\n * `element.ref`, so reading `element.props.ref` silently returns `undefined` and the\n * `cloneElement(children, { ref })` that follows destroys the child's ref.\n *\n * Neither location can be read unconditionally: React 19 warns on `element.ref`, React\n * 18.3 warns on `props.ref`. Both warnings are `console.error`, which the stories gate\n * fails on. The property SHAPE says which is live, measured on 19.2.4:\n *\n * React 19, ref passed props.ref data prop element.ref warning getter\n * React 19, no ref props.ref absent element.ref data prop (null)\n * React <19 props.ref absent element.ref data prop\n * React 18.3, ref passed props.ref warning get element.ref data prop\n *\n * Returning early on React 19's data-property `props.ref` is what keeps every branch off\n * a warning getter.\n */\nexport function getElementRef(element: React.ReactElement): React.Ref<unknown> | null {\n type WarningGetter = (() => unknown) & { isReactWarning?: boolean };\n\n const withRef = element as React.ReactElement<{ ref?: React.Ref<unknown> }> & {\n ref?: React.Ref<unknown>;\n };\n\n const propsRef = Object.getOwnPropertyDescriptor(element.props as object, 'ref');\n\n // React 18.3: props.ref warns, the live ref is on the element.\n if (propsRef?.get && (propsRef.get as WarningGetter).isReactWarning) {\n return withRef.ref ?? null;\n }\n\n // React 19: a genuine prop. Returning here avoids the deprecated element.ref getter.\n if (propsRef) {\n return withRef.props.ref ?? null;\n }\n\n // React 19 with no ref, or any React before 19 — element.ref is a plain data property.\n return withRef.ref ?? null;\n}\n"],"names":["getElementRef","element","withRef","propsRef","Object","getOwnPropertyDescriptor","props","get","isReactWarning","ref"],"mappings":"AAqBO,SAASA,aAAaA,CAACC,OAA2B,EAA6B;EAGpF,MAAMC,OAAO,GAAGD,OAEf;EAED,MAAME,QAAQ,GAAGC,MAAM,CAACC,wBAAwB,CAACJ,OAAO,CAACK,KAAK,EAAY,KAAK,CAAC;EAGhF,IAAIH,QAAQ,EAAEI,GAAG,IAAKJ,QAAQ,CAACI,GAAG,CAAmBC,cAAc,EAAE;AACnE,IAAA,OAAON,OAAO,CAACO,GAAG,IAAI,IAAI;AAC5B,EAAA;AAGA,EAAA,IAAIN,QAAQ,EAAE;AACZ,IAAA,OAAOD,OAAO,CAACI,KAAK,CAACG,GAAG,IAAI,IAAI;AAClC,EAAA;AAGA,EAAA,OAAOP,OAAO,CAACO,GAAG,IAAI,IAAI;AAC5B;;;;"}
1
+ {"version":3,"file":"getElementRef.js","sources":["../../src/utils/getElementRef.ts"],"sourcesContent":["import * as React from 'react';\n\n// Reads a child's ref across react >= 16.14.\n// React 19 has ref as a regular prop; <19 moves it to element.ref. The property shape\n// (data prop vs warning getter) determines which branch to use — early return on React 19's\n// data prop avoids warning getters in all branches.\nexport function getElementRef(element: React.ReactElement): React.Ref<unknown> | null {\n type WarningGetter = (() => unknown) & { isReactWarning?: boolean };\n\n const withRef = element as React.ReactElement<{ ref?: React.Ref<unknown> }> & {\n ref?: React.Ref<unknown>;\n };\n\n const propsRef = Object.getOwnPropertyDescriptor(element.props as object, 'ref');\n\n // React 18.3: props.ref warns — read from element.ref instead.\n if (propsRef?.get && (propsRef.get as WarningGetter).isReactWarning) {\n return withRef.ref ?? null;\n }\n\n // React 19: props.ref is a genuine data prop (avoids deprecated element.ref getter).\n if (propsRef) {\n return withRef.props.ref ?? null;\n }\n\n // React <19 or React 19 with no ref — element.ref is a data property.\n return withRef.ref ?? null;\n}\n"],"names":["getElementRef","element","withRef","propsRef","Object","getOwnPropertyDescriptor","props","get","isReactWarning","ref"],"mappings":"AAMO,SAASA,aAAaA,CAACC,OAA2B,EAA6B;EAGpF,MAAMC,OAAO,GAAGD,OAEf;EAED,MAAME,QAAQ,GAAGC,MAAM,CAACC,wBAAwB,CAACJ,OAAO,CAACK,KAAK,EAAY,KAAK,CAAC;EAGhF,IAAIH,QAAQ,EAAEI,GAAG,IAAKJ,QAAQ,CAACI,GAAG,CAAmBC,cAAc,EAAE;AACnE,IAAA,OAAON,OAAO,CAACO,GAAG,IAAI,IAAI;AAC5B,EAAA;AAGA,EAAA,IAAIN,QAAQ,EAAE;AACZ,IAAA,OAAOD,OAAO,CAACI,KAAK,CAACG,GAAG,IAAI,IAAI;AAClC,EAAA;AAGA,EAAA,OAAOP,OAAO,CAACO,GAAG,IAAI,IAAI;AAC5B;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"parseTrigger.js","sources":["../../src/utils/parseTrigger.ts"],"sourcesContent":["/**\n * tippy's `trigger` space-string, parsed into the three discrete Floating UI\n * interaction hooks.\n *\n * WHY THIS EXISTS AS A SEPARATE, PURE FUNCTION. tippy takes ONE prop —\n * `trigger=\"mouseenter focus\"` — and does its own tokenising\n * (`splitBySpaces(instance.props.trigger).forEach(...)` in\n * `tippy.js/dist/tippy.cjs.js`). Floating UI has no equivalent: it has three\n * separate Hooks (`useClick`, `useHover`, `useFocus`), each with its own\n * `enabled` flag. `Popover` and `Tooltip` both publish `trigger` as a documented\n * prop and 62 consumer call sites pass it, so the string has to survive — which\n * means exactly one place has to own the string → flags translation. This is it,\n * and it is a pure function so it can be reasoned about (and later tested)\n * without mounting anything.\n *\n * It lives in `src/utils/` rather than `src/hooks/` deliberately: it calls no\n * Hook, has no React import, and `useFloatingPopover` is not its only plausible\n * caller — a `<Popover>` that needs to know \"does this trigger imply hover?\" for\n * a styling decision can ask without pulling in a Hook.\n */\n\n/**\n * Which Floating UI interaction Hooks a tippy trigger string turns on.\n *\n * All three are REQUIRED and always present. This is a computed result, not a\n * bag of options: \"the caller did not mention hover\" and \"hover is off\" are the\n * same statement here, and an optional member would let a caller write\n * `if (parsed.hover === undefined)` as though there were a third state.\n */\nexport interface ParsedTrigger {\n /** `click` token present → `useClick`. */\n click: boolean;\n /** `mouseenter` token present → `useHover`. */\n hover: boolean;\n /** `focus` or `focusin` token present → `useFocus`. */\n focus: boolean;\n}\n\n/**\n * tippy's own default, measured — `tippy.js/dist/tippy.cjs.js`:\n *\n * ```js\n * var defaultProps = Object.assign({\n * …\n * trigger: 'mouseenter focus',\n * …\n * }, pluginProps, renderProps);\n * ```\n *\n * `Tooltip.tsx` declares no default for `trigger` and passes `undefined`\n * straight through, so `undefined` HAS ALWAYS MEANT `'mouseenter focus'` for\n * every tooltip in the library and in both consumers. `parseTrigger(undefined)`\n * therefore has to return hover+focus, not nothing — see the `trigger`\n * parameter's note.\n *\n * (`Popover.tsx` declares its own default, `'click focus'`, so it never relies\n * on this one.)\n */\nexport const TIPPY_DEFAULT_TRIGGER = 'mouseenter focus';\n\n/**\n * The tokens tippy recognises, and what each one becomes.\n *\n * | token | tippy listeners | Floating UI |\n * | ------------ | -------------------------------- | ---------------- |\n * | `click` | `click` | `useClick` |\n * | `mouseenter` | `mouseenter` + `mouseleave` | `useHover` |\n * | `focus` | `focusin` + `blur` | `useFocus` |\n * | `focusin` | `focusin` + `focusout` | `useFocus` |\n * | `manual` | none — tippy `return`s early | none |\n *\n * `focus` and `focusin` collapse to the same Hook. tippy distinguishes them only\n * by which *close* event it listens for (non-bubbling `blur` vs bubbling\n * `focusout`), and `useFocus` attaches `focus`/`blur` to the reference itself,\n * which covers both. The distinction was never observable through our public\n * props: both components document `focusin` as an example value and pass the\n * string through unread.\n *\n * Anything else — including `manual`, and including a typo — turns nothing on.\n * That is tippy's behaviour too: it iterates the tokens and only its four\n * `switch` cases attach anything, so an unrecognised token is silently inert. We\n * do not throw on it, because throwing would turn a consumer's harmless typo\n * into a runtime crash at a call site that works today.\n */\nconst CLICK_TOKEN = 'click';\nconst HOVER_TOKEN = 'mouseenter';\nconst FOCUS_TOKENS = ['focus', 'focusin'];\n\n/**\n * Parses a tippy `trigger` prop into `{ click, hover, focus }`.\n *\n * THE THREE INPUTS THAT ARE EASY TO GET WRONG, all of them in use:\n *\n * - **`undefined`** (and `null`) means \"tippy's default\", i.e. hover+focus. It\n * does NOT mean \"no triggers\". Every `<Tooltip>` in the library that does not\n * pass `trigger` relies on this.\n * - **`''`** means NO TRIGGERS AT ALL, and it is used. Measured, in BOTH\n * consumers — `mb-main-client/src/components/assets/sales_overlay.tsx:246` and\n * `ntb-dam/client/src/components/assets/sales_overlay.js:245`:\n *\n * ```jsx\n * trigger={assetsHasAllRequiredData ? \"\" : \"mouseenter focus\"}\n * ```\n *\n * i.e. `''` is how that call site turns the tooltip OFF conditionally. Return\n * anything truthy for it and a tooltip appears where the consumer suppressed\n * one. `''.split(/\\s+/)` is `['']`, which is why the `filter(Boolean)`\n * below is load-bearing rather than tidiness — without it `''` would be\n * treated as an unrecognised token, which happens to give the same answer here\n * but would stop doing so the moment a token were matched loosely.\n * - **A controlled popover ignores the result entirely.** That decision is NOT\n * made here: this function reports what the string says, and\n * `useFloatingPopover` is what gates the Hooks off when `visible` is a\n * boolean. Keeping the two apart means the parse stays testable and the\n * controlled-mode rule lives in one place instead of two.\n *\n * Whitespace is split on `/\\s+/` and not `' '`, matching tippy's\n * `splitBySpaces`, so `'click\\n focus'` parses the same way tippy parses it.\n *\n * @param trigger tippy's `trigger` prop. `undefined`/`null` → the tippy default\n * (`'mouseenter focus'`); `''` → nothing enabled\n */\nexport function parseTrigger(trigger?: string | null): ParsedTrigger {\n const source = trigger == null ? TIPPY_DEFAULT_TRIGGER : trigger;\n const tokens = source.split(/\\s+/).filter(Boolean);\n\n return {\n click: tokens.includes(CLICK_TOKEN),\n hover: tokens.includes(HOVER_TOKEN),\n focus: tokens.some(token => FOCUS_TOKENS.includes(token))\n };\n}\n"],"names":["TIPPY_DEFAULT_TRIGGER","CLICK_TOKEN","HOVER_TOKEN","FOCUS_TOKENS","parseTrigger","trigger","source","tokens","split","filter","Boolean","click","includes","hover","focus","some","token"],"mappings":"AA0DO,MAAMA,qBAAqB,GAAG;AA0BrC,MAAMC,WAAW,GAAG,OAAO;AAC3B,MAAMC,WAAW,GAAG,YAAY;AAChC,MAAMC,YAAY,GAAG,CAAC,OAAO,EAAE,SAAS,CAAC;AAoClC,SAASC,YAAYA,CAACC,OAAuB,EAAiB;EACnE,MAAMC,MAAM,GAAGD,OAAO,IAAI,IAAI,GAAGL,qBAAqB,GAAGK,OAAO;AAChE,EAAA,MAAME,MAAM,GAAGD,MAAM,CAACE,KAAK,CAAC,KAAK,CAAC,CAACC,MAAM,CAACC,OAAO,CAAC;EAElD,OAAO;AACLC,IAAAA,KAAK,EAAEJ,MAAM,CAACK,QAAQ,CAACX,WAAW,CAAC;AACnCY,IAAAA,KAAK,EAAEN,MAAM,CAACK,QAAQ,CAACV,WAAW,CAAC;AACnCY,IAAAA,KAAK,EAAEP,MAAM,CAACQ,IAAI,CAACC,KAAK,IAAIb,YAAY,CAACS,QAAQ,CAACI,KAAK,CAAC;GACzD;AACH;;;;"}
1
+ {"version":3,"file":"parseTrigger.js","sources":["../../src/utils/parseTrigger.ts"],"sourcesContent":["// Parses tippy's trigger space-string into Floating UI's three separate Hook flags.\n// Pure function: no Hook call, so it's testable and reusable beyond useFloatingPopover.\n\n// Floating UI interaction Hooks enabled by a tippy trigger string.\n// All three members required (not optional) — \"not mentioned\" and \"off\" are the same.\nexport interface ParsedTrigger {\n /** `click` token present → `useClick`. */\n click: boolean;\n /** `mouseenter` token present → `useHover`. */\n hover: boolean;\n /** `focus` or `focusin` token present → `useFocus`. */\n focus: boolean;\n}\n\n// tippy's default. Tooltip passes undefined for trigger, meaning this default applies.\n// Popover has its own default ('click focus'), so only Tooltip relies on this.\nexport const TIPPY_DEFAULT_TRIGGER = 'mouseenter focus';\n\n// Token mappings: click → useClick, mouseenter → useHover, focus/focusin → useFocus.\n// focus and focusin collapse (useFocus covers both). Unrecognized tokens are silently\n// inert (matching tippy), not thrown — a typo at a working call site stays working.\nconst CLICK_TOKEN = 'click';\nconst HOVER_TOKEN = 'mouseenter';\nconst FOCUS_TOKENS = ['focus', 'focusin'];\n\n/**\n * Parses a tippy trigger string into Floating UI Hook flags.\n *\n * Three inputs are easy to get wrong: `undefined`/`null` → tippy default (hover+focus,\n * NOT \"no triggers\"); `''` → no triggers (used in sales overlays to conditionally\n * suppress tooltips); filter(Boolean) is load-bearing (empty string splits to ['']\n * which would otherwise be treated as an unrecognised token). Controlled mode is\n * NOT handled here — useFloatingPopover gates the Hooks based on visible.\n *\n * @param trigger tippy's trigger prop; `undefined`/`null` → 'mouseenter focus';\n * `''` → all flags false\n */\nexport function parseTrigger(trigger?: string | null): ParsedTrigger {\n const source = trigger == null ? TIPPY_DEFAULT_TRIGGER : trigger;\n const tokens = source.split(/\\s+/).filter(Boolean);\n\n return {\n click: tokens.includes(CLICK_TOKEN),\n hover: tokens.includes(HOVER_TOKEN),\n focus: tokens.some(token => FOCUS_TOKENS.includes(token))\n };\n}\n"],"names":["TIPPY_DEFAULT_TRIGGER","CLICK_TOKEN","HOVER_TOKEN","FOCUS_TOKENS","parseTrigger","trigger","source","tokens","split","filter","Boolean","click","includes","hover","focus","some","token"],"mappings":"AAgBO,MAAMA,qBAAqB,GAAG;AAKrC,MAAMC,WAAW,GAAG,OAAO;AAC3B,MAAMC,WAAW,GAAG,YAAY;AAChC,MAAMC,YAAY,GAAG,CAAC,OAAO,EAAE,SAAS,CAAC;AAclC,SAASC,YAAYA,CAACC,OAAuB,EAAiB;EACnE,MAAMC,MAAM,GAAGD,OAAO,IAAI,IAAI,GAAGL,qBAAqB,GAAGK,OAAO;AAChE,EAAA,MAAME,MAAM,GAAGD,MAAM,CAACE,KAAK,CAAC,KAAK,CAAC,CAACC,MAAM,CAACC,OAAO,CAAC;EAElD,OAAO;AACLC,IAAAA,KAAK,EAAEJ,MAAM,CAACK,QAAQ,CAACX,WAAW,CAAC;AACnCY,IAAAA,KAAK,EAAEN,MAAM,CAACK,QAAQ,CAACV,WAAW,CAAC;AACnCY,IAAAA,KAAK,EAAEP,MAAM,CAACQ,IAAI,CAACC,KAAK,IAAIb,YAAY,CAACS,QAAQ,CAACI,KAAK,CAAC;GACzD;AACH;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"AssetAction.js","sources":["../../../src/components/widgets/AssetAction/AssetAction.tsx"],"sourcesContent":["import React, { useRef, useState, useCallback } from 'react';\nimport * as S from './AssetAction.styled';\n\nimport { isFunction } from 'lodash';\n\nimport {\n useFloating,\n useHover,\n useInteractions,\n useTransitionStyles,\n flip,\n shift,\n arrow,\n autoUpdate,\n offset,\n useDismiss\n} from '@floating-ui/react';\n\ntype AssetActionOwnProps = {\n action?: {\n icon?: React.ReactNode;\n onClick?: (...args: any[]) => any;\n actionWidthHeight?: number[];\n title?: string;\n };\n asset?: any;\n itemKey?: string;\n};\n\n/*\n * NMB-3998 §C.2: `props` is spread onto `S.AssetAction`, so the published type\n * has to admit that target's props too — a closed type here is worse than `any` for the\n * 125 consumer files. Declared members win over the base (`Omit` by `keyof AssetActionOwnProps`);\n * a bare `&` would INTERSECT a colliding member instead of overriding it, which narrows\n * it (measured: `rows?: number | string` & `rows?: number`) or empties it to `never`.\n */\ntype Props = Omit<React.ComponentPropsWithoutRef<typeof S.AssetAction>, keyof AssetActionOwnProps> &\n AssetActionOwnProps;\n\n/**\n * This is a component to help you get started with development.\n */\nconst AssetAction = React.forwardRef<any, Props>(function AssetAction(\n { action, asset, itemKey, ...props },\n forwardedRef\n) {\n const ARROW_WIDTH = 10;\n const ARROW_HEIGHT = 5;\n const GAP = 3;\n\n const arrowRef = useRef(null);\n\n const [isOpen, setIsOpen] = useState(false);\n /*\n * NMB-3998: `useState('bottom')` widens to `string`, and `useFloating`'s `placement` is\n * the closed `Placement` union — TS2322. `as const` pins it to the literal `'bottom'`,\n * which IS a `Placement`. No setter is destructured here, so this state is a constant and\n * the literal type cannot be too narrow. `as const` erases, so the emitted JS is\n * identical.\n */\n const [placement] = useState('bottom' as const);\n\n const { refs, floatingStyles, context } = useFloating({\n placement,\n open: isOpen,\n onOpenChange: setIsOpen,\n whileElementsMounted: autoUpdate,\n middleware: [\n offset(ARROW_HEIGHT + GAP),\n flip({ padding: 5 }),\n shift({ padding: 5 }),\n arrow({\n element: arrowRef\n })\n ]\n });\n\n const { isMounted, styles } = useTransitionStyles(context, {\n initial: {\n transform: 'translateY(-8px)',\n opacity: 0\n },\n duration: {\n open: 200,\n close: 100\n }\n });\n\n const hover = useHover(context);\n const dismiss = useDismiss(context, {\n referencePress: true\n });\n\n const { getReferenceProps, getFloatingProps } = useInteractions([dismiss, hover]);\n\n const onActionClick = useCallback(\n (e, action) => {\n e.preventDefault();\n e.stopPropagation();\n\n if (isFunction(action?.onClick)) {\n action.onClick(asset);\n }\n },\n [action]\n );\n\n return (\n <S.AssetAction ref={forwardedRef} {...props}>\n <S.AssetActionButton\n key={itemKey}\n ref={refs.setReference}\n {...getReferenceProps()}\n onClick={e => onActionClick(e, action.onClick(asset), itemKey)}\n $actionWidthHeight={action.actionWidthHeight}\n >\n {action.icon}\n </S.AssetActionButton>\n\n {isOpen && isMounted && (\n <S.Floating\n className=\"floating\"\n ref={refs.setFloating}\n style={floatingStyles}\n {...getFloatingProps()}\n >\n <S.ActionTitle style={styles}>{action.title}</S.ActionTitle>\n <S.StyledFloatingArrow\n ref={arrowRef}\n context={context}\n width={ARROW_WIDTH}\n height={ARROW_HEIGHT}\n />\n </S.Floating>\n )}\n </S.AssetAction>\n );\n});\n\nexport default AssetAction;\n"],"names":["AssetAction","React","forwardRef","action","asset","itemKey","props","forwardedRef","ARROW_WIDTH","ARROW_HEIGHT","GAP","arrowRef","useRef","isOpen","setIsOpen","useState","placement","refs","floatingStyles","context","useFloating","open","onOpenChange","whileElementsMounted","autoUpdate","middleware","offset","flip","padding","shift","arrow","element","isMounted","styles","useTransitionStyles","initial","transform","opacity","duration","close","hover","useHover","dismiss","useDismiss","referencePress","getReferenceProps","getFloatingProps","useInteractions","onActionClick","useCallback","e","preventDefault","stopPropagation","isFunction","onClick","_jsxs","S","ref","children","_jsx","setReference","$actionWidthHeight","actionWidthHeight","icon","className","setFloating","style","title","width","height"],"mappings":";;;;;;AA0CA,MAAMA,WAAW,GAAGC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AACH,WAAa,EAAA;AAACU,QAAAA,KAAK,EAAEjC,MAAO;QAAAyB,QAAA,EAAEvD,MAAM,CAACgE;AAAK,OAAgB,CAAC,EAC5DR,GAAA,CAACH,mBAAqB,EAAA;AACpBC,QAAAA,GAAG,EAAE9C,QAAS;AACdQ,QAAAA,OAAO,EAAEA,OAAQ;AACjBiD,QAAAA,KAAK,EAAE5D,WAAY;AACnB6D,QAAAA,MAAM,EAAE5D;AAAa,OACtB,CAAC;AAAA,KACQ,CACb;AAAA,GACY,CAAC;AAEpB,CAAC;;;;"}
1
+ {"version":3,"file":"AssetAction.js","sources":["../../../src/components/widgets/AssetAction/AssetAction.tsx"],"sourcesContent":["import React, { useRef, useState, useCallback } from 'react';\nimport * as S from './AssetAction.styled';\n\nimport { isFunction } from 'lodash';\n\nimport {\n useFloating,\n useHover,\n useInteractions,\n useTransitionStyles,\n flip,\n shift,\n arrow,\n autoUpdate,\n offset,\n useDismiss\n} from '@floating-ui/react';\n\ntype AssetActionOwnProps = {\n action?: {\n icon?: React.ReactNode;\n onClick?: (...args: any[]) => any;\n actionWidthHeight?: number[];\n title?: string;\n };\n asset?: any;\n itemKey?: string;\n};\n\n// Omit before & — a bare intersection narrows colliding props instead of overriding them.\ntype Props = Omit<React.ComponentPropsWithoutRef<typeof S.AssetAction>, keyof AssetActionOwnProps> &\n AssetActionOwnProps;\n\n/**\n * This is a component to help you get started with development.\n */\nconst AssetAction = React.forwardRef<any, Props>(function AssetAction(\n { action, asset, itemKey, ...props },\n forwardedRef\n) {\n const ARROW_WIDTH = 10;\n const ARROW_HEIGHT = 5;\n const GAP = 3;\n\n const arrowRef = useRef(null);\n\n const [isOpen, setIsOpen] = useState(false);\n // `useState('bottom')` widens to `string`, not the Placement union; `as const` pins it to the literal.\n const [placement] = useState('bottom' as const);\n\n const { refs, floatingStyles, context } = useFloating({\n placement,\n open: isOpen,\n onOpenChange: setIsOpen,\n whileElementsMounted: autoUpdate,\n middleware: [\n offset(ARROW_HEIGHT + GAP),\n flip({ padding: 5 }),\n shift({ padding: 5 }),\n arrow({\n element: arrowRef\n })\n ]\n });\n\n const { isMounted, styles } = useTransitionStyles(context, {\n initial: {\n transform: 'translateY(-8px)',\n opacity: 0\n },\n duration: {\n open: 200,\n close: 100\n }\n });\n\n const hover = useHover(context);\n const dismiss = useDismiss(context, {\n referencePress: true\n });\n\n const { getReferenceProps, getFloatingProps } = useInteractions([dismiss, hover]);\n\n const onActionClick = useCallback(\n (e, action) => {\n e.preventDefault();\n e.stopPropagation();\n\n if (isFunction(action?.onClick)) {\n action.onClick(asset);\n }\n },\n [action]\n );\n\n return (\n <S.AssetAction ref={forwardedRef} {...props}>\n <S.AssetActionButton\n key={itemKey}\n ref={refs.setReference}\n {...getReferenceProps()}\n onClick={e => onActionClick(e, action.onClick(asset), itemKey)}\n $actionWidthHeight={action.actionWidthHeight}\n >\n {action.icon}\n </S.AssetActionButton>\n\n {isOpen && isMounted && (\n <S.Floating\n className=\"floating\"\n ref={refs.setFloating}\n style={floatingStyles}\n {...getFloatingProps()}\n >\n <S.ActionTitle style={styles}>{action.title}</S.ActionTitle>\n <S.StyledFloatingArrow\n ref={arrowRef}\n context={context}\n width={ARROW_WIDTH}\n height={ARROW_HEIGHT}\n />\n </S.Floating>\n )}\n </S.AssetAction>\n );\n});\n\nexport default AssetAction;\n"],"names":["AssetAction","React","forwardRef","action","asset","itemKey","props","forwardedRef","ARROW_WIDTH","ARROW_HEIGHT","GAP","arrowRef","useRef","isOpen","setIsOpen","useState","placement","refs","floatingStyles","context","useFloating","open","onOpenChange","whileElementsMounted","autoUpdate","middleware","offset","flip","padding","shift","arrow","element","isMounted","styles","useTransitionStyles","initial","transform","opacity","duration","close","hover","useHover","dismiss","useDismiss","referencePress","getReferenceProps","getFloatingProps","useInteractions","onActionClick","useCallback","e","preventDefault","stopPropagation","isFunction","onClick","_jsxs","S","ref","children","_jsx","setReference","$actionWidthHeight","actionWidthHeight","icon","className","setFloating","style","title","width","height"],"mappings":";;;;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QAAA,EAAA,CAEtBC,GAAA,CAACH,WAAa,EAAA;AAACU,QAAAA,KAAK,EAAEjC,MAAO;QAAAyB,QAAA,EAAEvD,MAAM,CAACgE;AAAK,OAAgB,CAAC,EAC5DR,GAAA,CAACH,mBAAqB,EAAA;AACpBC,QAAAA,GAAG,EAAE9C,QAAS;AACdQ,QAAAA,OAAO,EAAEA,OAAQ;AACjBiD,QAAAA,KAAK,EAAE5D,WAAY;AACnB6D,QAAAA,MAAM,EAAE5D;AAAa,OACtB,CAAC;AAAA,KACQ,CACb;AAAA,GACY,CAAC;AAEpB,CAAC;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"AssetAction.styled.js","sources":["../../../src/components/widgets/AssetAction/AssetAction.styled.ts"],"sourcesContent":["/*\n * $-transient-prop pattern: rules in\n * `src/components/layout/SectionSeparator/SectionSeparator.styled.ts`, derivation and\n * measurements in `scripts/TS-MIGRATION-PLAYBOOK.md` §J.\n *\n * The run-together `$actionWidthHeightactionWidthHeight` read that used to guard\n * `AssetActionButton`'s `svg { width: … }` is FIXED — it now reads `$actionWidthHeight`,\n * the only key `AssetAction.tsx` passes, so the svg's width and height are once again\n * derived from the same array. That activates a branch which had never fired, so it moves\n * the render baseline (§E.3/§J.8); the re-record is a separate, reviewed commit.\n */\nimport styled from 'styled-components';\nimport { applyDefaultTheme } from '../../../utils/defaultTheme';\n\nimport { FloatingArrow } from '@floating-ui/react';\n\n/**\n * `AssetActionButton`'s props, i.e. what `AssetAction.tsx` passes to it:\n * `$actionWidthHeight={action.actionWidthHeight}` and nothing else.\n */\ninterface AssetActionButtonStyleProps {\n /**\n * `action.actionWidthHeight` — `PropTypes.arrayOf(PropTypes.number)`, read as\n * `[width, height]`. `number[]` and not `[number, number]`: the propTypes say an\n * array of numbers of any length, and the template guards on the array's presence\n * rather than its length. The values are px and are also used arithmetically\n * (`- 14`), so `number` and not `number | string`.\n */\n $actionWidthHeight?: number[];\n}\n\n/*\n * Single-argument, and it stays that way — peer floor `styled-components: >=5.1.0`, and\n * the two majors disagree on the second parameter. §J.4. `prop` needs the annotation\n * because `withConfig` takes this by reference, so it gets no contextual typing.\n */\nconst shouldForwardProp = (prop: string): boolean => {\n return prop !== 'theme' && !prop.startsWith('$');\n};\n\nexport const AssetAction = styled.div\n .withConfig({\n shouldForwardProp\n })\n .attrs(applyDefaultTheme)`\n font-family: ${props => props.theme.primaryFontFamily};\n`;\n\nexport const AssetActionButton = styled.div\n .withConfig({\n shouldForwardProp\n })\n .attrs<AssetActionButtonStyleProps>(applyDefaultTheme)`\n border-radius: 50%;\n width: ${props => (props.$actionWidthHeight ? `${props.$actionWidthHeight[0]}px` : 'auto')};\n height: ${props => (props.$actionWidthHeight ? `${props.$actionWidthHeight[1]}px` : 'auto')};\n cursor: pointer;\n display: flex;\n justify-content: center;\n align-items: center;\n box-shadow: 0px 3px 6px rgba(0, 0, 0, 0.16);\n ${props =>\n props.theme.themeProp(\n 'background-color',\n props.theme.getColor('gray-900'),\n props.theme.getColor('white')\n )};\n svg {\n pointer-events: none;\n width: ${props =>\n props.$actionWidthHeight ? `${props.$actionWidthHeight[0] - 14}px` : 'auto'};\n height: ${props =>\n props.$actionWidthHeight ? `${props.$actionWidthHeight[1] - 14}px` : 'auto'};\n ${props =>\n props.theme.themeProp(\n 'color',\n props.theme.getColor('gray-900'),\n props.theme.getColor('white')\n )};\n }\n`;\n\nexport const ActionTitle = styled.div\n .withConfig({\n shouldForwardProp\n })\n .attrs(applyDefaultTheme)`\n font-size: 14px;\n border-radius: 4px;\n padding: 8px 12px;\n white-space: nowrap;\n color: white;\n background: ${props => props.theme.getColor('gray-700')};\n`;\n\nexport const StyledFloatingArrow = styled(FloatingArrow).attrs(applyDefaultTheme)`\n fill: ${props => props.theme.getColor('gray-700')};\n`;\n\nexport const Floating = styled.div\n .withConfig({\n shouldForwardProp\n })\n .attrs(applyDefaultTheme)`\n pointer-events: none;\n`;\n"],"names":["shouldForwardProp","prop","startsWith","AssetAction","styled","div","withConfig","attrs","applyDefaultTheme","displayName","componentId","props","theme","primaryFontFamily","AssetActionButton","$actionWidthHeight","themeProp","getColor","ActionTitle","StyledFloatingArrow","FloatingArrow","Floating"],"mappings":";;;;AAoCA,MAAMA,iBAAiB,GAAIC,IAAY,IAAc;EACnD,OAAOA,IAAI,KAAK,OAAO,IAAI,CAACA,IAAI,CAACC,UAAU,CAAC,GAAG,CAAC;AAClD,CAAC;AAEM,MAAMC,WAAW,GAAGC,MAAM,CAACC,GAAG,CAClCC,UAAU,CAAC;AACVN,EAAAA;AACF,CAAC,CAAC,CACDO,KAAK,CAACC,iBAAiB,CAAC,CAAAF,UAAA,CAAA;EAAAG,WAAA,EAAA,gCAAA;EAAAC,WAAA,EAAA;AAAA,CAAA,CAAA,CAAA,CAAA,cAAA,EAAA,GAAA,CAAA,EACVC,KAAK,IAAIA,KAAK,CAACC,KAAK,CAACC,iBAAiB;AAGhD,MAAMC,iBAAiB,GAAGV,MAAM,CAACC,GAAG,CACxCC,UAAU,CAAC;AACVN,EAAAA;AACF,CAAC,CAAC,CACDO,KAAK,CAA8BC,iBAAiB,CAAC,CAAAF,UAAA,CAAA;EAAAG,WAAA,EAAA,sCAAA;EAAAC,WAAA,EAAA;AAAA,CAAA,CAAA,CAAA,CAAA,0BAAA,EAAA,UAAA,EAAA,iHAAA,EAAA,iCAAA,EAAA,UAAA,EAAA,GAAA,EAAA,IAAA,CAAA,EAE7CC,KAAK,IAAKA,KAAK,CAACI,kBAAkB,GAAG,CAAA,EAAGJ,KAAK,CAACI,kBAAkB,CAAC,CAAC,CAAC,CAAA,EAAA,CAAI,GAAG,MAAO,EAChFJ,KAAK,IAAKA,KAAK,CAACI,kBAAkB,GAAG,CAAA,EAAGJ,KAAK,CAACI,kBAAkB,CAAC,CAAC,CAAC,CAAA,EAAA,CAAI,GAAG,MAAO,EAMzFJ,KAAK,IACLA,KAAK,CAACC,KAAK,CAACI,SAAS,CACnB,kBAAkB,EAClBL,KAAK,CAACC,KAAK,CAACK,QAAQ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,CAAC,CACDO,KAAK,CAACC,iBAAiB,CAAC,CAAAF,UAAA,CAAA;EAAAG,WAAA,EAAA,6BAAA;EAAAC,WAAA,EAAA;AAAA,CAAA,CAAA,CAAA,CAAA,sBAAA,CAAA;;;;"}
1
+ {"version":3,"file":"AssetAction.styled.js","sources":["../../../src/components/widgets/AssetAction/AssetAction.styled.ts"],"sourcesContent":["// Fixed defect: guard now reads $actionWidthHeight (was run-together $actionWidthHeightactionWidthHeight).\nimport styled from 'styled-components';\nimport { applyDefaultTheme } from '../../../utils/defaultTheme';\n\nimport { FloatingArrow } from '@floating-ui/react';\n\n/**\n * Props passed by `AssetAction.tsx` to `<S.AssetActionButton>`.\n */\ninterface AssetActionButtonStyleProps {\n /**\n * `[width, height]` in pixels, used arithmetically.\n */\n $actionWidthHeight?: number[];\n}\n\n// Single-argument to stay compatible with styled-components v5.1 and v6. Annotation required despite noImplicitAny being off.\nconst shouldForwardProp = (prop: string): boolean => {\n return prop !== 'theme' && !prop.startsWith('$');\n};\n\nexport const AssetAction = styled.div\n .withConfig({\n shouldForwardProp\n })\n .attrs(applyDefaultTheme)`\n font-family: ${props => props.theme.primaryFontFamily};\n`;\n\nexport const AssetActionButton = styled.div\n .withConfig({\n shouldForwardProp\n })\n .attrs<AssetActionButtonStyleProps>(applyDefaultTheme)`\n border-radius: 50%;\n width: ${props => (props.$actionWidthHeight ? `${props.$actionWidthHeight[0]}px` : 'auto')};\n height: ${props => (props.$actionWidthHeight ? `${props.$actionWidthHeight[1]}px` : 'auto')};\n cursor: pointer;\n display: flex;\n justify-content: center;\n align-items: center;\n box-shadow: 0px 3px 6px rgba(0, 0, 0, 0.16);\n ${props =>\n props.theme.themeProp(\n 'background-color',\n props.theme.getColor('gray-900'),\n props.theme.getColor('white')\n )};\n svg {\n pointer-events: none;\n width: ${props =>\n props.$actionWidthHeight ? `${props.$actionWidthHeight[0] - 14}px` : 'auto'};\n height: ${props =>\n props.$actionWidthHeight ? `${props.$actionWidthHeight[1] - 14}px` : 'auto'};\n ${props =>\n props.theme.themeProp(\n 'color',\n props.theme.getColor('gray-900'),\n props.theme.getColor('white')\n )};\n }\n`;\n\nexport const ActionTitle = styled.div\n .withConfig({\n shouldForwardProp\n })\n .attrs(applyDefaultTheme)`\n font-size: 14px;\n border-radius: 4px;\n padding: 8px 12px;\n white-space: nowrap;\n color: white;\n background: ${props => props.theme.getColor('gray-700')};\n`;\n\nexport const StyledFloatingArrow = styled(FloatingArrow).attrs(applyDefaultTheme)`\n fill: ${props => props.theme.getColor('gray-700')};\n`;\n\nexport const Floating = styled.div\n .withConfig({\n shouldForwardProp\n })\n .attrs(applyDefaultTheme)`\n pointer-events: none;\n`;\n"],"names":["shouldForwardProp","prop","startsWith","AssetAction","styled","div","withConfig","attrs","applyDefaultTheme","displayName","componentId","props","theme","primaryFontFamily","AssetActionButton","$actionWidthHeight","themeProp","getColor","ActionTitle","StyledFloatingArrow","FloatingArrow","Floating"],"mappings":";;;;AAiBA,MAAMA,iBAAiB,GAAIC,IAAY,IAAc;EACnD,OAAOA,IAAI,KAAK,OAAO,IAAI,CAACA,IAAI,CAACC,UAAU,CAAC,GAAG,CAAC;AAClD,CAAC;AAEM,MAAMC,WAAW,GAAGC,MAAM,CAACC,GAAG,CAClCC,UAAU,CAAC;AACVN,EAAAA;AACF,CAAC,CAAC,CACDO,KAAK,CAACC,iBAAiB,CAAC,CAAAF,UAAA,CAAA;EAAAG,WAAA,EAAA,gCAAA;EAAAC,WAAA,EAAA;AAAA,CAAA,CAAA,CAAA,CAAA,cAAA,EAAA,GAAA,CAAA,EACVC,KAAK,IAAIA,KAAK,CAACC,KAAK,CAACC,iBAAiB;AAGhD,MAAMC,iBAAiB,GAAGV,MAAM,CAACC,GAAG,CACxCC,UAAU,CAAC;AACVN,EAAAA;AACF,CAAC,CAAC,CACDO,KAAK,CAA8BC,iBAAiB,CAAC,CAAAF,UAAA,CAAA;EAAAG,WAAA,EAAA,sCAAA;EAAAC,WAAA,EAAA;AAAA,CAA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CAAA,CAAA,8FAAA,EAAA,GAAA,CAAA,EAMXC,KAAK,IAAIA,KAAK,CAACC,KAAK,CAACK,QAAQ,CAAC,UAAU,CAAC;AAGlD,MAAME,mBAAmB,GAAGf,MAAM,CAACgB,aAAa,CAAC,CAACb,KAAK,CAACC,iBAAiB,CAAC,CAAAF,UAAA,CAAA;EAAAG,WAAA,EAAA,wCAAA;EAAAC,WAAA,EAAA;AAAA,CAAA,CAAA,CAAA,CAAA,OAAA,EAAA,GAAA,CAAA,EACvEC,KAAK,IAAIA,KAAK,CAACC,KAAK,CAACK,QAAQ,CAAC,UAAU,CAAC;AAG5C,MAAMI,QAAQ,GAAGjB,MAAM,CAACC,GAAG,CAC/BC,UAAU,CAAC;AACVN,EAAAA;AACF,CAAC,CAAC,CACDO,KAAK,CAACC,iBAAiB,CAAC,CAAAF,UAAA,CAAA;EAAAG,WAAA,EAAA,6BAAA;EAAAC,WAAA,EAAA;AAAA,CAAA,CAAA,CAAA,CAAA,sBAAA,CAAA;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"AssetActionsBase.js","sources":["../../../src/components/widgets/AssetActionsBase/AssetActionsBase.tsx"],"sourcesContent":["import React from 'react';\n\nimport * as S from './AssetActionsBase.styled';\n\nimport AssetAction from '../AssetAction/AssetAction';\n\ntype AssetActionsBaseOwnProps = {\n actions?: any[];\n asset?: any;\n};\n\n/*\n * NMB-3998 §C.2: `props` is spread onto `AssetAction`, so the published type\n * has to admit that target's props too — a closed type here is worse than `any` for the\n * 125 consumer files. Declared members win over the base (`Omit` by `keyof AssetActionsBaseOwnProps`);\n * a bare `&` would INTERSECT a colliding member instead of overriding it, which narrows\n * it (measured: `rows?: number | string` & `rows?: number`) or empties it to `never`.\n */\ntype Props = Omit<\n React.ComponentPropsWithoutRef<typeof AssetAction>,\n keyof AssetActionsBaseOwnProps\n> &\n AssetActionsBaseOwnProps;\n\nconst AssetActionsBase = React.forwardRef<any, Props>(function AssetActionsBase(\n { actions, asset, ...props },\n forwardedRef\n) {\n const assetActions = actions.map((action, index) => (\n <AssetAction\n key={`index_${action.title}`}\n ref={forwardedRef}\n {...props}\n action={action}\n asset={asset}\n itemKey={`${index}-${action.title}`}\n />\n ));\n\n return <S.AssetActions>{assetActions}</S.AssetActions>;\n});\n\nexport default AssetActionsBase;\n"],"names":["AssetActionsBase","React","forwardRef","actions","asset","props","forwardedRef","assetActions","map","action","index","_jsx","AssetAction","ref","itemKey","title","S","children"],"mappings":";;;;;AAwBA,MAAMA,gBAAgB,GAAGC,cAAK,CAACC,UAAU,CAAa,SAASF,gBAAgBA,CAC7E;EAAEG,OAAO;EAAEC,KAAK;EAAE,GAAGC;AAAM,CAAC,EAC5BC,YAAY,EACZ;AACA,EAAA,MAAMC,YAAY,GAAGJ,OAAO,CAACK,GAAG,CAAC,CAACC,MAAM,EAAEC,KAAK,KAC7CC,GAAA,CAACC,WAAW,EAAA;AAEVC,IAAAA,GAAG,EAAEP,YAAa;AAAA,IAAA,GACdD,KAAK;AACTI,IAAAA,MAAM,EAAEA,MAAO;AACfL,IAAAA,KAAK,EAAEA,KAAM;AACbU,IAAAA,OAAO,EAAE,CAAA,EAAGJ,KAAK,CAAA,CAAA,EAAID,MAAM,CAACM,KAAK,CAAA;AAAG,GAAA,EAL/B,SAASN,MAAM,CAACM,KAAK,CAAA,CAM3B,CACF,CAAC;AAEF,EAAA,OAAOJ,GAAA,CAACK,YAAc,EAAA;AAAAC,IAAAA,QAAA,EAAEV;AAAY,GAAiB,CAAC;AACxD,CAAC;;;;"}
1
+ {"version":3,"file":"AssetActionsBase.js","sources":["../../../src/components/widgets/AssetActionsBase/AssetActionsBase.tsx"],"sourcesContent":["import React from 'react';\n\nimport * as S from './AssetActionsBase.styled';\n\nimport AssetAction from '../AssetAction/AssetAction';\n\ntype AssetActionsBaseOwnProps = {\n actions?: any[];\n asset?: any;\n};\n\n// Omit before & — a bare intersection narrows colliding props instead of overriding them.\ntype Props = Omit<\n React.ComponentPropsWithoutRef<typeof AssetAction>,\n keyof AssetActionsBaseOwnProps\n> &\n AssetActionsBaseOwnProps;\n\nconst AssetActionsBase = React.forwardRef<any, Props>(function AssetActionsBase(\n { actions, asset, ...props },\n forwardedRef\n) {\n const assetActions = actions.map((action, index) => (\n <AssetAction\n key={`index_${action.title}`}\n ref={forwardedRef}\n {...props}\n action={action}\n asset={asset}\n itemKey={`${index}-${action.title}`}\n />\n ));\n\n return <S.AssetActions>{assetActions}</S.AssetActions>;\n});\n\nexport default AssetActionsBase;\n"],"names":["AssetActionsBase","React","forwardRef","actions","asset","props","forwardedRef","assetActions","map","action","index","_jsx","AssetAction","ref","itemKey","title","S","children"],"mappings":";;;;;AAkBA,MAAMA,gBAAgB,GAAGC,cAAK,CAACC,UAAU,CAAa,SAASF,gBAAgBA,CAC7E;EAAEG,OAAO;EAAEC,KAAK;EAAE,GAAGC;AAAM,CAAC,EAC5BC,YAAY,EACZ;AACA,EAAA,MAAMC,YAAY,GAAGJ,OAAO,CAACK,GAAG,CAAC,CAACC,MAAM,EAAEC,KAAK,KAC7CC,GAAA,CAACC,WAAW,EAAA;AAEVC,IAAAA,GAAG,EAAEP,YAAa;AAAA,IAAA,GACdD,KAAK;AACTI,IAAAA,MAAM,EAAEA,MAAO;AACfL,IAAAA,KAAK,EAAEA,KAAM;AACbU,IAAAA,OAAO,EAAE,CAAA,EAAGJ,KAAK,CAAA,CAAA,EAAID,MAAM,CAACM,KAAK,CAAA;AAAG,GAAA,EAL/B,SAASN,MAAM,CAACM,KAAK,CAAA,CAM3B,CACF,CAAC;AAEF,EAAA,OAAOJ,GAAA,CAACK,YAAc,EAAA;AAAAC,IAAAA,QAAA,EAAEV;AAAY,GAAiB,CAAC;AACxD,CAAC;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"AssetActionsBase.styled.js","sources":["../../../src/components/widgets/AssetActionsBase/AssetActionsBase.styled.ts"],"sourcesContent":["/*\n * $-transient-prop pattern: rules in\n * `src/components/layout/SectionSeparator/SectionSeparator.styled.ts`, derivation and\n * measurements in `scripts/TS-MIGRATION-PLAYBOOK.md` §J.\n *\n * NO COMPONENT IN THIS FILE READS A PROP, so there is no transient-prop type to declare —\n * rule 2, declare only what is actually passed and read. It reported ZERO errors before\n * this commit, and the one thing left to do is the predicate below.\n */\nimport styled from 'styled-components';\nimport { applyDefaultTheme } from '../../../utils/defaultTheme';\n\n/*\n * Single-argument, and it stays that way — peer floor `styled-components: >=5.1.0`, and\n * the two majors disagree on the second parameter (v6 `elementToBeCreated`, v5.1\n * `defaultValidatorFn`). A one-parameter function is assignable to both. §J.4.\n *\n * `prop` NEEDS THE ANNOTATION EVEN THOUGH ITS ABSENCE REPORTED NO ERROR. `withConfig`\n * receives this by reference, so it gets no contextual typing and `prop` was an implicit\n * `any` — silent, because `noImplicitAny` is off (+474 errors, see `tsconfig.json`). With\n * `any` there, `prop.startsWith` is unchecked: a typo in the method name would have been a\n * runtime TypeError in the prop filter of every component in the file. A file at zero\n * errors is not the same as a file that is checked.\n */\nconst shouldForwardProp = (prop: string): boolean => {\n return prop !== 'theme' && !prop.startsWith('$');\n};\n\nexport const AssetActions = styled.div\n .withConfig({\n shouldForwardProp\n })\n .attrs(applyDefaultTheme)`\n font-family: ${props => props.theme.primaryFontFamily};\n font-size: 1rem;\n font-weight: 500;\n display: flex;\n flex-direction: column;\n padding: 2px;\n gap: 8px;\n`;\n"],"names":["shouldForwardProp","prop","startsWith","AssetActions","styled","div","withConfig","attrs","applyDefaultTheme","displayName","componentId","props","theme","primaryFontFamily"],"mappings":";;;AAwBA,MAAMA,iBAAiB,GAAIC,IAAY,IAAc;EACnD,OAAOA,IAAI,KAAK,OAAO,IAAI,CAACA,IAAI,CAACC,UAAU,CAAC,GAAG,CAAC;AAClD,CAAC;AAEM,MAAMC,YAAY,GAAGC,MAAM,CAACC,GAAG,CACnCC,UAAU,CAAC;AACVN,EAAAA;AACF,CAAC,CAAC,CACDO,KAAK,CAACC,iBAAiB,CAAC,CAAAF,UAAA,CAAA;EAAAG,WAAA,EAAA,sCAAA;EAAAC,WAAA,EAAA;AAAA,CAAA,CAAA,CAAA,CAAA,cAAA,EAAA,yFAAA,CAAA,EACVC,KAAK,IAAIA,KAAK,CAACC,KAAK,CAACC,iBAAiB;;;;"}
1
+ {"version":3,"file":"AssetActionsBase.styled.js","sources":["../../../src/components/widgets/AssetActionsBase/AssetActionsBase.styled.ts"],"sourcesContent":["// No components read props, so no transient-prop types to declare.\nimport styled from 'styled-components';\nimport { applyDefaultTheme } from '../../../utils/defaultTheme';\n\n// Single-argument to stay compatible with styled-components v5.1 and v6. Annotation required despite noImplicitAny being off.\nconst shouldForwardProp = (prop: string): boolean => {\n return prop !== 'theme' && !prop.startsWith('$');\n};\n\nexport const AssetActions = styled.div\n .withConfig({\n shouldForwardProp\n })\n .attrs(applyDefaultTheme)`\n font-family: ${props => props.theme.primaryFontFamily};\n font-size: 1rem;\n font-weight: 500;\n display: flex;\n flex-direction: column;\n padding: 2px;\n gap: 8px;\n`;\n"],"names":["shouldForwardProp","prop","startsWith","AssetActions","styled","div","withConfig","attrs","applyDefaultTheme","displayName","componentId","props","theme","primaryFontFamily"],"mappings":";;;AAKA,MAAMA,iBAAiB,GAAIC,IAAY,IAAc;EACnD,OAAOA,IAAI,KAAK,OAAO,IAAI,CAACA,IAAI,CAACC,UAAU,CAAC,GAAG,CAAC;AAClD,CAAC;AAEM,MAAMC,YAAY,GAAGC,MAAM,CAACC,GAAG,CACnCC,UAAU,CAAC;AACVN,EAAAA;AACF,CAAC,CAAC,CACDO,KAAK,CAACC,iBAAiB,CAAC,CAAAF,UAAA,CAAA;EAAAG,WAAA,EAAA,sCAAA;EAAAC,WAAA,EAAA;AAAA,CAAA,CAAA,CAAA,CAAA,cAAA,EAAA,yFAAA,CAAA,EACVC,KAAK,IAAIA,KAAK,CAACC,KAAK,CAACC,iBAAiB;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"AssetGallery.js","sources":["../../../src/components/widgets/AssetGallery/AssetGallery.tsx"],"sourcesContent":["import { isFunction } from 'lodash';\nimport React, { useCallback, useEffect, useState } from 'react';\nimport AssetGalleryBase from './AssetGalleryBase/AssetGalleryBase';\n\nconst EMPTY_ARRAY = [];\nimport type { Asset } from './asset.types';\n\ntype AssetGalleryOwnProps = {\n /**\n * An array of assets to display in the gallery.\n */\n assets?: Asset[];\n /**\n * Whether the asset gallery should display the Version Count or Verifications on default.\n */\n displayIcon?: string;\n /**\n * Whether the asset gallery should render the Asset Summary Card on hover.\n */\n activeSummaryCard?: boolean;\n /**\n * The view mode of the gallery.\n */\n viewMode?: 'compact' | 'grid';\n /**\n * The maximum height of thumbnails in the gallery. When the grid is computed the gallery will try\n * to have each row of the gallery as close to the max height as possible.\n * This option is ignored unless `viewMode: 'compact'`.\n */\n thumbnailMaxHeight?: number;\n /**\n * Whether or not the asset gallery should have selectable asset cards\n */\n selectable?: boolean;\n /**\n * Whether or not the asset gallery should have custom borders on selected asset: Example: customSelectedBorder: ['#893FEB', '#EB513F'], where: customSelectedBorder.[0] is for darkMode and customSelectedBorder.[1] is for lightMode\n */\n customSelectedBorder?: string[];\n /**\n * An array containing the keys of all selected assets\n */\n selectedAssetKeys?: string[] | number[];\n /**\n * A callback function to run when the selected assets change\n */\n onSelectedChanged?: (...args: any[]) => any;\n /**\n * Whether the asset gallery should have soft selectable asset cards\n */\n softSelectable?: boolean;\n /**\n * Scrollable element to attach event listeners to. Defaults to window.\n */\n scrollElement?: any; // TODO: PropTypes.instanceOf(Element)\n /**\n * A callback function to run when the soft selected asset change\n */\n onSoftSelectedChanged?: (...args: any[]) => any;\n /**\n * A function that returns a custom component to use for the card in the gallery - The function provides\n * `asset` as its first argument\n */\n component?: (...args: any[]) => any;\n /**\n * When true, hides the consent summary footer on grid cards (CardFooter + CardDivider). Default: false.\n */\n hideConsentSummary?: boolean;\n};\n\n/*\n * NMB-3998 §C.2: `props` is spread onto `AssetGalleryBase`, so the published type\n * has to admit that target's props too — a closed type here is worse than `any` for the\n * 125 consumer files. Declared members win over the base (`Omit` by `keyof AssetGalleryOwnProps`);\n * a bare `&` would INTERSECT a colliding member instead of overriding it, which narrows\n * it (measured: `rows?: number | string` & `rows?: number`) or empties it to `never`.\n */\ntype Props = Omit<\n React.ComponentPropsWithoutRef<typeof AssetGalleryBase>,\n keyof AssetGalleryOwnProps\n> &\n AssetGalleryOwnProps;\n\n/**\n * An asset gallery that can be used to display a larger amounts of assets. The Asset Gallery supports displaying\n * images and videos.\n *\n * ### Import\n *\n * ``` js\n * import { AssetGallery } from '@ntbjs/react-components/widgets'\n * // or\n * import AssetGallery from '@ntbjs/react-components/widgets/AssetGallery'\n * ```\n *\n * ### Custom asset card element\n * In some cases you may want to swap out the boring `<div>`-tag that wraps each individual asset in the gallery for\n * something more useful.\n * By doing this you can achieve side-effects that this library has no concept about – like wrapping the assets\n * in [React-routers](https://reactrouter.com/web/api/Link) `<Link>`-component for internal application routing when\n * you click the asset.\n *\n * The asset gallery allows you to change the root element that will be rendered around all individual asset via a\n * property on the asset object called `component`.\n *\n * ```jsx\n * const assets = [{\n * previewUrl: 'https://preview.sdl.no/v1/no/7Zb20FDFCu-dne-lxi1thQ/uRs25Mh-FJY?v=1613865342365',\n * width: 512,\n * height: 324\n * }]\n *\n * const customComponent = (asset, children) => (\n * <a href={`https://www.ntb.no/?fromAssetId=${asset.key}`} target=\"_blank\">\n * {children}\n * </a>\n * )\n *\n * <AssetGallery assets={assets} component={customComponent} />\n * ```\n *\n * When providing a custom element it will take the place of the `<div>` being the outer most parent of the\n * asset itself. All required props will then be automatically applied, like the `style`-attribute containing the\n * positioning style of the asset. To tell the asset gallery where you want the rest of the asset card we provide the `{children}`.\n *\n * **Note:** If the root-element of the custom component is a React component the component must accept rest props (`{...props}`).\n *\n * This pattern is very powerful and allows for great flexibility, as well as a way to interoperate with other\n * libraries, such as your favorite routing or forms library. **But it also comes with a small caveat!**\n *\n * #### Caveat with inlining\n * Using an inline function as an argument for the component prop may result in unexpected unmounting, since a new\n * component is passed every time React renders.\n *\n * If we are using an inline function to change the rendered component, React will remount each individual assets every\n * time `AssetGallery` is re-rendered. Not only will React update the DOM unnecessarily, the ripple effect of the individual\n * assets will also not work correctly.\n *\n * To fix this issue **avoid using inline functions or wrap the function in some sort of memoization**\n * like `React.useMemo()`.\n *\n * #### Prop Collisions\n * Prop Collisions is something to be aware of. The asset gallery will render your custom element like this:\n *\n * ```js\n * return React.createElement(props.component, props)\n * ```\n *\n * That means that all the required props that the library automatically applies will take precedence over consumer\n * defined props. An example of this is the `style`-prop.\n *\n */\nconst AssetGallery = React.forwardRef<any, Props>(function AssetGallery(\n {\n assets = EMPTY_ARRAY,\n activeSummaryCard = false,\n viewMode = 'compact',\n thumbnailMaxHeight = 300,\n selectable,\n customSelectedBorder = EMPTY_ARRAY,\n selectedAssetKeys = EMPTY_ARRAY,\n onSelectedChanged,\n softSelectable,\n scrollElement,\n onSoftSelectedChanged,\n component,\n displayIcon = '',\n hideConsentSummary,\n ...props\n },\n forwardedRef\n) {\n // Internal state of the selected assets\n const [selectedAssetKeysInternalState, setSelectedAssetKeysInternalState] = useState(\n selectedAssetKeys || EMPTY_ARRAY\n );\n\n // Internal state of the soft selected asset\n const [softSelectedAssetKeyInternalState, setSoftSelectedAssetKeyInternalState] = useState(null);\n\n // Whenever the `selectedAssetKeys`-props changes we need to update the internal state\n useEffect(() => {\n setSelectedAssetKeysInternalState(selectedAssetKeys || EMPTY_ARRAY);\n }, [selectedAssetKeys]);\n\n // When the assets change we need to check if we have to update the list of selected assets\n // (removing keys of assets that is no longer present in `assets`)\n useEffect(() => {\n setSelectedAssetKeysInternalState(current => {\n return current.filter(c => assets.some(a => a.key === c));\n });\n }, [assets.length]);\n\n // Run the `onSelectedChanged` callback whenever `selectedAssetKeysInternalState` change\n useEffect(() => {\n // If the external and internal state of selected assets is in sync we can skip this update callback\n if (selectedAssetKeys === selectedAssetKeysInternalState) return;\n\n if (isFunction(onSelectedChanged)) {\n onSelectedChanged(selectedAssetKeysInternalState);\n }\n }, [selectedAssetKeysInternalState]);\n\n // Run the `onSoftSelectedChanged` callback whenever `softSelectedAssetKeyInternalState` change\n useEffect(() => {\n if (isFunction(onSoftSelectedChanged)) {\n onSoftSelectedChanged(softSelectedAssetKeyInternalState);\n }\n }, [softSelectedAssetKeyInternalState]);\n\n const onSelected = useCallback(assetKey => {\n setSelectedAssetKeysInternalState(currentState => [...currentState, assetKey]);\n }, []);\n\n const onUnselected = useCallback(assetKey => {\n setSelectedAssetKeysInternalState(currentState =>\n currentState.filter(filteredAssetKey => filteredAssetKey !== assetKey)\n );\n }, []);\n\n const onAssetSoftSelectedChanged = useCallback((assetKey = null) => {\n setSoftSelectedAssetKeyInternalState(assetKey);\n }, []);\n\n return (\n <AssetGalleryBase\n ref={forwardedRef}\n assets={assets}\n activeSummaryCard={activeSummaryCard}\n displayIcon={displayIcon}\n thumbnailMaxHeight={thumbnailMaxHeight}\n selectable={selectable}\n customSelectedBorder={customSelectedBorder}\n selectedAssetKeys={selectedAssetKeysInternalState}\n onAssetSelected={onSelected}\n onAssetUnselected={onUnselected}\n softSelectable={softSelectable}\n softSelectedAssetKey={softSelectedAssetKeyInternalState}\n scrollElement={scrollElement}\n onAssetSoftSelectedChanged={onAssetSoftSelectedChanged}\n component={component}\n viewMode={viewMode}\n hideConsentSummary={hideConsentSummary}\n {...props}\n />\n );\n});\n\nexport default AssetGallery;\n"],"names":["EMPTY_ARRAY","AssetGallery","React","forwardRef","assets","activeSummaryCard","viewMode","thumbnailMaxHeight","selectable","customSelectedBorder","selectedAssetKeys","onSelectedChanged","softSelectable","scrollElement","onSoftSelectedChanged","component","displayIcon","hideConsentSummary","props","forwardedRef","selectedAssetKeysInternalState","setSelectedAssetKeysInternalState","useState","softSelectedAssetKeyInternalState","setSoftSelectedAssetKeyInternalState","useEffect","current","filter","c","some","a","key","length","isFunction","onSelected","useCallback","assetKey","currentState","onUnselected","filteredAssetKey","onAssetSoftSelectedChanged","_jsx","AssetGalleryBase","ref","onAssetSelected","onAssetUnselected","softSel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A,cAAc,EAAEA,cAAe;AAC/BkC,IAAAA,oBAAoB,EAAEvB,iCAAkC;AACxDV,IAAAA,aAAa,EAAEA,aAAc;AAC7B2B,IAAAA,0BAA0B,EAAEA,0BAA2B;AACvDzB,IAAAA,SAAS,EAAEA,SAAU;AACrBT,IAAAA,QAAQ,EAAEA,QAAS;AACnBW,IAAAA,kBAAkB,EAAEA,kBAAmB;IAAA,GACnCC;AAAK,GACV,CAAC;AAEN,CAAC;;;;"}
1
+ {"version":3,"file":"AssetGallery.js","sources":["../../../src/components/widgets/AssetGallery/AssetGallery.tsx"],"sourcesContent":["import { isFunction } from 'lodash';\nimport React, { useCallback, useEffect, useState } from 'react';\nimport AssetGalleryBase from './AssetGalleryBase/AssetGalleryBase';\n\nconst EMPTY_ARRAY = [];\nimport type { Asset } from './asset.types';\n\ntype AssetGalleryOwnProps = {\n /**\n * An array of assets to display in the gallery.\n */\n assets?: Asset[];\n /**\n * Whether the asset gallery should display the Version Count or Verifications on default.\n */\n displayIcon?: string;\n /**\n * Whether the asset gallery should render the Asset Summary Card on hover.\n */\n activeSummaryCard?: boolean;\n /**\n * The view mode of the gallery.\n */\n viewMode?: 'compact' | 'grid';\n /**\n * The maximum height of thumbnails in the gallery. When the grid is computed the gallery will try\n * to have each row of the gallery as close to the max height as possible.\n * This option is ignored unless `viewMode: 'compact'`.\n */\n thumbnailMaxHeight?: number;\n /**\n * Whether or not the asset gallery should have selectable asset cards\n */\n selectable?: boolean;\n /**\n * Whether or not the asset gallery should have custom borders on selected asset: Example: customSelectedBorder: ['#893FEB', '#EB513F'], where: customSelectedBorder.[0] is for darkMode and customSelectedBorder.[1] is for lightMode\n */\n customSelectedBorder?: string[];\n /**\n * An array containing the keys of all selected assets\n */\n selectedAssetKeys?: string[] | number[];\n /**\n * A callback function to run when the selected assets change\n */\n onSelectedChanged?: (...args: any[]) => any;\n /**\n * Whether the asset gallery should have soft selectable asset cards\n */\n softSelectable?: boolean;\n /**\n * Scrollable element to attach event listeners to. Defaults to window.\n */\n scrollElement?: any; // TODO: PropTypes.instanceOf(Element)\n /**\n * A callback function to run when the soft selected asset change\n */\n onSoftSelectedChanged?: (...args: any[]) => any;\n /**\n * A function that returns a custom component to use for the card in the gallery - The function provides\n * `asset` as its first argument\n */\n component?: (...args: any[]) => any;\n /**\n * When true, hides the consent summary footer on grid cards (CardFooter + CardDivider). Default: false.\n */\n hideConsentSummary?: boolean;\n};\n\n// Omit before & — a bare intersection narrows colliding props instead of overriding them.\ntype Props = Omit<\n React.ComponentPropsWithoutRef<typeof AssetGalleryBase>,\n keyof AssetGalleryOwnProps\n> &\n AssetGalleryOwnProps;\n\n/**\n * An asset gallery that can be used to display a larger amounts of assets. The Asset Gallery supports displaying\n * images and videos.\n *\n * ### Import\n *\n * ``` js\n * import { AssetGallery } from '@ntbjs/react-components/widgets'\n * // or\n * import AssetGallery from '@ntbjs/react-components/widgets/AssetGallery'\n * ```\n *\n * ### Custom asset card element\n * In some cases you may want to swap out the boring `<div>`-tag that wraps each individual asset in the gallery for\n * something more useful.\n * By doing this you can achieve side-effects that this library has no concept about – like wrapping the assets\n * in [React-routers](https://reactrouter.com/web/api/Link) `<Link>`-component for internal application routing when\n * you click the asset.\n *\n * The asset gallery allows you to change the root element that will be rendered around all individual asset via a\n * property on the asset object called `component`.\n *\n * ```jsx\n * const assets = [{\n * previewUrl: 'https://preview.sdl.no/v1/no/7Zb20FDFCu-dne-lxi1thQ/uRs25Mh-FJY?v=1613865342365',\n * width: 512,\n * height: 324\n * }]\n *\n * const customComponent = (asset, children) => (\n * <a href={`https://www.ntb.no/?fromAssetId=${asset.key}`} target=\"_blank\">\n * {children}\n * </a>\n * )\n *\n * <AssetGallery assets={assets} component={customComponent} />\n * ```\n *\n * When providing a custom element it will take the place of the `<div>` being the outer most parent of the\n * asset itself. All required props will then be automatically applied, like the `style`-attribute containing the\n * positioning style of the asset. To tell the asset gallery where you want the rest of the asset card we provide the `{children}`.\n *\n * **Note:** If the root-element of the custom component is a React component the component must accept rest props (`{...props}`).\n *\n * This pattern is very powerful and allows for great flexibility, as well as a way to interoperate with other\n * libraries, such as your favorite routing or forms library. **But it also comes with a small caveat!**\n *\n * #### Caveat with inlining\n * Using an inline function as an argument for the component prop may result in unexpected unmounting, since a new\n * component is passed every time React renders.\n *\n * If we are using an inline function to change the rendered component, React will remount each individual assets every\n * time `AssetGallery` is re-rendered. Not only will React update the DOM unnecessarily, the ripple effect of the individual\n * assets will also not work correctly.\n *\n * To fix this issue **avoid using inline functions or wrap the function in some sort of memoization**\n * like `React.useMemo()`.\n *\n * #### Prop Collisions\n * Prop Collisions is something to be aware of. The asset gallery will render your custom element like this:\n *\n * ```js\n * return React.createElement(props.component, props)\n * ```\n *\n * That means that all the required props that the library automatically applies will take precedence over consumer\n * defined props. An example of this is the `style`-prop.\n *\n */\nconst AssetGallery = React.forwardRef<any, Props>(function AssetGallery(\n {\n assets = EMPTY_ARRAY,\n activeSummaryCard = false,\n viewMode = 'compact',\n thumbnailMaxHeight = 300,\n selectable,\n customSelectedBorder = EMPTY_ARRAY,\n selectedAssetKeys = EMPTY_ARRAY,\n onSelectedChanged,\n softSelectable,\n scrollElement,\n onSoftSelectedChanged,\n component,\n displayIcon = '',\n hideConsentSummary,\n ...props\n },\n forwardedRef\n) {\n // Internal state of the selected assets\n const [selectedAssetKeysInternalState, setSelectedAssetKeysInternalState] = useState(\n selectedAssetKeys || EMPTY_ARRAY\n );\n\n // Internal state of the soft selected asset\n const [softSelectedAssetKeyInternalState, setSoftSelectedAssetKeyInternalState] = useState(null);\n\n // Whenever the `selectedAssetKeys`-props changes we need to update the internal state\n useEffect(() => {\n setSelectedAssetKeysInternalState(selectedAssetKeys || EMPTY_ARRAY);\n }, [selectedAssetKeys]);\n\n // When the assets change we need to check if we have to update the list of selected assets\n // (removing keys of assets that is no longer present in `assets`)\n useEffect(() => {\n setSelectedAssetKeysInternalState(current => {\n return current.filter(c => assets.some(a => a.key === c));\n });\n }, [assets.length]);\n\n // Run the `onSelectedChanged` callback whenever `selectedAssetKeysInternalState` change\n useEffect(() => {\n // If the external and internal state of selected assets is in sync we can skip this update callback\n if (selectedAssetKeys === selectedAssetKeysInternalState) return;\n\n if (isFunction(onSelectedChanged)) {\n onSelectedChanged(selectedAssetKeysInternalState);\n }\n }, [selectedAssetKeysInternalState]);\n\n // Run the `onSoftSelectedChanged` callback whenever `softSelectedAssetKeyInternalState` change\n useEffect(() => {\n if (isFunction(onSoftSelectedChanged)) {\n onSoftSelectedChanged(softSelectedAssetKeyInternalState);\n }\n }, [softSelectedAssetKeyInternalState]);\n\n const onSelected = useCallback(assetKey => {\n setSelectedAssetKeysInternalState(currentState => [...currentState, assetKey]);\n }, []);\n\n const onUnselected = useCallback(assetKey => {\n setSelectedAssetKeysInternalState(currentState =>\n currentState.filter(filteredAssetKey => filteredAssetKey !== assetKey)\n );\n }, []);\n\n const onAssetSoftSelectedChanged = useCallback((assetKey = null) => {\n setSoftSelectedAssetKeyInternalState(assetKey);\n }, []);\n\n return (\n <AssetGalleryBase\n ref={forwardedRef}\n assets={assets}\n activeSummaryCard={activeSummaryCard}\n displayIcon={displayIcon}\n thumbnailMaxHeight={thumbnailMaxHeight}\n selectable={selectable}\n customSelectedBorder={customSelectedBorder}\n selectedAssetKeys={selectedAssetKeysInternalState}\n onAssetSelected={onSelected}\n onAssetUnselected={onUnselected}\n softSelectable={softSelectable}\n softSelectedAssetKey={softSelectedAssetKeyInternalState}\n scrollElement={scrollElement}\n onAssetSoftSelectedChanged={onAssetSoftSelectedChanged}\n component={component}\n viewMode={viewMode}\n hideConsentSummary={hideConsentSummary}\n {...props}\n />\n );\n});\n\nexport default AssetGallery;\n"],"names":["EMPTY_ARRAY","AssetGallery","React","forwardRef","assets","activeSummaryCard","viewMode","thumbnailMaxHeight","selectable","customSelectedBorder","selectedAssetKeys","onSelectedChanged","softSelectable","scrollElement","onSoftSelectedChanged","component","displayIcon","hideConsentSummary","props","forwardedRef","selectedAssetKeysInternalState","setSelectedAssetKeysInternalState","useState","softSelectedAssetKeyInternalState","setSoftSelectedAssetKeyInternalState","useEffect","current","filter","c","some","a","key","length","isFunction","onSelected","useCallback","assetKey","currentState","onUnselected","filteredAssetKey","onAssetSoftSelectedChanged","_jsx","AssetGalleryBase","ref","onAssetSelected","onAssetUnselected","softSelectedAssetKey"],"mappings":";;;;;AAIA,MAAMA,WAAW,GAAG,EAAE;AA6ItB,MAAMC,YAAY,GAAGC,cAAK,CAACC,UAAU,CAAa,SAASF,YAAYA,CACrE;AACEG,EAAAA,MAAM,GAAGJ,WAAW;AACpBK,EAAAA,iBAAiB,GAAG,KAAK;AACzBC,EAAAA,QAAQ,GAAG,SAAS;AACpBC,EAAAA,kBAAkB,GAAG,GAAG;EACxBC,UAAU;AACVC,EAAAA,oBAAoB,GAAGT,WAAW;AAClCU,EAAAA,iBAAiB,GAAGV,WAAW;EAC/BW,iBAAiB;EACjBC,cAAc;EACdC,aAAa;EACbC,qBAAqB;EACrBC,SAAS;AACTC,EAAAA,WAAW,GAAG,EAAE;EAChBC,kBAAkB;EAClB,GAAGC;AACL,CAAC,EACDC,YAAY,EACZ;EAEA,MAAM,CAACC,8BAA8B,EAAEC,iCAAiC,CAAC,GAAGC,QAAQ,CAClFZ,iBAAiB,IAAIV,WACvB,CAAC;EAGD,MAAM,CAACuB,iCAAiC,EAAEC,oCAAoC,CAAC,GAAGF,QAAQ,CAAC,IAAI,CAAC;AAGhGG,EAAAA,SAAS,CAAC,MAAM;AACdJ,IAAAA,iCAAiC,CAACX,iBAAiB,IAAIV,WAAW,CAAC;AACrE,EAAA,CAAC,EAAE,CAACU,iBAAiB,CAAC,CAAC;AAIvBe,EAAAA,SAAS,CAAC,MAAM;IACdJ,iCAAiC,CAACK,OAAO,IAAI;AAC3C,MAAA,OAAOA,OAAO,CAACC,MAAM,CAACC,CAAC,IAAIxB,MAAM,CAACyB,IAAI,CAACC,CAAC,IAAIA,CAAC,CAACC,GAAG,KAAKH,CAAC,CAAC,CAAC;AAC3D,IAAA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