@janbox/storefront-builder 2.0.24 → 2.0.26
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/components/composer/composer.d.ts +4 -0
- package/dist/components/composer/dataset.d.ts +2 -0
- package/dist/components/composer/index.d.ts +1 -4
- package/dist/{index-BBoR6Gy_.js → composer-DBRKIqu7.js} +1 -1
- package/dist/constants/index.d.ts +2 -0
- package/dist/editor/components/image-gallery-dialog.d.ts +9 -0
- package/dist/editor/components/image-source-selection.d.ts +3 -2
- package/dist/editor/components/index.d.ts +1 -0
- package/dist/editor/hooks/use-editor.d.ts +3 -0
- package/dist/editor/lib/index.d.ts +4 -1
- package/dist/editor/related/button/index.d.ts +1 -0
- package/dist/editor/related/count-up/count-up.inspector/count-up.inspector.d.ts +1 -0
- package/dist/editor/related/count-up/count-up.inspector/index.d.ts +1 -0
- package/dist/editor/related/image/index.d.ts +1 -0
- package/dist/editor/related/rating/rating.inspector/index.d.ts +1 -0
- package/dist/editor/related/rating/rating.inspector/rating.inspector.d.ts +1 -0
- package/dist/editor/types/index.d.ts +11 -0
- package/dist/editor/ui/cascader/cascader.d.ts +41 -0
- package/dist/editor/ui/cascader/index.d.ts +1 -0
- package/dist/editor/ui/date-picker/date-picker.d.ts +7 -18
- package/dist/editor/ui/index.d.ts +1 -0
- package/dist/editor.js +1112 -968
- package/dist/hooks/use-toggle.d.ts +2 -0
- package/dist/index-CpLNXUi2.js +4 -0
- package/dist/index.js +66 -60
- package/dist/lib/count-up/README.md +129 -0
- package/dist/lib/count-up/count-up.node/count-up.node.d.ts +2 -0
- package/dist/lib/count-up/count-up.node/helpers.d.ts +3 -0
- package/dist/lib/count-up/count-up.node/index.d.ts +3 -0
- package/dist/lib/count-up/count-up.node/types.d.ts +2 -0
- package/dist/lib/count-up/index.d.ts +1 -0
- package/dist/lib/icon/README.md +9 -18
- package/dist/lib/index.d.ts +2 -0
- package/dist/lib/inline/index.d.ts +0 -1
- package/dist/lib/rating/README.md +126 -0
- package/dist/lib/rating/index.d.ts +2 -0
- package/dist/lib/rating/rating/helpers.d.ts +4 -0
- package/dist/lib/rating/rating/index.d.ts +3 -0
- package/dist/lib/rating/rating/rating.d.ts +2 -0
- package/dist/lib/rating/rating/types.d.ts +10 -0
- package/dist/lib/rating/rating.node/helpers.d.ts +3 -0
- package/dist/lib/rating/rating.node/index.d.ts +3 -0
- package/dist/lib/rating/rating.node/rating.node.d.ts +2 -0
- package/dist/lib/rating/rating.node/types.d.ts +2 -0
- package/dist/style.css +1 -1
- package/dist/templates/sections/brand-story/about-story.d.ts +2 -0
- package/dist/templates/sections/hero/notebook-hero.d.ts +2 -0
- package/dist/templates/sections/index.d.ts +1 -0
- package/dist/templates/sections/testimonial/before-after.d.ts +2 -0
- package/dist/templates/sections/testimonial/index.d.ts +2 -0
- package/dist/templates.js +816 -204
- package/dist/{toaster-DMjFxzB_.js → toaster-Bx7Helq-.js} +10146 -9626
- package/dist/utils/internal.d.ts +0 -0
- package/package.json +4 -7
- package/dist/index-BPG8gpQT.js +0 -4
- /package/dist/{lib → editor/related}/accordion-group/accordion-group.inspector/accordion-group.inspector.d.ts +0 -0
- /package/dist/{lib → editor/related}/accordion-group/accordion-group.inspector/accordion-items-field.d.ts +0 -0
- /package/dist/{lib → editor/related}/accordion-group/accordion-group.inspector/expand-icon-field.d.ts +0 -0
- /package/dist/{lib → editor/related}/accordion-group/accordion-group.inspector/index.d.ts +0 -0
- /package/dist/{lib → editor/related}/accordion-group/accordion-group.inspector/open-mode-field.d.ts +0 -0
- /package/dist/{lib → editor/related}/box/box.inspector/box.inspector.d.ts +0 -0
- /package/dist/{lib → editor/related}/box/box.inspector/index.d.ts +0 -0
- /package/dist/{lib → editor/related}/button/button.inspector/button.inspector.d.ts +0 -0
- /package/dist/{lib → editor/related}/button/button.inspector/index.d.ts +0 -0
- /package/dist/{lib → editor/related}/button/button.inspector/link-field.d.ts +0 -0
- /package/dist/{lib → editor/related}/button/button.inspector/size-field.d.ts +0 -0
- /package/dist/{lib → editor/related}/button/button.inspector/variant-field.d.ts +0 -0
- /package/dist/{lib → editor/related}/cell/cell.inspector/cell.inspector.d.ts +0 -0
- /package/dist/{lib → editor/related}/cell/cell.inspector/col-span-field.d.ts +0 -0
- /package/dist/{lib → editor/related}/cell/cell.inspector/index.d.ts +0 -0
- /package/dist/{lib → editor/related}/container/container.inspector/container.inspector.d.ts +0 -0
- /package/dist/{lib → editor/related}/container/container.inspector/index.d.ts +0 -0
- /package/dist/{lib → editor/related}/countdown-timer/countdown-timer.inspector/caption-style-fields.d.ts +0 -0
- /package/dist/{lib → editor/related}/countdown-timer/countdown-timer.inspector/countdown-timer.inspector.d.ts +0 -0
- /package/dist/{lib → editor/related}/countdown-timer/countdown-timer.inspector/index.d.ts +0 -0
- /package/dist/{lib → editor/related}/countdown-timer/countdown-timer.inspector/time-style-fields.d.ts +0 -0
- /package/dist/{lib → editor/related}/countdown-timer/countdown-timer.inspector/unit-item-style-fields.d.ts +0 -0
- /package/dist/{lib → editor/related}/countdown-timer/countdown-timer.inspector/units-field.d.ts +0 -0
- /package/dist/{lib → editor/related}/flex-item/flex-item.inspector/auto-grow-field.d.ts +0 -0
- /package/dist/{lib → editor/related}/flex-item/flex-item.inspector/auto-shrink-field.d.ts +0 -0
- /package/dist/{lib → editor/related}/flex-item/flex-item.inspector/flex-item.inspector.d.ts +0 -0
- /package/dist/{lib → editor/related}/flex-item/flex-item.inspector/index.d.ts +0 -0
- /package/dist/{lib → editor/related}/flexbox/flexbox.inspector/direction-field.d.ts +0 -0
- /package/dist/{lib → editor/related}/flexbox/flexbox.inspector/flexbox.inspector.d.ts +0 -0
- /package/dist/{lib → editor/related}/flexbox/flexbox.inspector/index.d.ts +0 -0
- /package/dist/{lib → editor/related}/grid/grid.inspector/grid.inspector.d.ts +0 -0
- /package/dist/{lib → editor/related}/grid/grid.inspector/index.d.ts +0 -0
- /package/dist/{lib → editor/related}/heading/heading.inspector/heading.inspector.d.ts +0 -0
- /package/dist/{lib → editor/related}/heading/heading.inspector/index.d.ts +0 -0
- /package/dist/{lib → editor/related}/heading/heading.toolbar/heading.toolbar.d.ts +0 -0
- /package/dist/{lib → editor/related}/heading/heading.toolbar/index.d.ts +0 -0
- /package/dist/{lib → editor/related}/icon/icon.inspector/icon.inspector.d.ts +0 -0
- /package/dist/{lib → editor/related}/icon/icon.inspector/index.d.ts +0 -0
- /package/dist/{lib → editor/related}/image/image.inspector/alt-text-field.d.ts +0 -0
- /package/dist/{lib → editor/related}/image/image.inspector/image.inspector.d.ts +0 -0
- /package/dist/{lib → editor/related}/image/image.inspector/index.d.ts +0 -0
- /package/dist/{lib → editor/related}/image/image.inspector/preload-field.d.ts +0 -0
- /package/dist/{lib → editor/related}/image/image.inspector/proportion-field.d.ts +0 -0
- /package/dist/{lib → editor/related}/image/image.inspector/source-field.d.ts +0 -0
- /package/dist/{lib → editor/related}/inline/inline.inspector/index.d.ts +0 -0
- /package/dist/{lib → editor/related}/inline/inline.inspector/inline.inspector.d.ts +0 -0
- /package/dist/{lib → editor/related}/link/link.inspector/destination-field.d.ts +0 -0
- /package/dist/{lib → editor/related}/link/link.inspector/index.d.ts +0 -0
- /package/dist/{lib → editor/related}/link/link.inspector/link.inspector.d.ts +0 -0
- /package/dist/{lib → editor/related}/link/link.inspector/rel-field.d.ts +0 -0
- /package/dist/{lib → editor/related}/link/link.toolbar/index.d.ts +0 -0
- /package/dist/{lib → editor/related}/link/link.toolbar/link.toolbar.d.ts +0 -0
- /package/dist/{lib → editor/related}/marquee/marquee.inspector/index.d.ts +0 -0
- /package/dist/{lib → editor/related}/marquee/marquee.inspector/marquee.inspector.d.ts +0 -0
- /package/dist/{lib → editor/related}/marquee/marquee.inspector/play-state-field.d.ts +0 -0
- /package/dist/{lib → editor/related}/paragraph/paragraph.inspector/index.d.ts +0 -0
- /package/dist/{lib → editor/related}/paragraph/paragraph.inspector/paragraph.inspector.d.ts +0 -0
- /package/dist/{lib → editor/related}/paragraph/paragraph.toolbar/index.d.ts +0 -0
- /package/dist/{lib → editor/related}/paragraph/paragraph.toolbar/paragraph.toolbar.d.ts +0 -0
- /package/dist/{lib → editor/related}/swiper/swiper.inspector/autoplay-delay-field.d.ts +0 -0
- /package/dist/{lib → editor/related}/swiper/swiper.inspector/autoplay-loop-field.d.ts +0 -0
- /package/dist/{lib → editor/related}/swiper/swiper.inspector/index.d.ts +0 -0
- /package/dist/{lib → editor/related}/swiper/swiper.inspector/slides-per-view-field.d.ts +0 -0
- /package/dist/{lib → editor/related}/swiper/swiper.inspector/swiper.inspector.d.ts +0 -0
- /package/dist/{lib → editor/related}/tabs/tabs.inspector/child-tabs-field.d.ts +0 -0
- /package/dist/{lib → editor/related}/tabs/tabs.inspector/default-active-field.d.ts +0 -0
- /package/dist/{lib → editor/related}/tabs/tabs.inspector/index.d.ts +0 -0
- /package/dist/{lib → editor/related}/tabs/tabs.inspector/tabs.inspector.d.ts +0 -0
- /package/dist/{lib → editor/related}/unordered-list/unordered-list.inspector/index.d.ts +0 -0
- /package/dist/{lib → editor/related}/unordered-list/unordered-list.inspector/unordered-list.inspector.d.ts +0 -0
- /package/dist/{lib → editor/related}/video/video.inspector/index.d.ts +0 -0
- /package/dist/{lib → editor/related}/video/video.inspector/video.inspector.d.ts +0 -0
package/dist/index.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { N as n, c as t } from "./toaster-
|
|
2
|
-
import { A as
|
|
1
|
+
import { N as n, c as t } from "./toaster-Bx7Helq-.js";
|
|
2
|
+
import { A as I, e as L, f as T, h as x, i as R, j as S, k as w, l as A, m as E, n as h, o as F, F as U, p as k, q, G as B, H as G, s as H, I as M, t as y, v as V, L as j, w as D, M as z, x as J, y as K, P as O, R as Q, z as X, E as Y, S as Z, J as _, T as $, K as W, O as ee, Q as oe, U as se, V as ae, X as re, Y as de, Z as te, _ as ne, $ as Ne, a0 as ue, a1 as ie, a2 as pe, g as me, a3 as Pe, a4 as ce, a5 as le, a6 as ge, a7 as be, a8 as fe, a9 as ve, aa as Ce, ab as Ie, ac as Le, ad as Te, u as xe, ae as Re, af as Se, ag as we, ah as Ae, ai as Ee, aj as he, ak as Fe, al as Ue, am as ke, an as qe, ao as Be, ap as Ge, aq as He, ar as Me, as as ye, at as Ve, au as je, av as De, aw as ze } from "./toaster-Bx7Helq-.js";
|
|
3
3
|
import "lodash-es";
|
|
4
4
|
import { useRef as N, useEffect as u } from "react";
|
|
5
5
|
import { getTabPanelProps as i, getListItemProps as p } from "@janbox/storefront-ui";
|
|
6
|
-
import { C as
|
|
6
|
+
import { C as Ke, a as Oe } from "./composer-DBRKIqu7.js";
|
|
7
7
|
const g = ({ enabled: a, onChange: r }) => {
|
|
8
8
|
const { dom: e } = n((s) => ({ dom: s.dom })), o = N(void 0);
|
|
9
9
|
u(() => {
|
|
@@ -23,27 +23,27 @@ const g = ({ enabled: a, onChange: r }) => {
|
|
|
23
23
|
transform: p
|
|
24
24
|
});
|
|
25
25
|
export {
|
|
26
|
-
|
|
26
|
+
I as AccordionContentNode,
|
|
27
27
|
L as AccordionGroupNode,
|
|
28
28
|
T as AccordionNode,
|
|
29
29
|
x as AccordionSummaryNode,
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
h as
|
|
38
|
-
F as
|
|
30
|
+
R as BoxNode,
|
|
31
|
+
S as ButtonNode,
|
|
32
|
+
Ke as Canvas,
|
|
33
|
+
w as CanvasPlaceholder,
|
|
34
|
+
A as CellNode,
|
|
35
|
+
Oe as Composer,
|
|
36
|
+
E as ContainerNode,
|
|
37
|
+
h as CountUpNode,
|
|
38
|
+
F as CountdownTimerNode,
|
|
39
|
+
U as FlexItemNode,
|
|
39
40
|
k as FlexboxNode,
|
|
40
41
|
q as FragmentNode,
|
|
41
42
|
B as GridNode,
|
|
42
43
|
G as Heading,
|
|
43
44
|
H as HeadingNode,
|
|
44
45
|
M as IconNode,
|
|
45
|
-
|
|
46
|
-
y as InlineInspector,
|
|
46
|
+
y as ImageNode,
|
|
47
47
|
V as InlineNode,
|
|
48
48
|
j as LinkNode,
|
|
49
49
|
D as ListItemNode,
|
|
@@ -51,54 +51,60 @@ export {
|
|
|
51
51
|
J as MarqueeNode,
|
|
52
52
|
K as NodeElement,
|
|
53
53
|
O as ParagraphNode,
|
|
54
|
-
Q as
|
|
55
|
-
X as
|
|
56
|
-
Y as
|
|
57
|
-
Z as
|
|
58
|
-
_ as
|
|
59
|
-
$ as
|
|
60
|
-
W as
|
|
61
|
-
ee as
|
|
62
|
-
oe as
|
|
63
|
-
se as
|
|
64
|
-
ae as
|
|
65
|
-
re as
|
|
66
|
-
de as
|
|
67
|
-
te as
|
|
68
|
-
ne as
|
|
69
|
-
Ne as
|
|
70
|
-
ue as
|
|
71
|
-
ie as
|
|
72
|
-
pe as
|
|
73
|
-
me as
|
|
74
|
-
Pe as
|
|
75
|
-
ce as
|
|
76
|
-
le as
|
|
77
|
-
ge as
|
|
78
|
-
be as
|
|
79
|
-
fe as
|
|
80
|
-
ve as
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
Le as
|
|
84
|
-
Te as
|
|
85
|
-
xe as
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
54
|
+
Q as Rating,
|
|
55
|
+
X as RatingNode,
|
|
56
|
+
Y as RootNode,
|
|
57
|
+
Z as SwiperNode,
|
|
58
|
+
_ as SwiperSlideNode,
|
|
59
|
+
$ as TabContentNode,
|
|
60
|
+
W as TabListNode,
|
|
61
|
+
ee as TabNode,
|
|
62
|
+
oe as TabPanelNode,
|
|
63
|
+
se as TabsNode,
|
|
64
|
+
ae as UnknownNode,
|
|
65
|
+
re as UnorderedListNode,
|
|
66
|
+
de as VideoNode,
|
|
67
|
+
te as defaultProps,
|
|
68
|
+
ne as defineNode,
|
|
69
|
+
Ne as getNodeCustom,
|
|
70
|
+
ue as getNodeDisplayName,
|
|
71
|
+
ie as getNodeInfo,
|
|
72
|
+
pe as getNodeRelated,
|
|
73
|
+
me as getNodeResolved,
|
|
74
|
+
Pe as getRatingProps,
|
|
75
|
+
ce as isNodeSelectable,
|
|
76
|
+
le as parseNumber,
|
|
77
|
+
ge as parseSvgString,
|
|
78
|
+
be as registerNodeRelated,
|
|
79
|
+
fe as toResponsiveCss,
|
|
80
|
+
ve as useAccordionGroupNodeProps,
|
|
81
|
+
Ce as useAccordionNodeProps,
|
|
82
|
+
Ie as useBoxNodeProps,
|
|
83
|
+
Le as useButtonNodeProps,
|
|
84
|
+
Te as useCellNodeProps,
|
|
85
|
+
xe as useComposer,
|
|
86
|
+
Re as useContainerNodeProps,
|
|
87
|
+
Se as useCountUpNodeProps,
|
|
88
|
+
we as useCountdownTimerNodeProps,
|
|
89
|
+
Ae as useFlexItemNodeProps,
|
|
90
|
+
Ee as useFlexboxNodeProps,
|
|
91
|
+
he as useGridNodeProps,
|
|
92
|
+
Fe as useHeadingNodeProps,
|
|
93
|
+
Ue as useIconNodeProps,
|
|
94
|
+
ke as useImageNodeProps,
|
|
95
|
+
qe as useLinkNodeProps,
|
|
91
96
|
f as useListItemNodeProps,
|
|
92
|
-
|
|
97
|
+
Be as useMarqueeNodeProps,
|
|
93
98
|
n as useNode,
|
|
94
99
|
g as useNodeContentEditable,
|
|
95
|
-
|
|
100
|
+
Ge as useNodeDataAttributes,
|
|
96
101
|
t as useNodeProps,
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
102
|
+
He as useParagraphNodeProps,
|
|
103
|
+
Me as useRatingNodeProps,
|
|
104
|
+
ye as useSwiperNodeProps,
|
|
105
|
+
Ve as useTabNodeProps,
|
|
100
106
|
b as useTabPanelNodeProps,
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
107
|
+
je as useTabsNodeProps,
|
|
108
|
+
De as useUnorderedListNodeProps,
|
|
109
|
+
ze as useVideoNodeProps
|
|
104
110
|
};
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
# CountUpNode
|
|
2
|
+
|
|
3
|
+
Hiển thị con số chạy tăng dần (animate từ `from` đến `to`) — render ra component `CountUp` của `@janbox/storefront-ui`. Dùng cho số liệu thống kê, thành tựu, KPI... Không phải canvas node — không chứa node con.
|
|
4
|
+
|
|
5
|
+
## Resolved name
|
|
6
|
+
|
|
7
|
+
`CountUp` (displayName: `Count up`)
|
|
8
|
+
|
|
9
|
+
## Cấu trúc
|
|
10
|
+
|
|
11
|
+
```text
|
|
12
|
+
count-up/
|
|
13
|
+
├── count-up.node/ # CraftJS node bọc quanh <CountUp />
|
|
14
|
+
│ ├── count-up.node.tsx
|
|
15
|
+
│ ├── types.ts # CountUpNodeProps
|
|
16
|
+
│ └── helpers.ts # useCountUpNodeProps (transform = getCountUpProps)
|
|
17
|
+
└── count-up.inspector/ # Panel chỉnh sửa trong editor
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
`CountUpNode` lo phần CraftJS (connectors, data attributes) rồi delegate xuống `CountUp`. Trong editor (`enabled`) thì `startOnView` bị tắt để số luôn hiển thị giá trị cuối; ở trang thật thì animate khi cuộn tới.
|
|
21
|
+
|
|
22
|
+
## Configurable props
|
|
23
|
+
|
|
24
|
+
### Top-level props
|
|
25
|
+
|
|
26
|
+
| Prop | Type | Default | Description |
|
|
27
|
+
| --- | --- | --- | --- |
|
|
28
|
+
| `to` | `number` | — | Giá trị kết thúc. **Bắt buộc** |
|
|
29
|
+
| `from` | `number` | `0` | Giá trị bắt đầu |
|
|
30
|
+
| `duration` | `number` | `2` | Thời lượng animate (giây) |
|
|
31
|
+
| `prefix` | `ReactNode` | — | Nội dung hiển thị trước số (VD `+`, `$`) |
|
|
32
|
+
| `suffix` | `ReactNode` | — | Nội dung hiển thị sau số (VD `%`, `k`) |
|
|
33
|
+
| `startOnView` | `boolean` | `true` | Chỉ animate khi element cuộn vào viewport (tự tắt trong editor) |
|
|
34
|
+
| `formatNumberOptions` | `FormatNumberOptions` | — | Tùy chọn format số (phân tách hàng nghìn, số thập phân...) |
|
|
35
|
+
| `sizeVariant` | `TypographySizeVariant` | — | Cỡ chữ theo hệ typography. Hỗ trợ responsive qua `sm`, `md`, `lg` |
|
|
36
|
+
|
|
37
|
+
Ngoài ra kế thừa toàn bộ props của `motion.span` (`HTMLMotionProps<'span'>`) — có thể truyền `className`, `onClick`, animation props của Motion...
|
|
38
|
+
|
|
39
|
+
`sizeVariant` responsive: `sizeVariant="xl"` trên mobile, `md={{ sizeVariant: '2xl' }}` phóng to trên desktop.
|
|
40
|
+
|
|
41
|
+
### `sx` props
|
|
42
|
+
|
|
43
|
+
```ts
|
|
44
|
+
sx?: {
|
|
45
|
+
// typography
|
|
46
|
+
color?: string
|
|
47
|
+
fontWeight?: number | string
|
|
48
|
+
fontStyle?: string
|
|
49
|
+
textDecorationLine?: string
|
|
50
|
+
textAlign?: 'left' | 'center' | 'right'
|
|
51
|
+
textTransform?: 'none' | 'uppercase' | 'lowercase' | 'capitalize'
|
|
52
|
+
|
|
53
|
+
// border
|
|
54
|
+
borderStyle?: string
|
|
55
|
+
borderColor?: string
|
|
56
|
+
borderTopWidth?: number
|
|
57
|
+
borderRightWidth?: number
|
|
58
|
+
borderBottomWidth?: number
|
|
59
|
+
borderLeftWidth?: number
|
|
60
|
+
borderTopLeftRadius?: number | string
|
|
61
|
+
borderTopRightRadius?: number | string
|
|
62
|
+
borderBottomRightRadius?: number | string
|
|
63
|
+
borderBottomLeftRadius?: number | string
|
|
64
|
+
|
|
65
|
+
// background
|
|
66
|
+
backgroundColor?: string
|
|
67
|
+
backgroundImage?: string
|
|
68
|
+
backgroundPosition?: string
|
|
69
|
+
backgroundRepeat?: string
|
|
70
|
+
backgroundSize?: string
|
|
71
|
+
backgroundAttachment?: string
|
|
72
|
+
background?: string
|
|
73
|
+
|
|
74
|
+
// responsive overrides
|
|
75
|
+
sm?: { /* same keys above */ }
|
|
76
|
+
md?: { /* same keys above */ }
|
|
77
|
+
lg?: { /* same keys above */ }
|
|
78
|
+
}
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
## Usage
|
|
82
|
+
|
|
83
|
+
```tsx
|
|
84
|
+
import { CountUpNode } from '@janbox/storefront-builder';
|
|
85
|
+
|
|
86
|
+
// Cơ bản — chạy từ 0 đến 100
|
|
87
|
+
<CountUpNode from={0} to={100} />
|
|
88
|
+
|
|
89
|
+
// Có prefix/suffix
|
|
90
|
+
<CountUpNode from={0} to={1000} prefix="+" suffix="k" />
|
|
91
|
+
|
|
92
|
+
// Tùy chỉnh thời lượng + cỡ chữ responsive
|
|
93
|
+
<CountUpNode
|
|
94
|
+
from={0}
|
|
95
|
+
to={98}
|
|
96
|
+
suffix="%"
|
|
97
|
+
duration={3}
|
|
98
|
+
sizeVariant="xl"
|
|
99
|
+
md={{ sizeVariant: '3xl' }}
|
|
100
|
+
/>
|
|
101
|
+
|
|
102
|
+
// Style qua sx
|
|
103
|
+
<CountUpNode
|
|
104
|
+
from={0}
|
|
105
|
+
to={500}
|
|
106
|
+
sx={{
|
|
107
|
+
color: '#f59e0b',
|
|
108
|
+
fontWeight: 700,
|
|
109
|
+
textAlign: 'center',
|
|
110
|
+
}}
|
|
111
|
+
/>
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
## Editor (Inspector)
|
|
115
|
+
|
|
116
|
+
### Tab Settings
|
|
117
|
+
|
|
118
|
+
- **Config**: From, To, Duration (s), Prefix, Suffix
|
|
119
|
+
- **Text style**: Size variant, Color, Style (weight/italic/underline), Text align, Text transform, Font weight
|
|
120
|
+
|
|
121
|
+
### Tab Advanced
|
|
122
|
+
|
|
123
|
+
- **Shape**: Border, Border radius
|
|
124
|
+
- **Background**: Background
|
|
125
|
+
|
|
126
|
+
## Rules
|
|
127
|
+
|
|
128
|
+
- **Canvas**: no — không chứa node con.
|
|
129
|
+
- Các prop đều có default qua `getCountUpProps` của `@janbox/storefront-ui`.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './count-up.node';
|
package/dist/lib/icon/README.md
CHANGED
|
@@ -10,10 +10,10 @@ SVG icon node. Render inline SVG từ raw string hoặc URL.
|
|
|
10
10
|
|
|
11
11
|
### Top-level props
|
|
12
12
|
|
|
13
|
-
| Prop
|
|
14
|
-
|
|
|
15
|
-
| `source` | `string` | Raw SVG string hoặc URL tới file SVG
|
|
16
|
-
| `size`
|
|
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
17
|
|
|
18
18
|
`size` hỗ trợ responsive: `size={24}` xs, `md={{ size: 32 }}` desktop.
|
|
19
19
|
|
|
@@ -25,10 +25,6 @@ sx?: {
|
|
|
25
25
|
color?: string
|
|
26
26
|
|
|
27
27
|
// spacing
|
|
28
|
-
paddingTop?: number
|
|
29
|
-
paddingRight?: number
|
|
30
|
-
paddingBottom?: number
|
|
31
|
-
paddingLeft?: number
|
|
32
28
|
marginTop?: number
|
|
33
29
|
marginRight?: number
|
|
34
30
|
marginBottom?: number
|
|
@@ -73,21 +69,16 @@ import { IconNode } from '@janbox/storefront-builder';
|
|
|
73
69
|
sx={{ color: '#fa8c16' }}
|
|
74
70
|
/>
|
|
75
71
|
|
|
76
|
-
// Icon với
|
|
72
|
+
// Icon với border radius tròn
|
|
77
73
|
<IconNode
|
|
78
74
|
source='<svg>...</svg>'
|
|
79
75
|
size={16}
|
|
80
76
|
sx={{
|
|
81
77
|
color: '#ffffff',
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
backgroundColor: '#fa8c16',
|
|
87
|
-
borderTopLeftRadius: '50%',
|
|
88
|
-
borderTopRightRadius: '50%',
|
|
89
|
-
borderBottomLeftRadius: '50%',
|
|
90
|
-
borderBottomRightRadius: '50%',
|
|
78
|
+
borderTopLeftRadius: 9999,
|
|
79
|
+
borderTopRightRadius: 9999,
|
|
80
|
+
borderBottomLeftRadius: 9999,
|
|
81
|
+
borderBottomRightRadius: 9999,
|
|
91
82
|
}}
|
|
92
83
|
/>
|
|
93
84
|
```
|
package/dist/lib/index.d.ts
CHANGED
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
# RatingNode
|
|
2
|
+
|
|
3
|
+
Hiển thị dải sao đánh giá (render ra chuỗi `StarRating` của `@janbox/storefront-ui`). Hỗ trợ rating thập phân (sao được fill một phần), số lượng sao tùy chỉnh, kích thước responsive và màu tùy ý. Không phải canvas node — không chứa node con.
|
|
4
|
+
|
|
5
|
+
## Resolved name
|
|
6
|
+
|
|
7
|
+
`Rating` (displayName: `Rating`)
|
|
8
|
+
|
|
9
|
+
## Cấu trúc
|
|
10
|
+
|
|
11
|
+
```text
|
|
12
|
+
rating/
|
|
13
|
+
├── rating/ # Component thuần túy (không phụ thuộc CraftJS)
|
|
14
|
+
│ ├── rating.tsx # <Rating /> — render Primitive + danh sách StarRating
|
|
15
|
+
│ ├── types.ts # RatingProps
|
|
16
|
+
│ └── helpers.ts # defaultProps + getRatingProps (merge default)
|
|
17
|
+
├── rating.node/ # CraftJS node bọc quanh <Rating />
|
|
18
|
+
│ ├── rating.node.tsx
|
|
19
|
+
│ ├── types.ts # RatingNodeProps = RatingProps
|
|
20
|
+
│ └── helpers.ts # useRatingNodeProps (transform = getRatingProps)
|
|
21
|
+
└── rating.inspector/ # Panel chỉnh sửa trong editor
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
`RatingNode` chỉ lo phần CraftJS (connectors, data attributes) rồi delegate xuống component `Rating`.
|
|
25
|
+
|
|
26
|
+
## Configurable props
|
|
27
|
+
|
|
28
|
+
### Top-level props
|
|
29
|
+
|
|
30
|
+
| Prop | Type | Default | Description |
|
|
31
|
+
| --- | --- | --- | --- |
|
|
32
|
+
| `rating` | `number` | `5` | Giá trị rating hiện tại, hỗ trợ thập phân (VD `3.5` fill nửa sao). **Bắt buộc** |
|
|
33
|
+
| `count` | `number` | `5` | Số lượng sao hiển thị |
|
|
34
|
+
| `size` | `number` | `24` | Kích thước mỗi sao (px). Hỗ trợ responsive qua `sm`, `md`, `lg` |
|
|
35
|
+
| `color` | `string` | `orange.600` | Màu áp dụng cho tất cả sao (CSS color string) |
|
|
36
|
+
|
|
37
|
+
`size` responsive: `size={20}` trên mobile, `md={{ size: 32 }}` phóng to trên desktop.
|
|
38
|
+
|
|
39
|
+
### `sx` props
|
|
40
|
+
|
|
41
|
+
```ts
|
|
42
|
+
sx?: {
|
|
43
|
+
// spacing giữa các sao
|
|
44
|
+
columnGap?: number
|
|
45
|
+
|
|
46
|
+
// spacing ngoài/trong
|
|
47
|
+
marginTop?: number
|
|
48
|
+
marginRight?: number
|
|
49
|
+
marginBottom?: number
|
|
50
|
+
marginLeft?: number
|
|
51
|
+
paddingTop?: number
|
|
52
|
+
paddingRight?: number
|
|
53
|
+
paddingBottom?: number
|
|
54
|
+
paddingLeft?: number
|
|
55
|
+
|
|
56
|
+
// border
|
|
57
|
+
borderStyle?: string
|
|
58
|
+
borderColor?: string
|
|
59
|
+
borderTopWidth?: number
|
|
60
|
+
borderRightWidth?: number
|
|
61
|
+
borderBottomWidth?: number
|
|
62
|
+
borderLeftWidth?: number
|
|
63
|
+
borderTopLeftRadius?: number | string
|
|
64
|
+
borderTopRightRadius?: number | string
|
|
65
|
+
borderBottomRightRadius?: number | string
|
|
66
|
+
borderBottomLeftRadius?: number | string
|
|
67
|
+
|
|
68
|
+
// background
|
|
69
|
+
backgroundColor?: string
|
|
70
|
+
backgroundImage?: string
|
|
71
|
+
backgroundPosition?: string
|
|
72
|
+
backgroundRepeat?: string
|
|
73
|
+
backgroundSize?: string
|
|
74
|
+
backgroundAttachment?: string
|
|
75
|
+
background?: string
|
|
76
|
+
|
|
77
|
+
// responsive overrides
|
|
78
|
+
sm?: { /* same keys above */ }
|
|
79
|
+
md?: { /* same keys above */ }
|
|
80
|
+
lg?: { /* same keys above */ }
|
|
81
|
+
}
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
Container render `display: flex` với `width: fit-content`, nên `columnGap` là khoảng cách giữa các sao.
|
|
85
|
+
|
|
86
|
+
## Usage
|
|
87
|
+
|
|
88
|
+
```tsx
|
|
89
|
+
import { RatingNode } from '@janbox/storefront-builder';
|
|
90
|
+
|
|
91
|
+
// Cơ bản — 5 sao, rating 4.5
|
|
92
|
+
<RatingNode rating={4.5} />
|
|
93
|
+
|
|
94
|
+
// Tùy chỉnh số sao, kích thước, màu
|
|
95
|
+
<RatingNode rating={3} count={5} size={28} color="#f59e0b" />
|
|
96
|
+
|
|
97
|
+
// Size responsive
|
|
98
|
+
<RatingNode rating={4} size={20} md={{ size: 32 }} />
|
|
99
|
+
|
|
100
|
+
// Điều chỉnh khoảng cách giữa các sao + spacing ngoài
|
|
101
|
+
<RatingNode
|
|
102
|
+
rating={4.5}
|
|
103
|
+
sx={{
|
|
104
|
+
columnGap: 8,
|
|
105
|
+
marginTop: 12,
|
|
106
|
+
marginBottom: 12,
|
|
107
|
+
}}
|
|
108
|
+
/>
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
## Editor (Inspector)
|
|
112
|
+
|
|
113
|
+
### Tab Settings
|
|
114
|
+
|
|
115
|
+
- **Config**: Rating, Count, Size (responsive), Color (color picker), Column gap
|
|
116
|
+
- **Spacing (px)**: Margin, Padding (responsive)
|
|
117
|
+
|
|
118
|
+
### Tab Advanced
|
|
119
|
+
|
|
120
|
+
- **Shape**: Border, Border radius
|
|
121
|
+
- **Background**: Background
|
|
122
|
+
|
|
123
|
+
## Rules
|
|
124
|
+
|
|
125
|
+
- **Canvas**: no — không chứa node con.
|
|
126
|
+
- `rating` là prop bắt buộc; các prop còn lại có default qua `getRatingProps`.
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { PrimitiveProps, StarRatingResponsiveProps } from '@janbox/storefront-ui';
|
|
2
|
+
import { ToResponsiveProps } from '@janbox/storefront-ui/types';
|
|
3
|
+
export type RatingProps = ToResponsiveProps<StarRatingResponsiveProps> & PrimitiveProps & {
|
|
4
|
+
/** Giá trị rating hiện tại (hỗ trợ số thập phân, VD: 3.5). */
|
|
5
|
+
rating: number;
|
|
6
|
+
/** Số lượng ngôi sao hiển thị. */
|
|
7
|
+
count?: number;
|
|
8
|
+
/** Màu áp dụng cho tất cả ngôi sao (CSS color string). */
|
|
9
|
+
color?: string;
|
|
10
|
+
};
|