@globalbrain/sefirot 0.65.0 → 0.68.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 (52) hide show
  1. package/CHANGELOG.md +49 -0
  2. package/README.md +5 -17
  3. package/lib/.DS_Store +0 -0
  4. package/lib/assets/styles/variables.css +345 -5
  5. package/lib/components/.DS_Store +0 -0
  6. package/lib/components/SButton.vue +22 -27
  7. package/lib/components/SButtonGroup.vue +40 -22
  8. package/lib/components/SDialog.vue +4 -3
  9. package/lib/components/SInputBase.vue +27 -5
  10. package/lib/components/SInputNumber.vue +18 -1
  11. package/lib/components/SInputRadio.vue +5 -4
  12. package/lib/components/SInputText.vue +176 -19
  13. package/lib/components/SInputTextarea.vue +13 -2
  14. package/lib/components/SInputYMD.vue +244 -0
  15. package/lib/components/SModal.vue +7 -2
  16. package/lib/components/SSheet.vue +47 -0
  17. package/lib/components/SSheetFooter.vue +14 -0
  18. package/lib/components/SSheetFooterAction.vue +32 -0
  19. package/lib/components/SSheetFooterActions.vue +19 -0
  20. package/lib/components/SSheetHeader.vue +75 -0
  21. package/lib/components/SSheetHeaderTitle.vue +17 -0
  22. package/lib/components/SSheetMedium.vue +92 -0
  23. package/lib/components/SSnackbar.vue +7 -2
  24. package/lib/components/icons/.DS_Store +0 -0
  25. package/lib/components/icons/SIconGrab.vue +10 -0
  26. package/lib/components/icons/SIconInbox.vue +5 -0
  27. package/lib/components/icons/SIconLock.vue +5 -0
  28. package/lib/components/icons/SIconMoreVertical.vue +7 -0
  29. package/lib/components/icons/SIconPreloader.vue +239 -0
  30. package/lib/composables/Modal.ts +16 -5
  31. package/lib/composables/Tooltip.ts +1 -1
  32. package/lib/mixins/Sheet.ts +22 -0
  33. package/lib/validation/rules/every.ts +38 -0
  34. package/lib/validation/rules/index.ts +13 -1
  35. package/lib/validation/rules/requiredMonthDate.ts +11 -0
  36. package/lib/validation/rules/requiredYearMonth.ts +11 -0
  37. package/lib/validation/rules/requiredYearMonthDate.ts +11 -0
  38. package/lib/validation/rules/yearMonth.ts +11 -0
  39. package/lib/validation/rules/yearMonthDate.ts +11 -0
  40. package/lib/validation/validators/index.ts +13 -1
  41. package/lib/validation/validators/monthDate.ts +20 -0
  42. package/lib/validation/validators/requiredMonthDate.ts +8 -0
  43. package/lib/validation/validators/requiredYearMonth.ts +8 -0
  44. package/lib/validation/validators/requiredYearMonthDate.ts +9 -0
  45. package/lib/validation/validators/yearMonth.ts +20 -0
  46. package/lib/validation/validators/yearMonthDate.ts +21 -0
  47. package/package.json +30 -29
  48. package/lib/assets/styles/variables/colors.css +0 -189
  49. package/lib/assets/styles/variables/easings.css +0 -12
  50. package/lib/assets/styles/variables/shadows.css +0 -7
  51. package/lib/assets/styles/variables/typography.css +0 -6
  52. package/lib/assets/styles/variables/z-indexes.css +0 -8
@@ -24,6 +24,7 @@ export default defineComponent({
24
24
  note: { type: String, default: null },
25
25
  label: { type: String, default: null },
26
26
  help: { type: String, default: null },
27
+ errorMessage: { type: Boolean, default: true },
27
28
  validation: { type: Object as PropType<Validation>, default: null }
28
29
  },
29
30
 
@@ -46,7 +47,9 @@ export default defineComponent({
46
47
  return errors.length > 0 ? errors[0][1] : null
47
48
  })
48
49
 
49
- const showError = computed(() => hasError.value && errorMsg.value)
50
+ const showError = computed(() => {
51
+ return props.errorMessage && hasError.value && errorMsg.value
52
+ })
50
53
 
51
54
  return {
52
55
  hasError,
@@ -60,8 +63,7 @@ export default defineComponent({
60
63
  <style lang="postcss" scoped>
61
64
  @import "@/assets/styles/variables";
62
65
 
63
- .SInputBase.mini,
64
- .SInputBase.small {
66
+ .SInputBase.mini {
65
67
  .label {
66
68
  padding-bottom: 6px;
67
69
  font-size: 12px;
@@ -76,6 +78,28 @@ export default defineComponent({
76
78
  }
77
79
  }
78
80
 
81
+ .SInputBase.small {
82
+ .label {
83
+ padding-bottom: 8px;
84
+ font-size: 14px;
85
+ }
86
+
87
+ .help-text {
88
+ padding-top: 4px;
89
+ }
90
+ }
91
+
92
+ .SInputBase.medium {
93
+ .label {
94
+ padding-bottom: 8px;
95
+ font-size: 14px;
96
+ }
97
+
98
+ .help-text {
99
+ padding-top: 4px;
100
+ }
101
+ }
102
+
79
103
  .SInputBase.has-error {
80
104
  .label {
81
105
  color: var(--c-danger);
@@ -84,10 +108,8 @@ export default defineComponent({
84
108
 
85
109
  .label {
86
110
  display: block;
87
- padding-bottom: 10px;
88
111
  width: 100%;
89
112
  line-height: 16px;
90
- font-size: 14px;
91
113
  font-weight: 500;
92
114
  color: var(--input-label);
93
115
  cursor: pointer;
@@ -9,13 +9,17 @@
9
9
  :help="help"
10
10
  type="number"
11
11
  :placeholder="placeholder"
12
+ :align="align"
12
13
  :text="text"
13
14
  :text-after="textAfter"
14
15
  :action="action"
16
+ :color="color"
15
17
  :step="step"
16
18
  :disabled="disabled"
17
19
  :validation="validation"
20
+ :display-value="displayValue"
18
21
  :value="value"
22
+ :error-message="errorMessage"
19
23
  @input="emitInput"
20
24
  @blur="emitBlur"
21
25
  @enter="emitEnter"
@@ -33,7 +37,7 @@
33
37
  import { defineComponent, computed, PropType } from '@vue/composition-api'
34
38
  import { isNullish } from '../support/Util'
35
39
  import { Validation } from '../validation/Validation'
36
- import SInputText, { Size, Mode, Action } from './SInputText.vue'
40
+ import SInputText, { Size, Mode, Align, Color, Action } from './SInputText.vue'
37
41
 
38
42
  export default defineComponent({
39
43
  components: {
@@ -48,12 +52,16 @@ export default defineComponent({
48
52
  note: { type: String, default: null },
49
53
  help: { type: String, default: null },
50
54
  placeholder: { type: String, default: null },
55
+ align: { type: String as PropType<Align>, default: null },
51
56
  text: { type: String, default: null },
52
57
  textAfter: { type: String, default: null },
53
58
  action: { type: Object as PropType<Action>, default: null },
59
+ color: { type: Function as PropType<(value: number) => Color>, default: null },
54
60
  step: { type: Number, default: 1 },
61
+ separator: { type: Boolean, default: false },
55
62
  helpFormat: { type: Boolean, default: false },
56
63
  disabled: { type: Boolean, default: false },
64
+ errorMessage: { type: Boolean, default: true },
57
65
  value: { type: Number, default: null },
58
66
  validation: { type: Object as PropType<Validation>, default: null }
59
67
  },
@@ -69,6 +77,14 @@ export default defineComponent({
69
77
  : props.value.toLocaleString('en-US', { maximumFractionDigits: 20 })
70
78
  })
71
79
 
80
+ const displayValue = computed(() => {
81
+ if (!props.separator) {
82
+ return null
83
+ }
84
+
85
+ return valueWithSeparator.value !== '0' ? valueWithSeparator.value : null
86
+ })
87
+
72
88
  function emitInput(value: number): void {
73
89
  emit('input', value)
74
90
  }
@@ -83,6 +99,7 @@ export default defineComponent({
83
99
 
84
100
  return {
85
101
  valueWithSeparator,
102
+ displayValue,
86
103
  emitInput,
87
104
  emitBlur,
88
105
  emitEnter
@@ -68,14 +68,14 @@ export default defineComponent({
68
68
 
69
69
  &:hover {
70
70
  .box {
71
- border-color: var(--c-black);
71
+ border-color: var(--c-text-1);
72
72
  }
73
73
  }
74
74
  }
75
75
 
76
76
  .input.on {
77
77
  .box {
78
- border-color: var(--c-black);
78
+ border-color: var(--c-text-1);
79
79
  box-shadow: var(--shadow-depth-3);
80
80
  }
81
81
 
@@ -87,7 +87,7 @@ export default defineComponent({
87
87
 
88
88
  .box {
89
89
  position: relative;
90
- border: 2px solid var(--c-gray-dark-1);
90
+ border: 2px solid var(--c-text-3);
91
91
  border-radius: 50%;
92
92
  width: 18px;
93
93
  height: 18px;
@@ -105,7 +105,7 @@ export default defineComponent({
105
105
  align-items: center;
106
106
  border-radius: 50%;
107
107
  width: 100%;
108
- background-color: var(--c-black);
108
+ background-color: var(--c-text-1);
109
109
  opacity: 0;
110
110
  transform: scale(0);
111
111
  transition: opacity .25s, transform .1s;
@@ -116,5 +116,6 @@ export default defineComponent({
116
116
  padding-left: 12px;
117
117
  line-height: 20px;
118
118
  font-size: 14px;
119
+ font-weight: 500;
119
120
  }
120
121
  </style>
@@ -6,6 +6,7 @@
6
6
  :label="label"
7
7
  :note="note"
8
8
  :help="help"
9
+ :error-message="errorMessage"
9
10
  :validation="validation"
10
11
  >
11
12
  <div class="container">
@@ -28,14 +29,14 @@
28
29
  <input
29
30
  :id="name"
30
31
  ref="inputEl"
31
- class="input"
32
- :class="{ 'has-icon': icon, 'is-clearable': isClearable }"
32
+ class="input-area"
33
+ :class="inputAreaClasses"
33
34
  :style="inputStyles"
34
35
  :type="type"
35
36
  :step="step"
36
- :placeholder="placeholder"
37
37
  :disabled="disabled"
38
38
  :value="value"
39
+ :placeholder="placeholder"
39
40
  @input="emitInput"
40
41
  @blur="emitBlur"
41
42
  @keypress.enter="emitEnter"
@@ -43,6 +44,16 @@
43
44
  @keyup.escape="$emit('escape')"
44
45
  >
45
46
 
47
+ <div
48
+ class="input"
49
+ :class="inputClasses"
50
+ :style="inputStyles"
51
+ >
52
+ <span v-if="displayValue !== null || value !== null" class="value">
53
+ {{ displayValue !== null ? displayValue : value }}
54
+ </span>
55
+ </div>
56
+
46
57
  <div v-if="icon" class="icon" role="button" @click="focus">
47
58
  <component :is="icon" class="icon-svg" />
48
59
  </div>
@@ -69,13 +80,13 @@
69
80
 
70
81
  <script lang="ts">
71
82
  import {
83
+ PropType,
72
84
  defineComponent,
73
85
  ref,
74
86
  reactive,
75
87
  computed,
76
88
  watch,
77
- onMounted,
78
- PropType
89
+ onMounted
79
90
  } from '@vue/composition-api'
80
91
  import { Validation } from '../validation/Validation'
81
92
  import { SyntheticInputEvent } from '../types/Utils'
@@ -84,8 +95,11 @@ import SIconChevronDown from './icons/SIconChevronDown.vue'
84
95
  import SIconX from './icons/SIconX.vue'
85
96
  import SInputBase from './SInputBase.vue'
86
97
 
87
- export type Size = 'medium' | 'mini'
98
+ export type Size = 'mini' | 'small' | 'medium'
88
99
  export type Mode = 'filled' | 'outlined'
100
+ export type Align = 'left' | 'center' | 'right'
101
+ export type Color = 'neutral' | 'info' | 'success' | 'warning' | 'danger'
102
+ export type ColorCallback = (value: string | number) => Color
89
103
 
90
104
  export interface Action {
91
105
  type?: 'button' | 'select'
@@ -113,11 +127,15 @@ export default defineComponent({
113
127
  placeholder: { type: String, default: null },
114
128
  action: { type: Object as PropType<Action>, default: null },
115
129
  icon: { type: Object, default: null },
130
+ align: { type: String as PropType<Align>, default: null },
116
131
  text: { type: String, default: null },
117
132
  textAfter: { type: String, default: null },
133
+ color: { type: Function as PropType<ColorCallback>, default: null },
118
134
  step: { type: Number, default: 1 },
119
135
  clearable: { type: Boolean, default: false },
120
136
  disabled: { type: Boolean, default: false },
137
+ errorMessage: { type: Boolean, default: true },
138
+ displayValue: { type: String, default: null },
121
139
  value: { type: [String, Number], default: null },
122
140
  validation: { type: Object as PropType<Validation>, default: null }
123
141
  },
@@ -126,25 +144,44 @@ export default defineComponent({
126
144
  const inputEl = ref<HTMLElement | null>(null)
127
145
  const textEl = ref<HTMLElement | null>(null)
128
146
  const textAfterEl = ref<HTMLElement | null>(null)
147
+ const color = ref<Color | null>(null)
129
148
 
130
- const classes = computed(() => ({
131
- medium: props.size === 'medium',
132
- mini: props.size === 'mini',
133
- filled: props.mode === 'filled',
134
- outlined: props.mode === 'outlined',
135
- disabled: props.disabled
136
- }))
149
+ const classes = computed(() => [
150
+ props.size,
151
+ props.mode,
152
+ { disabled: props.disabled }
153
+ ])
137
154
 
138
155
  const inputStyles = reactive({
156
+ textAlign: props.align,
139
157
  paddingRight: '',
140
158
  paddingLeft: ''
141
159
  })
142
160
 
161
+ const isClearable = computed(() => props.clearable && !props.disabled)
162
+
163
+ const inputClasses = computed(() => [
164
+ color.value,
165
+ { 'has-icon': props.icon },
166
+ { 'is-clearable': isClearable.value }
167
+ ])
168
+
169
+ const inputAreaClasses = computed(() => ({
170
+ 'has-icon': props.icon,
171
+ 'is-clearable': isClearable.value
172
+ }))
173
+
143
174
  const showClearButton = computed(() => {
144
175
  return props.value !== null && props.value !== ''
145
176
  })
146
177
 
147
- const isClearable = computed(() => props.clearable && !props.disabled)
178
+ watch(() => props.value, () => {
179
+ if (!props.color) {
180
+ return
181
+ }
182
+
183
+ color.value = props.color(props.value)
184
+ })
148
185
 
149
186
  onMounted(() => {
150
187
  setTextPadding()
@@ -205,6 +242,8 @@ export default defineComponent({
205
242
  textAfterEl,
206
243
  classes,
207
244
  inputStyles,
245
+ inputClasses,
246
+ inputAreaClasses,
208
247
  isClearable,
209
248
  showClearButton,
210
249
  focus,
@@ -242,10 +281,12 @@ export default defineComponent({
242
281
  font-size: 14px;
243
282
  }
244
283
 
245
- .input {
284
+ .input,
285
+ .input-area {
246
286
  padding: 3px 12px;
247
287
  width: 100%;
248
288
  line-height: 24px;
289
+ min-height: 32px;
249
290
  font-size: 14px;
250
291
 
251
292
  &.has-icon {
@@ -292,6 +333,79 @@ export default defineComponent({
292
333
  }
293
334
  }
294
335
 
336
+ .SInputText.small {
337
+ .action {
338
+ padding: 3px 10px;
339
+ line-height: 24px;
340
+ }
341
+
342
+ .action-icon {
343
+ width: 14px;
344
+ height: 14px;
345
+ }
346
+
347
+ .action-icon + .action-text,
348
+ .action-icon + .action-select,
349
+ .action-text + .action-select {
350
+ margin-left: 6px;
351
+ }
352
+
353
+ .action-text {
354
+ font-size: 14px;
355
+ }
356
+
357
+ .input,
358
+ .input-area {
359
+ padding: 7px 12px;
360
+ width: 100%;
361
+ line-height: 24px;
362
+ min-height: 40px;
363
+ font-size: 16px;
364
+
365
+ &.has-icon {
366
+ padding-left: 30px;
367
+ }
368
+
369
+ &.is-clearable {
370
+ padding-right: 40px;
371
+ }
372
+ }
373
+
374
+ .icon {
375
+ top: 9px;
376
+ left: 10px;
377
+ }
378
+
379
+ .icon-svg {
380
+ width: 14px;
381
+ height: 14px;
382
+ }
383
+
384
+ .text {
385
+ padding: 0 8px 0 12px;
386
+ line-height: 40px;
387
+ font-size: 16px;
388
+ }
389
+
390
+ .text-after {
391
+ padding: 0 12px 0 8px;
392
+ line-height: 32px;
393
+ font-size: 14px;
394
+ }
395
+
396
+ .clear {
397
+ top: 0;
398
+ right: 0;
399
+ width: 32px;
400
+ height: 32px;
401
+ }
402
+
403
+ .clear-svg {
404
+ width: 10px;
405
+ height: 10px;
406
+ }
407
+ }
408
+
295
409
  .SInputText.medium {
296
410
  .action {
297
411
  padding: 11px 12px;
@@ -313,9 +427,11 @@ export default defineComponent({
313
427
  font-size: 14px;
314
428
  }
315
429
 
316
- .input {
430
+ .input,
431
+ .input-area {
317
432
  padding: 11px 16px;
318
433
  width: 100%;
434
+ min-height: 48px;
319
435
  line-height: 24px;
320
436
  font-size: 16px;
321
437
 
@@ -374,10 +490,15 @@ export default defineComponent({
374
490
 
375
491
  &:focus {
376
492
  border-color: var(--input-focus-border);
377
- background-color: var(--input-focus-bg);
493
+ background-color: var(--input-filled-bg-focus);
378
494
  }
379
495
  }
380
496
 
497
+ .input-area:focus + .input {
498
+ border-color: var(--input-focus-border);
499
+ background-color: var(--input-filled-bg-focus);
500
+ }
501
+
381
502
  &.disabled .input {
382
503
  background-color: var(--input-filled-bg-disabled);
383
504
  }
@@ -401,6 +522,11 @@ export default defineComponent({
401
522
  }
402
523
  }
403
524
 
525
+ .input-area:focus + .input {
526
+ border-color: var(--input-focus-border);
527
+ background-color: var(--input-filled-bg-focus);
528
+ }
529
+
404
530
  &.disabled .box:hover .input {
405
531
  border-color: var(--input-outlined-border);
406
532
  }
@@ -479,6 +605,7 @@ export default defineComponent({
479
605
  position: relative;
480
606
  display: flex;
481
607
  flex-grow: 1;
608
+ max-width: 100%;
482
609
 
483
610
  &:hover .input {
484
611
  border-color: var(--input-focus-border);
@@ -491,12 +618,42 @@ export default defineComponent({
491
618
  border-radius: 4px;
492
619
  color: var(--input-text);
493
620
  transition: border-color .25s, background-color .25s;
621
+ opacity: 1;
494
622
 
495
- &::placeholder {
496
- color: var(--input-placeholder);
623
+ .value {
624
+ display: block;
625
+ line-height: 24px;
626
+ overflow: hidden;
497
627
  }
498
628
  }
499
629
 
630
+ .input-area {
631
+ position: absolute;
632
+ top: 0;
633
+ left: 0;
634
+ letter-spacing: .4px;
635
+ background: transparent;
636
+ border: 1px solid transparent;
637
+ color: transparent;
638
+
639
+ &:focus {
640
+ color: var(--c-text-1);
641
+ }
642
+
643
+ &:focus + .input .value {
644
+ opacity: 0;
645
+ }
646
+ }
647
+
648
+ .input,
649
+ .input-area {
650
+ &.neutral { color: var(--c-black); }
651
+ &.info { color: var(--c-info); }
652
+ &.success { color: var(--c-success); }
653
+ &.warning { color: var(--c-warning); }
654
+ &.danger { color: var(--c-danger); }
655
+ }
656
+
500
657
  .icon {
501
658
  position: absolute;
502
659
  cursor: text;
@@ -29,7 +29,7 @@ import { SyntheticInputEvent } from '../types/Utils'
29
29
  import { Validation } from '../validation/Validation'
30
30
  import SInputBase from './SInputBase.vue'
31
31
 
32
- type Size = 'medium' | 'mini'
32
+ type Size = 'mini' | 'small' | 'medium'
33
33
  type Mode = 'filled' | 'outlined' | 'clear'
34
34
 
35
35
  export default defineComponent({
@@ -91,6 +91,16 @@ export default defineComponent({
91
91
  }
92
92
  }
93
93
 
94
+ .SInputTextarea.small {
95
+ .input {
96
+ padding: 7px 12px;
97
+ width: 100%;
98
+ min-height: 88px;
99
+ line-height: 24px;
100
+ font-size: 16px;
101
+ }
102
+ }
103
+
94
104
  .SInputTextarea.medium {
95
105
  .input {
96
106
  padding: 11px 16px;
@@ -119,6 +129,7 @@ export default defineComponent({
119
129
  .SInputTextarea.outlined {
120
130
  .input {
121
131
  border-color: var(--input-outlined-border);
132
+ background-color: transparent;
122
133
 
123
134
  &:hover {
124
135
  border-color: var(--input-focus-border);
@@ -126,7 +137,6 @@ export default defineComponent({
126
137
 
127
138
  &:focus {
128
139
  border-color: var(--input-focus-border);
129
- background-color: var(--input-focus-bg);
130
140
  }
131
141
  }
132
142
 
@@ -160,6 +170,7 @@ export default defineComponent({
160
170
  .input {
161
171
  border-color: var(--c-danger);
162
172
 
173
+ &:hover,
163
174
  &:focus {
164
175
  border-color: var(--c-danger);
165
176
  }