@dotss/ui 1.2.1 → 1.2.2

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/Select/Select.cjs CHANGED
@@ -1,4 +1,4 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const a=require("@emotion/react/jsx-runtime"),i=require("react"),P=require("../Backdrop/Backdrop.cjs"),T=require("../Box/Box.cjs"),K=require("../Flexbox/Flexbox.cjs"),U=require("../Icon/Icon.cjs"),X=require("@emotion/styled"),E=require("../utils/getSibling/getSibling.cjs"),G=e=>e&&e.__esModule?e:{default:e},m=G(X),J=m.default.div`
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const a=require("@emotion/react/jsx-runtime"),r=require("react"),P=require("../Backdrop/Backdrop.cjs"),T=require("../Box/Box.cjs"),K=require("../Flexbox/Flexbox.cjs"),U=require("../Icon/Icon.cjs"),X=require("@emotion/styled"),E=require("../utils/getSibling/getSibling.cjs"),G=e=>e&&e.__esModule?e:{default:e},S=G(X),J=S.default.div`
2
2
  display: flex;
3
3
  justify-content: space-between;
4
4
  align-items: center;
@@ -12,12 +12,12 @@
12
12
  color: inherit;
13
13
  }
14
14
 
15
- ${({theme:{palette:{grey:e,background:r}},variant:g})=>{let s={};switch(g){case"outlined":s={border:`1px solid ${e[50]}`,"&[disabled]":{backgroundColor:e[10],border:`1px solid ${e[30]}`,color:e[30],pointerEvents:"none"}};break;case"filled":s={border:"1px solid transparent",backgroundColor:r.primary,"&[disabled]":{backgroundColor:e[10],color:e[30],pointerEvents:"none"}};break}return s}}
15
+ ${({theme:{palette:{grey:e,background:i}},variant:h})=>{let s={};switch(h){case"outlined":s={border:`1px solid ${e[50]}`,"&[disabled]":{backgroundColor:e[10],border:`1px solid ${e[30]}`,color:e[30],cursor:"not-allowed"}};break;case"filled":s={border:"1px solid transparent",backgroundColor:i.primary,"&[disabled]":{backgroundColor:e[10],color:e[30],cursor:"not-allowed"}};break}return s}}
16
16
 
17
- ${({theme:{palette:{brand:e}},isFocused:r})=>r?{border:`1px solid ${e.primary.line}`}:{}}
17
+ ${({theme:{palette:{brand:e}},isFocused:i})=>i?{border:`1px solid ${e.primary.line}`}:{}}
18
18
 
19
- ${({size:e})=>{let r={};switch(e){case"large":r={height:"48px"};break;case"xLarge":r={height:"56px"};break}return r}}
20
- `,N=m.default.div`
19
+ ${({size:e})=>{let i={};switch(e){case"large":i={height:"48px"};break;case"xLarge":i={height:"56px"};break}return i}}
20
+ `,N=S.default.div`
21
21
  display: flex;
22
22
  width: calc(100% - 24px - 8px);
23
23
  gap: ${({theme:e})=>`${e.spacing.content(2)}px`};
@@ -25,18 +25,18 @@
25
25
  color: inherit;
26
26
  }
27
27
 
28
- ${({theme:{typography:e,palette:{grey:r}},value:g})=>{const s={fontSize:e.b2R.size,fontWeight:e.b2R.size,lineHeight:e.b2R.lineHeight,letterSpacing:e.b2R.letterSpacing,"&[disabled]":{color:r[30]}};return g?{...s,color:r[100]}:{...s,color:r[50]}}}
29
- `,Q=m.default.div`
28
+ ${({theme:{typography:e,palette:{grey:i}},value:h})=>{const s={fontSize:e.b2R.size,fontWeight:e.b2R.size,lineHeight:e.b2R.lineHeight,letterSpacing:e.b2R.letterSpacing,"&[disabled]":{color:i[30]}};return h?{...s,color:i[100]}:{...s,color:i[50]}}}
29
+ `,Q=S.default.div`
30
30
  overflow: hidden;
31
31
  text-overflow: ellipsis;
32
32
  white-space: nowrap;
33
- `,Y=m.default.div`
33
+ `,Y=S.default.div`
34
34
  display: flex;
35
35
  align-items: center;
36
36
  justify-content: center;
37
37
  transform: ${({isFocused:e})=>e?"rotate(180deg)":"rotate(0deg)"};
38
38
  transition: transform 200ms linear;
39
- `,Z=m.default.ul`
39
+ `,Z=S.default.ul`
40
40
  position: fixed;
41
41
  max-height: 476px;
42
42
  overflow-y: auto;
@@ -50,4 +50,4 @@
50
50
  box-shadow: ${({theme:{elevation:e}})=>e[4]};
51
51
  transition: opacity 200ms linear;
52
52
  opacity: ${({isFocused:e})=>e?1:0};
53
- `,ee=i.forwardRef(function({value:r,onChange:g,open:s,onOpen:v,onClose:C,variant:O="outlined",size:q="large",startAdornment:j,placeholder:W="TEXT",disabled:k=!1,fullWidth:D,children:h,inlineCSS:z,...S},V){const _=i.useId(),b=i.useRef(null),w=i.useRef(null),x=i.useRef(""),[d,u]=i.useState(s||!1),[f,c]=i.useState(""),[$,y]=i.useState({top:0,bottom:0,left:0,width:0}),p=(S==null?void 0:S.id)||_,H=()=>{s===void 0?u(t=>!t):s===!1&&v&&typeof v=="function"&&v()},I=t=>()=>{g(t.toString()),R()},R=()=>{s===void 0?(u(!1),c("")):s===!0&&C&&typeof C=="function"&&C()},B=t=>{if(t.preventDefault(),t.code==="Escape"&&u(!1),t.code==="Space"||t.code==="Enter")if(x.current?c(x.current):f||c(`${p}-0`),d){if(f){const n=document.querySelector(`#${CSS.escape(f)}`);n&&n.hasAttribute("value")&&(x.current=n==null?void 0:n.id,I(n.value)())}u(!1)}else u(!0);if(t.code==="ArrowDown"||t.code==="ArrowUp"){if(d||u(!0),x.current?c(x.current):c(`${p}-0`),!w.current||!f)return;const n=w.current.querySelector(`#${CSS.escape(f)}`);if(!n)return;if(t.code==="ArrowDown"){const o=E.default(n,"next",{skipDisabled:!0});if(o&&o.id)c(o.id),o.scrollIntoView({block:"end"});else{const l=w.current.firstElementChild;l&&(c(l.id),l.scrollIntoView({block:"start"}))}}if(t.code==="ArrowUp"){const o=E.default(n,"prev",{skipDisabled:!0});if(o&&o.id)c(o.id),o.scrollIntoView({block:"end"});else{const l=w.current.lastElementChild;l&&(c(l.id),l.scrollIntoView({block:"end"}))}}}if(t.code==="Home"&&c(`${p}-0`),t.code==="End"){const n=i.Children.count(h);c(`${p}-${n-1}`)}},L=t=>{const n=i.Children.map(t,o=>i.isValidElement(o)&&o&&o.props.value===r?o.props.children:null);return n&&n.length?n[0]:""};return i.useEffect(()=>{const t=()=>{if(b.current){const n=b.current.getBoundingClientRect(),o=i.Children.count(h),l=40,A=24,F=l*o>476?476:l*o,M=b.current.getBoundingClientRect().bottom+F+A>window.innerHeight;y(M?{bottom:24,left:n.left,width:b.current.offsetWidth}:{top:n.top+n.height,left:n.left,width:b.current.offsetWidth})}};return t(),window.addEventListener("resize",t),()=>{window.removeEventListener("resize",t)}},[h]),i.useEffect(()=>{s!==void 0&&u(s)},[s]),a.jsxs(T.default,{ref:V,inlineCSS:{position:"relative"},children:[a.jsxs(J,{role:"combobox",ref:b,tabIndex:0,variant:O,size:q,disabled:k,fullWidth:D,isFocused:d,onClick:H,onKeyDown:B,"aria-controls":p,"aria-expanded":d,"aria-haspopup":"listbox","aria-activedescendant":f,...S,css:z,children:[a.jsxs(N,{value:r==="0"||!!r,disabled:k,children:[j&&a.jsx(K.default,{justifyContent:"center",alignItems:"center",children:j}),a.jsx(Q,{children:L(h)||W})]}),a.jsx(Y,{isFocused:d,children:a.jsx(U.default,{name:"ChevronDownLine",size:"small",color:k?"grey.30":"grey.100"})})]}),a.jsx(P.default,{open:d,onClose:R,inlineCSS:{backgroundColor:"transparent"},children:a.jsx(Z,{id:p,role:"listbox",ref:w,tabIndex:-1,isFocused:d,style:{top:$.top,bottom:$.bottom,left:$.left,width:$.width},children:i.Children.map(h,(t,n)=>{if(!i.isValidElement(t)||!t.props.value)return null;const o=`${p}-${n}`,l=r===t.props.value;return l&&(x.current=o),i.cloneElement(t,{id:o,selected:l,focused:o===f,onClick:I(t.props.value),...t.props})})})})]})});exports.default=ee;
53
+ `,ee=r.forwardRef(function({value:i,onChange:h,open:s,onOpen:C,onClose:k,variant:O="outlined",size:q="large",startAdornment:j,placeholder:W="TEXT",disabled:d=!1,fullWidth:D,children:w,inlineCSS:z,...$},V){const _=r.useId(),g=r.useRef(null),m=r.useRef(null),b=r.useRef(""),[u,f]=r.useState(s||!1),[p,c]=r.useState(""),[v,y]=r.useState({top:0,bottom:0,left:0,width:0}),x=($==null?void 0:$.id)||_,H=()=>{d||(s===void 0?f(t=>!t):s===!1&&C&&typeof C=="function"&&C())},I=t=>()=>{d||(h(t.toString()),R())},R=()=>{d||(s===void 0?(f(!1),c("")):s===!0&&k&&typeof k=="function"&&k())},B=t=>{if(!d){if(t.preventDefault(),t.code==="Escape"&&f(!1),t.code==="Space"||t.code==="Enter")if(b.current?c(b.current):p||c(`${x}-0`),u){if(p){const n=document.querySelector(`#${CSS.escape(p)}`);n&&n.hasAttribute("value")&&(b.current=n==null?void 0:n.id,I(n.value)())}f(!1)}else f(!0);if(t.code==="ArrowDown"||t.code==="ArrowUp"){if(u||f(!0),b.current?c(b.current):c(`${x}-0`),!m.current||!p)return;const n=m.current.querySelector(`#${CSS.escape(p)}`);if(!n)return;if(t.code==="ArrowDown"){const o=E.default(n,"next",{skipDisabled:!0});if(o&&o.id)c(o.id),o.scrollIntoView({block:"end"});else{const l=m.current.firstElementChild;l&&(c(l.id),l.scrollIntoView({block:"start"}))}}if(t.code==="ArrowUp"){const o=E.default(n,"prev",{skipDisabled:!0});if(o&&o.id)c(o.id),o.scrollIntoView({block:"end"});else{const l=m.current.lastElementChild;l&&(c(l.id),l.scrollIntoView({block:"end"}))}}}if(t.code==="Home"&&c(`${x}-0`),t.code==="End"){const n=r.Children.count(w);c(`${x}-${n-1}`)}}},L=t=>{const n=r.Children.map(t,o=>r.isValidElement(o)&&o&&o.props.value===i?o.props.children:null);return n&&n.length?n[0]:""};return r.useEffect(()=>{const t=()=>{if(g.current){const n=g.current.getBoundingClientRect(),o=r.Children.count(w),l=40,A=24,F=l*o>476?476:l*o,M=g.current.getBoundingClientRect().bottom+F+A>window.innerHeight;y(M?{bottom:24,left:n.left,width:g.current.offsetWidth}:{top:n.top+n.height,left:n.left,width:g.current.offsetWidth})}};return t(),window.addEventListener("resize",t),()=>{window.removeEventListener("resize",t)}},[w]),r.useEffect(()=>{s!==void 0&&f(s)},[s]),a.jsxs(T.default,{ref:V,inlineCSS:{position:"relative"},children:[a.jsxs(J,{role:"combobox",ref:g,tabIndex:0,variant:O,size:q,disabled:d,fullWidth:D,isFocused:u,onClick:H,onKeyDown:B,"aria-controls":x,"aria-expanded":u,"aria-haspopup":"listbox","aria-activedescendant":p,"aria-disabled":d,...$,css:z,children:[a.jsxs(N,{value:i==="0"||!!i,disabled:d,children:[j&&a.jsx(K.default,{justifyContent:"center",alignItems:"center",children:j}),a.jsx(Q,{children:L(w)||W})]}),a.jsx(Y,{isFocused:u,children:a.jsx(U.default,{name:"ChevronDownLine",size:"small",color:d?"grey.30":"grey.100"})})]}),a.jsx(P.default,{open:u,onClose:R,inlineCSS:{backgroundColor:"transparent"},children:a.jsx(Z,{id:x,role:"listbox",ref:m,tabIndex:-1,isFocused:u,style:{top:v.top,bottom:v.bottom,left:v.left,width:v.width},children:r.Children.map(w,(t,n)=>{if(!r.isValidElement(t)||!t.props.value)return null;const o=`${x}-${n}`,l=i===t.props.value;return l&&(b.current=o),r.cloneElement(t,{id:o,selected:l,focused:o===p,onClick:I(t.props.value),...t.props})})})})]})});exports.default=ee;
@@ -1,12 +1,12 @@
1
- import { jsxs as I, jsx as b } from "@emotion/react/jsx-runtime";
2
- import { forwardRef as J, useId as N, useRef as y, useState as E, useEffect as z, Children as v, isValidElement as D, cloneElement as Q } from "react";
1
+ import { jsxs as I, jsx as g } from "@emotion/react/jsx-runtime";
2
+ import { forwardRef as J, useId as N, useRef as y, useState as R, useEffect as z, Children as v, isValidElement as D, cloneElement as Q } from "react";
3
3
  import Y from "../Backdrop/Backdrop.es.js";
4
4
  import Z from "../Box/Box.es.js";
5
5
  import _ from "../Flexbox/Flexbox.es.js";
6
6
  import ee from "../Icon/Icon.es.js";
7
- import h from "@emotion/styled";
7
+ import w from "@emotion/styled";
8
8
  import H from "../utils/getSibling/getSibling.es.js";
9
- const te = h.div`
9
+ const te = w.div`
10
10
  display: flex;
11
11
  justify-content: space-between;
12
12
  align-items: center;
@@ -22,64 +22,64 @@ const te = h.div`
22
22
 
23
23
  ${({
24
24
  theme: {
25
- palette: { grey: e, background: i }
25
+ palette: { grey: e, background: r }
26
26
  },
27
- variant: m
27
+ variant: b
28
28
  }) => {
29
- let r = {};
30
- switch (m) {
29
+ let i = {};
30
+ switch (b) {
31
31
  case "outlined":
32
- r = {
32
+ i = {
33
33
  border: `1px solid ${e[50]}`,
34
34
  "&[disabled]": {
35
35
  backgroundColor: e[10],
36
36
  border: `1px solid ${e[30]}`,
37
37
  color: e[30],
38
- pointerEvents: "none"
38
+ cursor: "not-allowed"
39
39
  }
40
40
  };
41
41
  break;
42
42
  case "filled":
43
- r = {
43
+ i = {
44
44
  border: "1px solid transparent",
45
- backgroundColor: i.primary,
45
+ backgroundColor: r.primary,
46
46
  "&[disabled]": {
47
47
  backgroundColor: e[10],
48
48
  color: e[30],
49
- pointerEvents: "none"
49
+ cursor: "not-allowed"
50
50
  }
51
51
  };
52
52
  break;
53
53
  }
54
- return r;
54
+ return i;
55
55
  }}
56
56
 
57
57
  ${({
58
58
  theme: {
59
59
  palette: { brand: e }
60
60
  },
61
- isFocused: i
62
- }) => i ? {
61
+ isFocused: r
62
+ }) => r ? {
63
63
  border: `1px solid ${e.primary.line}`
64
64
  } : {}}
65
65
 
66
66
  ${({ size: e }) => {
67
- let i = {};
67
+ let r = {};
68
68
  switch (e) {
69
69
  case "large":
70
- i = {
70
+ r = {
71
71
  height: "48px"
72
72
  };
73
73
  break;
74
74
  case "xLarge":
75
- i = {
75
+ r = {
76
76
  height: "56px"
77
77
  };
78
78
  break;
79
79
  }
80
- return i;
80
+ return r;
81
81
  }}
82
- `, ne = h.div`
82
+ `, oe = w.div`
83
83
  display: flex;
84
84
  width: calc(100% - 24px - 8px);
85
85
  gap: ${({ theme: e }) => `${e.spacing.content(2)}px`};
@@ -90,38 +90,38 @@ const te = h.div`
90
90
  ${({
91
91
  theme: {
92
92
  typography: e,
93
- palette: { grey: i }
93
+ palette: { grey: r }
94
94
  },
95
- value: m
95
+ value: b
96
96
  }) => {
97
- const r = {
97
+ const i = {
98
98
  fontSize: e.b2R.size,
99
99
  fontWeight: e.b2R.size,
100
100
  lineHeight: e.b2R.lineHeight,
101
101
  letterSpacing: e.b2R.letterSpacing,
102
102
  "&[disabled]": {
103
- color: i[30]
103
+ color: r[30]
104
104
  }
105
105
  };
106
- return m ? {
107
- ...r,
108
- color: i[100]
106
+ return b ? {
107
+ ...i,
108
+ color: r[100]
109
109
  } : {
110
- ...r,
111
- color: i[50]
110
+ ...i,
111
+ color: r[50]
112
112
  };
113
113
  }}
114
- `, oe = h.div`
114
+ `, ne = w.div`
115
115
  overflow: hidden;
116
116
  text-overflow: ellipsis;
117
117
  white-space: nowrap;
118
- `, ie = h.div`
118
+ `, re = w.div`
119
119
  display: flex;
120
120
  align-items: center;
121
121
  justify-content: center;
122
122
  transform: ${({ isFocused: e }) => e ? "rotate(180deg)" : "rotate(0deg)"};
123
123
  transition: transform 200ms linear;
124
- `, re = h.ul`
124
+ `, ie = w.ul`
125
125
  position: fixed;
126
126
  max-height: 476px;
127
127
  overflow-y: auto;
@@ -135,150 +135,153 @@ const te = h.div`
135
135
  box-shadow: ${({ theme: { elevation: e } }) => e[4]};
136
136
  transition: opacity 200ms linear;
137
137
  opacity: ${({ isFocused: e }) => e ? 1 : 0};
138
- `, be = J(function({
139
- value: i,
140
- onChange: m,
141
- open: r,
142
- onOpen: S,
143
- onClose: C,
138
+ `, me = J(function({
139
+ value: r,
140
+ onChange: b,
141
+ open: i,
142
+ onOpen: C,
143
+ onClose: k,
144
144
  variant: V = "outlined",
145
145
  size: B = "large",
146
- startAdornment: R,
146
+ startAdornment: E,
147
147
  placeholder: L = "TEXT",
148
- disabled: k = !1,
148
+ disabled: c = !1,
149
149
  fullWidth: A,
150
- children: g,
150
+ children: x,
151
151
  inlineCSS: F,
152
- ...w
152
+ ...$
153
153
  }, q) {
154
- const K = N(), f = y(null), x = y(null), u = y(""), [c, a] = E(r || !1), [d, l] = E(""), [$, O] = E({ top: 0, bottom: 0, left: 0, width: 0 }), p = (w == null ? void 0 : w.id) || K, P = () => {
155
- r === void 0 ? a((t) => !t) : r === !1 && S && typeof S == "function" && S();
154
+ const K = N(), u = y(null), h = y(null), m = y(""), [a, d] = R(i || !1), [f, s] = R(""), [S, O] = R({ top: 0, bottom: 0, left: 0, width: 0 }), p = ($ == null ? void 0 : $.id) || K, P = () => {
155
+ c || (i === void 0 ? d((t) => !t) : i === !1 && C && typeof C == "function" && C());
156
156
  }, W = (t) => () => {
157
- m(t.toString()), j();
157
+ c || (b(t.toString()), j());
158
158
  }, j = () => {
159
- r === void 0 ? (a(!1), l("")) : r === !0 && C && typeof C == "function" && C();
159
+ c || (i === void 0 ? (d(!1), s("")) : i === !0 && k && typeof k == "function" && k());
160
160
  }, T = (t) => {
161
- if (t.preventDefault(), t.code === "Escape" && a(!1), t.code === "Space" || t.code === "Enter")
162
- if (u.current ? l(u.current) : d || l(`${p}-0`), c) {
163
- if (d) {
164
- const n = document.querySelector(
165
- `#${CSS.escape(d)}`
166
- );
167
- n && n.hasAttribute("value") && (u.current = n == null ? void 0 : n.id, W(n.value)());
161
+ if (!c) {
162
+ if (t.preventDefault(), t.code === "Escape" && d(!1), t.code === "Space" || t.code === "Enter")
163
+ if (m.current ? s(m.current) : f || s(`${p}-0`), a) {
164
+ if (f) {
165
+ const o = document.querySelector(
166
+ `#${CSS.escape(f)}`
167
+ );
168
+ o && o.hasAttribute("value") && (m.current = o == null ? void 0 : o.id, W(o.value)());
169
+ }
170
+ d(!1);
171
+ } else
172
+ d(!0);
173
+ if (t.code === "ArrowDown" || t.code === "ArrowUp") {
174
+ if (a || d(!0), m.current ? s(m.current) : s(`${p}-0`), !h.current || !f) return;
175
+ const o = h.current.querySelector(
176
+ `#${CSS.escape(f)}`
177
+ );
178
+ if (!o) return;
179
+ if (t.code === "ArrowDown") {
180
+ const n = H(o, "next", { skipDisabled: !0 });
181
+ if (n && n.id)
182
+ s(n.id), n.scrollIntoView({ block: "end" });
183
+ else {
184
+ const l = h.current.firstElementChild;
185
+ l && (s(l.id), l.scrollIntoView({ block: "start" }));
186
+ }
168
187
  }
169
- a(!1);
170
- } else
171
- a(!0);
172
- if (t.code === "ArrowDown" || t.code === "ArrowUp") {
173
- if (c || a(!0), u.current ? l(u.current) : l(`${p}-0`), !x.current || !d) return;
174
- const n = x.current.querySelector(
175
- `#${CSS.escape(d)}`
176
- );
177
- if (!n) return;
178
- if (t.code === "ArrowDown") {
179
- const o = H(n, "next", { skipDisabled: !0 });
180
- if (o && o.id)
181
- l(o.id), o.scrollIntoView({ block: "end" });
182
- else {
183
- const s = x.current.firstElementChild;
184
- s && (l(s.id), s.scrollIntoView({ block: "start" }));
188
+ if (t.code === "ArrowUp") {
189
+ const n = H(o, "prev", { skipDisabled: !0 });
190
+ if (n && n.id)
191
+ s(n.id), n.scrollIntoView({ block: "end" });
192
+ else {
193
+ const l = h.current.lastElementChild;
194
+ l && (s(l.id), l.scrollIntoView({ block: "end" }));
195
+ }
185
196
  }
186
197
  }
187
- if (t.code === "ArrowUp") {
188
- const o = H(n, "prev", { skipDisabled: !0 });
189
- if (o && o.id)
190
- l(o.id), o.scrollIntoView({ block: "end" });
191
- else {
192
- const s = x.current.lastElementChild;
193
- s && (l(s.id), s.scrollIntoView({ block: "end" }));
194
- }
198
+ if (t.code === "Home" && s(`${p}-0`), t.code === "End") {
199
+ const o = v.count(x);
200
+ s(`${p}-${o - 1}`);
195
201
  }
196
202
  }
197
- if (t.code === "Home" && l(`${p}-0`), t.code === "End") {
198
- const n = v.count(g);
199
- l(`${p}-${n - 1}`);
200
- }
201
203
  }, U = (t) => {
202
- const n = v.map(t, (o) => D(o) && o && o.props.value === i ? o.props.children : null);
203
- return n && n.length ? n[0] : "";
204
+ const o = v.map(t, (n) => D(n) && n && n.props.value === r ? n.props.children : null);
205
+ return o && o.length ? o[0] : "";
204
206
  };
205
207
  return z(() => {
206
208
  const t = () => {
207
- if (f.current) {
208
- const n = f.current.getBoundingClientRect(), o = v.count(g), s = 40, M = 24, X = s * o > 476 ? 476 : s * o, G = f.current.getBoundingClientRect().bottom + X + M > window.innerHeight;
209
+ if (u.current) {
210
+ const o = u.current.getBoundingClientRect(), n = v.count(x), l = 40, M = 24, X = l * n > 476 ? 476 : l * n, G = u.current.getBoundingClientRect().bottom + X + M > window.innerHeight;
209
211
  O(G ? {
210
212
  bottom: 24,
211
- left: n.left,
212
- width: f.current.offsetWidth
213
+ left: o.left,
214
+ width: u.current.offsetWidth
213
215
  } : {
214
- top: n.top + n.height,
215
- left: n.left,
216
- width: f.current.offsetWidth
216
+ top: o.top + o.height,
217
+ left: o.left,
218
+ width: u.current.offsetWidth
217
219
  });
218
220
  }
219
221
  };
220
222
  return t(), window.addEventListener("resize", t), () => {
221
223
  window.removeEventListener("resize", t);
222
224
  };
223
- }, [g]), z(() => {
224
- r !== void 0 && a(r);
225
- }, [r]), /* @__PURE__ */ I(Z, { ref: q, inlineCSS: { position: "relative" }, children: [
225
+ }, [x]), z(() => {
226
+ i !== void 0 && d(i);
227
+ }, [i]), /* @__PURE__ */ I(Z, { ref: q, inlineCSS: { position: "relative" }, children: [
226
228
  /* @__PURE__ */ I(
227
229
  te,
228
230
  {
229
231
  role: "combobox",
230
- ref: f,
232
+ ref: u,
231
233
  tabIndex: 0,
232
234
  variant: V,
233
235
  size: B,
234
- disabled: k,
236
+ disabled: c,
235
237
  fullWidth: A,
236
- isFocused: c,
238
+ isFocused: a,
237
239
  onClick: P,
238
240
  onKeyDown: T,
239
241
  "aria-controls": p,
240
- "aria-expanded": c,
242
+ "aria-expanded": a,
241
243
  "aria-haspopup": "listbox",
242
- "aria-activedescendant": d,
243
- ...w,
244
+ "aria-activedescendant": f,
245
+ "aria-disabled": c,
246
+ ...$,
244
247
  css: F,
245
248
  children: [
246
- /* @__PURE__ */ I(ne, { value: i === "0" || !!i, disabled: k, children: [
247
- R && /* @__PURE__ */ b(_, { justifyContent: "center", alignItems: "center", children: R }),
248
- /* @__PURE__ */ b(oe, { children: U(g) || L })
249
+ /* @__PURE__ */ I(oe, { value: r === "0" || !!r, disabled: c, children: [
250
+ E && /* @__PURE__ */ g(_, { justifyContent: "center", alignItems: "center", children: E }),
251
+ /* @__PURE__ */ g(ne, { children: U(x) || L })
249
252
  ] }),
250
- /* @__PURE__ */ b(ie, { isFocused: c, children: /* @__PURE__ */ b(ee, { name: "ChevronDownLine", size: "small", color: k ? "grey.30" : "grey.100" }) })
253
+ /* @__PURE__ */ g(re, { isFocused: a, children: /* @__PURE__ */ g(ee, { name: "ChevronDownLine", size: "small", color: c ? "grey.30" : "grey.100" }) })
251
254
  ]
252
255
  }
253
256
  ),
254
- /* @__PURE__ */ b(
257
+ /* @__PURE__ */ g(
255
258
  Y,
256
259
  {
257
- open: c,
260
+ open: a,
258
261
  onClose: j,
259
262
  inlineCSS: { backgroundColor: "transparent" },
260
- children: /* @__PURE__ */ b(
261
- re,
263
+ children: /* @__PURE__ */ g(
264
+ ie,
262
265
  {
263
266
  id: p,
264
267
  role: "listbox",
265
- ref: x,
268
+ ref: h,
266
269
  tabIndex: -1,
267
- isFocused: c,
270
+ isFocused: a,
268
271
  style: {
269
- top: $.top,
270
- bottom: $.bottom,
271
- left: $.left,
272
- width: $.width
272
+ top: S.top,
273
+ bottom: S.bottom,
274
+ left: S.left,
275
+ width: S.width
273
276
  },
274
- children: v.map(g, (t, n) => {
277
+ children: v.map(x, (t, o) => {
275
278
  if (!D(t) || !t.props.value)
276
279
  return null;
277
- const o = `${p}-${n}`, s = i === t.props.value;
278
- return s && (u.current = o), Q(t, {
279
- id: o,
280
- selected: s,
281
- focused: o === d,
280
+ const n = `${p}-${o}`, l = r === t.props.value;
281
+ return l && (m.current = n), Q(t, {
282
+ id: n,
283
+ selected: l,
284
+ focused: n === f,
282
285
  onClick: W(t.props.value),
283
286
  ...t.props
284
287
  });
@@ -290,5 +293,5 @@ const te = h.div`
290
293
  ] });
291
294
  });
292
295
  export {
293
- be as default
296
+ me as default
294
297
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dotss/ui",
3
- "version": "1.2.1",
3
+ "version": "1.2.2",
4
4
  "description": "React UI components for Dotss",
5
5
  "type": "module",
6
6
  "main": "./index.cjs",