@oracle/oraclejet-preact 19.0.5 → 19.0.7

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 (131) hide show
  1. package/amd/{BarChart-8521c53a.js → BarChart-d94f9c56.js} +2 -2
  2. package/amd/{BarChart-8521c53a.js.map → BarChart-d94f9c56.js.map} +1 -1
  3. package/amd/{Chart-061335fe.js → Chart-3108fa88.js} +2 -2
  4. package/amd/{Chart-061335fe.js.map → Chart-3108fa88.js.map} +1 -1
  5. package/amd/CheckboxSet-678ea1d4.js +2 -0
  6. package/{es/CheckboxSet-751d4298.js.map → amd/CheckboxSet-678ea1d4.js.map} +1 -1
  7. package/amd/ColorPicker-8ef0b6e0.js +2 -0
  8. package/amd/{ColorPicker-d8bda48d.js.map → ColorPicker-8ef0b6e0.js.map} +1 -1
  9. package/amd/{ComboChart-f3876b51.js → ComboChart-e61b5581.js} +2 -2
  10. package/amd/{ComboChart-f3876b51.js.map → ComboChart-e61b5581.js.map} +1 -1
  11. package/amd/{InputColor-192a309b.js → InputColor-5315b76a.js} +2 -2
  12. package/amd/{InputColor-192a309b.js.map → InputColor-5315b76a.js.map} +1 -1
  13. package/amd/InputDatePicker-c5ceeb44.js +2 -0
  14. package/amd/{InputDatePicker-8c8e14ca.js.map → InputDatePicker-c5ceeb44.js.map} +1 -1
  15. package/amd/{LineAreaChart-68050d87.js → LineAreaChart-f8aefe07.js} +2 -2
  16. package/amd/{LineAreaChart-68050d87.js.map → LineAreaChart-f8aefe07.js.map} +1 -1
  17. package/amd/NavigationListItem-82b0c382.js +2 -0
  18. package/amd/{NavigationListItem-cdbcc394.js.map → NavigationListItem-82b0c382.js.map} +1 -1
  19. package/amd/{OverflowTabBar-587b7c2a.js → OverflowTabBar-e2b5f36e.js} +2 -2
  20. package/amd/{OverflowTabBar-587b7c2a.js.map → OverflowTabBar-e2b5f36e.js.map} +1 -1
  21. package/amd/{OverflowTabBarItem-bcf24ceb.js → OverflowTabBarItem-e01e53ae.js} +2 -2
  22. package/amd/{OverflowTabBarItem-bcf24ceb.js.map → OverflowTabBarItem-e01e53ae.js.map} +1 -1
  23. package/amd/PRIVATE_Chart.js +1 -1
  24. package/amd/{ScatterChart-6fc3c47e.js → ScatterChart-1999acf0.js} +2 -2
  25. package/amd/{ScatterChart-6fc3c47e.js.map → ScatterChart-1999acf0.js.map} +1 -1
  26. package/amd/Theme-redwood/theme.css +187 -187
  27. package/amd/Theme-stable/theme.css +173 -173
  28. package/amd/UNSAFE_BarChart/__test__/BarChart.spec.js +1 -1
  29. package/amd/UNSAFE_BarChart.js +1 -1
  30. package/amd/UNSAFE_CheckboxItem.js +1 -1
  31. package/amd/UNSAFE_CheckboxItem.js.map +1 -1
  32. package/amd/UNSAFE_CheckboxSet.js +1 -1
  33. package/amd/UNSAFE_CheckboxSet.js.map +1 -1
  34. package/amd/UNSAFE_ColorPicker.js +1 -1
  35. package/amd/UNSAFE_ComboChart.js +1 -1
  36. package/amd/UNSAFE_InputColor.js +1 -1
  37. package/amd/UNSAFE_InputDatePicker.js +1 -1
  38. package/amd/UNSAFE_LineAreaChart.js +1 -1
  39. package/amd/UNSAFE_NavigationList.js +1 -1
  40. package/amd/UNSAFE_OverflowTabBar.js +1 -1
  41. package/amd/UNSAFE_RichCheckboxSet.js +1 -1
  42. package/amd/UNSAFE_RichCheckboxSet.js.map +1 -1
  43. package/amd/UNSAFE_RichSelectionItem.js +1 -1
  44. package/amd/UNSAFE_RichSelectionItem.js.map +1 -1
  45. package/amd/UNSAFE_ScatterChart.js +1 -1
  46. package/amd/UNSAFE_TabBar.js +1 -1
  47. package/amd/UNSAFE_TabBarCommon.js +1 -1
  48. package/amd/UNSAFE_TabBarMixed.js +1 -1
  49. package/cjs/{Chart-55c4cd8f.js → Chart-c07adbbd.js} +2 -2
  50. package/cjs/{Chart-55c4cd8f.js.map → Chart-c07adbbd.js.map} +1 -1
  51. package/cjs/{ColorPalette-ea5e1bed.js → ColorPalette-f8fbe6a4.js} +2 -2
  52. package/cjs/{ColorPalette-ea5e1bed.js.map → ColorPalette-f8fbe6a4.js.map} +1 -1
  53. package/cjs/{ColorPicker-03036ee3.js → ColorPicker-efe1edb3.js} +2 -2
  54. package/cjs/{ColorPicker-03036ee3.js.map → ColorPicker-efe1edb3.js.map} +1 -1
  55. package/cjs/{Expander-96ce2888.js → Expander-01af6642.js} +2 -2
  56. package/cjs/{Expander-96ce2888.js.map → Expander-01af6642.js.map} +1 -1
  57. package/cjs/MaxLengthCounter-39055ba1.js +27 -0
  58. package/cjs/MaxLengthCounter-39055ba1.js.map +1 -0
  59. package/cjs/{NavigationListItem-24abe2ab.js → NavigationListItem-843e014d.js} +4 -2
  60. package/cjs/{NavigationListItem-24abe2ab.js.map → NavigationListItem-843e014d.js.map} +1 -1
  61. package/cjs/{NavigationListLinkItem-35f33123.js → NavigationListLinkItem-0931af4d.js} +2 -2
  62. package/cjs/{NavigationListLinkItem-35f33123.js.map → NavigationListLinkItem-0931af4d.js.map} +1 -1
  63. package/cjs/{OverflowTabBarItem-c8809159.js → OverflowTabBarItem-6c3c9629.js} +4 -4
  64. package/cjs/{OverflowTabBarItem-c8809159.js.map → OverflowTabBarItem-6c3c9629.js.map} +1 -1
  65. package/cjs/PRIVATE_Chart.js +4 -4
  66. package/cjs/PRIVATE_Expander.js +55 -55
  67. package/cjs/PRIVATE_Table.js +5 -5
  68. package/cjs/{SortControl-7be650eb.js → SortControl-5ca85c6b.js} +2 -2
  69. package/cjs/{SortControl-7be650eb.js.map → SortControl-5ca85c6b.js.map} +1 -1
  70. package/cjs/{TabBar-afd26c75.js → TabBar-1885c9c5.js} +3 -1
  71. package/cjs/{TabBar-afd26c75.js.map → TabBar-1885c9c5.js.map} +1 -1
  72. package/cjs/{TabBarLinkItem-4e4f8da0.js → TabBarLinkItem-cdff6676.js} +2 -2
  73. package/cjs/{TabBarLinkItem-4e4f8da0.js.map → TabBarLinkItem-cdff6676.js.map} +1 -1
  74. package/cjs/{Table-0bca32d4.js → Table-49575528.js} +2 -2
  75. package/cjs/{Table-0bca32d4.js.map → Table-49575528.js.map} +1 -1
  76. package/cjs/Theme-redwood/theme.css +148 -148
  77. package/cjs/Theme-stable/theme.css +239 -239
  78. package/cjs/UNSAFE_BarChart.js +4 -4
  79. package/cjs/UNSAFE_ColorPalette.js +69 -69
  80. package/cjs/UNSAFE_ColorPicker.js +64 -64
  81. package/cjs/UNSAFE_ComboChart.js +4 -4
  82. package/cjs/UNSAFE_FlatTreeView.js +30 -30
  83. package/cjs/UNSAFE_InputColor.js +12 -12
  84. package/cjs/UNSAFE_InputDatePicker.js +92 -92
  85. package/cjs/UNSAFE_LineAreaChart.js +4 -4
  86. package/cjs/UNSAFE_NavigationList.js +13 -13
  87. package/cjs/UNSAFE_NavigationListCommon.js +2 -2
  88. package/cjs/UNSAFE_OverflowTabBar.js +35 -35
  89. package/cjs/UNSAFE_ReorderableTabBar.js +30 -9
  90. package/cjs/UNSAFE_ReorderableTabBar.js.map +1 -1
  91. package/cjs/UNSAFE_ScatterChart.js +4 -4
  92. package/cjs/UNSAFE_SortControl.js +47 -47
  93. package/cjs/UNSAFE_TabBar.js +35 -35
  94. package/cjs/UNSAFE_TabBarCommon.js +55 -55
  95. package/cjs/UNSAFE_TabBarMixed.js +34 -34
  96. package/cjs/UNSAFE_TableView.js +5 -5
  97. package/cjs/UNSAFE_TextArea.js +216 -106
  98. package/cjs/UNSAFE_TextArea.js.map +1 -1
  99. package/cjs/UNSAFE_TextAreaAutosize.js +2 -2
  100. package/cjs/UNSAFE_TextAreaAutosize.js.map +1 -1
  101. package/es/CheckboxSetContext-1be56556.js +9 -0
  102. package/{amd/CheckboxSetContext-2e486ea8.js.map → es/CheckboxSetContext-1be56556.js.map} +1 -1
  103. package/es/{ColorPicker-3bb4cad3.js → ColorPicker-b0f5a7f2.js} +2 -2
  104. package/es/{ColorPicker-3bb4cad3.js.map → ColorPicker-b0f5a7f2.js.map} +1 -1
  105. package/es/DiagramStyles.styles.css +10 -16
  106. package/es/DiagramStyles.styles2.css +16 -10
  107. package/es/PRIVATE_ContainerDiagram/themes/DiagramStyles.css.js +1 -1
  108. package/es/PRIVATE_ContainerDiagram.js +1 -1
  109. package/es/Theme-redwood/theme.css +406 -406
  110. package/es/Theme-stable/theme.css +457 -457
  111. package/es/UNSAFE_CheckboxItem.js +47 -101
  112. package/es/UNSAFE_CheckboxItem.js.map +1 -1
  113. package/es/UNSAFE_CheckboxSet.js +44 -10
  114. package/es/UNSAFE_CheckboxSet.js.map +1 -1
  115. package/es/UNSAFE_ColorPicker.js +25 -25
  116. package/es/UNSAFE_Diagram/themes/DiagramStyles.css.js +1 -1
  117. package/es/UNSAFE_Diagram.js +1 -1
  118. package/es/UNSAFE_InputColor.js +2 -2
  119. package/es/UNSAFE_InputDatePicker.js +92 -92
  120. package/es/UNSAFE_RichCheckboxSet.js +25 -29
  121. package/es/UNSAFE_RichCheckboxSet.js.map +1 -1
  122. package/es/UNSAFE_RichSelectionItem.js +29 -172
  123. package/es/UNSAFE_RichSelectionItem.js.map +1 -1
  124. package/package.json +2 -2
  125. package/amd/CheckboxSetContext-2e486ea8.js +0 -2
  126. package/amd/ColorPicker-d8bda48d.js +0 -2
  127. package/amd/InputDatePicker-8c8e14ca.js +0 -2
  128. package/amd/NavigationListItem-cdbcc394.js +0 -2
  129. package/cjs/TextArea-8608dba1.js +0 -187
  130. package/cjs/TextArea-8608dba1.js.map +0 -1
  131. package/es/CheckboxSet-751d4298.js +0 -49
@@ -1 +1 @@
1
- {"version":3,"file":"ColorPicker-d8bda48d.js","sources":["../../src/UNSAFE_ColorPicker/ColorPicker.tsx"],"sourcesContent":["// import { Flex } from '#UNSAFE_Flex';\nimport { useTestId, type TestIdProps } from '#hooks/UNSAFE_useTestId';\nimport type { ValueUpdateDetail } from '#utils/UNSAFE_valueUpdateDetail';\nimport { colorPickerPropVars } from './themes/ColorPickerContract.css';\nimport { useComponentTheme } from '#hooks/UNSAFE_useComponentTheme';\nimport { ColorPickerRedwoodTheme } from './themes/redwood/ColorPickerTheme';\nimport { ColorPalette } from '#UNSAFE_ColorPalette';\nimport { Size } from '#utils/UNSAFE_size';\nimport { ComponentProps } from 'preact';\nimport { forwardRef, ForwardedRef } from 'preact/compat';\nimport { type ColorValue } from '#utils/UNSAFE_color';\nimport { Flex } from '#UNSAFE_Flex';\nimport { isMobile } from '#utils/UNSAFE_clientUtils';\n\ntype ColorPaletteProps = ComponentProps<typeof ColorPalette>;\ntype PickedPropsFromColorPalette = Pick<ColorPaletteProps, 'swatchSize' | 'palette'>;\n\ntype Props = TestIdProps &\n PickedPropsFromColorPalette & {\n /**\n * The selected color\n */\n value?: ColorValue;\n\n /**\n * When property is set to \"auto\", the color picker will automatically adjust to the height of the palette.\n * This is mainly to be used in conjunction with InputColor.\n * <p>If not specified, defaults to the theme specified height.<br/>\n */\n height?: 'auto';\n\n /**\n * Specifies the component style maxWidth.\n * <p>If not specified, defaults to the theme specified maxWidth.<br/>\n * This attribute accepts values of type:<br/>\n * 0 | `${number}${CssUnits}` | `${number}x` | `--${string}` | `var($string})` | `${number}%`</p>\n * <p>When this component is used in composition and the component should take up 100% of the parent container's\n * width, set maxWidth to '100%'.<br/>\n * Because there is a theme default value for maxWidth, when setting the width property to achieve a fixed width,\n * set the maxWidth property to the same value.</p>\n */\n maxWidth?: Size;\n\n /**\n * Specifies the component style width.\n * <p>If not specified, defaults to '100%'.</p>\n * <p>This attribute accepts values of type:</p>\n * <p>0 | `${number}${CssUnits}` | `${number}x` | `--${string}` | `var($string})` | `${number}%`</p>\n * <br/>\n * <p>Because there is a theme default value for maxWidth, when setting the width property to achieve a fixed width,\n * set the maxWidth property to the same value.</p>\n */\n width?: Size;\n\n /**\n * Callback invoked when the user selects a color in the Palette. This callback is called even when the previous\n * value and the value are the same, that is, when the user selects an already selected color.\n * The app needs to handle this to write back the controlled 'value' property, or else no color will be shown\n * to be selected.\n */\n onCommit: (detail: ValueUpdateDetail<ColorValue>) => void;\n };\n\n/**\n * A ColorPicker is a component that allows users to select a single color.\n */\nexport const ColorPicker = forwardRef(\n (\n { swatchSize = 'xs', palette, height, maxWidth, value, testId, width, onCommit }: Props,\n pickerRef?: ForwardedRef<HTMLDivElement>\n ) => {\n // we need to render the baseTheme on the root dom element so that the CSS vars in colorPickerPropVars will be defined.\n const { classes } = useComponentTheme(ColorPickerRedwoodTheme);\n\n const testIdProps = useTestId(testId);\n\n return (\n <div ref={pickerRef} class={classes} {...testIdProps}>\n <Flex\n direction=\"column\"\n height={\n height === 'auto' ? undefined : isMobile() ? undefined : colorPickerPropVars.maxHeight\n }\n maxWidth={\n maxWidth !== undefined ? maxWidth : isMobile() ? '100%' : colorPickerPropVars.maxWidth\n }\n width={width !== undefined ? width : colorPickerPropVars.width}>\n <ColorPalette\n palette={palette}\n swatchSize={swatchSize}\n value={value}\n testId={testId ? testId + '_picker' : undefined}\n onCommit={onCommit}></ColorPalette>\n </Flex>\n </div>\n );\n }\n);\n"],"names":["ColorPicker","forwardRef","swatchSize","palette","height","maxWidth","value","testId","width","onCommit","pickerRef","classes","useComponentTheme","ColorPickerRedwoodTheme","testIdProps","useTestId","_jsx","jsx","ref","class","children","Flex","direction","isMobile","undefined","colorPickerPropVars","maxHeight","ColorPalette"],"mappings":"4UAkEa,MAAAA,EAAcC,EAAAA,YACzB,EACIC,aAAa,KAAMC,UAASC,SAAQC,WAAUC,QAAOC,SAAQC,QAAOC,YACtEC,KAGA,MAAMC,QAAEA,GAAYC,EAAiBA,kBAACC,EAAuBA,yBAEvDC,EAAcC,YAAUR,GAE9B,OACES,EAAKC,IAAA,MAAA,CAAAC,IAAKR,EAAWS,MAAOR,KAAaG,EACvCM,SAAAJ,EAAAC,IAACI,EAAIA,KAAA,CACHC,UAAU,SACVlB,OACa,SAAXA,GAAgCmB,EAAAA,gBAAZC,EAAqCC,sBAAoBC,UAE/ErB,cACemB,IAAbnB,EAAyBA,EAAWkB,EAAAA,WAAa,OAASE,EAAAA,oBAAoBpB,SAEhFG,WAAiBgB,IAAVhB,EAAsBA,EAAQiB,sBAAoBjB,MAAKY,SAC9DJ,EAAAA,IAACW,EAAAA,aACC,CAAAxB,QAASA,EACTD,WAAYA,EACZI,MAAOA,EACPC,OAAQA,EAASA,EAAS,eAAYiB,EACtCf,SAAUA,OAGhB"}
1
+ {"version":3,"file":"ColorPicker-8ef0b6e0.js","sources":["../../src/UNSAFE_ColorPicker/ColorPicker.tsx"],"sourcesContent":["// import { Flex } from '#UNSAFE_Flex';\nimport { useTestId, type TestIdProps } from '#hooks/UNSAFE_useTestId';\nimport type { ValueUpdateDetail } from '#utils/UNSAFE_valueUpdateDetail';\nimport { colorPickerPropVars } from './themes/ColorPickerContract.css';\nimport { useComponentTheme } from '#hooks/UNSAFE_useComponentTheme';\nimport { ColorPickerRedwoodTheme } from './themes/redwood/ColorPickerTheme';\nimport { ColorPalette } from '#UNSAFE_ColorPalette';\nimport { Size } from '#utils/UNSAFE_size';\nimport { ComponentProps } from 'preact';\nimport { forwardRef, ForwardedRef } from 'preact/compat';\nimport { type ColorValue } from '#utils/UNSAFE_color';\nimport { Flex } from '#UNSAFE_Flex';\nimport { isMobile } from '#utils/UNSAFE_clientUtils';\n\ntype ColorPaletteProps = ComponentProps<typeof ColorPalette>;\ntype PickedPropsFromColorPalette = Pick<ColorPaletteProps, 'swatchSize' | 'palette'>;\n\ntype Props = TestIdProps &\n PickedPropsFromColorPalette & {\n /**\n * The selected color\n */\n value?: ColorValue;\n\n /**\n * When property is set to \"auto\", the color picker will automatically adjust to the height of the palette.\n * This is mainly to be used in conjunction with InputColor.\n * <p>If not specified, defaults to the theme specified height.<br/>\n */\n height?: 'auto';\n\n /**\n * Specifies the component style maxWidth.\n * <p>If not specified, defaults to the theme specified maxWidth.<br/>\n * This attribute accepts values of type:<br/>\n * 0 | `${number}${CssUnits}` | `${number}x` | `--${string}` | `var($string})` | `${number}%`</p>\n * <p>When this component is used in composition and the component should take up 100% of the parent container's\n * width, set maxWidth to '100%'.<br/>\n * Because there is a theme default value for maxWidth, when setting the width property to achieve a fixed width,\n * set the maxWidth property to the same value.</p>\n */\n maxWidth?: Size;\n\n /**\n * Specifies the component style width.\n * <p>If not specified, defaults to '100%'.</p>\n * <p>This attribute accepts values of type:</p>\n * <p>0 | `${number}${CssUnits}` | `${number}x` | `--${string}` | `var($string})` | `${number}%`</p>\n * <br/>\n * <p>Because there is a theme default value for maxWidth, when setting the width property to achieve a fixed width,\n * set the maxWidth property to the same value.</p>\n */\n width?: Size;\n\n /**\n * Callback invoked when the user selects a color in the Palette. This callback is called even when the previous\n * value and the value are the same, that is, when the user selects an already selected color.\n * The app needs to handle this to write back the controlled 'value' property, or else no color will be shown\n * to be selected.\n */\n onCommit: (detail: ValueUpdateDetail<ColorValue>) => void;\n };\n\n/**\n * A ColorPicker is a component that allows users to select a single color.\n */\nexport const ColorPicker = forwardRef(\n (\n { swatchSize = 'xs', palette, height, maxWidth, value, testId, width, onCommit }: Props,\n pickerRef?: ForwardedRef<HTMLDivElement>\n ) => {\n // we need to render the baseTheme on the root dom element so that the CSS vars in colorPickerPropVars will be defined.\n const { classes } = useComponentTheme(ColorPickerRedwoodTheme);\n\n const testIdProps = useTestId(testId);\n\n return (\n <div ref={pickerRef} class={classes} {...testIdProps}>\n <Flex\n direction=\"column\"\n height={\n height === 'auto' ? undefined : isMobile() ? undefined : colorPickerPropVars.maxHeight\n }\n maxWidth={\n maxWidth !== undefined ? maxWidth : isMobile() ? '100%' : colorPickerPropVars.maxWidth\n }\n width={width !== undefined ? width : colorPickerPropVars.width}>\n <ColorPalette\n palette={palette}\n swatchSize={swatchSize}\n value={value}\n testId={testId ? testId + '_picker' : undefined}\n onCommit={onCommit}></ColorPalette>\n </Flex>\n </div>\n );\n }\n);\n"],"names":["ColorPicker","forwardRef","swatchSize","palette","height","maxWidth","value","testId","width","onCommit","pickerRef","classes","useComponentTheme","ColorPickerRedwoodTheme","testIdProps","useTestId","_jsx","jsx","ref","class","children","Flex","direction","isMobile","undefined","colorPickerPropVars","maxHeight","ColorPalette"],"mappings":"4UAkEa,MAAAA,EAAcC,EAAAA,YACzB,EACIC,aAAa,KAAMC,UAASC,SAAQC,WAAUC,QAAOC,SAAQC,QAAOC,YACtEC,KAGA,MAAMC,QAAEA,GAAYC,EAAiBA,kBAACC,EAAuBA,yBAEvDC,EAAcC,YAAUR,GAE9B,OACES,EAAKC,IAAA,MAAA,CAAAC,IAAKR,EAAWS,MAAOR,KAAaG,EACvCM,SAAAJ,EAAAC,IAACI,EAAIA,KAAA,CACHC,UAAU,SACVlB,OACa,SAAXA,GAAgCmB,EAAAA,gBAAZC,EAAqCC,sBAAoBC,UAE/ErB,cACemB,IAAbnB,EAAyBA,EAAWkB,EAAAA,WAAa,OAASE,EAAAA,oBAAoBpB,SAEhFG,WAAiBgB,IAAVhB,EAAsBA,EAAQiB,sBAAoBjB,MAAKY,SAC9DJ,EAAAA,IAACW,EAAAA,aACC,CAAAxB,QAASA,EACTD,WAAYA,EACZI,MAAOA,EACPC,OAAQA,EAASA,EAAS,eAAYiB,EACtCf,SAAUA,OAGhB"}
@@ -1,2 +1,2 @@
1
- define(['exports', 'preact/jsx-runtime', './utils-8ccd1b88', './chartUtils-d0a5aa01', './LineSeries-53e65053', './dataStyleUtils-9895ff76', './useUser-988f7da2', './colorUtils-7aaca9f1', './accUtils-acd70e81', './themeContract.css-2e4b066d', './BarGroup-c171e6cb', './Chart-061335fe'], (function(e,t,i,a,r,s,n,o,l,d,c,h){"use strict";function g({width:e,height:l,selectedIds:g=[],hiddenIds:I=[],highlightedIds:x,hideAndShowBehavior:m="none",orientation:u="vertical",yAxis:y,series:S,groups:f,isStacked:A=!1,getDataItem:C,selectionMode:v="none",drilling:b="off",dataItemGaps:T=.5,dataLabelEffect:D="outline",...L}){const{direction:k,forcedColors:R}=n.useUser(),j="active"===R,M=S.filter((e=>"bar"===e.type)),U="rtl"===k,B="log"===y?.scale,P=L.xAxis?.timeAxisType,W=new Set(I),E=new Set(g),G=new Set(x),w="horizontal"===u,z=o.getColorRamp();let F=i.getSeriesData(S.length,f.length,C,W,B);const H=(e,t)=>A?{...C(e,t),value:F[e][t]}:C(e,t),N="number"==typeof L.y2Axis?.split,O=i.getMarkers(),q=[],{hasBar:V,hasCenteredSeries:Y,hasUncenteredSeries:Z,hasArea:J}=S.reduce(((e,t)=>({hasArea:e.hasArea||"area"===t.type||"lineWithArea"===t.type,hasBar:e.hasBar||"bar"===t.type,hasCenteredSeries:e.hasCenteredSeries||"centeredSegmented"===t.lineType||"centeredStepped"===t.lineType,hasUncenteredSeries:e.hasUncenteredSeries||"segmented"===t.lineType||"stepped"===t.lineType})),{hasBar:!1,hasCenteredSeries:!1,hasUncenteredSeries:!1,hasArea:!1});return t.jsx(h.Chart,{width:e,height:l,selectedIds:E,hiddenIds:I,hideAndShowBehavior:m,orientation:u,yAxis:y,series:S,defaultOverviewContentRenderer:()=>t.jsx(p,{groups:f,series:S,getDataItem:C}),groups:f,selectionMode:v,drilling:b,isStacked:A,getDataItem:C,findNearest:(e,t,a)=>i.findNearestDataPoint(S,f,e,t,H,A,(()=>({offset:0,dataWidth:0})),((e,t)=>t.transform(e)),B,0,W,P,a),getDataItemPos:(e,t,i,r,s,n)=>{const o=V?c.getBarPosition(M,f,C,e,t,i,W,T,r,s,n,"log"===y?.scale,A,U,w,N,P):void 0;return(i,r)=>"bar"===S[i].type?o?o(i,r):void 0:a.getLineAreaChartItemPosition(i,r,F,C,f,w,e,t,P)},getMarkerInfo:(e,t)=>({color:s.getItemColor(e,t,S,C),markerType:s.getMarkerType(e,t,C)}),renderGridLinesInFront:J,getNavUtil:(e,t)=>s.getLineAreaChartNavUtil(C,S.length,e,t,A,U,w),getGapRatio:()=>1,getStartAndEndAxesOffset:e=>i.getStartAndEndAxesOffset(Y,Z,w,e,V),isRtl:U,...L,children:({xStartIndex:e,xEndIndex:s,xScale:n,groupsInfo:o,yScale:l,y2Scale:h,activeId:g,focusedItemInfo:p,hoveredItemInfo:I,isPointInsideMarquee:m,getTextDimensions:f,defaultFontSize:k,axisStepWidth:R,averageGroupZ:V,getItemAriaLabel:Y,plotAreaClipPathId:Z})=>{let J=-1;const K=o.map((({item:e})=>e));return F=i.getSeriesData(S.length,K.length,C,W,B),t.jsx(t.Fragment,{children:F.map(((o,Q)=>{const X=S[Q],$="y2"===X.associatedYAxis,_="lineWithArea"===X.type?.2:1,ee="area"===X.type||"lineWithArea"===X.type,te="area"===X.type;if(0===o.length)return;const ie=i.getLineAreaSegments($?h:l,n,o,e,s,B,K,Q,H,P);q[Q]=ie[0];const ae="bar"!==X.type?"curved"===X.lineType&&A&&F.length>1&&Q>0:A&&F.length>1&&Q>0,re=void 0===x||0===G.size||G.has(X.id),se=A&&0!=Q?q.reduce(((e,t,i)=>i>=Q?e:t.length>0?i:e),0):void 0;return"bar"===X.type&&(J+=1),t.jsxs(t.Fragment,{children:["bar"===X.type&&K.slice(e,s+1).map(((a,r)=>t.jsx(c.BarGroup,{plotAreaClipPathId:Z,yScale:l,y2Scale:h,xScale:n,splitDualY:N,groupIndex:r+e,selectedIds:E,hiddenIds:W,highlightedIds:x?G:x,isDrillEnabled:"on"===b,series:M,barGapRatio:i.getBarGapRatio(A,e,s),dataItemGaps:T,isPointInsideMarquee:m,isStacked:A,axisStepWidth:R,averageGroupZ:V,group:K[r],timeAxisType:L.xAxis?.timeAxisType,colors:z,activeId:g,isLog:"log"===y?.scale,orientation:u,getDataItem:C,isSelectionEnabled:"none"!=v,isRtl:U,focusedItemInfo:p,hoveredItemInfo:I,getTextDimensions:f,defaultFontSize:k,seriesIndex:J,getItemAriaLabel:Y}))),ee&&t.jsx(a.AreaSeries,{yScale:$?h:l,plotAreaClipPathId:Z,lineType:X.lineType,color:X.areaColor||z[Q%z.length],isHorizontal:w,areaColorOpacity:_,isBottomSegmentCurved:ae,bottomCoords:void 0!==se&&q[se].some((e=>null!=e))?q[se]:void 0,lineSegments:ie,isLog:B,isHighlighted:re,seriesIndex:Q,groupWidth:R,isRtl:U,timeAxisType:P}),"line"===X.type&&t.jsx(r.LineSeries,{plotAreaClipPathId:Z,lineType:X.lineType,lineColor:te?d.colorSchemeVars.dvt.contrastLine:X.lineColor,lineWidth:te?1.25:X.lineWidth,lineStyle:X.lineStyle||"solid",color:X.lineColor||z[Q%z.length],lineSegmentCoords:ie,isHorizontal:w,isHighlighted:re,seriesIndex:Q,groupWidth:R,isRtl:U,timeAxisType:P}),!A&&("line"===X.type||ee)&&t.jsx(r.MarkersWithLabel,{yScale:$?h:l,xScale:n,groups:K,series:X,timeAxisType:P,color:z[Q%z.length],seriesIndex:Q,startIndex:e,endIndex:s,markerType:O[Q%O.length],orientation:u,isLog:B,activeId:g,getDataItem:C,isPointInsideMarquee:m,selectedIds:E,focusedItemIndex:p.seriesIndex!==Q||!p.isFocusVisible||L.isDataCursorEnabled&&L.dataCursorStyle?.isMarkerDisplayed?void 0:p.groupIndex,hoveredItemIndex:I?.isCurrent&&I.seriesIndex===Q?I.groupIndex:void 0,isSelectionEnabled:"single"===v||"multiple"===v,isDrillEnabled:"on"===b,defaultFontSize:k,dataLabelEffect:D,isHighContrast:j,getItemAriaLabel:Y})]})}))})}})}function p(e){return t.jsx(g,{datatip:()=>({content:""}),zoomAndScroll:"off",plotArea:{yMajorTick:{isRendered:!1},xMajorTick:{}},xAxis:{tickLabel:{autoRotate:!1,isRendered:!!e.xAxis?.timeAxisType}},series:e.series,groups:e.groups,getDataItem:e.getDataItem,yAxis:{tickLabel:{isRendered:!1}},overview:"off"})}e.ComboChart=g}));
2
- //# sourceMappingURL=ComboChart-f3876b51.js.map
1
+ define(['exports', 'preact/jsx-runtime', './utils-8ccd1b88', './chartUtils-d0a5aa01', './LineSeries-53e65053', './dataStyleUtils-9895ff76', './useUser-988f7da2', './colorUtils-7aaca9f1', './accUtils-acd70e81', './themeContract.css-2e4b066d', './BarGroup-c171e6cb', './Chart-3108fa88'], (function(e,t,i,a,r,s,n,o,l,d,c,h){"use strict";function g({width:e,height:l,selectedIds:g=[],hiddenIds:I=[],highlightedIds:x,hideAndShowBehavior:m="none",orientation:u="vertical",yAxis:y,series:S,groups:f,isStacked:A=!1,getDataItem:C,selectionMode:v="none",drilling:b="off",dataItemGaps:T=.5,dataLabelEffect:D="outline",...L}){const{direction:k,forcedColors:R}=n.useUser(),j="active"===R,M=S.filter((e=>"bar"===e.type)),U="rtl"===k,B="log"===y?.scale,P=L.xAxis?.timeAxisType,W=new Set(I),E=new Set(g),G=new Set(x),w="horizontal"===u,z=o.getColorRamp();let F=i.getSeriesData(S.length,f.length,C,W,B);const H=(e,t)=>A?{...C(e,t),value:F[e][t]}:C(e,t),N="number"==typeof L.y2Axis?.split,O=i.getMarkers(),q=[],{hasBar:V,hasCenteredSeries:Y,hasUncenteredSeries:Z,hasArea:J}=S.reduce(((e,t)=>({hasArea:e.hasArea||"area"===t.type||"lineWithArea"===t.type,hasBar:e.hasBar||"bar"===t.type,hasCenteredSeries:e.hasCenteredSeries||"centeredSegmented"===t.lineType||"centeredStepped"===t.lineType,hasUncenteredSeries:e.hasUncenteredSeries||"segmented"===t.lineType||"stepped"===t.lineType})),{hasBar:!1,hasCenteredSeries:!1,hasUncenteredSeries:!1,hasArea:!1});return t.jsx(h.Chart,{width:e,height:l,selectedIds:E,hiddenIds:I,hideAndShowBehavior:m,orientation:u,yAxis:y,series:S,defaultOverviewContentRenderer:()=>t.jsx(p,{groups:f,series:S,getDataItem:C}),groups:f,selectionMode:v,drilling:b,isStacked:A,getDataItem:C,findNearest:(e,t,a)=>i.findNearestDataPoint(S,f,e,t,H,A,(()=>({offset:0,dataWidth:0})),((e,t)=>t.transform(e)),B,0,W,P,a),getDataItemPos:(e,t,i,r,s,n)=>{const o=V?c.getBarPosition(M,f,C,e,t,i,W,T,r,s,n,"log"===y?.scale,A,U,w,N,P):void 0;return(i,r)=>"bar"===S[i].type?o?o(i,r):void 0:a.getLineAreaChartItemPosition(i,r,F,C,f,w,e,t,P)},getMarkerInfo:(e,t)=>({color:s.getItemColor(e,t,S,C),markerType:s.getMarkerType(e,t,C)}),renderGridLinesInFront:J,getNavUtil:(e,t)=>s.getLineAreaChartNavUtil(C,S.length,e,t,A,U,w),getGapRatio:()=>1,getStartAndEndAxesOffset:e=>i.getStartAndEndAxesOffset(Y,Z,w,e,V),isRtl:U,...L,children:({xStartIndex:e,xEndIndex:s,xScale:n,groupsInfo:o,yScale:l,y2Scale:h,activeId:g,focusedItemInfo:p,hoveredItemInfo:I,isPointInsideMarquee:m,getTextDimensions:f,defaultFontSize:k,axisStepWidth:R,averageGroupZ:V,getItemAriaLabel:Y,plotAreaClipPathId:Z})=>{let J=-1;const K=o.map((({item:e})=>e));return F=i.getSeriesData(S.length,K.length,C,W,B),t.jsx(t.Fragment,{children:F.map(((o,Q)=>{const X=S[Q],$="y2"===X.associatedYAxis,_="lineWithArea"===X.type?.2:1,ee="area"===X.type||"lineWithArea"===X.type,te="area"===X.type;if(0===o.length)return;const ie=i.getLineAreaSegments($?h:l,n,o,e,s,B,K,Q,H,P);q[Q]=ie[0];const ae="bar"!==X.type?"curved"===X.lineType&&A&&F.length>1&&Q>0:A&&F.length>1&&Q>0,re=void 0===x||0===G.size||G.has(X.id),se=A&&0!=Q?q.reduce(((e,t,i)=>i>=Q?e:t.length>0?i:e),0):void 0;return"bar"===X.type&&(J+=1),t.jsxs(t.Fragment,{children:["bar"===X.type&&K.slice(e,s+1).map(((a,r)=>t.jsx(c.BarGroup,{plotAreaClipPathId:Z,yScale:l,y2Scale:h,xScale:n,splitDualY:N,groupIndex:r+e,selectedIds:E,hiddenIds:W,highlightedIds:x?G:x,isDrillEnabled:"on"===b,series:M,barGapRatio:i.getBarGapRatio(A,e,s),dataItemGaps:T,isPointInsideMarquee:m,isStacked:A,axisStepWidth:R,averageGroupZ:V,group:K[r],timeAxisType:L.xAxis?.timeAxisType,colors:z,activeId:g,isLog:"log"===y?.scale,orientation:u,getDataItem:C,isSelectionEnabled:"none"!=v,isRtl:U,focusedItemInfo:p,hoveredItemInfo:I,getTextDimensions:f,defaultFontSize:k,seriesIndex:J,getItemAriaLabel:Y}))),ee&&t.jsx(a.AreaSeries,{yScale:$?h:l,plotAreaClipPathId:Z,lineType:X.lineType,color:X.areaColor||z[Q%z.length],isHorizontal:w,areaColorOpacity:_,isBottomSegmentCurved:ae,bottomCoords:void 0!==se&&q[se].some((e=>null!=e))?q[se]:void 0,lineSegments:ie,isLog:B,isHighlighted:re,seriesIndex:Q,groupWidth:R,isRtl:U,timeAxisType:P}),"line"===X.type&&t.jsx(r.LineSeries,{plotAreaClipPathId:Z,lineType:X.lineType,lineColor:te?d.colorSchemeVars.dvt.contrastLine:X.lineColor,lineWidth:te?1.25:X.lineWidth,lineStyle:X.lineStyle||"solid",color:X.lineColor||z[Q%z.length],lineSegmentCoords:ie,isHorizontal:w,isHighlighted:re,seriesIndex:Q,groupWidth:R,isRtl:U,timeAxisType:P}),!A&&("line"===X.type||ee)&&t.jsx(r.MarkersWithLabel,{yScale:$?h:l,xScale:n,groups:K,series:X,timeAxisType:P,color:z[Q%z.length],seriesIndex:Q,startIndex:e,endIndex:s,markerType:O[Q%O.length],orientation:u,isLog:B,activeId:g,getDataItem:C,isPointInsideMarquee:m,selectedIds:E,focusedItemIndex:p.seriesIndex!==Q||!p.isFocusVisible||L.isDataCursorEnabled&&L.dataCursorStyle?.isMarkerDisplayed?void 0:p.groupIndex,hoveredItemIndex:I?.isCurrent&&I.seriesIndex===Q?I.groupIndex:void 0,isSelectionEnabled:"single"===v||"multiple"===v,isDrillEnabled:"on"===b,defaultFontSize:k,dataLabelEffect:D,isHighContrast:j,getItemAriaLabel:Y})]})}))})}})}function p(e){return t.jsx(g,{datatip:()=>({content:""}),zoomAndScroll:"off",plotArea:{yMajorTick:{isRendered:!1},xMajorTick:{}},xAxis:{tickLabel:{autoRotate:!1,isRendered:!!e.xAxis?.timeAxisType}},series:e.series,groups:e.groups,getDataItem:e.getDataItem,yAxis:{tickLabel:{isRendered:!1}},overview:"off"})}e.ComboChart=g}));
2
+ //# sourceMappingURL=ComboChart-e61b5581.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"ComboChart-f3876b51.js","sources":["../../src/UNSAFE_ComboChart/ComboChart.tsx"],"sourcesContent":["/**\n * @license\n * Copyright (c) %FIRST_YEAR% %CURRENT_YEAR%, Oracle and/or its affiliates.\n * Licensed under The Universal Permissive License (UPL), Version 1.0\n * as shown at https://oss.oracle.com/licenses/upl/\n * @ignore\n */\n\nimport { ComboChartProps, LineAreaItem } from './ComboChart.types';\nimport {\n findNearestDataPoint,\n getStartAndEndAxesOffset\n} from '#utils/PRIVATE_chartUtils/layoutUtils';\nimport { AreaSeries } from '#PRIVATE_LineAreaComponents/AreaSeries';\nimport { getMarkers, getSeriesData } from '#utils/PRIVATE_chartUtils/utils';\nimport { MarkersWithLabel } from '#PRIVATE_Chart/MarkersWithLabel';\nimport { getLineAreaChartNavUtil } from '#utils/PRIVATE_chartUtils/navUtils';\nimport { Chart } from '#PRIVATE_Chart';\nimport { Scale, TimeAxisProps } from '#utils/UNSAFE_visTypes/chart';\nimport { useUser } from '#hooks/UNSAFE_useUser';\nimport { getColorRamp } from '#utils/UNSAFE_visUtils';\nimport { LineSeries } from '#PRIVATE_LineAreaComponents/LineSeries';\nimport { Point } from '#utils/PRIVATE_visSVGUtils';\nimport { getLineAreaSegments } from '#utils/PRIVATE_chartUtils/utils';\nimport { colorSchemeVars } from '@oracle/oraclejet-internal-theme-contract/themeContract.css';\nimport { getItemColor, getMarkerType } from '#utils/PRIVATE_chartUtils/dataStyleUtils';\nimport { BarGroup } from '#UNSAFE_BarChart/BarGroup';\nimport { getBarPosition } from '#UNSAFE_BarChart/utils/barLayoutUtils';\nimport { getLineAreaChartItemPosition } from '#PRIVATE_LineAreaComponents/utils/chartUtils';\nimport { getBarGapRatio } from '#UNSAFE_BarChart/utils/barSeriesUtils';\n\nconst LINE_WITH_AREA_OPACITY = 0.2;\n\n/**\n * The ComboChart displays information graphically using bars, lines and filled areas, making relationships among the data easier to understand.\n */\nexport function ComboChart<K extends string | number, D extends LineAreaItem<K>>({\n width,\n height,\n selectedIds = [],\n hiddenIds = [],\n highlightedIds,\n hideAndShowBehavior = 'none',\n orientation = 'vertical',\n yAxis,\n series,\n groups,\n isStacked = false,\n getDataItem,\n selectionMode = 'none',\n drilling = 'off',\n dataItemGaps = 0.5,\n dataLabelEffect = 'outline',\n ...props\n}: ComboChartProps<K, D>) {\n const { direction, forcedColors } = useUser();\n const isHighContrast = forcedColors === 'active';\n const filteredBarSeries = series.filter((currentSeries) => currentSeries.type === 'bar');\n const isRtl = direction === 'rtl';\n const isLog = yAxis?.scale === 'log';\n const timeAxisType = (props.xAxis as TimeAxisProps)?.timeAxisType;\n const hiddenSet = new Set(hiddenIds);\n const selectedSet = new Set(selectedIds);\n const highlightedSet = new Set(highlightedIds);\n const isHoriz = orientation === 'horizontal';\n const colors = getColorRamp();\n // TODO: JET-71332 ; should only be (number | undefined)[][]\n // remove the type inference from scatter chart item.\n let renderedSeries = getSeriesData<K, D>(\n series.length,\n groups.length,\n getDataItem,\n hiddenSet,\n isLog\n );\n\n const renderedGetDataItem = (seriesIndex: number, groupIndex: number): D | undefined => {\n if (!isStacked) return getDataItem(seriesIndex, groupIndex);\n return {\n ...getDataItem(seriesIndex, groupIndex),\n value: renderedSeries[seriesIndex][groupIndex]\n } as D;\n };\n\n const getGapRatio = () => {\n return 1;\n };\n\n const getNextChartItemFunc = (startIndex: number, endIndex: number) => {\n // TODO: JET-71332\n //@ts-ignore\n return getLineAreaChartNavUtil<D>(\n getDataItem,\n series.length,\n startIndex,\n endIndex,\n isStacked,\n isRtl,\n isHoriz\n );\n };\n const isSplitDualY = typeof props.y2Axis?.split === 'number';\n const getDataItemPos = (\n xScale: Scale,\n yScale: Scale,\n y2Scale: Scale,\n axisStepWidth: number,\n averageGroupZ: number,\n gapRatio: number\n ) => {\n const _getBarPosition = hasBar\n ? getBarPosition(\n filteredBarSeries,\n groups,\n getDataItem,\n xScale,\n yScale,\n y2Scale,\n hiddenSet,\n dataItemGaps,\n axisStepWidth,\n averageGroupZ,\n gapRatio,\n yAxis?.scale === 'log',\n isStacked,\n isRtl,\n isHoriz,\n isSplitDualY,\n timeAxisType\n )\n : undefined;\n\n return (seriesIndex: number, groupIndex: number) => {\n const seriesItem = series[seriesIndex];\n if (seriesItem.type === 'bar') {\n return _getBarPosition ? _getBarPosition(seriesIndex, groupIndex) : undefined;\n } else {\n return getLineAreaChartItemPosition(\n seriesIndex,\n groupIndex,\n renderedSeries,\n getDataItem,\n groups,\n isHoriz,\n xScale,\n yScale,\n timeAxisType\n );\n }\n };\n };\n\n const getMarkerColorAndType = (seriesIndex: number, groupIndex: number) => {\n const color = getItemColor(seriesIndex, groupIndex, series, getDataItem);\n const markerType = getMarkerType(seriesIndex, groupIndex, getDataItem);\n return { color, markerType };\n };\n\n const findNearest = (xScale: Scale, yScale: Scale, y2Scale: Scale) => {\n const getSeriesDataInfo = () => {\n return {\n offset: 0,\n dataWidth: 0\n };\n };\n\n const getYCoord = (value: number, yScale: Scale) => {\n return yScale.transform(value);\n };\n\n return findNearestDataPoint<K, D>(\n series,\n groups,\n xScale,\n yScale,\n renderedGetDataItem,\n isStacked,\n getSeriesDataInfo,\n getYCoord,\n isLog,\n 0,\n hiddenSet,\n timeAxisType,\n y2Scale\n );\n };\n const markers = getMarkers();\n\n const allLineSegmentCoords: Point[][] = [];\n\n const { hasBar, hasCenteredSeries, hasUncenteredSeries, hasArea } = (\n series as { lineType: string; type: string }[]\n ).reduce(\n (acc, s) => {\n return {\n hasArea: acc.hasArea || s.type === 'area' || s.type === 'lineWithArea',\n hasBar: acc.hasBar || s.type === 'bar',\n hasCenteredSeries:\n acc.hasCenteredSeries ||\n s.lineType === 'centeredSegmented' ||\n s.lineType === 'centeredStepped',\n hasUncenteredSeries:\n acc.hasUncenteredSeries || s.lineType === 'segmented' || s.lineType === 'stepped'\n };\n },\n { hasBar: false, hasCenteredSeries: false, hasUncenteredSeries: false, hasArea: false }\n );\n\n const getOffset = (groupCount: number) => {\n return getStartAndEndAxesOffset(\n hasCenteredSeries,\n hasUncenteredSeries,\n isHoriz,\n groupCount,\n hasBar\n );\n };\n\n return (\n <Chart\n width={width}\n height={height}\n selectedIds={selectedSet}\n hiddenIds={hiddenIds}\n hideAndShowBehavior={hideAndShowBehavior}\n orientation={orientation}\n yAxis={yAxis}\n series={series}\n defaultOverviewContentRenderer={() => {\n return <OverviewComboChart groups={groups} series={series} getDataItem={getDataItem} />;\n }}\n groups={groups}\n selectionMode={selectionMode}\n drilling={drilling}\n isStacked={isStacked}\n getDataItem={getDataItem}\n findNearest={findNearest}\n getDataItemPos={getDataItemPos}\n getMarkerInfo={getMarkerColorAndType}\n renderGridLinesInFront={hasArea}\n getNavUtil={getNextChartItemFunc}\n getGapRatio={getGapRatio}\n getStartAndEndAxesOffset={getOffset}\n isRtl={isRtl}\n {...props}>\n {({\n xStartIndex,\n xEndIndex,\n xScale,\n groupsInfo,\n yScale,\n y2Scale,\n activeId,\n focusedItemInfo,\n hoveredItemInfo,\n isPointInsideMarquee,\n getTextDimensions,\n defaultFontSize,\n axisStepWidth,\n averageGroupZ,\n getItemAriaLabel,\n plotAreaClipPathId\n }) => {\n let barSeriesIndex = -1;\n const leafGroups = groupsInfo.map(({ item }) => item);\n renderedSeries = getSeriesData<K, D>(\n series.length,\n leafGroups.length,\n getDataItem,\n hiddenSet,\n isLog\n );\n\n return (\n <>\n {renderedSeries.map((valueSeries, index) => {\n const currentSeries = series[index];\n const isAssociatedToY2 = currentSeries.associatedYAxis === 'y2';\n const areaOpacity =\n currentSeries.type === 'lineWithArea' ? LINE_WITH_AREA_OPACITY : 1;\n const isAreaRendered =\n currentSeries.type === 'area' || currentSeries.type === 'lineWithArea';\n const isContrastLineNeeded = currentSeries.type === 'area';\n\n if (valueSeries.length === 0) {\n return;\n }\n\n const lineSegmentCoords: Point[][] = getLineAreaSegments<K, D>(\n isAssociatedToY2 ? y2Scale : yScale,\n xScale,\n valueSeries,\n xStartIndex,\n xEndIndex,\n isLog,\n leafGroups,\n index,\n renderedGetDataItem,\n timeAxisType\n );\n allLineSegmentCoords[index] = lineSegmentCoords[0];\n const isBottomSegmentCurved =\n currentSeries.type !== 'bar'\n ? currentSeries.lineType === 'curved' &&\n isStacked &&\n renderedSeries.length > 1 &&\n index > 0\n : isStacked && renderedSeries.length > 1 && index > 0;\n\n const isHighlighted =\n highlightedIds === undefined ||\n highlightedSet.size === 0 ||\n highlightedSet.has(currentSeries.id);\n\n const prevCoords =\n isStacked && index != 0\n ? allLineSegmentCoords.reduce((prevValue, newValue, j) => {\n // find the index i such that i < index, and series i has at least\n // one or more data item unhidden. Only such series will can be\n // used as bottomCoord for current series. Otherwise we have to use\n // baseline coord\n if (j >= index) {\n return prevValue;\n }\n if (newValue.length > 0) {\n return j;\n }\n return prevValue;\n }, 0)\n : undefined;\n if (currentSeries.type === 'bar') barSeriesIndex = barSeriesIndex + 1;\n return (\n <>\n {currentSeries.type === 'bar' &&\n leafGroups.slice(xStartIndex, xEndIndex + 1).map((_, index) => {\n const barGroup = (\n <BarGroup\n plotAreaClipPathId={plotAreaClipPathId}\n yScale={yScale}\n y2Scale={y2Scale}\n xScale={xScale}\n splitDualY={isSplitDualY}\n groupIndex={index + xStartIndex}\n selectedIds={selectedSet}\n hiddenIds={hiddenSet}\n highlightedIds={highlightedIds ? highlightedSet : highlightedIds}\n isDrillEnabled={drilling === 'on'}\n series={filteredBarSeries}\n barGapRatio={getBarGapRatio(isStacked, xStartIndex, xEndIndex)}\n dataItemGaps={dataItemGaps}\n isPointInsideMarquee={isPointInsideMarquee}\n isStacked={isStacked}\n axisStepWidth={axisStepWidth}\n averageGroupZ={averageGroupZ!}\n group={leafGroups[index]}\n timeAxisType={(props.xAxis as TimeAxisProps)?.timeAxisType}\n colors={colors}\n activeId={activeId}\n isLog={yAxis?.scale === 'log'}\n orientation={orientation}\n getDataItem={getDataItem}\n isSelectionEnabled={selectionMode != 'none'}\n isRtl={isRtl}\n focusedItemInfo={focusedItemInfo}\n hoveredItemInfo={hoveredItemInfo}\n getTextDimensions={getTextDimensions}\n defaultFontSize={defaultFontSize}\n seriesIndex={barSeriesIndex}\n getItemAriaLabel={getItemAriaLabel}\n />\n );\n\n return barGroup;\n })}\n {isAreaRendered && (\n <AreaSeries\n yScale={isAssociatedToY2 ? y2Scale : yScale}\n plotAreaClipPathId={plotAreaClipPathId}\n lineType={currentSeries.lineType}\n color={currentSeries.areaColor || colors[index % colors.length]}\n isHorizontal={isHoriz}\n areaColorOpacity={areaOpacity}\n isBottomSegmentCurved={isBottomSegmentCurved}\n bottomCoords={\n prevCoords !== undefined &&\n allLineSegmentCoords[prevCoords].some((value) => value != null)\n ? allLineSegmentCoords[prevCoords]\n : undefined\n }\n lineSegments={lineSegmentCoords}\n isLog={isLog}\n isHighlighted={isHighlighted}\n seriesIndex={index}\n groupWidth={axisStepWidth}\n isRtl={isRtl}\n timeAxisType={timeAxisType}\n />\n )}\n {currentSeries.type === 'line' && (\n <LineSeries\n plotAreaClipPathId={plotAreaClipPathId}\n lineType={currentSeries.lineType}\n lineColor={\n isContrastLineNeeded\n ? colorSchemeVars.dvt.contrastLine\n : currentSeries.lineColor\n }\n lineWidth={isContrastLineNeeded ? 1.25 : currentSeries.lineWidth}\n lineStyle={currentSeries.lineStyle || 'solid'}\n color={currentSeries.lineColor || colors[index % colors.length]}\n lineSegmentCoords={lineSegmentCoords}\n isHorizontal={isHoriz}\n isHighlighted={isHighlighted}\n seriesIndex={index}\n groupWidth={axisStepWidth}\n isRtl={isRtl}\n timeAxisType={timeAxisType}\n />\n )}\n {\n /*for non stacked charts, markers should render in the order of series.\n some markers might get hidden behind area but this preserves the legacy behavior. */\n !isStacked && (currentSeries.type === 'line' || isAreaRendered) && (\n <MarkersWithLabel\n yScale={isAssociatedToY2 ? y2Scale : yScale}\n xScale={xScale}\n groups={leafGroups}\n series={currentSeries}\n timeAxisType={timeAxisType}\n color={\n colors[\n index % colors.length\n ] /* TODO : make this use getItemColor function from dataStyleUtils. */\n }\n seriesIndex={index}\n startIndex={xStartIndex}\n endIndex={xEndIndex}\n markerType={markers[index % markers.length]}\n orientation={orientation}\n isLog={isLog}\n activeId={activeId}\n getDataItem={getDataItem}\n isPointInsideMarquee={isPointInsideMarquee}\n selectedIds={selectedSet}\n focusedItemIndex={\n focusedItemInfo.seriesIndex === index &&\n focusedItemInfo.isFocusVisible &&\n !(props.isDataCursorEnabled && props.dataCursorStyle?.isMarkerDisplayed)\n ? focusedItemInfo.groupIndex\n : undefined\n }\n hoveredItemIndex={\n hoveredItemInfo?.isCurrent && hoveredItemInfo.seriesIndex === index\n ? hoveredItemInfo.groupIndex\n : undefined\n }\n isSelectionEnabled={\n selectionMode === 'single' || selectionMode === 'multiple'\n }\n isDrillEnabled={drilling === 'on'}\n defaultFontSize={defaultFontSize}\n dataLabelEffect={dataLabelEffect}\n isHighContrast={isHighContrast}\n getItemAriaLabel={getItemAriaLabel}\n />\n )\n }\n </>\n );\n })}\n </>\n //TODO - handle isStack part\n );\n }}\n </Chart>\n );\n}\n\nfunction OverviewComboChart<K extends string | number, D extends LineAreaItem<K>>(\n props: ComboChartProps<K, D>\n) {\n return (\n <ComboChart\n datatip={() => ({ content: '' })}\n zoomAndScroll=\"off\"\n plotArea={{\n yMajorTick: {\n isRendered: false\n },\n xMajorTick: {}\n }}\n xAxis={{\n tickLabel: {\n autoRotate: false,\n // @ts-ignore\n isRendered: props.xAxis?.timeAxisType ? true : false\n }\n }}\n series={props.series}\n groups={props.groups}\n getDataItem={props.getDataItem}\n yAxis={{\n tickLabel: {\n isRendered: false\n }\n }}\n overview=\"off\"\n />\n );\n}\n"],"names":["ComboChart","width","height","selectedIds","hiddenIds","highlightedIds","hideAndShowBehavior","orientation","yAxis","series","groups","isStacked","getDataItem","selectionMode","drilling","dataItemGaps","dataLabelEffect","props","direction","forcedColors","useUser","isHighContrast","filteredBarSeries","filter","currentSeries","type","isRtl","isLog","scale","timeAxisType","xAxis","hiddenSet","Set","selectedSet","highlightedSet","isHoriz","colors","getColorRamp","renderedSeries","getSeriesData","length","renderedGetDataItem","seriesIndex","groupIndex","value","isSplitDualY","y2Axis","split","markers","getMarkers","allLineSegmentCoords","hasBar","hasCenteredSeries","hasUncenteredSeries","hasArea","reduce","acc","s","lineType","_jsx","jsx","Chart","defaultOverviewContentRenderer","OverviewComboChart","findNearest","xScale","yScale","y2Scale","findNearestDataPoint","offset","dataWidth","transform","getDataItemPos","axisStepWidth","averageGroupZ","gapRatio","_getBarPosition","getBarPosition","undefined","getLineAreaChartItemPosition","getMarkerInfo","color","getItemColor","markerType","getMarkerType","renderGridLinesInFront","getNavUtil","startIndex","endIndex","getLineAreaChartNavUtil","getGapRatio","getStartAndEndAxesOffset","groupCount","children","xStartIndex","xEndIndex","groupsInfo","activeId","focusedItemInfo","hoveredItemInfo","isPointInsideMarquee","getTextDimensions","defaultFontSize","getItemAriaLabel","plotAreaClipPathId","barSeriesIndex","leafGroups","map","item","_Fragment","Fragment","valueSeries","index","isAssociatedToY2","associatedYAxis","areaOpacity","isAreaRendered","isContrastLineNeeded","lineSegmentCoords","getLineAreaSegments","isBottomSegmentCurved","isHighlighted","size","has","id","prevCoords","prevValue","newValue","j","_jsxs","slice","_","BarGroup","splitDualY","isDrillEnabled","barGapRatio","getBarGapRatio","group","isSelectionEnabled","AreaSeries","areaColor","isHorizontal","areaColorOpacity","bottomCoords","some","lineSegments","groupWidth","LineSeries","lineColor","colorSchemeVars","dvt","contrastLine","lineWidth","lineStyle","MarkersWithLabel","focusedItemIndex","isFocusVisible","isDataCursorEnabled","dataCursorStyle","isMarkerDisplayed","hoveredItemIndex","isCurrent","datatip","content","zoomAndScroll","plotArea","yMajorTick","isRendered","xMajorTick","tickLabel","autoRotate","overview"],"mappings":"kUAoCM,SAAUA,GAAiEC,MAC/EA,EAAKC,OACLA,EAAMC,YACNA,EAAc,GAAEC,UAChBA,EAAY,GAAEC,eACdA,EAAcC,oBACdA,EAAsB,OAAMC,YAC5BA,EAAc,WAAUC,MACxBA,EAAKC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YAAY,EAEZH,aAAYtJ,EAAMa,OAAOD,eAG7BpB,OAAQQ,EAAMR,OACdC,OAAQO,EAAMP,OACdE,YAAaK,EAAML,YACnBJ,MAAO,CACLiK,UAAW,CACTF,YAAY,IAGhBI,SAAS,OAGf"}
1
+ {"version":3,"file":"ComboChart-e61b5581.js","sources":["../../src/UNSAFE_ComboChart/ComboChart.tsx"],"sourcesContent":["/**\n * @license\n * Copyright (c) %FIRST_YEAR% %CURRENT_YEAR%, Oracle and/or its affiliates.\n * Licensed under The Universal Permissive License (UPL), Version 1.0\n * as shown at https://oss.oracle.com/licenses/upl/\n * @ignore\n */\n\nimport { ComboChartProps, LineAreaItem } from './ComboChart.types';\nimport {\n findNearestDataPoint,\n getStartAndEndAxesOffset\n} from '#utils/PRIVATE_chartUtils/layoutUtils';\nimport { AreaSeries } from '#PRIVATE_LineAreaComponents/AreaSeries';\nimport { getMarkers, getSeriesData } from '#utils/PRIVATE_chartUtils/utils';\nimport { MarkersWithLabel } from '#PRIVATE_Chart/MarkersWithLabel';\nimport { getLineAreaChartNavUtil } from '#utils/PRIVATE_chartUtils/navUtils';\nimport { Chart } from '#PRIVATE_Chart';\nimport { Scale, TimeAxisProps } from '#utils/UNSAFE_visTypes/chart';\nimport { useUser } from '#hooks/UNSAFE_useUser';\nimport { getColorRamp } from '#utils/UNSAFE_visUtils';\nimport { LineSeries } from '#PRIVATE_LineAreaComponents/LineSeries';\nimport { Point } from '#utils/PRIVATE_visSVGUtils';\nimport { getLineAreaSegments } from '#utils/PRIVATE_chartUtils/utils';\nimport { colorSchemeVars } from '@oracle/oraclejet-internal-theme-contract/themeContract.css';\nimport { getItemColor, getMarkerType } from '#utils/PRIVATE_chartUtils/dataStyleUtils';\nimport { BarGroup } from '#UNSAFE_BarChart/BarGroup';\nimport { getBarPosition } from '#UNSAFE_BarChart/utils/barLayoutUtils';\nimport { getLineAreaChartItemPosition } from '#PRIVATE_LineAreaComponents/utils/chartUtils';\nimport { getBarGapRatio } from '#UNSAFE_BarChart/utils/barSeriesUtils';\n\nconst LINE_WITH_AREA_OPACITY = 0.2;\n\n/**\n * The ComboChart displays information graphically using bars, lines and filled areas, making relationships among the data easier to understand.\n */\nexport function ComboChart<K extends string | number, D extends LineAreaItem<K>>({\n width,\n height,\n selectedIds = [],\n hiddenIds = [],\n highlightedIds,\n hideAndShowBehavior = 'none',\n orientation = 'vertical',\n yAxis,\n series,\n groups,\n isStacked = false,\n getDataItem,\n selectionMode = 'none',\n drilling = 'off',\n dataItemGaps = 0.5,\n dataLabelEffect = 'outline',\n ...props\n}: ComboChartProps<K, D>) {\n const { direction, forcedColors } = useUser();\n const isHighContrast = forcedColors === 'active';\n const filteredBarSeries = series.filter((currentSeries) => currentSeries.type === 'bar');\n const isRtl = direction === 'rtl';\n const isLog = yAxis?.scale === 'log';\n const timeAxisType = (props.xAxis as TimeAxisProps)?.timeAxisType;\n const hiddenSet = new Set(hiddenIds);\n const selectedSet = new Set(selectedIds);\n const highlightedSet = new Set(highlightedIds);\n const isHoriz = orientation === 'horizontal';\n const colors = getColorRamp();\n // TODO: JET-71332 ; should only be (number | undefined)[][]\n // remove the type inference from scatter chart item.\n let renderedSeries = getSeriesData<K, D>(\n series.length,\n groups.length,\n getDataItem,\n hiddenSet,\n isLog\n );\n\n const renderedGetDataItem = (seriesIndex: number, groupIndex: number): D | undefined => {\n if (!isStacked) return getDataItem(seriesIndex, groupIndex);\n return {\n ...getDataItem(seriesIndex, groupIndex),\n value: renderedSeries[seriesIndex][groupIndex]\n } as D;\n };\n\n const getGapRatio = () => {\n return 1;\n };\n\n const getNextChartItemFunc = (startIndex: number, endIndex: number) => {\n // TODO: JET-71332\n //@ts-ignore\n return getLineAreaChartNavUtil<D>(\n getDataItem,\n series.length,\n startIndex,\n endIndex,\n isStacked,\n isRtl,\n isHoriz\n );\n };\n const isSplitDualY = typeof props.y2Axis?.split === 'number';\n const getDataItemPos = (\n xScale: Scale,\n yScale: Scale,\n y2Scale: Scale,\n axisStepWidth: number,\n averageGroupZ: number,\n gapRatio: number\n ) => {\n const _getBarPosition = hasBar\n ? getBarPosition(\n filteredBarSeries,\n groups,\n getDataItem,\n xScale,\n yScale,\n y2Scale,\n hiddenSet,\n dataItemGaps,\n axisStepWidth,\n averageGroupZ,\n gapRatio,\n yAxis?.scale === 'log',\n isStacked,\n isRtl,\n isHoriz,\n isSplitDualY,\n timeAxisType\n )\n : undefined;\n\n return (seriesIndex: number, groupIndex: number) => {\n const seriesItem = series[seriesIndex];\n if (seriesItem.type === 'bar') {\n return _getBarPosition ? _getBarPosition(seriesIndex, groupIndex) : undefined;\n } else {\n return getLineAreaChartItemPosition(\n seriesIndex,\n groupIndex,\n renderedSeries,\n getDataItem,\n groups,\n isHoriz,\n xScale,\n yScale,\n timeAxisType\n );\n }\n };\n };\n\n const getMarkerColorAndType = (seriesIndex: number, groupIndex: number) => {\n const color = getItemColor(seriesIndex, groupIndex, series, getDataItem);\n const markerType = getMarkerType(seriesIndex, groupIndex, getDataItem);\n return { color, markerType };\n };\n\n const findNearest = (xScale: Scale, yScale: Scale, y2Scale: Scale) => {\n const getSeriesDataInfo = () => {\n return {\n offset: 0,\n dataWidth: 0\n };\n };\n\n const getYCoord = (value: number, yScale: Scale) => {\n return yScale.transform(value);\n };\n\n return findNearestDataPoint<K, D>(\n series,\n groups,\n xScale,\n yScale,\n renderedGetDataItem,\n isStacked,\n getSeriesDataInfo,\n getYCoord,\n isLog,\n 0,\n hiddenSet,\n timeAxisType,\n y2Scale\n );\n };\n const markers = getMarkers();\n\n const allLineSegmentCoords: Point[][] = [];\n\n const { hasBar, hasCenteredSeries, hasUncenteredSeries, hasArea } = (\n series as { lineType: string; type: string }[]\n ).reduce(\n (acc, s) => {\n return {\n hasArea: acc.hasArea || s.type === 'area' || s.type === 'lineWithArea',\n hasBar: acc.hasBar || s.type === 'bar',\n hasCenteredSeries:\n acc.hasCenteredSeries ||\n s.lineType === 'centeredSegmented' ||\n s.lineType === 'centeredStepped',\n hasUncenteredSeries:\n acc.hasUncenteredSeries || s.lineType === 'segmented' || s.lineType === 'stepped'\n };\n },\n { hasBar: false, hasCenteredSeries: false, hasUncenteredSeries: false, hasArea: false }\n );\n\n const getOffset = (groupCount: number) => {\n return getStartAndEndAxesOffset(\n hasCenteredSeries,\n hasUncenteredSeries,\n isHoriz,\n groupCount,\n hasBar\n );\n };\n\n return (\n <Chart\n width={width}\n height={height}\n selectedIds={selectedSet}\n hiddenIds={hiddenIds}\n hideAndShowBehavior={hideAndShowBehavior}\n orientation={orientation}\n yAxis={yAxis}\n series={series}\n defaultOverviewContentRenderer={() => {\n return <OverviewComboChart groups={groups} series={series} getDataItem={getDataItem} />;\n }}\n groups={groups}\n selectionMode={selectionMode}\n drilling={drilling}\n isStacked={isStacked}\n getDataItem={getDataItem}\n findNearest={findNearest}\n getDataItemPos={getDataItemPos}\n getMarkerInfo={getMarkerColorAndType}\n renderGridLinesInFront={hasArea}\n getNavUtil={getNextChartItemFunc}\n getGapRatio={getGapRatio}\n getStartAndEndAxesOffset={getOffset}\n isRtl={isRtl}\n {...props}>\n {({\n xStartIndex,\n xEndIndex,\n xScale,\n groupsInfo,\n yScale,\n y2Scale,\n activeId,\n focusedItemInfo,\n hoveredItemInfo,\n isPointInsideMarquee,\n getTextDimensions,\n defaultFontSize,\n axisStepWidth,\n averageGroupZ,\n getItemAriaLabel,\n plotAreaClipPathId\n }) => {\n let barSeriesIndex = -1;\n const leafGroups = groupsInfo.map(({ item }) => item);\n renderedSeries = getSeriesData<K, D>(\n series.length,\n leafGroups.length,\n getDataItem,\n hiddenSet,\n isLog\n );\n\n return (\n <>\n {renderedSeries.map((valueSeries, index) => {\n const currentSeries = series[index];\n const isAssociatedToY2 = currentSeries.associatedYAxis === 'y2';\n const areaOpacity =\n currentSeries.type === 'lineWithArea' ? LINE_WITH_AREA_OPACITY : 1;\n const isAreaRendered =\n currentSeries.type === 'area' || currentSeries.type === 'lineWithArea';\n const isContrastLineNeeded = currentSeries.type === 'area';\n\n if (valueSeries.length === 0) {\n return;\n }\n\n const lineSegmentCoords: Point[][] = getLineAreaSegments<K, D>(\n isAssociatedToY2 ? y2Scale : yScale,\n xScale,\n valueSeries,\n xStartIndex,\n xEndIndex,\n isLog,\n leafGroups,\n index,\n renderedGetDataItem,\n timeAxisType\n );\n allLineSegmentCoords[index] = lineSegmentCoords[0];\n const isBottomSegmentCurved =\n currentSeries.type !== 'bar'\n ? currentSeries.lineType === 'curved' &&\n isStacked &&\n renderedSeries.length > 1 &&\n index > 0\n : isStacked && renderedSeries.length > 1 && index > 0;\n\n const isHighlighted =\n highlightedIds === undefined ||\n highlightedSet.size === 0 ||\n highlightedSet.has(currentSeries.id);\n\n const prevCoords =\n isStacked && index != 0\n ? allLineSegmentCoords.reduce((prevValue, newValue, j) => {\n // find the index i such that i < index, and series i has at least\n // one or more data item unhidden. Only such series will can be\n // used as bottomCoord for current series. Otherwise we have to use\n // baseline coord\n if (j >= index) {\n return prevValue;\n }\n if (newValue.length > 0) {\n return j;\n }\n return prevValue;\n }, 0)\n : undefined;\n if (currentSeries.type === 'bar') barSeriesIndex = barSeriesIndex + 1;\n return (\n <>\n {currentSeries.type === 'bar' &&\n leafGroups.slice(xStartIndex, xEndIndex + 1).map((_, index) => {\n const barGroup = (\n <BarGroup\n plotAreaClipPathId={plotAreaClipPathId}\n yScale={yScale}\n y2Scale={y2Scale}\n xScale={xScale}\n splitDualY={isSplitDualY}\n groupIndex={index + xStartIndex}\n selectedIds={selectedSet}\n hiddenIds={hiddenSet}\n highlightedIds={highlightedIds ? highlightedSet : highlightedIds}\n isDrillEnabled={drilling === 'on'}\n series={filteredBarSeries}\n barGapRatio={getBarGapRatio(isStacked, xStartIndex, xEndIndex)}\n dataItemGaps={dataItemGaps}\n isPointInsideMarquee={isPointInsideMarquee}\n isStacked={isStacked}\n axisStepWidth={axisStepWidth}\n averageGroupZ={averageGroupZ!}\n group={leafGroups[index]}\n timeAxisType={(props.xAxis as TimeAxisProps)?.timeAxisType}\n colors={colors}\n activeId={activeId}\n isLog={yAxis?.scale === 'log'}\n orientation={orientation}\n getDataItem={getDataItem}\n isSelectionEnabled={selectionMode != 'none'}\n isRtl={isRtl}\n focusedItemInfo={focusedItemInfo}\n hoveredItemInfo={hoveredItemInfo}\n getTextDimensions={getTextDimensions}\n defaultFontSize={defaultFontSize}\n seriesIndex={barSeriesIndex}\n getItemAriaLabel={getItemAriaLabel}\n />\n );\n\n return barGroup;\n })}\n {isAreaRendered && (\n <AreaSeries\n yScale={isAssociatedToY2 ? y2Scale : yScale}\n plotAreaClipPathId={plotAreaClipPathId}\n lineType={currentSeries.lineType}\n color={currentSeries.areaColor || colors[index % colors.length]}\n isHorizontal={isHoriz}\n areaColorOpacity={areaOpacity}\n isBottomSegmentCurved={isBottomSegmentCurved}\n bottomCoords={\n prevCoords !== undefined &&\n allLineSegmentCoords[prevCoords].some((value) => value != null)\n ? allLineSegmentCoords[prevCoords]\n : undefined\n }\n lineSegments={lineSegmentCoords}\n isLog={isLog}\n isHighlighted={isHighlighted}\n seriesIndex={index}\n groupWidth={axisStepWidth}\n isRtl={isRtl}\n timeAxisType={timeAxisType}\n />\n )}\n {currentSeries.type === 'line' && (\n <LineSeries\n plotAreaClipPathId={plotAreaClipPathId}\n lineType={currentSeries.lineType}\n lineColor={\n isContrastLineNeeded\n ? colorSchemeVars.dvt.contrastLine\n : currentSeries.lineColor\n }\n lineWidth={isContrastLineNeeded ? 1.25 : currentSeries.lineWidth}\n lineStyle={currentSeries.lineStyle || 'solid'}\n color={currentSeries.lineColor || colors[index % colors.length]}\n lineSegmentCoords={lineSegmentCoords}\n isHorizontal={isHoriz}\n isHighlighted={isHighlighted}\n seriesIndex={index}\n groupWidth={axisStepWidth}\n isRtl={isRtl}\n timeAxisType={timeAxisType}\n />\n )}\n {\n /*for non stacked charts, markers should render in the order of series.\n some markers might get hidden behind area but this preserves the legacy behavior. */\n !isStacked && (currentSeries.type === 'line' || isAreaRendered) && (\n <MarkersWithLabel\n yScale={isAssociatedToY2 ? y2Scale : yScale}\n xScale={xScale}\n groups={leafGroups}\n series={currentSeries}\n timeAxisType={timeAxisType}\n color={\n colors[\n index % colors.length\n ] /* TODO : make this use getItemColor function from dataStyleUtils. */\n }\n seriesIndex={index}\n startIndex={xStartIndex}\n endIndex={xEndIndex}\n markerType={markers[index % markers.length]}\n orientation={orientation}\n isLog={isLog}\n activeId={activeId}\n getDataItem={getDataItem}\n isPointInsideMarquee={isPointInsideMarquee}\n selectedIds={selectedSet}\n focusedItemIndex={\n focusedItemInfo.seriesIndex === index &&\n focusedItemInfo.isFocusVisible &&\n !(props.isDataCursorEnabled && props.dataCursorStyle?.isMarkerDisplayed)\n ? focusedItemInfo.groupIndex\n : undefined\n }\n hoveredItemIndex={\n hoveredItemInfo?.isCurrent && hoveredItemInfo.seriesIndex === index\n ? hoveredItemInfo.groupIndex\n : undefined\n }\n isSelectionEnabled={\n selectionMode === 'single' || selectionMode === 'multiple'\n }\n isDrillEnabled={drilling === 'on'}\n defaultFontSize={defaultFontSize}\n dataLabelEffect={dataLabelEffect}\n isHighContrast={isHighContrast}\n getItemAriaLabel={getItemAriaLabel}\n />\n )\n }\n </>\n );\n })}\n </>\n //TODO - handle isStack part\n );\n }}\n </Chart>\n );\n}\n\nfunction OverviewComboChart<K extends string | number, D extends LineAreaItem<K>>(\n props: ComboChartProps<K, D>\n) {\n return (\n <ComboChart\n datatip={() => ({ content: '' })}\n zoomAndScroll=\"off\"\n plotArea={{\n yMajorTick: {\n isRendered: false\n },\n xMajorTick: {}\n }}\n xAxis={{\n tickLabel: {\n autoRotate: false,\n // @ts-ignore\n isRendered: props.xAxis?.timeAxisType ? true : false\n }\n }}\n series={props.series}\n groups={props.groups}\n getDataItem={props.getDataItem}\n yAxis={{\n tickLabel: {\n isRendered: false\n }\n }}\n overview=\"off\"\n />\n );\n}\n"],"names":["ComboChart","width","height","selectedIds","hiddenIds","highlightedIds","hideAndShowBehavior","orientation","yAxis","series","groups","isStacked","getDataItem","selectionMode","drilling","dataItemGaps","dataLabelEffect","props","direction","forcedColors","useUser","isHighContrast","filteredBarSeries","filter","currentSeries","type","isRtl","isLog","scale","timeAxisType","xAxis","hiddenSet","Set","selectedSet","highlightedSet","isHoriz","colors","getColorRamp","renderedSeries","getSeriesData","length","renderedGetDataItem","seriesIndex","groupIndex","value","isSplitDualY","y2Axis","split","markers","getMarkers","allLineSegmentCoords","hasBar","hasCenteredSeries","hasUncenteredSeries","hasArea","reduce","acc","s","lineType","_jsx","jsx","Chart","defaultOverviewContentRenderer","OverviewComboChart","findNearest","xScale","yScale","y2Scale","findNearestDataPoint","offset","dataWidth","transform","getDataItemPos","axisStepWidth","averageGroupZ","gapRatio","_getBarPosition","getBarPosition","undefined","getLineAreaChartItemPosition","getMarkerInfo","color","getItemColor","markerType","getMarkerType","renderGridLinesInFront","getNavUtil","startIndex","endIndex","getLineAreaChartNavUtil","getGapRatio","getStartAndEndAxesOffset","groupCount","children","xStartIndex","xEndIndex","groupsInfo","activeId","focusedItemInfo","hoveredItemInfo","isPointInsideMarquee","getTextDimensions","defaultFontSize","getItemAriaLabel","plotAreaClipPathId","barSeriesIndex","leafGroups","map","item","_Fragment","Fragment","valueSeries","index","isAssociatedToY2","associatedYAxis","areaOpacity","isAreaRendered","isContrastLineNeeded","lineSegmentCoords","getLineAreaSegments","isBottomSegmentCurved","isHighlighted","size","has","id","prevCoords","prevValue","newValue","j","_jsxs","slice","_","BarGroup","splitDualY","isDrillEnabled","barGapRatio","getBarGapRatio","group","isSelectionEnabled","AreaSeries","areaColor","isHorizontal","areaColorOpacity","bottomCoords","some","lineSegments","groupWidth","LineSeries","lineColor","colorSchemeVars","dvt","contrastLine","lineWidth","lineStyle","MarkersWithLabel","focusedItemIndex","isFocusVisible","isDataCursorEnabled","dataCursorStyle","isMarkerDisplayed","hoveredItemIndex","isCurrent","datatip","content","zoomAndScroll","plotArea","yMajorTick","isRendered","xMajorTick","tickLabel","autoRotate","overview"],"mappings":"kUAoCM,SAAUA,GAAiEC,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,CACTkK,QAAS,KAAO,CAAEC,QAAS,KAC3BC,cAAc,MACdC,SAAU,CACRC,WAAY,CACVC,YAAY,GAEdC,WAAY,CAAE,GAEhB1I,MAAO,CACL2I,UAAW,CACTC,YAAY,EAEZH,aAAYtJ,EAAMa,OAAOD,eAG7BpB,OAAQQ,EAAMR,OACdC,OAAQO,EAAMP,OACdE,YAAaK,EAAML,YACnBJ,MAAO,CACLiK,UAAW,CACTF,YAAY,IAGhBI,SAAS,OAGf"}
@@ -1,2 +1,2 @@
1
- define(['exports', 'preact/jsx-runtime', 'preact/compat', 'preact/hooks', './swatchData-ef8329c2', './clientHints-6d361eaa', './FormFieldContext-a024b891', './logger-0f873e29', './TabbableModeContext-a9c97640', './useTranslationBundle-27bf6340', 'css!./UserAssistanceStyles.styles.css', 'module', './UNSAFE_UserAssistance/themes/redwood/UserAssistanceVariants.css', './InlineUserAssistance-e406e352', './Flex-4bc3a394', 'css!./MessageBannerStyles.styles.css', 'module', './UNSAFE_MessageBanner/themes/redwood/MessageBannerVariants.css', 'preact', './LayerHost-7d4aa6d3', 'css!./TooltipContentStyles.styles.css', 'module', './hooks/UNSAFE_useTooltip/themes/redwood/TooltipContentVariants.css', './tooltipUtils-3c8a0253', 'css!./IconStyle.styles.css', './IconButton-232d63fc', 'css!./MessageStyles.styles.css', './MessageFormattingUtils-ea0be23e', './TransitionGroup-3b9d81b6', './MessagesContext-602a69a2', 'css!./HiddenAccessibleStyles.styles.css', 'css!./ComponentMessageStyles.styles.css', 'module', './UNSAFE_ComponentMessage/themes/redwood/ComponentMessageVariants.css', './Popup-062b66ff', './UNSAFE_Separator/themes/SeparatorStyles.css', 'css!./LabelStyles.styles.css', 'module', './UNSAFE_Label/themes/redwood/LabelVariants.css', './InputGroupContext-372087af', 'module', './UNSAFE_Popup/themes/redwood/PopupVariants.css', './UNSAFE_InputColor/themes/InputColorPickerDropdownStyles.css', './Sheet-fdd314ac', './ColorPicker-d8bda48d', './SectionedContent-bae8af88', './ColorSwatch-57d78771', './useDownToggle-80b61b43', './useClearIcon-05225968', './useFocusableTextField-8b755b15', './FormContext-6b0879a0', './useFormContext-b8cbbb21', './useHover-8b8a1496', './useTextField-3ab0a23b', './Label-3c17bcc9', './keyboardUtils-fb6219eb', './TextFieldInput-eb40adaa', 'css!./ObfuscatedTextFieldInputStyles.styles.css', './ReadonlyTextFieldInput-e5723c48', './StyledTextField-5e554e5b', './TextField-51b63f5f', 'css!./LiveRegionStyles.styles.css', './UNSAFE_TextField/themes/TextFieldStyles.css', 'css!./SkeletonStyles.styles.css', 'css!./TextFieldLoadingStyles.styles.css', 'css!./TextFieldStyles.styles.css', 'module', './UNSAFE_TextField/themes/redwood/TextFieldVariants.css', './CompactUserAssistance-5ef03b0a', './mergeProps-bcfa6a92', './ClearIcon-13bd61d3', './useCurrentValueReducer-faded381', './useSelectableTextField-900d2860'], (function(e,s,t,o,a,l,n,r,i,c,d,u,p,m,b,h,y,x,C,S,f,v,F,T,g,A,I,R,w,V,U,k,D,E,j,P,_,B,L,H,M,N,O,z,W,q,G,K,Z,$,J,Q,X,Y,ee,se,te,oe,ae,le,ne,re,ie,ce,de,ue,pe,me,be,he,ye,xe,Ce){"use strict";const Se=({anchorRef:e,assistiveText:t,swatchSize:a,palette:l,helpSourceLink:r,helpSourceText:i,isDisabled:d,isOpen:u,isReadonly:p,label:b,onClose:h,onCommit:y,messages:x,testId:C,userAssistanceDensity:S,value:f})=>{const[v,F]=o.useState(!1),[T,g]=o.useState(u),A=o.useCallback((e=>{F(e.placement.startsWith("top"))}),[]);T!==u&&(g(u),u||F(!1));const I=fe(),{colorPicker_label:R}=c.useTranslationBundle("@oracle/oraclejet-preact"),w=R(),V=s.jsx(W.ColorPicker,{height:I?void 0:"auto",onCommit:y,maxWidth:I?"100%":void 0,width:"100%",swatchSize:a,palette:l,testId:C,value:f}),U=!u||v&&!I||d||p||!(t||r||x&&x.length>0)||"efficient"!==S&&"reflow"!==S?void 0:s.jsx(n.FormFieldContext.Provider,{value:{isFocused:!0},children:s.jsx("div",{class:O.userAssistanceStyles,children:s.jsx(m.InlineUserAssistance,{assistiveText:t,fieldLabel:b,helpSourceLink:r,helpSourceText:i,messages:x,userAssistanceDensity:S})})}),k=C?C+(I?"_sheet":"_dropdown"):void 0,D=s.jsx("div",{class:O.dropdownStyles,children:s.jsx(q.SectionedContent,{paddingBlockEnd:"3.5x",paddingBlockStart:"3.5x",paddingInlineEnd:"3.5x",paddingInlineStart:"3.5x","aria-label":w,footer:U,hasFocusTrap:!0,main:V,role:"dialog",testId:k})});return I?s.jsx(z.Sheet,{isOpen:u,onClose:h,children:s.jsx(q.SectionedContent,{"aria-label":w,footer:U,hasFocusTrap:!0,main:V,role:"dialog",testId:k})}):s.jsx(q.StickyPositioningDropdown,{anchorRef:e,isOpen:u,onClose:h,onPosition:A,sizeOptions:{isMaxWidthAdjusted:!1,isMaxHeightAdjusted:!0},children:D})},fe=()=>"phone"===l.getClientHints().deviceType,ve=(e,s)=>{switch(s.type){case"colorChanged":case"colorSelected":return{...e,colorValue:s.data};case"reset":return{colorValue:s.data};default:return e}},Fe=({onCommit:e,onInput:s,value:t})=>{const[l,n]=o.useState(!1),r=o.useRef(null),i=o.useRef(null),c=o.useRef(!1),d=o.useRef(),u=o.useRef(t),p=o.useRef(t),m=o.useRef(t),b=o.useRef(!1),{state:h,dispatch:y}=(({value:e})=>{const[s,t]=o.useReducer(ve,{colorValue:e});return{state:s,dispatch:t}})({value:t});a.colorsAreDifferent(m.current,t)&&(m.current=t,a.colorsAreDifferent(t,h.colorValue)&&(y({type:"reset",data:t}),p.current=t,u.current=t)),o.useEffect((()=>{a.colorsAreDifferent(h.colorValue,p.current)&&(s({previousValue:p.current,value:h.colorValue}),p.current=h.colorValue),b.current&&a.colorsAreDifferent(h.colorValue,u.current)&&(e?.({previousValue:u.current,value:h.colorValue}),u.current=h.colorValue,b.current=!1)}),[e,s,h.colorValue]);const x=o.useCallback((e=>{y({type:"colorChanged",data:e.value})}),[y]),C=o.useCallback((()=>{a.colorsAreDifferent(u.current,h.colorValue)&&(e?.({value:h.colorValue,previousValue:u.current}),u.current=h.colorValue)}),[e,h.colorValue]),S=o.useCallback((()=>{c.current||n((e=>!e)),c.current=!1}),[]),f=o.useCallback((e=>{"outsideMousedown"===e.reason?(c.current=!0,clearTimeout(d.current),d.current=setTimeout((()=>{c.current=!1}),200)):"dismissed"!==e.reason&&"keyboardDismissed"!==e.reason||r.current?.focus(),n(!1)}),[]),v=o.useCallback((e=>{r.current?.focus(),b.current=!0,y({type:"colorSelected",data:e.value}),n(!1)}),[y]),F=o.useCallback((()=>{n(!0)}),[]),{triggerProps:T}=K.useDownToggle({isOpen:l,onToggle:F});return{colorIconActionHandler:S,colorPickerCommitHandler:v,dropdownCloseHandler:f,containerDropdownProps:T,colorValue:h.colorValue,iconRef:r,isOpen:l,colorCommitHandler:C,colorInputHandler:x,colorRef:i}},Te=t.forwardRef((({"aria-describedby":e,swatchSize:t,palette:l,value:r,isDisabled:i,isReadonly:d,labelEdge:u,labelStartWidth:p,isRequiredShown:b=!1,isRequired:h=!1,placeholder:y,hasClearIcon:x,columnSpan:C,textAlign:S,autoComplete:f,messages:v,assistiveText:F,helpSourceLink:T,helpSourceText:g,label:A,onCommit:I,onInput:R,testId:w,variant:V,userAssistanceDensity:U},k)=>{const{colorIconActionHandler:D,colorPickerCommitHandler:E,dropdownCloseHandler:j,colorValue:P,containerDropdownProps:_,iconRef:B,isOpen:L,colorCommitHandler:H,colorInputHandler:M,colorRef:N}=Fe({onCommit:I,onInput:R,value:r}),O=o.useRef(null),{inputColor_selectColor:z}=c.useTranslationBundle("@oracle/oraclejet-preact"),W=z(),{onKeyDown:q,...K}=_,{currentCommitValue:J,dispatch:se}=xe.useCurrentValueReducer({value:P}),oe=o.useCallback((e=>{se({type:"input",payload:e.value}),M?.(e)}),[M,se]),re=o.useCallback((e=>{se({type:"commit",payload:e.value}),H?.(e)}),[H,se]),{isDisabled:ie,isReadonly:ce,labelEdge:de,labelStartWidth:ue,textAlign:pe,userAssistanceDensity:me}=Q.useFormContext(),fe=i??ie,ve=d??ce,Te=u??de,Ae=p??ue,Ie=S??pe,Re=U??me,we=o.useRef(null),{focusProps:Ve,isFocused:Ue,methods:ke}=$.useFocusableTextField({isDisabled:fe,isReadonly:ve,enabledElementRef:N,readonlyElementRef:we}),{methods:De}=Ce.useSelectableTextField(N);o.useImperativeHandle(k,(()=>he.mergeProps(ke,De)),[ke,De]);const{hoverProps:Ee,isHover:je}=X.useHover({isDisabled:ve||fe||!1}),{formFieldContext:Pe,inputProps:_e,labelProps:Be,textFieldProps:Le,userAssistanceProps:He}=Y.useTextField({ariaDescribedBy:e,helpSourceLink:T,helpSourceText:g,isDisabled:fe,isFocused:Ue||L,isReadonly:ve,isRequiredShown:b,labelEdge:Te,messages:v,styleVariant:V,userAssistanceDensity:Re,value:P}),Me=o.useCallback((()=>{N.current?.focus(),oe?.({previousValue:P,value:void 0})}),[oe,P,N]),Ne=Z.useClearIcon({clearIcon:s.jsx(ye.ClearIcon,{onClick:Me,testId:`${w}_clearicon`}),display:x,hasValue:Pe.hasValue,isFocused:Ue,isEnabled:!ve&&!fe,isHover:je}),Oe=void 0!==A&&"inside"===Te,ze="none"!==Te?s.jsx(ee.Label,{...Be,children:A}):void 0,We={label:"none"!==Te?ze:void 0,labelEdge:"none"!==Te?Te:void 0,labelStartWidth:"none"!==Te?Ae:void 0},qe="none"===Te?A:void 0,Ge="efficient"===Re||"reflow"===Re?fe||ve?"efficient"!==Re?void 0:s.jsx(m.InlineUserAssistance,{userAssistanceDensity:Re,...He}):s.jsx(m.InlineUserAssistance,{assistiveText:F,fieldLabel:A,helpSourceLink:T,helpSourceText:g,messages:v,isRequiredShown:b,userAssistanceDensity:Re,...He}):void 0,Ke=o.useRef(null),Ze=O??Ke,$e="compact"===Re?s.jsx(be.CompactUserAssistance,{anchorRef:Ze,messages:v,assistiveText:F,...He}):void 0,Je=ve?s.jsx(ae.ReadonlyTextFieldInput,{"aria-describedby":_e["aria-describedby"],"aria-label":qe,"aria-labelledby":Be.id,as:"div",elementRef:we,textAlign:Ie,value:P,hasEmptyLabel:""===A&&"none"===Te,hasInsideLabel:Oe}):s.jsx(te.TextFieldInput,{"aria-labelledby":Be.id,"aria-label":qe,autoComplete:f,currentCommitValue:J,hasEmptyLabel:""===A&&"none"===Te,hasEndContent:!1,hasInsideLabel:void 0!==ze&&"inside"===Te,hasStartContent:!0,inputRef:N,isRequired:h,placeholder:y,textAlign:Ie,type:ge()?"text":void 0,value:P,onCommit:re,onInput:oe,onKeyDown:q,..._e});return s.jsxs(s.Fragment,{children:[s.jsx(n.FormFieldContext.Provider,{value:Pe,children:ve?s.jsx(le.ReadonlyTextField,{role:"presentation",columnSpan:C,compactUserAssistance:$e,inlineUserAssistance:Ge,onBlur:Ve.onFocusOut,onFocus:Ve.onFocusIn,ref:Ze,mainContent:Je,testId:w,...We}):s.jsx(ne.TextField,{endContent:Ne,columnSpan:C,compactUserAssistance:$e,inlineUserAssistance:Ge,mainContent:Je,onBlur:Ve.onFocusOut,onFocus:Ve.onFocusIn,startContent:s.jsx(G.ColorSwatch,{size:"xs","aria-haspopup":l?"grid":void 0,"aria-label":l?W:void 0,isDisabled:fe,isButton:!0,isTooltipDisabled:L,ref:B,testId:w?w+"_colorIcon":void 0,value:J,onToggle:fe||!l?void 0:D}),mainFieldRef:Ze,hasZeroStartMargin:!0,testId:w,...Le,...We,...Ee,...K})}),L&&!ve&&!fe&&s.jsx(Se,{anchorRef:O,assistiveText:F,helpSourceLink:T,helpSourceText:g,isDisabled:fe,isReadonly:ve,isOpen:L,label:A,onClose:j,onCommit:E,messages:v,testId:w?w+"_colorPicker":void 0,userAssistanceDensity:Re,value:P&&a.isValidColorValue(P)?P:void 0,palette:l,swatchSize:t})]})}));function ge(){const e=l.getClientHints().deviceType;return"phone"===e||"tablet"===e}Te.displayName="InputColor",e.InputColor=Te}));
2
- //# sourceMappingURL=InputColor-192a309b.js.map
1
+ define(['exports', 'preact/jsx-runtime', 'preact/compat', 'preact/hooks', './swatchData-ef8329c2', './clientHints-6d361eaa', './FormFieldContext-a024b891', './logger-0f873e29', './TabbableModeContext-a9c97640', './useTranslationBundle-27bf6340', 'css!./UserAssistanceStyles.styles.css', 'module', './UNSAFE_UserAssistance/themes/redwood/UserAssistanceVariants.css', './InlineUserAssistance-e406e352', './Flex-4bc3a394', 'css!./MessageBannerStyles.styles.css', 'module', './UNSAFE_MessageBanner/themes/redwood/MessageBannerVariants.css', 'preact', './LayerHost-7d4aa6d3', 'css!./TooltipContentStyles.styles.css', 'module', './hooks/UNSAFE_useTooltip/themes/redwood/TooltipContentVariants.css', './tooltipUtils-3c8a0253', 'css!./IconStyle.styles.css', './IconButton-232d63fc', 'css!./MessageStyles.styles.css', './MessageFormattingUtils-ea0be23e', './TransitionGroup-3b9d81b6', './MessagesContext-602a69a2', 'css!./HiddenAccessibleStyles.styles.css', 'css!./ComponentMessageStyles.styles.css', 'module', './UNSAFE_ComponentMessage/themes/redwood/ComponentMessageVariants.css', './Popup-062b66ff', './UNSAFE_Separator/themes/SeparatorStyles.css', 'css!./LabelStyles.styles.css', 'module', './UNSAFE_Label/themes/redwood/LabelVariants.css', './InputGroupContext-372087af', 'module', './UNSAFE_Popup/themes/redwood/PopupVariants.css', './UNSAFE_InputColor/themes/InputColorPickerDropdownStyles.css', './Sheet-fdd314ac', './ColorPicker-8ef0b6e0', './SectionedContent-bae8af88', './ColorSwatch-57d78771', './useDownToggle-80b61b43', './useClearIcon-05225968', './useFocusableTextField-8b755b15', './FormContext-6b0879a0', './useFormContext-b8cbbb21', './useHover-8b8a1496', './useTextField-3ab0a23b', './Label-3c17bcc9', './keyboardUtils-fb6219eb', './TextFieldInput-eb40adaa', 'css!./ObfuscatedTextFieldInputStyles.styles.css', './ReadonlyTextFieldInput-e5723c48', './StyledTextField-5e554e5b', './TextField-51b63f5f', 'css!./LiveRegionStyles.styles.css', './UNSAFE_TextField/themes/TextFieldStyles.css', 'css!./SkeletonStyles.styles.css', 'css!./TextFieldLoadingStyles.styles.css', 'css!./TextFieldStyles.styles.css', 'module', './UNSAFE_TextField/themes/redwood/TextFieldVariants.css', './CompactUserAssistance-5ef03b0a', './mergeProps-bcfa6a92', './ClearIcon-13bd61d3', './useCurrentValueReducer-faded381', './useSelectableTextField-900d2860'], (function(e,s,t,o,a,l,n,r,i,c,d,u,p,m,b,h,y,x,C,S,f,v,F,T,g,A,I,R,w,V,U,k,D,E,j,P,_,B,L,H,M,N,O,z,W,q,G,K,Z,$,J,Q,X,Y,ee,se,te,oe,ae,le,ne,re,ie,ce,de,ue,pe,me,be,he,ye,xe,Ce){"use strict";const Se=({anchorRef:e,assistiveText:t,swatchSize:a,palette:l,helpSourceLink:r,helpSourceText:i,isDisabled:d,isOpen:u,isReadonly:p,label:b,onClose:h,onCommit:y,messages:x,testId:C,userAssistanceDensity:S,value:f})=>{const[v,F]=o.useState(!1),[T,g]=o.useState(u),A=o.useCallback((e=>{F(e.placement.startsWith("top"))}),[]);T!==u&&(g(u),u||F(!1));const I=fe(),{colorPicker_label:R}=c.useTranslationBundle("@oracle/oraclejet-preact"),w=R(),V=s.jsx(W.ColorPicker,{height:I?void 0:"auto",onCommit:y,maxWidth:I?"100%":void 0,width:"100%",swatchSize:a,palette:l,testId:C,value:f}),U=!u||v&&!I||d||p||!(t||r||x&&x.length>0)||"efficient"!==S&&"reflow"!==S?void 0:s.jsx(n.FormFieldContext.Provider,{value:{isFocused:!0},children:s.jsx("div",{class:O.userAssistanceStyles,children:s.jsx(m.InlineUserAssistance,{assistiveText:t,fieldLabel:b,helpSourceLink:r,helpSourceText:i,messages:x,userAssistanceDensity:S})})}),k=C?C+(I?"_sheet":"_dropdown"):void 0,D=s.jsx("div",{class:O.dropdownStyles,children:s.jsx(q.SectionedContent,{paddingBlockEnd:"3.5x",paddingBlockStart:"3.5x",paddingInlineEnd:"3.5x",paddingInlineStart:"3.5x","aria-label":w,footer:U,hasFocusTrap:!0,main:V,role:"dialog",testId:k})});return I?s.jsx(z.Sheet,{isOpen:u,onClose:h,children:s.jsx(q.SectionedContent,{"aria-label":w,footer:U,hasFocusTrap:!0,main:V,role:"dialog",testId:k})}):s.jsx(q.StickyPositioningDropdown,{anchorRef:e,isOpen:u,onClose:h,onPosition:A,sizeOptions:{isMaxWidthAdjusted:!1,isMaxHeightAdjusted:!0},children:D})},fe=()=>"phone"===l.getClientHints().deviceType,ve=(e,s)=>{switch(s.type){case"colorChanged":case"colorSelected":return{...e,colorValue:s.data};case"reset":return{colorValue:s.data};default:return e}},Fe=({onCommit:e,onInput:s,value:t})=>{const[l,n]=o.useState(!1),r=o.useRef(null),i=o.useRef(null),c=o.useRef(!1),d=o.useRef(),u=o.useRef(t),p=o.useRef(t),m=o.useRef(t),b=o.useRef(!1),{state:h,dispatch:y}=(({value:e})=>{const[s,t]=o.useReducer(ve,{colorValue:e});return{state:s,dispatch:t}})({value:t});a.colorsAreDifferent(m.current,t)&&(m.current=t,a.colorsAreDifferent(t,h.colorValue)&&(y({type:"reset",data:t}),p.current=t,u.current=t)),o.useEffect((()=>{a.colorsAreDifferent(h.colorValue,p.current)&&(s({previousValue:p.current,value:h.colorValue}),p.current=h.colorValue),b.current&&a.colorsAreDifferent(h.colorValue,u.current)&&(e?.({previousValue:u.current,value:h.colorValue}),u.current=h.colorValue,b.current=!1)}),[e,s,h.colorValue]);const x=o.useCallback((e=>{y({type:"colorChanged",data:e.value})}),[y]),C=o.useCallback((()=>{a.colorsAreDifferent(u.current,h.colorValue)&&(e?.({value:h.colorValue,previousValue:u.current}),u.current=h.colorValue)}),[e,h.colorValue]),S=o.useCallback((()=>{c.current||n((e=>!e)),c.current=!1}),[]),f=o.useCallback((e=>{"outsideMousedown"===e.reason?(c.current=!0,clearTimeout(d.current),d.current=setTimeout((()=>{c.current=!1}),200)):"dismissed"!==e.reason&&"keyboardDismissed"!==e.reason||r.current?.focus(),n(!1)}),[]),v=o.useCallback((e=>{r.current?.focus(),b.current=!0,y({type:"colorSelected",data:e.value}),n(!1)}),[y]),F=o.useCallback((()=>{n(!0)}),[]),{triggerProps:T}=K.useDownToggle({isOpen:l,onToggle:F});return{colorIconActionHandler:S,colorPickerCommitHandler:v,dropdownCloseHandler:f,containerDropdownProps:T,colorValue:h.colorValue,iconRef:r,isOpen:l,colorCommitHandler:C,colorInputHandler:x,colorRef:i}},Te=t.forwardRef((({"aria-describedby":e,swatchSize:t,palette:l,value:r,isDisabled:i,isReadonly:d,labelEdge:u,labelStartWidth:p,isRequiredShown:b=!1,isRequired:h=!1,placeholder:y,hasClearIcon:x,columnSpan:C,textAlign:S,autoComplete:f,messages:v,assistiveText:F,helpSourceLink:T,helpSourceText:g,label:A,onCommit:I,onInput:R,testId:w,variant:V,userAssistanceDensity:U},k)=>{const{colorIconActionHandler:D,colorPickerCommitHandler:E,dropdownCloseHandler:j,colorValue:P,containerDropdownProps:_,iconRef:B,isOpen:L,colorCommitHandler:H,colorInputHandler:M,colorRef:N}=Fe({onCommit:I,onInput:R,value:r}),O=o.useRef(null),{inputColor_selectColor:z}=c.useTranslationBundle("@oracle/oraclejet-preact"),W=z(),{onKeyDown:q,...K}=_,{currentCommitValue:J,dispatch:se}=xe.useCurrentValueReducer({value:P}),oe=o.useCallback((e=>{se({type:"input",payload:e.value}),M?.(e)}),[M,se]),re=o.useCallback((e=>{se({type:"commit",payload:e.value}),H?.(e)}),[H,se]),{isDisabled:ie,isReadonly:ce,labelEdge:de,labelStartWidth:ue,textAlign:pe,userAssistanceDensity:me}=Q.useFormContext(),fe=i??ie,ve=d??ce,Te=u??de,Ae=p??ue,Ie=S??pe,Re=U??me,we=o.useRef(null),{focusProps:Ve,isFocused:Ue,methods:ke}=$.useFocusableTextField({isDisabled:fe,isReadonly:ve,enabledElementRef:N,readonlyElementRef:we}),{methods:De}=Ce.useSelectableTextField(N);o.useImperativeHandle(k,(()=>he.mergeProps(ke,De)),[ke,De]);const{hoverProps:Ee,isHover:je}=X.useHover({isDisabled:ve||fe||!1}),{formFieldContext:Pe,inputProps:_e,labelProps:Be,textFieldProps:Le,userAssistanceProps:He}=Y.useTextField({ariaDescribedBy:e,helpSourceLink:T,helpSourceText:g,isDisabled:fe,isFocused:Ue||L,isReadonly:ve,isRequiredShown:b,labelEdge:Te,messages:v,styleVariant:V,userAssistanceDensity:Re,value:P}),Me=o.useCallback((()=>{N.current?.focus(),oe?.({previousValue:P,value:void 0})}),[oe,P,N]),Ne=Z.useClearIcon({clearIcon:s.jsx(ye.ClearIcon,{onClick:Me,testId:`${w}_clearicon`}),display:x,hasValue:Pe.hasValue,isFocused:Ue,isEnabled:!ve&&!fe,isHover:je}),Oe=void 0!==A&&"inside"===Te,ze="none"!==Te?s.jsx(ee.Label,{...Be,children:A}):void 0,We={label:"none"!==Te?ze:void 0,labelEdge:"none"!==Te?Te:void 0,labelStartWidth:"none"!==Te?Ae:void 0},qe="none"===Te?A:void 0,Ge="efficient"===Re||"reflow"===Re?fe||ve?"efficient"!==Re?void 0:s.jsx(m.InlineUserAssistance,{userAssistanceDensity:Re,...He}):s.jsx(m.InlineUserAssistance,{assistiveText:F,fieldLabel:A,helpSourceLink:T,helpSourceText:g,messages:v,isRequiredShown:b,userAssistanceDensity:Re,...He}):void 0,Ke=o.useRef(null),Ze=O??Ke,$e="compact"===Re?s.jsx(be.CompactUserAssistance,{anchorRef:Ze,messages:v,assistiveText:F,...He}):void 0,Je=ve?s.jsx(ae.ReadonlyTextFieldInput,{"aria-describedby":_e["aria-describedby"],"aria-label":qe,"aria-labelledby":Be.id,as:"div",elementRef:we,textAlign:Ie,value:P,hasEmptyLabel:""===A&&"none"===Te,hasInsideLabel:Oe}):s.jsx(te.TextFieldInput,{"aria-labelledby":Be.id,"aria-label":qe,autoComplete:f,currentCommitValue:J,hasEmptyLabel:""===A&&"none"===Te,hasEndContent:!1,hasInsideLabel:void 0!==ze&&"inside"===Te,hasStartContent:!0,inputRef:N,isRequired:h,placeholder:y,textAlign:Ie,type:ge()?"text":void 0,value:P,onCommit:re,onInput:oe,onKeyDown:q,..._e});return s.jsxs(s.Fragment,{children:[s.jsx(n.FormFieldContext.Provider,{value:Pe,children:ve?s.jsx(le.ReadonlyTextField,{role:"presentation",columnSpan:C,compactUserAssistance:$e,inlineUserAssistance:Ge,onBlur:Ve.onFocusOut,onFocus:Ve.onFocusIn,ref:Ze,mainContent:Je,testId:w,...We}):s.jsx(ne.TextField,{endContent:Ne,columnSpan:C,compactUserAssistance:$e,inlineUserAssistance:Ge,mainContent:Je,onBlur:Ve.onFocusOut,onFocus:Ve.onFocusIn,startContent:s.jsx(G.ColorSwatch,{size:"xs","aria-haspopup":l?"grid":void 0,"aria-label":l?W:void 0,isDisabled:fe,isButton:!0,isTooltipDisabled:L,ref:B,testId:w?w+"_colorIcon":void 0,value:J,onToggle:fe||!l?void 0:D}),mainFieldRef:Ze,hasZeroStartMargin:!0,testId:w,...Le,...We,...Ee,...K})}),L&&!ve&&!fe&&s.jsx(Se,{anchorRef:O,assistiveText:F,helpSourceLink:T,helpSourceText:g,isDisabled:fe,isReadonly:ve,isOpen:L,label:A,onClose:j,onCommit:E,messages:v,testId:w?w+"_colorPicker":void 0,userAssistanceDensity:Re,value:P&&a.isValidColorValue(P)?P:void 0,palette:l,swatchSize:t})]})}));function ge(){const e=l.getClientHints().deviceType;return"phone"===e||"tablet"===e}Te.displayName="InputColor",e.InputColor=Te}));
2
+ //# sourceMappingURL=InputColor-5315b76a.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"InputColor-192a309b.js","sources":["../../src/UNSAFE_InputColor/InputColorPickerDropdown.tsx","../../src/UNSAFE_InputColor/useInputColorState.ts","../../src/UNSAFE_InputColor/useInputColor.ts","../../src/UNSAFE_InputColor/InputColor.tsx"],"sourcesContent":["/**\n * @license\n * Copyright (c) %FIRST_YEAR% %CURRENT_YEAR%, Oracle and/or its affiliates.\n * The Universal Permissive License (UPL), Version 1.0\n * as shown at https://oss.oracle.com/licenses/upl/\n * @ignore\n */\n\nimport { ComponentProps } from 'preact';\nimport { useCallback, useState } from 'preact/hooks';\nimport { BundleType } from '../resources/nls/bundle';\nimport { ColorPicker } from '#UNSAFE_ColorPicker';\nimport { type CloseDetail as DropdownCloseDetail } from '#UNSAFE_Dropdown';\nimport { getClientHints } from '#utils/PRIVATE_clientHints';\nimport { FormFieldContext } from '../hooks/UNSAFE_useFormFieldContext';\nimport { InlineUserAssistance } from '../UNSAFE_UserAssistance';\nimport { dropdownStyles, userAssistanceStyles } from './themes/InputColorPickerDropdownStyles.css';\nimport { PositionData } from '../UNSAFE_Floating';\nimport { StickyPositioningDropdown } from '#PRIVATE_FormControls';\nimport { SectionedContent } from '#PRIVATE_FormControls';\nimport { type CloseDetail as SheetCloseDetail, Sheet } from '#UNSAFE_Sheet';\nimport type { TestIdProps } from '#hooks/UNSAFE_useTestId';\nimport { useTranslationBundle } from '#hooks/UNSAFE_useTranslationBundle';\nimport { SizeOptions } from '#UNSAFE_Floating/Floating';\nimport { InputColorPublicProps as InputColorProps } from './InputColor.types';\n\ntype StickyPositioningDropdownProps = ComponentProps<typeof StickyPositioningDropdown>;\ntype ColorPickerProps = ComponentProps<typeof ColorPicker>;\ntype PickedPropsFromColorPicker = Pick<ColorPickerProps, 'value' | 'onCommit'>;\ntype PickedPropsFromDropdown = Omit<StickyPositioningDropdownProps, 'onClose'>;\ntype CloseDetail = SheetCloseDetail | DropdownCloseDetail;\ntype PickedPropsFromInputColor = Pick<\n InputColorProps,\n | 'swatchSize'\n | 'palette'\n | 'value'\n | 'aria-describedby'\n | 'assistiveText'\n | 'columnSpan'\n | 'helpSourceLink'\n | 'helpSourceText'\n | 'isDisabled'\n | 'isReadonly'\n | 'isRequired'\n | 'isRequiredShown'\n | 'label'\n | 'labelEdge'\n | 'labelStartWidth'\n | 'messages'\n | 'textAlign'\n | 'testId'\n | 'userAssistanceDensity'\n | 'variant'\n>;\n\ntype Props = PickedPropsFromColorPicker &\n PickedPropsFromInputColor &\n PickedPropsFromDropdown &\n TestIdProps & {\n /**\n * Called when the dropdown or sheet is supposed to be closed.\n */\n onClose?: (detail: CloseDetail) => void;\n };\n\n/**\n * Component that renders ColorPicker either inside a dropdown or sheet; in mobile,\n * it renders inside a sheet. Additionally, when a dropdown is being shown beneath\n * the component, we also show any user assistance text or messages below the picker\n * because otherwise that information would be obscured from view. When a sheet is being\n * shown, it will always display UA and messages at the bottom of the sheet.\n */\nconst InputColorPickerDropdown = ({\n anchorRef,\n assistiveText,\n swatchSize,\n palette,\n helpSourceLink,\n helpSourceText,\n isDisabled,\n isOpen,\n isReadonly,\n label,\n onClose,\n onCommit,\n messages,\n testId,\n userAssistanceDensity,\n value\n}: Props) => {\n // If the dropdown opens above the component, we don't want to show UA or messages.\n const [isDropdownAbove, setDropdownAbove] = useState(false);\n const [prevIsOpen, setPrevIsOpen] = useState(isOpen);\n const handleDropdownPosition = useCallback<\n NonNullable<StickyPositioningDropdownProps['onPosition']>\n >((data: PositionData) => {\n setDropdownAbove(data.placement.startsWith('top'));\n }, []);\n // Reset the flag when the dropdown is closed.\n if (prevIsOpen !== isOpen) {\n setPrevIsOpen(isOpen);\n if (!isOpen) {\n setDropdownAbove(false);\n }\n }\n\n const sizeOptions: SizeOptions = {\n isMaxWidthAdjusted: false,\n isMaxHeightAdjusted: true\n };\n\n // On mobile phones, the dropdown becomes a sheet.\n const shouldShowSheet = isPhone();\n\n const { colorPicker_label } = useTranslationBundle<BundleType>('@oracle/oraclejet-preact');\n const colorPickerAriaLabel = colorPicker_label();\n\n const colorPickerMainContent = (\n <ColorPicker\n height={!shouldShowSheet ? 'auto' : undefined}\n onCommit={onCommit}\n // for sheet, we want the width to grow to the width of the sheet, otherwise it will use the theme default.\n maxWidth={shouldShowSheet ? '100%' : undefined}\n width=\"100%\"\n swatchSize={swatchSize}\n palette={palette}\n testId={testId}\n value={value}\n />\n );\n\n const inlineUserAssistanceFooter =\n isOpen &&\n (!isDropdownAbove || shouldShowSheet) &&\n !isDisabled &&\n !isReadonly &&\n (assistiveText || helpSourceLink || (messages && messages.length > 0)) &&\n (userAssistanceDensity === 'efficient' || userAssistanceDensity === 'reflow') ? (\n <FormFieldContext.Provider value={{ isFocused: true }}>\n <div class={userAssistanceStyles}>\n <InlineUserAssistance\n assistiveText={assistiveText}\n fieldLabel={label}\n helpSourceLink={helpSourceLink}\n helpSourceText={helpSourceText}\n messages={messages}\n userAssistanceDensity={userAssistanceDensity}\n />\n </div>\n </FormFieldContext.Provider>\n ) : undefined;\n\n const contentTestId = testId ? testId + (shouldShowSheet ? '_sheet' : '_dropdown') : undefined;\n\n // The same content is displayed either in a dropdown or sheet: color picker and inline UA.\n // Add styling to the dropdown to enforce a fixed width.\n const dropdownContent = (\n <div class={dropdownStyles}>\n <SectionedContent\n paddingBlockEnd=\"3.5x\"\n paddingBlockStart=\"3.5x\"\n paddingInlineEnd=\"3.5x\"\n paddingInlineStart=\"3.5x\"\n aria-label={colorPickerAriaLabel}\n footer={inlineUserAssistanceFooter}\n hasFocusTrap={true}\n main={colorPickerMainContent}\n role=\"dialog\"\n testId={contentTestId}\n />\n </div>\n );\n\n const dropdown = shouldShowSheet ? (\n <Sheet isOpen={isOpen} onClose={onClose}>\n <SectionedContent\n aria-label={colorPickerAriaLabel}\n footer={inlineUserAssistanceFooter}\n hasFocusTrap={true}\n main={colorPickerMainContent}\n role=\"dialog\"\n testId={contentTestId}\n />\n </Sheet>\n ) : (\n <StickyPositioningDropdown\n anchorRef={anchorRef}\n isOpen={isOpen}\n onClose={onClose}\n onPosition={handleDropdownPosition}\n sizeOptions={sizeOptions}>\n {dropdownContent}\n </StickyPositioningDropdown>\n );\n\n return dropdown;\n};\n\nconst isPhone = () => {\n return getClientHints().deviceType === 'phone';\n};\n\nexport { InputColorPickerDropdown, type CloseDetail };\n","/**\n * @license\n * Copyright (c) %FIRST_YEAR% %CURRENT_YEAR%, Oracle and/or its affiliates.\n * The Universal Permissive License (UPL), Version 1.0\n * as shown at https://oss.oracle.com/licenses/upl/\n * @ignore\n */\n\nimport { useReducer } from 'preact/hooks';\nimport { type ColorValue } from '#utils/UNSAFE_color';\n\ntype InputColorState = {\n /**\n * Represents the current color value of the component. The user either selected\n * the color in the picker, or typed it into the color field.\n */\n colorValue?: ColorValue;\n};\n\ntype ColorChangedAction = { type: 'colorChanged'; data?: ColorValue };\ntype ColorResetAction = { type: 'reset'; data?: ColorValue };\ntype ColorSelectedAction = { type: 'colorSelected'; data?: ColorValue };\ntype InputColorReducerAction = ColorChangedAction | ColorResetAction | ColorSelectedAction;\n\n// Use a reducer function to manage InputColorState.\nconst inputColorReducer = (\n state: InputColorState,\n action: InputColorReducerAction\n): InputColorState => {\n switch (action.type) {\n case 'colorChanged': {\n return {\n ...state,\n colorValue: action.data\n };\n }\n case 'colorSelected': {\n return { ...state, colorValue: action.data };\n }\n case 'reset': {\n return {\n colorValue: action.data\n };\n }\n default:\n return state;\n }\n};\n\ntype Props = {\n /**\n * The value of the InputColor, or undefined.\n */\n value?: ColorValue;\n};\n\n/**\n * useInputColorState calls useReducer to determine the initial state. Any changes to that state\n * are managed by dispatching actions to the reducer function.\n */\nconst useInputColorState = ({ value }: Props) => {\n const [state, dispatch] = useReducer(inputColorReducer, {\n colorValue: value\n });\n\n return { state, dispatch };\n};\n\nexport { useInputColorState };\n","/**\n * @license\n * Copyright (c) %FIRST_YEAR% %CURRENT_YEAR%, Oracle and/or its affiliates.\n * The Universal Permissive License (UPL), Version 1.0\n * as shown at https://oss.oracle.com/licenses/upl/\n * @ignore\n */\n\nimport type { ComponentProps, RefObject } from 'preact';\nimport { useCallback, useEffect, useRef, useState } from 'preact/hooks';\nimport { ElementRef } from 'preact/compat';\nimport { colorsAreDifferent, type ColorValue } from '#utils/UNSAFE_color';\nimport { ColorPicker } from '#UNSAFE_ColorPicker';\nimport { ColorSwatch } from '#UNSAFE_ColorSwatch';\nimport { CloseDetail, InputColorPickerDropdown } from './InputColorPickerDropdown';\nimport { IconButton } from '#UNSAFE_IconButton';\nimport { useInputColorState } from './useInputColorState';\nimport type { ValueUpdateDetail } from '#utils/UNSAFE_valueUpdateDetail';\nimport { useDownToggle } from '#hooks/UNSAFE_useDownToggle';\nimport { InputColorPublicProps as InputColorProps } from './InputColor.types';\n\ntype SwatchHandle = ElementRef<typeof ColorSwatch>;\n\ntype ColorPickerProps = ComponentProps<typeof ColorPicker>;\ntype IconButtonProps = ComponentProps<typeof IconButton>;\ntype DropdownProps = ComponentProps<typeof InputColorPickerDropdown>;\n\ntype Props = {\n onCommit: InputColorProps['onCommit'];\n onInput: InputColorProps['onInput'];\n value: InputColorProps['value'];\n};\n\n/**\n * Hook that provides handlers and other functionality for InputColor.\n */\nconst useInputColor = ({ onCommit, onInput, value: currentValue }: Props) => {\n // Whether the dropdown is open.\n const [isOpen, setIsOpen] = useState<boolean>(false);\n\n // Ref to the swatch icon button.\n const iconRef: RefObject<SwatchHandle> = useRef<SwatchHandle>(null);\n\n // Ref to the text input which holds color value\n const colorRef: RefObject<HTMLInputElement> = useRef<HTMLInputElement>(null);\n\n // Keep track of whether the dropdown was just dismissed from an outside mousedown event.\n const outsideMousedownRef = useRef<boolean>(false);\n const outsideMousedownTimerRef = useRef<ReturnType<typeof setTimeout> | undefined>();\n\n // Keep track of the last color values passed to onInput and onCommit.\n const lastCommittedColorRef = useRef<ColorValue | undefined>(currentValue);\n const lastColorRef = useRef<ColorValue | undefined>(currentValue);\n\n // Keep track of the last controlled value passed from the parent, so we can detect a programmatic change.\n const lastValueFromParentRef = useRef<ColorValue | undefined>(currentValue);\n\n // Keep track of whether a color was selected in the color picker.\n const colorSelectedRef = useRef<boolean>(false);\n\n const { state, dispatch } = useInputColorState({ value: currentValue });\n\n // If a new value is being pushed from the parent, and that value differs from\n // the current value of the reducer, then this is a programmatic update\n // and we need to call 'reset' to update the reducer state. Otherwise, the only\n // time the reducer state is updated from the value is on mount.\n if (colorsAreDifferent(lastValueFromParentRef.current, currentValue)) {\n lastValueFromParentRef.current = currentValue;\n if (colorsAreDifferent(currentValue, state.colorValue)) {\n dispatch({ type: 'reset', data: currentValue });\n lastColorRef.current = currentValue;\n lastCommittedColorRef.current = currentValue;\n }\n }\n\n // Reducer updates are async, so wait until the state updates and then call our callbacks.\n useEffect(() => {\n if (colorsAreDifferent(state.colorValue, lastColorRef.current)) {\n onInput({ previousValue: lastColorRef.current, value: state.colorValue });\n lastColorRef.current = state.colorValue;\n }\n if (\n colorSelectedRef.current &&\n colorsAreDifferent(state.colorValue, lastCommittedColorRef.current)\n ) {\n onCommit?.({ previousValue: lastCommittedColorRef.current, value: state.colorValue });\n lastCommittedColorRef.current = state.colorValue;\n colorSelectedRef.current = false;\n }\n }, [onCommit, onInput, state.colorValue]);\n\n // Handle onInput from InputColor as values are entered in the input field.\n // We wait for the state to update before calling onInput.\n const colorInputHandler = useCallback<InputColorProps['onInput']>(\n (detail: ValueUpdateDetail<ColorValue>) => {\n dispatch({ type: 'colorChanged', data: detail.value });\n },\n [dispatch]\n );\n\n // Handle onCommit from InputColor, which is called when the user presses Enter or the field is blurred.\n const colorCommitHandler = useCallback<NonNullable<InputColorProps['onCommit']>>(() => {\n // If the current color value differs from the last committed value, then call onCommit.\n if (colorsAreDifferent(lastCommittedColorRef.current, state.colorValue)) {\n onCommit?.({ value: state.colorValue, previousValue: lastCommittedColorRef.current });\n lastCommittedColorRef.current = state.colorValue;\n }\n }, [onCommit, state.colorValue]);\n\n // Respond to onAction event from the swatch icon button. Toggles the color picker dropdown.\n const colorIconActionHandler = useCallback<NonNullable<IconButtonProps['onAction']>>(() => {\n // Only toggle the value of isOpen if we didn't just dismiss the dropdown.\n if (!outsideMousedownRef.current) {\n setIsOpen((prevIsOpen) => !prevIsOpen);\n }\n outsideMousedownRef.current = false;\n }, []);\n\n const dropdownCloseHandler = useCallback<NonNullable<DropdownProps['onClose']>>(\n (detail: CloseDetail) => {\n // Keep track of when the dropdown is closed via outside mousedown, including when the swatch icon\n // is clicked. We need this in order to toggle visibility of the picker and dropdown.\n if (detail.reason === 'outsideMousedown') {\n outsideMousedownRef.current = true;\n clearTimeout(outsideMousedownTimerRef.current);\n\n // Clear the flag after a short delay to ensure the dropdown can be opened again.\n outsideMousedownTimerRef.current = setTimeout(() => {\n outsideMousedownRef.current = false;\n }, 200);\n } else if (detail.reason === 'dismissed' || detail.reason === 'keyboardDismissed') {\n // Focus the swatch icon when the dropdown is closed.\n iconRef.current?.focus();\n }\n setIsOpen(false);\n },\n []\n );\n\n // Handle color selection in the picker.\n // - Updates the value in state.\n // - Closes the dropdown.\n // - Sets focus to the color field.\n const colorPickerCommitHandler = useCallback<ColorPickerProps['onCommit']>(\n (detail: ValueUpdateDetail<ColorValue>) => {\n // Set focus to the swatch when a color is selected.\n iconRef.current?.focus();\n\n // Set a ref indicating a color was selected.\n colorSelectedRef.current = true;\n dispatch({ type: 'colorSelected', data: detail.value });\n setIsOpen(false);\n },\n [dispatch]\n );\n\n // The Redwood UX design calls for the dropdown to open when the down arrow is pressed.\n // Handle opening the dropdown when the down arrow is pressed in the text edit field.\n const colorPickerDownHandler = useCallback(() => {\n setIsOpen(true);\n }, []);\n\n const { triggerProps: containerDropdownProps } = useDownToggle({\n isOpen,\n onToggle: colorPickerDownHandler\n });\n\n return {\n colorIconActionHandler,\n colorPickerCommitHandler,\n dropdownCloseHandler,\n containerDropdownProps,\n colorValue: state.colorValue,\n iconRef,\n isOpen,\n colorCommitHandler,\n colorInputHandler,\n colorRef\n };\n};\n\nexport { useInputColor };\n","/**\n * @license\n * Copyright (c) %FIRST_YEAR% %CURRENT_YEAR%, Oracle and/or its affiliates.\n * The Universal Permissive License (UPL), Version 1.0\n * as shown at https://oss.oracle.com/licenses/upl/\n * @ignore\n */\nimport { Ref } from 'preact';\nimport { forwardRef, ElementRef } from 'preact/compat';\nimport { useCallback, useImperativeHandle, useRef } from 'preact/hooks';\nimport { type BundleType } from '../resources/nls/bundle';\nimport { type ColorValue, isValidColorValue } from '#utils/UNSAFE_color';\nimport { InputColorPickerDropdown } from './InputColorPickerDropdown';\nimport { useTranslationBundle } from '#hooks/UNSAFE_useTranslationBundle';\nimport { ValueUpdateDetail } from '#utils/UNSAFE_valueUpdateDetail';\nimport { ColorSwatch } from '#UNSAFE_ColorSwatch';\nimport { useInputColor } from './useInputColor';\n\nimport { useClearIcon } from '../hooks/UNSAFE_useClearIcon';\nimport { FocusableHandle, useFocusableTextField } from '../hooks/UNSAFE_useFocusableTextField';\nimport { useFormContext } from '../hooks/UNSAFE_useFormContext';\nimport { FormFieldContext } from '../hooks/UNSAFE_useFormFieldContext';\nimport { useHover } from '../hooks/UNSAFE_useHover';\nimport { useTextField } from '../hooks/UNSAFE_useTextField';\nimport { Label } from '../UNSAFE_Label';\n\nimport {\n ReadonlyTextField,\n ReadonlyTextFieldInput,\n TextField,\n TextFieldInput\n} from '../UNSAFE_TextField';\nimport { CompactUserAssistance, InlineUserAssistance } from '../UNSAFE_UserAssistance';\nimport { getClientHints } from '../utils/PRIVATE_clientHints';\nimport { ClearIcon } from '../PRIVATE_ClearIcon/ClearIcon';\nimport { useCurrentValueReducer } from '../hooks/UNSAFE_useCurrentValueReducer';\nimport { SelectableHandle, useSelectableTextField } from '#hooks/UNSAFE_useSelectableTextField';\nimport { mergeProps } from '#utils/UNSAFE_mergeProps';\nimport { InputColorPublicProps as Props } from './InputColor.types';\n\ntype SwatchHandle = ElementRef<typeof ColorSwatch>;\n\ntype FocusSelectHandle = FocusableHandle & SelectableHandle;\n\n/**\n * An Input Color is a form field that allows users to select or input a color value,\n * using a color picker or by enterihg a HEX code.\n */\nexport const InputColor = forwardRef(\n (\n {\n 'aria-describedby': ariaDescribedBy,\n swatchSize,\n palette,\n value,\n isDisabled: propIsDisabled,\n isReadonly: propIsReadonly,\n labelEdge: propLabelEdge,\n labelStartWidth: propLabelStartWidth,\n isRequiredShown = false,\n isRequired = false,\n placeholder,\n hasClearIcon,\n columnSpan,\n textAlign: propTextAlign,\n autoComplete,\n messages,\n assistiveText,\n helpSourceLink,\n helpSourceText,\n label,\n onCommit,\n onInput,\n testId,\n variant,\n userAssistanceDensity: propUserAssistanceDensity\n }: Props,\n ref?: Ref<FocusSelectHandle>\n ) => {\n const {\n colorIconActionHandler,\n colorPickerCommitHandler,\n dropdownCloseHandler,\n colorValue,\n containerDropdownProps,\n iconRef,\n isOpen,\n colorCommitHandler,\n colorInputHandler,\n colorRef: enabledElementRef\n } = useInputColor({\n onCommit,\n onInput,\n value\n });\n\n const mainFieldRef = useRef<HTMLDivElement>(null);\n const { inputColor_selectColor } = useTranslationBundle<BundleType>('@oracle/oraclejet-preact');\n const colorIconAriaLabel = inputColor_selectColor();\n const { onKeyDown, ...inputContainerAriaProps } = containerDropdownProps;\n\n const { currentCommitValue, dispatch } = useCurrentValueReducer({ value: colorValue });\n const onInputAndDispatch = useCallback(\n (detail: ValueUpdateDetail<ColorValue>) => {\n // Should dispatch happen first? This will queue up a re-render, ordering should not cause issues (this is async)\n dispatch({ type: 'input', payload: detail.value });\n colorInputHandler?.(detail);\n },\n [colorInputHandler, dispatch]\n );\n const onCommitAndDispatch = useCallback(\n (detail: ValueUpdateDetail<ColorValue>) => {\n // Should dispatch happen first? This will queue up a re-render, ordering should not cause issues (this is async)\n dispatch({ type: 'commit', payload: detail.value });\n colorCommitHandler?.(detail);\n },\n [colorCommitHandler, dispatch]\n );\n\n const startContent = () => (\n <ColorSwatch\n size=\"xs\"\n aria-haspopup={palette ? 'grid' : undefined} // with only palette, grid is a better choice than dialog for now.\n aria-label={palette ? colorIconAriaLabel : undefined}\n isDisabled={isDisabled}\n isButton={true}\n isTooltipDisabled={isOpen}\n ref={iconRef as Ref<SwatchHandle>}\n testId={testId ? testId + '_colorIcon' : undefined}\n value={currentCommitValue as ColorValue}\n onToggle={isDisabled || !palette ? undefined : colorIconActionHandler}\n />\n );\n const {\n isDisabled: isFormDisabled,\n isReadonly: isFormReadonly,\n labelEdge: formLabelEdge,\n labelStartWidth: formLabelStartWidth,\n textAlign: formTextAlign,\n userAssistanceDensity: formUserAssistanceDensity\n } = useFormContext();\n // default to FormContext values if component properties are not specified\n const isDisabled = propIsDisabled ?? isFormDisabled;\n const isReadonly = propIsReadonly ?? isFormReadonly;\n const labelEdge = propLabelEdge ?? formLabelEdge;\n const labelStartWidth = propLabelStartWidth ?? formLabelStartWidth;\n const textAlign = propTextAlign ?? formTextAlign;\n const userAssistanceDensity = propUserAssistanceDensity ?? formUserAssistanceDensity;\n\n const readonlyElementRef = useRef<HTMLDivElement>(null);\n\n const {\n focusProps,\n isFocused,\n methods: focusMethods\n } = useFocusableTextField<HTMLInputElement, HTMLDivElement>({\n isDisabled,\n isReadonly,\n enabledElementRef,\n readonlyElementRef\n });\n\n const { methods: selectMethods } = useSelectableTextField<HTMLInputElement>(enabledElementRef);\n\n useImperativeHandle(ref!, () => mergeProps(focusMethods, selectMethods), [\n focusMethods,\n selectMethods\n ]);\n\n const { hoverProps, isHover } = useHover({ isDisabled: isReadonly || isDisabled || false });\n\n const { formFieldContext, inputProps, labelProps, textFieldProps, userAssistanceProps } =\n useTextField({\n ariaDescribedBy,\n helpSourceLink,\n helpSourceText,\n isDisabled,\n isFocused: isFocused || isOpen,\n isReadonly,\n isRequiredShown,\n labelEdge,\n messages,\n styleVariant: variant,\n userAssistanceDensity,\n value: colorValue\n });\n\n const onClickClearIcon = useCallback(() => {\n // Clicking the clear icon should put the focus on the input field\n enabledElementRef.current?.focus();\n // Send an event to clear the field's value\n onInputAndDispatch?.({ previousValue: colorValue, value: undefined });\n }, [onInputAndDispatch, colorValue, enabledElementRef]);\n\n const maybeClearIcon = useClearIcon({\n clearIcon: <ClearIcon onClick={onClickClearIcon} testId={`${testId}_clearicon`} />,\n display: hasClearIcon,\n hasValue: formFieldContext.hasValue,\n isFocused,\n isEnabled: !isReadonly && !isDisabled,\n isHover\n });\n\n const hasInsideLabel = label !== undefined && labelEdge === 'inside';\n\n const labelComp = labelEdge !== 'none' ? <Label {...labelProps}>{label}</Label> : undefined;\n\n const fieldLabelProps = {\n label: labelEdge !== 'none' ? labelComp : undefined,\n labelEdge: labelEdge !== 'none' ? labelEdge : undefined,\n labelStartWidth: labelEdge !== 'none' ? labelStartWidth : undefined\n };\n\n const ariaLabel = labelEdge === 'none' ? label : undefined;\n const isInlineDensity =\n userAssistanceDensity === 'efficient' || userAssistanceDensity === 'reflow';\n\n const inlineUserAssistance = isInlineDensity ? (\n isDisabled || isReadonly ? (\n // save space for user assistance if density is 'efficient', even though we don't\n // render user assistance for disabled or readonly fields\n userAssistanceDensity !== 'efficient' ? undefined : (\n <InlineUserAssistance\n userAssistanceDensity={userAssistanceDensity}\n {...userAssistanceProps}\n />\n )\n ) : (\n <InlineUserAssistance\n assistiveText={assistiveText}\n fieldLabel={label}\n helpSourceLink={helpSourceLink}\n helpSourceText={helpSourceText}\n messages={messages}\n isRequiredShown={isRequiredShown}\n userAssistanceDensity={userAssistanceDensity}\n {...userAssistanceProps}\n />\n )\n ) : undefined;\n\n const aRef = useRef<HTMLDivElement>(null);\n const anchorRef = mainFieldRef ?? aRef;\n\n const compactUserAssistance =\n userAssistanceDensity === 'compact' ? (\n <CompactUserAssistance\n anchorRef={anchorRef}\n messages={messages}\n assistiveText={assistiveText}\n {...userAssistanceProps}\n />\n ) : undefined;\n\n const mainContent = isReadonly ? (\n <ReadonlyTextFieldInput\n aria-describedby={inputProps['aria-describedby']}\n aria-label={ariaLabel}\n aria-labelledby={labelProps.id}\n as=\"div\"\n elementRef={readonlyElementRef}\n textAlign={textAlign}\n value={colorValue}\n hasEmptyLabel={label === '' && labelEdge === 'none'}\n hasInsideLabel={hasInsideLabel}\n />\n ) : (\n <TextFieldInput\n aria-labelledby={labelProps.id}\n aria-label={ariaLabel}\n autoComplete={autoComplete}\n currentCommitValue={currentCommitValue}\n hasEmptyLabel={label === '' && labelEdge === 'none'}\n hasEndContent={false}\n hasInsideLabel={labelComp !== undefined && labelEdge === 'inside'}\n hasStartContent={true}\n inputRef={enabledElementRef}\n isRequired={isRequired}\n placeholder={placeholder}\n textAlign={textAlign}\n type={isMobile() ? 'text' : undefined}\n value={colorValue}\n onCommit={\n onCommitAndDispatch as (detail: ValueUpdateDetail<string>) => {\n value: string;\n }\n }\n onInput={\n onInputAndDispatch as (detail: ValueUpdateDetail<string>) => {\n value: string;\n }\n }\n onKeyDown={onKeyDown}\n {...inputProps}\n />\n );\n\n return (\n <>\n <FormFieldContext.Provider value={formFieldContext}>\n {isReadonly ? (\n <ReadonlyTextField\n role=\"presentation\"\n columnSpan={columnSpan}\n compactUserAssistance={compactUserAssistance}\n inlineUserAssistance={inlineUserAssistance}\n onBlur={focusProps.onFocusOut}\n onFocus={focusProps.onFocusIn}\n ref={anchorRef}\n mainContent={mainContent}\n testId={testId}\n {...fieldLabelProps}></ReadonlyTextField>\n ) : (\n <TextField\n endContent={maybeClearIcon}\n columnSpan={columnSpan}\n compactUserAssistance={compactUserAssistance}\n inlineUserAssistance={inlineUserAssistance}\n mainContent={mainContent}\n onBlur={focusProps.onFocusOut}\n onFocus={focusProps.onFocusIn}\n startContent={startContent()}\n mainFieldRef={anchorRef}\n hasZeroStartMargin={true}\n testId={testId}\n {...textFieldProps}\n {...fieldLabelProps}\n {...hoverProps}\n {...inputContainerAriaProps}\n />\n )}\n </FormFieldContext.Provider>\n\n {isOpen && !isReadonly && !isDisabled && (\n <InputColorPickerDropdown\n anchorRef={mainFieldRef}\n assistiveText={assistiveText}\n helpSourceLink={helpSourceLink}\n helpSourceText={helpSourceText}\n isDisabled={isDisabled}\n isReadonly={isReadonly}\n isOpen={isOpen}\n label={label}\n onClose={dropdownCloseHandler}\n onCommit={colorPickerCommitHandler}\n messages={messages}\n testId={testId ? testId + '_colorPicker' : undefined}\n userAssistanceDensity={userAssistanceDensity}\n // memoize this for performance\n value={colorValue && isValidColorValue(colorValue) ? colorValue : undefined}\n palette={palette}\n swatchSize={swatchSize}\n />\n )}\n </>\n );\n }\n);\n\n/**\n * Helper function to determine whether the current device is a mobile device\n * @returns true if running on a mobile device, false otherwise\n */\nfunction isMobile() {\n const deviceType = getClientHints().deviceType;\n return deviceType === 'phone' || deviceType === 'tablet';\n}\nInputColor.displayName = 'InputColor';\n"],"names":["InputColorPickerDropdown","anchorRef","assistiveText","swatchSize","palette","helpSourceLink","helpSourceText","isDisabled","isOpen","isReadonly","label","onClose","onCommit","messages","testId","userAssistanceDensity","value","isDropdownAbove","setDropdownAbove","useState","prevIsOpen","setPrevIsOpen","handleDropdownPosition","useCallback","data","placement","startsWith","shouldShowSheet","isPhone","colorPicker_label","useTranslationBundle","colorPickerAriaLabel","colorPickerMainContent","_jsx","ColorPicker","height","undefined","maxWidth","width","inlineUserAssistanceFooter","length","FormFieldContext","Provider","isFocused","children","jsx","class","userAssistanceStyles","InlineUserAssistance","fieldLabel","contentTestId","dropdownContent","dropdownStyles","SectionedContent","paddingBlockEnd","paddingBlockStart","paddingInlineEnd","paddingInlineStart","footer","hasFocusTrap","main","role","Sheet","StickyPositioningDropdown","onPosition","sizeOptions","isMaxWidthAdjusted","isMaxHeightAdjusted","getClientHints","deviceType","inputColorReducer","state","action","type","colorValue","useInputColor","onInput","currentValue","setIsOpen","iconRef","useRef","colorRef","outsideMousedownRef","outsideMousedownTimerRef","lastCommittedColorRef","lastColorRef","lastValueFromParentRef","colorSelectedRef","dispatch","useReducer","useInputColorState","colorsAreDifferent","current","useEffect","previousValue","colorInputHandler","detail","colorCommitHandler","colorIconActionHandler","dropdownCloseHandler","reason","clearTimeout","setTimeout","focus","colorPickerCommitHandler","colorPickerDownHandler","triggerProps","containerDropdownProps","useDownToggle","onToggle","InputColor","forwardRef","ariaDescribedBy","propIsDisabled","propIsReadonly","labelEdge","propLabelEdge","labelStartWidth","propLabelStartWidth","isRequiredShown","isRequired","placeholder","hasClearIcon","columnSpan","textAlign","propTextAlign","autoComplete","variant","propUserAssistanceDensity","ref","enabledElementRef","mainFieldRef","inputColor_selectColor","colorIconAriaLabel","onKeyDown","inputContainerAriaProps","currentCommitValue","useCurrentValueReducer","onInputAndDispatch","payload","onCommitAndDispatch","isFormDisabled","isFormReadonly","formLabelEdge","formLabelStartWidth","formTextAlign","formUserAssistanceDensity","useFormContext","readonlyElementRef","focusProps","methods","focusMethods","useFocusableTextField","selectMethods","useSelectableTextField","useImperativeHandle","mergeProps","hoverProps","isHover","useHover","formFieldContext","inputProps","labelProps","textFieldProps","userAssistanceProps","useTextField","styleVariant","onClickClearIcon","maybeClearIcon","useClearIcon","clearIcon","ClearIcon","onClick","display","hasValue","isEnabled","hasInsideLabel","labelComp","Label","fieldLabelProps","ariaLabel","inlineUserAssistance","aRef","compactUserAssistance","CompactUserAssistance","mainContent","ReadonlyTextFieldInput","id","as","elementRef","hasEmptyLabel","TextFieldInput","hasEndContent","hasStartContent","inputRef","isMobile","_jsxs","ReadonlyTextField","onBlur","onFocusOut","onFocus","onFocusIn","TextField","endContent","startContent","ColorSwatch","size","isButton","isTooltipDisabled","hasZeroStartMargin","isValidColorValue","displayName"],"mappings":"ixFAwEA,MAAMA,GAA2B,EAC/BC,YACAC,gBACAC,aACAC,UACAC,iBACAC,iBACAC,aACAC,SACAC,aACAC,QACAC,UACAC,WACAC,WACAC,SACAC,wBACAC,YAGA,MAAOC,EAAiBC,GAAoBC,EAAQA,UAAC,IAC9CC,EAAYC,GAAiBF,EAAQA,SAACX,GACvCc,EAAyBC,eAE5BC,IACDN,EAAiBM,EAAKC,UAAUC,WAAW,OAAO,GACjD,IAECN,IAAeZ,IACjBa,EAAcb,GACTA,GACHU,GAAiB,IAIrB,MAMMS,EAAkBC,MAElBC,kBAAEA,GAAsBC,EAAoBA,qBAAa,4BACzDC,EAAuBF,IAEvBG,EACJC,MAACC,EAAAA,YACC,CAAAC,OAASR,OAA2BS,EAAT,OAC3BxB,SAAUA,EAEVyB,SAAUV,EAAkB,YAASS,EACrCE,MAAM,OACNnC,WAAYA,EACZC,QAASA,EACTU,OAAQA,EACRE,MAAOA,IAILuB,GACJ/B,GACES,IAAmBU,GACpBpB,GACAE,KACAP,GAAiBG,GAAmBQ,GAAYA,EAAS2B,OAAS,IACxC,cAA1BzB,GAAmE,WAA1BA,OAatCqB,EAZFH,MAACQ,EA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aAAclI,GACdgN,oBAAoB,EACpBnM,OAAQA,KACJqJ,MACAgB,MACAtB,MACAtB,MAKT/H,IAAWC,KAAeF,IACzB0B,EAAAA,IAACjC,GAAwB,CACvBC,UAAWkI,EACXjI,cAAeA,EACfG,eAAgBA,EAChBC,eAAgBA,EAChBC,WAAYA,GACZE,WAAYA,GACZD,OAAQA,EACRE,MAAOA,EACPC,QAASwF,EACTvF,SAAU4F,EACV3F,SAAUA,EACVC,OAAQA,EAASA,EAAS,oBAAiBsB,EAC3CrB,sBAAuBA,GAEvBC,MAAO0D,GAAcwI,EAAAA,kBAAkBxI,GAAcA,OAAatC,EAClEhC,QAASA,EACTD,WAAYA,MAIlB,IAQN,SAASgM,KACP,MAAM9H,EAAaD,mBAAiBC,WACpC,MAAsB,UAAfA,GAAyC,WAAfA,CACnC,CACAyC,GAAWqG,YAAc"}
1
+ {"version":3,"file":"InputColor-5315b76a.js","sources":["../../src/UNSAFE_InputColor/InputColorPickerDropdown.tsx","../../src/UNSAFE_InputColor/useInputColorState.ts","../../src/UNSAFE_InputColor/useInputColor.ts","../../src/UNSAFE_InputColor/InputColor.tsx"],"sourcesContent":["/**\n * @license\n * Copyright (c) %FIRST_YEAR% %CURRENT_YEAR%, Oracle and/or its affiliates.\n * The Universal Permissive License (UPL), Version 1.0\n * as shown at https://oss.oracle.com/licenses/upl/\n * @ignore\n */\n\nimport { ComponentProps } from 'preact';\nimport { useCallback, useState } from 'preact/hooks';\nimport { BundleType } from '../resources/nls/bundle';\nimport { ColorPicker } from '#UNSAFE_ColorPicker';\nimport { type CloseDetail as DropdownCloseDetail } from '#UNSAFE_Dropdown';\nimport { getClientHints } from '#utils/PRIVATE_clientHints';\nimport { FormFieldContext } from '../hooks/UNSAFE_useFormFieldContext';\nimport { InlineUserAssistance } from '../UNSAFE_UserAssistance';\nimport { dropdownStyles, userAssistanceStyles } from './themes/InputColorPickerDropdownStyles.css';\nimport { PositionData } from '../UNSAFE_Floating';\nimport { StickyPositioningDropdown } from '#PRIVATE_FormControls';\nimport { SectionedContent } from '#PRIVATE_FormControls';\nimport { type CloseDetail as SheetCloseDetail, Sheet } from '#UNSAFE_Sheet';\nimport type { TestIdProps } from '#hooks/UNSAFE_useTestId';\nimport { useTranslationBundle } from '#hooks/UNSAFE_useTranslationBundle';\nimport { SizeOptions } from '#UNSAFE_Floating/Floating';\nimport { InputColorPublicProps as InputColorProps } from './InputColor.types';\n\ntype StickyPositioningDropdownProps = ComponentProps<typeof StickyPositioningDropdown>;\ntype ColorPickerProps = ComponentProps<typeof ColorPicker>;\ntype PickedPropsFromColorPicker = Pick<ColorPickerProps, 'value' | 'onCommit'>;\ntype PickedPropsFromDropdown = Omit<StickyPositioningDropdownProps, 'onClose'>;\ntype CloseDetail = SheetCloseDetail | DropdownCloseDetail;\ntype PickedPropsFromInputColor = Pick<\n InputColorProps,\n | 'swatchSize'\n | 'palette'\n | 'value'\n | 'aria-describedby'\n | 'assistiveText'\n | 'columnSpan'\n | 'helpSourceLink'\n | 'helpSourceText'\n | 'isDisabled'\n | 'isReadonly'\n | 'isRequired'\n | 'isRequiredShown'\n | 'label'\n | 'labelEdge'\n | 'labelStartWidth'\n | 'messages'\n | 'textAlign'\n | 'testId'\n | 'userAssistanceDensity'\n | 'variant'\n>;\n\ntype Props = PickedPropsFromColorPicker &\n PickedPropsFromInputColor &\n PickedPropsFromDropdown &\n TestIdProps & {\n /**\n * Called when the dropdown or sheet is supposed to be closed.\n */\n onClose?: (detail: CloseDetail) => void;\n };\n\n/**\n * Component that renders ColorPicker either inside a dropdown or sheet; in mobile,\n * it renders inside a sheet. Additionally, when a dropdown is being shown beneath\n * the component, we also show any user assistance text or messages below the picker\n * because otherwise that information would be obscured from view. When a sheet is being\n * shown, it will always display UA and messages at the bottom of the sheet.\n */\nconst InputColorPickerDropdown = ({\n anchorRef,\n assistiveText,\n swatchSize,\n palette,\n helpSourceLink,\n helpSourceText,\n isDisabled,\n isOpen,\n isReadonly,\n label,\n onClose,\n onCommit,\n messages,\n testId,\n userAssistanceDensity,\n value\n}: Props) => {\n // If the dropdown opens above the component, we don't want to show UA or messages.\n const [isDropdownAbove, setDropdownAbove] = useState(false);\n const [prevIsOpen, setPrevIsOpen] = useState(isOpen);\n const handleDropdownPosition = useCallback<\n NonNullable<StickyPositioningDropdownProps['onPosition']>\n >((data: PositionData) => {\n setDropdownAbove(data.placement.startsWith('top'));\n }, []);\n // Reset the flag when the dropdown is closed.\n if (prevIsOpen !== isOpen) {\n setPrevIsOpen(isOpen);\n if (!isOpen) {\n setDropdownAbove(false);\n }\n }\n\n const sizeOptions: SizeOptions = {\n isMaxWidthAdjusted: false,\n isMaxHeightAdjusted: true\n };\n\n // On mobile phones, the dropdown becomes a sheet.\n const shouldShowSheet = isPhone();\n\n const { colorPicker_label } = useTranslationBundle<BundleType>('@oracle/oraclejet-preact');\n const colorPickerAriaLabel = colorPicker_label();\n\n const colorPickerMainContent = (\n <ColorPicker\n height={!shouldShowSheet ? 'auto' : undefined}\n onCommit={onCommit}\n // for sheet, we want the width to grow to the width of the sheet, otherwise it will use the theme default.\n maxWidth={shouldShowSheet ? '100%' : undefined}\n width=\"100%\"\n swatchSize={swatchSize}\n palette={palette}\n testId={testId}\n value={value}\n />\n );\n\n const inlineUserAssistanceFooter =\n isOpen &&\n (!isDropdownAbove || shouldShowSheet) &&\n !isDisabled &&\n !isReadonly &&\n (assistiveText || helpSourceLink || (messages && messages.length > 0)) &&\n (userAssistanceDensity === 'efficient' || userAssistanceDensity === 'reflow') ? (\n <FormFieldContext.Provider value={{ isFocused: true }}>\n <div class={userAssistanceStyles}>\n <InlineUserAssistance\n assistiveText={assistiveText}\n fieldLabel={label}\n helpSourceLink={helpSourceLink}\n helpSourceText={helpSourceText}\n messages={messages}\n userAssistanceDensity={userAssistanceDensity}\n />\n </div>\n </FormFieldContext.Provider>\n ) : undefined;\n\n const contentTestId = testId ? testId + (shouldShowSheet ? '_sheet' : '_dropdown') : undefined;\n\n // The same content is displayed either in a dropdown or sheet: color picker and inline UA.\n // Add styling to the dropdown to enforce a fixed width.\n const dropdownContent = (\n <div class={dropdownStyles}>\n <SectionedContent\n paddingBlockEnd=\"3.5x\"\n paddingBlockStart=\"3.5x\"\n paddingInlineEnd=\"3.5x\"\n paddingInlineStart=\"3.5x\"\n aria-label={colorPickerAriaLabel}\n footer={inlineUserAssistanceFooter}\n hasFocusTrap={true}\n main={colorPickerMainContent}\n role=\"dialog\"\n testId={contentTestId}\n />\n </div>\n );\n\n const dropdown = shouldShowSheet ? (\n <Sheet isOpen={isOpen} onClose={onClose}>\n <SectionedContent\n aria-label={colorPickerAriaLabel}\n footer={inlineUserAssistanceFooter}\n hasFocusTrap={true}\n main={colorPickerMainContent}\n role=\"dialog\"\n testId={contentTestId}\n />\n </Sheet>\n ) : (\n <StickyPositioningDropdown\n anchorRef={anchorRef}\n isOpen={isOpen}\n onClose={onClose}\n onPosition={handleDropdownPosition}\n sizeOptions={sizeOptions}>\n {dropdownContent}\n </StickyPositioningDropdown>\n );\n\n return dropdown;\n};\n\nconst isPhone = () => {\n return getClientHints().deviceType === 'phone';\n};\n\nexport { InputColorPickerDropdown, type CloseDetail };\n","/**\n * @license\n * Copyright (c) %FIRST_YEAR% %CURRENT_YEAR%, Oracle and/or its affiliates.\n * The Universal Permissive License (UPL), Version 1.0\n * as shown at https://oss.oracle.com/licenses/upl/\n * @ignore\n */\n\nimport { useReducer } from 'preact/hooks';\nimport { type ColorValue } from '#utils/UNSAFE_color';\n\ntype InputColorState = {\n /**\n * Represents the current color value of the component. The user either selected\n * the color in the picker, or typed it into the color field.\n */\n colorValue?: ColorValue;\n};\n\ntype ColorChangedAction = { type: 'colorChanged'; data?: ColorValue };\ntype ColorResetAction = { type: 'reset'; data?: ColorValue };\ntype ColorSelectedAction = { type: 'colorSelected'; data?: ColorValue };\ntype InputColorReducerAction = ColorChangedAction | ColorResetAction | ColorSelectedAction;\n\n// Use a reducer function to manage InputColorState.\nconst inputColorReducer = (\n state: InputColorState,\n action: InputColorReducerAction\n): InputColorState => {\n switch (action.type) {\n case 'colorChanged': {\n return {\n ...state,\n colorValue: action.data\n };\n }\n case 'colorSelected': {\n return { ...state, colorValue: action.data };\n }\n case 'reset': {\n return {\n colorValue: action.data\n };\n }\n default:\n return state;\n }\n};\n\ntype Props = {\n /**\n * The value of the InputColor, or undefined.\n */\n value?: ColorValue;\n};\n\n/**\n * useInputColorState calls useReducer to determine the initial state. Any changes to that state\n * are managed by dispatching actions to the reducer function.\n */\nconst useInputColorState = ({ value }: Props) => {\n const [state, dispatch] = useReducer(inputColorReducer, {\n colorValue: value\n });\n\n return { state, dispatch };\n};\n\nexport { useInputColorState };\n","/**\n * @license\n * Copyright (c) %FIRST_YEAR% %CURRENT_YEAR%, Oracle and/or its affiliates.\n * The Universal Permissive License (UPL), Version 1.0\n * as shown at https://oss.oracle.com/licenses/upl/\n * @ignore\n */\n\nimport type { ComponentProps, RefObject } from 'preact';\nimport { useCallback, useEffect, useRef, useState } from 'preact/hooks';\nimport { ElementRef } from 'preact/compat';\nimport { colorsAreDifferent, type ColorValue } from '#utils/UNSAFE_color';\nimport { ColorPicker } from '#UNSAFE_ColorPicker';\nimport { ColorSwatch } from '#UNSAFE_ColorSwatch';\nimport { CloseDetail, InputColorPickerDropdown } from './InputColorPickerDropdown';\nimport { IconButton } from '#UNSAFE_IconButton';\nimport { useInputColorState } from './useInputColorState';\nimport type { ValueUpdateDetail } from '#utils/UNSAFE_valueUpdateDetail';\nimport { useDownToggle } from '#hooks/UNSAFE_useDownToggle';\nimport { InputColorPublicProps as InputColorProps } from './InputColor.types';\n\ntype SwatchHandle = ElementRef<typeof ColorSwatch>;\n\ntype ColorPickerProps = ComponentProps<typeof ColorPicker>;\ntype IconButtonProps = ComponentProps<typeof IconButton>;\ntype DropdownProps = ComponentProps<typeof InputColorPickerDropdown>;\n\ntype Props = {\n onCommit: InputColorProps['onCommit'];\n onInput: InputColorProps['onInput'];\n value: InputColorProps['value'];\n};\n\n/**\n * Hook that provides handlers and other functionality for InputColor.\n */\nconst useInputColor = ({ onCommit, onInput, value: currentValue }: Props) => {\n // Whether the dropdown is open.\n const [isOpen, setIsOpen] = useState<boolean>(false);\n\n // Ref to the swatch icon button.\n const iconRef: RefObject<SwatchHandle> = useRef<SwatchHandle>(null);\n\n // Ref to the text input which holds color value\n const colorRef: RefObject<HTMLInputElement> = useRef<HTMLInputElement>(null);\n\n // Keep track of whether the dropdown was just dismissed from an outside mousedown event.\n const outsideMousedownRef = useRef<boolean>(false);\n const outsideMousedownTimerRef = useRef<ReturnType<typeof setTimeout> | undefined>();\n\n // Keep track of the last color values passed to onInput and onCommit.\n const lastCommittedColorRef = useRef<ColorValue | undefined>(currentValue);\n const lastColorRef = useRef<ColorValue | undefined>(currentValue);\n\n // Keep track of the last controlled value passed from the parent, so we can detect a programmatic change.\n const lastValueFromParentRef = useRef<ColorValue | undefined>(currentValue);\n\n // Keep track of whether a color was selected in the color picker.\n const colorSelectedRef = useRef<boolean>(false);\n\n const { state, dispatch } = useInputColorState({ value: currentValue });\n\n // If a new value is being pushed from the parent, and that value differs from\n // the current value of the reducer, then this is a programmatic update\n // and we need to call 'reset' to update the reducer state. Otherwise, the only\n // time the reducer state is updated from the value is on mount.\n if (colorsAreDifferent(lastValueFromParentRef.current, currentValue)) {\n lastValueFromParentRef.current = currentValue;\n if (colorsAreDifferent(currentValue, state.colorValue)) {\n dispatch({ type: 'reset', data: currentValue });\n lastColorRef.current = currentValue;\n lastCommittedColorRef.current = currentValue;\n }\n }\n\n // Reducer updates are async, so wait until the state updates and then call our callbacks.\n useEffect(() => {\n if (colorsAreDifferent(state.colorValue, lastColorRef.current)) {\n onInput({ previousValue: lastColorRef.current, value: state.colorValue });\n lastColorRef.current = state.colorValue;\n }\n if (\n colorSelectedRef.current &&\n colorsAreDifferent(state.colorValue, lastCommittedColorRef.current)\n ) {\n onCommit?.({ previousValue: lastCommittedColorRef.current, value: state.colorValue });\n lastCommittedColorRef.current = state.colorValue;\n colorSelectedRef.current = false;\n }\n }, [onCommit, onInput, state.colorValue]);\n\n // Handle onInput from InputColor as values are entered in the input field.\n // We wait for the state to update before calling onInput.\n const colorInputHandler = useCallback<InputColorProps['onInput']>(\n (detail: ValueUpdateDetail<ColorValue>) => {\n dispatch({ type: 'colorChanged', data: detail.value });\n },\n [dispatch]\n );\n\n // Handle onCommit from InputColor, which is called when the user presses Enter or the field is blurred.\n const colorCommitHandler = useCallback<NonNullable<InputColorProps['onCommit']>>(() => {\n // If the current color value differs from the last committed value, then call onCommit.\n if (colorsAreDifferent(lastCommittedColorRef.current, state.colorValue)) {\n onCommit?.({ value: state.colorValue, previousValue: lastCommittedColorRef.current });\n lastCommittedColorRef.current = state.colorValue;\n }\n }, [onCommit, state.colorValue]);\n\n // Respond to onAction event from the swatch icon button. Toggles the color picker dropdown.\n const colorIconActionHandler = useCallback<NonNullable<IconButtonProps['onAction']>>(() => {\n // Only toggle the value of isOpen if we didn't just dismiss the dropdown.\n if (!outsideMousedownRef.current) {\n setIsOpen((prevIsOpen) => !prevIsOpen);\n }\n outsideMousedownRef.current = false;\n }, []);\n\n const dropdownCloseHandler = useCallback<NonNullable<DropdownProps['onClose']>>(\n (detail: CloseDetail) => {\n // Keep track of when the dropdown is closed via outside mousedown, including when the swatch icon\n // is clicked. We need this in order to toggle visibility of the picker and dropdown.\n if (detail.reason === 'outsideMousedown') {\n outsideMousedownRef.current = true;\n clearTimeout(outsideMousedownTimerRef.current);\n\n // Clear the flag after a short delay to ensure the dropdown can be opened again.\n outsideMousedownTimerRef.current = setTimeout(() => {\n outsideMousedownRef.current = false;\n }, 200);\n } else if (detail.reason === 'dismissed' || detail.reason === 'keyboardDismissed') {\n // Focus the swatch icon when the dropdown is closed.\n iconRef.current?.focus();\n }\n setIsOpen(false);\n },\n []\n );\n\n // Handle color selection in the picker.\n // - Updates the value in state.\n // - Closes the dropdown.\n // - Sets focus to the color field.\n const colorPickerCommitHandler = useCallback<ColorPickerProps['onCommit']>(\n (detail: ValueUpdateDetail<ColorValue>) => {\n // Set focus to the swatch when a color is selected.\n iconRef.current?.focus();\n\n // Set a ref indicating a color was selected.\n colorSelectedRef.current = true;\n dispatch({ type: 'colorSelected', data: detail.value });\n setIsOpen(false);\n },\n [dispatch]\n );\n\n // The Redwood UX design calls for the dropdown to open when the down arrow is pressed.\n // Handle opening the dropdown when the down arrow is pressed in the text edit field.\n const colorPickerDownHandler = useCallback(() => {\n setIsOpen(true);\n }, []);\n\n const { triggerProps: containerDropdownProps } = useDownToggle({\n isOpen,\n onToggle: colorPickerDownHandler\n });\n\n return {\n colorIconActionHandler,\n colorPickerCommitHandler,\n dropdownCloseHandler,\n containerDropdownProps,\n colorValue: state.colorValue,\n iconRef,\n isOpen,\n colorCommitHandler,\n colorInputHandler,\n colorRef\n };\n};\n\nexport { useInputColor };\n","/**\n * @license\n * Copyright (c) %FIRST_YEAR% %CURRENT_YEAR%, Oracle and/or its affiliates.\n * The Universal Permissive License (UPL), Version 1.0\n * as shown at https://oss.oracle.com/licenses/upl/\n * @ignore\n */\nimport { Ref } from 'preact';\nimport { forwardRef, ElementRef } from 'preact/compat';\nimport { useCallback, useImperativeHandle, useRef } from 'preact/hooks';\nimport { type BundleType } from '../resources/nls/bundle';\nimport { type ColorValue, isValidColorValue } from '#utils/UNSAFE_color';\nimport { InputColorPickerDropdown } from './InputColorPickerDropdown';\nimport { useTranslationBundle } from '#hooks/UNSAFE_useTranslationBundle';\nimport { ValueUpdateDetail } from '#utils/UNSAFE_valueUpdateDetail';\nimport { ColorSwatch } from '#UNSAFE_ColorSwatch';\nimport { useInputColor } from './useInputColor';\n\nimport { useClearIcon } from '../hooks/UNSAFE_useClearIcon';\nimport { FocusableHandle, useFocusableTextField } from '../hooks/UNSAFE_useFocusableTextField';\nimport { useFormContext } from '../hooks/UNSAFE_useFormContext';\nimport { FormFieldContext } from '../hooks/UNSAFE_useFormFieldContext';\nimport { useHover } from '../hooks/UNSAFE_useHover';\nimport { useTextField } from '../hooks/UNSAFE_useTextField';\nimport { Label } from '../UNSAFE_Label';\n\nimport {\n ReadonlyTextField,\n ReadonlyTextFieldInput,\n TextField,\n TextFieldInput\n} from '../UNSAFE_TextField';\nimport { CompactUserAssistance, InlineUserAssistance } from '../UNSAFE_UserAssistance';\nimport { getClientHints } from '../utils/PRIVATE_clientHints';\nimport { ClearIcon } from '../PRIVATE_ClearIcon/ClearIcon';\nimport { useCurrentValueReducer } from '../hooks/UNSAFE_useCurrentValueReducer';\nimport { SelectableHandle, useSelectableTextField } from '#hooks/UNSAFE_useSelectableTextField';\nimport { mergeProps } from '#utils/UNSAFE_mergeProps';\nimport { InputColorPublicProps as Props } from './InputColor.types';\n\ntype SwatchHandle = ElementRef<typeof ColorSwatch>;\n\ntype FocusSelectHandle = FocusableHandle & SelectableHandle;\n\n/**\n * An Input Color is a form field that allows users to select or input a color value,\n * using a color picker or by enterihg a HEX code.\n */\nexport const InputColor = forwardRef(\n (\n {\n 'aria-describedby': ariaDescribedBy,\n swatchSize,\n palette,\n value,\n isDisabled: propIsDisabled,\n isReadonly: propIsReadonly,\n labelEdge: propLabelEdge,\n labelStartWidth: propLabelStartWidth,\n isRequiredShown = false,\n isRequired = false,\n placeholder,\n hasClearIcon,\n columnSpan,\n textAlign: propTextAlign,\n autoComplete,\n messages,\n assistiveText,\n helpSourceLink,\n helpSourceText,\n label,\n onCommit,\n onInput,\n testId,\n variant,\n userAssistanceDensity: propUserAssistanceDensity\n }: Props,\n ref?: Ref<FocusSelectHandle>\n ) => {\n const {\n colorIconActionHandler,\n colorPickerCommitHandler,\n dropdownCloseHandler,\n colorValue,\n containerDropdownProps,\n iconRef,\n isOpen,\n colorCommitHandler,\n colorInputHandler,\n colorRef: enabledElementRef\n } = useInputColor({\n onCommit,\n onInput,\n value\n });\n\n const mainFieldRef = useRef<HTMLDivElement>(null);\n const { inputColor_selectColor } = useTranslationBundle<BundleType>('@oracle/oraclejet-preact');\n const colorIconAriaLabel = inputColor_selectColor();\n const { onKeyDown, ...inputContainerAriaProps } = containerDropdownProps;\n\n const { currentCommitValue, dispatch } = useCurrentValueReducer({ value: colorValue });\n const onInputAndDispatch = useCallback(\n (detail: ValueUpdateDetail<ColorValue>) => {\n // Should dispatch happen first? This will queue up a re-render, ordering should not cause issues (this is async)\n dispatch({ type: 'input', payload: detail.value });\n colorInputHandler?.(detail);\n },\n [colorInputHandler, dispatch]\n );\n const onCommitAndDispatch = useCallback(\n (detail: ValueUpdateDetail<ColorValue>) => {\n // Should dispatch happen first? This will queue up a re-render, ordering should not cause issues (this is async)\n dispatch({ type: 'commit', payload: detail.value });\n colorCommitHandler?.(detail);\n },\n [colorCommitHandler, dispatch]\n );\n\n const startContent = () => (\n <ColorSwatch\n size=\"xs\"\n aria-haspopup={palette ? 'grid' : undefined} // with only palette, grid is a better choice than dialog for now.\n aria-label={palette ? colorIconAriaLabel : undefined}\n isDisabled={isDisabled}\n isButton={true}\n isTooltipDisabled={isOpen}\n ref={iconRef as Ref<SwatchHandle>}\n testId={testId ? testId + '_colorIcon' : undefined}\n value={currentCommitValue as ColorValue}\n onToggle={isDisabled || !palette ? undefined : colorIconActionHandler}\n />\n );\n const {\n isDisabled: isFormDisabled,\n isReadonly: isFormReadonly,\n labelEdge: formLabelEdge,\n labelStartWidth: formLabelStartWidth,\n textAlign: formTextAlign,\n userAssistanceDensity: formUserAssistanceDensity\n } = useFormContext();\n // default to FormContext values if component properties are not specified\n const isDisabled = propIsDisabled ?? isFormDisabled;\n const isReadonly = propIsReadonly ?? isFormReadonly;\n const labelEdge = propLabelEdge ?? formLabelEdge;\n const labelStartWidth = propLabelStartWidth ?? formLabelStartWidth;\n const textAlign = propTextAlign ?? formTextAlign;\n const userAssistanceDensity = propUserAssistanceDensity ?? formUserAssistanceDensity;\n\n const readonlyElementRef = useRef<HTMLDivElement>(null);\n\n const {\n focusProps,\n isFocused,\n methods: focusMethods\n } = useFocusableTextField<HTMLInputElement, HTMLDivElement>({\n isDisabled,\n isReadonly,\n enabledElementRef,\n readonlyElementRef\n });\n\n const { methods: selectMethods } = useSelectableTextField<HTMLInputElement>(enabledElementRef);\n\n useImperativeHandle(ref!, () => mergeProps(focusMethods, selectMethods), [\n focusMethods,\n selectMethods\n ]);\n\n const { hoverProps, isHover } = useHover({ isDisabled: isReadonly || isDisabled || false });\n\n const { formFieldContext, inputProps, labelProps, textFieldProps, userAssistanceProps } =\n useTextField({\n ariaDescribedBy,\n helpSourceLink,\n helpSourceText,\n isDisabled,\n isFocused: isFocused || isOpen,\n isReadonly,\n isRequiredShown,\n labelEdge,\n messages,\n styleVariant: variant,\n userAssistanceDensity,\n value: colorValue\n });\n\n const onClickClearIcon = useCallback(() => {\n // Clicking the clear icon should put the focus on the input field\n enabledElementRef.current?.focus();\n // Send an event to clear the field's value\n onInputAndDispatch?.({ previousValue: colorValue, value: undefined });\n }, [onInputAndDispatch, colorValue, enabledElementRef]);\n\n const maybeClearIcon = useClearIcon({\n clearIcon: <ClearIcon onClick={onClickClearIcon} testId={`${testId}_clearicon`} />,\n display: hasClearIcon,\n hasValue: formFieldContext.hasValue,\n isFocused,\n isEnabled: !isReadonly && !isDisabled,\n isHover\n });\n\n const hasInsideLabel = label !== undefined && labelEdge === 'inside';\n\n const labelComp = labelEdge !== 'none' ? <Label {...labelProps}>{label}</Label> : undefined;\n\n const fieldLabelProps = {\n label: labelEdge !== 'none' ? labelComp : undefined,\n labelEdge: labelEdge !== 'none' ? labelEdge : undefined,\n labelStartWidth: labelEdge !== 'none' ? labelStartWidth : undefined\n };\n\n const ariaLabel = labelEdge === 'none' ? label : undefined;\n const isInlineDensity =\n userAssistanceDensity === 'efficient' || userAssistanceDensity === 'reflow';\n\n const inlineUserAssistance = isInlineDensity ? (\n isDisabled || isReadonly ? (\n // save space for user assistance if density is 'efficient', even though we don't\n // render user assistance for disabled or readonly fields\n userAssistanceDensity !== 'efficient' ? undefined : (\n <InlineUserAssistance\n userAssistanceDensity={userAssistanceDensity}\n {...userAssistanceProps}\n />\n )\n ) : (\n <InlineUserAssistance\n assistiveText={assistiveText}\n fieldLabel={label}\n helpSourceLink={helpSourceLink}\n helpSourceText={helpSourceText}\n messages={messages}\n isRequiredShown={isRequiredShown}\n userAssistanceDensity={userAssistanceDensity}\n {...userAssistanceProps}\n />\n )\n ) : undefined;\n\n const aRef = useRef<HTMLDivElement>(null);\n const anchorRef = mainFieldRef ?? aRef;\n\n const compactUserAssistance =\n userAssistanceDensity === 'compact' ? (\n <CompactUserAssistance\n anchorRef={anchorRef}\n messages={messages}\n assistiveText={assistiveText}\n {...userAssistanceProps}\n />\n ) : undefined;\n\n const mainContent = isReadonly ? (\n <ReadonlyTextFieldInput\n aria-describedby={inputProps['aria-describedby']}\n aria-label={ariaLabel}\n aria-labelledby={labelProps.id}\n as=\"div\"\n elementRef={readonlyElementRef}\n textAlign={textAlign}\n value={colorValue}\n hasEmptyLabel={label === '' && labelEdge === 'none'}\n hasInsideLabel={hasInsideLabel}\n />\n ) : (\n <TextFieldInput\n aria-labelledby={labelProps.id}\n aria-label={ariaLabel}\n autoComplete={autoComplete}\n currentCommitValue={currentCommitValue}\n hasEmptyLabel={label === '' && labelEdge === 'none'}\n hasEndContent={false}\n hasInsideLabel={labelComp !== undefined && labelEdge === 'inside'}\n hasStartContent={true}\n inputRef={enabledElementRef}\n isRequired={isRequired}\n placeholder={placeholder}\n textAlign={textAlign}\n type={isMobile() ? 'text' : undefined}\n value={colorValue}\n onCommit={\n onCommitAndDispatch as (detail: ValueUpdateDetail<string>) => {\n value: string;\n }\n }\n onInput={\n onInputAndDispatch as (detail: ValueUpdateDetail<string>) => {\n value: string;\n }\n }\n onKeyDown={onKeyDown}\n {...inputProps}\n />\n );\n\n return (\n <>\n <FormFieldContext.Provider value={formFieldContext}>\n {isReadonly ? (\n <ReadonlyTextField\n role=\"presentation\"\n columnSpan={columnSpan}\n compactUserAssistance={compactUserAssistance}\n inlineUserAssistance={inlineUserAssistance}\n onBlur={focusProps.onFocusOut}\n onFocus={focusProps.onFocusIn}\n ref={anchorRef}\n mainContent={mainContent}\n testId={testId}\n {...fieldLabelProps}></ReadonlyTextField>\n ) : (\n <TextField\n endContent={maybeClearIcon}\n columnSpan={columnSpan}\n compactUserAssistance={compactUserAssistance}\n inlineUserAssistance={inlineUserAssistance}\n mainContent={mainContent}\n onBlur={focusProps.onFocusOut}\n onFocus={focusProps.onFocusIn}\n startContent={startContent()}\n mainFieldRef={anchorRef}\n hasZeroStartMargin={true}\n testId={testId}\n {...textFieldProps}\n {...fieldLabelProps}\n {...hoverProps}\n {...inputContainerAriaProps}\n />\n )}\n </FormFieldContext.Provider>\n\n {isOpen && !isReadonly && !isDisabled && (\n <InputColorPickerDropdown\n anchorRef={mainFieldRef}\n assistiveText={assistiveText}\n helpSourceLink={helpSourceLink}\n helpSourceText={helpSourceText}\n isDisabled={isDisabled}\n isReadonly={isReadonly}\n isOpen={isOpen}\n label={label}\n onClose={dropdownCloseHandler}\n onCommit={colorPickerCommitHandler}\n messages={messages}\n testId={testId ? testId + '_colorPicker' : undefined}\n userAssistanceDensity={userAssistanceDensity}\n // memoize this for performance\n value={colorValue && isValidColorValue(colorValue) ? colorValue : undefined}\n palette={palette}\n swatchSize={swatchSize}\n />\n )}\n </>\n );\n }\n);\n\n/**\n * Helper function to determine whether the current device is a mobile device\n * @returns true if running on a mobile device, false otherwise\n */\nfunction isMobile() {\n const deviceType = getClientHints().deviceType;\n return deviceType === 'phone' || deviceType === 'tablet';\n}\nInputColor.displayName = 'InputColor';\n"],"names":["InputColorPickerDropdown","anchorRef","assistiveText","swatchSize","palette","helpSourceLink","helpSourceText","isDisabled","isOpen","isReadonly","label","onClose","onCommit","messages","testId","userAssistanceDensity","value","isDropdownAbove","setDropdownAbove","useState","prevIsOpen","setPrevIsOpen","handleDropdownPosition","useCallback","data","placement","startsWith","shouldShowSheet","isPhone","colorPicker_label","useTranslationBundle","colorPickerAriaLabel","colorPickerMainContent","_jsx","ColorPicker","height","undefined","maxWidth","width","inlineUserAssistanceFooter","length","FormFieldContext","Provider","isFocused","children","jsx","class","userAssistanceStyles","InlineUserAssistance","fieldLabel","contentTestId","dropdownContent","dropdownStyles","SectionedContent","paddingBlockEnd","paddingBlockStart","paddingInlineEnd","paddingInlineStart","footer","hasFocusTrap","main","role","Sheet","StickyPositioningDropdown","onPosition","sizeOptions","isMaxWidthAdjusted","isMaxHeightAdjusted","getClientHints","deviceType","inputColorReducer","state","action","type","colorValue","useInputColor","onInput","currentValue","setIsOpen","iconRef","useRef","colorRef","outsideMousedownRef","outsideMousedownTimerRef","lastCommittedColorRef","lastColorRef","lastValueFromParentRef","colorSelectedRef","dispatch","useReducer","useInputColorState","colorsAreDifferent","current","useEffect","previousValue","colorInputHandler","detail","colorCommitHandler","colorIconActionHandler","dropdownCloseHandler","reason","clearTimeout","setTimeout","focus","colorPickerCommitHandler","colorPickerDownHandler","triggerProps","containerDropdownProps","useDownToggle","onToggle","InputColor","forwardRef","ariaDescribedBy","propIsDisabled","propIsReadonly","labelEdge","propLabelEdge","labelStartWidth","propLabelStartWidth","isRequiredShown","isRequired","placeholder","hasClearIcon","columnSpan","textAlign","propTextAlign","autoComplete","variant","propUserAssistanceDensity","ref","enabledElementRef","mainFieldRef","inputColor_selectColor","colorIconAriaLabel","onKeyDown","inputContainerAriaProps","currentCommitValue","useCurrentValueReducer","onInputAndDispatch","payload","onCommitAndDispatch","isFormDisabled","isFormReadonly","formLabelEdge","formLabelStartWidth","formTextAlign","formUserAssistanceDensity","useFormContext","readonlyElementRef","focusProps","methods","focusMethods","useFocusableTextField","selectMethods","useSelectableTextField","useImperativeHandle","mergeProps","hoverProps","isHover","useHover","formFieldContext","inputProps","labelProps","textFieldProps","userAssistanceProps","useTextField","styleVariant","onClickClearIcon","maybeClearIcon","useClearIcon","clearIcon","ClearIcon","onClick","display","hasValue","isEnabled","hasInsideLabel","labelComp","Label","fieldLabelProps","ariaLabel","inlineUserAssistance","aRef","compactUserAssistance","CompactUserAssistance","mainContent","ReadonlyTextFieldInput","id","as","elementRef","hasEmptyLabel","TextFieldInput","hasEndContent","hasStartContent","inputRef","isMobile","_jsxs","ReadonlyTextField","onBlur","onFocusOut","onFocus","onFocusIn","TextField","endContent","startContent","ColorSwatch","size","isButton","isTooltipDisabled","hasZeroStartMargin","isValidColorValue","displayName"],"mappings":"ixFAwEA,MAAMA,GAA2B,EAC/BC,YACAC,gBACAC,aACAC,UACAC,iBACAC,iBACAC,aACAC,SACAC,aACAC,QACAC,UACAC,WACAC,WACAC,SACAC,wBACAC,YAGA,MAAOC,EAAiBC,GAAoBC,EAAQA,UAAC,IAC9CC,EAAYC,GAAiBF,EAAQA,SAACX,GACvCc,EAAyBC,eAE5BC,IACDN,EAAiBM,EAAKC,UAAUC,WAAW,OAAO,GACjD,IAECN,IAAeZ,IACjBa,EAAcb,GACTA,GACHU,GAAiB,IAIrB,MAMMS,EAAkBC,MAElBC,kBAAEA,GAAsBC,EAAoBA,qBAAa,4BACzDC,EAAuBF,IAEvBG,EACJC,MAACC,EAAAA,YACC,CAAAC,OAASR,OAA2BS,EAAT,OAC3BxB,SAAUA,EAEVyB,SAAUV,EAAkB,YAASS,EACrCE,MAAM,OACNnC,WAAYA,EACZC,QAASA,EACTU,OAAQA,EACRE,MAAOA,IAILuB,GACJ/B,GACES,IAAmBU,GACpBpB,GACAE,KACAP,GAAiBG,GAAmBQ,GAAYA,EAAS2B,OAAS,IACxC,cAA1BzB,GAAmE,WAA1BA,OAatCqB,EAZFH,MAACQ,EAAAA,iBAAiBC,SAAQ,CAAC1B,MAAO,CAAE2B,WAAW,GAAMC,SACnDX,EAAKY,IAAA,MAAA,CAAAC,MAAOC,gCACVd,EAAAA,IAACe,EAAAA,qBACC,CAAA9C,cAAeA,EACf+C,WAAYvC,EACZL,eAAgBA,EAChBC,eAAgBA,EAChBO,SAAUA,EACVE,sBAAuBA,QAM3BmC,EAAgBpC,EAASA,GAAUa,EAAkB,SAAW,kBAAeS,EAI/Ee,EACJlB,EAAAA,IAAA,MAAA,CAAKa,MAAOM,EAAcA,eACxBR,SAA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O0D,GAAcwI,EAAAA,kBAAkBxI,GAAcA,OAAatC,EAClEhC,QAASA,EACTD,WAAYA,MAIlB,IAQN,SAASgM,KACP,MAAM9H,EAAaD,mBAAiBC,WACpC,MAAsB,UAAfA,GAAyC,WAAfA,CACnC,CACAyC,GAAWqG,YAAc"}
@@ -0,0 +1,2 @@
1
+ define(['exports', 'preact/jsx-runtime', 'preact/compat', 'preact/hooks', './Calendar-47e39e3e', './HiddenAccessible-037ef42d', './IconButton-232d63fc', './clientHints-6d361eaa', './FormFieldContext-a024b891', './logger-0f873e29', './TabbableModeContext-a9c97640', './useTranslationBundle-27bf6340', 'css!./UserAssistanceStyles.styles.css', 'module', './UNSAFE_UserAssistance/themes/redwood/UserAssistanceVariants.css', './InlineUserAssistance-e406e352', './Flex-4bc3a394', 'css!./MessageBannerStyles.styles.css', 'module', './UNSAFE_MessageBanner/themes/redwood/MessageBannerVariants.css', 'preact', './LayerHost-7d4aa6d3', 'css!./TooltipContentStyles.styles.css', 'module', './hooks/UNSAFE_useTooltip/themes/redwood/TooltipContentVariants.css', './tooltipUtils-3c8a0253', 'css!./IconStyle.styles.css', 'css!./MessageStyles.styles.css', './MessageFormattingUtils-ea0be23e', './TransitionGroup-3b9d81b6', './MessagesContext-602a69a2', 'css!./HiddenAccessibleStyles.styles.css', 'css!./ComponentMessageStyles.styles.css', 'module', './UNSAFE_ComponentMessage/themes/redwood/ComponentMessageVariants.css', './Popup-062b66ff', './UNSAFE_Separator/themes/SeparatorStyles.css', 'css!./LabelStyles.styles.css', 'module', './UNSAFE_Label/themes/redwood/LabelVariants.css', './InputGroupContext-372087af', 'module', './UNSAFE_Popup/themes/redwood/PopupVariants.css', './UNSAFE_InputDatePicker/themes/InputDatePickerDropdownStyles.css', './Sheet-fdd314ac', './DatePicker-568944a7', './SectionedContent-bae8af88', './stringUtils-4ffd9d59', './FormContext-6b0879a0', './useFormContext-b8cbbb21', './useId-c9578d26', './getFormatParse-7ea0c25b', './maskUtils-8e7a7701', './useHiddenTestMethod-2f1d2e7e', './calendarDateUtils-dd5b75ee', './useTestId-a2e433c2', './InputDateMask-2fdb6f26'], (function(e,s,t,a,n,o,r,i,l,d,c,u,m,p,h,y,f,b,C,D,v,S,k,x,A,T,g,F,I,V,P,R,w,M,U,_,j,H,B,E,N,L,O,Y,Z,W,z,G,q,J,K,Q,X,$,ee,se,te){"use strict";const ae=({anchorRef:e,assistiveText:t,dayFormatter:n,daysOutsideMonth:o,helpSourceLink:r,helpSourceText:i,isDisabled:d,isOpen:c,isReadonly:m,label:p,onClose:h,onCommit:f,max:b,messages:C,min:D,monthAndYearPicker:v,testId:S,todayButton:k,todayTimeZone:x,userAssistanceDensity:A,value:T,weekDisplay:g})=>{const[F,I]=a.useState(!1),[V,P]=a.useState(c),R=a.useCallback((e=>{I(e.placement.startsWith("top"))}),[]);V!==c&&(P(c),c||I(!1));const w=ne(),{datePicker_label:M}=u.useTranslationBundle("@oracle/oraclejet-preact"),U=M(),_=s.jsx(W.DatePicker,{dayFormatter:n,daysOutsideMonth:o,height:w?void 0:"auto",onCommit:f,max:b,min:D,maxWidth:w?"100%":void 0,width:"100%",monthAndYearPicker:v,testId:S,todayTimeZone:x,todayButton:k,value:T,weekDisplay:g}),j=!c||F&&!w||d||m||!(t||r||C&&C.length>0)||"efficient"!==A&&"reflow"!==A?void 0:s.jsx(l.FormFieldContext.Provider,{value:{isFocused:!0},children:s.jsx("div",{class:Y.userAssistanceStyles,children:s.jsx(y.InlineUserAssistance,{assistiveText:t,fieldLabel:p,helpSourceLink:r,helpSourceText:i,messages:C,userAssistanceDensity:A})})}),H=S?S+(w?"_sheet":"_dropdown"):void 0,B=s.jsx("div",{class:Y.dropdownStyles,children:s.jsx(z.SectionedContent,{"aria-label":U,footer:j,hasFocusTrap:!0,main:_,role:"dialog",testId:H})});return w?s.jsx(Z.Sheet,{initialFocus:"firstFocusable",isOpen:c,onClose:h,children:s.jsx(z.SectionedContent,{"aria-label":U,footer:j,hasFocusTrap:!0,main:_,role:"dialog",testId:H})}):s.jsx(z.StickyPositioningDropdown,{anchorRef:e,initialFocus:"firstFocusable",isOpen:c,onClose:h,onPosition:R,sizeOptions:{isMaxWidthAdjusted:!1,isMaxHeightAdjusted:!0},children:B})},ne=()=>"phone"===i.getClientHints().deviceType,oe=e=>e&&ee.isCompleteCalendarDate(e)?e:void 0,re=(e,s)=>{switch(s.type){case"dateChanged":return{...e,dateValue:s.data,completeDateValue:oe(s.data)};case"dateSelected":return{...e,dateValue:s.data,completeDateValue:s.data};case"reset":return{completeDateValue:oe(s.data),dateValue:s.data};default:return e}},ie=({isDisabled:e,isReadonly:s,onCommit:t,onInput:n,rootRef:o,value:r})=>{const[i,l]=a.useState(!1),d=a.useRef(null),c=a.useRef(null),u=a.useRef(!1),m=a.useRef(),p=a.useRef(r),h=a.useRef(r),y=a.useRef(r),f=a.useRef(!1),{state:b,dispatch:C}=(({value:e})=>{const[s,t]=a.useReducer(re,{completeDateValue:oe(e),dateValue:e});return{state:s,dispatch:t}})({value:r});X.calendarDatesAreDifferent(y.current,r)&&(y.current=r,X.calendarDatesAreDifferent(r,b.dateValue)&&(C({type:"reset",data:r}),h.current=r,p.current=r)),a.useEffect((()=>{X.calendarDatesAreDifferent(b.dateValue,h.current)&&(n({previousValue:h.current,value:b.dateValue}),h.current=b.dateValue),f.current&&X.calendarDatesAreDifferent(b.dateValue,p.current)&&(t?.({previousValue:p.current,value:b.dateValue}),p.current=b.dateValue,f.current=!1)}),[t,n,b.dateValue]);const D=a.useCallback((e=>{C({type:"dateChanged",data:e.value})}),[C]),v=a.useCallback((e=>{X.calendarDatesAreDifferent(p.current,e.value)&&(t?.({value:e.value,previousValue:p.current}),p.current=e.value)}),[t]),S=a.useCallback((()=>{u.current||l((e=>!e)),u.current=!1}),[]),k=a.useCallback((e=>{"outsideMousedown"===e.reason?(u.current=!0,clearTimeout(m.current),m.current=setTimeout((()=>{u.current=!1}),200)):"dismissed"!==e.reason&&"keyboardDismissed"!==e.reason||d.current?.focus(),l(!1)}),[]),x=a.useCallback((e=>{d.current?.focus(),f.current=!0,C({type:"dateSelected",data:e.value}),l(!1)}),[C]),A=a.useCallback((a=>s||e?Promise.reject("Component is readonly or disabled"):(n({value:a,previousValue:r}),t?.({value:a,previousValue:r}),Promise.resolve())),[r,e,s,t,n]);return $.useHiddenTestMethod({elementRef:o,method:A,name:"_changeValue"}),{calendarIconActionHandler:S,datePickerCommitHandler:x,dropdownCloseHandler:k,completeDateValue:b.completeDateValue,dateValue:b.dateValue,iconRef:d,isOpen:i,maskCommitHandler:v,maskInputHandler:D,maskRef:c}},le=t.forwardRef((({"aria-describedby":e,assistiveText:t,dayFormatter:i,daysOutsideMonth:l,helpSourceLink:d,helpSourceText:c,isDisabled:m,isReadonly:p,label:h,max:y,messages:f,min:b,monthAndYearPicker:C,todayTimeZone:D,todayButton:v,value:S,onCommit:k,onInput:x,testId:A,userAssistanceDensity:T,weekDisplay:g,...F},I)=>{const V=se.useTestId(A),P=a.useRef(null),{calendarIconActionHandler:R,datePickerCommitHandler:w,completeDateValue:M,dateValue:U,dropdownCloseHandler:_,iconRef:j,isOpen:H,maskCommitHandler:B,maskInputHandler:E,maskRef:N}=ie({isDisabled:m,isReadonly:p,onCommit:k,onInput:x,rootRef:P,value:S}),L=a.useRef(null),{inputDatePicker_selectDate:O,inputDatePicker_instruction:Y}=u.useTranslationBundle("@oracle/oraclejet-preact"),Z=O(),{userAssistanceDensity:W}=J.useFormContext(),z=T??W;a.useImperativeHandle(I,(()=>({focus:()=>{N.current?.focus()},blur:()=>{N.current?.blur()}})));const q=K.useId(),Q=Y(),X=m||p?void 0:s.jsx(o.HiddenAccessible,{id:q,isHidden:!0,children:Q}),$=m||p?e:G.l([e,q]),ee=s.jsx(r.IconButton,{"aria-haspopup":"dialog","aria-label":Z,isDisabled:m,ref:j,size:"sm",testId:A?A+"_calendarIcon":void 0,variant:"ghost",onAction:R,children:s.jsx(n.SvgCalendar,{})}),ne=H;return s.jsxs("div",{...V,ref:P,children:[s.jsx(te.InputDateMaskContext.Provider,{value:{isDropdownOpen:H,isInputDatePickerParent:!0},children:s.jsx(te.InputDateMask,{"aria-describedby":$,assistiveText:t,endContent:ee,helpSourceLink:d,helpSourceText:c,isDisabled:m,isReadonly:p,label:h,onCommit:B,onInput:E,mainFieldRef:L,messages:f,testId:A?A+"_mask":void 0,ref:N,userAssistanceDensity:T,value:U,...F})}),X,ne&&s.jsx(ae,{anchorRef:L,assistiveText:t,dayFormatter:i,daysOutsideMonth:l,helpSourceLink:d,helpSourceText:c,isDisabled:m,isReadonly:p,isOpen:H,label:h,onClose:_,onCommit:w,max:y,messages:f,min:b,monthAndYearPicker:C,testId:A?A+"_datePicker":void 0,todayTimeZone:D,todayButton:v,userAssistanceDensity:z,value:M,weekDisplay:g})]})}));e.InputDatePicker=le}));
2
+ //# sourceMappingURL=InputDatePicker-c5ceeb44.js.map