@crispy-seed/data-table 0.1.0 → 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.
- package/README.md +25 -13
- package/dist/{DataTable-12s-Bd20OuMs.js → DataTable-12s-D02v6Qj5.js} +234 -193
- package/dist/{DataTable-12s-8LMBtS2u.cjs → DataTable-12s-Gpv6I4J8.cjs} +242 -200
- package/dist/{DataTable-12s-Zml1x9Kr-12s-CTRzgvMT.cjs → DataTable-12s-Zml1x9Kr-12s-B-mwMBhn.cjs} +9 -9
- package/dist/{DataTable-12s-Zml1x9Kr-12s-Coi-3lUa.js → DataTable-12s-Zml1x9Kr-12s-BR-yHfob.js} +2 -2
- package/dist/{Menu-12s-Db_zr1AP.cjs → Menu-12s-A4lEc__n.cjs} +5 -6
- package/dist/{Menu-12s-Di5JADW4.js → Menu-12s-v9vnaq8F.js} +1 -2
- package/dist/{Select-12s-1Uh7XbkG.js → Select-12s-CE3SMzFp.js} +1 -2
- package/dist/{Select-12s-D8DdKT-U.cjs → Select-12s-CNQC9z8t.cjs} +5 -6
- package/dist/{body-cells-12s-BoOTcg-l.cjs → body-cells-12s-2sTwdliH.cjs} +7 -8
- package/dist/{body-cells-12s-BnOVUTKN.js → body-cells-12s-Ba2uF4T-.js} +4 -5
- package/dist/{column-calc-12s-C6IPSOaF.js → column-calc-12s-C1-I2KdV.js} +4 -4
- package/dist/{column-calc-12s-CKuSpe-l.cjs → column-calc-12s-CJ26VuDJ.cjs} +4 -4
- package/dist/{column-layout-12s-s7wnxkMN.js → column-layout-12s-BhQmNTJG.js} +1 -1
- package/dist/{column-layout-12s-CTu5yT_D.cjs → column-layout-12s-k2fZYeKl.cjs} +1 -1
- package/dist/{column-menu-12s-mRBk-4oa.js → column-menu-12s-6Yvu4SZ0.js} +5 -6
- package/dist/{column-menu-12s-BPE9N1gs.cjs → column-menu-12s-BnknuXGh.cjs} +6 -7
- package/dist/{editors-12s-DO8TZkYV.cjs → editors-12s-C0RxmTcI.cjs} +6 -7
- package/dist/{editors-12s-BO9Mp034.js → editors-12s-COixUnI2.js} +3 -4
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +8 -1
- package/dist/index.js +1 -1
- package/dist/{resize-12s-nsMvrmLt.js → resize-12s-CajyNXFB.js} +1 -1
- package/dist/{resize-12s-jQY-PX67.cjs → resize-12s-ChLpxb4i.cjs} +1 -1
- package/dist/{states-12s-CLO_uVue.cjs → states-12s-BB0PT_bq.cjs} +2 -2
- package/dist/{states-12s-DEFSxJCO.js → states-12s-m5mBR90e.js} +2 -2
- package/dist/{toolbar-12s-AVU-sbDW.js → toolbar-12s-B1xiS-Zu.js} +3 -4
- package/dist/{toolbar-12s-CaLgJrDo.cjs → toolbar-12s-DzLbghpK.cjs} +5 -6
- package/dist/{useDataTableRow-12s-CPYaDa1p-12s-BmUSAnPe.js → useDataTableRow-12s-CPYaDa1p-12s-4qkGoz-j.js} +1 -1
- package/dist/{useDataTableRow-12s-CPYaDa1p-12s-D-DRjwAe.cjs → useDataTableRow-12s-CPYaDa1p-12s-DG64uYjn.cjs} +1 -1
- package/package.json +1 -2
|
@@ -10,20 +10,19 @@ function __insertCSS(code) {
|
|
|
10
10
|
|
|
11
11
|
var React = require('react');
|
|
12
12
|
var jsxRuntime = require('react/jsx-runtime');
|
|
13
|
-
var DataTable12sZml1x9Kr12s = require('./DataTable-12s-Zml1x9Kr-12s-
|
|
13
|
+
var DataTable12sZml1x9Kr12s = require('./DataTable-12s-Zml1x9Kr-12s-B-mwMBhn.cjs');
|
|
14
14
|
var domUtils = require('@seed-design/dom-utils');
|
|
15
|
-
var reactPrimitive = require('@seed-design/react-primitive');
|
|
16
15
|
var checkbox = require('@seed-design/css/recipes/checkbox');
|
|
17
16
|
var checkmark = require('@seed-design/css/recipes/checkmark');
|
|
18
17
|
var reactCheckbox = require('@seed-design/react-checkbox');
|
|
19
18
|
var reactScaleFeedback = require('@seed-design/react-scale-feedback');
|
|
20
19
|
var checkboxGroup = require('@seed-design/css/recipes/checkbox-group');
|
|
21
|
-
var bodyCells12s = require('./body-cells-12s-
|
|
22
|
-
var columnCalc12s = require('./column-calc-12s-
|
|
23
|
-
var columnLayout12s = require('./column-layout-12s-
|
|
24
|
-
var columnMenu12s = require('./column-menu-12s-
|
|
25
|
-
var states12s = require('./states-12s-
|
|
26
|
-
var toolbar12s = require('./toolbar-12s-
|
|
20
|
+
var bodyCells12s = require('./body-cells-12s-2sTwdliH.cjs');
|
|
21
|
+
var columnCalc12s = require('./column-calc-12s-CJ26VuDJ.cjs');
|
|
22
|
+
var columnLayout12s = require('./column-layout-12s-k2fZYeKl.cjs');
|
|
23
|
+
var columnMenu12s = require('./column-menu-12s-BnknuXGh.cjs');
|
|
24
|
+
var states12s = require('./states-12s-BB0PT_bq.cjs');
|
|
25
|
+
var toolbar12s = require('./toolbar-12s-DzLbghpK.cjs');
|
|
27
26
|
|
|
28
27
|
function _interopNamespace(e) {
|
|
29
28
|
if (e && e.__esModule) return e;
|
|
@@ -311,176 +310,6 @@ var Icon = ({ size = 24, ...props }, ref)=>/* @__PURE__ */ jsxRuntime.jsx("svg",
|
|
|
311
310
|
var IconCheckmarkFatFill = /*#__PURE__*/ React.forwardRef(Icon);
|
|
312
311
|
var IconCheckmarkFatFill_default = IconCheckmarkFatFill;
|
|
313
312
|
|
|
314
|
-
function r(e) {
|
|
315
|
-
var t, f, n = "";
|
|
316
|
-
if ("string" == typeof e || "number" == typeof e) n += e;
|
|
317
|
-
else if ("object" == typeof e) if (Array.isArray(e)) {
|
|
318
|
-
var o = e.length;
|
|
319
|
-
for(t = 0; t < o; t++)e[t] && (f = r(e[t])) && (n && (n += " "), n += f);
|
|
320
|
-
} else for(f in e)e[f] && (n && (n += " "), n += f);
|
|
321
|
-
return n;
|
|
322
|
-
}
|
|
323
|
-
function clsx() {
|
|
324
|
-
for(var e, t, f = 0, n = "", o = arguments.length; f < o; f++)(e = arguments[f]) && (t = r(e)) && (n && (n += " "), n += t);
|
|
325
|
-
return n;
|
|
326
|
-
}
|
|
327
|
-
|
|
328
|
-
function splitMultipleVariantsProps(props, recipesMap) {
|
|
329
|
-
const multipleVariantsProps = {};
|
|
330
|
-
const extractedKeys = new Set();
|
|
331
|
-
for(const recipeKey in recipesMap){
|
|
332
|
-
const recipe = recipesMap[recipeKey];
|
|
333
|
-
const [variantProps] = recipe.splitVariantProps(props);
|
|
334
|
-
multipleVariantsProps[recipeKey] = variantProps;
|
|
335
|
-
for(const variantPropKey in variantProps){
|
|
336
|
-
extractedKeys.add(variantPropKey);
|
|
337
|
-
}
|
|
338
|
-
}
|
|
339
|
-
const remainingProps = {};
|
|
340
|
-
for(const propKey in props){
|
|
341
|
-
if (extractedKeys.has(propKey)) continue;
|
|
342
|
-
remainingProps[propKey] = props[propKey];
|
|
343
|
-
}
|
|
344
|
-
return [
|
|
345
|
-
multipleVariantsProps,
|
|
346
|
-
remainingProps
|
|
347
|
-
];
|
|
348
|
-
}
|
|
349
|
-
|
|
350
|
-
/** Restores defaults overwritten by explicitly passed undefined values. */ function restoreDefaultProps(props, defaultProps) {
|
|
351
|
-
if (!defaultProps) return;
|
|
352
|
-
for (const key of Object.keys(defaultProps)){
|
|
353
|
-
if (props[key] === undefined) {
|
|
354
|
-
props[key] = defaultProps[key];
|
|
355
|
-
}
|
|
356
|
-
}
|
|
357
|
-
}
|
|
358
|
-
|
|
359
|
-
function createSlotRecipeContext(recipe) {
|
|
360
|
-
const ClassNamesContext = /*#__PURE__*/ React.createContext(null);
|
|
361
|
-
const PropsContext = /*#__PURE__*/ React.createContext(null);
|
|
362
|
-
const ClassNamesProvider = ({ children, value })=>{
|
|
363
|
-
return /*#__PURE__*/ jsxRuntime.jsx(ClassNamesContext.Provider, {
|
|
364
|
-
value: value,
|
|
365
|
-
children: children
|
|
366
|
-
});
|
|
367
|
-
};
|
|
368
|
-
const PropsProvider = ({ children, value })=>{
|
|
369
|
-
return /*#__PURE__*/ jsxRuntime.jsx(PropsContext.Provider, {
|
|
370
|
-
value: value,
|
|
371
|
-
children: children
|
|
372
|
-
});
|
|
373
|
-
};
|
|
374
|
-
function useClassNames() {
|
|
375
|
-
const context = React.useContext(ClassNamesContext);
|
|
376
|
-
if (context === null) {
|
|
377
|
-
throw new Error("useClassNames must be used within a ClassNamesProvider. Did you forget to wrap your component in a ClassNamesProvider?");
|
|
378
|
-
}
|
|
379
|
-
return context;
|
|
380
|
-
}
|
|
381
|
-
function useProps() {
|
|
382
|
-
return React.useContext(PropsContext);
|
|
383
|
-
}
|
|
384
|
-
const withRootProvider = (Component, options)=>{
|
|
385
|
-
const { defaultProps } = options ?? {};
|
|
386
|
-
const StyledComponent = (innerProps)=>{
|
|
387
|
-
const props = {
|
|
388
|
-
...defaultProps ?? {},
|
|
389
|
-
...useProps(),
|
|
390
|
-
...innerProps
|
|
391
|
-
};
|
|
392
|
-
restoreDefaultProps(props, defaultProps);
|
|
393
|
-
const [variantProps, otherProps] = recipe.splitVariantProps(props);
|
|
394
|
-
const classNames = recipe(variantProps); // TODO: should we memoize this?
|
|
395
|
-
return /*#__PURE__*/ jsxRuntime.jsx(ClassNamesProvider, {
|
|
396
|
-
value: classNames,
|
|
397
|
-
children: /*#__PURE__*/ jsxRuntime.jsx(Component, {
|
|
398
|
-
...otherProps
|
|
399
|
-
})
|
|
400
|
-
});
|
|
401
|
-
};
|
|
402
|
-
// @ts-ignore
|
|
403
|
-
StyledComponent.displayName = Component.displayName || Component.name;
|
|
404
|
-
return StyledComponent;
|
|
405
|
-
};
|
|
406
|
-
const withProvider = (Component, slot, options)=>{
|
|
407
|
-
const { defaultProps } = options ?? {};
|
|
408
|
-
const StyledComponent = /*#__PURE__*/ React.forwardRef((innerProps, ref)=>{
|
|
409
|
-
const props = {
|
|
410
|
-
...defaultProps ?? {},
|
|
411
|
-
...useProps(),
|
|
412
|
-
...innerProps
|
|
413
|
-
};
|
|
414
|
-
restoreDefaultProps(props, defaultProps);
|
|
415
|
-
const [variantProps, otherProps] = recipe.splitVariantProps(props);
|
|
416
|
-
const classNames = recipe(variantProps); // TODO: should we memoize this?
|
|
417
|
-
const className = classNames[slot];
|
|
418
|
-
return /*#__PURE__*/ jsxRuntime.jsx(ClassNamesProvider, {
|
|
419
|
-
value: classNames,
|
|
420
|
-
children: /*#__PURE__*/ jsxRuntime.jsx(Component, {
|
|
421
|
-
ref: ref,
|
|
422
|
-
...otherProps,
|
|
423
|
-
className: clsx(className, props.className)
|
|
424
|
-
})
|
|
425
|
-
});
|
|
426
|
-
});
|
|
427
|
-
// @ts-ignore
|
|
428
|
-
StyledComponent.displayName = Component.displayName || Component.name;
|
|
429
|
-
return StyledComponent;
|
|
430
|
-
};
|
|
431
|
-
const withContext = (Component, slot)=>{
|
|
432
|
-
const StyledComponent = /*#__PURE__*/ React.forwardRef((props, ref)=>{
|
|
433
|
-
const classNames = useClassNames();
|
|
434
|
-
const className = classNames?.[slot];
|
|
435
|
-
return /*#__PURE__*/ jsxRuntime.jsx(Component, {
|
|
436
|
-
ref: ref,
|
|
437
|
-
...props,
|
|
438
|
-
className: clsx(className, props.className)
|
|
439
|
-
});
|
|
440
|
-
});
|
|
441
|
-
// @ts-ignore
|
|
442
|
-
StyledComponent.displayName = Component.displayName || Component.name;
|
|
443
|
-
return StyledComponent;
|
|
444
|
-
};
|
|
445
|
-
return {
|
|
446
|
-
ClassNamesProvider,
|
|
447
|
-
PropsProvider,
|
|
448
|
-
useClassNames,
|
|
449
|
-
useProps,
|
|
450
|
-
withRootProvider,
|
|
451
|
-
withProvider,
|
|
452
|
-
withContext
|
|
453
|
-
};
|
|
454
|
-
}
|
|
455
|
-
|
|
456
|
-
function createWithStateProps(useContexts) {
|
|
457
|
-
return function withStateProps(Component) {
|
|
458
|
-
const Node = /*#__PURE__*/ React.forwardRef((props, ref)=>{
|
|
459
|
-
const stateProps = {};
|
|
460
|
-
for (const contextConfig of useContexts){
|
|
461
|
-
if (typeof contextConfig === "function") {
|
|
462
|
-
Object.assign(stateProps, contextConfig({
|
|
463
|
-
strict: true
|
|
464
|
-
})?.stateProps);
|
|
465
|
-
} else {
|
|
466
|
-
const { useContext, strict = false } = contextConfig;
|
|
467
|
-
Object.assign(stateProps, useContext({
|
|
468
|
-
strict
|
|
469
|
-
})?.stateProps);
|
|
470
|
-
}
|
|
471
|
-
}
|
|
472
|
-
// @ts-ignore
|
|
473
|
-
return /*#__PURE__*/ jsxRuntime.jsx(Component, {
|
|
474
|
-
ref: ref,
|
|
475
|
-
...stateProps,
|
|
476
|
-
...props
|
|
477
|
-
});
|
|
478
|
-
});
|
|
479
|
-
Node.displayName = Component.displayName || Component.name;
|
|
480
|
-
return Node;
|
|
481
|
-
};
|
|
482
|
-
}
|
|
483
|
-
|
|
484
313
|
var __defProp$1 = Object.defineProperty;
|
|
485
314
|
var __name$1 = (target, value)=>__defProp$1(target, "name", {
|
|
486
315
|
value,
|
|
@@ -524,20 +353,6 @@ function useComposedRefs(...refs) {
|
|
|
524
353
|
}
|
|
525
354
|
__name$1(useComposedRefs, "useComposedRefs");
|
|
526
355
|
|
|
527
|
-
function withScaleFeedback(Component) {
|
|
528
|
-
const Pressable = /*#__PURE__*/ React__namespace.forwardRef((props, ref)=>{
|
|
529
|
-
const { scaleFeedbackRef, scaleFeedbackClassName } = reactScaleFeedback.useScaleFeedback();
|
|
530
|
-
const composedRef = useComposedRefs(scaleFeedbackRef, ref);
|
|
531
|
-
return /*#__PURE__*/ jsxRuntime.jsx(Component, {
|
|
532
|
-
...props,
|
|
533
|
-
ref: composedRef,
|
|
534
|
-
className: clsx(scaleFeedbackClassName, props.className)
|
|
535
|
-
});
|
|
536
|
-
});
|
|
537
|
-
Pressable.displayName = Component.displayName;
|
|
538
|
-
return Pressable;
|
|
539
|
-
}
|
|
540
|
-
|
|
541
356
|
var __defProp = Object.defineProperty;
|
|
542
357
|
var __name = (target, value)=>__defProp(target, "name", {
|
|
543
358
|
value,
|
|
@@ -683,6 +498,232 @@ var createSlottableError = /* @__PURE__ */ __name((ownerName)=>{
|
|
|
683
498
|
}, "createSlottableError");
|
|
684
499
|
var use = React__namespace[" use ".trim().toString()];
|
|
685
500
|
|
|
501
|
+
function createPrimitive(node) {
|
|
502
|
+
const Node = /*#__PURE__*/ React__namespace.forwardRef((props, ref)=>{
|
|
503
|
+
const { asChild, ...primitiveProps } = props;
|
|
504
|
+
const Comp = asChild ? Slot : node;
|
|
505
|
+
return /*#__PURE__*/ jsxRuntime.jsx(Comp, {
|
|
506
|
+
...primitiveProps,
|
|
507
|
+
ref: ref
|
|
508
|
+
});
|
|
509
|
+
});
|
|
510
|
+
Node.displayName = `Primitive.${node}`;
|
|
511
|
+
return Node;
|
|
512
|
+
}
|
|
513
|
+
const Primitive = {
|
|
514
|
+
div: createPrimitive("div"),
|
|
515
|
+
span: createPrimitive("span"),
|
|
516
|
+
img: createPrimitive("img"),
|
|
517
|
+
button: createPrimitive("button"),
|
|
518
|
+
label: createPrimitive("label"),
|
|
519
|
+
input: createPrimitive("input"),
|
|
520
|
+
textarea: createPrimitive("textarea"),
|
|
521
|
+
a: createPrimitive("a"),
|
|
522
|
+
p: createPrimitive("p"),
|
|
523
|
+
h2: createPrimitive("h2"),
|
|
524
|
+
ul: createPrimitive("ul"),
|
|
525
|
+
li: createPrimitive("li"),
|
|
526
|
+
nav: createPrimitive("nav"),
|
|
527
|
+
svg: createPrimitive("svg"),
|
|
528
|
+
circle: createPrimitive("circle"),
|
|
529
|
+
// Native table elements -- DataTable's own rendering (crispy-seed's addition, not
|
|
530
|
+
// upstream seed-design) needs these for a real `<table>` grid rather than a
|
|
531
|
+
// `display: flex` div grid faked with ARIA roles.
|
|
532
|
+
table: createPrimitive("table"),
|
|
533
|
+
thead: createPrimitive("thead"),
|
|
534
|
+
tbody: createPrimitive("tbody"),
|
|
535
|
+
tfoot: createPrimitive("tfoot"),
|
|
536
|
+
tr: createPrimitive("tr"),
|
|
537
|
+
th: createPrimitive("th"),
|
|
538
|
+
td: createPrimitive("td"),
|
|
539
|
+
colgroup: createPrimitive("colgroup"),
|
|
540
|
+
col: createPrimitive("col")
|
|
541
|
+
};
|
|
542
|
+
|
|
543
|
+
function r(e) {
|
|
544
|
+
var t, f, n = "";
|
|
545
|
+
if ("string" == typeof e || "number" == typeof e) n += e;
|
|
546
|
+
else if ("object" == typeof e) if (Array.isArray(e)) {
|
|
547
|
+
var o = e.length;
|
|
548
|
+
for(t = 0; t < o; t++)e[t] && (f = r(e[t])) && (n && (n += " "), n += f);
|
|
549
|
+
} else for(f in e)e[f] && (n && (n += " "), n += f);
|
|
550
|
+
return n;
|
|
551
|
+
}
|
|
552
|
+
function clsx() {
|
|
553
|
+
for(var e, t, f = 0, n = "", o = arguments.length; f < o; f++)(e = arguments[f]) && (t = r(e)) && (n && (n += " "), n += t);
|
|
554
|
+
return n;
|
|
555
|
+
}
|
|
556
|
+
|
|
557
|
+
function splitMultipleVariantsProps(props, recipesMap) {
|
|
558
|
+
const multipleVariantsProps = {};
|
|
559
|
+
const extractedKeys = new Set();
|
|
560
|
+
for(const recipeKey in recipesMap){
|
|
561
|
+
const recipe = recipesMap[recipeKey];
|
|
562
|
+
const [variantProps] = recipe.splitVariantProps(props);
|
|
563
|
+
multipleVariantsProps[recipeKey] = variantProps;
|
|
564
|
+
for(const variantPropKey in variantProps){
|
|
565
|
+
extractedKeys.add(variantPropKey);
|
|
566
|
+
}
|
|
567
|
+
}
|
|
568
|
+
const remainingProps = {};
|
|
569
|
+
for(const propKey in props){
|
|
570
|
+
if (extractedKeys.has(propKey)) continue;
|
|
571
|
+
remainingProps[propKey] = props[propKey];
|
|
572
|
+
}
|
|
573
|
+
return [
|
|
574
|
+
multipleVariantsProps,
|
|
575
|
+
remainingProps
|
|
576
|
+
];
|
|
577
|
+
}
|
|
578
|
+
|
|
579
|
+
/** Restores defaults overwritten by explicitly passed undefined values. */ function restoreDefaultProps(props, defaultProps) {
|
|
580
|
+
if (!defaultProps) return;
|
|
581
|
+
for (const key of Object.keys(defaultProps)){
|
|
582
|
+
if (props[key] === undefined) {
|
|
583
|
+
props[key] = defaultProps[key];
|
|
584
|
+
}
|
|
585
|
+
}
|
|
586
|
+
}
|
|
587
|
+
|
|
588
|
+
function createSlotRecipeContext(recipe) {
|
|
589
|
+
const ClassNamesContext = /*#__PURE__*/ React.createContext(null);
|
|
590
|
+
const PropsContext = /*#__PURE__*/ React.createContext(null);
|
|
591
|
+
const ClassNamesProvider = ({ children, value })=>{
|
|
592
|
+
return /*#__PURE__*/ jsxRuntime.jsx(ClassNamesContext.Provider, {
|
|
593
|
+
value: value,
|
|
594
|
+
children: children
|
|
595
|
+
});
|
|
596
|
+
};
|
|
597
|
+
const PropsProvider = ({ children, value })=>{
|
|
598
|
+
return /*#__PURE__*/ jsxRuntime.jsx(PropsContext.Provider, {
|
|
599
|
+
value: value,
|
|
600
|
+
children: children
|
|
601
|
+
});
|
|
602
|
+
};
|
|
603
|
+
function useClassNames() {
|
|
604
|
+
const context = React.useContext(ClassNamesContext);
|
|
605
|
+
if (context === null) {
|
|
606
|
+
throw new Error("useClassNames must be used within a ClassNamesProvider. Did you forget to wrap your component in a ClassNamesProvider?");
|
|
607
|
+
}
|
|
608
|
+
return context;
|
|
609
|
+
}
|
|
610
|
+
function useProps() {
|
|
611
|
+
return React.useContext(PropsContext);
|
|
612
|
+
}
|
|
613
|
+
const withRootProvider = (Component, options)=>{
|
|
614
|
+
const { defaultProps } = options ?? {};
|
|
615
|
+
const StyledComponent = (innerProps)=>{
|
|
616
|
+
const props = {
|
|
617
|
+
...defaultProps ?? {},
|
|
618
|
+
...useProps(),
|
|
619
|
+
...innerProps
|
|
620
|
+
};
|
|
621
|
+
restoreDefaultProps(props, defaultProps);
|
|
622
|
+
const [variantProps, otherProps] = recipe.splitVariantProps(props);
|
|
623
|
+
const classNames = recipe(variantProps); // TODO: should we memoize this?
|
|
624
|
+
return /*#__PURE__*/ jsxRuntime.jsx(ClassNamesProvider, {
|
|
625
|
+
value: classNames,
|
|
626
|
+
children: /*#__PURE__*/ jsxRuntime.jsx(Component, {
|
|
627
|
+
...otherProps
|
|
628
|
+
})
|
|
629
|
+
});
|
|
630
|
+
};
|
|
631
|
+
// @ts-ignore
|
|
632
|
+
StyledComponent.displayName = Component.displayName || Component.name;
|
|
633
|
+
return StyledComponent;
|
|
634
|
+
};
|
|
635
|
+
const withProvider = (Component, slot, options)=>{
|
|
636
|
+
const { defaultProps } = options ?? {};
|
|
637
|
+
const StyledComponent = /*#__PURE__*/ React.forwardRef((innerProps, ref)=>{
|
|
638
|
+
const props = {
|
|
639
|
+
...defaultProps ?? {},
|
|
640
|
+
...useProps(),
|
|
641
|
+
...innerProps
|
|
642
|
+
};
|
|
643
|
+
restoreDefaultProps(props, defaultProps);
|
|
644
|
+
const [variantProps, otherProps] = recipe.splitVariantProps(props);
|
|
645
|
+
const classNames = recipe(variantProps); // TODO: should we memoize this?
|
|
646
|
+
const className = classNames[slot];
|
|
647
|
+
return /*#__PURE__*/ jsxRuntime.jsx(ClassNamesProvider, {
|
|
648
|
+
value: classNames,
|
|
649
|
+
children: /*#__PURE__*/ jsxRuntime.jsx(Component, {
|
|
650
|
+
ref: ref,
|
|
651
|
+
...otherProps,
|
|
652
|
+
className: clsx(className, props.className)
|
|
653
|
+
})
|
|
654
|
+
});
|
|
655
|
+
});
|
|
656
|
+
// @ts-ignore
|
|
657
|
+
StyledComponent.displayName = Component.displayName || Component.name;
|
|
658
|
+
return StyledComponent;
|
|
659
|
+
};
|
|
660
|
+
const withContext = (Component, slot)=>{
|
|
661
|
+
const StyledComponent = /*#__PURE__*/ React.forwardRef((props, ref)=>{
|
|
662
|
+
const classNames = useClassNames();
|
|
663
|
+
const className = classNames?.[slot];
|
|
664
|
+
return /*#__PURE__*/ jsxRuntime.jsx(Component, {
|
|
665
|
+
ref: ref,
|
|
666
|
+
...props,
|
|
667
|
+
className: clsx(className, props.className)
|
|
668
|
+
});
|
|
669
|
+
});
|
|
670
|
+
// @ts-ignore
|
|
671
|
+
StyledComponent.displayName = Component.displayName || Component.name;
|
|
672
|
+
return StyledComponent;
|
|
673
|
+
};
|
|
674
|
+
return {
|
|
675
|
+
ClassNamesProvider,
|
|
676
|
+
PropsProvider,
|
|
677
|
+
useClassNames,
|
|
678
|
+
useProps,
|
|
679
|
+
withRootProvider,
|
|
680
|
+
withProvider,
|
|
681
|
+
withContext
|
|
682
|
+
};
|
|
683
|
+
}
|
|
684
|
+
|
|
685
|
+
function createWithStateProps(useContexts) {
|
|
686
|
+
return function withStateProps(Component) {
|
|
687
|
+
const Node = /*#__PURE__*/ React.forwardRef((props, ref)=>{
|
|
688
|
+
const stateProps = {};
|
|
689
|
+
for (const contextConfig of useContexts){
|
|
690
|
+
if (typeof contextConfig === "function") {
|
|
691
|
+
Object.assign(stateProps, contextConfig({
|
|
692
|
+
strict: true
|
|
693
|
+
})?.stateProps);
|
|
694
|
+
} else {
|
|
695
|
+
const { useContext, strict = false } = contextConfig;
|
|
696
|
+
Object.assign(stateProps, useContext({
|
|
697
|
+
strict
|
|
698
|
+
})?.stateProps);
|
|
699
|
+
}
|
|
700
|
+
}
|
|
701
|
+
// @ts-ignore
|
|
702
|
+
return /*#__PURE__*/ jsxRuntime.jsx(Component, {
|
|
703
|
+
ref: ref,
|
|
704
|
+
...stateProps,
|
|
705
|
+
...props
|
|
706
|
+
});
|
|
707
|
+
});
|
|
708
|
+
Node.displayName = Component.displayName || Component.name;
|
|
709
|
+
return Node;
|
|
710
|
+
};
|
|
711
|
+
}
|
|
712
|
+
|
|
713
|
+
function withScaleFeedback(Component) {
|
|
714
|
+
const Pressable = /*#__PURE__*/ React__namespace.forwardRef((props, ref)=>{
|
|
715
|
+
const { scaleFeedbackRef, scaleFeedbackClassName } = reactScaleFeedback.useScaleFeedback();
|
|
716
|
+
const composedRef = useComposedRefs(scaleFeedbackRef, ref);
|
|
717
|
+
return /*#__PURE__*/ jsxRuntime.jsx(Component, {
|
|
718
|
+
...props,
|
|
719
|
+
ref: composedRef,
|
|
720
|
+
className: clsx(scaleFeedbackClassName, props.className)
|
|
721
|
+
});
|
|
722
|
+
});
|
|
723
|
+
Pressable.displayName = Component.displayName;
|
|
724
|
+
return Pressable;
|
|
725
|
+
}
|
|
726
|
+
|
|
686
727
|
const InternalIcon = /*#__PURE__*/ React.forwardRef(({ svg, ...otherProps }, ref)=>{
|
|
687
728
|
return /*#__PURE__*/ jsxRuntime.jsx(Slot, {
|
|
688
729
|
ref: ref,
|
|
@@ -740,7 +781,7 @@ const { withProvider: withCheckmarkProvider, useClassNames: useCheckmarkClassNam
|
|
|
740
781
|
const withStateProps = createWithStateProps([
|
|
741
782
|
reactCheckbox.useCheckboxContext
|
|
742
783
|
]);
|
|
743
|
-
withGroupContext(
|
|
784
|
+
withGroupContext(Primitive.div);
|
|
744
785
|
const CheckboxRoot = Object.assign(/*#__PURE__*/ React.forwardRef(({ className, ...props }, ref)=>{
|
|
745
786
|
const [{ checkbox: checkboxVariantProps, checkmark: checkmarkVariantProps }, otherProps] = splitMultipleVariantsProps(props, {
|
|
746
787
|
checkbox: checkbox.checkbox,
|
|
@@ -789,7 +830,7 @@ const CheckboxIndicator = /*#__PURE__*/ React.forwardRef(({ unchecked: unchecked
|
|
|
789
830
|
return null;
|
|
790
831
|
});
|
|
791
832
|
CheckboxIndicator.displayName = "CheckboxIndicator";
|
|
792
|
-
const CheckboxLabel = withContext$1(withStateProps(
|
|
833
|
+
const CheckboxLabel = withContext$1(withStateProps(Primitive.span), "label");
|
|
793
834
|
const CheckboxHiddenInput = reactCheckbox.Checkbox.HiddenInput;
|
|
794
835
|
|
|
795
836
|
// Row-narrowing for the toolbar's search box and each column's filter picker -- split
|
|
@@ -1378,10 +1419,10 @@ const DataTableHeaderCell = withContext(DataTable12sZml1x9Kr12s.DataTableHeaderC
|
|
|
1378
1419
|
// `.crisp-datatable-th-inner` -- the flex row INSIDE a `<th>` (label + filter trigger +
|
|
1379
1420
|
// sort chevron + column menu). See qvism-preset's own `headerCellInner` slot comment
|
|
1380
1421
|
// for why this lives one level below the cell itself rather than on it.
|
|
1381
|
-
const DataTableHeaderCellInner = withContext(
|
|
1422
|
+
const DataTableHeaderCellInner = withContext(Primitive.div, "headerCellInner");
|
|
1382
1423
|
/** The label text specifically -- the one thing in `DataTableHeaderCellInner` that
|
|
1383
1424
|
* truncates; the trailing filter/sort/menu icons stay fully visible regardless of how
|
|
1384
|
-
* long a column's own header text is. */ const DataTableHeaderCellLabel = withContext(
|
|
1425
|
+
* long a column's own header text is. */ const DataTableHeaderCellLabel = withContext(Primitive.span, "headerCellLabel");
|
|
1385
1426
|
/**
|
|
1386
1427
|
* A selection `<th>`/`<td>`/footer `<td>` composes ITS base slot (`headerCell`/`cell`/
|
|
1387
1428
|
* `footerCell`) together with the `selectionCell` MODIFIER, rather than replacing it --
|
|
@@ -1403,7 +1444,7 @@ const DataTableHeaderCellInner = withContext(reactPrimitive.Primitive.div, "head
|
|
|
1403
1444
|
return StyledComponent;
|
|
1404
1445
|
}
|
|
1405
1446
|
const DataTableSelectionHeaderCell = withSelectionCell(DataTable12sZml1x9Kr12s.DataTableHeaderCell, "headerCell");
|
|
1406
|
-
const DataTableHeaderCellIcon = withContext(
|
|
1447
|
+
const DataTableHeaderCellIcon = withContext(Primitive.span, "headerCellIcon");
|
|
1407
1448
|
// body has no CSS slot of its own in the rootage spec -- it is a plain structural
|
|
1408
1449
|
// `<tbody>`, so it is not wrapped in `withContext`.
|
|
1409
1450
|
const DataTableBody = DataTable12sZml1x9Kr12s.DataTableBody;
|
|
@@ -1418,7 +1459,7 @@ const DataTableSelectionCell = withSelectionCell(DataTable12sZml1x9Kr12s.DataTab
|
|
|
1418
1459
|
// stays out of this slot's own base css (nothing here has a bounded height of its own
|
|
1419
1460
|
// to clip), so it never introduces a second vertical scrollbar next to whatever
|
|
1420
1461
|
// ambient container the whole DataTable already sits in.
|
|
1421
|
-
const DataTableScrollBodyBase = withContext(
|
|
1462
|
+
const DataTableScrollBodyBase = withContext(Primitive.div, "scrollArea");
|
|
1422
1463
|
function DataTableScrollBody({ children, scrollProps }) {
|
|
1423
1464
|
const { scrollAreaRef, scrolledStart, scrolledEnd, onScroll } = DataTable12sZml1x9Kr12s.useDataTableContext();
|
|
1424
1465
|
const { className: scrollClassName, style: scrollStyle, ...otherScrollProps } = scrollProps ?? {};
|
|
@@ -1433,7 +1474,7 @@ function DataTableScrollBody({ children, scrollProps }) {
|
|
|
1433
1474
|
children: children
|
|
1434
1475
|
});
|
|
1435
1476
|
}
|
|
1436
|
-
const DataTableFooterBase = withContext(
|
|
1477
|
+
const DataTableFooterBase = withContext(Primitive.tfoot, "footer");
|
|
1437
1478
|
function DataTableFooter({ children, ...props }) {
|
|
1438
1479
|
return /*#__PURE__*/ jsxRuntime.jsx(DataTableFooterBase, {
|
|
1439
1480
|
...props,
|
|
@@ -1442,7 +1483,7 @@ function DataTableFooter({ children, ...props }) {
|
|
|
1442
1483
|
})
|
|
1443
1484
|
});
|
|
1444
1485
|
}
|
|
1445
|
-
const DataTableFooterCell = withContext(
|
|
1486
|
+
const DataTableFooterCell = withContext(Primitive.td, "footerCell");
|
|
1446
1487
|
////////////////////////////////////////////////////////////////////////////////////
|
|
1447
1488
|
// Fix (bug report): karrot icons default to a 24px intrinsic SVG attribute size
|
|
1448
1489
|
// -- see column-menu.tsx's own `SORT_ICON_SIZE` comment for the full mechanism.
|
|
@@ -1521,6 +1562,7 @@ exports.IconPersonCircleLine_default = IconPersonCircleLine_default;
|
|
|
1521
1562
|
exports.IconPlusLine_default = IconPlusLine_default;
|
|
1522
1563
|
exports.IconSlider2HorizontalLine_default = IconSlider2HorizontalLine_default;
|
|
1523
1564
|
exports.InternalIcon = InternalIcon;
|
|
1565
|
+
exports.Primitive = Primitive;
|
|
1524
1566
|
exports.clsx = clsx;
|
|
1525
1567
|
exports.composeRefs = composeRefs;
|
|
1526
1568
|
exports.createSlotRecipeContext = createSlotRecipeContext;
|
package/dist/{DataTable-12s-Zml1x9Kr-12s-CTRzgvMT.cjs → DataTable-12s-Zml1x9Kr-12s-B-mwMBhn.cjs}
RENAMED
|
@@ -10,10 +10,10 @@ function __insertCSS(code) {
|
|
|
10
10
|
|
|
11
11
|
var jsxRuntime = require('react/jsx-runtime');
|
|
12
12
|
var domUtils = require('@seed-design/dom-utils');
|
|
13
|
-
var
|
|
13
|
+
var DataTable12s = require('./DataTable-12s-Gpv6I4J8.cjs');
|
|
14
14
|
var React = require('react');
|
|
15
15
|
var useDataTable12sBHiDUubw12s = require('./useDataTable-12s-BHiDUubw-12s-Dgvt7XDk.cjs');
|
|
16
|
-
var useDataTableRow12sCPYaDa1p12s = require('./useDataTableRow-12s-CPYaDa1p-12s-
|
|
16
|
+
var useDataTableRow12sCPYaDa1p12s = require('./useDataTableRow-12s-CPYaDa1p-12s-DG64uYjn.cjs');
|
|
17
17
|
|
|
18
18
|
const DataTableContext = /*#__PURE__*/ React.createContext(null);
|
|
19
19
|
const DataTableProvider = DataTableContext.Provider;
|
|
@@ -73,7 +73,7 @@ const DataTableRoot = /*#__PURE__*/ React.forwardRef((props, ref)=>{
|
|
|
73
73
|
});
|
|
74
74
|
return /*#__PURE__*/ jsxRuntime.jsx(DataTableProvider, {
|
|
75
75
|
value: api,
|
|
76
|
-
children: /*#__PURE__*/ jsxRuntime.jsx(
|
|
76
|
+
children: /*#__PURE__*/ jsxRuntime.jsx(DataTable12s.Primitive.div, {
|
|
77
77
|
ref: ref,
|
|
78
78
|
...otherProps
|
|
79
79
|
})
|
|
@@ -90,7 +90,7 @@ DataTableRoot.displayName = "DataTableRoot";
|
|
|
90
90
|
*/ const DataTableTable = /*#__PURE__*/ React.forwardRef((props, ref)=>{
|
|
91
91
|
const { rootProps } = useDataTableContext();
|
|
92
92
|
const mergedProps = domUtils.mergeProps(rootProps, props);
|
|
93
|
-
return /*#__PURE__*/ jsxRuntime.jsx(
|
|
93
|
+
return /*#__PURE__*/ jsxRuntime.jsx(DataTable12s.Primitive.table, {
|
|
94
94
|
ref: ref,
|
|
95
95
|
...mergedProps
|
|
96
96
|
});
|
|
@@ -102,7 +102,7 @@ DataTableTable.displayName = "DataTableTable";
|
|
|
102
102
|
* the only shape this table supports), so that `<tr>` is supplied HERE rather than
|
|
103
103
|
* asking every call site to add it.
|
|
104
104
|
*/ const DataTableHeader = /*#__PURE__*/ React.forwardRef(({ children, ...otherProps }, ref)=>{
|
|
105
|
-
return /*#__PURE__*/ jsxRuntime.jsx(
|
|
105
|
+
return /*#__PURE__*/ jsxRuntime.jsx(DataTable12s.Primitive.thead, {
|
|
106
106
|
ref: ref,
|
|
107
107
|
...otherProps,
|
|
108
108
|
children: /*#__PURE__*/ jsxRuntime.jsx("tr", {
|
|
@@ -114,7 +114,7 @@ DataTableHeader.displayName = "DataTableHeader";
|
|
|
114
114
|
const DataTableHeaderCell = /*#__PURE__*/ React.forwardRef(({ columnKey, sortable, ...otherProps }, ref)=>{
|
|
115
115
|
const { getHeaderCellProps } = useDataTableContext();
|
|
116
116
|
const mergedProps = domUtils.mergeProps(getHeaderCellProps(columnKey, sortable), otherProps);
|
|
117
|
-
return /*#__PURE__*/ jsxRuntime.jsx(
|
|
117
|
+
return /*#__PURE__*/ jsxRuntime.jsx(DataTable12s.Primitive.th, {
|
|
118
118
|
scope: "col",
|
|
119
119
|
ref: ref,
|
|
120
120
|
...mergedProps
|
|
@@ -122,7 +122,7 @@ const DataTableHeaderCell = /*#__PURE__*/ React.forwardRef(({ columnKey, sortabl
|
|
|
122
122
|
});
|
|
123
123
|
DataTableHeaderCell.displayName = "DataTableHeaderCell";
|
|
124
124
|
const DataTableBody = /*#__PURE__*/ React.forwardRef((props, ref)=>{
|
|
125
|
-
return /*#__PURE__*/ jsxRuntime.jsx(
|
|
125
|
+
return /*#__PURE__*/ jsxRuntime.jsx(DataTable12s.Primitive.tbody, {
|
|
126
126
|
ref: ref,
|
|
127
127
|
...props
|
|
128
128
|
});
|
|
@@ -135,7 +135,7 @@ const DataTableRow = /*#__PURE__*/ React.forwardRef(({ rowId, ...otherProps }, r
|
|
|
135
135
|
const mergedProps = domUtils.mergeProps(row.rootProps, otherProps);
|
|
136
136
|
return /*#__PURE__*/ jsxRuntime.jsx(DataTableRowProvider, {
|
|
137
137
|
value: row,
|
|
138
|
-
children: /*#__PURE__*/ jsxRuntime.jsx(
|
|
138
|
+
children: /*#__PURE__*/ jsxRuntime.jsx(DataTable12s.Primitive.tr, {
|
|
139
139
|
ref: ref,
|
|
140
140
|
...mergedProps
|
|
141
141
|
})
|
|
@@ -143,7 +143,7 @@ const DataTableRow = /*#__PURE__*/ React.forwardRef(({ rowId, ...otherProps }, r
|
|
|
143
143
|
});
|
|
144
144
|
DataTableRow.displayName = "DataTableRow";
|
|
145
145
|
const DataTableCell = /*#__PURE__*/ React.forwardRef((props, ref)=>{
|
|
146
|
-
return /*#__PURE__*/ jsxRuntime.jsx(
|
|
146
|
+
return /*#__PURE__*/ jsxRuntime.jsx(DataTable12s.Primitive.td, {
|
|
147
147
|
ref: ref,
|
|
148
148
|
...props
|
|
149
149
|
});
|
package/dist/{DataTable-12s-Zml1x9Kr-12s-Coi-3lUa.js → DataTable-12s-Zml1x9Kr-12s-BR-yHfob.js}
RENAMED
|
@@ -10,10 +10,10 @@ function __insertCSS(code) {
|
|
|
10
10
|
|
|
11
11
|
import { jsx } from 'react/jsx-runtime';
|
|
12
12
|
import { mergeProps } from '@seed-design/dom-utils';
|
|
13
|
-
import { Primitive } from '
|
|
13
|
+
import { P as Primitive } from './DataTable-12s-D02v6Qj5.js';
|
|
14
14
|
import { forwardRef, createContext, useContext } from 'react';
|
|
15
15
|
import { u as useDataTable } from './useDataTable-12s-BHiDUubw-12s-CBeCwTe7.js';
|
|
16
|
-
import { u as useDataTableRow } from './useDataTableRow-12s-CPYaDa1p-12s-
|
|
16
|
+
import { u as useDataTableRow } from './useDataTableRow-12s-CPYaDa1p-12s-4qkGoz-j.js';
|
|
17
17
|
|
|
18
18
|
const DataTableContext = /*#__PURE__*/ createContext(null);
|
|
19
19
|
const DataTableProvider = DataTableContext.Provider;
|
|
@@ -12,8 +12,7 @@ var jsxRuntime = require('react/jsx-runtime');
|
|
|
12
12
|
var reactMenu = require('@seed-design/react-menu');
|
|
13
13
|
var menu = require('@seed-design/css/recipes/menu');
|
|
14
14
|
var menuItem = require('@seed-design/css/recipes/menu-item');
|
|
15
|
-
var
|
|
16
|
-
var DataTable12s = require('./DataTable-12s-8LMBtS2u.cjs');
|
|
15
|
+
var DataTable12s = require('./DataTable-12s-Gpv6I4J8.cjs');
|
|
17
16
|
var React = require('react');
|
|
18
17
|
|
|
19
18
|
function _interopNamespace(e) {
|
|
@@ -71,7 +70,7 @@ const MenuPositioner = /*#__PURE__*/ React__namespace.forwardRef(({ className, .
|
|
|
71
70
|
});
|
|
72
71
|
MenuPositioner.displayName = "MenuPositioner";
|
|
73
72
|
const MenuContent = withContext(reactMenu.Menu.Content, "content");
|
|
74
|
-
const MenuScrollArea = withContext(withStateProps(
|
|
73
|
+
const MenuScrollArea = withContext(withStateProps(DataTable12s.Primitive.div), "scrollArea");
|
|
75
74
|
withContext(reactMenu.Menu.Group, "group");
|
|
76
75
|
withContext(reactMenu.Menu.GroupLabel, "groupLabel");
|
|
77
76
|
const MenuItem = /*#__PURE__*/ React__namespace.forwardRef(({ className: propClassName, ...props }, ref)=>{
|
|
@@ -91,9 +90,9 @@ const MenuItem = /*#__PURE__*/ React__namespace.forwardRef(({ className: propCla
|
|
|
91
90
|
});
|
|
92
91
|
});
|
|
93
92
|
MenuItem.displayName = "MenuItem";
|
|
94
|
-
withItemContext(withItemStateProps(
|
|
95
|
-
const MenuItemLabel = withItemContext(withItemStateProps(
|
|
96
|
-
withItemContext(withItemStateProps(
|
|
93
|
+
withItemContext(withItemStateProps(DataTable12s.Primitive.div), "body");
|
|
94
|
+
const MenuItemLabel = withItemContext(withItemStateProps(DataTable12s.Primitive.span), "label");
|
|
95
|
+
withItemContext(withItemStateProps(DataTable12s.Primitive.span), "description");
|
|
97
96
|
|
|
98
97
|
exports.MenuContent = MenuContent;
|
|
99
98
|
exports.MenuItem = MenuItem;
|
|
@@ -12,8 +12,7 @@ import { jsx } from 'react/jsx-runtime';
|
|
|
12
12
|
import { Menu, useMenuContext, useMenuItemContext } from '@seed-design/react-menu';
|
|
13
13
|
import { menu } from '@seed-design/css/recipes/menu';
|
|
14
14
|
import { menuItem } from '@seed-design/css/recipes/menu-item';
|
|
15
|
-
import { Primitive } from '
|
|
16
|
-
import { c as createSlotRecipeContext, a as createWithStateProps, b as clsx } from './DataTable-12s-Bd20OuMs.js';
|
|
15
|
+
import { c as createSlotRecipeContext, a as createWithStateProps, P as Primitive, b as clsx } from './DataTable-12s-D02v6Qj5.js';
|
|
17
16
|
import * as React from 'react';
|
|
18
17
|
|
|
19
18
|
const { ClassNamesProvider, withContext, useClassNames } = createSlotRecipeContext(menu);
|
|
@@ -15,8 +15,7 @@ import { mergeProps } from '@seed-design/dom-utils';
|
|
|
15
15
|
import { select } from '@seed-design/css/recipes/select';
|
|
16
16
|
import { selectTrigger } from '@seed-design/css/recipes/select-trigger';
|
|
17
17
|
import { selectItem } from '@seed-design/css/recipes/select-item';
|
|
18
|
-
import { Primitive } from '
|
|
19
|
-
import { c as createSlotRecipeContext, a as createWithStateProps, I as InternalIcon, b as clsx, s as splitMultipleVariantsProps } from './DataTable-12s-Bd20OuMs.js';
|
|
18
|
+
import { c as createSlotRecipeContext, a as createWithStateProps, I as InternalIcon, P as Primitive, b as clsx, s as splitMultipleVariantsProps } from './DataTable-12s-D02v6Qj5.js';
|
|
20
19
|
import * as React from 'react';
|
|
21
20
|
|
|
22
21
|
// A select-only combobox spans three specs — the trigger, the floating listbox
|