@birdycom/omniaui-react 0.12.5 → 0.12.6
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/dist/index.d.ts +323 -35
- package/dist/index.js +2642 -1701
- package/manifest.json +90 -6
- package/package.json +1 -1
- package/src/blocks/BlockAppShell.tsx +1 -1
- package/src/blocks/BlockProfileHeader.tsx +20 -3
- package/src/components/Attachment.tsx +1 -1
- package/src/components/AvatarPicker.tsx +68 -0
- package/src/components/Barcode.tsx +42 -0
- package/src/components/Breadcrumb.tsx +8 -4
- package/src/components/Button.tsx +22 -7
- package/src/components/ChatComposer.tsx +1 -1
- package/src/components/DataTable.tsx +182 -33
- package/src/components/DateField.tsx +41 -0
- package/src/components/EmojiPicker.tsx +2 -2
- package/src/components/FormSection.tsx +32 -0
- package/src/components/Gallery.tsx +56 -0
- package/src/components/Glass.tsx +5 -3
- package/src/components/GlassBar.tsx +42 -0
- package/src/components/LazyImage.tsx +45 -0
- package/src/components/Message.tsx +7 -7
- package/src/components/MessageThread.tsx +10 -10
- package/src/components/MeterRow.tsx +38 -0
- package/src/components/NameCard.tsx +59 -0
- package/src/components/Price.tsx +45 -0
- package/src/components/Prose.tsx +3 -3
- package/src/components/Quantity.tsx +55 -0
- package/src/components/Rating.tsx +69 -0
- package/src/components/Ribbon.tsx +30 -0
- package/src/components/SpecList.tsx +36 -0
- package/src/components/Stock.tsx +28 -0
- package/src/index.ts +15 -1
- package/src/utils.ts +1 -1
- package/src/components/ColumnMenu.tsx +0 -66
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
// File: packages/react/src/components/ColumnMenu.tsx
|
|
2
|
-
// Map: ColumnMenu = scope -> toolbar trigger -> popover (title, form with one checkbox per column, reset) -> children (the table)
|
|
3
|
-
// Hiding columns is pure CSS: an unchecked [data-col="n"] hides column n inside the scope (n = 1-10).
|
|
4
|
-
// The checkboxes are uncontrolled, so "Reset" (a form reset) restores the defaults.
|
|
5
|
-
import { forwardRef, useId } from "react";
|
|
6
|
-
import type { HTMLAttributes, ReactNode } from "react";
|
|
7
|
-
import { attrs, cx } from "../utils";
|
|
8
|
-
|
|
9
|
-
export interface ColumnMenuColumn {
|
|
10
|
-
label: ReactNode;
|
|
11
|
-
/** Visible at the start (default true). */
|
|
12
|
-
visible?: boolean;
|
|
13
|
-
/** Always visible; the checkbox is disabled. */
|
|
14
|
-
locked?: boolean;
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
export interface ColumnMenuProps extends Omit<HTMLAttributes<HTMLDivElement>, "title"> {
|
|
18
|
-
/** One entry per table column, in column order (max 10). */
|
|
19
|
-
columns: ColumnMenuColumn[];
|
|
20
|
-
/** The table (`.oc-table`) the menu controls. */
|
|
21
|
-
children: ReactNode;
|
|
22
|
-
triggerLabel?: ReactNode;
|
|
23
|
-
title?: ReactNode;
|
|
24
|
-
resetLabel?: ReactNode;
|
|
25
|
-
/** Called with the column number (1-based) and its new visibility. */
|
|
26
|
-
onColumnToggle?: (column: number, visible: boolean) => void;
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
/** `.oc-column-menu-scope` with a `.oc-column-menu[popover]` column checklist. */
|
|
30
|
-
export const ColumnMenu = forwardRef<HTMLDivElement, ColumnMenuProps>(function ColumnMenu(
|
|
31
|
-
{ columns, children, triggerLabel = "Columns", title = "Visible columns", resetLabel = "Reset", onColumnToggle, className, ...rest },
|
|
32
|
-
ref,
|
|
33
|
-
) {
|
|
34
|
-
const menuId = `oc-column-menu-${useId().replace(/:/g, "")}`;
|
|
35
|
-
return (
|
|
36
|
-
<div ref={ref} className={cx("oc-column-menu-scope", className)} {...rest}>
|
|
37
|
-
<div className="oc-table-toolbar">
|
|
38
|
-
<span className="oc-table-toolbar-spacer" />
|
|
39
|
-
<button className="oc-btn oc-btn--outline oc-btn--sm" type="button" popoverTarget={menuId}>
|
|
40
|
-
{triggerLabel}
|
|
41
|
-
</button>
|
|
42
|
-
</div>
|
|
43
|
-
<div className="oc-column-menu" id={menuId} {...attrs({ popover: "" })}>
|
|
44
|
-
<p className="oc-column-menu-title">{title}</p>
|
|
45
|
-
<form className="oc-column-menu-list">
|
|
46
|
-
{columns.map((col, i) => (
|
|
47
|
-
<label className="oc-column-menu-item" key={i}>
|
|
48
|
-
<input
|
|
49
|
-
type="checkbox"
|
|
50
|
-
data-col={i + 1}
|
|
51
|
-
defaultChecked={col.locked || col.visible !== false}
|
|
52
|
-
disabled={col.locked}
|
|
53
|
-
onChange={(e) => onColumnToggle?.(i + 1, e.currentTarget.checked)}
|
|
54
|
-
/>{" "}
|
|
55
|
-
{col.label}
|
|
56
|
-
</label>
|
|
57
|
-
))}
|
|
58
|
-
<div className="oc-column-menu-footer">
|
|
59
|
-
<button className="oc-btn oc-btn--ghost oc-btn--sm" type="reset">{resetLabel}</button>
|
|
60
|
-
</div>
|
|
61
|
-
</form>
|
|
62
|
-
</div>
|
|
63
|
-
{children}
|
|
64
|
-
</div>
|
|
65
|
-
);
|
|
66
|
-
});
|