@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
package/README.md
CHANGED
|
@@ -4,11 +4,23 @@ A publishable build of seed-design's Attio-measured `DataTable`, for apps that
|
|
|
4
4
|
already run `@seed-design/*` (e.g. an existing seed-design-based admin). The
|
|
5
5
|
JS bundle does **not** vendor a second copy of seed-design — every published
|
|
6
6
|
`@seed-design/*` package `DataTable` touches is a peer dependency, so your app
|
|
7
|
-
supplies one shared instance instead of shipping two.
|
|
8
|
-
|
|
9
|
-
`
|
|
10
|
-
|
|
11
|
-
|
|
7
|
+
supplies one shared instance instead of shipping two. Two exceptions:
|
|
8
|
+
|
|
9
|
+
- `@seed-design/react-data-table` (the headless data-table primitives this
|
|
10
|
+
`DataTable` is built on) isn't published to npm yet, so it's bundled in
|
|
11
|
+
rather than declared as a peer — there is no existing instance of it in your
|
|
12
|
+
app to dedupe against.
|
|
13
|
+
- `@seed-design/react-primitive` is ALSO bundled in, even though a package by
|
|
14
|
+
that name and version *is* published upstream: this fork's copy adds
|
|
15
|
+
`table`/`thead`/`tbody`/`tfoot`/`tr`/`th`/`td` primitives (see
|
|
16
|
+
`packages/react-headless/primitive/src/index.tsx`) that `DataTable` needs
|
|
17
|
+
for a real `<table>` grid, without bumping the version number, so a published
|
|
18
|
+
`@seed-design/react-primitive@2.0.1` installed from the real npm registry
|
|
19
|
+
(what any existing seed-design app already has) does NOT have them —
|
|
20
|
+
declaring it a peer crashes at render (`Cannot read properties of undefined
|
|
21
|
+
(reading 'displayName')`, from `Primitive.tfoot`/`.td` being `undefined`).
|
|
22
|
+
Bundling means two copies of this (small) module ship if your app already
|
|
23
|
+
depends on it, which is the right trade against a hard crash.
|
|
12
24
|
|
|
13
25
|
This is a derivative of [SEED Design](https://github.com/daangn/seed-design)'s
|
|
14
26
|
`DataTable` (`@seed-design/react`), repackaged under a different scope for
|
|
@@ -23,14 +35,14 @@ npm install @crispy-seed/data-table react react-dom
|
|
|
23
35
|
You also need the peer `@seed-design/*` packages `DataTable` imports —
|
|
24
36
|
`@seed-design/dom-utils`, `@seed-design/react-checkbox`,
|
|
25
37
|
`@seed-design/react-field`, `@seed-design/react-image`,
|
|
26
|
-
`@seed-design/react-menu`, `@seed-design/react-
|
|
27
|
-
`@seed-design/react-
|
|
28
|
-
`@seed-design/react-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
`@seed-design/react-data-table`
|
|
33
|
-
separately.
|
|
38
|
+
`@seed-design/react-menu`, `@seed-design/react-scale-feedback`,
|
|
39
|
+
`@seed-design/react-segmented-control`, `@seed-design/react-select`,
|
|
40
|
+
`@seed-design/react-switch`, `@seed-design/react-text-field` (see
|
|
41
|
+
`peerDependencies` in `package.json` for the version ranges). If your app
|
|
42
|
+
already depends on `@seed-design/react`, it already has all of these
|
|
43
|
+
transitively — nothing new to install.
|
|
44
|
+
`@seed-design/react-data-table` and `@seed-design/react-primitive` are bundled
|
|
45
|
+
in (see above) — do not install either separately.
|
|
34
46
|
|
|
35
47
|
You also need **`@seed-design/css@^2.8.0`** installed, even though it isn't in
|
|
36
48
|
`peerDependencies`: the JS imports 14 of its recipes
|
|
@@ -11,20 +11,19 @@ function __insertCSS(code) {
|
|
|
11
11
|
import * as React from 'react';
|
|
12
12
|
import { forwardRef, useContext, createContext } from 'react';
|
|
13
13
|
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
14
|
-
import { D as DataTableTable$1, a as DataTableHeader$1, b as DataTableHeaderCell$1, c as DataTableRow$1, d as DataTableCell$1, e as DataTableRoot, f as DataTableBody$1, u as useDataTableContext, g as useDataTableRowContext } from './DataTable-12s-Zml1x9Kr-12s-
|
|
14
|
+
import { D as DataTableTable$1, a as DataTableHeader$1, b as DataTableHeaderCell$1, c as DataTableRow$1, d as DataTableCell$1, e as DataTableRoot, f as DataTableBody$1, u as useDataTableContext, g as useDataTableRowContext } from './DataTable-12s-Zml1x9Kr-12s-BR-yHfob.js';
|
|
15
15
|
import { mergeProps as mergeProps$1, dataAttr } from '@seed-design/dom-utils';
|
|
16
|
-
import { Primitive } from '@seed-design/react-primitive';
|
|
17
16
|
import { checkbox } from '@seed-design/css/recipes/checkbox';
|
|
18
17
|
import { checkmark } from '@seed-design/css/recipes/checkmark';
|
|
19
18
|
import { Checkbox, useCheckboxContext } from '@seed-design/react-checkbox';
|
|
20
19
|
import { useScaleFeedback } from '@seed-design/react-scale-feedback';
|
|
21
20
|
import { checkboxGroup } from '@seed-design/css/recipes/checkbox-group';
|
|
22
|
-
import { C as ColumnBodyCells } from './body-cells-12s-
|
|
23
|
-
import { C as ColumnCalcCells } from './column-calc-12s-
|
|
24
|
-
import { s as stickyProps, u as useEffectiveColumns } from './column-layout-12s-
|
|
25
|
-
import { C as ColumnHeaderCells } from './column-menu-12s-
|
|
26
|
-
import { L as LoadingStateContent, E as EmptyStateContent, I as InfiniteScrollRow, A as AddRowFooter } from './states-12s-
|
|
27
|
-
import { D as DataTableToolbar, S as SearchBox, R as RowCount } from './toolbar-12s-
|
|
21
|
+
import { C as ColumnBodyCells } from './body-cells-12s-Ba2uF4T-.js';
|
|
22
|
+
import { C as ColumnCalcCells } from './column-calc-12s-C1-I2KdV.js';
|
|
23
|
+
import { s as stickyProps, u as useEffectiveColumns } from './column-layout-12s-BhQmNTJG.js';
|
|
24
|
+
import { C as ColumnHeaderCells } from './column-menu-12s-6Yvu4SZ0.js';
|
|
25
|
+
import { L as LoadingStateContent, E as EmptyStateContent, I as InfiniteScrollRow, A as AddRowFooter } from './states-12s-m5mBR90e.js';
|
|
26
|
+
import { D as DataTableToolbar, S as SearchBox, R as RowCount } from './toolbar-12s-B1xiS-Zu.js';
|
|
28
27
|
|
|
29
28
|
// src/IconChevronDownLine.tsx
|
|
30
29
|
var Icon$a = ({ size = 24, ...props }, ref)=>/* @__PURE__ */ jsx("svg", {
|
|
@@ -292,176 +291,6 @@ var Icon = ({ size = 24, ...props }, ref)=>/* @__PURE__ */ jsx("svg", {
|
|
|
292
291
|
var IconCheckmarkFatFill = /*#__PURE__*/ forwardRef(Icon);
|
|
293
292
|
var IconCheckmarkFatFill_default = IconCheckmarkFatFill;
|
|
294
293
|
|
|
295
|
-
function r(e) {
|
|
296
|
-
var t, f, n = "";
|
|
297
|
-
if ("string" == typeof e || "number" == typeof e) n += e;
|
|
298
|
-
else if ("object" == typeof e) if (Array.isArray(e)) {
|
|
299
|
-
var o = e.length;
|
|
300
|
-
for(t = 0; t < o; t++)e[t] && (f = r(e[t])) && (n && (n += " "), n += f);
|
|
301
|
-
} else for(f in e)e[f] && (n && (n += " "), n += f);
|
|
302
|
-
return n;
|
|
303
|
-
}
|
|
304
|
-
function clsx() {
|
|
305
|
-
for(var e, t, f = 0, n = "", o = arguments.length; f < o; f++)(e = arguments[f]) && (t = r(e)) && (n && (n += " "), n += t);
|
|
306
|
-
return n;
|
|
307
|
-
}
|
|
308
|
-
|
|
309
|
-
function splitMultipleVariantsProps(props, recipesMap) {
|
|
310
|
-
const multipleVariantsProps = {};
|
|
311
|
-
const extractedKeys = new Set();
|
|
312
|
-
for(const recipeKey in recipesMap){
|
|
313
|
-
const recipe = recipesMap[recipeKey];
|
|
314
|
-
const [variantProps] = recipe.splitVariantProps(props);
|
|
315
|
-
multipleVariantsProps[recipeKey] = variantProps;
|
|
316
|
-
for(const variantPropKey in variantProps){
|
|
317
|
-
extractedKeys.add(variantPropKey);
|
|
318
|
-
}
|
|
319
|
-
}
|
|
320
|
-
const remainingProps = {};
|
|
321
|
-
for(const propKey in props){
|
|
322
|
-
if (extractedKeys.has(propKey)) continue;
|
|
323
|
-
remainingProps[propKey] = props[propKey];
|
|
324
|
-
}
|
|
325
|
-
return [
|
|
326
|
-
multipleVariantsProps,
|
|
327
|
-
remainingProps
|
|
328
|
-
];
|
|
329
|
-
}
|
|
330
|
-
|
|
331
|
-
/** Restores defaults overwritten by explicitly passed undefined values. */ function restoreDefaultProps(props, defaultProps) {
|
|
332
|
-
if (!defaultProps) return;
|
|
333
|
-
for (const key of Object.keys(defaultProps)){
|
|
334
|
-
if (props[key] === undefined) {
|
|
335
|
-
props[key] = defaultProps[key];
|
|
336
|
-
}
|
|
337
|
-
}
|
|
338
|
-
}
|
|
339
|
-
|
|
340
|
-
function createSlotRecipeContext(recipe) {
|
|
341
|
-
const ClassNamesContext = /*#__PURE__*/ createContext(null);
|
|
342
|
-
const PropsContext = /*#__PURE__*/ createContext(null);
|
|
343
|
-
const ClassNamesProvider = ({ children, value })=>{
|
|
344
|
-
return /*#__PURE__*/ jsx(ClassNamesContext.Provider, {
|
|
345
|
-
value: value,
|
|
346
|
-
children: children
|
|
347
|
-
});
|
|
348
|
-
};
|
|
349
|
-
const PropsProvider = ({ children, value })=>{
|
|
350
|
-
return /*#__PURE__*/ jsx(PropsContext.Provider, {
|
|
351
|
-
value: value,
|
|
352
|
-
children: children
|
|
353
|
-
});
|
|
354
|
-
};
|
|
355
|
-
function useClassNames() {
|
|
356
|
-
const context = useContext(ClassNamesContext);
|
|
357
|
-
if (context === null) {
|
|
358
|
-
throw new Error("useClassNames must be used within a ClassNamesProvider. Did you forget to wrap your component in a ClassNamesProvider?");
|
|
359
|
-
}
|
|
360
|
-
return context;
|
|
361
|
-
}
|
|
362
|
-
function useProps() {
|
|
363
|
-
return useContext(PropsContext);
|
|
364
|
-
}
|
|
365
|
-
const withRootProvider = (Component, options)=>{
|
|
366
|
-
const { defaultProps } = options ?? {};
|
|
367
|
-
const StyledComponent = (innerProps)=>{
|
|
368
|
-
const props = {
|
|
369
|
-
...defaultProps ?? {},
|
|
370
|
-
...useProps(),
|
|
371
|
-
...innerProps
|
|
372
|
-
};
|
|
373
|
-
restoreDefaultProps(props, defaultProps);
|
|
374
|
-
const [variantProps, otherProps] = recipe.splitVariantProps(props);
|
|
375
|
-
const classNames = recipe(variantProps); // TODO: should we memoize this?
|
|
376
|
-
return /*#__PURE__*/ jsx(ClassNamesProvider, {
|
|
377
|
-
value: classNames,
|
|
378
|
-
children: /*#__PURE__*/ jsx(Component, {
|
|
379
|
-
...otherProps
|
|
380
|
-
})
|
|
381
|
-
});
|
|
382
|
-
};
|
|
383
|
-
// @ts-ignore
|
|
384
|
-
StyledComponent.displayName = Component.displayName || Component.name;
|
|
385
|
-
return StyledComponent;
|
|
386
|
-
};
|
|
387
|
-
const withProvider = (Component, slot, options)=>{
|
|
388
|
-
const { defaultProps } = options ?? {};
|
|
389
|
-
const StyledComponent = /*#__PURE__*/ forwardRef((innerProps, ref)=>{
|
|
390
|
-
const props = {
|
|
391
|
-
...defaultProps ?? {},
|
|
392
|
-
...useProps(),
|
|
393
|
-
...innerProps
|
|
394
|
-
};
|
|
395
|
-
restoreDefaultProps(props, defaultProps);
|
|
396
|
-
const [variantProps, otherProps] = recipe.splitVariantProps(props);
|
|
397
|
-
const classNames = recipe(variantProps); // TODO: should we memoize this?
|
|
398
|
-
const className = classNames[slot];
|
|
399
|
-
return /*#__PURE__*/ jsx(ClassNamesProvider, {
|
|
400
|
-
value: classNames,
|
|
401
|
-
children: /*#__PURE__*/ jsx(Component, {
|
|
402
|
-
ref: ref,
|
|
403
|
-
...otherProps,
|
|
404
|
-
className: clsx(className, props.className)
|
|
405
|
-
})
|
|
406
|
-
});
|
|
407
|
-
});
|
|
408
|
-
// @ts-ignore
|
|
409
|
-
StyledComponent.displayName = Component.displayName || Component.name;
|
|
410
|
-
return StyledComponent;
|
|
411
|
-
};
|
|
412
|
-
const withContext = (Component, slot)=>{
|
|
413
|
-
const StyledComponent = /*#__PURE__*/ forwardRef((props, ref)=>{
|
|
414
|
-
const classNames = useClassNames();
|
|
415
|
-
const className = classNames?.[slot];
|
|
416
|
-
return /*#__PURE__*/ jsx(Component, {
|
|
417
|
-
ref: ref,
|
|
418
|
-
...props,
|
|
419
|
-
className: clsx(className, props.className)
|
|
420
|
-
});
|
|
421
|
-
});
|
|
422
|
-
// @ts-ignore
|
|
423
|
-
StyledComponent.displayName = Component.displayName || Component.name;
|
|
424
|
-
return StyledComponent;
|
|
425
|
-
};
|
|
426
|
-
return {
|
|
427
|
-
ClassNamesProvider,
|
|
428
|
-
PropsProvider,
|
|
429
|
-
useClassNames,
|
|
430
|
-
useProps,
|
|
431
|
-
withRootProvider,
|
|
432
|
-
withProvider,
|
|
433
|
-
withContext
|
|
434
|
-
};
|
|
435
|
-
}
|
|
436
|
-
|
|
437
|
-
function createWithStateProps(useContexts) {
|
|
438
|
-
return function withStateProps(Component) {
|
|
439
|
-
const Node = /*#__PURE__*/ forwardRef((props, ref)=>{
|
|
440
|
-
const stateProps = {};
|
|
441
|
-
for (const contextConfig of useContexts){
|
|
442
|
-
if (typeof contextConfig === "function") {
|
|
443
|
-
Object.assign(stateProps, contextConfig({
|
|
444
|
-
strict: true
|
|
445
|
-
})?.stateProps);
|
|
446
|
-
} else {
|
|
447
|
-
const { useContext, strict = false } = contextConfig;
|
|
448
|
-
Object.assign(stateProps, useContext({
|
|
449
|
-
strict
|
|
450
|
-
})?.stateProps);
|
|
451
|
-
}
|
|
452
|
-
}
|
|
453
|
-
// @ts-ignore
|
|
454
|
-
return /*#__PURE__*/ jsx(Component, {
|
|
455
|
-
ref: ref,
|
|
456
|
-
...stateProps,
|
|
457
|
-
...props
|
|
458
|
-
});
|
|
459
|
-
});
|
|
460
|
-
Node.displayName = Component.displayName || Component.name;
|
|
461
|
-
return Node;
|
|
462
|
-
};
|
|
463
|
-
}
|
|
464
|
-
|
|
465
294
|
var __defProp$1 = Object.defineProperty;
|
|
466
295
|
var __name$1 = (target, value)=>__defProp$1(target, "name", {
|
|
467
296
|
value,
|
|
@@ -505,20 +334,6 @@ function useComposedRefs(...refs) {
|
|
|
505
334
|
}
|
|
506
335
|
__name$1(useComposedRefs, "useComposedRefs");
|
|
507
336
|
|
|
508
|
-
function withScaleFeedback(Component) {
|
|
509
|
-
const Pressable = /*#__PURE__*/ React.forwardRef((props, ref)=>{
|
|
510
|
-
const { scaleFeedbackRef, scaleFeedbackClassName } = useScaleFeedback();
|
|
511
|
-
const composedRef = useComposedRefs(scaleFeedbackRef, ref);
|
|
512
|
-
return /*#__PURE__*/ jsx(Component, {
|
|
513
|
-
...props,
|
|
514
|
-
ref: composedRef,
|
|
515
|
-
className: clsx(scaleFeedbackClassName, props.className)
|
|
516
|
-
});
|
|
517
|
-
});
|
|
518
|
-
Pressable.displayName = Component.displayName;
|
|
519
|
-
return Pressable;
|
|
520
|
-
}
|
|
521
|
-
|
|
522
337
|
var __defProp = Object.defineProperty;
|
|
523
338
|
var __name = (target, value)=>__defProp(target, "name", {
|
|
524
339
|
value,
|
|
@@ -664,6 +479,232 @@ var createSlottableError = /* @__PURE__ */ __name((ownerName)=>{
|
|
|
664
479
|
}, "createSlottableError");
|
|
665
480
|
var use = React[" use ".trim().toString()];
|
|
666
481
|
|
|
482
|
+
function createPrimitive(node) {
|
|
483
|
+
const Node = /*#__PURE__*/ React.forwardRef((props, ref)=>{
|
|
484
|
+
const { asChild, ...primitiveProps } = props;
|
|
485
|
+
const Comp = asChild ? Slot : node;
|
|
486
|
+
return /*#__PURE__*/ jsx(Comp, {
|
|
487
|
+
...primitiveProps,
|
|
488
|
+
ref: ref
|
|
489
|
+
});
|
|
490
|
+
});
|
|
491
|
+
Node.displayName = `Primitive.${node}`;
|
|
492
|
+
return Node;
|
|
493
|
+
}
|
|
494
|
+
const Primitive = {
|
|
495
|
+
div: createPrimitive("div"),
|
|
496
|
+
span: createPrimitive("span"),
|
|
497
|
+
img: createPrimitive("img"),
|
|
498
|
+
button: createPrimitive("button"),
|
|
499
|
+
label: createPrimitive("label"),
|
|
500
|
+
input: createPrimitive("input"),
|
|
501
|
+
textarea: createPrimitive("textarea"),
|
|
502
|
+
a: createPrimitive("a"),
|
|
503
|
+
p: createPrimitive("p"),
|
|
504
|
+
h2: createPrimitive("h2"),
|
|
505
|
+
ul: createPrimitive("ul"),
|
|
506
|
+
li: createPrimitive("li"),
|
|
507
|
+
nav: createPrimitive("nav"),
|
|
508
|
+
svg: createPrimitive("svg"),
|
|
509
|
+
circle: createPrimitive("circle"),
|
|
510
|
+
// Native table elements -- DataTable's own rendering (crispy-seed's addition, not
|
|
511
|
+
// upstream seed-design) needs these for a real `<table>` grid rather than a
|
|
512
|
+
// `display: flex` div grid faked with ARIA roles.
|
|
513
|
+
table: createPrimitive("table"),
|
|
514
|
+
thead: createPrimitive("thead"),
|
|
515
|
+
tbody: createPrimitive("tbody"),
|
|
516
|
+
tfoot: createPrimitive("tfoot"),
|
|
517
|
+
tr: createPrimitive("tr"),
|
|
518
|
+
th: createPrimitive("th"),
|
|
519
|
+
td: createPrimitive("td"),
|
|
520
|
+
colgroup: createPrimitive("colgroup"),
|
|
521
|
+
col: createPrimitive("col")
|
|
522
|
+
};
|
|
523
|
+
|
|
524
|
+
function r(e) {
|
|
525
|
+
var t, f, n = "";
|
|
526
|
+
if ("string" == typeof e || "number" == typeof e) n += e;
|
|
527
|
+
else if ("object" == typeof e) if (Array.isArray(e)) {
|
|
528
|
+
var o = e.length;
|
|
529
|
+
for(t = 0; t < o; t++)e[t] && (f = r(e[t])) && (n && (n += " "), n += f);
|
|
530
|
+
} else for(f in e)e[f] && (n && (n += " "), n += f);
|
|
531
|
+
return n;
|
|
532
|
+
}
|
|
533
|
+
function clsx() {
|
|
534
|
+
for(var e, t, f = 0, n = "", o = arguments.length; f < o; f++)(e = arguments[f]) && (t = r(e)) && (n && (n += " "), n += t);
|
|
535
|
+
return n;
|
|
536
|
+
}
|
|
537
|
+
|
|
538
|
+
function splitMultipleVariantsProps(props, recipesMap) {
|
|
539
|
+
const multipleVariantsProps = {};
|
|
540
|
+
const extractedKeys = new Set();
|
|
541
|
+
for(const recipeKey in recipesMap){
|
|
542
|
+
const recipe = recipesMap[recipeKey];
|
|
543
|
+
const [variantProps] = recipe.splitVariantProps(props);
|
|
544
|
+
multipleVariantsProps[recipeKey] = variantProps;
|
|
545
|
+
for(const variantPropKey in variantProps){
|
|
546
|
+
extractedKeys.add(variantPropKey);
|
|
547
|
+
}
|
|
548
|
+
}
|
|
549
|
+
const remainingProps = {};
|
|
550
|
+
for(const propKey in props){
|
|
551
|
+
if (extractedKeys.has(propKey)) continue;
|
|
552
|
+
remainingProps[propKey] = props[propKey];
|
|
553
|
+
}
|
|
554
|
+
return [
|
|
555
|
+
multipleVariantsProps,
|
|
556
|
+
remainingProps
|
|
557
|
+
];
|
|
558
|
+
}
|
|
559
|
+
|
|
560
|
+
/** Restores defaults overwritten by explicitly passed undefined values. */ function restoreDefaultProps(props, defaultProps) {
|
|
561
|
+
if (!defaultProps) return;
|
|
562
|
+
for (const key of Object.keys(defaultProps)){
|
|
563
|
+
if (props[key] === undefined) {
|
|
564
|
+
props[key] = defaultProps[key];
|
|
565
|
+
}
|
|
566
|
+
}
|
|
567
|
+
}
|
|
568
|
+
|
|
569
|
+
function createSlotRecipeContext(recipe) {
|
|
570
|
+
const ClassNamesContext = /*#__PURE__*/ createContext(null);
|
|
571
|
+
const PropsContext = /*#__PURE__*/ createContext(null);
|
|
572
|
+
const ClassNamesProvider = ({ children, value })=>{
|
|
573
|
+
return /*#__PURE__*/ jsx(ClassNamesContext.Provider, {
|
|
574
|
+
value: value,
|
|
575
|
+
children: children
|
|
576
|
+
});
|
|
577
|
+
};
|
|
578
|
+
const PropsProvider = ({ children, value })=>{
|
|
579
|
+
return /*#__PURE__*/ jsx(PropsContext.Provider, {
|
|
580
|
+
value: value,
|
|
581
|
+
children: children
|
|
582
|
+
});
|
|
583
|
+
};
|
|
584
|
+
function useClassNames() {
|
|
585
|
+
const context = useContext(ClassNamesContext);
|
|
586
|
+
if (context === null) {
|
|
587
|
+
throw new Error("useClassNames must be used within a ClassNamesProvider. Did you forget to wrap your component in a ClassNamesProvider?");
|
|
588
|
+
}
|
|
589
|
+
return context;
|
|
590
|
+
}
|
|
591
|
+
function useProps() {
|
|
592
|
+
return useContext(PropsContext);
|
|
593
|
+
}
|
|
594
|
+
const withRootProvider = (Component, options)=>{
|
|
595
|
+
const { defaultProps } = options ?? {};
|
|
596
|
+
const StyledComponent = (innerProps)=>{
|
|
597
|
+
const props = {
|
|
598
|
+
...defaultProps ?? {},
|
|
599
|
+
...useProps(),
|
|
600
|
+
...innerProps
|
|
601
|
+
};
|
|
602
|
+
restoreDefaultProps(props, defaultProps);
|
|
603
|
+
const [variantProps, otherProps] = recipe.splitVariantProps(props);
|
|
604
|
+
const classNames = recipe(variantProps); // TODO: should we memoize this?
|
|
605
|
+
return /*#__PURE__*/ jsx(ClassNamesProvider, {
|
|
606
|
+
value: classNames,
|
|
607
|
+
children: /*#__PURE__*/ jsx(Component, {
|
|
608
|
+
...otherProps
|
|
609
|
+
})
|
|
610
|
+
});
|
|
611
|
+
};
|
|
612
|
+
// @ts-ignore
|
|
613
|
+
StyledComponent.displayName = Component.displayName || Component.name;
|
|
614
|
+
return StyledComponent;
|
|
615
|
+
};
|
|
616
|
+
const withProvider = (Component, slot, options)=>{
|
|
617
|
+
const { defaultProps } = options ?? {};
|
|
618
|
+
const StyledComponent = /*#__PURE__*/ forwardRef((innerProps, ref)=>{
|
|
619
|
+
const props = {
|
|
620
|
+
...defaultProps ?? {},
|
|
621
|
+
...useProps(),
|
|
622
|
+
...innerProps
|
|
623
|
+
};
|
|
624
|
+
restoreDefaultProps(props, defaultProps);
|
|
625
|
+
const [variantProps, otherProps] = recipe.splitVariantProps(props);
|
|
626
|
+
const classNames = recipe(variantProps); // TODO: should we memoize this?
|
|
627
|
+
const className = classNames[slot];
|
|
628
|
+
return /*#__PURE__*/ jsx(ClassNamesProvider, {
|
|
629
|
+
value: classNames,
|
|
630
|
+
children: /*#__PURE__*/ jsx(Component, {
|
|
631
|
+
ref: ref,
|
|
632
|
+
...otherProps,
|
|
633
|
+
className: clsx(className, props.className)
|
|
634
|
+
})
|
|
635
|
+
});
|
|
636
|
+
});
|
|
637
|
+
// @ts-ignore
|
|
638
|
+
StyledComponent.displayName = Component.displayName || Component.name;
|
|
639
|
+
return StyledComponent;
|
|
640
|
+
};
|
|
641
|
+
const withContext = (Component, slot)=>{
|
|
642
|
+
const StyledComponent = /*#__PURE__*/ forwardRef((props, ref)=>{
|
|
643
|
+
const classNames = useClassNames();
|
|
644
|
+
const className = classNames?.[slot];
|
|
645
|
+
return /*#__PURE__*/ jsx(Component, {
|
|
646
|
+
ref: ref,
|
|
647
|
+
...props,
|
|
648
|
+
className: clsx(className, props.className)
|
|
649
|
+
});
|
|
650
|
+
});
|
|
651
|
+
// @ts-ignore
|
|
652
|
+
StyledComponent.displayName = Component.displayName || Component.name;
|
|
653
|
+
return StyledComponent;
|
|
654
|
+
};
|
|
655
|
+
return {
|
|
656
|
+
ClassNamesProvider,
|
|
657
|
+
PropsProvider,
|
|
658
|
+
useClassNames,
|
|
659
|
+
useProps,
|
|
660
|
+
withRootProvider,
|
|
661
|
+
withProvider,
|
|
662
|
+
withContext
|
|
663
|
+
};
|
|
664
|
+
}
|
|
665
|
+
|
|
666
|
+
function createWithStateProps(useContexts) {
|
|
667
|
+
return function withStateProps(Component) {
|
|
668
|
+
const Node = /*#__PURE__*/ forwardRef((props, ref)=>{
|
|
669
|
+
const stateProps = {};
|
|
670
|
+
for (const contextConfig of useContexts){
|
|
671
|
+
if (typeof contextConfig === "function") {
|
|
672
|
+
Object.assign(stateProps, contextConfig({
|
|
673
|
+
strict: true
|
|
674
|
+
})?.stateProps);
|
|
675
|
+
} else {
|
|
676
|
+
const { useContext, strict = false } = contextConfig;
|
|
677
|
+
Object.assign(stateProps, useContext({
|
|
678
|
+
strict
|
|
679
|
+
})?.stateProps);
|
|
680
|
+
}
|
|
681
|
+
}
|
|
682
|
+
// @ts-ignore
|
|
683
|
+
return /*#__PURE__*/ jsx(Component, {
|
|
684
|
+
ref: ref,
|
|
685
|
+
...stateProps,
|
|
686
|
+
...props
|
|
687
|
+
});
|
|
688
|
+
});
|
|
689
|
+
Node.displayName = Component.displayName || Component.name;
|
|
690
|
+
return Node;
|
|
691
|
+
};
|
|
692
|
+
}
|
|
693
|
+
|
|
694
|
+
function withScaleFeedback(Component) {
|
|
695
|
+
const Pressable = /*#__PURE__*/ React.forwardRef((props, ref)=>{
|
|
696
|
+
const { scaleFeedbackRef, scaleFeedbackClassName } = useScaleFeedback();
|
|
697
|
+
const composedRef = useComposedRefs(scaleFeedbackRef, ref);
|
|
698
|
+
return /*#__PURE__*/ jsx(Component, {
|
|
699
|
+
...props,
|
|
700
|
+
ref: composedRef,
|
|
701
|
+
className: clsx(scaleFeedbackClassName, props.className)
|
|
702
|
+
});
|
|
703
|
+
});
|
|
704
|
+
Pressable.displayName = Component.displayName;
|
|
705
|
+
return Pressable;
|
|
706
|
+
}
|
|
707
|
+
|
|
667
708
|
const InternalIcon = /*#__PURE__*/ forwardRef(({ svg, ...otherProps }, ref)=>{
|
|
668
709
|
return /*#__PURE__*/ jsx(Slot, {
|
|
669
710
|
ref: ref,
|
|
@@ -1479,4 +1520,4 @@ function SelectAllCheckbox({ label, checkedIcon, indeterminateIcon }) {
|
|
|
1479
1520
|
});
|
|
1480
1521
|
}
|
|
1481
1522
|
|
|
1482
|
-
export { dataTable as A, IconMagnifyingglassLine_default as B, CheckboxRoot as C, DataTableCell as D, DataTable as E, InternalIcon as I, createWithStateProps as a, clsx as b, createSlotRecipeContext as c, IconCheckmarkLine_default as d, CheckboxControl as e, CheckboxIndicator as f, CheckboxHiddenInput as g, getColumnValue as h, DataTableFooterCell as i, IconChevronDownLine_default as j, DataTableHeaderCell as k, DataTableHeaderCellInner as l, DataTableHeaderCellLabel as m, DataTableHeaderCellIcon as n, IconSlider2HorizontalLine_default as o, CheckboxLabel as p, IconDot3HorizontalLine_default as q, IconChevronUpLine_default as r, splitMultipleVariantsProps as s, composeRefs as t, IconChevronDownSmallLine_default as u, IconCheckmarkFatFill_default as v, withScaleFeedback as w, IconPersonCircleLine_default as x, IconPlusLine_default as y, withContext as z };
|
|
1523
|
+
export { dataTable as A, IconMagnifyingglassLine_default as B, CheckboxRoot as C, DataTableCell as D, DataTable as E, InternalIcon as I, Primitive as P, createWithStateProps as a, clsx as b, createSlotRecipeContext as c, IconCheckmarkLine_default as d, CheckboxControl as e, CheckboxIndicator as f, CheckboxHiddenInput as g, getColumnValue as h, DataTableFooterCell as i, IconChevronDownLine_default as j, DataTableHeaderCell as k, DataTableHeaderCellInner as l, DataTableHeaderCellLabel as m, DataTableHeaderCellIcon as n, IconSlider2HorizontalLine_default as o, CheckboxLabel as p, IconDot3HorizontalLine_default as q, IconChevronUpLine_default as r, splitMultipleVariantsProps as s, composeRefs as t, IconChevronDownSmallLine_default as u, IconCheckmarkFatFill_default as v, withScaleFeedback as w, IconPersonCircleLine_default as x, IconPlusLine_default as y, withContext as z };
|