@mich8060/unified-design-system 0.2.34 → 0.2.35
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/components/Dropdown/Dropdown.cjs +1 -1
- package/dist/components/Dropdown/Dropdown.js +1 -1
- package/dist/components/Flex/Flex.cjs +1 -1
- package/dist/components/Flex/Flex.js +1 -1
- package/dist/design-system/components/Dropdown/Dropdown.d.ts +1 -2
- package/dist/design-system/components/Dropdown/Dropdown.types.d.ts +0 -1
- package/dist/style.css +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const a=require("react/jsx-runtime"),l=require("react"),y=require("../Icon/Icon.cjs"),h=require("../ActionMenu/ActionMenu.cjs");;/* empty css */const t="uds-dropdown",b={compact:"compact",default:null},g={default:null,focused:"focused",error:"error",disabled:"disabled"};function k({options:d=[],value:n,onChange:o,placeholder:r,size:m="default",state:f="default",placement:v="bottom-start",id:j,className:S="",disabled:s=!1,...w}){const[c,x]=l.useState(!1),M=l.useId(),N=j||`dropdown-${M}`,u=l.useMemo(()=>d.map(e=>typeof e=="string"?{value:e,label:e}:e),[d]),p=s?"disabled":f==="default"&&c?"focused":f,i=u.find(e=>e.value===n),$=typeof r=="string"&&r.trim().length>0?r.trim():"Select an option",C=i?i.label:$,I=l.useMemo(()=>u.map(e=>({id:e.value,label:e.label,active:e.value===n,onClick:()=>{o&&!s&&o(e.value)}})),[u,n,o,s]),O=[t,b[m]&&`${t}--${b[m]}`,g[p]&&`${t}--${g[p]}`,c&&`${t}--open`,S].filter(Boolean).join(" "),_={...w};delete _.label;const q=a.jsxs("button",{type:"button",id:N,className:`${t}__trigger`,disabled:s,"aria-label":$,..._,children:[a.jsx("span",{className:`${t}__value ${i?"":`${t}__value--placeholder`}`,children:C}),a.jsx(y.default,{name:"CaretDown",size:16,appearance:"regular",className:`${t}__icon ${c?`${t}__icon--open`:""}`})]});return a.jsx("div",{className:`${t}-outer`,children:a.jsx(h.default,{trigger:q,items:I,placement:v,fullWidth:!0,disabled:s,onOpenChange:x,className:O,menuClassName:`${t}__menu`})})}const A=l.memo(k);exports.default=A;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as s,jsxs as
|
|
1
|
+
import{jsx as s,jsxs as j}from"react/jsx-runtime";import k,{useState as A,useId as B,useMemo as _}from"react";import D from"../Icon/Icon.js";import L from"../ActionMenu/ActionMenu.js";/* empty css */const t="uds-dropdown",b={compact:"compact",default:null},g={default:null,focused:"focused",error:"error",disabled:"disabled"};function z({options:i=[],value:o,onChange:l,placeholder:n,size:m="default",state:d="default",placement:v="bottom-start",id:w,className:N="",disabled:a=!1,...C}){const[r,I]=A(!1),S=B(),O=w||`dropdown-${S}`,c=_(()=>i.map(e=>typeof e=="string"?{value:e,label:e}:e),[i]),p=a?"disabled":d==="default"&&r?"focused":d,u=c.find(e=>e.value===o),f=typeof n=="string"&&n.trim().length>0?n.trim():"Select an option",h=u?u.label:f,x=_(()=>c.map(e=>({id:e.value,label:e.label,active:e.value===o,onClick:()=>{l&&!a&&l(e.value)}})),[c,o,l,a]),y=[t,b[m]&&`${t}--${b[m]}`,g[p]&&`${t}--${g[p]}`,r&&`${t}--open`,N].filter(Boolean).join(" "),$={...C};delete $.label;const M=j("button",{type:"button",id:O,className:`${t}__trigger`,disabled:a,"aria-label":f,...$,children:[s("span",{className:`${t}__value ${u?"":`${t}__value--placeholder`}`,children:h}),s(D,{name:"CaretDown",size:16,appearance:"regular",className:`${t}__icon ${r?`${t}__icon--open`:""}`})]});return s("div",{className:`${t}-outer`,children:s(L,{trigger:M,items:x,placement:v,fullWidth:!0,disabled:a,onOpenChange:I,className:y,menuClassName:`${t}__menu`})})}const q=k.memo(z);export{q as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const g=require("react/jsx-runtime"),h=require("react");;/* empty css */const K=new Set(["0","2","4","6","8","10","12","14","16","18","24","32","48","64","80"]);function L(e){return e===!0?"wrap":e===!1||e==null?"nowrap":e}function c(e){return e.replace(/\s+/g,"-")}function M(e,n){if(e)return"flex-start";if(n)return"flex-end"}function O(e,n){if(e)return"flex-start";if(n)return"flex-end"}function V(e){var o;if(e==null)return;const n=String(e).trim();if(n==="auto")return;const t=((o=n.match(/^spacing-(\d+)$/))==null?void 0:o[1])??n;return K.has(t)?`var(--uds-spacing-${t})`:e}function k(e){if(typeof e!="number"||!Number.isFinite(e))return;const n=Math.floor(e);return n>0?n:void 0}const C=h.forwardRef(function({as:n="div",direction:t="row",justifyContent:o,alignItems:l,top:i=!1,bottom:u=!1,left:S=!1,right:R=!1,itemsPerRow:j,ItemsPerRow:A,wrap:b=!1,gap:f,fullWidth:d=!1,span:z=!1,inline:G=!1,className:$,style:r,children:P,...B},I){const x=k(j??A),a=t==="row"&&x!==void 0,N=L(a?!0:b),_=String(f).trim()==="auto",m=M(i,u),p=O(S,R),w=o??(t==="row"?p:m),v=l??(t==="row"?m:p),q=["uds-flex",`uds-flex--direction-${t}`,w&&`uds-flex--justify-${c(w)}`,v&&`uds-flex--align-${c(v)}`,`uds-flex--wrap-${c(N)}`,G&&"uds-flex--inline",d&&"uds-flex--full-width",z&&"uds-flex--span",a&&"uds-flex--items-per-row",_&&"uds-flex--gap-auto",$].filter(Boolean).join(" "),s={},T=V(f),E=(r==null?void 0:r.gap)!=null;return f!=null&&!E&&(s.gap=T),a&&(s["--uds-flex-items-per-row"]=String(x)),d&&(r==null?void 0:r.width)==null&&(s.width="100%"),g.jsx(n,{ref:I,className:q,style:{...s,...r},...B,children:P})}),J=h.forwardRef(function({as:n="div",className:t,children:o,...l},i){const u=["uds-flex__full",t].filter(Boolean).join(" ");return g.jsx(n,{ref:i,className:u,...l,children:o})}),F=C;F.Full=J;exports.Flex=F;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as
|
|
1
|
+
import{jsx as g}from"react/jsx-runtime";import h from"react";/* empty css */const L=new Set(["0","2","4","6","8","10","12","14","16","18","24","32","48","64","80"]);function T(e){return e===!0?"wrap":e===!1||e==null?"nowrap":e}function c(e){return e.replace(/\s+/g,"-")}function V(e,n){if(e)return"flex-start";if(n)return"flex-end"}function k(e,n){if(e)return"flex-start";if(n)return"flex-end"}function C(e){var o;if(e==null)return;const n=String(e).trim();if(n==="auto")return;const t=((o=n.match(/^spacing-(\d+)$/))==null?void 0:o[1])??n;return L.has(t)?`var(--uds-spacing-${t})`:e}function J(e){if(typeof e!="number"||!Number.isFinite(e))return;const n=Math.floor(e);return n>0?n:void 0}const M=h.forwardRef(function({as:n="div",direction:t="row",justifyContent:o,alignItems:l,top:i=!1,bottom:f=!1,left:F=!1,right:S=!1,itemsPerRow:A,ItemsPerRow:R,wrap:z=!1,gap:u,fullWidth:d=!1,span:G=!1,inline:$=!1,className:b,style:r,children:j,...B},I){const m=J(A??R),a=t==="row"&&m!==void 0,N=T(a?!0:z),P=String(u).trim()==="auto",x=V(i,f),p=k(F,S),w=o??(t==="row"?p:x),v=l??(t==="row"?x:p),_=["uds-flex",`uds-flex--direction-${t}`,w&&`uds-flex--justify-${c(w)}`,v&&`uds-flex--align-${c(v)}`,`uds-flex--wrap-${c(N)}`,$&&"uds-flex--inline",d&&"uds-flex--full-width",G&&"uds-flex--span",a&&"uds-flex--items-per-row",P&&"uds-flex--gap-auto",b].filter(Boolean).join(" "),s={},E=C(u),K=(r==null?void 0:r.gap)!=null;return u!=null&&!K&&(s.gap=E),a&&(s["--uds-flex-items-per-row"]=String(m)),d&&(r==null?void 0:r.width)==null&&(s.width="100%"),g(n,{ref:I,className:_,style:{...s,...r},...B,children:j})}),O=h.forwardRef(function({as:n="div",className:t,children:o,...l},i){const f=["uds-flex__full",t].filter(Boolean).join(" ");return g(n,{ref:i,className:f,...l,children:o})}),U=M;U.Full=O;export{U as Flex};
|
|
@@ -14,11 +14,10 @@ import type { DropdownProps } from "./Dropdown.types";
|
|
|
14
14
|
* @param {string} size - Size variant: 'compact' or 'default' (default: 'default')
|
|
15
15
|
* @param {string} state - Visual state: 'default', 'focused', 'error', 'disabled'
|
|
16
16
|
* @param {string} id - Unique identifier for the dropdown
|
|
17
|
-
* @param {string} label - Label text for the dropdown
|
|
18
17
|
* @param {string} className - Additional CSS classes
|
|
19
18
|
* @param {boolean} disabled - Whether the dropdown is disabled
|
|
20
19
|
* @param {object} props - Additional props to pass to the trigger button
|
|
21
20
|
*/
|
|
22
|
-
declare function Dropdown({ options, value, onChange, placeholder, size, state, placement, id,
|
|
21
|
+
declare function Dropdown({ options, value, onChange, placeholder, size, state, placement, id, className, disabled, ...props }: DropdownProps): import("react/jsx-runtime").JSX.Element;
|
|
23
22
|
declare const _default: React.MemoExoticComponent<typeof Dropdown>;
|
|
24
23
|
export default _default;
|