@globalbrain/sefirot 2.0.0-draft.8 → 2.0.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.
- package/README.md +6 -6
- package/lib/components/SAvatar.vue +17 -17
- package/lib/components/SButton.vue +512 -267
- package/lib/components/SButtonGroup.vue +149 -0
- package/lib/components/SDropdown.vue +26 -150
- package/lib/components/SDropdownSection.vue +48 -0
- package/lib/components/SDropdownSectionFilter.vue +189 -0
- package/lib/components/SDropdownSectionFilterItem.vue +21 -0
- package/lib/components/SDropdownSectionFilterItemAvatar.vue +31 -0
- package/lib/components/SDropdownSectionFilterItemText.vue +20 -0
- package/lib/components/SDropdownSectionMenu.vue +39 -0
- package/lib/components/SIcon.vue +13 -0
- package/lib/components/SInputBase.vue +31 -31
- package/lib/components/SInputCheckbox.vue +1 -1
- package/lib/components/SInputCheckboxes.vue +74 -0
- package/lib/components/SInputDate.vue +182 -0
- package/lib/components/SInputDropdown.vue +158 -157
- package/lib/components/SInputDropdownItem.vue +46 -48
- package/lib/components/{SInputDropdownItemUserTag.vue → SInputDropdownItemAvatar.vue} +43 -44
- package/lib/components/SInputDropdownItemText.vue +79 -16
- package/lib/components/SInputFile.vue +55 -60
- package/lib/components/SInputHMS.vue +120 -110
- package/lib/components/SInputNumber.vue +38 -9
- package/lib/components/SInputRadio.vue +39 -36
- package/lib/components/SInputRadios.vue +40 -53
- package/lib/components/SInputSelect.vue +3 -3
- package/lib/components/SInputSwitch.vue +193 -0
- package/lib/components/SInputSwitches.vue +88 -0
- package/lib/components/SInputText.vue +206 -62
- package/lib/components/SInputTextarea.vue +46 -32
- package/lib/components/SInputYMD.vue +123 -126
- package/lib/components/SMarkdown.vue +52 -0
- package/lib/components/SModal.vue +25 -63
- package/lib/components/SMount.vue +19 -0
- package/lib/components/SSheet.vue +49 -55
- package/lib/components/SSheetFooter.vue +1 -1
- package/lib/components/SSheetFooterAction.vue +24 -17
- package/lib/components/SSheetFooterActions.vue +1 -4
- package/lib/components/SSheetForm.vue +15 -0
- package/lib/components/SSheetMedium.vue +8 -10
- package/lib/components/SSheetTitle.vue +7 -14
- package/lib/components/SSnackbar.vue +55 -45
- package/lib/components/{SPortalSnackbars.vue → SSnackbars.vue} +17 -20
- package/lib/components/SStep.vue +106 -0
- package/lib/components/SSteps.vue +59 -0
- package/lib/components/STable.vue +241 -0
- package/lib/components/STableCell.vue +82 -0
- package/lib/components/STableCellAvatar.vue +69 -0
- package/lib/components/STableCellAvatars.vue +93 -0
- package/lib/components/STableCellDay.vue +40 -0
- package/lib/components/STableCellPill.vue +84 -0
- package/lib/components/STableCellText.vue +102 -0
- package/lib/components/STableColumn.vue +255 -0
- package/lib/components/STableFooter.vue +115 -0
- package/lib/components/STableHeader.vue +74 -0
- package/lib/components/STableItem.vue +38 -0
- package/lib/components/STooltip.vue +112 -0
- package/lib/composables/Dropdown.ts +40 -99
- package/lib/composables/Form.ts +21 -18
- package/lib/composables/Grid.ts +117 -0
- package/lib/composables/Markdown.ts +138 -0
- package/lib/composables/Step.ts +7 -0
- package/lib/composables/Table.ts +103 -0
- package/lib/composables/Tooltip.ts +91 -0
- package/lib/composables/Validation.ts +5 -9
- package/lib/composables/markdown/LinkPlugin.ts +45 -0
- package/lib/mixins/Sheet.ts +5 -3
- package/lib/stores/Snackbars.ts +48 -0
- package/lib/{assets/styles → styles}/base.css +0 -0
- package/lib/{assets/styles → styles}/bootstrap.css +1 -0
- package/lib/{assets/styles → styles}/variables.css +55 -48
- package/lib/support/Day.ts +8 -0
- package/lib/support/Num.ts +3 -0
- package/lib/support/Time.ts +5 -2
- package/lib/support/Utils.ts +4 -3
- package/lib/types/shims.d.ts +3 -0
- package/lib/validation/validators/requiredYmd.ts +1 -1
- package/lib/validation/validators/ymd.ts +4 -4
- package/package.json +57 -37
- package/CHANGELOG.md +0 -47
- package/lib/.DS_Store +0 -0
- package/lib/components/.DS_Store +0 -0
- package/lib/components/SDialog.vue +0 -140
- package/lib/components/SDropdownItem.vue +0 -78
- package/lib/components/SDropdownItemText.vue +0 -22
- package/lib/components/SDropdownItemUser.vue +0 -40
- package/lib/components/SInputDropdownItemTextTag.vue +0 -94
- package/lib/components/SInputDropdownItemUser.vue +0 -41
- package/lib/components/SPortalModals.vue +0 -74
- package/lib/components/icons/.DS_Store +0 -0
- package/lib/composables/Dialog.ts +0 -38
- package/lib/composables/Modal.ts +0 -34
- package/lib/composables/Snackbar.ts +0 -18
- package/lib/store/Sefirot.ts +0 -17
- package/lib/store/dialog/index.ts +0 -42
- package/lib/store/modal/index.ts +0 -61
- package/lib/store/snackbars/index.ts +0 -70
|
@@ -1,31 +1,15 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div class="SInputBase" :class="{ 'has-error': hasError }">
|
|
3
|
-
<label v-if="label" class="label" :for="name">
|
|
4
|
-
{{ label }} <span class="note">{{ note }}</span>
|
|
5
|
-
</label>
|
|
6
|
-
|
|
7
|
-
<slot />
|
|
8
|
-
|
|
9
|
-
<div class="help">
|
|
10
|
-
<slot name="before-help" />
|
|
11
|
-
<p v-if="showError" class="help-error">{{ errorMsg }}</p>
|
|
12
|
-
<p v-if="help" class="help-text">{{ help }}</p>
|
|
13
|
-
</div>
|
|
14
|
-
</div>
|
|
15
|
-
</template>
|
|
16
|
-
|
|
17
1
|
<script setup lang="ts">
|
|
18
|
-
import {
|
|
2
|
+
import { computed, unref } from 'vue'
|
|
19
3
|
import { Validatable } from '../composables/Validation'
|
|
20
4
|
|
|
21
|
-
const props = defineProps
|
|
22
|
-
name
|
|
23
|
-
note
|
|
24
|
-
label
|
|
25
|
-
help
|
|
26
|
-
|
|
27
|
-
validation
|
|
28
|
-
})
|
|
5
|
+
const props = defineProps<{
|
|
6
|
+
name?: string,
|
|
7
|
+
note?: string,
|
|
8
|
+
label?: string,
|
|
9
|
+
help?: string,
|
|
10
|
+
hideError?: boolean
|
|
11
|
+
validation?: Validatable
|
|
12
|
+
}>()
|
|
29
13
|
|
|
30
14
|
const hasError = computed(() => {
|
|
31
15
|
if (!props.validation) {
|
|
@@ -42,14 +26,30 @@ const errorMsg = computed(() => {
|
|
|
42
26
|
|
|
43
27
|
const errors = props.validation.$errors
|
|
44
28
|
|
|
45
|
-
return errors.length > 0 ? errors[0].$message : null
|
|
29
|
+
return errors.length > 0 ? unref(errors[0].$message) : null
|
|
46
30
|
})
|
|
47
31
|
|
|
48
32
|
const showError = computed(() => {
|
|
49
|
-
return props.
|
|
33
|
+
return !props.hideError && hasError.value && errorMsg.value
|
|
50
34
|
})
|
|
51
35
|
</script>
|
|
52
36
|
|
|
37
|
+
<template>
|
|
38
|
+
<div class="SInputBase" :class="{ 'has-error': hasError }">
|
|
39
|
+
<label v-if="label" class="label" :for="name">
|
|
40
|
+
{{ label }} <span class="note">{{ note }}</span>
|
|
41
|
+
</label>
|
|
42
|
+
|
|
43
|
+
<slot />
|
|
44
|
+
|
|
45
|
+
<div class="help">
|
|
46
|
+
<slot name="before-help" />
|
|
47
|
+
<p v-if="showError" class="help-error">{{ errorMsg }}</p>
|
|
48
|
+
<p v-if="help" class="help-text">{{ help }}</p>
|
|
49
|
+
</div>
|
|
50
|
+
</div>
|
|
51
|
+
</template>
|
|
52
|
+
|
|
53
53
|
<style lang="postcss" scoped>
|
|
54
54
|
.SInputBase.mini {
|
|
55
55
|
.label {
|
|
@@ -83,9 +83,9 @@ const showError = computed(() => {
|
|
|
83
83
|
width: 100%;
|
|
84
84
|
line-height: 16px;
|
|
85
85
|
font-weight: 500;
|
|
86
|
-
color: var(--
|
|
86
|
+
color: var(--c-text-1);
|
|
87
87
|
cursor: pointer;
|
|
88
|
-
transition: color .25s;
|
|
88
|
+
transition: color 0.25s;
|
|
89
89
|
}
|
|
90
90
|
|
|
91
91
|
.note {
|
|
@@ -93,7 +93,7 @@ const showError = computed(() => {
|
|
|
93
93
|
margin-left: 8px;
|
|
94
94
|
font-size: 12px;
|
|
95
95
|
font-weight: 500;
|
|
96
|
-
color: var(--
|
|
96
|
+
color: var(--c-text-2);
|
|
97
97
|
}
|
|
98
98
|
|
|
99
99
|
.help {
|
|
@@ -118,7 +118,7 @@ const showError = computed(() => {
|
|
|
118
118
|
line-height: 20px;
|
|
119
119
|
font-size: 12px;
|
|
120
120
|
font-weight: 500;
|
|
121
|
-
color: var(--
|
|
121
|
+
color: var(--c-text-2);
|
|
122
122
|
}
|
|
123
123
|
|
|
124
124
|
.help-error + .help-text,
|
|
@@ -24,8 +24,8 @@
|
|
|
24
24
|
<script setup lang="ts">
|
|
25
25
|
import { PropType } from 'vue'
|
|
26
26
|
import { Validatable } from '../composables/Validation'
|
|
27
|
-
import SIconCheck from './icons/SIconCheck.vue'
|
|
28
27
|
import SInputBase from './SInputBase.vue'
|
|
28
|
+
import SIconCheck from './icons/SIconCheck.vue'
|
|
29
29
|
|
|
30
30
|
type Size = 'mini' | 'small' | 'medium'
|
|
31
31
|
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<SInputBase
|
|
3
|
+
class="SInputCheckboxes"
|
|
4
|
+
:class="[size]"
|
|
5
|
+
:name="name"
|
|
6
|
+
:label="label"
|
|
7
|
+
:note="note"
|
|
8
|
+
:help="help"
|
|
9
|
+
>
|
|
10
|
+
<div class="container">
|
|
11
|
+
<div class="row">
|
|
12
|
+
<div v-for="option in options" :key="option.value" class="col">
|
|
13
|
+
<SInputCheckbox
|
|
14
|
+
:text="option.label"
|
|
15
|
+
:model-value="isChecked(option.value)"
|
|
16
|
+
@update:model-value="handleChange(option.value)"
|
|
17
|
+
/>
|
|
18
|
+
</div>
|
|
19
|
+
</div>
|
|
20
|
+
</div>
|
|
21
|
+
</SInputBase>
|
|
22
|
+
</template>
|
|
23
|
+
|
|
24
|
+
<script setup lang="ts">
|
|
25
|
+
import { PropType } from 'vue'
|
|
26
|
+
import SInputBase from './SInputBase.vue'
|
|
27
|
+
import SInputCheckbox from './SInputCheckbox.vue'
|
|
28
|
+
|
|
29
|
+
type Size = 'mini' | 'small' | 'medium'
|
|
30
|
+
|
|
31
|
+
interface CheckboxOption {
|
|
32
|
+
label: string
|
|
33
|
+
value: any
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
const props = defineProps({
|
|
37
|
+
size: { type: String as PropType<Size>, default: 'small' },
|
|
38
|
+
name: { type: String, default: null },
|
|
39
|
+
label: { type: String, default: null },
|
|
40
|
+
note: { type: String, default: null },
|
|
41
|
+
help: { type: String, default: null },
|
|
42
|
+
options: { type: Array as PropType<CheckboxOption[]>, required: true },
|
|
43
|
+
modelValue: { type: Array, required: true }
|
|
44
|
+
})
|
|
45
|
+
|
|
46
|
+
const emit = defineEmits(['update:modelValue'])
|
|
47
|
+
|
|
48
|
+
function isChecked(value: unknown): boolean {
|
|
49
|
+
return props.modelValue.includes(value)
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
function handleChange(value: unknown): void {
|
|
53
|
+
const distinct = props.modelValue
|
|
54
|
+
.filter(v => v !== value)
|
|
55
|
+
.concat(props.modelValue.includes(value) ? [] : [value])
|
|
56
|
+
|
|
57
|
+
emit('update:modelValue', distinct)
|
|
58
|
+
}
|
|
59
|
+
</script>
|
|
60
|
+
|
|
61
|
+
<style lang="postcss" scoped>
|
|
62
|
+
.container {
|
|
63
|
+
display: flex;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
.row {
|
|
67
|
+
margin: -2px -8px;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
.col {
|
|
71
|
+
padding: 2px 8px;
|
|
72
|
+
}
|
|
73
|
+
</style>
|
|
74
|
+
|
|
@@ -0,0 +1,182 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<SInputBase
|
|
3
|
+
class="SInputDate"
|
|
4
|
+
:class="classes"
|
|
5
|
+
:name="name"
|
|
6
|
+
:label="label"
|
|
7
|
+
:note="note"
|
|
8
|
+
:help="help"
|
|
9
|
+
:validation="validation"
|
|
10
|
+
>
|
|
11
|
+
<div class="container">
|
|
12
|
+
<DatePicker
|
|
13
|
+
v-slot="{ inputValue, inputEvents }"
|
|
14
|
+
:value="modelValue"
|
|
15
|
+
color="blue"
|
|
16
|
+
is-dark
|
|
17
|
+
:masks="{ input: 'YYYY-MM-DD' }"
|
|
18
|
+
:model-config="{ type: 'string', mask: 'YYYY-MM-DD' }"
|
|
19
|
+
:popover="{ placement: 'bottom', visibility: 'click' }"
|
|
20
|
+
@input="emitInput"
|
|
21
|
+
>
|
|
22
|
+
<input
|
|
23
|
+
:id="name"
|
|
24
|
+
class="input"
|
|
25
|
+
type="text"
|
|
26
|
+
:placeholder="placeholder"
|
|
27
|
+
:disabled="disabled"
|
|
28
|
+
:value="inputValue"
|
|
29
|
+
autocomplete="off"
|
|
30
|
+
v-on="inputEvents"
|
|
31
|
+
@blur="emitBlur"
|
|
32
|
+
>
|
|
33
|
+
</DatePicker>
|
|
34
|
+
</div>
|
|
35
|
+
</SInputBase>
|
|
36
|
+
</template>
|
|
37
|
+
|
|
38
|
+
<script setup lang="ts">
|
|
39
|
+
import { DatePicker } from 'v-calendar'
|
|
40
|
+
import { PropType, computed } from 'vue'
|
|
41
|
+
import { Validation } from '../composables/Validation'
|
|
42
|
+
import SInputBase from './SInputBase.vue'
|
|
43
|
+
|
|
44
|
+
type Size = 'medium' | 'mini'
|
|
45
|
+
type Mode = 'filled' | 'outlined'
|
|
46
|
+
|
|
47
|
+
const props = defineProps({
|
|
48
|
+
size: { type: String as PropType<Size>, default: 'medium' },
|
|
49
|
+
mode: { type: String as PropType<Mode>, default: 'filled' },
|
|
50
|
+
name: { type: String, default: null },
|
|
51
|
+
label: { type: String, default: null },
|
|
52
|
+
note: { type: String, default: null },
|
|
53
|
+
help: { type: String, default: null },
|
|
54
|
+
placeholder: { type: String, default: 'YYYY-MM-DD' },
|
|
55
|
+
disabled: { type: Boolean, default: false },
|
|
56
|
+
modelValue: { type: String, default: null },
|
|
57
|
+
validation: { type: Object as PropType<Validation>, default: null }
|
|
58
|
+
})
|
|
59
|
+
|
|
60
|
+
const emit = defineEmits(['update:modelValue', 'blur'])
|
|
61
|
+
|
|
62
|
+
const classes = computed(() => [
|
|
63
|
+
props.size,
|
|
64
|
+
props.mode,
|
|
65
|
+
{
|
|
66
|
+
disabled: props.disabled
|
|
67
|
+
}
|
|
68
|
+
])
|
|
69
|
+
|
|
70
|
+
function emitInput(date: string | null) {
|
|
71
|
+
emit('update:modelValue', date)
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
function emitBlur(e: FocusEvent) {
|
|
75
|
+
setTimeout(() => {
|
|
76
|
+
props.validation && props.validation.$touch()
|
|
77
|
+
|
|
78
|
+
emit('blur', (e.target as HTMLInputElement).value)
|
|
79
|
+
}, 100)
|
|
80
|
+
}
|
|
81
|
+
</script>
|
|
82
|
+
|
|
83
|
+
<style lang="postcss" scoped>
|
|
84
|
+
.SInputDate.mini {
|
|
85
|
+
.input {
|
|
86
|
+
padding: 3px 12px;
|
|
87
|
+
width: 100%;
|
|
88
|
+
line-height: 24px;
|
|
89
|
+
font-size: 14px;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
.container {
|
|
93
|
+
height: 32px;
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
.SInputDate.medium {
|
|
98
|
+
.input {
|
|
99
|
+
padding: 11px 16px;
|
|
100
|
+
width: 100%;
|
|
101
|
+
line-height: 24px;
|
|
102
|
+
font-size: 16px;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
.container {
|
|
106
|
+
height: 48px;
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
.SInputDate.has-error {
|
|
111
|
+
.input {
|
|
112
|
+
border-color: var(--c-danger);
|
|
113
|
+
|
|
114
|
+
&:focus {
|
|
115
|
+
border-color: var(--c-danger);
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
.SInputDate.filled {
|
|
121
|
+
.input {
|
|
122
|
+
background-color: var(--input-filled-bg);
|
|
123
|
+
|
|
124
|
+
&:hover {
|
|
125
|
+
border-color: var(--input-focus-border);
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
&:focus {
|
|
129
|
+
border-color: var(--input-focus-border);
|
|
130
|
+
background-color: var(--input-filled-bg-focus);
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
&.disabled .input {
|
|
135
|
+
background-color: var(--input-filled-bg-disabled);
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
.SInputDate.outlined {
|
|
140
|
+
.input {
|
|
141
|
+
border-color: var(--input-outlined-border);
|
|
142
|
+
background-color: transparent;
|
|
143
|
+
|
|
144
|
+
&:hover {
|
|
145
|
+
border-color: var(--input-focus-border);
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
&:focus {
|
|
149
|
+
border-color: var(--input-focus-border);
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
&.disabled .input:hover {
|
|
154
|
+
border-color: var(--input-outlined-border);
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
&.disabled .input {
|
|
158
|
+
background-color: var(--input-outlined-bg-disabled);
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
.SInputDate.disabled {
|
|
163
|
+
.input:hover {
|
|
164
|
+
cursor: not-allowed;
|
|
165
|
+
border-color: transparent;
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
|
|
170
|
+
.input {
|
|
171
|
+
display: block;
|
|
172
|
+
border: 1px solid transparent;
|
|
173
|
+
border-radius: 4px;
|
|
174
|
+
width: 100%;
|
|
175
|
+
color: var(--input-text);
|
|
176
|
+
transition: border-color .25s, background-color .25s;
|
|
177
|
+
|
|
178
|
+
&::placeholder {
|
|
179
|
+
color: var(--input-placeholder);
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
</style>
|