@globalbrain/sefirot 0.72.0 → 2.0.0-draft.1

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 (174) hide show
  1. package/CHANGELOG.md +2 -820
  2. package/README.md +1 -1
  3. package/lib/assets/styles/bootstrap.css +1 -2
  4. package/lib/assets/styles/variables.css +14 -47
  5. package/lib/components/SAvatar.vue +9 -18
  6. package/lib/components/SButton.vue +35 -48
  7. package/lib/components/SDialog.vue +16 -34
  8. package/lib/components/SDropdown.vue +36 -55
  9. package/lib/components/SDropdownItem.vue +27 -39
  10. package/lib/components/SDropdownItemText.vue +4 -9
  11. package/lib/components/SDropdownItemUser.vue +4 -12
  12. package/lib/components/SInputBase.vue +33 -45
  13. package/lib/components/SInputCheckbox.vue +17 -37
  14. package/lib/components/SInputDropdown.vue +109 -171
  15. package/lib/components/SInputDropdownItem.vue +26 -32
  16. package/lib/components/SInputDropdownItemText.vue +6 -11
  17. package/lib/components/SInputDropdownItemTextTag.vue +10 -17
  18. package/lib/components/SInputDropdownItemUser.vue +5 -13
  19. package/lib/components/SInputDropdownItemUserTag.vue +9 -16
  20. package/lib/components/SInputFile.vue +38 -53
  21. package/lib/components/SInputHMS.vue +91 -114
  22. package/lib/components/SInputNumber.vue +27 -106
  23. package/lib/components/SInputRadio.vue +21 -34
  24. package/lib/components/SInputRadios.vue +36 -46
  25. package/lib/components/SInputText.vue +59 -633
  26. package/lib/components/SInputTextarea.vue +54 -113
  27. package/lib/components/SInputYMD.vue +94 -105
  28. package/lib/components/SLink.vue +16 -52
  29. package/lib/components/SModal.vue +53 -90
  30. package/lib/components/SPortalModals.vue +37 -53
  31. package/lib/components/SPortalSnackbars.vue +9 -24
  32. package/lib/components/SSheet.vue +10 -23
  33. package/lib/components/SSheetFooter.vue +0 -2
  34. package/lib/components/SSheetFooterAction.vue +9 -14
  35. package/lib/components/SSheetFooterActions.vue +1 -3
  36. package/lib/components/SSheetHeader.vue +9 -24
  37. package/lib/components/SSheetHeaderTitle.vue +0 -2
  38. package/lib/components/SSheetMedium.vue +12 -14
  39. package/lib/components/SSnackbar.vue +18 -28
  40. package/lib/composables/Dialog.ts +9 -17
  41. package/lib/composables/Dropdown.ts +1 -1
  42. package/lib/composables/{Menu.ts → Flyout.ts} +11 -4
  43. package/lib/composables/Form.ts +42 -44
  44. package/lib/composables/Modal.ts +9 -9
  45. package/lib/composables/Snackbar.ts +18 -0
  46. package/lib/composables/Validation.ts +28 -0
  47. package/lib/mixins/Sheet.ts +3 -3
  48. package/lib/store/Sefirot.ts +8 -13
  49. package/lib/store/dialog/index.ts +20 -10
  50. package/lib/store/modal/index.ts +11 -13
  51. package/lib/store/snackbars/index.ts +3 -4
  52. package/lib/support/{Util.ts → Utils.ts} +0 -2
  53. package/lib/types/Utils.ts +0 -7
  54. package/lib/types/vue-shims.d.ts +7 -0
  55. package/lib/validation/rules/checked.ts +6 -10
  56. package/lib/validation/rules/fileExtension.ts +9 -9
  57. package/lib/validation/rules/hms.ts +9 -9
  58. package/lib/validation/rules/index.ts +10 -74
  59. package/lib/validation/rules/maxLength.ts +10 -9
  60. package/lib/validation/rules/minLength.ts +12 -0
  61. package/lib/validation/rules/required.ts +2 -10
  62. package/lib/validation/rules/requiredHms.ts +11 -0
  63. package/lib/validation/rules/requiredIf.ts +3 -11
  64. package/lib/validation/rules/requiredYmd.ts +11 -0
  65. package/lib/validation/rules/ymd.ts +11 -0
  66. package/lib/validation/validators/checked.ts +1 -1
  67. package/lib/validation/validators/fileExtension.ts +1 -1
  68. package/lib/validation/validators/hms.ts +5 -5
  69. package/lib/validation/validators/requiredHms.ts +17 -0
  70. package/lib/validation/validators/requiredYmd.ts +7 -0
  71. package/lib/validation/validators/ymd.ts +41 -0
  72. package/package.json +45 -50
  73. package/lib/components/SAction.vue +0 -37
  74. package/lib/components/SActionAvatar.vue +0 -25
  75. package/lib/components/SActionButton.vue +0 -40
  76. package/lib/components/SActionPill.vue +0 -35
  77. package/lib/components/SActionSwitch.vue +0 -37
  78. package/lib/components/SAlert.vue +0 -145
  79. package/lib/components/SButtonGroup.vue +0 -160
  80. package/lib/components/SCard.vue +0 -111
  81. package/lib/components/SCardFooter.vue +0 -74
  82. package/lib/components/SCardHeader.vue +0 -213
  83. package/lib/components/SGrid.vue +0 -237
  84. package/lib/components/SGridActionLink.vue +0 -53
  85. package/lib/components/SGridActionMulti.vue +0 -139
  86. package/lib/components/SGridActionSingle.vue +0 -64
  87. package/lib/components/SHeader.vue +0 -180
  88. package/lib/components/SInputCheckboxes.vue +0 -87
  89. package/lib/components/SInputDate.vue +0 -192
  90. package/lib/components/SInputDay.vue +0 -87
  91. package/lib/components/SInputMonth.vue +0 -86
  92. package/lib/components/SInputSelect.vue +0 -298
  93. package/lib/components/SInputSwitch.vue +0 -212
  94. package/lib/components/SInputSwitches.vue +0 -108
  95. package/lib/components/SInputTime.vue +0 -255
  96. package/lib/components/SInputYear.vue +0 -60
  97. package/lib/components/SMarkdown.vue +0 -56
  98. package/lib/components/SPlaceholderBlank.vue +0 -113
  99. package/lib/components/SPlaceholderImage.vue +0 -83
  100. package/lib/components/SPortalScreens.vue +0 -62
  101. package/lib/components/SProgressBar.vue +0 -89
  102. package/lib/components/SResponsive.vue +0 -46
  103. package/lib/components/SScreen.vue +0 -81
  104. package/lib/components/SStep.vue +0 -107
  105. package/lib/components/SSteps.vue +0 -75
  106. package/lib/components/STag.vue +0 -67
  107. package/lib/components/STooltip.vue +0 -134
  108. package/lib/components/SWindow.vue +0 -158
  109. package/lib/components/icons/SIconCopy.vue +0 -6
  110. package/lib/composables/Action.ts +0 -141
  111. package/lib/composables/Alert.ts +0 -50
  112. package/lib/composables/Card.ts +0 -46
  113. package/lib/composables/FormValidation.ts +0 -150
  114. package/lib/composables/Header.ts +0 -72
  115. package/lib/composables/InputDropdown.ts +0 -6
  116. package/lib/composables/Markdown.ts +0 -138
  117. package/lib/composables/Router.ts +0 -20
  118. package/lib/composables/Step.ts +0 -7
  119. package/lib/composables/Store.ts +0 -9
  120. package/lib/composables/Tag.ts +0 -32
  121. package/lib/composables/Tooltip.ts +0 -91
  122. package/lib/composables/Utils.ts +0 -115
  123. package/lib/composables/markdown/LinkPlugin.ts +0 -45
  124. package/lib/compositions/useForm.ts +0 -17
  125. package/lib/compositions/useResizeObserver.ts +0 -25
  126. package/lib/compositions/useTime.ts +0 -26
  127. package/lib/store/alert/index.ts +0 -32
  128. package/lib/store/screen/index.ts +0 -46
  129. package/lib/types/v-calendar.d.ts +0 -5
  130. package/lib/validation/Validation.ts +0 -151
  131. package/lib/validation/rules/day.ts +0 -11
  132. package/lib/validation/rules/email.ts +0 -11
  133. package/lib/validation/rules/every.ts +0 -38
  134. package/lib/validation/rules/include.ts +0 -11
  135. package/lib/validation/rules/includeSome.ts +0 -11
  136. package/lib/validation/rules/integer.ts +0 -11
  137. package/lib/validation/rules/maxValue.ts +0 -11
  138. package/lib/validation/rules/minValue.ts +0 -11
  139. package/lib/validation/rules/month.ts +0 -11
  140. package/lib/validation/rules/not.ts +0 -10
  141. package/lib/validation/rules/regex.ts +0 -11
  142. package/lib/validation/rules/requiredHMS.ts +0 -11
  143. package/lib/validation/rules/requiredMonthDate.ts +0 -11
  144. package/lib/validation/rules/requiredYearMonth.ts +0 -11
  145. package/lib/validation/rules/requiredYearMonthDate.ts +0 -11
  146. package/lib/validation/rules/rule.ts +0 -5
  147. package/lib/validation/rules/sameAs.ts +0 -11
  148. package/lib/validation/rules/url.ts +0 -11
  149. package/lib/validation/rules/validateIf.ts +0 -27
  150. package/lib/validation/rules/year.ts +0 -11
  151. package/lib/validation/rules/yearMonth.ts +0 -11
  152. package/lib/validation/rules/yearMonthDate.ts +0 -11
  153. package/lib/validation/validators/day.ts +0 -29
  154. package/lib/validation/validators/email.ts +0 -5
  155. package/lib/validation/validators/include.ts +0 -5
  156. package/lib/validation/validators/includeSome.ts +0 -5
  157. package/lib/validation/validators/index.ts +0 -51
  158. package/lib/validation/validators/integer.ts +0 -6
  159. package/lib/validation/validators/maxLength.ts +0 -3
  160. package/lib/validation/validators/maxValue.ts +0 -3
  161. package/lib/validation/validators/minValue.ts +0 -3
  162. package/lib/validation/validators/month.ts +0 -3
  163. package/lib/validation/validators/monthDate.ts +0 -20
  164. package/lib/validation/validators/regex.ts +0 -3
  165. package/lib/validation/validators/required.ts +0 -27
  166. package/lib/validation/validators/requiredHMS.ts +0 -17
  167. package/lib/validation/validators/requiredMonthDate.ts +0 -8
  168. package/lib/validation/validators/requiredYearMonth.ts +0 -8
  169. package/lib/validation/validators/requiredYearMonthDate.ts +0 -9
  170. package/lib/validation/validators/sameAs.ts +0 -5
  171. package/lib/validation/validators/url.ts +0 -5
  172. package/lib/validation/validators/year.ts +0 -3
  173. package/lib/validation/validators/yearMonth.ts +0 -20
  174. package/lib/validation/validators/yearMonthDate.ts +0 -21
@@ -2,121 +2,42 @@
2
2
  <SInputText
3
3
  class="SInputNumber"
4
4
  :size="size"
5
- :mode="mode"
6
- :name="name"
5
+ type="number"
7
6
  :label="label"
8
7
  :note="note"
9
8
  :help="help"
10
- type="number"
11
9
  :placeholder="placeholder"
12
- :align="align"
13
- :text="text"
14
- :text-after="textAfter"
15
- :action="action"
16
- :color="color"
17
- :step="step"
18
10
  :disabled="disabled"
19
- :validation="validation"
20
- :display-value="displayValue"
21
- :value="value"
22
11
  :error-message="errorMessage"
23
- @input="emitInput"
24
- @blur="emitBlur"
25
- @enter="emitEnter"
26
- @action="$emit('action')"
27
- >
28
- <template #before-help>
29
- <p v-if="helpFormat" class="help-text">
30
- {{ valueWithSeparator }}
31
- </p>
32
- </template>
33
- </SInputText>
12
+ :model-value="modelValue"
13
+ :validation="validation"
14
+ @update:model-value="emitUpdate"
15
+ />
34
16
  </template>
35
17
 
36
- <script lang="ts">
37
- import { PropType, defineComponent, computed } from '@vue/composition-api'
38
- import { isNullish } from '../support/Util'
39
- import { Validation } from '../validation/Validation'
40
- import SInputText, { Size, Mode, Align, Color, Action } from './SInputText.vue'
41
-
42
- export default defineComponent({
43
- components: {
44
- SInputText
45
- },
46
-
47
- props: {
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: null },
55
- align: { type: String as PropType<Align>, default: null },
56
- text: { type: String, default: null },
57
- textAfter: { type: String, default: null },
58
- action: { type: Object as PropType<Action>, default: null },
59
- color: { type: Function as PropType<(value: number) => Color>, default: null },
60
- step: { type: Number, default: 1 },
61
- separator: { type: Boolean, default: false },
62
- helpFormat: { type: Boolean, default: false },
63
- disabled: { type: Boolean, default: false },
64
- errorMessage: { type: Boolean, default: true },
65
- value: { type: Number, default: null },
66
- validation: { type: Object as PropType<Validation>, default: null }
67
- },
68
-
69
- setup(props, { emit }) {
70
- const valueWithSeparator = computed(() => {
71
- if (isNullish(props.value)) {
72
- return '0'
73
- }
74
-
75
- return props.value >= 100000000000000000000
76
- ? 'The number is too big'
77
- : props.value.toLocaleString('en-US', { maximumFractionDigits: 20 })
78
- })
79
-
80
- const displayValue = computed(() => {
81
- if (!props.separator) {
82
- return null
83
- }
84
-
85
- return valueWithSeparator.value !== '0' ? valueWithSeparator.value : null
86
- })
87
-
88
- function emitInput(value: number): void {
89
- emit('input', value)
90
- }
91
-
92
- function emitBlur(value: number): void {
93
- emit('blur', value)
94
- }
95
-
96
- function emitEnter(value: number): void {
97
- emit('enter', value)
98
- }
99
-
100
- return {
101
- valueWithSeparator,
102
- displayValue,
103
- emitInput,
104
- emitBlur,
105
- emitEnter
106
- }
107
- }
18
+ <script setup lang="ts">
19
+ import { PropType } from 'vue'
20
+ import { isNullish } from '../support/Utils'
21
+ import { Validation, Validatable } from '../composables/Validation'
22
+ import SInputText from './SInputText.vue'
23
+
24
+ type Size = 'mini' | 'small' | 'medium'
25
+
26
+ defineProps({
27
+ size: { type: String as PropType<Size>, default: 'small' },
28
+ label: { type: String, default: null },
29
+ note: { type: String, default: null },
30
+ help: { type: String, default: null },
31
+ placeholder: { type: String, default: null },
32
+ disabled: { type: Boolean, default: false },
33
+ errorMessage: { type: Boolean, default: true },
34
+ modelValue: { type: Number as PropType<number | null>, default: null },
35
+ validation: { type: Object as PropType<Validatable>, default: null }
108
36
  })
109
- </script>
110
37
 
111
- <style lang="postcss" scoped>
112
- @import "@/assets/styles/variables";
38
+ const emit = defineEmits(['update:modelValue'])
113
39
 
114
- .SInputNumber-help-format {
115
- margin: 0;
116
- padding: 6px 0 0;
117
- line-height: 20px;
118
- font-size: 12px;
119
- font-weight: 500;
120
- color: var(--input-help);
40
+ function emitUpdate(value: string): void {
41
+ emit('update:modelValue', value === '' ? null : Number(value))
121
42
  }
122
- </style>
43
+ </script>
@@ -1,13 +1,15 @@
1
1
  <template>
2
2
  <SInputBase
3
3
  class="SInputRadio"
4
- :name="name"
4
+ :class="[size]"
5
5
  :label="label"
6
6
  :note="note"
7
7
  :help="help"
8
+ :error-message="errorMessage"
9
+ :validation="validation"
8
10
  >
9
11
  <div class="container">
10
- <div class="input" :class="{ on: value }" role="button" @click="emitChange">
12
+ <div class="input" :class="{ on: modelValue }" role="button" @click="emitChange">
11
13
  <div class="box">
12
14
  <div class="check" />
13
15
  </div>
@@ -18,47 +20,32 @@
18
20
  </SInputBase>
19
21
  </template>
20
22
 
21
- <script lang="ts">
22
- import { PropType, defineComponent } from '@vue/composition-api'
23
+ <script setup lang="ts">
24
+ import { PropType } from 'vue'
25
+ import { Validation } from '../composables/Validation'
23
26
  import SInputBase from './SInputBase.vue'
24
27
 
25
28
  type Size = 'mini' | 'small' | 'medium'
26
29
 
27
- export default defineComponent({
28
- components: {
29
- SInputBase
30
- },
31
-
32
- model: {
33
- prop: 'value',
34
- event: 'change'
35
- },
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
+ text: { type: String, required: true },
36
+ errorMessage: { type: Boolean, default: true },
37
+ modelValue: { type: Boolean, required: true },
38
+ validation: { type: Object as PropType<Validation>, default: null }
39
+ })
36
40
 
37
- props: {
38
- size: { type: String as PropType<Size>, default: 'small' },
39
- name: { type: String, default: null },
40
- label: { type: String, default: null },
41
- note: { type: String, default: null },
42
- help: { type: String, default: null },
43
- text: { type: String, required: true },
44
- value: { type: Boolean, required: true }
45
- },
41
+ const emit = defineEmits(['update:modelValue'])
46
42
 
47
- setup(props, { emit }) {
48
- function emitChange(): void {
49
- emit('change', !props.value)
50
- }
51
-
52
- return {
53
- emitChange
54
- }
55
- }
56
- })
43
+ function emitChange() {
44
+ emit('update:modelValue', !props.modelValue)
45
+ }
57
46
  </script>
58
47
 
59
48
  <style lang="postcss" scoped>
60
- @import "@/assets/styles/variables";
61
-
62
49
  .container {
63
50
  display: flex;
64
51
  }
@@ -2,18 +2,19 @@
2
2
  <SInputBase
3
3
  class="SInputRadios"
4
4
  :class="[size]"
5
- :name="name"
6
5
  :label="label"
7
6
  :note="note"
8
7
  :help="help"
8
+ :error-message="errorMessage"
9
+ :validation="validation"
9
10
  >
10
11
  <div class="container">
11
12
  <div class="row">
12
- <div v-for="option in options" :key="option.value" class="col">
13
+ <div v-for="(option, index) in options" :key="index" class="col">
13
14
  <SInputRadio
14
15
  :text="option.label"
15
- :value="isChecked(option.value)"
16
- @change="handleChange(option.value)"
16
+ :model-value="isChecked(option.value)"
17
+ @update:model-value="handleChange(option.value)"
17
18
  />
18
19
  </div>
19
20
  </div>
@@ -21,63 +22,52 @@
21
22
  </SInputBase>
22
23
  </template>
23
24
 
24
- <script lang="ts">
25
- import { PropType, defineComponent } from '@vue/composition-api'
25
+ <script setup lang="ts">
26
+ import { PropType } from 'vue'
27
+ import { Validatable } from '../composables/Validation'
26
28
  import SInputBase from './SInputBase.vue'
27
29
  import SInputRadio from './SInputRadio.vue'
28
30
 
29
31
  type Size = 'mini' | 'small' | 'medium'
30
32
 
31
- export default defineComponent({
32
- components: {
33
- SInputBase,
34
- SInputRadio
35
- },
36
-
37
- model: {
38
- prop: 'value',
39
- event: 'change'
40
- },
33
+ interface Option {
34
+ label: string
35
+ value: string | number | boolean
36
+ }
41
37
 
42
- props: {
43
- size: { type: String as PropType<Size>, default: 'small' },
44
- name: { type: String, default: null },
45
- label: { type: String, default: null },
46
- note: { type: String, default: null },
47
- help: { type: String, default: null },
48
- nullable: { type: Boolean, default: true },
49
- options: { type: Array, required: true },
50
- value: { type: [String, Number, Boolean], default: null }
51
- },
38
+ const props = defineProps({
39
+ size: { type: String as PropType<Size>, default: 'small' },
40
+ name: { type: String, default: null },
41
+ label: { type: String, default: null },
42
+ note: { type: String, default: null },
43
+ help: { type: String, default: null },
44
+ nullable: { type: Boolean, default: true },
45
+ options: { type: Array as PropType<any[]>, required: true },
46
+ errorMessage: { type: Boolean, default: true },
47
+ modelValue: { type: [String, Number, Boolean], default: null },
48
+ validation: { type: Object as PropType<Validatable>, default: null }
49
+ })
52
50
 
53
- setup(props, { emit }) {
54
- function isChecked(value: unknown): boolean {
55
- return value === props.value
56
- }
51
+ const emit = defineEmits(['update:modelValue'])
57
52
 
58
- function handleChange(value: unknown): void {
59
- if (value !== props.value) {
60
- emit('change', value)
53
+ function isChecked(value: string | number | boolean) {
54
+ return value === props.modelValue
55
+ }
61
56
 
62
- return
63
- }
57
+ function handleChange(value: string | number | boolean) {
58
+ if (value !== props.modelValue) {
59
+ emit('update:modelValue', value)
64
60
 
65
- if (props.nullable) {
66
- emit('change', null)
67
- }
68
- }
61
+ return
62
+ }
69
63
 
70
- return {
71
- isChecked,
72
- handleChange
73
- }
64
+ if (props.nullable) {
65
+ emit('update:modelValue', null)
74
66
  }
75
- })
67
+ }
76
68
  </script>
77
69
 
78
70
  <style lang="postcss" scoped>
79
- @import "@/assets/styles/variables";
80
-
81
71
  .container {
82
72
  display: flex;
83
73
  }