forstok-ui-lib 5.11.21 → 5.12.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/dist/index.d.ts +10 -2
- package/dist/index.js +25 -23
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +322 -320
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/src/assets/images/icons/warning-agent.svg +18 -0
- package/src/assets/javascripts/function.ts +27 -0
- package/src/assets/javascripts/helper.ts +48 -0
- package/src/assets/stylesheets/shares.styles.ts +65 -10
- package/src/components/icon/styles.ts +8 -0
- package/src/components/textarea/index.tsx +1 -1
- package/src/typeds/shares.typed.ts +1 -0
package/package.json
CHANGED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
|
|
2
|
+
|
|
3
|
+
<!-- Uploaded to: SVG Repo, www.svgrepo.com, Transformed by: SVG Repo Mixer Tools -->
|
|
4
|
+
<svg fill="#ff0000" width="auto" height="auto" viewBox="0 0 24 24" id="warning" data-name="Flat Color" xmlns="http://www.w3.org/2000/svg" class="icon flat-color" stroke="#ff0000">
|
|
5
|
+
|
|
6
|
+
<g id="SVGRepo_bgCarrier" stroke-width="0"/>
|
|
7
|
+
|
|
8
|
+
<g id="SVGRepo_tracerCarrier" stroke-linecap="round" stroke-linejoin="round"/>
|
|
9
|
+
|
|
10
|
+
<g id="SVGRepo_iconCarrier">
|
|
11
|
+
|
|
12
|
+
<circle id="primary" cx="12" cy="12" r="10" style="fill: #ff0000;"/>
|
|
13
|
+
|
|
14
|
+
<path id="secondary" d="M11,13V7a1,1,0,0,1,2,0v6a1,1,0,0,1-2,0Zm1,2.5A1.5,1.5,0,1,0,13.5,17,1.5,1.5,0,0,0,12,15.5Z" style="fill: #ffffff;"/>
|
|
15
|
+
|
|
16
|
+
</g>
|
|
17
|
+
|
|
18
|
+
</svg>
|
|
@@ -619,4 +619,31 @@ export const abbreviateNumber = (value?: number) => {
|
|
|
619
619
|
}
|
|
620
620
|
}
|
|
621
621
|
return result
|
|
622
|
+
}
|
|
623
|
+
|
|
624
|
+
export const pasteIntoInput = (el:HTMLInputElement| HTMLTextAreaElement, text: string) => {
|
|
625
|
+
el.focus()
|
|
626
|
+
if (typeof el.selectionStart == 'number' && typeof el.selectionEnd == 'number') {
|
|
627
|
+
var val = el.value
|
|
628
|
+
var selStart = el.selectionStart
|
|
629
|
+
el.value = val.slice(0, selStart) + text + val.slice(el.selectionEnd)
|
|
630
|
+
el.selectionEnd = el.selectionStart = selStart + text.length
|
|
631
|
+
} else if (typeof (document as any).selection != 'undefined') {
|
|
632
|
+
var textRange = (document as any).selection.createRange()
|
|
633
|
+
textRange.text = text
|
|
634
|
+
textRange.collapse(false)
|
|
635
|
+
textRange.select()
|
|
636
|
+
}
|
|
637
|
+
}
|
|
638
|
+
|
|
639
|
+
export const isDesktop = () => {
|
|
640
|
+
return document.body.clientWidth >= 1024 ? true : false;
|
|
641
|
+
}
|
|
642
|
+
|
|
643
|
+
export const isTablet = () => {
|
|
644
|
+
return (document.body.clientWidth >= 768 && document.body.clientWidth < 1024) ? true : false;
|
|
645
|
+
}
|
|
646
|
+
|
|
647
|
+
export const isMobile = () => {
|
|
648
|
+
return document.body.clientWidth < 768 ? true : false;
|
|
622
649
|
}
|
|
@@ -176,4 +176,52 @@ export const historyType = (name?: string) => {
|
|
|
176
176
|
default:
|
|
177
177
|
return '';
|
|
178
178
|
}
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
export const channelMap = (value: number) => {
|
|
182
|
+
const channel: TObject = {
|
|
183
|
+
'2': 'Shopify',
|
|
184
|
+
'3': 'Lazada',
|
|
185
|
+
'5': 'Blanja',
|
|
186
|
+
'6': 'Matahari mall',
|
|
187
|
+
'7': 'Magento 1',
|
|
188
|
+
'8': 'Elevania',
|
|
189
|
+
'9': 'Blibli',
|
|
190
|
+
'1o': 'Magento 2',
|
|
191
|
+
'11': 'Bukalapak',
|
|
192
|
+
'12': 'Shopee',
|
|
193
|
+
'13': 'Zalora Indonesia',
|
|
194
|
+
'15': 'Tokopedia',
|
|
195
|
+
'16': 'JD Indonesia',
|
|
196
|
+
'18': 'Zilingo',
|
|
197
|
+
'19': 'Woocommerce',
|
|
198
|
+
'21': 'Manual SO',
|
|
199
|
+
'3532': 'Aladin Mall',
|
|
200
|
+
'10017': 'Grabmart',
|
|
201
|
+
'10030': 'Tiktok',
|
|
202
|
+
};
|
|
203
|
+
return channel[value.toString()] || '';
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
export const colorStatus = (value?: string) => {
|
|
207
|
+
switch (value) {
|
|
208
|
+
case 'Pending_payment': case 'Pending_courier': case 'pending payment': case 'Pending Payment': case 'pending courier': case 'not started yet': case 'Pending': case 'Draft':
|
|
209
|
+
return '#FF585C'
|
|
210
|
+
case 'Open': case 'open': case 'In_picking': case 'Partial_picked': case 'in picking': case 'In Picking': case 'Incoming':
|
|
211
|
+
return '#F8813E'
|
|
212
|
+
case 'Picked': case 'picked': case 'Packed': case 'Ready_to_ship': case 'ready to ship': case 'Ready to Ship': case 'Ready_to_pickup': case 'Shipped': case 'shipped': case 'Fulfilled': case 'Delivered': case 'delivered': case 'Picked_up': case 'Invoiced': case 'Not_invoiced': case 'Invoice_paid': case 'Completed': case 'completed': case 'Paid': case 'In Progress': case 'Active': case 'Confirmed': case 'Adjusted':
|
|
213
|
+
return '#21BA45'
|
|
214
|
+
case 'Not_picked': case 'Not Picked': case 'Unpaid': case 'Overdue': case 'Write_off': case 'Write Off': case 'write off': case 'Written Off': case 'Failed Delivery': case 'failed delivery':
|
|
215
|
+
return '#FF585C'
|
|
216
|
+
case 'not shipped': case 'Not Shipped': case 'Partial_paid':
|
|
217
|
+
return '#F8813E'
|
|
218
|
+
case 'Cancelled': case 'cancelled': case 'Voided':
|
|
219
|
+
return '#a9a9a9'
|
|
220
|
+
case 'Returned': case 'return': case 'Return':
|
|
221
|
+
return '#ff585d'
|
|
222
|
+
case 'Closed':
|
|
223
|
+
return '#2c913d'
|
|
224
|
+
default:
|
|
225
|
+
return 'green'
|
|
226
|
+
}
|
|
179
227
|
}
|
|
@@ -22,6 +22,11 @@ const getTabsContentModFunc = ({ $mode }:{ $mode?: string }) => {
|
|
|
22
22
|
min-height: 600px;
|
|
23
23
|
}
|
|
24
24
|
`
|
|
25
|
+
} else if ($mode === 'chat') {
|
|
26
|
+
style +=`
|
|
27
|
+
height: calc(100vh - 150px);
|
|
28
|
+
overflow: hidden;
|
|
29
|
+
`
|
|
25
30
|
} else if ($mode === 'clear') {
|
|
26
31
|
style +=`
|
|
27
32
|
padding-top: 9px;
|
|
@@ -112,7 +117,7 @@ const getBulkActionWrapperModifiedStyled = ({ $isOpen }:{ $isOpen?: boolean }) =
|
|
|
112
117
|
}
|
|
113
118
|
return style
|
|
114
119
|
}
|
|
115
|
-
const getTableHeaderModFunc = ({ $mode }:{ $mode?: string }) => {
|
|
120
|
+
const getTableHeaderModFunc = ({ $mode, $isPlayground }:{ $mode?: string, $isPlayground?: boolean }) => {
|
|
116
121
|
let style = `
|
|
117
122
|
& ${TableHeadLabel} {
|
|
118
123
|
&:empty,
|
|
@@ -226,15 +231,17 @@ const getTableHeaderModFunc = ({ $mode }:{ $mode?: string }) => {
|
|
|
226
231
|
}
|
|
227
232
|
`
|
|
228
233
|
} else if ($mode === 'chat') {
|
|
234
|
+
const templateCol = $isPlayground ? '1fr max-content;' : '30px 1fr max-content;'
|
|
229
235
|
style +=`
|
|
230
236
|
padding: 0;
|
|
231
237
|
align-items: center;
|
|
232
|
-
grid-template-columns:
|
|
238
|
+
grid-template-columns: ${templateCol};
|
|
233
239
|
position: relative;
|
|
234
240
|
top: 50%;
|
|
235
241
|
transform: translateY(-50%);
|
|
236
242
|
grid-gap: 8px;
|
|
237
243
|
margin-left: 16px;
|
|
244
|
+
border-bottom: 0;
|
|
238
245
|
${TableRowGroup} {
|
|
239
246
|
${TableColumnGroup} {
|
|
240
247
|
span {
|
|
@@ -243,17 +250,16 @@ const getTableHeaderModFunc = ({ $mode }:{ $mode?: string }) => {
|
|
|
243
250
|
}
|
|
244
251
|
}
|
|
245
252
|
@media only screen and (min-width: 768px) {
|
|
246
|
-
border-bottom: 0;
|
|
247
253
|
grid-gap: 8px;
|
|
248
254
|
}
|
|
249
255
|
@media only screen and (min-width: 1280px) {
|
|
250
|
-
grid-template-columns:
|
|
256
|
+
grid-template-columns: ${templateCol};
|
|
251
257
|
padding: 0 16px 0 16px;
|
|
252
258
|
top: 0;
|
|
253
259
|
transform: none;
|
|
254
260
|
margin-left: 0;
|
|
255
261
|
${TableRowGroup},
|
|
256
|
-
${TableRightGroup}
|
|
262
|
+
${TableRightGroup}{
|
|
257
263
|
display: grid;
|
|
258
264
|
}
|
|
259
265
|
${TableRowGroup} {
|
|
@@ -288,6 +294,12 @@ const getTableHeaderModFunc = ({ $mode }:{ $mode?: string }) => {
|
|
|
288
294
|
}
|
|
289
295
|
`
|
|
290
296
|
}
|
|
297
|
+
if ($isPlayground) {
|
|
298
|
+
style += `
|
|
299
|
+
min-height: 41px;
|
|
300
|
+
align-content: center;
|
|
301
|
+
`
|
|
302
|
+
}
|
|
291
303
|
return style
|
|
292
304
|
}
|
|
293
305
|
const getTabsRowModFunc = ({ $content, $mode }:{ $content?: string, $mode?: string }) => {
|
|
@@ -570,6 +582,36 @@ const getTabsWrapperModFunc =({ $mode }:{ $mode?: string }) => {
|
|
|
570
582
|
padding: 16px 10px 11px 10px;
|
|
571
583
|
}
|
|
572
584
|
`
|
|
585
|
+
} else if ($mode === 'chat-faq') {
|
|
586
|
+
style += `
|
|
587
|
+
${TabsList} {
|
|
588
|
+
border-bottom: 1px solid #DEE0E0;
|
|
589
|
+
justify-content: center;
|
|
590
|
+
}
|
|
591
|
+
${TabsItem} {
|
|
592
|
+
padding-left: 10px;
|
|
593
|
+
padding-right: 10px;
|
|
594
|
+
}
|
|
595
|
+
@media only screen and (min-width: 1024px) {
|
|
596
|
+
${TabsHeader} {
|
|
597
|
+
width: 100%;
|
|
598
|
+
min-width: unset;
|
|
599
|
+
max-width: unset;
|
|
600
|
+
}
|
|
601
|
+
}
|
|
602
|
+
@media only screen and (min-width: 1280px) {
|
|
603
|
+
${TabsList} {
|
|
604
|
+
padding-left: 1em;
|
|
605
|
+
padding-right: 1em;
|
|
606
|
+
padding-top: 6px;
|
|
607
|
+
}
|
|
608
|
+
${TabsItem} {
|
|
609
|
+
font-size: 14px;
|
|
610
|
+
padding-left: 16px;
|
|
611
|
+
padding-right: 16px;
|
|
612
|
+
}
|
|
613
|
+
}
|
|
614
|
+
`
|
|
573
615
|
}
|
|
574
616
|
return style
|
|
575
617
|
}
|
|
@@ -1585,7 +1627,18 @@ const getIconDotModifiedStyled = ({ $mode }:{ $mode?: string }) => {
|
|
|
1585
1627
|
transform: scale(1) translate(50%, -50%);
|
|
1586
1628
|
`
|
|
1587
1629
|
}
|
|
1588
|
-
}
|
|
1630
|
+
} else if ($mode === 'chat') {
|
|
1631
|
+
style += `
|
|
1632
|
+
position: absolute;
|
|
1633
|
+
z-index: 8;
|
|
1634
|
+
left: 18px;
|
|
1635
|
+
top: -3px;
|
|
1636
|
+
padding: 0.2em 0.3em;
|
|
1637
|
+
font-weight: bold;
|
|
1638
|
+
font-size: 10px;
|
|
1639
|
+
min-width: 20px;
|
|
1640
|
+
`
|
|
1641
|
+
}
|
|
1589
1642
|
return style
|
|
1590
1643
|
}
|
|
1591
1644
|
const getCardModFunc = ({ $mode }:{ $mode?: string }) => {
|
|
@@ -2163,8 +2216,8 @@ export const FigureWraper = styled.figure<{ $size?: string, $mode?: string }>`
|
|
|
2163
2216
|
let style = ``;
|
|
2164
2217
|
if ($size) {
|
|
2165
2218
|
style += `
|
|
2166
|
-
width
|
|
2167
|
-
height
|
|
2219
|
+
width: ${$size};
|
|
2220
|
+
height: ${$size};
|
|
2168
2221
|
`
|
|
2169
2222
|
}
|
|
2170
2223
|
return style;
|
|
@@ -2265,13 +2318,15 @@ export const TableHeadLabel = styled.span`
|
|
|
2265
2318
|
width: auto;
|
|
2266
2319
|
}
|
|
2267
2320
|
`
|
|
2268
|
-
export const TableHeadWrapper = styled.div<{ $mode?: string }>`
|
|
2321
|
+
export const TableHeadWrapper = styled.div<{ $mode?: string, $isPlayground?: boolean }>`
|
|
2269
2322
|
display: grid;
|
|
2270
2323
|
border-bottom: 2px solid var(--ter-clr-ln);
|
|
2271
|
-
>span:last-child { justify-self: right; }
|
|
2272
2324
|
padding-top: 22px;
|
|
2273
2325
|
padding-bottom: 22px;
|
|
2274
2326
|
align-items: center;
|
|
2327
|
+
> span:last-child {
|
|
2328
|
+
justify-self: right;
|
|
2329
|
+
}
|
|
2275
2330
|
& ${TableHeadLabel} {
|
|
2276
2331
|
&:empty, &:last-child {
|
|
2277
2332
|
cursor: default;
|
|
@@ -6,6 +6,7 @@ import IconCart from '../../assets/images/icons/cart.svg';
|
|
|
6
6
|
import IconBack from '../../assets/images/icons/back.svg';
|
|
7
7
|
import IconDashboardLeftNav from '../../assets/images/navs/left/dashboard.svg';
|
|
8
8
|
import IconProductLeftNav from '../../assets/images/navs/left/products.svg';
|
|
9
|
+
import IconWarningChat from '../../assets/images/icons/warning-agent.svg';
|
|
9
10
|
|
|
10
11
|
const NotificationStyled = css`
|
|
11
12
|
width: 44px;
|
|
@@ -291,6 +292,13 @@ const getIconContainerStyled = ({ $mode, $name, $width, onClick }:{ $mode?: stri
|
|
|
291
292
|
}
|
|
292
293
|
`
|
|
293
294
|
break;
|
|
295
|
+
case 'warning-chat':
|
|
296
|
+
style += `
|
|
297
|
+
&:before {
|
|
298
|
+
content: url(${IconWarningChat});
|
|
299
|
+
}
|
|
300
|
+
`
|
|
301
|
+
break;
|
|
294
302
|
default:
|
|
295
303
|
break;
|
|
296
304
|
}
|
|
@@ -7,7 +7,7 @@ type TTextArea = TextareaHTMLAttributes<HTMLTextAreaElement> & {
|
|
|
7
7
|
reset?: boolean
|
|
8
8
|
setReset?: TState<boolean>
|
|
9
9
|
isForceUpdate?: boolean
|
|
10
|
-
setForceUpdate?: TState<boolean>
|
|
10
|
+
setForceUpdate?: TState<boolean | undefined>
|
|
11
11
|
evChange?: (e: ChangeEvent<HTMLTextAreaElement>) => void
|
|
12
12
|
evBlur?: (e: FocusEvent<HTMLTextAreaElement>) => void
|
|
13
13
|
isField?: boolean
|