@dataloop-ai/components 0.16.4 → 0.16.6

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.
package/.eslintrc.js CHANGED
@@ -95,7 +95,7 @@ module.exports = {
95
95
  hoist: 'all'
96
96
  }
97
97
  ],
98
- '@typescript-eslint/no-unused-expressions': 'error',
98
+ '@typescript-eslint/no-unused-expressions': 'off',
99
99
  '@typescript-eslint/no-unused-vars': 'off',
100
100
  '@typescript-eslint/no-use-before-define': 'off',
101
101
  '@typescript-eslint/no-var-requires': 'off',
@@ -120,7 +120,7 @@ module.exports = {
120
120
  'no-trailing-spaces': 'warn',
121
121
  'no-undef-init': 'warn',
122
122
  'no-unsafe-finally': 'off',
123
- 'no-unused-expressions': 'error',
123
+ 'no-unused-expressions': 'off',
124
124
  'no-unused-labels': 'error',
125
125
  'no-use-before-define': 'off',
126
126
  'no-var': 'warn',
@@ -0,0 +1,53 @@
1
+ # Contributing Guidelines
2
+ Thank you for your interest in contributing to our project! We welcome contributions from everyone. Please take a moment to review these guidelines before submitting a pull request or issue.
3
+
4
+ ## Code of Conduct
5
+ Our project has a [Code of Conduct](./CODE_OF_CONDUCT.md) that we expect all contributors to follow. Please read it before making any contribution.
6
+
7
+ ## Issues
8
+ If you find any issues or bugs, please search the existing issues to see if the issue has already been reported. If it hasn't, please create a new issue with a clear and concise title and description. Be sure to include any relevant information, such as error messages or steps to reproduce the issue.
9
+
10
+ The repository provides base templates for create a bug/feature request type of issues. please fill the relevant information there.
11
+
12
+ If the issue is related to a specific component then please have in the title of the issue the name of the component and then a short description of the issue. Example: ``` DlButton > 'description of issue' ```
13
+
14
+ ## Pull Requests
15
+ We welcome contributions in the form of pull requests. Before submitting a pull request, please make sure that your code:
16
+
17
+ - Is well-tested
18
+ - Conforms to our coding style guidelines (see below)
19
+ - Includes any necessary documentation
20
+
21
+ ### Naming Convention
22
+ Each pull request should reflect the issue it is trying to close or have a short descriptive title.
23
+
24
+ If the pull request is working on a specific component please start the pull request title with the components name. Example: ``` DlButton > 'description of issue' ```
25
+
26
+ If a component / module or type that is being developed or introduced will not be exported it should not have the ```Dl``` prefix.
27
+ If it is being exported it is required for it to have the ```Dl``` prefix.
28
+
29
+ ### Coding Style Guidelines
30
+ Please follow these coding style guidelines when submitting a pull request:
31
+ - Use consistent indentation
32
+ - Use descriptive variable names
33
+ - Use comments to explain non-obvious code behavior
34
+ - Follow the provided linter configuration
35
+ - Please note that any build that does not pass the linter will fail. as part of our CI/CD
36
+ - When developing a component it should be assigned to the correct scope and have its own aligned code structure
37
+ - if the component has inner components they should be in the components directory under ```/components```
38
+ - every component should export index.ts and types.ts
39
+
40
+
41
+ Steps to submit a pull request:
42
+ 1. Fork the repository
43
+ 2. Clone the forked repository to your local machine
44
+ 3. Create a new branch for your changes
45
+ 4. Make your changes and commit them
46
+ 5. Push the changes to your forked repository
47
+ 6. Submit a pull request to the original repository
48
+ 7. Please make sure that your pull request clearly explains the problem you are trying to solve, the solution you have implemented, and any potential side effects of your changes.
49
+
50
+ ## License
51
+ By contributing to our project, you agree that your contributions will be licensed under the [project's license](./LICENSE.md).
52
+
53
+ Thank you for your contributions!
package/SECURITY.md ADDED
@@ -0,0 +1,15 @@
1
+ # Security Policy
2
+
3
+ ## Supported Versions
4
+
5
+ We release patches for security vulnerabilities. Every new version of our project contains the latest security fixes and we will always push versions with the latest security fixes.
6
+
7
+ ## Reporting a Vulnerability
8
+
9
+ If you discover a security vulnerability within our project, please open an issue with the `security` tag. All security vulnerabilities will be promptly addressed.
10
+
11
+ ## Security Fixes and Resolutions
12
+
13
+ We take the security of our project seriously and strive to ensure that every version released includes the latest security fixes and resolutions. We regularly monitor and update our dependencies to ensure that they are up-to-date and secure.
14
+
15
+ If you have any questions or concerns about the security of our project, please do not hesitate to contact us.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dataloop-ai/components",
3
- "version": "0.16.4",
3
+ "version": "0.16.6",
4
4
  "exports": {
5
5
  ".": "./index.ts",
6
6
  "./models": "./models.ts",
@@ -17,7 +17,8 @@
17
17
  "lint:fix": "eslint ./src --ext .ts,.vue --fix",
18
18
  "format": "prettier --write ./src",
19
19
  "lint-staged": "lint-staged",
20
- "test": "vitest run --coverage",
20
+ "test": "vitest",
21
+ "test:coverage": "vitest run --coverage",
21
22
  "check-only": "if grep -E -H -r --exclude-dir=.git --exclude-dir=node_modules --exclude=*.json --exclude=*.yml '^(describe|it).only' .; then echo 'Found only in test files' && exit 1; fi"
22
23
  },
23
24
  "dependencies": {
@@ -100,7 +100,8 @@ export default defineComponent({
100
100
  validator: (value: string): boolean =>
101
101
  transformOptions.includes(value)
102
102
  },
103
- overflow: { type: Boolean, default: false }
103
+ overflow: { type: Boolean, default: false },
104
+ fit: { type: Boolean, default: false }
104
105
  },
105
106
  emits: ['remove'],
106
107
  setup() {
@@ -142,7 +143,9 @@ export default defineComponent({
142
143
  },
143
144
  cssChipVars(): Record<string, string | number> {
144
145
  return {
145
- '--dl-chip-max-width': setMaxWidth(this.maxWidth),
146
+ '--dl-chip-max-width': this.fit
147
+ ? 'fit-content'
148
+ : setMaxWidth(this.maxWidth),
146
149
  '--dl-chip-remove-icon-width': setRemoveIconWidth({
147
150
  hasLabel: this.hasLabel,
148
151
  removable: this.removable,
@@ -14,7 +14,8 @@
14
14
  class="dialog-wrapper"
15
15
  :style="{
16
16
  width: Number(width) ? `${width}px` : width,
17
- height: Number(height) ? `${height}px` : height
17
+ height: Number(height) ? `${height}px` : height,
18
+ transform: `translate(${draggableOptions.draggableX}px, ${draggableOptions.draggableY}px)`
18
19
  }"
19
20
  :class="{
20
21
  'dialog-wrapper--fullscreen': fullscreen,
@@ -23,6 +24,15 @@
23
24
  'dialog-wrapper--left': position === 'left'
24
25
  }"
25
26
  >
27
+ <dl-icon
28
+ v-if="draggable"
29
+ :style="{ cursor: draggableOptions.draggableCursor }"
30
+ class="dialog-wrapper--draggable-icon"
31
+ color="dl-color-medium"
32
+ icon="icon-dl-drag"
33
+ size="15px"
34
+ @mousedown="startDragElement"
35
+ />
26
36
  <div
27
37
  v-if="hasHeader"
28
38
  class="header"
@@ -52,9 +62,12 @@
52
62
  <script lang="ts">
53
63
  import { v4 } from 'uuid'
54
64
  import { defineComponent, PropType } from 'vue-demi'
65
+ import DlIcon from '../../essential/DlIcon/DlIcon.vue'
66
+ import { throttle } from 'lodash'
55
67
 
56
68
  export default defineComponent({
57
69
  name: 'DlDialogBox',
70
+ components: { DlIcon },
58
71
  model: {
59
72
  prop: 'modelValue',
60
73
  event: 'update:modelValue'
@@ -70,13 +83,24 @@ export default defineComponent({
70
83
  default: 'center'
71
84
  },
72
85
  modelValue: Boolean,
73
- volatile: { type: Boolean, default: false }
86
+ volatile: { type: Boolean, default: false },
87
+ draggable: {
88
+ type: Boolean,
89
+ default: false
90
+ }
74
91
  },
75
92
  emits: ['update:modelValue', 'hide', 'show'],
76
93
  data() {
77
94
  return {
78
95
  uuid: `dl-dialog-box-${v4()}`,
79
- show: this.modelValue
96
+ show: this.modelValue,
97
+ draggableOptions: {
98
+ draggableX: 0,
99
+ draggableY: 0,
100
+ originalX: 0,
101
+ originalY: 0,
102
+ draggableCursor: 'pointer'
103
+ }
80
104
  }
81
105
  },
82
106
  computed: {
@@ -112,6 +136,33 @@ export default defineComponent({
112
136
  }
113
137
  },
114
138
  methods: {
139
+ startDragElement(e: {
140
+ preventDefault: () => void
141
+ y: number
142
+ x: number
143
+ }) {
144
+ e.preventDefault()
145
+ if (
146
+ !this.draggableOptions.originalY &&
147
+ !this.draggableOptions.originalX
148
+ ) {
149
+ this.draggableOptions.originalY = e.y
150
+ this.draggableOptions.originalX = e.x
151
+ }
152
+ this.draggableOptions.draggableCursor = 'grabbing'
153
+ document.onmousemove = throttle((e) => {
154
+ this.draggableOptions.draggableX =
155
+ e.x - this.draggableOptions.originalX
156
+ this.draggableOptions.draggableY =
157
+ e.y - this.draggableOptions.originalY
158
+ }, 5)
159
+ document.onmouseup = this.stopDragElement
160
+ },
161
+ stopDragElement() {
162
+ document.onmousemove = null
163
+ document.onmouseup = null
164
+ this.draggableOptions.draggableCursor = 'pointer'
165
+ },
115
166
  closeModal() {
116
167
  if ((this.$el as HTMLElement)?.blur) {
117
168
  (this.$el as HTMLElement).blur()
@@ -183,15 +234,26 @@ export default defineComponent({
183
234
  height: 100vh !important;
184
235
  border-radius: 0px;
185
236
  }
237
+
186
238
  &--fullheight {
187
239
  margin: 0;
188
240
  height: 100vh !important;
189
241
  border-radius: 0px;
190
242
  }
243
+
244
+ &--draggable-icon {
245
+ position: absolute;
246
+ top: -1px;
247
+ left: 3px;
248
+ cursor: pointer;
249
+ transform: rotate(90deg);
250
+ }
251
+
191
252
  &--right {
192
253
  position: absolute !important;
193
254
  right: 0;
194
255
  }
256
+
195
257
  &--left {
196
258
  position: absolute !important;
197
259
  left: 0;
@@ -165,6 +165,16 @@
165
165
  overflow
166
166
  />
167
167
  </div>
168
+ <h4>Chips with Fit</h4>
169
+ <div
170
+ class="col"
171
+ style="margin-bottom: 30px"
172
+ >
173
+ <DlChip
174
+ label="Long Chip Label With Alot Of Text"
175
+ fit
176
+ />
177
+ </div>
168
178
  </div>
169
179
  </template>
170
180
 
@@ -1,11 +1,16 @@
1
1
  <template>
2
2
  <div>
3
- <button @click="openModal">
3
+ <dl-switch
4
+ v-model="draggable"
5
+ left-label="Draggable"
6
+ />
7
+ <dl-button @click="openModal">
4
8
  Open modal
5
- </button>
9
+ </dl-button>
6
10
  <dl-dialog-box
7
11
  ref="modalOne"
8
12
  v-model="isOpenedFirstModal"
13
+ :draggable="draggable"
9
14
  >
10
15
  <template #header>
11
16
  <dl-dialog-box-header
@@ -112,12 +117,13 @@
112
117
 
113
118
  <script lang="ts">
114
119
  import { defineComponent, ref } from 'vue-demi'
115
- import { DlDialogBox, DlButton } from '../components'
120
+ import { DlButton, DlDialogBox, DlSwitch } from '../components'
116
121
  import { DlDialogBoxHeader, DlDialogBoxFooter } from '../components'
117
122
 
118
123
  export default defineComponent({
119
124
  name: 'DlDialogBoxDemo',
120
125
  components: {
126
+ DlSwitch,
121
127
  DlButton,
122
128
  DlDialogBox,
123
129
  DlDialogBoxHeader,
@@ -126,7 +132,7 @@ export default defineComponent({
126
132
  setup() {
127
133
  const modalOne = ref<any>(null)
128
134
  const modalTwo = ref<any>(null)
129
-
135
+ const draggable = ref(true)
130
136
  const isOpenedFirstModal = ref(false)
131
137
 
132
138
  const openModal = () => {
@@ -168,7 +174,8 @@ export default defineComponent({
168
174
  closeSecondModal,
169
175
  modalOne,
170
176
  modalTwo,
171
- isOpenedFirstModal
177
+ isOpenedFirstModal,
178
+ draggable
172
179
  }
173
180
  }
174
181
  })