@globalbrain/sefirot 2.14.1 → 2.16.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.
@@ -1,4 +1,5 @@
1
- import { MaybeRef } from '@vueuse/core'
1
+ import { MaybeRef, useElementBounding, useWindowSize } from '@vueuse/core'
2
+ import { Ref, ref, unref } from 'vue'
2
3
 
3
4
  export type DropdownSection =
4
5
  | DropdownSectionMenu
@@ -55,6 +56,70 @@ export interface DropdownSectionFilterOptionAvatar extends DropdownSectionFilter
55
56
  image?: string | null
56
57
  }
57
58
 
59
+ export interface ManualDropdownPosition {
60
+ position: Ref<'top' | 'bottom'>
61
+ update(): void
62
+ }
63
+
58
64
  export function createDropdown(section: DropdownSection[]): DropdownSection[] {
59
65
  return section
60
66
  }
67
+
68
+ export function useManualDropdownPosition(
69
+ container?: Ref<any>,
70
+ initPosition?: 'top' | 'bottom'
71
+ ): ManualDropdownPosition {
72
+ const el = container ?? ref<any>(null)
73
+
74
+ const { top, bottom } = useElementBounding(el)
75
+ const { height } = useWindowSize()
76
+
77
+ const position = ref<'top' | 'bottom'>('bottom')
78
+
79
+ const dialogHeight = 400
80
+
81
+ function update(): void {
82
+ if (initPosition) {
83
+ return
84
+ }
85
+
86
+ // If the space top of the input is not enough to show dialog, just show
87
+ // the dialog at the bottom of the input.
88
+ if (top.value < dialogHeight) {
89
+ position.value = 'bottom'
90
+ return
91
+ }
92
+
93
+ // Else show dialog depending on the space bottom of the input.
94
+ if (bottom.value + dialogHeight <= height.value) {
95
+ position.value = 'bottom'
96
+ return
97
+ }
98
+
99
+ position.value = 'top'
100
+ }
101
+
102
+ return {
103
+ position,
104
+ update
105
+ }
106
+ }
107
+
108
+ export function getSelectedOption(
109
+ sections: DropdownSection[]
110
+ ): DropdownSectionFilterOption | null {
111
+ for (const section of sections) {
112
+ if (section.type === 'filter') {
113
+ const options = unref(section.options)
114
+ const selected = unref(section.selected)
115
+
116
+ for (const option of options) {
117
+ if (option.value === selected) {
118
+ return option
119
+ }
120
+ }
121
+ }
122
+ }
123
+
124
+ return null
125
+ }
@@ -1,7 +1,7 @@
1
- import { ref, watch } from 'vue'
1
+ import { Ref, ref, watch } from 'vue'
2
2
 
3
- export function useFlyout() {
4
- const container = ref<any>(null)
3
+ export function useFlyout(container?: Ref<any>) {
4
+ const el = container ?? ref<any>(null)
5
5
 
6
6
  const isOpen = ref(false)
7
7
 
@@ -18,7 +18,7 @@ export function useFlyout() {
18
18
  }
19
19
 
20
20
  function closeOnClickOutside(event: any) {
21
- if (!container.value.contains(event.target) && isVisible(container.value)) {
21
+ if (!el.value.contains(event.target) && isVisible(el.value)) {
22
22
  isOpen.value = false
23
23
  }
24
24
  }
@@ -37,7 +37,7 @@ export function useFlyout() {
37
37
  })
38
38
 
39
39
  return {
40
- container,
40
+ container: el,
41
41
  isOpen,
42
42
  open,
43
43
  close,
@@ -651,6 +651,7 @@
651
651
  --input-focus-border-color: var(--c-info-light);
652
652
  --input-error-text-color: var(--c-danger-text);
653
653
  --input-error-border-color: var(--c-danger-light);
654
+ --input-disabled-border-color: var(--c-divider-1);
654
655
  --input-disabled-value-color: var(--c-text-1);
655
656
  --input-disabled-bg-color: var(--c-mute);
656
657
 
package/package.json CHANGED
@@ -1,6 +1,7 @@
1
1
  {
2
2
  "name": "@globalbrain/sefirot",
3
- "version": "2.14.1",
3
+ "version": "2.16.0",
4
+ "packageManager": "pnpm@7.26.0",
4
5
  "description": "Vue Components for Global Brain Design System.",
5
6
  "author": "Kia Ishii <ka.ishii@globalbrains.com>",
6
7
  "license": "MIT",
@@ -20,26 +21,26 @@
20
21
  "lib"
21
22
  ],
22
23
  "peerDependencies": {
23
- "@iconify-icons/ph": "^1.2.2",
24
- "@iconify/vue": "^4.0.0",
24
+ "@iconify-icons/ph": "^1.2.3",
25
+ "@iconify/vue": "^4.0.2",
25
26
  "@types/body-scroll-lock": "^3.1.0",
26
27
  "@types/lodash-es": "^4.17.6",
27
28
  "@types/markdown-it": "^12.2.3",
28
29
  "@vuelidate/core": "^2.0.0",
29
30
  "@vuelidate/validators": "^2.0.0",
30
- "@vueuse/core": "^9.3.0",
31
+ "@vueuse/core": "^9.11.1",
31
32
  "body-scroll-lock": "^4.0.0-beta.0",
32
33
  "fuse.js": "^6.6.2",
33
34
  "lodash-es": "^4.17.21",
34
35
  "markdown-it": "^13.0.1",
35
36
  "normalize.css": "^8.0.1",
36
- "pinia": "^2.0.22",
37
- "postcss": "^8.4.17",
38
- "postcss-nested": "^5.0.6",
39
- "typescript": "^4.8.4",
37
+ "pinia": "^2.0.29",
38
+ "postcss": "^8.4.21",
39
+ "postcss-nested": "^6.0.0",
40
+ "typescript": "^4.9.4",
40
41
  "v-calendar": "^3.0.0-alpha.8",
41
- "vue": "^3.2.40",
42
- "vue-router": "^4.1.5"
42
+ "vue": "^3.2.45",
43
+ "vue-router": "^4.1.6"
43
44
  },
44
45
  "dependencies": {
45
46
  "dayjs": "^1.11.7"
@@ -48,17 +49,17 @@
48
49
  "@globalbrain/eslint-config": "^1.2.1",
49
50
  "@histoire/plugin-vue": "^0.12.4",
50
51
  "@iconify-icons/ph": "^1.2.3",
51
- "@iconify/vue": "^4.0.1",
52
+ "@iconify/vue": "^4.0.2",
52
53
  "@types/body-scroll-lock": "^3.1.0",
53
54
  "@types/lodash-es": "^4.17.6",
54
55
  "@types/markdown-it": "^12.2.3",
55
56
  "@types/node": "^18.11.18",
56
57
  "@vitejs/plugin-vue": "^4.0.0",
57
- "@vitest/coverage-c8": "^0.27.2",
58
+ "@vitest/coverage-c8": "^0.28.1",
58
59
  "@vue/test-utils": "^2.2.7",
59
60
  "@vuelidate/core": "^2.0.0",
60
61
  "@vuelidate/validators": "^2.0.0",
61
- "@vueuse/core": "^9.6.0",
62
+ "@vueuse/core": "^9.11.1",
62
63
  "body-scroll-lock": "^4.0.0-beta.0",
63
64
  "chalk": "^4.1.2",
64
65
  "conventional-changelog-cli": "^2.2.2",
@@ -66,20 +67,19 @@
66
67
  "eslint": "^8.32.0",
67
68
  "execa": "^5.1.1",
68
69
  "fuse.js": "^6.6.2",
69
- "happy-dom": "^8.1.4",
70
70
  "histoire": "^0.12.4",
71
71
  "lodash-es": "^4.17.21",
72
72
  "markdown-it": "^13.0.1",
73
73
  "normalize.css": "^8.0.1",
74
- "pinia": "^2.0.27",
75
- "postcss": "^8.4.19",
74
+ "pinia": "^2.0.29",
75
+ "postcss": "^8.4.21",
76
76
  "postcss-nested": "^6.0.0",
77
77
  "semver": "^7.3.8",
78
78
  "typescript": "^4.9.4",
79
79
  "v-calendar": "3.0.0-alpha.8",
80
80
  "vite": "^4.0.4",
81
- "vitepress": "1.0.0-alpha.38",
82
- "vitest": "^0.27.2",
81
+ "vitepress": "1.0.0-alpha.40",
82
+ "vitest": "^0.28.1",
83
83
  "vue": "^3.2.45",
84
84
  "vue-router": "^4.1.6",
85
85
  "vue-tsc": "^1.0.24"