@skygraph/react 0.4.0 → 0.5.0

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 ADDED
@@ -0,0 +1,70 @@
1
+ # @skygraph/react
2
+
3
+ React adapter for [SkyGraph](https://skygraph.ruslansinkevich.ru/) — 78+ components, hooks and `ConfigProvider` built on the framework-agnostic [`@skygraph/core`](../core) engine. Shares the `.sg-*` CSS contract with the Vue and Angular adapters via [`@skygraph/styles`](../styles).
4
+
5
+ > **Easier path — the meta-package:**
6
+ >
7
+ > ```bash
8
+ > npm install skygraph-react
9
+ > ```
10
+ >
11
+ > The meta-package re-exports everything below and auto-loads the CSS as a side effect. No separate `@skygraph/core` install, no manual `import '@skygraph/styles'`. Use this package directly only when you need fine-grained control over the install set.
12
+
13
+ ## Install (direct)
14
+
15
+ ```bash
16
+ npm install @skygraph/react @skygraph/core
17
+ ```
18
+
19
+ ```ts
20
+ import '@skygraph/styles'
21
+ import { Form, Field, SubmitButton } from '@skygraph/react'
22
+
23
+ export function App() {
24
+ return (
25
+ <Form
26
+ defaultValues={{ email: '' }}
27
+ onSubmit={(values) => console.log(values)}
28
+ >
29
+ <Field name="email" label="Email" rules={[{ type: 'email' }]} />
30
+ <SubmitButton>Submit</SubmitButton>
31
+ </Form>
32
+ )
33
+ }
34
+ ```
35
+
36
+ ## Components (78+)
37
+
38
+ **Data entry:** Button, Input, InputNumber, Textarea, Select, Checkbox, Radio, Switch, Slider, DatePicker, TimePicker, AutoComplete, Rate, Upload, ColorPicker, Cascader, TreeSelect, Mentions
39
+
40
+ **Data display:** Table, DataGrid, Tree, List, Tabs, Collapse, Descriptions, Badge, Tag, Avatar, Calendar, Carousel, Timeline, Steps, Segmented, Skeleton, Diagram
41
+
42
+ **Visualization:** LineChart, BarChart, AreaChart, PieChart, Dashboard, DashboardEditor, Gantt, EventTimeline, ResourceCalendar
43
+
44
+ **Feedback:** Modal, Drawer, Notification, Popconfirm, Tooltip, Progress, Spin, Result, Empty
45
+
46
+ **Navigation:** Menu, Breadcrumb, Dropdown, Pagination, Transfer
47
+
48
+ **Form:** Form, Field, FormList, FormProvider, SchemaForm, SchemaFormEditor, AutoField, SubmitButton
49
+
50
+ **Utility:** Transition (CSS-class-based animations)
51
+
52
+ ## Subpath exports
53
+
54
+ | Subpath | Use |
55
+ |---|---|
56
+ | `@skygraph/react` | Full bundle |
57
+ | `@skygraph/react/form` | Form primitives only |
58
+ | `@skygraph/react/table` | Table primitives only |
59
+ | `@skygraph/react/tree` | Tree primitives only |
60
+ | `@skygraph/react/virtual` | Virtual-scroll helpers |
61
+ | `@skygraph/react/datagrid` | DataGrid |
62
+ | `@skygraph/react/devtools` | Optional devtools panel |
63
+
64
+ ## Repository
65
+
66
+ [github.com/RuslanSinkevich/skygraph-public](https://github.com/RuslanSinkevich/skygraph-public)
67
+
68
+ ## License
69
+
70
+ MIT
@@ -131,6 +131,8 @@ interface TableLocale {
131
131
  filterOpIsEmpty?: string;
132
132
  /** Operator label: is not empty. */
133
133
  filterOpIsNotEmpty?: string;
134
+ /** Accessible label for the filter-operator `<Select>`. */
135
+ filterOperatorAriaLabel?: string;
134
136
  }
135
137
  /** Locale strings for the DataGrid component. */
136
138
  interface DataGridLocale {
@@ -131,6 +131,8 @@ interface TableLocale {
131
131
  filterOpIsEmpty?: string;
132
132
  /** Operator label: is not empty. */
133
133
  filterOpIsNotEmpty?: string;
134
+ /** Accessible label for the filter-operator `<Select>`. */
135
+ filterOperatorAriaLabel?: string;
134
136
  }
135
137
  /** Locale strings for the DataGrid component. */
136
138
  interface DataGridLocale {
@@ -46,6 +46,7 @@ function Checkbox({
46
46
  onChange: (e) => onChange?.(e.target.checked)
47
47
  }
48
48
  ),
49
+ !unstyled && /* @__PURE__ */ jsx("span", { className: "sg-checkbox-box", "aria-hidden": true }),
49
50
  children && /* @__PURE__ */ jsx("span", { className: unstyled ? "" : "sg-checkbox-label", children }),
50
51
  loading && /* @__PURE__ */ jsx(Spin, { size: "small", unstyled })
51
52
  ] });
@@ -54,4 +55,4 @@ function Checkbox({
54
55
  export {
55
56
  Checkbox
56
57
  };
57
- //# sourceMappingURL=chunk-DRBAZI46.js.map
58
+ //# sourceMappingURL=chunk-FSV73JI4.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/components/ui/Checkbox.tsx"],"sourcesContent":["import React from 'react'\nimport { useConfig } from '../ConfigProvider'\nimport type { BaseComponentProps, InteractiveProps } from '../../types'\nimport { Spin } from './Spin'\n\n/** Props for the Checkbox component. */\nexport interface CheckboxProps extends BaseComponentProps, InteractiveProps {\n /** Controlled checked state. */\n checked?: boolean\n /** Uncontrolled initial checked state. */\n defaultChecked?: boolean\n /** Renders the native checkbox in indeterminate state. */\n indeterminate?: boolean\n /** Called when the checked state changes. */\n onChange?: (checked: boolean) => void\n /** Label content beside the control. */\n children?: React.ReactNode\n}\n\n/** Labeled checkbox with indeterminate support and optional loading state. */\nexport function Checkbox({\n checked,\n defaultChecked,\n disabled: disabledProp,\n loading,\n indeterminate,\n onChange,\n children,\n className,\n style,\n unstyled,\n}: CheckboxProps) {\n const config = useConfig()\n const disabled = disabledProp ?? config.disabled ?? false\n\n const inputRef = React.useRef<HTMLInputElement>(null)\n\n React.useEffect(() => {\n if (inputRef.current) {\n inputRef.current.indeterminate = indeterminate ?? false\n }\n }, [indeterminate])\n\n const wrapperClass = unstyled\n ? (className ?? '')\n : [\n 'sg-checkbox',\n disabled || loading ? 'sg-checkbox-disabled' : '',\n loading ? 'sg-checkbox-loading' : '',\n className,\n ]\n .filter(Boolean)\n .join(' ')\n\n return (\n <label className={wrapperClass} style={style}>\n <input\n ref={inputRef}\n type=\"checkbox\"\n aria-checked={checked}\n className={unstyled ? '' : 'sg-checkbox-input'}\n checked={checked}\n defaultChecked={defaultChecked}\n disabled={disabled || loading}\n onChange={(e) => onChange?.(e.target.checked)}\n />\n {!unstyled && <span className=\"sg-checkbox-box\" aria-hidden />}\n {children && <span className={unstyled ? '' : 'sg-checkbox-label'}>{children}</span>}\n {loading && <Spin size=\"small\" unstyled={unstyled} />}\n </label>\n )\n}\n"],"mappings":";;;;;;AAAA,OAAO,WAAW;AAuDd,SACE,KADF;AAnCG,SAAS,SAAS;AAAA,EACvB;AAAA,EACA;AAAA,EACA,UAAU;AAAA,EACV;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,GAAkB;AAChB,QAAM,SAAS,UAAU;AACzB,QAAM,WAAW,gBAAgB,OAAO,YAAY;AAEpD,QAAM,WAAW,MAAM,OAAyB,IAAI;AAEpD,QAAM,UAAU,MAAM;AACpB,QAAI,SAAS,SAAS;AACpB,eAAS,QAAQ,gBAAgB,iBAAiB;AAAA,IACpD;AAAA,EACF,GAAG,CAAC,aAAa,CAAC;AAElB,QAAM,eAAe,WAChB,aAAa,KACd;AAAA,IACE;AAAA,IACA,YAAY,UAAU,yBAAyB;AAAA,IAC/C,UAAU,wBAAwB;AAAA,IAClC;AAAA,EACF,EACG,OAAO,OAAO,EACd,KAAK,GAAG;AAEf,SACE,qBAAC,WAAM,WAAW,cAAc,OAC9B;AAAA;AAAA,MAAC;AAAA;AAAA,QACC,KAAK;AAAA,QACL,MAAK;AAAA,QACL,gBAAc;AAAA,QACd,WAAW,WAAW,KAAK;AAAA,QAC3B;AAAA,QACA;AAAA,QACA,UAAU,YAAY;AAAA,QACtB,UAAU,CAAC,MAAM,WAAW,EAAE,OAAO,OAAO;AAAA;AAAA,IAC9C;AAAA,IACC,CAAC,YAAY,oBAAC,UAAK,WAAU,mBAAkB,eAAW,MAAC;AAAA,IAC3D,YAAY,oBAAC,UAAK,WAAW,WAAW,KAAK,qBAAsB,UAAS;AAAA,IAC5E,WAAW,oBAAC,QAAK,MAAK,SAAQ,UAAoB;AAAA,KACrD;AAEJ;","names":[]}
@@ -5,7 +5,7 @@ import {
5
5
  } from "./chunk-ZJF6SJLP.js";
6
6
  import {
7
7
  Checkbox
8
- } from "./chunk-DRBAZI46.js";
8
+ } from "./chunk-FSV73JI4.js";
9
9
  import {
10
10
  Spin,
11
11
  useConfig
@@ -1050,7 +1050,7 @@ function AdvancedFilterPanel({ col, t, state, actions, filterRef }) {
1050
1050
  value: draftOp,
1051
1051
  onChange: (v) => setDraftOp(v),
1052
1052
  options: ops.map((op) => ({ label: operatorLabel(op, t), value: op })),
1053
- "aria-label": "Filter operator"
1053
+ "aria-label": t.filterOperatorAriaLabel
1054
1054
  }
1055
1055
  ) }),
1056
1056
  showValueInput && /* @__PURE__ */ jsx3("div", { className: "sg-table-filter-advanced-row", children: /* @__PURE__ */ jsx3(
@@ -1306,7 +1306,7 @@ function TableHeader(props) {
1306
1306
  className: ["sg-table-th-content", sCls.headerCellContent].filter(Boolean).join(" "),
1307
1307
  style: sSty.headerCellContent,
1308
1308
  children: [
1309
- cell.col.title,
1309
+ /* @__PURE__ */ jsx4("span", { className: "sg-table-th-title", children: cell.col.title }),
1310
1310
  isLeaf && cell.col.tooltip && /* @__PURE__ */ jsx4(ColumnTooltip, { content: cell.col.tooltip }),
1311
1311
  isLeaf && /* @__PURE__ */ jsx4(SortIndicator, { col: cell.col, ...sortProps })
1312
1312
  ]
@@ -1375,7 +1375,7 @@ function TableHeader(props) {
1375
1375
  className: ["sg-table-th-content", sCls.headerCellContent].filter(Boolean).join(" "),
1376
1376
  style: sSty.headerCellContent,
1377
1377
  children: [
1378
- col.title,
1378
+ /* @__PURE__ */ jsx4("span", { className: "sg-table-th-title", children: col.title }),
1379
1379
  col.tooltip && /* @__PURE__ */ jsx4(ColumnTooltip, { content: col.tooltip }),
1380
1380
  /* @__PURE__ */ jsx4(SortIndicator, { col, ...sortProps })
1381
1381
  ]
@@ -1832,7 +1832,9 @@ function VirtualTableBody(props) {
1832
1832
  if (!el) return;
1833
1833
  setViewportHeight(el.clientHeight);
1834
1834
  setScrollTop(el.scrollTop);
1835
- const onScroll = () => setScrollTop(el.scrollTop);
1835
+ const onScroll = () => {
1836
+ setScrollTop(el.scrollTop);
1837
+ };
1836
1838
  el.addEventListener("scroll", onScroll, { passive: true });
1837
1839
  let ro = null;
1838
1840
  if (typeof ResizeObserver !== "undefined") {
@@ -2357,7 +2359,8 @@ var DEFAULT_LOCALE = {
2357
2359
  filterOpStartsWith: "starts with",
2358
2360
  filterOpEndsWith: "ends with",
2359
2361
  filterOpIsEmpty: "is empty",
2360
- filterOpIsNotEmpty: "is not empty"
2362
+ filterOpIsNotEmpty: "is not empty",
2363
+ filterOperatorAriaLabel: "Filter operator"
2361
2364
  };
2362
2365
  var DEFAULT_COL_WIDTH = 150;
2363
2366
  var MIN_COL_WIDTH = 50;
@@ -3788,4 +3791,4 @@ export {
3788
3791
  printElement,
3789
3792
  Table
3790
3793
  };
3791
- //# sourceMappingURL=chunk-MJAEAFPN.js.map
3794
+ //# sourceMappingURL=chunk-NXB3VAVF.js.map