@globalbrain/sefirot 2.0.0-draft.8 → 2.1.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 (182) hide show
  1. package/README.md +6 -6
  2. package/lib/components/SAvatar.vue +17 -17
  3. package/lib/components/SButton.vue +520 -276
  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 +190 -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 +4 -3
  15. package/lib/components/SInputCheckboxes.vue +74 -0
  16. package/lib/components/SInputDate.vue +182 -0
  17. package/lib/components/SInputDropdown.vue +159 -157
  18. package/lib/components/SInputDropdownItem.vue +46 -48
  19. package/lib/components/SInputDropdownItemAvatar.vue +99 -0
  20. package/lib/components/SInputDropdownItemText.vue +79 -16
  21. package/lib/components/SInputFile.vue +56 -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 +7 -6
  27. package/lib/components/SInputSwitch.vue +193 -0
  28. package/lib/components/SInputSwitches.vue +88 -0
  29. package/lib/components/SInputText.vue +207 -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 +33 -57
  34. package/lib/components/SMount.vue +19 -0
  35. package/lib/components/SSheet.vue +50 -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 +58 -47
  43. package/lib/components/{SPortalSnackbars.vue → SSnackbars.vue} +17 -20
  44. package/lib/components/{icons/SIconPreloader.vue → SSpinner.vue} +5 -4
  45. package/lib/components/SStep.vue +107 -0
  46. package/lib/components/SSteps.vue +59 -0
  47. package/lib/components/STable.vue +242 -0
  48. package/lib/components/STableCell.vue +82 -0
  49. package/lib/components/STableCellAvatar.vue +69 -0
  50. package/lib/components/STableCellAvatars.vue +93 -0
  51. package/lib/components/STableCellDay.vue +40 -0
  52. package/lib/components/STableCellPill.vue +84 -0
  53. package/lib/components/STableCellText.vue +103 -0
  54. package/lib/components/STableColumn.vue +255 -0
  55. package/lib/components/STableFooter.vue +115 -0
  56. package/lib/components/STableHeader.vue +74 -0
  57. package/lib/components/STableItem.vue +38 -0
  58. package/lib/components/STooltip.vue +112 -0
  59. package/lib/composables/Dropdown.ts +40 -99
  60. package/lib/composables/Form.ts +21 -18
  61. package/lib/composables/Grid.ts +117 -0
  62. package/lib/composables/Markdown.ts +138 -0
  63. package/lib/composables/Step.ts +7 -0
  64. package/lib/composables/Table.ts +103 -0
  65. package/lib/composables/Tooltip.ts +91 -0
  66. package/lib/composables/Validation.ts +5 -9
  67. package/lib/composables/markdown/LinkPlugin.ts +45 -0
  68. package/lib/mixins/Sheet.ts +5 -3
  69. package/lib/stores/Snackbars.ts +48 -0
  70. package/lib/{assets/styles → styles}/base.css +0 -0
  71. package/lib/{assets/styles → styles}/bootstrap.css +1 -0
  72. package/lib/{assets/styles → styles}/variables.css +55 -48
  73. package/lib/support/Day.ts +8 -0
  74. package/lib/support/Num.ts +3 -0
  75. package/lib/support/Time.ts +5 -2
  76. package/lib/support/Utils.ts +4 -3
  77. package/lib/types/shims.d.ts +3 -0
  78. package/lib/validation/validators/requiredYmd.ts +1 -1
  79. package/lib/validation/validators/ymd.ts +4 -4
  80. package/package.json +59 -37
  81. package/CHANGELOG.md +0 -47
  82. package/lib/.DS_Store +0 -0
  83. package/lib/components/.DS_Store +0 -0
  84. package/lib/components/SDialog.vue +0 -140
  85. package/lib/components/SDropdownItem.vue +0 -78
  86. package/lib/components/SDropdownItemText.vue +0 -22
  87. package/lib/components/SDropdownItemUser.vue +0 -40
  88. package/lib/components/SInputDropdownItemTextTag.vue +0 -94
  89. package/lib/components/SInputDropdownItemUser.vue +0 -41
  90. package/lib/components/SInputDropdownItemUserTag.vue +0 -100
  91. package/lib/components/SPortalModals.vue +0 -74
  92. package/lib/components/icons/.DS_Store +0 -0
  93. package/lib/components/icons/SIconActivity.vue +0 -5
  94. package/lib/components/icons/SIconArrowDown.vue +0 -5
  95. package/lib/components/icons/SIconArrowLeft.vue +0 -5
  96. package/lib/components/icons/SIconArrowRight.vue +0 -5
  97. package/lib/components/icons/SIconArrowUp.vue +0 -5
  98. package/lib/components/icons/SIconBarChart.vue +0 -7
  99. package/lib/components/icons/SIconBriefcase.vue +0 -5
  100. package/lib/components/icons/SIconBuilding.vue +0 -5
  101. package/lib/components/icons/SIconCalendar.vue +0 -5
  102. package/lib/components/icons/SIconCheck.vue +0 -5
  103. package/lib/components/icons/SIconCheckCircle.vue +0 -6
  104. package/lib/components/icons/SIconCheckCircleThin.vue +0 -6
  105. package/lib/components/icons/SIconCheckSquare.vue +0 -6
  106. package/lib/components/icons/SIconChevronDown.vue +0 -5
  107. package/lib/components/icons/SIconChevronLeft.vue +0 -5
  108. package/lib/components/icons/SIconChevronRight.vue +0 -5
  109. package/lib/components/icons/SIconChevronUp.vue +0 -5
  110. package/lib/components/icons/SIconClock.vue +0 -6
  111. package/lib/components/icons/SIconCode.vue +0 -6
  112. package/lib/components/icons/SIconDatabase.vue +0 -5
  113. package/lib/components/icons/SIconDollarSign.vue +0 -5
  114. package/lib/components/icons/SIconDownload.vue +0 -6
  115. package/lib/components/icons/SIconDownloadCloud.vue +0 -6
  116. package/lib/components/icons/SIconEdit.vue +0 -6
  117. package/lib/components/icons/SIconEdit2.vue +0 -5
  118. package/lib/components/icons/SIconEdit3.vue +0 -6
  119. package/lib/components/icons/SIconEdit3Off.vue +0 -6
  120. package/lib/components/icons/SIconExternalLink.vue +0 -6
  121. package/lib/components/icons/SIconEye.vue +0 -6
  122. package/lib/components/icons/SIconFile.vue +0 -5
  123. package/lib/components/icons/SIconFilePlus.vue +0 -6
  124. package/lib/components/icons/SIconFileText.vue +0 -8
  125. package/lib/components/icons/SIconFlag.vue +0 -5
  126. package/lib/components/icons/SIconGitBranch.vue +0 -5
  127. package/lib/components/icons/SIconGitCommit.vue +0 -5
  128. package/lib/components/icons/SIconGitPullRequest.vue +0 -6
  129. package/lib/components/icons/SIconGlobe.vue +0 -5
  130. package/lib/components/icons/SIconGrab.vue +0 -10
  131. package/lib/components/icons/SIconGrid.vue +0 -8
  132. package/lib/components/icons/SIconHome.vue +0 -5
  133. package/lib/components/icons/SIconImage.vue +0 -6
  134. package/lib/components/icons/SIconInbox.vue +0 -5
  135. package/lib/components/icons/SIconInfo.vue +0 -7
  136. package/lib/components/icons/SIconLayout.vue +0 -5
  137. package/lib/components/icons/SIconList.vue +0 -10
  138. package/lib/components/icons/SIconLock.vue +0 -5
  139. package/lib/components/icons/SIconLogout.vue +0 -6
  140. package/lib/components/icons/SIconMail.vue +0 -6
  141. package/lib/components/icons/SIconMapPin.vue +0 -6
  142. package/lib/components/icons/SIconMoon.vue +0 -5
  143. package/lib/components/icons/SIconMoreHorizontal.vue +0 -7
  144. package/lib/components/icons/SIconMoreVertical.vue +0 -7
  145. package/lib/components/icons/SIconPauseFill.vue +0 -6
  146. package/lib/components/icons/SIconPlayCircle.vue +0 -6
  147. package/lib/components/icons/SIconPlayFill.vue +0 -5
  148. package/lib/components/icons/SIconPlus.vue +0 -5
  149. package/lib/components/icons/SIconPlusCircle.vue +0 -8
  150. package/lib/components/icons/SIconPlusOff.vue +0 -7
  151. package/lib/components/icons/SIconPreloaderDark.vue +0 -52
  152. package/lib/components/icons/SIconPreloaderLight.vue +0 -52
  153. package/lib/components/icons/SIconProgress.vue +0 -5
  154. package/lib/components/icons/SIconRadio.vue +0 -6
  155. package/lib/components/icons/SIconSave.vue +0 -5
  156. package/lib/components/icons/SIconSearch.vue +0 -5
  157. package/lib/components/icons/SIconSend.vue +0 -5
  158. package/lib/components/icons/SIconSettings.vue +0 -6
  159. package/lib/components/icons/SIconShare2.vue +0 -5
  160. package/lib/components/icons/SIconSkipBackFill.vue +0 -6
  161. package/lib/components/icons/SIconSliders.vue +0 -12
  162. package/lib/components/icons/SIconSun.vue +0 -13
  163. package/lib/components/icons/SIconTelescope.vue +0 -5
  164. package/lib/components/icons/SIconTrash.vue +0 -5
  165. package/lib/components/icons/SIconTrash2.vue +0 -7
  166. package/lib/components/icons/SIconTrash2Off.vue +0 -6
  167. package/lib/components/icons/SIconTrello.vue +0 -7
  168. package/lib/components/icons/SIconUser.vue +0 -6
  169. package/lib/components/icons/SIconUsers.vue +0 -8
  170. package/lib/components/icons/SIconWarning.vue +0 -7
  171. package/lib/components/icons/SIconX.vue +0 -5
  172. package/lib/components/icons/SIconXCircle.vue +0 -6
  173. package/lib/components/icons/SIconXCircleThin.vue +0 -6
  174. package/lib/components/icons/SIconXSquare.vue +0 -6
  175. package/lib/components/icons/SIconZap.vue +0 -5
  176. package/lib/composables/Dialog.ts +0 -38
  177. package/lib/composables/Modal.ts +0 -34
  178. package/lib/composables/Snackbar.ts +0 -18
  179. package/lib/store/Sefirot.ts +0 -17
  180. package/lib/store/dialog/index.ts +0 -42
  181. package/lib/store/modal/index.ts +0 -61
  182. 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 { PropType, computed } from 'vue'
2
+ import { computed, unref } from 'vue'
19
3
  import { Validatable } from '../composables/Validation'
20
4
 
21
- const props = defineProps({
22
- name: { type: String, default: null },
23
- note: { type: String, default: null },
24
- label: { type: String, default: null },
25
- help: { type: String, default: null },
26
- errorMessage: { type: Boolean, default: true },
27
- validation: { type: Object as PropType<Validatable>, default: null }
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.errorMessage && hasError.value && errorMsg.value
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(--input-label);
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(--input-note);
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(--input-help);
121
+ color: var(--c-text-2);
122
122
  }
123
123
 
124
124
  .help-error + .help-text,
@@ -11,7 +11,7 @@
11
11
  <div class="input" :class="{ on: modelValue }" role="button" @click="emitChange">
12
12
  <div class="box">
13
13
  <div class="check">
14
- <SIconCheck class="check-icon" />
14
+ <SIcon :icon="IconCheck" class="check-icon" />
15
15
  </div>
16
16
  </div>
17
17
 
@@ -22,9 +22,10 @@
22
22
  </template>
23
23
 
24
24
  <script setup lang="ts">
25
+ import IconCheck from '@iconify-icons/ph/check'
25
26
  import { PropType } from 'vue'
26
27
  import { Validatable } from '../composables/Validation'
27
- import SIconCheck from './icons/SIconCheck.vue'
28
+ import SIcon from './SIcon.vue'
28
29
  import SInputBase from './SInputBase.vue'
29
30
 
30
31
  type Size = 'mini' | 'small' | 'medium'
@@ -101,7 +102,7 @@ function emitChange() {
101
102
  .check-icon {
102
103
  width: 10px;
103
104
  height: 10px;
104
- fill: var(--c-white);
105
+ color: var(--c-white);
105
106
  }
106
107
 
107
108
  .text {
@@ -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>