@mobilestock-native/drawer 0.0.0-stage → 0.2.0

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.
Files changed (4) hide show
  1. package/index.d.ts +266 -0
  2. package/index.js +21 -0
  3. package/package.json +14 -3
  4. package/README.md +0 -3
package/index.d.ts ADDED
@@ -0,0 +1,266 @@
1
+ import * as react_jsx_runtime from 'react/jsx-runtime';
2
+ import { ClickableProps } from '@mobilestock-native/clickable';
3
+ import { IconName } from '@mobilestock-native/icons';
4
+ import { ReactNode } from 'react';
5
+
6
+ /**
7
+ * @description Color of the icon of a compact item: `DEFAULT` the text color, `DANGER` the danger color (logout).
8
+ */
9
+ type DrawerCompactItemColor = 'DEFAULT' | 'DANGER';
10
+ /**
11
+ * @description Size of the compact item: `MD` the 48×48 item of the 72px bar (tablet and desktop), `SM` the 40×40 item
12
+ * with a smaller icon for the 56px bar of a phone.
13
+ */
14
+ type DrawerCompactItemSize = 'MD' | 'SM';
15
+ interface DrawerCompactItemProps extends Omit<ClickableProps, 'children' | 'accessibilityLabel'> {
16
+ /**
17
+ * @description Icon of the item, from `@mobilestock-native/icons`.
18
+ * Default: required
19
+ * @example icon="ReceiptLong"
20
+ */
21
+ icon: IconName;
22
+ /**
23
+ * @description Name of the item for screen readers. Required: the icon is the only thing drawn.
24
+ * Default: required
25
+ * @example accessibilityLabel="Pedidos da loja"
26
+ */
27
+ accessibilityLabel: string;
28
+ /**
29
+ * @description Text of the floating label shown beside the item while the pointer rests on it or the item has the
30
+ * keyboard focus (web), or after a long press (native, inside a `Drawer.Root`).
31
+ * Default: the `accessibilityLabel`
32
+ * @example label="Pedidos"
33
+ */
34
+ label?: string;
35
+ /**
36
+ * @description Marks the item of the current screen: the background takes `theme.colors.drawer.activeBackground`
37
+ * and the icon takes `theme.colors.drawer.activeForeground`.
38
+ * Default: false
39
+ * @example active
40
+ */
41
+ active?: boolean;
42
+ /**
43
+ * @description Color of the icon: `DEFAULT` the text color, `DANGER` the danger color (logout).
44
+ * Default: 'DEFAULT'
45
+ * @example color="DANGER"
46
+ */
47
+ color?: DrawerCompactItemColor;
48
+ /**
49
+ * @description Short text drawn as a badge over the top right corner of the icon: a count of pending orders, a
50
+ * "new" mark. It is read after the accessibility label.
51
+ * Default: undefined
52
+ * @example badge="3"
53
+ */
54
+ badge?: string;
55
+ /**
56
+ * @description `MD` is the 48×48 item of the 72px bar; `SM` the 40×40 item with a smaller icon, for the 56px bar of
57
+ * a phone (`theme.drawer.compactSmall`).
58
+ * Default: 'MD'
59
+ * @example size="SM"
60
+ */
61
+ size?: DrawerCompactItemSize;
62
+ }
63
+ /**
64
+ * @description The icon-only item of the compact side menu: a 48×48 touch area (40×40 with `size="SM"`), centered,
65
+ * with the medium radius of the theme. `active` tints it with the active colors of the drawer; the hover and the
66
+ * press take the hover color of the list items. On web, the item name floats beside it while the pointer rests on it
67
+ * or while it has the keyboard focus, never on a click; on native, after a long press, when the menu is wrapped in a
68
+ * `Drawer.Root`.
69
+ */
70
+ declare function CompactItem({ icon, accessibilityLabel, label, active, color, badge, size, onHoverIn, onHoverOut, onFocus, onBlur, onPressIn, onLongPress, ...props }: DrawerCompactItemProps): react_jsx_runtime.JSX.Element;
71
+
72
+ type DrawerFooterSize = 'MD' | 'SM';
73
+ interface DrawerFooterProps {
74
+ children: ReactNode;
75
+ /**
76
+ * @description Drops the side padding, so a 48px compact item fits the 72px bar.
77
+ * Default: false
78
+ * @example compact
79
+ */
80
+ compact?: boolean;
81
+ /**
82
+ * @description Vertical padding for the size of the items inside: `MD` for the 48px compact item or the 44px row,
83
+ * `SM` for the 40px compact item or the 36px row, which lines the footer up with a 49px bottom tab bar.
84
+ * Default: 'MD'
85
+ * @example size="SM"
86
+ */
87
+ size?: DrawerFooterSize;
88
+ }
89
+ /**
90
+ * @description Bottom area of the side menu, under the scrolling entries: a hairline on top, in the divider color of
91
+ * the drawer, and the padding of the menu. Holds the logout (and the login of a visitor).
92
+ */
93
+ declare function Footer({ children, compact, size }: DrawerFooterProps): react_jsx_runtime.JSX.Element;
94
+
95
+ /**
96
+ * @description Color of the icon and the label of an item: `DEFAULT` is the text color, `SELECTED` is the active
97
+ * color of the drawer (the brand color) and `DANGER` is the danger color, for the logout.
98
+ */
99
+ type DrawerItemColor = 'DEFAULT' | 'SELECTED' | 'DANGER';
100
+
101
+ /**
102
+ * @description Size of the item: `MD` the 44px row, `SM` the 36px row with a smaller label.
103
+ */
104
+ type DrawerItemSize = 'MD' | 'SM';
105
+ interface DrawerItemProps extends Omit<ClickableProps, 'children'> {
106
+ /**
107
+ * @description Text of the item. It is also the accessibility label, unless `accessibilityLabel` is given.
108
+ * Default: required
109
+ * @example label="Pedidos da loja"
110
+ */
111
+ label: string;
112
+ /**
113
+ * @description Icon drawn before the label, from `@mobilestock-native/icons`.
114
+ * Default: required
115
+ * @example icon="ReceiptLong"
116
+ */
117
+ icon: IconName;
118
+ /**
119
+ * @description Color of the icon and the label: `DEFAULT` the text color, `SELECTED` the active color of the
120
+ * drawer (the brand color), `DANGER` the danger color (logout).
121
+ * Default: 'DEFAULT'
122
+ * @example color="DANGER"
123
+ */
124
+ color?: DrawerItemColor;
125
+ /**
126
+ * @description Marks the item of the current screen: the background takes `theme.colors.drawer.activeBackground`
127
+ * and the icon and the label take `theme.colors.drawer.activeForeground`.
128
+ * Default: false
129
+ * @example active
130
+ */
131
+ active?: boolean;
132
+ /**
133
+ * @description Element drawn after the label, on the same row: a balance, a badge, a counter.
134
+ * Default: undefined
135
+ * @example trailing={<Typography size="XS" color="DEFAULT_200">R$ 0,00</Typography>}
136
+ */
137
+ trailing?: ReactNode;
138
+ /**
139
+ * @description URL of the item on web, so the row is a real link (middle click, open in a new tab). Ignored on
140
+ * native.
141
+ * Default: undefined
142
+ * @example href="https://necso.com.br/conta"
143
+ */
144
+ href?: string;
145
+ /**
146
+ * @description `MD` is the 44px row with the small label; `SM` the 36px row with the extra-small label, for a
147
+ * denser menu (a phone).
148
+ * Default: 'MD'
149
+ * @example size="SM"
150
+ */
151
+ size?: DrawerItemSize;
152
+ }
153
+ /**
154
+ * @description One row of the expanded side menu: icon, label and an optional trailing element, with a touch height
155
+ * of at least 44px and the radius of the theme. `active` tints the row with the active colors of the drawer.
156
+ */
157
+ declare function Item({ label, icon, color, active, trailing, href, accessibilityLabel, size, ...props }: DrawerItemProps): react_jsx_runtime.JSX.Element;
158
+
159
+ /**
160
+ * @description Box of the item (or divider) a floating label names, in window coordinates.
161
+ */
162
+ interface FloatingLabelAnchor {
163
+ left: number;
164
+ top: number;
165
+ width: number;
166
+ height: number;
167
+ }
168
+
169
+ /**
170
+ * @description Side of the screen the menu is attached to. The floating labels open towards the other side.
171
+ */
172
+ type DrawerSide = 'left' | 'right';
173
+ interface FloatingLabelRequest {
174
+ text: string;
175
+ anchor: FloatingLabelAnchor;
176
+ }
177
+ interface DrawerRootProps {
178
+ children: ReactNode;
179
+ /**
180
+ * @description Side of the screen the menu is attached to: the floating labels open to the right of a left menu
181
+ * and to the left of a right menu.
182
+ * Default: 'left'
183
+ * @example side="right"
184
+ */
185
+ side?: DrawerSide;
186
+ /**
187
+ * @description Called on web when `Escape` is pressed with the keyboard focus inside the menu: the place to collapse
188
+ * an expanded permanent menu or close the overlay.
189
+ * Default: undefined
190
+ * @example onEscape={collapseMenu}
191
+ */
192
+ onEscape?(): void;
193
+ /**
194
+ * @description Called on web once the pointer rested over the menu for `hoverDelayInMilliseconds`: the place to
195
+ * expand a compact permanent menu while the mouse is on it. The floating label leaves at the same time, since the
196
+ * menu is about to change shape.
197
+ * Default: undefined
198
+ * @example onHoverIn={expandMenu}
199
+ */
200
+ onHoverIn?(): void;
201
+ /**
202
+ * @description Called on web when the pointer leaves the menu after `onHoverIn` fired: the place to collapse the
203
+ * menu again. Leaving before the delay only cancels the pending `onHoverIn`.
204
+ * Default: undefined
205
+ * @example onHoverOut={collapseMenu}
206
+ */
207
+ onHoverOut?(): void;
208
+ /**
209
+ * @description How long the pointer has to rest over the menu before `onHoverIn` fires, so crossing the menu on the
210
+ * way to the screen does not expand it.
211
+ * Default: 400
212
+ * @example hoverDelayInMilliseconds={600}
213
+ */
214
+ hoverDelayInMilliseconds?: number;
215
+ }
216
+ /**
217
+ * @description Default rest of the pointer over the menu before `onHoverIn` fires.
218
+ */
219
+ declare const HOVER_EXPAND_DELAY_IN_MILLISECONDS = 400;
220
+ /**
221
+ * @description Wrapper of the whole content of a side menu. It fills its parent, painted with
222
+ * `theme.colors.drawer.background`, and draws the floating label of the
223
+ * compact item under the pointer here, outside the scroll area of the menu: inside a ScrollView the label would be
224
+ * positioned against the scroll container (react-native-web transforms it) and clipped by its overflow. On web it also
225
+ * hides the label when anything scrolls and moves the keyboard focus between the entries with the arrow keys.
226
+ */
227
+ declare function Root({ children, side, onEscape, onHoverIn, onHoverOut, hoverDelayInMilliseconds }: DrawerRootProps): react_jsx_runtime.JSX.Element;
228
+
229
+ interface DrawerSectionTitleProps {
230
+ /**
231
+ * @description Name of the section, shown in upper case. In the compact menu it is the accessibility label of the
232
+ * divider and the floating label shown when the pointer rests on it.
233
+ * Default: required
234
+ * @example title="Minha loja"
235
+ */
236
+ title: string;
237
+ /**
238
+ * @description Draws a 32px hairline divider instead of the text, for the compact menu. The title stays as the
239
+ * accessibility label, so screen readers still announce the section.
240
+ * Default: false
241
+ * @example compact
242
+ */
243
+ compact?: boolean;
244
+ }
245
+ /**
246
+ * @description Title of a group of items of the side menu: small bold upper-case text with the section padding. With
247
+ * `compact` the same component becomes the hairline divider that separates the groups of the compact menu; inside a
248
+ * `Drawer.Root`, on web, the pointer resting on the divider floats the name of the section beside it.
249
+ */
250
+ declare function SectionTitle({ title, compact }: DrawerSectionTitleProps): react_jsx_runtime.JSX.Element;
251
+
252
+ /**
253
+ * @description Pieces of a side menu: `Item` (icon, label and an optional trailing element), `CompactItem` (the
254
+ * icon-only item of the compact menu, with a floating label on web), `SectionTitle` (the title of a group of
255
+ * items, a hairline divider when `compact`) and `Root`, the wrapper of the menu that hosts the floating label
256
+ * outside the scroll area.
257
+ */
258
+ declare const Drawer: {
259
+ Root: typeof Root;
260
+ Item: typeof Item;
261
+ CompactItem: typeof CompactItem;
262
+ SectionTitle: typeof SectionTitle;
263
+ Footer: typeof Footer;
264
+ };
265
+
266
+ export { Drawer, type DrawerCompactItemColor, type DrawerCompactItemProps, type DrawerCompactItemSize, type DrawerFooterProps, type DrawerFooterSize, type DrawerItemColor, type DrawerItemProps, type DrawerItemSize, type DrawerRootProps, type DrawerSectionTitleProps, type DrawerSide, type FloatingLabelRequest, HOVER_EXPAND_DELAY_IN_MILLISECONDS };
package/index.js ADDED
@@ -0,0 +1,21 @@
1
+ "use strict";var Ye=Object.create;var N=Object.defineProperty,Ze=Object.defineProperties,qe=Object.getOwnPropertyDescriptor,Je=Object.getOwnPropertyDescriptors,Qe=Object.getOwnPropertyNames,V=Object.getOwnPropertySymbols,je=Object.getPrototypeOf,j=Object.prototype.hasOwnProperty,ce=Object.prototype.propertyIsEnumerable;var le=(e,t,r)=>t in e?N(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,F=(e,t)=>{for(var r in t||(t={}))j.call(t,r)&&le(e,r,t[r]);if(V)for(var r of V(t))ce.call(t,r)&&le(e,r,t[r]);return e},X=(e,t)=>Ze(e,Je(t));var z=(e,t)=>{var r={};for(var o in e)j.call(e,o)&&t.indexOf(o)<0&&(r[o]=e[o]);if(e!=null&&V)for(var o of V(e))t.indexOf(o)<0&&ce.call(e,o)&&(r[o]=e[o]);return r};var et=(e,t)=>{for(var r in t)N(e,r,{get:t[r],enumerable:!0})},se=(e,t,r,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of Qe(t))!j.call(e,n)&&n!==r&&N(e,n,{get:()=>t[n],enumerable:!(o=qe(t,n))||o.enumerable});return e};var $=(e,t,r)=>(r=e!=null?Ye(je(e)):{},se(t||!e||!e.__esModule?N(r,"default",{value:e,enumerable:!0}):r,e)),tt=e=>se(N({},"__esModule",{value:!0}),e);var Dt={};et(Dt,{Drawer:()=>It,HOVER_EXPAND_DELAY_IN_MILLISECONDS:()=>re});module.exports=tt(Dt);var S=require("react"),x=require("react-native"),De=require("styled-components/native"),Se=require("@mobilestock-native/badge"),Ee=require("@mobilestock-native/clickable"),Le=require("@mobilestock-native/icons");function U(e,t,r){return r||t==="SELECTED"?e.colors.drawer.activeForeground:t==="DANGER"?e.colors.text.danger:e.colors.text.default}function W(e){var t;return(t=e.colors.listItem)==null?void 0:t.hover}var de=require("react-native");function T(e,t){if(!e)return;let r=e;if(de.Platform.OS==="web"&&typeof r.getBoundingClientRect=="function"){let o=r.getBoundingClientRect();t(o.left,o.top,o.width,o.height);return}e.measureInWindow(t)}var ue=require("react-native"),te=$(require("styled-components/native")),me=require("@mobilestock-native/typography"),ee=require("react/jsx-runtime"),A=28,P=12;function K({text:e,visible:t,top:r,left:o,right:n}){if(!t)return null;let c={position:ue.Platform.OS==="web"?"fixed":"absolute",top:r,left:o,right:n};return(0,ee.jsx)(rt,{pointerEvents:"none",accessibilityElementsHidden:!0,importantForAccessibility:"no-hide-descendants",style:c,testID:"drawer-floating-label",children:(0,ee.jsx)(ot,{size:"XS",weight:"MEDIUM",withEllipsis:!0,children:e})})}var rt=te.default.View`
2
+ z-index: 1000;
3
+ height: ${A}px;
4
+ justify-content: center;
5
+ padding: 0 ${({theme:e})=>e.spacing.xs};
6
+ border-radius: ${({theme:e})=>e.borderRadius.default};
7
+ background-color: ${({theme:e})=>e.colors.drawer.labelBackground};
8
+ `,ot=(0,te.default)(me.Typography)`
9
+ color: ${({theme:e})=>e.colors.drawer.labelText};
10
+ `;var d=require("react"),D=require("react-native"),pe=require("styled-components/native");var M=require("react/jsx-runtime"),be=(0,d.createContext)(null);function Y(){return(0,d.useContext)(be)}var re=400,nt='[data-testid="drawer-compact-item"], [data-testid="drawer-item"]';function it(e,t){var n;if(e.key==="Escape"){t.hideLabel(),(n=t.onEscape)==null||n.call(t);return}if(e.key!=="ArrowDown"&&e.key!=="ArrowUp"||t.activeIndex===-1||t.entries.length===0)return;e.preventDefault();let r=e.key==="ArrowDown"?1:-1,o=(t.activeIndex+r+t.entries.length)%t.entries.length;t.entries[o].focus()}function fe(e,t,r){let{anchor:o}=e,n=o.top+(o.height-A)/2-r.top;return t==="right"?{text:e.text,top:n,right:r.left+r.width-o.left+P}:{text:e.text,top:n,left:o.left+o.width+P-r.left}}function at(){var t;return(typeof document=="undefined"?0:(t=document.documentElement)==null?void 0:t.clientWidth)||D.Dimensions.get("window").width}function lt(e){return typeof(e==null?void 0:e.addEventListener)=="function"}function we({children:e,side:t="left",onEscape:r,onHoverIn:o,onHoverOut:n,hoverDelayInMilliseconds:c=re}){var C,p;let f=(0,pe.useTheme)(),u=(0,d.useRef)(null),s=(0,d.useRef)(null),w=(0,d.useRef)(!1),[i,l]=(0,d.useState)(null);(0,d.useEffect)(()=>g,[]);function g(){s.current&&(clearTimeout(s.current),s.current=null)}function E(){o&&(g(),s.current=setTimeout(()=>{s.current=null,w.current=!0,l(null),o()},c))}function G(){g(),w.current&&(w.current=!1,n==null||n())}let R={side:t,show(L){if(D.Platform.OS==="web"){l(fe(L,t,{left:0,top:0,width:at()}));return}T(u.current,(m,I,h)=>{l(fe(L,t,{left:m,top:I,width:h}))})},hide:()=>l(null)};return(0,d.useEffect)(()=>{let L=u.current,m=typeof document=="undefined"?void 0:document;if(D.Platform.OS!=="web"||!lt(L)||!m)return;let I=L,h=m;function b(){l(null)}function _(J){let v=Array.from(I.querySelectorAll(nt));it(J,{entries:v,activeIndex:v.indexOf(h.activeElement),hideLabel:b,onEscape:r})}return I.addEventListener("keydown",_),h.addEventListener("scroll",b,!0),()=>{I.removeEventListener("keydown",_),h.removeEventListener("scroll",b,!0)}},[r]),(0,M.jsx)(be.Provider,{value:R,children:(0,M.jsxs)(D.View,{ref:u,collapsable:!1,style:[ct.root,{backgroundColor:f.colors.drawer.background}],onPointerEnter:E,onPointerLeave:G,testID:"drawer-root",children:[e,(0,M.jsx)(K,{text:(C=i==null?void 0:i.text)!=null?C:"",visible:i!==null,top:(p=i==null?void 0:i.top)!=null?p:0,left:i==null?void 0:i.left,right:i==null?void 0:i.right})]})})}var ct=D.StyleSheet.create({root:{flex:1}});var y=require("react/jsx-runtime"),st=250,dt=1500,ge={MD:"3rem",SM:"2.5rem"},ut={MD:"MD",SM:"SM"};function ye(G){var R=G,{icon:e,accessibilityLabel:t,label:r=t,active:o=!1,color:n="DEFAULT",badge:c,size:f="MD",onHoverIn:u,onHoverOut:s,onFocus:w,onBlur:i,onPressIn:l,onLongPress:g}=R,E=z(R,["icon","accessibilityLabel","label","active","color","badge","size","onHoverIn","onHoverOut","onFocus","onBlur","onPressIn","onLongPress"]);var oe;let C=(0,De.useTheme)(),p=Y(),L=(0,S.useRef)(null),m=(0,S.useRef)(null),I=(0,S.useRef)(!1),h=(0,S.useRef)(!1),[b,_]=(0,S.useState)(null),J=U(C,n,o),v=W(C),Oe=C.colors.drawer.activeBackground,Ge=c?`${t}, ${c}`:t;(0,S.useEffect)(()=>()=>{k(),I.current&&(p==null||p.hide())},[]);function k(){m.current&&(clearTimeout(m.current),m.current=null)}function Q(){T(L.current,(a,ne,ie,ae)=>{if(p){I.current=!0,p.show({text:r,anchor:{left:a,top:ne,width:ie,height:ae}});return}x.Platform.OS==="web"&&_({top:ne+(ae-A)/2,left:a+ie+P})})}function H(){if(k(),p){I.current=!1,p.hide();return}_(null)}function He(){k(),Q(),m.current=setTimeout(()=>{m.current=null,H()},dt)}function Ve(a){k(),m.current=setTimeout(()=>{m.current=null,Q()},a)}function Xe(a){Ve(st),u==null||u(a)}function ze(a){H(),s==null||s(a)}function $e(a){h.current?h.current=!1:(k(),Q()),w==null||w(a)}function Ue(a){h.current=!1,H(),i==null||i(a)}function We(a){h.current=!0,H(),l==null||l(a)}function Ke(a){x.Platform.OS!=="web"&&p&&He(),g==null||g(a)}return(0,y.jsxs)(x.View,{ref:L,collapsable:!1,style:Ie.anchor,testID:"drawer-compact-item-anchor",children:[(0,y.jsx)(Ee.Clickable,X(F({accessibilityRole:"button",accessibilityLabel:Ge,accessibilityState:{selected:o},width:ge[f],height:ge[f],align:"CENTER_CENTER",borderRadius:"MEDIUM",backgroundColor:o?Oe:void 0,whenHovered:v?{backgroundColor:v}:void 0,whenPressed:v?{backgroundColor:v}:void 0,onHoverIn:Xe,onHoverOut:ze,onFocus:$e,onBlur:Ue,onPressIn:We,onLongPress:Ke},E),{testID:"drawer-compact-item",children:(0,y.jsx)(Le.Icon,{name:e,size:ut[f],color:J})})),c&&(0,y.jsx)(x.View,{style:Ie.badge,pointerEvents:"none",testID:"drawer-compact-item-badge",children:(0,y.jsx)(Se.Badge,{text:c,type:"DANGER",size:"2XS",isRounded:!0})}),(0,y.jsx)(K,{text:r,visible:b!==null,top:(oe=b==null?void 0:b.top)!=null?oe:0,left:b==null?void 0:b.left})]})}var he=2,Ie=x.StyleSheet.create({anchor:{alignSelf:"center"},badge:{position:"absolute",top:he,right:he}});var xe=$(require("styled-components/native")),ve=require("@mobilestock-native/container"),Ce=require("react/jsx-runtime"),mt={MD:"XS",SM:"2XS"};function Re({children:e,compact:t=!1,size:r="MD"}){let o=`${mt[r]}_${t?"NONE":"SM"}`;return(0,Ce.jsx)(ft,{padding:o,testID:"drawer-footer",children:e})}var ft=(0,xe.default)(ve.Container)`
11
+ border-top-width: 1px;
12
+ border-top-color: ${({theme:e})=>e.colors.drawer.divider};
13
+ `;var Z=$(require("styled-components/native")),Te=require("@mobilestock-native/clickable"),_e=require("@mobilestock-native/icons"),ke=require("@mobilestock-native/typography");var B=require("react/jsx-runtime"),pt={MD:"2.75rem",SM:"2.25rem"},bt={MD:"SM",SM:"XS"};function Ne(w){var i=w,{label:e,icon:t,color:r="DEFAULT",active:o=!1,trailing:n,href:c,accessibilityLabel:f,size:u="MD"}=i,s=z(i,["label","icon","color","active","trailing","href","accessibilityLabel","size"]);let l=(0,Z.useTheme)(),g=U(l,r,o),E=W(l),G=l.colors.drawer.activeBackground,R=Math.round(Number(l.font.size.sm)*l.font.lineHeight);return(0,B.jsxs)(Te.Clickable,X(F(F({accessibilityRole:c?"link":"button",accessibilityLabel:f!=null?f:e,accessibilityState:{selected:o},direction:"ROW",align:"START_CENTER",gap:"SM",padding:"2XS_XS",minHeight:pt[u],borderRadius:"DEFAULT",backgroundColor:o?G:void 0,whenHovered:E?{backgroundColor:E}:void 0,whenPressed:E?{backgroundColor:E}:void 0},c?{href:c}:null),s),{testID:"drawer-item",children:[(0,B.jsx)(_e.Icon,{name:t,size:"SM",color:g}),(0,B.jsx)(wt,{size:bt[u],$color:g,$lineHeight:R,withEllipsis:!0,testID:"drawer-item-label",children:e}),n]}))}var wt=(0,Z.default)(ke.Typography)`
14
+ flex-shrink: 1;
15
+ line-height: ${({$lineHeight:e})=>e}px;
16
+ color: ${({$color:e})=>e};
17
+ `;var Fe=require("react"),q=require("react-native"),Ae=$(require("styled-components/native")),Pe=require("@mobilestock-native/container"),Me=require("@mobilestock-native/typography");var O=require("react/jsx-runtime");function Be({title:e,compact:t=!1}){let r=Y(),o=(0,Fe.useRef)(null);function n(){r&&T(o.current,(f,u,s,w)=>{r.show({text:e,anchor:{left:f,top:u,width:s,height:w}})})}function c(){r==null||r.hide()}return t?(0,O.jsx)(q.View,{ref:o,collapsable:!1,style:ht.dividerRow,accessible:!0,accessibilityRole:"header",accessibilityLabel:e,onPointerEnter:n,onPointerLeave:c,testID:"drawer-section-divider",children:(0,O.jsx)(gt,{testID:"drawer-section-divider-line"})}):(0,O.jsx)(Pe.Container,{padding:"SM_XS_2XS_XS",testID:"drawer-section-title",children:(0,O.jsx)(Me.Typography,{size:"XS",weight:"BOLD",color:"DEFAULT_200",transform:"UPPERCASE",accessibilityRole:"header",children:e})})}var gt=Ae.default.View`
18
+ width: 32px;
19
+ height: 1px;
20
+ background-color: ${({theme:e})=>e.colors.drawer.divider};
21
+ `,ht=q.StyleSheet.create({dividerRow:{alignItems:"center",paddingVertical:4}});var It={Root:we,Item:Ne,CompactItem:ye,SectionTitle:Be,Footer:Re};0&&(module.exports={Drawer,HOVER_EXPAND_DELAY_IN_MILLISECONDS});
package/package.json CHANGED
@@ -1,6 +1,17 @@
1
1
  {
2
2
  "name": "@mobilestock-native/drawer",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
3
+ "version": "0.2.0",
4
+ "main": "index.js",
5
+ "dependencies": {
6
+ "@mobilestock-native/badge": "^0.1.5",
7
+ "@mobilestock-native/clickable": "^1.1.2",
8
+ "@mobilestock-native/container": "^1.4.0",
9
+ "@mobilestock-native/icons": "^0.10.0",
10
+ "@mobilestock-native/typography": "^0.1.3"
11
+ },
12
+ "peerDependencies": {
13
+ "react": "18.2.0",
14
+ "react-native": "0.74.5",
15
+ "styled-components": "^6.1.8"
16
+ }
6
17
  }
package/README.md DELETED
@@ -1,3 +0,0 @@
1
- # Temporary Holding Version
2
-
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.