shared-ritm 1.3.67 → 1.3.69

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 (76) hide show
  1. package/dist/index.css +1 -1
  2. package/dist/shared-ritm.es.js +4862 -4700
  3. package/dist/shared-ritm.umd.js +190 -190
  4. package/dist/types/api/services/AuthService.d.ts +0 -1
  5. package/dist/types/api/services/MetricsService.d.ts +2 -1
  6. package/dist/types/api/services/PhotoService.d.ts +40 -0
  7. package/dist/types/api/services/UserService.d.ts +1 -2
  8. package/dist/types/api/settings/ApiService.d.ts +2 -7
  9. package/dist/types/api/types/Api_Auth.d.ts +0 -15
  10. package/dist/types/api/types/Api_Metrics.d.ts +18 -0
  11. package/dist/types/api/types/Api_User.d.ts +0 -9
  12. package/dist/types/common/app-checkbox/Checkbox.stories.d.ts +5 -1
  13. package/dist/types/common/app-toggle/Toggle.stories.d.ts +5 -1
  14. package/dist/types/stories/Button.stories.d.ts +13 -0
  15. package/dist/types/stories/Checkbox.stories.d.ts +7 -0
  16. package/dist/types/stories/Confirm.stories.d.ts +8 -0
  17. package/dist/types/stories/DatePicker.stories.d.ts +8 -0
  18. package/dist/types/stories/Dropdown.stories.d.ts +8 -0
  19. package/dist/types/stories/File.stories.d.ts +8 -0
  20. package/dist/types/stories/Icon.stories.d.ts +7 -0
  21. package/dist/types/stories/Input.stories.d.ts +11 -0
  22. package/dist/types/stories/InputNew.stories.d.ts +12 -0
  23. package/dist/types/stories/InputSearch.stories.d.ts +10 -0
  24. package/dist/types/stories/Loader.stories.d.ts +8 -0
  25. package/dist/types/stories/Select.stories.d.ts +7 -0
  26. package/dist/types/stories/Toggle.stories.d.ts +8 -0
  27. package/package.json +70 -70
  28. package/src/App.vue +2461 -2461
  29. package/src/api/services/AuthService.ts +4 -18
  30. package/src/api/services/ControlsService.ts +96 -96
  31. package/src/api/services/EquipmentService.ts +29 -29
  32. package/src/api/services/GanttService.ts +23 -23
  33. package/src/api/services/MetricsService.ts +127 -123
  34. package/src/api/services/RepairsService.ts +111 -111
  35. package/src/api/services/UserService.ts +0 -6
  36. package/src/api/services/VideoService.ts +118 -118
  37. package/src/api/settings/ApiService.ts +10 -73
  38. package/src/api/types/Api_Auth.ts +0 -16
  39. package/src/api/types/Api_Metrics.ts +26 -5
  40. package/src/api/types/Api_Repairs.ts +186 -186
  41. package/src/api/types/Api_Tasks.ts +376 -376
  42. package/src/api/types/Api_User.ts +0 -10
  43. package/src/api/types/Api_Video.ts +244 -244
  44. package/src/common/app-button/Button.stories.ts +369 -369
  45. package/src/common/app-checkbox/AppCheckbox.vue +19 -12
  46. package/src/common/app-checkbox/Checkbox.stories.ts +252 -60
  47. package/src/common/app-date-picker/DatePicker.stories.ts +66 -66
  48. package/src/common/app-datepicker/Datepicker.stories.ts +145 -145
  49. package/src/common/app-dialogs/AppConfirmDialog.vue +109 -109
  50. package/src/common/app-dialogs/Confirm.stories.ts +93 -93
  51. package/src/common/app-dropdown/Dropdown.stories.ts +94 -94
  52. package/src/common/app-file/File.stories.ts +104 -104
  53. package/src/common/app-icon/AppIcon.vue +108 -108
  54. package/src/common/app-icon/Icon.stories.ts +91 -91
  55. package/src/common/app-input/Input.stories.ts +160 -160
  56. package/src/common/app-input-new/InputNew.stories.ts +240 -240
  57. package/src/common/app-input-search/InputSearch.stories.ts +149 -149
  58. package/src/common/app-layout/components/AppLayoutHeader.vue +289 -289
  59. package/src/common/app-loader/Loader.stories.ts +114 -114
  60. package/src/common/app-select/AppSelect.vue +159 -159
  61. package/src/common/app-select/Select.stories.ts +155 -155
  62. package/src/common/app-sidebar/AppSidebar.vue +174 -174
  63. package/src/common/app-table/AppTable.vue +313 -313
  64. package/src/common/app-table/components/ModalSelect.stories.ts +323 -323
  65. package/src/common/app-table/components/ModalSelect.vue +302 -302
  66. package/src/common/app-table/components/TableModal.vue +367 -367
  67. package/src/common/app-table/controllers/useColumnSelector.ts +45 -45
  68. package/src/common/app-table/controllers/useTableModel.ts +97 -97
  69. package/src/common/app-toggle/AppToggle.vue +5 -15
  70. package/src/common/app-toggle/Toggle.stories.ts +245 -69
  71. package/src/common/app-wrapper/AppWrapper.vue +31 -31
  72. package/src/configs/storybook.ts +14 -14
  73. package/src/index.ts +131 -131
  74. package/src/shared/styles/general.css +140 -140
  75. package/src/styles/variables.sass +12 -12
  76. package/src/utils/helpers.ts +59 -59
@@ -1,45 +1,45 @@
1
- import { computed, ref } from 'vue'
2
-
3
- export interface ColumnConfig {
4
- name: string
5
- label: string
6
- [key: string]: any
7
- }
8
-
9
- export function useColumnSelector(allColumns: ColumnConfig[], fixedColumnNames: string[] = []) {
10
- const selectedColumnNames = ref<string[]>([...new Set([...fixedColumnNames, ...allColumns.map(col => col.name)])])
11
-
12
- const visibleColumns = computed(() => allColumns.filter(col => selectedColumnNames.value.includes(col.name)))
13
-
14
- function openColumnSelectorDialog($q: any) {
15
- $q.dialog({
16
- title: 'Выберите колонки',
17
- options: {
18
- type: 'checkbox',
19
- model: [...selectedColumnNames.value],
20
- items: allColumns.map(col => ({
21
- label: col.label,
22
- value: col.name,
23
- disable: fixedColumnNames.includes(col.name),
24
- })),
25
- },
26
- cancel: {
27
- label: 'Отмена',
28
- 'data-test': 'cancel-button',
29
- },
30
- ok: {
31
- label: 'Ок',
32
- 'data-test': 'ok-button',
33
- },
34
- persistent: true,
35
- }).onOk((val: string[]) => {
36
- selectedColumnNames.value = Array.from(new Set([...val, ...fixedColumnNames]))
37
- })
38
- }
39
-
40
- return {
41
- selectedColumnNames,
42
- visibleColumns,
43
- openColumnSelectorDialog,
44
- }
45
- }
1
+ import { computed, ref } from 'vue'
2
+
3
+ export interface ColumnConfig {
4
+ name: string
5
+ label: string
6
+ [key: string]: any
7
+ }
8
+
9
+ export function useColumnSelector(allColumns: ColumnConfig[], fixedColumnNames: string[] = []) {
10
+ const selectedColumnNames = ref<string[]>([...new Set([...fixedColumnNames, ...allColumns.map(col => col.name)])])
11
+
12
+ const visibleColumns = computed(() => allColumns.filter(col => selectedColumnNames.value.includes(col.name)))
13
+
14
+ function openColumnSelectorDialog($q: any) {
15
+ $q.dialog({
16
+ title: 'Выберите колонки',
17
+ options: {
18
+ type: 'checkbox',
19
+ model: [...selectedColumnNames.value],
20
+ items: allColumns.map(col => ({
21
+ label: col.label,
22
+ value: col.name,
23
+ disable: fixedColumnNames.includes(col.name),
24
+ })),
25
+ },
26
+ cancel: {
27
+ label: 'Отмена',
28
+ 'data-test': 'cancel-button',
29
+ },
30
+ ok: {
31
+ label: 'Ок',
32
+ 'data-test': 'ok-button',
33
+ },
34
+ persistent: true,
35
+ }).onOk((val: string[]) => {
36
+ selectedColumnNames.value = Array.from(new Set([...val, ...fixedColumnNames]))
37
+ })
38
+ }
39
+
40
+ return {
41
+ selectedColumnNames,
42
+ visibleColumns,
43
+ openColumnSelectorDialog,
44
+ }
45
+ }
@@ -1,97 +1,97 @@
1
- import { Ref, computed, ref } from 'vue'
2
-
3
- export interface TableColumn {
4
- name: string
5
- label: string
6
- style?: string
7
- headerStyle?: string
8
- field?: string | ((row: any) => any)
9
- sortable?: boolean
10
- filterType?: 'single' | 'multi' | null
11
- align?: 'left' | 'center' | 'right'
12
- badge?: {
13
- true?: string
14
- false?: string
15
- colorTrue?: string
16
- colorFalse?: string
17
- }
18
- format?: (val: any) => any
19
- html?: boolean
20
- }
21
-
22
- export interface FilterOption {
23
- id: string
24
- name: string
25
- }
26
-
27
- export interface TableModel<T = any> {
28
- columns: TableColumn[]
29
- rows: T[] | Ref<T[]>
30
- filtersOptions?: Ref<Record<string, FilterOption[]>>
31
- }
32
-
33
- export const useTableModel = <T = any>(model: TableModel<T>) => {
34
- const columnFilters = ref<Record<string, string | string[] | undefined>>({})
35
- const filterMenus = ref<Record<string, boolean>>({})
36
-
37
- model.columns.forEach(({ name, filterType }) => {
38
- if (filterType) {
39
- columnFilters.value[name] = filterType === 'multi' ? [] : undefined
40
- filterMenus.value[name] = false
41
- }
42
- })
43
-
44
- const resolvedRows = computed(() => (Array.isArray(model.rows) ? model.rows : model.rows.value))
45
-
46
- const toggleFilterValue = (colName: string, value: string) => {
47
- const col = model.columns.find(c => c.name === colName)
48
- if (col?.filterType === 'multi') {
49
- const current = columnFilters.value[colName] as string[]
50
- const index = current.indexOf(value)
51
- index > -1 ? current.splice(index, 1) : current.push(value)
52
- columnFilters.value[colName] = [...current]
53
- } else {
54
- columnFilters.value[colName] = value
55
- filterMenus.value[colName] = false
56
- }
57
- }
58
-
59
- const selectedFilters = computed(() => {
60
- const result: Record<string, string[]> = {}
61
- for (const col of model.columns) {
62
- const filter = columnFilters.value[col.name]
63
- const options = model.filtersOptions?.value[col.name] || []
64
-
65
- if (filter) {
66
- let selectedIds: string[] = []
67
- if (Array.isArray(filter)) {
68
- selectedIds = options.filter(opt => filter.includes(opt.name)).map(opt => opt.id)
69
- } else {
70
- selectedIds = options.filter(opt => opt.name === filter).map(opt => opt.id)
71
- }
72
- result[col.name] = Array.from(new Set(selectedIds))
73
- }
74
- }
75
- return result
76
- })
77
-
78
- const clearFilter = (colName: string) => {
79
- const col = model.columns.find(c => c.name === colName)
80
- columnFilters.value[colName] = col?.filterType === 'multi' ? [] : undefined
81
- }
82
-
83
- const openFilterMenu = (colName: string, isOpen: boolean) => {
84
- filterMenus.value[colName] = isOpen
85
- }
86
-
87
- return {
88
- rows: resolvedRows,
89
- columns: computed(() => model.columns),
90
- columnFilters,
91
- filterMenus,
92
- toggleFilterValue,
93
- clearFilter,
94
- openFilterMenu,
95
- selectedFilters,
96
- }
97
- }
1
+ import { Ref, computed, ref } from 'vue'
2
+
3
+ export interface TableColumn {
4
+ name: string
5
+ label: string
6
+ style?: string
7
+ headerStyle?: string
8
+ field?: string | ((row: any) => any)
9
+ sortable?: boolean
10
+ filterType?: 'single' | 'multi' | null
11
+ align?: 'left' | 'center' | 'right'
12
+ badge?: {
13
+ true?: string
14
+ false?: string
15
+ colorTrue?: string
16
+ colorFalse?: string
17
+ }
18
+ format?: (val: any) => any
19
+ html?: boolean
20
+ }
21
+
22
+ export interface FilterOption {
23
+ id: string
24
+ name: string
25
+ }
26
+
27
+ export interface TableModel<T = any> {
28
+ columns: TableColumn[]
29
+ rows: T[] | Ref<T[]>
30
+ filtersOptions?: Ref<Record<string, FilterOption[]>>
31
+ }
32
+
33
+ export const useTableModel = <T = any>(model: TableModel<T>) => {
34
+ const columnFilters = ref<Record<string, string | string[] | undefined>>({})
35
+ const filterMenus = ref<Record<string, boolean>>({})
36
+
37
+ model.columns.forEach(({ name, filterType }) => {
38
+ if (filterType) {
39
+ columnFilters.value[name] = filterType === 'multi' ? [] : undefined
40
+ filterMenus.value[name] = false
41
+ }
42
+ })
43
+
44
+ const resolvedRows = computed(() => (Array.isArray(model.rows) ? model.rows : model.rows.value))
45
+
46
+ const toggleFilterValue = (colName: string, value: string) => {
47
+ const col = model.columns.find(c => c.name === colName)
48
+ if (col?.filterType === 'multi') {
49
+ const current = columnFilters.value[colName] as string[]
50
+ const index = current.indexOf(value)
51
+ index > -1 ? current.splice(index, 1) : current.push(value)
52
+ columnFilters.value[colName] = [...current]
53
+ } else {
54
+ columnFilters.value[colName] = value
55
+ filterMenus.value[colName] = false
56
+ }
57
+ }
58
+
59
+ const selectedFilters = computed(() => {
60
+ const result: Record<string, string[]> = {}
61
+ for (const col of model.columns) {
62
+ const filter = columnFilters.value[col.name]
63
+ const options = model.filtersOptions?.value[col.name] || []
64
+
65
+ if (filter) {
66
+ let selectedIds: string[] = []
67
+ if (Array.isArray(filter)) {
68
+ selectedIds = options.filter(opt => filter.includes(opt.name)).map(opt => opt.id)
69
+ } else {
70
+ selectedIds = options.filter(opt => opt.name === filter).map(opt => opt.id)
71
+ }
72
+ result[col.name] = Array.from(new Set(selectedIds))
73
+ }
74
+ }
75
+ return result
76
+ })
77
+
78
+ const clearFilter = (colName: string) => {
79
+ const col = model.columns.find(c => c.name === colName)
80
+ columnFilters.value[colName] = col?.filterType === 'multi' ? [] : undefined
81
+ }
82
+
83
+ const openFilterMenu = (colName: string, isOpen: boolean) => {
84
+ filterMenus.value[colName] = isOpen
85
+ }
86
+
87
+ return {
88
+ rows: resolvedRows,
89
+ columns: computed(() => model.columns),
90
+ columnFilters,
91
+ filterMenus,
92
+ toggleFilterValue,
93
+ clearFilter,
94
+ openFilterMenu,
95
+ selectedFilters,
96
+ }
97
+ }
@@ -1,24 +1,14 @@
1
1
  <template>
2
2
  <div>
3
- <q-toggle v-model="value" :disable="disable" />
3
+ <q-toggle v-bind="$props" v-model="model" />
4
4
  </div>
5
5
  </template>
6
6
 
7
7
  <script setup lang="ts">
8
- import { computed, defineProps, defineEmits } from 'vue'
8
+ import { defineProps } from 'vue'
9
+ import { QToggleProps } from 'quasar'
9
10
 
10
- interface Props {
11
- modelValue: any
12
- disable?: boolean
13
- }
11
+ defineProps<QToggleProps>()
14
12
 
15
- const props = defineProps<Props>()
16
- const emit = defineEmits(['update:modelValue', 'number'])
17
-
18
- const value = computed({
19
- get: () => props.modelValue,
20
- set: (newValue: any) => emit('update:modelValue', newValue),
21
- })
13
+ const model = defineModel<any>()
22
14
  </script>
23
-
24
- <style module lang="scss"></style>
@@ -1,69 +1,245 @@
1
- import type { Meta, StoryObj } from '@storybook/vue3'
2
- import AppToggle from '@/common/app-toggle/AppToggle.vue'
3
-
4
- const meta: Meta<typeof AppToggle> = {
5
- title: 'Components/AppToggle',
6
- component: AppToggle,
7
- tags: ['autodocs'],
8
- argTypes: {
9
- modelValue: {
10
- control: 'boolean',
11
- },
12
- disable: {
13
- control: 'boolean',
14
- },
15
- },
16
- args: {
17
- modelValue: false,
18
- disable: false,
19
- },
20
- }
21
-
22
- export default meta
23
-
24
- type Story = StoryObj<typeof AppToggle>
25
-
26
- export const Default: Story = {}
27
-
28
- export const States: Story = {
29
- render: () => ({
30
- components: { AppToggle },
31
- template: `
32
- <div style="display: flex; flex-direction: column; gap: 12px;">
33
- <label style="display: flex; align-items: center; gap: 12px;">
34
- <AppToggle :model-value="true" />
35
- Включён
36
- </label>
37
- <label style="display: flex; align-items: center; gap: 12px;">
38
- <AppToggle :model-value="false" />
39
- Выключен
40
- </label>
41
- <label style="display: flex; align-items: center; gap: 12px; opacity: 0.6;">
42
- <AppToggle :model-value="true" :disable="true" />
43
- Включён + отключён
44
- </label>
45
- <label style="display: flex; align-items: center; gap: 12px; opacity: 0.6;">
46
- <AppToggle :model-value="false" :disable="true" />
47
- Выключен + отключён
48
- </label>
49
- </div>
50
- `,
51
- }),
52
- }
53
-
54
- export const WithBinding: Story = {
55
- render: () => ({
56
- components: { AppToggle },
57
- template: `
58
- <div style="display: flex; align-items: center; gap: 16px;">
59
- <AppToggle v-model="toggleState" />
60
- <span>Значение: {{ toggleState ? 'включено' : 'выключено' }}</span>
61
- </div>
62
- `,
63
- data() {
64
- return {
65
- toggleState: true,
66
- }
67
- },
68
- }),
69
- }
1
+ import type { Meta, StoryObj } from '@storybook/vue3'
2
+ import AppToggle from '@/common/app-toggle/AppToggle.vue'
3
+ import { quasarColorOpts } from '@/configs/storybook'
4
+
5
+ const meta: Meta<typeof AppToggle> = {
6
+ title: 'Components/AppToggle',
7
+ component: AppToggle,
8
+ tags: ['autodocs'],
9
+ argTypes: {
10
+ modelValue: {
11
+ control: 'text',
12
+ description: 'any | Array - required!',
13
+ table: { category: 'model' },
14
+ },
15
+ val: {
16
+ control: 'text',
17
+ description: 'any | Используется, если model - массив',
18
+ table: { category: 'model' },
19
+ },
20
+ trueValue: {
21
+ control: 'text',
22
+ description: 'any | Какое значение модели следует считать вкл',
23
+ table: { category: 'model' },
24
+ },
25
+ falseValue: {
26
+ control: 'text',
27
+ description: 'any | Какое значение модели следует считать выкл',
28
+ table: { category: 'model' },
29
+ },
30
+ indeterminateValue: {
31
+ control: 'text',
32
+ description: 'any | Какое значение модели следует считать неопределённым',
33
+ table: { category: 'model' },
34
+ },
35
+ disable: {
36
+ control: 'boolean',
37
+ },
38
+ name: {
39
+ control: 'text',
40
+ },
41
+ tabindex: {
42
+ control: 'text',
43
+ description: 'number | string',
44
+ },
45
+ label: {
46
+ control: 'text',
47
+ },
48
+ leftLabel: {
49
+ control: 'boolean',
50
+ description: 'Расположить текст слева от переключателя',
51
+ },
52
+ size: {
53
+ control: 'text',
54
+ description: 'CSS или quasar(xs|sm|md|lg|xl)',
55
+ },
56
+ dark: {
57
+ control: 'boolean',
58
+ description: 'Используется для темного фона, чтобы фон переключателя был светлее',
59
+ },
60
+ dense: {
61
+ control: 'boolean',
62
+ },
63
+ color: {
64
+ control: 'select',
65
+ options: quasarColorOpts,
66
+ },
67
+ toggleOrder: {
68
+ control: 'text',
69
+ description:
70
+ '"tf" | "ft". Порядок переключения состояний. t - true, f - false. Если toggle-indeterminate истинно, то порядок следующий: indet -> первое состояние -> второе состояние -> indet (и повторять), в противном случае: indet -> первое состояние -> второе состояние -> первое состояние -> второе состояние -> ...',
71
+ },
72
+ toggleIndeterminate: {
73
+ control: 'boolean',
74
+ description:
75
+ 'При взаимодействии пользователя с компонентом исполюзуется не только вкл/выкл, а ещё и неопределенное состояние',
76
+ },
77
+ keepColor: {
78
+ control: 'boolean',
79
+ description: 'Следует ли сохранять значение color, если выкл',
80
+ },
81
+ icon: {
82
+ control: 'text',
83
+ description: 'Если передано "none", иконка не используется',
84
+ table: { category: 'icon' },
85
+ },
86
+ checkedIcon: {
87
+ control: 'text',
88
+ description: 'Иконка для вкл',
89
+ table: { category: 'icon' },
90
+ },
91
+ uncheckedIcon: {
92
+ control: 'text',
93
+ description: 'Иконка для выкл',
94
+ table: { category: 'icon' },
95
+ },
96
+ indeterminateIcon: {
97
+ control: 'text',
98
+ description: 'Иконка для неопределенного состояния',
99
+ table: { category: 'icon' },
100
+ },
101
+ iconColor: {
102
+ control: 'select',
103
+ options: quasarColorOpts,
104
+ description: 'Цвет иконки из палитры quasar(только для вкл)',
105
+ table: { category: 'icon' },
106
+ },
107
+ },
108
+ args: {
109
+ label: 'Toggle',
110
+ modelValue: 'on',
111
+ falseValue: 'off',
112
+ trueValue: 'on',
113
+ indeterminateValue: '',
114
+ disable: false,
115
+ name: 'toggler',
116
+ tabindex: '1',
117
+ leftLabel: false,
118
+ keepColor: false,
119
+ color: 'primary',
120
+ icon: 'none',
121
+ size: 'md',
122
+ dark: false,
123
+ dense: false,
124
+ toggleIndeterminate: false,
125
+ toggleOrder: 'ft',
126
+ val: '',
127
+ checkedIcon: 'none',
128
+ uncheckedIcon: 'none',
129
+ indeterminateIcon: 'none',
130
+ },
131
+ }
132
+
133
+ export default meta
134
+
135
+ type Story = StoryObj<typeof AppToggle>
136
+
137
+ export const Default: Story = {}
138
+
139
+ export const States: Story = {
140
+ render: () => ({
141
+ components: { AppToggle },
142
+ template: `
143
+ <AppToggle label="Включён" :model-value="true" />
144
+ <AppToggle label="Выключен left label" :model-value="false" left-label />
145
+ <AppToggle label="indeterminate" :model-value="null" indeterminate-value/>
146
+ <AppToggle label="Включён + отключён" :model-value="true" disable />
147
+ <AppToggle label="Выключен + отключён" :model-value="false" disable />
148
+ `,
149
+ }),
150
+ }
151
+
152
+ export const Sizes: Story = {
153
+ render: () => ({
154
+ components: { AppToggle },
155
+ template: `
156
+ <AppToggle size="xs" v-model="toggleState" val="xs" label="Size 'xs'" />
157
+ <AppToggle size="sm" v-model="toggleState" val="sm" label="Size 'sm'" />
158
+ <AppToggle size="md" v-model="toggleState" val="md" label="Size 'md'" />
159
+ <AppToggle size="lg" v-model="toggleState" val="lg" label="Size 'lg'" />
160
+ <AppToggle size="xl" v-model="toggleState" val="xl" label="Size 'xl'" />
161
+ <AppToggle size="150px" v-model="toggleState" val="150px" label="Size '150px'" />
162
+ `,
163
+ data() {
164
+ return {
165
+ toggleState: true,
166
+ }
167
+ },
168
+ }),
169
+ }
170
+
171
+ export const Colors: Story = {
172
+ render: () => ({
173
+ components: { AppToggle },
174
+ template: `
175
+ <AppToggle v-model="toggleState" label="red" color="red"/>
176
+ <AppToggle v-model="toggleState" label="red keep color" color="red" keep-color />
177
+ <AppToggle v-model="toggleState" label="yellow" color="yellow" />
178
+ <AppToggle v-model="toggleState" label="yellow keep color" color="yellow" keep-color />
179
+ <AppToggle v-model="toggleState" label="green" color="green" />
180
+ <AppToggle v-model="toggleState" label="green keep color" color="green" keep-color />
181
+ `,
182
+ data() {
183
+ return {
184
+ toggleState: true,
185
+ }
186
+ },
187
+ }),
188
+ }
189
+
190
+ export const DarkBg: Story = {
191
+ render: () => ({
192
+ components: { AppToggle },
193
+ template: `
194
+ <div class="bg-secondary rounded-borders">
195
+ <AppToggle v-model="toggleState" label="red" dark class="text-white" color="red" />
196
+ <AppToggle v-model="toggleState" label="red keep color" dark keep-color class="text-white" color="red" />
197
+ <AppToggle v-model="toggleState" label="yellow" dark class="text-white" color="yellow" />
198
+ <AppToggle v-model="toggleState" label="yellow keep color" dark keep-color class="text-white" color="yellow" />
199
+ <AppToggle v-model="toggleState" label="green" dark class="text-white" color="green" />
200
+ <AppToggle v-model="toggleState" label="green keep color" dark keep-color class="text-white" color="green" />
201
+ </div>
202
+ `,
203
+ data() {
204
+ return {
205
+ toggleState: true,
206
+ }
207
+ },
208
+ }),
209
+ }
210
+
211
+ export const Icons: Story = {
212
+ render: () => ({
213
+ components: { AppToggle },
214
+ template: `
215
+ <AppToggle v-model="toggleState" color="pink" icon="mail" label="Same Icon for each state" />
216
+ <AppToggle v-model="toggleState" color="orange" icon="alarm" label="Same Icon for each state" keep-color/>
217
+ <AppToggle v-model="toggleState" label="Different icon for each state" color="green" checked-icon="check" unchecked-icon="clear"/>
218
+ `,
219
+ data() {
220
+ return {
221
+ toggleState: true,
222
+ }
223
+ },
224
+ }),
225
+ }
226
+
227
+ export const ArrayModel: Story = {
228
+ render: () => ({
229
+ components: { AppToggle },
230
+ template: `
231
+ <AppToggle color="blue" label="Blue" v-model="selection" val="blue" />
232
+ <AppToggle color="yellow" label="Yellow" v-model="selection" val="yellow" />
233
+ <AppToggle color="green" label="Green" v-model="selection" val="green" />
234
+ <AppToggle color="red" label="Red" v-model="selection" val="red" />
235
+ <div>
236
+ Model: {{selection}}
237
+ </div>
238
+ `,
239
+ data() {
240
+ return {
241
+ selection: ['yellow', 'red'],
242
+ }
243
+ },
244
+ }),
245
+ }