forstok-ui-lib 5.4.4 → 5.4.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/dist/index.d.ts +10 -1
- package/dist/index.js +25 -16
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +25 -16
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/src/components/button/styles.ts +1 -1
- package/src/components/index.ts +1 -0
- package/src/components/list/index.tsx +12 -0
- package/src/components/list/styles.tsx +150 -0
package/package.json
CHANGED
package/src/components/index.ts
CHANGED
|
@@ -25,6 +25,7 @@ export { default as DateTimeComponent } from './datetime';
|
|
|
25
25
|
export { default as RadioComponent } from './radio';
|
|
26
26
|
export { default as SwitchComponent } from './switch';
|
|
27
27
|
export { default as MasterTableComponent } from './masterTable';
|
|
28
|
+
export { default as ListComponent } from './list';
|
|
28
29
|
|
|
29
30
|
export * from './dropdown/typed';
|
|
30
31
|
export * from './message/typed';
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { HTMLAttributes } from 'react';
|
|
2
|
+
import { ListContainer } from './styles';
|
|
3
|
+
|
|
4
|
+
const ListComponent = ({ children, $mode, $selected, $type, onClick, forwardRef, ...props }: HTMLAttributes<HTMLDivElement> & { children: React.ReactNode, $mode: string, $selected: boolean, $type: string, onClick: () => void, forwardRef: React.RefObject<HTMLDivElement> }) => {
|
|
5
|
+
return (
|
|
6
|
+
<ListContainer $mode={$mode} $selected={$selected} $type={$type} onClick={onClick} ref={forwardRef} {...props} >
|
|
7
|
+
{children}
|
|
8
|
+
</ListContainer>
|
|
9
|
+
)
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export default ListComponent
|
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
import styled, { css } from 'styled-components'
|
|
2
|
+
|
|
3
|
+
const ListContainerStyles = css`
|
|
4
|
+
display: grid;
|
|
5
|
+
grid-template-columns: 1fr;
|
|
6
|
+
align-items: center;
|
|
7
|
+
padding: 14px 16px 13px;
|
|
8
|
+
border-bottom: 1px solid var(--pri-clr-ln);
|
|
9
|
+
`
|
|
10
|
+
|
|
11
|
+
const getListContainerModifiedStyles = ({ $mode, $selected, $type }:{ $mode: string, $selected: boolean, $type: string }) => {
|
|
12
|
+
let style = ``;
|
|
13
|
+
if($mode === 'check' || $mode === 'uncheck' ) {
|
|
14
|
+
if($type === 'order' || $type === 'return') {
|
|
15
|
+
style += `
|
|
16
|
+
grid-template-columns: 24px 38px 50% 30%;
|
|
17
|
+
@media (min-width: 375px) {
|
|
18
|
+
grid-template-columns: 24px 38px 50% 32%;
|
|
19
|
+
}
|
|
20
|
+
@media (min-width: 425px) {
|
|
21
|
+
grid-template-columns: 24px 38px 50% 34%;
|
|
22
|
+
}
|
|
23
|
+
@media (min-width: 768px) {
|
|
24
|
+
grid-template-columns: 24px 38px 2.5fr 1.5fr;
|
|
25
|
+
}
|
|
26
|
+
`
|
|
27
|
+
} else if($type === 'confirm'){
|
|
28
|
+
style += `
|
|
29
|
+
grid-template-columns: 24px 38px 3.5fr 25px 1fr;
|
|
30
|
+
|
|
31
|
+
div:nth-child(3) {
|
|
32
|
+
grid-row-start: 1;
|
|
33
|
+
}
|
|
34
|
+
div:nth-child(4) {
|
|
35
|
+
grid-row-start: 1;
|
|
36
|
+
grid-row-end: 3;
|
|
37
|
+
justify-self: center;
|
|
38
|
+
padding-top: 8px;
|
|
39
|
+
padding-left: 4px;
|
|
40
|
+
}
|
|
41
|
+
`
|
|
42
|
+
} else if($type === 'item' || $type === 'price') {
|
|
43
|
+
style += `
|
|
44
|
+
grid-auto-flow: column;
|
|
45
|
+
grid-template-columns: 24px 38px auto 100px 158px 100px;
|
|
46
|
+
._refCheckboxWrapper, figure {
|
|
47
|
+
grid-row: unset !important;
|
|
48
|
+
}
|
|
49
|
+
*:nth-child(3) {
|
|
50
|
+
padding-right: 1em;
|
|
51
|
+
}
|
|
52
|
+
`
|
|
53
|
+
} else {
|
|
54
|
+
style += `
|
|
55
|
+
grid-template-columns: 24px 38px 3fr 1fr;
|
|
56
|
+
`
|
|
57
|
+
}
|
|
58
|
+
style += `
|
|
59
|
+
align-items: center;
|
|
60
|
+
:hover {
|
|
61
|
+
background-color: var(--hg-clr-bg);
|
|
62
|
+
}
|
|
63
|
+
._refCheckboxWrapper {
|
|
64
|
+
grid-row-start: 1;
|
|
65
|
+
grid-row-end: 4;
|
|
66
|
+
}
|
|
67
|
+
figure {
|
|
68
|
+
grid-row-start: 1;
|
|
69
|
+
grid-row-end: 4;
|
|
70
|
+
}
|
|
71
|
+
&.is-selected {
|
|
72
|
+
&, &:hover {
|
|
73
|
+
background-color: var(--hg-clr-bg__fc);
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
`
|
|
77
|
+
}
|
|
78
|
+
else if($mode === 'clear') {
|
|
79
|
+
style += `
|
|
80
|
+
display: block;
|
|
81
|
+
padding: 4px 16px;
|
|
82
|
+
text-overflow: ellipsis;
|
|
83
|
+
white-space: nowrap;
|
|
84
|
+
overflow: hidden;
|
|
85
|
+
font-size: 13px;
|
|
86
|
+
line-height: 21px
|
|
87
|
+
text-transform: uppercase;
|
|
88
|
+
@media (min-width: 425px) {
|
|
89
|
+
font-size: 13px;
|
|
90
|
+
}
|
|
91
|
+
`
|
|
92
|
+
} else if($mode === 'remove') {
|
|
93
|
+
style += `
|
|
94
|
+
grid-template-columns: 40px 3fr 1fr 20px;
|
|
95
|
+
align-items:start;
|
|
96
|
+
padding: 14px 16px 13px;
|
|
97
|
+
@media (min-width: 768px) {
|
|
98
|
+
grid-template-columns: 40px 3fr 1fr 30px;
|
|
99
|
+
padding: 12px 16px;
|
|
100
|
+
}
|
|
101
|
+
figure {
|
|
102
|
+
grid-row-start: 1;
|
|
103
|
+
grid-row-end: 4;
|
|
104
|
+
}
|
|
105
|
+
i {
|
|
106
|
+
display: grid;
|
|
107
|
+
justify-content: end;
|
|
108
|
+
}
|
|
109
|
+
&, &:hover {
|
|
110
|
+
background-color: var(--hg-clr-bg__fc);
|
|
111
|
+
}
|
|
112
|
+
`
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
if($mode === `uncheck`) {
|
|
116
|
+
style += `
|
|
117
|
+
figure {
|
|
118
|
+
grid-column-start: 2;
|
|
119
|
+
}
|
|
120
|
+
div:nth-child(2) {
|
|
121
|
+
grid-column-start: 3;
|
|
122
|
+
}
|
|
123
|
+
div:nth-child(3) {
|
|
124
|
+
grid-column-start: 4;
|
|
125
|
+
}
|
|
126
|
+
div:nth-child(4) {
|
|
127
|
+
grid-column-start: 3;
|
|
128
|
+
}
|
|
129
|
+
div:nth-child(5) {
|
|
130
|
+
grid-column-start: 4;
|
|
131
|
+
}
|
|
132
|
+
`
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
if($mode === 'check' && $selected) {
|
|
136
|
+
style += `
|
|
137
|
+
&, &:hover {
|
|
138
|
+
background-color: var(--hg-clr-bg__fc);
|
|
139
|
+
}
|
|
140
|
+
`
|
|
141
|
+
}
|
|
142
|
+
style += ` cursor: pointer; `
|
|
143
|
+
|
|
144
|
+
return style
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
export const ListContainer = styled.div<{ $mode: string, $selected: boolean, $type: string }>`
|
|
148
|
+
${ListContainerStyles}
|
|
149
|
+
${getListContainerModifiedStyles}
|
|
150
|
+
`
|