@overdoser/react-toolkit 0.0.7 → 0.0.9

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/AGENTS.md CHANGED
@@ -112,6 +112,7 @@ Full copy-paste-able files live alongside this doc. Each is one self-contained f
112
112
  - [recipes/interactive-area-chart.tsx](./recipes/interactive-area-chart.tsx) — Data-range filter (not series toggle): all series stay visible, the selector picks the time window. Three selector UIs exported: `InteractiveAreaChartTiles`, `InteractiveAreaChartNavigator`, `InteractiveAreaChartDropdown`.
113
113
  - [recipes/interactive-pie-chart.tsx](./recipes/interactive-pie-chart.tsx) — Metric/period filter for `PieChart`: all slices stay visible, the selector picks which metric drives the pie. Three exports: `InteractivePieChartTiles`, `InteractivePieChartNavigator`, `InteractivePieChartDropdown`.
114
114
  - [recipes/trading-chart.tsx](./recipes/trading-chart.tsx) — Full-stack `TradingChart` with a resolution selector, in-memory datafeed adapter, and the SMA/EMA/Bollinger/RSI/Volume indicator stack. Swap `createMemoryDatafeed` for your own REST/WebSocket adapter; everything else carries over.
115
+ - [recipes/tag-input.tsx](./recipes/tag-input.tsx) — Tag-input pattern via `<Select multiple allowCreate>`: pick from existing tags or type a new one + Enter to create. `onCreate` persists the new tag back into the options list. Wired through `<FormField>` for react-hook-form integration.
115
116
 
116
117
  ## Anti-patterns to refuse
117
118
 
@@ -5,8 +5,23 @@ export interface PopoverClasses {
5
5
  popover: string;
6
6
  }
7
7
  export interface PopoverProps {
8
- /** Trigger content. Wrapped in an internal `<button>`. */
8
+ /**
9
+ * Trigger content. By default, wrapped in an internal `<button>` — pass any
10
+ * `ReactNode` (string, icon, fragment). If you need to pass your own
11
+ * interactive element (e.g. a `<Button>`) without the extra wrapping that
12
+ * would nest `<button>` inside `<button>`, set `asChild` and pass a single
13
+ * React element instead.
14
+ */
9
15
  trigger: React.ReactNode;
16
+ /**
17
+ * Render the trigger as-is (no internal `<button>` wrapper) and merge the
18
+ * onClick / `aria-*` handlers + ref into it. The trigger MUST be a single
19
+ * React element whose root is interactive (e.g. a `<button>`, `<a>`, or a
20
+ * `role="button"` element). Use this when nesting `<button>` inside
21
+ * `<button>` would otherwise produce a hydration warning.
22
+ * @default false
23
+ */
24
+ asChild?: boolean;
10
25
  /** Panel content. Rendered inside a `[role="dialog"]` when open. */
11
26
  content: React.ReactNode;
12
27
  /** Side of the trigger to anchor the panel to. @default 'bottom' */
@@ -46,6 +46,24 @@ export interface SelectProps extends Omit<ComponentPropsWithRef<'select'>, 'onCh
46
46
  onValuesChange?: (values: string[]) => void;
47
47
  /** Clear the search query after each toggle in multi mode. @default true */
48
48
  clearSearchOnSelect?: boolean;
49
+ /**
50
+ * Multi-mode only. When `true`, an extra "Create '<query>'" row appears
51
+ * in the menu whenever the search query doesn't match an existing option.
52
+ * Pressing Enter (or clicking the row) adds the trimmed query as a new
53
+ * selected value and fires `onCreate`. @default false
54
+ */
55
+ allowCreate?: boolean;
56
+ /**
57
+ * Multi-mode only. Called with the newly-created value when `allowCreate`
58
+ * is true and the user creates a new tag. Consumers typically persist the
59
+ * new value (e.g. push it into their options list).
60
+ */
61
+ onCreate?: (value: string) => void;
62
+ /**
63
+ * Multi-mode only. Custom render function for the "Create" row body.
64
+ * @default (q) => `Create "${q}"`
65
+ */
66
+ createLabel?: (query: string) => React.ReactNode;
49
67
  }
50
68
  /**
51
69
  * Three internal modes, picked automatically: