@bikdotai/bik-component-library 0.0.783-beta.8 → 0.0.783
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/assets/icons/magic-line.svg.js +1 -0
- package/dist/cjs/assets/icons/refresh-purple.svg.js +1 -0
- package/dist/cjs/assets/icons/rewind.svg.js +1 -0
- package/dist/cjs/assets/icons/thumbs_down.svg.js +1 -0
- package/dist/cjs/assets/icons/thumbs_up.svg.js +1 -0
- package/dist/cjs/components/QueryBuilder/Filters/CustomField/components/CustomField.js +1 -1
- package/dist/cjs/components/QueryBuilder/Filters/Event/components/EventFilter.js +1 -1
- package/dist/cjs/components/QueryBuilder/Filters/Segment/components/SegmentFilter.js +1 -1
- package/dist/cjs/components/QueryBuilder/Filters/UserProperty/components/UserPropertyFilter.js +1 -1
- package/dist/cjs/components/QueryBuilder/Triggers/EVENTS/components/EventsTrigger.d.ts +1 -1
- package/dist/cjs/components/QueryBuilder/Triggers/EVENTS/components/EventsTrigger.js +1 -1
- package/dist/cjs/components/QueryBuilder/Triggers/EVENTS/selectors/useIGTriggerNameCacheSelector.d.ts +1 -1
- package/dist/cjs/components/QueryBuilder/Triggers/IG/components/IGTrigger.d.ts +1 -1
- package/dist/cjs/components/QueryBuilder/Triggers/IG/selectors/useIGTriggerNameCacheSelector.d.ts +1 -1
- package/dist/cjs/components/QueryBuilder/Triggers/components/BaseTriggerQueryBuilderNode.d.ts +2 -2
- package/dist/cjs/components/QueryBuilder/Triggers/components/BaseTriggerQueryBuilderNode.js +1 -1
- package/dist/cjs/components/QueryBuilder/components/Connectors/Components/InTheLast.js +1 -1
- package/dist/cjs/components/QueryBuilder/components/Connectors/Components/InTwoLast.js +1 -1
- package/dist/cjs/components/QueryBuilder/components/Connectors/Components/MultiselectDropdownFreeText.js +1 -1
- package/dist/cjs/components/QueryBuilder/components/Connectors/Components/SingleselectDropdownFreeText.js +1 -1
- package/dist/cjs/components/QueryBuilder/components/Connectors/Connector.js +1 -1
- package/dist/cjs/components/QueryBuilder/components/DropdownWrapper.d.ts +3 -1
- package/dist/cjs/components/QueryBuilder/components/DropdownWrapper.js +1 -1
- package/dist/cjs/components/QueryBuilder/components/QueryBuilderNode/Property/PropertyNode.js +1 -1
- package/dist/cjs/components/QueryBuilder/types/QueryBuilderConnector.type.d.ts +5 -0
- package/dist/cjs/components/SearchFilter/components/SearchFilterItem.js +1 -1
- package/dist/cjs/components/TablePagination/TablePagination.d.ts +1 -0
- package/dist/cjs/components/TablePagination/TablePagination.js +1 -1
- package/dist/cjs/components/WhatsAppTextEditor/AIRephrase.styled.d.ts +10 -0
- package/dist/cjs/components/WhatsAppTextEditor/AIRephrase.styled.js +1 -0
- package/dist/cjs/components/WhatsAppTextEditor/AIRephraseButton.d.ts +17 -0
- package/dist/cjs/components/WhatsAppTextEditor/AIRephraseButton.js +1 -0
- package/dist/cjs/components/WhatsAppTextEditor/BorderAnimation.d.ts +11 -0
- package/dist/cjs/components/WhatsAppTextEditor/BorderAnimation.js +1 -0
- package/dist/cjs/components/WhatsAppTextEditor/CustomEditor.styled.d.ts +13 -0
- package/dist/cjs/components/WhatsAppTextEditor/CustomEditor.styled.js +1 -1
- package/dist/cjs/components/WhatsAppTextEditor/WhatsAppTextEditor.d.ts +128 -3
- package/dist/cjs/components/WhatsAppTextEditor/WhatsAppTextEditor.js +5 -1
- package/dist/cjs/components/WhatsAppTextEditor/WhatsAppTextEditorHeader.d.ts +42 -1
- package/dist/cjs/components/WhatsAppTextEditor/WhatsAppTextEditorHeader.js +1 -1
- package/dist/cjs/components/WhatsAppTextEditor/ai/actionRegistry.d.ts +14 -0
- package/dist/cjs/components/WhatsAppTextEditor/ai/actionRegistry.js +1 -0
- package/dist/cjs/components/WhatsAppTextEditor/ai/aiTag.d.ts +63 -0
- package/dist/cjs/components/WhatsAppTextEditor/ai/aiTag.js +1 -0
- package/dist/cjs/components/WhatsAppTextEditor/ai/api.d.ts +22 -0
- package/dist/cjs/components/WhatsAppTextEditor/ai/api.js +1 -0
- package/dist/cjs/components/alerts/Alert.styled.js +1 -0
- package/dist/cjs/components/analytics-chips-and-dropdowns/AnalyticsDropdown.js +1 -1
- package/dist/cjs/components/country-code-picker/CountryCodePicker.js +1 -1
- package/dist/cjs/components/country-code-picker/CountryPicker.js +1 -1
- package/dist/cjs/components/custom-date-time/CustomDateTime.js +1 -1
- package/dist/cjs/components/custom-date-time/DateSelector/DateSelector.js +1 -1
- package/dist/cjs/components/datePicker/TimePicker.js +1 -1
- package/dist/cjs/components/discount-modal/CouponExpiration/CouponExpiration.js +1 -1
- package/dist/cjs/components/discount-modal/DiscountModal.js +1 -1
- package/dist/cjs/components/discount-modal/DynamicCoupon/DynamicCoupon.js +1 -1
- package/dist/cjs/components/discount-modal/DynamicCoupon/MinimumRequirementComponent.js +1 -1
- package/dist/cjs/components/dropdown/Dropdown.js +1 -1
- package/dist/cjs/components/dropdown/OpenedDropdown/components/OpennedDropdown.js +1 -1
- package/dist/cjs/components/dropdown/OpenedDropdown/components/searchbox/SearchZeroState.d.ts +2 -0
- package/dist/cjs/components/dropdown/OpenedDropdown/components/searchbox/SearchZeroState.js +1 -1
- package/dist/cjs/components/dropdown/hooks/useDropdown.d.ts +2 -0
- package/dist/cjs/components/dropdown/hooks/useDropdown.js +1 -1
- package/dist/cjs/components/dropdown/type.d.ts +9 -0
- package/dist/cjs/components/dropdown-button/DropdownButton.js +1 -1
- package/dist/cjs/components/feature-announcements/MajorUpdatePopup.js +1 -1
- package/dist/cjs/components/feature-announcements/MinorUpdatePopup.js +1 -1
- package/dist/cjs/components/input/Input-helper.d.ts +2 -0
- package/dist/cjs/components/input/Input-helper.js +1 -1
- package/dist/cjs/components/input/Input.d.ts +1 -0
- package/dist/cjs/components/input/Input.js +1 -1
- package/dist/cjs/components/multi-level-dropdown/GroupedMenuList.d.ts +4 -0
- package/dist/cjs/components/multi-level-dropdown/GroupedMenuList.js +1 -1
- package/dist/cjs/components/multi-level-dropdown/MenuItem.d.ts +3 -0
- package/dist/cjs/components/multi-level-dropdown/MenuItem.js +1 -1
- package/dist/cjs/components/multi-level-dropdown/MenuList.d.ts +4 -0
- package/dist/cjs/components/multi-level-dropdown/MenuList.js +1 -1
- package/dist/cjs/components/multi-level-dropdown/MultiLevelDropdown.js +1 -1
- package/dist/cjs/components/multi-level-dropdown/type.d.ts +3 -0
- package/dist/cjs/components/radioButton/RadioButton.d.ts +1 -0
- package/dist/cjs/components/radioButton/RadioButton.js +1 -1
- package/dist/cjs/components/tag/Tag.styled.js +1 -1
- package/dist/cjs/components/template-preview/TemplatePreview.js +1 -1
- package/dist/cjs/components/zeroState/ZeroState.js +2 -1
- package/dist/cjs/helpers/BaseWhatsappContentLang.helper.js +1 -1
- package/dist/cjs/index.js +1 -1
- package/dist/esm/assets/icons/magic-line.svg.js +1 -0
- package/dist/esm/assets/icons/refresh-purple.svg.js +1 -0
- package/dist/esm/assets/icons/rewind.svg.js +1 -0
- package/dist/esm/assets/icons/thumbs_down.svg.js +1 -0
- package/dist/esm/assets/icons/thumbs_up.svg.js +1 -0
- package/dist/esm/components/QueryBuilder/Filters/CustomField/components/CustomField.js +1 -1
- package/dist/esm/components/QueryBuilder/Filters/Event/components/EventFilter.js +1 -1
- package/dist/esm/components/QueryBuilder/Filters/Segment/components/SegmentFilter.js +1 -1
- package/dist/esm/components/QueryBuilder/Filters/UserProperty/components/UserPropertyFilter.js +1 -1
- package/dist/esm/components/QueryBuilder/Triggers/EVENTS/components/EventsTrigger.d.ts +1 -1
- package/dist/esm/components/QueryBuilder/Triggers/EVENTS/components/EventsTrigger.js +1 -1
- package/dist/esm/components/QueryBuilder/Triggers/EVENTS/selectors/useIGTriggerNameCacheSelector.d.ts +1 -1
- package/dist/esm/components/QueryBuilder/Triggers/IG/components/IGTrigger.d.ts +1 -1
- package/dist/esm/components/QueryBuilder/Triggers/IG/selectors/useIGTriggerNameCacheSelector.d.ts +1 -1
- package/dist/esm/components/QueryBuilder/Triggers/components/BaseTriggerQueryBuilderNode.d.ts +2 -2
- package/dist/esm/components/QueryBuilder/Triggers/components/BaseTriggerQueryBuilderNode.js +1 -1
- package/dist/esm/components/QueryBuilder/components/Connectors/Components/InTheLast.js +1 -1
- package/dist/esm/components/QueryBuilder/components/Connectors/Components/InTwoLast.js +1 -1
- package/dist/esm/components/QueryBuilder/components/Connectors/Components/MultiselectDropdownFreeText.js +1 -1
- package/dist/esm/components/QueryBuilder/components/Connectors/Components/SingleselectDropdownFreeText.js +1 -1
- package/dist/esm/components/QueryBuilder/components/Connectors/Connector.js +1 -1
- package/dist/esm/components/QueryBuilder/components/DropdownWrapper.d.ts +3 -1
- package/dist/esm/components/QueryBuilder/components/DropdownWrapper.js +1 -1
- package/dist/esm/components/QueryBuilder/components/QueryBuilderNode/Property/PropertyNode.js +1 -1
- package/dist/esm/components/QueryBuilder/types/QueryBuilderConnector.type.d.ts +5 -0
- package/dist/esm/components/SearchFilter/components/SearchFilterItem.js +1 -1
- package/dist/esm/components/TablePagination/TablePagination.d.ts +1 -0
- package/dist/esm/components/TablePagination/TablePagination.js +1 -1
- package/dist/esm/components/WhatsAppTextEditor/AIRephrase.styled.d.ts +10 -0
- package/dist/esm/components/WhatsAppTextEditor/AIRephrase.styled.js +1 -0
- package/dist/esm/components/WhatsAppTextEditor/AIRephraseButton.d.ts +17 -0
- package/dist/esm/components/WhatsAppTextEditor/AIRephraseButton.js +1 -0
- package/dist/esm/components/WhatsAppTextEditor/BorderAnimation.d.ts +11 -0
- package/dist/esm/components/WhatsAppTextEditor/BorderAnimation.js +1 -0
- package/dist/esm/components/WhatsAppTextEditor/CustomEditor.styled.d.ts +13 -0
- package/dist/esm/components/WhatsAppTextEditor/CustomEditor.styled.js +1 -1
- package/dist/esm/components/WhatsAppTextEditor/WhatsAppTextEditor.d.ts +128 -3
- package/dist/esm/components/WhatsAppTextEditor/WhatsAppTextEditor.js +5 -1
- package/dist/esm/components/WhatsAppTextEditor/WhatsAppTextEditorHeader.d.ts +42 -1
- package/dist/esm/components/WhatsAppTextEditor/WhatsAppTextEditorHeader.js +1 -1
- package/dist/esm/components/WhatsAppTextEditor/ai/actionRegistry.d.ts +14 -0
- package/dist/esm/components/WhatsAppTextEditor/ai/actionRegistry.js +1 -0
- package/dist/esm/components/WhatsAppTextEditor/ai/aiTag.d.ts +63 -0
- package/dist/esm/components/WhatsAppTextEditor/ai/aiTag.js +1 -0
- package/dist/esm/components/WhatsAppTextEditor/ai/api.d.ts +22 -0
- package/dist/esm/components/WhatsAppTextEditor/ai/api.js +1 -0
- package/dist/esm/components/alerts/Alert.styled.js +9 -8
- package/dist/esm/components/analytics-chips-and-dropdowns/AnalyticsDropdown.js +1 -1
- package/dist/esm/components/country-code-picker/CountryCodePicker.js +1 -1
- package/dist/esm/components/country-code-picker/CountryPicker.js +1 -1
- package/dist/esm/components/custom-date-time/CustomDateTime.js +1 -1
- package/dist/esm/components/custom-date-time/DateSelector/DateSelector.js +1 -1
- package/dist/esm/components/datePicker/TimePicker.js +1 -1
- package/dist/esm/components/discount-modal/CouponExpiration/CouponExpiration.js +1 -1
- package/dist/esm/components/discount-modal/DiscountModal.js +1 -1
- package/dist/esm/components/discount-modal/DynamicCoupon/DynamicCoupon.js +1 -1
- package/dist/esm/components/discount-modal/DynamicCoupon/MinimumRequirementComponent.js +1 -1
- package/dist/esm/components/dropdown/Dropdown.js +1 -1
- package/dist/esm/components/dropdown/OpenedDropdown/components/OpennedDropdown.js +1 -1
- package/dist/esm/components/dropdown/OpenedDropdown/components/searchbox/SearchZeroState.d.ts +2 -0
- package/dist/esm/components/dropdown/OpenedDropdown/components/searchbox/SearchZeroState.js +1 -1
- package/dist/esm/components/dropdown/hooks/useDropdown.d.ts +2 -0
- package/dist/esm/components/dropdown/hooks/useDropdown.js +1 -1
- package/dist/esm/components/dropdown/type.d.ts +9 -0
- package/dist/esm/components/dropdown-button/DropdownButton.js +1 -1
- package/dist/esm/components/feature-announcements/MajorUpdatePopup.js +1 -1
- package/dist/esm/components/feature-announcements/MinorUpdatePopup.js +1 -1
- package/dist/esm/components/input/Input-helper.d.ts +2 -0
- package/dist/esm/components/input/Input-helper.js +1 -1
- package/dist/esm/components/input/Input.d.ts +1 -0
- package/dist/esm/components/input/Input.js +1 -1
- package/dist/esm/components/multi-level-dropdown/GroupedMenuList.d.ts +4 -0
- package/dist/esm/components/multi-level-dropdown/GroupedMenuList.js +1 -1
- package/dist/esm/components/multi-level-dropdown/MenuItem.d.ts +3 -0
- package/dist/esm/components/multi-level-dropdown/MenuItem.js +1 -1
- package/dist/esm/components/multi-level-dropdown/MenuList.d.ts +4 -0
- package/dist/esm/components/multi-level-dropdown/MenuList.js +1 -1
- package/dist/esm/components/multi-level-dropdown/MultiLevelDropdown.js +1 -1
- package/dist/esm/components/multi-level-dropdown/type.d.ts +3 -0
- package/dist/esm/components/radioButton/RadioButton.d.ts +1 -0
- package/dist/esm/components/radioButton/RadioButton.js +1 -1
- package/dist/esm/components/tag/Tag.styled.js +1 -1
- package/dist/esm/components/template-preview/TemplatePreview.js +1 -1
- package/dist/esm/components/zeroState/ZeroState.js +2 -1
- package/dist/esm/helpers/BaseWhatsappContentLang.helper.js +1 -1
- package/dist/esm/index.js +1 -1
- package/package.json +1 -1
|
@@ -7,6 +7,8 @@ export declare const useDropdown: (version: string | undefined, options: Dropdow
|
|
|
7
7
|
search: (searchKey: string) => void;
|
|
8
8
|
searchedString: string;
|
|
9
9
|
searchedOptions: DropdownOption[];
|
|
10
|
+
searchError: string | undefined;
|
|
11
|
+
retrySearch: () => void;
|
|
10
12
|
onApplyHandler: (optionSelect: SingleOption, returnOnly?: boolean) => ({
|
|
11
13
|
label: string;
|
|
12
14
|
value: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import e from"lodash/debounce";import{useState as
|
|
1
|
+
import{__awaiter as e}from"../../../_virtual/_tslib.js";import t from"lodash/debounce";import{useState as s,useRef as n,useEffect as l,useCallback as i,useMemo as c}from"react";import{iterateOnOptionsRaw as o,iterateOnOptions as a}from"../OpenedDropdown/utils/iterationOnOptions.js";const r=function(){let r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"1.0",d=arguments.length>1?arguments[1]:void 0,u=arguments.length>2?arguments[2]:void 0,v=arguments.length>3?arguments[3]:void 0,f=arguments.length>4?arguments[4]:void 0,g=arguments.length>5?arguments[5]:void 0,p=arguments.length>6?arguments[6]:void 0,b=arguments.length>7&&void 0!==arguments[7]?arguments[7]:[],O=arguments.length>8?arguments[8]:void 0;const[h,j]=s(null!=d?d:[]),[m,w]=s([]),[S,C]=s(""),[E,y]=s(void 0),F=n(h),L=n(g);l((()=>{L.current=g}),[g]),l((()=>{if(F.current=h,m.length&&S&&g){let e=[...m];const t=h.map((e=>{if(e.options)return e.options.map((e=>({value:e.value,selected:e.selected})));const t=e;return{value:t.value,selected:t.selected}})).flat();e=e.map((e=>{const s=t.find((t=>e.value===t.value));return s?Object.assign(Object.assign({},e),{selected:s.selected}):e})),p&&(e=e.map((e=>Object.assign(Object.assign({},e),{disabled:!b.includes(e.value)})))),w(f&&!v?[...e.sort((e=>e.selected?-1:1))]:[...e])}}),[h]),l((()=>{if(d){const e=[...d];j(f&&!v?[...e.sort((e=>e.selected?-1:1))]:[...e])}}),[d]);const A=e=>{const t=[];return e.forEach((e=>{if(e.options){const s=e.options.filter((e=>!0===e.selected));t.push(Object.assign(Object.assign({},e),{options:[...s]}))}else e.selected&&t.push(Object.assign({},e))})),t},x=e=>{let t=0;return e.forEach((e=>{e.options?t+=e.options.filter((e=>!0===e.selected)).length:e.selected&&t++})),t},M=e=>!(!f||!O&&0!==O)&&x(e)>=O,D=i((t=>e(void 0,void 0,void 0,(function*(){const e=L.current;if(!t||!e)return;const s=[];o(F.current,(e=>{e.selected&&!s.includes(e.value)&&s.push(e.value)}));try{const n=yield e(t);if(y(void 0),n){const e=n.map((e=>{if(e.options){const t=e;return Object.assign(Object.assign({},t),{options:t.options.map((e=>Object.assign(Object.assign({},e),{selected:s.includes(e.value)})))})}return Object.assign(Object.assign({},e),{selected:s.includes(e.value)})}));w([...e])}else w([])}catch(e){w([]),y(e instanceof Error?e.message:"Something went wrong while fetching the list. Please try again")}}))),[]),H=c((()=>t(D,300)),[D]);function R(e,t){if(f){if(e.selected&&O&&M(h))return;if(m.length&&S&&g)if(e.selected){if(O&&M(h))return;let s=!1;const n=a(h,{selected:e.selected},(t=>t.value===e.value&&(s=!0,!0)));if(s||n.push(e),t)return[...n];j([...n]),"2.0"===r&&_(n)}else{let s=!1,n=a(h,{selected:e.selected},(t=>t.value===e.value&&(s=!0,!0)));if(s&&(n=n.filter((t=>t.value!==e.value))),t)return[...n];j([...n]),"2.0"===r&&_(n)}else{const s=a(h,{selected:e.selected},(t=>t.value===e.value));if(t)return[...s];j([...s]),"2.0"===r&&_(s)}}else null==u||u(e)}function _(e){const t=A(null!=e?e:F.current);null==u||u([...t])}return l((()=>()=>null==H?void 0:H.cancel()),[H]),{latestDropdownOptionsRef:F,dropdownOptions:h,search:function(e){C(e),w([]),y(void 0),e?H(e):null==H||H.cancel()},searchedString:S,searchedOptions:m,searchError:E,retrySearch:function(){S&&(y(void 0),D(S))},onApplyHandler:R,selectAllHandler:function(e){if(m.length&&S&&g)"selectAll"===e?function(e){let t=[...h];if(e&&O&&O>0){const e=x(t),s=O-e;if(s<=0)return;let n=0;m.forEach((e=>{if(n>=s)return;let l=!1;t=t.map((t=>{const s=e;return t.selected||t.disabled?t:void 0!==s.value&&s.value===t.value?(l=!0,n++,Object.assign(Object.assign({},t),{selected:!0})):t})),!l&&n<s&&(e.disabled||(t.push(Object.assign(Object.assign({},e),{selected:!0})),n++))})),j([...t]),"2.0"===r&&_(t)}}(!0):function(e){let t=[...h];e?m.forEach((e=>{let s=!1;t=t.map((t=>{const n=e;return void 0!==n.value&&n.value===t.value?(s=!0,Object.assign(Object.assign({},t),{selected:!0})):t})),s||t.push(Object.assign(Object.assign({},e),{selected:!0}))})):m.forEach((e=>{t=t.map((t=>{const s=e;return void 0!==s.value&&s.value===t.value?Object.assign(Object.assign({},t),{selected:!1}):t}))})),j([...t]),"2.0"===r&&_(t)}(!1);else if("selectAll"===e)if(O&&O>0){const e=x(h),t=O-e;if(t<=0)return;let s=0;const n=h.map((e=>{var n;if(e.options){const n=e;return Object.assign(Object.assign({},n),{options:n.options.map((e=>{var n;return e.disabled||e.selected||S&&!(null===(n=e.label)||void 0===n?void 0:n.toLowerCase().includes(S.toLowerCase()))?e:s<t?(s++,Object.assign(Object.assign({},e),{selected:!0})):e}))})}{const l=e;return l.disabled||(l.selected||S&&!(null===(n=l.label)||void 0===n?void 0:n.toLowerCase().includes(S.toLowerCase())))?e:s<t?(s++,Object.assign(Object.assign({},e),{selected:!0})):e}}));j([...n]),"2.0"===r&&_(n)}else{const e=a(h,{selected:!0},(e=>{var t;return S?(null===(t=e.label)||void 0===t?void 0:t.toLowerCase().includes(S.toLowerCase()))&&!e.disabled:!e.disabled}));j([...e]),"2.0"===r&&_(e)}else if("notSelected"===e){const e=a(h,{selected:!1},(e=>!e.disabled));j([...e]),"2.0"===r&&_(e)}},onMultiSelectClear:function(){const e=a(h,{selected:!1});j([...e]),"2.0"===r&&_(e)},onFreeFormSelect:function(e){if(!f)return void R({label:S,value:S,isFreeForm:!0,selected:!0});const t=h.map((t=>t.options?t:Object.assign(Object.assign({},t),{selected:t.label===S&&t.value===S?e:t.selected})));e&&(t.some((e=>e.label===S&&e.value===S))||t.unshift({label:S,value:S,isFreeForm:!0,selected:!0})),j([...t]),"2.0"===r&&_(t)},onMultiSelectApply:_,getSelectedOptions:A,getCurrentSelectionCount:x,isMaxSelectionsReached:M,maxSelections:O}};export{r as useDropdown};
|
|
@@ -27,6 +27,15 @@ export interface OpenDropdownProps {
|
|
|
27
27
|
onDropdownItemClick?: (option: DropdownOption) => void;
|
|
28
28
|
buttonOptions?: ButtonOptions;
|
|
29
29
|
isSearchLoading?: boolean;
|
|
30
|
+
isOptionsLoading?: boolean;
|
|
31
|
+
optionsErrorState?: {
|
|
32
|
+
Icon?: React.ReactNode;
|
|
33
|
+
IconHolderStyle?: React.CSSProperties;
|
|
34
|
+
actionButton?: ButtonProps;
|
|
35
|
+
buttonWidth?: number;
|
|
36
|
+
title?: string;
|
|
37
|
+
subTitle?: string;
|
|
38
|
+
};
|
|
30
39
|
disableSearchOptions?: boolean;
|
|
31
40
|
disableSearchedOptionExcept?: string[];
|
|
32
41
|
useDefaultCursor?: boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{__rest as o}from"../../_virtual/_tslib.js";import{jsxs as t,jsx as n}from"react/jsx-runtime";import{DropdownPopover as r}from"../dropdown/DropdownPopover/index.js";import"../dropdown/Dropdown.js";import"../dropdown/ChipDropdown.js";import"react";import"../zeroState/ZeroState.js";import"lodash/debounce";import"../TypographyStyle.js";import"
|
|
1
|
+
import{__rest as o}from"../../_virtual/_tslib.js";import{jsxs as t,jsx as n}from"react/jsx-runtime";import{DropdownPopover as r}from"../dropdown/DropdownPopover/index.js";import"../dropdown/Dropdown.js";import"../dropdown/ChipDropdown.js";import"react";import"../zeroState/ZeroState.js";import"../../constants/Theme.js";import"lodash/debounce";import"../TypographyStyle.js";import"../dropdown/OpenedDropdown/components/description/Description.styled.js";import"../checkBox/CheckBox.styled.js";import"../list-item/ListItem.js";import"../dropdown/OpenedDropdown/components/menu/FreeFormMenu.styled.js";import"../dropdown/OpenedDropdown/components/menu/MenuItem.js";import"../dropdown/OpenedDropdown/components/menu/MenuList.styled.js";import{Button as e}from"../button/Button.js";import"../dropdown/OpenedDropdown/components/multiSelect/MultiSelectDropdownBottomBar.styled.js";import"../dropdown/OpenedDropdown/components/OpennedDropdown.styled.js";import"../icon-button/IconButton.js";import"../input/Input.js";import"../dropdown/MenuItem/MenuItem.js";import{SpinnerColorMap as p}from"../button/themes.js";import{Spinner as s}from"../spinner/Spinner.js";import{DropdownButtonStyle as i,LoaderContainer as d}from"./DropdownButton.style.js";const m=m=>{var u,l;const a=m.buttonProps,c=o(a,["onClick"]);return t(i,Object.assign({type:m.buttonProps.buttonType,disabled:m.buttonProps.disabled},{children:[(null===(u=m.buttonProps)||void 0===u?void 0:u.isLoading)&&n(d,{children:n(s,{className:"spinner",size:"small",color:p(m.buttonProps.buttonType||"primary",m.buttonProps.inverse)})}),n(e,Object.assign({},m.buttonProps,{isLoading:!1,style:{borderRadius:"0px",borderTopLeftRadius:"4px",borderBottomLeftRadius:"4px",borderRight:"0px"}})),n("div",{className:"dd-button-divider"}),n(r,Object.assign({},m.dropdownProps,{isChildLoading:null===(l=m.buttonProps)||void 0===l?void 0:l.isLoading},{children:n(e,Object.assign({},c,{isLoading:!1,buttonText:"",TrailingIcon:m.iconProps,style:{borderRadius:"0px",borderTopRightRadius:"4px",borderBottomRightRadius:"4px"}}))}))]}))};export{m as DropdownButton};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as t,jsxs as e,Fragment as n}from"react/jsx-runtime";import{useState as o,useRef as r,useEffect as s}from"react";import a from"../../assets/icons/chevronRight2.svg.js";import i from"../../assets/icons/play.svg.js";import{TEXT as l}from"./constants/index.js";import{getMajorPopupStyles as c}from"./styles/majorPopup.styles.js";import"../../constants/Theme.js";import"./constants/animations.js";import{decodeHTMLEntities as u}from"./utils/htmlHelpers.js";import{hideJoyrideArrow as d,calculateCloseTransform as p,executeAfterAnimation as g}from"./utils/animationHelpers.js";import{findWhatsNewButton as y}from"./utils/elementHelpers.js";const b=b=>{let{feature:v,currentIndex:h,totalFeatures:m,onSkip:f,onExplore:j,onPrevious:O,onNext:B,setIsClosing:T,onSecondaryAction:k,ratio:x="16:9",padding:M}=b;var E,P,C,L,w;const[U,W]=o(!1),[_,I]=o(!1),[D,H]=o(""),S=r(null),[A,R]=o(!1),[V,F]=o(!0),N=r(null),[z,G]=o(x),K=r(null);s((()=>{U&&I(!0)}),[U]);const X=t=>{var e,n;t.preventDefault(),t.stopPropagation();const o=null===(e=v.secondaryButton)||void 0===e?void 0:e.action;if("Open link"===o){const t=null===(n=v.secondaryButton)||void 0===n?void 0:n.redirectionUrl;if(t){t.startsWith("http")?window.open(t,"_blank","noopener,noreferrer"):window.location.href=t}}
|
|
1
|
+
import{jsx as t,jsxs as e,Fragment as n}from"react/jsx-runtime";import{useState as o,useRef as r,useEffect as s}from"react";import a from"../../assets/icons/chevronRight2.svg.js";import i from"../../assets/icons/play.svg.js";import{TEXT as l}from"./constants/index.js";import{getMajorPopupStyles as c}from"./styles/majorPopup.styles.js";import"../../constants/Theme.js";import"./constants/animations.js";import{decodeHTMLEntities as u}from"./utils/htmlHelpers.js";import{hideJoyrideArrow as d,calculateCloseTransform as p,executeAfterAnimation as g}from"./utils/animationHelpers.js";import{findWhatsNewButton as y}from"./utils/elementHelpers.js";const b=b=>{let{feature:v,currentIndex:h,totalFeatures:m,onSkip:f,onExplore:j,onPrevious:O,onNext:B,setIsClosing:T,onSecondaryAction:k,ratio:x="16:9",padding:M}=b;var E,P,C,L,w;const[U,W]=o(!1),[_,I]=o(!1),[D,H]=o(""),S=r(null),[A,R]=o(!1),[V,F]=o(!0),N=r(null),[z,G]=o(x),K=r(null);s((()=>{U&&I(!0)}),[U]);const X=t=>{var e,n;t.preventDefault(),t.stopPropagation();const o=null===(e=v.secondaryButton)||void 0===e?void 0:e.action,r=k||f;if("Open link"===o){const t=null===(n=v.secondaryButton)||void 0===n?void 0:n.redirectionUrl;if(t){t.startsWith("http")?window.open(t,"_blank","noopener,noreferrer"):window.location.href=t}}d(S.current);const s=y();if(s&&S.current){const t=p(S.current,s);H(t)}else H("scale(0)");null==T||T(!0),W(!0),g(r)},$=c(_,D,z,M||v.padding,null===(E=v.primaryButton)||void 0===E?void 0:E.style,null===(P=v.secondaryButton)||void 0===P?void 0:P.style);return t("div",Object.assign({style:$.outerWrapper},{children:e("div",Object.assign({ref:S,style:Object.assign(Object.assign({},$.container),{opacity:_?0:1,transition:"opacity 0.2s ease-in-out, transform 0.3s ease"})},{children:[t("style",{children:"\n\t\t\t\t[data-popup-content] ul {\n\t\t\t\t\tmargin: 0;\n\t\t\t\t\tpadding-left: 20px;\n\t\t\t\t\tlist-style-type: disc;\n\t\t\t\t}\n\t\t\t\t[data-popup-content] ul li {\n\t\t\t\t\tmargin-bottom: 8px;\n\t\t\t\t\tcolor: rgba(255, 255, 255, 0.8);\n\t\t\t\t\tfont-size: 12px;\n\t\t\t\t\tline-height: 16px;\n\t\t\t\t\tfont-family: Inter, sans-serif;\n\t\t\t\t}\n\t\t\t"}),e("div",Object.assign({style:$.contentWrapper},{children:[t("div",Object.assign({style:$.imageContainer},{children:v.productVideo?e(n,{children:[t("video",{ref:N,src:v.productVideo,style:$.image,autoPlay:!0,muted:!0,loop:!0,playsInline:!0,controls:!0,"aria-label":`Product video for ${v.title}`,onLoadedMetadata:t=>{const e=t.currentTarget,n=e.videoWidth,o=e.videoHeight;if(n&&o){const t=n/o;Math.abs(t-16/9)<.1?G("16:9"):Math.abs(t-1)<.1?G("1:1"):Math.abs(t-4/3)<.1?G("4:3"):G(t>1.5?"16:9":t<.9?"4:3":"1:1")}}}),(A||V)&&t("div",Object.assign({style:$.videoOverlay,onClick:t=>{t.stopPropagation(),N.current&&(N.current.paused?(N.current.play(),R(!1),F(!1)):(N.current.pause(),R(!0),F(!0)))},role:"button",tabIndex:0,"aria-label":A?"Play video":"Pause video",onKeyDown:t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),t.stopPropagation(),N.current&&(N.current.paused?(N.current.play(),R(!1),F(!1)):(N.current.pause(),R(!0),F(!0))))}},{children:t(i,{width:20,height:20})}))]}):v.displayImage?t("img",{ref:K,src:v.displayImage,alt:v.title,style:$.image,onLoad:t=>{const e=t.currentTarget,n=e.naturalWidth,o=e.naturalHeight;if(n&&o){const t=n/o;Math.abs(t-16/9)<.1?G("16:9"):Math.abs(t-1)<.1?G("1:1"):Math.abs(t-4/3)<.1?G("4:3"):G(t>1.5?"16:9":t<.9?"4:3":"1:1")}},onError:t=>{v.image&&(t.target.src=v.image)}}):t("div",Object.assign({style:$.imagePlaceholder},{children:l.FEATURE_PREVIEW_PLACEHOLDER}))})),e("div",Object.assign({style:$.contentContainer},{children:[t("div",Object.assign({style:$.skipButtonContainer},{children:t("button",Object.assign({onClick:t=>{t.preventDefault(),t.stopPropagation(),(t=>{d(S.current);const e=y();if(e&&S.current){const t=p(S.current,e);H(t)}else H("scale(0)");null==T||T(!0),W(!0),g(t)})(f)},style:$.skipButton.base,onMouseEnter:t=>Object.assign(t.currentTarget.style,$.skipButton.hover),onMouseLeave:t=>Object.assign(t.currentTarget.style,$.skipButton.base),"aria-label":"Skip feature announcement"},{children:"Skip"}))})),t("h3",Object.assign({style:$.title},{children:v.title})),t("div",{"data-popup-content":!0,style:$.content,dangerouslySetInnerHTML:{__html:u(v.content||v.body||"")}}),e("div",Object.assign({style:$.actionsWrapper},{children:[e("div",Object.assign({style:$.buttonsGroup},{children:[t("button",Object.assign({onClick:()=>{var t,e;const n=null===(t=v.primaryButton)||void 0===t?void 0:t.action;if("Play Video"===n)j();else if("Open link"===n){const t=(null===(e=v.primaryButton)||void 0===e?void 0:e.redirectionUrl)||v.redirectUrl;if(t){t.startsWith("http")?window.open(t,"_blank","noopener,noreferrer"):window.location.href=t}j()}else j();d(S.current);const o=y();if(o&&S.current){const t=p(S.current,o);H(t)}else H("scale(0)");null==T||T(!0),W(!0)},style:$.exploreButton.base,onMouseEnter:t=>Object.assign(t.currentTarget.style,$.exploreButton.hover),onMouseLeave:t=>Object.assign(t.currentTarget.style,$.exploreButton.base)},{children:(null===(C=v.primaryButton)||void 0===C?void 0:C.text)||v.buttonText||l.DEFAULT_BUTTON_TEXT})),(null===(L=v.secondaryButton)||void 0===L?void 0:L.text)&&((null===(w=v.secondaryButton)||void 0===w?void 0:w.redirectionUrl)?t("a",Object.assign({href:v.secondaryButton.redirectionUrl,target:v.secondaryButton.redirectionUrl.startsWith("http")?"_blank":"_self",rel:v.secondaryButton.redirectionUrl.startsWith("http")?"noopener noreferrer":void 0,onClick:X,style:$.secondaryButton.base,onMouseEnter:t=>Object.assign(t.currentTarget.style,$.secondaryButton.hover),onMouseLeave:t=>Object.assign(t.currentTarget.style,$.secondaryButton.base)},{children:v.secondaryButton.text})):t("button",Object.assign({onClick:X,style:$.secondaryButton.base,onMouseEnter:t=>Object.assign(t.currentTarget.style,$.secondaryButton.hover),onMouseLeave:t=>Object.assign(t.currentTarget.style,$.secondaryButton.base)},{children:v.secondaryButton.text})))]})),m>1&&e("div",Object.assign({style:$.navigationContainer},{children:[t("button",Object.assign({onClick:t=>{t.preventDefault(),t.stopPropagation(),O()},disabled:0===h,style:$.navigationButton(0===h).base,onMouseEnter:t=>{0!==h&&Object.assign(t.currentTarget.style,$.navigationButton(!1).hover)},onMouseLeave:t=>{0!==h&&Object.assign(t.currentTarget.style,$.navigationButton(!1).base)},"aria-label":"Previous feature"},{children:t(a,{style:{transform:"rotate(180deg)"}})})),t("button",Object.assign({onClick:t=>{t.preventDefault(),t.stopPropagation(),B()},disabled:h===m-1,style:$.navigationButton(h===m-1).base,onMouseEnter:t=>{h!==m-1&&Object.assign(t.currentTarget.style,$.navigationButton(!1).hover)},onMouseLeave:t=>{h!==m-1&&Object.assign(t.currentTarget.style,$.navigationButton(h===m-1).base)},"aria-label":"Next feature"},{children:t(a,{})}))]}))]}))]}))]}))]}))}))};export{b as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsxs as e,jsx as t}from"react/jsx-runtime";import{useState as n,useRef as r,useEffect as o}from"react";import{TEXT as i}from"./constants/index.js";import"../../constants/Theme.js";import"./constants/animations.js";import{getMinorPopupStyles as s}from"./styles/minorPopup.styles.js";import{decodeHTMLEntities as l}from"./utils/htmlHelpers.js";import{hideJoyrideArrow as a,calculateCloseTransform as c}from"./utils/animationHelpers.js";import{findFeatureTagElement as
|
|
1
|
+
import{jsxs as e,jsx as t}from"react/jsx-runtime";import{useState as n,useRef as r,useEffect as o}from"react";import{TEXT as i}from"./constants/index.js";import"../../constants/Theme.js";import"./constants/animations.js";import{getMinorPopupStyles as s}from"./styles/minorPopup.styles.js";import{decodeHTMLEntities as l}from"./utils/htmlHelpers.js";import{hideJoyrideArrow as a,calculateCloseTransform as c,executeAfterAnimation as d}from"./utils/animationHelpers.js";import{findFeatureTagElement as u}from"./utils/elementHelpers.js";const m=m=>{let{feature:p,currentIndex:f,totalFeatures:g,onSkip:y,onExplore:v,onPrevious:h,onNext:T,setIsClosing:j}=m;var b,O;const[x,B]=n(!1),[E,w]=n(!1),[C,_]=n(""),k=r(null);o((()=>{x&&w(!0)}),[x]);const W=s(E,C);return e("div",Object.assign({ref:k,style:W.container},{children:[t("div",Object.assign({style:W.imageContainer},{children:p.displayImage?t("div",Object.assign({style:W.imageWrapper},{children:t("img",{src:p.displayImage,alt:p.title,style:W.image,onError:e=>{p.image&&(e.target.src=p.image)}})})):t("div",Object.assign({style:W.imagePlaceholder},{children:i.FEATURE_PREVIEW_PLACEHOLDER}))})),e("div",Object.assign({style:W.contentContainer},{children:[e("div",{children:[t("h3",Object.assign({style:W.title},{children:p.title})),t("div",{style:W.content,dangerouslySetInnerHTML:{__html:l(p.content||p.body||"")}})]}),e("div",Object.assign({style:W.actionsContainer},{children:[(null===(b=p.secondaryButton)||void 0===b?void 0:b.text)&&t("span",Object.assign({onClick:()=>{var e,t,n;const r=null===(e=p.secondaryButton)||void 0===e?void 0:e.action,o=y;if("Open link"===r){const e=null===(t=p.secondaryButton)||void 0===t?void 0:t.redirectionUrl;if(e){e.startsWith("http")?window.open(e,"_blank","noopener,noreferrer"):window.location.href=e}}else"Close popup"!==r&&""!==r||null===(n=p.secondaryButton)||void 0===n||n.action;if(a(k.current),k.current&&p.featureTag){const e=u(p.featureTag);if(e){const t=c(k.current,e);_(t)}else _("scale(0)")}else _("scale(0)");null==j||j(!0),B(!0),d(o)},style:W.understoodText},{children:p.secondaryButton.text})),t("button",Object.assign({onClick:()=>{var e,t;const n=null===(e=p.primaryButton)||void 0===e?void 0:e.action;if("Play Video"===n)v();else if("Open link"===n){const e=(null===(t=p.primaryButton)||void 0===t?void 0:t.redirectionUrl)||p.redirectUrl;if(e){e.startsWith("http")?window.open(e,"_blank","noopener,noreferrer"):window.location.href=e}v()}else v();if(a(k.current),k.current&&p.featureTag){const e=p.featureTag.startsWith("#")||p.featureTag.startsWith(".")||p.featureTag.startsWith("[")?p.featureTag:`#${p.featureTag}`,t=document.querySelector(e);if(t){const e=c(k.current,t);_(e)}else _("scale(0)")}else _("scale(0)");null==j||j(!0),B(!0)},style:W.exploreButton},{children:(null===(O=p.primaryButton)||void 0===O?void 0:O.text)||p.buttonText||i.DEFAULT_BUTTON_TEXT}))]}))]}))]}))};export{m as default};
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { InputTypeI } from "./Input";
|
|
2
2
|
export declare const isFunction: (fn: any) => boolean;
|
|
3
|
+
export declare const sanitizeUnsafeInput: (input: string) => string;
|
|
4
|
+
export declare const shouldSanitizeForType: (type: InputTypeI) => boolean;
|
|
3
5
|
export declare const validateInput: (inputText: string | number, type: InputTypeI, rangeValidation?: {
|
|
4
6
|
min?: number;
|
|
5
7
|
max?: number;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{phone as
|
|
1
|
+
import{phone as e}from"phone";const t=e=>e&&"function"==typeof e,n=/<(script|style|iframe|object|noscript|template)\b[^<]*(?:(?!<\/\1>)<[^<]*)*<\/\1\s*>/gi,r=/<\/?(script|style|iframe|object|embed|link|meta|base|form|svg|math|noscript|template)\b[^>]*>/gi,i=/(<[a-zA-Z][^>]*?)\s+on[a-zA-Z]+\s*=\s*(?:"[^"]*"|'[^']*'|[^\s>]+)/g,a=e=>{if(!e)return e;let t,a=e.replace(n,"");a=a.replace(r,"");do{t=a,a=a.replace(i,"$1")}while(a!==t);return a},l=["text","multiline","email","url","password"],m=e=>l.includes(e),u=function(t,n){let r,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const a=["phonenumber","zip","number"].includes(n),l=a?t?Number(t):null:t;if(null==l||""===l)return[!0,""];if(a&&String(l).length&&(i.min&&l<i.min||i.max&&l>i.max))return[!1,`Enter valid number between ${i.min} and ${i.max}`];if("email"===n)return r=/(.+)@(.+){2,}\.(.+){2,}/,l.match(r)?[!0,""]:[!1,"Enter a valid email id"];if("url"===n)return r=/^https?:\/\/(?:www\.)?[-a-zA-Z0-9@:%._\+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b(?:[-a-zA-Z0-9()@:%_\+.~#?&\/=]*)$/,l.match(r)?[!0,""]:[!1,"Enter a valid url"];if("number"===n)return l>=0?[!0,""]:[!1,"Enter a valid number"];if("zip"===n)return 6===String(l).trim().length?[!0,""]:[!1,"Enter a valid zip code"];if("phonenumber"===n){const{isValid:t}=e("+"+String(l));return t?[!0,""]:[!1,"Enter a valid phonenumber"]}return(null==l?void 0:l.trim().length)>0?[!0,""]:[!1,"Enter a valid data"]};export{t as isFunction,a as sanitizeUnsafeInput,m as shouldSanitizeForType,u as validateInput};
|
|
@@ -69,5 +69,6 @@ export interface InputProps {
|
|
|
69
69
|
inputWrapperStyles?: React.CSSProperties;
|
|
70
70
|
minCharsToTrigger?: number;
|
|
71
71
|
isDisabled?: boolean;
|
|
72
|
+
allowUnsafeInput?: boolean;
|
|
72
73
|
}
|
|
73
74
|
export declare const Input: React.ForwardRefExoticComponent<InputProps & React.RefAttributes<HTMLInputElement | HTMLTextAreaElement | null>>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsxs as e,jsx as t,Fragment as i}from"react/jsx-runtime";import n from"../../assets/icons/info.svg.js";import{forwardRef as l,useState as r,useContext as o,useRef as a,useEffect as s}from"react";import{Button as c}from"../button/Button.js";import{isFunction as h,validateInput as
|
|
1
|
+
import{jsxs as e,jsx as t,Fragment as i}from"react/jsx-runtime";import n from"../../assets/icons/info.svg.js";import{forwardRef as l,useState as r,useContext as o,useRef as a,useEffect as s}from"react";import{Button as c}from"../button/Button.js";import{isFunction as h,shouldSanitizeForType as d,sanitizeUnsafeInput as u,validateInput as v}from"./Input-helper.js";import{Tooltip as g}from"../tooltips/Tooltip.js";import{TitleSmall as p,BodySecondary as m}from"../TypographyStyle.js";import{COLORS as b}from"../../constants/Theme.js";import x from"../../assets/icons/errorInfo.svg.js";import{InputStyleContext as f}from"./context/InputStyleProvider.js";import{RootContainer as y,InputFooter as j,MaxCharStyle as C,InputWrapper as T,IconHolder as O,PrefixHolder as w,InputContainer as I,InputContainerSmall as k,SuffixHolder as B,InputHeader as L}from"./Input.styled.js";const H=l(((l,H)=>{var D,E,M,P,S,z,A,F;const{placeholder:K,leftIcon:N,rightIcon:R,labelText:G,maxCharLimit:W,isRequired:_,hintText:q,type:U,state:V,validate:$,variant:J,button:Q,suffixText:X,prefixText:Y,onChangeText:Z,value:ee,noErrorHint:te,reset:ie,rangeValidation:ne,noKeyDownChange:le,version:re,noMaxCharCheck:oe,labelElement:ae,autoGrow:se,minHeight:ce,maxHeight:he,labelTextBold:de,truncateText:ue,maxCharLimitPosition:ve,hightlightInputColor:ge,onKeyDownEvent:pe,hideInputHeader:me,hideBorder:be,inputWrapperStyles:xe,minCharsToTrigger:fe,isDisabled:ye=!1,allowUnsafeInput:je}=Object.assign({maxCharLimit:0,type:"text",variant:"default",maxCharLimitPosition:"TOP",minCharsToTrigger:0},l),Ce=null==N?void 0:N.icon,Te=null==R?void 0:R.icon,[Oe,we]=r(!1),[Ie,ke]=r(!1),[Be,Le]=r(),He="x-small"===J?"12px":"small"===J?"18px":"22px",De=o(f),[Ee,Me]=r(""),Pe=a(null),Se=null!=H?H:Pe;s((()=>{Me(ee||""),!ee&&se&&(Se.current.style.height=ce||"48px")}),[ee]),s((()=>{var e;Se.current&&(null===(e=l.onReferenceInit)||void 0===e||e.call(l,Se.current))}),[Se]),s((()=>{const e=Se.current;if(e&&["phonenumber","zip","number"].includes(U))return e.addEventListener("wheel",Ke,{passive:!1}),()=>{e.removeEventListener("wheel",Ke)}}),[]),s((()=>{ie&&Me("")}),[ie]),s((()=>{var e;ke(!!l.isActive),l.isActive&&(null===(e=Se.current)||void 0===e||e.focus())}),[l.isActive]),s((()=>{Le(l.errorMessage)}),[l.errorMessage]),s((()=>{var e;we(!1),("invalid"===l.state||Be||"disabled-invalid"===l.state)&&we(!0),"active"===l.state&&(null===(e=Se.current)||void 0===e||e.focus())}),[l.state,Be]),s((()=>{we(!!Be||"invalid"===l.state)}),[Be,l.state]);const ze=function(e){if(h(e)){for(var t=arguments.length,i=new Array(t>1?t-1:0),n=1;n<t;n++)i[n-1]=arguments[n];e(...i)}},Ae=()=>"zip"===U?6:2e3,Fe=e=>{const t=0!==W?W:Ae(),i=fe,n=e.target.value;pe&&(!n.length||n.length>=i)&&pe(e),le||n.length&&!(n.length>=i)||Z(ee||"",e),oe||![8].includes(e.which)&&t>0&&n.length>=t&&e.preventDefault()},Ke=e=>{e.preventDefault()},Ne=e=>{let t=e.target.value;const i=0!==W?W+1:Ae(),n=fe;if(!je&&d(U)&&(t=u(t)),!oe&&i>0&&t.length>=i&&(t=t.substring(0,i-1)),l.textControl||Me(t||""),n&&t&&t.length<n)return;Z(t,e),se&&(Se.current.style.height=`${Se.current.scrollHeight}px`,t||(Se.current.style.height=ce||"48px"));const r=$||v;if(!r||!h(r))return;const[o,a]=r(t,U,ne);we(!o),Le(l.errorMessage?l.errorMessage:a)},Re=e=>{var t;l.skipFocus||ke(!0),ze(null===(t=l.onFocus)||void 0===t?void 0:t.call(l,e))},Ge=e=>{var t;l.skipFocus||ke(!1),ze(null===(t=l.onBlur)||void 0===t?void 0:t.call(l,e))},We=()=>{var n;return e(i,{children:["multiline"!==U&&t("input",{className:ue?"truncate-class":"","data-test":l["data-test"],id:l.id,style:null!==(n=null==De?void 0:De.input)&&void 0!==n?n:{},ref:Se,disabled:ye,type:["phonenumber","zip","number"].includes(U)?"number":U,value:Ee,onFocus:e=>Re(e),onBlur:e=>Ge(e),placeholder:K||"Enter here",onChange:Ne,onClick:e=>ze(l.onClick),onKeyDown:e=>Fe(e)}),"multiline"===U&&t("textarea",{"data-test":l["data-test"],value:Ee,ref:Se,onFocus:e=>Re(e),onBlur:e=>Ge(e),onClick:e=>ze(l.onClick),disabled:ye,placeholder:K||"Enter here",onChange:Ne,onKeyDown:e=>Fe(e),maxLength:W>0?W:void 0})]})};return e(y,Object.assign({width:l.width,height:l.height,state:V,type:U,style:null!==(D=null==De?void 0:De.RootContainer)&&void 0!==D?D:{}},{children:[e("div",Object.assign({className:"flex-align-center"},{children:[!te&&(!!q||!!Be)&&e(j,Object.assign({invalid:!!Be},{children:[!!Be&&t(x,{width:16,height:16}),Be||q]})),W>0&&"BOTTOM"===ve&&e(C,Object.assign({position:"BOTTOM"},{children:[null!==(M=null===(E=(null!=ee?ee:"").toString())||void 0===E?void 0:E.length)&&void 0!==M?M:0,"/",W]}))]})),e(T,Object.assign({variant:J,state:V,width:l.width,isActive:"active"===V||Ie,isInvalid:Oe,style:null!==(S=null!==(P=null==De?void 0:De.InputWrapper)&&void 0!==P?P:xe)&&void 0!==S?S:{},version:re,height:l.height,hightlightInputColor:ge,hideBorder:be},{children:[!!Ce&&t(O,Object.assign({variant:J,iconSize:He,onClick:()=>ze(null==N?void 0:N.callback),isLeft:!0,style:null!==(z=null==De?void 0:De.IconHolder)&&void 0!==z?z:{}},{children:t(Ce,{})})),!!Y&&t(w,Object.assign({variant:J},{children:Y})),"default"===J&&t(I,Object.assign({height:l.height,type:l.type,minHeight:ce,maxHeight:he,autoGrow:se},{children:We()})),["x-small","small"].includes(J)&&t(k,Object.assign({height:l.height,type:l.type},{children:We()})),!!Te&&t(O,Object.assign({variant:J,iconSize:He,onClick:()=>ze(null==R?void 0:R.callback),isLeft:!1},{children:t(Te,{})})),!!X&&t(B,Object.assign({variant:J},{children:X})),Q&&Q.text&&t(c,{buttonText:Q.text,onClick:()=>ze(null==Q?void 0:Q.onClick)}),Q&&Q.buttonProps&&t(c,Object.assign({},Q.buttonProps))]})),!me&&(!!G||!!W)&&e(L,Object.assign({invalid:Oe},{children:[ae&&ae,e("div",Object.assign({className:"label__container"},{children:[e(de?p:m,{children:[G,_?t("span",{children:"*"}):""]}),l.tooltipText&&t(g,Object.assign({body:l.tooltipText,placement:"top"},{children:t("span",{children:t(n,{style:{marginTop:-3},width:18,height:18,color:Oe?b.content.negative:b.content.primary})})}))]})),W>0&&"TOP"===ve&&e(C,{children:[null!==(F=null===(A=(null!=ee?ee:"").toString())||void 0===A?void 0:A.length)&&void 0!==F?F:0,"/",W]})]}))]}))}));H.displayName="Input";export{H as Input};
|
|
@@ -5,4 +5,8 @@ export declare const GroupedMenuList: React.FC<{
|
|
|
5
5
|
onDropdownItemClick?: (option: MultiLevelDropdownOption, parents: MultiLevelDropdownOption[]) => void;
|
|
6
6
|
option: GroupedOption;
|
|
7
7
|
parents: MultiLevelDropdownOption[];
|
|
8
|
+
allowParentSelection?: boolean;
|
|
9
|
+
maxLevels?: number;
|
|
10
|
+
hideGroupLabel?: boolean;
|
|
11
|
+
currentLevel: number;
|
|
8
12
|
}>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsxs as
|
|
1
|
+
import{jsxs as e,jsx as o}from"react/jsx-runtime";import{COLORS as t}from"../../constants/Theme.js";import{BodyTiny as r}from"../TypographyStyle.js";import{MenuItem as n}from"./MenuItem.js";import{GroupedMenuListContainer as l}from"./MultiLevelDropdown.styled.js";const p=p=>{let{width:i,onDropdownItemClick:a,option:m,parents:s,allowParentSelection:c,maxLevels:d,hideGroupLabel:u,currentLevel:h}=p;return e(l,{children:[!u&&o(r,Object.assign({style:{padding:"4px 8px 4px 12px",cursor:"default"},color:t.content.placeholder},{children:m.label})),m.options.map(((e,t)=>o(n,{width:i,onDropdownItemClick:a,option:e,parents:s,allowParentSelection:c,maxLevels:d,currentLevel:h},t)))]})};export{p as GroupedMenuList};
|
|
@@ -5,4 +5,7 @@ export declare const MenuItem: React.FC<{
|
|
|
5
5
|
onDropdownItemClick?: (option: MultiLevelDropdownOption, parents: MultiLevelDropdownOption[]) => void;
|
|
6
6
|
option: SingleOption;
|
|
7
7
|
parents: MultiLevelDropdownOption[];
|
|
8
|
+
allowParentSelection?: boolean;
|
|
9
|
+
maxLevels?: number;
|
|
10
|
+
currentLevel: number;
|
|
8
11
|
}>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsxs as e,jsx as t,Fragment as n}from"react/jsx-runtime";import
|
|
1
|
+
import{jsxs as e,jsx as t,Fragment as n}from"react/jsx-runtime";import o from"../../assets/icons/chevronRight2.svg.js";import i,{useRef as l,Suspense as r}from"react";import{COLORS as s}from"../../constants/Theme.js";import{BodyCaption as c,BodyTiny as d}from"../TypographyStyle.js";import{MenuItemWrapper as a,MenuItemContainer as p,ContentContainer as u,LeadingIconContainer as h,TrailingIconContainer as m,SubMenuContainer as v,StyledSubMenuWrapper as g,SubMenuListContainer as b}from"./MultiLevelDropdown.styled.js";const f=i.lazy((()=>import("./MenuList.js").then((e=>({default:e.MenuList}))))),j=j=>{let{width:w,onDropdownItemClick:y,option:L,parents:M,allowParentSelection:O,maxLevels:S,currentLevel:x}=j;var C,I,T,k,D,P,E;const[R,z]=i.useState(!1),[B,H]=i.useState(!1),[N,W]=i.useState({top:0,left:0}),q=l({top:0,left:0}),A=!!L.children&&L.children.length>0,F=A&&(void 0===S||x<S);return e(a,Object.assign({onMouseEnter:e=>{F&&(z(!0),(e=>{const t=e.currentTarget.getBoundingClientRect();W({top:t.top,left:t.right}),q.current={top:t.top,left:t.right}})(e))},onMouseLeave:()=>{z(!1)},onClick:e=>{e.stopPropagation(),(()=>{var e;!y||null!==(e=L.disabled)&&void 0!==e&&e||A&&!O||y(L,M)})()},id:"menuItemWrapper",style:{cursor:null!==(C=L.disabled)&&void 0!==C&&C?"not-allowed":"pointer",backgroundColor:null!==(I=L.disabled)&&void 0!==I&&I?s.surface.standard:"transparent"}},{children:[L.customComponent?L.customComponent:e(p,Object.assign({isSelected:L.selected,isSubMenuOpen:R,isHovered:B,isDisabled:null!==(T=L.disabled)&&void 0!==T&&T},{children:[e(u,{children:[L.leadingIcon&&t(h,{children:L.leadingIcon}),e("div",{children:[t(c,Object.assign({style:{color:null!==(k=L.disabled)&&void 0!==k&&k?s.content.inactive:L.selected||B?s.content.positive:s.content.primary}},{children:L.label})),L.subText&&t(d,Object.assign({style:{color:null!==(D=L.disabled)&&void 0!==D&&D?s.content.inactive:L.selected||B?s.content.positive:s.content.secondary,marginTop:"2px"}},{children:L.subText}))]})]}),A?t(m,{children:t(o,{width:16,height:16,color:!F||null!==(P=L.disabled)&&void 0!==P&&P?s.content.inactive:L.selected||B?s.content.positive:s.content.primary})}):L.trailingIcon?t(m,{children:L.trailingIcon}):t(n,{})]})),!(null!==(E=L.disabled)&&void 0!==E&&E)&&L.children&&L.children.length>0&&F&&R&&t(v,Object.assign({width:w,className:"submenu",onMouseEnter:()=>H(!0),onMouseLeave:()=>H(!1)},{children:t(g,Object.assign({width:w,top:N.top,left:N.left},{children:t(b,{children:t(r,Object.assign({fallback:t("div",{children:"Loading..."})},{children:t(f,{width:w,onDropdownItemClick:y,options:L.children,parents:[...M,L],allowParentSelection:O,maxLevels:S,currentLevel:x+1})}))})}))}))]}))};export{j as MenuItem};
|
|
@@ -5,4 +5,8 @@ export declare const MenuList: React.FC<{
|
|
|
5
5
|
onDropdownItemClick?: (option: MultiLevelDropdownOption, parents: MultiLevelDropdownOption[]) => void;
|
|
6
6
|
options: MultiLevelDropdownOption[];
|
|
7
7
|
parents: MultiLevelDropdownOption[];
|
|
8
|
+
allowParentSelection?: boolean;
|
|
9
|
+
maxLevels?: number;
|
|
10
|
+
hideGroupLabel?: boolean;
|
|
11
|
+
currentLevel: number;
|
|
8
12
|
}>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as
|
|
1
|
+
import{jsx as e}from"react/jsx-runtime";import{GroupedMenuList as o}from"./GroupedMenuList.js";import{MenuItem as t}from"./MenuItem.js";import{StyledMenuList as n}from"./MultiLevelDropdown.styled.js";const r=r=>{let{width:i,onDropdownItemClick:l,options:p,parents:a,allowParentSelection:m,maxLevels:s,hideGroupLabel:d,currentLevel:c}=r;return e(n,{children:p.map(((n,r)=>"value"in n?e(t,{width:i,onDropdownItemClick:l,option:n,parents:a,allowParentSelection:m,maxLevels:s,currentLevel:c},r):"options"in n&&n.options.length>0?e(o,{width:i,onDropdownItemClick:l,option:n,parents:a,allowParentSelection:m,maxLevels:s,hideGroupLabel:d,currentLevel:c},r):void 0))})};export{r as MenuList};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as e,jsxs as n}from"react/jsx-runtime";import t,{useState as o,useEffect as r}from"react";import{ZeroState as s}from"../zeroState/ZeroState.js";import{COLORS as i}from"../../constants/Theme.js";import{SearchBox as l}from"../dropdown/OpenedDropdown/components/searchbox/SearchBox.js";import{Floater as c}from"../floater/floater.js";import{MenuList as
|
|
1
|
+
import{jsx as e,jsxs as n}from"react/jsx-runtime";import t,{useState as o,useEffect as r}from"react";import{ZeroState as s}from"../zeroState/ZeroState.js";import{COLORS as i}from"../../constants/Theme.js";import{SearchBox as l}from"../dropdown/OpenedDropdown/components/searchbox/SearchBox.js";import{Floater as c}from"../floater/floater.js";import{MenuList as a}from"./MenuList.js";import{DropdownContainer as d,OptionsContainer as p,NoResultsContainer as u}from"./MultiLevelDropdown.styled.js";const h=h=>{let{options:f,width:m,isSearchable:w,onDropdownItemClick:b,refElement:g,topOffset:j,leftOffset:O,isDropdownOpen:x,onDropdownOutsideClick:L,allowParentSelection:v,maxLevels:y,hideGroupLabel:S}=h;const C=t.useRef(null),[D,k]=o(f),E=e=>{const n=Array.isArray(f)?[...f]:[],t=[];for(;n.length>0;){const o=n.shift();o&&o.label.toLowerCase().includes(e.toLowerCase())&&t.push(o),o&&"children"in o&&o.children?n.push(...o.children):o&&"options"in o&&o.options&&n.push(...o.options)}const o=e=>e.map((e=>{if(t.includes(e))return e;if("children"in e&&e.children){const n=o(e.children);if(n.length>0)return Object.assign(Object.assign({},e),{children:n})}if("options"in e&&e.options){const n=o(e.options);if(n.length>0)return Object.assign(Object.assign({},e),{options:n})}return null})).filter((e=>null!==e));k(o(f))},I=e=>{C.current&&!C.current.contains(e.target)?L&&L(!0):L&&L(!1)};return r((()=>{x&&E("")}),[x]),r((()=>(document.addEventListener("mousedown",I),()=>{document.removeEventListener("mousedown",I)})),[]),r((()=>{k(f)}),[f]),e(c,Object.assign({refElement:g,topOffset:j,leftOffset:O},{children:x&&e("div",Object.assign({ref:C,style:{backgroundColor:i.surface.standard,zIndex:99999,borderRadius:"8px",whiteSpace:"normal"}},{children:n(d,Object.assign({width:m},{children:[w&&e("div",Object.assign({style:{padding:"4px",width:null!=m?m:"200px"}},{children:e(l,{onSearch:E,version:"2.0"})})),e(p,Object.assign({width:m},{children:(null!=D?D:[]).length>0&&e(a,{width:null!=m?m:"200px",onDropdownItemClick:b,options:D,parents:[],allowParentSelection:v,maxLevels:y,hideGroupLabel:S,currentLevel:1})})),0===(null!=D?D:[]).length&&e(u,Object.assign({style:{width:null!=m?m:"200px"}},{children:e(s,{title:"No results found!",subTitle:"Sorry, we are unable to find any results for your search."})}))]}))}))}))};export{h as MultiLevelDropdown};
|
|
@@ -5,6 +5,9 @@ export interface MultiLevelDropdownProps extends FloaterProps {
|
|
|
5
5
|
width?: string;
|
|
6
6
|
isSearchable?: boolean;
|
|
7
7
|
isDropdownOpen?: boolean;
|
|
8
|
+
allowParentSelection?: boolean;
|
|
9
|
+
maxLevels?: number;
|
|
10
|
+
hideGroupLabel?: boolean;
|
|
8
11
|
onDropdownOutsideClick?: (isOutsideClick: any) => void;
|
|
9
12
|
onDropdownItemClick?: (option: MultiLevelDropdownOption, parents: MultiLevelDropdownOption[]) => void;
|
|
10
13
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsxs as i,jsx as e,Fragment as s}from"react/jsx-runtime";import{useState as l,useEffect as t,useMemo as a}from"react";import{RadioButtonContainer as o,RadioButtonIcon as c}from"./RadioButton.styled.js";import{BodyCaption as
|
|
1
|
+
import{jsxs as i,jsx as e,Fragment as s}from"react/jsx-runtime";import{useState as l,useEffect as t,useMemo as a}from"react";import{RadioButtonContainer as o,RadioButtonIcon as c}from"./RadioButton.styled.js";import{BodyCaption as n,TitleSmall as r,BodySecondary as d,BodyPrimary as b}from"../TypographyStyle.js";import{COLORS as m}from"../../constants/Theme.js";const p=s=>{const l=a((()=>(null==s?void 0:s.activeColor)||m.background.positive.vibrant),[s.activeColor]),t=a((()=>s.isDisabled?m.content.inactive:s.isActive?l:m.content.primary),[s.isDisabled,s.isActive,l]);return i("svg",Object.assign({width:s.isSmall?"16":"20",height:s.isSmall?"16":"20",viewBox:s.isSmall?"0 0 16 16":"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg"},{children:[e("circle",{cx:s.isSmall?"8":"10",cy:s.isSmall?"8":"10",r:s.isSmall?6:9,stroke:t,strokeWidth:s.isSmall?1.5:2}),s.isActive&&e("circle",{cx:s.isSmall?"8":"10",cy:s.isSmall?"8":"10",r:s.isSmall?3:5,fill:s.isDisabled?m.content.inactive:l})]}))},v=a=>{const[v,g]=l(a.isActive||!1),[x,h]=l(!1),[y,S]=l(!1);t((()=>{g(a.isActive)}),[a.isActive]);return i(o,Object.assign({onClick:()=>{var i;if(!a.skipSelectingOff&&!a.isDisabled){const e=!v;g(e),null===(i=a.onValueChange)||void 0===i||i.call(a,e,a.value)}},onMouseEnter:()=>h(!a.skipHoverState),onMouseLeave:()=>h(!1),onMouseDown:()=>S(!a.skipHoverState),onMouseUp:()=>S(!1),style:a.caption?{alignItems:"flex-start"}:{}},{children:[e(c,Object.assign({checked:v,hovered:x,clicked:y,isDisabled:a.isDisabled||!1,size:a.size,style:a.caption?{margin:"2px 0"}:{}},{children:e(p,{isSmall:"SMALL"===a.size,isActive:v,isDisabled:a.isDisabled||!1,activeColor:a.activeColor})})),i("div",Object.assign({style:{display:"flex",flexDirection:"column",gap:a.gapBetweenBodyAndCaption||"0px"}},{children:[a.label?a.boldOnChecked&&v||a.alwaysBold?e(r,Object.assign({color:a.isDisabled?m.text.disabled:m.text.primary},{children:a.label})):"SMALL"===a.size?e(n,Object.assign({color:a.isDisabled?m.text.disabled:m.text.primary},{children:a.label})):"MEDIUM"===a.labelSize?e(d,Object.assign({color:a.isDisabled?m.text.disabled:m.text.primary},{children:a.label})):e(b,Object.assign({color:a.isDisabled?m.text.disabled:m.text.primary},{children:a.label})):e(s,{}),a.caption&&e(n,Object.assign({color:a.isDisabled?m.text.disabled:m.text.secondary},{children:a.caption}))]}))]}))};export{v as RadioButton};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import c from"@emotion/styled/base";import{getPadding as I,getBackgroundColor as
|
|
1
|
+
import c from"@emotion/styled/base";import{getPadding as I,getBackgroundColor as b,generateBorder as g,getTextColor as l}from"./themes.js";const i=c("div","production"===process.env.NODE_ENV?{target:"e930jd90"}:{target:"e930jd90",label:"Tag"})("cursor:",(c=>{var I;return null!==(I=c.cursor)&&void 0!==I?I:"default"}),";",(c=>"small"!==c.size&&("regular"===c.variant?"display: block;\n\t\t min-height: 26px;\n\t\t":"min-height: 20px;"))," .container{display:flex;align-items:",(c=>c.alignIcon?c.alignIcon:"center"),";gap:6px;",(c=>"small"===c.size?"height: 16px; box-sizing: border-box;":"")," padding:",(c=>"small"===c.size?"2px 6px":c.contentPadding?`${c.contentPadding}px`:I(c.variant)),";background:",(c=>{var I;return null!==(I=c.backgroundColor)&&void 0!==I?I:b(c.theme,c.type)}),";border-radius:",(c=>void 0!==c.borderRadius?"number"==typeof c.borderRadius?`${c.borderRadius}px`:c.borderRadius:"regular"===c.variant?"4px":"12px"),";",(c=>!c.noBorder&&"light"===c.theme&&`border: ${"2.0"===c.version?.5:1}px solid ${g(c.type,c.theme)};`)," .text{color:",(c=>l(c.theme,c.type)),";}.icon-trailing{all:unset;display:flex;}.icon-leading{all:unset;display:flex;}}"+("production"===process.env.NODE_ENV?"":"/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIlRhZy5zdHlsZWQudHN4Il0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUU4QiIsImZpbGUiOiJUYWcuc3R5bGVkLnRzeCIsInNvdXJjZXNDb250ZW50IjpbImltcG9ydCBzdHlsZWQgZnJvbSAnQGVtb3Rpb24vc3R5bGVkJztcclxuaW1wb3J0IHsgZ2VuZXJhdGVCb3JkZXIsIGdldEJhY2tncm91bmRDb2xvciwgZ2V0UGFkZGluZywgZ2V0VGV4dENvbG9yLCB9IGZyb20gJy4vdGhlbWVzJztcclxuZXhwb3J0IGNvbnN0IFRhZyA9IHN0eWxlZC5kaXYgYFxuXHRjdXJzb3I6ICR7KHByb3BzKSA9PiB7IHZhciBfYTsgcmV0dXJuIChfYSA9IHByb3BzLmN1cnNvcikgIT09IG51bGwgJiYgX2EgIT09IHZvaWQgMCA/IF9hIDogJ2RlZmF1bHQnOyB9fTtcblx0JHsocHJvcHMpID0+IHByb3BzLnNpemUgIT09ICdzbWFsbCcgJiZcclxuICAgIChwcm9wcy52YXJpYW50ID09PSAncmVndWxhcidcclxuICAgICAgICA/IGBkaXNwbGF5OiBibG9jaztcblx0XHQgICAgIG1pbi1oZWlnaHQ6IDI2cHg7XG5cdFx0YFxyXG4gICAgICAgIDogYG1pbi1oZWlnaHQ6IDIwcHg7YCl9XG5cdC5jb250YWluZXIge1xuXHRcdGRpc3BsYXk6IGZsZXg7XG5cdFx0YWxpZ24taXRlbXM6ICR7KHByb3BzKSA9PiAocHJvcHMuYWxpZ25JY29uID8gcHJvcHMuYWxpZ25JY29uIDogJ2NlbnRlcicpfTtcblx0XHRnYXA6IDZweDtcblx0XHQkeyhwcm9wcykgPT4gcHJvcHMuc2l6ZSA9PT0gJ3NtYWxsJyA/ICdoZWlnaHQ6IDE2cHg7IGJveC1zaXppbmc6IGJvcmRlci1ib3g7JyA6ICcnfVxuXHRcdHBhZGRpbmc6ICR7KHByb3BzKSA9PiBwcm9wcy5zaXplID09PSAnc21hbGwnXHJcbiAgICA/ICcycHggNnB4J1xyXG4gICAgOiBwcm9wcy5jb250ZW50UGFkZGluZ1xyXG4gICAgICAgID8gYCR7cHJvcHMuY29udGVudFBhZGRpbmd9cHhgXHJcbiAgICAgICAgOiBnZXRQYWRkaW5nKHByb3BzLnZhcmlhbnQpfTtcblx0XHRiYWNrZ3JvdW5kOiAkeyhwcm9wcykgPT4geyB2YXIgX2E7IHJldHVybiAoX2EgPSBwcm9wcy5iYWNrZ3JvdW5kQ29sb3IpICE9PSBudWxsICYmIF9hICE9PSB2b2lkIDAgPyBfYSA6IGdldEJhY2tncm91bmRDb2xvcihwcm9wcy50aGVtZSwgcHJvcHMudHlwZSk7IH19O1xuXG5cdFx0Ym9yZGVyLXJhZGl1czogJHsocHJvcHMpID0+IHByb3BzLmJvcmRlclJhZGl1cyAhPT0gdW5kZWZpbmVkXHJcbiAgICA/IHR5cGVvZiBwcm9wcy5ib3JkZXJSYWRpdXMgPT09ICdudW1iZXInXHJcbiAgICAgICAgPyBgJHtwcm9wcy5ib3JkZXJSYWRpdXN9cHhgXHJcbiAgICAgICAgOiBwcm9wcy5ib3JkZXJSYWRpdXNcclxuICAgIDogcHJvcHMudmFyaWFudCA9PT0gJ3JlZ3VsYXInXHJcbiAgICAgICAgPyAnNHB4J1xyXG4gICAgICAgIDogJzEycHgnfTtcblxuXHRcdCR7KHByb3BzKSA9PiAhcHJvcHMubm9Cb3JkZXIgJiZcclxuICAgIHByb3BzLnRoZW1lID09PSAnbGlnaHQnICYmXHJcbiAgICBgYm9yZGVyOiAke3Byb3BzLnZlcnNpb24gPT09ICcyLjAnID8gMC41IDogMX1weCBzb2xpZCAke2dlbmVyYXRlQm9yZGVyKHByb3BzLnR5cGUsIHByb3BzLnRoZW1lKX07YH1cblxuXHRcdC50ZXh0IHtcblx0XHRcdGNvbG9yOiAkeyhwcm9wcykgPT4gZ2V0VGV4dENvbG9yKHByb3BzLnRoZW1lLCBwcm9wcy50eXBlKX07XG5cdFx0fVxuXG5cdFx0Lmljb24tdHJhaWxpbmcge1xuXHRcdFx0YWxsOiB1bnNldDtcblx0XHRcdGRpc3BsYXk6IGZsZXg7XG5cdFx0fVxuXG5cdFx0Lmljb24tbGVhZGluZyB7XG5cdFx0XHRhbGw6IHVuc2V0O1xuXHRcdFx0ZGlzcGxheTogZmxleDtcblx0XHR9XG5cdH1cbmA7XHJcbi8vIyBzb3VyY2VNYXBwaW5nVVJMPVRhZy5zdHlsZWQuanMubWFwIl19 */"));export{i as Tag};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as e,jsxs as t,Fragment as i}from"react/jsx-runtime";import{useTemplateModalContext as l}from"../template-context-mapper/context/templateModalContext.js";import n from"../../utils/StringUtils.js";import{COLORS as o}from"../../constants/Theme.js";import a from"../../assets/icons/aiContentIcon.svg.js";import{TitleRegular as s}from"../TypographyStyle.js";import r from"./EmailTemplateThumbnailPreview.js";import{CHANNEL_TYPE as d}from"./models/Channels.js";import p from"./SmsTemplatePreview.js";import m from"./webpush/WebpushPreview.js";import u from"./WhatsAppTemplatePreview.js";const c=c=>{let{template:h,channel:g,whatsAppSpecificMeta:C,templateCreationsInfo:b,hideHeader:y,size:S,onlyTemplateContent:j,emailSpecificMeta:f,smsSpecificMeta:w,showSampleValues:T,carouselCardIndex:x,isWhatsappCarousel:O,isPreview:P,applyBorderBottom:I,webPushSpecificMeta:W,hidePointerEvents:H}=c;var A,B;const{setSelectedCarouselIndex:E}=l();return g===d.SMS?e("div",Object.assign({style:Object.assign({marginTop:b?16:0,border:b?`1px solid ${o.stroke.primary}`:"none",borderRadius:4},null==w?void 0:w.templateContainerStyles)},{children:e(p,{template:h,hideHeader:y,onlyTemplateContent:j,size:null!=S?S:"large",variableStore:null==w?void 0:w.smsVariableStore,display_content:null==w?void 0:w.smsDisplayContent,uniqueId:null==w?void 0:w.uniqueId})})):g===d.EMAIL?e("div",Object.assign({style:Object.assign({marginTop:b?16:0},null==f?void 0:f.templateContainerStyles)},{children:e(r,{template:h,handleViewTemplate:()=>{var e;null===(e=null==f?void 0:f.handleViewTemplate)||void 0===e||e.call(f)},hideHeader:y,hideViewButton:null==f?void 0:f.hideViewButtonForEmail,containerStyle:null==f?void 0:f.containerStyle,emailDisplayContent:null==f?void 0:f.emailDisplayContent,emailHtmlContainerId:null==f?void 0:f.emailHtmlContainerId,applyBorderBottom:I,hidePointerEvents:H})})):g===d.WHATSAPP||g===d.RCS?t("div",Object.assign({style:Object.assign(Object.assign(Object.assign({},null==C?void 0:C.templateContainerStyles),b?v.WhatsAppWrapper:{}),{position:"relative"}),onClick:()=>{var e,t;if(E&&O){if(-1===x&&!(null===(t=null===(e=null==h?void 0:h.mapping)||void 0===e?void 0:e.body)||void 0===t?void 0:t.length))return;E(null!=x?x:-1)}}},{children:[b?e("div",Object.assign({style:{padding:16}},{children:e(s,{children:n.convertToTitleCase(null!==(A=null==h?void 0:h.label)&&void 0!==A?A:"")})})):e(i,{}),e(u,{showSampleValues:T,showHeader:null==C?void 0:C.showWhatsAppHeader,extras:null==C?void 0:C.whatsAppExtras,template:h,size:b?"small":null!=S?S:"large",containerStyle:Object.assign(Object.assign({borderWidth:b?0:1,borderTopWidth:1},null!==(B=null==C?void 0:C.containerStyle)&&void 0!==B?B:{}),{height:"100%"}),zeroStateComponent:null==C?void 0:C.zeroStateComponent,usePlaceHolderName:null==C?void 0:C.usePlaceHolderName,carouselCardIndex:x,isWhatsappCarousel:O,isPreview:P,channel:g}),(!!(null==h?void 0:h.aiContentConfigId)||!!(null==h?void 0:h.isAiGenerated))&&e("div",Object.assign({style:{position:"absolute",top:0,right:
|
|
1
|
+
import{jsx as e,jsxs as t,Fragment as i}from"react/jsx-runtime";import{useTemplateModalContext as l}from"../template-context-mapper/context/templateModalContext.js";import n from"../../utils/StringUtils.js";import{COLORS as o}from"../../constants/Theme.js";import a from"../../assets/icons/aiContentIcon.svg.js";import{TitleRegular as s}from"../TypographyStyle.js";import r from"./EmailTemplateThumbnailPreview.js";import{CHANNEL_TYPE as d}from"./models/Channels.js";import p from"./SmsTemplatePreview.js";import m from"./webpush/WebpushPreview.js";import u from"./WhatsAppTemplatePreview.js";const c=c=>{let{template:h,channel:g,whatsAppSpecificMeta:C,templateCreationsInfo:b,hideHeader:y,size:S,onlyTemplateContent:j,emailSpecificMeta:f,smsSpecificMeta:w,showSampleValues:T,carouselCardIndex:x,isWhatsappCarousel:O,isPreview:P,applyBorderBottom:I,webPushSpecificMeta:W,hidePointerEvents:H}=c;var A,B;const{setSelectedCarouselIndex:E}=l();return g===d.SMS?e("div",Object.assign({style:Object.assign({marginTop:b?16:0,border:b?`1px solid ${o.stroke.primary}`:"none",borderRadius:4},null==w?void 0:w.templateContainerStyles)},{children:e(p,{template:h,hideHeader:y,onlyTemplateContent:j,size:null!=S?S:"large",variableStore:null==w?void 0:w.smsVariableStore,display_content:null==w?void 0:w.smsDisplayContent,uniqueId:null==w?void 0:w.uniqueId})})):g===d.EMAIL?e("div",Object.assign({style:Object.assign({marginTop:b?16:0},null==f?void 0:f.templateContainerStyles)},{children:e(r,{template:h,handleViewTemplate:()=>{var e;null===(e=null==f?void 0:f.handleViewTemplate)||void 0===e||e.call(f)},hideHeader:y,hideViewButton:null==f?void 0:f.hideViewButtonForEmail,containerStyle:null==f?void 0:f.containerStyle,emailDisplayContent:null==f?void 0:f.emailDisplayContent,emailHtmlContainerId:null==f?void 0:f.emailHtmlContainerId,applyBorderBottom:I,hidePointerEvents:H})})):g===d.WHATSAPP||g===d.RCS?t("div",Object.assign({style:Object.assign(Object.assign(Object.assign({},null==C?void 0:C.templateContainerStyles),b?v.WhatsAppWrapper:{}),{position:"relative"}),onClick:()=>{var e,t;if(E&&O){if(-1===x&&!(null===(t=null===(e=null==h?void 0:h.mapping)||void 0===e?void 0:e.body)||void 0===t?void 0:t.length))return;E(null!=x?x:-1)}}},{children:[b?e("div",Object.assign({style:{padding:16}},{children:e(s,{children:n.convertToTitleCase(null!==(A=null==h?void 0:h.label)&&void 0!==A?A:"")})})):e(i,{}),e(u,{showSampleValues:T,showHeader:null==C?void 0:C.showWhatsAppHeader,extras:null==C?void 0:C.whatsAppExtras,template:h,size:b?"small":null!=S?S:"large",containerStyle:Object.assign(Object.assign({borderWidth:b?0:1,borderTopWidth:1},null!==(B=null==C?void 0:C.containerStyle)&&void 0!==B?B:{}),{height:"100%"}),zeroStateComponent:null==C?void 0:C.zeroStateComponent,usePlaceHolderName:null==C?void 0:C.usePlaceHolderName,carouselCardIndex:x,isWhatsappCarousel:O,isPreview:P,channel:g}),(!!(null==h?void 0:h.aiContentConfigId)||!!(null==h?void 0:h.isAiGenerated))&&e("div",Object.assign({style:{position:"absolute",top:0,right:30,display:"flex",alignItems:"center",justifyContent:"center",width:48,height:48,zIndex:4}},{children:e(a,{width:48,height:48})}))]})):g==d.WEBPUSH?e("div",Object.assign({style:Object.assign({},null==W?void 0:W.containerStyle)},{children:e(m,{template:h,extraContainerCss:null==W?void 0:W.extraContainerCss})})):e(i,{})},v={WhatsAppWrapper:{backgroundColor:o.surface.standard,borderRadius:4,border:`1px solid ${o.background.inactive}`,marginTop:16}};export{c as TemplatePreview};
|
|
@@ -5,6 +5,7 @@ import{__rest as t}from"../../_virtual/_tslib.js";import{jsxs as e,jsx as n}from
|
|
|
5
5
|
align-items: center;
|
|
6
6
|
justify-content: center;
|
|
7
7
|
flex: 1;
|
|
8
|
+
gap: 6px;
|
|
8
9
|
`,m=i.div`
|
|
9
10
|
background: ${c.background.base};
|
|
10
11
|
width: 48px;
|
|
@@ -14,4 +15,4 @@ import{__rest as t}from"../../_virtual/_tslib.js";import{jsxs as e,jsx as n}from
|
|
|
14
15
|
align-items: center;
|
|
15
16
|
justify-content: center;
|
|
16
17
|
border-radius: 24px;
|
|
17
|
-
`,p=i=>{var{subTitle:p,title:g,IconHolderStyle:h,style:y,isLoading:b,containerWidth:f}=i,j=t(i,["subTitle","title","IconHolderStyle","style","isLoading","containerWidth"]);let x=l;const v=f?parseFloat(f):0;return v&&!isNaN(v)&&v<=150&&(x=s),e(u,Object.assign({style:null!=y?y:{}},{children:[b?n(o,{size:"large",color:c.stroke.brand}):n(m,Object.assign({style:null!=h?h:{}},{children:(null==j?void 0:j.Icon)||n(a,{color:c.content.placeholder,height:24,width:24})})),n(x,Object.assign({style:{
|
|
18
|
+
`,p=i=>{var{subTitle:p,title:g,IconHolderStyle:h,style:y,isLoading:b,containerWidth:f}=i,j=t(i,["subTitle","title","IconHolderStyle","style","isLoading","containerWidth"]);let x=l;const v=f?parseFloat(f):0;return v&&!isNaN(v)&&v<=150&&(x=s),e(u,Object.assign({style:null!=y?y:{}},{children:[b?n(o,{size:"large",color:c.stroke.brand}):n(m,Object.assign({style:null!=h?h:{}},{children:(null==j?void 0:j.Icon)||n(a,{color:c.content.placeholder,height:24,width:24})})),n(x,Object.assign({style:{color:c.content.primary}},{children:b?"Loading...":g||"No results found"})),!!p&&!b&&n(r,Object.assign({style:{color:c.content.secondary,textAlign:"center",maxWidth:184}},{children:p})),!!(null==j?void 0:j.actionButton)&&n("div",Object.assign({style:(null==j?void 0:j.buttonWidth)?{width:null==j?void 0:j.buttonWidth,display:"flex"}:{}},{children:n(d,Object.assign({},null==j?void 0:j.actionButton))}))]}))};export{p as ZeroState};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{isAplhanumeric as t}from"../utils/isAlphanumeric.js";class
|
|
1
|
+
import{isAplhanumeric as t}from"../utils/isAlphanumeric.js";class s{getHTML(t){let s=t;return s=this.whatsappStyles(s,"_","<i>","</i>"),s=this.whatsappStyles(s,"*","<b>","</b>"),s=this.whatsappStyles(s,"~","<s>","</s>"),s=this.whatsappStylesMonospace(s,'<code style="color: black;">',"</code>"),s&&(s=s.replace(/\n/gi,"<br>")),s=this.whatsappLinkStyle(s),s}whatsappStyles(s,e,o,p){const r=[];if(s)for(let o=0;o<s.length;o++)s[o]===e?r.length%2?" "!==s[o-1]&&((void 0===s[o+1]||!t(s[o+1]))&&r.push(o)):void 0!==s[o+1]&&(" "!==s[o+1]&&((void 0===s[o-1]||!t(s[o-1]))&&r.push(o))):10===s.charCodeAt(o)&&r.length%2&&r.pop();r.length%2&&r.pop();let l=0;return r.forEach((function(t,e){const r=e%2?p:o;t+=l,s=s.substr(0,t)+r+s.substr(t+1),l+=r.length-1})),s}whatsappStylesMonospace(s,e,o){const p=[];if(s)for(let e=0;e<s.length;e++)"`"===s[e]&&"`"===s[e+1]&&"`"===s[e+2]?p.length%2?" "===s[e-3]||(void 0===s[e+3]?p.push(e):t(s[e+3])?p.length%2==1&&p.pop():p.push(e)):void 0===s[e+3]||" "===s[e+3]||(void 0===s[e-1]||" "===s[e-1]?p.push(e):t(s[e-1])?p.length%2==1&&p.pop():p.push(e)):10===s.charCodeAt(e)&&p.length%2&&p.pop();p.length%2&&p.pop();let r=0;return p.forEach((function(t,p){const l=p%2?o:e;t+=r,s=s.substr(0,t)+l+s.substr(t+3),r+=l.length-3})),s}whatsappLinkStyle(t){const s=null==t?void 0:t.trim();if(!s||/\s/.test(s))return t;const e=/^https?:\/\//i.test(s)?s:`https://${s}`;try{const o=new URL(e);if(!/^https?:$/i.test(o.protocol))return t;const p=o.hostname.toLowerCase(),r="localhost"===p,l=/^(?:\d{1,3}\.){3}\d{1,3}$/.test(p),n=p.includes(".")&&/\.[a-z]{2,}$/i.test(p);return r||l||n?`<a href="${e}" target="_blank" rel="noreferrer">${s}</a>`:t}catch(s){return t}}wrappWildcard(t,s,e,o){return t<0||t>s?o:o.slice(0,t)+e+o.slice(t,s)+e+o.slice(s)}}export{s as BaseWhatsappContentLangHelper};
|