@x-plat/design-system 0.5.6 → 0.5.8
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/Chart/index.cjs +33 -24
- package/dist/components/Chart/index.js +33 -24
- package/dist/components/DatePicker/index.cjs +38 -22
- package/dist/components/DatePicker/index.css +14 -1
- package/dist/components/DatePicker/index.d.cts +2 -1
- package/dist/components/DatePicker/index.d.ts +2 -1
- package/dist/components/DatePicker/index.js +38 -22
- package/dist/components/Video/index.cjs +1 -1
- package/dist/components/Video/index.css +7 -0
- package/dist/components/Video/index.js +1 -1
- package/dist/components/index.cjs +72 -47
- package/dist/components/index.css +21 -1
- package/dist/components/index.js +72 -47
- package/dist/index.cjs +72 -47
- package/dist/index.css +21 -1
- package/dist/index.js +72 -47
- package/package.json +1 -1
package/dist/index.css
CHANGED
|
@@ -2244,6 +2244,7 @@
|
|
|
2244
2244
|
.lib-xplat-datepicker.range {
|
|
2245
2245
|
display: flex;
|
|
2246
2246
|
flex-direction: column;
|
|
2247
|
+
container-type: inline-size;
|
|
2247
2248
|
}
|
|
2248
2249
|
.lib-xplat-datepicker .datepicker-range-tabs {
|
|
2249
2250
|
display: none;
|
|
@@ -2286,7 +2287,7 @@
|
|
|
2286
2287
|
color: var(--semantic-text-muted);
|
|
2287
2288
|
margin-bottom: var(--spacing-space-2);
|
|
2288
2289
|
}
|
|
2289
|
-
@
|
|
2290
|
+
@container (max-width: 600px) {
|
|
2290
2291
|
.lib-xplat-datepicker .datepicker-range-tabs {
|
|
2291
2292
|
display: flex;
|
|
2292
2293
|
}
|
|
@@ -2303,6 +2304,18 @@
|
|
|
2303
2304
|
.lib-xplat-datepicker.input-datepicker {
|
|
2304
2305
|
position: relative;
|
|
2305
2306
|
}
|
|
2307
|
+
.lib-xplat-datepicker.input-datepicker .input-datepicker-trigger {
|
|
2308
|
+
cursor: pointer;
|
|
2309
|
+
}
|
|
2310
|
+
.lib-xplat-datepicker.input-datepicker .input-datepicker-trigger input {
|
|
2311
|
+
cursor: pointer;
|
|
2312
|
+
}
|
|
2313
|
+
.lib-xplat-datepicker.input-datepicker.disabled .input-datepicker-trigger {
|
|
2314
|
+
cursor: not-allowed;
|
|
2315
|
+
}
|
|
2316
|
+
.lib-xplat-datepicker.input-datepicker.disabled .input-datepicker-trigger input {
|
|
2317
|
+
cursor: not-allowed;
|
|
2318
|
+
}
|
|
2306
2319
|
.lib-xplat-datepicker.input-datepicker .input-datepicker-dropdown {
|
|
2307
2320
|
position: absolute;
|
|
2308
2321
|
top: 100%;
|
|
@@ -4079,6 +4092,9 @@
|
|
|
4079
4092
|
max-height: 100%;
|
|
4080
4093
|
object-fit: contain;
|
|
4081
4094
|
vertical-align: middle;
|
|
4095
|
+
}
|
|
4096
|
+
.lib-xplat-video.has-controls > video,
|
|
4097
|
+
.lib-xplat-video:has(> .center-play) > video {
|
|
4082
4098
|
cursor: pointer;
|
|
4083
4099
|
}
|
|
4084
4100
|
.lib-xplat-video > .center-play {
|
|
@@ -4241,6 +4257,9 @@
|
|
|
4241
4257
|
appearance: none;
|
|
4242
4258
|
background: transparent;
|
|
4243
4259
|
cursor: pointer;
|
|
4260
|
+
margin: 0;
|
|
4261
|
+
padding: 0;
|
|
4262
|
+
align-self: center;
|
|
4244
4263
|
}
|
|
4245
4264
|
.lib-xplat-video .seekbar:focus,
|
|
4246
4265
|
.lib-xplat-video .volume-slider:focus {
|
|
@@ -4252,6 +4271,7 @@
|
|
|
4252
4271
|
appearance: none;
|
|
4253
4272
|
width: 12px;
|
|
4254
4273
|
height: 12px;
|
|
4274
|
+
margin-top: -4px;
|
|
4255
4275
|
border-radius: 50%;
|
|
4256
4276
|
background: #fff;
|
|
4257
4277
|
border: none;
|
package/dist/index.js
CHANGED
|
@@ -6117,23 +6117,30 @@ var CardTab_default = CardTab;
|
|
|
6117
6117
|
// src/components/Chart/Chart.tsx
|
|
6118
6118
|
import React5 from "react";
|
|
6119
6119
|
import { jsx as jsx305, jsxs as jsxs196 } from "react/jsx-runtime";
|
|
6120
|
-
var
|
|
6121
|
-
|
|
6122
|
-
|
|
6123
|
-
[
|
|
6124
|
-
|
|
6125
|
-
|
|
6126
|
-
|
|
6127
|
-
|
|
6128
|
-
|
|
6129
|
-
|
|
6130
|
-
var
|
|
6131
|
-
|
|
6132
|
-
|
|
6133
|
-
|
|
6134
|
-
|
|
6135
|
-
|
|
6136
|
-
|
|
6120
|
+
var CATEGORICAL_COUNT2 = 8;
|
|
6121
|
+
var LINE_BAR_PALETTES = Array.from({ length: CATEGORICAL_COUNT2 }, (_, i) => {
|
|
6122
|
+
const n = i + 1;
|
|
6123
|
+
return [
|
|
6124
|
+
`var(--semantic-categorical-${n}-bg)`,
|
|
6125
|
+
`var(--semantic-categorical-${n}-area)`,
|
|
6126
|
+
`var(--semantic-categorical-${n}-fill)`,
|
|
6127
|
+
`var(--semantic-categorical-${n}-text)`
|
|
6128
|
+
];
|
|
6129
|
+
});
|
|
6130
|
+
var PIE_COLORS = Array.from(
|
|
6131
|
+
{ length: CATEGORICAL_COUNT2 },
|
|
6132
|
+
(_, i) => `var(--semantic-categorical-${i + 1}-fill)`
|
|
6133
|
+
);
|
|
6134
|
+
var hashString = (str) => {
|
|
6135
|
+
let hash = 0;
|
|
6136
|
+
for (let i = 0; i < str.length; i++) {
|
|
6137
|
+
hash = (hash << 5) - hash + str.charCodeAt(i) | 0;
|
|
6138
|
+
}
|
|
6139
|
+
return Math.abs(hash);
|
|
6140
|
+
};
|
|
6141
|
+
var getPalette = (palettes, index, key) => {
|
|
6142
|
+
const offset = key ? hashString(key) : 0;
|
|
6143
|
+
return palettes[(index + offset) % palettes.length];
|
|
6137
6144
|
};
|
|
6138
6145
|
var PADDING = { top: 20, right: 20, bottom: 30, left: 40 };
|
|
6139
6146
|
var useChartTooltip = (enabled) => {
|
|
@@ -6203,8 +6210,8 @@ var LineChart = React5.memo(({ data, labels, onHover, onMove, onLeave }) => {
|
|
|
6203
6210
|
return /* @__PURE__ */ jsx305("text", { x, y: 300 - 8, className: "chart-axis-label", textAnchor: "middle", children: label }, i);
|
|
6204
6211
|
}),
|
|
6205
6212
|
entries.map(([key], di) => {
|
|
6206
|
-
const palette = getPalette(LINE_BAR_PALETTES, di);
|
|
6207
|
-
const color = palette[
|
|
6213
|
+
const palette = getPalette(LINE_BAR_PALETTES, di, key);
|
|
6214
|
+
const color = palette[2];
|
|
6208
6215
|
const points = seriesPoints[di];
|
|
6209
6216
|
return /* @__PURE__ */ jsxs196("g", { children: [
|
|
6210
6217
|
/* @__PURE__ */ jsx305(
|
|
@@ -6269,8 +6276,8 @@ var BarChart = React5.memo(({ data, labels, onHover, onMove, onLeave }) => {
|
|
|
6269
6276
|
}),
|
|
6270
6277
|
labels.map((label, i) => /* @__PURE__ */ jsx305("text", { x: PADDING.left + groupW * i + groupW / 2, y: 300 - 8, className: "chart-axis-label", textAnchor: "middle", children: label }, i)),
|
|
6271
6278
|
entries.map(([key], di) => {
|
|
6272
|
-
const palette = getPalette(LINE_BAR_PALETTES, di);
|
|
6273
|
-
const color = palette[
|
|
6279
|
+
const palette = getPalette(LINE_BAR_PALETTES, di, key);
|
|
6280
|
+
const color = palette[2];
|
|
6274
6281
|
return bars[di].map((b, i) => /* @__PURE__ */ jsx305(
|
|
6275
6282
|
"rect",
|
|
6276
6283
|
{
|
|
@@ -6293,13 +6300,15 @@ var BarChart = React5.memo(({ data, labels, onHover, onMove, onLeave }) => {
|
|
|
6293
6300
|
BarChart.displayName = "BarChart";
|
|
6294
6301
|
var PieDonutChart = React5.memo(
|
|
6295
6302
|
({ data, labels, isDoughnut, onHover, onMove, onLeave }) => {
|
|
6296
|
-
const
|
|
6303
|
+
const entries = React5.useMemo(() => Object.entries(data), [data]);
|
|
6304
|
+
const values = React5.useMemo(() => entries.flatMap(([, v]) => v), [entries]);
|
|
6297
6305
|
const total = React5.useMemo(() => values.reduce((a, b) => a + b, 0) || 1, [values]);
|
|
6298
6306
|
const cx = 150;
|
|
6299
6307
|
const cy = 150;
|
|
6300
6308
|
const r2 = 120;
|
|
6301
6309
|
const innerR = isDoughnut ? 60 : 0;
|
|
6302
|
-
const
|
|
6310
|
+
const firstKey = entries[0]?.[0] ?? "";
|
|
6311
|
+
const colorOffset = hashString(firstKey);
|
|
6303
6312
|
const sliceData = React5.useMemo(() => {
|
|
6304
6313
|
let angle0 = -Math.PI / 2;
|
|
6305
6314
|
return values.map((v, i) => {
|
|
@@ -6334,7 +6343,7 @@ var PieDonutChart = React5.memo(
|
|
|
6334
6343
|
"path",
|
|
6335
6344
|
{
|
|
6336
6345
|
d: s.d,
|
|
6337
|
-
fill:
|
|
6346
|
+
fill: PIE_COLORS[(i + colorOffset) % PIE_COLORS.length],
|
|
6338
6347
|
className: "chart-slice",
|
|
6339
6348
|
onMouseEnter: (e) => onHover(e, `${s.label}: ${s.v} (${s.pct}%)`),
|
|
6340
6349
|
onMouseMove: onMove,
|
|
@@ -6829,13 +6838,14 @@ var SingleDatePicker_default = SingleDatePicker;
|
|
|
6829
6838
|
// src/components/DatePicker/InputDatePicker/index.tsx
|
|
6830
6839
|
import { jsx as jsx312, jsxs as jsxs201 } from "react/jsx-runtime";
|
|
6831
6840
|
var formatDate = (date) => {
|
|
6841
|
+
if (!date || !(date instanceof Date) || isNaN(date.getTime())) return "";
|
|
6832
6842
|
const y = date.getFullYear();
|
|
6833
6843
|
const m = String(date.getMonth() + 1).padStart(2, "0");
|
|
6834
6844
|
const d = String(date.getDate()).padStart(2, "0");
|
|
6835
6845
|
return `${y}/${m}/${d}`;
|
|
6836
6846
|
};
|
|
6837
6847
|
var InputDatePicker = (props) => {
|
|
6838
|
-
const { value, onChange, minDate, maxDate, disabled, locale } = props;
|
|
6848
|
+
const { value, onChange, minDate, maxDate, disabled, locale, placeholder } = props;
|
|
6839
6849
|
const [isOpen, setIsOpen] = React10.useState(false);
|
|
6840
6850
|
const containerRef = React10.useRef(null);
|
|
6841
6851
|
const calendarRef = React10.useRef(null);
|
|
@@ -6845,27 +6855,42 @@ var InputDatePicker = (props) => {
|
|
|
6845
6855
|
onChange?.(date);
|
|
6846
6856
|
setIsOpen(false);
|
|
6847
6857
|
};
|
|
6848
|
-
return /* @__PURE__ */ jsxs201(
|
|
6849
|
-
|
|
6850
|
-
|
|
6851
|
-
|
|
6852
|
-
|
|
6853
|
-
|
|
6854
|
-
|
|
6855
|
-
|
|
6856
|
-
|
|
6857
|
-
|
|
6858
|
-
|
|
6859
|
-
|
|
6860
|
-
|
|
6861
|
-
|
|
6862
|
-
|
|
6863
|
-
|
|
6864
|
-
|
|
6865
|
-
|
|
6866
|
-
|
|
6867
|
-
|
|
6868
|
-
|
|
6858
|
+
return /* @__PURE__ */ jsxs201(
|
|
6859
|
+
"div",
|
|
6860
|
+
{
|
|
6861
|
+
className: clsx_default("lib-xplat-datepicker input-datepicker", disabled && "disabled"),
|
|
6862
|
+
ref: containerRef,
|
|
6863
|
+
children: [
|
|
6864
|
+
/* @__PURE__ */ jsx312(
|
|
6865
|
+
"div",
|
|
6866
|
+
{
|
|
6867
|
+
className: "input-datepicker-trigger",
|
|
6868
|
+
onClick: () => !disabled && setIsOpen((o) => !o),
|
|
6869
|
+
children: /* @__PURE__ */ jsx312(
|
|
6870
|
+
Input_default,
|
|
6871
|
+
{
|
|
6872
|
+
value: formatDate(value),
|
|
6873
|
+
placeholder,
|
|
6874
|
+
suffix: /* @__PURE__ */ jsx312(CalenderIcon_default, {}),
|
|
6875
|
+
disabled,
|
|
6876
|
+
readOnly: true
|
|
6877
|
+
}
|
|
6878
|
+
)
|
|
6879
|
+
}
|
|
6880
|
+
),
|
|
6881
|
+
isOpen && /* @__PURE__ */ jsx312("div", { className: "input-datepicker-dropdown", ref: calendarRef, children: /* @__PURE__ */ jsx312(
|
|
6882
|
+
SingleDatePicker_default,
|
|
6883
|
+
{
|
|
6884
|
+
value: value ?? /* @__PURE__ */ new Date(),
|
|
6885
|
+
onChange: handleSelect,
|
|
6886
|
+
minDate,
|
|
6887
|
+
maxDate,
|
|
6888
|
+
locale
|
|
6889
|
+
}
|
|
6890
|
+
) })
|
|
6891
|
+
]
|
|
6892
|
+
}
|
|
6893
|
+
);
|
|
6869
6894
|
};
|
|
6870
6895
|
InputDatePicker.displayName = "InputDatePicker";
|
|
6871
6896
|
var InputDatePicker_default = InputDatePicker;
|
|
@@ -9083,7 +9108,7 @@ var Video = React38.forwardRef((props, ref) => {
|
|
|
9083
9108
|
onTimeUpdate: handleTimeUpdate,
|
|
9084
9109
|
onVolumeChange: handleVolumeChange,
|
|
9085
9110
|
onRateChange: handleRateChange,
|
|
9086
|
-
onClick: togglePlay,
|
|
9111
|
+
onClick: showControls || showCenterPlay ? togglePlay : void 0,
|
|
9087
9112
|
...rest,
|
|
9088
9113
|
children
|
|
9089
9114
|
}
|