@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/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
- @media (max-width: 600px) {
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 LINE_BAR_PALETTES = [
6121
- ["var(--primitive-red-100)", "var(--primitive-red-200)", "var(--primitive-red-300)", "var(--primitive-red-400)", "var(--primitive-red-500)", "var(--primitive-red-600)"],
6122
- ["var(--primitive-orange-100)", "var(--primitive-orange-200)", "var(--primitive-orange-300)", "var(--primitive-orange-400)", "var(--primitive-orange-500)", "var(--primitive-orange-600)"],
6123
- ["var(--primitive-yellow-100)", "var(--primitive-yellow-200)", "var(--primitive-yellow-300)", "var(--primitive-yellow-400)", "var(--primitive-yellow-500)", "var(--primitive-yellow-600)"],
6124
- ["var(--primitive-green-100)", "var(--primitive-green-200)", "var(--primitive-green-300)", "var(--primitive-green-400)", "var(--primitive-green-500)", "var(--primitive-green-600)"],
6125
- ["var(--primitive-blue-100)", "var(--primitive-blue-200)", "var(--primitive-blue-300)", "var(--primitive-blue-400)", "var(--primitive-blue-500)", "var(--primitive-blue-600)"],
6126
- ["var(--primitive-light-blue-100)", "var(--primitive-light-blue-200)", "var(--primitive-light-blue-300)", "var(--primitive-light-blue-400)", "var(--primitive-light-blue-500)", "var(--primitive-light-blue-600)"],
6127
- ["var(--primitive-purple-100)", "var(--primitive-purple-200)", "var(--primitive-purple-300)", "var(--primitive-purple-400)", "var(--primitive-purple-500)", "var(--primitive-purple-600)"],
6128
- ["var(--primitive-pink-100)", "var(--primitive-pink-200)", "var(--primitive-pink-300)", "var(--primitive-pink-400)", "var(--primitive-pink-500)", "var(--primitive-pink-600)"]
6129
- ];
6130
- var PIE_PALETTES = [
6131
- ["var(--primitive-orange-300)", "var(--primitive-red-300)", "var(--primitive-yellow-300)", "var(--primitive-green-300)", "var(--primitive-blue-300)", "var(--primitive-light-blue-300)"],
6132
- ["var(--primitive-orange-400)", "var(--primitive-red-400)", "var(--primitive-yellow-400)", "var(--primitive-green-400)", "var(--primitive-blue-400)", "var(--primitive-light-blue-400)"],
6133
- ["var(--primitive-orange-500)", "var(--primitive-red-500)", "var(--primitive-yellow-500)", "var(--primitive-green-500)", "var(--primitive-blue-500)", "var(--primitive-light-blue-500)"]
6134
- ];
6135
- var getPalette = (palettes, index) => {
6136
- return palettes[index % palettes.length];
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[4];
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[4];
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 values = React5.useMemo(() => Object.entries(data).flatMap(([, v]) => v), [data]);
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 palette = getPalette(PIE_PALETTES, 0);
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: palette[i % palette.length],
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("div", { className: "lib-xplat-datepicker input-datepicker", ref: containerRef, children: [
6849
- /* @__PURE__ */ jsx312("div", { onClick: () => !disabled && setIsOpen(!isOpen), children: /* @__PURE__ */ jsx312(
6850
- Input_default,
6851
- {
6852
- value: formatDate(value),
6853
- suffix: /* @__PURE__ */ jsx312(CalenderIcon_default, {}),
6854
- disabled,
6855
- readOnly: true
6856
- }
6857
- ) }),
6858
- isOpen && /* @__PURE__ */ jsx312("div", { className: "input-datepicker-dropdown", ref: calendarRef, children: /* @__PURE__ */ jsx312(
6859
- SingleDatePicker_default,
6860
- {
6861
- value,
6862
- onChange: handleSelect,
6863
- minDate,
6864
- maxDate,
6865
- locale
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
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@x-plat/design-system",
3
- "version": "0.5.6",
3
+ "version": "0.5.8",
4
4
  "description": "XPLAT UI Design System",
5
5
  "author": "XPLAT WOONG",
6
6
  "main": "dist/index.cjs",