@globalbrain/sefirot 3.35.2 → 3.36.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.
- package/lib/components/SInputDropdown.vue +62 -54
- package/lib/components/SInputDropdownItem.vue +5 -0
- package/lib/components/SInputDropdownItemAvatar.vue +102 -24
- package/lib/components/SInputDropdownItemText.vue +93 -20
- package/lib/validation/rules/index.ts +1 -0
- package/lib/validation/rules/slackChannelName.ts +15 -0
- package/lib/validation/validators/index.ts +1 -0
- package/lib/validation/validators/slackChannelName.ts +16 -0
- package/package.json +1 -1
|
@@ -164,6 +164,7 @@ function handleArray(value: OptionValue) {
|
|
|
164
164
|
<SInputDropdownItem
|
|
165
165
|
v-if="hasSelected"
|
|
166
166
|
:items="selected"
|
|
167
|
+
:size="size ?? 'small'"
|
|
167
168
|
:removable="removable"
|
|
168
169
|
:disabled="disabled ?? false"
|
|
169
170
|
@remove="handleSelect"
|
|
@@ -187,13 +188,72 @@ function handleArray(value: OptionValue) {
|
|
|
187
188
|
</template>
|
|
188
189
|
|
|
189
190
|
<style scoped lang="postcss">
|
|
191
|
+
.container {
|
|
192
|
+
position: relative;
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
.box {
|
|
196
|
+
position: relative;
|
|
197
|
+
display: flex;
|
|
198
|
+
align-items: center;
|
|
199
|
+
border: 1px solid var(--input-border-color);
|
|
200
|
+
border-radius: 6px;
|
|
201
|
+
width: 100%;
|
|
202
|
+
color: var(--input-text);
|
|
203
|
+
background-color: var(--input-bg-color);;
|
|
204
|
+
cursor: pointer;
|
|
205
|
+
transition: border-color 0.25s, background-color 0.25s;
|
|
206
|
+
|
|
207
|
+
&:hover {
|
|
208
|
+
border-color: var(--input-hover-border-color);
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
.box-content {
|
|
213
|
+
display: flex;
|
|
214
|
+
align-items: center;
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
.box-placeholder {
|
|
218
|
+
line-height: 24px;
|
|
219
|
+
color: var(--input-placeholder-color);
|
|
220
|
+
overflow: hidden;
|
|
221
|
+
white-space: nowrap;
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
.box-icon {
|
|
225
|
+
position: absolute;
|
|
226
|
+
z-index: 10;
|
|
227
|
+
cursor: pointer;
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
.box-icon-svg {
|
|
231
|
+
display: block;
|
|
232
|
+
width: 14px;
|
|
233
|
+
height: 14px;
|
|
234
|
+
color: var(--c-text-2);
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
.box-icon-svg.up {
|
|
238
|
+
margin-bottom: -4px;
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
.dropdown {
|
|
242
|
+
position: absolute;
|
|
243
|
+
left: 0;
|
|
244
|
+
z-index: var(--z-index-dropdown);
|
|
245
|
+
|
|
246
|
+
&.top { bottom: calc(100% + 8px); }
|
|
247
|
+
&.bottom { top: calc(100% + 8px); }
|
|
248
|
+
}
|
|
249
|
+
|
|
190
250
|
.SInputDropdown.mini {
|
|
191
251
|
.box {
|
|
192
252
|
min-height: 32px;
|
|
193
253
|
}
|
|
194
254
|
|
|
195
255
|
.box-content {
|
|
196
|
-
padding: 3px 30px 3px
|
|
256
|
+
padding: 3px 30px 3px 8px;
|
|
197
257
|
line-height: 24px;
|
|
198
258
|
font-size: var(--input-font-size, var(--input-mini-font-size));
|
|
199
259
|
}
|
|
@@ -210,7 +270,7 @@ function handleArray(value: OptionValue) {
|
|
|
210
270
|
}
|
|
211
271
|
|
|
212
272
|
.box-content {
|
|
213
|
-
padding: 5px 30px 5px
|
|
273
|
+
padding: 5px 30px 5px 12px;
|
|
214
274
|
line-height: 24px;
|
|
215
275
|
font-size: var(--input-font-size, var(--input-small-font-size));
|
|
216
276
|
}
|
|
@@ -258,56 +318,4 @@ function handleArray(value: OptionValue) {
|
|
|
258
318
|
border-color: var(--input-error-border-color);
|
|
259
319
|
}
|
|
260
320
|
}
|
|
261
|
-
|
|
262
|
-
.container {
|
|
263
|
-
position: relative;
|
|
264
|
-
}
|
|
265
|
-
|
|
266
|
-
.box {
|
|
267
|
-
position: relative;
|
|
268
|
-
border: 1px solid var(--input-border-color);
|
|
269
|
-
border-radius: 6px;
|
|
270
|
-
width: 100%;
|
|
271
|
-
color: var(--input-text);
|
|
272
|
-
background-color: var(--input-bg-color);;
|
|
273
|
-
cursor: pointer;
|
|
274
|
-
transition: border-color 0.25s, background-color 0.25s;
|
|
275
|
-
|
|
276
|
-
&:hover {
|
|
277
|
-
border-color: var(--input-hover-border-color);
|
|
278
|
-
}
|
|
279
|
-
}
|
|
280
|
-
|
|
281
|
-
.box-placeholder {
|
|
282
|
-
padding: 2px 4px;
|
|
283
|
-
color: var(--input-placeholder-color);
|
|
284
|
-
overflow: hidden;
|
|
285
|
-
white-space: nowrap;
|
|
286
|
-
}
|
|
287
|
-
|
|
288
|
-
.box-icon {
|
|
289
|
-
position: absolute;
|
|
290
|
-
z-index: 10;
|
|
291
|
-
cursor: pointer;
|
|
292
|
-
}
|
|
293
|
-
|
|
294
|
-
.box-icon-svg {
|
|
295
|
-
display: block;
|
|
296
|
-
width: 14px;
|
|
297
|
-
height: 14px;
|
|
298
|
-
color: var(--c-text-2);
|
|
299
|
-
}
|
|
300
|
-
|
|
301
|
-
.box-icon-svg.up {
|
|
302
|
-
margin-bottom: -4px;
|
|
303
|
-
}
|
|
304
|
-
|
|
305
|
-
.dropdown {
|
|
306
|
-
position: absolute;
|
|
307
|
-
left: 0;
|
|
308
|
-
z-index: var(--z-index-dropdown);
|
|
309
|
-
|
|
310
|
-
&.top { bottom: calc(100% + 8px); }
|
|
311
|
-
&.bottom { top: calc(100% + 8px); }
|
|
312
|
-
}
|
|
313
321
|
</style>
|
|
@@ -20,8 +20,11 @@ export interface ItemAvatar extends ItemBase {
|
|
|
20
20
|
image?: string | null
|
|
21
21
|
}
|
|
22
22
|
|
|
23
|
+
export type Size = 'mini' | 'small' | 'medium'
|
|
24
|
+
|
|
23
25
|
defineProps<{
|
|
24
26
|
items: Item[]
|
|
27
|
+
size: Size
|
|
25
28
|
removable: boolean
|
|
26
29
|
disabled: boolean
|
|
27
30
|
}>()
|
|
@@ -36,6 +39,7 @@ defineEmits<{
|
|
|
36
39
|
<div v-for="(item, index) in items" :key="index" class="item">
|
|
37
40
|
<SInputDropdownItemText
|
|
38
41
|
v-if="item.type === 'text' || item.type === undefined"
|
|
42
|
+
:size="size"
|
|
39
43
|
:label="item.label"
|
|
40
44
|
:value="item.value"
|
|
41
45
|
:removable="removable"
|
|
@@ -44,6 +48,7 @@ defineEmits<{
|
|
|
44
48
|
/>
|
|
45
49
|
<SInputDropdownItemAvatar
|
|
46
50
|
v-if="item.type === 'avatar'"
|
|
51
|
+
:size="size"
|
|
47
52
|
:label="item.label"
|
|
48
53
|
:image="item.image"
|
|
49
54
|
:value="item.value"
|
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
|
-
import IconX from '@iconify-icons/ph/x'
|
|
2
|
+
import IconX from '@iconify-icons/ph/x-bold'
|
|
3
3
|
import SAvatar from './SAvatar.vue'
|
|
4
4
|
import SIcon from './SIcon.vue'
|
|
5
5
|
|
|
6
|
+
export type Size = 'mini' | 'small' | 'medium'
|
|
7
|
+
|
|
6
8
|
defineProps<{
|
|
9
|
+
size: Size
|
|
7
10
|
label: string
|
|
8
11
|
image?: string | null
|
|
9
12
|
value: any
|
|
@@ -14,13 +17,19 @@ defineProps<{
|
|
|
14
17
|
defineEmits<{
|
|
15
18
|
(e: 'remove', value: any): void
|
|
16
19
|
}>()
|
|
20
|
+
|
|
21
|
+
const avatarSizeDict = {
|
|
22
|
+
mini: 'nano',
|
|
23
|
+
small: 'mini',
|
|
24
|
+
medium: 'mini'
|
|
25
|
+
} as const
|
|
17
26
|
</script>
|
|
18
27
|
|
|
19
28
|
<template>
|
|
20
|
-
<div class="SInputDropdownItemAvatar" :class="{ disabled, removable }">
|
|
29
|
+
<div class="SInputDropdownItemAvatar" :class="[size, { disabled, removable }]">
|
|
21
30
|
<div class="user">
|
|
22
31
|
<div class="avatar">
|
|
23
|
-
<SAvatar size="
|
|
32
|
+
<SAvatar :size="avatarSizeDict[size]" :avatar="image" :name="label" />
|
|
24
33
|
</div>
|
|
25
34
|
<p class="name">{{ label }}</p>
|
|
26
35
|
</div>
|
|
@@ -36,31 +45,22 @@ defineEmits<{
|
|
|
36
45
|
<style lang="postcss" scoped>
|
|
37
46
|
.SInputDropdownItemAvatar {
|
|
38
47
|
display: flex;
|
|
48
|
+
align-items: center;
|
|
39
49
|
border: 1px solid var(--c-border-mute-1);
|
|
40
|
-
border-radius: 14px;
|
|
41
|
-
padding: 0 12px 0 0;
|
|
42
50
|
background-color: var(--c-bg-mute-1);
|
|
43
51
|
}
|
|
44
52
|
|
|
45
|
-
.SInputDropdownItemAvatar.removable {
|
|
46
|
-
padding: 0;
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
.SInputDropdownItemUserAvatar.disabled {
|
|
50
|
-
padding: 0 10px 0 0;
|
|
51
|
-
}
|
|
52
|
-
|
|
53
53
|
.user {
|
|
54
54
|
display: flex;
|
|
55
|
+
align-items: center;
|
|
55
56
|
}
|
|
56
57
|
|
|
57
58
|
.avatar {
|
|
58
|
-
|
|
59
|
+
display: flex;
|
|
60
|
+
align-items: center;
|
|
59
61
|
}
|
|
60
62
|
|
|
61
63
|
.name {
|
|
62
|
-
margin: 0 0 0 8px;
|
|
63
|
-
line-height: 26px;
|
|
64
64
|
font-size: 12px;
|
|
65
65
|
font-weight: 500;
|
|
66
66
|
white-space: nowrap;
|
|
@@ -70,9 +70,6 @@ defineEmits<{
|
|
|
70
70
|
display: flex;
|
|
71
71
|
justify-content: center;
|
|
72
72
|
align-items: center;
|
|
73
|
-
margin-left: 2px;
|
|
74
|
-
width: 26px;
|
|
75
|
-
height: 26px;
|
|
76
73
|
}
|
|
77
74
|
|
|
78
75
|
.remove-box {
|
|
@@ -80,8 +77,6 @@ defineEmits<{
|
|
|
80
77
|
justify-content: center;
|
|
81
78
|
align-items: center;
|
|
82
79
|
border-radius: 50%;
|
|
83
|
-
width: 20px;
|
|
84
|
-
height: 20px;
|
|
85
80
|
color: var(--c-text-2);
|
|
86
81
|
transition: color 0.25s, background-color 0.25s;
|
|
87
82
|
|
|
@@ -91,8 +86,91 @@ defineEmits<{
|
|
|
91
86
|
}
|
|
92
87
|
}
|
|
93
88
|
|
|
94
|
-
.
|
|
95
|
-
|
|
96
|
-
|
|
89
|
+
.SInputDropdownItemAvatar.mini {
|
|
90
|
+
gap: 2px;
|
|
91
|
+
border-radius: 12px;
|
|
92
|
+
padding: 0 8px 0 0;
|
|
93
|
+
height: 24px;
|
|
94
|
+
|
|
95
|
+
.avatar {
|
|
96
|
+
padding: 0 0 0 1px;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
.name {
|
|
100
|
+
margin-left: 6px;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
.remove {
|
|
104
|
+
width: 23px;
|
|
105
|
+
height: 23px;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
.remove-box {
|
|
109
|
+
width: 20px;
|
|
110
|
+
height: 20px;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
.remove-icon {
|
|
114
|
+
width: 12px;
|
|
115
|
+
height: 12px;
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
.SInputDropdownItemAvatar.small {
|
|
120
|
+
border-radius: 14px;
|
|
121
|
+
padding: 0 12px 0 0;
|
|
122
|
+
height: 28px;
|
|
123
|
+
|
|
124
|
+
.avatar {
|
|
125
|
+
padding: 0 0 0 1px;
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
.name {
|
|
129
|
+
margin-left: 6px;
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
.remove {
|
|
133
|
+
width: 26px;
|
|
134
|
+
height: 26px;
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
.remove-box {
|
|
138
|
+
width: 20px;
|
|
139
|
+
height: 20px;
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
.remove-icon {
|
|
143
|
+
width: 12px;
|
|
144
|
+
height: 12px;
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
.SInputDropdownItemAvatar.medium {
|
|
149
|
+
border-radius: 16px;
|
|
150
|
+
padding: 0 12px 0 0;
|
|
151
|
+
height: 32px;
|
|
152
|
+
|
|
153
|
+
.avatar {
|
|
154
|
+
padding: 0 0 0 4px;
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
.name {
|
|
158
|
+
margin-left: 6px;
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
.remove {
|
|
162
|
+
width: 26px;
|
|
163
|
+
height: 26px;
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
.remove-box {
|
|
167
|
+
width: 20px;
|
|
168
|
+
height: 20px;
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
.remove-icon {
|
|
172
|
+
width: 12px;
|
|
173
|
+
height: 12px;
|
|
174
|
+
}
|
|
97
175
|
}
|
|
98
176
|
</style>
|
|
@@ -2,7 +2,10 @@
|
|
|
2
2
|
import IconX from '@iconify-icons/ph/x-bold'
|
|
3
3
|
import SIcon from './SIcon.vue'
|
|
4
4
|
|
|
5
|
+
export type Size = 'mini' | 'small' | 'medium'
|
|
6
|
+
|
|
5
7
|
defineProps<{
|
|
8
|
+
size: Size
|
|
6
9
|
label: string
|
|
7
10
|
value: any
|
|
8
11
|
removable: boolean
|
|
@@ -15,7 +18,7 @@ defineEmits<{
|
|
|
15
18
|
</script>
|
|
16
19
|
|
|
17
20
|
<template>
|
|
18
|
-
<div class="SInputDropdownItemText" :class="{ disabled, removable }">
|
|
21
|
+
<div class="SInputDropdownItemText" :class="[size, { disabled, removable }]">
|
|
19
22
|
<p class="text">{{ label }}</p>
|
|
20
23
|
|
|
21
24
|
<div v-if="!disabled && removable" class="remove" role="button" @click.stop="$emit('remove', value)">
|
|
@@ -29,23 +32,14 @@ defineEmits<{
|
|
|
29
32
|
<style lang="postcss" scoped>
|
|
30
33
|
.SInputDropdownItemText {
|
|
31
34
|
display: flex;
|
|
35
|
+
align-items: center;
|
|
32
36
|
border: 1px solid var(--c-border-mute-1);
|
|
33
|
-
border-radius: 14px;
|
|
34
|
-
padding: 0 12px;
|
|
35
37
|
background-color: var(--c-bg-mute-1);
|
|
36
38
|
}
|
|
37
39
|
|
|
38
|
-
.SInputDropdownItemText.removable {
|
|
39
|
-
padding: 0 0 0 12px;
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
.SInputDropdownItemText.disabled {
|
|
43
|
-
padding: 0 10px;
|
|
44
|
-
}
|
|
45
|
-
|
|
46
40
|
.text {
|
|
47
41
|
margin: 0;
|
|
48
|
-
line-height:
|
|
42
|
+
line-height: 20px;
|
|
49
43
|
font-size: 12px;
|
|
50
44
|
font-weight: 500;
|
|
51
45
|
white-space: nowrap;
|
|
@@ -55,8 +49,6 @@ defineEmits<{
|
|
|
55
49
|
display: flex;
|
|
56
50
|
justify-content: center;
|
|
57
51
|
align-items: center;
|
|
58
|
-
width: 26px;
|
|
59
|
-
height: 26px;
|
|
60
52
|
}
|
|
61
53
|
|
|
62
54
|
.remove-box {
|
|
@@ -64,19 +56,100 @@ defineEmits<{
|
|
|
64
56
|
justify-content: center;
|
|
65
57
|
align-items: center;
|
|
66
58
|
border-radius: 50%;
|
|
67
|
-
width: 20px;
|
|
68
|
-
height: 20px;
|
|
69
59
|
color: var(--c-text-2);
|
|
70
60
|
transition: color 0.25s, background-color 0.25s;
|
|
71
61
|
|
|
72
62
|
.remove:hover & {
|
|
73
63
|
color: var(--c-text-1);
|
|
74
|
-
background-color: var(--c-bg-mute-
|
|
64
|
+
background-color: var(--c-bg-mute-3);
|
|
75
65
|
}
|
|
76
66
|
}
|
|
77
67
|
|
|
78
|
-
.
|
|
79
|
-
|
|
80
|
-
|
|
68
|
+
.SInputDropdownItemText.mini {
|
|
69
|
+
gap: 2px;
|
|
70
|
+
border-radius: 12px;
|
|
71
|
+
padding: 0 8px;
|
|
72
|
+
height: 24px;
|
|
73
|
+
|
|
74
|
+
&.removable {
|
|
75
|
+
padding: 0 0 0 8px;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
&.disabled {
|
|
79
|
+
padding: 0 10px;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
.remove {
|
|
83
|
+
width: 23px;
|
|
84
|
+
height: 23px;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
.remove-box {
|
|
88
|
+
width: 20px;
|
|
89
|
+
height: 20px;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
.remove-icon {
|
|
93
|
+
width: 12px;
|
|
94
|
+
height: 12px;
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
.SInputDropdownItemText.small {
|
|
99
|
+
border-radius: 14px;
|
|
100
|
+
padding: 0 12px;
|
|
101
|
+
height: 28px;
|
|
102
|
+
|
|
103
|
+
&.removable {
|
|
104
|
+
padding: 0 0 0 12px;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
&.disabled {
|
|
108
|
+
padding: 0 12px;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
.remove {
|
|
112
|
+
width: 26px;
|
|
113
|
+
height: 26px;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
.remove-box {
|
|
117
|
+
width: 20px;
|
|
118
|
+
height: 20px;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
.remove-icon {
|
|
122
|
+
width: 12px;
|
|
123
|
+
height: 12px;
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
.SInputDropdownItemText.medium {
|
|
128
|
+
border-radius: 16px;
|
|
129
|
+
padding: 0 12px;
|
|
130
|
+
height: 32px;
|
|
131
|
+
|
|
132
|
+
&.removable {
|
|
133
|
+
padding: 0 0 0 12px;
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
&.disabled {
|
|
137
|
+
padding: 0 12px;
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
.remove {
|
|
141
|
+
width: 26px;
|
|
142
|
+
height: 26px;
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
.remove-box {
|
|
146
|
+
width: 20px;
|
|
147
|
+
height: 20px;
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
.remove-icon {
|
|
151
|
+
width: 12px;
|
|
152
|
+
height: 12px;
|
|
153
|
+
}
|
|
81
154
|
}
|
|
82
155
|
</style>
|
|
@@ -19,6 +19,7 @@ export { requiredHms } from './requiredHms'
|
|
|
19
19
|
export { requiredIf } from './requiredIf'
|
|
20
20
|
export { requiredYmd } from './requiredYmd'
|
|
21
21
|
export { rule } from './rule'
|
|
22
|
+
export { slackChannelName } from './slackChannelName'
|
|
22
23
|
export { url } from './url'
|
|
23
24
|
export { ymd } from './ymd'
|
|
24
25
|
export { zeroOrNegativeInteger } from './zeroOrNegativeInteger'
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { createRule } from '../Rule'
|
|
2
|
+
import { type SlackChannelNameOptions, slackChannelName as baseSlackChannelName } from '../validators'
|
|
3
|
+
|
|
4
|
+
export const message = {
|
|
5
|
+
en: 'The slack channel name is invalid.',
|
|
6
|
+
ja: 'Slackチャンネル名の形式が正しくありません。'
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export function slackChannelName(options?: SlackChannelNameOptions, msg?: string) {
|
|
10
|
+
return createRule({
|
|
11
|
+
message: ({ lang }) => msg ?? message[lang],
|
|
12
|
+
optional: true,
|
|
13
|
+
validation: (value) => baseSlackChannelName(value, options)
|
|
14
|
+
})
|
|
15
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { isString } from '../../support/Utils'
|
|
2
|
+
|
|
3
|
+
export interface SlackChannelNameOptions {
|
|
4
|
+
offset?: number
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
export function slackChannelName(value: unknown, options: SlackChannelNameOptions = {}): boolean {
|
|
8
|
+
if (!isString(value)) {
|
|
9
|
+
return false
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
const { offset = 0 } = options
|
|
13
|
+
const maxLength = /* Slack channel name max length */ 80 - offset
|
|
14
|
+
|
|
15
|
+
return new RegExp(`^[\\p{L}\\p{M}\\p{N}_-]{1,${maxLength}}$`, 'u').test(value)
|
|
16
|
+
}
|