@teammodlr/ui-kit 2.1.7 → 2.1.8

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,36 +1,48 @@
1
1
  <template>
2
- <div
3
- @click="onClick"
4
- style="width: 24px; height: 24px; display: inline-flex; align-items: center; justify-content: center; vertical-align: bottom;"
5
- >
6
- <template v-if="!hide">
7
- <svg v-if="expanded" xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-chevron-down"><path d="m6 9 6 6 6-6"/></svg>
8
- <svg v-else xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-chevron-right"><path d="m9 18 6-6-6-6"/></svg>
9
- </template>
10
- </div>
2
+ <div
3
+ @click="onClick"
4
+ :class="iconClass"
5
+ >
6
+ <template v-if="!hide">
7
+ <svg v-if="expanded" :class="style.icon" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32">
8
+ <path d="M12 8l10 8l-10 8z"></path>
9
+ </svg>
10
+ <svg v-else :class="style.icon" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32">
11
+ <path d="M12 8l10 8l-10 8z"></path>
12
+ </svg>
13
+ </template>
14
+ </div>
11
15
  </template>
12
16
 
13
17
  <script lang="ts">
14
- import {defineComponent, type PropType} from "vue";
18
+ import {computed, defineComponent, type PropType} from "vue";
15
19
  import type {TmNode} from "./types";
20
+ import * as style from "./style";
16
21
 
17
22
  export default defineComponent({
18
- name: "TreeNodeToggle",
19
- props: {
20
- expanded: Boolean,
21
- selected: Boolean,
22
- onClick: Function as PropType<(e: MouseEvent) => void>,
23
- hide: Boolean,
24
- node: {
25
- type: Object as PropType<TmNode>,
26
- required: true
27
- }
28
- },
29
- setup (props) {
30
-
31
- return {
23
+ name: "TreeNodeToggle",
24
+ props: {
25
+ expanded: Boolean,
26
+ selected: Boolean,
27
+ onClick: Function as PropType<(e: MouseEvent) => void>,
28
+ hide: Boolean,
29
+ node: {
30
+ type: Object as PropType<TmNode>,
31
+ required: true
32
+ }
33
+ },
34
+ setup(props) {
32
35
 
33
- }
36
+ const iconClass = computed(() => {
37
+ return {
38
+ [style.toggle]: true,
39
+ [style.iconRotate["90"]]: props.expanded,
40
+ }
41
+ });
42
+ return {
43
+ style,
44
+ iconClass
34
45
  }
46
+ }
35
47
  })
36
48
  </script>
@@ -1,5 +1,5 @@
1
1
  <template>
2
- <MTree :data="data" label-field="name" key-field="id" @dblclick="dblclick"/>
2
+ <MTree :data="data" label-field="name" key-field="id" @dblclick="dblclick" style="height: 300px;"/>
3
3
  </template>
4
4
  <script lang="ts" setup>
5
5
  import {ref} from 'vue'
@@ -0,0 +1,70 @@
1
+ import {createVar, globalKeyframes, globalStyle, style, styleVariants} from "@vanilla-extract/css";
2
+ import {themeVars} from "../../../styles/theme.css";
3
+
4
+
5
+ export const toggle = style({
6
+ cursor: "pointer",
7
+ display: "inline-flex",
8
+ flexShrink: 0,
9
+ height: `24px`,
10
+ width: `24px`,
11
+ alignItems: "center",
12
+ justifyContent: "center",
13
+ verticalAlign: "bottom",
14
+ transition: `transform .15s ${themeVars.transition.default}`
15
+ })
16
+ export const icon = style({
17
+ position: "relative",
18
+ height: `14px`,
19
+ width: `14px`,
20
+ display: "flex",
21
+ fontSize: `14px`,
22
+ fill: "currentColor",
23
+ color: themeVars.color.gray["600"],
24
+ });
25
+
26
+ export const iconRotate = styleVariants({
27
+ 90: {
28
+ transform: `rotate(90deg)`,
29
+ }
30
+ });
31
+
32
+ export const nodeWrapper = style({
33
+ boxSizing: "border-box",
34
+ padding: `${themeVars.space["0.5"]} 0`,
35
+ })
36
+
37
+ export const node = style({
38
+ transform: `translate3d(0, 0, 0)`,
39
+ position: "relative",
40
+ display: "flex",
41
+ borderRadius: themeVars.rounded.small,
42
+ transition: `background-color .3s ${themeVars.transition.default}`,
43
+ selectors: {
44
+ [`&:hover`]: {
45
+ backgroundColor: themeVars.color.gray["150"]
46
+ }
47
+ }
48
+ })
49
+
50
+ export const nodeContent = style({
51
+ cursor: "pointer",
52
+ position: "relative",
53
+ display: "inline-flex",
54
+ alignItems: "center",
55
+ minHeight: `24px`,
56
+ boxSizing: "border-box",
57
+ verticalAlign: "bottom",
58
+ padding: `0 ${themeVars.space["1"]} 0 ${themeVars.space["1"]}`,
59
+ borderRadius: themeVars.rounded.default,
60
+ lineHeight: 1.5,
61
+ userSelect: "none",
62
+ flexGrow: 1
63
+ });
64
+
65
+ export const nodeContentText = style({
66
+ flexGrow: 1,
67
+ maxWidth: `100%`,
68
+ fontSize: themeVars.fontSize.base,
69
+ color: themeVars.color.gray["700"],
70
+ })
@@ -0,0 +1 @@
1
+ export * from './Tree.css';
@@ -28,6 +28,7 @@ export interface TreeInjection {
28
28
  nodePropsRef: Ref<TreeNodeProps | undefined>,
29
29
  labelFieldRef: Ref<string>,
30
30
  keyFieldRef: Ref<string>,
31
+ childrenFieldRef: Ref<string>,
31
32
  handleToggleClick: (node: TreeNode<TreeOption>) => void,
32
33
  handleDoubleClick: (node: TreeOption) => void,
33
34
  }