@sia.soul/sia-react-ui 0.1.106 → 0.1.107

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.
Files changed (45) hide show
  1. package/dist/Button-BiL3Wjsd.d.ts +44 -0
  2. package/dist/Button-O_pNB3SQ.d.cts +44 -0
  3. package/dist/{Select-DmT9pFRW.d.ts → Select-BddM4uXC.d.ts} +4 -42
  4. package/dist/{Select-DQpfyK7I.d.cts → Select-Cf0xz1Tg.d.cts} +4 -42
  5. package/dist/chart.js +5 -3
  6. package/dist/chunk-4TTHKFJ7.js +706 -0
  7. package/dist/chunk-CZ2ITBRW.js +65 -0
  8. package/dist/{chunk-EYB55TC5.js → chunk-D3HXXEEZ.js} +9 -5
  9. package/dist/{chunk-X4OLHWC3.js → chunk-JEDJQ257.js} +11 -7
  10. package/dist/chunk-KY6A5IJH.js +18 -0
  11. package/dist/{chunk-NURPAO7G.js → chunk-MMSYWDTR.js} +9 -5
  12. package/dist/{chunk-PUZWLIIJ.js → chunk-NZMUW5XI.js} +1 -13
  13. package/dist/{chunk-D456SSL3.js → chunk-OJ2WDC66.js} +6 -4
  14. package/dist/{chunk-V6CRVCSB.js → chunk-QV3AP6A2.js} +40 -729
  15. package/dist/chunk-RX242MUO.js +0 -0
  16. package/dist/chunk-SCEHVGKV.js +75 -0
  17. package/dist/{chunk-TUXNOSCT.js → chunk-SO7IJZIR.js} +4 -2
  18. package/dist/{chunk-T3EGAN7O.js → chunk-WD56MJO2.js} +5 -3
  19. package/dist/{core-_1K1jLyH.d.ts → core-Bm-1bOjF.d.ts} +8 -1
  20. package/dist/{core-DF7gei-P.d.cts → core-zpQkbNf_.d.cts} +8 -1
  21. package/dist/core.cjs +3 -1
  22. package/dist/core.css +31 -0
  23. package/dist/core.d.cts +3 -2
  24. package/dist/core.d.ts +3 -2
  25. package/dist/core.js +12 -7
  26. package/dist/game.cjs +2801 -0
  27. package/dist/game.css +8919 -0
  28. package/dist/game.d.cts +416 -0
  29. package/dist/game.d.ts +416 -0
  30. package/dist/game.js +1020 -0
  31. package/dist/index.cjs +5518 -5460
  32. package/dist/index.css +71 -0
  33. package/dist/index.d.cts +45 -10
  34. package/dist/index.d.ts +45 -10
  35. package/dist/index.js +718 -656
  36. package/dist/markdown-editor.js +3 -2
  37. package/dist/rich-text-editor.cjs +3 -1
  38. package/dist/rich-text-editor.js +7 -4
  39. package/dist/{select-date-range-BT71tp7y.d.cts → select-date-range-Cm5o2xPp.d.cts} +1 -1
  40. package/dist/{select-date-range-CFGzoyLs.d.ts → select-date-range-yGDEA1RP.d.ts} +1 -1
  41. package/dist/select-date-range.d.cts +3 -2
  42. package/dist/select-date-range.d.ts +3 -2
  43. package/dist/select-date-range.js +8 -5
  44. package/package.json +9 -3
  45. package/dist/chunk-SJFT5OSX.js +0 -131
@@ -1,7 +1,8 @@
1
1
  import {
2
2
  MarkdownEditor
3
- } from "./chunk-TUXNOSCT.js";
4
- import "./chunk-PUZWLIIJ.js";
3
+ } from "./chunk-SO7IJZIR.js";
4
+ import "./chunk-KY6A5IJH.js";
5
+ import "./chunk-NZMUW5XI.js";
5
6
  export {
6
7
  MarkdownEditor
7
8
  };
@@ -1604,10 +1604,12 @@ function MenuEntry({
1604
1604
  ...withTitleTooltip({ title: collapsed ? item.title ?? (typeof item.label === "string" ? item.label : void 0) : item.title }),
1605
1605
  disabled: item.disabled,
1606
1606
  "aria-current": isSelected ? "page" : void 0,
1607
+ "data-applied": item.applied || void 0,
1607
1608
  "aria-expanded": hasChildren ? isOpen : void 0,
1608
1609
  onClick: (event) => hasChildren ? props.toggle(item.key) : props.select(item, path, event),
1609
1610
  children: [
1610
- reserveIcon ? /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("span", { className: "sia-menu__icon", "aria-hidden": !item.icon || void 0, children: item.icon }) : null,
1611
+ reserveIcon ? /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("span", { className: "sia-menu__icon", style: item.iconSize ? { width: item.iconSize, height: item.iconSize, flexBasis: item.iconSize } : void 0, "aria-hidden": !item.icon || void 0, children: item.icon }) : null,
1612
+ item.applied ? /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("span", { className: "sia-menu__applied", role: "img", "aria-label": item.appliedLabel ?? "\u5F53\u524D\u4F7F\u7528", children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Icon, { name: "circle-check", size: 32 }) }) : null,
1611
1613
  !collapsed ? /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("span", { className: "sia-menu__label", children: item.label }) : null,
1612
1614
  !collapsed && item.extra ? /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("span", { className: "sia-menu__extra", children: item.extra }) : null,
1613
1615
  !collapsed && hasChildren ? /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Icon, { className: "sia-menu__expand-icon", name: "chevron-down", size: 13 }) : null
@@ -1,10 +1,13 @@
1
1
  import {
2
2
  RichTextContent,
3
3
  RichTextEditor
4
- } from "./chunk-NURPAO7G.js";
5
- import "./chunk-V6CRVCSB.js";
6
- import "./chunk-SJFT5OSX.js";
7
- import "./chunk-PUZWLIIJ.js";
4
+ } from "./chunk-MMSYWDTR.js";
5
+ import "./chunk-4TTHKFJ7.js";
6
+ import "./chunk-SCEHVGKV.js";
7
+ import "./chunk-QV3AP6A2.js";
8
+ import "./chunk-CZ2ITBRW.js";
9
+ import "./chunk-KY6A5IJH.js";
10
+ import "./chunk-NZMUW5XI.js";
8
11
  export {
9
12
  RichTextContent,
10
13
  RichTextEditor
@@ -1,7 +1,7 @@
1
1
  import * as react from 'react';
2
2
  import { InputHTMLAttributes, ReactNode, HTMLAttributes, CSSProperties } from 'react';
3
3
  import { I as InputPlaceholderMode, C as ControlSize, a as ControlStatus } from './shared-Bx4B28Wh.cjs';
4
- import { S as SelectOption, m as SelectValue } from './Select-DQpfyK7I.cjs';
4
+ import { S as SelectOption, j as SelectValue } from './Select-Cf0xz1Tg.cjs';
5
5
 
6
6
  /** 日期选择附带的时间选择配置。 */
7
7
  type DatePickerShowTime = boolean | {
@@ -1,7 +1,7 @@
1
1
  import * as react from 'react';
2
2
  import { InputHTMLAttributes, ReactNode, HTMLAttributes, CSSProperties } from 'react';
3
3
  import { I as InputPlaceholderMode, C as ControlSize, a as ControlStatus } from './shared-Bx4B28Wh.js';
4
- import { S as SelectOption, m as SelectValue } from './Select-DmT9pFRW.js';
4
+ import { S as SelectOption, j as SelectValue } from './Select-BddM4uXC.js';
5
5
 
6
6
  /** 日期选择附带的时间选择配置。 */
7
7
  type DatePickerShowTime = boolean | {
@@ -1,4 +1,5 @@
1
- export { S as SelectDateRange, i as SelectDateRangeProps, j as SelectDateRangeValue } from './select-date-range-BT71tp7y.cjs';
1
+ export { S as SelectDateRange, i as SelectDateRangeProps, j as SelectDateRangeValue } from './select-date-range-Cm5o2xPp.cjs';
2
2
  import 'react';
3
3
  import './shared-Bx4B28Wh.cjs';
4
- import './Select-DQpfyK7I.cjs';
4
+ import './Select-Cf0xz1Tg.cjs';
5
+ import './Button-O_pNB3SQ.cjs';
@@ -1,4 +1,5 @@
1
- export { S as SelectDateRange, i as SelectDateRangeProps, j as SelectDateRangeValue } from './select-date-range-CFGzoyLs.js';
1
+ export { S as SelectDateRange, i as SelectDateRangeProps, j as SelectDateRangeValue } from './select-date-range-yGDEA1RP.js';
2
2
  import 'react';
3
3
  import './shared-Bx4B28Wh.js';
4
- import './Select-DmT9pFRW.js';
4
+ import './Select-BddM4uXC.js';
5
+ import './Button-BiL3Wjsd.js';
@@ -1,10 +1,13 @@
1
1
  import {
2
2
  SelectDateRange
3
- } from "./chunk-D456SSL3.js";
4
- import "./chunk-EYB55TC5.js";
5
- import "./chunk-V6CRVCSB.js";
6
- import "./chunk-SJFT5OSX.js";
7
- import "./chunk-PUZWLIIJ.js";
3
+ } from "./chunk-OJ2WDC66.js";
4
+ import "./chunk-D3HXXEEZ.js";
5
+ import "./chunk-4TTHKFJ7.js";
6
+ import "./chunk-SCEHVGKV.js";
7
+ import "./chunk-QV3AP6A2.js";
8
+ import "./chunk-CZ2ITBRW.js";
9
+ import "./chunk-KY6A5IJH.js";
10
+ import "./chunk-NZMUW5XI.js";
8
11
  export {
9
12
  SelectDateRange
10
13
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sia.soul/sia-react-ui",
3
- "version": "0.1.106",
3
+ "version": "0.1.107",
4
4
  "description": "Sia Design components and tokens for React",
5
5
  "publishConfig": {
6
6
  "access": "public",
@@ -44,14 +44,20 @@
44
44
  "import": "./dist/chart.js",
45
45
  "require": "./dist/chart.cjs"
46
46
  },
47
- "./styles.css": "./dist/index.css"
47
+ "./styles.css": "./dist/index.css",
48
+ "./game": {
49
+ "types": "./dist/game.d.ts",
50
+ "import": "./dist/game.js",
51
+ "require": "./dist/game.cjs"
52
+ },
53
+ "./game/styles.css": "./dist/game.css"
48
54
  },
49
55
  "files": [
50
56
  "dist",
51
57
  "THIRD_PARTY_NOTICES.md"
52
58
  ],
53
59
  "scripts": {
54
- "build": "tsup src/index.ts src/core.ts src/select-date-range.ts src/rich-text-editor.ts src/markdown-editor.ts src/chart.ts --format esm,cjs --dts --clean",
60
+ "build": "tsup src/index.ts src/core.ts src/select-date-range.ts src/rich-text-editor.ts src/markdown-editor.ts src/chart.ts src/game.ts --format esm,cjs --dts --clean",
55
61
  "typecheck": "tsc -p tsconfig.json",
56
62
  "prepublishOnly": "node ../../scripts/check-api-docs.cjs && pnpm typecheck && pnpm build && node ../../scripts/test-api-docs.cjs"
57
63
  },
@@ -1,131 +0,0 @@
1
- import {
2
- useControlSize,
3
- useFloatingPlaceholder,
4
- withTitleTooltip
5
- } from "./chunk-PUZWLIIJ.js";
6
-
7
- // src/components/Button.tsx
8
- import { forwardRef, useRef } from "react";
9
- import { jsx, jsxs } from "react/jsx-runtime";
10
- var Button = forwardRef(function Button2({
11
- variant = "default",
12
- size: sizeProp,
13
- loading = false,
14
- block = false,
15
- danger = false,
16
- icon,
17
- iconPosition = "start",
18
- className = "",
19
- children,
20
- disabled,
21
- onClick,
22
- style,
23
- ...props
24
- }, forwardedRef) {
25
- const size = useControlSize(sizeProp);
26
- const localRef = useRef(null);
27
- function setRef(node) {
28
- localRef.current = node;
29
- if (typeof forwardedRef === "function") forwardedRef(node);
30
- else if (forwardedRef) forwardedRef.current = node;
31
- }
32
- function handleClick(event) {
33
- const button = localRef.current;
34
- if (button && variant === "primary") {
35
- const rect = button.getBoundingClientRect();
36
- button.style.setProperty("--sia-wave-x", `${event.clientX - rect.left}px`);
37
- button.style.setProperty("--sia-wave-y", `${event.clientY - rect.top}px`);
38
- button.dataset.wave = "active";
39
- window.setTimeout(() => delete button.dataset.wave, 360);
40
- }
41
- onClick?.(event);
42
- }
43
- const mergedStyle = block ? { ...style, width: "100%" } : style ?? {};
44
- return /* @__PURE__ */ jsxs(
45
- "button",
46
- {
47
- ref: setRef,
48
- type: "button",
49
- className: `sia-button sia-button--${variant} sia-button--${size}${danger ? " sia-button--danger" : ""} ${className}`.trim(),
50
- "aria-busy": loading || void 0,
51
- disabled: disabled || loading,
52
- onClick: handleClick,
53
- style: mergedStyle,
54
- ...withTitleTooltip(props),
55
- children: [
56
- loading ? /* @__PURE__ */ jsx("span", { className: "sia-button__spinner", "aria-hidden": "true" }) : icon && iconPosition === "start" ? /* @__PURE__ */ jsx("span", { className: "sia-button__icon", children: icon }) : null,
57
- children !== void 0 && children !== null ? /* @__PURE__ */ jsx("span", { children }) : null,
58
- !loading && icon && iconPosition === "end" ? /* @__PURE__ */ jsx("span", { className: "sia-button__icon", children: icon }) : null
59
- ]
60
- }
61
- );
62
- });
63
-
64
- // src/components/TextArea.tsx
65
- import { forwardRef as forwardRef2, useId, useState } from "react";
66
- import { jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
67
- var TextArea = forwardRef2(function TextArea2({
68
- label,
69
- hint,
70
- status = "default",
71
- size: sizeProp,
72
- showCount = false,
73
- placeholder,
74
- placeholderMode,
75
- className = "",
76
- id,
77
- disabled,
78
- value,
79
- defaultValue,
80
- maxLength,
81
- onChange,
82
- ...props
83
- }, ref) {
84
- const size = useControlSize(sizeProp);
85
- const fallbackId = useId();
86
- const textAreaId = id ?? fallbackId;
87
- const [uncontrolledValue, setUncontrolledValue] = useState(() => defaultValue === void 0 ? "" : String(defaultValue));
88
- const currentText = value !== void 0 ? String(value) : uncontrolledValue;
89
- const floating = useFloatingPlaceholder({ mode: placeholderMode, placeholder, filled: currentText.length > 0 });
90
- const hintId = `${textAreaId}-hint`;
91
- const describedBy = [props["aria-describedby"], hint ? hintId : null].filter(Boolean).join(" ") || void 0;
92
- function handleChange(event) {
93
- setUncontrolledValue(event.target.value);
94
- onChange?.(event);
95
- }
96
- const control = /* @__PURE__ */ jsxs2("span", { className: `sia-textarea-control sia-textarea-control--${size} sia-textarea-control--${status}${floating.className}${disabled ? " is-disabled" : ""}`, children: [
97
- /* @__PURE__ */ jsx2(
98
- "textarea",
99
- {
100
- ...withTitleTooltip(props),
101
- ref,
102
- id: textAreaId,
103
- className: "sia-textarea",
104
- disabled,
105
- value,
106
- defaultValue,
107
- maxLength,
108
- placeholder,
109
- "aria-describedby": describedBy,
110
- "aria-invalid": status === "error" || void 0,
111
- onChange: handleChange
112
- }
113
- ),
114
- floating.label,
115
- showCount ? /* @__PURE__ */ jsxs2("span", { className: `sia-textarea-control__count${maxLength !== void 0 && currentText.length >= maxLength ? " is-limit" : ""}`, "aria-live": "polite", children: [
116
- currentText.length,
117
- maxLength !== void 0 ? `/${maxLength}` : null
118
- ] }) : null
119
- ] });
120
- if (!label && !hint) return /* @__PURE__ */ jsx2("span", { className: `sia-field ${className}`.trim(), children: control });
121
- return /* @__PURE__ */ jsxs2("span", { className: `sia-field ${className}`.trim(), children: [
122
- label ? /* @__PURE__ */ jsx2("label", { className: "sia-field__label", htmlFor: textAreaId, children: label }) : null,
123
- control,
124
- hint ? /* @__PURE__ */ jsx2("span", { id: hintId, className: `sia-field__hint sia-field__hint--${status}`, children: hint }) : null
125
- ] });
126
- });
127
-
128
- export {
129
- Button,
130
- TextArea
131
- };