b44ui 0.2.5 → 0.2.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 CHANGED
@@ -1765,9 +1765,10 @@ export declare const Input: ({ state, cn, cnIgnoreWrongUsage, grow, gap, p, wd,
1765
1765
  export declare const Textarea: ({ cn, cnIgnoreWrongUsage, ref, grow, gap, p, wd, ht, ...rest }: DProps & React.TextareaHTMLAttributes<HTMLTextAreaElement> & {
1766
1766
  ref?: React.RefObject<HTMLTextAreaElement | null>;
1767
1767
  }) => import("react/jsx-runtime").JSX.Element;
1768
- export declare const Select: <T extends SelectValue>({ state, options, cn, cnIgnoreWrongUsage, grow, gap, p, wd, ht, onChange, children, ...rest }: DProps & Omit<React.SelectHTMLAttributes<HTMLSelectElement>, "value" | "defaultValue"> & {
1768
+ export declare const Select: <T extends SelectValue>({ state, options, title, cn, cnIgnoreWrongUsage, grow, gap, p, wd, ht, onChange, children, ...rest }: DProps & Omit<React.SelectHTMLAttributes<HTMLSelectElement>, "value" | "defaultValue" | "title"> & {
1769
1769
  state?: SelectState<T>;
1770
1770
  options?: Record<string, T>;
1771
+ title?: string;
1771
1772
  value?: T;
1772
1773
  defaultValue?: T;
1773
1774
  }) => import("react/jsx-runtime").JSX.Element;
package/dist/index.js CHANGED
@@ -129,16 +129,20 @@ export const Textarea = ({ cn, cnIgnoreWrongUsage, ref, grow, gap, p, wd, ht, ..
129
129
  const c = rcn({ cn, cnIgnoreWrongUsage, className: rest.className });
130
130
  return _jsx("textarea", { ref: ref, ...rest, className: CN('rounded bg-zinc-800 border border-zinc-700 px-3 py-2 text-sm outline-none w-full', growCn(grow), c), style: dStyle({ gap, p, wd, ht, style: rest.style }) });
131
131
  };
132
- export const Select = ({ state, options, cn, cnIgnoreWrongUsage, grow, gap, p, wd, ht, onChange, children, ...rest }) => {
132
+ export const Select = ({ state, options, title, cn, cnIgnoreWrongUsage, grow, gap, p, wd, ht, onChange, children, ...rest }) => {
133
133
  const c = rcn({ cn, cnIgnoreWrongUsage, className: rest.className });
134
134
  const entries = options ? Object.entries(options) : undefined;
135
- return _jsx("select", { ...rest, className: CN('rounded bg-zinc-800 border border-zinc-700 px-3 py-2 text-sm outline-none cursor-pointer', growCn(grow), c), style: dStyle({ gap, p, wd, ht, style: rest.style }), value: state ? state[0] : rest.value, defaultValue: rest.defaultValue, onChange: e => {
135
+ return _jsxs("select", { ...rest, className: CN('rounded bg-zinc-800 border border-zinc-700 px-3 py-2 text-sm outline-none cursor-pointer', growCn(grow), c), style: dStyle({ gap, p, wd, ht, style: rest.style }), value: state ? state[0] : rest.value, defaultValue: rest.defaultValue, onChange: e => {
136
+ if (title && e.target.value === '') {
137
+ onChange?.(e);
138
+ return;
139
+ }
136
140
  const value = entries?.find(([, value]) => String(value) === e.target.value)?.[1] ?? e.target.value;
137
141
  state?.[1](value);
138
142
  onChange?.(e);
139
- }, children: entries
140
- ? entries.map(([label, value]) => _jsx("option", { value: value, children: label }, `${label}:${value}`))
141
- : children });
143
+ }, children: [title && _jsx("option", { value: '', children: title }), entries
144
+ ? entries.map(([label, value]) => _jsx("option", { value: value, children: label }, `${label}:${value}`))
145
+ : children] });
142
146
  };
143
147
  export const Grid = ({ children, cols, gap, ...rest }) => _jsx(D, { ...rest, cn: CN('grid ui-grid', rcn(rest)), gap: gap ?? 4, style: { ['--cols']: cols ?? Children.count(children), ...rest.style }, children: children });
144
148
  export const Scroll = ({ grow = true, ...rest }) => _jsx(D, { ...rest, cn: CN('min-h-0 overflow-y-auto', rcn(rest)), grow: grow });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "b44ui",
3
- "version": "0.2.5",
3
+ "version": "0.2.6",
4
4
  "type": "module",
5
5
  "sideEffects": [
6
6
  "./index.js",