@globalbrain/sefirot 0.67.0 → 0.68.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.
@@ -95,8 +95,9 @@ import SIconChevronDown from './icons/SIconChevronDown.vue'
95
95
  import SIconX from './icons/SIconX.vue'
96
96
  import SInputBase from './SInputBase.vue'
97
97
 
98
- export type Size = 'medium' | 'mini'
98
+ export type Size = 'mini' | 'small' | 'medium'
99
99
  export type Mode = 'filled' | 'outlined'
100
+ export type Align = 'left' | 'center' | 'right'
100
101
  export type Color = 'neutral' | 'info' | 'success' | 'warning' | 'danger'
101
102
  export type ColorCallback = (value: string | number) => Color
102
103
 
@@ -126,6 +127,7 @@ export default defineComponent({
126
127
  placeholder: { type: String, default: null },
127
128
  action: { type: Object as PropType<Action>, default: null },
128
129
  icon: { type: Object, default: null },
130
+ align: { type: String as PropType<Align>, default: null },
129
131
  text: { type: String, default: null },
130
132
  textAfter: { type: String, default: null },
131
133
  color: { type: Function as PropType<ColorCallback>, default: null },
@@ -144,15 +146,14 @@ export default defineComponent({
144
146
  const textAfterEl = ref<HTMLElement | null>(null)
145
147
  const color = ref<Color | null>(null)
146
148
 
147
- const classes = computed(() => ({
148
- medium: props.size === 'medium',
149
- mini: props.size === 'mini',
150
- filled: props.mode === 'filled',
151
- outlined: props.mode === 'outlined',
152
- disabled: props.disabled
153
- }))
149
+ const classes = computed(() => [
150
+ props.size,
151
+ props.mode,
152
+ { disabled: props.disabled }
153
+ ])
154
154
 
155
155
  const inputStyles = reactive({
156
+ textAlign: props.align,
156
157
  paddingRight: '',
157
158
  paddingLeft: ''
158
159
  })
@@ -332,6 +333,79 @@ export default defineComponent({
332
333
  }
333
334
  }
334
335
 
336
+ .SInputText.small {
337
+ .action {
338
+ padding: 3px 10px;
339
+ line-height: 24px;
340
+ }
341
+
342
+ .action-icon {
343
+ width: 14px;
344
+ height: 14px;
345
+ }
346
+
347
+ .action-icon + .action-text,
348
+ .action-icon + .action-select,
349
+ .action-text + .action-select {
350
+ margin-left: 6px;
351
+ }
352
+
353
+ .action-text {
354
+ font-size: 14px;
355
+ }
356
+
357
+ .input,
358
+ .input-area {
359
+ padding: 7px 12px;
360
+ width: 100%;
361
+ line-height: 24px;
362
+ min-height: 40px;
363
+ font-size: 16px;
364
+
365
+ &.has-icon {
366
+ padding-left: 30px;
367
+ }
368
+
369
+ &.is-clearable {
370
+ padding-right: 40px;
371
+ }
372
+ }
373
+
374
+ .icon {
375
+ top: 9px;
376
+ left: 10px;
377
+ }
378
+
379
+ .icon-svg {
380
+ width: 14px;
381
+ height: 14px;
382
+ }
383
+
384
+ .text {
385
+ padding: 0 8px 0 12px;
386
+ line-height: 40px;
387
+ font-size: 16px;
388
+ }
389
+
390
+ .text-after {
391
+ padding: 0 12px 0 8px;
392
+ line-height: 32px;
393
+ font-size: 14px;
394
+ }
395
+
396
+ .clear {
397
+ top: 0;
398
+ right: 0;
399
+ width: 32px;
400
+ height: 32px;
401
+ }
402
+
403
+ .clear-svg {
404
+ width: 10px;
405
+ height: 10px;
406
+ }
407
+ }
408
+
335
409
  .SInputText.medium {
336
410
  .action {
337
411
  padding: 11px 12px;
@@ -416,13 +490,13 @@ export default defineComponent({
416
490
 
417
491
  &:focus {
418
492
  border-color: var(--input-focus-border);
419
- background-color: var(--input-focus-bg);
493
+ background-color: var(--input-filled-bg-focus);
420
494
  }
421
495
  }
422
496
 
423
497
  .input-area:focus + .input {
424
498
  border-color: var(--input-focus-border);
425
- background-color: var(--input-focus-bg);
499
+ background-color: var(--input-filled-bg-focus);
426
500
  }
427
501
 
428
502
  &.disabled .input {
@@ -448,6 +522,11 @@ export default defineComponent({
448
522
  }
449
523
  }
450
524
 
525
+ .input-area:focus + .input {
526
+ border-color: var(--input-focus-border);
527
+ background-color: var(--input-filled-bg-focus);
528
+ }
529
+
451
530
  &.disabled .box:hover .input {
452
531
  border-color: var(--input-outlined-border);
453
532
  }
@@ -137,7 +137,6 @@ export default defineComponent({
137
137
 
138
138
  &:focus {
139
139
  border-color: var(--input-focus-border);
140
- background-color: var(--input-focus-bg);
141
140
  }
142
141
  }
143
142
 
@@ -2,7 +2,12 @@
2
2
  <transition name="fade" :duration="250" appear>
3
3
  <div ref="el" class="SModal" @click="closeIfClosable">
4
4
  <transition name="fade">
5
- <div v-show="show" class="SModal-content" :style="contentStyles">
5
+ <div
6
+ v-show="show"
7
+ class="SModal-content"
8
+ :style="contentStyles"
9
+ @click="closeIfClosable"
10
+ >
6
11
  <component
7
12
  :is="resolvedComponent"
8
13
  :if="resolvedComponent"
@@ -58,7 +63,7 @@ export default defineComponent({
58
63
  }
59
64
 
60
65
  function isDescendant(el: Element): boolean {
61
- if (el.classList && el.classList.contains('SModal')) {
66
+ if (el.classList && el.classList.contains('SModal-content')) {
62
67
  return false
63
68
  }
64
69
 
@@ -0,0 +1,47 @@
1
+ <template>
2
+ <article class="SSheet" :class="[size]">
3
+ <slot :close="close" />
4
+ </article>
5
+ </template>
6
+
7
+ <script lang="ts">
8
+ import { PropType, defineComponent } from '@vue/composition-api'
9
+ import { useStore } from '../composables/Store'
10
+
11
+ type Size = 'small' | 'medium' | 'large'
12
+
13
+ export default defineComponent({
14
+ props: {
15
+ size: { type: String as PropType<Size>, default: 'medium' }
16
+ },
17
+
18
+ setup() {
19
+ const store = useStore()
20
+
21
+ function close() {
22
+ store.dispatch('modal/close')
23
+ }
24
+
25
+ return {
26
+ close
27
+ }
28
+ }
29
+ })
30
+ </script>
31
+
32
+ <style lang="postcss" scoped>
33
+ @import "@/assets/styles/variables";
34
+
35
+ .SSheet {
36
+ margin: 0 auto;
37
+ border: 1px solid var(--c-divider-light);
38
+ border-radius: 8px;
39
+ background-color: var(--c-bg);
40
+ box-shadow: var(--shadow-depth-3);
41
+ overflow: hidden;
42
+ }
43
+
44
+ .SSheet.small { max-width: 392px; }
45
+ .SSheet.medium { max-width: 512px; }
46
+ .SSheet.large { max-width: 768px; }
47
+ </style>
@@ -0,0 +1,14 @@
1
+ <template>
2
+ <footer class="SSheetFooter">
3
+ <slot />
4
+ </footer>
5
+ </template>
6
+
7
+ <style lang="postcss" scoped>
8
+ @import "@/assets/styles/variables";
9
+
10
+ .SSheetFooter {
11
+ border-top: 1px solid var(--c-divider-light);
12
+ padding: 0 16px;
13
+ }
14
+ </style>
@@ -0,0 +1,32 @@
1
+ <template>
2
+ <div class="SSheetFooterAction">
3
+ <SButton
4
+ size="medium"
5
+ :type="type"
6
+ :mode="mode"
7
+ :label="label"
8
+ block
9
+ @click="$emit('click')"
10
+ />
11
+ </div>
12
+ </template>
13
+
14
+ <script lang="ts">
15
+ import { PropType, defineComponent } from '@nuxtjs/composition-api'
16
+ import SButton from './SButton.vue'
17
+
18
+ type Type = 'primary' | 'secondary' | 'tertiary' | 'text' | 'mute'
19
+ type Mode = 'neutral' | 'info' | 'success' | 'warning' | 'danger'
20
+
21
+ export default defineComponent({
22
+ components: {
23
+ SButton
24
+ },
25
+
26
+ props: {
27
+ type: { type: String as PropType<Type>, default: 'primary' },
28
+ mode: { type: String as PropType<Mode>, default: 'neutral' },
29
+ label: { type: String, default: null }
30
+ }
31
+ })
32
+ </script>
@@ -0,0 +1,19 @@
1
+ <template>
2
+ <div class="SSheetFooterActions">
3
+ <slot />
4
+ </div>
5
+ </template>
6
+
7
+ <style lang="postcss" scoped>
8
+ @import "@/assets/styles/variables";
9
+
10
+ .SSheetFooterActions {
11
+ display: flex;
12
+ justify-content: flex-end;
13
+ padding: 12px 0 11px;
14
+ }
15
+
16
+ .SSheetFooterActions >>> .SSheetFooterAction + .SSheetFooterAction {
17
+ padding-left: 8px;
18
+ }
19
+ </style>
@@ -0,0 +1,75 @@
1
+ <template>
2
+ <header class="SSheetHeader">
3
+ <slot />
4
+
5
+ <div v-if="closable" class="close">
6
+ <button class="close-button" @click="close">
7
+ <SIconX class="close-icon" />
8
+ </button>
9
+ </div>
10
+ </header>
11
+ </template>
12
+
13
+ <script lang="ts">
14
+ import { defineComponent } from '@vue/composition-api'
15
+ import { useStore } from '../composables/Store'
16
+ import SIconX from './icons/SIconX.vue'
17
+
18
+ export default defineComponent({
19
+ components: {
20
+ SIconX
21
+ },
22
+
23
+ props: {
24
+ closable: { type: Boolean, default: true }
25
+ },
26
+
27
+ setup() {
28
+ const store = useStore()
29
+
30
+ function close() {
31
+ store.dispatch('modal/close')
32
+ }
33
+
34
+ return {
35
+ close
36
+ }
37
+ }
38
+ })
39
+ </script>
40
+
41
+ <style lang="postcss" scoped>
42
+ @import "@/assets/styles/variables";
43
+
44
+ .SSheetHeader {
45
+ display: flex;
46
+ justify-content: space-between;
47
+ border-bottom: 1px solid var(--c-divider-light);
48
+ min-height: 48px;
49
+ background-color: var(--c-bg-soft);
50
+ }
51
+
52
+ .close {
53
+ margin: 0 0 0 auto;
54
+ }
55
+
56
+ .close-button {
57
+ display: flex;
58
+ justify-content: center;
59
+ align-items: center;
60
+ width: 48px;
61
+ height: 47px;
62
+ color: var(--c-text-3);
63
+ transition: color .25s;
64
+
65
+ &:hover {
66
+ color: var(--c-text-1);
67
+ }
68
+ }
69
+
70
+ .close-icon {
71
+ width: 20px;
72
+ height: 20px;
73
+ fill: currentColor;
74
+ }
75
+ </style>
@@ -0,0 +1,17 @@
1
+ <template>
2
+ <h1 class="SSheetHeaderTitle">
3
+ <slot />
4
+ </h1>
5
+ </template>
6
+
7
+ <style lang="postcss" scoped>
8
+ @import "@/assets/styles/variables";
9
+
10
+ .SSheetHeaderTitle {
11
+ margin: 0;
12
+ padding: 14px 16px 10px;
13
+ line-height: 20px;
14
+ font-size: 16px;
15
+ font-weight: 500;
16
+ }
17
+ </style>
@@ -0,0 +1,92 @@
1
+ <template>
2
+ <div class="SSheetMedium">
3
+ <slot />
4
+ </div>
5
+ </template>
6
+
7
+ <style lang="postcss" scoped>
8
+ @import "@/assets/styles/variables";
9
+
10
+ .SSheetMedium {
11
+ padding: 24px 16px;
12
+
13
+ @media (min-width: 768px) {
14
+ padding: 24px;
15
+ }
16
+ }
17
+
18
+ .SSheet.small .SSheetMedium {
19
+ @media (min-width: 768px) {
20
+ padding: 24px 16px;
21
+ }
22
+ }
23
+
24
+ .SSheetMedium >>> h1 {
25
+ line-height: 32px;
26
+ font-size: 20px;
27
+ font-weight: 500;
28
+ }
29
+
30
+ .SSheetMedium >>> h1 + p {
31
+ margin-top: 8px;
32
+ }
33
+
34
+ .SSheetMedium >>> p {
35
+ margin: 16px 0;
36
+ line-height: 24px;
37
+ font-size: 14px;
38
+ font-weight: 400;
39
+ }
40
+
41
+ .SSheetMedium >>> p:first-child {
42
+ margin-top: 0;
43
+ }
44
+
45
+ .SSheetMedium >>> p:last-child {
46
+ margin-bottom: 0;
47
+ }
48
+
49
+ .SSheetMedium >>> a {
50
+ font-weight: 500;
51
+ color: var(--c-info);
52
+ transition: color .25s;
53
+
54
+ &:hover {
55
+ color: var(--c-info-dark);
56
+ }
57
+ }
58
+
59
+ .SSheetMedium >>> ul {
60
+ margin: 16px 0;
61
+ }
62
+
63
+ .SSheetMedium >>> ul:last-child {
64
+ margin-bottom: 0;
65
+ }
66
+
67
+ .SSheetMedium >>> li {
68
+ position: relative;
69
+ padding-left: 20px;
70
+ font-size: 14px;
71
+ font-weight: 400;
72
+ }
73
+
74
+ .SSheetMedium >>> li::before {
75
+ position: absolute;
76
+ top: 9px;
77
+ left: 4px;
78
+ border-radius: 50%;
79
+ width: 6px;
80
+ height: 6px;
81
+ background-color: var(--c-text-3);
82
+ content: "";
83
+ }
84
+
85
+ .SSheetMedium >>> li + li {
86
+ margin-top: 4px;
87
+ }
88
+
89
+ .SSheetMedium >>> li > ul {
90
+ margin: 4px 0 0;
91
+ }
92
+ </style>
Binary file
@@ -0,0 +1,10 @@
1
+ <template>
2
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24">
3
+ <circle cx="8.83" cy="12" r="2" />
4
+ <circle cx="8.83" cy="5" r="2" />
5
+ <circle cx="8.83" cy="19" r="2" />
6
+ <circle cx="15.17" cy="12" r="2" />
7
+ <circle cx="15.17" cy="5" r="2" />
8
+ <circle cx="15.17" cy="19" r="2" />
9
+ </svg>
10
+ </template>
@@ -0,0 +1,7 @@
1
+ <template>
2
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24">
3
+ <circle cx="12" cy="12" r="2" />
4
+ <circle cx="12" cy="5" r="2" />
5
+ <circle cx="12" cy="19" r="2" />
6
+ </svg>
7
+ </template>
@@ -1,19 +1,30 @@
1
- import { Item } from '../store/modal'
1
+ import { Options as ModalOptions } from '../store/modal'
2
2
  import { useStore } from './Store'
3
3
 
4
4
  export interface Modal {
5
- open(item: Omit<Item, 'uid'>): Promise<any>
5
+ open(item?: OpenOptions): Promise<any>
6
6
  close(): Promise<any>
7
7
  }
8
8
 
9
+ export interface OpenOptions {
10
+ component?: any
11
+ uid?: number
12
+ data?: Record<string, any>
13
+ options?: ModalOptions
14
+ }
15
+
9
16
  let modalUid = 0
10
17
 
11
- export function useModal(): Modal {
18
+ export function useModal(component?: any): Modal {
12
19
  const store = useStore()
13
20
  const uid = useModalUid()
14
21
 
15
- function open(item: Omit<Item, 'uid'>) {
16
- return store.dispatch('modal/open', { ...item, uid })
22
+ function open(item: OpenOptions = {}) {
23
+ return store.dispatch('modal/open', {
24
+ uid,
25
+ component,
26
+ ...item
27
+ })
17
28
  }
18
29
 
19
30
  function close() {
@@ -22,7 +22,7 @@ export function useTooltip(
22
22
  }
23
23
 
24
24
  function hide(): void {
25
- on.value = false
25
+ setTimeout(() => { on.value = false })
26
26
  }
27
27
 
28
28
  function setPosition(): void {
@@ -0,0 +1,22 @@
1
+ import { defineComponent } from '@vue/composition-api'
2
+ import SSheet from '../components/SSheet.vue'
3
+ import SSheetHeader from '../components/SSheetHeader.vue'
4
+ import SSheetHeaderTitle from '../components/SSheetHeaderTitle.vue'
5
+ import SSheetMedium from '../components/SSheetMedium.vue'
6
+ import SSheetFooter from '../components/SSheetFooter.vue'
7
+ import SSheetFooterActions from '../components/SSheetFooterActions.vue'
8
+ import SSheetFooterAction from '../components/SSheetFooterAction.vue'
9
+
10
+ export default function Sheet() {
11
+ return defineComponent({
12
+ components: {
13
+ SSheet,
14
+ SSheetHeader,
15
+ SSheetHeaderTitle,
16
+ SSheetMedium,
17
+ SSheetFooter,
18
+ SSheetFooterActions,
19
+ SSheetFooterAction
20
+ }
21
+ })
22
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@globalbrain/sefirot",
3
- "version": "0.67.0",
3
+ "version": "0.68.0",
4
4
  "description": "Vue Components for Global Brain Design System.",
5
5
  "files": [
6
6
  "lib"
@@ -36,51 +36,52 @@
36
36
  },
37
37
  "devDependencies": {
38
38
  "@juggle/resize-observer": "^3.3.1",
39
- "@nuxt/types": "^2.15.4",
39
+ "@nuxt/types": "^2.15.8",
40
40
  "@nuxt/typescript-build": "^2.1.0",
41
- "@nuxtjs/composition-api": "^0.22.4",
41
+ "@nuxtjs/color-mode": "^2.1.1",
42
+ "@nuxtjs/composition-api": "^0.29.3",
42
43
  "@nuxtjs/dotenv": "^1.4.1",
43
- "@nuxtjs/eslint-config-typescript": "^6.0.0",
44
+ "@nuxtjs/eslint-config-typescript": "^6.0.1",
44
45
  "@nuxtjs/google-analytics": "^2.4.0",
45
46
  "@nuxtjs/markdownit": "^1.2.10",
46
- "@types/body-scroll-lock": "^2.6.1",
47
+ "@types/body-scroll-lock": "^3.1.0",
47
48
  "@types/escape-html": "^1.0.1",
48
- "@types/jest": "^26.0.23",
49
- "@types/lodash-es": "^4.17.4",
50
- "@types/markdown-it": "^12.0.1",
51
- "@types/prismjs": "^1.16.5",
52
- "@vue/composition-api": "^1.0.0-rc.6",
53
- "@vue/test-utils": "^1.1.3",
49
+ "@types/jest": "^27.0.2",
50
+ "@types/lodash-es": "^4.17.5",
51
+ "@types/markdown-it": "^12.2.3",
52
+ "@types/prismjs": "^1.16.6",
53
+ "@vue/composition-api": "^1.2.4",
54
+ "@vue/test-utils": "^1.2.2",
55
+ "@vue/vue2-jest": "^27.0.0-alpha.2",
54
56
  "babel-core": "^7.0.0-bridge.0",
55
57
  "body-scroll-lock": "^3.1.5",
56
- "codecov": "^3.8.2",
58
+ "codecov": "^3.8.3",
57
59
  "conventional-changelog-cli": "^2.1.1",
58
- "dayjs": "^1.10.4",
60
+ "dayjs": "^1.10.7",
59
61
  "escape-html": "^1.0.3",
60
- "eslint": "^7.26.0",
62
+ "eslint": "^7.32.0",
61
63
  "fuse.js": "^6.4.6",
62
- "jest": "^26.6.3",
64
+ "jest": "^27.3.1",
63
65
  "jest-serializer-vue": "^2.0.2",
64
66
  "lodash": "^4.17.21",
65
67
  "lodash-es": "^4.17.21",
66
- "markdown-it": "^12.0.6",
67
- "markdown-it-anchor": "^7.1.0",
68
+ "markdown-it": "^12.2.0",
69
+ "markdown-it-anchor": "^8.4.1",
68
70
  "normalize.css": "^8.0.1",
69
- "nuxt": "^2.15.4",
71
+ "nuxt": "^2.15.8",
70
72
  "portal-vue": "^2.1.7",
71
73
  "postcss-custom-properties": "^10.0.0",
72
74
  "postcss-nested": "^4.2.3",
73
- "prismjs": "^1.23.0",
75
+ "prismjs": "^1.25.0",
74
76
  "push-dir": "^0.4.1",
75
- "simplebar-vue": "^1.6.3",
76
- "ts-jest": "^26.5.6",
77
- "ts-loader": "^8.1.0",
78
- "typescript": "^4.2.4",
79
- "v-calendar": "^2.3.0",
80
- "vue": "^2.6.12",
81
- "vue-jest": "^3.0.7",
82
- "vue-router": "^3.5.1",
83
- "vue-server-renderer": "^2.6.12",
84
- "vue-template-compiler": "^2.6.12"
77
+ "simplebar-vue": "^1.6.8",
78
+ "ts-jest": "^27.0.7",
79
+ "ts-loader": "^8.3.0",
80
+ "typescript": "^4.4.4",
81
+ "v-calendar": "^2.3.4",
82
+ "vue": "^2.6.14",
83
+ "vue-router": "^3.5.2",
84
+ "vue-server-renderer": "^2.6.14",
85
+ "vue-template-compiler": "^2.6.14"
85
86
  }
86
87
  }