pentatrion-design 0.0.19 → 0.0.20

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.
@@ -96,8 +96,10 @@ export const Autocomplete = forwardRef(function Autocomplete({ className, icon =
96
96
  }), [activeIndex, selection, getItemProps, handleSelect]);
97
97
  const showClearSearchButton = clearSearchButton && (searchValue.trim() !== "" || selection !== null);
98
98
  return (_jsxs("div", { className: className, children: [_jsxs("div", { className: clsx(inputConfig.container, readOnly && "readonly"), ref: refs.setReference, "data-color": color, children: [icon !== false && (_jsxs("div", { className: "relative flex-center", children: [loading && _jsx(Loader, { size: "medium", color: "gray", className: "absolute left-0 top-0" }), icon === true ? (_jsx("span", { className: "h-8 w-8 flex-center", children: _jsx("i", { className: "fe-search" }) })) : (icon)] })), _jsx("input", { spellCheck: "false", className: clsx(inputConfig.input, icon === false && "pl-4"), ref: inputRef, type: "search", readOnly: readOnly, value: searchValue, placeholder: placeholder, "aria-autocomplete": "list", ...getReferenceProps({
99
- onFocus() {
99
+ onClick() {
100
100
  if (selectOnFocus) {
101
+ // it's better to listen onClick instead of onFocus. the event is triggered later and there
102
+ // was an issue if we listen on onFocus and user click on the text of the textarea with Firefox
101
103
  document.activeElement?.select();
102
104
  }
103
105
  },
@@ -9,7 +9,7 @@ export const Input = forwardRef(({ variant = "normal", color = "yellow", disable
9
9
  return (_jsxs("div", { "data-color": color, "data-variant": variant, className: clsx(inputConfig.container, disabled && "disabled", readOnly && "readonly", className), children: [prefix && (_jsx("div", { className: clsx([
10
10
  "relative flex-center",
11
11
  typeof prefix === "string" && "mx-2 select-none text-gray-6",
12
- ]), children: prefix })), _jsx("input", { ref: ref, className: clsx(inputConfig.input, !prefix && "pl-4", !suffix && "pr-4"), disabled: disabled, readOnly: readOnly, onFocus: () => {
12
+ ]), children: prefix })), _jsx("input", { ref: ref, className: clsx(inputConfig.input, !prefix && "pl-4", !suffix && "pr-4"), disabled: disabled, readOnly: readOnly, onClick: () => {
13
13
  if (readOnly) {
14
14
  document.activeElement?.select();
15
15
  }
@@ -2,8 +2,10 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import clsx from "clsx";
3
3
  import { forwardRef } from "react";
4
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: () => {
5
+ return (_jsxs("div", { className: clsx("relative block", className), children: [_jsx("textarea", { "data-color": color, "data-variant": variant, ref: ref, className: clsx("p8n-textarea h-full w-full min-w-0 appearance-none rounded-2xl bg-transparent p-2 outline-offset-[-1px] filter-none", disabled && "disabled", readOnly && "readonly"), readOnly: readOnly, onClick: () => {
6
6
  if (readOnly) {
7
+ // it's better to listen onClick instead of onFocus. the event is triggered later and there
8
+ // was an issue if we listen on onFocus and user click on the text of the textarea with Firefox
7
9
  document.activeElement?.select();
8
10
  }
9
11
  }, disabled: disabled, ...rest }), action && _jsx("div", { className: "absolute right-1 top-1", children: action })] }));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pentatrion-design",
3
- "version": "0.0.19",
3
+ "version": "0.0.20",
4
4
  "description": "",
5
5
  "keywords": [],
6
6
  "author": "Hugues Tavernier",