@salutejs/plasma-new-hope 0.174.0-canary.1504.11479867300.0 → 0.174.0-canary.1505.11485998091.0
Sign up to get free protection for your applications and to get access to all the features.
- package/cjs/components/Combobox/ComboboxNew/Combobox.js +9 -2
- package/cjs/components/Combobox/ComboboxNew/Combobox.js.map +1 -1
- package/cjs/components/Combobox/ComboboxNew/utils/getInitialValue.js +27 -0
- package/cjs/components/Combobox/ComboboxNew/utils/getInitialValue.js.map +1 -0
- package/cjs/components/Pagination/Pagination.css +13 -13
- package/cjs/components/Pagination/ui/PaginationSelectPerPage/PaginationSelectPerPage.css +13 -13
- package/cjs/components/Pagination/ui/PaginationSelectPerPage/PaginationSelectPerPage.js +2 -2
- package/cjs/components/Pagination/ui/PaginationSelectPerPage/PaginationSelectPerPage.js.map +1 -1
- package/cjs/components/Select/Select.css +13 -13
- package/cjs/components/Select/Select.js +12 -16
- package/cjs/components/Select/Select.js.map +1 -1
- package/cjs/components/Select/Select.styles.js +1 -1
- package/cjs/components/Select/Select.styles.js.map +1 -1
- package/cjs/components/Select/Select.styles_1nzals0.css +5 -0
- package/cjs/components/Select/Select.tokens.js +1 -17
- package/cjs/components/Select/Select.tokens.js.map +1 -1
- package/cjs/components/Select/hooks/useKeyboardNavigation.js +1 -1
- package/cjs/components/Select/hooks/useKeyboardNavigation.js.map +1 -1
- package/cjs/components/Select/ui/Inner/Inner.css +13 -13
- package/cjs/components/Select/ui/Inner/ui/Item/Item.css +13 -13
- package/cjs/components/Select/ui/Inner/ui/Item/Item.styles.js +11 -11
- package/cjs/components/Select/ui/Inner/ui/Item/Item.styles.js.map +1 -1
- package/cjs/components/Select/ui/Inner/ui/Item/{Item.styles_1gaxu1y.css → Item.styles_baxa65.css} +2 -2
- package/cjs/components/Select/ui/Target/ui/Textfield/Textfield.js +1 -1
- package/cjs/components/Select/ui/Target/ui/Textfield/Textfield.js.map +1 -1
- package/cjs/components/Select/ui/Target/ui/Textfield/Textfield.styles.js +1 -1
- package/cjs/components/Select/ui/Target/ui/Textfield/Textfield.styles.js.map +1 -1
- package/cjs/components/Select/utils/getButtonLabel.js +1 -1
- package/cjs/components/Select/utils/getButtonLabel.js.map +1 -1
- package/cjs/components/Select/utils/getInitialValue.js +27 -0
- package/cjs/components/Select/utils/getInitialValue.js.map +1 -0
- package/cjs/components/Select/utils/initialItemsTransform.js +8 -4
- package/cjs/components/Select/utils/initialItemsTransform.js.map +1 -1
- package/cjs/index.css +13 -13
- package/emotion/cjs/components/Combobox/ComboboxNew/Combobox.js +8 -2
- package/emotion/cjs/components/Combobox/ComboboxNew/utils/getInitialValue.js +26 -0
- package/emotion/cjs/components/Combobox/ComboboxNew/utils/index.js +8 -1
- package/emotion/cjs/components/Pagination/ui/PaginationSelectPerPage/PaginationSelectPerPage.js +2 -2
- package/emotion/cjs/components/Select/Select.js +11 -16
- package/emotion/cjs/components/Select/Select.styles.js +5 -5
- package/emotion/cjs/components/Select/Select.tokens.js +1 -17
- package/emotion/cjs/components/Select/hooks/useKeyboardNavigation.js +1 -1
- package/emotion/cjs/components/Select/ui/Inner/ui/Item/Item.styles.js +10 -10
- package/emotion/cjs/components/Select/ui/Target/ui/Textfield/Textfield.js +1 -1
- package/emotion/cjs/components/Select/ui/Target/ui/Textfield/Textfield.styles.js +13 -13
- package/emotion/cjs/components/Select/utils/getButtonLabel.js +1 -1
- package/emotion/cjs/components/Select/utils/getInitialValue.js +26 -0
- package/emotion/cjs/components/Select/utils/index.js +8 -1
- package/emotion/cjs/components/Select/utils/initialItemsTransform.js +18 -4
- package/emotion/es/components/Combobox/ComboboxNew/Combobox.js +9 -3
- package/emotion/es/components/Combobox/ComboboxNew/utils/getInitialValue.js +20 -0
- package/emotion/es/components/Combobox/ComboboxNew/utils/index.js +2 -1
- package/emotion/es/components/Pagination/ui/PaginationSelectPerPage/PaginationSelectPerPage.js +2 -2
- package/emotion/es/components/Select/Select.js +12 -17
- package/emotion/es/components/Select/Select.styles.js +5 -5
- package/emotion/es/components/Select/Select.tokens.js +1 -17
- package/emotion/es/components/Select/hooks/useKeyboardNavigation.js +1 -1
- package/emotion/es/components/Select/ui/Inner/ui/Item/Item.styles.js +10 -10
- package/emotion/es/components/Select/ui/Target/ui/Textfield/Textfield.js +1 -1
- package/emotion/es/components/Select/ui/Target/ui/Textfield/Textfield.styles.js +13 -13
- package/emotion/es/components/Select/utils/getButtonLabel.js +1 -1
- package/emotion/es/components/Select/utils/getInitialValue.js +20 -0
- package/emotion/es/components/Select/utils/index.js +2 -1
- package/emotion/es/components/Select/utils/initialItemsTransform.js +18 -4
- package/es/components/Combobox/ComboboxNew/Combobox.js +9 -2
- package/es/components/Combobox/ComboboxNew/Combobox.js.map +1 -1
- package/es/components/Combobox/ComboboxNew/utils/getInitialValue.js +23 -0
- package/es/components/Combobox/ComboboxNew/utils/getInitialValue.js.map +1 -0
- package/es/components/Pagination/Pagination.css +13 -13
- package/es/components/Pagination/ui/PaginationSelectPerPage/PaginationSelectPerPage.css +13 -13
- package/es/components/Pagination/ui/PaginationSelectPerPage/PaginationSelectPerPage.js +2 -2
- package/es/components/Pagination/ui/PaginationSelectPerPage/PaginationSelectPerPage.js.map +1 -1
- package/es/components/Select/Select.css +13 -13
- package/es/components/Select/Select.js +13 -17
- package/es/components/Select/Select.js.map +1 -1
- package/es/components/Select/Select.styles.js +1 -1
- package/es/components/Select/Select.styles.js.map +1 -1
- package/es/components/Select/Select.styles_1nzals0.css +5 -0
- package/es/components/Select/Select.tokens.js +1 -17
- package/es/components/Select/Select.tokens.js.map +1 -1
- package/es/components/Select/hooks/useKeyboardNavigation.js +1 -1
- package/es/components/Select/hooks/useKeyboardNavigation.js.map +1 -1
- package/es/components/Select/ui/Inner/Inner.css +13 -13
- package/es/components/Select/ui/Inner/ui/Item/Item.css +13 -13
- package/es/components/Select/ui/Inner/ui/Item/Item.styles.js +11 -11
- package/es/components/Select/ui/Inner/ui/Item/Item.styles.js.map +1 -1
- package/es/components/Select/ui/Inner/ui/Item/{Item.styles_1gaxu1y.css → Item.styles_baxa65.css} +2 -2
- package/es/components/Select/ui/Target/ui/Textfield/Textfield.js +1 -1
- package/es/components/Select/ui/Target/ui/Textfield/Textfield.js.map +1 -1
- package/es/components/Select/ui/Target/ui/Textfield/Textfield.styles.js +1 -1
- package/es/components/Select/ui/Target/ui/Textfield/Textfield.styles.js.map +1 -1
- package/es/components/Select/utils/getButtonLabel.js +1 -1
- package/es/components/Select/utils/getButtonLabel.js.map +1 -1
- package/es/components/Select/utils/getInitialValue.js +23 -0
- package/es/components/Select/utils/getInitialValue.js.map +1 -0
- package/es/components/Select/utils/initialItemsTransform.js +8 -4
- package/es/components/Select/utils/initialItemsTransform.js.map +1 -1
- package/es/index.css +13 -13
- package/package.json +2 -2
- package/styled-components/cjs/components/Combobox/ComboboxNew/Combobox.js +8 -2
- package/styled-components/cjs/components/Combobox/ComboboxNew/utils/getInitialValue.js +26 -0
- package/styled-components/cjs/components/Combobox/ComboboxNew/utils/index.js +8 -1
- package/styled-components/cjs/components/Pagination/ui/PaginationSelectPerPage/PaginationSelectPerPage.js +2 -2
- package/styled-components/cjs/components/Select/Select.js +11 -16
- package/styled-components/cjs/components/Select/Select.styles.js +2 -2
- package/styled-components/cjs/components/Select/Select.tokens.js +1 -17
- package/styled-components/cjs/components/Select/hooks/useKeyboardNavigation.js +1 -1
- package/styled-components/cjs/components/Select/ui/Inner/ui/Item/Item.styles.js +3 -3
- package/styled-components/cjs/components/Select/ui/Target/ui/Textfield/Textfield.js +1 -1
- package/styled-components/cjs/components/Select/ui/Target/ui/Textfield/Textfield.styles.js +1 -1
- package/styled-components/cjs/components/Select/utils/getButtonLabel.js +1 -1
- package/styled-components/cjs/components/Select/utils/getInitialValue.js +26 -0
- package/styled-components/cjs/components/Select/utils/index.js +8 -1
- package/styled-components/cjs/components/Select/utils/initialItemsTransform.js +18 -4
- package/styled-components/es/components/Combobox/ComboboxNew/Combobox.js +9 -3
- package/styled-components/es/components/Combobox/ComboboxNew/utils/getInitialValue.js +20 -0
- package/styled-components/es/components/Combobox/ComboboxNew/utils/index.js +2 -1
- package/styled-components/es/components/Pagination/ui/PaginationSelectPerPage/PaginationSelectPerPage.js +2 -2
- package/styled-components/es/components/Select/Select.js +12 -17
- package/styled-components/es/components/Select/Select.styles.js +2 -2
- package/styled-components/es/components/Select/Select.tokens.js +1 -17
- package/styled-components/es/components/Select/hooks/useKeyboardNavigation.js +1 -1
- package/styled-components/es/components/Select/ui/Inner/ui/Item/Item.styles.js +3 -3
- package/styled-components/es/components/Select/ui/Target/ui/Textfield/Textfield.js +1 -1
- package/styled-components/es/components/Select/ui/Target/ui/Textfield/Textfield.styles.js +1 -1
- package/styled-components/es/components/Select/utils/getButtonLabel.js +1 -1
- package/styled-components/es/components/Select/utils/getInitialValue.js +20 -0
- package/styled-components/es/components/Select/utils/index.js +2 -1
- package/styled-components/es/components/Select/utils/initialItemsTransform.js +18 -4
- package/types/components/Combobox/ComboboxNew/Combobox.d.ts.map +1 -1
- package/types/components/Combobox/ComboboxNew/utils/getInitialValue.d.ts +4 -0
- package/types/components/Combobox/ComboboxNew/utils/getInitialValue.d.ts.map +1 -0
- package/types/components/Combobox/ComboboxNew/utils/index.d.ts +1 -0
- package/types/components/Combobox/ComboboxNew/utils/index.d.ts.map +1 -1
- package/types/components/Pagination/ui/PaginationSelectPerPage/PaginationSelectPerPage.styles.d.ts +8 -8
- package/types/components/Select/Select.d.ts +2 -2
- package/types/components/Select/Select.d.ts.map +1 -1
- package/types/components/Select/Select.tokens.d.ts +0 -16
- package/types/components/Select/Select.tokens.d.ts.map +1 -1
- package/types/components/Select/Select.types.d.ts +2 -1
- package/types/components/Select/Select.types.d.ts.map +1 -1
- package/types/components/Select/hooks/useKeyboardNavigation.d.ts +2 -2
- package/types/components/Select/hooks/useKeyboardNavigation.d.ts.map +1 -1
- package/types/components/Select/ui/Target/Target.types.d.ts +2 -2
- package/types/components/Select/ui/Target/Target.types.d.ts.map +1 -1
- package/types/components/Select/ui/Target/ui/Textfield/Textfield.styles.d.ts +4 -4
- package/types/components/Select/ui/Target/ui/Textfield/Textfield.styles.d.ts.map +1 -1
- package/types/components/Select/utils/getInitialValue.d.ts +4 -0
- package/types/components/Select/utils/getInitialValue.d.ts.map +1 -0
- package/types/components/Select/utils/index.d.ts +1 -0
- package/types/components/Select/utils/index.d.ts.map +1 -1
- package/types/components/Select/utils/initialItemsTransform.d.ts.map +1 -1
- package/types/examples/plasma_b2c/components/Select/Select.d.ts +8 -8
- package/types/examples/plasma_web/components/Select/Select.d.ts +8 -8
- package/cjs/components/Select/Select.styles_ei4ic3.css +0 -5
- package/es/components/Select/Select.styles_ei4ic3.css +0 -5
package/es/index.css
CHANGED
@@ -605,14 +605,14 @@
|
|
605
605
|
|
606
606
|
.base_1gha00t_blzorgi__0445cc63 .base_1gha00t_swmawm7__0445cc63{height:var(--plasma-progress-track-height);border-radius:var(--plasma-progress-track-border-radius);}.base_1gha00t_blzorgi__0445cc63 .base_1gha00t_s1mmwynp__0445cc63{height:var(--plasma-progress-filled-height);border-radius:var(--plasma-progress-filled-border-radius);}.base_1gha00t_blzorgi__0445cc63 .base_1gha00t_s1oe6gw0__0445cc63{margin-left:var(--plasma-progress-value-margin-left);}
|
607
607
|
|
608
|
-
.
|
609
|
-
.
|
610
|
-
.
|
611
|
-
.
|
612
|
-
.
|
613
|
-
.
|
614
|
-
.
|
615
|
-
.
|
608
|
+
.Item_styles_baxa65_s1vls8ri__1ba2f282{--plasma-checkbox-trigger-size:var(--plasma-select-checkbox-trigger-size);--plasma-checkbox-trigger-border-radius:var(--plasma-select-checkbox-trigger-border-radius);--plasma-checkbox-fill-color:var(--plasma-select-checkbox-fill-color);--plasma-checkbox-icon-color:var(--plasma-select-checkbox-icon-color);--plasma-checkbox-trigger-border-color:var(--plasma-select-checkbox-trigger-border-color);}
|
609
|
+
.Item_styles_baxa65_s1to2lz5__1ba2f282{--plasma-indicator-size:var(--plasma-select-indicator-size);--plasma-indicator-color:var(--plasma-select-checkbox-fill-color);}
|
610
|
+
.Item_styles_baxa65_s17z4dei__1ba2f282{display:-webkit-inline-box;display:-webkit-inline-flex;display:-ms-inline-flexbox;display:inline-flex;}
|
611
|
+
.Item_styles_baxa65_s1nd9idj__1ba2f282{margin-left:auto;display:-webkit-inline-box;display:-webkit-inline-flex;display:-ms-inline-flexbox;display:inline-flex;}
|
612
|
+
.Item_styles_baxa65_dnb2nsj__1ba2f282{line-height:0;color:var(--text-secondary);}.Item_styles_baxa65_dnb2nsj__1ba2f282:hover{color:var(--text-secondary-hover);}
|
613
|
+
.Item_styles_baxa65_i581hb1__1ba2f282{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-align-items:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;-webkit-box-pack:center;-webkit-justify-content:center;-ms-flex-pack:center;justify-content:center;width:var(--i581hb1-0);height:var(--i581hb1-0);margin:var(--plasma-select-item-icon-margin);line-height:0;color:var(--plasma-select-checkbox-fill-color);}.Item_styles_baxa65_i581hb1__1ba2f282 .Item_styles_baxa65_selectItemCheckbox__1ba2f282{--plasma-checkbox-trigger-size:var(--i581hb1-1);--plasma-checkbox-trigger-border-radius:var(--i581hb1-2);}
|
614
|
+
.Item_styles_baxa65_scgpql7__1ba2f282{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;-webkit-flex:1;-ms-flex:1;flex:1;color:var(--scgpql7-0);}
|
615
|
+
.Item_styles_baxa65_wzzpzvq__1ba2f282{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-align-items:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;min-height:var(--plasma-select-item-height);margin:0;box-sizing:content-box;padding:var(--wzzpzvq-0);font-family:var(--plasma-select-font-family);font-size:var(--plasma-select-font-size);font-style:var(--plasma-select-font-style);font-weight:var(--plasma-select-font-weight);-webkit-letter-spacing:var(--plasma-select-font-letter-spacing);-moz-letter-spacing:var(--plasma-select-font-letter-spacing);-ms-letter-spacing:var(--plasma-select-font-letter-spacing);letter-spacing:var(--plasma-select-font-letter-spacing);line-height:var(--plasma-select-font-line-height);background:var(--plasma-colors-transparent);color:var(--text-primary);border-radius:var(--plasma-select-item-border-radius);-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;position:relative;}.Item_styles_baxa65_wzzpzvq__1ba2f282:hover:not(.Item_styles_baxa65_dropdownItemIsDisabled__1ba2f282){cursor:pointer;background:var(--surface-transparent-secondary);}.Item_styles_baxa65_wzzpzvq__1ba2f282.Item_styles_baxa65_dropdownItemIsActive__1ba2f282{background:var(--surface-transparent-secondary);}.Item_styles_baxa65_wzzpzvq__1ba2f282.Item_styles_baxa65_dropdownItemIsDisabled__1ba2f282{opacity:0.4;cursor:not-allowed;}.Item_styles_baxa65_wzzpzvq__1ba2f282:focus{outline:none;}.Item_styles_baxa65_wzzpzvq__1ba2f282::before{content:'';position:absolute;top:0;left:0;right:0;bottom:0;z-index:1;display:block;box-sizing:content-box;border:0.0625rem solid transparent;border-radius:var(--plasma-select-item-border-radius);-webkit-transition:none;transition:none;pointer-events:none;}.Item_styles_baxa65_wzzpzvq__1ba2f282.Item_styles_baxa65_dropdownItemIsFocused__1ba2f282:before{outline:none;box-shadow:0 0 0 0.0625rem var(--surface-accent);}
|
616
616
|
|
617
617
|
|
618
618
|
.Button_styles_lxxm4p_sfn0xs0__70a12c1a{--plasma-button-color:var(--plasma-select-target-button-color);--plasma-button-color-hover:var(--plasma-select-target-button-color-hover);--plasma-button-color-active:var(--plasma-select-target-button-color-active);--plasma-button-background-color:var(--plasma-select-target-button-background-color);--plasma-button-background-color-hover:var(--plasma-select-target-button-background-color-hover);--plasma-button-background-color-active:var(--plasma-select-target-button-background-color-active);--plasma-button-right-content-margin:var(--plasma-select-target-button-arrow-margin);--plasma-button-height:var(--sfn0xs0-0);--plasma-button-width:100%;--plasma-button-padding:var(--plasma-select-target-button-padding);--plasma-button-radius:var(--plasma-select-border-radius);--plasma-button-font-family:var(--plasma-select-font-family);--plasma-button-font-size:var(--plasma-select-font-size);--plasma-button-font-style:var(--plasma-select-font-style);--plasma-button-font-weight:600;--plasma-button-letter-spacing:var(--plasma-select-font-letter-spacing);--plasma-button-line-height:var(--plasma-select-font-line-height);--plasma-button-disabled-opacity:0.4;--plasma-button-focus-color:var(--surface-accent);text-align:left;}
|
@@ -636,11 +636,11 @@
|
|
636
636
|
.Textfield_styles_11yj58s_c1ox0htq__817000d1{-webkit-flex:none;-ms-flex:none;flex:none;margin-left:-0.125rem;margin-right:0.375rem;line-height:0;}
|
637
637
|
.Textfield_styles_11yj58s_v1kam5d__817000d1{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;}
|
638
638
|
|
639
|
-
.
|
640
|
-
.
|
641
|
-
.
|
642
|
-
.
|
643
|
-
.
|
639
|
+
.Select_styles_1nzals0_spxbau6__beedd761 .Select_styles_1nzals0_popoverRoot__beedd761{width:var(--spxbau6-0);}.Select_styles_1nzals0_spxbau6__beedd761 .Select_styles_1nzals0_popoverTarget__beedd761{width:100%;}
|
640
|
+
.Select_styles_1nzals0_u1yey2x3__beedd761{box-sizing:border-box;background:var(--surface-solid-card);box-shadow:0px 4px 14px -4px rgba(8,8,8,0.08),0px 1px 4px -1px rgba(0,0,0,0.04);border-radius:var(--plasma-select-border-radius);width:var(--u1yey2x3-0);height:var(--u1yey2x3-1);overflow:var(--u1yey2x3-2);border:var(--plasma-select-popover-border-width) solid var(--plasma-select-popover-border-color);margin:var(--u1yey2x3-3);padding:var(--plasma-select-padding);}
|
641
|
+
.Select_styles_1nzals0_bvro45w__beedd761 .Select_styles_1nzals0_popoverWrapper__beedd761,.Select_styles_1nzals0_bvro45w__beedd761 .Select_styles_1nzals0_popoverTarget__beedd761{display:block;}
|
642
|
+
.Select_styles_1nzals0_ogpldc9__beedd761{display:block;margin-bottom:var(--plasma-select-label-offset);color:var(--text-primary);font-family:var(--plasma-select-font-family);font-size:var(--plasma-select-font-size);font-style:var(--plasma-select-font-style);font-weight:var(--plasma-select-font-weight);-webkit-letter-spacing:var(--plasma-select-font-letter-spacing);-moz-letter-spacing:var(--plasma-select-font-letter-spacing);-ms-letter-spacing:var(--plasma-select-font-letter-spacing);letter-spacing:var(--plasma-select-font-letter-spacing);line-height:var(--plasma-select-font-line-height);}
|
643
|
+
.Select_styles_1nzals0_h2ef052__beedd761{margin-top:var(--plasma-select-helper-text-offset);color:var(--plasma-select-helper-text-color);font-family:var(--plasma-typo-body-xs-font-family);font-size:var(--plasma-typo-body-xs-font-size);font-style:var(--plasma-typo-body-xs-font-style);font-weight:var(--plasma-typo-body-xs-font-weight);-webkit-letter-spacing:var(--plasma-typo-body-xs-letter-spacing);-moz-letter-spacing:var(--plasma-typo-body-xs-letter-spacing);-ms-letter-spacing:var(--plasma-typo-body-xs-letter-spacing);letter-spacing:var(--plasma-typo-body-xs-letter-spacing);line-height:var(--plasma-typo-body-xs-line-height);}
|
644
644
|
|
645
645
|
.base_1mk6ghf_b1qy9s12__46da26aa{background:var(--plasma-divider-background);}
|
646
646
|
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@salutejs/plasma-new-hope",
|
3
|
-
"version": "0.174.0-canary.
|
3
|
+
"version": "0.174.0-canary.1505.11485998091.0",
|
4
4
|
"description": "Salute Design System blueprint",
|
5
5
|
"main": "cjs/index.js",
|
6
6
|
"module": "es/index.js",
|
@@ -127,5 +127,5 @@
|
|
127
127
|
"sideEffects": [
|
128
128
|
"*.css"
|
129
129
|
],
|
130
|
-
"gitHead": "
|
130
|
+
"gitHead": "9c0d81e436556bca97ceb2a19d0c11e21ce11d72"
|
131
131
|
}
|
@@ -88,7 +88,7 @@ var comboboxRoot = exports.comboboxRoot = function comboboxRoot(Root) {
|
|
88
88
|
_useState4 = _slicedToArray(_useState3, 2),
|
89
89
|
internalValue = _useState4[0],
|
90
90
|
setInternalValue = _useState4[1];
|
91
|
-
var value = outerValue
|
91
|
+
var value = outerValue !== null && outerValue !== undefined ? (0, _utils3.getInitialValue)(outerValue, valueToItemMap) : internalValue;
|
92
92
|
var inputRef = (0, _react.useRef)(null);
|
93
93
|
var floatingPopoverRef = (0, _react.useRef)(null);
|
94
94
|
var inputForkRef = (0, _plasmaCore.useForkRef)(inputRef, ref);
|
@@ -320,6 +320,7 @@ var comboboxRoot = exports.comboboxRoot = function comboboxRoot(Root) {
|
|
320
320
|
// В данном эффекте мы следим за изменениями value снаружи и вносим коррективы в дерево чекбоксов.
|
321
321
|
// Пример: когда юзер очистил value извне, тогда нужно пройтись по элементам и выключить все чекбоксы.
|
322
322
|
(0, _react.useLayoutEffect)(function () {
|
323
|
+
var _valueToItemMap$get4;
|
323
324
|
var checkedCopy = new Map(checked);
|
324
325
|
checkedCopy.forEach(function (_, key) {
|
325
326
|
checkedCopy.set(key, false);
|
@@ -337,7 +338,12 @@ var comboboxRoot = exports.comboboxRoot = function comboboxRoot(Root) {
|
|
337
338
|
}
|
338
339
|
}
|
339
340
|
setChecked(checkedCopy);
|
340
|
-
|
341
|
+
setTextValue(((_valueToItemMap$get4 = valueToItemMap.get(outerValue)) === null || _valueToItemMap$get4 === void 0 ? void 0 : _valueToItemMap$get4.label) || '');
|
342
|
+
|
343
|
+
// В deps мы кладем именно outerValue и internalValue, а не просто value.
|
344
|
+
// Т.к. вначале нужно отфильтровать и провалидировать outerValue и результат положить в переменную.
|
345
|
+
// А переменную, содержащую сложные типы данных, нельзя помещать в deps.
|
346
|
+
}, [outerValue, internalValue]);
|
341
347
|
return /*#__PURE__*/_react["default"].createElement(Root, {
|
342
348
|
size: size,
|
343
349
|
view: view,
|
@@ -0,0 +1,26 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
4
|
+
value: true
|
5
|
+
});
|
6
|
+
exports.getInitialValue = void 0;
|
7
|
+
// Утилита предназначена для фильтрации элементов в value, которые отсутствуют в items.
|
8
|
+
// Эти элементы игнорируются и не участвуют в дальнейшей работе компонента.
|
9
|
+
var getInitialValue = exports.getInitialValue = function getInitialValue(outerValue, valueToItemMap) {
|
10
|
+
if (Array.isArray(outerValue)) {
|
11
|
+
if (outerValue.length === 0) {
|
12
|
+
return [];
|
13
|
+
}
|
14
|
+
var updatedValue = [];
|
15
|
+
outerValue.forEach(function (value) {
|
16
|
+
if (valueToItemMap.has(value)) {
|
17
|
+
updatedValue.push(value);
|
18
|
+
}
|
19
|
+
});
|
20
|
+
return updatedValue;
|
21
|
+
}
|
22
|
+
if (valueToItemMap.has(outerValue)) {
|
23
|
+
return outerValue;
|
24
|
+
}
|
25
|
+
return '';
|
26
|
+
};
|
@@ -9,6 +9,12 @@ Object.defineProperty(exports, "filterItems", {
|
|
9
9
|
return _filterItems.filterItems;
|
10
10
|
}
|
11
11
|
});
|
12
|
+
Object.defineProperty(exports, "getInitialValue", {
|
13
|
+
enumerable: true,
|
14
|
+
get: function get() {
|
15
|
+
return _getInitialValue.getInitialValue;
|
16
|
+
}
|
17
|
+
});
|
12
18
|
Object.defineProperty(exports, "getItemId", {
|
13
19
|
enumerable: true,
|
14
20
|
get: function get() {
|
@@ -51,4 +57,5 @@ var _updateAncestors = /*#__PURE__*/require("./updateAncestors");
|
|
51
57
|
var _updateSingleAncestors = /*#__PURE__*/require("./updateSingleAncestors");
|
52
58
|
var _sizeToIconSize = /*#__PURE__*/require("./sizeToIconSize");
|
53
59
|
var _filterItems = /*#__PURE__*/require("./filterItems");
|
54
|
-
var _getItemId = /*#__PURE__*/require("./getItemId");
|
60
|
+
var _getItemId = /*#__PURE__*/require("./getItemId");
|
61
|
+
var _getInitialValue = /*#__PURE__*/require("./getInitialValue");
|
@@ -24,8 +24,8 @@ var PaginationSelectPerPage = exports.PaginationSelectPerPage = function Paginat
|
|
24
24
|
listWidth = _ref.listWidth,
|
25
25
|
rest = _objectWithoutProperties(_ref, _excluded);
|
26
26
|
var handleSelectChange = function handleSelectChange(newValue) {
|
27
|
-
if (newValue) {
|
28
|
-
onChangeValue
|
27
|
+
if (newValue && !Array.isArray(newValue) && onChangeValue) {
|
28
|
+
onChangeValue(Number(newValue));
|
29
29
|
}
|
30
30
|
};
|
31
31
|
var transformedList = perPageList.map(function (num) {
|
@@ -67,17 +67,6 @@ var selectRoot = exports.selectRoot = function selectRoot(Root) {
|
|
67
67
|
separator = props.separator,
|
68
68
|
outerCloseAfterSelect = props.closeAfterSelect,
|
69
69
|
rest = _objectWithoutProperties(props, _excluded);
|
70
|
-
var _useState = (0, _react.useState)(outerValue || props.multiselect ? [] : ''),
|
71
|
-
_useState2 = _slicedToArray(_useState, 2),
|
72
|
-
internalValue = _useState2[0],
|
73
|
-
setInternalValue = _useState2[1];
|
74
|
-
var value = outerValue || internalValue;
|
75
|
-
var onChange = function onChange(e) {
|
76
|
-
if (outerOnChange) {
|
77
|
-
outerOnChange(e);
|
78
|
-
}
|
79
|
-
setInternalValue(e);
|
80
|
-
};
|
81
70
|
var transformedItems = (0, _react.useMemo)(function () {
|
82
71
|
return (0, _utils2.initialItemsTransform)(items || []);
|
83
72
|
}, [items]);
|
@@ -87,6 +76,12 @@ var selectRoot = exports.selectRoot = function selectRoot(Root) {
|
|
87
76
|
focusedToValueMap = _usePathMaps2[1],
|
88
77
|
valueToCheckedMap = _usePathMaps2[2],
|
89
78
|
valueToItemMap = _usePathMaps2[3];
|
79
|
+
var value = (0, _utils2.getInitialValue)(outerValue, valueToItemMap);
|
80
|
+
var onChange = function onChange(e) {
|
81
|
+
if (outerOnChange) {
|
82
|
+
outerOnChange(e);
|
83
|
+
}
|
84
|
+
};
|
90
85
|
var _useReducer = (0, _react.useReducer)(_reducers.pathReducer, []),
|
91
86
|
_useReducer2 = _slicedToArray(_useReducer, 2),
|
92
87
|
path = _useReducer2[0],
|
@@ -99,10 +94,10 @@ var selectRoot = exports.selectRoot = function selectRoot(Root) {
|
|
99
94
|
_useReducer6 = _slicedToArray(_useReducer5, 2),
|
100
95
|
focusedChipIndex = _useReducer6[0],
|
101
96
|
dispatchFocusedChipIndex = _useReducer6[1];
|
102
|
-
var
|
103
|
-
|
104
|
-
checked =
|
105
|
-
setChecked =
|
97
|
+
var _useState = (0, _react.useState)(valueToCheckedMap),
|
98
|
+
_useState2 = _slicedToArray(_useState, 2),
|
99
|
+
checked = _useState2[0],
|
100
|
+
setChecked = _useState2[1];
|
106
101
|
var closeAfterSelect = outerCloseAfterSelect !== null && outerCloseAfterSelect !== void 0 ? outerCloseAfterSelect : !props.multiselect;
|
107
102
|
var targetRef = (0, _hooks.useOutsideClick)(function () {
|
108
103
|
if (focusedChipIndex != null) {
|
@@ -248,7 +243,7 @@ var selectRoot = exports.selectRoot = function selectRoot(Root) {
|
|
248
243
|
}
|
249
244
|
}
|
250
245
|
setChecked(checkedCopy);
|
251
|
-
}, [
|
246
|
+
}, [outerValue]);
|
252
247
|
return /*#__PURE__*/_react["default"].createElement(Root, _extends({
|
253
248
|
ref: ref,
|
254
249
|
size: size,
|
@@ -37,7 +37,7 @@ var Ul = exports.Ul = /*#__PURE__*/_styledComponents["default"].ul.withConfig({
|
|
37
37
|
var base = exports.base = /*#__PURE__*/(0, _styledComponents.css)([".", ",.", "{display:block;}"], _Popover.popoverClasses.wrapper, _Popover.popoverClasses.target);
|
38
38
|
var OuterLabel = exports.OuterLabel = /*#__PURE__*/_styledComponents["default"].label.withConfig({
|
39
39
|
componentId: "plasma-new-hope__sc-le54jv-2"
|
40
|
-
})(["display:block;margin-bottom:var(", ");color:var(", ");font-family:var(", "
|
40
|
+
})(["display:block;margin-bottom:var(", ");color:var(", ");font-family:var(", ");font-size:var(", ");font-style:var(", ");font-weight:var(", ");letter-spacing:var(", ");line-height:var(", ");"], _Select.tokens.labelOffset, _Select.constants.textfieldOuterLabelColor, _Select.tokens.fontFamily, _Select.tokens.fontSize, _Select.tokens.fontStyle, _Select.tokens.fontWeight, _Select.tokens.fontLetterSpacing, _Select.tokens.fontLineHeight);
|
41
41
|
var HelperText = exports.HelperText = /*#__PURE__*/_styledComponents["default"].div.withConfig({
|
42
42
|
componentId: "plasma-new-hope__sc-le54jv-3"
|
43
|
-
})(["margin-top:var(", ");color:var(", ");font-family:var(", "
|
43
|
+
})(["margin-top:var(", ");color:var(", ");font-family:var(", ");font-size:var(", ");font-style:var(", ");font-weight:var(", ");letter-spacing:var(", ");line-height:var(", ");"], _Select.tokens.helperTextOffset, _Select.tokens.helperTextColor, _Select.constants.fontFamily, _Select.constants.fontSize, _Select.constants.fontStyle, _Select.constants.fontWeight, _Select.constants.fontLetterSpacing, _Select.constants.fontLineHeight);
|
@@ -26,18 +26,6 @@ var tokens = exports.tokens = {
|
|
26
26
|
fontWeight: '--plasma-select-font-weight',
|
27
27
|
fontLetterSpacing: '--plasma-select-font-letter-spacing',
|
28
28
|
fontLineHeight: '--plasma-select-font-line-height',
|
29
|
-
labelFontFamily: '--plasma-select-label-font-family',
|
30
|
-
labelFontSize: '--plasma-select-label-font-size',
|
31
|
-
labelFontStyle: '--plasma-select-label-font-style',
|
32
|
-
labelFontWeight: '--plasma-select-label-font-weight',
|
33
|
-
labelFontLetterSpacing: '--plasma-select-label-font-letter-spacing',
|
34
|
-
labelFontLineHeight: '--plasma-select-label-font-line-height',
|
35
|
-
helperTextFontFamily: '--plasma-select-helper-text-font-family',
|
36
|
-
helperTextFontSize: '--plasma-select-helper-text-font-size',
|
37
|
-
helperTextFontStyle: '--plasma-select-helper-text-font-style',
|
38
|
-
helperTextFontWeight: '--plasma-select-helper-text-font-weight',
|
39
|
-
helperTextFontLetterSpacing: '--plasma-select-helper-text-font-letter-spacing',
|
40
|
-
helperTextFontLineHeight: '--plasma-select-helper-text-font-line-height',
|
41
29
|
itemHeight: '--plasma-select-item-height',
|
42
30
|
itemBorderRadius: '--plasma-select-item-border-radius',
|
43
31
|
itemPadding: '--plasma-select-item-padding',
|
@@ -45,8 +33,6 @@ var tokens = exports.tokens = {
|
|
45
33
|
itemIconSize: '--plasma-select-item-icon-size',
|
46
34
|
itemIconSizeTight: '--plasma-select-item-icon-size-tight',
|
47
35
|
itemIconMargin: '--plasma-select-item-icon-margin',
|
48
|
-
itemBackground: '--plasma-select-item-background',
|
49
|
-
itemBackgroundHover: '--plasma-select-item-background-hover',
|
50
36
|
checkboxTriggerSize: '--plasma-select-checkbox-trigger-size',
|
51
37
|
checkboxTriggerSizeTight: '--plasma-select-checkbox-trigger-size-tight',
|
52
38
|
checkboxTriggerBorderRadius: '--plasma-select-checkbox-trigger-border-radius',
|
@@ -98,9 +84,7 @@ var tokens = exports.tokens = {
|
|
98
84
|
helperTextColor: '--plasma-select-helper-text-color',
|
99
85
|
helperTextOffset: '--plasma-select-helper-text-offset',
|
100
86
|
spinnerSize: '--plasma-select-spinner-size',
|
101
|
-
spinnerSizeTight: '--plasma-select-spinner-size-tight'
|
102
|
-
disclosureIconColor: '--plasma-select-disclosure-icon-color',
|
103
|
-
disclosureIconColorHover: '--plasma-select-disclosure-icon-color-hover'
|
87
|
+
spinnerSizeTight: '--plasma-select-spinner-size-tight'
|
104
88
|
};
|
105
89
|
var constants = exports.constants = {
|
106
90
|
focusColor: '--surface-accent',
|
@@ -159,7 +159,7 @@ var useKeyNavigation = exports.useKeyNavigation = function useKeyNavigation(_ref
|
|
159
159
|
}
|
160
160
|
case keys.Backspace:
|
161
161
|
{
|
162
|
-
if (!multiselect) break;
|
162
|
+
if (!multiselect || !Array.isArray(value)) break;
|
163
163
|
if (focusedChipIndex !== null) {
|
164
164
|
var _currentItem = valueToItemMap.get(value[focusedChipIndex]);
|
165
165
|
handlePressDown(_currentItem);
|
@@ -29,7 +29,7 @@ var StyledContentRight = exports.StyledContentRight = /*#__PURE__*/_styledCompon
|
|
29
29
|
})(["margin-left:auto;display:inline-flex;"]);
|
30
30
|
var DisclosureIconWrapper = exports.DisclosureIconWrapper = /*#__PURE__*/_styledComponents["default"].div.withConfig({
|
31
31
|
componentId: "plasma-new-hope__sc-fr2h0y-4"
|
32
|
-
})(["line-height:0;color:var(", "
|
32
|
+
})(["line-height:0;color:var(", ");&:hover{color:var(", ");}"], _Select.constants.disclosureIconColor, _Select.constants.disclosureIconColorHover);
|
33
33
|
var IconWrapper = exports.IconWrapper = /*#__PURE__*/_styledComponents["default"].div.withConfig({
|
34
34
|
componentId: "plasma-new-hope__sc-fr2h0y-5"
|
35
35
|
})(["display:flex;align-items:center;justify-content:center;width:", ";height:", ";margin:var(", ");line-height:0;color:var(", ");& .", "{--plasma-checkbox-trigger-size:", ";--plasma-checkbox-trigger-border-radius:", ";}"], function (_ref) {
|
@@ -53,10 +53,10 @@ var StyledText = exports.StyledText = /*#__PURE__*/_styledComponents["default"].
|
|
53
53
|
});
|
54
54
|
var Wrapper = exports.Wrapper = /*#__PURE__*/_styledComponents["default"].li.withConfig({
|
55
55
|
componentId: "plasma-new-hope__sc-fr2h0y-7"
|
56
|
-
})(["display:flex;align-items:center;min-height:var(", ");margin:0;box-sizing:content-box;padding:", ";font-family:var(", ");font-size:var(", ");font-style:var(", ");font-weight:var(", ");letter-spacing:var(", ");line-height:var(", ");background:var(", "
|
56
|
+
})(["display:flex;align-items:center;min-height:var(", ");margin:0;box-sizing:content-box;padding:", ";font-family:var(", ");font-size:var(", ");font-style:var(", ");font-weight:var(", ");letter-spacing:var(", ");line-height:var(", ");background:var(", ");color:var(--text-primary);border-radius:var(", ");user-select:none;&:hover:not(.", "){cursor:pointer;background:var(", ");}&.", "{background:var(", ");}&.", "{opacity:", ";cursor:not-allowed;}:focus{outline:none;}", ";"], _Select.tokens.itemHeight, function (_ref6) {
|
57
57
|
var variant = _ref6.variant;
|
58
58
|
return "var(".concat(variant === 'tight' ? _Select.tokens.itemPaddingTight : _Select.tokens.itemPadding, ")");
|
59
|
-
}, _Select.tokens.fontFamily, _Select.tokens.fontSize, _Select.tokens.fontStyle, _Select.tokens.fontWeight, _Select.tokens.fontLetterSpacing, _Select.tokens.fontLineHeight, _Select.
|
59
|
+
}, _Select.tokens.fontFamily, _Select.tokens.fontSize, _Select.tokens.fontStyle, _Select.tokens.fontWeight, _Select.tokens.fontLetterSpacing, _Select.tokens.fontLineHeight, _Select.constants.itemBackground, _Select.tokens.itemBorderRadius, _Select.classes.dropdownItemIsDisabled, _Select.constants.itemBackgroundHover, _Select.classes.dropdownItemIsActive, _Select.constants.itemBackgroundHover, _Select.classes.dropdownItemIsDisabled, _Select.constants.opacity, /*#__PURE__*/(0, _mixins.addFocus)({
|
60
60
|
outlineSize: '0.0625rem',
|
61
61
|
outlineOffset: '0',
|
62
62
|
outlineColor: /*#__PURE__*/"var(".concat(_Select.constants.focusColor, ")"),
|
@@ -41,7 +41,7 @@ var getLabel = function getLabel(_ref) {
|
|
41
41
|
text: renderValue ? renderValue(valueToItemMap.get(currentValue)) : itemLabel,
|
42
42
|
onClick: function onClick(e) {
|
43
43
|
e.stopPropagation();
|
44
|
-
onChipClick(currentValue);
|
44
|
+
onChipClick(currentValue.toString());
|
45
45
|
},
|
46
46
|
focused: focusedChipIndex === index
|
47
47
|
});
|
@@ -54,7 +54,7 @@ var ChipWrapper = exports.ChipWrapper = /*#__PURE__*/_styledComponents["default"
|
|
54
54
|
})(["width:100%;display:flex;min-width:0;padding:", ";gap:0.25rem;overflow-x:scroll;border-top-right-radius:var(", ");border-bottom-right-radius:var(", ");-ms-overflow-style:none;scrollbar-width:none;&::-webkit-scrollbar{display:none;}"], function (_ref6) {
|
55
55
|
var multiselect = _ref6.multiselect,
|
56
56
|
value = _ref6.value;
|
57
|
-
return "calc(".concat(_Select.constants.focusSize, " + ").concat(multiselect && value && value.length > 0 ? "var(".concat(_Select.tokens.focusOffset, ")") : 0, ")");
|
57
|
+
return "calc(".concat(_Select.constants.focusSize, " + ").concat(multiselect && value && value.toString().length > 0 ? "var(".concat(_Select.tokens.focusOffset, ")") : 0, ")");
|
58
58
|
}, _Select.tokens.chipBorderRadius, _Select.tokens.chipBorderRadius);
|
59
59
|
var Label = exports.Label = /*#__PURE__*/_styledComponents["default"].label.withConfig({
|
60
60
|
componentId: "plasma-new-hope__sc-1akl2tk-6"
|
@@ -23,7 +23,7 @@ var getButtonLabel = exports.getButtonLabel = function getButtonLabel(_ref3) {
|
|
23
23
|
return label || '';
|
24
24
|
}
|
25
25
|
if (selectProps.multiselect && selectProps.isTargetAmount) {
|
26
|
-
return "\u0412\u044B\u0431\u0440\u0430\u043D\u043E: ".concat(value.length);
|
26
|
+
return "\u0412\u044B\u0431\u0440\u0430\u043D\u043E: ".concat(value.toString().length);
|
27
27
|
}
|
28
28
|
if (selectProps.multiselect && Array.isArray(value)) {
|
29
29
|
return value === null || value === void 0 ? void 0 : value.map(function (itemValue) {
|
@@ -0,0 +1,26 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
4
|
+
value: true
|
5
|
+
});
|
6
|
+
exports.getInitialValue = void 0;
|
7
|
+
// Утилита предназначена для фильтрации элементов в value, которые отсутствуют в items.
|
8
|
+
// Эти элементы игнорируются и не участвуют в дальнейшей работе компонента.
|
9
|
+
var getInitialValue = exports.getInitialValue = function getInitialValue(outerValue, valueToItemMap) {
|
10
|
+
if (Array.isArray(outerValue)) {
|
11
|
+
if (outerValue.length === 0) {
|
12
|
+
return [];
|
13
|
+
}
|
14
|
+
var updatedValue = [];
|
15
|
+
outerValue.forEach(function (value) {
|
16
|
+
if (valueToItemMap.has(value)) {
|
17
|
+
updatedValue.push(value);
|
18
|
+
}
|
19
|
+
});
|
20
|
+
return updatedValue;
|
21
|
+
}
|
22
|
+
if (valueToItemMap.has(outerValue)) {
|
23
|
+
return outerValue;
|
24
|
+
}
|
25
|
+
return '';
|
26
|
+
};
|
@@ -15,6 +15,12 @@ Object.defineProperty(exports, "getCorrectHeight", {
|
|
15
15
|
return _getCorrectHeight.getCorrectHeight;
|
16
16
|
}
|
17
17
|
});
|
18
|
+
Object.defineProperty(exports, "getInitialValue", {
|
19
|
+
enumerable: true,
|
20
|
+
get: function get() {
|
21
|
+
return _getInitialValue.getInitialValue;
|
22
|
+
}
|
23
|
+
});
|
18
24
|
Object.defineProperty(exports, "getView", {
|
19
25
|
enumerable: true,
|
20
26
|
get: function get() {
|
@@ -58,4 +64,5 @@ var _updateSingleAncestors = /*#__PURE__*/require("./updateSingleAncestors");
|
|
58
64
|
var _sizeToIconSize = /*#__PURE__*/require("./sizeToIconSize");
|
59
65
|
var _getCorrectHeight = /*#__PURE__*/require("./getCorrectHeight");
|
60
66
|
var _getButtonLabel = /*#__PURE__*/require("./getButtonLabel");
|
61
|
-
var _getView = /*#__PURE__*/require("./getView");
|
67
|
+
var _getView = /*#__PURE__*/require("./getView");
|
68
|
+
var _getInitialValue = /*#__PURE__*/require("./getInitialValue");
|
@@ -1,18 +1,32 @@
|
|
1
1
|
"use strict";
|
2
2
|
|
3
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
3
4
|
Object.defineProperty(exports, "__esModule", {
|
4
5
|
value: true
|
5
6
|
});
|
6
7
|
exports.initialItemsTransform = void 0;
|
8
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
9
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
10
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
11
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
|
12
|
+
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
13
|
+
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
14
|
+
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
15
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
16
|
+
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
17
|
+
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
18
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
7
19
|
// Проходимся по массиву items и добавляем в каждый item ключ parent, который ссылается на item родителя.
|
8
20
|
// Дает возможность прохода к корневому элементу (снизу вверх).
|
9
|
-
|
21
|
+
// На выходе получаем глубокую копию исходного массива items.
|
10
22
|
var initialItemsTransform = exports.initialItemsTransform = function initialItemsTransform(items, parent) {
|
11
|
-
|
12
|
-
|
23
|
+
var newItems = _toConsumableArray(items);
|
24
|
+
newItems.forEach(function (item) {
|
25
|
+
var newItem = _objectSpread({}, item);
|
26
|
+
newItem.parent = parent;
|
13
27
|
if (item.items) {
|
14
28
|
item.items = initialItemsTransform(item.items, item);
|
15
29
|
}
|
16
30
|
});
|
17
|
-
return
|
31
|
+
return newItems;
|
18
32
|
};
|
@@ -16,7 +16,7 @@ import { sizeToIconSize } from '../../Select/utils';
|
|
16
16
|
import { classes } from './Combobox.tokens';
|
17
17
|
import { FloatingPopover } from './FloatingPopover';
|
18
18
|
import { useKeyNavigation, getItemByFocused } from './hooks/useKeyboardNavigation';
|
19
|
-
import { initialItemsTransform, updateAncestors, updateDescendants, updateSingleAncestors, filterItems, getItemId } from './utils';
|
19
|
+
import { initialItemsTransform, updateAncestors, updateDescendants, updateSingleAncestors, filterItems, getItemId, getInitialValue } from './utils';
|
20
20
|
import { Inner, StyledTextField } from './ui';
|
21
21
|
import { pathReducer, focusedPathReducer } from './reducers';
|
22
22
|
import { getPathMap, getTreeMaps } from './hooks/getPathMaps';
|
@@ -79,7 +79,7 @@ export var comboboxRoot = function comboboxRoot(Root) {
|
|
79
79
|
_useState4 = _slicedToArray(_useState3, 2),
|
80
80
|
internalValue = _useState4[0],
|
81
81
|
setInternalValue = _useState4[1];
|
82
|
-
var value = outerValue
|
82
|
+
var value = outerValue !== null && outerValue !== undefined ? getInitialValue(outerValue, valueToItemMap) : internalValue;
|
83
83
|
var inputRef = useRef(null);
|
84
84
|
var floatingPopoverRef = useRef(null);
|
85
85
|
var inputForkRef = useForkRef(inputRef, ref);
|
@@ -311,6 +311,7 @@ export var comboboxRoot = function comboboxRoot(Root) {
|
|
311
311
|
// В данном эффекте мы следим за изменениями value снаружи и вносим коррективы в дерево чекбоксов.
|
312
312
|
// Пример: когда юзер очистил value извне, тогда нужно пройтись по элементам и выключить все чекбоксы.
|
313
313
|
useLayoutEffect(function () {
|
314
|
+
var _valueToItemMap$get4;
|
314
315
|
var checkedCopy = new Map(checked);
|
315
316
|
checkedCopy.forEach(function (_, key) {
|
316
317
|
checkedCopy.set(key, false);
|
@@ -328,7 +329,12 @@ export var comboboxRoot = function comboboxRoot(Root) {
|
|
328
329
|
}
|
329
330
|
}
|
330
331
|
setChecked(checkedCopy);
|
331
|
-
|
332
|
+
setTextValue(((_valueToItemMap$get4 = valueToItemMap.get(outerValue)) === null || _valueToItemMap$get4 === void 0 ? void 0 : _valueToItemMap$get4.label) || '');
|
333
|
+
|
334
|
+
// В deps мы кладем именно outerValue и internalValue, а не просто value.
|
335
|
+
// Т.к. вначале нужно отфильтровать и провалидировать outerValue и результат положить в переменную.
|
336
|
+
// А переменную, содержащую сложные типы данных, нельзя помещать в deps.
|
337
|
+
}, [outerValue, internalValue]);
|
332
338
|
return /*#__PURE__*/React.createElement(Root, {
|
333
339
|
size: size,
|
334
340
|
view: view,
|
@@ -0,0 +1,20 @@
|
|
1
|
+
// Утилита предназначена для фильтрации элементов в value, которые отсутствуют в items.
|
2
|
+
// Эти элементы игнорируются и не участвуют в дальнейшей работе компонента.
|
3
|
+
export var getInitialValue = function getInitialValue(outerValue, valueToItemMap) {
|
4
|
+
if (Array.isArray(outerValue)) {
|
5
|
+
if (outerValue.length === 0) {
|
6
|
+
return [];
|
7
|
+
}
|
8
|
+
var updatedValue = [];
|
9
|
+
outerValue.forEach(function (value) {
|
10
|
+
if (valueToItemMap.has(value)) {
|
11
|
+
updatedValue.push(value);
|
12
|
+
}
|
13
|
+
});
|
14
|
+
return updatedValue;
|
15
|
+
}
|
16
|
+
if (valueToItemMap.has(outerValue)) {
|
17
|
+
return outerValue;
|
18
|
+
}
|
19
|
+
return '';
|
20
|
+
};
|
@@ -4,4 +4,5 @@ export { updateAncestors } from './updateAncestors';
|
|
4
4
|
export { updateSingleAncestors } from './updateSingleAncestors';
|
5
5
|
export { sizeToIconSize } from './sizeToIconSize';
|
6
6
|
export { filterItems } from './filterItems';
|
7
|
-
export { getItemId } from './getItemId';
|
7
|
+
export { getItemId } from './getItemId';
|
8
|
+
export { getInitialValue } from './getInitialValue';
|
@@ -17,8 +17,8 @@ export var PaginationSelectPerPage = function PaginationSelectPerPage(_ref) {
|
|
17
17
|
listWidth = _ref.listWidth,
|
18
18
|
rest = _objectWithoutProperties(_ref, _excluded);
|
19
19
|
var handleSelectChange = function handleSelectChange(newValue) {
|
20
|
-
if (newValue) {
|
21
|
-
onChangeValue
|
20
|
+
if (newValue && !Array.isArray(newValue) && onChangeValue) {
|
21
|
+
onChangeValue(Number(newValue));
|
22
22
|
}
|
23
23
|
};
|
24
24
|
var transformedList = perPageList.map(function (num) {
|
@@ -12,7 +12,7 @@ import React, { forwardRef, useState, useReducer, useMemo, createContext, useLay
|
|
12
12
|
import { isEmpty, getPlacements } from '../../utils';
|
13
13
|
import { useOutsideClick } from '../../hooks';
|
14
14
|
import { useKeyNavigation } from './hooks/useKeyboardNavigation';
|
15
|
-
import { initialItemsTransform, updateAncestors, updateDescendants, updateSingleAncestors, getView } from './utils';
|
15
|
+
import { initialItemsTransform, updateAncestors, updateDescendants, updateSingleAncestors, getView, getInitialValue } from './utils';
|
16
16
|
import { Inner, Target } from './ui';
|
17
17
|
import { pathReducer, focusedPathReducer, focusedChipIndexReducer } from './reducers';
|
18
18
|
import { usePathMaps } from './hooks/usePathMaps';
|
@@ -58,17 +58,6 @@ export var selectRoot = function selectRoot(Root) {
|
|
58
58
|
separator = props.separator,
|
59
59
|
outerCloseAfterSelect = props.closeAfterSelect,
|
60
60
|
rest = _objectWithoutProperties(props, _excluded);
|
61
|
-
var _useState = useState(outerValue || props.multiselect ? [] : ''),
|
62
|
-
_useState2 = _slicedToArray(_useState, 2),
|
63
|
-
internalValue = _useState2[0],
|
64
|
-
setInternalValue = _useState2[1];
|
65
|
-
var value = outerValue || internalValue;
|
66
|
-
var onChange = function onChange(e) {
|
67
|
-
if (outerOnChange) {
|
68
|
-
outerOnChange(e);
|
69
|
-
}
|
70
|
-
setInternalValue(e);
|
71
|
-
};
|
72
61
|
var transformedItems = useMemo(function () {
|
73
62
|
return initialItemsTransform(items || []);
|
74
63
|
}, [items]);
|
@@ -78,6 +67,12 @@ export var selectRoot = function selectRoot(Root) {
|
|
78
67
|
focusedToValueMap = _usePathMaps2[1],
|
79
68
|
valueToCheckedMap = _usePathMaps2[2],
|
80
69
|
valueToItemMap = _usePathMaps2[3];
|
70
|
+
var value = getInitialValue(outerValue, valueToItemMap);
|
71
|
+
var onChange = function onChange(e) {
|
72
|
+
if (outerOnChange) {
|
73
|
+
outerOnChange(e);
|
74
|
+
}
|
75
|
+
};
|
81
76
|
var _useReducer = useReducer(pathReducer, []),
|
82
77
|
_useReducer2 = _slicedToArray(_useReducer, 2),
|
83
78
|
path = _useReducer2[0],
|
@@ -90,10 +85,10 @@ export var selectRoot = function selectRoot(Root) {
|
|
90
85
|
_useReducer6 = _slicedToArray(_useReducer5, 2),
|
91
86
|
focusedChipIndex = _useReducer6[0],
|
92
87
|
dispatchFocusedChipIndex = _useReducer6[1];
|
93
|
-
var
|
94
|
-
|
95
|
-
checked =
|
96
|
-
setChecked =
|
88
|
+
var _useState = useState(valueToCheckedMap),
|
89
|
+
_useState2 = _slicedToArray(_useState, 2),
|
90
|
+
checked = _useState2[0],
|
91
|
+
setChecked = _useState2[1];
|
97
92
|
var closeAfterSelect = outerCloseAfterSelect !== null && outerCloseAfterSelect !== void 0 ? outerCloseAfterSelect : !props.multiselect;
|
98
93
|
var targetRef = useOutsideClick(function () {
|
99
94
|
if (focusedChipIndex != null) {
|
@@ -239,7 +234,7 @@ export var selectRoot = function selectRoot(Root) {
|
|
239
234
|
}
|
240
235
|
}
|
241
236
|
setChecked(checkedCopy);
|
242
|
-
}, [
|
237
|
+
}, [outerValue]);
|
243
238
|
return /*#__PURE__*/React.createElement(Root, _extends({
|
244
239
|
ref: ref,
|
245
240
|
size: size,
|
@@ -29,7 +29,7 @@ export var Ul = /*#__PURE__*/styled.ul.withConfig({
|
|
29
29
|
export var base = /*#__PURE__*/css([".", ",.", "{display:block;}"], popoverClasses.wrapper, popoverClasses.target);
|
30
30
|
export var OuterLabel = /*#__PURE__*/styled.label.withConfig({
|
31
31
|
componentId: "plasma-new-hope__sc-le54jv-2"
|
32
|
-
})(["display:block;margin-bottom:var(", ");color:var(", ");font-family:var(", "
|
32
|
+
})(["display:block;margin-bottom:var(", ");color:var(", ");font-family:var(", ");font-size:var(", ");font-style:var(", ");font-weight:var(", ");letter-spacing:var(", ");line-height:var(", ");"], tokens.labelOffset, constants.textfieldOuterLabelColor, tokens.fontFamily, tokens.fontSize, tokens.fontStyle, tokens.fontWeight, tokens.fontLetterSpacing, tokens.fontLineHeight);
|
33
33
|
export var HelperText = /*#__PURE__*/styled.div.withConfig({
|
34
34
|
componentId: "plasma-new-hope__sc-le54jv-3"
|
35
|
-
})(["margin-top:var(", ");color:var(", ");font-family:var(", "
|
35
|
+
})(["margin-top:var(", ");color:var(", ");font-family:var(", ");font-size:var(", ");font-style:var(", ");font-weight:var(", ");letter-spacing:var(", ");line-height:var(", ");"], tokens.helperTextOffset, tokens.helperTextColor, constants.fontFamily, constants.fontSize, constants.fontStyle, constants.fontWeight, constants.fontLetterSpacing, constants.fontLineHeight);
|