@bikdotai/bik-component-library 0.0.840 → 0.0.841-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/components/agent-builder/AgentBuilder.js +1 -1
- package/dist/cjs/components/agent-builder/AgentBuilder.js.map +1 -1
- package/dist/cjs/components/agent-builder/AgentBuilder.styled.js +51 -39
- package/dist/cjs/components/agent-builder/AgentBuilder.styled.js.map +1 -1
- package/dist/cjs/components/agent-builder/components/AgentBuilderFooter.js +1 -1
- package/dist/cjs/components/agent-builder/components/AgentBuilderFooter.js.map +1 -1
- package/dist/cjs/components/agent-builder/components/AgentBuilderTopBar.js +1 -1
- package/dist/cjs/components/agent-builder/components/AgentBuilderTopBar.js.map +1 -1
- package/dist/cjs/components/agent-builder/components/ConfigToolPanel.js +2 -2
- package/dist/cjs/components/agent-builder/components/ConfigToolPanel.js.map +1 -1
- package/dist/cjs/components/agent-builder/components/CreateSubAgentPanel.js +1 -1
- package/dist/cjs/components/agent-builder/components/CreateSubAgentPanel.js.map +1 -1
- package/dist/cjs/components/agent-builder/components/DiscardModal.js +1 -1
- package/dist/cjs/components/agent-builder/components/DiscardModal.js.map +1 -1
- package/dist/cjs/components/agent-builder/components/GoLiveModal.js +1 -1
- package/dist/cjs/components/agent-builder/components/GoLiveModal.js.map +1 -1
- package/dist/cjs/components/agent-builder/components/MentionEditor.js +1 -1
- package/dist/cjs/components/agent-builder/components/MentionEditor.js.map +1 -1
- package/dist/cjs/components/agent-builder/components/MentionPicker.js +28 -22
- package/dist/cjs/components/agent-builder/components/MentionPicker.js.map +1 -1
- package/dist/cjs/components/agent-builder/components/RequireVerificationModal.js +2 -0
- package/dist/cjs/components/agent-builder/components/RequireVerificationModal.js.map +1 -0
- package/dist/cjs/components/agent-builder/components/RestApiToolPanel.js +4 -4
- package/dist/cjs/components/agent-builder/components/RestApiToolPanel.js.map +1 -1
- package/dist/cjs/components/agent-builder/components/SelectableListSection.js +6 -6
- package/dist/cjs/components/agent-builder/components/SelectableListSection.js.map +1 -1
- package/dist/cjs/components/agent-builder/components/StepSectionHeader.js +1 -1
- package/dist/cjs/components/agent-builder/components/StepSectionHeader.js.map +1 -1
- package/dist/cjs/components/agent-builder/constants/tools.js +1 -1
- package/dist/cjs/components/agent-builder/constants/tools.js.map +1 -1
- package/dist/cjs/components/agent-builder/context/AgentBuilderContext.js +1 -1
- package/dist/cjs/components/agent-builder/context/AgentBuilderContext.js.map +1 -1
- package/dist/cjs/components/agent-builder/steps/Step2WhenItStepsIn.js +3 -1
- package/dist/cjs/components/agent-builder/steps/Step2WhenItStepsIn.js.map +1 -1
- package/dist/cjs/components/agent-builder/steps/Step3HowItResponds.js +1 -1
- package/dist/cjs/components/agent-builder/steps/Step3HowItResponds.js.map +1 -1
- package/dist/cjs/components/agent-builder/steps/Step4HandoverRules.js +1 -1
- package/dist/cjs/components/agent-builder/steps/Step4HandoverRules.js.map +1 -1
- package/dist/cjs/components/agent-builder/utils/mentionSerialization.js +5 -3
- package/dist/cjs/components/agent-builder/utils/mentionSerialization.js.map +1 -1
- package/dist/cjs/components/agent-listing/AgentListing.js +1 -1
- package/dist/cjs/components/agent-listing/AgentListing.js.map +1 -1
- package/dist/cjs/components/agent-listing/AgentTable.js +1 -1
- package/dist/cjs/components/agent-listing/AgentTable.js.map +1 -1
- package/dist/cjs/components/agent-listing/AgentTableRow.js +1 -1
- package/dist/cjs/components/agent-listing/AgentTableRow.js.map +1 -1
- package/dist/cjs/components/agent-listing/AgentTableShimmer.js +2 -0
- package/dist/cjs/components/agent-listing/AgentTableShimmer.js.map +1 -0
- package/dist/cjs/components/agent-listing/DeleteAgentModal.js +1 -1
- package/dist/cjs/components/agent-listing/DeleteAgentModal.js.map +1 -1
- package/dist/cjs/components/button/Button.styled.js +1 -0
- package/dist/cjs/components/button/Button.styled.js.map +1 -1
- package/dist/cjs/components/card-selector/CardSelector.js +1 -1
- package/dist/cjs/components/card-selector/CardSelector.js.map +1 -1
- package/dist/cjs/components/card-selector/CardSelectorGroup.js +1 -1
- package/dist/cjs/components/card-selector/CardSelectorGroup.js.map +1 -1
- package/dist/cjs/components/carousel/carousel.js +2 -2
- package/dist/cjs/components/carousel/carousel.js.map +1 -1
- package/dist/cjs/components/checkBox/CheckBox.js +1 -1
- package/dist/cjs/components/checkBox/CheckBox.js.map +1 -1
- package/dist/cjs/components/code-block/CodeBlock.js +2 -2
- package/dist/cjs/components/code-block/CodeBlock.js.map +1 -1
- package/dist/cjs/components/colourInput/ColourInput.js +1 -1
- package/dist/cjs/components/colourInput/ColourInput.js.map +1 -1
- package/dist/cjs/components/dot-pulse/DotPulse.js +3 -3
- package/dist/cjs/components/dot-pulse/DotPulse.js.map +1 -1
- package/dist/cjs/components/dropShadow/DropShadow.js +1 -1
- package/dist/cjs/components/dropShadow/DropShadow.js.map +1 -1
- package/dist/cjs/components/dropdown/ChipInput.js +1 -1
- package/dist/cjs/components/dropdown/ChipInput.js.map +1 -1
- package/dist/cjs/components/dropdown/Dropdown.js +1 -1
- package/dist/cjs/components/dropdown/Dropdown.js.map +1 -1
- package/dist/cjs/components/dropdown/DropdownPopover/index.js +1 -1
- package/dist/cjs/components/dropdown/DropdownPopover/index.js.map +1 -1
- package/dist/cjs/components/floater/floater.js +1 -1
- package/dist/cjs/components/floater/floater.js.map +1 -1
- package/dist/cjs/components/modals/styledModal.js +2 -2
- package/dist/cjs/components/modals/styledModal.js.map +1 -1
- package/dist/cjs/components/pagination/Pagination.js +1 -1
- package/dist/cjs/components/pagination/Pagination.js.map +1 -1
- package/dist/cjs/components/progress-bar/CircularProgressBar.js +1 -1
- package/dist/cjs/components/progress-bar/CircularProgressBar.js.map +1 -1
- package/dist/cjs/components/progress-bar/ProgressBarComponent.js +2 -2
- package/dist/cjs/components/progress-bar/ProgressBarComponent.js.map +1 -1
- package/dist/cjs/components/progress-bar-v2/ProgressBarV2.js +17 -17
- package/dist/cjs/components/progress-bar-v2/ProgressBarV2.js.map +1 -1
- package/dist/cjs/components/shimmer-image/ShimmerImage.js +1 -1
- package/dist/cjs/components/shimmer-image/ShimmerImage.js.map +1 -1
- package/dist/cjs/components/spinner/Spinner.js +3 -3
- package/dist/cjs/components/spinner/Spinner.js.map +1 -1
- package/dist/cjs/components/states/StateComponent.js +1 -1
- package/dist/cjs/components/states/StateComponent.js.map +1 -1
- package/dist/cjs/components/stepper/Stepper.js +1 -1
- package/dist/cjs/components/stepper/Stepper.js.map +1 -1
- package/dist/cjs/components/testimonial-card/TestimonialCard.js +1 -1
- package/dist/cjs/components/testimonial-card/TestimonialCard.js.map +1 -1
- package/dist/cjs/components/unsatisfactory-response-list/UnsatisfactoryResponseList.js +1 -1
- package/dist/cjs/components/unsatisfactory-response-list/UnsatisfactoryResponseList.js.map +1 -1
- package/dist/cjs/editor/BikEditor.js +1 -1
- package/dist/cjs/editor/BikEditor.js.map +1 -1
- package/dist/cjs/editor/BikEditor.styles.js +97 -54
- package/dist/cjs/editor/BikEditor.styles.js.map +1 -1
- package/dist/cjs/editor/extensions/jsonHighlight/JsonHighlightExtension.js +3 -3
- package/dist/cjs/editor/extensions/jsonHighlight/JsonHighlightExtension.js.map +1 -1
- package/dist/cjs/icons/Informational/Common UI/Shield.js +2 -0
- package/dist/cjs/icons/Informational/Common UI/Shield.js.map +1 -0
- package/dist/cjs/icons/index.js +1 -1
- package/dist/esm/components/agent-builder/AgentBuilder.js +106 -102
- package/dist/esm/components/agent-builder/AgentBuilder.js.map +1 -1
- package/dist/esm/components/agent-builder/AgentBuilder.model.d.ts +31 -1
- package/dist/esm/components/agent-builder/AgentBuilder.styled.d.ts +3 -6
- package/dist/esm/components/agent-builder/AgentBuilder.styled.js +118 -106
- package/dist/esm/components/agent-builder/AgentBuilder.styled.js.map +1 -1
- package/dist/esm/components/agent-builder/__fixtures__/agentValue.d.ts +11 -0
- package/dist/esm/components/agent-builder/components/AgentBuilderFooter.js +29 -21
- package/dist/esm/components/agent-builder/components/AgentBuilderFooter.js.map +1 -1
- package/dist/esm/components/agent-builder/components/AgentBuilderTopBar.js +27 -26
- package/dist/esm/components/agent-builder/components/AgentBuilderTopBar.js.map +1 -1
- package/dist/esm/components/agent-builder/components/ConfigToolPanel.js +25 -25
- package/dist/esm/components/agent-builder/components/ConfigToolPanel.js.map +1 -1
- package/dist/esm/components/agent-builder/components/CreateSubAgentPanel.js +24 -23
- package/dist/esm/components/agent-builder/components/CreateSubAgentPanel.js.map +1 -1
- package/dist/esm/components/agent-builder/components/DiscardModal.d.ts +3 -1
- package/dist/esm/components/agent-builder/components/DiscardModal.js +33 -24
- package/dist/esm/components/agent-builder/components/DiscardModal.js.map +1 -1
- package/dist/esm/components/agent-builder/components/GoLiveModal.js +23 -21
- package/dist/esm/components/agent-builder/components/GoLiveModal.js.map +1 -1
- package/dist/esm/components/agent-builder/components/MentionEditor.js +19 -19
- package/dist/esm/components/agent-builder/components/MentionEditor.js.map +1 -1
- package/dist/esm/components/agent-builder/components/MentionPicker.js +205 -154
- package/dist/esm/components/agent-builder/components/MentionPicker.js.map +1 -1
- package/dist/esm/components/agent-builder/components/RequireVerificationModal.d.ts +18 -0
- package/dist/esm/components/agent-builder/components/RequireVerificationModal.js +74 -0
- package/dist/esm/components/agent-builder/components/RequireVerificationModal.js.map +1 -0
- package/dist/esm/components/agent-builder/components/RestApiToolPanel.d.ts +2 -0
- package/dist/esm/components/agent-builder/components/RestApiToolPanel.js +111 -105
- package/dist/esm/components/agent-builder/components/RestApiToolPanel.js.map +1 -1
- package/dist/esm/components/agent-builder/components/SelectableListSection.d.ts +18 -4
- package/dist/esm/components/agent-builder/components/SelectableListSection.js +174 -138
- package/dist/esm/components/agent-builder/components/SelectableListSection.js.map +1 -1
- package/dist/esm/components/agent-builder/components/StepSectionHeader.js +7 -7
- package/dist/esm/components/agent-builder/components/StepSectionHeader.js.map +1 -1
- package/dist/esm/components/agent-builder/constants/tools.js +6 -6
- package/dist/esm/components/agent-builder/constants/tools.js.map +1 -1
- package/dist/esm/components/agent-builder/context/AgentBuilderContext.js +104 -103
- package/dist/esm/components/agent-builder/context/AgentBuilderContext.js.map +1 -1
- package/dist/esm/components/agent-builder/steps/Step2WhenItStepsIn.js +101 -102
- package/dist/esm/components/agent-builder/steps/Step2WhenItStepsIn.js.map +1 -1
- package/dist/esm/components/agent-builder/steps/Step3HowItResponds.js +289 -205
- package/dist/esm/components/agent-builder/steps/Step3HowItResponds.js.map +1 -1
- package/dist/esm/components/agent-builder/steps/Step4HandoverRules.js +23 -79
- package/dist/esm/components/agent-builder/steps/Step4HandoverRules.js.map +1 -1
- package/dist/esm/components/agent-builder/utils/mentionSerialization.d.ts +2 -0
- package/dist/esm/components/agent-builder/utils/mentionSerialization.js +59 -46
- package/dist/esm/components/agent-builder/utils/mentionSerialization.js.map +1 -1
- package/dist/esm/components/agent-listing/AgentListing.js +70 -65
- package/dist/esm/components/agent-listing/AgentListing.js.map +1 -1
- package/dist/esm/components/agent-listing/AgentTable.d.ts +2 -0
- package/dist/esm/components/agent-listing/AgentTable.js +16 -15
- package/dist/esm/components/agent-listing/AgentTable.js.map +1 -1
- package/dist/esm/components/agent-listing/AgentTableRow.js +11 -11
- package/dist/esm/components/agent-listing/AgentTableRow.js.map +1 -1
- package/dist/esm/components/agent-listing/AgentTableShimmer.d.ts +12 -0
- package/dist/esm/components/agent-listing/AgentTableShimmer.js +20 -0
- package/dist/esm/components/agent-listing/AgentTableShimmer.js.map +1 -0
- package/dist/esm/components/agent-listing/DeleteAgentModal.js +8 -8
- package/dist/esm/components/agent-listing/DeleteAgentModal.js.map +1 -1
- package/dist/esm/components/agent-listing/__fixtures__/agents.d.ts +3 -0
- package/dist/esm/components/button/Button.styled.js +25 -19
- package/dist/esm/components/button/Button.styled.js.map +1 -1
- package/dist/esm/components/card-selector/CardSelector.js +11 -9
- package/dist/esm/components/card-selector/CardSelector.js.map +1 -1
- package/dist/esm/components/card-selector/CardSelectorGroup.js +1 -0
- package/dist/esm/components/card-selector/CardSelectorGroup.js.map +1 -1
- package/dist/esm/components/carousel/carousel.js +8 -8
- package/dist/esm/components/carousel/carousel.js.map +1 -1
- package/dist/esm/components/checkBox/CheckBox.js +8 -5
- package/dist/esm/components/checkBox/CheckBox.js.map +1 -1
- package/dist/esm/components/code-block/CodeBlock.js +14 -14
- package/dist/esm/components/code-block/CodeBlock.js.map +1 -1
- package/dist/esm/components/colourInput/ColourInput.js +11 -10
- package/dist/esm/components/colourInput/ColourInput.js.map +1 -1
- package/dist/esm/components/dot-pulse/DotPulse.js +15 -15
- package/dist/esm/components/dot-pulse/DotPulse.js.map +1 -1
- package/dist/esm/components/dropShadow/DropShadow.js +6 -6
- package/dist/esm/components/dropShadow/DropShadow.js.map +1 -1
- package/dist/esm/components/dropdown/ChipInput.js +10 -9
- package/dist/esm/components/dropdown/ChipInput.js.map +1 -1
- package/dist/esm/components/dropdown/Dropdown.js +18 -13
- package/dist/esm/components/dropdown/Dropdown.js.map +1 -1
- package/dist/esm/components/dropdown/DropdownPopover/index.js +26 -25
- package/dist/esm/components/dropdown/DropdownPopover/index.js.map +1 -1
- package/dist/esm/components/floater/floater.js +14 -13
- package/dist/esm/components/floater/floater.js.map +1 -1
- package/dist/esm/components/modals/styledModal.js +6 -5
- package/dist/esm/components/modals/styledModal.js.map +1 -1
- package/dist/esm/components/pagination/Pagination.js +7 -7
- package/dist/esm/components/pagination/Pagination.js.map +1 -1
- package/dist/esm/components/progress-bar/CircularProgressBar.js +61 -50
- package/dist/esm/components/progress-bar/CircularProgressBar.js.map +1 -1
- package/dist/esm/components/progress-bar/ProgressBarComponent.js +14 -13
- package/dist/esm/components/progress-bar/ProgressBarComponent.js.map +1 -1
- package/dist/esm/components/progress-bar-v2/ProgressBarV2.js +57 -39
- package/dist/esm/components/progress-bar-v2/ProgressBarV2.js.map +1 -1
- package/dist/esm/components/shimmer-image/ShimmerImage.js +19 -18
- package/dist/esm/components/shimmer-image/ShimmerImage.js.map +1 -1
- package/dist/esm/components/spinner/Spinner.js +19 -11
- package/dist/esm/components/spinner/Spinner.js.map +1 -1
- package/dist/esm/components/states/StateComponent.js +47 -30
- package/dist/esm/components/states/StateComponent.js.map +1 -1
- package/dist/esm/components/stepper/Stepper.js +24 -16
- package/dist/esm/components/stepper/Stepper.js.map +1 -1
- package/dist/esm/components/testimonial-card/TestimonialCard.js +5 -4
- package/dist/esm/components/testimonial-card/TestimonialCard.js.map +1 -1
- package/dist/esm/components/unsatisfactory-response-list/UnsatisfactoryResponseList.js +19 -18
- package/dist/esm/components/unsatisfactory-response-list/UnsatisfactoryResponseList.js.map +1 -1
- package/dist/esm/editor/BikEditor.js +173 -160
- package/dist/esm/editor/BikEditor.js.map +1 -1
- package/dist/esm/editor/BikEditor.styles.d.ts +20 -3
- package/dist/esm/editor/BikEditor.styles.js +102 -57
- package/dist/esm/editor/BikEditor.styles.js.map +1 -1
- package/dist/esm/editor/extensions/jsonHighlight/JsonHighlightExtension.d.ts +5 -8
- package/dist/esm/editor/extensions/jsonHighlight/JsonHighlightExtension.js +87 -68
- package/dist/esm/editor/extensions/jsonHighlight/JsonHighlightExtension.js.map +1 -1
- package/dist/esm/icons/Informational/Common UI/Shield.d.ts +6 -0
- package/dist/esm/icons/Informational/Common UI/Shield.js +33 -0
- package/dist/esm/icons/Informational/Common UI/Shield.js.map +1 -0
- package/dist/esm/icons/Informational/Common UI/index.d.ts +1 -0
- package/dist/esm/icons/Media/Visual/index.d.ts +0 -2
- package/dist/esm/icons/index.d.ts +25 -25
- package/dist/esm/icons/index.js +418 -420
- package/dist/esm/icons/index.js.map +1 -1
- package/package.json +1 -1
- package/dist/cjs/icons/Media/Visual/FormkitNeutral.js +0 -2
- package/dist/cjs/icons/Media/Visual/FormkitNeutral.js.map +0 -1
- package/dist/cjs/icons/Media/Visual/FormkitSad.js +0 -2
- package/dist/cjs/icons/Media/Visual/FormkitSad.js.map +0 -1
- package/dist/esm/icons/Media/Visual/FormkitNeutral.js +0 -58
- package/dist/esm/icons/Media/Visual/FormkitNeutral.js.map +0 -1
- package/dist/esm/icons/Media/Visual/FormkitSad.js +0 -61
- package/dist/esm/icons/Media/Visual/FormkitSad.js.map +0 -1
|
@@ -1,23 +1,24 @@
|
|
|
1
|
-
import { jsxs as
|
|
1
|
+
import { jsxs as t, jsx as e } from "react/jsx-runtime";
|
|
2
2
|
import { ColorInputContainer as n, StyledColorInput as l } from "./ColourInput.styled.js";
|
|
3
3
|
import { BodySecondary as a, BodyPrimary as i } from "../TypographyStyle.js";
|
|
4
|
-
const
|
|
5
|
-
|
|
6
|
-
/* @__PURE__ */
|
|
7
|
-
/* @__PURE__ */
|
|
8
|
-
/* @__PURE__ */
|
|
4
|
+
const m = (o) => /* @__PURE__ */ t("div", { className: "buttonColorCustom", children: [
|
|
5
|
+
o.headingText && /* @__PURE__ */ e(a, { children: o.headingText }),
|
|
6
|
+
/* @__PURE__ */ t(n, { children: [
|
|
7
|
+
/* @__PURE__ */ e(i, { children: o.labelText ?? "Colour" }),
|
|
8
|
+
/* @__PURE__ */ e(
|
|
9
9
|
l,
|
|
10
10
|
{
|
|
11
11
|
type: "color",
|
|
12
|
-
|
|
13
|
-
|
|
12
|
+
"data-testid": "colour-input",
|
|
13
|
+
onChange: (r) => {
|
|
14
|
+
o.onValueChange(r.target.value);
|
|
14
15
|
},
|
|
15
|
-
value:
|
|
16
|
+
value: o.value
|
|
16
17
|
}
|
|
17
18
|
)
|
|
18
19
|
] })
|
|
19
20
|
] });
|
|
20
21
|
export {
|
|
21
|
-
|
|
22
|
+
m as ColourInput
|
|
22
23
|
};
|
|
23
24
|
//# sourceMappingURL=ColourInput.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ColourInput.js","sources":["../../../../src/components/colourInput/ColourInput.tsx"],"sourcesContent":["import React from 'react';\nimport {\n\tColorInputContainer,\n\tStyledColorInput,\n} from '@src/components/colourInput/ColourInput.styled';\nimport { BodyPrimary, BodySecondary } from '@src/components/TypographyStyle';\n\nexport interface ColourInputProps {\n\tvalue: string;\n\tlabelText: string;\n\theadingText?: string;\n\tonValueChange: (value: string) => void;\n}\n\nexport const ColourInput: React.FC<ColourInputProps> = (props) => {\n\treturn (\n\t\t<div className=\"buttonColorCustom\">\n\t\t\t{props.headingText && <BodySecondary>{props.headingText}</BodySecondary>}\n\t\t\t<ColorInputContainer>\n\t\t\t\t<BodyPrimary>{props.labelText ?? 'Colour'}</BodyPrimary>\n\t\t\t\t<StyledColorInput\n\t\t\t\t\ttype=\"color\"\n\t\t\t\t\tonChange={(e) => {\n\t\t\t\t\t\tprops.onValueChange(e.target.value);\n\t\t\t\t\t}}\n\t\t\t\t\tvalue={props.value}\n\t\t\t\t/>\n\t\t\t</ColorInputContainer>\n\t\t</div>\n\t);\n};\n"],"names":["ColourInput","props","jsxs","jsx","BodySecondary","ColorInputContainer","BodyPrimary","StyledColorInput","e"],"mappings":";;;AAcO,MAAMA,IAA0C,CAACC,MAEtD,gBAAAC,EAAC,OAAA,EAAI,WAAU,qBACb,UAAA;AAAA,EAAAD,EAAM,eAAe,gBAAAE,EAACC,GAAA,EAAe,UAAAH,EAAM,aAAY;AAAA,oBACvDI,GAAA,EACA,UAAA;AAAA,IAAA,gBAAAF,EAACG,GAAA,EAAa,UAAAL,EAAM,aAAa,UAAS;AAAA,IAC1C,gBAAAE;AAAA,MAACI;AAAA,MAAA;AAAA,QACA,MAAK;AAAA,QACL,UAAU,CAACC,MAAM;AAChB,UAAAP,EAAM,cAAcO,EAAE,OAAO,KAAK;AAAA,QACnC;AAAA,QACA,OAAOP,EAAM;AAAA,MAAA;AAAA,IAAA;AAAA,EACd,EAAA,CACD;AAAA,GACD;"}
|
|
1
|
+
{"version":3,"file":"ColourInput.js","sources":["../../../../src/components/colourInput/ColourInput.tsx"],"sourcesContent":["import React from 'react';\nimport {\n\tColorInputContainer,\n\tStyledColorInput,\n} from '@src/components/colourInput/ColourInput.styled';\nimport { BodyPrimary, BodySecondary } from '@src/components/TypographyStyle';\n\nexport interface ColourInputProps {\n\tvalue: string;\n\tlabelText: string;\n\theadingText?: string;\n\tonValueChange: (value: string) => void;\n}\n\nexport const ColourInput: React.FC<ColourInputProps> = (props) => {\n\treturn (\n\t\t<div className=\"buttonColorCustom\">\n\t\t\t{props.headingText && <BodySecondary>{props.headingText}</BodySecondary>}\n\t\t\t<ColorInputContainer>\n\t\t\t\t<BodyPrimary>{props.labelText ?? 'Colour'}</BodyPrimary>\n\t\t\t\t<StyledColorInput\n\t\t\t\t\ttype=\"color\"\n\t\t\t\t\tdata-testid=\"colour-input\"\n\t\t\t\t\tonChange={(e) => {\n\t\t\t\t\t\tprops.onValueChange(e.target.value);\n\t\t\t\t\t}}\n\t\t\t\t\tvalue={props.value}\n\t\t\t\t/>\n\t\t\t</ColorInputContainer>\n\t\t</div>\n\t);\n};\n"],"names":["ColourInput","props","jsxs","jsx","BodySecondary","ColorInputContainer","BodyPrimary","StyledColorInput","e"],"mappings":";;;AAcO,MAAMA,IAA0C,CAACC,MAEtD,gBAAAC,EAAC,OAAA,EAAI,WAAU,qBACb,UAAA;AAAA,EAAAD,EAAM,eAAe,gBAAAE,EAACC,GAAA,EAAe,UAAAH,EAAM,aAAY;AAAA,oBACvDI,GAAA,EACA,UAAA;AAAA,IAAA,gBAAAF,EAACG,GAAA,EAAa,UAAAL,EAAM,aAAa,UAAS;AAAA,IAC1C,gBAAAE;AAAA,MAACI;AAAA,MAAA;AAAA,QACA,MAAK;AAAA,QACL,eAAY;AAAA,QACZ,UAAU,CAACC,MAAM;AAChB,UAAAP,EAAM,cAAcO,EAAE,OAAO,KAAK;AAAA,QACnC;AAAA,QACA,OAAOP,EAAM;AAAA,MAAA;AAAA,IAAA;AAAA,EACd,EAAA,CACD;AAAA,GACD;"}
|
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import
|
|
3
|
-
const
|
|
4
|
-
color:
|
|
5
|
-
size:
|
|
6
|
-
}) => /* @__PURE__ */
|
|
7
|
-
/* @__PURE__ */ a(
|
|
8
|
-
/* @__PURE__ */ a(
|
|
9
|
-
/* @__PURE__ */ a(
|
|
10
|
-
] }),
|
|
1
|
+
import { jsxs as s, jsx as a } from "react/jsx-runtime";
|
|
2
|
+
import e from "styled-components";
|
|
3
|
+
const r = ({
|
|
4
|
+
color: t = "linear-gradient(90deg, #ff166a 0%, #ff317dff 100%)",
|
|
5
|
+
size: i = 4
|
|
6
|
+
}) => /* @__PURE__ */ s(n, { children: [
|
|
7
|
+
/* @__PURE__ */ a(o, { "data-testid": "dot-pulse-dot", $color: t, $size: i }),
|
|
8
|
+
/* @__PURE__ */ a(o, { "data-testid": "dot-pulse-dot", $color: t, $size: i }),
|
|
9
|
+
/* @__PURE__ */ a(o, { "data-testid": "dot-pulse-dot", $color: t, $size: i })
|
|
10
|
+
] }), n = e.span`
|
|
11
11
|
display: inline-flex;
|
|
12
12
|
align-items: center;
|
|
13
|
-
`,
|
|
13
|
+
`, o = e.span`
|
|
14
14
|
display: block;
|
|
15
|
-
width: ${(
|
|
16
|
-
height: ${(
|
|
15
|
+
width: ${(t) => t.$size}px;
|
|
16
|
+
height: ${(t) => t.$size}px;
|
|
17
17
|
border-radius: 50%;
|
|
18
|
-
background: ${(
|
|
18
|
+
background: ${(t) => t.$color};
|
|
19
19
|
margin: 0 1.5px;
|
|
20
20
|
opacity: 0.6;
|
|
21
21
|
animation: dotPulse 1.2s infinite;
|
|
@@ -43,6 +43,6 @@ const c = ({
|
|
|
43
43
|
}
|
|
44
44
|
`;
|
|
45
45
|
export {
|
|
46
|
-
|
|
46
|
+
r as DotPulse
|
|
47
47
|
};
|
|
48
48
|
//# sourceMappingURL=DotPulse.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DotPulse.js","sources":["../../../../src/components/dot-pulse/DotPulse.tsx"],"sourcesContent":["import React from 'react';\nimport styled from 'styled-components';\n\nexport interface DotPulseProps {\n\tcolor?: string;\n\tsize?: number;\n}\n\nconst DotPulse: React.FC<DotPulseProps> = ({\n\tcolor = 'linear-gradient(90deg, #ff166a 0%, #ff317dff 100%)',\n\tsize = 4,\n}) => {\n\treturn (\n\t\t<DotPulseContainer>\n\t\t\t<Dot $color={color} $size={size} />\n\t\t\t<Dot $color={color} $size={size} />\n\t\t\t<Dot $color={color} $size={size} />\n\t\t</DotPulseContainer>\n\t);\n};\n\nconst DotPulseContainer = styled.span`\n\tdisplay: inline-flex;\n\talign-items: center;\n`;\n\ninterface DotProps {\n\t$color: string;\n\t$size: number;\n}\n\nconst Dot = styled.span<DotProps>`\n\tdisplay: block;\n\twidth: ${(props) => props.$size}px;\n\theight: ${(props) => props.$size}px;\n\tborder-radius: 50%;\n\tbackground: ${(props) => props.$color};\n\tmargin: 0 1.5px;\n\topacity: 0.6;\n\tanimation: dotPulse 1.2s infinite;\n\twill-change: opacity, transform;\n\n\t&:nth-child(2) {\n\t\tanimation-delay: 0.2s;\n\t}\n\n\t&:nth-child(3) {\n\t\tanimation-delay: 0.4s;\n\t}\n\n\t@keyframes dotPulse {\n\t\t0%,\n\t\t80%,\n\t\t100% {\n\t\t\topacity: 0.6;\n\t\t\ttransform: scale(1);\n\t\t}\n\t\t40% {\n\t\t\topacity: 1;\n\t\t\ttransform: scale(1.4);\n\t\t}\n\t}\n`;\n\nexport { DotPulse };\n"],"names":["DotPulse","color","size","DotPulseContainer","jsx","Dot","styled","props"],"mappings":";;AAQA,MAAMA,IAAoC,CAAC;AAAA,EAC1C,OAAAC,IAAQ;AAAA,EACR,MAAAC,IAAO;AACR,wBAEGC,GAAA,EACA,UAAA;AAAA,EAAA,gBAAAC,EAACC,
|
|
1
|
+
{"version":3,"file":"DotPulse.js","sources":["../../../../src/components/dot-pulse/DotPulse.tsx"],"sourcesContent":["import React from 'react';\nimport styled from 'styled-components';\n\nexport interface DotPulseProps {\n\tcolor?: string;\n\tsize?: number;\n}\n\nconst DotPulse: React.FC<DotPulseProps> = ({\n\tcolor = 'linear-gradient(90deg, #ff166a 0%, #ff317dff 100%)',\n\tsize = 4,\n}) => {\n\treturn (\n\t\t<DotPulseContainer>\n\t\t\t<Dot data-testid=\"dot-pulse-dot\" $color={color} $size={size} />\n\t\t\t<Dot data-testid=\"dot-pulse-dot\" $color={color} $size={size} />\n\t\t\t<Dot data-testid=\"dot-pulse-dot\" $color={color} $size={size} />\n\t\t</DotPulseContainer>\n\t);\n};\n\nconst DotPulseContainer = styled.span`\n\tdisplay: inline-flex;\n\talign-items: center;\n`;\n\ninterface DotProps {\n\t$color: string;\n\t$size: number;\n}\n\nconst Dot = styled.span<DotProps>`\n\tdisplay: block;\n\twidth: ${(props) => props.$size}px;\n\theight: ${(props) => props.$size}px;\n\tborder-radius: 50%;\n\tbackground: ${(props) => props.$color};\n\tmargin: 0 1.5px;\n\topacity: 0.6;\n\tanimation: dotPulse 1.2s infinite;\n\twill-change: opacity, transform;\n\n\t&:nth-child(2) {\n\t\tanimation-delay: 0.2s;\n\t}\n\n\t&:nth-child(3) {\n\t\tanimation-delay: 0.4s;\n\t}\n\n\t@keyframes dotPulse {\n\t\t0%,\n\t\t80%,\n\t\t100% {\n\t\t\topacity: 0.6;\n\t\t\ttransform: scale(1);\n\t\t}\n\t\t40% {\n\t\t\topacity: 1;\n\t\t\ttransform: scale(1.4);\n\t\t}\n\t}\n`;\n\nexport { DotPulse };\n"],"names":["DotPulse","color","size","DotPulseContainer","jsx","Dot","styled","props"],"mappings":";;AAQA,MAAMA,IAAoC,CAAC;AAAA,EAC1C,OAAAC,IAAQ;AAAA,EACR,MAAAC,IAAO;AACR,wBAEGC,GAAA,EACA,UAAA;AAAA,EAAA,gBAAAC,EAACC,KAAI,eAAY,iBAAgB,QAAQJ,GAAO,OAAOC,GAAM;AAAA,oBAC5DG,GAAA,EAAI,eAAY,iBAAgB,QAAQJ,GAAO,OAAOC,GAAM;AAAA,oBAC5DG,GAAA,EAAI,eAAY,iBAAgB,QAAQJ,GAAO,OAAOC,EAAA,CAAM;AAAA,GAC9D,GAIIC,IAAoBG,EAAO;AAAA;AAAA;AAAA,GAU3BD,IAAMC,EAAO;AAAA;AAAA,UAET,CAACC,MAAUA,EAAM,KAAK;AAAA,WACrB,CAACA,MAAUA,EAAM,KAAK;AAAA;AAAA,eAElB,CAACA,MAAUA,EAAM,MAAM;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
const
|
|
1
|
+
import { jsx as r } from "react/jsx-runtime";
|
|
2
|
+
const t = {
|
|
3
3
|
z1: {
|
|
4
4
|
up: "0px -2px 8px rgba(0, 0, 0, 0.12)",
|
|
5
5
|
down: "0px 2px 8px rgba(0, 0, 0, 0.12)"
|
|
@@ -8,11 +8,11 @@ const n = {
|
|
|
8
8
|
up: "0px -4px 12px rgba(0, 0, 0, 0.12)",
|
|
9
9
|
down: "0px 4px 12px rgba(0, 0, 0, 0.12)"
|
|
10
10
|
}
|
|
11
|
-
},
|
|
12
|
-
const
|
|
13
|
-
return /* @__PURE__ */
|
|
11
|
+
}, s = ({ level: p = "z1", position: o = "down", children: x, style: a }) => {
|
|
12
|
+
const d = t[p][o];
|
|
13
|
+
return /* @__PURE__ */ r("div", { "data-testid": "drop-shadow", style: { boxShadow: d, ...a ?? {} }, children: x });
|
|
14
14
|
};
|
|
15
15
|
export {
|
|
16
|
-
|
|
16
|
+
s as DropShadow
|
|
17
17
|
};
|
|
18
18
|
//# sourceMappingURL=DropShadow.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DropShadow.js","sources":["../../../../src/components/dropShadow/DropShadow.tsx"],"sourcesContent":["import React from 'react';\n\nconst BoxShadowMap = {\n\tz1: {\n\t\tup: '0px -2px 8px rgba(0, 0, 0, 0.12)',\n\t\tdown: '0px 2px 8px rgba(0, 0, 0, 0.12)',\n\t},\n\tz2: {\n\t\tup: '0px -4px 12px rgba(0, 0, 0, 0.12)',\n\t\tdown: '0px 4px 12px rgba(0, 0, 0, 0.12)',\n\t},\n};\n\nexport const DropShadow: React.FC<{\n\tlevel: 'z1' | 'z2';\n\tposition: 'up' | 'down';\n\tchildren: React.ReactNode;\n\tstyle?: React.CSSProperties;\n}> = ({ level = 'z1', position = 'down', children, style }) => {\n\tconst boxShadow = BoxShadowMap[level][position];\n\n\treturn <div style={{ boxShadow, ...(style ?? {}) }}
|
|
1
|
+
{"version":3,"file":"DropShadow.js","sources":["../../../../src/components/dropShadow/DropShadow.tsx"],"sourcesContent":["import React from 'react';\n\nconst BoxShadowMap = {\n\tz1: {\n\t\tup: '0px -2px 8px rgba(0, 0, 0, 0.12)',\n\t\tdown: '0px 2px 8px rgba(0, 0, 0, 0.12)',\n\t},\n\tz2: {\n\t\tup: '0px -4px 12px rgba(0, 0, 0, 0.12)',\n\t\tdown: '0px 4px 12px rgba(0, 0, 0, 0.12)',\n\t},\n};\n\nexport const DropShadow: React.FC<{\n\tlevel: 'z1' | 'z2';\n\tposition: 'up' | 'down';\n\tchildren: React.ReactNode;\n\tstyle?: React.CSSProperties;\n}> = ({ level = 'z1', position = 'down', children, style }) => {\n\tconst boxShadow = BoxShadowMap[level][position];\n\n\treturn (\n\t\t<div data-testid=\"drop-shadow\" style={{ boxShadow, ...(style ?? {}) }}>\n\t\t\t{children}\n\t\t</div>\n\t);\n};\n"],"names":["BoxShadowMap","DropShadow","level","position","children","style","boxShadow","jsx"],"mappings":";AAEA,MAAMA,IAAe;AAAA,EACpB,IAAI;AAAA,IACH,IAAI;AAAA,IACJ,MAAM;AAAA,EAAA;AAAA,EAEP,IAAI;AAAA,IACH,IAAI;AAAA,IACJ,MAAM;AAAA,EAAA;AAER,GAEaC,IAKR,CAAC,EAAE,OAAAC,IAAQ,MAAM,UAAAC,IAAW,QAAQ,UAAAC,GAAU,OAAAC,QAAY;AAC9D,QAAMC,IAAYN,EAAaE,CAAK,EAAEC,CAAQ;AAE9C,SACC,gBAAAI,EAAC,OAAA,EAAI,eAAY,eAAc,OAAO,EAAE,WAAAD,GAAW,GAAID,KAAS,GAAC,GAC/D,UAAAD,EAAA,CACF;AAEF;"}
|
|
@@ -24,15 +24,15 @@ const B = (t) => t.length === 1 ? 100 : t.length === 2 ? 40 : 34, V = ({
|
|
|
24
24
|
return w(() => {
|
|
25
25
|
if (!t) return;
|
|
26
26
|
let n = 0;
|
|
27
|
-
const
|
|
28
|
-
let
|
|
29
|
-
|
|
30
|
-
const O = t.filter((l) => !
|
|
31
|
-
I(O), y(t.length -
|
|
27
|
+
const o = B(t);
|
|
28
|
+
let r = t.filter((l) => (n += l.label.length, n <= o));
|
|
29
|
+
r.length === 0 && t.length > 0 && (r = [t[0]]), x(r);
|
|
30
|
+
const O = t.filter((l) => !r.includes(l)).map((l) => l.label);
|
|
31
|
+
I(O), y(t.length - r.length);
|
|
32
32
|
}, [t]), /* @__PURE__ */ m(S, { children: [
|
|
33
33
|
/* @__PURE__ */ m(F, { style: { ...f }, error: !!a, children: [
|
|
34
34
|
/* @__PURE__ */ m("div", { className: "chips-container", children: [
|
|
35
|
-
b?.map((n,
|
|
35
|
+
b?.map((n, o) => /* @__PURE__ */ e("div", { style: { zIndex: 2 }, children: /* @__PURE__ */ e(
|
|
36
36
|
T,
|
|
37
37
|
{
|
|
38
38
|
tagText: L.truncateText(
|
|
@@ -42,6 +42,7 @@ const B = (t) => t.length === 1 ? 100 : t.length === 2 ? 40 : 34, V = ({
|
|
|
42
42
|
TrailingIcon: () => /* @__PURE__ */ e(
|
|
43
43
|
E,
|
|
44
44
|
{
|
|
45
|
+
"data-testid": "chip-remove-icon",
|
|
45
46
|
width: 12,
|
|
46
47
|
height: 12,
|
|
47
48
|
style: { cursor: "pointer" },
|
|
@@ -52,7 +53,7 @@ const B = (t) => t.length === 1 ? 100 : t.length === 2 ? 40 : 34, V = ({
|
|
|
52
53
|
),
|
|
53
54
|
children: n.selectedLabel || n.label
|
|
54
55
|
}
|
|
55
|
-
) },
|
|
56
|
+
) }, o)),
|
|
56
57
|
!!p && /* @__PURE__ */ e(
|
|
57
58
|
"div",
|
|
58
59
|
{
|
|
@@ -66,13 +67,13 @@ const B = (t) => t.length === 1 ? 100 : t.length === 2 ? 40 : 34, V = ({
|
|
|
66
67
|
{
|
|
67
68
|
body: "",
|
|
68
69
|
placement: "bottom",
|
|
69
|
-
tooltipContent: v && c.length > 0 ? /* @__PURE__ */ e("div", { style: { padding: "4px" }, children: c.map((n,
|
|
70
|
+
tooltipContent: v && c.length > 0 ? /* @__PURE__ */ e("div", { style: { padding: "4px" }, children: c.map((n, o) => /* @__PURE__ */ e(
|
|
70
71
|
h,
|
|
71
72
|
{
|
|
72
73
|
style: { color: d.text.white },
|
|
73
74
|
children: n
|
|
74
75
|
},
|
|
75
|
-
|
|
76
|
+
o
|
|
76
77
|
)) }) : void 0,
|
|
77
78
|
children: /* @__PURE__ */ e(h, { color: d.content.placeholder, children: `+${p} more` })
|
|
78
79
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ChipInput.js","sources":["../../../../src/components/dropdown/ChipInput.tsx"],"sourcesContent":["import React, { useEffect, useState } from 'react';\nimport StringUtils from '@src/utils/StringUtils';\nimport { COLORS } from '@src/constants/Theme';\nimport DownIcon from '../../assets/icons/chevronDown.svg';\nimport CrossIcon from '../../assets/icons/cross.svg';\nimport ErrorIcon from '../../assets/icons/errorInfo.svg';\nimport { InputFooter } from '../input/Input.styled';\nimport { Tag } from '../tag';\nimport { Tooltip } from '../tooltips';\nimport { BodyCaption } from '../TypographyStyle';\nimport { ChipInputWrapper } from './Common.styled';\nimport { SingleOption } from './type';\n\ninterface ChipInputProps {\n\tplaceholder?: string;\n\tchips: SingleOption[];\n\tonDeleteChip: (chip: SingleOption) => void;\n\tcontainerStyle?: React.CSSProperties;\n\tisDropdownOpened?: boolean;\n\tsizeToUse?: 'default' | 'small' | 'x-small';\n\terrorMessage?: string;\n\tshowLabelsOnMoreHover?: boolean;\n}\n\nconst getMaxChipsCharCount = (chips: SingleOption[]) => {\n\tif (chips.length === 1) return 100;\n\tif (chips.length === 2) return 40;\n\treturn 34;\n};\n\nconst ChipInput: React.FC<ChipInputProps> = ({\n\tchips,\n\tonDeleteChip,\n\tcontainerStyle = {},\n\tsizeToUse = 'default',\n\tisDropdownOpened,\n\tplaceholder = 'Select..',\n\terrorMessage = '',\n\tshowLabelsOnMoreHover = false,\n}) => {\n\tconst [options, setOptions] = useState<SingleOption[]>();\n\tconst [remainingOptionsCnt, setRemainingOptionsCnt] = useState(0);\n\tconst [remainingOptionsLabels, setRemainingOptionsLabels] = useState<\n\t\tstring[]\n\t>([]);\n\n\tuseEffect(() => {\n\t\tif (!chips) return;\n\t\tlet combineCharCnt = 0;\n\t\tconst MAX_CHAR = getMaxChipsCharCount(chips);\n\t\tlet options = chips.filter((option) => {\n\t\t\tcombineCharCnt += option.label.length;\n\t\t\treturn combineCharCnt <= MAX_CHAR;\n\t\t});\n\t\tif (options.length === 0 && chips.length > 0) {\n\t\t\toptions = [chips[0]];\n\t\t}\n\t\tsetOptions(options);\n\t\tconst remainingChips = chips.filter((option) => !options.includes(option));\n\t\tconst labels = remainingChips.map((option) => option.label);\n\t\tsetRemainingOptionsLabels(labels);\n\t\tsetRemainingOptionsCnt(chips.length - options.length);\n\t}, [chips]);\n\n\treturn (\n\t\t<>\n\t\t\t<ChipInputWrapper style={{ ...containerStyle }} error={!!errorMessage}>\n\t\t\t\t<div className=\"chips-container\">\n\t\t\t\t\t{options?.map((chip, index) => (\n\t\t\t\t\t\t<div key={index} style={{ zIndex: 2 }}>\n\t\t\t\t\t\t\t<Tag\n\t\t\t\t\t\t\t\ttagText={StringUtils.truncateText(\n\t\t\t\t\t\t\t\t\tchip.selectedLabel || chip.label,\n\t\t\t\t\t\t\t\t\t40,\n\t\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t\t\tTrailingIcon={() => (\n\t\t\t\t\t\t\t\t\t<CrossIcon\n\t\t\t\t\t\t\t\t\t\twidth={12}\n\t\t\t\t\t\t\t\t\t\theight={12}\n\t\t\t\t\t\t\t\t\t\tstyle={{ cursor: 'pointer' }}\n\t\t\t\t\t\t\t\t\t\tonClick={() => {\n\t\t\t\t\t\t\t\t\t\t\tonDeleteChip(chip);\n\t\t\t\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t{chip.selectedLabel || chip.label}\n\t\t\t\t\t\t\t</Tag>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t))}\n\t\t\t\t\t{!!remainingOptionsCnt && (\n\t\t\t\t\t\t<div\n\t\t\t\t\t\t\tstyle={{\n\t\t\t\t\t\t\t\tposition: 'relative',\n\t\t\t\t\t\t\t\tzIndex: 2,\n\t\t\t\t\t\t\t\tpointerEvents: 'auto',\n\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<Tooltip\n\t\t\t\t\t\t\t\tbody={''}\n\t\t\t\t\t\t\t\tplacement=\"bottom\"\n\t\t\t\t\t\t\t\ttooltipContent={\n\t\t\t\t\t\t\t\t\tshowLabelsOnMoreHover && remainingOptionsLabels.length > 0 ? (\n\t\t\t\t\t\t\t\t\t\t<div style={{ padding: '4px' }}>\n\t\t\t\t\t\t\t\t\t\t\t{remainingOptionsLabels.map((label, index) => (\n\t\t\t\t\t\t\t\t\t\t\t\t<BodyCaption\n\t\t\t\t\t\t\t\t\t\t\t\t\tstyle={{ color: COLORS.text.white }}\n\t\t\t\t\t\t\t\t\t\t\t\t\tkey={index}\n\t\t\t\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t\t\t\t{label}\n\t\t\t\t\t\t\t\t\t\t\t\t</BodyCaption>\n\t\t\t\t\t\t\t\t\t\t\t))}\n\t\t\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t\t) : undefined\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t<BodyCaption color={COLORS.content.placeholder}>\n\t\t\t\t\t\t\t\t\t{`+${remainingOptionsCnt} more`}\n\t\t\t\t\t\t\t\t</BodyCaption>\n\t\t\t\t\t\t\t</Tooltip>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t)}\n\n\t\t\t\t\t{chips.length === 0 && (\n\t\t\t\t\t\t<div style={{ color: COLORS.content.placeholder }}>\n\t\t\t\t\t\t\t{placeholder}\n\t\t\t\t\t\t</div>\n\t\t\t\t\t)}\n\t\t\t\t</div>\n\n\t\t\t\t<div>\n\t\t\t\t\t<DownIcon\n\t\t\t\t\t\tstyle={{\n\t\t\t\t\t\t\ttransform: isDropdownOpened ? 'rotate(180deg)' : 'rotate(0deg)',\n\t\t\t\t\t\t}}\n\t\t\t\t\t\twidth={\n\t\t\t\t\t\t\tsizeToUse === 'x-small' ? 16 : sizeToUse === 'small' ? 20 : 24\n\t\t\t\t\t\t}\n\t\t\t\t\t\theight={\n\t\t\t\t\t\t\tsizeToUse === 'x-small' ? 16 : sizeToUse === 'small' ? 20 : 24\n\t\t\t\t\t\t}\n\t\t\t\t\t\tcolor={COLORS.content.primary}\n\t\t\t\t\t/>\n\t\t\t\t</div>\n\t\t\t</ChipInputWrapper>\n\t\t\t{!!errorMessage && (\n\t\t\t\t<InputFooter invalid={true}>\n\t\t\t\t\t{!!errorMessage && <ErrorIcon width={16} height={16} />}\n\t\t\t\t\t{errorMessage}\n\t\t\t\t</InputFooter>\n\t\t\t)}\n\t\t</>\n\t);\n};\n\nexport default ChipInput;\n"],"names":["getMaxChipsCharCount","chips","ChipInput","onDeleteChip","containerStyle","sizeToUse","isDropdownOpened","placeholder","errorMessage","showLabelsOnMoreHover","options","setOptions","useState","remainingOptionsCnt","setRemainingOptionsCnt","remainingOptionsLabels","setRemainingOptionsLabels","useEffect","combineCharCnt","MAX_CHAR","option","labels","jsxs","Fragment","ChipInputWrapper","chip","index","jsx","Tag","StringUtils","CrossIcon","Tooltip","label","BodyCaption","COLORS","DownIcon","InputFooter","ErrorIcon"],"mappings":";;;;;;;;;;;;AAwBA,MAAMA,IAAuB,CAACC,MACzBA,EAAM,WAAW,IAAU,MAC3BA,EAAM,WAAW,IAAU,KACxB,IAGFC,IAAsC,CAAC;AAAA,EAC5C,OAAAD;AAAA,EACA,cAAAE;AAAA,EACA,gBAAAC,IAAiB,CAAA;AAAA,EACjB,WAAAC,IAAY;AAAA,EACZ,kBAAAC;AAAA,EACA,aAAAC,IAAc;AAAA,EACd,cAAAC,IAAe;AAAA,EACf,uBAAAC,IAAwB;AACzB,MAAM;AACL,QAAM,CAACC,GAASC,CAAU,IAAIC,EAAA,GACxB,CAACC,GAAqBC,CAAsB,IAAIF,EAAS,CAAC,GAC1D,CAACG,GAAwBC,CAAyB,IAAIJ,EAE1D,CAAA,CAAE;AAEJ,SAAAK,EAAU,MAAM;AACf,QAAI,CAAChB,EAAO;AACZ,QAAIiB,IAAiB;AACrB,UAAMC,IAAWnB,EAAqBC,CAAK;AAC3C,QAAIS,IAAUT,EAAM,OAAO,CAACmB,OAC3BF,KAAkBE,EAAO,MAAM,QACxBF,KAAkBC,EACzB;AACD,IAAIT,EAAQ,WAAW,KAAKT,EAAM,SAAS,MAC1CS,IAAU,CAACT,EAAM,CAAC,CAAC,IAEpBU,EAAWD,CAAO;AAElB,UAAMW,IADiBpB,EAAM,OAAO,CAACmB,MAAW,CAACV,EAAQ,SAASU,CAAM,CAAC,EAC3C,IAAI,CAACA,MAAWA,EAAO,KAAK;AAC1D,IAAAJ,EAA0BK,CAAM,GAChCP,EAAuBb,EAAM,SAASS,EAAQ,MAAM;AAAA,EACrD,GAAG,CAACT,CAAK,CAAC,GAGT,gBAAAqB,EAAAC,GAAA,EACC,UAAA;AAAA,IAAA,gBAAAD,EAACE,GAAA,EAAiB,OAAO,EAAE,GAAGpB,KAAkB,OAAO,CAAC,CAACI,GACxD,UAAA;AAAA,MAAA,gBAAAc,EAAC,OAAA,EAAI,WAAU,mBACb,UAAA;AAAA,QAAAZ,GAAS,IAAI,CAACe,GAAMC,MACpB,gBAAAC,EAAC,SAAgB,OAAO,EAAE,QAAQ,EAAA,GACjC,UAAA,gBAAAA;AAAA,UAACC;AAAA,UAAA;AAAA,YACA,SAASC,EAAY;AAAA,cACpBJ,EAAK,iBAAiBA,EAAK;AAAA,cAC3B;AAAA,YAAA;AAAA,YAED,cAAc,MACb,gBAAAE;AAAA,cAACG;AAAAA,cAAA;AAAA,gBACA,OAAO;AAAA,gBACP,QAAQ;AAAA,gBACR,OAAO,EAAE,QAAQ,UAAA;AAAA,gBACjB,SAAS,MAAM;AACd,kBAAA3B,EAAasB,CAAI;AAAA,gBAClB;AAAA,cAAA;AAAA,YAAA;AAAA,YAID,UAAAA,EAAK,iBAAiBA,EAAK;AAAA,UAAA;AAAA,QAAA,EAC7B,
|
|
1
|
+
{"version":3,"file":"ChipInput.js","sources":["../../../../src/components/dropdown/ChipInput.tsx"],"sourcesContent":["import React, { useEffect, useState } from 'react';\nimport StringUtils from '@src/utils/StringUtils';\nimport { COLORS } from '@src/constants/Theme';\nimport DownIcon from '../../assets/icons/chevronDown.svg';\nimport CrossIcon from '../../assets/icons/cross.svg';\nimport ErrorIcon from '../../assets/icons/errorInfo.svg';\nimport { InputFooter } from '../input/Input.styled';\nimport { Tag } from '../tag';\nimport { Tooltip } from '../tooltips';\nimport { BodyCaption } from '../TypographyStyle';\nimport { ChipInputWrapper } from './Common.styled';\nimport { SingleOption } from './type';\n\ninterface ChipInputProps {\n\tplaceholder?: string;\n\tchips: SingleOption[];\n\tonDeleteChip: (chip: SingleOption) => void;\n\tcontainerStyle?: React.CSSProperties;\n\tisDropdownOpened?: boolean;\n\tsizeToUse?: 'default' | 'small' | 'x-small';\n\terrorMessage?: string;\n\tshowLabelsOnMoreHover?: boolean;\n}\n\nconst getMaxChipsCharCount = (chips: SingleOption[]) => {\n\tif (chips.length === 1) return 100;\n\tif (chips.length === 2) return 40;\n\treturn 34;\n};\n\nconst ChipInput: React.FC<ChipInputProps> = ({\n\tchips,\n\tonDeleteChip,\n\tcontainerStyle = {},\n\tsizeToUse = 'default',\n\tisDropdownOpened,\n\tplaceholder = 'Select..',\n\terrorMessage = '',\n\tshowLabelsOnMoreHover = false,\n}) => {\n\tconst [options, setOptions] = useState<SingleOption[]>();\n\tconst [remainingOptionsCnt, setRemainingOptionsCnt] = useState(0);\n\tconst [remainingOptionsLabels, setRemainingOptionsLabels] = useState<\n\t\tstring[]\n\t>([]);\n\n\tuseEffect(() => {\n\t\tif (!chips) return;\n\t\tlet combineCharCnt = 0;\n\t\tconst MAX_CHAR = getMaxChipsCharCount(chips);\n\t\tlet options = chips.filter((option) => {\n\t\t\tcombineCharCnt += option.label.length;\n\t\t\treturn combineCharCnt <= MAX_CHAR;\n\t\t});\n\t\tif (options.length === 0 && chips.length > 0) {\n\t\t\toptions = [chips[0]];\n\t\t}\n\t\tsetOptions(options);\n\t\tconst remainingChips = chips.filter((option) => !options.includes(option));\n\t\tconst labels = remainingChips.map((option) => option.label);\n\t\tsetRemainingOptionsLabels(labels);\n\t\tsetRemainingOptionsCnt(chips.length - options.length);\n\t}, [chips]);\n\n\treturn (\n\t\t<>\n\t\t\t<ChipInputWrapper style={{ ...containerStyle }} error={!!errorMessage}>\n\t\t\t\t<div className=\"chips-container\">\n\t\t\t\t\t{options?.map((chip, index) => (\n\t\t\t\t\t\t<div key={index} style={{ zIndex: 2 }}>\n\t\t\t\t\t\t\t<Tag\n\t\t\t\t\t\t\t\ttagText={StringUtils.truncateText(\n\t\t\t\t\t\t\t\t\tchip.selectedLabel || chip.label,\n\t\t\t\t\t\t\t\t\t40,\n\t\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t\t\tTrailingIcon={() => (\n\t\t\t\t\t\t\t\t\t<CrossIcon\n\t\t\t\t\t\t\t\t\t\tdata-testid=\"chip-remove-icon\"\n\t\t\t\t\t\t\t\t\t\twidth={12}\n\t\t\t\t\t\t\t\t\t\theight={12}\n\t\t\t\t\t\t\t\t\t\tstyle={{ cursor: 'pointer' }}\n\t\t\t\t\t\t\t\t\t\tonClick={() => {\n\t\t\t\t\t\t\t\t\t\t\tonDeleteChip(chip);\n\t\t\t\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t{chip.selectedLabel || chip.label}\n\t\t\t\t\t\t\t</Tag>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t))}\n\t\t\t\t\t{!!remainingOptionsCnt && (\n\t\t\t\t\t\t<div\n\t\t\t\t\t\t\tstyle={{\n\t\t\t\t\t\t\t\tposition: 'relative',\n\t\t\t\t\t\t\t\tzIndex: 2,\n\t\t\t\t\t\t\t\tpointerEvents: 'auto',\n\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<Tooltip\n\t\t\t\t\t\t\t\tbody={''}\n\t\t\t\t\t\t\t\tplacement=\"bottom\"\n\t\t\t\t\t\t\t\ttooltipContent={\n\t\t\t\t\t\t\t\t\tshowLabelsOnMoreHover && remainingOptionsLabels.length > 0 ? (\n\t\t\t\t\t\t\t\t\t\t<div style={{ padding: '4px' }}>\n\t\t\t\t\t\t\t\t\t\t\t{remainingOptionsLabels.map((label, index) => (\n\t\t\t\t\t\t\t\t\t\t\t\t<BodyCaption\n\t\t\t\t\t\t\t\t\t\t\t\t\tstyle={{ color: COLORS.text.white }}\n\t\t\t\t\t\t\t\t\t\t\t\t\tkey={index}\n\t\t\t\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t\t\t\t{label}\n\t\t\t\t\t\t\t\t\t\t\t\t</BodyCaption>\n\t\t\t\t\t\t\t\t\t\t\t))}\n\t\t\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t\t) : undefined\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t<BodyCaption color={COLORS.content.placeholder}>\n\t\t\t\t\t\t\t\t\t{`+${remainingOptionsCnt} more`}\n\t\t\t\t\t\t\t\t</BodyCaption>\n\t\t\t\t\t\t\t</Tooltip>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t)}\n\n\t\t\t\t\t{chips.length === 0 && (\n\t\t\t\t\t\t<div style={{ color: COLORS.content.placeholder }}>\n\t\t\t\t\t\t\t{placeholder}\n\t\t\t\t\t\t</div>\n\t\t\t\t\t)}\n\t\t\t\t</div>\n\n\t\t\t\t<div>\n\t\t\t\t\t<DownIcon\n\t\t\t\t\t\tstyle={{\n\t\t\t\t\t\t\ttransform: isDropdownOpened ? 'rotate(180deg)' : 'rotate(0deg)',\n\t\t\t\t\t\t}}\n\t\t\t\t\t\twidth={\n\t\t\t\t\t\t\tsizeToUse === 'x-small' ? 16 : sizeToUse === 'small' ? 20 : 24\n\t\t\t\t\t\t}\n\t\t\t\t\t\theight={\n\t\t\t\t\t\t\tsizeToUse === 'x-small' ? 16 : sizeToUse === 'small' ? 20 : 24\n\t\t\t\t\t\t}\n\t\t\t\t\t\tcolor={COLORS.content.primary}\n\t\t\t\t\t/>\n\t\t\t\t</div>\n\t\t\t</ChipInputWrapper>\n\t\t\t{!!errorMessage && (\n\t\t\t\t<InputFooter invalid={true}>\n\t\t\t\t\t{!!errorMessage && <ErrorIcon width={16} height={16} />}\n\t\t\t\t\t{errorMessage}\n\t\t\t\t</InputFooter>\n\t\t\t)}\n\t\t</>\n\t);\n};\n\nexport default ChipInput;\n"],"names":["getMaxChipsCharCount","chips","ChipInput","onDeleteChip","containerStyle","sizeToUse","isDropdownOpened","placeholder","errorMessage","showLabelsOnMoreHover","options","setOptions","useState","remainingOptionsCnt","setRemainingOptionsCnt","remainingOptionsLabels","setRemainingOptionsLabels","useEffect","combineCharCnt","MAX_CHAR","option","labels","jsxs","Fragment","ChipInputWrapper","chip","index","jsx","Tag","StringUtils","CrossIcon","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A,QAIDZ,EAAM,WAAW,KACjB,gBAAA0B,EAAC,OAAA,EAAI,OAAO,EAAE,OAAOO,EAAO,QAAQ,YAAA,GAClC,UAAA3B,EAAA,CACF;AAAA,MAAA,GAEF;AAAA,wBAEC,OAAA,EACA,UAAA,gBAAAoB;AAAA,QAACQ;AAAAA,QAAA;AAAA,UACA,OAAO;AAAA,YACN,WAAW7B,IAAmB,mBAAmB;AAAA,UAAA;AAAA,UAElD,OACCD,MAAc,YAAY,KAAKA,MAAc,UAAU,KAAK;AAAA,UAE7D,QACCA,MAAc,YAAY,KAAKA,MAAc,UAAU,KAAK;AAAA,UAE7D,OAAO6B,EAAO,QAAQ;AAAA,QAAA;AAAA,MAAA,EACvB,CACD;AAAA,IAAA,GACD;AAAA,IACC,CAAC,CAAC1B,KACF,gBAAAc,EAACc,GAAA,EAAY,SAAS,IACpB,UAAA;AAAA,MAAA,CAAC,CAAC5B,KAAgB,gBAAAmB,EAACU,KAAU,OAAO,IAAI,QAAQ,IAAI;AAAA,MACpD7B;AAAA,IAAA,EAAA,CACF;AAAA,EAAA,GAEF;AAEF;"}
|
|
@@ -26,28 +26,28 @@ const H = ({
|
|
|
26
26
|
showTrailingIconPlaceholder: V = !1,
|
|
27
27
|
showLabelsOnMoreHover: j = !1,
|
|
28
28
|
value: l,
|
|
29
|
-
showSelected:
|
|
29
|
+
showSelected: f = !1,
|
|
30
30
|
onDropdownVisbilityChange: z,
|
|
31
31
|
...t
|
|
32
32
|
}) => {
|
|
33
|
-
const [
|
|
33
|
+
const [c, F] = g(!1), [y, I] = g(!1), i = E ?? "default", B = G(), [s, d] = g(
|
|
34
34
|
o ?? []
|
|
35
35
|
);
|
|
36
36
|
function N(e) {
|
|
37
|
-
Array.isArray(e) ?
|
|
37
|
+
Array.isArray(e) ? d([...e]) : d([e]), M?.(e);
|
|
38
38
|
}
|
|
39
39
|
p(() => {
|
|
40
40
|
const e = [];
|
|
41
|
-
t?.options?.forEach((
|
|
42
|
-
|
|
41
|
+
t?.options?.forEach((h) => {
|
|
42
|
+
h.options ? h.options.forEach((u) => {
|
|
43
43
|
u.selected && e.push({
|
|
44
44
|
...u,
|
|
45
45
|
label: u.label
|
|
46
46
|
});
|
|
47
|
-
}) :
|
|
48
|
-
}),
|
|
47
|
+
}) : h.selected && e.push(h);
|
|
48
|
+
}), d([...e]);
|
|
49
49
|
}, [t.options]), p(() => {
|
|
50
|
-
o &&
|
|
50
|
+
o && d([...o]);
|
|
51
51
|
}, [o]);
|
|
52
52
|
const U = Z(s), _ = w ? a : U ?? a ?? "Select an option", m = t.buttonWidth, C = m ?? t.width ?? "100%", q = t.dropdownWidth ?? C;
|
|
53
53
|
return /* @__PURE__ */ n(b, { children: /* @__PURE__ */ n(
|
|
@@ -61,14 +61,19 @@ const H = ({
|
|
|
61
61
|
zIndex: 1,
|
|
62
62
|
cursor: "pointer",
|
|
63
63
|
padding: i === "x-small" ? "4px 8px" : "6px 8px",
|
|
64
|
-
backgroundColor: t.version === "3.0" ?
|
|
64
|
+
backgroundColor: t.version === "3.0" ? c || y ? r.surface.hovered : r.surface.standard : f && l !== void 0 ? J.positive[100] : (
|
|
65
|
+
// The hover wrapper also contains the popover, so while the
|
|
66
|
+
// dropdown is open, hovering an option would grey the input
|
|
67
|
+
// — only show hover feedback while closed.
|
|
68
|
+
y && !c ? r.background.inactive : r.surface.standard
|
|
69
|
+
),
|
|
65
70
|
transition: "background-color 0.3s ease",
|
|
66
71
|
...A
|
|
67
72
|
},
|
|
68
73
|
input: {
|
|
69
74
|
minHeight: "100%",
|
|
70
75
|
maxWidth: "100%",
|
|
71
|
-
color:
|
|
76
|
+
color: f && l !== void 0 ? r.content.positive : "inherit"
|
|
72
77
|
}
|
|
73
78
|
},
|
|
74
79
|
children: /* @__PURE__ */ n(
|
|
@@ -117,12 +122,12 @@ const H = ({
|
|
|
117
122
|
K,
|
|
118
123
|
{
|
|
119
124
|
style: {
|
|
120
|
-
transform:
|
|
125
|
+
transform: c ? "rotate(180deg)" : "rotate(0deg)"
|
|
121
126
|
},
|
|
122
127
|
onClick: O,
|
|
123
128
|
width: i === "x-small" ? 16 : i === "small" ? 20 : 24,
|
|
124
129
|
height: i === "x-small" ? 16 : i === "small" ? 20 : 24,
|
|
125
|
-
color:
|
|
130
|
+
color: f ? r.content.positive : r.content.primary
|
|
126
131
|
}
|
|
127
132
|
)
|
|
128
133
|
]
|
|
@@ -141,7 +146,7 @@ const H = ({
|
|
|
141
146
|
R?.(e);
|
|
142
147
|
},
|
|
143
148
|
errorMessage: t.error,
|
|
144
|
-
isDropdownOpened:
|
|
149
|
+
isDropdownOpened: c,
|
|
145
150
|
sizeToUse: i,
|
|
146
151
|
containerStyle: {
|
|
147
152
|
width: t.width ?? "100%",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Dropdown.js","sources":["../../../../src/components/dropdown/Dropdown.tsx"],"sourcesContent":["import React, { Ref, useEffect, useRef, useState } from 'react';\nimport { BASE_COLORS, COLORS } from '@src/constants/Theme';\nimport DownIcon from '../../assets/icons/chevronDown.svg';\nimport { Input } from '../input';\nimport { InputStyleContext } from '../input/context/InputStyleProvider';\nimport ChipInput from './ChipInput';\nimport { DropdownPopover } from './DropdownPopover';\nimport { getSelectedOptionsAsText } from './OpenedDropdown/utils/iterationOnOptions';\nimport {\n\tDropdownOption,\n\tGroupedOption,\n\tOpenDropdownProps,\n\tSingleOption,\n} from './type';\n\nexport type DropdownProps = OpenDropdownProps & {\n\tplaceHolder?: string;\n\tsize?: 'default' | 'small' | 'x-small';\n\tdisabled?: boolean;\n\tnoErrorHint?: boolean;\n\tbuttonWidth?: string;\n\tplaceHolderHeight?: string;\n\tshowPlaceholderWhenSelected?: boolean;\n\tinputStyle?: React.CSSProperties;\n\tinputType?: 'chip' | 'default';\n\tonDeleteChip?: (chip: SingleOption) => void;\n\ttruncatedText?: boolean;\n\t'data-test'?: string;\n\tshowLeadingIconInPlaceholder?: boolean;\n\tshowTrailingIconPlaceholder?: boolean;\n\tshowLabelsOnMoreHover?: boolean;\n\tbackgroundColor?: string;\n\tvalue?: string;\n\tshowSelected?: boolean;\n\t/** Fired when the dropdown opens/closes. Runs alongside internal open state. */\n\tonDropdownVisbilityChange?: (isOpen: boolean) => void;\n};\n\nfunction noop() {\n\t/** empty */\n}\n\nexport const Dropdown: React.FC<DropdownProps> = ({\n\tplaceHolder,\n\tsize,\n\tonSelect,\n\tdefaultOptions,\n\tdisabled,\n\tnoErrorHint,\n\tplaceHolderHeight,\n\tshowPlaceholderWhenSelected = false,\n\tinputStyle = {},\n\tinputType = 'default',\n\tonDeleteChip,\n\ttruncatedText,\n\tshowLeadingIconInPlaceholder = false,\n\tshowTrailingIconPlaceholder = false,\n\tshowLabelsOnMoreHover = false,\n\tvalue,\n\tshowSelected = false,\n\tonDropdownVisbilityChange,\n\t...openDropdownProps\n}) => {\n\tconst [isDropdownOpened, setDropdownOpenFlag] = useState(false);\n\tconst [isHovering, setIsHovering] = useState(false);\n\tconst sizeToUse = size ?? 'default';\n\tconst dropdownVisibilityRef = useRef<{\n\t\topenDropdown: boolean;\n\t}>();\n\tconst [selectedOption, setSelectedOption] = useState<DropdownOption[]>(\n\t\tdefaultOptions ?? [],\n\t);\n\tfunction handleSelection(option: DropdownOption | DropdownOption[]) {\n\t\tif (Array.isArray(option)) {\n\t\t\tsetSelectedOption([...option]);\n\t\t} else {\n\t\t\tsetSelectedOption([...[option]]);\n\t\t}\n\t\tonSelect?.(option);\n\t}\n\n\tuseEffect(() => {\n\t\tconst flatSelectedOption: SingleOption[] = [];\n\t\topenDropdownProps?.options?.forEach((option) => {\n\t\t\tif ((option as GroupedOption).options) {\n\t\t\t\t(option as GroupedOption).options.forEach((op) => {\n\t\t\t\t\tif (op.selected) {\n\t\t\t\t\t\tflatSelectedOption.push({\n\t\t\t\t\t\t\t...op,\n\t\t\t\t\t\t\tlabel: op.label,\n\t\t\t\t\t\t});\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t} else {\n\t\t\t\tif ((option as SingleOption).selected) {\n\t\t\t\t\tflatSelectedOption.push(option as SingleOption);\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\n\t\tsetSelectedOption([...flatSelectedOption]);\n\t}, [openDropdownProps.options]);\n\n\tuseEffect(() => {\n\t\tif (defaultOptions) {\n\t\t\tsetSelectedOption([...defaultOptions]);\n\t\t}\n\t}, [defaultOptions]);\n\n\tconst textVal = getSelectedOptionsAsText(selectedOption);\n\tconst displayText = showPlaceholderWhenSelected\n\t\t? placeHolder\n\t\t: textVal ?? placeHolder ?? 'Select an option';\n\n\tconst configuredMaxWidth = openDropdownProps.buttonWidth;\n\n\t// Shared width for the input wrapper and dropdown popover\n\tconst inputWidth = configuredMaxWidth ?? openDropdownProps.width ?? '100%';\n\n\t// Width passed to dropdown popover — matches input box width\n\tconst dropdownWidth = openDropdownProps.dropdownWidth ?? inputWidth;\n\n\treturn (\n\t\t<>\n\t\t\t<InputStyleContext.Provider\n\t\t\t\tvalue={{\n\t\t\t\t\tInputWrapper: {\n\t\t\t\t\t\theight: placeHolderHeight\n\t\t\t\t\t\t\t? placeHolderHeight\n\t\t\t\t\t\t\t: sizeToUse === 'x-small'\n\t\t\t\t\t\t\t? 24\n\t\t\t\t\t\t\t: sizeToUse === 'small'\n\t\t\t\t\t\t\t? 32\n\t\t\t\t\t\t\t: 48,\n\t\t\t\t\t\twidth: inputWidth,\n\t\t\t\t\t\t...(configuredMaxWidth ? { maxWidth: configuredMaxWidth } : {}),\n\t\t\t\t\t\tzIndex: 1,\n\t\t\t\t\t\tcursor: 'pointer',\n\t\t\t\t\t\tpadding: sizeToUse === 'x-small' ? '4px 8px' : '6px 8px',\n\t\t\t\t\t\tbackgroundColor:\n\t\t\t\t\t\t\topenDropdownProps.version === '3.0'\n\t\t\t\t\t\t\t\t? isDropdownOpened || isHovering\n\t\t\t\t\t\t\t\t\t? COLORS.surface.hovered\n\t\t\t\t\t\t\t\t\t: COLORS.surface.standard\n\t\t\t\t\t\t\t\t: showSelected && value !== undefined\n\t\t\t\t\t\t\t\t? BASE_COLORS.positive['100']\n\t\t\t\t\t\t\t\t: isHovering\n\t\t\t\t\t\t\t\t? COLORS.background.inactive\n\t\t\t\t\t\t\t\t: COLORS.surface.standard,\n\t\t\t\t\t\ttransition: 'background-color 0.3s ease',\n\t\t\t\t\t\t...inputStyle,\n\t\t\t\t\t},\n\t\t\t\t\tinput: {\n\t\t\t\t\t\tminHeight: '100%',\n\t\t\t\t\t\tmaxWidth: '100%',\n\t\t\t\t\t\tcolor:\n\t\t\t\t\t\t\tshowSelected && value !== undefined\n\t\t\t\t\t\t\t\t? COLORS.content.positive\n\t\t\t\t\t\t\t\t: 'inherit',\n\t\t\t\t\t},\n\t\t\t\t}}\n\t\t\t>\n\t\t\t\t<div\n\t\t\t\t\tonMouseEnter={() => setIsHovering(true)}\n\t\t\t\t\tonMouseLeave={() => setIsHovering(false)}\n\t\t\t\t\tstyle={\n\t\t\t\t\t\topenDropdownProps.width\n\t\t\t\t\t\t\t? { width: openDropdownProps.width }\n\t\t\t\t\t\t\t: undefined\n\t\t\t\t\t}\n\t\t\t\t>\n\t\t\t\t\t<DropdownPopover\n\t\t\t\t\t\tdata-test={openDropdownProps['data-test']}\n\t\t\t\t\t\tref={\n\t\t\t\t\t\t\tdropdownVisibilityRef as Ref<{\n\t\t\t\t\t\t\t\topenDropdown: boolean;\n\t\t\t\t\t\t\t}>\n\t\t\t\t\t\t}\n\t\t\t\t\t\tonSelect={handleSelection}\n\t\t\t\t\t\tdisabled={disabled}\n\t\t\t\t\t\t{...openDropdownProps}\n\t\t\t\t\t\tonDropdownVisbilityChange={(isOpen) => {\n\t\t\t\t\t\t\t// Keep the internal open flag (carat/open styling) AND forward\n\t\t\t\t\t\t\t// to a consumer-provided handler so callers can react to open state.\n\t\t\t\t\t\t\tsetDropdownOpenFlag(isOpen);\n\t\t\t\t\t\t\tonDropdownVisbilityChange?.(isOpen);\n\t\t\t\t\t\t}}\n\t\t\t\t\t\twidth={dropdownWidth}\n\t\t\t\t\t>\n\t\t\t\t\t\t{inputType == 'default' && (\n\t\t\t\t\t\t\t<Input\n\t\t\t\t\t\t\t\tversion={openDropdownProps.version}\n\t\t\t\t\t\t\t\tnoErrorHint={noErrorHint}\n\t\t\t\t\t\t\t\tstate={disabled ? 'disabled' : 'none'}\n\t\t\t\t\t\t\t\tvalue={value === undefined ? displayText : value}\n\t\t\t\t\t\t\t\terrorMessage={openDropdownProps.error}\n\t\t\t\t\t\t\t\tvariant={sizeToUse}\n\t\t\t\t\t\t\t\tplaceholder={placeHolder ?? 'Select an option'}\n\t\t\t\t\t\t\t\tonChangeText={noop}\n\t\t\t\t\t\t\t\tleftIcon={\n\t\t\t\t\t\t\t\t\tshowLeadingIconInPlaceholder && selectedOption[0]?.leadingIcon\n\t\t\t\t\t\t\t\t\t\t? {\n\t\t\t\t\t\t\t\t\t\t\t\ticon: () => <>{selectedOption[0]?.leadingIcon}</>,\n\t\t\t\t\t\t\t\t\t\t }\n\t\t\t\t\t\t\t\t\t\t: undefined\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\trightIcon={{\n\t\t\t\t\t\t\t\t\ticon: () => (\n\t\t\t\t\t\t\t\t\t\t<div\n\t\t\t\t\t\t\t\t\t\t\tstyle={{\n\t\t\t\t\t\t\t\t\t\t\t\tdisplay: 'flex',\n\t\t\t\t\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t\t{showTrailingIconPlaceholder &&\n\t\t\t\t\t\t\t\t\t\t\t\t(selectedOption[0] as SingleOption)?.trailingIcon}\n\t\t\t\t\t\t\t\t\t\t\t<DownIcon\n\t\t\t\t\t\t\t\t\t\t\t\tstyle={{\n\t\t\t\t\t\t\t\t\t\t\t\t\ttransform: isDropdownOpened\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t? 'rotate(180deg)'\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t: 'rotate(0deg)',\n\t\t\t\t\t\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t\t\t\t\t\t\tonClick={noop}\n\t\t\t\t\t\t\t\t\t\t\t\twidth={\n\t\t\t\t\t\t\t\t\t\t\t\t\tsizeToUse === 'x-small'\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t? 16\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t: sizeToUse === 'small'\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t? 20\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t: 24\n\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\theight={\n\t\t\t\t\t\t\t\t\t\t\t\t\tsizeToUse === 'x-small'\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t? 16\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t: sizeToUse === 'small'\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t? 20\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t: 24\n\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\tcolor={\n\t\t\t\t\t\t\t\t\t\t\t\t\tshowSelected\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t? COLORS.content.positive\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t: COLORS.content.primary\n\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t\t\ttruncateText={truncatedText ?? true}\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t)}\n\t\t\t\t\t\t{inputType == 'chip' && (\n\t\t\t\t\t\t\t<ChipInput\n\t\t\t\t\t\t\t\tplaceholder={placeHolder ?? 'Select options'}\n\t\t\t\t\t\t\t\tchips={selectedOption as SingleOption[]}\n\t\t\t\t\t\t\t\tonDeleteChip={(chip) => {\n\t\t\t\t\t\t\t\t\tonDeleteChip?.(chip);\n\t\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t\t\terrorMessage={openDropdownProps.error}\n\t\t\t\t\t\t\t\tisDropdownOpened={isDropdownOpened}\n\t\t\t\t\t\t\t\tsizeToUse={sizeToUse}\n\t\t\t\t\t\t\t\tcontainerStyle={{\n\t\t\t\t\t\t\t\t\twidth: openDropdownProps.width ?? '100%',\n\t\t\t\t\t\t\t\t\tcursor: 'pointer',\n\t\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t\t\tshowLabelsOnMoreHover={showLabelsOnMoreHover}\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t)}\n\t\t\t\t\t</DropdownPopover>\n\t\t\t\t</div>\n\t\t\t</InputStyleContext.Provider>\n\t\t</>\n\t);\n};\n\nDropdown.displayName = 'Dropdown';\n"],"names":["noop","Dropdown","placeHolder","size","onSelect","defaultOptions","disabled","noErrorHint","placeHolderHeight","showPlaceholderWhenSelected","inputStyle","inputType","onDeleteChip","truncatedText","showLeadingIconInPlaceholder","showTrailingIconPlaceholder","showLabelsOnMoreHover","value","showSelected","onDropdownVisbilityChange","openDropdownProps","isDropdownOpened","setDropdownOpenFlag","useState","isHovering","setIsHovering","sizeToUse","dropdownVisibilityRef","useRef","selectedOption","setSelectedOption","handleSelection","option","useEffect","flatSelectedOption","op","textVal","getSelectedOptionsAsText","displayText","configuredMaxWidth","inputWidth","dropdownWidth","jsx","Fragment","InputStyleContext","COLORS","BASE_COLORS","jsxs","DropdownPopover","isOpen","Input","DownIcon","ChipInput","chip"],"mappings":";;;;;;;;;AAsCA,SAASA,IAAO;AAEhB;AAEO,MAAMC,IAAoC,CAAC;AAAA,EACjD,aAAAC;AAAA,EACA,MAAAC;AAAA,EACA,UAAAC;AAAA,EACA,gBAAAC;AAAA,EACA,UAAAC;AAAA,EACA,aAAAC;AAAA,EACA,mBAAAC;AAAA,EACA,6BAAAC,IAA8B;AAAA,EAC9B,YAAAC,IAAa,CAAA;AAAA,EACb,W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B,OAAO2B;AAAA,oBACP,cAAc,CAACwB,MAAS;AACvB,sBAAAzC,IAAeyC,CAAI;AAAA,oBACpB;AAAA,oBACA,cAAcjC,EAAkB;AAAA,oBAChC,kBAAAC;AAAA,oBACA,WAAAK;AAAA,oBACA,gBAAgB;AAAA,sBACf,OAAON,EAAkB,SAAS;AAAA,sBAClC,QAAQ;AAAA,oBAAA;AAAA,oBAET,uBAAAJ;AAAA,kBAAA;AAAA,gBAAA;AAAA,cACD;AAAA,YAAA;AAAA,UAAA;AAAA,QAEF;AAAA,MAAA;AAAA,IACD;AAAA,EAAA,GAEF;AAEF;AAEAf,EAAS,cAAc;"}
|
|
1
|
+
{"version":3,"file":"Dropdown.js","sources":["../../../../src/components/dropdown/Dropdown.tsx"],"sourcesContent":["import React, { Ref, useEffect, useRef, useState } from 'react';\nimport { BASE_COLORS, COLORS } from '@src/constants/Theme';\nimport DownIcon from '../../assets/icons/chevronDown.svg';\nimport { Input } from '../input';\nimport { InputStyleContext } from '../input/context/InputStyleProvider';\nimport ChipInput from './ChipInput';\nimport { DropdownPopover } from './DropdownPopover';\nimport { getSelectedOptionsAsText } from './OpenedDropdown/utils/iterationOnOptions';\nimport {\n\tDropdownOption,\n\tGroupedOption,\n\tOpenDropdownProps,\n\tSingleOption,\n} from './type';\n\nexport type DropdownProps = OpenDropdownProps & {\n\tplaceHolder?: string;\n\tsize?: 'default' | 'small' | 'x-small';\n\tdisabled?: boolean;\n\tnoErrorHint?: boolean;\n\tbuttonWidth?: string;\n\tplaceHolderHeight?: string;\n\tshowPlaceholderWhenSelected?: boolean;\n\tinputStyle?: React.CSSProperties;\n\tinputType?: 'chip' | 'default';\n\tonDeleteChip?: (chip: SingleOption) => void;\n\ttruncatedText?: boolean;\n\t'data-test'?: string;\n\tshowLeadingIconInPlaceholder?: boolean;\n\tshowTrailingIconPlaceholder?: boolean;\n\tshowLabelsOnMoreHover?: boolean;\n\tbackgroundColor?: string;\n\tvalue?: string;\n\tshowSelected?: boolean;\n\t/** Fired when the dropdown opens/closes. Runs alongside internal open state. */\n\tonDropdownVisbilityChange?: (isOpen: boolean) => void;\n};\n\nfunction noop() {\n\t/** empty */\n}\n\nexport const Dropdown: React.FC<DropdownProps> = ({\n\tplaceHolder,\n\tsize,\n\tonSelect,\n\tdefaultOptions,\n\tdisabled,\n\tnoErrorHint,\n\tplaceHolderHeight,\n\tshowPlaceholderWhenSelected = false,\n\tinputStyle = {},\n\tinputType = 'default',\n\tonDeleteChip,\n\ttruncatedText,\n\tshowLeadingIconInPlaceholder = false,\n\tshowTrailingIconPlaceholder = false,\n\tshowLabelsOnMoreHover = false,\n\tvalue,\n\tshowSelected = false,\n\tonDropdownVisbilityChange,\n\t...openDropdownProps\n}) => {\n\tconst [isDropdownOpened, setDropdownOpenFlag] = useState(false);\n\tconst [isHovering, setIsHovering] = useState(false);\n\tconst sizeToUse = size ?? 'default';\n\tconst dropdownVisibilityRef = useRef<{\n\t\topenDropdown: boolean;\n\t}>();\n\tconst [selectedOption, setSelectedOption] = useState<DropdownOption[]>(\n\t\tdefaultOptions ?? [],\n\t);\n\tfunction handleSelection(option: DropdownOption | DropdownOption[]) {\n\t\tif (Array.isArray(option)) {\n\t\t\tsetSelectedOption([...option]);\n\t\t} else {\n\t\t\tsetSelectedOption([...[option]]);\n\t\t}\n\t\tonSelect?.(option);\n\t}\n\n\tuseEffect(() => {\n\t\tconst flatSelectedOption: SingleOption[] = [];\n\t\topenDropdownProps?.options?.forEach((option) => {\n\t\t\tif ((option as GroupedOption).options) {\n\t\t\t\t(option as GroupedOption).options.forEach((op) => {\n\t\t\t\t\tif (op.selected) {\n\t\t\t\t\t\tflatSelectedOption.push({\n\t\t\t\t\t\t\t...op,\n\t\t\t\t\t\t\tlabel: op.label,\n\t\t\t\t\t\t});\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t} else {\n\t\t\t\tif ((option as SingleOption).selected) {\n\t\t\t\t\tflatSelectedOption.push(option as SingleOption);\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\n\t\tsetSelectedOption([...flatSelectedOption]);\n\t}, [openDropdownProps.options]);\n\n\tuseEffect(() => {\n\t\tif (defaultOptions) {\n\t\t\tsetSelectedOption([...defaultOptions]);\n\t\t}\n\t}, [defaultOptions]);\n\n\tconst textVal = getSelectedOptionsAsText(selectedOption);\n\tconst displayText = showPlaceholderWhenSelected\n\t\t? placeHolder\n\t\t: textVal ?? placeHolder ?? 'Select an option';\n\n\tconst configuredMaxWidth = openDropdownProps.buttonWidth;\n\n\t// Shared width for the input wrapper and dropdown popover\n\tconst inputWidth = configuredMaxWidth ?? openDropdownProps.width ?? '100%';\n\n\t// Width passed to dropdown popover — matches input box width\n\tconst dropdownWidth = openDropdownProps.dropdownWidth ?? inputWidth;\n\n\treturn (\n\t\t<>\n\t\t\t<InputStyleContext.Provider\n\t\t\t\tvalue={{\n\t\t\t\t\tInputWrapper: {\n\t\t\t\t\t\theight: placeHolderHeight\n\t\t\t\t\t\t\t? placeHolderHeight\n\t\t\t\t\t\t\t: sizeToUse === 'x-small'\n\t\t\t\t\t\t\t? 24\n\t\t\t\t\t\t\t: sizeToUse === 'small'\n\t\t\t\t\t\t\t? 32\n\t\t\t\t\t\t\t: 48,\n\t\t\t\t\t\twidth: inputWidth,\n\t\t\t\t\t\t...(configuredMaxWidth ? { maxWidth: configuredMaxWidth } : {}),\n\t\t\t\t\t\tzIndex: 1,\n\t\t\t\t\t\tcursor: 'pointer',\n\t\t\t\t\t\tpadding: sizeToUse === 'x-small' ? '4px 8px' : '6px 8px',\n\t\t\t\t\t\tbackgroundColor:\n\t\t\t\t\t\t\topenDropdownProps.version === '3.0'\n\t\t\t\t\t\t\t\t? isDropdownOpened || isHovering\n\t\t\t\t\t\t\t\t\t? COLORS.surface.hovered\n\t\t\t\t\t\t\t\t\t: COLORS.surface.standard\n\t\t\t\t\t\t\t\t: showSelected && value !== undefined\n\t\t\t\t\t\t\t\t? BASE_COLORS.positive['100']\n\t\t\t\t\t\t\t\t: // The hover wrapper also contains the popover, so while the\n\t\t\t\t\t\t\t\t// dropdown is open, hovering an option would grey the input\n\t\t\t\t\t\t\t\t// — only show hover feedback while closed.\n\t\t\t\t\t\t\t\tisHovering && !isDropdownOpened\n\t\t\t\t\t\t\t\t? COLORS.background.inactive\n\t\t\t\t\t\t\t\t: COLORS.surface.standard,\n\t\t\t\t\t\ttransition: 'background-color 0.3s ease',\n\t\t\t\t\t\t...inputStyle,\n\t\t\t\t\t},\n\t\t\t\t\tinput: {\n\t\t\t\t\t\tminHeight: '100%',\n\t\t\t\t\t\tmaxWidth: '100%',\n\t\t\t\t\t\tcolor:\n\t\t\t\t\t\t\tshowSelected && value !== undefined\n\t\t\t\t\t\t\t\t? COLORS.content.positive\n\t\t\t\t\t\t\t\t: 'inherit',\n\t\t\t\t\t},\n\t\t\t\t}}\n\t\t\t>\n\t\t\t\t<div\n\t\t\t\t\tonMouseEnter={() => setIsHovering(true)}\n\t\t\t\t\tonMouseLeave={() => setIsHovering(false)}\n\t\t\t\t\tstyle={\n\t\t\t\t\t\topenDropdownProps.width\n\t\t\t\t\t\t\t? { width: openDropdownProps.width }\n\t\t\t\t\t\t\t: undefined\n\t\t\t\t\t}\n\t\t\t\t>\n\t\t\t\t\t<DropdownPopover\n\t\t\t\t\t\tdata-test={openDropdownProps['data-test']}\n\t\t\t\t\t\tref={\n\t\t\t\t\t\t\tdropdownVisibilityRef as Ref<{\n\t\t\t\t\t\t\t\topenDropdown: boolean;\n\t\t\t\t\t\t\t}>\n\t\t\t\t\t\t}\n\t\t\t\t\t\tonSelect={handleSelection}\n\t\t\t\t\t\tdisabled={disabled}\n\t\t\t\t\t\t{...openDropdownProps}\n\t\t\t\t\t\tonDropdownVisbilityChange={(isOpen) => {\n\t\t\t\t\t\t\t// Keep the internal open flag (carat/open styling) AND forward\n\t\t\t\t\t\t\t// to a consumer-provided handler so callers can react to open state.\n\t\t\t\t\t\t\tsetDropdownOpenFlag(isOpen);\n\t\t\t\t\t\t\tonDropdownVisbilityChange?.(isOpen);\n\t\t\t\t\t\t}}\n\t\t\t\t\t\twidth={dropdownWidth}\n\t\t\t\t\t>\n\t\t\t\t\t\t{inputType == 'default' && (\n\t\t\t\t\t\t\t<Input\n\t\t\t\t\t\t\t\tversion={openDropdownProps.version}\n\t\t\t\t\t\t\t\tnoErrorHint={noErrorHint}\n\t\t\t\t\t\t\t\tstate={disabled ? 'disabled' : 'none'}\n\t\t\t\t\t\t\t\tvalue={value === undefined ? displayText : value}\n\t\t\t\t\t\t\t\terrorMessage={openDropdownProps.error}\n\t\t\t\t\t\t\t\tvariant={sizeToUse}\n\t\t\t\t\t\t\t\tplaceholder={placeHolder ?? 'Select an option'}\n\t\t\t\t\t\t\t\tonChangeText={noop}\n\t\t\t\t\t\t\t\tleftIcon={\n\t\t\t\t\t\t\t\t\tshowLeadingIconInPlaceholder && selectedOption[0]?.leadingIcon\n\t\t\t\t\t\t\t\t\t\t? {\n\t\t\t\t\t\t\t\t\t\t\t\ticon: () => <>{selectedOption[0]?.leadingIcon}</>,\n\t\t\t\t\t\t\t\t\t\t }\n\t\t\t\t\t\t\t\t\t\t: undefined\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\trightIcon={{\n\t\t\t\t\t\t\t\t\ticon: () => (\n\t\t\t\t\t\t\t\t\t\t<div\n\t\t\t\t\t\t\t\t\t\t\tstyle={{\n\t\t\t\t\t\t\t\t\t\t\t\tdisplay: 'flex',\n\t\t\t\t\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t\t{showTrailingIconPlaceholder &&\n\t\t\t\t\t\t\t\t\t\t\t\t(selectedOption[0] as SingleOption)?.trailingIcon}\n\t\t\t\t\t\t\t\t\t\t\t<DownIcon\n\t\t\t\t\t\t\t\t\t\t\t\tstyle={{\n\t\t\t\t\t\t\t\t\t\t\t\t\ttransform: isDropdownOpened\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t? 'rotate(180deg)'\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t: 'rotate(0deg)',\n\t\t\t\t\t\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t\t\t\t\t\t\tonClick={noop}\n\t\t\t\t\t\t\t\t\t\t\t\twidth={\n\t\t\t\t\t\t\t\t\t\t\t\t\tsizeToUse === 'x-small'\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t? 16\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t: sizeToUse === 'small'\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t? 20\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t: 24\n\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\theight={\n\t\t\t\t\t\t\t\t\t\t\t\t\tsizeToUse === 'x-small'\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t? 16\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t: sizeToUse === 'small'\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t? 20\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t: 24\n\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\tcolor={\n\t\t\t\t\t\t\t\t\t\t\t\t\tshowSelected\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t? COLORS.content.positive\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t: COLORS.content.primary\n\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t\t\ttruncateText={truncatedText ?? true}\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t)}\n\t\t\t\t\t\t{inputType == 'chip' && (\n\t\t\t\t\t\t\t<ChipInput\n\t\t\t\t\t\t\t\tplaceholder={placeHolder ?? 'Select options'}\n\t\t\t\t\t\t\t\tchips={selectedOption as SingleOption[]}\n\t\t\t\t\t\t\t\tonDeleteChip={(chip) => {\n\t\t\t\t\t\t\t\t\tonDeleteChip?.(chip);\n\t\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t\t\terrorMessage={openDropdownProps.error}\n\t\t\t\t\t\t\t\tisDropdownOpened={isDropdownOpened}\n\t\t\t\t\t\t\t\tsizeToUse={sizeToUse}\n\t\t\t\t\t\t\t\tcontainerStyle={{\n\t\t\t\t\t\t\t\t\twidth: openDropdownProps.width ?? '100%',\n\t\t\t\t\t\t\t\t\tcursor: 'pointer',\n\t\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t\t\tshowLabelsOnMoreHover={showLabelsOnMoreHover}\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t)}\n\t\t\t\t\t</DropdownPopover>\n\t\t\t\t</div>\n\t\t\t</InputStyleContext.Provider>\n\t\t</>\n\t);\n};\n\nDropdown.displayName = 'Dropdown';\n"],"names":["noop","Dropdown","placeHolder","size","onSelect","defaultOptions","disabled","noErrorHint","placeHolderHeight","showPlaceholderWhenSelected","inputStyle","inputType","onDeleteChip","truncatedText","showLeadingIconInPlaceholder","showTrailingIconPlaceholder","showLabelsOnMoreHover","value","showSelected","onDropdownVisbilityChange","openDropdownProps","isDropdownOpened","setDropdownOpenFlag","useState","isHovering","setIsHovering","sizeToUse","dropdownVisibilityRef","useRef","selectedOption","setSelectedOption","handleSelection","option","useEffect","flatSelectedOption","op","textVal","getSelectedOptionsAsText","displayText","configuredMaxWidth","inputWidth","dropdownWidth","jsx","Fragment","InputStyleContext","COLORS","BASE_COLORS","jsxs","DropdownPopover","isOpen","Input","DownIcon","ChipInput","chip"],"mappings":";;;;;;;;;AAsCA,SAASA,IAAO;AAEhB;AAEO,MAAMC,IAAoC,CAAC;AAAA,EACjD,aAAAC;AAAA,EACA,MAAAC;AAAA,EACA,UAAAC;AAAA,EACA,gBAAAC;AAAA,EACA,UAAAC;AAAA,EACA,aAAAC;AAAA,EACA,mBAAAC;AAAA,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gBAAA;AAAA,gBAGhCF,KAAa,UACb,gBAAA+B;AAAA,kBAACU;AAAA,kBAAA;AAAA,oBACA,aAAalD,KAAe;AAAA,oBAC5B,OAAO2B;AAAA,oBACP,cAAc,CAACwB,MAAS;AACvB,sBAAAzC,IAAeyC,CAAI;AAAA,oBACpB;AAAA,oBACA,cAAcjC,EAAkB;AAAA,oBAChC,kBAAAC;AAAA,oBACA,WAAAK;AAAA,oBACA,gBAAgB;AAAA,sBACf,OAAON,EAAkB,SAAS;AAAA,sBAClC,QAAQ;AAAA,oBAAA;AAAA,oBAET,uBAAAJ;AAAA,kBAAA;AAAA,gBAAA;AAAA,cACD;AAAA,YAAA;AAAA,UAAA;AAAA,QAEF;AAAA,MAAA;AAAA,IACD;AAAA,EAAA,GAEF;AAEF;AAEAf,EAAS,cAAc;"}
|
|
@@ -1,24 +1,24 @@
|
|
|
1
1
|
import { jsx as a, Fragment as b, jsxs as v } from "react/jsx-runtime";
|
|
2
2
|
import L, { useState as s, useRef as j, useImperativeHandle as A, useEffect as g } from "react";
|
|
3
3
|
import { usePopper as _ } from "react-popper";
|
|
4
|
-
import { COLORS as
|
|
5
|
-
import { OverLapAbs as
|
|
6
|
-
import { Tooltip as
|
|
7
|
-
import { DropShadow as
|
|
8
|
-
import { OpenedDropdown as
|
|
9
|
-
const
|
|
4
|
+
import { COLORS as w } from "../../../constants/Theme.js";
|
|
5
|
+
import { OverLapAbs as F, OpenDropdownContainer as N } from "../Common.styled.js";
|
|
6
|
+
import { Tooltip as T } from "../../tooltips/Tooltip.js";
|
|
7
|
+
import { DropShadow as V } from "../../dropShadow/DropShadow.js";
|
|
8
|
+
import { OpenedDropdown as Z } from "../OpenedDropdown/components/OpennedDropdown.js";
|
|
9
|
+
const q = L.forwardRef(
|
|
10
10
|
({
|
|
11
11
|
children: d,
|
|
12
12
|
onDropdownVisbilityChange: h,
|
|
13
13
|
version: l = "1.0",
|
|
14
14
|
tooltipContent: c,
|
|
15
15
|
tooltipDirection: S,
|
|
16
|
-
showTooltipArrow:
|
|
17
|
-
isChildLoading:
|
|
18
|
-
forceOpen:
|
|
16
|
+
showTooltipArrow: y,
|
|
17
|
+
isChildLoading: E,
|
|
18
|
+
forceOpen: o,
|
|
19
19
|
...e
|
|
20
|
-
},
|
|
21
|
-
const n =
|
|
20
|
+
}, R) => {
|
|
21
|
+
const n = R, [t, i] = s(!1), [x, f] = s(!1), [C, O] = s(null), [z, H] = s(null), u = j(null), { styles: I, attributes: M } = _(C, z, {
|
|
22
22
|
placement: e.placement,
|
|
23
23
|
strategy: e.strategy
|
|
24
24
|
}), k = (r) => {
|
|
@@ -42,25 +42,26 @@ const w = L.forwardRef(
|
|
|
42
42
|
style: {
|
|
43
43
|
position: "relative",
|
|
44
44
|
...l === "3.0" && {
|
|
45
|
-
backgroundColor: t || x ?
|
|
45
|
+
backgroundColor: t || x ? w.surface.hovered : "transparent",
|
|
46
46
|
transition: "background-color 0.3s ease",
|
|
47
47
|
borderRadius: 4
|
|
48
48
|
}
|
|
49
49
|
},
|
|
50
50
|
ref: O,
|
|
51
|
-
onMouseEnter: l === "3.0" ? () =>
|
|
52
|
-
onMouseLeave: l === "3.0" ? () =>
|
|
51
|
+
onMouseEnter: l === "3.0" ? () => f(!0) : void 0,
|
|
52
|
+
onMouseLeave: l === "3.0" ? () => f(!1) : void 0,
|
|
53
53
|
children: [
|
|
54
54
|
/* @__PURE__ */ a(
|
|
55
|
-
|
|
55
|
+
F,
|
|
56
56
|
{
|
|
57
57
|
ref: u,
|
|
58
|
+
"data-testid": "dropdown-overlay",
|
|
58
59
|
allowEvents: e.allowEvents,
|
|
59
60
|
disabled: e.disabled,
|
|
60
61
|
onClick: (r) => {
|
|
61
62
|
e.onDropdownOpen?.(), t ? (i(!1), r.preventDefault()) : e.disabled || i(!0);
|
|
62
63
|
},
|
|
63
|
-
isChildLoading:
|
|
64
|
+
isChildLoading: E,
|
|
64
65
|
children: e.allowEvents ? d : null
|
|
65
66
|
}
|
|
66
67
|
),
|
|
@@ -68,8 +69,8 @@ const w = L.forwardRef(
|
|
|
68
69
|
]
|
|
69
70
|
}
|
|
70
71
|
),
|
|
71
|
-
(t ||
|
|
72
|
-
|
|
72
|
+
(t || o) && /* @__PURE__ */ a(
|
|
73
|
+
N,
|
|
73
74
|
{
|
|
74
75
|
ref: H,
|
|
75
76
|
style: {
|
|
@@ -79,7 +80,7 @@ const w = L.forwardRef(
|
|
|
79
80
|
...M.popper,
|
|
80
81
|
"data-test": e["data-test"],
|
|
81
82
|
children: /* @__PURE__ */ a(
|
|
82
|
-
|
|
83
|
+
V,
|
|
83
84
|
{
|
|
84
85
|
level: "z2",
|
|
85
86
|
position: "down",
|
|
@@ -88,7 +89,7 @@ const w = L.forwardRef(
|
|
|
88
89
|
boxShadow: "0 2px 8px 0 rgba(0, 0, 0, 0.12)"
|
|
89
90
|
},
|
|
90
91
|
children: /* @__PURE__ */ a(
|
|
91
|
-
|
|
92
|
+
Z,
|
|
92
93
|
{
|
|
93
94
|
...e,
|
|
94
95
|
onSelect: (r) => {
|
|
@@ -107,19 +108,19 @@ const w = L.forwardRef(
|
|
|
107
108
|
}
|
|
108
109
|
)
|
|
109
110
|
] });
|
|
110
|
-
return /* @__PURE__ */ a(b, { children: !t && !
|
|
111
|
-
|
|
111
|
+
return /* @__PURE__ */ a(b, { children: !t && !o && c !== void 0 ? /* @__PURE__ */ a(
|
|
112
|
+
T,
|
|
112
113
|
{
|
|
113
114
|
body: c,
|
|
114
115
|
placement: S,
|
|
115
|
-
hideArrow: !
|
|
116
|
+
hideArrow: !y,
|
|
116
117
|
children: /* @__PURE__ */ a("div", { "data-test": e["data-test"], children: m() })
|
|
117
118
|
}
|
|
118
119
|
) : m() });
|
|
119
120
|
}
|
|
120
121
|
);
|
|
121
|
-
|
|
122
|
+
q.displayName = "DropdownPopover";
|
|
122
123
|
export {
|
|
123
|
-
|
|
124
|
+
q as DropdownPopover
|
|
124
125
|
};
|
|
125
126
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../../../../src/components/dropdown/DropdownPopover/index.tsx"],"sourcesContent":["import React, {\n\tLegacyRef,\n\tRef,\n\tuseEffect,\n\tuseImperativeHandle,\n\tuseRef,\n\tuseState,\n} from 'react';\nimport { usePopper } from 'react-popper';\nimport { DropShadow } from '@src/components/dropShadow';\nimport { Placement, Tooltip } from '@src/components/tooltips';\nimport { COLORS } from '@src/constants/Theme';\nimport { OpenDropdownContainer, OverLapAbs } from '../Common.styled';\nimport { OpenedDropdown } from '../OpenedDropdown';\nimport { OpenDropdownProps } from '../type';\n\ntype DropdownProps = OpenDropdownProps & {\n\tisLoading?: boolean;\n\tchildren?: React.ReactNode;\n\tdisabled?: boolean;\n\tonDropdownOpen?: () => void;\n\tonDropdownVisbilityChange?: (isOpen: boolean) => void;\n\ttooltipContent?: string;\n\ttooltipDirection?: Placement;\n\tshowTooltipArrow?: boolean;\n\tallowEvents?: boolean;\n\t'data-test'?: string;\n\tisChildLoading?: boolean;\n\t/**\n\t * If true, forces the dropdown to remain open regardless of user interaction or internal state.\n\t * This prop overrides the internal openDropdown state, ensuring the dropdown stays open.\n\t * Use this prop when you need to programmatically control the dropdown's visibility from a parent component.\n\t */\n\tforceOpen?: boolean;\n};\n\nexport const DropdownPopover = React.forwardRef<\n\t{\n\t\topenDropdown: boolean;\n\t},\n\tDropdownProps\n>(\n\t(\n\t\t{\n\t\t\tchildren,\n\t\t\tonDropdownVisbilityChange,\n\t\t\tversion = '1.0',\n\t\t\ttooltipContent,\n\t\t\ttooltipDirection,\n\t\t\tshowTooltipArrow,\n\t\t\tisChildLoading,\n\t\t\tforceOpen,\n\t\t\t...openDropdownProps\n\t\t},\n\t\tunTypedRef,\n\t) => {\n\t\tconst ref = unTypedRef as React.RefObject<{ openDropdown: boolean }>;\n\t\tconst [openDropdown, setDropdownVisibility] = useState(false);\n\t\tconst [isHovering, setIsHovering] = useState(false);\n\t\tconst [referenceElement, setReferenceElement] = useState(null);\n\t\tconst [popperElement, setPopperElement] = useState(null);\n\t\tconst headerRef = useRef(null);\n\n\t\tconst { styles, attributes } = usePopper(referenceElement, popperElement, {\n\t\t\tplacement: openDropdownProps.placement,\n\t\t\tstrategy: openDropdownProps.strategy,\n\t\t});\n\n\t\tconst onCloseHandle = (data) => {\n\t\t\tif (version === '2.0' && openDropdownProps.isMultiSelect && data) {\n\t\t\t\topenDropdownProps.onSelect?.([...data]);\n\t\t\t}\n\t\t\tsetDropdownVisibility(false);\n\t\t\topenDropdownProps?.onClose?.();\n\t\t};\n\n\t\tuseImperativeHandle(\n\t\t\tref,\n\t\t\t() => {\n\t\t\t\treturn {\n\t\t\t\t\topenDropdown: openDropdown,\n\t\t\t\t};\n\t\t\t},\n\t\t\t[],\n\t\t);\n\n\t\tuseEffect(() => {\n\t\t\tif (ref?.current) ref.current.openDropdown = openDropdown;\n\t\t}, [openDropdown]);\n\n\t\tuseEffect(() => {\n\t\t\tonDropdownVisbilityChange?.(openDropdown);\n\t\t}, [openDropdown]);\n\n\t\tconst dropDownComponent = () => {\n\t\t\treturn (\n\t\t\t\t<>\n\t\t\t\t\t<div\n\t\t\t\t\t\tstyle={{\n\t\t\t\t\t\t\tposition: 'relative',\n\t\t\t\t\t\t\t...(version === '3.0' && {\n\t\t\t\t\t\t\t\tbackgroundColor:\n\t\t\t\t\t\t\t\t\topenDropdown || isHovering\n\t\t\t\t\t\t\t\t\t\t? COLORS.surface.hovered\n\t\t\t\t\t\t\t\t\t\t: 'transparent',\n\t\t\t\t\t\t\t\ttransition: 'background-color 0.3s ease',\n\t\t\t\t\t\t\t\tborderRadius: 4,\n\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t}}\n\t\t\t\t\t\t/** This assigment is mentioned as per react-popper's docs, so typecasting */\n\t\t\t\t\t\tref={setReferenceElement as LegacyRef<HTMLDivElement>}\n\t\t\t\t\t\tonMouseEnter={\n\t\t\t\t\t\t\tversion === '3.0' ? () => setIsHovering(true) : undefined\n\t\t\t\t\t\t}\n\t\t\t\t\t\tonMouseLeave={\n\t\t\t\t\t\t\tversion === '3.0' ? () => setIsHovering(false) : undefined\n\t\t\t\t\t\t}\n\t\t\t\t\t>\n\t\t\t\t\t\t<OverLapAbs\n\t\t\t\t\t\t\tref={headerRef}\n\t\t\t\t\t\t\tallowEvents={openDropdownProps.allowEvents}\n\t\t\t\t\t\t\tdisabled={openDropdownProps.disabled}\n\t\t\t\t\t\t\tonClick={(e) => {\n\t\t\t\t\t\t\t\topenDropdownProps.onDropdownOpen?.();\n\t\t\t\t\t\t\t\tif (!openDropdown) {\n\t\t\t\t\t\t\t\t\tif (!openDropdownProps.disabled) setDropdownVisibility(true);\n\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\tsetDropdownVisibility(false);\n\t\t\t\t\t\t\t\t\te.preventDefault();\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t\tisChildLoading={isChildLoading}\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{openDropdownProps.allowEvents ? children : null}\n\t\t\t\t\t\t</OverLapAbs>\n\t\t\t\t\t\t{openDropdownProps.allowEvents ? null : children}\n\t\t\t\t\t</div>\n\t\t\t\t\t{(openDropdown || forceOpen) && (\n\t\t\t\t\t\t<OpenDropdownContainer\n\t\t\t\t\t\t\t/** This assigment is mentioned as per react-popper's docs, so typecasting */\n\t\t\t\t\t\t\tref={setPopperElement as Ref<HTMLDivElement>}\n\t\t\t\t\t\t\tstyle={{\n\t\t\t\t\t\t\t\t...styles['popper'],\n\t\t\t\t\t\t\t\tzIndex: openDropdownProps.dropdownZIndex ?? 3,\n\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t\t{...attributes['popper']}\n\t\t\t\t\t\t\tdata-test={openDropdownProps['data-test']}\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<DropShadow\n\t\t\t\t\t\t\t\tlevel={'z2'}\n\t\t\t\t\t\t\t\tposition={'down'}\n\t\t\t\t\t\t\t\tstyle={{\n\t\t\t\t\t\t\t\t\tborderRadius: version === '3.0' ? 4 : 8,\n\t\t\t\t\t\t\t\t\tboxShadow: '0 2px 8px 0 rgba(0, 0, 0, 0.12)',\n\t\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t<OpenedDropdown\n\t\t\t\t\t\t\t\t\t{...openDropdownProps}\n\t\t\t\t\t\t\t\t\tonSelect={(options) => {\n\t\t\t\t\t\t\t\t\t\tif (version === '2.0' && openDropdownProps.isMultiSelect) {\n\t\t\t\t\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\t\t\topenDropdownProps.onSelect?.(options);\n\t\t\t\t\t\t\t\t\t\t\tsetDropdownVisibility(false);\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t\t\t\tonClose={onCloseHandle}\n\t\t\t\t\t\t\t\t\tversion={version}\n\t\t\t\t\t\t\t\t\theaderRef={headerRef}\n\t\t\t\t\t\t\t\t\tzeroState={openDropdownProps?.zeroState}\n\t\t\t\t\t\t\t\t\tisDraggable={openDropdownProps.isDraggable}\n\t\t\t\t\t\t\t\t\tonOptionsReorder={openDropdownProps.onOptionsReorder}\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t</DropShadow>\n\t\t\t\t\t\t</OpenDropdownContainer>\n\t\t\t\t\t)}\n\t\t\t\t</>\n\t\t\t);\n\t\t};\n\n\t\treturn (\n\t\t\t<>\n\t\t\t\t{!openDropdown && !forceOpen && tooltipContent !== undefined ? (\n\t\t\t\t\t<Tooltip\n\t\t\t\t\t\tbody={tooltipContent}\n\t\t\t\t\t\tplacement={tooltipDirection}\n\t\t\t\t\t\thideArrow={!showTooltipArrow}\n\t\t\t\t\t>\n\t\t\t\t\t\t<div data-test={openDropdownProps['data-test']}>\n\t\t\t\t\t\t\t{dropDownComponent()}\n\t\t\t\t\t\t</div>\n\t\t\t\t\t</Tooltip>\n\t\t\t\t) : (\n\t\t\t\t\tdropDownComponent()\n\t\t\t\t)}\n\t\t\t</>\n\t\t);\n\t},\n);\n\nDropdownPopover.displayName = 'DropdownPopover';\n"],"names":["DropdownPopover","React","children","onDropdownVisbilityChange","version","tooltipContent","tooltipDirection","showTooltipArrow","isChildLoading","forceOpen","openDropdownProps","unTypedRef","ref","openDropdown","setDropdownVisibility","useState","isHovering","setIsHovering","referenceElement","setReferenceElement","popperElement","setPopperElement","headerRef","useRef","styles","attributes","usePopper","onCloseHandle","data","useImperativeHandle","useEffect","dropDownComponent","jsxs","Fragment","COLORS","jsx","OverLapAbs","e","OpenDropdownContainer","DropShadow","OpenedDropdown","options","Tooltip"],"mappings":";;;;;;;;AAoCO,MAAMA,IAAkBC,EAAM;AAAA,EAMpC,CACC;AAAA,IACC,UAAAC;AAAA,IACA,2BAAAC;AAAA,IACA,SAAAC,IAAU;AAAA,IACV,gBAAAC;AAAA,IACA,kBAAAC;AAAA,IACA,kBAAAC;AAAA,IACA,gBAAAC;AAAA,IACA,WAAAC;AAAA,IACA,GAAGC;AAAA,EAAA,GAEJC,MACI;AACJ,UAAMC,IAAMD,GACN,CAACE,GAAcC,CAAqB,IAAIC,EAAS,EAAK,GACtD,CAACC,GAAYC,CAAa,IAAIF,EAAS,EAAK,GAC5C,CAACG,GAAkBC,CAAmB,IAAIJ,EAAS,IAAI,GACvD,CAACK,GAAeC,CAAgB,IAAIN,EAAS,IAAI,GACjDO,IAAYC,EAAO,IAAI,GAEvB,EAAE,QAAAC,GAAQ,YAAAC,EAAA,IAAeC,EAAUR,GAAkBE,GAAe;AAAA,MACzE,WAAWV,EAAkB;AAAA,MAC7B,UAAUA,EAAkB;AAAA,IAAA,CAC5B,GAEKiB,IAAgB,CAACC,MAAS;AAC/B,MAAIxB,MAAY,SAASM,EAAkB,iBAAiBkB,KAC3DlB,EAAkB,WAAW,CAAC,GAAGkB,CAAI,CAAC,GAEv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ent":["import React, {\n\tLegacyRef,\n\tRef,\n\tuseEffect,\n\tuseImperativeHandle,\n\tuseRef,\n\tuseState,\n} from 'react';\nimport { usePopper } from 'react-popper';\nimport { DropShadow } from '@src/components/dropShadow';\nimport { Placement, Tooltip } from '@src/components/tooltips';\nimport { COLORS } from '@src/constants/Theme';\nimport { OpenDropdownContainer, OverLapAbs } from '../Common.styled';\nimport { OpenedDropdown } from '../OpenedDropdown';\nimport { OpenDropdownProps } from '../type';\n\ntype DropdownProps = OpenDropdownProps & {\n\tisLoading?: boolean;\n\tchildren?: React.ReactNode;\n\tdisabled?: boolean;\n\tonDropdownOpen?: () => void;\n\tonDropdownVisbilityChange?: (isOpen: boolean) => void;\n\ttooltipContent?: string;\n\ttooltipDirection?: Placement;\n\tshowTooltipArrow?: boolean;\n\tallowEvents?: boolean;\n\t'data-test'?: string;\n\tisChildLoading?: boolean;\n\t/**\n\t * If true, forces the dropdown to remain open regardless of user interaction or internal state.\n\t * This prop overrides the internal openDropdown state, ensuring the dropdown stays open.\n\t * Use this prop when you need to programmatically control the dropdown's visibility from a parent component.\n\t */\n\tforceOpen?: boolean;\n};\n\nexport const DropdownPopover = React.forwardRef<\n\t{\n\t\topenDropdown: boolean;\n\t},\n\tDropdownProps\n>(\n\t(\n\t\t{\n\t\t\tchildren,\n\t\t\tonDropdownVisbilityChange,\n\t\t\tversion = '1.0',\n\t\t\ttooltipContent,\n\t\t\ttooltipDirection,\n\t\t\tshowTooltipArrow,\n\t\t\tisChildLoading,\n\t\t\tforceOpen,\n\t\t\t...openDropdownProps\n\t\t},\n\t\tunTypedRef,\n\t) => {\n\t\tconst ref = unTypedRef as React.RefObject<{ openDropdown: boolean }>;\n\t\tconst [openDropdown, setDropdownVisibility] = useState(false);\n\t\tconst [isHovering, setIsHovering] = useState(false);\n\t\tconst [referenceElement, setReferenceElement] = useState(null);\n\t\tconst [popperElement, setPopperElement] = useState(null);\n\t\tconst headerRef = useRef(null);\n\n\t\tconst { styles, attributes } = usePopper(referenceElement, popperElement, {\n\t\t\tplacement: openDropdownProps.placement,\n\t\t\tstrategy: openDropdownProps.strategy,\n\t\t});\n\n\t\tconst onCloseHandle = (data) => {\n\t\t\tif (version === '2.0' && openDropdownProps.isMultiSelect && data) {\n\t\t\t\topenDropdownProps.onSelect?.([...data]);\n\t\t\t}\n\t\t\tsetDropdownVisibility(false);\n\t\t\topenDropdownProps?.onClose?.();\n\t\t};\n\n\t\tuseImperativeHandle(\n\t\t\tref,\n\t\t\t() => {\n\t\t\t\treturn {\n\t\t\t\t\topenDropdown: openDropdown,\n\t\t\t\t};\n\t\t\t},\n\t\t\t[],\n\t\t);\n\n\t\tuseEffect(() => {\n\t\t\tif (ref?.current) ref.current.openDropdown = openDropdown;\n\t\t}, [openDropdown]);\n\n\t\tuseEffect(() => {\n\t\t\tonDropdownVisbilityChange?.(openDropdown);\n\t\t}, [openDropdown]);\n\n\t\tconst dropDownComponent = () => {\n\t\t\treturn (\n\t\t\t\t<>\n\t\t\t\t\t<div\n\t\t\t\t\t\tstyle={{\n\t\t\t\t\t\t\tposition: 'relative',\n\t\t\t\t\t\t\t...(version === '3.0' && {\n\t\t\t\t\t\t\t\tbackgroundColor:\n\t\t\t\t\t\t\t\t\topenDropdown || isHovering\n\t\t\t\t\t\t\t\t\t\t? COLORS.surface.hovered\n\t\t\t\t\t\t\t\t\t\t: 'transparent',\n\t\t\t\t\t\t\t\ttransition: 'background-color 0.3s ease',\n\t\t\t\t\t\t\t\tborderRadius: 4,\n\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t}}\n\t\t\t\t\t\t/** This assigment is mentioned as per react-popper's docs, so typecasting */\n\t\t\t\t\t\tref={setReferenceElement as LegacyRef<HTMLDivElement>}\n\t\t\t\t\t\tonMouseEnter={\n\t\t\t\t\t\t\tversion === '3.0' ? () => setIsHovering(true) : undefined\n\t\t\t\t\t\t}\n\t\t\t\t\t\tonMouseLeave={\n\t\t\t\t\t\t\tversion === '3.0' ? () => setIsHovering(false) : undefined\n\t\t\t\t\t\t}\n\t\t\t\t\t>\n\t\t\t\t\t\t<OverLapAbs\n\t\t\t\t\t\t\tref={headerRef}\n\t\t\t\t\t\t\tdata-testid=\"dropdown-overlay\"\n\t\t\t\t\t\t\tallowEvents={openDropdownProps.allowEvents}\n\t\t\t\t\t\t\tdisabled={openDropdownProps.disabled}\n\t\t\t\t\t\t\tonClick={(e) => {\n\t\t\t\t\t\t\t\topenDropdownProps.onDropdownOpen?.();\n\t\t\t\t\t\t\t\tif (!openDropdown) {\n\t\t\t\t\t\t\t\t\tif (!openDropdownProps.disabled) setDropdownVisibility(true);\n\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\tsetDropdownVisibility(false);\n\t\t\t\t\t\t\t\t\te.preventDefault();\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t\tisChildLoading={isChildLoading}\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{openDropdownProps.allowEvents ? children : null}\n\t\t\t\t\t\t</OverLapAbs>\n\t\t\t\t\t\t{openDropdownProps.allowEvents ? null : children}\n\t\t\t\t\t</div>\n\t\t\t\t\t{(openDropdown || forceOpen) && (\n\t\t\t\t\t\t<OpenDropdownContainer\n\t\t\t\t\t\t\t/** This assigment is mentioned as per react-popper's docs, so typecasting */\n\t\t\t\t\t\t\tref={setPopperElement as Ref<HTMLDivElement>}\n\t\t\t\t\t\t\tstyle={{\n\t\t\t\t\t\t\t\t...styles['popper'],\n\t\t\t\t\t\t\t\tzIndex: openDropdownProps.dropdownZIndex ?? 3,\n\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t\t{...attributes['popper']}\n\t\t\t\t\t\t\tdata-test={openDropdownProps['data-test']}\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<DropShadow\n\t\t\t\t\t\t\t\tlevel={'z2'}\n\t\t\t\t\t\t\t\tposition={'down'}\n\t\t\t\t\t\t\t\tstyle={{\n\t\t\t\t\t\t\t\t\tborderRadius: version === '3.0' ? 4 : 8,\n\t\t\t\t\t\t\t\t\tboxShadow: '0 2px 8px 0 rgba(0, 0, 0, 0.12)',\n\t\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t<OpenedDropdown\n\t\t\t\t\t\t\t\t\t{...openDropdownProps}\n\t\t\t\t\t\t\t\t\tonSelect={(options) => {\n\t\t\t\t\t\t\t\t\t\tif (version === '2.0' && openDropdownProps.isMultiSelect) {\n\t\t\t\t\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\t\t\topenDropdownProps.onSelect?.(options);\n\t\t\t\t\t\t\t\t\t\t\tsetDropdownVisibility(false);\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t\t\t\tonClose={onCloseHandle}\n\t\t\t\t\t\t\t\t\tversion={version}\n\t\t\t\t\t\t\t\t\theaderRef={headerRef}\n\t\t\t\t\t\t\t\t\tzeroState={openDropdownProps?.zeroState}\n\t\t\t\t\t\t\t\t\tisDraggable={openDropdownProps.isDraggable}\n\t\t\t\t\t\t\t\t\tonOptionsReorder={openDropdownProps.onOptionsReorder}\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t</DropShadow>\n\t\t\t\t\t\t</OpenDropdownContainer>\n\t\t\t\t\t)}\n\t\t\t\t</>\n\t\t\t);\n\t\t};\n\n\t\treturn (\n\t\t\t<>\n\t\t\t\t{!openDropdown && !forceOpen && tooltipContent !== undefined ? (\n\t\t\t\t\t<Tooltip\n\t\t\t\t\t\tbody={tooltipContent}\n\t\t\t\t\t\tplacement={tooltipDirection}\n\t\t\t\t\t\thideArrow={!showTooltipArrow}\n\t\t\t\t\t>\n\t\t\t\t\t\t<div data-test={openDropdownProps['data-test']}>\n\t\t\t\t\t\t\t{dropDownComponent()}\n\t\t\t\t\t\t</div>\n\t\t\t\t\t</Tooltip>\n\t\t\t\t) : (\n\t\t\t\t\tdropDownComponent()\n\t\t\t\t)}\n\t\t\t</>\n\t\t);\n\t},\n);\n\nDropdownPopover.displayName = 'DropdownPopover';\n"],"names":["DropdownPopover","React","children","onDropdownVisbilityChange","version","tooltipContent","tooltipDirection","showTooltipArrow","isChildLoading","forceOpen","openDropdownProps","unTypedRef","ref","openDropdown","setDropdownVisibility","useState","isHovering","setIsHovering","referenceElement","setReferenceElement","popperElement","setPopperElement","headerRef","useRef","styles","attributes","usePopper","onCloseHandle","data","useImperativeHandle","useEffect","dropDownComponent","jsxs","Fragment","COLORS","jsx","OverLapAbs","e","OpenDropdownContainer","DropShadow","OpenedDropdown","options","Tooltip"],"mappings":";;;;;;;;AAoCO,MAAMA,IAAkBC,EAAM;AAAA,EAMpC,CACC;AAAA,IACC,UAAAC;AAAA,IACA,2BAAAC;AAAA,IACA,SAAAC,IAAU;AAAA,IACV,gBAAAC;AAAA,IACA,kBAAAC;AAAA,IACA,kBAAAC;AAAA,IACA,gBAAAC;AAAA,IACA,WAAAC;AAAA,IACA,GAAGC;AAAA,EAAA,GAEJC,MACI;AACJ,UAAMC,IAAMD,GACN,CAACE,GAAcC,CAAqB,IAAIC,EAAS,EAAK,GACtD,CAACC,GAAYC,CAAa,IAAIF,EAAS,EAAK,GAC5C,CAACG,GAAkBC,CAAmB,IAAIJ,EAAS,IAAI,GACvD,CAACK,GAAeC,CAAgB,IAAIN,EAAS,IAAI,GACjDO,IAAYC,EAAO,IAAI,GAEvB,EAAE,QAAAC,GAAQ,YAAAC,EAAA,IAAeC,EAAUR,GAAkBE,GAAe;AAAA,MACzE,WAAWV,EAAkB;AAAA,MAC7B,UAAUA,EAAkB;AAAA,IAAA,CAC5B,GAEKiB,IAAgB,CAACC,MAAS;AAC/B,MAAIxB,MAAY,SAASM,EAAkB,iBAAiBkB,KAC3DlB,EAAkB,WAAW,CAAC,GAAGkB,CAAI,CAAC,GAEvCd,EAAsB,EAAK,GAC3BJ,GAAmB,UAAA;AAAA,IACpB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