@janbox/storefront-builder 1.0.5 → 1.0.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/README.md +47 -44
- package/dist/editor/hooks/use-editor-state.d.ts +13 -1
- package/dist/editor/lib/index.d.ts +4 -1
- package/dist/editor.js +356 -351
- package/dist/{index-DrJkOkbq.js → index-BU9pvpw_.js} +250 -243
- package/dist/index.js +428 -419
- package/package.json +2 -4
- package/dist/editor/lib/events.d.ts +0 -5
- package/lib/accordion/README.md +0 -39
- package/lib/accordion-content/README.md +0 -36
- package/lib/accordion-group/README.md +0 -106
- package/lib/accordion-summary/README.md +0 -37
- package/lib/box/README.md +0 -107
- package/lib/button/README.md +0 -94
- package/lib/cell/README.md +0 -119
- package/lib/countdown-timer/README.md +0 -157
- package/lib/flex-item/README.md +0 -111
- package/lib/flexbox/README.md +0 -120
- package/lib/grid/README.md +0 -133
- package/lib/heading/README.md +0 -53
- package/lib/icon/README.md +0 -98
- package/lib/image/README.md +0 -107
- package/lib/link/README.md +0 -111
- package/lib/list-item/README.md +0 -31
- package/lib/marquee/README.md +0 -111
- package/lib/marquee-item/README.md +0 -31
- package/lib/paragraph/README.md +0 -82
- package/lib/root/README.md +0 -33
- package/lib/swiper/README.md +0 -108
- package/lib/swiper-slide/README.md +0 -32
- package/lib/tab/README.md +0 -35
- package/lib/tab-content/README.md +0 -35
- package/lib/tab-list/README.md +0 -35
- package/lib/tab-panel/README.md +0 -35
- package/lib/tabs/README.md +0 -90
- package/lib/text/README.md +0 -90
- package/lib/unknown/README.md +0 -48
- package/lib/unordered-list/README.md +0 -82
- package/lib/video/README.md +0 -91
|
@@ -1,157 +0,0 @@
|
|
|
1
|
-
# CountdownTimerNode
|
|
2
|
-
|
|
3
|
-
Đồng hồ đếm ngược đến một mốc thời gian. Hiển thị các time units (days, hours, minutes, seconds...) kèm caption.
|
|
4
|
-
|
|
5
|
-
## Resolved name
|
|
6
|
-
|
|
7
|
-
`CountdownTimer`
|
|
8
|
-
|
|
9
|
-
## Configurable props
|
|
10
|
-
|
|
11
|
-
### Top-level props
|
|
12
|
-
|
|
13
|
-
| Prop | Type | Description |
|
|
14
|
-
| --- | --- | --- |
|
|
15
|
-
| `date` | `Date` | Thời điểm đích để đếm ngược đến |
|
|
16
|
-
| `units` | `{ value: TimeUnit; caption?: string }[]` | Danh sách time units hiển thị, theo thứ tự |
|
|
17
|
-
| `hideAfterExpired` | `boolean` | Ẩn toàn bộ component sau khi hết giờ |
|
|
18
|
-
|
|
19
|
-
**`TimeUnit`:** `'months' | 'weeks' | 'days' | 'hours' | 'minutes' | 'seconds'`
|
|
20
|
-
|
|
21
|
-
### `unitItemProps.sx` — Styling cho mỗi unit box
|
|
22
|
-
|
|
23
|
-
```ts
|
|
24
|
-
unitItemProps?: {
|
|
25
|
-
sx?: {
|
|
26
|
-
width?: number | string
|
|
27
|
-
rowGap?: number // khoảng cách giữa số và caption
|
|
28
|
-
paddingTop?: number
|
|
29
|
-
paddingRight?: number
|
|
30
|
-
paddingBottom?: number
|
|
31
|
-
paddingLeft?: number
|
|
32
|
-
backgroundColor?: string
|
|
33
|
-
borderTopLeftRadius?: number | string
|
|
34
|
-
borderTopRightRadius?: number | string
|
|
35
|
-
borderBottomLeftRadius?: number | string
|
|
36
|
-
borderBottomRightRadius?: number | string
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
```
|
|
40
|
-
|
|
41
|
-
### `timeProps` — Styling cho số đếm
|
|
42
|
-
|
|
43
|
-
```ts
|
|
44
|
-
timeProps?: {
|
|
45
|
-
sizeVariant?: TypographySizeVariant // responsive
|
|
46
|
-
sx?: {
|
|
47
|
-
color?: string
|
|
48
|
-
fontWeight?: number | string
|
|
49
|
-
fontStyle?: 'normal' | 'italic'
|
|
50
|
-
textDecorationLine?: 'none' | 'underline' | 'line-through'
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
```
|
|
54
|
-
|
|
55
|
-
### `captionProps` — Styling cho caption (label dưới số)
|
|
56
|
-
|
|
57
|
-
```ts
|
|
58
|
-
captionProps?: {
|
|
59
|
-
sizeVariant?: TypographySizeVariant // responsive
|
|
60
|
-
sx?: {
|
|
61
|
-
color?: string
|
|
62
|
-
fontWeight?: number | string
|
|
63
|
-
fontStyle?: 'normal' | 'italic'
|
|
64
|
-
textDecorationLine?: 'none' | 'underline' | 'line-through'
|
|
65
|
-
textTransform?: 'none' | 'uppercase' | 'lowercase' | 'capitalize'
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
```
|
|
69
|
-
|
|
70
|
-
### `sx` props (outer container)
|
|
71
|
-
|
|
72
|
-
```ts
|
|
73
|
-
sx?: {
|
|
74
|
-
width?: number | string
|
|
75
|
-
flexWrap?: 'nowrap' | 'wrap' | 'wrap-reverse'
|
|
76
|
-
|
|
77
|
-
// spacing
|
|
78
|
-
paddingTop?: number
|
|
79
|
-
paddingRight?: number
|
|
80
|
-
paddingBottom?: number
|
|
81
|
-
paddingLeft?: number
|
|
82
|
-
marginTop?: number
|
|
83
|
-
marginRight?: number
|
|
84
|
-
marginBottom?: number
|
|
85
|
-
marginLeft?: number
|
|
86
|
-
|
|
87
|
-
// border
|
|
88
|
-
borderStyle?: string
|
|
89
|
-
borderColor?: string
|
|
90
|
-
borderTopWidth?: number
|
|
91
|
-
borderRightWidth?: number
|
|
92
|
-
borderBottomWidth?: number
|
|
93
|
-
borderLeftWidth?: number
|
|
94
|
-
borderTopLeftRadius?: number | string
|
|
95
|
-
borderTopRightRadius?: number | string
|
|
96
|
-
borderBottomRightRadius?: number | string
|
|
97
|
-
borderBottomLeftRadius?: number | string
|
|
98
|
-
|
|
99
|
-
// background
|
|
100
|
-
backgroundColor?: string
|
|
101
|
-
backgroundImage?: string
|
|
102
|
-
backgroundPosition?: string
|
|
103
|
-
backgroundRepeat?: string
|
|
104
|
-
backgroundSize?: string
|
|
105
|
-
backgroundAttachment?: string
|
|
106
|
-
background?: string
|
|
107
|
-
|
|
108
|
-
// responsive overrides
|
|
109
|
-
sm?: { /* same keys above */ }
|
|
110
|
-
md?: { /* same keys above */ }
|
|
111
|
-
lg?: { /* same keys above */ }
|
|
112
|
-
}
|
|
113
|
-
```
|
|
114
|
-
|
|
115
|
-
## Usage
|
|
116
|
-
|
|
117
|
-
```tsx
|
|
118
|
-
import { CountdownTimerNode } from '@janbox/storefront-builder';
|
|
119
|
-
|
|
120
|
-
// Đếm ngược đến ngày sale
|
|
121
|
-
<CountdownTimerNode
|
|
122
|
-
date={new Date('2026-12-31T23:59:59')}
|
|
123
|
-
units={[
|
|
124
|
-
{ value: 'days', caption: 'Days' },
|
|
125
|
-
{ value: 'hours', caption: 'Hours' },
|
|
126
|
-
{ value: 'minutes', caption: 'Mins' },
|
|
127
|
-
{ value: 'seconds', caption: 'Secs' },
|
|
128
|
-
]}
|
|
129
|
-
hideAfterExpired={false}
|
|
130
|
-
sx={{ columnGap: 8 }}
|
|
131
|
-
unitItemProps={{
|
|
132
|
-
sx: {
|
|
133
|
-
width: 64,
|
|
134
|
-
paddingTop: 8,
|
|
135
|
-
paddingBottom: 8,
|
|
136
|
-
backgroundColor: '#fa8c16',
|
|
137
|
-
borderTopLeftRadius: 8,
|
|
138
|
-
borderTopRightRadius: 8,
|
|
139
|
-
borderBottomLeftRadius: 8,
|
|
140
|
-
borderBottomRightRadius: 8,
|
|
141
|
-
},
|
|
142
|
-
}}
|
|
143
|
-
timeProps={{
|
|
144
|
-
sizeVariant: '2xl',
|
|
145
|
-
sx: { color: '#ffffff', fontWeight: 700 },
|
|
146
|
-
}}
|
|
147
|
-
captionProps={{
|
|
148
|
-
sizeVariant: 'xs',
|
|
149
|
-
sx: { color: '#ffffff', textTransform: 'uppercase' },
|
|
150
|
-
}}
|
|
151
|
-
/>
|
|
152
|
-
```
|
|
153
|
-
|
|
154
|
-
## Rules
|
|
155
|
-
|
|
156
|
-
- **Canvas**: no — không chứa node con.
|
|
157
|
-
- Khi editor đang bật, component hiển thị placeholder nếu `units` rỗng hoặc đã hết giờ với `hideAfterExpired: true`.
|
package/lib/flex-item/README.md
DELETED
|
@@ -1,111 +0,0 @@
|
|
|
1
|
-
# FlexItemNode
|
|
2
|
-
|
|
3
|
-
Một item trong `FlexboxNode`. Kiểm soát kích thước, grow/shrink, thứ tự của từng item trong flex container.
|
|
4
|
-
|
|
5
|
-
## Resolved name
|
|
6
|
-
|
|
7
|
-
`FlexItem`
|
|
8
|
-
|
|
9
|
-
## Configurable props
|
|
10
|
-
|
|
11
|
-
Tất cả props nằm trong `sx`. Không có top-level prop riêng.
|
|
12
|
-
|
|
13
|
-
### `sx` props
|
|
14
|
-
|
|
15
|
-
```ts
|
|
16
|
-
sx?: {
|
|
17
|
-
// flex item behavior
|
|
18
|
-
flexGrow?: number // auto grow: 1 = bật, undefined = tắt
|
|
19
|
-
flexShrink?: number // auto shrink: 0 = tắt, undefined = bật
|
|
20
|
-
|
|
21
|
-
// size
|
|
22
|
-
width?: number | string
|
|
23
|
-
height?: number | string
|
|
24
|
-
|
|
25
|
-
// order (thứ tự hiển thị)
|
|
26
|
-
order?: number | string
|
|
27
|
-
|
|
28
|
-
// spacing
|
|
29
|
-
paddingTop?: number
|
|
30
|
-
paddingRight?: number
|
|
31
|
-
paddingBottom?: number
|
|
32
|
-
paddingLeft?: number
|
|
33
|
-
marginTop?: number
|
|
34
|
-
marginRight?: number
|
|
35
|
-
marginBottom?: number
|
|
36
|
-
marginLeft?: number
|
|
37
|
-
|
|
38
|
-
// border
|
|
39
|
-
borderStyle?: string
|
|
40
|
-
borderColor?: string
|
|
41
|
-
borderTopWidth?: number
|
|
42
|
-
borderRightWidth?: number
|
|
43
|
-
borderBottomWidth?: number
|
|
44
|
-
borderLeftWidth?: number
|
|
45
|
-
borderTopLeftRadius?: number | string
|
|
46
|
-
borderTopRightRadius?: number | string
|
|
47
|
-
borderBottomRightRadius?: number | string
|
|
48
|
-
borderBottomLeftRadius?: number | string
|
|
49
|
-
|
|
50
|
-
// background
|
|
51
|
-
backgroundColor?: string
|
|
52
|
-
backgroundImage?: string
|
|
53
|
-
backgroundPosition?: string
|
|
54
|
-
backgroundRepeat?: string
|
|
55
|
-
backgroundSize?: string
|
|
56
|
-
backgroundAttachment?: string
|
|
57
|
-
background?: string
|
|
58
|
-
|
|
59
|
-
// responsive overrides
|
|
60
|
-
sm?: { /* same keys above */ }
|
|
61
|
-
md?: { /* same keys above */ }
|
|
62
|
-
lg?: { /* same keys above */ }
|
|
63
|
-
}
|
|
64
|
-
```
|
|
65
|
-
|
|
66
|
-
## Usage
|
|
67
|
-
|
|
68
|
-
```tsx
|
|
69
|
-
import { FlexboxNode, FlexItemNode } from '@janbox/storefront-builder';
|
|
70
|
-
|
|
71
|
-
// Item cố định width, item còn lại grow để fill
|
|
72
|
-
<FlexboxNode sx={{ flexDirection: 'row', columnGap: 16 }}>
|
|
73
|
-
<FlexItemNode sx={{ width: 200 }}>Sidebar</FlexItemNode>
|
|
74
|
-
<FlexItemNode sx={{ flexGrow: 1 }}>Main content</FlexItemNode>
|
|
75
|
-
</FlexboxNode>
|
|
76
|
-
|
|
77
|
-
// Item không shrink khi container hẹp
|
|
78
|
-
<FlexboxNode sx={{ flexDirection: 'row' }}>
|
|
79
|
-
<FlexItemNode sx={{ flexShrink: 0, width: 120 }}>Fixed</FlexItemNode>
|
|
80
|
-
<FlexItemNode sx={{ flexGrow: 1 }}>Flexible</FlexItemNode>
|
|
81
|
-
</FlexboxNode>
|
|
82
|
-
|
|
83
|
-
// Responsive: full width mobile, 50% desktop
|
|
84
|
-
<FlexboxNode sx={{ flexDirection: 'column', md: { flexDirection: 'row' } }}>
|
|
85
|
-
<FlexItemNode
|
|
86
|
-
sx={{
|
|
87
|
-
width: '100%',
|
|
88
|
-
md: { width: '50%' },
|
|
89
|
-
}}
|
|
90
|
-
>
|
|
91
|
-
Left
|
|
92
|
-
</FlexItemNode>
|
|
93
|
-
<FlexItemNode
|
|
94
|
-
sx={{
|
|
95
|
-
width: '100%',
|
|
96
|
-
md: { width: '50%' },
|
|
97
|
-
}}
|
|
98
|
-
>
|
|
99
|
-
Right
|
|
100
|
-
</FlexItemNode>
|
|
101
|
-
</FlexboxNode>
|
|
102
|
-
```
|
|
103
|
-
|
|
104
|
-
## Rules
|
|
105
|
-
|
|
106
|
-
- **Canvas**: yes — chứa bất kỳ node con nào.
|
|
107
|
-
- **Parent**: phải là `FlexboxNode`.
|
|
108
|
-
|
|
109
|
-
## Related nodes
|
|
110
|
-
|
|
111
|
-
- [`FlexboxNode`](../flexbox/README.md) — parent bắt buộc của `FlexItemNode`
|
package/lib/flexbox/README.md
DELETED
|
@@ -1,120 +0,0 @@
|
|
|
1
|
-
# FlexboxNode
|
|
2
|
-
|
|
3
|
-
Flex container node (`display: flex`). Chỉ chấp nhận `FlexItemNode` làm con trực tiếp.
|
|
4
|
-
|
|
5
|
-
## Resolved name
|
|
6
|
-
|
|
7
|
-
`Flexbox`
|
|
8
|
-
|
|
9
|
-
## Configurable props
|
|
10
|
-
|
|
11
|
-
### Top-level props
|
|
12
|
-
|
|
13
|
-
| Prop | Type | Description |
|
|
14
|
-
| --- | --- | --- |
|
|
15
|
-
| `container` | `boolean` | Bật max-width container constraint |
|
|
16
|
-
|
|
17
|
-
### `sx` props
|
|
18
|
-
|
|
19
|
-
```ts
|
|
20
|
-
sx?: {
|
|
21
|
-
// flex layout
|
|
22
|
-
flexDirection?: 'row' | 'column'
|
|
23
|
-
flexWrap?: 'nowrap' | 'wrap' | 'wrap-reverse'
|
|
24
|
-
justifyContent?: 'flex-start' | 'flex-end' | 'center' | 'space-between' | 'space-around' | 'space-evenly'
|
|
25
|
-
alignItems?: 'flex-start' | 'flex-end' | 'center' | 'stretch' | 'baseline'
|
|
26
|
-
rowGap?: number
|
|
27
|
-
columnGap?: number
|
|
28
|
-
|
|
29
|
-
// size
|
|
30
|
-
width?: number | string
|
|
31
|
-
height?: number | string
|
|
32
|
-
|
|
33
|
-
// spacing
|
|
34
|
-
paddingTop?: number
|
|
35
|
-
paddingRight?: number
|
|
36
|
-
paddingBottom?: number
|
|
37
|
-
paddingLeft?: number
|
|
38
|
-
marginTop?: number
|
|
39
|
-
marginRight?: number
|
|
40
|
-
marginBottom?: number
|
|
41
|
-
marginLeft?: number
|
|
42
|
-
|
|
43
|
-
// border
|
|
44
|
-
borderStyle?: string
|
|
45
|
-
borderColor?: string
|
|
46
|
-
borderTopWidth?: number
|
|
47
|
-
borderRightWidth?: number
|
|
48
|
-
borderBottomWidth?: number
|
|
49
|
-
borderLeftWidth?: number
|
|
50
|
-
borderTopLeftRadius?: number | string
|
|
51
|
-
borderTopRightRadius?: number | string
|
|
52
|
-
borderBottomRightRadius?: number | string
|
|
53
|
-
borderBottomLeftRadius?: number | string
|
|
54
|
-
|
|
55
|
-
// background
|
|
56
|
-
backgroundColor?: string
|
|
57
|
-
backgroundImage?: string
|
|
58
|
-
backgroundPosition?: string
|
|
59
|
-
backgroundRepeat?: string
|
|
60
|
-
backgroundSize?: string
|
|
61
|
-
backgroundAttachment?: string
|
|
62
|
-
background?: string
|
|
63
|
-
|
|
64
|
-
// responsive overrides
|
|
65
|
-
sm?: { /* same keys above */ }
|
|
66
|
-
md?: { /* same keys above */ }
|
|
67
|
-
lg?: { /* same keys above */ }
|
|
68
|
-
}
|
|
69
|
-
```
|
|
70
|
-
|
|
71
|
-
## Usage
|
|
72
|
-
|
|
73
|
-
```tsx
|
|
74
|
-
import { FlexboxNode, FlexItemNode } from '@janbox/storefront-builder';
|
|
75
|
-
|
|
76
|
-
// Row ngang, căn giữa dọc
|
|
77
|
-
<FlexboxNode sx={{ flexDirection: 'row', alignItems: 'center', columnGap: 16 }}>
|
|
78
|
-
<FlexItemNode>Item A</FlexItemNode>
|
|
79
|
-
<FlexItemNode>Item B</FlexItemNode>
|
|
80
|
-
</FlexboxNode>
|
|
81
|
-
|
|
82
|
-
// Đổi direction theo breakpoint: column trên mobile, row trên desktop
|
|
83
|
-
<FlexboxNode
|
|
84
|
-
sx={{
|
|
85
|
-
flexDirection: 'column',
|
|
86
|
-
rowGap: 12,
|
|
87
|
-
md: {
|
|
88
|
-
flexDirection: 'row',
|
|
89
|
-
columnGap: 24,
|
|
90
|
-
alignItems: 'center',
|
|
91
|
-
},
|
|
92
|
-
}}
|
|
93
|
-
>
|
|
94
|
-
<FlexItemNode>Item A</FlexItemNode>
|
|
95
|
-
<FlexItemNode>Item B</FlexItemNode>
|
|
96
|
-
</FlexboxNode>
|
|
97
|
-
|
|
98
|
-
// Space-between, wrap
|
|
99
|
-
<FlexboxNode
|
|
100
|
-
sx={{
|
|
101
|
-
flexDirection: 'row',
|
|
102
|
-
flexWrap: 'wrap',
|
|
103
|
-
justifyContent: 'space-between',
|
|
104
|
-
rowGap: 16,
|
|
105
|
-
}}
|
|
106
|
-
>
|
|
107
|
-
<FlexItemNode>Item A</FlexItemNode>
|
|
108
|
-
<FlexItemNode>Item B</FlexItemNode>
|
|
109
|
-
<FlexItemNode>Item C</FlexItemNode>
|
|
110
|
-
</FlexboxNode>
|
|
111
|
-
```
|
|
112
|
-
|
|
113
|
-
## Rules
|
|
114
|
-
|
|
115
|
-
- **Canvas**: yes.
|
|
116
|
-
- **canMoveIn**: chỉ chấp nhận `FlexItemNode`.
|
|
117
|
-
|
|
118
|
-
## Related nodes
|
|
119
|
-
|
|
120
|
-
- [`FlexItemNode`](../flex-item/README.md) — con trực tiếp duy nhất của `FlexboxNode`
|
package/lib/grid/README.md
DELETED
|
@@ -1,133 +0,0 @@
|
|
|
1
|
-
# GridNode
|
|
2
|
-
|
|
3
|
-
A CSS Grid container node. Accepts only `CellNode` children — the editor enforces this via `canMoveIn`.
|
|
4
|
-
|
|
5
|
-
## Resolved name
|
|
6
|
-
|
|
7
|
-
`Grid`
|
|
8
|
-
|
|
9
|
-
## Configurable props
|
|
10
|
-
|
|
11
|
-
Props mà user có thể chỉnh trong editor inspector. Tất cả đều hỗ trợ responsive trừ `container`.
|
|
12
|
-
|
|
13
|
-
### Top-level props
|
|
14
|
-
|
|
15
|
-
| Prop | Type | Description |
|
|
16
|
-
| --- | --- | --- |
|
|
17
|
-
| `cols` | `number` | Số cột — generates `grid-template-columns: repeat(cols, minmax(0, 1fr))` |
|
|
18
|
-
| `container` | `boolean` | Bật max-width container constraint |
|
|
19
|
-
|
|
20
|
-
### `sx` props
|
|
21
|
-
|
|
22
|
-
`sx` nhận `StyledCSS` với responsive keys `sm`, `md`, `lg` bên trong:
|
|
23
|
-
|
|
24
|
-
```ts
|
|
25
|
-
sx?: {
|
|
26
|
-
// layout
|
|
27
|
-
columnGap?: number
|
|
28
|
-
rowGap?: number
|
|
29
|
-
alignItems?: 'start' | 'center' | 'end' | 'stretch'
|
|
30
|
-
justifyItems?: 'start' | 'center' | 'end' | 'stretch'
|
|
31
|
-
width?: number | string
|
|
32
|
-
height?: number | string
|
|
33
|
-
|
|
34
|
-
// spacing
|
|
35
|
-
paddingTop?: number
|
|
36
|
-
paddingRight?: number
|
|
37
|
-
paddingBottom?: number
|
|
38
|
-
paddingLeft?: number
|
|
39
|
-
marginTop?: number
|
|
40
|
-
marginRight?: number
|
|
41
|
-
marginBottom?: number
|
|
42
|
-
marginLeft?: number
|
|
43
|
-
|
|
44
|
-
// border
|
|
45
|
-
borderStyle?: string
|
|
46
|
-
borderColor?: string
|
|
47
|
-
borderTopWidth?: number
|
|
48
|
-
borderRightWidth?: number
|
|
49
|
-
borderBottomWidth?: number
|
|
50
|
-
borderLeftWidth?: number
|
|
51
|
-
borderTopLeftRadius?: number | string
|
|
52
|
-
borderTopRightRadius?: number | string
|
|
53
|
-
borderBottomRightRadius?: number | string
|
|
54
|
-
borderBottomLeftRadius?: number | string
|
|
55
|
-
|
|
56
|
-
// background
|
|
57
|
-
backgroundColor?: string
|
|
58
|
-
backgroundImage?: string
|
|
59
|
-
backgroundPosition?: string
|
|
60
|
-
backgroundRepeat?: string
|
|
61
|
-
backgroundSize?: string
|
|
62
|
-
backgroundAttachment?: string
|
|
63
|
-
background?: string
|
|
64
|
-
|
|
65
|
-
// responsive overrides
|
|
66
|
-
sm?: { /* same keys above */ }
|
|
67
|
-
md?: { /* same keys above */ }
|
|
68
|
-
lg?: { /* same keys above */ }
|
|
69
|
-
}
|
|
70
|
-
```
|
|
71
|
-
|
|
72
|
-
## Usage
|
|
73
|
-
|
|
74
|
-
```tsx
|
|
75
|
-
import { GridNode, CellNode } from '@janbox/storefront-builder';
|
|
76
|
-
|
|
77
|
-
// 2 cột cố định
|
|
78
|
-
<GridNode cols={2}>
|
|
79
|
-
<CellNode>...</CellNode>
|
|
80
|
-
<CellNode>...</CellNode>
|
|
81
|
-
</GridNode>
|
|
82
|
-
|
|
83
|
-
// Responsive: 1 cột mobile, 3 cột desktop
|
|
84
|
-
<GridNode cols={1} md={{ cols: 3 }}>
|
|
85
|
-
<CellNode>...</CellNode>
|
|
86
|
-
<CellNode>...</CellNode>
|
|
87
|
-
<CellNode>...</CellNode>
|
|
88
|
-
</GridNode>
|
|
89
|
-
|
|
90
|
-
// sx responsive: gap nhỏ trên mobile, lớn hơn trên desktop
|
|
91
|
-
<GridNode
|
|
92
|
-
cols={1}
|
|
93
|
-
md={{ cols: 2 }}
|
|
94
|
-
sx={{
|
|
95
|
-
columnGap: 8,
|
|
96
|
-
rowGap: 8,
|
|
97
|
-
paddingTop: 16,
|
|
98
|
-
paddingBottom: 16,
|
|
99
|
-
md: {
|
|
100
|
-
columnGap: 24,
|
|
101
|
-
rowGap: 24,
|
|
102
|
-
paddingTop: 32,
|
|
103
|
-
paddingBottom: 32,
|
|
104
|
-
},
|
|
105
|
-
}}
|
|
106
|
-
>
|
|
107
|
-
<CellNode>...</CellNode>
|
|
108
|
-
<CellNode>...</CellNode>
|
|
109
|
-
</GridNode>
|
|
110
|
-
|
|
111
|
-
// Container với background
|
|
112
|
-
<GridNode
|
|
113
|
-
container
|
|
114
|
-
cols={2}
|
|
115
|
-
sx={{
|
|
116
|
-
backgroundColor: '#f5f5f5',
|
|
117
|
-
paddingTop: 32,
|
|
118
|
-
paddingBottom: 32,
|
|
119
|
-
}}
|
|
120
|
-
>
|
|
121
|
-
<CellNode>...</CellNode>
|
|
122
|
-
<CellNode>...</CellNode>
|
|
123
|
-
</GridNode>
|
|
124
|
-
```
|
|
125
|
-
|
|
126
|
-
## Rules
|
|
127
|
-
|
|
128
|
-
- **Canvas**: yes — accepts dropped children.
|
|
129
|
-
- **canMoveIn**: only `CellNode` children are allowed.
|
|
130
|
-
|
|
131
|
-
## Related nodes
|
|
132
|
-
|
|
133
|
-
- [`CellNode`](../cell/README.md) — the only valid direct child of `GridNode`
|
package/lib/heading/README.md
DELETED
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
# HeadingNode
|
|
2
|
-
|
|
3
|
-
Text node dành cho tiêu đề. Dùng chung `TextInspector` với `TextNode` nhưng giới hạn tag trong `h1`–`h6` và `div`.
|
|
4
|
-
|
|
5
|
-
## Resolved name
|
|
6
|
-
|
|
7
|
-
`Heading`
|
|
8
|
-
|
|
9
|
-
## Configurable props
|
|
10
|
-
|
|
11
|
-
Giống hệt `TextNode`. Xem chi tiết tại [TextNode](../text/README.md#configurable-props).
|
|
12
|
-
|
|
13
|
-
### Điểm khác biệt
|
|
14
|
-
|
|
15
|
-
| Prop | Giá trị cho phép | Default |
|
|
16
|
-
| --- | --- | --- |
|
|
17
|
-
| `as` | `'h1' \| 'h2' \| 'h3' \| 'h4' \| 'h5' \| 'h6' \| 'div'` | `'p'` (từ Text) |
|
|
18
|
-
|
|
19
|
-
## Usage
|
|
20
|
-
|
|
21
|
-
```tsx
|
|
22
|
-
import { HeadingNode } from '@janbox/storefront-builder';
|
|
23
|
-
|
|
24
|
-
// H1 mặc định
|
|
25
|
-
<HeadingNode as="h1" sizeVariant="4xl">
|
|
26
|
-
Page Title
|
|
27
|
-
</HeadingNode>
|
|
28
|
-
|
|
29
|
-
// Responsive size
|
|
30
|
-
<HeadingNode
|
|
31
|
-
as="h2"
|
|
32
|
-
sizeVariant="2xl"
|
|
33
|
-
md={{ sizeVariant: '4xl' }}
|
|
34
|
-
sx={{ color: '#111111', textAlign: 'center' }}
|
|
35
|
-
>
|
|
36
|
-
Section Title
|
|
37
|
-
</HeadingNode>
|
|
38
|
-
|
|
39
|
-
// Dùng div khi không cần semantic heading nhưng muốn style heading
|
|
40
|
-
<HeadingNode as="div" sizeVariant="xl" sx={{ fontWeight: 700 }}>
|
|
41
|
-
Display text
|
|
42
|
-
</HeadingNode>
|
|
43
|
-
```
|
|
44
|
-
|
|
45
|
-
## Rules
|
|
46
|
-
|
|
47
|
-
- **Canvas**: no — không chứa node con.
|
|
48
|
-
- **Inline editing**: có thể double-click để chỉnh nội dung trong canvas.
|
|
49
|
-
|
|
50
|
-
## Related nodes
|
|
51
|
-
|
|
52
|
-
- [`TextNode`](../text/README.md) — base component dùng chung inspector
|
|
53
|
-
- [`ParagraphNode`](../paragraph/README.md) — dành cho nội dung dạng đoạn văn
|
package/lib/icon/README.md
DELETED
|
@@ -1,98 +0,0 @@
|
|
|
1
|
-
# IconNode
|
|
2
|
-
|
|
3
|
-
SVG icon node. Render inline SVG từ raw string hoặc URL.
|
|
4
|
-
|
|
5
|
-
## Resolved name
|
|
6
|
-
|
|
7
|
-
`Icon`
|
|
8
|
-
|
|
9
|
-
## Configurable props
|
|
10
|
-
|
|
11
|
-
### Top-level props
|
|
12
|
-
|
|
13
|
-
| Prop | Type | Description |
|
|
14
|
-
| --- | --- | --- |
|
|
15
|
-
| `source` | `string` | Raw SVG string hoặc URL tới file SVG |
|
|
16
|
-
| `size` | `number` | Kích thước icon (px) — set cả `width` và `height` |
|
|
17
|
-
|
|
18
|
-
`size` hỗ trợ responsive: `size={24}` xs, `md={{ size: 32 }}` desktop.
|
|
19
|
-
|
|
20
|
-
### `sx` props
|
|
21
|
-
|
|
22
|
-
```ts
|
|
23
|
-
sx?: {
|
|
24
|
-
// color (áp dụng toàn breakpoint — không responsive)
|
|
25
|
-
color?: string
|
|
26
|
-
|
|
27
|
-
// spacing
|
|
28
|
-
paddingTop?: number
|
|
29
|
-
paddingRight?: number
|
|
30
|
-
paddingBottom?: number
|
|
31
|
-
paddingLeft?: number
|
|
32
|
-
marginTop?: number
|
|
33
|
-
marginRight?: number
|
|
34
|
-
marginBottom?: number
|
|
35
|
-
marginLeft?: number
|
|
36
|
-
|
|
37
|
-
// border
|
|
38
|
-
borderStyle?: string
|
|
39
|
-
borderColor?: string
|
|
40
|
-
borderTopWidth?: number
|
|
41
|
-
borderRightWidth?: number
|
|
42
|
-
borderBottomWidth?: number
|
|
43
|
-
borderLeftWidth?: number
|
|
44
|
-
borderTopLeftRadius?: number | string
|
|
45
|
-
borderTopRightRadius?: number | string
|
|
46
|
-
borderBottomRightRadius?: number | string
|
|
47
|
-
borderBottomLeftRadius?: number | string
|
|
48
|
-
|
|
49
|
-
// responsive overrides
|
|
50
|
-
sm?: { /* same keys above */ }
|
|
51
|
-
md?: { /* same keys above */ }
|
|
52
|
-
lg?: { /* same keys above */ }
|
|
53
|
-
}
|
|
54
|
-
```
|
|
55
|
-
|
|
56
|
-
## Usage
|
|
57
|
-
|
|
58
|
-
```tsx
|
|
59
|
-
import { IconNode } from '@janbox/storefront-builder';
|
|
60
|
-
|
|
61
|
-
// Icon từ raw SVG
|
|
62
|
-
<IconNode
|
|
63
|
-
source='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="..."/></svg>'
|
|
64
|
-
size={24}
|
|
65
|
-
sx={{ color: '#333333' }}
|
|
66
|
-
/>
|
|
67
|
-
|
|
68
|
-
// Responsive size
|
|
69
|
-
<IconNode
|
|
70
|
-
source="https://example.com/icon.svg"
|
|
71
|
-
size={20}
|
|
72
|
-
md={{ size: 28 }}
|
|
73
|
-
sx={{ color: '#fa8c16' }}
|
|
74
|
-
/>
|
|
75
|
-
|
|
76
|
-
// Icon với background tròn
|
|
77
|
-
<IconNode
|
|
78
|
-
source='<svg>...</svg>'
|
|
79
|
-
size={16}
|
|
80
|
-
sx={{
|
|
81
|
-
color: '#ffffff',
|
|
82
|
-
paddingTop: 8,
|
|
83
|
-
paddingBottom: 8,
|
|
84
|
-
paddingLeft: 8,
|
|
85
|
-
paddingRight: 8,
|
|
86
|
-
backgroundColor: '#fa8c16',
|
|
87
|
-
borderTopLeftRadius: '50%',
|
|
88
|
-
borderTopRightRadius: '50%',
|
|
89
|
-
borderBottomLeftRadius: '50%',
|
|
90
|
-
borderBottomRightRadius: '50%',
|
|
91
|
-
}}
|
|
92
|
-
/>
|
|
93
|
-
```
|
|
94
|
-
|
|
95
|
-
## Rules
|
|
96
|
-
|
|
97
|
-
- **Canvas**: no — không chứa node con.
|
|
98
|
-
- `source` bắt buộc phải có — nếu không có, icon sẽ không hiển thị.
|