@globalbrain/sefirot 2.4.0 → 2.5.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.
@@ -25,7 +25,7 @@ const fuse = computed(() => {
25
25
  const filteredOptions = computed(() => {
26
26
  return !props.search || !query.value
27
27
  ? unref(props.options)
28
- : fuse.value.search(query.value).map(r => r.item)
28
+ : fuse.value.search(query.value).map((r) => r.item)
29
29
  })
30
30
 
31
31
  onMounted(() => {
@@ -125,7 +125,6 @@ function handleClick(option: DropdownSectionFilterOption, value: string | number
125
125
 
126
126
  .button {
127
127
  display: flex;
128
- align-items: center;
129
128
  border-radius: 6px;
130
129
  padding: 0 8px;
131
130
  width: 100%;
@@ -145,6 +144,7 @@ function handleClick(option: DropdownSectionFilterOption, value: string | number
145
144
 
146
145
  .checkbox {
147
146
  display: block;
147
+ padding-top: 8px;
148
148
  }
149
149
 
150
150
  .checkbox-box {
@@ -177,6 +177,11 @@ function handleClick(option: DropdownSectionFilterOption, value: string | number
177
177
  }
178
178
  }
179
179
 
180
+ .option-item {
181
+ padding-left: 8px;
182
+ width: 100%;
183
+ }
184
+
180
185
  .empty {
181
186
  padding: 16px;
182
187
  font-size: 12px;
@@ -9,23 +9,32 @@ defineProps<{
9
9
 
10
10
  <template>
11
11
  <span class="SDropdownSectionFilterItemAvatar">
12
- <SAvatar size="nano" :avatar="image" :name="label" />
12
+ <div class="avatar">
13
+ <SAvatar size="nano" :avatar="image" :name="label" />
14
+ </div>
13
15
  <span class="name">{{ label }}</span>
14
16
  </span>
15
17
  </template>
16
18
 
17
19
  <style scoped lang="postcss">
18
20
  .SDropdownSectionFilterItemAvatar {
19
- display: inline-flex;
21
+ display: flex;
20
22
  align-items: center;
21
- padding-left: 8px;
23
+ padding-right: 16px;
22
24
  min-height: 32px;
23
25
  }
24
26
 
27
+ .avatar {
28
+ flex-shrink: 0;
29
+ }
30
+
25
31
  .name {
26
32
  display: inline-block;
27
33
  padding-left: 8px;
28
34
  font-size: 12px;
29
35
  font-weight: 500;
36
+ white-space: nowrap;
37
+ overflow: hidden;
38
+ text-overflow: ellipsis;
30
39
  }
31
40
  </style>
@@ -6,14 +6,21 @@ defineProps<{
6
6
 
7
7
  <template>
8
8
  <span class="SDropdownSectionFilterItemText">
9
- {{ label }}
9
+ <span class="text">{{ label }}</span>
10
10
  </span>
11
11
  </template>
12
12
 
13
13
  <style scoped lang="postcss">
14
14
  .SDropdownSectionFilterItemText {
15
- padding-left: 8px;
16
- line-height: 32px;
15
+ display: inline-block;
16
+ padding: 6px 0;
17
+ line-height: 20px;
18
+ font-size: 12px;
19
+ }
20
+
21
+ .text {
22
+ display: inline-block;
23
+ line-height: 20px;
17
24
  font-size: 12px;
18
25
  font-weight: 500;
19
26
  }
@@ -28,7 +28,7 @@ function isChecked(value: unknown): boolean {
28
28
 
29
29
  function handleChange(value: unknown): void {
30
30
  const distinct = props.modelValue
31
- .filter(v => v !== value)
31
+ .filter((v) => v !== value)
32
32
  .concat(props.modelValue.includes(value) ? [] : [value])
33
33
 
34
34
  emit('update:modelValue', distinct)
@@ -71,10 +71,10 @@ const dropdownOptions = computed<DropdownSectionFilter[]>(() => [{
71
71
 
72
72
  const selected = computed(() => {
73
73
  if (isArray(props.modelValue)) {
74
- return props.options.filter(o => (props.modelValue as ArrayValue).includes(o.value))
74
+ return props.options.filter((o) => (props.modelValue as ArrayValue).includes(o.value))
75
75
  }
76
76
 
77
- const item = props.options.find(o => o.value === props.modelValue)
77
+ const item = props.options.find((o) => o.value === props.modelValue)
78
78
 
79
79
  return item ? [item] : []
80
80
  })
@@ -87,7 +87,7 @@ function emitTouch(type: ValueType): void {
87
87
 
88
88
  touched[type] = true
89
89
 
90
- if (createRequiredTouched().every(v => v)) {
90
+ if (createRequiredTouched().every((v) => v)) {
91
91
  props.validation.$touch()
92
92
  }
93
93
  }
@@ -38,7 +38,7 @@ function isChecked(value: string | number | boolean): boolean {
38
38
 
39
39
  function handleChange(value: string | number | boolean): void {
40
40
  const difference = props.modelValue
41
- .filter(v => v !== value)
41
+ .filter((v) => v !== value)
42
42
  .concat(props.modelValue.includes(value) ? [] : [value])
43
43
 
44
44
  emit('update:modelValue', difference)
@@ -77,7 +77,7 @@ function emitTouch(type: ValueType): void {
77
77
 
78
78
  touched[type] = true
79
79
 
80
- if (createRequiredTouched().every(v => v)) {
80
+ if (createRequiredTouched().every((v) => v)) {
81
81
  props.validation.$touch()
82
82
  }
83
83
  }
@@ -29,7 +29,7 @@ watch(
29
29
  { immediate: true }
30
30
  )
31
31
 
32
- subscribe(payload => emit('clicked', payload))
32
+ subscribe((payload) => emit('clicked', payload))
33
33
  </script>
34
34
 
35
35
  <template>
@@ -57,6 +57,13 @@ defineProps<{
57
57
  :avatars="cell.avatars"
58
58
  :color="cell.color"
59
59
  />
60
+ <component
61
+ v-else-if="cell.type === 'component'"
62
+ :is="cell.component"
63
+ :value="value"
64
+ :record="record"
65
+ v-bind="cell.props"
66
+ />
60
67
  </div>
61
68
  </template>
62
69
 
@@ -46,7 +46,7 @@ export function useGrid(options: UseGridOptions): Grid {
46
46
 
47
47
  function adjustSpacer() {
48
48
  container.value?.querySelectorAll(`${toClassSelector(spacerClass)}`)
49
- .forEach(n => n.remove())
49
+ .forEach((n) => n.remove())
50
50
 
51
51
  const track = container.value?.firstElementChild
52
52
 
@@ -70,7 +70,7 @@ export function useLink({ container, callbacks }: UseLinkOptions): UseLink {
70
70
  const isExternal = isExternalUrl(href)
71
71
  const isCallback = isCallbackUrl(href)
72
72
 
73
- subscribers.forEach(sub => sub({
73
+ subscribers.forEach((sub) => sub({
74
74
  event,
75
75
  target,
76
76
  isExternal,
@@ -1,5 +1,5 @@
1
1
  import { MaybeRef } from '@vueuse/core'
2
- import { reactive } from 'vue'
2
+ import { Component, reactive } from 'vue'
3
3
  import { DropdownSection } from './Dropdown'
4
4
 
5
5
  export interface Table {
@@ -34,8 +34,9 @@ export type TableCell =
34
34
  | TableCellPill
35
35
  | TableCellAvatar
36
36
  | TableCellAvatars
37
+ | TableCellComponent
37
38
 
38
- export type TableCellType = 'text' | 'day' | 'pill' | 'avatar' | 'avatars'
39
+ export type TableCellType = 'text' | 'day' | 'pill' | 'avatar' | 'avatars' | 'component'
39
40
 
40
41
  export interface TableCellBase {
41
42
  type: TableCellType
@@ -78,6 +79,12 @@ export interface TableCellAvatars extends TableCellBase {
78
79
  color?: 'neutral' | 'soft' | 'mute'
79
80
  }
80
81
 
82
+ export interface TableCellComponent extends TableCellBase {
83
+ type: 'component'
84
+ component: Component
85
+ props?: Record<string, any>
86
+ }
87
+
81
88
  export interface TableCellAvatarsOption {
82
89
  image?: string
83
90
  name?: string
@@ -37,7 +37,7 @@ export const useSnackbars = defineStore('snackbars', () => {
37
37
  }
38
38
 
39
39
  function pop(id: number): void {
40
- items.value = items.value.filter(item => item.id !== id)
40
+ items.value = items.value.filter((item) => item.id !== id)
41
41
  }
42
42
 
43
43
  return {
@@ -1,7 +1,7 @@
1
1
  type Awaited<T> = T extends undefined ? T : T extends PromiseLike<infer U> ? U : T
2
2
 
3
3
  export function sleep(ms = 500): Promise<undefined> {
4
- return new Promise<undefined>(resolve => setTimeout(resolve, ms))
4
+ return new Promise<undefined>((resolve) => setTimeout(resolve, ms))
5
5
  }
6
6
 
7
7
  export function delay<T extends any[]>(
@@ -13,5 +13,5 @@ export const HmsMap = {
13
13
  } as const
14
14
 
15
15
  export function requiredHms(hms: Hms, required: HmsType[] = ['h', 'm', 's']): boolean {
16
- return required.every(r => hms[HmsMap[r]] !== undefined)
16
+ return required.every((r) => hms[HmsMap[r]] !== undefined)
17
17
  }
@@ -3,5 +3,5 @@ import { Ymd, YmdMap, YmdType } from './ymd'
3
3
  export type { Ymd, YmdType, YmdMap }
4
4
 
5
5
  export function requiredYmd(ymd: Ymd, required: YmdType[] = ['y', 'm', 'd']): boolean {
6
- return required.every(r => ymd[YmdMap[r]] !== null)
6
+ return required.every((r) => ymd[YmdMap[r]] !== null)
7
7
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@globalbrain/sefirot",
3
- "version": "2.4.0",
3
+ "version": "2.5.1",
4
4
  "description": "Vue Components for Global Brain Design System.",
5
5
  "author": "Kia Ishii <ka.ishii@globalbrains.com>",
6
6
  "license": "MIT",
@@ -43,7 +43,7 @@
43
43
  "vue-router": "^4.1.5"
44
44
  },
45
45
  "devDependencies": {
46
- "@globalbrain/eslint-config": "^0.1.0",
46
+ "@globalbrain/eslint-config": "^1.0.0",
47
47
  "@histoire/plugin-vue": "^0.10.7",
48
48
  "@iconify-icons/ph": "^1.2.2",
49
49
  "@iconify/vue": "^4.0.0",
@@ -62,7 +62,7 @@
62
62
  "conventional-changelog-cli": "^2.2.2",
63
63
  "dayjs": "^1.11.5",
64
64
  "enquirer": "^2.3.6",
65
- "eslint": "^8.23.1",
65
+ "eslint": "^8.27.0",
66
66
  "execa": "^5.1.1",
67
67
  "fuse.js": "^6.6.2",
68
68
  "happy-dom": "^6.0.4",