@bethinkpl/design-system 18.7.4 → 18.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (69) hide show
  1. package/dist/design-system.umd.js +299 -148
  2. package/dist/design-system.umd.js.map +1 -1
  3. package/dist/lib/js/components/Badges/Badge/Badge.consts.d.ts +1 -0
  4. package/dist/lib/js/components/Badges/Badge/Badge.vue.d.ts +21 -1
  5. package/dist/lib/js/components/Banner/Banner.vue.d.ts +1 -0
  6. package/dist/lib/js/components/Buttons/Button/Button.vue.d.ts +2 -0
  7. package/dist/lib/js/components/Buttons/IconButton/IconButton.vue.d.ts +1 -0
  8. package/dist/lib/js/components/Cards/CardExpandable/CardExpandable.vue.d.ts +1 -0
  9. package/dist/lib/js/components/Drawer/DrawerContent/DrawerContent.vue.d.ts +4 -3
  10. package/dist/lib/js/components/Drawer/DrawerDivider/DrawerDivider.vue.d.ts +20 -3
  11. package/dist/lib/js/components/Drawer/DrawerListItemGroup/DrawerListItemGroup.vue.d.ts +4 -3
  12. package/dist/lib/js/components/Drawer/DrawerSection/DrawerSection.vue.d.ts +231 -3
  13. package/dist/lib/js/components/Drawer/DrawerTile/DrawerTile.vue.d.ts +63 -3
  14. package/dist/lib/js/components/Form/Checkbox/Checkbox.vue.d.ts +1 -0
  15. package/dist/lib/js/components/Form/RadioButton/RadioButton.vue.d.ts +1 -0
  16. package/dist/lib/js/components/Headers/OverlayHeader/OverlayHeader.vue.d.ts +1 -0
  17. package/dist/lib/js/components/Headers/SectionHeader/SectionHeader.vue.d.ts +1 -0
  18. package/dist/lib/js/components/Icons/Icon/Icon.consts.d.ts +1 -0
  19. package/dist/lib/js/components/Modal/Modal.vue.d.ts +1 -0
  20. package/dist/lib/js/components/Modals/Modal/Modal.vue.d.ts +1 -0
  21. package/dist/lib/js/components/Outline/OutlineItem/OutlineItem.vue.d.ts +1 -0
  22. package/dist/lib/js/components/Pagination/Pagination.vue.d.ts +1 -0
  23. package/dist/lib/js/components/Pill/Pill.vue.d.ts +1 -0
  24. package/dist/lib/js/components/ProgressBar/ProgressBar.vue.d.ts +1 -0
  25. package/dist/lib/js/components/ProgressDonutChart/ProgressDonutChart.vue.d.ts +1 -0
  26. package/dist/lib/js/components/RichList/RichListItem/RichListItem.consts.d.ts +53 -0
  27. package/dist/lib/js/components/RichList/RichListItem/RichListItem.stories.d.ts +5 -0
  28. package/dist/lib/js/components/RichList/RichListItem/index.d.ts +3 -0
  29. package/dist/lib/js/components/RichList/RichListItemBasic/RichListItemBasic.stories.d.ts +5 -0
  30. package/dist/lib/js/components/RichList/RichListItemBasic/index.d.ts +2 -0
  31. package/dist/lib/js/components/SelectList/SelectListItemTile/SelectListItemTile.vue.d.ts +62 -3
  32. package/dist/lib/js/components/SelectList/SelectListItemToggle/SelectListItemToggle.vue.d.ts +58 -3
  33. package/dist/lib/js/components/SelectList/SelectListSectionTitle/SelectListSectionTitle.vue.d.ts +14 -3
  34. package/dist/lib/js/components/SelectionTile/SelectionTile.vue.d.ts +1 -0
  35. package/dist/lib/js/components/Statuses/AccessStatus/AccessStatus.vue.d.ts +1 -0
  36. package/dist/lib/js/components/Statuses/BlockadeStatus/BlockadeStatus.vue.d.ts +1 -0
  37. package/dist/lib/js/components/SurveyQuestions/SurveyQuestion.consts.d.ts +4 -0
  38. package/dist/lib/js/components/SurveyQuestions/SurveyQuestionOpenEnded/SurveyQuestionOpenEnded.vue.d.ts +1 -0
  39. package/dist/lib/js/components/SurveyQuestions/SurveyQuestionScale/SurveyQuestionScale.vue.d.ts +13 -0
  40. package/dist/lib/js/components/Tile/Tile.sb.shared.d.ts +1 -0
  41. package/dist/lib/js/components/Tile/Tile.vue.d.ts +1 -0
  42. package/dist/lib/js/components/Toggles/ToggleButton/ToggleButton.vue.d.ts +1 -0
  43. package/dist/lib/js/icons/fontawesome.d.ts +1 -0
  44. package/docs/988.4ee26573.iframe.bundle.js +2 -0
  45. package/docs/iframe.html +1 -1
  46. package/docs/main.b20a2704.iframe.bundle.js +1 -0
  47. package/docs/project.json +1 -1
  48. package/lib/js/components/Badges/Badge/Badge.consts.ts +1 -0
  49. package/lib/js/components/Badges/Badge/Badge.stories.ts +11 -2
  50. package/lib/js/components/Badges/Badge/Badge.vue +44 -4
  51. package/lib/js/components/Buttons/Button/Button.vue +9 -3
  52. package/lib/js/components/Drawer/DrawerHeader/DrawerHeader.vue +1 -1
  53. package/lib/js/components/Outline/OutlineItem/OutlineItem.stories.ts +10 -8
  54. package/lib/js/components/Outline/OutlineItem/OutlineItem.vue +7 -3
  55. package/lib/js/components/RichList/RichListItem/RichListItem.consts.ts +64 -0
  56. package/lib/js/components/RichList/RichListItem/RichListItem.stories.ts +136 -0
  57. package/lib/js/components/RichList/RichListItem/RichListItem.vue +459 -0
  58. package/lib/js/components/RichList/RichListItem/index.ts +4 -0
  59. package/lib/js/components/RichList/RichListItemBasic/RichListItemBasic.stories.ts +137 -0
  60. package/lib/js/components/RichList/RichListItemBasic/RichListItemBasic.vue +176 -0
  61. package/lib/js/components/RichList/RichListItemBasic/index.ts +3 -0
  62. package/lib/js/components/SurveyQuestions/SurveyQuestion.consts.ts +5 -0
  63. package/lib/js/components/SurveyQuestions/SurveyQuestionScale/SurveyQuestionScale.stories.ts +72 -52
  64. package/lib/js/components/SurveyQuestions/SurveyQuestionScale/SurveyQuestionScale.vue +127 -42
  65. package/lib/js/icons/fontawesome.ts +2 -0
  66. package/package.json +2 -2
  67. package/docs/48.83e0f3f5.iframe.bundle.js +0 -2
  68. package/docs/main.a0cde6ec.iframe.bundle.js +0 -1
  69. /package/docs/{48.83e0f3f5.iframe.bundle.js.LICENSE.txt → 988.4ee26573.iframe.bundle.js.LICENSE.txt} +0 -0
@@ -0,0 +1,176 @@
1
+ <template>
2
+ <rich-list-item
3
+ :size="size"
4
+ :type="type"
5
+ :is-interactive="isInteractive"
6
+ :is-draggable="isDraggable"
7
+ :icon="icon"
8
+ :icon-color="iconColor"
9
+ :icon-color-hex="iconColorHex"
10
+ :is-dimmed="isDimmed"
11
+ :border-color="borderColor"
12
+ :border-color-hex="borderColorHex"
13
+ :state="state"
14
+ class="richListItemBasic"
15
+ >
16
+ <template #content>
17
+ <div class="richListItemBasic__content">
18
+ <div
19
+ class="richListItemBasic__eyebrow"
20
+ :class="{ '-uppercase': isEyebrowUppercase }"
21
+ >
22
+ {{ eyebrow }}
23
+ </div>
24
+
25
+ <div class="richListItemBasic__text">
26
+ {{ text }}
27
+ </div>
28
+ </div>
29
+ </template>
30
+ <template v-if="$slots.meta" #meta>
31
+ <slot name="meta" />
32
+ </template>
33
+ <template v-if="$slots.trailing" #trailing>
34
+ <slot name="trailing" />
35
+ </template>
36
+ </rich-list-item>
37
+ </template>
38
+
39
+ <style scoped lang="scss">
40
+ @import '../../../../styles/settings/colors/tokens';
41
+ @import '../../../../styles/settings/typography/tokens';
42
+ @import '../../../../styles/settings/spacings';
43
+
44
+ .richListItemBasic {
45
+ max-width: 100%;
46
+
47
+ &__content {
48
+ display: flex;
49
+ flex-direction: column;
50
+ gap: $space-xxxxs;
51
+ justify-content: center;
52
+ min-width: 0; // to prevent the component from being pushed by the ellipses
53
+ padding: $space-xxs 0;
54
+ }
55
+
56
+ &__eyebrow {
57
+ @include info-s-extensive-bold;
58
+
59
+ color: $color-neutral-text-weak;
60
+ min-width: 0;
61
+ overflow: hidden;
62
+ text-overflow: ellipsis;
63
+ white-space: nowrap;
64
+
65
+ &.-uppercase {
66
+ @include info-s-extensive-bold-uppercase;
67
+ }
68
+ }
69
+
70
+ &__text {
71
+ @include text-m-compact-bold;
72
+
73
+ color: $color-neutral-text;
74
+ min-width: 0;
75
+ overflow: hidden;
76
+ text-overflow: ellipsis;
77
+ white-space: nowrap;
78
+ }
79
+ }
80
+ </style>
81
+
82
+ <script lang="ts">
83
+ import RichListItem, {
84
+ RICH_LIST_ITEM_BORDER_COLOR,
85
+ RICH_LIST_ITEM_ICON_COLOR,
86
+ RICH_LIST_ITEM_SIZE,
87
+ RICH_LIST_ITEM_STATE,
88
+ RICH_LIST_ITEM_TYPE,
89
+ RichListItemBorderColor,
90
+ RichListItemIconColor,
91
+ RichListItemSize,
92
+ RichListItemState,
93
+ RichListItemType,
94
+ } from '../RichListItem';
95
+ import { PropType } from 'vue';
96
+
97
+ export default {
98
+ name: 'RichListItemBasic',
99
+ components: {
100
+ RichListItem,
101
+ },
102
+ props: {
103
+ type: {
104
+ type: String as PropType<RichListItemType>,
105
+ default: RICH_LIST_ITEM_TYPE.DEFAULT,
106
+ validator(type) {
107
+ return Object.values(RICH_LIST_ITEM_TYPE).includes(type);
108
+ },
109
+ },
110
+ state: {
111
+ type: String as PropType<RichListItemState>,
112
+ default: RICH_LIST_ITEM_STATE.DEFAULT,
113
+ validator(state) {
114
+ return Object.values(RICH_LIST_ITEM_STATE).includes(state);
115
+ },
116
+ },
117
+ size: {
118
+ type: String as PropType<RichListItemSize>,
119
+ default: RICH_LIST_ITEM_SIZE.MEDIUM,
120
+ validator(size) {
121
+ return Object.values(RICH_LIST_ITEM_SIZE).includes(size);
122
+ },
123
+ },
124
+ isInteractive: {
125
+ type: Boolean,
126
+ default: true,
127
+ },
128
+ isDimmed: {
129
+ type: Boolean,
130
+ default: false,
131
+ },
132
+ isDraggable: {
133
+ type: Boolean,
134
+ default: true,
135
+ },
136
+ icon: {
137
+ type: String,
138
+ default: null,
139
+ },
140
+ iconColor: {
141
+ type: String as PropType<RichListItemIconColor>,
142
+ default: null,
143
+ validator(iconColor) {
144
+ return Object.values(RICH_LIST_ITEM_ICON_COLOR).includes(iconColor);
145
+ },
146
+ },
147
+ iconColorHex: {
148
+ type: String,
149
+ default: null,
150
+ },
151
+ borderColor: {
152
+ type: String as PropType<RichListItemBorderColor>,
153
+ default: null,
154
+ validator(borderColor) {
155
+ return Object.values(RICH_LIST_ITEM_BORDER_COLOR).includes(borderColor);
156
+ },
157
+ },
158
+ borderColorHex: {
159
+ type: String,
160
+ default: null,
161
+ },
162
+ text: {
163
+ type: String,
164
+ required: true,
165
+ },
166
+ eyebrow: {
167
+ type: String,
168
+ required: true,
169
+ },
170
+ isEyebrowUppercase: {
171
+ type: Boolean,
172
+ default: false,
173
+ },
174
+ },
175
+ };
176
+ </script>
@@ -0,0 +1,3 @@
1
+ import RichListItemBasic from './RichListItemBasic.vue';
2
+
3
+ export default RichListItemBasic;
@@ -2,3 +2,8 @@ export const SURVEY_QUESTION_STATES = {
2
2
  DEFAULT: 'default',
3
3
  DISABLED: 'disabled',
4
4
  } as const;
5
+
6
+ export const SURVEY_QUESTION_SCALE_CONTAINERS = {
7
+ ONE: 'one',
8
+ TWO: 'two',
9
+ } as const;
@@ -1,6 +1,6 @@
1
1
  import SurveyQuestionScale from './SurveyQuestionScale.vue';
2
2
  import { SURVEY_TOGGLE_MEANINGS } from '../../SurveyToggle';
3
- import { SURVEY_QUESTION_STATES } from '../SurveyQuestion.consts';
3
+ import { SURVEY_QUESTION_SCALE_CONTAINERS, SURVEY_QUESTION_STATES } from '../SurveyQuestion.consts';
4
4
 
5
5
  import { Args, ArgTypes, Meta, StoryFn } from '@storybook/vue3';
6
6
 
@@ -15,7 +15,7 @@ const StoryTemplate: StoryFn<typeof SurveyQuestionScale> = (args, { updateArgs }
15
15
  return { ...args };
16
16
  },
17
17
  template:
18
- '<survey-question-scale :title="title" :scale-options="scaleOptions" :elaboration-value="elaborationValue" :elaborationLabel="elaborationLabel" :placeholder="placeholder" :selected-value="selectedValue" :state="state" @select-change="selectedValueUpdate" @elaboration-change="elaborationUpdate">' +
18
+ '<survey-question-scale :title="title" :scale-options="scaleOptions" :elaboration-value="elaborationValue" :elaborationLabel="elaborationLabel" :placeholder="placeholder" :selected-value="selectedValue" :state="state" :containers="containers" @select-change="selectedValueUpdate" @elaboration-change="elaborationUpdate">' +
19
19
  '<template v-if="explanation" #explanation><div v-html="explanation" /></template>' +
20
20
  '</survey-question-scale>',
21
21
  methods: {
@@ -37,6 +37,7 @@ const args = {
37
37
  explanation:
38
38
  '<h3 style="text-align: center; margin-bottom: 16px;">Jak ocenić, czy slajdy i diagramy były zrozumiałe?</h3>\n<div>Wyczerpujące materiały dają poczucie pełnego zrozumienia, przy jednoczesnym usystematyzowaniu informacji. Wpływa na to nie tylko ich jakość, ale też ilość.</div>',
39
39
  placeholder: 'Wpisz swoją odpowiedź',
40
+ containers: SURVEY_QUESTION_SCALE_CONTAINERS.TWO,
40
41
  scaleOptions: [
41
42
  {
42
43
  value: '1',
@@ -75,6 +76,10 @@ const argTypes = {
75
76
  elaborationValue: { control: { type: 'text' } },
76
77
  selectedValue: { control: false },
77
78
  explanation: { control: { type: 'text' } },
79
+ containers: {
80
+ control: { type: 'select' },
81
+ options: Object.values(SURVEY_QUESTION_SCALE_CONTAINERS),
82
+ },
78
83
  scaleOptions: { control: { type: 'object' } },
79
84
  state: {
80
85
  control: { type: 'select', options: Object.values(SURVEY_QUESTION_STATES) },
@@ -111,7 +116,7 @@ const StoryLimitedWidthTemplate: StoryFn<typeof SurveyQuestionScale> = (args, {
111
116
  return { ...args };
112
117
  },
113
118
  template:
114
- '<div style="max-width: 600px"><survey-question-scale :title="title" :scale-options="scaleOptions" :elaboration-value="elaborationValue" :elaborationLabel="elaborationLabel" :placeholder="placeholder" :selected-value="selectedValue" :state="state" @select-change="selectedValueUpdate" @elaboration-change="elaborationUpdate">' +
119
+ '<div style="max-width: 600px"><survey-question-scale :title="title" :scale-options="scaleOptions" :elaboration-value="elaborationValue" :elaborationLabel="elaborationLabel" :placeholder="placeholder" :selected-value="selectedValue" :containers="containers" :state="state" @select-change="selectedValueUpdate" @elaboration-change="elaborationUpdate">' +
115
120
  '<template v-if="explanation" #explanation><div v-html="explanation" /></template>' +
116
121
  '</survey-question-scale></div>',
117
122
  methods: {
@@ -125,7 +130,13 @@ const StoryLimitedWidthTemplate: StoryFn<typeof SurveyQuestionScale> = (args, {
125
130
  });
126
131
 
127
132
  export const LimitedWidth = StoryLimitedWidthTemplate.bind({});
128
- LimitedWidth.argTypes = argTypesDisabled;
133
+ LimitedWidth.argTypes = {
134
+ ...argTypesDisabled,
135
+ containers: {
136
+ control: { type: 'select' },
137
+ options: Object.values(SURVEY_QUESTION_SCALE_CONTAINERS),
138
+ },
139
+ } as ArgTypes;
129
140
 
130
141
  LimitedWidth.args = {
131
142
  title: "Main question write here if it's long it will collapse.",
@@ -134,6 +145,7 @@ LimitedWidth.args = {
134
145
  explanation:
135
146
  '<h3 class="modalHeader" style="text-align: center; margin-bottom: 16px;">Jak ocenić, czy slajdy i diagramy były zrozumiałe?</h3>\n<div>Wyczerpujące materiały dają poczucie pełnego zrozumienia, przy jednoczesnym usystematyzowaniu informacji. Wpływa na to nie tylko ich jakość, ale też ilość.</div>',
136
147
  placeholder: 'Wpisz swoją odpowiedź',
148
+ containers: SURVEY_QUESTION_SCALE_CONTAINERS.TWO,
137
149
  scaleOptions: [
138
150
  {
139
151
  value: '1',
@@ -176,54 +188,8 @@ const StorySevenOptionsTemplate: StoryFn<typeof SurveyQuestionScale> = (args, {
176
188
  data() {
177
189
  return { elaboration: '' };
178
190
  },
179
- created() {
180
- this.scaleOptions = [
181
- {
182
- value: '1',
183
- label: 'Nie zgadzam się',
184
- meaning: SURVEY_TOGGLE_MEANINGS.PRIMARY,
185
- content: '1',
186
- },
187
- {
188
- value: '2',
189
- label: '',
190
- meaning: SURVEY_TOGGLE_MEANINGS.PRIMARY,
191
- content: '2',
192
- },
193
- {
194
- value: '3',
195
- label: '',
196
- meaning: SURVEY_TOGGLE_MEANINGS.PRIMARY,
197
- content: '3',
198
- },
199
- {
200
- value: '4',
201
- label: 'Trochę',
202
- meaning: SURVEY_TOGGLE_MEANINGS.PRIMARY,
203
- content: '4',
204
- },
205
- {
206
- value: '5',
207
- label: '',
208
- meaning: SURVEY_TOGGLE_MEANINGS.PRIMARY,
209
- content: '5',
210
- },
211
- {
212
- value: '6',
213
- label: '',
214
- meaning: SURVEY_TOGGLE_MEANINGS.PRIMARY,
215
- content: '6',
216
- },
217
- {
218
- value: '7',
219
- label: 'Zgadzam się',
220
- meaning: SURVEY_TOGGLE_MEANINGS.PRIMARY,
221
- content: '7',
222
- },
223
- ];
224
- },
225
191
  template:
226
- '<survey-question-scale title="title" :scale-options="scaleOptions" elaborationLabel="elaborationLabel" :elaboration-value="elaboration" :selected-value="selectedValue" @select-change="selectedValueUpdate" />',
192
+ '<survey-question-scale title="title" :scale-options="scaleOptions" elaborationLabel="elaborationLabel" :elaboration-value="elaboration" :selected-value="selectedValue" :containers="containers" @select-change="selectedValueUpdate" />',
227
193
  methods: {
228
194
  selectedValueUpdate(selectedValue) {
229
195
  updateArgs({ selectedValue });
@@ -232,4 +198,58 @@ const StorySevenOptionsTemplate: StoryFn<typeof SurveyQuestionScale> = (args, {
232
198
  });
233
199
 
234
200
  export const SevenOptions = StorySevenOptionsTemplate.bind({});
235
- SevenOptions.argTypes = argTypesDisabled;
201
+ SevenOptions.argTypes = {
202
+ ...argTypesDisabled,
203
+ containers: {
204
+ control: { type: 'select' },
205
+ options: Object.values(SURVEY_QUESTION_SCALE_CONTAINERS),
206
+ },
207
+ } as ArgTypes;
208
+
209
+ SevenOptions.args = {
210
+ containers: SURVEY_QUESTION_SCALE_CONTAINERS.ONE,
211
+ scaleOptions: [
212
+ {
213
+ value: '1',
214
+ label: 'Nie zgadzam się',
215
+ meaning: SURVEY_TOGGLE_MEANINGS.PRIMARY,
216
+ content: '1',
217
+ },
218
+ {
219
+ value: '2',
220
+ label: '',
221
+ meaning: SURVEY_TOGGLE_MEANINGS.PRIMARY,
222
+ content: '2',
223
+ },
224
+ {
225
+ value: '3',
226
+ label: '',
227
+ meaning: SURVEY_TOGGLE_MEANINGS.PRIMARY,
228
+ content: '3',
229
+ },
230
+ {
231
+ value: '4',
232
+ label: 'Trochę',
233
+ meaning: SURVEY_TOGGLE_MEANINGS.PRIMARY,
234
+ content: '4',
235
+ },
236
+ {
237
+ value: '5',
238
+ label: '',
239
+ meaning: SURVEY_TOGGLE_MEANINGS.PRIMARY,
240
+ content: '5',
241
+ },
242
+ {
243
+ value: '6',
244
+ label: '',
245
+ meaning: SURVEY_TOGGLE_MEANINGS.PRIMARY,
246
+ content: '6',
247
+ },
248
+ {
249
+ value: '7',
250
+ label: 'Zgadzam się',
251
+ meaning: SURVEY_TOGGLE_MEANINGS.PRIMARY,
252
+ content: '7',
253
+ },
254
+ ],
255
+ } as Args;
@@ -24,34 +24,79 @@
24
24
  @click="showModal = true"
25
25
  />
26
26
  </div>
27
- <div class="surveyQuestionScale__content">
28
- <template
29
- v-for="(option, index) in scaleOptions"
30
- :key="`surveyQuestionScale-${index}`"
27
+ <div
28
+ class="surveyQuestionScale__content"
29
+ :class="{ '-oneContainer': containers === SURVEY_QUESTION_CONTAINERS.ONE }"
30
+ >
31
+ <div
32
+ class="surveyQuestionScale__container"
33
+ :class="{
34
+ '-oneContainer': containers === SURVEY_QUESTION_CONTAINERS.ONE,
35
+ }"
31
36
  >
32
- <div
33
- v-if="option.standalone"
34
- class="surveyQuestionScale__toggleSeparator"
35
- />
36
- <div class="surveyQuestionScale__toggle">
37
- <survey-toggle
38
- :meaning="option.meaning"
39
- :content-text="option.content"
40
- :label="option.label"
41
- :status="
42
- selectedValue === option.value
43
- ? SURVEY_TOGGLE_STATUSES.SELECTED
44
- : SURVEY_TOGGLE_STATUSES.DEFAULT
45
- "
46
- :state="
47
- state === SURVEY_QUESTION_STATES.DISABLED
48
- ? SURVEY_TOGGLE_STATES.DISABLED
49
- : SURVEY_TOGGLE_STATES.DEFAULT
50
- "
51
- @click="onToggleClick(option.value)"
52
- />
53
- </div>
54
- </template>
37
+ <template
38
+ v-for="(option, index) in scaleOptions"
39
+ :key="`surveyQuestionScale-${index}`"
40
+ >
41
+ <div
42
+ class="surveyQuestionScale__toggle"
43
+ :class="{
44
+ '-hideOnDesktop':
45
+ option.standalone &&
46
+ containers === SURVEY_QUESTION_CONTAINERS.TWO,
47
+ }"
48
+ >
49
+ <survey-toggle
50
+ :meaning="option.meaning"
51
+ :content-text="option.content"
52
+ :label="option.label"
53
+ :status="
54
+ selectedValue === option.value
55
+ ? SURVEY_TOGGLE_STATUSES.SELECTED
56
+ : SURVEY_TOGGLE_STATUSES.DEFAULT
57
+ "
58
+ :state="
59
+ state === SURVEY_QUESTION_STATES.DISABLED
60
+ ? SURVEY_TOGGLE_STATES.DISABLED
61
+ : SURVEY_TOGGLE_STATES.DEFAULT
62
+ "
63
+ @click="onToggleClick(option.value)"
64
+ />
65
+ </div>
66
+ </template>
67
+ </div>
68
+
69
+ <div
70
+ v-if="
71
+ standaloneOptions.length > 0 &&
72
+ containers === SURVEY_QUESTION_CONTAINERS.TWO
73
+ "
74
+ class="surveyQuestionScale__container -justifyEnd -hideOnMobile"
75
+ >
76
+ <template
77
+ v-for="(option, index) in standaloneOptions"
78
+ :key="`surveyQuestionScale-standalone-${index}`"
79
+ >
80
+ <div class="surveyQuestionScale__toggle">
81
+ <survey-toggle
82
+ :meaning="option.meaning"
83
+ :content-text="option.content"
84
+ :label="option.label"
85
+ :status="
86
+ selectedValue === option.value
87
+ ? SURVEY_TOGGLE_STATUSES.SELECTED
88
+ : SURVEY_TOGGLE_STATUSES.DEFAULT
89
+ "
90
+ :state="
91
+ state === SURVEY_QUESTION_STATES.DISABLED
92
+ ? SURVEY_TOGGLE_STATES.DISABLED
93
+ : SURVEY_TOGGLE_STATES.DEFAULT
94
+ "
95
+ @click="onToggleClick(option.value)"
96
+ />
97
+ </div>
98
+ </template>
99
+ </div>
55
100
  </div>
56
101
 
57
102
  <template v-if="selectedValue !== null && elaborationLabel !== null">
@@ -108,31 +153,34 @@
108
153
  background: $color-neutral-background;
109
154
  border-radius: $radius-s;
110
155
  display: flex;
111
- justify-content: space-between;
112
156
  overflow-x: auto;
113
157
  padding: $space-s $space-xxs;
114
158
 
115
159
  @media #{breakpoint-s()} {
160
+ gap: $space-l;
116
161
  padding: $space-s $space-l;
162
+
163
+ &:not(.-oneContainer) {
164
+ justify-content: center;
165
+ overflow-x: initial;
166
+ }
167
+ }
168
+
169
+ &.-oneContainer {
170
+ overflow-x: auto;
117
171
  }
118
172
  }
119
173
 
120
174
  &__toggle {
121
175
  display: flex;
122
176
  justify-content: center;
123
- margin-right: $space-xxs;
124
177
 
125
- &:last-child {
126
- margin-right: 0;
127
- }
128
- }
178
+ &.-hideOnDesktop {
179
+ display: flex;
129
180
 
130
- &__toggleSeparator {
131
- display: none;
132
-
133
- @media #{breakpoint-s()} {
134
- display: block;
135
- width: $space-l;
181
+ @media #{breakpoint-s()} {
182
+ display: none;
183
+ }
136
184
  }
137
185
  }
138
186
 
@@ -154,22 +202,44 @@
154
202
  &__elaborationInput {
155
203
  margin-top: $space-xxs;
156
204
  }
205
+
206
+ &__container {
207
+ display: flex;
208
+ flex: 1;
209
+ flex-direction: row;
210
+ gap: $space-l;
211
+
212
+ &.-justifyEnd {
213
+ justify-content: flex-end;
214
+ }
215
+
216
+ &.-oneContainer {
217
+ justify-content: space-between;
218
+ }
219
+
220
+ &.-hideOnMobile {
221
+ display: none;
222
+
223
+ @media #{breakpoint-s()} {
224
+ display: flex;
225
+ }
226
+ }
227
+ }
157
228
  }
158
229
  </style>
159
230
 
160
231
  <script lang="ts">
161
232
  import DsCard from '../../Cards/Card';
162
- import IconButton from '../../Buttons/IconButton';
233
+ import IconButton, { ICON_BUTTON_COLORS } from '../../Buttons/IconButton';
163
234
  import { ICON_SIZES, ICONS } from '../../Icons/Icon';
164
235
  import DsButton, { BUTTON_TYPES } from '../../Buttons/Button';
165
- import { ICON_BUTTON_COLORS } from '../../Buttons/IconButton';
166
236
  import DsModal from '../../Modal';
167
237
  import SurveyToggle, {
168
238
  SURVEY_TOGGLE_MEANINGS,
169
239
  SURVEY_TOGGLE_STATES,
170
240
  SURVEY_TOGGLE_STATUSES,
171
241
  } from '../../SurveyToggle';
172
- import { SURVEY_QUESTION_STATES } from '../SurveyQuestion.consts';
242
+ import { SURVEY_QUESTION_SCALE_CONTAINERS, SURVEY_QUESTION_STATES } from '../SurveyQuestion.consts';
173
243
  import SurveyQuestionTextarea from '../';
174
244
  import { SurveyQuestionScaleOption } from '../SurveyQuestion.domain';
175
245
  import { randomString } from '../../../utils/string';
@@ -219,6 +289,13 @@ export default {
219
289
  type: String,
220
290
  default: null,
221
291
  },
292
+ containers: {
293
+ type: String,
294
+ default: SURVEY_QUESTION_SCALE_CONTAINERS.TWO,
295
+ validator(containers) {
296
+ return Object.values(SURVEY_QUESTION_SCALE_CONTAINERS).includes(containers);
297
+ },
298
+ },
222
299
  },
223
300
  emits: ['elaboration-change', 'select-change'],
224
301
  data() {
@@ -233,8 +310,16 @@ export default {
233
310
  SURVEY_TOGGLE_STATES: Object.freeze(SURVEY_TOGGLE_STATES),
234
311
  SURVEY_TOGGLE_STATUSES: Object.freeze(SURVEY_TOGGLE_STATUSES),
235
312
  SURVEY_QUESTION_STATES: Object.freeze(SURVEY_QUESTION_STATES),
313
+ SURVEY_QUESTION_CONTAINERS: Object.freeze(SURVEY_QUESTION_SCALE_CONTAINERS),
236
314
  };
237
315
  },
316
+ computed: {
317
+ standaloneOptions() {
318
+ return this.scaleOptions.filter(
319
+ (option: SurveyQuestionScaleOption) => option.standalone,
320
+ );
321
+ },
322
+ },
238
323
  methods: {
239
324
  onToggleClick(value: string) {
240
325
  this.$emit('select-change', this.selectedValue === value ? null : value);
@@ -110,6 +110,7 @@ import { faPrint } from '@fortawesome/pro-regular-svg-icons/faPrint';
110
110
  import { faReply } from '@fortawesome/pro-regular-svg-icons/faReply';
111
111
  import { faRotateLeft } from '@fortawesome/pro-regular-svg-icons/faRotateLeft';
112
112
  import { faShare } from '@fortawesome/pro-regular-svg-icons/faShare';
113
+ import { faShareNodes } from '@fortawesome/pro-regular-svg-icons/faShareNodes';
113
114
  import { faShieldHalved } from '@fortawesome/pro-regular-svg-icons/faShieldHalved';
114
115
  import { faSignal } from '@fortawesome/pro-regular-svg-icons/faSignal';
115
116
  import { faSitemap } from '@fortawesome/pro-regular-svg-icons/faSitemap';
@@ -325,6 +326,7 @@ export const FONTAWESOME_ICONS = {
325
326
  FA_REPLY: faReply,
326
327
  FA_ROTATE_LEFT: faRotateLeft,
327
328
  FA_SHARE: faShare,
329
+ FA_SHARE_NODES: faShareNodes,
328
330
  FA_SHIELD_HALVED: faShieldHalved,
329
331
  FA_SIGNAL: faSignal,
330
332
  FA_SITEMAP: faSitemap,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bethinkpl/design-system",
3
- "version": "18.7.4",
3
+ "version": "18.9.0",
4
4
  "description": "Bethink universe design-system",
5
5
  "repository": "git@github.com:bethinkpl/design-system.git",
6
6
  "author": "nerdy@bethink.pl",
@@ -80,7 +80,7 @@
80
80
  "typescript": "4.6.4",
81
81
  "vue": "3.2.45",
82
82
  "vue-loader": "17.0.0",
83
- "vue-popperjs": "bethinkpl/vue-popper#4714b024fda5c3b66f3f856c5ca2a470ff2cb51e",
83
+ "vue-popperjs": "bethinkpl/vue-popper#03c7912c4729386743b0cca8f39b35448cc3db7f",
84
84
  "vue-svg-loader": "0.17.0-beta.2"
85
85
  }
86
86
  }