@clicktap/ui 0.19.0 → 0.19.1
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 +1 @@
|
|
|
1
|
-
import{jsx as e,jsxs as
|
|
1
|
+
import{jsx as e,jsxs as f,Fragment as C}from"react/jsx-runtime";import{UNSAFE_PortalProvider as _}from"react-aria";import{Popover as k,ComboBox as N,Label as S,Input as L,Button as y,Text as I,FieldError as j,ListBox as D}from"react-aria-components";import{forwardRef as F}from"react";import{cn as t}from"../../utils/cn.js";import"framer-motion";import{Pulse as P}from"../Loader/Pulse.js";function E({buttonIcon:d,...o}){return d?typeof d=="function"?d(o):d:e("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:t("transition-all ease-in-out duration-200",o.isOpen?"rotate-180":"rotate-0"),children:e("path",{d:"M6 9L12 15L18 9",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:t(["stroke-slate-900",o.isDisabled&&"stroke-slate-400",o.isInvalid&&"stroke-red-500"])})})}function M({listBoxComponent:d,children:o,...r}){return e(d||D,{...r,children:o})}function z({label:d,description:o,errorMessage:r,children:s,placeholder:b,isLoading:l,slots:i,popoverPortalContainer:c,popoverOffset:m,selectedKey:n,className:h,classNames:a,autoComplete:p,...u},v){const g=t("px-0 py-1.5","shadow-[0_10px_15px_-3px_rgba(0,0,0,0.1),0_4px_6px_-4px_rgba(0,0,0,0.1)]","rounded-md","w-[var(--trigger-width)]","bg-white","border border-solid border-slate-300",a?.listContainer),x=e(k,{offset:m,className:g,children:e(M,{listBoxComponent:i?.listBoxComponent,className:t("max-h-80","overflow-y-scroll",a?.list),children:s})}),w=n===void 0?null:n;return e(N,{isDisabled:u.isDisabled||l,"data-has-value":!!n,selectedKey:w,...u,className:t("flex flex-col","w-full",h),children:B=>f(C,{children:[e(S,{className:t("flex","text-xs text-slate-500",a?.label),children:d}),f("div",{className:t("flex","relative","w-full",a?.comboBoxContainer),children:[e(L,{placeholder:b,className:t("border border-solid border-slate-300","text-sm text-slate-900","py-0 px-2","h-10 w-full","m-0","rounded-md","bg-white","transition-all ease-in-out duration-200","data-[hovered]:border-slate-400","data-[focused]:border-slate-400 data-[focused]:outline data-[focused]:outline-2 data-[focused]:outline-slate-200"," data-[disabled]:bg-slate-100 data-[disabled]:border-slate-300",l?"data-[disabled]:text-slate-900":"data-[disabled]:text-slate-500","data-[invalid]:border-red-500 data-[invalid]:bg-red-100 data-[invalid]:text-red-600","data-[invalid]:data-[hovered]:border-red-600","data-[invalid]:data-[focused]:border-red-600 data-[invalid]:data-[focused]:outline data-[invalid]:data-[focused]:outline-2 data-[invalid]:data-[focused]:outline-red-200","data-[invalid]:placeholder:text-slate-400",a?.input),ref:v,autoComplete:p}),l?e("div",{className:t("absolute top-2 right-2","block",a?.loader),children:i?.loadingIcon||e(P,{})}):e(y,{className:t("absolute top-2 right-0","block","border-none","bg-none",a?.arrowButton),children:e(E,{buttonIcon:i?.buttonIcon,...B})})]}),o&&e(I,{slot:"description",className:t("flex","text-xs","text-slate-500",a?.description),children:o}),e(j,{className:t("flex","text-xs","text-red-500",a?.errorMessage),children:r}),c?e(_,{getContainer:c,children:x}):x]})})}const G=F(z);export{G as Select,G as default};
|
|
@@ -15,6 +15,7 @@ export interface SelectProps<T extends object> extends Omit<AriaComboBoxProps<T>
|
|
|
15
15
|
children: ReactNode | ((item: T) => ReactNode);
|
|
16
16
|
slots?: SelectSlots<T>;
|
|
17
17
|
popoverOffset?: number;
|
|
18
|
+
popoverPortalContainer?: () => HTMLElement | null;
|
|
18
19
|
classNames?: SlotsToClasses<'label' | 'name' | 'comboBoxContainer' | 'input' | 'loader' | 'arrowButton' | 'description' | 'errorMessage' | 'listContainer' | 'list'>;
|
|
19
20
|
autoComplete?: HTMLInputAutoCompleteAttribute;
|
|
20
21
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{Option as
|
|
1
|
+
import{Option as c}from"./Option.js";import{Select as n}from"./Select.js";import"react/jsx-runtime";import"react-aria-components";import"../../utils/cn.js";import"react-aria";import"react";import"framer-motion";import"../Loader/Pulse.js";export{c as Option,n as Select};
|