@milaboratories/uikit 2.0.8 → 2.0.10

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@milaboratories/uikit",
3
- "version": "2.0.8",
3
+ "version": "2.0.10",
4
4
  "type": "module",
5
5
  "main": "dist/pl-uikit.umd.js",
6
6
  "module": "dist/pl-uikit.js",
@@ -32,8 +32,8 @@
32
32
  "vue-tsc": "^2.1.6",
33
33
  "yarpm": "^1.2.0",
34
34
  "svgo": "^3.3.2",
35
- "@platforma-sdk/model": "^1.7.20",
36
- "@milaboratories/helpers": "^1.6.6"
35
+ "@milaboratories/helpers": "^1.6.6",
36
+ "@platforma-sdk/model": "^1.7.20"
37
37
  },
38
38
  "scripts": {
39
39
  "dev": "vite",
@@ -14,6 +14,8 @@ import './pl-log-view.scss';
14
14
  import { okOptional, tapIf } from '@milaboratories/helpers';
15
15
  import type { AnyLogHandle, Platforma, ValueOrErrors } from '@platforma-sdk/model';
16
16
  import { useLogHandle } from './useLogHandle';
17
+ import { useLabelNotch } from '@/utils/useLabelNotch';
18
+ import DoubleContour from '@/utils/DoubleContour.vue';
17
19
 
18
20
  const getOutputError = <T,>(o?: ValueOrErrors<T>) => {
19
21
  if (o && o.ok === false) {
@@ -50,6 +52,10 @@ const props = defineProps<{
50
52
  * @TODO
51
53
  */
52
54
  mockPlatforma?: Platforma;
55
+ /**
56
+ * The label to display above the texarea.
57
+ */
58
+ label?: string;
53
59
  }>();
54
60
 
55
61
  const logState = useLogHandle(props);
@@ -58,10 +64,14 @@ const isAnchored = ref<boolean>(true);
58
64
 
59
65
  const contentRef = ref<HTMLElement>();
60
66
 
67
+ const root = ref<HTMLInputElement>();
68
+
61
69
  const computedError = computed(() => logState.value?.error ?? props.error ?? getOutputError(props.output));
62
70
 
63
71
  const computedValue = computed(() => logState.value?.lines ?? props.value ?? okOptional(props.output));
64
72
 
73
+ useLabelNotch(root);
74
+
65
75
  const onClickCopy = () => {
66
76
  if (computedValue.value && typeof computedValue.value === 'string') {
67
77
  navigator.clipboard.writeText(computedValue.value);
@@ -93,7 +103,9 @@ const onContentScroll = (ev: Event) => {
93
103
  </script>
94
104
 
95
105
  <template>
96
- <div class="pl-log-view" :class="{ 'has-error': computedError }">
106
+ <div ref="root" class="pl-log-view" :class="{ 'has-error': computedError }">
107
+ <label v-if="label"> {{ label }} </label>
108
+ <DoubleContour class="pl-log-view__contour" />
97
109
  <PlMaskIcon24 title="Copy content" class="pl-log-view__copy" name="clipboard" @click="onClickCopy" />
98
110
  <div v-if="computedError" class="pl-log-view__error">{{ computedError }}</div>
99
111
  <div v-else ref="contentRef" class="pl-log-view__content" @scroll="onContentScroll">{{ computedValue }}</div>
@@ -2,18 +2,44 @@
2
2
 
3
3
  .pl-log-view {
4
4
  --log-background: var(--bg-base-light);
5
+ --contour-color: var(--txt-01);
6
+ --contour-border-width: 1px;
7
+ --label-offset-left-x: 8px;
8
+ --label-offset-right-x: 8px;
9
+ --border-color-log-view: var(--border-color-div-grey);
10
+
5
11
  height: 100%;
6
12
  max-height: 100%;
7
13
  max-width: 100%;
8
14
  border-radius: 6px;
9
- border: 1px solid var(--border-color-div-grey);
10
15
  background: var(--log-background);
11
16
  display: flex;
12
17
  position: relative;
13
18
  min-height: 44px;
19
+ padding-right: 40px;
20
+
21
+ &__contour {
22
+ position: absolute;
23
+ top: 0;
24
+ left: 0;
25
+ right: 0;
26
+ bottom: 0;
27
+ border-radius: var(--border-radius-control);
28
+ border-width: var(--contour-border-width);
29
+ border-color: var(--border-color-log-view);
30
+ border-style: solid;
31
+ box-shadow: none;
32
+ z-index: 0;
33
+ pointer-events: none;
34
+ }
35
+
36
+ label {
37
+ @include outlined-control-label();
38
+ }
14
39
 
15
40
  &.has-error {
16
- --log-background: var(--notification-error);
41
+ --log-background: linear-gradient(90deg, #FFEBEB 0%, #FFFFFF 100%);
42
+ --border-color-log-view: var(--border-color-error);
17
43
  }
18
44
 
19
45
  &__copy {
@@ -22,6 +48,7 @@
22
48
  right: 12px;
23
49
  background-color: var(--ic-02);
24
50
  cursor: pointer;
51
+
25
52
  &:hover {
26
53
  background-color: var(--txt-01);
27
54
  }
@@ -12,6 +12,8 @@ import { PlTooltip } from '@/components/PlTooltip';
12
12
  import DoubleContour from '@/utils/DoubleContour.vue';
13
13
  import { useLabelNotch } from '@/utils/useLabelNotch';
14
14
  import { useValidation } from '@/utils/useValidation';
15
+ import { PlIcon16 } from '../PlIcon16';
16
+ import { PlIcon24 } from '../PlIcon24';
15
17
 
16
18
  const slots = useSlots();
17
19
 
@@ -99,7 +101,7 @@ const fieldType = computed(() => {
99
101
  }
100
102
  });
101
103
 
102
- const passwordIcon = computed(() => (showPassword.value ? 'icon-view-off' : 'icon-view-on'));
104
+ const passwordIcon = computed(() => (showPassword.value ? 'view-on' : 'view-off'));
103
105
 
104
106
  const clear = () => {
105
107
  if (props.clearable) {
@@ -136,16 +138,16 @@ const canShowClearable = computed(() => props.clearable && nonEmpty.value && pro
136
138
 
137
139
  useLabelNotch(rootRef);
138
140
 
139
- function togglePassword() {
141
+ function togglePasswordVisibility() {
140
142
  showPassword.value = !showPassword.value;
141
143
  }
142
144
  </script>
143
145
 
144
146
  <template>
145
- <div class="ui-text-field__envelope">
147
+ <div class="pl-text-field__envelope">
146
148
  <div
147
149
  ref="rootRef"
148
- class="ui-text-field"
150
+ class="pl-text-field"
149
151
  :class="{
150
152
  error: hasErrors,
151
153
  disabled,
@@ -162,20 +164,20 @@ function togglePassword() {
162
164
  </template>
163
165
  </PlTooltip>
164
166
  </label>
165
- <div v-if="prefix" class="ui-text-field__prefix">
167
+ <div v-if="prefix" class="pl-text-field__prefix">
166
168
  {{ prefix }}
167
169
  </div>
168
170
  <input ref="inputRef" v-model="valueRef" :disabled="disabled" :placeholder="placeholder || '...'" :type="fieldType" spellcheck="false" />
169
- <div class="ui-text-field__append">
170
- <div v-if="canShowClearable" class="icon icon--clear" @click="clear" />
171
- <div v-if="type === 'password'" :class="passwordIcon" class="icon-24 uc-pointer" @click="togglePassword" />
171
+ <div class="pl-text-field__append">
172
+ <PlIcon16 v-if="canShowClearable" name="delete-clear" @click="clear" />
173
+ <PlIcon24 v-if="type === 'password'" :name="passwordIcon" style="cursor: pointer" @click="togglePasswordVisibility" />
172
174
  <slot name="append" />
173
175
  </div>
174
- <DoubleContour class="ui-text-field__contour" />
176
+ <DoubleContour class="pl-text-field__contour" />
175
177
  </div>
176
- <div v-if="hasErrors" class="ui-text-field__error">
178
+ <div v-if="hasErrors" class="pl-text-field__error">
177
179
  {{ displayErrors.join(' ') }}
178
180
  </div>
179
- <div v-else-if="helper" class="ui-text-field__helper">{{ helper }}</div>
181
+ <div v-else-if="helper" class="pl-text-field__helper">{{ helper }}</div>
180
182
  </div>
181
183
  </template>
@@ -1,6 +1,6 @@
1
1
  @import "@/assets/mixins";
2
2
 
3
- .ui-text-field {
3
+ .pl-text-field {
4
4
  $root: &;
5
5
 
6
6
  --contour-color: var(--txt-01);
@@ -78,10 +78,10 @@
78
78
  flex-direction: row;
79
79
  align-items: center;
80
80
  gap: 4px;
81
- .icon {
81
+ .icon-16 {
82
82
  cursor: pointer;
83
83
  }
84
- .mask {
84
+ .mask-16 {
85
85
  background-color: var(--control-mask-fill);
86
86
  cursor: pointer;
87
87
  }