@qualtrics/ui-react 2.27.0 → 2.29.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +23 -0
- package/dist/__shared/cjs/{index-88aa3bce.js → index-c2d2f188.js} +707 -451
- package/dist/__shared/cjs/{index-e6893573.js → index-c9e48360.js} +3 -3
- package/dist/components/Accordion/Accordion2.js +3 -3
- package/dist/components/Button/Button.js +3 -3
- package/dist/components/ButtonGroup/ButtonGroup2.js +3 -3
- package/dist/components/Checkbox/Checkbox.js +54 -10
- package/dist/components/Checkbox/Checkbox2.js +3 -3
- package/dist/components/Checkbox/VisualCheckbox2.js +3 -3
- package/dist/components/ColorPicker/ColorPicker2.js +3 -3
- package/dist/components/Combobox/Combobox2.js +3 -3
- package/dist/components/ConfigPane/ConfigPane2.js +3 -3
- package/dist/components/Divider/Divider2.js +3 -3
- package/dist/components/Dropdown/Dropdown.js +59 -7
- package/dist/components/Dropdown/Dropdown2.js +3 -3
- package/dist/components/FilePicker/FilePicker2.js +3 -3
- package/dist/components/FormField/Caption.js +3 -3
- package/dist/components/FormField/FormField2.js +3 -3
- package/dist/components/FullScreenTakeover/FullScreenTakeover2.js +3 -3
- package/dist/components/IconButton/IconButton2.js +3 -3
- package/dist/components/InlineInput/InlineInput2.js +3 -3
- package/dist/components/Input/Input2.js +3 -3
- package/dist/components/InputGroup/InputGroup2.js +3 -3
- package/dist/components/Label/Label2.js +3 -3
- package/dist/components/Link/Link2.js +3 -3
- package/dist/components/LoadingSpinner/LoadingSpinner2.js +3 -3
- package/dist/components/LogicEditor/ConditionSet.js +3 -4
- package/dist/components/LogicEditor/Controls.js +66 -48
- package/dist/components/LogicEditor/LogicEditor.js +34 -8
- package/dist/components/LogicEditor/LogicEditor2.js +3 -3
- package/dist/components/LogicEditor/utils.js +4 -1
- package/dist/components/Modal/Modal2.js +3 -3
- package/dist/components/NewMenu/NewMenu.js +3 -3
- package/dist/components/NumberStepper/NumberStepper2.js +3 -3
- package/dist/components/PageLayout/PageLayout.js +3 -3
- package/dist/components/Pagination/Pagination2.js +3 -3
- package/dist/components/Popover/Popover2.js +3 -3
- package/dist/components/QuickSearch/QuickSearch2.js +3 -3
- package/dist/components/Radio/Radio.js +25 -5
- package/dist/components/Radio/Radio2.js +3 -3
- package/dist/components/Radio/RadioGroup.js +16 -3
- package/dist/components/SearchInput/SearchInput2.js +3 -3
- package/dist/components/SidebarNav/SidebarNav2.js +3 -3
- package/dist/components/Slider/Slider2.js +3 -3
- package/dist/components/Switch/Switch2.js +3 -3
- package/dist/components/Table/Table2.js +3 -3
- package/dist/components/Tabs/Tabs2.js +3 -3
- package/dist/components/Tooltip/Tooltip2.js +3 -3
- package/dist/components/deprecated_ColorPicker/ColorPicker2.js +3 -3
- package/dist/components/deprecated_NumberStepper/NumberStepper2.js +3 -3
- package/dist/components/deprecated_Tabs/Tabs2.js +3 -3
- package/dist/components/deprecated_Toolbar/Toolbar2.js +3 -3
- package/dist/hooks/useOverlay/useOverlay2.js +3 -3
- package/dist/hooks/useScreenReaderAnnouncement/useScreenReaderAnnouncement2.js +3 -3
- package/dist/icons/Icon.js +3 -3
- package/dist/icons/index.js +1 -1
- package/dist/index.d.ts +12 -2
- package/dist/index.es.js +1 -1
- package/dist/index.js +3 -3
- package/dist/next/AdvancedTable/AdvancedTable.js +54 -78
- package/dist/next/AdvancedTable/AdvancedTable2.js +3 -3
- package/dist/next/CollapsibleSearchInput/CollapsibleSearchInput2.js +3 -3
- package/dist/next/Combobox/Combobox2.js +3 -3
- package/dist/next/Drawer/Drawer2.js +3 -3
- package/dist/next/FilterAnchor/FilterAnchor2.js +3 -3
- package/dist/next/Form/FormFields/FormFieldWrapper.js +36 -0
- package/dist/next/Form/FormFields/InputField.js +8 -0
- package/dist/next/Form/index.js +2 -0
- package/dist/next/Form/useForm.js +298 -0
- package/dist/next/Form/useFormField.js +25 -0
- package/dist/next/Form/utils/createFormInstance.js +32 -0
- package/dist/next/Form/utils/useFormContext.js +9 -0
- package/dist/next/Input/Input.js +47 -7
- package/dist/next/Input/Input2.js +3 -3
- package/dist/next/Menu/Menu2.js +3 -3
- package/dist/next/Menu/MenuPane.js +2 -2
- package/dist/next/Pagination/Pagination.css.js +9 -0
- package/dist/next/Pagination/Pagination.css.ts.vanilla.js +8 -0
- package/dist/next/Pagination/Pagination.js +166 -0
- package/dist/next/Pagination/RowDisplayCount.js +46 -0
- package/dist/next/Pagination/index.js +2 -0
- package/dist/next/PhoneNumberInput/PhoneNumberInput2.js +3 -3
- package/dist/next/Select/Select2.js +3 -3
- package/dist/next/SplitButton/SplitButton2.js +3 -3
- package/dist/next/TimePicker/TimeDropdown.js +9 -3
- package/dist/next/TimePicker/TimePicker.js +1 -1
- package/dist/next/TimePicker/TimePicker2.js +3 -3
- package/dist/next/ToggleButton/ToggleButton.js +2 -2
- package/dist/next/ToggleButton/styles.js +3 -3
- package/dist/next/index.d.ts +170 -4
- package/dist/next/index.es.js +29 -23
- package/dist/next/index.js +1968 -1474
- package/dist/utils/Flyout/Flyout2.js +3 -3
- package/icons/package.json +1 -1
- package/next/package.json +2 -2
- package/package.json +3 -3
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import styleInject from './../../__node_modules/style-inject/dist/style-inject.es.js';
|
|
2
2
|
|
|
3
|
-
var css_248z = ".
|
|
4
|
-
var styles = {"container":"
|
|
5
|
-
var stylesheet=".
|
|
3
|
+
var css_248z = "._Oxn01{max-width:100%;position:relative;display:inline-block}._sW8cL{display:inline-flex;justify-content:space-between;align-items:center;background-color:#fafafa;border:1px solid #898989;border-radius:4px;height:36px;color:#515559;outline:none;cursor:pointer}._sW8cL:hover:not([aria-disabled=true]){cursor:pointer;background-color:#f5f5f5}._sW8cL:focus{box-shadow:0 0 0 2px #fff,0 0 0 4px #0a3f88;background-color:#fafafa}._sW8cL:disabled,._sW8cL[aria-disabled=true]{color:#74777a;border-color:#e5e5e5;cursor:not-allowed}._sW8cL._k-xci{border-color:#b00}._sW8cL._k-xci:focus{box-shadow:0 0 0 2px #fff,0 0 0 4px #900000}._sW8cL._CK9Dx{min-width:120px;padding:0 4px 0 12px}._sW8cL._e8B3i{margin-top:4px}._sW8cL._WbAYv:not([aria-disabled=true]):not(:disabled){color:#32363a}._sW8cL ._huqqe{min-height:10px}._sW8cL ._huqqe._r8WtV{line-height:20px;font-size:14px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}._sW8cL ._huqqe._Jj0yL{display:inline-flex;align-items:center}._sW8cL ._GkQLi{height:24px;width:24px;border-radius:4px;fill:#515559;flex-shrink:0;cursor:pointer}._sW8cL ._GkQLi._lS1N-{border-color:#e5e5e5;fill:#9d9fa1;opacity:.4;cursor:not-allowed}._sW8cL ._GkQLi._335Er{transform:rotate(-180deg)}._hXCHa[aria-disabled=true]{cursor:not-allowed;color:rgba(81,85,89,.65);fill:#9d9fa1}._PQ2Nd{position:-webkit-sticky;position:sticky;top:0;z-index:20;padding:4px 8px 8px!important;border-bottom:1px solid #e8e8e8;border-radius:4px 4px 0 0;background-color:#fff!important}._oGmBj{min-height:40px;padding:10px 12px;display:flex;flex-direction:row;align-items:center;background-color:#fff;font-size:14px;color:#32363a;word-break:break-word}._Z5gJA{fill:#515559}._ccV0M{margin:2px 12px 2px 0}._ccV0M._hMFu4>svg{border-color:#0b6ed0}._8m3Au{width:100%}";
|
|
4
|
+
var styles = {"container":"_Oxn01","button":"_sW8cL","invalid":"_k-xci","hasText":"_CK9Dx","labelled":"_e8B3i","selected":"_WbAYv","buttonLabel":"_huqqe","isString":"_r8WtV","isNode":"_Jj0yL","icon":"_GkQLi","disabled":"_lS1N-","open":"_335Er","option":"_hXCHa","search":"_PQ2Nd","emptyOption":"_oGmBj","searchIcon":"_Z5gJA","checkbox":"_ccV0M","highlighted":"_hMFu4","searchInput":"_8m3Au"};
|
|
5
|
+
var stylesheet="._Oxn01{max-width:100%;position:relative;display:inline-block}._sW8cL{display:inline-flex;justify-content:space-between;align-items:center;background-color:#fafafa;border:1px solid #898989;border-radius:4px;height:36px;color:#515559;outline:none;cursor:pointer}._sW8cL:hover:not([aria-disabled=true]){cursor:pointer;background-color:#f5f5f5}._sW8cL:focus{box-shadow:0 0 0 2px #fff,0 0 0 4px #0a3f88;background-color:#fafafa}._sW8cL:disabled,._sW8cL[aria-disabled=true]{color:#74777a;border-color:#e5e5e5;cursor:not-allowed}._sW8cL._k-xci{border-color:#b00}._sW8cL._k-xci:focus{box-shadow:0 0 0 2px #fff,0 0 0 4px #900000}._sW8cL._CK9Dx{min-width:120px;padding:0 4px 0 12px}._sW8cL._e8B3i{margin-top:4px}._sW8cL._WbAYv:not([aria-disabled=true]):not(:disabled){color:#32363a}._sW8cL ._huqqe{min-height:10px}._sW8cL ._huqqe._r8WtV{line-height:20px;font-size:14px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}._sW8cL ._huqqe._Jj0yL{display:inline-flex;align-items:center}._sW8cL ._GkQLi{height:24px;width:24px;border-radius:4px;fill:#515559;flex-shrink:0;cursor:pointer}._sW8cL ._GkQLi._lS1N-{border-color:#e5e5e5;fill:#9d9fa1;opacity:.4;cursor:not-allowed}._sW8cL ._GkQLi._335Er{transform:rotate(-180deg)}._hXCHa[aria-disabled=true]{cursor:not-allowed;color:rgba(81,85,89,.65);fill:#9d9fa1}._PQ2Nd{position:-webkit-sticky;position:sticky;top:0;z-index:20;padding:4px 8px 8px!important;border-bottom:1px solid #e8e8e8;border-radius:4px 4px 0 0;background-color:#fff!important}._oGmBj{min-height:40px;padding:10px 12px;display:flex;flex-direction:row;align-items:center;background-color:#fff;font-size:14px;color:#32363a;word-break:break-word}._Z5gJA{fill:#515559}._ccV0M{margin:2px 12px 2px 0}._ccV0M._hMFu4>svg{border-color:#0b6ed0}._8m3Au{width:100%}";
|
|
6
6
|
if(typeof process !== 'object' || !process.hasOwnProperty('env') || process.env.NODE_ENV !== 'test'){styleInject(css_248z);}
|
|
7
7
|
|
|
8
8
|
export { styles as default, stylesheet };
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import styleInject from './../../__node_modules/style-inject/dist/style-inject.es.js';
|
|
2
2
|
|
|
3
|
-
var css_248z = ".
|
|
4
|
-
var filePickerStyles = {"container":"
|
|
5
|
-
var stylesheet=".
|
|
3
|
+
var css_248z = "._31WCV{position:relative}._31WCV[focus-within] button{outline:none;box-shadow:0 0 0 2px #fff,0 0 0 4px #0a3f88}._31WCV:focus-within button{outline:none;box-shadow:0 0 0 2px #fff,0 0 0 4px #0a3f88}._Svpzm{opacity:0;position:absolute;height:36px;width:100%;left:0;z-index:-1}._lSQNR{margin-left:16px;font-size:14px;color:#32363a}._lSQNR ._l00E2{margin-right:16px}";
|
|
4
|
+
var filePickerStyles = {"container":"_31WCV","fileInput":"_Svpzm","fileDetails":"_lSQNR","fileName":"_l00E2"};
|
|
5
|
+
var stylesheet="._31WCV{position:relative}._31WCV[focus-within] button{outline:none;box-shadow:0 0 0 2px #fff,0 0 0 4px #0a3f88}._31WCV:focus-within button{outline:none;box-shadow:0 0 0 2px #fff,0 0 0 4px #0a3f88}._Svpzm{opacity:0;position:absolute;height:36px;width:100%;left:0;z-index:-1}._lSQNR{margin-left:16px;font-size:14px;color:#32363a}._lSQNR ._l00E2{margin-right:16px}";
|
|
6
6
|
if(typeof process !== 'object' || !process.hasOwnProperty('env') || process.env.NODE_ENV !== 'test'){styleInject(css_248z);}
|
|
7
7
|
|
|
8
8
|
export { filePickerStyles as default, stylesheet };
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import styleInject from './../../__node_modules/style-inject/dist/style-inject.es.js';
|
|
2
2
|
|
|
3
|
-
var css_248z = ".
|
|
4
|
-
var styles = {"caption":"
|
|
5
|
-
var stylesheet=".
|
|
3
|
+
var css_248z = "._-Sn-x{display:flex;align-items:center;font-size:12px;line-height:16px;min-height:16px}._WR73Z{color:#6a6d70;fill:#6a6d70}._DhQj-{color:#b00;fill:#b00}._-Y6V3,._cXCSd{margin-left:-2px;margin-right:3px}";
|
|
4
|
+
var styles = {"caption":"_-Sn-x","helperText":"_WR73Z","errorText":"_DhQj-","errorIcon":"_-Y6V3","readOnlyIcon":"_cXCSd"};
|
|
5
|
+
var stylesheet="._-Sn-x{display:flex;align-items:center;font-size:12px;line-height:16px;min-height:16px}._WR73Z{color:#6a6d70;fill:#6a6d70}._DhQj-{color:#b00;fill:#b00}._-Y6V3,._cXCSd{margin-left:-2px;margin-right:3px}";
|
|
6
6
|
if(typeof process !== 'object' || !process.hasOwnProperty('env') || process.env.NODE_ENV !== 'test'){styleInject(css_248z);}
|
|
7
7
|
|
|
8
8
|
export { styles as default, stylesheet };
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import styleInject from './../../__node_modules/style-inject/dist/style-inject.es.js';
|
|
2
2
|
|
|
3
|
-
var css_248z = ".
|
|
4
|
-
var styles = {"formField":"
|
|
5
|
-
var stylesheet=".
|
|
3
|
+
var css_248z = "._KRYqF{display:flex;flex-direction:column;align-items:flex-start}._wJPIR{margin-top:6px;max-width:100%}._wJPIR *+*{margin-top:4px}";
|
|
4
|
+
var styles = {"formField":"_KRYqF","captionContainer":"_wJPIR"};
|
|
5
|
+
var stylesheet="._KRYqF{display:flex;flex-direction:column;align-items:flex-start}._wJPIR{margin-top:6px;max-width:100%}._wJPIR *+*{margin-top:4px}";
|
|
6
6
|
if(typeof process !== 'object' || !process.hasOwnProperty('env') || process.env.NODE_ENV !== 'test'){styleInject(css_248z);}
|
|
7
7
|
|
|
8
8
|
export { styles as default, stylesheet };
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import styleInject from './../../__node_modules/style-inject/dist/style-inject.es.js';
|
|
2
2
|
|
|
3
|
-
var css_248z = ".
|
|
4
|
-
var styles = {"dialog":"
|
|
5
|
-
var stylesheet=".
|
|
3
|
+
var css_248z = "._qR-wV{position:fixed;left:0;top:0;width:100vw;height:100vh;background-color:#fff;overflow:auto}@keyframes _Z3uSf{0%{transform:scale3d(.7,.7,.7);opacity:0}}._DNI8a{animation:_Z3uSf both;animation-duration:.2s}@keyframes _k-BcY{to{transform:scale3d(.7,.7,.7);opacity:0}}._JABEp{animation:_k-BcY both;animation-duration:.2s}";
|
|
4
|
+
var styles = {"dialog":"_qR-wV","transitionIn":"_DNI8a","showAnimation":"_Z3uSf","transitionOut":"_JABEp","hideAnimation":"_k-BcY"};
|
|
5
|
+
var stylesheet="._qR-wV{position:fixed;left:0;top:0;width:100vw;height:100vh;background-color:#fff;overflow:auto}@keyframes _Z3uSf{0%{transform:scale3d(.7,.7,.7);opacity:0}}._DNI8a{animation:_Z3uSf both;animation-duration:.2s}@keyframes _k-BcY{to{transform:scale3d(.7,.7,.7);opacity:0}}._JABEp{animation:_k-BcY both;animation-duration:.2s}";
|
|
6
6
|
if(typeof process !== 'object' || !process.hasOwnProperty('env') || process.env.NODE_ENV !== 'test'){styleInject(css_248z);}
|
|
7
7
|
|
|
8
8
|
export { styles as default, stylesheet };
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import styleInject from './../../__node_modules/style-inject/dist/style-inject.es.js';
|
|
2
2
|
|
|
3
|
-
var css_248z = ".
|
|
4
|
-
var iconButtonStyles = {"button":"
|
|
5
|
-
var stylesheet=".
|
|
3
|
+
var css_248z = "._5J-4M{border-radius:4px;border:none;height:36px;width:36px;display:inline-flex;flex-shrink:0;align-items:center;justify-content:center;padding:0;cursor:pointer;fill:#515559;background-color:transparent;transition:background .2s,color .2s}._5J-4M:focus{outline:none}._5J-4M:hover:not(._tViLp){background-color:rgba(50,54,58,.08)}._5J-4M:active:not(._tViLp){background-color:rgba(50,54,58,.11);stroke-width:2}._5J-4M._tViLp{cursor:not-allowed;fill:rgba(81,85,89,.6)}._5J-4M.focus-visible,._5J-4M:focus-visible{outline:none;box-shadow:0 0 0 2px #fff,0 0 0 4px #0a3f88}";
|
|
4
|
+
var iconButtonStyles = {"button":"_5J-4M","disabled":"_tViLp"};
|
|
5
|
+
var stylesheet="._5J-4M{border-radius:4px;border:none;height:36px;width:36px;display:inline-flex;flex-shrink:0;align-items:center;justify-content:center;padding:0;cursor:pointer;fill:#515559;background-color:transparent;transition:background .2s,color .2s}._5J-4M:focus{outline:none}._5J-4M:hover:not(._tViLp){background-color:rgba(50,54,58,.08)}._5J-4M:active:not(._tViLp){background-color:rgba(50,54,58,.11);stroke-width:2}._5J-4M._tViLp{cursor:not-allowed;fill:rgba(81,85,89,.6)}._5J-4M.focus-visible,._5J-4M:focus-visible{outline:none;box-shadow:0 0 0 2px #fff,0 0 0 4px #0a3f88}";
|
|
6
6
|
if(typeof process !== 'object' || !process.hasOwnProperty('env') || process.env.NODE_ENV !== 'test'){styleInject(css_248z);}
|
|
7
7
|
|
|
8
8
|
export { iconButtonStyles as default, stylesheet };
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import styleInject from './../../__node_modules/style-inject/dist/style-inject.es.js';
|
|
2
2
|
|
|
3
|
-
var css_248z = ".
|
|
4
|
-
var styles = {"container":"
|
|
5
|
-
var stylesheet=".
|
|
3
|
+
var css_248z = "._5CDb2{display:inline-block}._p94xX{color:#085caf;cursor:pointer;font-size:14px;box-sizing:border-box;padding:4px;margin:-5px;outline:0;border:1px solid transparent;border-radius:4px;background-clip:padding-box;display:block}._p94xX::-moz-selection{background-color:rgba(11,110,208,.11)}._p94xX::selection{background-color:rgba(11,110,208,.11)}._p94xX:focus,._p94xX:hover{background-color:#f5f5f5}._p94xX:focus{border:2px solid #0a3f88;padding:3px}._p94xX:focus._GVv4L{background-color:#fafafa;cursor:text;box-shadow:inset 0 1px 1px rgba(0,0,0,.075),0 1px 8px hsla(0,0%,66.7%,.5)}";
|
|
4
|
+
var styles = {"container":"_5CDb2","inlineInput":"_p94xX","isEditing":"_GVv4L"};
|
|
5
|
+
var stylesheet="._5CDb2{display:inline-block}._p94xX{color:#085caf;cursor:pointer;font-size:14px;box-sizing:border-box;padding:4px;margin:-5px;outline:0;border:1px solid transparent;border-radius:4px;background-clip:padding-box;display:block}._p94xX::-moz-selection{background-color:rgba(11,110,208,.11)}._p94xX::selection{background-color:rgba(11,110,208,.11)}._p94xX:focus,._p94xX:hover{background-color:#f5f5f5}._p94xX:focus{border:2px solid #0a3f88;padding:3px}._p94xX:focus._GVv4L{background-color:#fafafa;cursor:text;box-shadow:inset 0 1px 1px rgba(0,0,0,.075),0 1px 8px hsla(0,0%,66.7%,.5)}";
|
|
6
6
|
if(typeof process !== 'object' || !process.hasOwnProperty('env') || process.env.NODE_ENV !== 'test'){styleInject(css_248z);}
|
|
7
7
|
|
|
8
8
|
export { styles as default, stylesheet };
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import styleInject from './../../__node_modules/style-inject/dist/style-inject.es.js';
|
|
2
2
|
|
|
3
|
-
var css_248z = ".
|
|
4
|
-
var styles = {"input":"
|
|
5
|
-
var stylesheet=".
|
|
3
|
+
var css_248z = "._15ziu{display:inline-block;height:36px;min-height:36px;padding:8px 12px;line-height:20px;font-size:14px;color:#32363a;caret-color:#32363a;background-color:#fafafa;border:1px solid #898989;border-radius:4px;outline:none}._15ziu::-moz-placeholder{color:#515559;opacity:1}._15ziu::placeholder{color:#515559;opacity:1}._15ziu:hover{cursor:pointer;background-color:#f5f5f5}._15ziu:focus{box-shadow:0 0 0 2px #fff,0 0 0 4px #0a3f88;background-color:#fafafa;cursor:text;outline:none;border-color:transparent}._15ziu._-Ow1J{border-color:#b00}._15ziu._-Ow1J:focus{box-shadow:0 0 0 2px #fff,0 0 0 4px #900000;border-color:transparent}._15ziu:disabled{background-color:#fafafa;border-color:#e5e5e5;color:#9d9fa1;-webkit-text-fill-color:#9d9fa1;cursor:not-allowed}._15ziu:disabled::-moz-placeholder{color:#aaabad;-webkit-text-fill-color:#aaabad}._15ziu:disabled::placeholder{color:#aaabad;-webkit-text-fill-color:#aaabad}._15ziu._93BjW{height:auto}._15ziu._93BjW::-webkit-resizer{background-image:url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iOCIgaGVpZ2h0PSI4IiBmaWxsPSJub25lIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjxwYXRoIGQ9Ik03IDF2M2EzIDMgMCAwMS0zIDNIMSIgc3Ryb2tlPSIjOTI5MjkyIiBzdHJva2Utd2lkdGg9IjIiIHN0cm9rZS1saW5lY2FwPSJyb3VuZCIgc3Ryb2tlLWxpbmVqb2luPSJyb3VuZCIvPjwvc3ZnPg==);background-size:8px 8px;background-repeat:no-repeat;background-position:50%}._15ziu._BO7z8{display:block;width:100%}._15ziu._eZQ9V{padding:4px 8px}input._15ziu._eZQ9V{height:26px;min-height:26px}[type=number]._15ziu{-moz-appearance:textfield}[type=number]._15ziu::-webkit-inner-spin-button,[type=number]._15ziu::-webkit-outer-spin-button{-webkit-appearance:none;margin:0}._qijvA{line-height:20px;color:#6a6d70;display:flex;flex-direction:column;align-items:flex-start}._qijvA:hover{cursor:pointer}._qijvA._uTV6P{color:#0b6ed0}._8jFuc{margin-top:4px}";
|
|
4
|
+
var styles = {"input":"_15ziu","invalid":"_-Ow1J","multiline":"_93BjW","full":"_BO7z8","small":"_eZQ9V","label":"_qijvA","focused":"_uTV6P","wrappedInput":"_8jFuc"};
|
|
5
|
+
var stylesheet="._15ziu{display:inline-block;height:36px;min-height:36px;padding:8px 12px;line-height:20px;font-size:14px;color:#32363a;caret-color:#32363a;background-color:#fafafa;border:1px solid #898989;border-radius:4px;outline:none}._15ziu::-moz-placeholder{color:#515559;opacity:1}._15ziu::placeholder{color:#515559;opacity:1}._15ziu:hover{cursor:pointer;background-color:#f5f5f5}._15ziu:focus{box-shadow:0 0 0 2px #fff,0 0 0 4px #0a3f88;background-color:#fafafa;cursor:text;outline:none;border-color:transparent}._15ziu._-Ow1J{border-color:#b00}._15ziu._-Ow1J:focus{box-shadow:0 0 0 2px #fff,0 0 0 4px #900000;border-color:transparent}._15ziu:disabled{background-color:#fafafa;border-color:#e5e5e5;color:#9d9fa1;-webkit-text-fill-color:#9d9fa1;cursor:not-allowed}._15ziu:disabled::-moz-placeholder{color:#aaabad;-webkit-text-fill-color:#aaabad}._15ziu:disabled::placeholder{color:#aaabad;-webkit-text-fill-color:#aaabad}._15ziu._93BjW{height:auto}._15ziu._93BjW::-webkit-resizer{background-image:url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iOCIgaGVpZ2h0PSI4IiBmaWxsPSJub25lIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjxwYXRoIGQ9Ik03IDF2M2EzIDMgMCAwMS0zIDNIMSIgc3Ryb2tlPSIjOTI5MjkyIiBzdHJva2Utd2lkdGg9IjIiIHN0cm9rZS1saW5lY2FwPSJyb3VuZCIgc3Ryb2tlLWxpbmVqb2luPSJyb3VuZCIvPjwvc3ZnPg==);background-size:8px 8px;background-repeat:no-repeat;background-position:50%}._15ziu._BO7z8{display:block;width:100%}._15ziu._eZQ9V{padding:4px 8px}input._15ziu._eZQ9V{height:26px;min-height:26px}[type=number]._15ziu{-moz-appearance:textfield}[type=number]._15ziu::-webkit-inner-spin-button,[type=number]._15ziu::-webkit-outer-spin-button{-webkit-appearance:none;margin:0}._qijvA{line-height:20px;color:#6a6d70;display:flex;flex-direction:column;align-items:flex-start}._qijvA:hover{cursor:pointer}._qijvA._uTV6P{color:#0b6ed0}._8jFuc{margin-top:4px}";
|
|
6
6
|
if(typeof process !== 'object' || !process.hasOwnProperty('env') || process.env.NODE_ENV !== 'test'){styleInject(css_248z);}
|
|
7
7
|
|
|
8
8
|
export { styles as default, stylesheet };
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import styleInject from './../../__node_modules/style-inject/dist/style-inject.es.js';
|
|
2
2
|
|
|
3
|
-
var css_248z = ".
|
|
4
|
-
var styles = {"addon":"
|
|
5
|
-
var stylesheet=".
|
|
3
|
+
var css_248z = "._txHMa{border:1px solid #898989;border-radius:4px;height:36px;min-height:36px;color:#6a6d70;fill:#6a6d70;background-color:#fafafa;font-size:14px;display:inline-flex;justify-content:center;align-items:center;line-height:1;padding:0 13px}._txHMa._TSejv{height:26px;min-height:26px;padding:5px 8px}._UiP7s{display:flex;align-items:stretch}._UiP7s._wLB4u{width:100%}._UiP7s ._iDD5d{margin:0;position:relative;flex-shrink:0;z-index:10}._UiP7s ._iDD5d:first-child{margin:0 -1px 0 0;border-top-left-radius:4px;border-bottom-left-radius:4px;border-top-right-radius:0;border-bottom-right-radius:0}._UiP7s ._iDD5d:not(:last-child):not(:first-child){margin:0 -1px 0 0;border-radius:0}._UiP7s ._iDD5d:last-child{border-top-left-radius:0;border-bottom-left-radius:0}._UiP7s ._iDD5d:last-child,._UiP7s ._iDD5d:only-child{margin:0;border-top-right-radius:4px;border-bottom-right-radius:4px}._UiP7s ._iDD5d:only-child{border-top-left-radius:4px;border-bottom-left-radius:4px}._UiP7s ._iDD5d._kUrVQ{flex-shrink:1;min-width:40px;z-index:0}._UiP7s ._iDD5d._kUrVQ._wLB4u{flex-grow:1}._UiP7s ._iDD5d:focus{z-index:20}";
|
|
4
|
+
var styles = {"addon":"_txHMa","small":"_TSejv","inputGroup":"_UiP7s","full":"_wLB4u","inputGroupElement":"_iDD5d","input":"_kUrVQ"};
|
|
5
|
+
var stylesheet="._txHMa{border:1px solid #898989;border-radius:4px;height:36px;min-height:36px;color:#6a6d70;fill:#6a6d70;background-color:#fafafa;font-size:14px;display:inline-flex;justify-content:center;align-items:center;line-height:1;padding:0 13px}._txHMa._TSejv{height:26px;min-height:26px;padding:5px 8px}._UiP7s{display:flex;align-items:stretch}._UiP7s._wLB4u{width:100%}._UiP7s ._iDD5d{margin:0;position:relative;flex-shrink:0;z-index:10}._UiP7s ._iDD5d:first-child{margin:0 -1px 0 0;border-top-left-radius:4px;border-bottom-left-radius:4px;border-top-right-radius:0;border-bottom-right-radius:0}._UiP7s ._iDD5d:not(:last-child):not(:first-child){margin:0 -1px 0 0;border-radius:0}._UiP7s ._iDD5d:last-child{border-top-left-radius:0;border-bottom-left-radius:0}._UiP7s ._iDD5d:last-child,._UiP7s ._iDD5d:only-child{margin:0;border-top-right-radius:4px;border-bottom-right-radius:4px}._UiP7s ._iDD5d:only-child{border-top-left-radius:4px;border-bottom-left-radius:4px}._UiP7s ._iDD5d._kUrVQ{flex-shrink:1;min-width:40px;z-index:0}._UiP7s ._iDD5d._kUrVQ._wLB4u{flex-grow:1}._UiP7s ._iDD5d:focus{z-index:20}";
|
|
6
6
|
if(typeof process !== 'object' || !process.hasOwnProperty('env') || process.env.NODE_ENV !== 'test'){styleInject(css_248z);}
|
|
7
7
|
|
|
8
8
|
export { styles as default, stylesheet };
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import styleInject from './../../__node_modules/style-inject/dist/style-inject.es.js';
|
|
2
2
|
|
|
3
|
-
var css_248z = ".
|
|
4
|
-
var styles = {"label":"
|
|
5
|
-
var stylesheet=".
|
|
3
|
+
var css_248z = "._kwZoc{font-size:14px}._ePrV0{color:#6a6d70;line-height:20px;display:inline-flex;flex-direction:column;align-items:flex-start}._2NAta{color:#0b6ed0}";
|
|
4
|
+
var styles = {"label":"_kwZoc","control":"_ePrV0","focused":"_2NAta"};
|
|
5
|
+
var stylesheet="._kwZoc{font-size:14px}._ePrV0{color:#6a6d70;line-height:20px;display:inline-flex;flex-direction:column;align-items:flex-start}._2NAta{color:#0b6ed0}";
|
|
6
6
|
if(typeof process !== 'object' || !process.hasOwnProperty('env') || process.env.NODE_ENV !== 'test'){styleInject(css_248z);}
|
|
7
7
|
|
|
8
8
|
export { styles as default, stylesheet };
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import styleInject from './../../__node_modules/style-inject/dist/style-inject.es.js';
|
|
2
2
|
|
|
3
|
-
var css_248z = ".
|
|
4
|
-
var styles = {"link":"
|
|
5
|
-
var stylesheet=".
|
|
3
|
+
var css_248z = "._DXsA1{color:#0b6ed0;cursor:pointer;text-decoration:underline;text-decoration-thickness:1px;-webkit-text-decoration-skip:ink;text-decoration-skip-ink:auto;text-underline-offset:3px;border-radius:1px}._DXsA1:active:focus,._DXsA1:focus{outline:none}._DXsA1:visited{color:#0854a1}._DXsA1:hover{color:#085caf}._DXsA1:active{color:#0854a1}._DXsA1.focus-visible,._DXsA1:focus-visible{box-shadow:0 0 0 2px #fff,0 0 0 4px #0a3f88}";
|
|
4
|
+
var styles = {"link":"_DXsA1"};
|
|
5
|
+
var stylesheet="._DXsA1{color:#0b6ed0;cursor:pointer;text-decoration:underline;text-decoration-thickness:1px;-webkit-text-decoration-skip:ink;text-decoration-skip-ink:auto;text-underline-offset:3px;border-radius:1px}._DXsA1:active:focus,._DXsA1:focus{outline:none}._DXsA1:visited{color:#0854a1}._DXsA1:hover{color:#085caf}._DXsA1:active{color:#0854a1}._DXsA1.focus-visible,._DXsA1:focus-visible{box-shadow:0 0 0 2px #fff,0 0 0 4px #0a3f88}";
|
|
6
6
|
if(typeof process !== 'object' || !process.hasOwnProperty('env') || process.env.NODE_ENV !== 'test'){styleInject(css_248z);}
|
|
7
7
|
|
|
8
8
|
export { styles as default, stylesheet };
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import styleInject from './../../__node_modules/style-inject/dist/style-inject.es.js';
|
|
2
2
|
|
|
3
|
-
var css_248z = ".
|
|
4
|
-
var styles = {"spinnerContainer":"
|
|
5
|
-
var stylesheet=".
|
|
3
|
+
var css_248z = "._gNwVH{position:relative;display:inline-block}._gNwVH._WhE9c{min-height:20px;min-width:20px}._gNwVH._QF74b{min-height:25px;min-width:25px}._gNwVH._-hiLC{min-height:40px;min-width:40px}._gNwVH._Jf-QY{min-height:64px;min-width:64px}._gNwVH ._HYLqQ{display:inline-block;background-color:transparent;position:absolute;z-index:10;width:0;height:0;left:50%;bottom:50%;pointer-events:none}._gNwVH ._HYLqQ._WAngi{visibility:hidden}._gNwVH ._HYLqQ div{position:absolute;transform:rotate(20deg)}._gNwVH ._HYLqQ div div:nth-child(-n+9){background-color:#fff;transform-origin:0 0;animation:_HYLqQ .9s linear infinite}._gNwVH ._HYLqQ div div:nth-child(-n+9):after{content:\" \";display:block;position:absolute;top:5px;left:-1px;width:2px;height:10px;border-radius:20%;background:#000}._gNwVH ._HYLqQ div div:first-child{transform:rotate(20deg);animation-delay:-.8s}._gNwVH ._HYLqQ div div:nth-child(2){transform:rotate(60deg);animation-delay:-.7s}._gNwVH ._HYLqQ div div:nth-child(3){transform:rotate(100deg);animation-delay:-.6s}._gNwVH ._HYLqQ div div:nth-child(4){transform:rotate(140deg);animation-delay:-.5s}._gNwVH ._HYLqQ div div:nth-child(5){transform:rotate(180deg);animation-delay:-.4s}._gNwVH ._HYLqQ div div:nth-child(6){transform:rotate(220deg);animation-delay:-.3s}._gNwVH ._HYLqQ div div:nth-child(7){transform:rotate(260deg);animation-delay:-.2s}._gNwVH ._HYLqQ div div:nth-child(8){transform:rotate(300deg);animation-delay:-.1s}._gNwVH ._HYLqQ div div:nth-child(9){transform:rotate(340deg);animation-delay:0s}._gNwVH ._Jf-QY div div:nth-child(-n+9):after{top:10px;left:-2px;width:4px;height:18px}._gNwVH ._WhE9c div div:nth-child(-n+9):after{top:2px;left:-1px;width:1.5px;height:6px}._gNwVH ._QF74b div div:nth-child(-n+9):after{top:4px;left:-1px;width:2px;height:7px}._gNwVH ._vkRO6 div div:nth-child(-n+9):after{background:#fff}._gNwVH ._n-J4s{width:100%;height:100%}._gNwVH ._n-J4s._7dUL1{pointer-events:none}._gNwVH ._n-J4s._WAngi{opacity:0}._gNwVH ._n-J4s._QGTe2{opacity:.5}@keyframes _HYLqQ{0%{opacity:1}to{opacity:0}}";
|
|
4
|
+
var styles = {"spinnerContainer":"_gNwVH","xs":"_WhE9c","small":"_QF74b","medium":"_-hiLC","large":"_Jf-QY","spinnerComponent":"_HYLqQ","hide":"_WAngi","inverted":"_vkRO6","spinnerContent":"_n-J4s","disablePointerEvents":"_7dUL1","fade":"_QGTe2"};
|
|
5
|
+
var stylesheet="._gNwVH{position:relative;display:inline-block}._gNwVH._WhE9c{min-height:20px;min-width:20px}._gNwVH._QF74b{min-height:25px;min-width:25px}._gNwVH._-hiLC{min-height:40px;min-width:40px}._gNwVH._Jf-QY{min-height:64px;min-width:64px}._gNwVH ._HYLqQ{display:inline-block;background-color:transparent;position:absolute;z-index:10;width:0;height:0;left:50%;bottom:50%;pointer-events:none}._gNwVH ._HYLqQ._WAngi{visibility:hidden}._gNwVH ._HYLqQ div{position:absolute;transform:rotate(20deg)}._gNwVH ._HYLqQ div div:nth-child(-n+9){background-color:#fff;transform-origin:0 0;animation:_HYLqQ .9s linear infinite}._gNwVH ._HYLqQ div div:nth-child(-n+9):after{content:\" \";display:block;position:absolute;top:5px;left:-1px;width:2px;height:10px;border-radius:20%;background:#000}._gNwVH ._HYLqQ div div:first-child{transform:rotate(20deg);animation-delay:-.8s}._gNwVH ._HYLqQ div div:nth-child(2){transform:rotate(60deg);animation-delay:-.7s}._gNwVH ._HYLqQ div div:nth-child(3){transform:rotate(100deg);animation-delay:-.6s}._gNwVH ._HYLqQ div div:nth-child(4){transform:rotate(140deg);animation-delay:-.5s}._gNwVH ._HYLqQ div div:nth-child(5){transform:rotate(180deg);animation-delay:-.4s}._gNwVH ._HYLqQ div div:nth-child(6){transform:rotate(220deg);animation-delay:-.3s}._gNwVH ._HYLqQ div div:nth-child(7){transform:rotate(260deg);animation-delay:-.2s}._gNwVH ._HYLqQ div div:nth-child(8){transform:rotate(300deg);animation-delay:-.1s}._gNwVH ._HYLqQ div div:nth-child(9){transform:rotate(340deg);animation-delay:0s}._gNwVH ._Jf-QY div div:nth-child(-n+9):after{top:10px;left:-2px;width:4px;height:18px}._gNwVH ._WhE9c div div:nth-child(-n+9):after{top:2px;left:-1px;width:1.5px;height:6px}._gNwVH ._QF74b div div:nth-child(-n+9):after{top:4px;left:-1px;width:2px;height:7px}._gNwVH ._vkRO6 div div:nth-child(-n+9):after{background:#fff}._gNwVH ._n-J4s{width:100%;height:100%}._gNwVH ._n-J4s._7dUL1{pointer-events:none}._gNwVH ._n-J4s._WAngi{opacity:0}._gNwVH ._n-J4s._QGTe2{opacity:.5}@keyframes _HYLqQ{0%{opacity:1}to{opacity:0}}";
|
|
6
6
|
if(typeof process !== 'object' || !process.hasOwnProperty('env') || process.env.NODE_ENV !== 'test'){styleInject(css_248z);}
|
|
7
7
|
|
|
8
8
|
export { styles as default, stylesheet };
|
|
@@ -89,14 +89,13 @@ const ConditionSet = function ConditionSet(_ref) {
|
|
|
89
89
|
}
|
|
90
90
|
return getSubDataTestId(rootDataTestId, "".concat(prefix, "-").concat(indices.join('-')));
|
|
91
91
|
}, [fixedSet, rootDataTestId]);
|
|
92
|
-
function renderControls(itemType, itemPosition, itemLevel,
|
|
92
|
+
function renderControls(itemType, itemPosition, itemLevel, itemId) {
|
|
93
93
|
return /*#__PURE__*/React__default.createElement(Controls, {
|
|
94
94
|
handleNewLogicItem: handleNewLogicItem,
|
|
95
95
|
itemType: itemType,
|
|
96
96
|
parent: itemPosition.parent,
|
|
97
97
|
itemIndex: itemPosition.index,
|
|
98
98
|
itemLevel: itemLevel,
|
|
99
|
-
numberOfSetItems: numberOfSetItems,
|
|
100
99
|
itemId: itemId,
|
|
101
100
|
"data-testid": getDataTestId('condition-actions', itemPosition)
|
|
102
101
|
});
|
|
@@ -130,7 +129,7 @@ const ConditionSet = function ConditionSet(_ref) {
|
|
|
130
129
|
position: conditionPosition,
|
|
131
130
|
condition: item,
|
|
132
131
|
firstFocusableElementRef: fixedSet && firstFocusableElementRef && i === 0 ? firstFocusableElementRef : undefined,
|
|
133
|
-
conditionControls: !readOnly ? renderControls(LOGIC_TYPE_CONDITION, conditionPosition, level + 1,
|
|
132
|
+
conditionControls: !readOnly ? renderControls(LOGIC_TYPE_CONDITION, conditionPosition, level + 1, item.id) : undefined
|
|
134
133
|
}));
|
|
135
134
|
}
|
|
136
135
|
if (item.logicType === LOGIC_TYPE_SET) {
|
|
@@ -172,7 +171,7 @@ const ConditionSet = function ConditionSet(_ref) {
|
|
|
172
171
|
}), /*#__PURE__*/React__default.createElement(DropdownOption, {
|
|
173
172
|
value: SET_VALUE_ALL,
|
|
174
173
|
label: String(translations.all)
|
|
175
|
-
}))), !readOnly && renderControls(LOGIC_TYPE_SET, position, level, value.
|
|
174
|
+
}))), !readOnly && renderControls(LOGIC_TYPE_SET, position, level, value.id)), /*#__PURE__*/React__default.createElement("div", {
|
|
176
175
|
role: "group",
|
|
177
176
|
ref: conditionRef
|
|
178
177
|
}, renderSetChildren()));
|
|
@@ -22,7 +22,6 @@ const Controls = function Controls(_ref) {
|
|
|
22
22
|
itemIndex,
|
|
23
23
|
itemLevel,
|
|
24
24
|
itemId,
|
|
25
|
-
numberOfSetItems,
|
|
26
25
|
'data-testid': dataTestId
|
|
27
26
|
} = _ref;
|
|
28
27
|
const {
|
|
@@ -32,63 +31,82 @@ const Controls = function Controls(_ref) {
|
|
|
32
31
|
defaultSetValue,
|
|
33
32
|
maxNestedSets,
|
|
34
33
|
maxConditions,
|
|
35
|
-
controlsRef
|
|
34
|
+
controlsRef,
|
|
35
|
+
numberOfItems,
|
|
36
|
+
setNumberOfItems
|
|
36
37
|
} = useLogicEditorContext();
|
|
38
|
+
const canAddNewCondition = useMemo(() => !maxConditions || numberOfItems < maxConditions, [maxConditions, numberOfItems]);
|
|
37
39
|
const canAddNewSet = useMemo(() => {
|
|
40
|
+
// Need to have space for two conditions to add a new set, since
|
|
41
|
+
// adding a set automatically adds a condition below.
|
|
42
|
+
if (maxConditions && numberOfItems >= maxConditions - 1) {
|
|
43
|
+
return false;
|
|
44
|
+
}
|
|
38
45
|
// If "insert condition set below" is clicked on a logic item's control, it's added at the same level.
|
|
39
46
|
// If "insert condition set below" is clicked on a logic set's control, it's added a level deeper.
|
|
40
47
|
const levelOfNewSet = itemType === LOGIC_TYPE_CONDITION ? itemLevel : itemLevel + 1;
|
|
41
48
|
return !fixedSet && levelOfNewSet <= maxNestedSets;
|
|
42
|
-
}, [fixedSet, itemLevel, maxNestedSets, itemType]);
|
|
49
|
+
}, [fixedSet, itemLevel, maxNestedSets, itemType, maxConditions, numberOfItems]);
|
|
43
50
|
const indexOfNewItem = useMemo(() => itemType === LOGIC_TYPE_SET ? 0 : itemIndex + 1, [itemType, itemIndex]);
|
|
44
|
-
const menu = useMemo(() =>
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
51
|
+
const menu = useMemo(() => {
|
|
52
|
+
const isRootMenu = itemLevel === 0 && !fixedSet;
|
|
53
|
+
const menuHasNoOptions = isRootMenu && !canAddNewCondition;
|
|
54
|
+
return /*#__PURE__*/React__default.createElement(Menu, {
|
|
55
|
+
anchor: /*#__PURE__*/React__default.createElement(IconButton, {
|
|
56
|
+
"aria-label": translations.conditionActions,
|
|
57
|
+
className: styles.controls,
|
|
58
|
+
"data-testid": dataTestId,
|
|
59
|
+
style: {
|
|
60
|
+
visibility: menuHasNoOptions ? 'hidden' : undefined
|
|
61
|
+
}
|
|
62
|
+
}, /*#__PURE__*/React__default.createElement(EllipsisHorizontalIcon, null)),
|
|
63
|
+
ref: node => {
|
|
64
|
+
if (node) {
|
|
65
|
+
controlsRef.current.set(itemId, node);
|
|
66
|
+
setNumberOfItems(controlsRef.current.size);
|
|
67
|
+
} else {
|
|
68
|
+
controlsRef.current.delete(itemId);
|
|
69
|
+
setNumberOfItems(controlsRef.current.size);
|
|
70
|
+
}
|
|
55
71
|
}
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
"
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
"
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
"
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
},
|
|
72
|
+
}, canAddNewCondition && /*#__PURE__*/React__default.createElement(MenuItem, {
|
|
73
|
+
value: "add-condition",
|
|
74
|
+
onSelect: () => handleNewLogicItem(newCondition(), indexOfNewItem)
|
|
75
|
+
}, /*#__PURE__*/React__default.createElement(AddItemIcon, {
|
|
76
|
+
"aria-hidden": "true"
|
|
77
|
+
}), /*#__PURE__*/React__default.createElement("span", {
|
|
78
|
+
className: styles.controlMenuItem
|
|
79
|
+
}, translations.insertConditionBelow)), canAddNewSet && /*#__PURE__*/React__default.createElement(MenuItem, {
|
|
80
|
+
value: "add-set",
|
|
81
|
+
onSelect: () => handleNewLogicItem(newConditionSet(defaultSetValue), indexOfNewItem)
|
|
82
|
+
}, /*#__PURE__*/React__default.createElement(FilterIcon, {
|
|
83
|
+
"aria-hidden": "true"
|
|
84
|
+
}), /*#__PURE__*/React__default.createElement("span", {
|
|
85
|
+
className: styles.controlMenuItem
|
|
86
|
+
}, translations.insertSetBelow)), (fixedSet && numberOfItems > 1 || !fixedSet && itemLevel > 0) && /*#__PURE__*/React__default.createElement(MenuItem, {
|
|
87
|
+
value: "delete",
|
|
88
|
+
onSelect: e => {
|
|
89
|
+
onDelete({
|
|
90
|
+
parent,
|
|
91
|
+
index: itemIndex
|
|
92
|
+
});
|
|
93
|
+
// We want to move focus to the previous control
|
|
94
|
+
// item when this one is deleted, so we need to
|
|
95
|
+
// prevent Menu's default focus behavior
|
|
96
|
+
e.preventDefault();
|
|
97
|
+
}
|
|
98
|
+
}, /*#__PURE__*/React__default.createElement(RemoveItemIcon, {
|
|
99
|
+
"aria-hidden": "true"
|
|
100
|
+
}), /*#__PURE__*/React__default.createElement("span", {
|
|
101
|
+
className: styles.controlMenuItem
|
|
102
|
+
}, translations.delete)));
|
|
103
|
+
}, [
|
|
88
104
|
// context
|
|
89
|
-
translations, fixedSet, onDelete, defaultSetValue,
|
|
105
|
+
translations, fixedSet, onDelete, defaultSetValue, controlsRef, numberOfItems, setNumberOfItems,
|
|
90
106
|
// props
|
|
91
|
-
handleNewLogicItem, parent, itemIndex, itemLevel, itemId,
|
|
107
|
+
handleNewLogicItem, parent, itemIndex, itemLevel, itemId, dataTestId,
|
|
108
|
+
// variables in scope
|
|
109
|
+
canAddNewSet, canAddNewCondition, indexOfNewItem]);
|
|
92
110
|
return /*#__PURE__*/React__default.createElement("div", {
|
|
93
111
|
className: classNames({
|
|
94
112
|
[styles.conditionControlsContainer]: itemType === LOGIC_TYPE_CONDITION
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import _extends from '@babel/runtime-corejs3/helpers/extends';
|
|
2
|
-
import React__default, { useMemo, useState, useCallback, useRef } from 'react';
|
|
2
|
+
import React__default, { useMemo, useState, useCallback, useRef, useEffect } from 'react';
|
|
3
3
|
import classNames from 'classnames';
|
|
4
4
|
import styles from './LogicEditor2.js';
|
|
5
5
|
import ConditionSet from './ConditionSet.js';
|
|
@@ -48,14 +48,33 @@ const LogicEditor = /*#__PURE__*/React__default.forwardRef((_ref, ref) => {
|
|
|
48
48
|
return newState;
|
|
49
49
|
});
|
|
50
50
|
}, [onChange]);
|
|
51
|
+
const controlsRef = useRef(new Map());
|
|
52
|
+
const [numberOfItems, setNumberOfItems] = useState(controlsRef.current.size);
|
|
53
|
+
const itemToFocusId = useRef(null);
|
|
54
|
+
useEffect(() => {
|
|
55
|
+
// Must be in a useEffect instead of event handlers to ensure `focus` is called
|
|
56
|
+
// _after_ the root condition control menu is possibly added back into view
|
|
57
|
+
if (itemToFocusId.current !== null) {
|
|
58
|
+
var _controlsRef$current$;
|
|
59
|
+
(_controlsRef$current$ = controlsRef.current.get(itemToFocusId.current)) === null || _controlsRef$current$ === void 0 || _controlsRef$current$.focus();
|
|
60
|
+
itemToFocusId.current = null;
|
|
61
|
+
}
|
|
62
|
+
}, [numberOfItems]);
|
|
51
63
|
const handleNewLogicItem = useCallback((item, position) => {
|
|
64
|
+
var _position$parent;
|
|
65
|
+
const numberOfItemsBeingAdded = item.logicType === 'set' ? 2 : 1;
|
|
66
|
+
const willReachMaxCondiitons = numberOfItems + numberOfItemsBeingAdded === maxConditions;
|
|
67
|
+
const focusIsOnRootNode = position.index === 0 && ((_position$parent = position.parent) === null || _position$parent === void 0 ? void 0 : _position$parent.parent) === undefined;
|
|
68
|
+
if (focusIsOnRootNode && willReachMaxCondiitons) {
|
|
69
|
+
itemToFocusId.current = item.id;
|
|
70
|
+
}
|
|
52
71
|
update(prevState => {
|
|
53
72
|
const newState = shallowCopy(prevState);
|
|
54
73
|
const parent = getParentSet(newState, position);
|
|
55
74
|
parent.conditions.splice(position.index, 0, item);
|
|
56
75
|
return newState;
|
|
57
76
|
});
|
|
58
|
-
}, [update]);
|
|
77
|
+
}, [update, numberOfItems, maxConditions]);
|
|
59
78
|
const handleSetChange = (newSetValue, position) => {
|
|
60
79
|
update(prevState => {
|
|
61
80
|
const rootState = shallowCopy(prevState);
|
|
@@ -77,23 +96,28 @@ const LogicEditor = /*#__PURE__*/React__default.forwardRef((_ref, ref) => {
|
|
|
77
96
|
return newState;
|
|
78
97
|
});
|
|
79
98
|
};
|
|
80
|
-
const controlsRef = useRef({});
|
|
81
99
|
const handleDelete = useCallback(position => {
|
|
100
|
+
let previousItemId;
|
|
82
101
|
update(prevState => {
|
|
83
|
-
|
|
102
|
+
previousItemId = getPreviousItemId(prevState, position, fixedSet);
|
|
84
103
|
const newState = shallowCopy(prevState);
|
|
85
104
|
const parent = getParentSet(newState, position);
|
|
86
105
|
parent.conditions.splice(position.index, 1);
|
|
87
106
|
|
|
88
107
|
// If the last condition in a set was deleted, also delete the set.
|
|
89
108
|
if (parent.conditions.length === 0) {
|
|
90
|
-
previousItemId = getPreviousItemId(newState, position.parent);
|
|
109
|
+
previousItemId = getPreviousItemId(newState, position.parent, fixedSet);
|
|
91
110
|
getParentSet(newState, position.parent).conditions.splice(position.parent.index, 1);
|
|
92
111
|
}
|
|
93
|
-
|
|
112
|
+
if (previousItemId === null) {
|
|
113
|
+
// May be null if first item in fixedSet editor is deleted.
|
|
114
|
+
// In this case focus the new first item in the editor.
|
|
115
|
+
previousItemId = newState.conditions[0].id;
|
|
116
|
+
}
|
|
94
117
|
return newState;
|
|
95
118
|
});
|
|
96
|
-
|
|
119
|
+
itemToFocusId.current = previousItemId;
|
|
120
|
+
}, [update, fixedSet]);
|
|
97
121
|
return /*#__PURE__*/React__default.createElement("div", _extends({}, rest, {
|
|
98
122
|
role: "group",
|
|
99
123
|
className: classes,
|
|
@@ -113,7 +137,9 @@ const LogicEditor = /*#__PURE__*/React__default.forwardRef((_ref, ref) => {
|
|
|
113
137
|
maxConditions,
|
|
114
138
|
readOnly,
|
|
115
139
|
rootDataTestId: dataTestId,
|
|
116
|
-
controlsRef
|
|
140
|
+
controlsRef,
|
|
141
|
+
numberOfItems,
|
|
142
|
+
setNumberOfItems
|
|
117
143
|
}
|
|
118
144
|
}, /*#__PURE__*/React__default.createElement(ConditionSet, {
|
|
119
145
|
value: state,
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import styleInject from './../../__node_modules/style-inject/dist/style-inject.es.js';
|
|
2
2
|
|
|
3
|
-
var css_248z = ".
|
|
4
|
-
var styles = {"set":"
|
|
5
|
-
var stylesheet=".
|
|
3
|
+
var css_248z = "._GiFHr{width:100%}._Z8l6G{display:flex;align-items:center}._q9zRP{display:flex;flex-wrap:wrap;grid-gap:4px}._q9zRP._W2-Wo :nth-last-child(2){margin-right:42px}._MO99L{position:relative;padding-left:32px;padding-top:16px}._XWoNh ._MO99L{padding-top:0;padding-left:16px}._XWoNh ._MO99L+._MO99L{margin-top:16px}._-Qs-r{position:absolute;left:16px;top:0;height:34px;width:16px;border-left:1px solid #c2c2c2;border-bottom:1px solid #c2c2c2;border-bottom-left-radius:4px}._XWoNh ._MO99L:first-of-type ._-Qs-r{top:16px;border-bottom:none;border-bottom-left-radius:0;border-top:1px solid #c2c2c2;border-top-left-radius:4px}._XWoNh ._-Qs-r{top:-16px;left:0}._XWoNh ._MO99L:not(:first-of-type):not(:last-of-type) ._-Qs-r{border-bottom-left-radius:0}._99O3B{margin-left:-46px}._l5Uio{margin:0 2px 0 4px}._l5Uio.focus-visible,._l5Uio:focus-visible{outline-width:2px}._FCkGC{margin-left:4px}";
|
|
4
|
+
var styles = {"set":"_GiFHr","setWrapper":"_Z8l6G","condition":"_q9zRP","readOnly":"_W2-Wo","branch":"_MO99L","fixedSet":"_XWoNh","connection":"_-Qs-r","conditionControlsContainer":"_99O3B","controls":"_l5Uio","controlMenuItem":"_FCkGC"};
|
|
5
|
+
var stylesheet="._GiFHr{width:100%}._Z8l6G{display:flex;align-items:center}._q9zRP{display:flex;flex-wrap:wrap;grid-gap:4px}._q9zRP._W2-Wo :nth-last-child(2){margin-right:42px}._MO99L{position:relative;padding-left:32px;padding-top:16px}._XWoNh ._MO99L{padding-top:0;padding-left:16px}._XWoNh ._MO99L+._MO99L{margin-top:16px}._-Qs-r{position:absolute;left:16px;top:0;height:34px;width:16px;border-left:1px solid #c2c2c2;border-bottom:1px solid #c2c2c2;border-bottom-left-radius:4px}._XWoNh ._MO99L:first-of-type ._-Qs-r{top:16px;border-bottom:none;border-bottom-left-radius:0;border-top:1px solid #c2c2c2;border-top-left-radius:4px}._XWoNh ._-Qs-r{top:-16px;left:0}._XWoNh ._MO99L:not(:first-of-type):not(:last-of-type) ._-Qs-r{border-bottom-left-radius:0}._99O3B{margin-left:-46px}._l5Uio{margin:0 2px 0 4px}._l5Uio.focus-visible,._l5Uio:focus-visible{outline-width:2px}._FCkGC{margin-left:4px}";
|
|
6
6
|
if(typeof process !== 'object' || !process.hasOwnProperty('env') || process.env.NODE_ENV !== 'test'){styleInject(css_248z);}
|
|
7
7
|
|
|
8
8
|
export { styles as default, stylesheet };
|
|
@@ -111,9 +111,12 @@ function walkToRoot(position) {
|
|
|
111
111
|
}
|
|
112
112
|
return root;
|
|
113
113
|
}
|
|
114
|
-
function getPreviousItemId(conditionRoot, position) {
|
|
114
|
+
function getPreviousItemId(conditionRoot, position, fixedSet) {
|
|
115
115
|
const parentSet = getParentSet(conditionRoot, position);
|
|
116
116
|
if (position.index === 0) {
|
|
117
|
+
if (fixedSet) {
|
|
118
|
+
return null;
|
|
119
|
+
}
|
|
117
120
|
// The previous item is the parent
|
|
118
121
|
return parentSet.id;
|
|
119
122
|
}
|