@macrostrat/data-sheet 3.0.1 → 3.0.2
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/CHANGELOG.md +5 -0
- package/dist/components/colors.cjs +1 -41
- package/dist/components/colors.cjs.map +1 -1
- package/dist/components/colors.d.ts +2 -17
- package/dist/components/colors.js +3 -43
- package/dist/components/colors.js.map +1 -1
- package/dist/components/main.module.sass.cjs +9 -10
- package/dist/components/main.module.sass.cjs.map +1 -1
- package/dist/components/main.module.sass.js +9 -10
- package/dist/components/main.module.sass.js.map +1 -1
- package/dist/data-sheet.css +10 -14
- package/package.json +14 -11
- package/src/components/colors.ts +4 -54
- package/src/components/main.module.sass +0 -6
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,11 @@ All notable changes to this project will be documented in this file. The format
|
|
|
4
4
|
is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this
|
|
5
5
|
project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
6
6
|
|
|
7
|
+
## [3.0.2] - 2026-01-29
|
|
8
|
+
|
|
9
|
+
- Change layout of `package.json` and remove `@uiw/react-color` dependency in
|
|
10
|
+
favor of `@macrostrat/ui-components` color picker
|
|
11
|
+
|
|
7
12
|
## [3.0.1] - 2026-01-28
|
|
8
13
|
|
|
9
14
|
Update handling of `@uiw/react-color` dependency
|
|
@@ -5,13 +5,12 @@ const uiComponents = require("@macrostrat/ui-components");
|
|
|
5
5
|
const hyper = require("@macrostrat/hyper");
|
|
6
6
|
const main_module = require("./main.module.sass.cjs");
|
|
7
7
|
const colorUtils = require("@macrostrat/color-utils");
|
|
8
|
-
const react = require("react");
|
|
9
8
|
const underscore = require("underscore");
|
|
10
|
-
const reactColor = require("@uiw/react-color");
|
|
11
9
|
const classNames = require("classnames");
|
|
12
10
|
const _interopDefault = (e) => e && e.__esModule ? e : { default: e };
|
|
13
11
|
const hyper__default = /* @__PURE__ */ _interopDefault(hyper);
|
|
14
12
|
const classNames__default = /* @__PURE__ */ _interopDefault(classNames);
|
|
13
|
+
const ColorPicker = uiComponents.ColorPicker2;
|
|
15
14
|
const h = hyper__default.default.styled(main_module.default);
|
|
16
15
|
function ColorCell({
|
|
17
16
|
value,
|
|
@@ -60,45 +59,6 @@ function colorSwatchRenderer(value) {
|
|
|
60
59
|
]);
|
|
61
60
|
}
|
|
62
61
|
const colorCombo = underscore.memoize(colorUtils.getLuminanceAdjustedColorScheme);
|
|
63
|
-
function ColorPicker({
|
|
64
|
-
value,
|
|
65
|
-
onChange,
|
|
66
|
-
editable = true,
|
|
67
|
-
type = "css"
|
|
68
|
-
/* CSS */
|
|
69
|
-
}) {
|
|
70
|
-
const ref = react.useRef(null);
|
|
71
|
-
react.useEffect(() => {
|
|
72
|
-
if (ref.current == null) return;
|
|
73
|
-
ref.current.focus();
|
|
74
|
-
}, []);
|
|
75
|
-
const color = react.useMemo(() => {
|
|
76
|
-
try {
|
|
77
|
-
return colorUtils.asChromaColor(value).hex();
|
|
78
|
-
} catch {
|
|
79
|
-
return "#aaaaaa";
|
|
80
|
-
}
|
|
81
|
-
}, [value]);
|
|
82
|
-
return h(
|
|
83
|
-
"div.color-picker-container",
|
|
84
|
-
{
|
|
85
|
-
onKeyDown(evt) {
|
|
86
|
-
if (evt.key === "Escape") {
|
|
87
|
-
evt.preventDefault();
|
|
88
|
-
}
|
|
89
|
-
},
|
|
90
|
-
ref,
|
|
91
|
-
tabIndex: 0
|
|
92
|
-
},
|
|
93
|
-
h(reactColor.Sketch, {
|
|
94
|
-
color,
|
|
95
|
-
disableAlpha: true,
|
|
96
|
-
onChange(color2) {
|
|
97
|
-
onChange(colorUtils.asChromaColor(color2.hexa)[type]());
|
|
98
|
-
}
|
|
99
|
-
})
|
|
100
|
-
);
|
|
101
|
-
}
|
|
102
62
|
exports.ColorCell = ColorCell;
|
|
103
63
|
exports.ColorPicker = ColorPicker;
|
|
104
64
|
exports.colorSwatchRenderer = colorSwatchRenderer;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"colors.cjs","sources":["../../src/components/colors.ts"],"sourcesContent":["import { Cell } from \"@blueprintjs/table\";\nimport { useInDarkMode } from \"@macrostrat/ui-components\";\nimport hyper from \"@macrostrat/hyper\";\nimport styles from \"./main.module.sass\";\nimport {
|
|
1
|
+
{"version":3,"file":"colors.cjs","sources":["../../src/components/colors.ts"],"sourcesContent":["import { Cell } from \"@blueprintjs/table\";\nimport { useInDarkMode } from \"@macrostrat/ui-components\";\nimport hyper from \"@macrostrat/hyper\";\nimport styles from \"./main.module.sass\";\nimport { getLuminanceAdjustedColorScheme } from \"@macrostrat/color-utils\";\nimport { memoize } from \"underscore\";\nimport classNames from \"classnames\";\nimport { ColorPicker2 } from \"@macrostrat/ui-components\";\n\nexport const ColorPicker = ColorPicker2;\n\nconst h = hyper.styled(styles);\n\nexport function ColorCell({\n value,\n children,\n style,\n intent,\n adjustLuminance = true,\n className,\n ...rest\n}) {\n const darkMode = useInDarkMode();\n\n const _className = classNames(className, \"color-cell\");\n\n let mainColor = \"var(--text-color)\";\n let backgroundColor = value;\n\n if (adjustLuminance) {\n // If adjustLuminance is true, get the color scheme based on the value\n let colors = colorCombo(value, darkMode, 0.05);\n if (colors != null) {\n mainColor = colors.mainColor;\n backgroundColor = colors.backgroundColor;\n }\n }\n\n if (intent != null) {\n // If an intent is specified, override the main color\n mainColor = undefined;\n }\n\n return h(\n Cell,\n {\n intent,\n className: _className,\n ...rest,\n style: {\n color: mainColor,\n backgroundColor,\n ...style,\n },\n },\n children,\n );\n}\n\nexport function colorSwatchRenderer(value) {\n return h(\"span.color-swatch-container\", [\n h(\"span.color-swatch\", {\n style: { backgroundColor: value },\n }),\n h(\"span.color-name\", value),\n ]);\n}\n\nconst colorCombo = memoize(getLuminanceAdjustedColorScheme);\n"],"names":["ColorPicker2","hyper","styles","useInDarkMode","classNames","Cell","memoize","getLuminanceAdjustedColorScheme"],"mappings":";;;;;;;;;;;;AASO,MAAM,cAAcA,aAAAA;AAE3B,MAAM,IAAIC,eAAAA,QAAM,OAAOC,mBAAM;AAEtB,SAAS,UAAU;AAAA,EACxB;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,kBAAkB;AAAA,EAClB;AAAA,EACA,GAAG;AACL,GAAG;AACD,QAAM,WAAWC,aAAAA,cAAA;AAEjB,QAAM,aAAaC,oBAAAA,QAAW,WAAW,YAAY;AAErD,MAAI,YAAY;AAChB,MAAI,kBAAkB;AAEtB,MAAI,iBAAiB;AAEnB,QAAI,SAAS,WAAW,OAAO,UAAU,IAAI;AAC7C,QAAI,UAAU,MAAM;AAClB,kBAAY,OAAO;AACnB,wBAAkB,OAAO;AAAA,IAC3B;AAAA,EACF;AAEA,MAAI,UAAU,MAAM;AAElB,gBAAY;AAAA,EACd;AAEA,SAAO;AAAA,IACLC,MAAAA;AAAAA,IACA;AAAA,MACE;AAAA,MACA,WAAW;AAAA,MACX,GAAG;AAAA,MACH,OAAO;AAAA,QACL,OAAO;AAAA,QACP;AAAA,QACA,GAAG;AAAA,MAAA;AAAA,IACL;AAAA,IAEF;AAAA,EAAA;AAEJ;AAEO,SAAS,oBAAoB,OAAO;AACzC,SAAO,EAAE,+BAA+B;AAAA,IACtC,EAAE,qBAAqB;AAAA,MACrB,OAAO,EAAE,iBAAiB,MAAA;AAAA,IAAM,CACjC;AAAA,IACD,EAAE,mBAAmB,KAAK;AAAA,EAAA,CAC3B;AACH;AAEA,MAAM,aAAaC,WAAAA,QAAQC,0CAA+B;;;;"}
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { ColorPicker2 } from '@macrostrat/ui-components';
|
|
2
|
+
export declare const ColorPicker: typeof ColorPicker2;
|
|
1
3
|
export declare function ColorCell({ value, children, style, intent, adjustLuminance, className, ...rest }: {
|
|
2
4
|
[x: string]: any;
|
|
3
5
|
value: any;
|
|
@@ -8,20 +10,3 @@ export declare function ColorCell({ value, children, style, intent, adjustLumina
|
|
|
8
10
|
className: any;
|
|
9
11
|
}): import('react').DetailedReactHTMLElement<import('react').InputHTMLAttributes<HTMLInputElement>, HTMLInputElement>;
|
|
10
12
|
export declare function colorSwatchRenderer(value: any): import('react').DOMElement<import('react').DOMAttributes<Element>, Element>;
|
|
11
|
-
declare enum ColorConversionType {
|
|
12
|
-
HEX = "hex",
|
|
13
|
-
RGB = "rgb",
|
|
14
|
-
HSL = "hsl",
|
|
15
|
-
CSS = "css"
|
|
16
|
-
}
|
|
17
|
-
export declare function ColorPicker({ value, onChange, editable, type, }: {
|
|
18
|
-
value: any;
|
|
19
|
-
onChange: any;
|
|
20
|
-
editable?: boolean;
|
|
21
|
-
type?: ColorConversionType;
|
|
22
|
-
}): import('react').DOMElement<{
|
|
23
|
-
onKeyDown(evt: import('react').KeyboardEvent<any>): void;
|
|
24
|
-
ref: import('react').MutableRefObject<any>;
|
|
25
|
-
tabIndex: number;
|
|
26
|
-
}, any>;
|
|
27
|
-
export {};
|
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
import { Cell } from "@blueprintjs/table";
|
|
2
|
-
import { useInDarkMode } from "@macrostrat/ui-components";
|
|
2
|
+
import { ColorPicker2, useInDarkMode } from "@macrostrat/ui-components";
|
|
3
3
|
import hyper from "@macrostrat/hyper";
|
|
4
4
|
import styles from "./main.module.sass.js";
|
|
5
|
-
import {
|
|
6
|
-
import { useRef, useEffect, useMemo } from "react";
|
|
5
|
+
import { getLuminanceAdjustedColorScheme } from "@macrostrat/color-utils";
|
|
7
6
|
import { memoize } from "underscore";
|
|
8
|
-
import { Sketch } from "@uiw/react-color";
|
|
9
7
|
import classNames from "classnames";
|
|
8
|
+
const ColorPicker = ColorPicker2;
|
|
10
9
|
const h = hyper.styled(styles);
|
|
11
10
|
function ColorCell({
|
|
12
11
|
value,
|
|
@@ -55,45 +54,6 @@ function colorSwatchRenderer(value) {
|
|
|
55
54
|
]);
|
|
56
55
|
}
|
|
57
56
|
const colorCombo = memoize(getLuminanceAdjustedColorScheme);
|
|
58
|
-
function ColorPicker({
|
|
59
|
-
value,
|
|
60
|
-
onChange,
|
|
61
|
-
editable = true,
|
|
62
|
-
type = "css"
|
|
63
|
-
/* CSS */
|
|
64
|
-
}) {
|
|
65
|
-
const ref = useRef(null);
|
|
66
|
-
useEffect(() => {
|
|
67
|
-
if (ref.current == null) return;
|
|
68
|
-
ref.current.focus();
|
|
69
|
-
}, []);
|
|
70
|
-
const color = useMemo(() => {
|
|
71
|
-
try {
|
|
72
|
-
return asChromaColor(value).hex();
|
|
73
|
-
} catch {
|
|
74
|
-
return "#aaaaaa";
|
|
75
|
-
}
|
|
76
|
-
}, [value]);
|
|
77
|
-
return h(
|
|
78
|
-
"div.color-picker-container",
|
|
79
|
-
{
|
|
80
|
-
onKeyDown(evt) {
|
|
81
|
-
if (evt.key === "Escape") {
|
|
82
|
-
evt.preventDefault();
|
|
83
|
-
}
|
|
84
|
-
},
|
|
85
|
-
ref,
|
|
86
|
-
tabIndex: 0
|
|
87
|
-
},
|
|
88
|
-
h(Sketch, {
|
|
89
|
-
color,
|
|
90
|
-
disableAlpha: true,
|
|
91
|
-
onChange(color2) {
|
|
92
|
-
onChange(asChromaColor(color2.hexa)[type]());
|
|
93
|
-
}
|
|
94
|
-
})
|
|
95
|
-
);
|
|
96
|
-
}
|
|
97
57
|
export {
|
|
98
58
|
ColorCell,
|
|
99
59
|
ColorPicker,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"colors.js","sources":["../../src/components/colors.ts"],"sourcesContent":["import { Cell } from \"@blueprintjs/table\";\nimport { useInDarkMode } from \"@macrostrat/ui-components\";\nimport hyper from \"@macrostrat/hyper\";\nimport styles from \"./main.module.sass\";\nimport {
|
|
1
|
+
{"version":3,"file":"colors.js","sources":["../../src/components/colors.ts"],"sourcesContent":["import { Cell } from \"@blueprintjs/table\";\nimport { useInDarkMode } from \"@macrostrat/ui-components\";\nimport hyper from \"@macrostrat/hyper\";\nimport styles from \"./main.module.sass\";\nimport { getLuminanceAdjustedColorScheme } from \"@macrostrat/color-utils\";\nimport { memoize } from \"underscore\";\nimport classNames from \"classnames\";\nimport { ColorPicker2 } from \"@macrostrat/ui-components\";\n\nexport const ColorPicker = ColorPicker2;\n\nconst h = hyper.styled(styles);\n\nexport function ColorCell({\n value,\n children,\n style,\n intent,\n adjustLuminance = true,\n className,\n ...rest\n}) {\n const darkMode = useInDarkMode();\n\n const _className = classNames(className, \"color-cell\");\n\n let mainColor = \"var(--text-color)\";\n let backgroundColor = value;\n\n if (adjustLuminance) {\n // If adjustLuminance is true, get the color scheme based on the value\n let colors = colorCombo(value, darkMode, 0.05);\n if (colors != null) {\n mainColor = colors.mainColor;\n backgroundColor = colors.backgroundColor;\n }\n }\n\n if (intent != null) {\n // If an intent is specified, override the main color\n mainColor = undefined;\n }\n\n return h(\n Cell,\n {\n intent,\n className: _className,\n ...rest,\n style: {\n color: mainColor,\n backgroundColor,\n ...style,\n },\n },\n children,\n );\n}\n\nexport function colorSwatchRenderer(value) {\n return h(\"span.color-swatch-container\", [\n h(\"span.color-swatch\", {\n style: { backgroundColor: value },\n }),\n h(\"span.color-name\", value),\n ]);\n}\n\nconst colorCombo = memoize(getLuminanceAdjustedColorScheme);\n"],"names":[],"mappings":";;;;;;;AASO,MAAM,cAAc;AAE3B,MAAM,IAAI,MAAM,OAAO,MAAM;AAEtB,SAAS,UAAU;AAAA,EACxB;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,kBAAkB;AAAA,EAClB;AAAA,EACA,GAAG;AACL,GAAG;AACD,QAAM,WAAW,cAAA;AAEjB,QAAM,aAAa,WAAW,WAAW,YAAY;AAErD,MAAI,YAAY;AAChB,MAAI,kBAAkB;AAEtB,MAAI,iBAAiB;AAEnB,QAAI,SAAS,WAAW,OAAO,UAAU,IAAI;AAC7C,QAAI,UAAU,MAAM;AAClB,kBAAY,OAAO;AACnB,wBAAkB,OAAO;AAAA,IAC3B;AAAA,EACF;AAEA,MAAI,UAAU,MAAM;AAElB,gBAAY;AAAA,EACd;AAEA,SAAO;AAAA,IACL;AAAA,IACA;AAAA,MACE;AAAA,MACA,WAAW;AAAA,MACX,GAAG;AAAA,MACH,OAAO;AAAA,QACL,OAAO;AAAA,QACP;AAAA,QACA,GAAG;AAAA,MAAA;AAAA,IACL;AAAA,IAEF;AAAA,EAAA;AAEJ;AAEO,SAAS,oBAAoB,OAAO;AACzC,SAAO,EAAE,+BAA+B;AAAA,IACtC,EAAE,qBAAqB;AAAA,MACrB,OAAO,EAAE,iBAAiB,MAAA;AAAA,IAAM,CACjC;AAAA,IACD,EAAE,mBAAmB,KAAK;AAAA,EAAA,CAC3B;AACH;AAEA,MAAM,aAAa,QAAQ,+BAA+B;"}
|
|
@@ -1,17 +1,16 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
|
|
3
|
-
const tools = "
|
|
3
|
+
const tools = "_tools_utey8_23";
|
|
4
4
|
const styles = {
|
|
5
|
-
"interaction-barrier": "_interaction-
|
|
6
|
-
"editor-popup-target": "_editor-popup-
|
|
7
|
-
"editable-text-area": "_editable-text-
|
|
5
|
+
"interaction-barrier": "_interaction-barrier_utey8_1",
|
|
6
|
+
"editor-popup-target": "_editor-popup-target_utey8_5",
|
|
7
|
+
"editable-text-area": "_editable-text-area_utey8_14",
|
|
8
8
|
tools,
|
|
9
|
-
"hidden-editor": "_hidden-
|
|
10
|
-
"editor-value": "_editor-
|
|
11
|
-
"color-
|
|
12
|
-
"color-swatch": "_color-
|
|
13
|
-
"color-
|
|
14
|
-
"color-name": "_color-name_1gc88_65"
|
|
9
|
+
"hidden-editor": "_hidden-editor_utey8_30",
|
|
10
|
+
"editor-value": "_editor-value_utey8_34",
|
|
11
|
+
"color-swatch": "_color-swatch_utey8_42",
|
|
12
|
+
"color-swatch-container": "_color-swatch-container_utey8_49",
|
|
13
|
+
"color-name": "_color-name_utey8_61"
|
|
15
14
|
};
|
|
16
15
|
exports.default = styles;
|
|
17
16
|
exports.tools = tools;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"main.module.sass.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"main.module.sass.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;"}
|
|
@@ -1,15 +1,14 @@
|
|
|
1
|
-
const tools = "
|
|
1
|
+
const tools = "_tools_utey8_23";
|
|
2
2
|
const styles = {
|
|
3
|
-
"interaction-barrier": "_interaction-
|
|
4
|
-
"editor-popup-target": "_editor-popup-
|
|
5
|
-
"editable-text-area": "_editable-text-
|
|
3
|
+
"interaction-barrier": "_interaction-barrier_utey8_1",
|
|
4
|
+
"editor-popup-target": "_editor-popup-target_utey8_5",
|
|
5
|
+
"editable-text-area": "_editable-text-area_utey8_14",
|
|
6
6
|
tools,
|
|
7
|
-
"hidden-editor": "_hidden-
|
|
8
|
-
"editor-value": "_editor-
|
|
9
|
-
"color-
|
|
10
|
-
"color-swatch": "_color-
|
|
11
|
-
"color-
|
|
12
|
-
"color-name": "_color-name_1gc88_65"
|
|
7
|
+
"hidden-editor": "_hidden-editor_utey8_30",
|
|
8
|
+
"editor-value": "_editor-value_utey8_34",
|
|
9
|
+
"color-swatch": "_color-swatch_utey8_42",
|
|
10
|
+
"color-swatch-container": "_color-swatch-container_utey8_49",
|
|
11
|
+
"color-name": "_color-name_utey8_61"
|
|
13
12
|
};
|
|
14
13
|
export {
|
|
15
14
|
styles as default,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"main.module.sass.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"main.module.sass.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;"}
|
package/dist/data-sheet.css
CHANGED
|
@@ -1204,11 +1204,11 @@
|
|
|
1204
1204
|
._table-actions_1xz9a_1 {
|
|
1205
1205
|
margin-bottom: 0.5em;
|
|
1206
1206
|
gap: 1em;
|
|
1207
|
-
}._interaction-
|
|
1207
|
+
}._interaction-barrier_utey8_1 {
|
|
1208
1208
|
pointer-events: all;
|
|
1209
1209
|
}
|
|
1210
1210
|
|
|
1211
|
-
._editor-popup-
|
|
1211
|
+
._editor-popup-target_utey8_5 {
|
|
1212
1212
|
position: absolute;
|
|
1213
1213
|
display: block;
|
|
1214
1214
|
top: 0;
|
|
@@ -1217,27 +1217,27 @@
|
|
|
1217
1217
|
height: 100%;
|
|
1218
1218
|
}
|
|
1219
1219
|
|
|
1220
|
-
._editable-text-
|
|
1220
|
+
._editable-text-area_utey8_14 {
|
|
1221
1221
|
position: relative;
|
|
1222
1222
|
}
|
|
1223
|
-
._editable-text-
|
|
1223
|
+
._editable-text-area_utey8_14 textarea {
|
|
1224
1224
|
min-width: var(--data-editor-width, 15em);
|
|
1225
1225
|
min-height: var(--data-editor-height, 10em);
|
|
1226
1226
|
font-family: inherit;
|
|
1227
1227
|
font-size: inherit;
|
|
1228
1228
|
}
|
|
1229
|
-
._editable-text-
|
|
1229
|
+
._editable-text-area_utey8_14 ._tools_utey8_23 {
|
|
1230
1230
|
position: absolute;
|
|
1231
1231
|
top: 0.2em;
|
|
1232
1232
|
right: 0.2em;
|
|
1233
1233
|
transform: scale(0.8);
|
|
1234
1234
|
}
|
|
1235
1235
|
|
|
1236
|
-
._hidden-
|
|
1236
|
+
._hidden-editor_utey8_30 {
|
|
1237
1237
|
opacity: 0;
|
|
1238
1238
|
}
|
|
1239
1239
|
|
|
1240
|
-
._editor-
|
|
1240
|
+
._editor-value_utey8_34 {
|
|
1241
1241
|
position: absolute;
|
|
1242
1242
|
top: 0;
|
|
1243
1243
|
left: 0;
|
|
@@ -1245,18 +1245,14 @@
|
|
|
1245
1245
|
height: 100%;
|
|
1246
1246
|
}
|
|
1247
1247
|
|
|
1248
|
-
._color-
|
|
1249
|
-
--sketch-background: var(--secondary-background) !important;
|
|
1250
|
-
}
|
|
1251
|
-
|
|
1252
|
-
._color-swatch_1gc88_46 {
|
|
1248
|
+
._color-swatch_utey8_42 {
|
|
1253
1249
|
width: 18px;
|
|
1254
1250
|
height: 18px;
|
|
1255
1251
|
display: inline-block;
|
|
1256
1252
|
margin-right: 0.5em;
|
|
1257
1253
|
}
|
|
1258
1254
|
|
|
1259
|
-
._color-swatch-
|
|
1255
|
+
._color-swatch-container_utey8_49 {
|
|
1260
1256
|
position: absolute;
|
|
1261
1257
|
top: 0;
|
|
1262
1258
|
left: 0;
|
|
@@ -1268,7 +1264,7 @@
|
|
|
1268
1264
|
gap: 0.3em;
|
|
1269
1265
|
}
|
|
1270
1266
|
|
|
1271
|
-
._color-
|
|
1267
|
+
._color-name_utey8_61 {
|
|
1272
1268
|
position: relative;
|
|
1273
1269
|
flex-grow: 1;
|
|
1274
1270
|
display: block;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@macrostrat/data-sheet",
|
|
3
|
-
"version": "3.0.
|
|
3
|
+
"version": "3.0.2",
|
|
4
4
|
"description": "Scalable data sheet with optional editing capabilities",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -9,9 +9,9 @@
|
|
|
9
9
|
},
|
|
10
10
|
"license": "MIT",
|
|
11
11
|
"author": "Daven Quinn",
|
|
12
|
-
"type": "module",
|
|
13
12
|
"source": "src/index.ts",
|
|
14
|
-
"main": "dist/index.
|
|
13
|
+
"main": "dist/index.cjs",
|
|
14
|
+
"module": "dist/index.js",
|
|
15
15
|
"node": "dist/index.cjs",
|
|
16
16
|
"types": "dist/index.d.ts",
|
|
17
17
|
"style": "dist/data-sheet.css",
|
|
@@ -25,9 +25,14 @@
|
|
|
25
25
|
"exports": {
|
|
26
26
|
".": {
|
|
27
27
|
"source": "./src/index.ts",
|
|
28
|
-
"import":
|
|
29
|
-
|
|
30
|
-
|
|
28
|
+
"import": {
|
|
29
|
+
"types": "./dist/index.d.ts",
|
|
30
|
+
"default": "./dist/index.js"
|
|
31
|
+
},
|
|
32
|
+
"require": {
|
|
33
|
+
"types": "./dist/index.d.ts",
|
|
34
|
+
"default": "./dist/index.cjs"
|
|
35
|
+
},
|
|
31
36
|
"style": "./dist/data-sheet.css"
|
|
32
37
|
},
|
|
33
38
|
"./package.json": "./package.json",
|
|
@@ -43,14 +48,12 @@
|
|
|
43
48
|
"dependencies": {
|
|
44
49
|
"@blueprintjs/core": "^6.6.1",
|
|
45
50
|
"@blueprintjs/table": "^6.0.13",
|
|
46
|
-
"@macrostrat/color-utils": "^1.2.
|
|
47
|
-
"@macrostrat/data-components": "^1.0.
|
|
51
|
+
"@macrostrat/color-utils": "^1.2.1",
|
|
52
|
+
"@macrostrat/data-components": "^1.0.1",
|
|
48
53
|
"@macrostrat/hyper": "^3.0.6",
|
|
49
|
-
"@macrostrat/ui-components": "^5.0.
|
|
54
|
+
"@macrostrat/ui-components": "^5.0.4",
|
|
50
55
|
"@supabase/postgrest-js": "^1.17.7",
|
|
51
56
|
"@types/underscore": "^1.13.0",
|
|
52
|
-
"@uiw/react-color": "^2.9.2",
|
|
53
|
-
"chroma-js": "^3.2.0",
|
|
54
57
|
"classnames": "^2.5.1",
|
|
55
58
|
"immutability-helper": "^3.1.1",
|
|
56
59
|
"underscore": "^1.13.7",
|
package/src/components/colors.ts
CHANGED
|
@@ -2,14 +2,12 @@ import { Cell } from "@blueprintjs/table";
|
|
|
2
2
|
import { useInDarkMode } from "@macrostrat/ui-components";
|
|
3
3
|
import hyper from "@macrostrat/hyper";
|
|
4
4
|
import styles from "./main.module.sass";
|
|
5
|
-
import {
|
|
6
|
-
asChromaColor,
|
|
7
|
-
getLuminanceAdjustedColorScheme,
|
|
8
|
-
} from "@macrostrat/color-utils";
|
|
9
|
-
import { useEffect, useMemo, useRef, useState } from "react";
|
|
5
|
+
import { getLuminanceAdjustedColorScheme } from "@macrostrat/color-utils";
|
|
10
6
|
import { memoize } from "underscore";
|
|
11
|
-
import { Sketch } from "@uiw/react-color";
|
|
12
7
|
import classNames from "classnames";
|
|
8
|
+
import { ColorPicker2 } from "@macrostrat/ui-components";
|
|
9
|
+
|
|
10
|
+
export const ColorPicker = ColorPicker2;
|
|
13
11
|
|
|
14
12
|
const h = hyper.styled(styles);
|
|
15
13
|
|
|
@@ -69,51 +67,3 @@ export function colorSwatchRenderer(value) {
|
|
|
69
67
|
}
|
|
70
68
|
|
|
71
69
|
const colorCombo = memoize(getLuminanceAdjustedColorScheme);
|
|
72
|
-
|
|
73
|
-
enum ColorConversionType {
|
|
74
|
-
HEX = "hex",
|
|
75
|
-
RGB = "rgb",
|
|
76
|
-
HSL = "hsl",
|
|
77
|
-
CSS = "css",
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
export function ColorPicker({
|
|
81
|
-
value,
|
|
82
|
-
onChange,
|
|
83
|
-
editable = true,
|
|
84
|
-
type = ColorConversionType.CSS,
|
|
85
|
-
}) {
|
|
86
|
-
const ref = useRef(null);
|
|
87
|
-
useEffect(() => {
|
|
88
|
-
if (ref.current == null) return;
|
|
89
|
-
ref.current.focus();
|
|
90
|
-
}, []);
|
|
91
|
-
|
|
92
|
-
const color = useMemo(() => {
|
|
93
|
-
try {
|
|
94
|
-
return asChromaColor(value).hex();
|
|
95
|
-
} catch {
|
|
96
|
-
return "#aaaaaa";
|
|
97
|
-
}
|
|
98
|
-
}, [value]);
|
|
99
|
-
|
|
100
|
-
return h(
|
|
101
|
-
"div.color-picker-container",
|
|
102
|
-
{
|
|
103
|
-
onKeyDown(evt) {
|
|
104
|
-
if (evt.key === "Escape") {
|
|
105
|
-
evt.preventDefault();
|
|
106
|
-
}
|
|
107
|
-
},
|
|
108
|
-
ref,
|
|
109
|
-
tabIndex: 0,
|
|
110
|
-
},
|
|
111
|
-
h(Sketch, {
|
|
112
|
-
color,
|
|
113
|
-
disableAlpha: true,
|
|
114
|
-
onChange(color) {
|
|
115
|
-
onChange(asChromaColor(color.hexa)[type]());
|
|
116
|
-
},
|
|
117
|
-
}),
|
|
118
|
-
);
|
|
119
|
-
}
|