@globalbrain/sefirot 3.3.0 → 3.4.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.
@@ -2,7 +2,7 @@
2
2
  import { computed } from 'vue'
3
3
  import { provideCardState } from '../composables/Card'
4
4
 
5
- export type Size = 'small' | 'medium' | 'large'
5
+ export type Size = 'small' | 'medium' | 'large' | 'xlarge' | 'xxlarge'
6
6
  export type Mode = 'neutral' | 'info' | 'success' | 'warning' | 'danger'
7
7
 
8
8
  const props = defineProps<{
@@ -83,6 +83,20 @@ const classes = computed(() => [
83
83
  max-width: 768px;
84
84
  }
85
85
  }
86
+
87
+ &.xlarge {
88
+ @media (min-width: 1056px) {
89
+ margin: 48px auto 128px;
90
+ max-width: 960px;
91
+ }
92
+ }
93
+
94
+ &.xxlarge {
95
+ @media (min-width: 1248px) {
96
+ margin: 48px auto 128px;
97
+ max-width: 1152px;
98
+ }
99
+ }
86
100
  }
87
101
 
88
102
  .SModal.fade-enter-from > .SCard,
@@ -36,7 +36,7 @@ defineEmits<{
36
36
  <style lang="postcss" scoped>
37
37
  .SInputDropdownItemAvatar {
38
38
  display: flex;
39
- border: 1px solid var(--c-divider-light);
39
+ border: 1px solid var(--c-divider);
40
40
  border-radius: 14px;
41
41
  padding: 0 12px 0 0;
42
42
  background-color: var(--c-bg-mute);
@@ -29,7 +29,7 @@ defineEmits<{
29
29
  <style lang="postcss" scoped>
30
30
  .SInputDropdownItemText {
31
31
  display: flex;
32
- border: 1px solid var(--c-divider-light);
32
+ border: 1px solid var(--c-divider);
33
33
  border-radius: 14px;
34
34
  padding: 0 12px;
35
35
  background-color: var(--c-bg-mute);
@@ -31,7 +31,7 @@ defineEmits<{
31
31
  <style scoped lang="postcss">
32
32
  .SSheet {
33
33
  position: relative;
34
- border: 1px solid var(--c-divider-light);
34
+ border: 1px solid var(--c-divider);
35
35
  border-radius: 16px;
36
36
  background-color: var(--c-bg);
37
37
  transition: opacity 0.25s, transform 0.25s;
@@ -6,7 +6,7 @@
6
6
 
7
7
  <style scoped lang="postcss">
8
8
  .SSheetFooter {
9
- border-top: 1px solid var(--c-divider-light);
9
+ border-top: 1px solid var(--c-divider);
10
10
  padding: 0 16px;
11
11
 
12
12
  @media (min-width: 512px) {
@@ -44,7 +44,7 @@ function close() {
44
44
  <style scoped lang="postcss">
45
45
  .SSnackbar {
46
46
  position: relative;
47
- border: 1px solid var(--c-divider-light);
47
+ border: 1px solid var(--c-divider);
48
48
  border-radius: 6px;
49
49
  width: 100%;
50
50
  background-color: var(--c-bg-elv-up);
@@ -92,7 +92,7 @@ defineProps({
92
92
  height: 2px;
93
93
  }
94
94
 
95
- .bar.mute { background-color: var(--c-divider-light); }
95
+ .bar.mute { background-color: var(--c-divider); }
96
96
  .bar.active { background-color: var(--c-success); }
97
97
  .bar.failed { background-color: var(--c-danger); }
98
98
 
@@ -12,6 +12,7 @@ import {
12
12
  watch
13
13
  } from 'vue'
14
14
  import { type Table } from '../composables/Table'
15
+ import { getTextWidth } from '../support/Text'
15
16
  import SInputCheckbox from './SInputCheckbox.vue'
16
17
  import SSpinner from './SSpinner.vue'
17
18
  import STableCell from './STableCell.vue'
@@ -204,6 +205,52 @@ useResizeObserver(block, ([entry]) => {
204
205
 
205
206
  const resizeObserver = useResizeObserver(head, handleResize)
206
207
 
208
+ const font = typeof document !== 'undefined'
209
+ ? `500 12px ${getComputedStyle(document.body).fontFamily}`
210
+ : '500 12px Inter'
211
+
212
+ const actionsColumnWidth = computed(() => {
213
+ const { cell } = unref(props.options.columns).actions ?? {}
214
+
215
+ if (
216
+ typeof document === 'undefined'
217
+ || !cell
218
+ || typeof cell === 'function'
219
+ || cell.type !== 'actions'
220
+ ) {
221
+ return undefined
222
+ }
223
+
224
+ const { actions } = cell
225
+
226
+ const widths = actions.map(({ icon, label }) => {
227
+ // has only icon
228
+ if (icon && !label) {
229
+ return 1 /* border */ + 5 /* padding */ + 16 /* icon */ + 5 /* padding */ + 1 /* border */
230
+ }
231
+
232
+ // has only label
233
+ if (label && !icon) {
234
+ return 1 /* border */ + 12 /* padding */ + getTextWidth(label, font) + 12 /* padding */ + 1 /* border */
235
+ }
236
+
237
+ // has both icon and label
238
+ if (icon && label) {
239
+ return 1 /* border */ + 8 /* padding */ + 16 /* icon */ + 4 /* padding */ + getTextWidth(label, font) + 10 /* padding */ + 1 /* border */
240
+ }
241
+
242
+ return 0
243
+ })
244
+
245
+ return 8 /* padding */ + widths.reduce((a, b) => a + b, 0) + 8 /* padding */
246
+ })
247
+
248
+ watch(actionsColumnWidth, (newValue) => {
249
+ if (newValue) {
250
+ updateColWidth('actions', `${newValue}px`)
251
+ }
252
+ }, { immediate: true, flush: 'post' })
253
+
207
254
  function stopObserving() {
208
255
  const orders = ordersToShow.value
209
256
  const lastOrder
@@ -496,7 +543,7 @@ function updateSelected(selected: unknown[]) {
496
543
 
497
544
  :deep(.row) {
498
545
  display: flex;
499
- border-bottom: 1px solid var(--c-divider-2);
546
+ border-bottom: 1px solid var(--c-gutter);
500
547
  }
501
548
 
502
549
  :deep(.row.last),
@@ -31,8 +31,8 @@ defineProps<{
31
31
  min-height: 40px;
32
32
  display: flex;
33
33
  align-items: center;
34
- justify-content: center;
35
34
  flex-wrap: nowrap;
36
35
  flex-direction: row;
36
+ padding: 0 8px;
37
37
  }
38
38
  </style>
@@ -151,7 +151,7 @@ function stopDialogPositionListener() {
151
151
  background-color: var(--c-bg-elv-4);
152
152
 
153
153
  &.has-header {
154
- border-top: 1px solid var(--c-divider-2);
154
+ border-top: 1px solid var(--c-gutter);
155
155
  }
156
156
 
157
157
  .STableItem:first-child & {
@@ -56,7 +56,7 @@ const hasNext = computed(() => {
56
56
 
57
57
  <style scoped lang="postcss">
58
58
  .STableFooter {
59
- border-top: 1px solid var(--c-divider-2);
59
+ border-top: 1px solid var(--c-gutter);
60
60
  border-radius: 0 0 calc(var(--table-border-radius) - 1px) calc(var(--table-border-radius) - 1px);
61
61
  padding-right: var(--table-padding-right);
62
62
  padding-left: var(--table-padding-left);
@@ -47,6 +47,6 @@ const normalizedMenu = computed(() => {
47
47
  margin: 0 8px;
48
48
  width: 1px;
49
49
  height: 16px;
50
- background-color: var(--c-divider-2);
50
+ background-color: var(--c-gutter);
51
51
  }
52
52
  </style>
@@ -26,10 +26,13 @@ const classes = computed(() => [
26
26
  .STableItem {
27
27
  position: var(--table-col-position, relative);
28
28
  left: var(--table-col-left, 0);
29
+ right: var(--table-col-right, auto);
29
30
  z-index: var(--table-col-z-index, auto);
30
31
  flex-shrink: 0;
31
32
  flex-grow: 1;
32
- border-right: 1px solid var(--c-divider-light);
33
+ border-left: var(--table-col-border-left, 0) solid var(--c-gutter);
34
+ border-right: 1px solid var(--c-gutter);
35
+ margin-left: calc(var(--table-col-border-left, 0) * -1);
33
36
  min-width: var(--table-col-width);
34
37
  max-width: var(--table-col-width);
35
38
 
@@ -441,7 +441,7 @@
441
441
  --button-fill-mute-active-border-color: var(--c-border-mute-3);
442
442
  --button-fill-mute-active-text-color: var(--c-text-2);
443
443
  --button-fill-mute-active-bg-color: var(--c-bg-mute-3);
444
- --button-fill-mute-disabled-border-color: var(--c-divider-2);
444
+ --button-fill-mute-disabled-border-color: var(--c-border-mute-1);
445
445
  --button-fill-mute-disabled-text-color: var(--c-text-3);
446
446
  --button-fill-mute-disabled-content-color: var(--c-text-3);
447
447
  --button-fill-mute-disabled-bg-color: var(--c-bg-mute-1);
@@ -508,11 +508,11 @@
508
508
  --button-fill-info-disabled-border-color: var(--c-border-info-1);
509
509
  --button-fill-info-disabled-text-color: var(--c-white-a3);
510
510
  --button-fill-info-disabled-content-color: var(--c-white-a3);
511
- --button-fill-info-disabled-bg-color: var(--c-info-bg-dark);
511
+ --button-fill-info-disabled-bg-color: var(--c-blue-8);
512
512
 
513
513
  --button-fill-success-border-color: var(--c-border-success-1);
514
514
  --button-fill-success-text-color: var(--c-white-1);
515
- --button-fill-success-content-color: var(--c-success-text);
515
+ --button-fill-success-content-color: var(--c-white-1);
516
516
  --button-fill-success-bg-color: var(--c-bg-success-1);
517
517
  --button-fill-success-loader-color: var(--c-white);
518
518
  --button-fill-success-hover-border-color: var(--c-border-success-2);
@@ -524,7 +524,7 @@
524
524
  --button-fill-success-disabled-border-color: var(--c-border-success-1);
525
525
  --button-fill-success-disabled-text-color: var(--c-white-a3);
526
526
  --button-fill-success-disabled-content-color: var(--c-white-a3);
527
- --button-fill-success-disabled-bg-color: var(--c-success-bg-dark);
527
+ --button-fill-success-disabled-bg-color: var(--c-green-8);
528
528
 
529
529
  --button-fill-warning-border-color: var(--c-border-mute-1);
530
530
  --button-fill-warning-text-color: var(--c-text-warning-1);
@@ -826,7 +826,7 @@
826
826
  * -------------------------------------------------------------------------- */
827
827
 
828
828
  :root {
829
- --table-border: 1px solid var(--c-divider-2);
829
+ --table-border: 1px solid var(--c-divider);
830
830
  --table-border-top: var(--table-border);
831
831
  --table-border-right: var(--table-border);
832
832
  --table-border-bottom: var(--table-border);
@@ -0,0 +1,25 @@
1
+ // Adapted from https://stackoverflow.com/a/21015393/11613622
2
+
3
+ let _canvas: HTMLCanvasElement
4
+
5
+ export function getTextWidth(text: string, font: string): number
6
+ export function getTextWidth(text: string, el: HTMLElement): number
7
+
8
+ export function getTextWidth(text: string, fontOrEl: string | HTMLElement): number {
9
+ const canvas = _canvas || (_canvas = document.createElement('canvas'))
10
+ const context = canvas.getContext('2d')!
11
+ context.font = typeof fontOrEl === 'string' ? fontOrEl : getCanvasFont(fontOrEl)
12
+ const metrics = context.measureText(text)
13
+
14
+ return metrics.width
15
+ }
16
+
17
+ function getCanvasFont(el: HTMLElement) {
18
+ const {
19
+ fontWeight = 'normal',
20
+ fontSize = '16px',
21
+ fontFamily = 'Times New Roman'
22
+ } = getComputedStyle(el)
23
+
24
+ return `${fontWeight} ${fontSize} ${fontFamily}`
25
+ }
@@ -1,3 +1,7 @@
1
- declare module 'v-calendar' {
2
- export const DatePicker: any
1
+ /// <reference types="vite/client" />
2
+
3
+ declare module '*.vue' {
4
+ import { DefineComponent } from 'vue'
5
+ const component: DefineComponent<{}, {}, any>
6
+ export default component
3
7
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@globalbrain/sefirot",
3
- "version": "3.3.0",
4
- "packageManager": "pnpm@8.10.3",
3
+ "version": "3.4.0",
4
+ "packageManager": "pnpm@8.10.4",
5
5
  "description": "Vue Components for Global Brain Design System.",
6
6
  "author": "Kia Ishii <ka.ishii@globalbrains.com>",
7
7
  "license": "MIT",
@@ -20,6 +20,22 @@
20
20
  "files": [
21
21
  "lib"
22
22
  ],
23
+ "scripts": {
24
+ "docs": "vitepress dev docs --port 4000",
25
+ "docs:build": "vitepress build docs",
26
+ "docs:preview": "vitepress serve docs --port 3000",
27
+ "story": "histoire dev --port 3000",
28
+ "story:build": "histoire build",
29
+ "story:preview": "histoire preview --port 3000",
30
+ "type": "vue-tsc --noEmit",
31
+ "lint": "eslint --fix .",
32
+ "lint:fail": "eslint .",
33
+ "vitest": "vitest",
34
+ "coverage": "vitest run --coverage",
35
+ "test": "pnpm run type && pnpm run lint && pnpm run coverage",
36
+ "test:fail": "pnpm run type && pnpm run lint:fail && pnpm run coverage",
37
+ "release": "release-it"
38
+ },
23
39
  "peerDependencies": {
24
40
  "@iconify-icons/ph": "^1.2.5",
25
41
  "@iconify/vue": "^4.1.1",
@@ -29,7 +45,7 @@
29
45
  "@types/markdown-it": "^13.0.6",
30
46
  "@vuelidate/core": "^2.0.3",
31
47
  "@vuelidate/validators": "^2.0.4",
32
- "@vueuse/core": "^10.6.0",
48
+ "@vueuse/core": "^10.6.1",
33
49
  "body-scroll-lock": "4.0.0-beta.0",
34
50
  "fuse.js": "^7.0.0",
35
51
  "lodash-es": "^4.17.21",
@@ -47,9 +63,10 @@
47
63
  },
48
64
  "devDependencies": {
49
65
  "@globalbrain/eslint-config": "^1.5.2",
50
- "@histoire/plugin-vue": "^0.17.4",
66
+ "@histoire/plugin-vue": "^0.17.5",
51
67
  "@iconify-icons/ph": "^1.2.5",
52
68
  "@iconify/vue": "^4.1.1",
69
+ "@release-it/conventional-changelog": "^8.0.1",
53
70
  "@tanstack/vue-virtual": "3.0.0-beta.62",
54
71
  "@types/body-scroll-lock": "^3.1.2",
55
72
  "@types/lodash-es": "^4.17.11",
@@ -60,23 +77,19 @@
60
77
  "@vue/test-utils": "^2.4.1",
61
78
  "@vuelidate/core": "^2.0.3",
62
79
  "@vuelidate/validators": "^2.0.4",
63
- "@vueuse/core": "^10.6.0",
80
+ "@vueuse/core": "^10.6.1",
64
81
  "body-scroll-lock": "4.0.0-beta.0",
65
- "chalk": "^4.1.2",
66
- "conventional-changelog-cli": "^4.1.0",
67
- "enquirer": "^2.4.1",
68
82
  "eslint": "^8.53.0",
69
- "execa": "^5.1.1",
70
83
  "fuse.js": "^7.0.0",
71
84
  "happy-dom": "^12.10.3",
72
- "histoire": "^0.17.4",
85
+ "histoire": "^0.17.5",
73
86
  "lodash-es": "^4.17.21",
74
87
  "markdown-it": "^13.0.2",
75
88
  "normalize.css": "^8.0.1",
76
89
  "pinia": "^2.1.7",
77
90
  "postcss": "^8.4.31",
78
91
  "postcss-nested": "^6.0.1",
79
- "semver": "^7.5.4",
92
+ "release-it": "^17.0.0",
80
93
  "typescript": "~5.2.2",
81
94
  "v-calendar": "^3.1.2",
82
95
  "vite": "^4.5.0",
@@ -85,22 +98,5 @@
85
98
  "vue": "^3.3.8",
86
99
  "vue-router": "^4.2.5",
87
100
  "vue-tsc": "^1.8.22"
88
- },
89
- "scripts": {
90
- "docs": "vitepress dev docs --port 4000",
91
- "docs:build": "vitepress build docs",
92
- "docs:preview": "vitepress serve docs --port 3000",
93
- "story": "histoire dev --port 3000",
94
- "story:build": "histoire build",
95
- "story:preview": "histoire preview --port 3000",
96
- "type": "vue-tsc --noEmit",
97
- "lint": "eslint --fix .",
98
- "lint:fail": "eslint .",
99
- "vitest": "vitest",
100
- "coverage": "vitest run --coverage",
101
- "test": "pnpm run type && pnpm run lint && pnpm run coverage",
102
- "test:fail": "pnpm run type && pnpm run lint:fail && pnpm run coverage",
103
- "changelog": "conventional-changelog -p angular -i CHANGELOG.md -s",
104
- "release": "node scripts/release.js"
105
101
  }
106
- }
102
+ }
@@ -1,7 +0,0 @@
1
- declare module '*.vue' {
2
- import { DefineComponent } from 'vue'
3
-
4
- const component: DefineComponent<{}, {}, any>
5
-
6
- export default component
7
- }