@globalbrain/sefirot 3.5.0 → 3.7.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.
@@ -47,7 +47,7 @@ function close() {
47
47
  border: 1px solid var(--c-divider);
48
48
  border-radius: 6px;
49
49
  width: 100%;
50
- background-color: var(--c-bg-elv-up);
50
+ background-color: var(--c-bg-elv-3);
51
51
  box-shadow: var(--shadow-depth-3);
52
52
  overflow: hidden;
53
53
 
@@ -60,10 +60,10 @@ function close() {
60
60
  content: "";
61
61
  }
62
62
 
63
- &.neutral::before { background-color: var(--c-gray); }
64
- &.info::before { background-color: var(--c-info); }
65
- &.warning::before { background-color: var(--c-warning); }
66
- &.danger::before { background-color: var(--c-danger); }
63
+ &.neutral::before { background-color: var(--c-fg-gray-1); }
64
+ &.info::before { background-color: var(--c-fg-info-1); }
65
+ &.warning::before { background-color: var(--c-fg-warning-1); }
66
+ &.danger::before { background-color: var(--c-fg-danger-1); }
67
67
  }
68
68
 
69
69
  .close {
@@ -31,19 +31,19 @@ defineProps({
31
31
 
32
32
  <style lang="postcss" scoped>
33
33
  .SStep.upcoming {
34
- .point { border-color: var(--c-divider); }
34
+ .point { border-color: var(--c-border-mute-1); }
35
35
  .text { color: var(--c-text-2); }
36
36
  }
37
37
 
38
38
  .SStep.active {
39
- .point { border-color: var(--c-success); }
40
- .text { color: var(--c-success); }
39
+ .point { border-color: var(--c-fg-success-1); }
40
+ .text { color: var(--c-text-success-1); }
41
41
  }
42
42
 
43
43
  .SStep.done {
44
44
  .point {
45
- border-color: var(--c-success);
46
- background-color: var(--c-success);
45
+ border-color: var(--c-fg-success-1);
46
+ background-color: var(--c-fg-success-1);
47
47
  }
48
48
 
49
49
  .text { color: var(--c-text-1); }
@@ -51,11 +51,11 @@ defineProps({
51
51
 
52
52
  .SStep.failed {
53
53
  .point {
54
- border-color: var(--c-danger);
55
- background-color: var(--c-danger);
54
+ border-color: var(--c-fg-danger-1);
55
+ background-color: var(--c-fg-danger-1);
56
56
  }
57
57
 
58
- .text { color: var(--c-danger); }
58
+ .text { color: var(--c-text-danger-1); }
59
59
  }
60
60
 
61
61
  .indicator {
@@ -78,7 +78,7 @@ defineProps({
78
78
  border-radius: 50%;
79
79
  width: 6px;
80
80
  height: 6px;
81
- background-color: var(--c-success);
81
+ background-color: var(--c-fg-success-1);
82
82
  }
83
83
 
84
84
  .icon {
@@ -92,9 +92,9 @@ defineProps({
92
92
  height: 2px;
93
93
  }
94
94
 
95
- .bar.mute { background-color: var(--c-divider); }
96
- .bar.active { background-color: var(--c-success); }
97
- .bar.failed { background-color: var(--c-danger); }
95
+ .bar.mute { background-color: var(--c-border-mute-1); }
96
+ .bar.active { background-color: var(--c-fg-success-1); }
97
+ .bar.failed { background-color: var(--c-fg-danger-1); }
98
98
 
99
99
  .text {
100
100
  margin: 0;
@@ -1,14 +1,12 @@
1
1
  <script setup lang="ts">
2
2
  import { computed } from 'vue'
3
- import SPill from './SPill.vue'
4
-
5
- export type Color = 'neutral' | 'mute' | 'info' | 'success' | 'warning' | 'danger'
3
+ import SPill, { type Mode } from './SPill.vue'
6
4
 
7
5
  const props = defineProps<{
8
6
  value?: any
9
7
  record: any
10
8
  getter?: string | ((value: any, record: any) => string)
11
- color?: Color | ((value: any, record: any) => Color)
9
+ color?: Mode | ((value: any, record: any) => Mode)
12
10
  }>()
13
11
 
14
12
  const _value = computed(() => {
@@ -1,17 +1,12 @@
1
1
  <script setup lang="ts">
2
2
  import { computed } from 'vue'
3
- import { type TableCellPillColor } from '../composables/Table'
3
+ import { type TableCellPillItem } from '../composables/Table'
4
4
  import STableCellPill from './STableCellPill.vue'
5
5
 
6
- export interface Pill {
7
- label: string
8
- color: TableCellPillColor
9
- }
10
-
11
6
  const props = defineProps<{
12
7
  value: string[]
13
8
  record: any
14
- pills(value: string[], record: any): Pill[]
9
+ pills(value: string[], record: any): TableCellPillItem[]
15
10
  }>()
16
11
 
17
12
  const items = computed(() => props.pills(props.value, props.record))
@@ -4,13 +4,14 @@ import SIcon from './SIcon.vue'
4
4
  import SLink from './SLink.vue'
5
5
 
6
6
  export type Color =
7
- | 'neutral'
8
- | 'soft'
7
+ | 'default'
9
8
  | 'mute'
9
+ | 'neutral'
10
10
  | 'info'
11
11
  | 'success'
12
12
  | 'warning'
13
13
  | 'danger'
14
+ | 'soft'
14
15
 
15
16
  const props = defineProps<{
16
17
  value?: any
@@ -1,3 +1,4 @@
1
+ import { isClient } from '@vueuse/core'
1
2
  import { type MaybeRefOrGetter, type Ref, ref, toValue, watchEffect } from 'vue'
2
3
  import { isFile, isString } from '../support/Utils'
3
4
 
@@ -13,7 +14,13 @@ export interface ImageSrcFromFile {
13
14
  export function useImageSrcFromFile(
14
15
  file: MaybeRefOrGetter<File | string | null>
15
16
  ): ImageSrcFromFile {
16
- const reader = new FileReader()
17
+ if (!isClient) {
18
+ return {
19
+ src: ref(null)
20
+ }
21
+ }
22
+
23
+ const reader = new window.FileReader()
17
24
  const src = ref<string | null>(null)
18
25
 
19
26
  reader.onload = function () {
@@ -46,26 +46,26 @@ export interface TableColumn<V, R, SV, SR> {
46
46
  dropdown?: DropdownSection[]
47
47
  grow?: boolean
48
48
  resizable?: boolean
49
- cell?: TableCell | TableColumnCellFn<V, R>
50
- summaryCell?: TableCell | TableColumnCellFn<SV, SR>
49
+ cell?: TableCell<V, R> | TableColumnCellFn<V, R>
50
+ summaryCell?: TableCell<SV, SR> | TableColumnCellFn<SV, SR>
51
51
  show?: boolean
52
52
  }
53
53
 
54
- export type TableColumnCellFn<V, R> = (value: V, record: R) => TableCell
54
+ export type TableColumnCellFn<V, R> = (value: V, record: R) => TableCell<V, R>
55
55
 
56
- export type TableCell =
57
- | TableCellText
58
- | TableCellNumber
56
+ export type TableCell<V = any, R = any> =
57
+ | TableCellText<V, R>
58
+ | TableCellNumber<V, R>
59
59
  | TableCellDay
60
- | TableCellPill
61
- | TableCellPills
60
+ | TableCellPill<V, R>
61
+ | TableCellPills<V, R>
62
62
  | TableCellState
63
- | TableCellAvatar
64
- | TableCellAvatars
63
+ | TableCellAvatar<V, R>
64
+ | TableCellAvatars<V, R>
65
65
  | TableCellCustom
66
66
  | TableCellEmpty
67
67
  | TableCellComponent
68
- | TableCellActions
68
+ | TableCellActions<R>
69
69
 
70
70
  export type TableCellType =
71
71
  | 'text'
@@ -81,24 +81,31 @@ export type TableCellType =
81
81
  | 'component'
82
82
  | 'actions'
83
83
 
84
- export type ColorModes = 'neutral' | 'mute' | 'info' | 'success' | 'warning' | 'danger'
84
+ export type ColorModes =
85
+ | 'default'
86
+ | 'mute'
87
+ | 'neutral'
88
+ | 'info'
89
+ | 'success'
90
+ | 'warning'
91
+ | 'danger'
85
92
 
86
93
  export interface TableCellBase {
87
94
  type: TableCellType
88
95
  }
89
96
 
90
- export interface TableCellText extends TableCellBase {
97
+ export interface TableCellText<V = any, R = any> extends TableCellBase {
91
98
  type: 'text'
92
99
  align?: 'left' | 'center' | 'right'
93
100
  icon?: any
94
- value?: string | null | ((value: any, record: any) => string | null)
95
- link?: string | null | ((value: any, record: any) => string)
96
- color?: TableCellValueColor | ((value: any, record: any) => TableCellValueColor)
97
- iconColor?: TableCellValueColor | ((value: any, record: any) => TableCellValueColor)
98
- onClick?(value: any, record: any): void
101
+ value?: string | null | ((value: V, record: R) => string | null)
102
+ link?: string | null | ((value: V, record: R) => string)
103
+ color?: TableCellValueColor | ((value: V, record: R) => TableCellValueColor)
104
+ iconColor?: TableCellValueColor | ((value: V, record: R) => TableCellValueColor)
105
+ onClick?(value: V, record: R): void
99
106
  }
100
107
 
101
- export interface TableCellNumber extends TableCellBase {
108
+ export interface TableCellNumber<V = any, R = any> extends TableCellBase {
102
109
  type: 'number'
103
110
  align?: 'left' | 'center' | 'right'
104
111
  icon?: any
@@ -107,7 +114,7 @@ export interface TableCellNumber extends TableCellBase {
107
114
  link?: string | null
108
115
  color?: TableCellValueColor
109
116
  iconColor?: TableCellValueColor
110
- onClick?(value: any, record: any): void
117
+ onClick?(value: V, record: R): void
111
118
  }
112
119
 
113
120
  export type TableCellValueColor = ColorModes | 'soft'
@@ -120,36 +127,36 @@ export interface TableCellDay extends TableCellBase {
120
127
  color?: 'neutral' | 'soft' | 'mute'
121
128
  }
122
129
 
123
- export interface TableCellPill extends TableCellBase {
130
+ export interface TableCellPill<V = any, R = any> extends TableCellBase {
124
131
  type: 'pill'
125
- value?: string | ((value: any, record: any) => string)
126
- color?: TableCellPillColor | ((value: any, record: any) => TableCellPillColor)
132
+ value?: string | ((value: V, record: R) => string)
133
+ color?: TableCellPillColor | ((value: V, record: R) => TableCellPillColor)
127
134
  }
128
135
 
129
136
  export type TableCellPillColor = ColorModes
130
137
 
131
- export interface TableCellPills extends TableCellBase {
138
+ export interface TableCellPills<V = any, R = any> extends TableCellBase {
132
139
  type: 'pills'
133
- pills(value: any, record: any): TableCellPillItem[]
140
+ pills(value: V, record: R): TableCellPillItem[]
134
141
  }
135
142
 
136
143
  export interface TableCellPillItem {
137
144
  label: string
138
- color: TableCellPillColor
145
+ color?: TableCellPillColor
139
146
  }
140
147
 
141
- export interface TableCellAvatar extends TableCellBase {
148
+ export interface TableCellAvatar<V = any, R = any> extends TableCellBase {
142
149
  type: 'avatar'
143
- image?: string | null | ((value: any, record: any) => string | null | undefined)
144
- name?: string | null | ((value: any, record: any) => string | null | undefined)
145
- link?: string | null | ((value: any, record: any) => string | null | undefined)
150
+ image?: string | null | ((value: V, record: R) => string | null | undefined)
151
+ name?: string | null | ((value: V, record: R) => string | null | undefined)
152
+ link?: string | null | ((value: V, record: R) => string | null | undefined)
146
153
  color?: 'neutral' | 'soft' | 'mute'
147
- onClick?(value: any, record: any): void
154
+ onClick?(value: V, record: R): void
148
155
  }
149
156
 
150
- export interface TableCellAvatars extends TableCellBase {
157
+ export interface TableCellAvatars<V = any, R = any> extends TableCellBase {
151
158
  type: 'avatars'
152
- avatars: TableCellAvatarsOption[] | ((value: any, record: any) => TableCellAvatarsOption[])
159
+ avatars: TableCellAvatarsOption[] | ((value: V, record: R) => TableCellAvatarsOption[])
153
160
  color?: 'neutral' | 'soft' | 'mute'
154
161
  }
155
162
 
@@ -178,19 +185,19 @@ export interface TableCellState extends TableCellBase {
178
185
  mode?: ColorModes
179
186
  }
180
187
 
181
- export interface TableCellActions extends TableCellBase {
188
+ export interface TableCellActions<R = any> extends TableCellBase {
182
189
  type: 'actions'
183
- actions: TableCellAction[]
190
+ actions: TableCellAction<R>[]
184
191
  }
185
192
 
186
- export interface TableCellAction {
193
+ export interface TableCellAction<R = any> {
187
194
  mode?: Mode
188
195
  icon?: any
189
196
  iconMode?: Mode
190
197
  label?: string
191
198
  labelMode?: Mode
192
- onClick(record: any): void
193
- show?(record: any): boolean
199
+ onClick(record: R): void
200
+ show?(record: R): boolean
194
201
  }
195
202
 
196
203
  export interface TableMenu {
@@ -1,8 +1,9 @@
1
- import { decimal as baseDecimal, helpers } from '@vuelidate/validators'
1
+ import { and, decimal as baseDecimal, helpers, not } from '@vuelidate/validators'
2
+ import { hyphen } from '../validators'
2
3
 
3
4
  export function decimal(msg?: string) {
4
5
  return helpers.withMessage(
5
6
  () => msg ?? 'The value must be valid decimal numbers.',
6
- baseDecimal
7
+ and(not(hyphen), baseDecimal)
7
8
  )
8
9
  }
@@ -0,0 +1,8 @@
1
+ import { decimal as baseDecimal, helpers } from '@vuelidate/validators'
2
+
3
+ export function decimalOrHyphen(msg?: string) {
4
+ return helpers.withMessage(
5
+ () => msg ?? 'The value must be valid decimal numbers or just a hyphen.',
6
+ baseDecimal
7
+ )
8
+ }
@@ -1,6 +1,7 @@
1
1
  export { and, not, or } from '@vuelidate/validators'
2
2
  export * from './checked'
3
3
  export * from './decimal'
4
+ export * from './decimalOrHyphen'
4
5
  export * from './email'
5
6
  export * from './fileExtension'
6
7
  export * from './hms'
@@ -11,6 +12,8 @@ export * from './maxValue'
11
12
  export * from './minLength'
12
13
  export * from './minValue'
13
14
  export * from './month'
15
+ export * from './negativeInteger'
16
+ export * from './positiveInteger'
14
17
  export * from './required'
15
18
  export * from './requiredHms'
16
19
  export * from './requiredIf'
@@ -18,3 +21,5 @@ export * from './requiredYmd'
18
21
  export * from './rule'
19
22
  export * from './url'
20
23
  export * from './ymd'
24
+ export * from './zeroOrNegativeInteger'
25
+ export * from './zeroOrPositiveInteger'
@@ -0,0 +1,9 @@
1
+ import { helpers } from '@vuelidate/validators'
2
+ import { negativeInteger as baseNegativeInteger } from '../validators'
3
+
4
+ export function negativeInteger(msg?: string) {
5
+ return helpers.withMessage(
6
+ () => msg ?? 'The value must be valid negative integer.',
7
+ baseNegativeInteger
8
+ )
9
+ }
@@ -0,0 +1,9 @@
1
+ import { helpers } from '@vuelidate/validators'
2
+ import { positiveInteger as basePositiveInteger } from '../validators'
3
+
4
+ export function positiveInteger(msg?: string) {
5
+ return helpers.withMessage(
6
+ () => msg ?? 'The value must be valid positive integer.',
7
+ basePositiveInteger
8
+ )
9
+ }
@@ -0,0 +1,9 @@
1
+ import { helpers, or } from '@vuelidate/validators'
2
+ import { negativeInteger, zero } from '../validators'
3
+
4
+ export function zeroOrNegativeInteger(msg?: string) {
5
+ return helpers.withMessage(
6
+ () => msg ?? 'The value must be zero or valid negative integer.',
7
+ or(zero, negativeInteger)
8
+ )
9
+ }
@@ -0,0 +1,9 @@
1
+ import { helpers, or } from '@vuelidate/validators'
2
+ import { positiveInteger, zero } from '../validators'
3
+
4
+ export function zeroOrPositiveInteger(msg?: string) {
5
+ return helpers.withMessage(
6
+ () => msg ?? 'The value must be zero or valid positive integer.',
7
+ or(zero, positiveInteger)
8
+ )
9
+ }
@@ -0,0 +1,3 @@
1
+ export function hyphen(value: string): boolean {
2
+ return value === '-'
3
+ }
@@ -1,9 +1,13 @@
1
1
  export * from './checked'
2
2
  export * from './fileExtension'
3
3
  export * from './hms'
4
+ export * from './hyphen'
4
5
  export * from './maxFileSize'
5
6
  export * from './maxTotalFileSize'
6
7
  export * from './month'
8
+ export * from './negativeInteger'
9
+ export * from './positiveInteger'
7
10
  export * from './requiredHms'
8
11
  export * from './requiredYmd'
9
12
  export * from './ymd'
13
+ export * from './zero'
@@ -0,0 +1,3 @@
1
+ export function negativeInteger(value: number): boolean {
2
+ return Number.isInteger(value) && value < 0
3
+ }
@@ -0,0 +1,3 @@
1
+ export function positiveInteger(value: number): boolean {
2
+ return Number.isInteger(value) && value > 0
3
+ }
@@ -0,0 +1,3 @@
1
+ export function zero(value: number): boolean {
2
+ return value === 0
3
+ }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@globalbrain/sefirot",
3
- "version": "3.5.0",
4
- "packageManager": "pnpm@8.10.4",
3
+ "version": "3.7.0",
4
+ "packageManager": "pnpm@8.10.5",
5
5
  "description": "Vue Components for Global Brain Design System.",
6
6
  "author": "Kia Ishii <ka.ishii@globalbrains.com>",
7
7
  "license": "MIT",
@@ -72,15 +72,15 @@
72
72
  "@types/body-scroll-lock": "^3.1.2",
73
73
  "@types/lodash-es": "^4.17.11",
74
74
  "@types/markdown-it": "^13.0.6",
75
- "@types/node": "^20.9.0",
76
- "@vitejs/plugin-vue": "^4.4.1",
77
- "@vitest/coverage-v8": "^1.0.0-beta.4",
78
- "@vue/test-utils": "^2.4.1",
75
+ "@types/node": "^20.9.2",
76
+ "@vitejs/plugin-vue": "^4.5.0",
77
+ "@vitest/coverage-v8": "^1.0.0-beta.5",
78
+ "@vue/test-utils": "^2.4.2",
79
79
  "@vuelidate/core": "^2.0.3",
80
80
  "@vuelidate/validators": "^2.0.4",
81
81
  "@vueuse/core": "^10.6.1",
82
82
  "body-scroll-lock": "4.0.0-beta.0",
83
- "eslint": "^8.53.0",
83
+ "eslint": "^8.54.0",
84
84
  "fuse.js": "^7.0.0",
85
85
  "happy-dom": "^12.10.3",
86
86
  "histoire": "^0.17.5",
@@ -90,12 +90,13 @@
90
90
  "pinia": "^2.1.7",
91
91
  "postcss": "^8.4.31",
92
92
  "postcss-nested": "^6.0.1",
93
+ "punycode": "^2.3.1",
93
94
  "release-it": "^17.0.0",
94
95
  "typescript": "~5.2.2",
95
96
  "v-calendar": "^3.1.2",
96
- "vite": "^4.5.0",
97
- "vitepress": "1.0.0-rc.25",
98
- "vitest": "^1.0.0-beta.4",
97
+ "vite": "^5.0.0",
98
+ "vitepress": "1.0.0-rc.29",
99
+ "vitest": "^1.0.0-beta.5",
99
100
  "vue": "^3.3.8",
100
101
  "vue-router": "^4.2.5",
101
102
  "vue-tsc": "^1.8.22"