@coorpacademy/components 11.40.14 → 11.40.16
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/es/atom/button/style.css +2 -2
- package/es/atom/button-menu/utils.d.ts +1 -1
- package/es/atom/checkbox-with-title/index.d.ts +25 -1
- package/es/atom/checkbox-with-title/index.d.ts.map +1 -1
- package/es/atom/checkbox-with-title/index.js +19 -2
- package/es/atom/checkbox-with-title/index.js.map +1 -1
- package/es/atom/chip/index.d.ts.map +1 -1
- package/es/atom/chip/index.js +4 -4
- package/es/atom/chip/index.js.map +1 -1
- package/es/atom/content-badge/style.css +2 -2
- package/es/atom/input-html/index.d.ts.map +1 -1
- package/es/atom/input-html/index.js +2 -1
- package/es/atom/input-html/index.js.map +1 -1
- package/es/atom/input-switch/index.d.ts +24 -1
- package/es/atom/input-switch/index.d.ts.map +1 -1
- package/es/atom/input-switch/index.js +18 -4
- package/es/atom/input-switch/index.js.map +1 -1
- package/es/atom/input-switch/style.css +3 -0
- package/es/atom/range/index.d.ts +35 -3
- package/es/atom/range/index.d.ts.map +1 -1
- package/es/atom/range/index.js +95 -20
- package/es/atom/range/index.js.map +1 -1
- package/es/atom/range/style.css +40 -2
- package/es/atom/resource-miniature/style.css +3 -3
- package/es/atom/status-item/index.native.js +1 -1
- package/es/atom/status-item/index.native.js.map +1 -1
- package/es/molecule/base-modal/index.d.ts.map +1 -1
- package/es/molecule/base-modal/index.js +11 -5
- package/es/molecule/base-modal/index.js.map +1 -1
- package/es/molecule/card/favorite.d.ts.map +1 -1
- package/es/molecule/card/favorite.js +15 -16
- package/es/molecule/card/favorite.js.map +1 -1
- package/es/molecule/card/notification.css +0 -6
- package/es/molecule/card/notification.d.ts.map +1 -1
- package/es/molecule/card/notification.js +12 -14
- package/es/molecule/card/notification.js.map +1 -1
- package/es/molecule/cm-popin/types.d.ts +2 -0
- package/es/molecule/cm-popin/types.d.ts.map +1 -1
- package/es/molecule/coorpmanager-base-banner/style.css +1 -1
- package/es/molecule/dashboard/cards-list/index.d.ts +9 -0
- package/es/molecule/dashboard/cards-list/index.d.ts.map +1 -1
- package/es/molecule/dashboard/cards-list/index.js +5 -1
- package/es/molecule/dashboard/cards-list/index.js.map +1 -1
- package/es/molecule/dashboard/cards-list/style.css +1 -1
- package/es/molecule/draggable-list/index.d.ts +1 -0
- package/es/molecule/go1-banner/style.css +3 -3
- package/es/molecule/learning-priority-modal/index.js +1 -1
- package/es/molecule/learning-priority-modal/index.js.map +1 -1
- package/es/molecule/modal/style.css +3 -3
- package/es/molecule/multi-filter-panel/index.d.ts +42 -0
- package/es/molecule/multi-filter-panel/index.d.ts.map +1 -1
- package/es/molecule/multi-filter-panel/index.js +28 -15
- package/es/molecule/multi-filter-panel/index.js.map +1 -1
- package/es/molecule/multi-filter-panel/prop-types.d.ts +32 -5
- package/es/molecule/multi-filter-panel/prop-types.d.ts.map +1 -1
- package/es/molecule/multi-filter-panel/prop-types.js +4 -0
- package/es/molecule/multi-filter-panel/prop-types.js.map +1 -1
- package/es/molecule/questions/question-range/index.d.ts +6 -1
- package/es/molecule/quick-filters/index.js +3 -1
- package/es/molecule/quick-filters/index.js.map +1 -1
- package/es/molecule/quick-filters/style.css +7 -2
- package/es/molecule/tabs/index.d.ts +39 -0
- package/es/molecule/tabs/index.d.ts.map +1 -0
- package/es/molecule/tabs/index.js +69 -0
- package/es/molecule/tabs/index.js.map +1 -0
- package/es/molecule/tabs/style.css +28 -0
- package/es/molecule/title-and-checkbox-wrapper/index.d.ts +1 -0
- package/es/organism/brand-analytics/style.css +1 -1
- package/es/organism/brand-learning-priorities/index.d.ts +1 -0
- package/es/organism/content-skill-modal/index.d.ts +23 -0
- package/es/organism/content-skill-modal/index.d.ts.map +1 -1
- package/es/organism/content-skill-modal/types.d.ts +23 -0
- package/es/organism/content-skill-modal/types.d.ts.map +1 -1
- package/es/organism/filter-checkbox-and-search/index.d.ts +22 -0
- package/es/organism/filter-checkbox-and-search/index.d.ts.map +1 -1
- package/es/organism/filter-checkbox-and-search/index.js +21 -4
- package/es/organism/filter-checkbox-and-search/index.js.map +1 -1
- package/es/organism/filter-checkbox-and-search/props-types.d.ts +3 -0
- package/es/organism/filter-checkbox-and-search/props-types.d.ts.map +1 -1
- package/es/organism/filter-checkbox-and-search/props-types.js +1 -0
- package/es/organism/filter-checkbox-and-search/props-types.js.map +1 -1
- package/es/organism/filter-chip/index.d.ts +21 -0
- package/es/organism/filter-chip/index.d.ts.map +1 -1
- package/es/organism/filter-chip/index.js +14 -2
- package/es/organism/filter-chip/index.js.map +1 -1
- package/es/organism/filter-range/index.d.ts +28 -0
- package/es/organism/filter-range/index.d.ts.map +1 -0
- package/es/organism/filter-range/index.js +101 -0
- package/es/organism/filter-range/index.js.map +1 -0
- package/es/organism/filter-range/prop-types.d.ts +40 -0
- package/es/organism/filter-range/prop-types.d.ts.map +1 -0
- package/es/organism/filter-range/prop-types.js +20 -0
- package/es/organism/filter-range/prop-types.js.map +1 -0
- package/es/organism/filter-range/style.css +15 -0
- package/es/organism/filter-switch/index.d.ts +22 -0
- package/es/organism/filter-switch/index.d.ts.map +1 -1
- package/es/organism/filter-switch/index.js +18 -3
- package/es/organism/filter-switch/index.js.map +1 -1
- package/es/organism/filter-switch/prop-types.d.ts +2 -0
- package/es/organism/filter-switch/prop-types.d.ts.map +1 -1
- package/es/organism/filter-switch/prop-types.js +2 -1
- package/es/organism/filter-switch/prop-types.js.map +1 -1
- package/es/organism/list-item/index.d.ts +1 -0
- package/es/organism/list-items/index.d.ts +2 -0
- package/es/organism/list-items/style.css +1 -1
- package/es/organism/mooc-footer/style.css +2 -2
- package/es/organism/rewards-form/index.d.ts +1 -0
- package/es/organism/select-opponents/index.d.ts +1 -0
- package/es/organism/select-opponents/index.d.ts.map +1 -1
- package/es/organism/select-opponents/types.d.ts +1 -0
- package/es/organism/select-opponents/types.d.ts.map +1 -1
- package/es/organism/sidebar/style.css +3 -3
- package/es/organism/title-and-input/index.d.ts +1 -0
- package/es/organism/title-and-input/index.d.ts.map +1 -1
- package/es/organism/title-and-input/types.d.ts +1 -0
- package/es/organism/title-and-input/types.d.ts.map +1 -1
- package/es/organism/wizard-contents/index.d.ts +1 -0
- package/es/template/activity/stars-summary.css +2 -2
- package/es/template/app-player/loading/index.d.ts +2 -0
- package/es/template/app-player/player/index.d.ts +4 -0
- package/es/template/app-player/player/slides/index.d.ts +2 -0
- package/es/template/app-player/player/slides/index.d.ts.map +1 -1
- package/es/template/app-player/popin-correction/index.d.ts +2 -0
- package/es/template/app-player/popin-correction/index.d.ts.map +1 -1
- package/es/template/app-player/popin-end/index.d.ts +11 -0
- package/es/template/app-player/popin-end/summary.d.ts +9 -0
- package/es/template/app-review/index.d.ts +2 -0
- package/es/template/app-review/index.d.ts.map +1 -1
- package/es/template/app-review/player/prop-types.d.ts +2 -0
- package/es/template/app-review/player/prop-types.d.ts.map +1 -1
- package/es/template/app-review/prop-types.d.ts +2 -0
- package/es/template/app-review/prop-types.d.ts.map +1 -1
- package/es/template/back-office/brand-update/index.d.ts +28 -0
- package/es/template/back-office/brand-update/utils.d.ts +1 -1
- package/es/template/common/dashboard/index.d.ts +4 -0
- package/es/template/common/search-page/index.d.ts +106 -21
- package/es/template/common/search-page/index.d.ts.map +1 -1
- package/es/template/common/search-page/index.js +76 -21
- package/es/template/common/search-page/index.js.map +1 -1
- package/es/template/common/search-page/style.css +52 -4
- package/es/template/external-course/index.d.ts +2 -0
- package/es/template/my-learning/index.d.ts +9 -0
- package/es/template/teams-dashboard/index.d.ts +9 -0
- package/es/util/external-content.js +2 -2
- package/es/util/external-content.js.map +1 -1
- package/es/variables/colors.css +6 -6
- package/es/variables/colors.d.ts +5 -4
- package/es/variables/colors.d.ts.map +1 -1
- package/es/variables/colors.js +5 -4
- package/es/variables/colors.js.map +1 -1
- package/lib/atom/button/style.css +2 -2
- package/lib/atom/button-menu/utils.d.ts +1 -1
- package/lib/atom/checkbox-with-title/index.d.ts +25 -1
- package/lib/atom/checkbox-with-title/index.d.ts.map +1 -1
- package/lib/atom/checkbox-with-title/index.js +19 -2
- package/lib/atom/checkbox-with-title/index.js.map +1 -1
- package/lib/atom/chip/index.d.ts.map +1 -1
- package/lib/atom/chip/index.js +4 -4
- package/lib/atom/chip/index.js.map +1 -1
- package/lib/atom/content-badge/style.css +2 -2
- package/lib/atom/input-html/index.d.ts.map +1 -1
- package/lib/atom/input-html/index.js +2 -1
- package/lib/atom/input-html/index.js.map +1 -1
- package/lib/atom/input-switch/index.d.ts +24 -1
- package/lib/atom/input-switch/index.d.ts.map +1 -1
- package/lib/atom/input-switch/index.js +18 -4
- package/lib/atom/input-switch/index.js.map +1 -1
- package/lib/atom/input-switch/style.css +3 -0
- package/lib/atom/range/index.d.ts +35 -3
- package/lib/atom/range/index.d.ts.map +1 -1
- package/lib/atom/range/index.js +95 -20
- package/lib/atom/range/index.js.map +1 -1
- package/lib/atom/range/style.css +40 -2
- package/lib/atom/resource-miniature/style.css +3 -3
- package/lib/atom/status-item/index.native.js +1 -1
- package/lib/atom/status-item/index.native.js.map +1 -1
- package/lib/molecule/base-modal/index.d.ts.map +1 -1
- package/lib/molecule/base-modal/index.js +11 -5
- package/lib/molecule/base-modal/index.js.map +1 -1
- package/lib/molecule/card/favorite.d.ts.map +1 -1
- package/lib/molecule/card/favorite.js +15 -16
- package/lib/molecule/card/favorite.js.map +1 -1
- package/lib/molecule/card/notification.css +0 -6
- package/lib/molecule/card/notification.d.ts.map +1 -1
- package/lib/molecule/card/notification.js +12 -14
- package/lib/molecule/card/notification.js.map +1 -1
- package/lib/molecule/cm-popin/types.d.ts +2 -0
- package/lib/molecule/cm-popin/types.d.ts.map +1 -1
- package/lib/molecule/coorpmanager-base-banner/style.css +1 -1
- package/lib/molecule/dashboard/cards-list/index.d.ts +9 -0
- package/lib/molecule/dashboard/cards-list/index.d.ts.map +1 -1
- package/lib/molecule/dashboard/cards-list/index.js +5 -1
- package/lib/molecule/dashboard/cards-list/index.js.map +1 -1
- package/lib/molecule/dashboard/cards-list/style.css +1 -1
- package/lib/molecule/draggable-list/index.d.ts +1 -0
- package/lib/molecule/go1-banner/style.css +3 -3
- package/lib/molecule/learning-priority-modal/index.js +1 -1
- package/lib/molecule/learning-priority-modal/index.js.map +1 -1
- package/lib/molecule/modal/style.css +3 -3
- package/lib/molecule/multi-filter-panel/index.d.ts +42 -0
- package/lib/molecule/multi-filter-panel/index.d.ts.map +1 -1
- package/lib/molecule/multi-filter-panel/index.js +28 -15
- package/lib/molecule/multi-filter-panel/index.js.map +1 -1
- package/lib/molecule/multi-filter-panel/prop-types.d.ts +32 -5
- package/lib/molecule/multi-filter-panel/prop-types.d.ts.map +1 -1
- package/lib/molecule/multi-filter-panel/prop-types.js +4 -0
- package/lib/molecule/multi-filter-panel/prop-types.js.map +1 -1
- package/lib/molecule/questions/question-range/index.d.ts +6 -1
- package/lib/molecule/quick-filters/index.js +3 -1
- package/lib/molecule/quick-filters/index.js.map +1 -1
- package/lib/molecule/quick-filters/style.css +7 -2
- package/lib/molecule/tabs/index.d.ts +39 -0
- package/lib/molecule/tabs/index.d.ts.map +1 -0
- package/lib/molecule/tabs/index.js +74 -0
- package/lib/molecule/tabs/index.js.map +1 -0
- package/lib/molecule/tabs/style.css +28 -0
- package/lib/molecule/title-and-checkbox-wrapper/index.d.ts +1 -0
- package/lib/organism/brand-analytics/style.css +1 -1
- package/lib/organism/brand-learning-priorities/index.d.ts +1 -0
- package/lib/organism/content-skill-modal/index.d.ts +23 -0
- package/lib/organism/content-skill-modal/index.d.ts.map +1 -1
- package/lib/organism/content-skill-modal/types.d.ts +23 -0
- package/lib/organism/content-skill-modal/types.d.ts.map +1 -1
- package/lib/organism/filter-checkbox-and-search/index.d.ts +22 -0
- package/lib/organism/filter-checkbox-and-search/index.d.ts.map +1 -1
- package/lib/organism/filter-checkbox-and-search/index.js +21 -4
- package/lib/organism/filter-checkbox-and-search/index.js.map +1 -1
- package/lib/organism/filter-checkbox-and-search/props-types.d.ts +3 -0
- package/lib/organism/filter-checkbox-and-search/props-types.d.ts.map +1 -1
- package/lib/organism/filter-checkbox-and-search/props-types.js +1 -0
- package/lib/organism/filter-checkbox-and-search/props-types.js.map +1 -1
- package/lib/organism/filter-chip/index.d.ts +21 -0
- package/lib/organism/filter-chip/index.d.ts.map +1 -1
- package/lib/organism/filter-chip/index.js +14 -2
- package/lib/organism/filter-chip/index.js.map +1 -1
- package/lib/organism/filter-range/index.d.ts +28 -0
- package/lib/organism/filter-range/index.d.ts.map +1 -0
- package/lib/organism/filter-range/index.js +108 -0
- package/lib/organism/filter-range/index.js.map +1 -0
- package/lib/organism/filter-range/prop-types.d.ts +40 -0
- package/lib/organism/filter-range/prop-types.d.ts.map +1 -0
- package/lib/organism/filter-range/prop-types.js +25 -0
- package/lib/organism/filter-range/prop-types.js.map +1 -0
- package/lib/organism/filter-range/style.css +15 -0
- package/lib/organism/filter-switch/index.d.ts +22 -0
- package/lib/organism/filter-switch/index.d.ts.map +1 -1
- package/lib/organism/filter-switch/index.js +18 -3
- package/lib/organism/filter-switch/index.js.map +1 -1
- package/lib/organism/filter-switch/prop-types.d.ts +2 -0
- package/lib/organism/filter-switch/prop-types.d.ts.map +1 -1
- package/lib/organism/filter-switch/prop-types.js +2 -1
- package/lib/organism/filter-switch/prop-types.js.map +1 -1
- package/lib/organism/list-item/index.d.ts +1 -0
- package/lib/organism/list-items/index.d.ts +2 -0
- package/lib/organism/list-items/style.css +1 -1
- package/lib/organism/mooc-footer/style.css +2 -2
- package/lib/organism/rewards-form/index.d.ts +1 -0
- package/lib/organism/select-opponents/index.d.ts +1 -0
- package/lib/organism/select-opponents/index.d.ts.map +1 -1
- package/lib/organism/select-opponents/types.d.ts +1 -0
- package/lib/organism/select-opponents/types.d.ts.map +1 -1
- package/lib/organism/sidebar/style.css +3 -3
- package/lib/organism/title-and-input/index.d.ts +1 -0
- package/lib/organism/title-and-input/index.d.ts.map +1 -1
- package/lib/organism/title-and-input/types.d.ts +1 -0
- package/lib/organism/title-and-input/types.d.ts.map +1 -1
- package/lib/organism/wizard-contents/index.d.ts +1 -0
- package/lib/template/activity/stars-summary.css +2 -2
- package/lib/template/app-player/loading/index.d.ts +2 -0
- package/lib/template/app-player/player/index.d.ts +4 -0
- package/lib/template/app-player/player/slides/index.d.ts +2 -0
- package/lib/template/app-player/player/slides/index.d.ts.map +1 -1
- package/lib/template/app-player/popin-correction/index.d.ts +2 -0
- package/lib/template/app-player/popin-correction/index.d.ts.map +1 -1
- package/lib/template/app-player/popin-end/index.d.ts +11 -0
- package/lib/template/app-player/popin-end/summary.d.ts +9 -0
- package/lib/template/app-review/index.d.ts +2 -0
- package/lib/template/app-review/index.d.ts.map +1 -1
- package/lib/template/app-review/player/prop-types.d.ts +2 -0
- package/lib/template/app-review/player/prop-types.d.ts.map +1 -1
- package/lib/template/app-review/prop-types.d.ts +2 -0
- package/lib/template/app-review/prop-types.d.ts.map +1 -1
- package/lib/template/back-office/brand-update/index.d.ts +28 -0
- package/lib/template/back-office/brand-update/utils.d.ts +1 -1
- package/lib/template/common/dashboard/index.d.ts +4 -0
- package/lib/template/common/search-page/index.d.ts +106 -21
- package/lib/template/common/search-page/index.d.ts.map +1 -1
- package/lib/template/common/search-page/index.js +75 -20
- package/lib/template/common/search-page/index.js.map +1 -1
- package/lib/template/common/search-page/style.css +52 -4
- package/lib/template/external-course/index.d.ts +2 -0
- package/lib/template/my-learning/index.d.ts +9 -0
- package/lib/template/teams-dashboard/index.d.ts +9 -0
- package/lib/util/external-content.js +2 -2
- package/lib/util/external-content.js.map +1 -1
- package/lib/variables/colors.css +6 -6
- package/lib/variables/colors.d.ts +5 -4
- package/lib/variables/colors.d.ts.map +1 -1
- package/lib/variables/colors.js +5 -4
- package/lib/variables/colors.js.map +1 -1
- package/locales/cs/global.json +1 -1
- package/locales/de/global.json +1 -1
- package/locales/et/global.json +1 -1
- package/locales/fi/global.json +1 -1
- package/locales/fr/global.json +1 -1
- package/locales/hu/global.json +1 -1
- package/locales/hy/global.json +1 -1
- package/locales/ja/global.json +1 -1
- package/locales/ko/global.json +1 -1
- package/locales/lt/global.json +1 -1
- package/locales/pl/global.json +1 -1
- package/locales/ro/global.json +1 -1
- package/locales/ru/global.json +1 -1
- package/locales/sk/global.json +1 -1
- package/locales/sv/global.json +1 -1
- package/locales/uk/global.json +1 -1
- package/locales/vi/global.json +1 -1
- package/locales/zh/global.json +1 -1
- package/locales/zh_TW/global.json +1 -1
- package/package.json +4 -2
|
@@ -37,6 +37,7 @@ declare const MultiFilterPanel: {
|
|
|
37
37
|
count: import("prop-types").Requireable<number>;
|
|
38
38
|
onClick: import("prop-types").Requireable<(...args: any[]) => any>;
|
|
39
39
|
}> | null | undefined)[]>;
|
|
40
|
+
emptySearchResult: import("prop-types").Requireable<string>;
|
|
40
41
|
searchOptions: import("prop-types").Requireable<import("prop-types").InferProps<{
|
|
41
42
|
value: import("prop-types").Requireable<string>;
|
|
42
43
|
placeholder: import("prop-types").Validator<string>;
|
|
@@ -63,12 +64,53 @@ declare const MultiFilterPanel: {
|
|
|
63
64
|
onChange: import("prop-types").Validator<(...args: any[]) => any>;
|
|
64
65
|
theme: import("prop-types").Validator<string>;
|
|
65
66
|
ariaLabel: import("prop-types").Validator<string>;
|
|
67
|
+
id: import("prop-types").Requireable<string>;
|
|
66
68
|
}> | null | undefined)[]>;
|
|
67
69
|
}>>;
|
|
70
|
+
}> | import("prop-types").InferProps<{
|
|
71
|
+
type: import("prop-types").Requireable<string>;
|
|
72
|
+
options: import("prop-types").Requireable<import("prop-types").InferProps<{
|
|
73
|
+
title: import("prop-types").Validator<string>;
|
|
74
|
+
titleAriaLabel: import("prop-types").Requireable<string>;
|
|
75
|
+
onClear: import("prop-types").Validator<(...args: any[]) => any>;
|
|
76
|
+
options: import("prop-types").Requireable<import("prop-types").InferProps<{
|
|
77
|
+
label: import("prop-types").Validator<string>;
|
|
78
|
+
min: import("prop-types").Validator<number>;
|
|
79
|
+
max: import("prop-types").Validator<number>;
|
|
80
|
+
step: import("prop-types").Requireable<number>;
|
|
81
|
+
value: import("prop-types").Requireable<(number | null | undefined)[]>;
|
|
82
|
+
minLabel: import("prop-types").Requireable<string>;
|
|
83
|
+
maxLabel: import("prop-types").Requireable<string>;
|
|
84
|
+
onChange: import("prop-types").Validator<(...args: any[]) => any>;
|
|
85
|
+
theme: import("prop-types").Requireable<string>;
|
|
86
|
+
selected: import("prop-types").Requireable<boolean>;
|
|
87
|
+
}>>;
|
|
88
|
+
}>>;
|
|
68
89
|
}> | null | undefined> | null | undefined)[]>;
|
|
69
90
|
};
|
|
70
91
|
contextTypes: {
|
|
71
92
|
translate: import("prop-types").Requireable<(...args: any[]) => any>;
|
|
93
|
+
skin: import("prop-types").Requireable<import("prop-types").InferProps<{
|
|
94
|
+
common: import("prop-types").Requireable<{
|
|
95
|
+
[x: string]: any;
|
|
96
|
+
}>;
|
|
97
|
+
images: import("prop-types").Requireable<import("prop-types").InferProps<{
|
|
98
|
+
'logo-mobile': import("prop-types").Requireable<any>;
|
|
99
|
+
logo: import("prop-types").Requireable<any>;
|
|
100
|
+
'logo-email': import("prop-types").Requireable<any>;
|
|
101
|
+
login: import("prop-types").Requireable<any>;
|
|
102
|
+
}>>;
|
|
103
|
+
icons: import("prop-types").Requireable<{
|
|
104
|
+
[x: string]: any;
|
|
105
|
+
}>;
|
|
106
|
+
mod: import("prop-types").Requireable<{
|
|
107
|
+
[x: string]: any;
|
|
108
|
+
}>;
|
|
109
|
+
courses: import("prop-types").Requireable<any[]>;
|
|
110
|
+
texts: import("prop-types").Requireable<{
|
|
111
|
+
[x: string]: any;
|
|
112
|
+
}>;
|
|
113
|
+
}>>;
|
|
72
114
|
};
|
|
73
115
|
};
|
|
74
116
|
export default MultiFilterPanel;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/molecule/multi-filter-panel/index.tsx"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/molecule/multi-filter-panel/index.tsx"],"names":[],"mappings":";AAQA,OAAO,EAAC,gBAAgB,EAAC,MAAM,iCAAiC,CAAC;AAWjE,OAAkB,EAAC,qBAAqB,EAAqB,MAAM,cAAc,CAAC;AAuDlF,QAAA,MAAM,gBAAgB;YAAW,qBAAqB,WAAW,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA6DhF,CAAC;AASF,eAAe,gBAAgB,CAAC"}
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import _noop from "lodash/fp/noop";
|
|
2
|
+
import _getOr from "lodash/fp/getOr";
|
|
1
3
|
import _toString from "lodash/fp/toString";
|
|
2
4
|
import _flatMap from "lodash/fp/flatMap";
|
|
3
5
|
import _filter from "lodash/fp/filter";
|
|
@@ -5,6 +7,7 @@ import _pipe from "lodash/fp/pipe";
|
|
|
5
7
|
import _size from "lodash/fp/size";
|
|
6
8
|
import _map from "lodash/fp/map";
|
|
7
9
|
import React from 'react';
|
|
10
|
+
import { convert } from 'css-color-function';
|
|
8
11
|
import FilterChip from '../../organism/filter-chip';
|
|
9
12
|
import FilterCheckboxAndSearch from '../../organism/filter-checkbox-and-search';
|
|
10
13
|
import Title from '../../atom/title';
|
|
@@ -14,16 +17,13 @@ import Provider, { GetTranslateFromContext } from '../../atom/provider';
|
|
|
14
17
|
import Chip from '../../atom/chip';
|
|
15
18
|
import { COLORS } from '../../variables/colors';
|
|
16
19
|
import FilterSwitch from '../../organism/filter-switch';
|
|
20
|
+
import FilterRange from '../../organism/filter-range';
|
|
17
21
|
import style from './style.css';
|
|
18
22
|
import propTypes from './prop-types';
|
|
19
23
|
// @ts-expect-error convert is not recognized by the types
|
|
20
24
|
const uncappedMap = _map.convert({
|
|
21
25
|
cap: false
|
|
22
26
|
});
|
|
23
|
-
const CLEAR_ALL_BUTTON_STYLE = {
|
|
24
|
-
fontWeight: 'normal',
|
|
25
|
-
padding: 0
|
|
26
|
-
};
|
|
27
27
|
const FilterSeparator = /*#__PURE__*/React.createElement("div", {
|
|
28
28
|
className: style.filterSeparator
|
|
29
29
|
});
|
|
@@ -39,8 +39,8 @@ const buildFilters = filterOptions => {
|
|
|
39
39
|
return /*#__PURE__*/React.createElement(FilterCheckboxAndSearch, options);
|
|
40
40
|
case 'switch':
|
|
41
41
|
return /*#__PURE__*/React.createElement(FilterSwitch, options);
|
|
42
|
-
|
|
43
|
-
return
|
|
42
|
+
case 'range':
|
|
43
|
+
return /*#__PURE__*/React.createElement(FilterRange, options);
|
|
44
44
|
}
|
|
45
45
|
};
|
|
46
46
|
const buildAllSelectedFilterChips = (selectedFilters, onRemoveSelectedFilter) => {
|
|
@@ -52,7 +52,7 @@ const buildAllSelectedFilterChips = (selectedFilters, onRemoveSelectedFilter) =>
|
|
|
52
52
|
label
|
|
53
53
|
} = filterItem;
|
|
54
54
|
function handleClick() {
|
|
55
|
-
return onRemoveSelectedFilter(
|
|
55
|
+
return onRemoveSelectedFilter(filterItem);
|
|
56
56
|
}
|
|
57
57
|
return /*#__PURE__*/React.createElement(Chip, {
|
|
58
58
|
key: label,
|
|
@@ -69,11 +69,15 @@ const buildAllSelectedFilterChips = (selectedFilters, onRemoveSelectedFilter) =>
|
|
|
69
69
|
}));
|
|
70
70
|
};
|
|
71
71
|
const MultiFilterPanel = (props, context) => {
|
|
72
|
+
const {
|
|
73
|
+
skin
|
|
74
|
+
} = context;
|
|
75
|
+
const primaryColor = _getOr(COLORS.cm_primary_blue, 'common.primary', skin);
|
|
72
76
|
const {
|
|
73
77
|
title,
|
|
74
78
|
onClearAll,
|
|
75
79
|
options,
|
|
76
|
-
onRemoveSelectedFilter =
|
|
80
|
+
onRemoveSelectedFilter = _noop
|
|
77
81
|
} = props;
|
|
78
82
|
const translate = GetTranslateFromContext(context);
|
|
79
83
|
const allSelectedFilters = _pipe(_map('options'), _flatMap('options'), _filter(filterOptions => filterOptions.selected || filterOptions.value === true))(options);
|
|
@@ -86,31 +90,40 @@ const MultiFilterPanel = (props, context) => {
|
|
|
86
90
|
}, options);
|
|
87
91
|
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
|
|
88
92
|
className: style.header
|
|
89
|
-
}, /*#__PURE__*/React.createElement("div", {
|
|
93
|
+
}, hasSelectedFilters ? /*#__PURE__*/React.createElement("div", {
|
|
90
94
|
className: style.titleContainer
|
|
91
95
|
}, /*#__PURE__*/React.createElement(Title, {
|
|
92
96
|
title: title,
|
|
93
97
|
type: "form-group",
|
|
94
98
|
titleSize: "standard-light-weight"
|
|
95
|
-
}),
|
|
99
|
+
}), /*#__PURE__*/React.createElement(Tag, {
|
|
96
100
|
label: _toString(_size(allSelectedFilters)),
|
|
97
101
|
type: "info",
|
|
98
|
-
size: "S"
|
|
99
|
-
|
|
102
|
+
size: "S",
|
|
103
|
+
customStyle: {
|
|
104
|
+
color: primaryColor,
|
|
105
|
+
backgroundColor: convert(`color(${primaryColor} lightness(92%))`)
|
|
106
|
+
}
|
|
107
|
+
})) : null, hasSelectedFilters ? /*#__PURE__*/React.createElement("div", {
|
|
100
108
|
className: style.buttonContainer
|
|
101
109
|
}, /*#__PURE__*/React.createElement(ButtonLink, {
|
|
102
|
-
customStyle:
|
|
110
|
+
customStyle: {
|
|
111
|
+
fontWeight: 'normal',
|
|
112
|
+
padding: 0,
|
|
113
|
+
color: primaryColor
|
|
114
|
+
},
|
|
103
115
|
label: translate('clear_all'),
|
|
104
116
|
type: "text",
|
|
105
117
|
"data-name": "filters-all-clear-button",
|
|
106
118
|
"aria-label": "filters all clear button",
|
|
107
119
|
onClick: onClearAll,
|
|
108
120
|
hoverColor: COLORS.primary_600
|
|
109
|
-
})) : null),
|
|
121
|
+
})) : null), hasSelectedFilters ? /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", null, buildAllSelectedFilterChips(allSelectedFilters, onRemoveSelectedFilter)), FilterSeparator) : null, filters);
|
|
110
122
|
};
|
|
111
123
|
MultiFilterPanel.propTypes = process.env.NODE_ENV !== "production" ? propTypes : {};
|
|
112
124
|
MultiFilterPanel.contextTypes = {
|
|
113
|
-
translate: Provider.childContextTypes.translate
|
|
125
|
+
translate: Provider.childContextTypes.translate,
|
|
126
|
+
skin: Provider.childContextTypes.skin
|
|
114
127
|
};
|
|
115
128
|
export default MultiFilterPanel;
|
|
116
129
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["React","FilterChip","FilterCheckboxAndSearch","Title","Tag","ButtonLink","Provider","GetTranslateFromContext","Chip","COLORS","FilterSwitch","style","propTypes","uncappedMap","_map","convert","cap","CLEAR_ALL_BUTTON_STYLE","fontWeight","padding","FilterSeparator","createElement","className","filterSeparator","buildFilters","filterOptions","type","options","buildAllSelectedFilterChips","selectedFilters","onRemoveSelectedFilter","selectedFiltersContainer","map","filterItem","label","handleClick","key","onClick","text","textColor","neutral_500","backgroundColor","cm_grey_150","customIcon","customStyle","height","MultiFilterPanel","props","context","title","onClearAll","translate","allSelectedFilters","_pipe","_flatMap","_filter","selected","value","hasSelectedFilters","_size","filters","i","isLastItem","Fragment","header","titleContainer","titleSize","_toString","size","buttonContainer","hoverColor","primary_600","process","env","NODE_ENV","contextTypes","childContextTypes"],"sources":["../../../src/molecule/multi-filter-panel/index.tsx"],"sourcesContent":["import React from 'react';\nimport {map, size, pipe, filter, flatMap, toString} from 'lodash/fp';\nimport FilterChip from '../../organism/filter-chip';\nimport FilterCheckboxAndSearch from '../../organism/filter-checkbox-and-search';\nimport Title from '../../atom/title';\nimport Tag from '../../atom/tag';\nimport ButtonLink from '../../atom/button-link';\nimport {WebContextValues} from '../../atom/provider/web-context';\nimport Provider, {GetTranslateFromContext} from '../../atom/provider';\nimport Chip from '../../atom/chip';\nimport {COLORS} from '../../variables/colors';\nimport FilterSwitch from '../../organism/filter-switch';\nimport {FilterCheckboxAndSearchOptions} from '../../organism/filter-checkbox-and-search/props-types';\nimport {FilterChipOptionsProps} from '../../organism/filter-chip/prop-types';\nimport {FilterSwitchOptionsProps} from '../../organism/filter-switch/prop-types';\nimport style from './style.css';\nimport propTypes, {MultiFilterPanelProps, FilterOptionsProps} from './prop-types';\n\ntype SelectedFilter =\n | FilterChipOptionsProps\n | FilterSwitchOptionsProps\n | FilterCheckboxAndSearchOptions;\n\n// @ts-expect-error convert is not recognized by the types\nconst uncappedMap = map.convert({cap: false});\n\nconst CLEAR_ALL_BUTTON_STYLE = {fontWeight: 'normal', padding: 0};\nconst FilterSeparator = <div className={style.filterSeparator} />;\n\nconst buildFilters = (filterOptions: FilterOptionsProps) => {\n const {type, options} = filterOptions;\n switch (type) {\n case 'chip':\n return <FilterChip {...options} />;\n case 'checkbox':\n return <FilterCheckboxAndSearch {...options} />;\n case 'switch':\n return <FilterSwitch {...options} />;\n default:\n return null;\n }\n};\n\nconst buildAllSelectedFilterChips = (\n selectedFilters: SelectedFilter[],\n onRemoveSelectedFilter: (label: string) => void\n) => {\n return (\n <div className={style.selectedFiltersContainer} data-testid=\"selected-filters-container\">\n {selectedFilters.map((filterItem: SelectedFilter) => {\n const {label} = filterItem;\n\n function handleClick() {\n return onRemoveSelectedFilter(label);\n }\n\n return (\n <Chip\n key={label}\n onClick={handleClick}\n text={label}\n textColor={COLORS.neutral_500}\n backgroundColor={COLORS.cm_grey_150}\n customIcon={'xmark'}\n customStyle={{height: '28px', padding: '4px 8px'}}\n />\n );\n })}\n </div>\n );\n};\n\nconst MultiFilterPanel = (props: MultiFilterPanelProps, context: WebContextValues) => {\n const {title, onClearAll, options, onRemoveSelectedFilter = false} = props;\n const translate = GetTranslateFromContext(context);\n const allSelectedFilters: SelectedFilter[] = pipe(\n map('options'),\n flatMap('options'),\n filter(filterOptions => filterOptions.selected || filterOptions.value === true)\n )(options);\n const hasSelectedFilters = size(allSelectedFilters) > 0;\n const filters = uncappedMap((filterOptions: FilterOptionsProps, i: number) => {\n const isLastItem = i + 1 === size(options);\n\n return (\n <div key={i}>\n {buildFilters(filterOptions)}\n {isLastItem ? null : FilterSeparator}\n </div>\n );\n }, options);\n return (\n <>\n <div className={style.header}>\n <div className={style.titleContainer}>\n <Title title={title} type=\"form-group\" titleSize=\"standard-light-weight\" />\n {hasSelectedFilters ? (\n <Tag label={toString(size(allSelectedFilters))} type=\"info\" size=\"S\" />\n ) : null}\n </div>\n {hasSelectedFilters ? (\n <div className={style.buttonContainer}>\n <ButtonLink\n customStyle={CLEAR_ALL_BUTTON_STYLE}\n label={translate('clear_all')}\n type=\"text\"\n data-name=\"filters-all-clear-button\"\n aria-label=\"filters all clear button\"\n onClick={onClearAll}\n hoverColor={COLORS.primary_600}\n />\n </div>\n ) : null}\n </div>\n {onRemoveSelectedFilter && hasSelectedFilters ? (\n <>\n <div>{buildAllSelectedFilterChips(allSelectedFilters, onRemoveSelectedFilter)}</div>\n {FilterSeparator}\n </>\n ) : null}\n {filters}\n </>\n );\n};\n\nMultiFilterPanel.propTypes = propTypes;\n\nMultiFilterPanel.contextTypes = {\n translate: Provider.childContextTypes.translate\n};\n\nexport default MultiFilterPanel;\n"],"mappings":";;;;;;AAAA,OAAOA,KAAK,MAAM,OAAO;AAEzB,OAAOC,UAAU,MAAM,4BAA4B;AACnD,OAAOC,uBAAuB,MAAM,2CAA2C;AAC/E,OAAOC,KAAK,MAAM,kBAAkB;AACpC,OAAOC,GAAG,MAAM,gBAAgB;AAChC,OAAOC,UAAU,MAAM,wBAAwB;AAE/C,OAAOC,QAAQ,IAAGC,uBAAuB,QAAO,qBAAqB;AACrE,OAAOC,IAAI,MAAM,iBAAiB;AAClC,SAAQC,MAAM,QAAO,wBAAwB;AAC7C,OAAOC,YAAY,MAAM,8BAA8B;AAIvD,OAAOC,KAAK,MAAM,aAAa;AAC/B,OAAOC,SAAS,MAAmD,cAAc;AAOjF;AACA,MAAMC,WAAW,GAAGC,IAAA,CAAIC,OAAO,CAAC;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AY;IAACwC,SAAS,EAAC;EAAuB,CAAE,CAAC,EAC1ER,kBAAkB,gBACjB1D,KAAA,CAAAqB,aAAA,CAACjB,GAAG;IAAC8B,KAAK,EAAEiC,SAAA,CAASR,KAAA,CAAKP,kBAAkB,CAAC,CAAE;IAAC1B,IAAI,EAAC,MAAM;IAAC0C,IAAI,EAAC;EAAG,CAAE,CAAC,GACrE,IACD,CAAC,EACLV,kBAAkB,gBACjB1D,KAAA,CAAAqB,aAAA;IAAKC,SAAS,EAAEX,KAAK,CAAC0D;EAAgB,gBACpCrE,KAAA,CAAAqB,aAAA,CAAChB,UAAU;IACTuC,WAAW,EAAE3B,sBAAuB;IACpCiB,KAAK,EAAEiB,SAAS,CAAC,WAAW,CAAE;IAC9BzB,IAAI,EAAC,MAAM;IACX,aAAU,0BAA0B;IACpC,cAAW,0BAA0B;IACrCW,OAAO,EAAEa,UAAW;IACpBoB,UAAU,EAAE7D,MAAM,CAAC8D;EAAY,CAChC,CACE,CAAC,GACJ,IACD,CAAC,EACLzC,sBAAsB,IAAI4B,kBAAkB,gBAC3C1D,KAAA,CAAAqB,aAAA,CAAArB,KAAA,CAAA+D,QAAA,qBACE/D,KAAA,CAAAqB,aAAA,cAAMO,2BAA2B,CAACwB,kBAAkB,EAAEtB,sBAAsB,CAAO,CAAC,EACnFV,eACD,CAAC,GACD,IAAI,EACPwC,OACD,CAAC;AAEP,CAAC;AAEDd,gBAAgB,CAAClC,SAAS,GAAA4D,OAAA,CAAAC,GAAA,CAAAC,QAAA,oBAAG9D,SAAS;AAEtCkC,gBAAgB,CAAC6B,YAAY,GAAG;EAC9BxB,SAAS,EAAE7C,QAAQ,CAACsE,iBAAiB,CAACzB;AACxC,CAAC;AAED,eAAeL,gBAAgB","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"index.js","names":["React","convert","FilterChip","FilterCheckboxAndSearch","Title","Tag","ButtonLink","Provider","GetTranslateFromContext","Chip","COLORS","FilterSwitch","FilterRange","style","propTypes","uncappedMap","_map","cap","FilterSeparator","createElement","className","filterSeparator","buildFilters","filterOptions","type","options","buildAllSelectedFilterChips","selectedFilters","onRemoveSelectedFilter","selectedFiltersContainer","map","filterItem","label","handleClick","key","onClick","text","textColor","neutral_500","backgroundColor","cm_grey_150","customIcon","customStyle","height","padding","MultiFilterPanel","props","context","skin","primaryColor","_getOr","cm_primary_blue","title","onClearAll","_noop","translate","allSelectedFilters","_pipe","_flatMap","_filter","selected","value","hasSelectedFilters","_size","filters","i","isLastItem","Fragment","header","titleContainer","titleSize","_toString","size","color","buttonContainer","fontWeight","hoverColor","primary_600","process","env","NODE_ENV","contextTypes","childContextTypes"],"sources":["../../../src/molecule/multi-filter-panel/index.tsx"],"sourcesContent":["import React from 'react';\nimport {map, size, pipe, filter, flatMap, toString, getOr, noop} from 'lodash/fp';\nimport {convert} from 'css-color-function';\nimport FilterChip from '../../organism/filter-chip';\nimport FilterCheckboxAndSearch from '../../organism/filter-checkbox-and-search';\nimport Title from '../../atom/title';\nimport Tag from '../../atom/tag';\nimport ButtonLink from '../../atom/button-link';\nimport {WebContextValues} from '../../atom/provider/web-context';\nimport Provider, {GetTranslateFromContext} from '../../atom/provider';\nimport Chip from '../../atom/chip';\nimport {COLORS} from '../../variables/colors';\nimport FilterSwitch from '../../organism/filter-switch';\nimport FilterRange from '../../organism/filter-range';\nimport {FilterCheckboxAndSearchOptions} from '../../organism/filter-checkbox-and-search/props-types';\nimport {FilterChipOptionsProps} from '../../organism/filter-chip/prop-types';\nimport {FilterSwitchOptionsProps} from '../../organism/filter-switch/prop-types';\nimport {FilterRangeOptionsProps} from '../../organism/filter-range/prop-types';\nimport style from './style.css';\nimport propTypes, {MultiFilterPanelProps, FilterOptionsProps} from './prop-types';\n\ntype SelectedFilter =\n | FilterChipOptionsProps\n | FilterSwitchOptionsProps\n | FilterCheckboxAndSearchOptions\n | FilterRangeOptionsProps;\n\n// @ts-expect-error convert is not recognized by the types\nconst uncappedMap = map.convert({cap: false});\n\nconst FilterSeparator = <div className={style.filterSeparator} />;\n\nconst buildFilters = (filterOptions: FilterOptionsProps) => {\n const {type, options} = filterOptions;\n switch (type) {\n case 'chip':\n return <FilterChip {...options} />;\n case 'checkbox':\n return <FilterCheckboxAndSearch {...options} />;\n case 'switch':\n return <FilterSwitch {...options} />;\n case 'range':\n return <FilterRange {...options} />;\n }\n};\n\nconst buildAllSelectedFilterChips = (\n selectedFilters: SelectedFilter[],\n onRemoveSelectedFilter: (filterItem: SelectedFilter) => void\n) => {\n return (\n <div className={style.selectedFiltersContainer} data-testid=\"selected-filters-container\">\n {selectedFilters.map((filterItem: SelectedFilter) => {\n const {label} = filterItem;\n function handleClick() {\n return onRemoveSelectedFilter(filterItem);\n }\n\n return (\n <Chip\n key={label}\n onClick={handleClick}\n text={label}\n textColor={COLORS.neutral_500}\n backgroundColor={COLORS.cm_grey_150}\n customIcon={'xmark'}\n customStyle={{height: '28px', padding: '4px 8px'}}\n />\n );\n })}\n </div>\n );\n};\n\nconst MultiFilterPanel = (props: MultiFilterPanelProps, context: WebContextValues) => {\n const {skin} = context;\n const primaryColor = getOr(COLORS.cm_primary_blue, 'common.primary', skin);\n const {title, onClearAll, options, onRemoveSelectedFilter = noop} = props;\n const translate = GetTranslateFromContext(context);\n const allSelectedFilters: SelectedFilter[] = pipe(\n map('options'),\n flatMap('options'),\n filter(filterOptions => filterOptions.selected || filterOptions.value === true)\n )(options);\n const hasSelectedFilters = size(allSelectedFilters) > 0;\n const filters = uncappedMap((filterOptions: FilterOptionsProps, i: number) => {\n const isLastItem = i + 1 === size(options);\n\n return (\n <div key={i}>\n {buildFilters(filterOptions)}\n {isLastItem ? null : FilterSeparator}\n </div>\n );\n }, options);\n return (\n <>\n <div className={style.header}>\n {hasSelectedFilters ? (\n <div className={style.titleContainer}>\n <Title title={title} type=\"form-group\" titleSize=\"standard-light-weight\" />\n <Tag\n label={toString(size(allSelectedFilters))}\n type=\"info\"\n size=\"S\"\n customStyle={{\n color: primaryColor,\n backgroundColor: convert(`color(${primaryColor} lightness(92%))`)\n }}\n />\n </div>\n ) : null}\n {hasSelectedFilters ? (\n <div className={style.buttonContainer}>\n <ButtonLink\n customStyle={{fontWeight: 'normal', padding: 0, color: primaryColor}}\n label={translate('clear_all')}\n type=\"text\"\n data-name=\"filters-all-clear-button\"\n aria-label=\"filters all clear button\"\n onClick={onClearAll}\n hoverColor={COLORS.primary_600}\n />\n </div>\n ) : null}\n </div>\n {hasSelectedFilters ? (\n <>\n <div>{buildAllSelectedFilterChips(allSelectedFilters, onRemoveSelectedFilter)}</div>\n {FilterSeparator}\n </>\n ) : null}\n {filters}\n </>\n );\n};\n\nMultiFilterPanel.propTypes = propTypes;\n\nMultiFilterPanel.contextTypes = {\n translate: Provider.childContextTypes.translate,\n skin: Provider.childContextTypes.skin\n};\n\nexport default MultiFilterPanel;\n"],"mappings":";;;;;;;;AAAA,OAAOA,KAAK,MAAM,OAAO;AAEzB,SAAQC,OAAO,QAAO,oBAAoB;AAC1C,OAAOC,UAAU,MAAM,4BAA4B;AACnD,OAAOC,uBAAuB,MAAM,2CAA2C;AAC/E,OAAOC,KAAK,MAAM,kBAAkB;AACpC,OAAOC,GAAG,MAAM,gBAAgB;AAChC,OAAOC,UAAU,MAAM,wBAAwB;AAE/C,OAAOC,QAAQ,IAAGC,uBAAuB,QAAO,qBAAqB;AACrE,OAAOC,IAAI,MAAM,iBAAiB;AAClC,SAAQC,MAAM,QAAO,wBAAwB;AAC7C,OAAOC,YAAY,MAAM,8BAA8B;AACvD,OAAOC,WAAW,MAAM,6BAA6B;AAKrD,OAAOC,KAAK,MAAM,aAAa;AAC/B,OAAOC,SAAS,MAAmD,cAAc;AAQjF;AACA,MAAMC,WAAW,GAAGC,IAAA,CAAIf,OAAO,CAAC;EAACgB,GAAG,EAAE;AAAK,CAAC,CAAC;AAE7C,MAAMC,eAAe,gBAAGlB,KAAA,CAAAmB,aAAA;EAAKC,SAAS,EAAEP,KAAK,CAACQ;AAAgB,CAAE,CAAC;AAEjE,MA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B,CAAClC;AACnC,CAAC;AAED,eAAeH,gBAAgB","ignoreList":[]}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import PropTypes from 'prop-types';
|
|
2
|
-
import { FilterChipProps } from '../../organism/filter-chip/prop-types';
|
|
3
|
-
import { FilterCheckboxAndSearchProps } from '../../organism/filter-checkbox-and-search/props-types';
|
|
4
|
-
import { FilterSwitchProps } from '../../organism/filter-switch/prop-types';
|
|
2
|
+
import { FilterChipOptionsProps, FilterChipProps } from '../../organism/filter-chip/prop-types';
|
|
3
|
+
import { FilterCheckboxAndSearchOptions, FilterCheckboxAndSearchProps } from '../../organism/filter-checkbox-and-search/props-types';
|
|
4
|
+
import { FilterSwitchOptionsProps, FilterSwitchProps } from '../../organism/filter-switch/prop-types';
|
|
5
|
+
import { FilterRangeProps, FilterRangeOptionsProps } from '../../organism/filter-range/prop-types';
|
|
5
6
|
declare const propTypes: {
|
|
6
7
|
title: PropTypes.Requireable<string>;
|
|
7
8
|
onClearAll: PropTypes.Requireable<(...args: any[]) => any>;
|
|
@@ -36,6 +37,7 @@ declare const propTypes: {
|
|
|
36
37
|
count: PropTypes.Requireable<number>;
|
|
37
38
|
onClick: PropTypes.Requireable<(...args: any[]) => any>;
|
|
38
39
|
}> | null | undefined)[]>;
|
|
40
|
+
emptySearchResult: PropTypes.Requireable<string>;
|
|
39
41
|
searchOptions: PropTypes.Requireable<PropTypes.InferProps<{
|
|
40
42
|
value: PropTypes.Requireable<string>;
|
|
41
43
|
placeholder: PropTypes.Validator<string>;
|
|
@@ -62,8 +64,28 @@ declare const propTypes: {
|
|
|
62
64
|
onChange: PropTypes.Validator<(...args: any[]) => any>;
|
|
63
65
|
theme: PropTypes.Validator<string>;
|
|
64
66
|
ariaLabel: PropTypes.Validator<string>;
|
|
67
|
+
id: PropTypes.Requireable<string>;
|
|
65
68
|
}> | null | undefined)[]>;
|
|
66
69
|
}>>;
|
|
70
|
+
}> | PropTypes.InferProps<{
|
|
71
|
+
type: PropTypes.Requireable<string>;
|
|
72
|
+
options: PropTypes.Requireable<PropTypes.InferProps<{
|
|
73
|
+
title: PropTypes.Validator<string>;
|
|
74
|
+
titleAriaLabel: PropTypes.Requireable<string>;
|
|
75
|
+
onClear: PropTypes.Validator<(...args: any[]) => any>;
|
|
76
|
+
options: PropTypes.Requireable<PropTypes.InferProps<{
|
|
77
|
+
label: PropTypes.Validator<string>;
|
|
78
|
+
min: PropTypes.Validator<number>;
|
|
79
|
+
max: PropTypes.Validator<number>;
|
|
80
|
+
step: PropTypes.Requireable<number>;
|
|
81
|
+
value: PropTypes.Requireable<(number | null | undefined)[]>;
|
|
82
|
+
minLabel: PropTypes.Requireable<string>;
|
|
83
|
+
maxLabel: PropTypes.Requireable<string>;
|
|
84
|
+
onChange: PropTypes.Validator<(...args: any[]) => any>;
|
|
85
|
+
theme: PropTypes.Requireable<string>;
|
|
86
|
+
selected: PropTypes.Requireable<boolean>;
|
|
87
|
+
}>>;
|
|
88
|
+
}>>;
|
|
67
89
|
}> | null | undefined> | null | undefined)[]>;
|
|
68
90
|
};
|
|
69
91
|
export declare type OptionsChipProps = {
|
|
@@ -78,10 +100,15 @@ export declare type OptionsSwitchProps = {
|
|
|
78
100
|
type: 'switch';
|
|
79
101
|
options: FilterSwitchProps;
|
|
80
102
|
};
|
|
81
|
-
export declare type
|
|
103
|
+
export declare type OptionsRangeProps = {
|
|
104
|
+
type: 'range';
|
|
105
|
+
options: FilterRangeProps;
|
|
106
|
+
};
|
|
107
|
+
export declare type FilterOptionsProps = OptionsChipProps | OptionsCheckboxProps | OptionsSwitchProps | OptionsRangeProps;
|
|
108
|
+
export declare type SelectedFilter = FilterChipOptionsProps | FilterSwitchOptionsProps | FilterCheckboxAndSearchOptions | FilterRangeOptionsProps;
|
|
82
109
|
export declare type MultiFilterPanelProps = {
|
|
83
110
|
title: string;
|
|
84
|
-
onRemoveSelectedFilter?: (
|
|
111
|
+
onRemoveSelectedFilter?: (filterItem: SelectedFilter) => void;
|
|
85
112
|
onClearAll: () => void;
|
|
86
113
|
options: FilterOptionsProps[];
|
|
87
114
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"prop-types.d.ts","sourceRoot":"","sources":["../../../src/molecule/multi-filter-panel/prop-types.ts"],"names":[],"mappings":"AAAA,OAAO,SAAS,MAAM,YAAY,CAAC;AACnC,OAA4B,
|
|
1
|
+
{"version":3,"file":"prop-types.d.ts","sourceRoot":"","sources":["../../../src/molecule/multi-filter-panel/prop-types.ts"],"names":[],"mappings":"AAAA,OAAO,SAAS,MAAM,YAAY,CAAC;AACnC,OAA4B,EAC1B,sBAAsB,EACtB,eAAe,EAChB,MAAM,uCAAuC,CAAC;AAC/C,OAAyC,EACvC,8BAA8B,EAC9B,4BAA4B,EAC7B,MAAM,uDAAuD,CAAC;AAC/D,OAA8B,EAC5B,wBAAwB,EACxB,iBAAiB,EAClB,MAAM,yCAAyC,CAAC;AACjD,OAA6B,EAC3B,gBAAgB,EAChB,uBAAuB,EACxB,MAAM,wCAAwC,CAAC;AAEhD,QAAA,MAAM,SAAS;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAwBd,CAAC;AAEF,oBAAY,gBAAgB,GAAG;IAC7B,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,eAAe,CAAC;CAC1B,CAAC;AAEF,oBAAY,oBAAoB,GAAG;IACjC,IAAI,EAAE,UAAU,CAAC;IACjB,OAAO,EAAE,4BAA4B,CAAC;CACvC,CAAC;AAEF,oBAAY,kBAAkB,GAAG;IAC/B,IAAI,EAAE,QAAQ,CAAC;IACf,OAAO,EAAE,iBAAiB,CAAC;CAC5B,CAAC;AAEF,oBAAY,iBAAiB,GAAG;IAC9B,IAAI,EAAE,OAAO,CAAC;IACd,OAAO,EAAE,gBAAgB,CAAC;CAC3B,CAAC;AAEF,oBAAY,kBAAkB,GAC1B,gBAAgB,GAChB,oBAAoB,GACpB,kBAAkB,GAClB,iBAAiB,CAAC;AAEtB,oBAAY,cAAc,GACtB,sBAAsB,GACtB,wBAAwB,GACxB,8BAA8B,GAC9B,uBAAuB,CAAC;AAE5B,oBAAY,qBAAqB,GAAG;IAClC,KAAK,EAAE,MAAM,CAAC;IACd,sBAAsB,CAAC,EAAE,CAAC,UAAU,EAAE,cAAc,KAAK,IAAI,CAAC;IAC9D,UAAU,EAAE,MAAM,IAAI,CAAC;IACvB,OAAO,EAAE,kBAAkB,EAAE,CAAC;CAC/B,CAAC;AAEF,eAAe,SAAS,CAAC"}
|
|
@@ -2,6 +2,7 @@ import PropTypes from 'prop-types';
|
|
|
2
2
|
import filterChipProptypes from '../../organism/filter-chip/prop-types';
|
|
3
3
|
import filterCheckboxAndSearchProptypes from '../../organism/filter-checkbox-and-search/props-types';
|
|
4
4
|
import filterSwitchProptypes from '../../organism/filter-switch/prop-types';
|
|
5
|
+
import filterRangeProptypes from '../../organism/filter-range/prop-types';
|
|
5
6
|
const propTypes = {
|
|
6
7
|
title: PropTypes.string,
|
|
7
8
|
onClearAll: PropTypes.func,
|
|
@@ -15,6 +16,9 @@ const propTypes = {
|
|
|
15
16
|
}), PropTypes.shape({
|
|
16
17
|
type: PropTypes.oneOf(['switch']),
|
|
17
18
|
options: PropTypes.shape(filterSwitchProptypes)
|
|
19
|
+
}), PropTypes.shape({
|
|
20
|
+
type: PropTypes.oneOf(['range']),
|
|
21
|
+
options: PropTypes.shape(filterRangeProptypes)
|
|
18
22
|
})]))
|
|
19
23
|
};
|
|
20
24
|
export default propTypes;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"prop-types.js","names":["PropTypes","filterChipProptypes","filterCheckboxAndSearchProptypes","filterSwitchProptypes","propTypes","title","string","onClearAll","func","onRemoveSelectedFilter","options","arrayOf","oneOfType","shape","type","oneOf"],"sources":["../../../src/molecule/multi-filter-panel/prop-types.ts"],"sourcesContent":["import PropTypes from 'prop-types';\nimport filterChipProptypes, {FilterChipProps} from '../../organism/filter-chip/prop-types';\nimport filterCheckboxAndSearchProptypes, {\n FilterCheckboxAndSearchProps\n} from '../../organism/filter-checkbox-and-search/props-types';\nimport filterSwitchProptypes, {FilterSwitchProps} from '../../organism/filter-switch/prop-types';\n\nconst propTypes = {\n title: PropTypes.string,\n onClearAll: PropTypes.func,\n onRemoveSelectedFilter: PropTypes.func,\n options: PropTypes.arrayOf(\n PropTypes.oneOfType([\n PropTypes.shape({\n type: PropTypes.oneOf(['chip']),\n options: PropTypes.shape(filterChipProptypes)\n }),\n PropTypes.shape({\n type: PropTypes.oneOf(['checkbox']),\n options: PropTypes.shape(filterCheckboxAndSearchProptypes)\n }),\n PropTypes.shape({\n type: PropTypes.oneOf(['switch']),\n options: PropTypes.shape(filterSwitchProptypes)\n })\n ])\n )\n};\n\nexport type OptionsChipProps = {\n type: 'chip';\n options: FilterChipProps;\n};\n\nexport type OptionsCheckboxProps = {\n type: 'checkbox';\n options: FilterCheckboxAndSearchProps;\n};\n\nexport type OptionsSwitchProps = {\n type: 'switch';\n options: FilterSwitchProps;\n};\n\nexport type
|
|
1
|
+
{"version":3,"file":"prop-types.js","names":["PropTypes","filterChipProptypes","filterCheckboxAndSearchProptypes","filterSwitchProptypes","filterRangeProptypes","propTypes","title","string","onClearAll","func","onRemoveSelectedFilter","options","arrayOf","oneOfType","shape","type","oneOf"],"sources":["../../../src/molecule/multi-filter-panel/prop-types.ts"],"sourcesContent":["import PropTypes from 'prop-types';\nimport filterChipProptypes, {\n FilterChipOptionsProps,\n FilterChipProps\n} from '../../organism/filter-chip/prop-types';\nimport filterCheckboxAndSearchProptypes, {\n FilterCheckboxAndSearchOptions,\n FilterCheckboxAndSearchProps\n} from '../../organism/filter-checkbox-and-search/props-types';\nimport filterSwitchProptypes, {\n FilterSwitchOptionsProps,\n FilterSwitchProps\n} from '../../organism/filter-switch/prop-types';\nimport filterRangeProptypes, {\n FilterRangeProps,\n FilterRangeOptionsProps\n} from '../../organism/filter-range/prop-types';\n\nconst propTypes = {\n title: PropTypes.string,\n onClearAll: PropTypes.func,\n onRemoveSelectedFilter: PropTypes.func,\n options: PropTypes.arrayOf(\n PropTypes.oneOfType([\n PropTypes.shape({\n type: PropTypes.oneOf(['chip']),\n options: PropTypes.shape(filterChipProptypes)\n }),\n PropTypes.shape({\n type: PropTypes.oneOf(['checkbox']),\n options: PropTypes.shape(filterCheckboxAndSearchProptypes)\n }),\n PropTypes.shape({\n type: PropTypes.oneOf(['switch']),\n options: PropTypes.shape(filterSwitchProptypes)\n }),\n PropTypes.shape({\n type: PropTypes.oneOf(['range']),\n options: PropTypes.shape(filterRangeProptypes)\n })\n ])\n )\n};\n\nexport type OptionsChipProps = {\n type: 'chip';\n options: FilterChipProps;\n};\n\nexport type OptionsCheckboxProps = {\n type: 'checkbox';\n options: FilterCheckboxAndSearchProps;\n};\n\nexport type OptionsSwitchProps = {\n type: 'switch';\n options: FilterSwitchProps;\n};\n\nexport type OptionsRangeProps = {\n type: 'range';\n options: FilterRangeProps;\n};\n\nexport type FilterOptionsProps =\n | OptionsChipProps\n | OptionsCheckboxProps\n | OptionsSwitchProps\n | OptionsRangeProps;\n\nexport type SelectedFilter =\n | FilterChipOptionsProps\n | FilterSwitchOptionsProps\n | FilterCheckboxAndSearchOptions\n | FilterRangeOptionsProps;\n\nexport type MultiFilterPanelProps = {\n title: string;\n onRemoveSelectedFilter?: (filterItem: SelectedFilter) => void;\n onClearAll: () => void;\n options: FilterOptionsProps[];\n};\n\nexport default propTypes;\n"],"mappings":"AAAA,OAAOA,SAAS,MAAM,YAAY;AAClC,OAAOC,mBAAmB,MAGnB,uCAAuC;AAC9C,OAAOC,gCAAgC,MAGhC,uDAAuD;AAC9D,OAAOC,qBAAqB,MAGrB,yCAAyC;AAChD,OAAOC,oBAAoB,MAGpB,wCAAwC;AAE/C,MAAMC,SAAS,GAAG;EAChBC,KAAK,EAAEN,SAAS,CAACO,MAAM;EACvBC,UAAU,EAAER,SAAS,CAACS,IAAI;EAC1BC,sBAAsB,EAAEV,SAAS,CAACS,IAAI;EACtCE,OAAO,EAAEX,SAAS,CAACY,OAAO,CACxBZ,SAAS,CAACa,SAAS,CAAC,CAClBb,SAAS,CAACc,KAAK,CAAC;IACdC,IAAI,EAAEf,SAAS,CAACgB,KAAK,CAAC,CAAC,MAAM,CAAC,CAAC;IAC/BL,OAAO,EAAEX,SAAS,CAACc,KAAK,CAACb,mBAAmB;EAC9C,CAAC,CAAC,EACFD,SAAS,CAACc,KAAK,CAAC;IACdC,IAAI,EAAEf,SAAS,CAACgB,KAAK,CAAC,CAAC,UAAU,CAAC,CAAC;IACnCL,OAAO,EAAEX,SAAS,CAACc,KAAK,CAACZ,gCAAgC;EAC3D,CAAC,CAAC,EACFF,SAAS,CAACc,KAAK,CAAC;IACdC,IAAI,EAAEf,SAAS,CAACgB,KAAK,CAAC,CAAC,QAAQ,CAAC,CAAC;IACjCL,OAAO,EAAEX,SAAS,CAACc,KAAK,CAACX,qBAAqB;EAChD,CAAC,CAAC,EACFH,SAAS,CAACc,KAAK,CAAC;IACdC,IAAI,EAAEf,SAAS,CAACgB,KAAK,CAAC,CAAC,OAAO,CAAC,CAAC;IAChCL,OAAO,EAAEX,SAAS,CAACc,KAAK,CAACV,oBAAoB;EAC/C,CAAC,CAAC,CACH,CACH;AACF,CAAC;AAyCD,eAAeC,SAAS","ignoreList":[]}
|
|
@@ -32,6 +32,12 @@ declare namespace QuestionRange {
|
|
|
32
32
|
onChange: PropTypes.Requireable<(...args: any[]) => any>;
|
|
33
33
|
onChangeEnd: PropTypes.Requireable<(...args: any[]) => any>;
|
|
34
34
|
multi: PropTypes.Requireable<boolean>;
|
|
35
|
+
theme: PropTypes.Requireable<string>;
|
|
36
|
+
min: PropTypes.Requireable<number>;
|
|
37
|
+
max: PropTypes.Requireable<number>;
|
|
38
|
+
step: PropTypes.Requireable<number>;
|
|
39
|
+
minValueLabel: PropTypes.Requireable<string>;
|
|
40
|
+
maxValueLabel: PropTypes.Requireable<string>;
|
|
35
41
|
HammerForTestingMin: PropTypes.Requireable<PropTypes.InferProps<{
|
|
36
42
|
on: PropTypes.Requireable<(...args: any[]) => any>;
|
|
37
43
|
destroy: PropTypes.Requireable<(...args: any[]) => any>;
|
|
@@ -42,7 +48,6 @@ declare namespace QuestionRange {
|
|
|
42
48
|
destroy: PropTypes.Requireable<(...args: any[]) => any>;
|
|
43
49
|
stop: PropTypes.Requireable<(...args: any[]) => any>;
|
|
44
50
|
}>>;
|
|
45
|
-
value: PropTypes.Requireable<NonNullable<number | (number | null | undefined)[] | null | undefined>>;
|
|
46
51
|
};
|
|
47
52
|
}
|
|
48
53
|
import PropTypes from "prop-types";
|
|
@@ -175,7 +175,9 @@ const QuickFilters = ({
|
|
|
175
175
|
wrapperSize: 20
|
|
176
176
|
},
|
|
177
177
|
"aria-label": ariaLabel
|
|
178
|
-
}), /*#__PURE__*/React.createElement("span",
|
|
178
|
+
}), /*#__PURE__*/React.createElement("span", {
|
|
179
|
+
className: style.filterLabel
|
|
180
|
+
}, label), /*#__PURE__*/React.createElement("div", {
|
|
179
181
|
className: style.bar,
|
|
180
182
|
style: {
|
|
181
183
|
background: primarySkinColor
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["React","useCallback","useRef","useEffect","classNames","FaIcon","COLORS","ButtonLink","Provider","GetSkinFromContext","style","propTypes","SCROLL_RIGHT_SIZE","SCROLL_LEFT_SIZE","handleScroll","direction","listRef","current","scrollBy","left","behavior","getFilterButton","filterButtonProps","primarySkinColor","tag","rest","createElement","className","filterButtonWrapper","borderColor","label","filterButton","_extends","icon","position","faIcon","name","size","color","cm_grey_700","neutral_500","customStyle","backgroundColor","undefined","borderRadius","QuickFilters","primaryOption","filterOptions","filterOptionsAriaLabel","context","skin","_get","defaultLabel","defaultIconName","defaultSelected","defaultAriaLabel","onDefaultClick","filtersListRef","rightBtnRef","leftBtnRef","handleScrollRight","handleScrollLeft","list","rightButton","leftButton","update","rightArrowWidth","offsetWidth","showingRightButton","scrollLeft","clientWidth","scrollWidth","showingLeftButton","visibility","opacity","addEventListener","window","removeEventListener","filtersMainContainer","leftArrowButton","ref","onClick","height","filtersList","defaultOption","filterSelected","iconName","faSize","wrapperSize","filterLabel","bar","background","filterSeparator","filtersContainer","map","filterOption","idx","selected","value","ariaLabel","key","borderBottomColor","rightArrowButton","process","env","NODE_ENV","contextTypes","childContextTypes"],"sources":["../../../src/molecule/quick-filters/index.tsx"],"sourcesContent":["import React, {useCallback, useRef, useEffect} from 'react';\nimport classNames from 'classnames';\nimport {get} from 'lodash/fp';\nimport FaIcon from '../../atom/icon';\nimport {COLORS} from '../../variables/colors';\nimport ButtonLink from '../../atom/button-link';\nimport {ButtonLinkProps} from '../../atom/button-link/types';\nimport {WebContextValues} from '../../atom/provider/web-context';\nimport Provider, {GetSkinFromContext} from '../../atom/provider';\nimport style from './style.css';\nimport {QuickFiltersProps, propTypes} from './types';\n\nconst SCROLL_RIGHT_SIZE = 400;\nconst SCROLL_LEFT_SIZE = -400;\nexport const handleScroll = (direction: number, listRef: React.RefObject<HTMLDivElement>) => {\n if (listRef.current) {\n listRef.current.scrollBy({\n left: direction,\n behavior: 'smooth'\n });\n }\n};\n\nconst getFilterButton = (\n filterButtonProps: ButtonLinkProps | undefined,\n primarySkinColor: string\n) => {\n if (!filterButtonProps) return null;\n const {tag, ...rest} = filterButtonProps;\n return (\n <div\n className={style.filterButtonWrapper}\n style={{borderColor: tag?.label ? primarySkinColor : 'transparent'}}\n >\n <div className={style.filterButton}>\n <ButtonLink\n {...rest}\n icon={{\n position: 'left',\n faIcon: {\n name: 'sliders',\n size: 14,\n color: tag ? COLORS.cm_grey_700 : COLORS.neutral_500\n }\n }}\n tag={\n tag\n ? {\n label: tag.label,\n customStyle: {backgroundColor: primarySkinColor, color: '#FFFFFF'}\n }\n : undefined\n }\n className={style.filterButton}\n data-testid=\"open-filters-modal-button\"\n customStyle={{borderRadius: '12px'}}\n />\n </div>\n </div>\n );\n};\n\nconst QuickFilters = (\n {primaryOption, filterOptions, filterButton, filterOptionsAriaLabel}: QuickFiltersProps,\n context: WebContextValues\n) => {\n const skin = GetSkinFromContext(context);\n const primarySkinColor = get('common.primary', skin);\n const {defaultLabel, defaultIconName, defaultSelected, defaultAriaLabel, onDefaultClick} =\n primaryOption;\n const filtersListRef = React.useRef<HTMLDivElement>(null);\n const rightBtnRef = useRef<HTMLDivElement>(null);\n const leftBtnRef = useRef<HTMLDivElement>(null);\n\n const handleScrollRight = useCallback(() => {\n handleScroll(SCROLL_RIGHT_SIZE, filtersListRef);\n }, [filtersListRef]);\n const handleScrollLeft = useCallback(() => {\n handleScroll(SCROLL_LEFT_SIZE, filtersListRef);\n }, [filtersListRef]);\n useEffect(() => {\n const list = filtersListRef.current;\n const rightButton = rightBtnRef.current;\n const leftButton = leftBtnRef.current;\n /* istanbul ignore next */ // not testable without complex mocking useRef\n if (!list || !leftButton || !rightButton) return;\n\n const update = () => {\n const rightArrowWidth = rightButton.offsetWidth;\n const showingRightButton =\n list.scrollLeft + list.clientWidth < list.scrollWidth - rightArrowWidth;\n const showingLeftButton = list.scrollLeft > 0;\n rightButton.style.visibility = showingRightButton ? 'visible' : 'hidden';\n rightButton.style.opacity = showingRightButton ? '1' : '0';\n leftButton.style.visibility = showingLeftButton ? 'visible' : 'hidden';\n leftButton.style.opacity = showingLeftButton ? '1' : '0';\n };\n\n list.addEventListener('scroll', update);\n window.addEventListener('resize', update);\n update();\n return () => {\n list.removeEventListener('scroll', update);\n window.removeEventListener('resize', update);\n };\n }, [filterOptions]);\n\n return (\n <div className={style.filtersMainContainer} data-name=\"search\">\n <div className={style.leftArrowButton} ref={leftBtnRef} style={{visibility: 'hidden'}}>\n <ButtonLink\n icon={{position: 'left', faIcon: {name: 'arrow-left', size: 15}}}\n onClick={handleScrollLeft}\n className={style.leftArrowButton}\n customStyle={{height: '36px'}}\n data-testid=\"scroll-left-button\"\n />\n </div>\n <div\n className={style.filtersList}\n ref={filtersListRef}\n data-testid=\"filters-options-list\"\n aria-label={filterOptionsAriaLabel}\n >\n <div\n data-testid=\"all-option\"\n className={classNames(style.defaultOption, defaultSelected && style.filterSelected)}\n onClick={onDefaultClick}\n >\n <FaIcon\n iconName={defaultIconName}\n size={{faSize: 20, wrapperSize: 20}}\n aria-label={defaultAriaLabel}\n />\n <span className={style.filterLabel}>{defaultLabel}</span>\n <div className={style.bar} style={{background: primarySkinColor}} />\n </div>\n <div className={style.filterSeparator} />\n <div className={style.filtersContainer}>\n {filterOptions.map((filterOption, idx) => {\n const {iconName, label, selected, value, onClick, ariaLabel} = filterOption;\n return (\n <div\n key={idx}\n className={classNames(style.filterOption, selected && style.filterSelected)}\n data-testid={`filter-${value}-${idx}`}\n style={{borderBottomColor: primarySkinColor}}\n onClick={onClick}\n >\n <FaIcon\n iconName={iconName}\n size={{faSize: 20, wrapperSize: 20}}\n aria-label={ariaLabel}\n />\n <span>{label}</span>\n <div className={style.bar} style={{background: primarySkinColor}} />\n </div>\n );\n })}\n <div className={style.rightArrowButton} ref={rightBtnRef} style={{visibility: 'hidden'}}>\n <ButtonLink\n icon={{\n position: 'left',\n faIcon: {\n name: 'arrow-right',\n size: 15\n }\n }}\n className={style.rightArrowButton}\n onClick={handleScrollRight}\n customStyle={{height: '36px'}}\n data-testid=\"scroll-right-button\"\n />\n </div>\n </div>\n </div>\n {getFilterButton(filterButton, primarySkinColor)}\n </div>\n );\n};\n\nQuickFilters.propTypes = propTypes;\nQuickFilters.contextTypes = {\n skin: Provider.childContextTypes.skin\n};\nexport default QuickFilters;\n"],"mappings":";;AAAA,OAAOA,KAAK,IAAGC,WAAW,EAAEC,MAAM,EAAEC,SAAS,QAAO,OAAO;AAC3D,OAAOC,UAAU,MAAM,YAAY;AAEnC,OAAOC,MAAM,MAAM,iBAAiB;AACpC,SAAQC,MAAM,QAAO,wBAAwB;AAC7C,OAAOC,UAAU,MAAM,wBAAwB;AAG/C,OAAOC,QAAQ,IAAGC,kBAAkB,QA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AqB,CAClC,CACE,CACF,CACF,CAAC,EACL7D,eAAe,CAACU,YAAY,EAAER,gBAAgB,CAC5C,CAAC;AAEV,CAAC;AAEDsB,YAAY,CAAClC,SAAS,GAAA4F,OAAA,CAAAC,GAAA,CAAAC,QAAA,oBAAG9F,SAAS;AAClCkC,YAAY,CAAC6D,YAAY,GAAG;EAC1BxD,IAAI,EAAE1C,QAAQ,CAACmG,iBAAiB,CAACzD;AACnC,CAAC;AACD,eAAeL,YAAY","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"index.js","names":["React","useCallback","useRef","useEffect","classNames","FaIcon","COLORS","ButtonLink","Provider","GetSkinFromContext","style","propTypes","SCROLL_RIGHT_SIZE","SCROLL_LEFT_SIZE","handleScroll","direction","listRef","current","scrollBy","left","behavior","getFilterButton","filterButtonProps","primarySkinColor","tag","rest","createElement","className","filterButtonWrapper","borderColor","label","filterButton","_extends","icon","position","faIcon","name","size","color","cm_grey_700","neutral_500","customStyle","backgroundColor","undefined","borderRadius","QuickFilters","primaryOption","filterOptions","filterOptionsAriaLabel","context","skin","_get","defaultLabel","defaultIconName","defaultSelected","defaultAriaLabel","onDefaultClick","filtersListRef","rightBtnRef","leftBtnRef","handleScrollRight","handleScrollLeft","list","rightButton","leftButton","update","rightArrowWidth","offsetWidth","showingRightButton","scrollLeft","clientWidth","scrollWidth","showingLeftButton","visibility","opacity","addEventListener","window","removeEventListener","filtersMainContainer","leftArrowButton","ref","onClick","height","filtersList","defaultOption","filterSelected","iconName","faSize","wrapperSize","filterLabel","bar","background","filterSeparator","filtersContainer","map","filterOption","idx","selected","value","ariaLabel","key","borderBottomColor","rightArrowButton","process","env","NODE_ENV","contextTypes","childContextTypes"],"sources":["../../../src/molecule/quick-filters/index.tsx"],"sourcesContent":["import React, {useCallback, useRef, useEffect} from 'react';\nimport classNames from 'classnames';\nimport {get} from 'lodash/fp';\nimport FaIcon from '../../atom/icon';\nimport {COLORS} from '../../variables/colors';\nimport ButtonLink from '../../atom/button-link';\nimport {ButtonLinkProps} from '../../atom/button-link/types';\nimport {WebContextValues} from '../../atom/provider/web-context';\nimport Provider, {GetSkinFromContext} from '../../atom/provider';\nimport style from './style.css';\nimport {QuickFiltersProps, propTypes} from './types';\n\nconst SCROLL_RIGHT_SIZE = 400;\nconst SCROLL_LEFT_SIZE = -400;\nexport const handleScroll = (direction: number, listRef: React.RefObject<HTMLDivElement>) => {\n if (listRef.current) {\n listRef.current.scrollBy({\n left: direction,\n behavior: 'smooth'\n });\n }\n};\n\nconst getFilterButton = (\n filterButtonProps: ButtonLinkProps | undefined,\n primarySkinColor: string\n) => {\n if (!filterButtonProps) return null;\n const {tag, ...rest} = filterButtonProps;\n return (\n <div\n className={style.filterButtonWrapper}\n style={{borderColor: tag?.label ? primarySkinColor : 'transparent'}}\n >\n <div className={style.filterButton}>\n <ButtonLink\n {...rest}\n icon={{\n position: 'left',\n faIcon: {\n name: 'sliders',\n size: 14,\n color: tag ? COLORS.cm_grey_700 : COLORS.neutral_500\n }\n }}\n tag={\n tag\n ? {\n label: tag.label,\n customStyle: {backgroundColor: primarySkinColor, color: '#FFFFFF'}\n }\n : undefined\n }\n className={style.filterButton}\n data-testid=\"open-filters-modal-button\"\n customStyle={{borderRadius: '12px'}}\n />\n </div>\n </div>\n );\n};\n\nconst QuickFilters = (\n {primaryOption, filterOptions, filterButton, filterOptionsAriaLabel}: QuickFiltersProps,\n context: WebContextValues\n) => {\n const skin = GetSkinFromContext(context);\n const primarySkinColor = get('common.primary', skin);\n const {defaultLabel, defaultIconName, defaultSelected, defaultAriaLabel, onDefaultClick} =\n primaryOption;\n const filtersListRef = React.useRef<HTMLDivElement>(null);\n const rightBtnRef = useRef<HTMLDivElement>(null);\n const leftBtnRef = useRef<HTMLDivElement>(null);\n\n const handleScrollRight = useCallback(() => {\n handleScroll(SCROLL_RIGHT_SIZE, filtersListRef);\n }, [filtersListRef]);\n const handleScrollLeft = useCallback(() => {\n handleScroll(SCROLL_LEFT_SIZE, filtersListRef);\n }, [filtersListRef]);\n useEffect(() => {\n const list = filtersListRef.current;\n const rightButton = rightBtnRef.current;\n const leftButton = leftBtnRef.current;\n /* istanbul ignore next */ // not testable without complex mocking useRef\n if (!list || !leftButton || !rightButton) return;\n\n const update = () => {\n const rightArrowWidth = rightButton.offsetWidth;\n const showingRightButton =\n list.scrollLeft + list.clientWidth < list.scrollWidth - rightArrowWidth;\n const showingLeftButton = list.scrollLeft > 0;\n rightButton.style.visibility = showingRightButton ? 'visible' : 'hidden';\n rightButton.style.opacity = showingRightButton ? '1' : '0';\n leftButton.style.visibility = showingLeftButton ? 'visible' : 'hidden';\n leftButton.style.opacity = showingLeftButton ? '1' : '0';\n };\n\n list.addEventListener('scroll', update);\n window.addEventListener('resize', update);\n update();\n return () => {\n list.removeEventListener('scroll', update);\n window.removeEventListener('resize', update);\n };\n }, [filterOptions]);\n\n return (\n <div className={style.filtersMainContainer} data-name=\"search\">\n <div className={style.leftArrowButton} ref={leftBtnRef} style={{visibility: 'hidden'}}>\n <ButtonLink\n icon={{position: 'left', faIcon: {name: 'arrow-left', size: 15}}}\n onClick={handleScrollLeft}\n className={style.leftArrowButton}\n customStyle={{height: '36px'}}\n data-testid=\"scroll-left-button\"\n />\n </div>\n <div\n className={style.filtersList}\n ref={filtersListRef}\n data-testid=\"filters-options-list\"\n aria-label={filterOptionsAriaLabel}\n >\n <div\n data-testid=\"all-option\"\n className={classNames(style.defaultOption, defaultSelected && style.filterSelected)}\n onClick={onDefaultClick}\n >\n <FaIcon\n iconName={defaultIconName}\n size={{faSize: 20, wrapperSize: 20}}\n aria-label={defaultAriaLabel}\n />\n <span className={style.filterLabel}>{defaultLabel}</span>\n <div className={style.bar} style={{background: primarySkinColor}} />\n </div>\n <div className={style.filterSeparator} />\n <div className={style.filtersContainer}>\n {filterOptions.map((filterOption, idx) => {\n const {iconName, label, selected, value, onClick, ariaLabel} = filterOption;\n return (\n <div\n key={idx}\n className={classNames(style.filterOption, selected && style.filterSelected)}\n data-testid={`filter-${value}-${idx}`}\n style={{borderBottomColor: primarySkinColor}}\n onClick={onClick}\n >\n <FaIcon\n iconName={iconName}\n size={{faSize: 20, wrapperSize: 20}}\n aria-label={ariaLabel}\n />\n <span className={style.filterLabel}>{label}</span>\n <div className={style.bar} style={{background: primarySkinColor}} />\n </div>\n );\n })}\n <div className={style.rightArrowButton} ref={rightBtnRef} style={{visibility: 'hidden'}}>\n <ButtonLink\n icon={{\n position: 'left',\n faIcon: {\n name: 'arrow-right',\n size: 15\n }\n }}\n className={style.rightArrowButton}\n onClick={handleScrollRight}\n customStyle={{height: '36px'}}\n data-testid=\"scroll-right-button\"\n />\n </div>\n </div>\n </div>\n {getFilterButton(filterButton, primarySkinColor)}\n </div>\n );\n};\n\nQuickFilters.propTypes = propTypes;\nQuickFilters.contextTypes = {\n skin: Provider.childContextTypes.skin\n};\nexport default QuickFilters;\n"],"mappings":";;AAAA,OAAOA,KAAK,IAAGC,WAAW,EAAEC,MAAM,EAAEC,SAAS,QAAO,OAAO;AAC3D,OAAOC,UAAU,MAAM,YAAY;AAEnC,OAAOC,MAAM,MAAM,iBAAiB;AACpC,SAAQC,MAAM,QAAO,wBAAwB;AAC7C,OAAOC,UAAU,MAAM,wBAAwB;AAG/C,OAAOC,QAAQ,IAAGC,kBAAkB,QAAO,qBAAqB;AAChE,OAAOC,KAAK,MAAM,aAAa;AAC/B,SAA2BC,SAAS,QAAO,SAAS;AAEpD,MAAMC,iBAAiB,GAAG,GAAG;AAC7B,MAAMC,gBAAgB,GAAG,CAAC,GAAG;AAC7B,OAAO,MAAMC,YAAY,GAAGA,CAACC,SAAiB,EAAEC,OAAwC,KAAK;EAC3F,IAAIA,OAAO,CAACC,OAAO,EAAE;IACnBD,OAAO,CAACC,OAAO,CAACC,QAAQ,CAAC;MACvBC,IAAI,EAAEJ,SAAS;MACfK,QAAQ,EAAE;IACZ,CAAC,CAAC;EACJ;AACF,CAAC;AAED,MAAMC,eAAe,GAAGA,CACtBC,iBAA8C,EAC9CC,g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;
|
|
116
|
+
user-select: none;
|
|
117
|
+
text-align: center;
|
|
116
118
|
}
|
|
117
119
|
|
|
118
120
|
.filterSeparator {
|
|
@@ -190,10 +192,13 @@
|
|
|
190
192
|
}
|
|
191
193
|
|
|
192
194
|
@media mobile {
|
|
193
|
-
.leftArrowButton, .rightArrowButton
|
|
195
|
+
.leftArrowButton, .rightArrowButton {
|
|
194
196
|
display: none!important;
|
|
195
197
|
}
|
|
196
|
-
|
|
198
|
+
.filtersMainContainer {
|
|
199
|
+
margin: 0px;
|
|
200
|
+
padding: 20px 0px 0px 0px;
|
|
201
|
+
}
|
|
197
202
|
.filtersList{
|
|
198
203
|
margin-right: 0;
|
|
199
204
|
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
export default Tabs;
|
|
2
|
+
declare function Tabs(props: any, context: any): JSX.Element;
|
|
3
|
+
declare namespace Tabs {
|
|
4
|
+
namespace contextTypes {
|
|
5
|
+
const skin: PropTypes.Requireable<PropTypes.InferProps<{
|
|
6
|
+
common: PropTypes.Requireable<{
|
|
7
|
+
[x: string]: any;
|
|
8
|
+
}>;
|
|
9
|
+
images: PropTypes.Requireable<PropTypes.InferProps<{
|
|
10
|
+
'logo-mobile': PropTypes.Requireable<any>;
|
|
11
|
+
logo: PropTypes.Requireable<any>;
|
|
12
|
+
'logo-email': PropTypes.Requireable<any>;
|
|
13
|
+
login: PropTypes.Requireable<any>;
|
|
14
|
+
}>>;
|
|
15
|
+
icons: PropTypes.Requireable<{
|
|
16
|
+
[x: string]: any;
|
|
17
|
+
}>;
|
|
18
|
+
mod: PropTypes.Requireable<{
|
|
19
|
+
[x: string]: any;
|
|
20
|
+
}>;
|
|
21
|
+
courses: PropTypes.Requireable<any[]>;
|
|
22
|
+
texts: PropTypes.Requireable<{
|
|
23
|
+
[x: string]: any;
|
|
24
|
+
}>;
|
|
25
|
+
}>>;
|
|
26
|
+
const translate: PropTypes.Requireable<(...args: any[]) => any>;
|
|
27
|
+
}
|
|
28
|
+
namespace propTypes {
|
|
29
|
+
const items: PropTypes.Requireable<(PropTypes.InferProps<{
|
|
30
|
+
title: PropTypes.Requireable<string>;
|
|
31
|
+
count: PropTypes.Requireable<number>;
|
|
32
|
+
'aria-label': PropTypes.Requireable<string>;
|
|
33
|
+
onClick: PropTypes.Requireable<(...args: any[]) => any>;
|
|
34
|
+
isActive: PropTypes.Requireable<boolean>;
|
|
35
|
+
}> | null | undefined)[]>;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
import PropTypes from "prop-types";
|
|
39
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/molecule/tabs/index.js"],"names":[],"mappings":";AAeA,6DAkDC"}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { convert } from 'css-color-function';
|
|
3
|
+
import PropTypes from 'prop-types';
|
|
4
|
+
import getOr from 'lodash/fp/getOr';
|
|
5
|
+
import Provider from '../../atom/provider';
|
|
6
|
+
import { COLORS } from '../../variables/colors';
|
|
7
|
+
import Tag from '../../atom/tag';
|
|
8
|
+
import style from './style.css';
|
|
9
|
+
const handleTabClick = tab => e => {
|
|
10
|
+
if (tab && typeof tab.onClick === 'function') tab.onClick(e);
|
|
11
|
+
};
|
|
12
|
+
const handleTabKeyDown = tab => e => {
|
|
13
|
+
if (e.key === 'Enter') handleTabClick(tab)(e);
|
|
14
|
+
};
|
|
15
|
+
const Tabs = (props, context) => {
|
|
16
|
+
const {
|
|
17
|
+
items = []
|
|
18
|
+
} = props;
|
|
19
|
+
const {
|
|
20
|
+
skin
|
|
21
|
+
} = context;
|
|
22
|
+
const primaryColor = getOr('#00B0FF', 'common.primary', skin);
|
|
23
|
+
const createTab = (index, tab) => {
|
|
24
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
25
|
+
key: index,
|
|
26
|
+
className: style.tab,
|
|
27
|
+
role: "tab",
|
|
28
|
+
tabIndex: 0,
|
|
29
|
+
"aria-selected": tab.isActive,
|
|
30
|
+
"aria-label": tab['aria-label'] || tab.title,
|
|
31
|
+
onClick: handleTabClick(tab),
|
|
32
|
+
onKeyDown: handleTabKeyDown(tab),
|
|
33
|
+
style: {
|
|
34
|
+
'--hover-bg': convert(`color(${tab.isActive ? primaryColor : COLORS.cm_grey_500} a(0.15))`),
|
|
35
|
+
'--bg': tab.isActive ? convert(`color(${primaryColor} a(0.07))`) : 'transparent',
|
|
36
|
+
color: tab.isActive ? primaryColor : COLORS.cm_grey_500
|
|
37
|
+
}
|
|
38
|
+
}, /*#__PURE__*/React.createElement("span", null, tab.title), typeof tab.count === 'number' ? /*#__PURE__*/React.createElement(Tag, {
|
|
39
|
+
label: tab.count.toString(),
|
|
40
|
+
type: "default",
|
|
41
|
+
size: "S",
|
|
42
|
+
customStyle: {
|
|
43
|
+
backgroundColor: tab.isActive ? convert(`color(${primaryColor} a(0.25))`) : COLORS.cm_grey_200,
|
|
44
|
+
color: tab.isActive ? primaryColor : COLORS.cm_grey_500
|
|
45
|
+
}
|
|
46
|
+
}) : null);
|
|
47
|
+
};
|
|
48
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
49
|
+
className: style.tabs,
|
|
50
|
+
role: "tablist"
|
|
51
|
+
}, items && items.map((tab, index) => {
|
|
52
|
+
return createTab(index, tab);
|
|
53
|
+
}));
|
|
54
|
+
};
|
|
55
|
+
Tabs.contextTypes = {
|
|
56
|
+
skin: Provider.childContextTypes.skin,
|
|
57
|
+
translate: Provider.childContextTypes.translate
|
|
58
|
+
};
|
|
59
|
+
Tabs.propTypes = process.env.NODE_ENV !== "production" ? {
|
|
60
|
+
items: PropTypes.arrayOf(PropTypes.shape({
|
|
61
|
+
title: PropTypes.string,
|
|
62
|
+
count: PropTypes.number,
|
|
63
|
+
'aria-label': PropTypes.string,
|
|
64
|
+
onClick: PropTypes.func,
|
|
65
|
+
isActive: PropTypes.bool
|
|
66
|
+
}))
|
|
67
|
+
} : {};
|
|
68
|
+
export default Tabs;
|
|
69
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","names":["React","convert","PropTypes","getOr","Provider","COLORS","Tag","style","handleTabClick","tab","e","onClick","handleTabKeyDown","key","Tabs","props","context","items","skin","primaryColor","createTab","index","createElement","className","role","tabIndex","isActive","title","onKeyDown","cm_grey_500","color","count","label","toString","type","size","customStyle","backgroundColor","cm_grey_200","tabs","map","contextTypes","childContextTypes","translate","propTypes","process","env","NODE_ENV","arrayOf","shape","string","number","func","bool"],"sources":["../../../src/molecule/tabs/index.js"],"sourcesContent":["import React from 'react';\nimport {convert} from 'css-color-function';\nimport PropTypes from 'prop-types';\nimport getOr from 'lodash/fp/getOr';\nimport Provider from '../../atom/provider';\nimport {COLORS} from '../../variables/colors';\nimport Tag from '../../atom/tag';\nimport style from './style.css';\n\nconst handleTabClick = tab => e => {\n if (tab && typeof tab.onClick === 'function') tab.onClick(e);\n};\nconst handleTabKeyDown = tab => e => {\n if (e.key === 'Enter') handleTabClick(tab)(e);\n};\nconst Tabs = (props, context) => {\n const {items = []} = props;\n const {skin} = context;\n const primaryColor = getOr('#00B0FF', 'common.primary', skin);\n\n const createTab = (index, tab) => {\n return (\n <div\n key={index}\n className={style.tab}\n role=\"tab\"\n tabIndex={0}\n aria-selected={tab.isActive}\n aria-label={tab['aria-label'] || tab.title}\n onClick={handleTabClick(tab)}\n onKeyDown={handleTabKeyDown(tab)}\n style={{\n '--hover-bg': convert(\n `color(${tab.isActive ? primaryColor : COLORS.cm_grey_500} a(0.15))`\n ),\n '--bg': tab.isActive ? convert(`color(${primaryColor} a(0.07))`) : 'transparent',\n color: tab.isActive ? primaryColor : COLORS.cm_grey_500\n }}\n >\n <span>{tab.title}</span>\n {typeof tab.count === 'number' ? (\n <Tag\n label={tab.count.toString()}\n type=\"default\"\n size=\"S\"\n customStyle={{\n backgroundColor: tab.isActive\n ? convert(`color(${primaryColor} a(0.25))`)\n : COLORS.cm_grey_200,\n color: tab.isActive ? primaryColor : COLORS.cm_grey_500\n }}\n />\n ) : null}\n </div>\n );\n };\n\n return (\n <div className={style.tabs} role=\"tablist\">\n {items &&\n items.map((tab, index) => {\n return createTab(index, tab);\n })}\n </div>\n );\n};\n\nTabs.contextTypes = {\n skin: Provider.childContextTypes.skin,\n translate: Provider.childContextTypes.translate\n};\n\nTabs.propTypes = {\n items: PropTypes.arrayOf(\n PropTypes.shape({\n title: PropTypes.string,\n count: PropTypes.number,\n 'aria-label': PropTypes.string,\n onClick: PropTypes.func,\n isActive: PropTypes.bool\n })\n )\n};\n\nexport default Tabs;\n"],"mappings":"AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,SAAQC,OAAO,QAAO,oBAAoB;AAC1C,OAAOC,SAAS,MAAM,YAAY;AAClC,OAAOC,KAAK,MAAM,iBAAiB;AACnC,OAAOC,QAAQ,MAAM,qBAAqB;AAC1C,SAAQC,MAAM,QAAO,wBAAwB;AAC7C,OAAOC,GAAG,MAAM,gBAAgB;AAChC,OAAOC,KAAK,MAAM,aAAa;AAE/B,MAAMC,cAAc,GAAGC,GAAG,IAAIC,CAAC,IAAI;EACjC,IAAID,GAAG,IAAI,OAAOA,GAAG,CAACE,OAAO,KAAK,UAAU,EAAEF,GAAG,CAACE,OAAO,CAACD,CAAC,CAAC;AAC9D,CAAC;AACD,MAAME,gBAAgB,GAAGH,GAAG,IAAIC,CAAC,IAAI;EACnC,IAAIA,CAAC,CAACG,GAAG,KAAK,OAAO,EAAEL,cAAc,CAACC,GAAG,CAAC,CAACC,CAAC,CAAC;AAC/C,CAAC;AACD,MAAMI,IAAI,GAAGA,CAACC,KAAK,EAAEC,OAAO,KAAK;EAC/B,MAAM;IAACC,KAAK,GAAG;EAAE,CAAC,GAAGF,KAAK;EAC1B,MAAM;IAACG;EAAI,CAAC,GAAGF,OAAO;EACtB,MAAMG,YAAY,GAAGhB,KAAK,CAAC,SAAS,EA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