@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.
Files changed (97) hide show
  1. package/README.md +6 -6
  2. package/lib/components/SAvatar.vue +17 -17
  3. package/lib/components/SButton.vue +512 -267
  4. package/lib/components/SButtonGroup.vue +149 -0
  5. package/lib/components/SDropdown.vue +26 -150
  6. package/lib/components/SDropdownSection.vue +48 -0
  7. package/lib/components/SDropdownSectionFilter.vue +189 -0
  8. package/lib/components/SDropdownSectionFilterItem.vue +21 -0
  9. package/lib/components/SDropdownSectionFilterItemAvatar.vue +31 -0
  10. package/lib/components/SDropdownSectionFilterItemText.vue +20 -0
  11. package/lib/components/SDropdownSectionMenu.vue +39 -0
  12. package/lib/components/SIcon.vue +13 -0
  13. package/lib/components/SInputBase.vue +31 -31
  14. package/lib/components/SInputCheckbox.vue +1 -1
  15. package/lib/components/SInputCheckboxes.vue +74 -0
  16. package/lib/components/SInputDate.vue +182 -0
  17. package/lib/components/SInputDropdown.vue +158 -157
  18. package/lib/components/SInputDropdownItem.vue +46 -48
  19. package/lib/components/{SInputDropdownItemUserTag.vue → SInputDropdownItemAvatar.vue} +43 -44
  20. package/lib/components/SInputDropdownItemText.vue +79 -16
  21. package/lib/components/SInputFile.vue +55 -60
  22. package/lib/components/SInputHMS.vue +120 -110
  23. package/lib/components/SInputNumber.vue +38 -9
  24. package/lib/components/SInputRadio.vue +39 -36
  25. package/lib/components/SInputRadios.vue +40 -53
  26. package/lib/components/SInputSelect.vue +3 -3
  27. package/lib/components/SInputSwitch.vue +193 -0
  28. package/lib/components/SInputSwitches.vue +88 -0
  29. package/lib/components/SInputText.vue +206 -62
  30. package/lib/components/SInputTextarea.vue +46 -32
  31. package/lib/components/SInputYMD.vue +123 -126
  32. package/lib/components/SMarkdown.vue +52 -0
  33. package/lib/components/SModal.vue +25 -63
  34. package/lib/components/SMount.vue +19 -0
  35. package/lib/components/SSheet.vue +49 -55
  36. package/lib/components/SSheetFooter.vue +1 -1
  37. package/lib/components/SSheetFooterAction.vue +24 -17
  38. package/lib/components/SSheetFooterActions.vue +1 -4
  39. package/lib/components/SSheetForm.vue +15 -0
  40. package/lib/components/SSheetMedium.vue +8 -10
  41. package/lib/components/SSheetTitle.vue +7 -14
  42. package/lib/components/SSnackbar.vue +55 -45
  43. package/lib/components/{SPortalSnackbars.vue → SSnackbars.vue} +17 -20
  44. package/lib/components/SStep.vue +106 -0
  45. package/lib/components/SSteps.vue +59 -0
  46. package/lib/components/STable.vue +241 -0
  47. package/lib/components/STableCell.vue +82 -0
  48. package/lib/components/STableCellAvatar.vue +69 -0
  49. package/lib/components/STableCellAvatars.vue +93 -0
  50. package/lib/components/STableCellDay.vue +40 -0
  51. package/lib/components/STableCellPill.vue +84 -0
  52. package/lib/components/STableCellText.vue +102 -0
  53. package/lib/components/STableColumn.vue +255 -0
  54. package/lib/components/STableFooter.vue +115 -0
  55. package/lib/components/STableHeader.vue +74 -0
  56. package/lib/components/STableItem.vue +38 -0
  57. package/lib/components/STooltip.vue +112 -0
  58. package/lib/composables/Dropdown.ts +40 -99
  59. package/lib/composables/Form.ts +21 -18
  60. package/lib/composables/Grid.ts +117 -0
  61. package/lib/composables/Markdown.ts +138 -0
  62. package/lib/composables/Step.ts +7 -0
  63. package/lib/composables/Table.ts +103 -0
  64. package/lib/composables/Tooltip.ts +91 -0
  65. package/lib/composables/Validation.ts +5 -9
  66. package/lib/composables/markdown/LinkPlugin.ts +45 -0
  67. package/lib/mixins/Sheet.ts +5 -3
  68. package/lib/stores/Snackbars.ts +48 -0
  69. package/lib/{assets/styles → styles}/base.css +0 -0
  70. package/lib/{assets/styles → styles}/bootstrap.css +1 -0
  71. package/lib/{assets/styles → styles}/variables.css +55 -48
  72. package/lib/support/Day.ts +8 -0
  73. package/lib/support/Num.ts +3 -0
  74. package/lib/support/Time.ts +5 -2
  75. package/lib/support/Utils.ts +4 -3
  76. package/lib/types/shims.d.ts +3 -0
  77. package/lib/validation/validators/requiredYmd.ts +1 -1
  78. package/lib/validation/validators/ymd.ts +4 -4
  79. package/package.json +57 -37
  80. package/CHANGELOG.md +0 -47
  81. package/lib/.DS_Store +0 -0
  82. package/lib/components/.DS_Store +0 -0
  83. package/lib/components/SDialog.vue +0 -140
  84. package/lib/components/SDropdownItem.vue +0 -78
  85. package/lib/components/SDropdownItemText.vue +0 -22
  86. package/lib/components/SDropdownItemUser.vue +0 -40
  87. package/lib/components/SInputDropdownItemTextTag.vue +0 -94
  88. package/lib/components/SInputDropdownItemUser.vue +0 -41
  89. package/lib/components/SPortalModals.vue +0 -74
  90. package/lib/components/icons/.DS_Store +0 -0
  91. package/lib/composables/Dialog.ts +0 -38
  92. package/lib/composables/Modal.ts +0 -34
  93. package/lib/composables/Snackbar.ts +0 -18
  94. package/lib/store/Sefirot.ts +0 -17
  95. package/lib/store/dialog/index.ts +0 -42
  96. package/lib/store/modal/index.ts +0 -61
  97. package/lib/store/snackbars/index.ts +0 -70
@@ -1,45 +1,27 @@
1
- <template>
2
- <SInputBase
3
- class="SInputText"
4
- :class="classes"
5
- :label="label"
6
- :note="note"
7
- :help="help"
8
- :error-message="errorMessage"
9
- :validation="validation"
10
- >
11
- <input
12
- class="input"
13
- :type="type"
14
- :placeholder="placeholder"
15
- :disabled="disabled"
16
- :value="modelValue"
17
- @input="emitInput"
18
- @blur="emitBlur"
19
- @keypress.enter="emitEnter"
20
- >
21
- </SInputBase>
22
- </template>
23
-
24
1
  <script setup lang="ts">
25
- import { PropType, computed } from 'vue'
26
- import { Validation, Validatable } from '../composables/Validation'
2
+ import { ref, computed } from 'vue'
3
+ import { Validatable } from '../composables/Validation'
27
4
  import SInputBase from './SInputBase.vue'
28
5
 
29
- type Size = 'mini' | 'small' | 'medium'
30
-
31
- const props = defineProps({
32
- size: { type: String as PropType<Size>, default: 'small' },
33
- label: { type: String, default: null },
34
- note: { type: String, default: null },
35
- help: { type: String, default: null },
36
- type: { type: String, default: 'text' },
37
- placeholder: { type: String, default: null },
38
- disabled: { type: Boolean, default: false },
39
- errorMessage: { type: Boolean, default: true },
40
- modelValue: { type: [String, Number] as PropType<string | number | null>, default: null },
41
- validation: { type: Object as PropType<Validatable>, default: null }
42
- })
6
+ export type Size = 'mini' | 'small' | 'medium'
7
+ export type Align = 'left' | 'center' | 'right'
8
+
9
+ const props = defineProps<{
10
+ size?: Size
11
+ name?: string
12
+ label?: string
13
+ note?: string
14
+ help?: string
15
+ type?: string
16
+ placeholder?: string
17
+ icon?: any
18
+ align?: Align
19
+ disabled?: boolean
20
+ modelValue: string | null
21
+ displayValue?: string | null
22
+ hideError?: boolean
23
+ validation?: Validatable
24
+ }>()
43
25
 
44
26
  const emit = defineEmits<{
45
27
  (e: 'update:modelValue', value: string | null): void
@@ -47,13 +29,24 @@ const emit = defineEmits<{
47
29
  (e: 'enter', value: string | null): void
48
30
  }>()
49
31
 
32
+ const input = ref<HTMLElement | null>(null)
33
+ const isFocused = ref(false)
34
+
50
35
  const classes = computed(() => [
51
- props.size,
36
+ props.size ?? 'small',
52
37
  { disabled: props.disabled }
53
38
  ])
54
39
 
55
- function emitInput(e: Event): void {
56
- emit('update:modelValue', getValue(e))
40
+ const showDisplay = computed(() => {
41
+ return !isFocused.value && props.displayValue
42
+ })
43
+
44
+ function focus(): void {
45
+ input.value?.focus()
46
+ }
47
+
48
+ function onFocus(): void {
49
+ isFocused.value = true
57
50
  }
58
51
 
59
52
  function emitBlur(e: FocusEvent): void {
@@ -63,6 +56,12 @@ function emitBlur(e: FocusEvent): void {
63
56
 
64
57
  emit('update:modelValue', value)
65
58
  emit('blur', value)
59
+
60
+ isFocused.value = false
61
+ }
62
+
63
+ function emitInput(e: Event): void {
64
+ emit('update:modelValue', getValue(e))
66
65
  }
67
66
 
68
67
  function emitEnter(e: KeyboardEvent): void {
@@ -81,37 +80,139 @@ function getValue(e: Event | FocusEvent | KeyboardEvent): string | null {
81
80
  }
82
81
  </script>
83
82
 
83
+ <template>
84
+ <SInputBase
85
+ class="SInputText"
86
+ :class="classes"
87
+ :name="name"
88
+ :label="label"
89
+ :note="note"
90
+ :help="help"
91
+ :hide-error="hideError"
92
+ :validation="validation"
93
+ >
94
+ <div class="box" :class="{ focus: isFocused }" @click="focus">
95
+ <div v-if="icon" class="icon">
96
+ <component :is="icon" class="icon-svg" />
97
+ </div>
98
+
99
+ <div class="value">
100
+ <input
101
+ class="input"
102
+ :class="{ hide: showDisplay }"
103
+ :id="name"
104
+ :type="type ?? 'text'"
105
+ :placeholder="placeholder"
106
+ :disabled="disabled"
107
+ :value="modelValue"
108
+ ref="input"
109
+ @focus="onFocus"
110
+ @blur="emitBlur"
111
+ @input="emitInput"
112
+ @keypress.enter="emitEnter"
113
+ >
114
+ <div v-if="showDisplay" class="display">
115
+ {{ displayValue }}
116
+ </div>
117
+ </div>
118
+ </div>
119
+ </SInputBase>
120
+ </template>
121
+
84
122
  <style lang="postcss" scoped>
85
123
  .SInputText.mini {
86
- .input {
124
+ .input,
125
+ .input-area {
126
+ min-height: 32px;
87
127
  padding: 3px 12px;
88
128
  font-size: 14px;
129
+
130
+ &.has-icon {
131
+ padding-left: 30px;
132
+ }
133
+ }
134
+
135
+ .icon {
136
+ top: 9px;
137
+ left: 10px;
138
+ }
139
+
140
+ .icon-svg {
141
+ width: 14px;
142
+ height: 14px;
89
143
  }
90
144
  }
91
145
 
92
146
  .SInputText.small {
93
- .input {
94
- padding: 7px 12px;
147
+ .box {
148
+ min-height: 40px;
149
+ }
150
+
151
+ .value,
152
+ .input,
153
+ .display {
154
+ min-height: 38px;
155
+ }
156
+
157
+ .box {
158
+ padding: 0 12px;
159
+ }
160
+
161
+ .input,
162
+ .display {
163
+ padding: 5px 0;
164
+ letter-spacing: 0;
165
+ line-height: 24px;
95
166
  font-size: 16px;
96
167
  }
168
+
169
+ .icon {
170
+ width: 26px;
171
+ height: 38px;
172
+ }
173
+
174
+ .icon-svg {
175
+ width: 16px;
176
+ height: 16px;
177
+ }
97
178
  }
98
179
 
99
180
  .SInputText.medium {
100
- .input {
181
+ .input,
182
+ .input-area {
183
+ min-height: 48px;
101
184
  padding: 11px 16px;
102
185
  font-size: 16px;
186
+
187
+ &.has-icon {
188
+ padding-left: 36px;
189
+ }
190
+ }
191
+
192
+ .icon {
193
+ top: 16px;
194
+ left: 12px;
195
+ }
196
+
197
+ .icon-svg {
198
+ width: 16px;
199
+ height: 16px;
103
200
  }
104
201
  }
105
202
 
106
203
  .SInputText.disabled {
107
204
  .input {
205
+ background-color: var(--input-outlined-bg-disabled);
206
+ }
207
+
208
+ .box:hover .input {
108
209
  cursor: not-allowed;
109
- border-color: transparent;
210
+ border-color: var(--input-outlined-border);
110
211
  }
111
212
  }
112
213
 
113
214
  .SInputText.has-error {
114
- .input {
215
+ .box {
115
216
  border-color: var(--c-danger);
116
217
 
117
218
  &:hover,
@@ -121,28 +222,71 @@ function getValue(e: Event | FocusEvent | KeyboardEvent): string | null {
121
222
  }
122
223
  }
123
224
 
124
- .input {
125
- display: block;
225
+ .box {
226
+ position: relative;
227
+ display: flex;
126
228
  flex-grow: 1;
127
- border: 1px solid var(--input-border);
128
- border-radius: 4px;
229
+ max-width: 100%;
230
+ border: 1px solid var(--c-divider);
231
+ border-radius: 6px;
232
+ background-color: var(--c-bg);
233
+ cursor: text;
234
+ transition: border-color 0.25s;
235
+
236
+ &:hover {
237
+ border-color: var(--c-black);
238
+ }
239
+
240
+ &.focus,
241
+ &:hover.focus {
242
+ border-color: var(--c-info);
243
+ }
244
+
245
+ .dark &:hover {
246
+ border-color: var(--c-gray);
247
+ }
248
+
249
+ .dark &.focus,
250
+ .dark &:hover.focus {
251
+ border-color: var(--c-info);
252
+ }
253
+ }
254
+
255
+ .value {
256
+ position: relative;
257
+ flex-grow: 1;
258
+ }
259
+
260
+ .input {
129
261
  width: 100%;
130
- font-weight: 400;
131
262
  background-color: transparent;
132
- transition: border-color .25s, background-color .25s;
263
+
264
+ &.hide,
265
+ &.hide::placeholder {
266
+ color: transparent;
267
+ }
133
268
 
134
269
  &::placeholder {
135
270
  font-weight: 500;
136
- color: var(--input-placeholder);
271
+ color: var(--c-text-3);
137
272
  }
273
+ }
138
274
 
139
- &:hover {
140
- border-color: var(--input-hover-border);
141
- }
275
+ .display {
276
+ position: absolute;
277
+ top: 0;
278
+ left: 0;
279
+ width: 100%;
280
+ }
142
281
 
143
- &:focus {
144
- border-color: var(--input-focus-border);
145
- background-color: transparent;
146
- }
282
+ .icon {
283
+ display: flex;
284
+ align-items: center;
285
+ cursor: text;
286
+ color: var(--c-text-2);
287
+ }
288
+
289
+ .icon-svg {
290
+ fill: currentColor;
147
291
  }
148
292
  </style>
@@ -2,18 +2,20 @@
2
2
  <SInputBase
3
3
  class="SInputTextarea"
4
4
  :class="classes"
5
+ :name="name"
5
6
  :label="label"
6
7
  :note="note"
7
8
  :help="help"
8
- :error-message="errorMessage"
9
+ :hide-error="hideError"
9
10
  :validation="validation"
10
11
  >
11
12
  <textarea
13
+ :id="name"
12
14
  class="input"
13
15
  :placeholder="placeholder"
14
- :rows="rows"
16
+ :rows="rows ?? 3"
15
17
  :disabled="disabled"
16
- :value="modelValue ?? undefined"
18
+ :value="modelValue ?? ''"
17
19
  @input="emitInput"
18
20
  @blur="emitBlur"
19
21
  />
@@ -21,29 +23,32 @@
21
23
  </template>
22
24
 
23
25
  <script setup lang="ts">
24
- import { PropType, computed } from 'vue'
26
+ import { computed } from 'vue'
25
27
  import { Validatable } from '../composables/Validation'
26
28
  import SInputBase from './SInputBase.vue'
27
29
 
28
- type Size = 'mini' | 'small' | 'medium'
29
-
30
- const props = defineProps({
31
- size: { type: String as PropType<Size>, default: 'small' },
32
- label: { type: String, default: null },
33
- note: { type: String, default: null },
34
- help: { type: String, default: null },
35
- placeholder: { type: String, default: null },
36
- disabled: { type: Boolean, default: false },
37
- rows: { type: Number, default: 3 },
38
- errorMessage: { type: Boolean, default: true },
39
- modelValue: { type: String as PropType<string | null>, default: null },
40
- validation: { type: Object as PropType<Validatable>, default: null }
41
- })
42
-
43
- const emit = defineEmits(['update:modelValue'])
30
+ export type Size = 'mini' | 'small' | 'medium'
31
+
32
+ const props = defineProps<{
33
+ size?: Size
34
+ name?: string
35
+ label?: string
36
+ note?: string
37
+ help?: string
38
+ placeholder?: string
39
+ disabled?: boolean
40
+ rows?: number
41
+ modelValue: string | null
42
+ hideError?: boolean
43
+ validation?: Validatable
44
+ }>()
45
+
46
+ const emit = defineEmits<{
47
+ (e: 'update:modelValue', value: string): void
48
+ }>()
44
49
 
45
50
  const classes = computed(() => [
46
- props.size,
51
+ props.size ?? 'small',
47
52
  { disabled: props.disabled }
48
53
  ])
49
54
 
@@ -70,9 +75,9 @@ function emitBlur(e: FocusEvent): void {
70
75
 
71
76
  .SInputTextarea.small {
72
77
  .input {
73
- padding: 7px 12px;
78
+ padding: 12px;
74
79
  width: 100%;
75
- min-height: 88px;
80
+ min-height: 96px;
76
81
  line-height: 24px;
77
82
  font-size: 16px;
78
83
  }
@@ -110,25 +115,34 @@ function emitBlur(e: FocusEvent): void {
110
115
  .input {
111
116
  display: block;
112
117
  flex-grow: 1;
113
- border: 1px solid var(--input-border);
114
- border-radius: 4px;
118
+ border: 1px solid var(--c-divider);
119
+ border-radius: 6px;
115
120
  width: 100%;
116
121
  font-weight: 400;
117
- background-color: transparent;
118
- transition: border-color .25s, background-color .25s;
122
+ background-color: var(--c-bg);
123
+ transition: border-color 0.25s, background-color 0.25s;
119
124
 
120
125
  &::placeholder {
121
126
  font-weight: 500;
122
- color: var(--input-placeholder);
127
+ color: var(--c-text-3);
123
128
  }
124
129
 
125
130
  &:hover {
126
- border-color: var(--input-hover-border);
131
+ border-color: var(--c-black);
132
+ }
133
+
134
+ &:focus,
135
+ &:hover:focus {
136
+ border-color: var(--c-info);
137
+ }
138
+
139
+ .dark &:hover {
140
+ border-color: var(--c-gray);
127
141
  }
128
142
 
129
- &:focus {
130
- border-color: var(--input-focus-border);
131
- background-color: transparent;
143
+ .dark &:focus,
144
+ .dark &:hover:focus {
145
+ border-color: var(--c-info);
132
146
  }
133
147
  }
134
148
  </style>