@salutejs/plasma-new-hope 0.121.0-dev.0 → 0.122.0-canary.1349.10334109595.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (113) hide show
  1. package/cjs/components/Select/Select.js +13 -5
  2. package/cjs/components/Select/Select.js.map +1 -1
  3. package/cjs/components/Select/hooks/useKeyboardNavigation.js.map +1 -1
  4. package/cjs/components/Select/hooks/usePathMaps.js +2 -2
  5. package/cjs/components/Select/hooks/usePathMaps.js.map +1 -1
  6. package/cjs/components/Select/ui/Inner/Inner.js.map +1 -1
  7. package/cjs/components/Select/ui/Inner/ui/Item/Item.js +1 -1
  8. package/cjs/components/Select/ui/Inner/ui/Item/Item.js.map +1 -1
  9. package/cjs/components/Select/ui/Target/Target.js +4 -2
  10. package/cjs/components/Select/ui/Target/Target.js.map +1 -1
  11. package/cjs/components/Select/ui/Target/ui/Button/Button.js +4 -2
  12. package/cjs/components/Select/ui/Target/ui/Button/Button.js.map +1 -1
  13. package/cjs/components/Select/utils/getButtonLabel.js +3 -2
  14. package/cjs/components/Select/utils/getButtonLabel.js.map +1 -1
  15. package/cjs/components/Select/utils/getView.js +27 -0
  16. package/cjs/components/Select/utils/getView.js.map +1 -0
  17. package/cjs/components/Select/utils/initialItemsTransform.js.map +1 -1
  18. package/cjs/components/Select/utils/updateAncestors.js.map +1 -1
  19. package/cjs/components/Select/utils/updateDescendants.js.map +1 -1
  20. package/cjs/components/Select/utils/updateSingleAncestors.js.map +1 -1
  21. package/emotion/cjs/components/Select/Select.js +12 -5
  22. package/emotion/cjs/components/Select/hooks/usePathMaps.js +2 -2
  23. package/emotion/cjs/components/Select/ui/Inner/ui/Item/Item.js +1 -1
  24. package/emotion/cjs/components/Select/ui/Target/Target.js +4 -2
  25. package/emotion/cjs/components/Select/ui/Target/ui/Button/Button.js +4 -2
  26. package/emotion/cjs/components/Select/utils/getButtonLabel.js +3 -2
  27. package/emotion/cjs/components/Select/utils/getView.js +26 -0
  28. package/emotion/cjs/components/Select/utils/index.js +8 -1
  29. package/emotion/es/components/Select/Select.js +13 -6
  30. package/emotion/es/components/Select/hooks/usePathMaps.js +2 -2
  31. package/emotion/es/components/Select/ui/Inner/ui/Item/Item.js +1 -1
  32. package/emotion/es/components/Select/ui/Target/Target.js +4 -2
  33. package/emotion/es/components/Select/ui/Target/ui/Button/Button.js +4 -2
  34. package/emotion/es/components/Select/utils/getButtonLabel.js +3 -2
  35. package/emotion/es/components/Select/utils/getView.js +20 -0
  36. package/emotion/es/components/Select/utils/index.js +2 -1
  37. package/es/components/Select/Select.js +13 -5
  38. package/es/components/Select/Select.js.map +1 -1
  39. package/es/components/Select/hooks/useKeyboardNavigation.js.map +1 -1
  40. package/es/components/Select/hooks/usePathMaps.js +2 -2
  41. package/es/components/Select/hooks/usePathMaps.js.map +1 -1
  42. package/es/components/Select/ui/Inner/Inner.js.map +1 -1
  43. package/es/components/Select/ui/Inner/ui/Item/Item.js +1 -1
  44. package/es/components/Select/ui/Inner/ui/Item/Item.js.map +1 -1
  45. package/es/components/Select/ui/Target/Target.js +4 -2
  46. package/es/components/Select/ui/Target/Target.js.map +1 -1
  47. package/es/components/Select/ui/Target/ui/Button/Button.js +4 -2
  48. package/es/components/Select/ui/Target/ui/Button/Button.js.map +1 -1
  49. package/es/components/Select/utils/getButtonLabel.js +3 -2
  50. package/es/components/Select/utils/getButtonLabel.js.map +1 -1
  51. package/es/components/Select/utils/getView.js +23 -0
  52. package/es/components/Select/utils/getView.js.map +1 -0
  53. package/es/components/Select/utils/initialItemsTransform.js.map +1 -1
  54. package/es/components/Select/utils/updateAncestors.js.map +1 -1
  55. package/es/components/Select/utils/updateDescendants.js.map +1 -1
  56. package/es/components/Select/utils/updateSingleAncestors.js.map +1 -1
  57. package/package.json +2 -2
  58. package/styled-components/cjs/components/Select/Select.js +12 -5
  59. package/styled-components/cjs/components/Select/hooks/usePathMaps.js +2 -2
  60. package/styled-components/cjs/components/Select/ui/Inner/ui/Item/Item.js +1 -1
  61. package/styled-components/cjs/components/Select/ui/Target/Target.js +4 -2
  62. package/styled-components/cjs/components/Select/ui/Target/ui/Button/Button.js +4 -2
  63. package/styled-components/cjs/components/Select/utils/getButtonLabel.js +3 -2
  64. package/styled-components/cjs/components/Select/utils/getView.js +26 -0
  65. package/styled-components/cjs/components/Select/utils/index.js +8 -1
  66. package/styled-components/es/components/Select/Select.js +13 -6
  67. package/styled-components/es/components/Select/hooks/usePathMaps.js +2 -2
  68. package/styled-components/es/components/Select/ui/Inner/ui/Item/Item.js +1 -1
  69. package/styled-components/es/components/Select/ui/Target/Target.js +4 -2
  70. package/styled-components/es/components/Select/ui/Target/ui/Button/Button.js +4 -2
  71. package/styled-components/es/components/Select/utils/getButtonLabel.js +3 -2
  72. package/styled-components/es/components/Select/utils/getView.js +20 -0
  73. package/styled-components/es/components/Select/utils/index.js +2 -1
  74. package/types/components/Pagination/ui/PaginationSelectPerPage/PaginationSelectPerPage.styles.d.ts +123 -27
  75. package/types/components/Pagination/ui/PaginationSelectPerPage/PaginationSelectPerPage.styles.d.ts.map +1 -1
  76. package/types/components/Select/Select.d.ts +3 -3
  77. package/types/components/Select/Select.d.ts.map +1 -1
  78. package/types/components/Select/Select.types.d.ts +73 -9
  79. package/types/components/Select/Select.types.d.ts.map +1 -1
  80. package/types/components/Select/hooks/useKeyboardNavigation.d.ts +6 -6
  81. package/types/components/Select/hooks/useKeyboardNavigation.d.ts.map +1 -1
  82. package/types/components/Select/hooks/usePathMaps.d.ts +6 -6
  83. package/types/components/Select/hooks/usePathMaps.d.ts.map +1 -1
  84. package/types/components/Select/index.d.ts +1 -1
  85. package/types/components/Select/index.d.ts.map +1 -1
  86. package/types/components/Select/ui/Inner/Inner.type.d.ts +4 -4
  87. package/types/components/Select/ui/Inner/Inner.type.d.ts.map +1 -1
  88. package/types/components/Select/ui/Inner/ui/Item/Item.types.d.ts +18 -3
  89. package/types/components/Select/ui/Inner/ui/Item/Item.types.d.ts.map +1 -1
  90. package/types/components/Select/ui/Target/Target.d.ts.map +1 -1
  91. package/types/components/Select/ui/Target/Target.types.d.ts +4 -3
  92. package/types/components/Select/ui/Target/Target.types.d.ts.map +1 -1
  93. package/types/components/Select/ui/Target/ui/Button/Button.d.ts.map +1 -1
  94. package/types/components/Select/ui/Target/ui/Button/Button.types.d.ts +1 -1
  95. package/types/components/Select/ui/Target/ui/Button/Button.types.d.ts.map +1 -1
  96. package/types/components/Select/utils/getButtonLabel.d.ts +1 -1
  97. package/types/components/Select/utils/getButtonLabel.d.ts.map +1 -1
  98. package/types/components/Select/utils/getView.d.ts +3 -0
  99. package/types/components/Select/utils/getView.d.ts.map +1 -0
  100. package/types/components/Select/utils/index.d.ts +1 -0
  101. package/types/components/Select/utils/index.d.ts.map +1 -1
  102. package/types/components/Select/utils/initialItemsTransform.d.ts +2 -2
  103. package/types/components/Select/utils/initialItemsTransform.d.ts.map +1 -1
  104. package/types/components/Select/utils/updateAncestors.d.ts +2 -2
  105. package/types/components/Select/utils/updateAncestors.d.ts.map +1 -1
  106. package/types/components/Select/utils/updateDescendants.d.ts +2 -2
  107. package/types/components/Select/utils/updateDescendants.d.ts.map +1 -1
  108. package/types/components/Select/utils/updateSingleAncestors.d.ts +2 -2
  109. package/types/components/Select/utils/updateSingleAncestors.d.ts.map +1 -1
  110. package/types/examples/plasma_b2c/components/Select/Select.d.ts +123 -27
  111. package/types/examples/plasma_b2c/components/Select/Select.d.ts.map +1 -1
  112. package/types/examples/plasma_web/components/Select/Select.d.ts +123 -27
  113. package/types/examples/plasma_web/components/Select/Select.d.ts.map +1 -1
@@ -0,0 +1,27 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ var getView = function getView(status) {
6
+ switch (status) {
7
+ case 'success':
8
+ {
9
+ return 'positive';
10
+ }
11
+ case 'error':
12
+ {
13
+ return 'negative';
14
+ }
15
+ case 'warning':
16
+ {
17
+ return 'warning';
18
+ }
19
+ default:
20
+ {
21
+ return 'default';
22
+ }
23
+ }
24
+ };
25
+
26
+ exports.getView = getView;
27
+ //# sourceMappingURL=getView.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getView.js","sources":["../../../../src/components/Select/utils/getView.ts"],"sourcesContent":["import { MergedSelectProps } from '../Select.types';\n\nexport const getView = (status: MergedSelectProps['status']) => {\n switch (status) {\n case 'success': {\n return 'positive';\n }\n\n case 'error': {\n return 'negative';\n }\n\n case 'warning': {\n return 'warning';\n }\n\n default: {\n return 'default';\n }\n }\n};\n"],"names":["getView","status"],"mappings":";;;;IAEaA,OAAO,GAAG,SAAVA,OAAOA,CAAIC,MAAmC,EAAK;AAC5D,EAAA,QAAQA,MAAM;AACV,IAAA,KAAK,SAAS;AAAE,MAAA;AACZ,QAAA,OAAO,UAAU,CAAA;AACrB,OAAA;AAEA,IAAA,KAAK,OAAO;AAAE,MAAA;AACV,QAAA,OAAO,UAAU,CAAA;AACrB,OAAA;AAEA,IAAA,KAAK,SAAS;AAAE,MAAA;AACZ,QAAA,OAAO,SAAS,CAAA;AACpB,OAAA;AAEA,IAAA;AAAS,MAAA;AACL,QAAA,OAAO,SAAS,CAAA;AACpB,OAAA;AACJ,GAAA;AACJ;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"initialItemsTransform.js","sources":["../../../../src/components/Select/utils/initialItemsTransform.ts"],"sourcesContent":["import { ItemOptionTransformed } from '../ui/Inner/ui/Item/Item.types';\n\n// Проходимся по массиву items и добавляем в каждый item ключ parent, который ссылается на item родителя.\n// Дает возможность прохода к корневому элементу (снизу вверх).\n\nexport const initialItemsTransform = (\n items: Array<ItemOptionTransformed>,\n parent?: ItemOptionTransformed,\n): Array<ItemOptionTransformed> => {\n items.forEach((item) => {\n item.parent = parent;\n\n if (item.items) {\n item.items = initialItemsTransform(item.items, item);\n }\n });\n\n return items;\n};\n"],"names":["initialItemsTransform","items","parent","forEach","item"],"mappings":";;;;AAEA;AACA;;AAEO,IAAMA,qBAAqB,GAAG,SAAxBA,qBAAqBA,CAC9BC,KAAmC,EACnCC,MAA8B,EACC;AAC/BD,EAAAA,KAAK,CAACE,OAAO,CAAC,UAACC,IAAI,EAAK;IACpBA,IAAI,CAACF,MAAM,GAAGA,MAAM,CAAA;IAEpB,IAAIE,IAAI,CAACH,KAAK,EAAE;MACZG,IAAI,CAACH,KAAK,GAAGD,qBAAqB,CAACI,IAAI,CAACH,KAAK,EAAEG,IAAI,CAAC,CAAA;AACxD,KAAA;AACJ,GAAC,CAAC,CAAA;AAEF,EAAA,OAAOH,KAAK,CAAA;AAChB;;;;"}
1
+ {"version":3,"file":"initialItemsTransform.js","sources":["../../../../src/components/Select/utils/initialItemsTransform.ts"],"sourcesContent":["import { MergedDropdownNodeTransformed } from '../ui/Inner/ui/Item/Item.types';\n\n// Проходимся по массиву items и добавляем в каждый item ключ parent, который ссылается на item родителя.\n// Дает возможность прохода к корневому элементу (снизу вверх).\n\nexport const initialItemsTransform = (\n items: Array<MergedDropdownNodeTransformed>,\n parent?: MergedDropdownNodeTransformed,\n): Array<MergedDropdownNodeTransformed> => {\n items.forEach((item) => {\n item.parent = parent;\n\n if (item.items) {\n item.items = initialItemsTransform(item.items, item);\n }\n });\n\n return items;\n};\n"],"names":["initialItemsTransform","items","parent","forEach","item"],"mappings":";;;;AAEA;AACA;;AAEO,IAAMA,qBAAqB,GAAG,SAAxBA,qBAAqBA,CAC9BC,KAA2C,EAC3CC,MAAsC,EACC;AACvCD,EAAAA,KAAK,CAACE,OAAO,CAAC,UAACC,IAAI,EAAK;IACpBA,IAAI,CAACF,MAAM,GAAGA,MAAM,CAAA;IAEpB,IAAIE,IAAI,CAACH,KAAK,EAAE;MACZG,IAAI,CAACH,KAAK,GAAGD,qBAAqB,CAACI,IAAI,CAACH,KAAK,EAAEG,IAAI,CAAC,CAAA;AACxD,KAAA;AACJ,GAAC,CAAC,CAAA;AAEF,EAAA,OAAOH,KAAK,CAAA;AAChB;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"updateAncestors.js","sources":["../../../../src/components/Select/utils/updateAncestors.ts"],"sourcesContent":["import type { ItemOptionTransformed } from '../ui/Inner/ui/Item/Item.types';\nimport type { ValueToCheckedMapType } from '../hooks/usePathMaps';\n\nexport const updateAncestors = (node: ItemOptionTransformed, checkedMap: ValueToCheckedMapType) => {\n if (!node?.parent) {\n return;\n }\n\n const { parent } = node;\n const siblings = parent.items!;\n const siblingsLength = siblings.length;\n let checkedFromAllSiblings = 0;\n let isParentIndeterminate = false;\n\n siblings.forEach((sib) => {\n if (checkedMap.get(sib.value) === 'indeterminate') {\n isParentIndeterminate = true;\n return;\n }\n\n if (checkedMap.get(sib.value)) {\n checkedFromAllSiblings += 1;\n }\n });\n\n if (isParentIndeterminate || (checkedFromAllSiblings > 0 && checkedFromAllSiblings < siblingsLength)) {\n checkedMap.set(parent.value, 'indeterminate');\n } else if (checkedFromAllSiblings === 0) {\n checkedMap.set(parent.value, false);\n } else {\n checkedMap.set(parent.value, true);\n }\n\n updateAncestors(parent, checkedMap);\n};\n"],"names":["updateAncestors","node","checkedMap","parent","siblings","items","siblingsLength","length","checkedFromAllSiblings","isParentIndeterminate","forEach","sib","get","value","set"],"mappings":";;;;AAGO,IAAMA,eAAe,GAAG,SAAlBA,eAAeA,CAAIC,IAA2B,EAAEC,UAAiC,EAAK;EAC/F,IAAI,EAACD,IAAI,KAAJA,IAAAA,IAAAA,IAAI,eAAJA,IAAI,CAAEE,MAAM,CAAE,EAAA;AACf,IAAA,OAAA;AACJ,GAAA;AAEA,EAAA,IAAQA,MAAM,GAAKF,IAAI,CAAfE,MAAM,CAAA;AACd,EAAA,IAAMC,QAAQ,GAAGD,MAAM,CAACE,KAAM,CAAA;AAC9B,EAAA,IAAMC,cAAc,GAAGF,QAAQ,CAACG,MAAM,CAAA;EACtC,IAAIC,sBAAsB,GAAG,CAAC,CAAA;EAC9B,IAAIC,qBAAqB,GAAG,KAAK,CAAA;AAEjCL,EAAAA,QAAQ,CAACM,OAAO,CAAC,UAACC,GAAG,EAAK;IACtB,IAAIT,UAAU,CAACU,GAAG,CAACD,GAAG,CAACE,KAAK,CAAC,KAAK,eAAe,EAAE;AAC/CJ,MAAAA,qBAAqB,GAAG,IAAI,CAAA;AAC5B,MAAA,OAAA;AACJ,KAAA;IAEA,IAAIP,UAAU,CAACU,GAAG,CAACD,GAAG,CAACE,KAAK,CAAC,EAAE;AAC3BL,MAAAA,sBAAsB,IAAI,CAAC,CAAA;AAC/B,KAAA;AACJ,GAAC,CAAC,CAAA;EAEF,IAAIC,qBAAqB,IAAKD,sBAAsB,GAAG,CAAC,IAAIA,sBAAsB,GAAGF,cAAe,EAAE;IAClGJ,UAAU,CAACY,GAAG,CAACX,MAAM,CAACU,KAAK,EAAE,eAAe,CAAC,CAAA;AACjD,GAAC,MAAM,IAAIL,sBAAsB,KAAK,CAAC,EAAE;IACrCN,UAAU,CAACY,GAAG,CAACX,MAAM,CAACU,KAAK,EAAE,KAAK,CAAC,CAAA;AACvC,GAAC,MAAM;IACHX,UAAU,CAACY,GAAG,CAACX,MAAM,CAACU,KAAK,EAAE,IAAI,CAAC,CAAA;AACtC,GAAA;AAEAb,EAAAA,eAAe,CAACG,MAAM,EAAED,UAAU,CAAC,CAAA;AACvC;;;;"}
1
+ {"version":3,"file":"updateAncestors.js","sources":["../../../../src/components/Select/utils/updateAncestors.ts"],"sourcesContent":["import type { MergedDropdownNodeTransformed } from '../ui/Inner/ui/Item/Item.types';\nimport type { ValueToCheckedMapType } from '../hooks/usePathMaps';\n\nexport const updateAncestors = (node: MergedDropdownNodeTransformed, checkedMap: ValueToCheckedMapType) => {\n if (!node?.parent) {\n return;\n }\n\n const { parent } = node;\n const siblings = parent.items!;\n const siblingsLength = siblings.length;\n let checkedFromAllSiblings = 0;\n let isParentIndeterminate = false;\n\n siblings.forEach((sib) => {\n if (checkedMap.get(sib.value) === 'indeterminate') {\n isParentIndeterminate = true;\n return;\n }\n\n if (checkedMap.get(sib.value)) {\n checkedFromAllSiblings += 1;\n }\n });\n\n if (isParentIndeterminate || (checkedFromAllSiblings > 0 && checkedFromAllSiblings < siblingsLength)) {\n checkedMap.set(parent.value, 'indeterminate');\n } else if (checkedFromAllSiblings === 0) {\n checkedMap.set(parent.value, false);\n } else {\n checkedMap.set(parent.value, true);\n }\n\n updateAncestors(parent, checkedMap);\n};\n"],"names":["updateAncestors","node","checkedMap","parent","siblings","items","siblingsLength","length","checkedFromAllSiblings","isParentIndeterminate","forEach","sib","get","value","set"],"mappings":";;;;AAGO,IAAMA,eAAe,GAAG,SAAlBA,eAAeA,CAAIC,IAAmC,EAAEC,UAAiC,EAAK;EACvG,IAAI,EAACD,IAAI,KAAJA,IAAAA,IAAAA,IAAI,eAAJA,IAAI,CAAEE,MAAM,CAAE,EAAA;AACf,IAAA,OAAA;AACJ,GAAA;AAEA,EAAA,IAAQA,MAAM,GAAKF,IAAI,CAAfE,MAAM,CAAA;AACd,EAAA,IAAMC,QAAQ,GAAGD,MAAM,CAACE,KAAM,CAAA;AAC9B,EAAA,IAAMC,cAAc,GAAGF,QAAQ,CAACG,MAAM,CAAA;EACtC,IAAIC,sBAAsB,GAAG,CAAC,CAAA;EAC9B,IAAIC,qBAAqB,GAAG,KAAK,CAAA;AAEjCL,EAAAA,QAAQ,CAACM,OAAO,CAAC,UAACC,GAAG,EAAK;IACtB,IAAIT,UAAU,CAACU,GAAG,CAACD,GAAG,CAACE,KAAK,CAAC,KAAK,eAAe,EAAE;AAC/CJ,MAAAA,qBAAqB,GAAG,IAAI,CAAA;AAC5B,MAAA,OAAA;AACJ,KAAA;IAEA,IAAIP,UAAU,CAACU,GAAG,CAACD,GAAG,CAACE,KAAK,CAAC,EAAE;AAC3BL,MAAAA,sBAAsB,IAAI,CAAC,CAAA;AAC/B,KAAA;AACJ,GAAC,CAAC,CAAA;EAEF,IAAIC,qBAAqB,IAAKD,sBAAsB,GAAG,CAAC,IAAIA,sBAAsB,GAAGF,cAAe,EAAE;IAClGJ,UAAU,CAACY,GAAG,CAACX,MAAM,CAACU,KAAK,EAAE,eAAe,CAAC,CAAA;AACjD,GAAC,MAAM,IAAIL,sBAAsB,KAAK,CAAC,EAAE;IACrCN,UAAU,CAACY,GAAG,CAACX,MAAM,CAACU,KAAK,EAAE,KAAK,CAAC,CAAA;AACvC,GAAC,MAAM;IACHX,UAAU,CAACY,GAAG,CAACX,MAAM,CAACU,KAAK,EAAE,IAAI,CAAC,CAAA;AACtC,GAAA;AAEAb,EAAAA,eAAe,CAACG,MAAM,EAAED,UAAU,CAAC,CAAA;AACvC;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"updateDescendants.js","sources":["../../../../src/components/Select/utils/updateDescendants.ts"],"sourcesContent":["import type { ItemOptionTransformed } from '../ui/Inner/ui/Item/Item.types';\nimport type { ValueToCheckedMapType } from '../hooks/usePathMaps';\n\nexport const updateDescendants = (\n node: ItemOptionTransformed,\n checkedMap: ValueToCheckedMapType,\n isChecked: boolean,\n) => {\n if (!node?.items) {\n return;\n }\n\n node.items.forEach((item) => {\n checkedMap.set(item.value, isChecked);\n\n if (item.items) {\n updateDescendants(item, checkedMap, isChecked);\n }\n });\n};\n"],"names":["updateDescendants","node","checkedMap","isChecked","items","forEach","item","set","value"],"mappings":";;;;AAGO,IAAMA,iBAAiB,GAAG,SAApBA,iBAAiBA,CAC1BC,IAA2B,EAC3BC,UAAiC,EACjCC,SAAkB,EACjB;EACD,IAAI,EAACF,IAAI,KAAJA,IAAAA,IAAAA,IAAI,eAAJA,IAAI,CAAEG,KAAK,CAAE,EAAA;AACd,IAAA,OAAA;AACJ,GAAA;AAEAH,EAAAA,IAAI,CAACG,KAAK,CAACC,OAAO,CAAC,UAACC,IAAI,EAAK;IACzBJ,UAAU,CAACK,GAAG,CAACD,IAAI,CAACE,KAAK,EAAEL,SAAS,CAAC,CAAA;IAErC,IAAIG,IAAI,CAACF,KAAK,EAAE;AACZJ,MAAAA,iBAAiB,CAACM,IAAI,EAAEJ,UAAU,EAAEC,SAAS,CAAC,CAAA;AAClD,KAAA;AACJ,GAAC,CAAC,CAAA;AACN;;;;"}
1
+ {"version":3,"file":"updateDescendants.js","sources":["../../../../src/components/Select/utils/updateDescendants.ts"],"sourcesContent":["import type { MergedDropdownNodeTransformed } from '../ui/Inner/ui/Item/Item.types';\nimport type { ValueToCheckedMapType } from '../hooks/usePathMaps';\n\nexport const updateDescendants = (\n node: MergedDropdownNodeTransformed,\n checkedMap: ValueToCheckedMapType,\n isChecked: boolean,\n) => {\n if (!node?.items) {\n return;\n }\n\n node.items.forEach((item) => {\n checkedMap.set(item.value, isChecked);\n\n if (item.items) {\n updateDescendants(item, checkedMap, isChecked);\n }\n });\n};\n"],"names":["updateDescendants","node","checkedMap","isChecked","items","forEach","item","set","value"],"mappings":";;;;AAGO,IAAMA,iBAAiB,GAAG,SAApBA,iBAAiBA,CAC1BC,IAAmC,EACnCC,UAAiC,EACjCC,SAAkB,EACjB;EACD,IAAI,EAACF,IAAI,KAAJA,IAAAA,IAAAA,IAAI,eAAJA,IAAI,CAAEG,KAAK,CAAE,EAAA;AACd,IAAA,OAAA;AACJ,GAAA;AAEAH,EAAAA,IAAI,CAACG,KAAK,CAACC,OAAO,CAAC,UAACC,IAAI,EAAK;IACzBJ,UAAU,CAACK,GAAG,CAACD,IAAI,CAACE,KAAK,EAAEL,SAAS,CAAC,CAAA;IAErC,IAAIG,IAAI,CAACF,KAAK,EAAE;AACZJ,MAAAA,iBAAiB,CAACM,IAAI,EAAEJ,UAAU,EAAEC,SAAS,CAAC,CAAA;AAClD,KAAA;AACJ,GAAC,CAAC,CAAA;AACN;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"updateSingleAncestors.js","sources":["../../../../src/components/Select/utils/updateSingleAncestors.ts"],"sourcesContent":["import type { ItemOptionTransformed } from '../ui/Inner/ui/Item/Item.types';\nimport type { ValueToCheckedMapType } from '../hooks/usePathMaps';\n\nexport const updateSingleAncestors = (\n node: ItemOptionTransformed,\n checkedMap: ValueToCheckedMapType,\n type: boolean | 'done' | 'dot' | 'indeterminate',\n) => {\n if (!node.parent) {\n return;\n }\n\n const { parent } = node;\n\n checkedMap.set(parent.value, type);\n\n updateSingleAncestors(parent, checkedMap, type);\n};\n"],"names":["updateSingleAncestors","node","checkedMap","type","parent","set","value"],"mappings":";;;;AAGO,IAAMA,qBAAqB,GAAG,SAAxBA,qBAAqBA,CAC9BC,IAA2B,EAC3BC,UAAiC,EACjCC,IAAgD,EAC/C;AACD,EAAA,IAAI,CAACF,IAAI,CAACG,MAAM,EAAE;AACd,IAAA,OAAA;AACJ,GAAA;AAEA,EAAA,IAAQA,MAAM,GAAKH,IAAI,CAAfG,MAAM,CAAA;EAEdF,UAAU,CAACG,GAAG,CAACD,MAAM,CAACE,KAAK,EAAEH,IAAI,CAAC,CAAA;AAElCH,EAAAA,qBAAqB,CAACI,MAAM,EAAEF,UAAU,EAAEC,IAAI,CAAC,CAAA;AACnD;;;;"}
1
+ {"version":3,"file":"updateSingleAncestors.js","sources":["../../../../src/components/Select/utils/updateSingleAncestors.ts"],"sourcesContent":["import type { MergedDropdownNodeTransformed } from '../ui/Inner/ui/Item/Item.types';\nimport type { ValueToCheckedMapType } from '../hooks/usePathMaps';\n\nexport const updateSingleAncestors = (\n node: MergedDropdownNodeTransformed,\n checkedMap: ValueToCheckedMapType,\n type: boolean | 'done' | 'dot' | 'indeterminate',\n) => {\n if (!node.parent) {\n return;\n }\n\n const { parent } = node;\n\n checkedMap.set(parent.value, type);\n\n updateSingleAncestors(parent, checkedMap, type);\n};\n"],"names":["updateSingleAncestors","node","checkedMap","type","parent","set","value"],"mappings":";;;;AAGO,IAAMA,qBAAqB,GAAG,SAAxBA,qBAAqBA,CAC9BC,IAAmC,EACnCC,UAAiC,EACjCC,IAAgD,EAC/C;AACD,EAAA,IAAI,CAACF,IAAI,CAACG,MAAM,EAAE;AACd,IAAA,OAAA;AACJ,GAAA;AAEA,EAAA,IAAQA,MAAM,GAAKH,IAAI,CAAfG,MAAM,CAAA;EAEdF,UAAU,CAACG,GAAG,CAACD,MAAM,CAACE,KAAK,EAAEH,IAAI,CAAC,CAAA;AAElCH,EAAAA,qBAAqB,CAACI,MAAM,EAAEF,UAAU,EAAEC,IAAI,CAAC,CAAA;AACnD;;;;"}
@@ -16,7 +16,7 @@ var _usePathMaps3 = /*#__PURE__*/require("./hooks/usePathMaps");
16
16
  var _Select = /*#__PURE__*/require("./Select.styles");
17
17
  var _base = /*#__PURE__*/require("./variations/_view/base");
18
18
  var _base2 = /*#__PURE__*/require("./variations/_size/base");
19
- var _excluded = ["value", "onChange", "target", "items", "placement", "label", "labelPlacement", "placeholder", "helperText", "disabled", "view", "size", "listOverflow", "listHeight", "listWidth", "contentLeft", "onScrollBottom", "chipView", "variant", "portal", "renderValue", "renderItem"];
19
+ var _excluded = ["value", "onChange", "target", "items", "placement", "label", "labelPlacement", "placeholder", "helperText", "disabled", "view", "size", "listOverflow", "listHeight", "listWidth", "contentLeft", "onScrollBottom", "chipView", "variant", "portal", "renderValue", "renderItem", "status", "onItemSelect", "separator"];
20
20
  function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
21
21
  function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { "default": e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n["default"] = e, t && t.set(e, n), n; }
22
22
  function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
@@ -62,6 +62,9 @@ var selectRoot = exports.selectRoot = function selectRoot(Root) {
62
62
  portal = props.portal,
63
63
  renderValue = props.renderValue,
64
64
  renderItem = props.renderItem,
65
+ status = props.status,
66
+ onItemSelect = props.onItemSelect,
67
+ separator = props.separator,
65
68
  rest = _objectWithoutProperties(props, _excluded);
66
69
  var _useState = (0, _react.useState)(outerValue || props.multiselect ? [] : ''),
67
70
  _useState2 = _slicedToArray(_useState, 2),
@@ -75,7 +78,7 @@ var selectRoot = exports.selectRoot = function selectRoot(Root) {
75
78
  setInternalValue(e);
76
79
  };
77
80
  var transformedItems = (0, _react.useMemo)(function () {
78
- return (0, _utils2.initialItemsTransform)(items);
81
+ return (0, _utils2.initialItemsTransform)(items || []);
79
82
  }, [items]);
80
83
  var _usePathMaps = (0, _usePathMaps3.usePathMaps)(transformedItems),
81
84
  _usePathMaps2 = _slicedToArray(_usePathMaps, 4),
@@ -167,6 +170,9 @@ var selectRoot = exports.selectRoot = function selectRoot(Root) {
167
170
  if (onChange) {
168
171
  onChange(isCurrentChecked ? '' : item.value);
169
172
  }
173
+ if (onItemSelect) {
174
+ onItemSelect(item);
175
+ }
170
176
  }
171
177
  };
172
178
  var handleChipClick = function handleChipClick(currentValue) {
@@ -228,7 +234,7 @@ var selectRoot = exports.selectRoot = function selectRoot(Root) {
228
234
  return /*#__PURE__*/_react["default"].createElement(Root, _extends({
229
235
  ref: ref,
230
236
  size: size,
231
- view: view,
237
+ view: status ? (0, _utils2.getView)(status) : view,
232
238
  chipView: chipView
233
239
  }, rest), label && labelPlacement === 'outer' && target !== 'button-like' && /*#__PURE__*/_react["default"].createElement(_Select.OuterLabel, null, label), /*#__PURE__*/_react["default"].createElement(Context.Provider, {
234
240
  value: {
@@ -265,11 +271,12 @@ var selectRoot = exports.selectRoot = function selectRoot(Root) {
265
271
  size: size,
266
272
  contentLeft: contentLeft,
267
273
  disabled: disabled,
268
- renderValue: renderValue
274
+ renderValue: renderValue,
275
+ separator: separator
269
276
  }),
270
277
  preventOverflow: false,
271
278
  closeOnOverlayClick: true
272
- }, /*#__PURE__*/_react["default"].createElement(Root, _extends({
279
+ }, items && /*#__PURE__*/_react["default"].createElement(Root, _extends({
273
280
  size: size
274
281
  }, rest), /*#__PURE__*/_react["default"].createElement(_Select.Ul, {
275
282
  role: "tree",
@@ -11,10 +11,10 @@ var usePathMaps = exports.usePathMaps = function usePathMaps(items) {
11
11
  var focusedToValueMap = new Map();
12
12
  var valueToCheckedMap = new Map();
13
13
  var valueToItemMap = new Map();
14
- pathMap.set('root', items.length);
14
+ pathMap.set('root', (items === null || items === void 0 ? void 0 : items.length) || 0);
15
15
  var rec = function rec(items) {
16
16
  var prevIndex = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
17
- items.forEach(function (item, index) {
17
+ items === null || items === void 0 || items.forEach(function (item, index) {
18
18
  var value = item.value,
19
19
  innerItems = item.items;
20
20
  var currIndex = "".concat(prevIndex, "/").concat(index).replace(/^(\/)/, '');
@@ -88,7 +88,7 @@ var Item = exports.Item = function Item(_ref) {
88
88
  }))), !multiselect && checked.get(item.value) === 'done' && /*#__PURE__*/_react["default"].createElement(_Icon.IconDone, {
89
89
  size: (0, _utils.sizeToIconSize)(size, variant),
90
90
  color: "inherit"
91
- })), contentLeft && /*#__PURE__*/_react["default"].createElement(_Item.StyledContentLeft, null, contentLeft), /*#__PURE__*/_react["default"].createElement(_Item.StyledText, null, renderItem && renderItem(value, label) || label), contentRight && /*#__PURE__*/_react["default"].createElement(_Item.StyledContentRight, null, contentRight), !(0, _utils2.isEmpty)(item.items) && /*#__PURE__*/_react["default"].createElement(_Item.DisclosureIconWrapper, null, /*#__PURE__*/_react["default"].createElement(_Icon.IconDisclosureRightCentered, {
91
+ })), contentLeft && /*#__PURE__*/_react["default"].createElement(_Item.StyledContentLeft, null, contentLeft), /*#__PURE__*/_react["default"].createElement(_Item.StyledText, null, renderItem && renderItem(value.toString(), label) || label), contentRight && /*#__PURE__*/_react["default"].createElement(_Item.StyledContentRight, null, contentRight), !(0, _utils2.isEmpty)(item.items) && /*#__PURE__*/_react["default"].createElement(_Item.DisclosureIconWrapper, null, /*#__PURE__*/_react["default"].createElement(_Icon.IconDisclosureRightCentered, {
92
92
  size: (0, _utils.sizeToIconSize)(size, variant),
93
93
  color: "inherit"
94
94
  })));
@@ -23,7 +23,8 @@ var Target = exports.Target = function Target(_ref) {
23
23
  renderValue = _ref.renderValue,
24
24
  focusedPath = _ref.focusedPath,
25
25
  focusedToValueMap = _ref.focusedToValueMap,
26
- selectProps = _ref.selectProps;
26
+ selectProps = _ref.selectProps,
27
+ separator = _ref.separator;
27
28
  return selectProps.target === 'button-like' ? /*#__PURE__*/_react["default"].createElement(_ui.Button, {
28
29
  opened: opened,
29
30
  value: value,
@@ -35,7 +36,8 @@ var Target = exports.Target = function Target(_ref) {
35
36
  renderValue: renderValue,
36
37
  focusedPath: focusedPath,
37
38
  focusedToValueMap: focusedToValueMap,
38
- selectProps: selectProps
39
+ selectProps: selectProps,
40
+ separator: separator
39
41
  }) : /*#__PURE__*/_react["default"].createElement(_ui.Textfield, {
40
42
  opened: opened,
41
43
  value: value,
@@ -21,7 +21,8 @@ var Button = exports.Button = function Button(_ref) {
21
21
  renderValue = _ref.renderValue,
22
22
  focusedPath = _ref.focusedPath,
23
23
  focusedToValueMap = _ref.focusedToValueMap,
24
- selectProps = _ref.selectProps;
24
+ selectProps = _ref.selectProps,
25
+ separator = _ref.separator;
25
26
  var withArrowInverse = opened ? _Select.classes.arrowInverse : undefined;
26
27
  var getActiveDescendant = function getActiveDescendant() {
27
28
  var _focusedToValueMap$ge;
@@ -51,6 +52,7 @@ var Button = exports.Button = function Button(_ref) {
51
52
  valueToItemMap: valueToItemMap,
52
53
  label: label,
53
54
  renderValue: renderValue,
54
- selectProps: selectProps
55
+ selectProps: selectProps,
56
+ separator: separator
55
57
  }))));
56
58
  };
@@ -18,7 +18,8 @@ var getButtonLabel = exports.getButtonLabel = function getButtonLabel(_ref3) {
18
18
  valueToItemMap = _ref3.valueToItemMap,
19
19
  label = _ref3.label,
20
20
  renderValue = _ref3.renderValue,
21
- selectProps = _ref3.selectProps;
21
+ selectProps = _ref3.selectProps,
22
+ separator = _ref3.separator;
22
23
  if ((0, _utils.isEmpty)(value)) {
23
24
  return label || '';
24
25
  }
@@ -32,7 +33,7 @@ var getButtonLabel = exports.getButtonLabel = function getButtonLabel(_ref3) {
32
33
  valueToItemMap: valueToItemMap,
33
34
  renderValue: renderValue
34
35
  });
35
- }).join(', ');
36
+ }).join(separator || ', ');
36
37
  }
37
38
  return getLabel({
38
39
  renderValue: renderValue,
@@ -0,0 +1,26 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.getView = void 0;
7
+ var getView = exports.getView = function getView(status) {
8
+ switch (status) {
9
+ case 'success':
10
+ {
11
+ return 'positive';
12
+ }
13
+ case 'error':
14
+ {
15
+ return 'negative';
16
+ }
17
+ case 'warning':
18
+ {
19
+ return 'warning';
20
+ }
21
+ default:
22
+ {
23
+ return 'default';
24
+ }
25
+ }
26
+ };
@@ -15,6 +15,12 @@ Object.defineProperty(exports, "getCorrectHeight", {
15
15
  return _getCorrectHeight.getCorrectHeight;
16
16
  }
17
17
  });
18
+ Object.defineProperty(exports, "getView", {
19
+ enumerable: true,
20
+ get: function get() {
21
+ return _getView.getView;
22
+ }
23
+ });
18
24
  Object.defineProperty(exports, "initialItemsTransform", {
19
25
  enumerable: true,
20
26
  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 _getCorrectHeight = /*#__PURE__*/require("./getCorrectHeight");
54
- var _getButtonLabel = /*#__PURE__*/require("./getButtonLabel");
60
+ var _getButtonLabel = /*#__PURE__*/require("./getButtonLabel");
61
+ var _getView = /*#__PURE__*/require("./getView");
@@ -1,4 +1,4 @@
1
- var _excluded = ["value", "onChange", "target", "items", "placement", "label", "labelPlacement", "placeholder", "helperText", "disabled", "view", "size", "listOverflow", "listHeight", "listWidth", "contentLeft", "onScrollBottom", "chipView", "variant", "portal", "renderValue", "renderItem"];
1
+ var _excluded = ["value", "onChange", "target", "items", "placement", "label", "labelPlacement", "placeholder", "helperText", "disabled", "view", "size", "listOverflow", "listHeight", "listWidth", "contentLeft", "onScrollBottom", "chipView", "variant", "portal", "renderValue", "renderItem", "status", "onItemSelect", "separator"];
2
2
  function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
3
3
  function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
4
4
  function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
@@ -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 } from './utils';
15
+ import { initialItemsTransform, updateAncestors, updateDescendants, updateSingleAncestors, getView } from './utils';
16
16
  import { Inner, Target } from './ui';
17
17
  import { pathReducer, focusedPathReducer, focusedChipIndexReducer } from './reducers';
18
18
  import { usePathMaps } from './hooks/usePathMaps';
@@ -53,6 +53,9 @@ export var selectRoot = function selectRoot(Root) {
53
53
  portal = props.portal,
54
54
  renderValue = props.renderValue,
55
55
  renderItem = props.renderItem,
56
+ status = props.status,
57
+ onItemSelect = props.onItemSelect,
58
+ separator = props.separator,
56
59
  rest = _objectWithoutProperties(props, _excluded);
57
60
  var _useState = useState(outerValue || props.multiselect ? [] : ''),
58
61
  _useState2 = _slicedToArray(_useState, 2),
@@ -66,7 +69,7 @@ export var selectRoot = function selectRoot(Root) {
66
69
  setInternalValue(e);
67
70
  };
68
71
  var transformedItems = useMemo(function () {
69
- return initialItemsTransform(items);
72
+ return initialItemsTransform(items || []);
70
73
  }, [items]);
71
74
  var _usePathMaps = usePathMaps(transformedItems),
72
75
  _usePathMaps2 = _slicedToArray(_usePathMaps, 4),
@@ -158,6 +161,9 @@ export var selectRoot = function selectRoot(Root) {
158
161
  if (onChange) {
159
162
  onChange(isCurrentChecked ? '' : item.value);
160
163
  }
164
+ if (onItemSelect) {
165
+ onItemSelect(item);
166
+ }
161
167
  }
162
168
  };
163
169
  var handleChipClick = function handleChipClick(currentValue) {
@@ -219,7 +225,7 @@ export var selectRoot = function selectRoot(Root) {
219
225
  return /*#__PURE__*/React.createElement(Root, _extends({
220
226
  ref: ref,
221
227
  size: size,
222
- view: view,
228
+ view: status ? getView(status) : view,
223
229
  chipView: chipView
224
230
  }, rest), label && labelPlacement === 'outer' && target !== 'button-like' && /*#__PURE__*/React.createElement(OuterLabel, null, label), /*#__PURE__*/React.createElement(Context.Provider, {
225
231
  value: {
@@ -256,11 +262,12 @@ export var selectRoot = function selectRoot(Root) {
256
262
  size: size,
257
263
  contentLeft: contentLeft,
258
264
  disabled: disabled,
259
- renderValue: renderValue
265
+ renderValue: renderValue,
266
+ separator: separator
260
267
  }),
261
268
  preventOverflow: false,
262
269
  closeOnOverlayClick: true
263
- }, /*#__PURE__*/React.createElement(Root, _extends({
270
+ }, items && /*#__PURE__*/React.createElement(Root, _extends({
264
271
  size: size
265
272
  }, rest), /*#__PURE__*/React.createElement(Ul, {
266
273
  role: "tree",
@@ -5,10 +5,10 @@ export var usePathMaps = function usePathMaps(items) {
5
5
  var focusedToValueMap = new Map();
6
6
  var valueToCheckedMap = new Map();
7
7
  var valueToItemMap = new Map();
8
- pathMap.set('root', items.length);
8
+ pathMap.set('root', (items === null || items === void 0 ? void 0 : items.length) || 0);
9
9
  var rec = function rec(items) {
10
10
  var prevIndex = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
11
- items.forEach(function (item, index) {
11
+ items === null || items === void 0 || items.forEach(function (item, index) {
12
12
  var value = item.value,
13
13
  innerItems = item.items;
14
14
  var currIndex = "".concat(prevIndex, "/").concat(index).replace(/^(\/)/, '');
@@ -79,7 +79,7 @@ export var Item = function Item(_ref) {
79
79
  }))), !multiselect && checked.get(item.value) === 'done' && /*#__PURE__*/React.createElement(IconDone, {
80
80
  size: sizeToIconSize(size, variant),
81
81
  color: "inherit"
82
- })), contentLeft && /*#__PURE__*/React.createElement(StyledContentLeft, null, contentLeft), /*#__PURE__*/React.createElement(StyledText, null, renderItem && renderItem(value, label) || label), contentRight && /*#__PURE__*/React.createElement(StyledContentRight, null, contentRight), !isEmpty(item.items) && /*#__PURE__*/React.createElement(DisclosureIconWrapper, null, /*#__PURE__*/React.createElement(IconDisclosureRightCentered, {
82
+ })), contentLeft && /*#__PURE__*/React.createElement(StyledContentLeft, null, contentLeft), /*#__PURE__*/React.createElement(StyledText, null, renderItem && renderItem(value.toString(), label) || label), contentRight && /*#__PURE__*/React.createElement(StyledContentRight, null, contentRight), !isEmpty(item.items) && /*#__PURE__*/React.createElement(DisclosureIconWrapper, null, /*#__PURE__*/React.createElement(IconDisclosureRightCentered, {
83
83
  size: sizeToIconSize(size, variant),
84
84
  color: "inherit"
85
85
  })));
@@ -16,7 +16,8 @@ export var Target = function Target(_ref) {
16
16
  renderValue = _ref.renderValue,
17
17
  focusedPath = _ref.focusedPath,
18
18
  focusedToValueMap = _ref.focusedToValueMap,
19
- selectProps = _ref.selectProps;
19
+ selectProps = _ref.selectProps,
20
+ separator = _ref.separator;
20
21
  return selectProps.target === 'button-like' ? /*#__PURE__*/React.createElement(Button, {
21
22
  opened: opened,
22
23
  value: value,
@@ -28,7 +29,8 @@ export var Target = function Target(_ref) {
28
29
  renderValue: renderValue,
29
30
  focusedPath: focusedPath,
30
31
  focusedToValueMap: focusedToValueMap,
31
- selectProps: selectProps
32
+ selectProps: selectProps,
33
+ separator: separator
32
34
  }) : /*#__PURE__*/React.createElement(Textfield, {
33
35
  opened: opened,
34
36
  value: value,
@@ -14,7 +14,8 @@ export var Button = function Button(_ref) {
14
14
  renderValue = _ref.renderValue,
15
15
  focusedPath = _ref.focusedPath,
16
16
  focusedToValueMap = _ref.focusedToValueMap,
17
- selectProps = _ref.selectProps;
17
+ selectProps = _ref.selectProps,
18
+ separator = _ref.separator;
18
19
  var withArrowInverse = opened ? classes.arrowInverse : undefined;
19
20
  var getActiveDescendant = function getActiveDescendant() {
20
21
  var _focusedToValueMap$ge;
@@ -44,6 +45,7 @@ export var Button = function Button(_ref) {
44
45
  valueToItemMap: valueToItemMap,
45
46
  label: label,
46
47
  renderValue: renderValue,
47
- selectProps: selectProps
48
+ selectProps: selectProps,
49
+ separator: separator
48
50
  }))));
49
51
  };
@@ -12,7 +12,8 @@ export var getButtonLabel = function getButtonLabel(_ref3) {
12
12
  valueToItemMap = _ref3.valueToItemMap,
13
13
  label = _ref3.label,
14
14
  renderValue = _ref3.renderValue,
15
- selectProps = _ref3.selectProps;
15
+ selectProps = _ref3.selectProps,
16
+ separator = _ref3.separator;
16
17
  if (isEmpty(value)) {
17
18
  return label || '';
18
19
  }
@@ -26,7 +27,7 @@ export var getButtonLabel = function getButtonLabel(_ref3) {
26
27
  valueToItemMap: valueToItemMap,
27
28
  renderValue: renderValue
28
29
  });
29
- }).join(', ');
30
+ }).join(separator || ', ');
30
31
  }
31
32
  return getLabel({
32
33
  renderValue: renderValue,
@@ -0,0 +1,20 @@
1
+ export var getView = function getView(status) {
2
+ switch (status) {
3
+ case 'success':
4
+ {
5
+ return 'positive';
6
+ }
7
+ case 'error':
8
+ {
9
+ return 'negative';
10
+ }
11
+ case 'warning':
12
+ {
13
+ return 'warning';
14
+ }
15
+ default:
16
+ {
17
+ return 'default';
18
+ }
19
+ }
20
+ };
@@ -4,4 +4,5 @@ export { updateAncestors } from './updateAncestors';
4
4
  export { updateSingleAncestors } from './updateSingleAncestors';
5
5
  export { sizeToIconSize } from './sizeToIconSize';
6
6
  export { getCorrectHeight } from './getCorrectHeight';
7
- export { getButtonLabel } from './getButtonLabel';
7
+ export { getButtonLabel } from './getButtonLabel';
8
+ export { getView } from './getView';
@@ -9,6 +9,7 @@ import { initialItemsTransform } from './utils/initialItemsTransform.js';
9
9
  import { updateDescendants } from './utils/updateDescendants.js';
10
10
  import { updateAncestors } from './utils/updateAncestors.js';
11
11
  import { updateSingleAncestors } from './utils/updateSingleAncestors.js';
12
+ import { getView } from './utils/getView.js';
12
13
  import '@linaria/react';
13
14
  import '@linaria/core';
14
15
  import 'focus-visible';
@@ -23,7 +24,7 @@ import { OuterLabel, StyledPopover, Ul, HelperText, base } from './Select.styles
23
24
  import { base as base$1 } from './variations/_view/base.js';
24
25
  import { base as base$2 } from './variations/_size/base.js';
25
26
 
26
- var _excluded = ["value", "onChange", "target", "items", "placement", "label", "labelPlacement", "placeholder", "helperText", "disabled", "view", "size", "listOverflow", "listHeight", "listWidth", "contentLeft", "onScrollBottom", "chipView", "variant", "portal", "renderValue", "renderItem"];
27
+ var _excluded = ["value", "onChange", "target", "items", "placement", "label", "labelPlacement", "placeholder", "helperText", "disabled", "view", "size", "listOverflow", "listHeight", "listWidth", "contentLeft", "onScrollBottom", "chipView", "variant", "portal", "renderValue", "renderItem", "status", "onItemSelect", "separator"];
27
28
  var Context = /*#__PURE__*/createContext({});
28
29
 
29
30
  /**
@@ -58,6 +59,9 @@ var selectRoot = function selectRoot(Root) {
58
59
  portal = props.portal,
59
60
  renderValue = props.renderValue,
60
61
  renderItem = props.renderItem,
62
+ status = props.status,
63
+ onItemSelect = props.onItemSelect,
64
+ separator = props.separator,
61
65
  rest = _objectWithoutProperties(props, _excluded);
62
66
  var _useState = useState(outerValue || props.multiselect ? [] : ''),
63
67
  _useState2 = _slicedToArray(_useState, 2),
@@ -71,7 +75,7 @@ var selectRoot = function selectRoot(Root) {
71
75
  setInternalValue(e);
72
76
  };
73
77
  var transformedItems = useMemo(function () {
74
- return initialItemsTransform(items);
78
+ return initialItemsTransform(items || []);
75
79
  }, [items]);
76
80
  var _usePathMaps = usePathMaps(transformedItems),
77
81
  _usePathMaps2 = _slicedToArray(_usePathMaps, 4),
@@ -163,6 +167,9 @@ var selectRoot = function selectRoot(Root) {
163
167
  if (onChange) {
164
168
  onChange(isCurrentChecked ? '' : item.value);
165
169
  }
170
+ if (onItemSelect) {
171
+ onItemSelect(item);
172
+ }
166
173
  }
167
174
  };
168
175
  var handleChipClick = function handleChipClick(currentValue) {
@@ -224,7 +231,7 @@ var selectRoot = function selectRoot(Root) {
224
231
  return /*#__PURE__*/React.createElement(Root, _extends({
225
232
  ref: ref,
226
233
  size: size,
227
- view: view,
234
+ view: status ? getView(status) : view,
228
235
  chipView: chipView
229
236
  }, rest), label && labelPlacement === 'outer' && target !== 'button-like' && /*#__PURE__*/React.createElement(OuterLabel, null, label), /*#__PURE__*/React.createElement(Context.Provider, {
230
237
  value: {
@@ -261,11 +268,12 @@ var selectRoot = function selectRoot(Root) {
261
268
  size: size,
262
269
  contentLeft: contentLeft,
263
270
  disabled: disabled,
264
- renderValue: renderValue
271
+ renderValue: renderValue,
272
+ separator: separator
265
273
  }),
266
274
  preventOverflow: false,
267
275
  closeOnOverlayClick: true
268
- }, /*#__PURE__*/React.createElement(Root, _extends({
276
+ }, items && /*#__PURE__*/React.createElement(Root, _extends({
269
277
  size: size
270
278
  }, rest), /*#__PURE__*/React.createElement(Ul, {
271
279
  role: "tree",