pentatrion-design 0.0.18 → 0.0.19

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.
@@ -1,7 +1,8 @@
1
- import { ComponentProps } from "react";
1
+ import { ComponentProps, ReactNode } from "react";
2
2
  import type { ThemeColor } from "../../types";
3
3
  export interface TextareaProps extends ComponentProps<"textarea"> {
4
4
  variant?: "normal" | "ghost";
5
5
  color?: ThemeColor;
6
+ action?: ReactNode;
6
7
  }
7
8
  export declare const Textarea: (props: TextareaProps & import("react").RefAttributes<HTMLTextAreaElement>) => React.ReactElement | null;
@@ -1,6 +1,10 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import clsx from "clsx";
3
3
  import { forwardRef } from "react";
4
- export const Textarea = forwardRef(function Textarea({ variant = "normal", color = "yellow", disabled = false, className, ...rest }, ref) {
5
- return (_jsx("textarea", { "data-color": color, "data-variant": variant, ref: ref, className: clsx("p8n-textarea min-w-0 appearance-none rounded-2xl bg-transparent p-2 outline-offset-[-1px] filter-none", disabled && "disabled", className), disabled: disabled, ...rest }));
4
+ export const Textarea = forwardRef(function Textarea({ variant = "normal", color = "yellow", disabled = false, className, readOnly, action, ...rest }, ref) {
5
+ return (_jsxs("div", { className: clsx("relative block", className), children: [_jsx("textarea", { "data-color": color, "data-variant": variant, ref: ref, className: clsx("p8n-textarea w-full min-w-0 appearance-none rounded-2xl bg-transparent p-2 outline-offset-[-1px] filter-none", disabled && "disabled", readOnly && "readonly"), readOnly: readOnly, onFocus: () => {
6
+ if (readOnly) {
7
+ document.activeElement?.select();
8
+ }
9
+ }, disabled: disabled, ...rest }), action && _jsx("div", { className: "absolute right-1 top-1", children: action })] }));
6
10
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pentatrion-design",
3
- "version": "0.0.18",
3
+ "version": "0.0.19",
4
4
  "description": "",
5
5
  "keywords": [],
6
6
  "author": "Hugues Tavernier",
@@ -230,7 +230,7 @@ export const components = {
230
230
  opacity: "0.5",
231
231
  },
232
232
  },
233
- "input[readonly]": {
233
+ ":is(input,textarea)[readonly]": {
234
234
  color: "rgb(var(--color-gray-6))",
235
235
  },
236
236
  ".option": {
@@ -42,16 +42,14 @@ export const pentatrionTw = plugin.withOptions(function (options = {}) {
42
42
  options.vars !== false && addBase(vars);
43
43
  options.base !== false && addBase(base);
44
44
  options.components !== false && addComponents(components);
45
- options.componentsInputOutline !== false &&
46
- addComponents(componentsInputOutline);
47
- options.componentsResizeArea !== false &&
48
- addComponents(componentsResizeArea);
45
+ options.componentsInputOutline !== false && addComponents(componentsInputOutline);
46
+ options.componentsResizeArea !== false && addComponents(componentsResizeArea);
49
47
  options.componentsStep !== false && addComponents(componentsStep);
50
48
  options.utilities !== false && addUtilities(utilities);
51
49
  options.utilitiesDialog !== false && addUtilities(utilitiesDialog);
52
50
  addVariant("active-full", ["&:active", "&.active"]);
53
- // addVariant("focus-full", ["&:focus-within", "&.focus", "&:focus"]);
54
- addVariant("focus-full", ["&:has(input:focus)", "&.focus", "&:focus"]);
51
+ // dbl :focus:focus else :hover will have priority to focus-full variant.
52
+ addVariant("focus-full", ["&:has(input:focus)", "&.focus", "&:focus:focus"]);
55
53
  };
56
54
  }, function () {
57
55
  return {