@openworkbook/react 0.0.0-stage → 0.1.1

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.
@@ -0,0 +1,73 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+
20
+ // src/skeleton.tsx
21
+ var skeleton_exports = {};
22
+ __export(skeleton_exports, {
23
+ GridSkeleton: () => GridSkeleton,
24
+ SpreadsheetSkeleton: () => SpreadsheetSkeleton
25
+ });
26
+ module.exports = __toCommonJS(skeleton_exports);
27
+ var import_jsx_runtime = require("react/jsx-runtime");
28
+ var CSS = `
29
+ .osk{position:absolute;inset:0;z-index:5;overflow:hidden;display:flex;flex-direction:column;background:var(--osk-bg,var(--ox-bg,var(--os-bg,#fff)));--osk-line:var(--ox-border,var(--os-border,#e1e4e8));--osk-bar:var(--ox-hover,var(--os-hover,#eceef1));--osk-head:var(--ox-surface,var(--os-bar,#f5f6f7))}
30
+ .osk-dark{--osk-bg:#1f1f1f;--osk-line:#3a3a3a;--osk-bar:#333;--osk-head:#2a2a2a}
31
+ .osk-solo{position:relative;inset:auto;border:1px solid var(--osk-line);border-radius:6px}
32
+ .osk-head{flex:none;height:24px;background:var(--osk-head);border-bottom:1px solid var(--osk-line)}
33
+ .osk-body{flex:1;min-height:0;display:flex}
34
+ .osk-side{flex:none;width:46px;background:var(--osk-head);border-right:1px solid var(--osk-line)}
35
+ .osk-cells{flex:1;min-width:0;background-image:linear-gradient(var(--osk-line) 1px,transparent 1px),linear-gradient(90deg,var(--osk-line) 1px,transparent 1px);background-size:100% 24px,112px 100%;background-position:0 -1px,-1px 0}
36
+ .osk-row{display:flex;height:24px;align-items:center}
37
+ .osk-cell{flex:none;width:112px;padding:0 8px;box-sizing:border-box}
38
+ .osk-bar{height:10px;border-radius:5px;background:linear-gradient(90deg,var(--osk-bar) 25%,var(--osk-line) 37%,var(--osk-bar) 63%);background-size:400% 100%;animation:osk-shimmer 1.4s ease infinite}
39
+ .osk-label{position:absolute;left:50%;bottom:16px;transform:translateX(-50%);padding:4px 12px;border-radius:12px;font:12px/1.4 system-ui,sans-serif;color:var(--ox-fg,var(--os-fg,#444));background:var(--osk-head);border:1px solid var(--osk-line)}
40
+ @keyframes osk-shimmer{0%{background-position:100% 50%}100%{background-position:0 50%}}
41
+ @media (prefers-reduced-motion:reduce){.osk-bar{animation:none}}
42
+ `;
43
+ var ROWS = [
44
+ [70, 55, 60, 50, 65, 45],
45
+ [85, 40, 45, 35, 50, 0],
46
+ [60, 45, 40, 45, 40, 30],
47
+ [75, 35, 50, 40, 55, 0],
48
+ [50, 50, 45, 30, 45, 35],
49
+ [80, 40, 35, 45, 50, 0],
50
+ [65, 45, 50, 35, 40, 30],
51
+ [55, 35, 45, 40, 55, 0],
52
+ [70, 50, 40, 45, 45, 0],
53
+ [45, 0, 0, 0, 60, 40]
54
+ ];
55
+ function GridSkeleton({ label, loadingLabel = "Loading", dark, className, style }) {
56
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: `osk${dark ? " osk-dark" : ""}${className ? " " + className : ""}`, style, role: "status", "aria-busy": "true", "aria-live": "polite", "aria-label": label || loadingLabel, children: [
57
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("style", { children: CSS }),
58
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "osk-head" }),
59
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "osk-body", children: [
60
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "osk-side" }),
61
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "osk-cells", "aria-hidden": "true", children: ROWS.map((row, r) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "osk-row", children: row.map((w, c) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "osk-cell", style: c > 0 ? { display: "flex", justifyContent: "flex-end" } : void 0, children: w > 0 && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "osk-bar", style: { width: `${w}%`, animationDelay: `${(r + c) * 40}ms` } }) }, c)) }, r)) })
62
+ ] }),
63
+ label && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "osk-label", children: label })
64
+ ] });
65
+ }
66
+ function SpreadsheetSkeleton({ height = 480, className, style, ...rest }) {
67
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(GridSkeleton, { ...rest, className: `osk-solo${className ? " " + className : ""}`, style: { height, ...style } });
68
+ }
69
+ // Annotate the CommonJS export names for ESM import in node:
70
+ 0 && (module.exports = {
71
+ GridSkeleton,
72
+ SpreadsheetSkeleton
73
+ });
@@ -0,0 +1,21 @@
1
+ import React from 'react';
2
+
3
+ interface GridSkeletonProps {
4
+ /** Text shown in a small pill at the bottom (for example "Opening report.xlsx…"); also the accessible name. */
5
+ label?: string;
6
+ /** Accessible name when there is no `label` (default "Loading"; pass a translated text). */
7
+ loadingLabel?: string;
8
+ dark?: boolean;
9
+ className?: string;
10
+ style?: React.CSSProperties;
11
+ }
12
+ /** Fills the nearest positioned ancestor. */
13
+ declare function GridSkeleton({ label, loadingLabel, dark, className, style }: GridSkeletonProps): React.JSX.Element;
14
+ interface SpreadsheetSkeletonProps extends GridSkeletonProps {
15
+ /** Default 480. */
16
+ height?: number | string;
17
+ }
18
+ /** Standalone placeholder with its own box, for `next/dynamic({ loading })`, `<Suspense fallback>` or `loading.tsx`. */
19
+ declare function SpreadsheetSkeleton({ height, className, style, ...rest }: SpreadsheetSkeletonProps): React.JSX.Element;
20
+
21
+ export { GridSkeleton, type GridSkeletonProps, SpreadsheetSkeleton, type SpreadsheetSkeletonProps };
@@ -0,0 +1,21 @@
1
+ import React from 'react';
2
+
3
+ interface GridSkeletonProps {
4
+ /** Text shown in a small pill at the bottom (for example "Opening report.xlsx…"); also the accessible name. */
5
+ label?: string;
6
+ /** Accessible name when there is no `label` (default "Loading"; pass a translated text). */
7
+ loadingLabel?: string;
8
+ dark?: boolean;
9
+ className?: string;
10
+ style?: React.CSSProperties;
11
+ }
12
+ /** Fills the nearest positioned ancestor. */
13
+ declare function GridSkeleton({ label, loadingLabel, dark, className, style }: GridSkeletonProps): React.JSX.Element;
14
+ interface SpreadsheetSkeletonProps extends GridSkeletonProps {
15
+ /** Default 480. */
16
+ height?: number | string;
17
+ }
18
+ /** Standalone placeholder with its own box, for `next/dynamic({ loading })`, `<Suspense fallback>` or `loading.tsx`. */
19
+ declare function SpreadsheetSkeleton({ height, className, style, ...rest }: SpreadsheetSkeletonProps): React.JSX.Element;
20
+
21
+ export { GridSkeleton, type GridSkeletonProps, SpreadsheetSkeleton, type SpreadsheetSkeletonProps };
@@ -0,0 +1,47 @@
1
+ // src/skeleton.tsx
2
+ import { jsx, jsxs } from "react/jsx-runtime";
3
+ var CSS = `
4
+ .osk{position:absolute;inset:0;z-index:5;overflow:hidden;display:flex;flex-direction:column;background:var(--osk-bg,var(--ox-bg,var(--os-bg,#fff)));--osk-line:var(--ox-border,var(--os-border,#e1e4e8));--osk-bar:var(--ox-hover,var(--os-hover,#eceef1));--osk-head:var(--ox-surface,var(--os-bar,#f5f6f7))}
5
+ .osk-dark{--osk-bg:#1f1f1f;--osk-line:#3a3a3a;--osk-bar:#333;--osk-head:#2a2a2a}
6
+ .osk-solo{position:relative;inset:auto;border:1px solid var(--osk-line);border-radius:6px}
7
+ .osk-head{flex:none;height:24px;background:var(--osk-head);border-bottom:1px solid var(--osk-line)}
8
+ .osk-body{flex:1;min-height:0;display:flex}
9
+ .osk-side{flex:none;width:46px;background:var(--osk-head);border-right:1px solid var(--osk-line)}
10
+ .osk-cells{flex:1;min-width:0;background-image:linear-gradient(var(--osk-line) 1px,transparent 1px),linear-gradient(90deg,var(--osk-line) 1px,transparent 1px);background-size:100% 24px,112px 100%;background-position:0 -1px,-1px 0}
11
+ .osk-row{display:flex;height:24px;align-items:center}
12
+ .osk-cell{flex:none;width:112px;padding:0 8px;box-sizing:border-box}
13
+ .osk-bar{height:10px;border-radius:5px;background:linear-gradient(90deg,var(--osk-bar) 25%,var(--osk-line) 37%,var(--osk-bar) 63%);background-size:400% 100%;animation:osk-shimmer 1.4s ease infinite}
14
+ .osk-label{position:absolute;left:50%;bottom:16px;transform:translateX(-50%);padding:4px 12px;border-radius:12px;font:12px/1.4 system-ui,sans-serif;color:var(--ox-fg,var(--os-fg,#444));background:var(--osk-head);border:1px solid var(--osk-line)}
15
+ @keyframes osk-shimmer{0%{background-position:100% 50%}100%{background-position:0 50%}}
16
+ @media (prefers-reduced-motion:reduce){.osk-bar{animation:none}}
17
+ `;
18
+ var ROWS = [
19
+ [70, 55, 60, 50, 65, 45],
20
+ [85, 40, 45, 35, 50, 0],
21
+ [60, 45, 40, 45, 40, 30],
22
+ [75, 35, 50, 40, 55, 0],
23
+ [50, 50, 45, 30, 45, 35],
24
+ [80, 40, 35, 45, 50, 0],
25
+ [65, 45, 50, 35, 40, 30],
26
+ [55, 35, 45, 40, 55, 0],
27
+ [70, 50, 40, 45, 45, 0],
28
+ [45, 0, 0, 0, 60, 40]
29
+ ];
30
+ function GridSkeleton({ label, loadingLabel = "Loading", dark, className, style }) {
31
+ return /* @__PURE__ */ jsxs("div", { className: `osk${dark ? " osk-dark" : ""}${className ? " " + className : ""}`, style, role: "status", "aria-busy": "true", "aria-live": "polite", "aria-label": label || loadingLabel, children: [
32
+ /* @__PURE__ */ jsx("style", { children: CSS }),
33
+ /* @__PURE__ */ jsx("div", { className: "osk-head" }),
34
+ /* @__PURE__ */ jsxs("div", { className: "osk-body", children: [
35
+ /* @__PURE__ */ jsx("div", { className: "osk-side" }),
36
+ /* @__PURE__ */ jsx("div", { className: "osk-cells", "aria-hidden": "true", children: ROWS.map((row, r) => /* @__PURE__ */ jsx("div", { className: "osk-row", children: row.map((w, c) => /* @__PURE__ */ jsx("div", { className: "osk-cell", style: c > 0 ? { display: "flex", justifyContent: "flex-end" } : void 0, children: w > 0 && /* @__PURE__ */ jsx("div", { className: "osk-bar", style: { width: `${w}%`, animationDelay: `${(r + c) * 40}ms` } }) }, c)) }, r)) })
37
+ ] }),
38
+ label && /* @__PURE__ */ jsx("div", { className: "osk-label", children: label })
39
+ ] });
40
+ }
41
+ function SpreadsheetSkeleton({ height = 480, className, style, ...rest }) {
42
+ return /* @__PURE__ */ jsx(GridSkeleton, { ...rest, className: `osk-solo${className ? " " + className : ""}`, style: { height, ...style } });
43
+ }
44
+ export {
45
+ GridSkeleton,
46
+ SpreadsheetSkeleton
47
+ };
package/package.json CHANGED
@@ -1,6 +1,73 @@
1
1
  {
2
2
  "name": "@openworkbook/react",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
3
+ "version": "0.1.1",
4
+ "description": "React / Next.js spreadsheet component for OpenWorkbook",
5
+ "license": "MIT",
6
+ "engines": {
7
+ "node": ">=18"
8
+ },
9
+ "type": "module",
10
+ "main": "./dist/index.cjs",
11
+ "module": "./dist/index.js",
12
+ "types": "./dist/index.d.ts",
13
+ "exports": {
14
+ ".": {
15
+ "types": "./dist/index.d.ts",
16
+ "import": "./dist/index.js",
17
+ "require": "./dist/index.cjs"
18
+ },
19
+ "./skeleton": {
20
+ "types": "./dist/skeleton.d.ts",
21
+ "import": "./dist/skeleton.js",
22
+ "require": "./dist/skeleton.cjs"
23
+ },
24
+ "./dictionaries/en": {
25
+ "types": "./dist/dictionaries/en.d.ts",
26
+ "import": "./dist/dictionaries/en.js",
27
+ "require": "./dist/dictionaries/en.cjs"
28
+ },
29
+ "./dictionaries/en-GB": {
30
+ "types": "./dist/dictionaries/en-GB.d.ts",
31
+ "import": "./dist/dictionaries/en-GB.js",
32
+ "require": "./dist/dictionaries/en-GB.cjs"
33
+ }
34
+ },
35
+ "files": [
36
+ "dist",
37
+ "THIRD-PARTY-NOTICES.md"
38
+ ],
39
+ "sideEffects": false,
40
+ "dependencies": {
41
+ "@openworkbook/core": "0.1.1"
42
+ },
43
+ "peerDependencies": {
44
+ "react": ">=18",
45
+ "react-dom": ">=18"
46
+ },
47
+ "devDependencies": {
48
+ "@types/react": "^18.3.12",
49
+ "@types/react-dom": "^18.3.1",
50
+ "react": "^18.3.1",
51
+ "react-dom": "^18.3.1"
52
+ },
53
+ "homepage": "https://openworkbook.netlify.app",
54
+ "keywords": [
55
+ "spreadsheet",
56
+ "excel",
57
+ "react",
58
+ "nextjs",
59
+ "react-component",
60
+ "data-grid",
61
+ "workbook",
62
+ "ribbon"
63
+ ],
64
+ "publishConfig": {
65
+ "access": "public"
66
+ },
67
+ "scripts": {
68
+ "build": "node -e \"require('fs').rmSync('dist',{recursive:true,force:true})\" && tsup",
69
+ "test": "vitest run",
70
+ "typecheck": "tsc -p tsconfig.json",
71
+ "sync:core": "node scripts/sync-core-exports.cjs"
72
+ }
6
73
  }