@nori-ui/core 1.0.6 → 1.1.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.
- package/dist/chunk-2UXKXUX2.js +286 -0
- package/dist/chunk-2UXKXUX2.js.map +1 -0
- package/dist/{chunk-DDGMLLS3.js → chunk-46OT4PA6.js} +3 -3
- package/dist/{chunk-DDGMLLS3.js.map → chunk-46OT4PA6.js.map} +1 -1
- package/dist/{chunk-SFNDR6DI.js → chunk-5BM6H2CD.js} +3 -3
- package/dist/{chunk-SFNDR6DI.js.map → chunk-5BM6H2CD.js.map} +1 -1
- package/dist/{chunk-EWWQQ5DB.js → chunk-6JVUVBZH.js} +5 -5
- package/dist/{chunk-EWWQQ5DB.js.map → chunk-6JVUVBZH.js.map} +1 -1
- package/dist/{chunk-FT2XBBQJ.js → chunk-6PO2IWB3.js} +8 -5
- package/dist/chunk-6PO2IWB3.js.map +1 -0
- package/dist/{chunk-YNKKEO2A.js → chunk-7D2BHQ6M.js} +3 -3
- package/dist/{chunk-YNKKEO2A.js.map → chunk-7D2BHQ6M.js.map} +1 -1
- package/dist/{chunk-MRJWPRCX.js → chunk-AFQIK6JI.js} +3 -3
- package/dist/{chunk-MRJWPRCX.js.map → chunk-AFQIK6JI.js.map} +1 -1
- package/dist/{chunk-IKLA2CVQ.js → chunk-C6TRLHMW.js} +21 -5
- package/dist/chunk-C6TRLHMW.js.map +1 -0
- package/dist/{chunk-NRYWNOG5.js → chunk-CGQIVFCN.js} +3 -3
- package/dist/{chunk-NRYWNOG5.js.map → chunk-CGQIVFCN.js.map} +1 -1
- package/dist/chunk-EFK7726V.js +104 -0
- package/dist/chunk-EFK7726V.js.map +1 -0
- package/dist/{chunk-3BDDPFCI.js → chunk-FDBQOQMW.js} +3 -3
- package/dist/{chunk-3BDDPFCI.js.map → chunk-FDBQOQMW.js.map} +1 -1
- package/dist/{chunk-XALU6LOT.js → chunk-GELLSU64.js} +3 -3
- package/dist/{chunk-XALU6LOT.js.map → chunk-GELLSU64.js.map} +1 -1
- package/dist/{chunk-BZLT6R62.js → chunk-GRDVE3IR.js} +3 -3
- package/dist/{chunk-BZLT6R62.js.map → chunk-GRDVE3IR.js.map} +1 -1
- package/dist/{chunk-OMU4R4Y5.js → chunk-HTF6FDB6.js} +3 -3
- package/dist/{chunk-OMU4R4Y5.js.map → chunk-HTF6FDB6.js.map} +1 -1
- package/dist/{chunk-X7APG7G2.js → chunk-HZKXPN6B.js} +154 -34
- package/dist/chunk-HZKXPN6B.js.map +1 -0
- package/dist/{chunk-WGT345SV.js → chunk-IGLMPAWE.js} +3 -3
- package/dist/{chunk-WGT345SV.js.map → chunk-IGLMPAWE.js.map} +1 -1
- package/dist/{chunk-5XEGZFG5.js → chunk-LWQZ257T.js} +3 -3
- package/dist/{chunk-5XEGZFG5.js.map → chunk-LWQZ257T.js.map} +1 -1
- package/dist/{chunk-RFW5SRZA.js → chunk-MJ4AGXS7.js} +3 -3
- package/dist/{chunk-RFW5SRZA.js.map → chunk-MJ4AGXS7.js.map} +1 -1
- package/dist/{chunk-PNP7L4TA.js → chunk-RM5TSXVE.js} +3 -3
- package/dist/{chunk-PNP7L4TA.js.map → chunk-RM5TSXVE.js.map} +1 -1
- package/dist/{chunk-MKSDYRWQ.js → chunk-SINLREQV.js} +3 -3
- package/dist/{chunk-MKSDYRWQ.js.map → chunk-SINLREQV.js.map} +1 -1
- package/dist/{chunk-TLS54G6Y.js → chunk-UF5OENHV.js} +3 -3
- package/dist/{chunk-TLS54G6Y.js.map → chunk-UF5OENHV.js.map} +1 -1
- package/dist/{chunk-ZQMNGPLE.js → chunk-UJ5KFRDE.js} +18 -6
- package/dist/chunk-UJ5KFRDE.js.map +1 -0
- package/dist/{chunk-SWC5CNKE.js → chunk-UPVNZPFV.js} +3 -3
- package/dist/{chunk-SWC5CNKE.js.map → chunk-UPVNZPFV.js.map} +1 -1
- package/dist/{chunk-3F4TXKDY.js → chunk-UUXWRDWW.js} +3 -3
- package/dist/chunk-UUXWRDWW.js.map +1 -0
- package/dist/{chunk-7GPDNQSX.js → chunk-V2AWSDDZ.js} +5 -5
- package/dist/{chunk-7GPDNQSX.js.map → chunk-V2AWSDDZ.js.map} +1 -1
- package/dist/{chunk-JQQ3FBN7.js → chunk-VCJF75T2.js} +3 -3
- package/dist/{chunk-JQQ3FBN7.js.map → chunk-VCJF75T2.js.map} +1 -1
- package/dist/{chunk-ZBW3BA5R.js → chunk-VMAGFYHG.js} +39 -4
- package/dist/chunk-VMAGFYHG.js.map +1 -0
- package/dist/{chunk-JZ774T7U.js → chunk-W3HMOOON.js} +3 -3
- package/dist/{chunk-JZ774T7U.js.map → chunk-W3HMOOON.js.map} +1 -1
- package/dist/{chunk-6AD6KCVB.js → chunk-WAKKQROH.js} +3 -3
- package/dist/{chunk-6AD6KCVB.js.map → chunk-WAKKQROH.js.map} +1 -1
- package/dist/{chunk-LVWNMQGR.js → chunk-WDNDTSNX.js} +5 -5
- package/dist/{chunk-LVWNMQGR.js.map → chunk-WDNDTSNX.js.map} +1 -1
- package/dist/chunk-WOF67PKT.js +60 -0
- package/dist/chunk-WOF67PKT.js.map +1 -0
- package/dist/{chunk-QJNV7YQP.js → chunk-WTNDPO2V.js} +39 -4
- package/dist/chunk-WTNDPO2V.js.map +1 -0
- package/dist/{chunk-FEPTH5RV.js → chunk-XP55RZ3D.js} +3 -3
- package/dist/{chunk-FEPTH5RV.js.map → chunk-XP55RZ3D.js.map} +1 -1
- package/dist/{chunk-CCUXO2HN.js → chunk-Y4ZRSW35.js} +3 -3
- package/dist/{chunk-CCUXO2HN.js.map → chunk-Y4ZRSW35.js.map} +1 -1
- package/dist/client.cjs +619 -123
- package/dist/client.cjs.map +1 -1
- package/dist/client.d.cts +2 -0
- package/dist/client.d.ts +2 -0
- package/dist/client.js +40 -38
- package/dist/client.js.map +1 -1
- package/dist/components/Accordion/index.js +2 -2
- package/dist/components/Alert/index.js +2 -2
- package/dist/components/AlertDialog/index.js +2 -2
- package/dist/components/Avatar/index.js +2 -2
- package/dist/components/Badge/index.js +2 -2
- package/dist/components/Box/index.js +4 -4
- package/dist/components/Breadcrumb/index.cjs +6 -3
- package/dist/components/Breadcrumb/index.cjs.map +1 -1
- package/dist/components/Breadcrumb/index.js +5 -5
- package/dist/components/Button/index.js +2 -2
- package/dist/components/Calendar/index.cjs +170 -35
- package/dist/components/Calendar/index.cjs.map +1 -1
- package/dist/components/Calendar/index.js +5 -5
- package/dist/components/Card/index.js +2 -2
- package/dist/components/Checkbox/index.cjs +36 -1
- package/dist/components/Checkbox/index.cjs.map +1 -1
- package/dist/components/Checkbox/index.d.cts +17 -1
- package/dist/components/Checkbox/index.d.ts +17 -1
- package/dist/components/Checkbox/index.js +2 -2
- package/dist/components/Dialog/index.js +2 -2
- package/dist/components/Field/index.cjs +703 -0
- package/dist/components/Field/index.cjs.map +1 -0
- package/dist/components/Field/index.d.cts +51 -0
- package/dist/components/Field/index.d.ts +51 -0
- package/dist/components/Field/index.js +9 -0
- package/dist/components/Field/index.js.map +1 -0
- package/dist/components/FloatButton/index.cjs +6 -3
- package/dist/components/FloatButton/index.cjs.map +1 -1
- package/dist/components/FloatButton/index.js +5 -5
- package/dist/components/HStack/index.js +4 -4
- package/dist/components/InputGroup/index.cjs.map +1 -1
- package/dist/components/InputGroup/index.d.cts +8 -1
- package/dist/components/InputGroup/index.d.ts +8 -1
- package/dist/components/InputGroup/index.js +2 -2
- package/dist/components/Label/index.cjs +458 -0
- package/dist/components/Label/index.cjs.map +1 -0
- package/dist/components/Label/index.d.cts +14 -0
- package/dist/components/Label/index.d.ts +14 -0
- package/dist/components/Label/index.js +8 -0
- package/dist/components/Label/index.js.map +1 -0
- package/dist/components/Pagination/index.cjs +21 -6
- package/dist/components/Pagination/index.cjs.map +1 -1
- package/dist/components/Pagination/index.js +5 -5
- package/dist/components/Popover/index.js +2 -2
- package/dist/components/Progress/index.js +2 -2
- package/dist/components/Radio/index.cjs +18 -2
- package/dist/components/Radio/index.cjs.map +1 -1
- package/dist/components/Radio/index.d.cts +17 -1
- package/dist/components/Radio/index.d.ts +17 -1
- package/dist/components/Radio/index.js +2 -2
- package/dist/components/SegmentedControl/index.js +2 -2
- package/dist/components/Select/index.cjs +15 -3
- package/dist/components/Select/index.cjs.map +1 -1
- package/dist/components/Select/index.d.cts +6 -0
- package/dist/components/Select/index.d.ts +6 -0
- package/dist/components/Select/index.js +2 -2
- package/dist/components/Switch/index.cjs +36 -1
- package/dist/components/Switch/index.cjs.map +1 -1
- package/dist/components/Switch/index.d.cts +17 -1
- package/dist/components/Switch/index.d.ts +17 -1
- package/dist/components/Switch/index.js +2 -2
- package/dist/components/Tabs/index.js +2 -2
- package/dist/components/Text/index.js +2 -2
- package/dist/components/TextArea/index.cjs +35 -84
- package/dist/components/TextArea/index.cjs.map +1 -1
- package/dist/components/TextArea/index.js +3 -3
- package/dist/components/TextInput/index.cjs +35 -84
- package/dist/components/TextInput/index.cjs.map +1 -1
- package/dist/components/TextInput/index.d.cts +7 -8
- package/dist/components/TextInput/index.d.ts +7 -8
- package/dist/components/TextInput/index.js +2 -2
- package/dist/components/Toggle/index.js +2 -2
- package/dist/components/Tooltip/index.js +2 -2
- package/dist/components/VStack/index.js +4 -4
- package/dist/i18n/index.cjs +6 -3
- package/dist/i18n/index.cjs.map +1 -1
- package/dist/i18n/index.js +1 -1
- package/dist/index.cjs +619 -123
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +2 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +37 -35
- package/package.json +8 -1
- package/dist/chunk-3F4TXKDY.js.map +0 -1
- package/dist/chunk-FT2XBBQJ.js.map +0 -1
- package/dist/chunk-IKLA2CVQ.js.map +0 -1
- package/dist/chunk-QJNV7YQP.js.map +0 -1
- package/dist/chunk-X7APG7G2.js.map +0 -1
- package/dist/chunk-ZBW3BA5R.js.map +0 -1
- package/dist/chunk-ZQMNGPLE.js.map +0 -1
- package/dist/chunk-ZRD4FQBT.js +0 -153
- package/dist/ch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A,CAAQ,YAAA,EAAc,OAAO,CAAA;AAAA,IACpD;AACA,IAAA,OAAO,OAAA,IAAW,EAAA;AAAA,EACtB,CAAA;AACJ;AA1BgB,MAAA,CAAA,WAAA,EAAA,aAAA,CAAA;AA4BhB,SAAS,SAAA,CAAU,KAAa,KAAA,EAAmC;AAC/D,EAAA,IAAI,UAAU,MAAA,EAAW;AACrB,IAAA,OAAO,GAAA;AAAA,EACX;AAEA,EAAA,IAAI,UAAU,CAAA,EAAG;AACb,IAAA,OAAO,GAAG,GAAG,CAAA,IAAA,CAAA;AAAA,EACjB;AACA,EAAA,OAAO,GAAG,GAAG,CAAA,MAAA,CAAA;AACjB;AATS,MAAA,CAAA,SAAA,EAAA,WAAA,CAAA;AAWT,SAAS,WAAA,CAAY,UAAkB,OAAA,EAA0C;AAC7E,EAAA,IAAI,CAAC,OAAA,EAAS;AACV,IAAA,OAAO,QAAA;AAAA,EACX;AACA,EAAA,OAAO,QAAA,CAAS,OAAA,CAAQ,kCAAA,EAAoC,CAAC,QAAQ,IAAA,KAAiB;AAClF,IAAA,MAAM,KAAA,GAAQ,QAAQ,IAAI,CAAA;AAC1B,IAAA,OAAO,UAAU,MAAA,IAAa,KAAA,KAAU,IAAA,GAAO,EAAA,GAAK,OAAO,KAAK,CAAA;AAAA,EACpE,CAAC,CAAA;AACL;AARS,MAAA,CAAA,WAAA,EAAA,aAAA,CAAA","file":"chunk-6PO2IWB3.js","sourcesContent":["import type { Dictionary } from './types';\n\n/**\n * Default English strings used by library components.\n *\n * Key naming convention:\n * <component>.<purpose>[_plural-form]\n *\n * Plural suffixes follow i18next: `_zero`, `_one`, `_two`, `_few`, `_many`, `_other`.\n * Interpolation uses `{{name}}` — double braces, no spaces, by convention.\n */\nexport const defaultDictionary: Dictionary = {\n // generic / shared\n 'common.cancel': 'Cancel',\n 'common.confirm': 'Confirm',\n 'common.close': 'Close',\n 'common.back': 'Back',\n 'common.loading': 'Loading',\n 'common.error': 'Something went wrong',\n 'common.retry': 'Try again',\n\n // breadcrumb\n 'breadcrumb.ariaLabel': 'Breadcrumb',\n 'breadcrumb.expandLabel': 'Show full path',\n 'breadcrumb.ellipsisLabel': 'More',\n 'breadcrumb.currentPageLabel': 'Current page',\n 'breadcrumb.siblingMenuLabel': 'Open sibling pages',\n\n // pagination\n 'pagination.ariaLabel': 'Pagination',\n 'pagination.previous': 'Previous page',\n 'pagination.next': 'Next page',\n 'pagination.first': 'First page',\n 'pagination.last': 'Last page',\n 'pagination.ellipsis': 'More pages',\n 'pagination.currentPage': 'Current page',\n 'pagination.gotoPage': 'Go to page {{page}}',\n 'pagination.range': 'Showing {{from}}–{{to}} of {{total}}',\n 'pagination.pageOf': 'Page {{page}} of {{total}}',\n 'pagination.pageSizeLabel': 'Items per page',\n 'pagination.jumperLabel': 'Go to page',\n 'pagination.jumperPlaceholder': '#',\n\n // floatButton\n 'floatButton.backToTop': 'Back to top',\n\n // calendar\n 'calendar.header.previous': 'Previous month',\n 'calendar.header.next': 'Next month',\n 'calendar.header.openMonthView': 'Open month picker',\n 'calendar.header.openYearView': 'Open year picker',\n 'calendar.header.openDayView': 'Open day picker',\n 'calendar.today': 'Today',\n 'calendar.clear': 'Clear',\n\n // button\n 'button.loadingLabel': 'Loading',\n\n // input\n 'input.clear': 'Clear',\n 'input.passwordShow': 'Show password',\n 'input.passwordHide': 'Hide password',\n\n // checkbox / switch\n 'checkbox.checked': 'Checked',\n 'checkbox.unchecked': 'Unchecked',\n 'switch.on': 'On',\n 'switch.off': 'Off',\n\n // field\n 'field.requiredIndicator': '*',\n 'field.requiredLabel': 'required',\n};\n","import type { Dictionary, I18nInput, I18nOptions, TranslateFn } from './types';\n\n/**\n * Normalizes the consumer's i18n input (undefined | dictionary | function) into a\n * uniform TranslateFn. Internal code only calls the returned function.\n *\n * Precedence for a given key lookup:\n * 1. consumer function (if provided) — called verbatim, no further fallback\n * 2. consumer dictionary (if provided)\n * 3. library defaults\n * 4. options.defaultValue\n * 5. the key itself (so missing strings are visible in dev, not silent)\n */\nexport function resolveI18n(input: I18nInput, defaults: Dictionary): TranslateFn {\n if (typeof input === 'function') {\n // Wrap so the consumer fn is always invoked with (key, options) — enables\n // Jest `toHaveBeenCalledWith(key, undefined)` assertions and mirrors i18next's\n // own call signature exactly.\n return (keyOrKeys, options) => input(keyOrKeys, options);\n }\n\n const dict = input ?? {};\n\n return (keyOrKeys, options) => {\n const keys = Array.isArray(keyOrKeys) ? keyOrKeys : [keyOrKeys];\n for (const rawKey of keys) {\n const key = pluralize(rawKey, options?.count);\n const template = dict[key] ?? defaults[key];\n if (template !== undefined) {\n return interpolate(template, options);\n }\n }\n // exhausted the key list\n const lastKey = keys[keys.length - 1];\n if (options?.defaultValue !== undefined) {\n return interpolate(options.defaultValue, options);\n }\n return lastKey ?? '';\n };\n}\n\nfunction pluralize(key: string, count: number | undefined): string {\n if (count === undefined) {\n return key;\n }\n // Minimal English pluralization — extend with ICU rules later if needed.\n if (count === 1) {\n return `${key}_one`;\n }\n return `${key}_other`;\n}\n\nfunction interpolate(template: string, options: I18nOptions | undefined): string {\n if (!options) {\n return template;\n }\n return template.replace(/\\{\\{\\s*([A-Za-z0-9_.-]+)\\s*\\}\\}/g, (_match, name: string) => {\n const value = options[name];\n return value === undefined || value === null ? '' : String(value);\n });\n}\n"]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Slot } from './chunk-ZIBNLXIV.js';
|
|
2
|
-
import { px } from './chunk-5A2QOOVN.js';
|
|
3
2
|
import { cn } from './chunk-CHXHRJNZ.js';
|
|
3
|
+
import { px } from './chunk-5A2QOOVN.js';
|
|
4
4
|
import { useThemeColors } from './chunk-R5JMDDCB.js';
|
|
5
5
|
import { __name } from './chunk-WCQVDF3K.js';
|
|
6
6
|
import { createContext, useState, useCallback, useId, useRef, useEffect, isValidElement, useContext } from 'react';
|
|
@@ -332,5 +332,5 @@ var Popover = Object.assign(PopoverRoot, {
|
|
|
332
332
|
});
|
|
333
333
|
|
|
334
334
|
export { Popover };
|
|
335
|
-
//# sourceMappingURL=chunk-
|
|
336
|
-
//# sourceMappingURL=chunk-
|
|
335
|
+
//# sourceMappingURL=chunk-7D2BHQ6M.js.map
|
|
336
|
+
//# sourceMappingURL=chunk-7D2BHQ6M.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/Popover/Popover.tsx"],"names":["RNText","content"],"mappings":";;;;;;;;;AAoCA,IAAM,cAAA,GAAiB,cAA0C,IAAI,CAAA;AAErE,IAAM,iBAAA,2BAAqB,KAAA,KAAuC;AAC9D,EAAA,MAAM,GAAA,GAAM,WAAW,cAAc,CAAA;AACrC,EAAA,IAAI,CAAC,GAAA,EAAK;AACN,IAAA,MAAM,IAAI,KAAA,CAAM,CAAA,CAAA,EAAI,KAAK,CAAA,sCAAA,CAAwC,CAAA;AAAA,EACrE;AACA,EAAA,OAAO,GAAA;AACX,CAAA,EAN0B,mBAAA,CAAA;AAyC1B,IAAM,WAAA,2BAAe,EAAE,IAAA,EAAM,cAAc,KAAA,EAAO,YAAA,EAAc,UAAS,KAAoB;AACzF,EAAA,MAAM,CAAC,KAAA,EAAO,QAAQ,CAAA,GAAI,SAAkB,WAAW,CAAA;AACvD,EAAA,MAAM,eAAe,IAAA,KAAS,MAAA;AAC9B,EAAA,MAAM,OAAA,GAAU,eAAe,IAAA,GAAO,KAAA;AAEtC,EAAA,MAAM,OAAA,GAAU,WAAA;AAAA,IACZ,CAAC,IAAA,KAAkB;AACf,MAAA,IAAI,CAAC,YAAA,EAAc;AACf,QAAA,QAAA,CAAS,IAAI,CAAA;AAAA,MACjB;AACA,MAAA,YAAA,GAAe,IAAI,CAAA;AAAA,IACvB,CAAA;AAAA,IACA,CAAC,cAAc,YAAY;AAAA,GAC/B;AAEA,EAAA,MAAM,SAAS,KAAA,EAAM;AACrB,EAAA,MAAM,UAAA,GAAa,OAA2B,IAAI,CAAA;AAClD,EAAA,MAAM,UAAA,GAAa,OAA8B,IAAI,CAAA;AAMrD,EA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UAEC,QAAA,EAAA;AAAA;AAAA;AACL;AAAA,GACJ,EACJ,CAAA;AAER,CAAA,EAzN8B,gBAAA,CAAA;AAiOvB,IAAM,OAAA,GAAU,MAAA,CAAO,MAAA,CAAO,WAAA,EAAa;AAAA,EAC9C,OAAA,EAAS,cAAA;AAAA,EACT,OAAA,EAAS;AACb,CAAC","file":"chunk-YNKKEO2A.js","sourcesContent":["'use client';\n\nimport {\n createContext,\n isValidElement,\n type ReactElement,\n type ReactNode,\n useCallback,\n useContext,\n useEffect,\n useId,\n useRef,\n useState,\n} from 'react';\nimport type { ViewStyle } from 'react-native';\nimport { Dimensions, Modal, Platform, Pressable, Text as RNText, View } from 'react-native';\nimport { Slot } from '../../slot';\nimport { px } from '../../theme/px';\nimport { useThemeColors } from '../../theme/use-theme-colors';\nimport { cn } from '../../utils/cn';\n\nexport type PopoverSide = 'top' | 'right' | 'bottom' | 'left';\nexport type PopoverAlign = 'start' | 'center' | 'end';\n\ntype TriggerRect = { top: number; left: number; width: number; height: number };\n\ntype PopoverContextValue = {\n open: boolean;\n setOpen: (next: boolean) => void;\n contentId: string;\n triggerRef: { current: HTMLElement | null };\n contentRef: { current: HTMLDivElement | null };\n triggerRect: TriggerRect | null;\n measureTrigger: () => void;\n};\n\nconst PopoverContext = createContext<PopoverContextValue | null>(null);\n\nconst usePopoverContext = (label: string): PopoverContextValue => {\n const ctx = useContext(PopoverContext);\n if (!ctx) {\n throw new Error(`<${label}> must be rendered inside a <Popover>.`);\n }\n return ctx;\n};\n\nexport type PopoverProps = {\n /** Controlled open state. */\n open?: boolean;\n /** Uncontrolled initial open state. @defaultValue false */\n defaultOpen?: boolean;\n /** Fires with the new open state. */\n onOpenChange?: (open: boolean) => void;\n children?: ReactNode;\n};\n\n/**\n * Non-modal floating panel anchored to a trigger element. Use for help\n * tooltips with rich content, color pickers, or profile previews.\n *\n * Composition: `Popover` (root, owns open state), `PopoverTrigger`\n * (forwards events to its child via Slot when `asChild`), `PopoverContent`\n * (the floating surface).\n *\n * Differences from `Dialog`: non-modal — does NOT trap focus or lock\n * scroll. Tab moves outside as normal. Differences from `Tooltip`: can\n * contain interactive content (buttons, inputs, links) and dismisses on\n * outside-click + Escape rather than mouse-leave.\n *\n * Behavior:\n * - Trigger click toggles open/close.\n * - Click outside the content (and outside the trigger) closes.\n * - Escape closes.\n *\n * Cross-platform: uses RN `<Modal>` as the visibility/portal primitive on\n * native (transparent backdrop, tap-outside-to-close). On web, the content\n * uses `position: fixed` + a measured trigger rect so it escapes any\n * ancestor `overflow: hidden`.\n */\nconst PopoverRoot = ({ open, defaultOpen = false, onOpenChange, children }: PopoverProps) => {\n const [inner, setInner] = useState<boolean>(defaultOpen);\n const isControlled = open !== undefined;\n const current = isControlled ? open : inner;\n\n const setOpen = useCallback(\n (next: boolean) => {\n if (!isControlled) {\n setInner(next);\n }\n onOpenChange?.(next);\n },\n [isControlled, onOpenChange]\n );\n\n const baseId = useId();\n const triggerRef = useRef<HTMLElement | null>(null);\n const contentRef = useRef<HTMLDivElement | null>(null);\n\n // Measure the trigger so the content can render with `position: fixed` +\n // computed coords. position:fixed escapes any ancestor's overflow:hidden\n // (e.g. fumadocs Tabs panes, our Preview frame), which is the single\n // biggest source of \"the popup got cut off\" bugs.\n const [triggerRect, setTriggerRect] = useState<TriggerRect | null>(null);\n const measureTrigger = useCallback(() => {\n const node = triggerRef.current;\n if (!node || typeof node.getBoundingClientRect !== 'function') {\n return;\n }\n const rect = node.getBoundingClientRect();\n setTriggerRect({ top: rect.top, left: rect.left, width: rect.width, height: rect.height });\n }, []);\n\n const ctxValue: PopoverContextValue = {\n open: current,\n setOpen,\n contentId: `${baseId}-content`,\n triggerRef,\n contentRef,\n triggerRect,\n measureTrigger,\n };\n\n return <PopoverContext.Provider value={ctxValue}>{children}</PopoverContext.Provider>;\n};\n\nexport type PopoverTriggerProps = {\n /** Render the child as the trigger (Slot pattern). Default true — pass `false` for an inline pressable. */\n asChild?: boolean;\n children?: ReactNode;\n className?: string;\n testID?: string;\n};\n\n/**\n * Element that toggles the popover. Uses `asChild` by default so any\n * element (Button, Link, custom Pressable) becomes the trigger.\n *\n * The trigger element gets `aria-haspopup=\"dialog\"` and `aria-expanded`\n * so assistive tech announces the relationship.\n */\nexport const PopoverTrigger = ({ asChild = true, children, className, testID }: PopoverTriggerProps) => {\n const ctx = usePopoverContext('PopoverTrigger');\n const onPress = useCallback(() => {\n ctx.measureTrigger();\n ctx.setOpen(!ctx.open);\n }, [ctx]);\n\n if (asChild && isValidElement(children)) {\n const child = children as ReactElement<Record<string, unknown>>;\n // Pass both onClick (web HTML buttons) AND onPress (RN Pressable /\n // our own Button) so the trigger fires regardless of which event\n // model the wrapped child speaks. The child's existing handler\n // runs first, then we toggle.\n const fire = (existing: ((e: unknown) => void) | undefined) => (event: unknown) => {\n existing?.(event);\n ctx.measureTrigger();\n ctx.setOpen(!ctx.open);\n };\n return (\n <Slot\n ref={(node: HTMLElement | null) => {\n ctx.triggerRef.current = node;\n }}\n onClick={fire(child.props.onClick as ((e: unknown) => void) | undefined)}\n onPress={fire(child.props.onPress as ((e: unknown) => void) | undefined)}\n aria-haspopup=\"dialog\"\n aria-expanded={ctx.open}\n aria-controls={ctx.contentId}\n {...(testID !== undefined ? { 'data-testid': testID } : {})}\n {...(className !== undefined ? { className } : {})}\n >\n {child}\n </Slot>\n );\n }\n\n return (\n <Pressable\n ref={(node) => {\n ctx.triggerRef.current = node as unknown as HTMLElement | null;\n }}\n onPress={onPress}\n {...({\n 'aria-haspopup': 'dialog',\n 'aria-expanded': ctx.open,\n 'aria-controls': ctx.contentId,\n } as Record<string, unknown>)}\n {...(testID !== undefined ? { testID } : {})}\n {...(className !== undefined ? { className } : {})}\n >\n {wrapStringChildren(children)}\n </Pressable>\n );\n};\n\n// On native, raw strings rendered as children of a non-Text component\n// throw \"Text strings must be rendered within a <Text> component\". On\n// web, react-native-web silently tolerates it. Wrap any string/number\n// children in an RNText so the same JSX renders cleanly on both\n// platforms. Non-string children are passed through unchanged.\nfunction wrapStringChildren(children: ReactNode): ReactNode {\n if (typeof children === 'string' || typeof children === 'number') {\n return <RNText>{children}</RNText>;\n }\n return children;\n}\n\nconst GAP = 4; // visual gap between trigger and content\nconst MIN_WIDTH = 200;\n// Margin reserved on each side so the popover never butts against the\n// viewport edge. Matches the 8px safe-area we use for native modal pads.\nconst VIEWPORT_MARGIN = 8;\n\nfunction computePosition(\n rect: TriggerRect,\n side: PopoverSide,\n align: PopoverAlign,\n contentSize: { width: number; height: number } | null\n): { top: number; left: number } {\n const cw = contentSize?.width ?? MIN_WIDTH;\n const ch = contentSize?.height ?? 0;\n\n let top = 0;\n let left = 0;\n\n switch (side) {\n case 'top':\n top = rect.top - GAP - ch;\n break;\n case 'bottom':\n top = rect.top + rect.height + GAP;\n break;\n case 'left':\n left = rect.left - GAP - cw;\n break;\n case 'right':\n left = rect.left + rect.width + GAP;\n break;\n }\n\n if (side === 'top' || side === 'bottom') {\n switch (align) {\n case 'start':\n left = rect.left;\n break;\n case 'center':\n left = rect.left + rect.width / 2 - cw / 2;\n break;\n case 'end':\n left = rect.left + rect.width - cw;\n break;\n }\n } else {\n switch (align) {\n case 'start':\n top = rect.top;\n break;\n case 'center':\n top = rect.top + rect.height / 2 - ch / 2;\n break;\n case 'end':\n top = rect.top + rect.height - ch;\n break;\n }\n }\n\n return { top, left };\n}\n\nexport type PopoverContentProps = {\n /** Side of the trigger to anchor on. @defaultValue 'bottom' */\n side?: PopoverSide;\n /** Alignment along the trigger edge. @defaultValue 'center' */\n align?: PopoverAlign;\n children?: ReactNode;\n className?: string;\n testID?: string;\n /** Accessible label when no visible heading is present. */\n 'aria-label'?: string;\n};\n\n/**\n * The floating popover surface. Renders only while open. On web uses\n * `position: fixed` with a measured trigger rect so it escapes any\n * ancestor `overflow: hidden`. Non-modal: focus is NOT trapped inside —\n * the user can tab back out as normal.\n *\n * ARIA: `role=\"dialog\"` (without `aria-modal`) so assistive tech\n * announces it as a grouping but doesn't suppress the rest of the page.\n */\nexport const PopoverContent = ({\n side = 'bottom',\n align = 'center',\n children,\n className,\n testID,\n ...rest\n}: PopoverContentProps) => {\n const ctx = usePopoverContext('PopoverContent');\n const colors = useThemeColors();\n const ariaLabel = rest['aria-label'];\n\n // Measure content size after first paint so we can anchor `top`-style\n // popups (which need to know content height to render above the trigger).\n const [contentSize, setContentSize] = useState<{ width: number; height: number } | null>(null);\n\n // Web-only side effects: outside-click close, Escape close, re-measure\n // on resize. RN Modal handles its own dismissal on native (tap-outside\n // is the transparent overlay's onPress).\n useEffect(() => {\n if (!ctx.open) {\n return;\n }\n if (Platform.OS !== 'web') {\n return;\n }\n if (typeof document === 'undefined') {\n return;\n }\n\n ctx.measureTrigger();\n\n const onDocMouseDown = (event: MouseEvent) => {\n const target = event.target as Node;\n const trigger = ctx.triggerRef.current;\n const content = ctx.contentRef.current;\n if (trigger?.contains(target)) {\n return;\n }\n if (content?.contains(target)) {\n return;\n }\n ctx.setOpen(false);\n };\n const onKeyDown = (event: KeyboardEvent) => {\n if (event.key === 'Escape') {\n event.preventDefault();\n ctx.setOpen(false);\n }\n };\n const onResize = () => ctx.measureTrigger();\n const onScroll = () => ctx.measureTrigger();\n\n document.addEventListener('mousedown', onDocMouseDown);\n document.addEventListener('keydown', onKeyDown);\n window.addEventListener('resize', onResize);\n window.addEventListener('scroll', onScroll, true);\n return () => {\n document.removeEventListener('mousedown', onDocMouseDown);\n document.removeEventListener('keydown', onKeyDown);\n window.removeEventListener('resize', onResize);\n window.removeEventListener('scroll', onScroll, true);\n };\n // ctx is the provider's stable identity; we only care about open transitions.\n }, [ctx.open, ctx.measureTrigger, ctx.setOpen, ctx.triggerRef, ctx.contentRef]);\n\n // Reset measured size when popover closes so reopening re-measures fresh.\n useEffect(() => {\n if (!ctx.open) {\n setContentSize(null);\n }\n }, [ctx.open]);\n\n if (!ctx.open) {\n return null;\n }\n\n const position = ctx.triggerRect ? computePosition(ctx.triggerRect, side, align, contentSize) : null;\n\n // Viewport-aware max width. Web uses Dimensions.get('window') which\n // react-native-web maps to window.innerWidth; native uses the same API\n // for the device window. Subtract margin on both sides so content\n // doesn't kiss the screen edge.\n const viewportWidth = Dimensions.get('window').width;\n const maxContentWidth = Math.max(MIN_WIDTH, viewportWidth - VIEWPORT_MARGIN * 2);\n\n const contentBaseStyle: ViewStyle = {\n minWidth: MIN_WIDTH,\n maxWidth: maxContentWidth,\n borderRadius: px(colors.radius.lg),\n borderWidth: 1,\n borderColor: colors.semantic.border.default,\n backgroundColor: colors.semantic.background.elevated,\n padding: px(colors.spacing['4']),\n ...(Platform.OS === 'web'\n ? ({\n boxShadow: '0 10px 15px -3px rgba(0,0,0,0.1), 0 4px 6px -4px rgba(0,0,0,0.1)',\n // Subtle scale-in. Skipped on native (do nothing fancy there).\n transition: 'opacity 120ms ease-out, transform 120ms ease-out',\n transform: 'scale(1)',\n opacity: 1,\n } as ViewStyle)\n : { elevation: 8 }),\n };\n\n // Clamp `left` so the popover stays within the viewport even when the\n // trigger sits near the right edge. First-paint fallback uses\n // `maxContentWidth` (the cap we apply via maxWidth above) — content\n // is allowed to grow up to that size, so assuming worst-case avoids\n // a one-frame overflow before measurement settles.\n const measuredWidth = contentSize?.width ?? maxContentWidth;\n const clampedLeft = position\n ? Math.min(\n Math.max(VIEWPORT_MARGIN, position.left),\n Math.max(VIEWPORT_MARGIN, viewportWidth - measuredWidth - VIEWPORT_MARGIN)\n )\n : 0;\n\n const positionedStyle: ViewStyle =\n Platform.OS === 'web'\n ? position\n ? ({\n position: 'fixed' as unknown as 'absolute',\n top: position.top,\n left: clampedLeft,\n zIndex: 50,\n } as ViewStyle)\n : ({\n // Trigger not yet measured — render off-screen for a\n // frame to avoid a flash at (0,0).\n position: 'fixed' as unknown as 'absolute',\n top: -9999,\n left: -9999,\n zIndex: 50,\n } as ViewStyle)\n : {};\n\n const content = (\n <View\n ref={(node) => {\n ctx.contentRef.current = node as unknown as HTMLDivElement | null;\n if (Platform.OS !== 'web') {\n return;\n }\n if (!node) {\n return;\n }\n if (typeof (node as unknown as HTMLDivElement).getBoundingClientRect !== 'function') {\n return;\n }\n const rect = (node as unknown as HTMLDivElement).getBoundingClientRect();\n if (!contentSize || contentSize.width !== rect.width || contentSize.height !== rect.height) {\n setContentSize({ width: rect.width, height: rect.height });\n }\n }}\n {...({\n role: 'dialog',\n id: ctx.contentId,\n ...(ariaLabel !== undefined ? { 'aria-label': ariaLabel, accessibilityLabel: ariaLabel } : {}),\n } as Record<string, unknown>)}\n {...(testID !== undefined ? { testID } : {})}\n className={cn(\n 'rounded-lg border border-semantic-border-default bg-semantic-background-elevated',\n className\n )}\n style={[contentBaseStyle, positionedStyle]}\n >\n {children}\n </View>\n );\n\n if (Platform.OS === 'web') {\n return content;\n }\n\n // Native: use Modal as the floating layer with a transparent backdrop.\n // Tap on the backdrop closes the popover.\n return (\n <Modal visible={ctx.open} transparent animationType=\"fade\" onRequestClose={() => ctx.setOpen(false)}>\n <Pressable\n accessibilityRole=\"none\"\n aria-hidden={true}\n onPress={() => ctx.setOpen(false)}\n style={{\n position: 'absolute',\n top: 0,\n left: 0,\n right: 0,\n bottom: 0,\n backgroundColor: 'transparent',\n }}\n >\n <Pressable\n onPress={(event) => event.stopPropagation?.()}\n style={{\n position: 'absolute',\n top: ctx.triggerRect\n ? side === 'top'\n ? Math.max(VIEWPORT_MARGIN, ctx.triggerRect.top - GAP - 80)\n : ctx.triggerRect.top + ctx.triggerRect.height + GAP\n : 80,\n // Clamp horizontally so a wide popover near the\n // right edge can still grow leftward without\n // overflowing the screen.\n left: ctx.triggerRect\n ? Math.min(\n Math.max(VIEWPORT_MARGIN, ctx.triggerRect.left),\n Math.max(VIEWPORT_MARGIN, viewportWidth - measuredWidth - VIEWPORT_MARGIN)\n )\n : VIEWPORT_MARGIN * 2,\n }}\n >\n {content}\n </Pressable>\n </Pressable>\n </Modal>\n );\n};\n\n/**\n * Public `Popover` value — the root function plus its `.Trigger` and `.Content`\n * static members. `Object.assign` produces a value whose inferred type carries\n * the static properties, so `.d.ts` consumers can write `<Popover.Trigger>`\n * without a separate import.\n */\nexport const Popover = Object.assign(PopoverRoot, {\n Trigger: PopoverTrigger,\n Content: PopoverContent,\n});\n"]}
|
|
1
|
+
{"version":3,"sources":["../src/components/Popover/Popover.tsx"],"names":["RNText","content"],"mappings":";;;;;;;;;AAoCA,IAAM,cAAA,GAAiB,cAA0C,IAAI,CAAA;AAErE,IAAM,iBAAA,2BAAqB,KAAA,KAAuC;AAC9D,EAAA,MAAM,GAAA,GAAM,WAAW,cAAc,CAAA;AACrC,EAAA,IAAI,CAAC,GAAA,EAAK;AACN,IAAA,MAAM,IAAI,KAAA,CAAM,CAAA,CAAA,EAAI,KAAK,CAAA,sCAAA,CAAwC,CAAA;AAAA,EACrE;AACA,EAAA,OAAO,GAAA;AACX,CAAA,EAN0B,mBAAA,CAAA;AAyC1B,IAAM,WAAA,2BAAe,EAAE,IAAA,EAAM,cAAc,KAAA,EAAO,YAAA,EAAc,UAAS,KAAoB;AACzF,EAAA,MAAM,CAAC,KAAA,EAAO,QAAQ,CAAA,GAAI,SAAkB,WAAW,CAAA;AACvD,EAAA,MAAM,eAAe,IAAA,KAAS,MAAA;AAC9B,EAAA,MAAM,OAAA,GAAU,eAAe,IAAA,GAAO,KAAA;AAEtC,EAAA,MAAM,OAAA,GAAU,WAAA;AAAA,IACZ,CAAC,IAAA,KAAkB;AACf,MAAA,IAAI,CAAC,YAAA,EAAc;AACf,QAAA,QAAA,CAAS,IAAI,CAAA;AAAA,MACjB;AACA,MAAA,YAAA,GAAe,IAAI,CAAA;AAAA,IACvB,CAAA;AAAA,IACA,CAAC,cAAc,YAAY;AAAA,GAC/B;AAEA,EAAA,MAAM,SAAS,KAAA,EAAM;AACrB,EAAA,MAAM,UAAA,GAAa,OAA2B,IAAI,CAAA;AAClD,EAAA,MAAM,UAAA,GAAa,OAA8B,IAAI,CAAA;AAMrD,EAAA,MAAM,CAAC,WAAA,EAAa,cAAc,CAAA,GAAI,SAA6B,IAAI,CAAA;AAC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A,EAzN8B,gBAAA,CAAA;AAiOvB,IAAM,OAAA,GAAU,MAAA,CAAO,MAAA,CAAO,WAAA,EAAa;AAAA,EAC9C,OAAA,EAAS,cAAA;AAAA,EACT,OAAA,EAAS;AACb,CAAC","file":"chunk-7D2BHQ6M.js","sourcesContent":["'use client';\n\nimport {\n createContext,\n isValidElement,\n type ReactElement,\n type ReactNode,\n useCallback,\n useContext,\n useEffect,\n useId,\n useRef,\n useState,\n} from 'react';\nimport type { ViewStyle } from 'react-native';\nimport { Dimensions, Modal, Platform, Pressable, Text as RNText, View } from 'react-native';\nimport { Slot } from '../../slot';\nimport { px } from '../../theme/px';\nimport { useThemeColors } from '../../theme/use-theme-colors';\nimport { cn } from '../../utils/cn';\n\nexport type PopoverSide = 'top' | 'right' | 'bottom' | 'left';\nexport type PopoverAlign = 'start' | 'center' | 'end';\n\ntype TriggerRect = { top: number; left: number; width: number; height: number };\n\ntype PopoverContextValue = {\n open: boolean;\n setOpen: (next: boolean) => void;\n contentId: string;\n triggerRef: { current: HTMLElement | null };\n contentRef: { current: HTMLDivElement | null };\n triggerRect: TriggerRect | null;\n measureTrigger: () => void;\n};\n\nconst PopoverContext = createContext<PopoverContextValue | null>(null);\n\nconst usePopoverContext = (label: string): PopoverContextValue => {\n const ctx = useContext(PopoverContext);\n if (!ctx) {\n throw new Error(`<${label}> must be rendered inside a <Popover>.`);\n }\n return ctx;\n};\n\nexport type PopoverProps = {\n /** Controlled open state. */\n open?: boolean;\n /** Uncontrolled initial open state. @defaultValue false */\n defaultOpen?: boolean;\n /** Fires with the new open state. */\n onOpenChange?: (open: boolean) => void;\n children?: ReactNode;\n};\n\n/**\n * Non-modal floating panel anchored to a trigger element. Use for help\n * tooltips with rich content, color pickers, or profile previews.\n *\n * Composition: `Popover` (root, owns open state), `PopoverTrigger`\n * (forwards events to its child via Slot when `asChild`), `PopoverContent`\n * (the floating surface).\n *\n * Differences from `Dialog`: non-modal — does NOT trap focus or lock\n * scroll. Tab moves outside as normal. Differences from `Tooltip`: can\n * contain interactive content (buttons, inputs, links) and dismisses on\n * outside-click + Escape rather than mouse-leave.\n *\n * Behavior:\n * - Trigger click toggles open/close.\n * - Click outside the content (and outside the trigger) closes.\n * - Escape closes.\n *\n * Cross-platform: uses RN `<Modal>` as the visibility/portal primitive on\n * native (transparent backdrop, tap-outside-to-close). On web, the content\n * uses `position: fixed` + a measured trigger rect so it escapes any\n * ancestor `overflow: hidden`.\n */\nconst PopoverRoot = ({ open, defaultOpen = false, onOpenChange, children }: PopoverProps) => {\n const [inner, setInner] = useState<boolean>(defaultOpen);\n const isControlled = open !== undefined;\n const current = isControlled ? open : inner;\n\n const setOpen = useCallback(\n (next: boolean) => {\n if (!isControlled) {\n setInner(next);\n }\n onOpenChange?.(next);\n },\n [isControlled, onOpenChange]\n );\n\n const baseId = useId();\n const triggerRef = useRef<HTMLElement | null>(null);\n const contentRef = useRef<HTMLDivElement | null>(null);\n\n // Measure the trigger so the content can render with `position: fixed` +\n // computed coords. position:fixed escapes any ancestor's overflow:hidden\n // (e.g. fumadocs Tabs panes, our Preview frame), which is the single\n // biggest source of \"the popup got cut off\" bugs.\n const [triggerRect, setTriggerRect] = useState<TriggerRect | null>(null);\n const measureTrigger = useCallback(() => {\n const node = triggerRef.current;\n if (!node || typeof node.getBoundingClientRect !== 'function') {\n return;\n }\n const rect = node.getBoundingClientRect();\n setTriggerRect({ top: rect.top, left: rect.left, width: rect.width, height: rect.height });\n }, []);\n\n const ctxValue: PopoverContextValue = {\n open: current,\n setOpen,\n contentId: `${baseId}-content`,\n triggerRef,\n contentRef,\n triggerRect,\n measureTrigger,\n };\n\n return <PopoverContext.Provider value={ctxValue}>{children}</PopoverContext.Provider>;\n};\n\nexport type PopoverTriggerProps = {\n /** Render the child as the trigger (Slot pattern). Default true — pass `false` for an inline pressable. */\n asChild?: boolean;\n children?: ReactNode;\n className?: string;\n testID?: string;\n};\n\n/**\n * Element that toggles the popover. Uses `asChild` by default so any\n * element (Button, Link, custom Pressable) becomes the trigger.\n *\n * The trigger element gets `aria-haspopup=\"dialog\"` and `aria-expanded`\n * so assistive tech announces the relationship.\n */\nexport const PopoverTrigger = ({ asChild = true, children, className, testID }: PopoverTriggerProps) => {\n const ctx = usePopoverContext('PopoverTrigger');\n const onPress = useCallback(() => {\n ctx.measureTrigger();\n ctx.setOpen(!ctx.open);\n }, [ctx]);\n\n if (asChild && isValidElement(children)) {\n const child = children as ReactElement<Record<string, unknown>>;\n // Pass both onClick (web HTML buttons) AND onPress (RN Pressable /\n // our own Button) so the trigger fires regardless of which event\n // model the wrapped child speaks. The child's existing handler\n // runs first, then we toggle.\n const fire = (existing: ((e: unknown) => void) | undefined) => (event: unknown) => {\n existing?.(event);\n ctx.measureTrigger();\n ctx.setOpen(!ctx.open);\n };\n return (\n <Slot\n ref={(node: HTMLElement | null) => {\n ctx.triggerRef.current = node;\n }}\n onClick={fire(child.props.onClick as ((e: unknown) => void) | undefined)}\n onPress={fire(child.props.onPress as ((e: unknown) => void) | undefined)}\n aria-haspopup=\"dialog\"\n aria-expanded={ctx.open}\n aria-controls={ctx.contentId}\n {...(testID !== undefined ? { 'data-testid': testID } : {})}\n {...(className !== undefined ? { className } : {})}\n >\n {child}\n </Slot>\n );\n }\n\n return (\n <Pressable\n ref={(node) => {\n ctx.triggerRef.current = node as unknown as HTMLElement | null;\n }}\n onPress={onPress}\n {...({\n 'aria-haspopup': 'dialog',\n 'aria-expanded': ctx.open,\n 'aria-controls': ctx.contentId,\n } as Record<string, unknown>)}\n {...(testID !== undefined ? { testID } : {})}\n {...(className !== undefined ? { className } : {})}\n >\n {wrapStringChildren(children)}\n </Pressable>\n );\n};\n\n// On native, raw strings rendered as children of a non-Text component\n// throw \"Text strings must be rendered within a <Text> component\". On\n// web, react-native-web silently tolerates it. Wrap any string/number\n// children in an RNText so the same JSX renders cleanly on both\n// platforms. Non-string children are passed through unchanged.\nfunction wrapStringChildren(children: ReactNode): ReactNode {\n if (typeof children === 'string' || typeof children === 'number') {\n return <RNText>{children}</RNText>;\n }\n return children;\n}\n\nconst GAP = 4; // visual gap between trigger and content\nconst MIN_WIDTH = 200;\n// Margin reserved on each side so the popover never butts against the\n// viewport edge. Matches the 8px safe-area we use for native modal pads.\nconst VIEWPORT_MARGIN = 8;\n\nfunction computePosition(\n rect: TriggerRect,\n side: PopoverSide,\n align: PopoverAlign,\n contentSize: { width: number; height: number } | null\n): { top: number; left: number } {\n const cw = contentSize?.width ?? MIN_WIDTH;\n const ch = contentSize?.height ?? 0;\n\n let top = 0;\n let left = 0;\n\n switch (side) {\n case 'top':\n top = rect.top - GAP - ch;\n break;\n case 'bottom':\n top = rect.top + rect.height + GAP;\n break;\n case 'left':\n left = rect.left - GAP - cw;\n break;\n case 'right':\n left = rect.left + rect.width + GAP;\n break;\n }\n\n if (side === 'top' || side === 'bottom') {\n switch (align) {\n case 'start':\n left = rect.left;\n break;\n case 'center':\n left = rect.left + rect.width / 2 - cw / 2;\n break;\n case 'end':\n left = rect.left + rect.width - cw;\n break;\n }\n } else {\n switch (align) {\n case 'start':\n top = rect.top;\n break;\n case 'center':\n top = rect.top + rect.height / 2 - ch / 2;\n break;\n case 'end':\n top = rect.top + rect.height - ch;\n break;\n }\n }\n\n return { top, left };\n}\n\nexport type PopoverContentProps = {\n /** Side of the trigger to anchor on. @defaultValue 'bottom' */\n side?: PopoverSide;\n /** Alignment along the trigger edge. @defaultValue 'center' */\n align?: PopoverAlign;\n children?: ReactNode;\n className?: string;\n testID?: string;\n /** Accessible label when no visible heading is present. */\n 'aria-label'?: string;\n};\n\n/**\n * The floating popover surface. Renders only while open. On web uses\n * `position: fixed` with a measured trigger rect so it escapes any\n * ancestor `overflow: hidden`. Non-modal: focus is NOT trapped inside —\n * the user can tab back out as normal.\n *\n * ARIA: `role=\"dialog\"` (without `aria-modal`) so assistive tech\n * announces it as a grouping but doesn't suppress the rest of the page.\n */\nexport const PopoverContent = ({\n side = 'bottom',\n align = 'center',\n children,\n className,\n testID,\n ...rest\n}: PopoverContentProps) => {\n const ctx = usePopoverContext('PopoverContent');\n const colors = useThemeColors();\n const ariaLabel = rest['aria-label'];\n\n // Measure content size after first paint so we can anchor `top`-style\n // popups (which need to know content height to render above the trigger).\n const [contentSize, setContentSize] = useState<{ width: number; height: number } | null>(null);\n\n // Web-only side effects: outside-click close, Escape close, re-measure\n // on resize. RN Modal handles its own dismissal on native (tap-outside\n // is the transparent overlay's onPress).\n useEffect(() => {\n if (!ctx.open) {\n return;\n }\n if (Platform.OS !== 'web') {\n return;\n }\n if (typeof document === 'undefined') {\n return;\n }\n\n ctx.measureTrigger();\n\n const onDocMouseDown = (event: MouseEvent) => {\n const target = event.target as Node;\n const trigger = ctx.triggerRef.current;\n const content = ctx.contentRef.current;\n if (trigger?.contains(target)) {\n return;\n }\n if (content?.contains(target)) {\n return;\n }\n ctx.setOpen(false);\n };\n const onKeyDown = (event: KeyboardEvent) => {\n if (event.key === 'Escape') {\n event.preventDefault();\n ctx.setOpen(false);\n }\n };\n const onResize = () => ctx.measureTrigger();\n const onScroll = () => ctx.measureTrigger();\n\n document.addEventListener('mousedown', onDocMouseDown);\n document.addEventListener('keydown', onKeyDown);\n window.addEventListener('resize', onResize);\n window.addEventListener('scroll', onScroll, true);\n return () => {\n document.removeEventListener('mousedown', onDocMouseDown);\n document.removeEventListener('keydown', onKeyDown);\n window.removeEventListener('resize', onResize);\n window.removeEventListener('scroll', onScroll, true);\n };\n // ctx is the provider's stable identity; we only care about open transitions.\n }, [ctx.open, ctx.measureTrigger, ctx.setOpen, ctx.triggerRef, ctx.contentRef]);\n\n // Reset measured size when popover closes so reopening re-measures fresh.\n useEffect(() => {\n if (!ctx.open) {\n setContentSize(null);\n }\n }, [ctx.open]);\n\n if (!ctx.open) {\n return null;\n }\n\n const position = ctx.triggerRect ? computePosition(ctx.triggerRect, side, align, contentSize) : null;\n\n // Viewport-aware max width. Web uses Dimensions.get('window') which\n // react-native-web maps to window.innerWidth; native uses the same API\n // for the device window. Subtract margin on both sides so content\n // doesn't kiss the screen edge.\n const viewportWidth = Dimensions.get('window').width;\n const maxContentWidth = Math.max(MIN_WIDTH, viewportWidth - VIEWPORT_MARGIN * 2);\n\n const contentBaseStyle: ViewStyle = {\n minWidth: MIN_WIDTH,\n maxWidth: maxContentWidth,\n borderRadius: px(colors.radius.lg),\n borderWidth: 1,\n borderColor: colors.semantic.border.default,\n backgroundColor: colors.semantic.background.elevated,\n padding: px(colors.spacing['4']),\n ...(Platform.OS === 'web'\n ? ({\n boxShadow: '0 10px 15px -3px rgba(0,0,0,0.1), 0 4px 6px -4px rgba(0,0,0,0.1)',\n // Subtle scale-in. Skipped on native (do nothing fancy there).\n transition: 'opacity 120ms ease-out, transform 120ms ease-out',\n transform: 'scale(1)',\n opacity: 1,\n } as ViewStyle)\n : { elevation: 8 }),\n };\n\n // Clamp `left` so the popover stays within the viewport even when the\n // trigger sits near the right edge. First-paint fallback uses\n // `maxContentWidth` (the cap we apply via maxWidth above) — content\n // is allowed to grow up to that size, so assuming worst-case avoids\n // a one-frame overflow before measurement settles.\n const measuredWidth = contentSize?.width ?? maxContentWidth;\n const clampedLeft = position\n ? Math.min(\n Math.max(VIEWPORT_MARGIN, position.left),\n Math.max(VIEWPORT_MARGIN, viewportWidth - measuredWidth - VIEWPORT_MARGIN)\n )\n : 0;\n\n const positionedStyle: ViewStyle =\n Platform.OS === 'web'\n ? position\n ? ({\n position: 'fixed' as unknown as 'absolute',\n top: position.top,\n left: clampedLeft,\n zIndex: 50,\n } as ViewStyle)\n : ({\n // Trigger not yet measured — render off-screen for a\n // frame to avoid a flash at (0,0).\n position: 'fixed' as unknown as 'absolute',\n top: -9999,\n left: -9999,\n zIndex: 50,\n } as ViewStyle)\n : {};\n\n const content = (\n <View\n ref={(node) => {\n ctx.contentRef.current = node as unknown as HTMLDivElement | null;\n if (Platform.OS !== 'web') {\n return;\n }\n if (!node) {\n return;\n }\n if (typeof (node as unknown as HTMLDivElement).getBoundingClientRect !== 'function') {\n return;\n }\n const rect = (node as unknown as HTMLDivElement).getBoundingClientRect();\n if (!contentSize || contentSize.width !== rect.width || contentSize.height !== rect.height) {\n setContentSize({ width: rect.width, height: rect.height });\n }\n }}\n {...({\n role: 'dialog',\n id: ctx.contentId,\n ...(ariaLabel !== undefined ? { 'aria-label': ariaLabel, accessibilityLabel: ariaLabel } : {}),\n } as Record<string, unknown>)}\n {...(testID !== undefined ? { testID } : {})}\n className={cn(\n 'rounded-lg border border-semantic-border-default bg-semantic-background-elevated',\n className\n )}\n style={[contentBaseStyle, positionedStyle]}\n >\n {children}\n </View>\n );\n\n if (Platform.OS === 'web') {\n return content;\n }\n\n // Native: use Modal as the floating layer with a transparent backdrop.\n // Tap on the backdrop closes the popover.\n return (\n <Modal visible={ctx.open} transparent animationType=\"fade\" onRequestClose={() => ctx.setOpen(false)}>\n <Pressable\n accessibilityRole=\"none\"\n aria-hidden={true}\n onPress={() => ctx.setOpen(false)}\n style={{\n position: 'absolute',\n top: 0,\n left: 0,\n right: 0,\n bottom: 0,\n backgroundColor: 'transparent',\n }}\n >\n <Pressable\n onPress={(event) => event.stopPropagation?.()}\n style={{\n position: 'absolute',\n top: ctx.triggerRect\n ? side === 'top'\n ? Math.max(VIEWPORT_MARGIN, ctx.triggerRect.top - GAP - 80)\n : ctx.triggerRect.top + ctx.triggerRect.height + GAP\n : 80,\n // Clamp horizontally so a wide popover near the\n // right edge can still grow leftward without\n // overflowing the screen.\n left: ctx.triggerRect\n ? Math.min(\n Math.max(VIEWPORT_MARGIN, ctx.triggerRect.left),\n Math.max(VIEWPORT_MARGIN, viewportWidth - measuredWidth - VIEWPORT_MARGIN)\n )\n : VIEWPORT_MARGIN * 2,\n }}\n >\n {content}\n </Pressable>\n </Pressable>\n </Modal>\n );\n};\n\n/**\n * Public `Popover` value — the root function plus its `.Trigger` and `.Content`\n * static members. `Object.assign` produces a value whose inferred type carries\n * the static properties, so `.d.ts` consumers can write `<Popover.Trigger>`\n * without a separate import.\n */\nexport const Popover = Object.assign(PopoverRoot, {\n Trigger: PopoverTrigger,\n Content: PopoverContent,\n});\n"]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { wrapStringChildren } from './chunk-
|
|
1
|
+
import { wrapStringChildren } from './chunk-VCJF75T2.js';
|
|
2
2
|
import { cn } from './chunk-CHXHRJNZ.js';
|
|
3
3
|
import { __name } from './chunk-WCQVDF3K.js';
|
|
4
4
|
import { View } from 'react-native';
|
|
@@ -76,5 +76,5 @@ var VStack = /* @__PURE__ */ __name(({ gap, align, justify, className, children,
|
|
|
76
76
|
}, "VStack");
|
|
77
77
|
|
|
78
78
|
export { VStack };
|
|
79
|
-
//# sourceMappingURL=chunk-
|
|
80
|
-
//# sourceMappingURL=chunk-
|
|
79
|
+
//# sourceMappingURL=chunk-AFQIK6JI.js.map
|
|
80
|
+
//# sourceMappingURL=chunk-AFQIK6JI.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/VStack/VStack.tsx"],"names":[],"mappings":";;;;;;AAcA,IAAM,WAAA,GAA0C;AAAA,EAC5C,KAAA,EAAO,aAAA;AAAA,EACP,MAAA,EAAQ,cAAA;AAAA,EACR,GAAA,EAAK,WAAA;AAAA,EACL,OAAA,EAAS,eAAA;AAAA,EACT,QAAA,EAAU;AACd,CAAA;AAEA,IAAM,aAAA,GAA8C;AAAA,EAChD,KAAA,EAAO,eAAA;AAAA,EACP,MAAA,EAAQ,gBAAA;AAAA,EACR,GAAA,EAAK,aAAA;AAAA,EACL,OAAA,EAAS,iBAAA;AAAA,EACT,MAAA,EAAQ,gBAAA;AAAA,EACR,MAAA,EAAQ;AACZ,CAAA;AAEA,IAAM,WAAA,GAA2D;AAAA,EAC7D,KAAA,EAAO,YAAA;AAAA,EACP,MAAA,EAAQ,QAAA;AAAA,EACR,GAAA,EAAK,UAAA;AAAA,EACL,OAAA,EAAS,SAAA;AAAA,EACT,QAAA,EAAU;AACd,CAAA;AAEA,IAAM,aAAA,GAAmE;AAAA,EACrE,KA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,KAAA,KAAU,MAAA,GAAY,WAAA,CAAY,KAAK,CAAA,GAAI,MAAA;AAAA,QAC3C,OAAA,KAAY,MAAA,GAAY,aAAA,CAAc,OAAO,CAAA,GAAI,MAAA;AAAA,QACjD;AAAA,OACJ;AAAA,MAEC,6BAAmB,QAAQ;AAAA;AAAA,GAChC;AAER,CAAA,EA3BsB,QAAA","file":"chunk-AFQIK6JI.js","sourcesContent":["import type { ViewProps, ViewStyle } from 'react-native';\nimport { View } from 'react-native';\nimport { cn } from '../../utils/cn';\nimport { wrapStringChildren } from '../../utils/wrap-string-children';\nimport type { StackAlign, StackGap, StackJustify } from '../HStack/HStack';\n\nexport type VStackProps = ViewProps & {\n gap?: StackGap;\n align?: StackAlign;\n justify?: StackJustify;\n className?: string;\n testID?: string;\n};\n\nconst ALIGN_CLASS: Record<StackAlign, string> = {\n start: 'items-start',\n center: 'items-center',\n end: 'items-end',\n stretch: 'items-stretch',\n baseline: 'items-baseline',\n};\n\nconst JUSTIFY_CLASS: Record<StackJustify, string> = {\n start: 'justify-start',\n center: 'justify-center',\n end: 'justify-end',\n between: 'justify-between',\n around: 'justify-around',\n evenly: 'justify-evenly',\n};\n\nconst ALIGN_STYLE: Record<StackAlign, ViewStyle['alignItems']> = {\n start: 'flex-start',\n center: 'center',\n end: 'flex-end',\n stretch: 'stretch',\n baseline: 'baseline',\n};\n\nconst JUSTIFY_STYLE: Record<StackJustify, ViewStyle['justifyContent']> = {\n start: 'flex-start',\n center: 'center',\n end: 'flex-end',\n between: 'space-between',\n around: 'space-around',\n evenly: 'space-evenly',\n};\n\nconst GAP_PX: Record<StackGap, number> = {\n 0: 0,\n 1: 4,\n 2: 8,\n 3: 12,\n 4: 16,\n 5: 20,\n 6: 24,\n 8: 32,\n 10: 40,\n 12: 48,\n};\n\n/**\n * Vertical flex layout primitive. RSC-safe.\n *\n * Layout is driven by inline style; see HStack for the rationale.\n */\nexport const VStack = ({ gap, align, justify, className, children, style, ...rest }: VStackProps) => {\n const inline: ViewStyle = { flexDirection: 'column' };\n if (gap !== undefined && gap !== 0) {\n inline.gap = GAP_PX[gap];\n }\n if (align !== undefined) {\n inline.alignItems = ALIGN_STYLE[align];\n }\n if (justify !== undefined) {\n inline.justifyContent = JUSTIFY_STYLE[justify];\n }\n const merged = style === undefined ? inline : ([inline, style] as ViewStyle[]);\n return (\n <View\n {...rest}\n style={merged}\n className={cn(\n 'flex-col',\n gap !== undefined && gap !== 0 ? `gap-${gap}` : undefined,\n align !== undefined ? ALIGN_CLASS[align] : undefined,\n justify !== undefined ? JUSTIFY_CLASS[justify] : undefined,\n className\n )}\n >\n {wrapStringChildren(children)}\n </View>\n );\n};\n"]}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { px } from './chunk-5A2QOOVN.js';
|
|
2
1
|
import { cn } from './chunk-CHXHRJNZ.js';
|
|
2
|
+
import { px } from './chunk-5A2QOOVN.js';
|
|
3
3
|
import { useThemeColors } from './chunk-R5JMDDCB.js';
|
|
4
4
|
import { __name } from './chunk-WCQVDF3K.js';
|
|
5
5
|
import { createContext, useRef, useEffect, useCallback, useState, useMemo, useContext } from 'react';
|
|
@@ -43,7 +43,15 @@ var RadioGroup = /* @__PURE__ */ __name(({
|
|
|
43
43
|
name,
|
|
44
44
|
children,
|
|
45
45
|
className,
|
|
46
|
-
testID
|
|
46
|
+
testID,
|
|
47
|
+
id,
|
|
48
|
+
nativeID,
|
|
49
|
+
"aria-labelledby": ariaLabelledBy,
|
|
50
|
+
accessibilityLabelledBy,
|
|
51
|
+
"aria-describedby": ariaDescribedBy,
|
|
52
|
+
accessibilityDescribedBy,
|
|
53
|
+
"aria-invalid": ariaInvalid,
|
|
54
|
+
"aria-required": ariaRequired
|
|
47
55
|
}) => {
|
|
48
56
|
const [inner, setInner] = useState(defaultValue);
|
|
49
57
|
const isControlled = value !== void 0;
|
|
@@ -145,7 +153,15 @@ var RadioGroup = /* @__PURE__ */ __name(({
|
|
|
145
153
|
"aria-orientation": orientation,
|
|
146
154
|
"aria-disabled": disabled || void 0,
|
|
147
155
|
onKeyDown: handleKeyDown,
|
|
148
|
-
...testID !== void 0 ? { testID } : {}
|
|
156
|
+
...testID !== void 0 ? { testID } : {},
|
|
157
|
+
...id !== void 0 ? { id } : {},
|
|
158
|
+
...nativeID !== void 0 ? { nativeID } : {},
|
|
159
|
+
...ariaLabelledBy !== void 0 ? { "aria-labelledby": ariaLabelledBy } : {},
|
|
160
|
+
...accessibilityLabelledBy !== void 0 ? { accessibilityLabelledBy } : {},
|
|
161
|
+
...ariaDescribedBy !== void 0 ? { "aria-describedby": ariaDescribedBy } : {},
|
|
162
|
+
...accessibilityDescribedBy !== void 0 ? { accessibilityDescribedBy } : {},
|
|
163
|
+
...ariaInvalid ? { "aria-invalid": true } : {},
|
|
164
|
+
...ariaRequired ? { "aria-required": true } : {}
|
|
149
165
|
};
|
|
150
166
|
return /* @__PURE__ */ jsx(RadioGroupContext.Provider, { value: ctxValue, children: /* @__PURE__ */ jsx(
|
|
151
167
|
RadioGroupViewport,
|
|
@@ -256,5 +272,5 @@ var Radio = Object.assign(RadioOption, {
|
|
|
256
272
|
});
|
|
257
273
|
|
|
258
274
|
export { Radio };
|
|
259
|
-
//# sourceMappingURL=chunk-
|
|
260
|
-
//# sourceMappingURL=chunk-
|
|
275
|
+
//# sourceMappingURL=chunk-C6TRLHMW.js.map
|
|
276
|
+
//# sourceMappingURL=chunk-C6TRLHMW.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/components/Radio/Radio.tsx"],"names":["RNText"],"mappings":";;;;;;;;AAkCA,IAAM,iBAAA,GAAoB,cAA6C,IAAI,CAAA;AAE3E,IAAM,uCAAuB,MAAA,CAAA,MAA8B;AACvD,EAAA,MAAM,GAAA,GAAM,WAAW,iBAAiB,CAAA;AACxC,EAAA,IAAI,CAAC,GAAA,EAAK;AACN,IAAA,MAAM,IAAI,MAAM,kDAAkD,CAAA;AAAA,EACtE;AACA,EAAA,OAAO,G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AA,EAAS,GAAA,KAAQ,IAAI,CAAA;AAAA,MAEtD,QAAA,EAAA;AAAA,wBAAA,GAAA,CAAC,IAAA,EAAA,EAAK,OAAO,aAAA,EAAgB,QAAA,EAAA,QAAA,uBAAY,IAAA,EAAA,EAAK,KAAA,EAAO,aAAA,EAAe,CAAA,GAAK,IAAA,EAAK,CAAA;AAAA,QAC7E,QAAA,KACI,UAAU,MAAA,mBACP,GAAA;AAAA,UAACA,IAAA;AAAA,UAAA;AAAA,YACG,KAAA,EAAO;AAAA,cACH,KAAA,EAAO,MAAA,CAAO,QAAA,CAAS,IAAA,CAAK,OAAA;AAAA,cAC5B,UAAA,EAAY,OAAO,UAAA,CAAW,IAAA;AAAA,cAC9B,QAAA,EAAU,EAAA,CAAG,MAAA,CAAO,QAAA,CAAS,EAAE;AAAA,aACnC;AAAA,YAEC,QAAA,EAAA;AAAA;AAAA,SACL,GACA,IAAA;AAAA;AAAA;AAAA,GACZ;AAER,CAAA,EAxEoB,aAAA,CAAA;AA6EpB,SAAS,aAAA,CAAc,KAA6B,KAAA,EAAwB;AAQxE,EAAA,OAAO,IAAA;AACX;AATS,MAAA,CAAA,aAAA,EAAA,eAAA,CAAA;AAmBF,IAAM,KAAA,GAAQ,MAAA,CAAO,MAAA,CAAO,WAAA,EAAa;AAAA,EAC5C,KAAA,EAAO;AACX,CAAC","file":"chunk-C6TRLHMW.js","sourcesContent":["'use client';\n\nimport {\n createContext,\n type KeyboardEvent,\n type ReactNode,\n type RefObject,\n useCallback,\n useContext,\n useEffect,\n useMemo,\n useRef,\n useState,\n} from 'react';\nimport type { ViewStyle } from 'react-native';\nimport { Pressable, Text as RNText, View } from 'react-native';\nimport { px } from '../../theme/px';\nimport { useThemeColors } from '../../theme/use-theme-colors';\nimport { cn } from '../../utils/cn';\n\nexport type RadioGroupOrientation = 'horizontal' | 'vertical';\n\ntype RadioRefMap = Map<string, RefObject<HTMLElement | null>>;\n\ntype RadioGroupContextValue = {\n value: string | undefined;\n select: (next: string) => void;\n disabled: boolean;\n orientation: RadioGroupOrientation;\n name: string | undefined;\n register: (value: string, ref: RefObject<HTMLElement | null>) => void;\n unregister: (value: string) => void;\n};\n\nconst RadioGroupContext = createContext<RadioGroupContextValue | null>(null);\n\nconst useRadioGroupContext = (): RadioGroupContextValue => {\n const ctx = useContext(RadioGroupContext);\n if (!ctx) {\n throw new Error('<Radio> must be rendered inside a <Radio.Group>.');\n }\n return ctx;\n};\n\nexport type RadioGroupProps = {\n /** Controlled selected value. */\n value?: string;\n /** Uncontrolled initial value. */\n defaultValue?: string;\n /** Fires with the new value when the selection changes. */\n onChange?: (next: string) => void;\n /** When true, every Radio inside is non-interactive. Individual Radios can also opt in. */\n disabled?: boolean;\n /**\n * Layout orientation. Drives the keyboard nav axis (Down/Up for vertical,\n * Right/Left for horizontal — both pairs work in either orientation as a\n * usability bonus).\n * @defaultValue 'vertical'\n */\n orientation?: RadioGroupOrientation;\n /** HTML `name` for form integration on web. Optional but recommended. */\n name?: string;\n children?: ReactNode;\n className?: string;\n testID?: string;\n // ── Accessibility / Field.Control injection ──────────────────────────────\n /** HTML id forwarded to the radiogroup container. Injected by Field.Control. */\n id?: string;\n /** React Native equivalent of `id`. Injected by Field.Control. */\n nativeID?: string;\n /** Points to the element that labels this group. Injected by Field.Control. */\n 'aria-labelledby'?: string;\n /** React Native equivalent of `aria-labelledby`. Injected by Field.Control. */\n accessibilityLabelledBy?: string;\n /** Points to description / error elements. Injected by Field.Control. */\n 'aria-describedby'?: string;\n /** React Native equivalent of `aria-describedby`. Injected by Field.Control. */\n accessibilityDescribedBy?: string;\n /** Marks the group as invalid. Injected by Field.Control when Field has an error. */\n 'aria-invalid'?: boolean;\n /** Marks the group as required. Injected by Field.Control when Field is required. */\n 'aria-required'?: boolean;\n};\n\nexport type RadioProps = {\n /** Unique value within the group. Required. */\n value: string;\n /** Visible label that doubles as the accessibility label. */\n label?: string;\n /** Disable just this option. */\n disabled?: boolean;\n /** Custom content rendered next to the radio dot. Overrides `label`. */\n children?: ReactNode;\n className?: string;\n testID?: string;\n};\n\n// Layout-only base; theme-driven gap is merged inside Radio. The dot\n// dimensions are component-density literals — not from theme — because the\n// radio dot has a fixed visual ramp independent of the spacing scale.\nconst ROW_LAYOUT_BASE: ViewStyle = { flexDirection: 'row', alignItems: 'center' };\nconst DOT_OUTER_BASE: ViewStyle = {\n width: 18, // component-density literal — not from theme\n height: 18, // component-density literal — not from theme\n borderRadius: 9, // perfect circle of dot diameter — not from theme\n borderWidth: 1.5,\n alignItems: 'center',\n justifyContent: 'center',\n};\nconst DOT_INNER_BASE: ViewStyle = {\n width: 8, // component-density literal — not from theme\n height: 8, // component-density literal — not from theme\n borderRadius: 4, // perfect circle — not from theme\n};\n\n/**\n * Single-selection group of radio buttons. Container owns the value;\n * children declare their `value` and any extra disabled state.\n *\n * Keyboard nav follows the WAI-ARIA radiogroup pattern:\n * - Tab into the group → focus lands on the selected option (or the\n * first when nothing is selected). Tab out leaves the group.\n * - ArrowDown / ArrowRight → next option (wraps).\n * - ArrowUp / ArrowLeft → previous option (wraps).\n * - Home / End → first / last.\n * - Selection follows focus, so an arrow key both moves focus and\n * activates the option (the standard radiogroup behavior).\n */\nexport const RadioGroup = ({\n value,\n defaultValue,\n onChange,\n disabled = false,\n orientation = 'vertical',\n name,\n children,\n className,\n testID,\n id,\n nativeID,\n 'aria-labelledby': ariaLabelledBy,\n accessibilityLabelledBy,\n 'aria-describedby': ariaDescribedBy,\n accessibilityDescribedBy,\n 'aria-invalid': ariaInvalid,\n 'aria-required': ariaRequired,\n}: RadioGroupProps) => {\n const [inner, setInner] = useState<string | undefined>(defaultValue);\n const isControlled = value !== undefined;\n const current = isControlled ? value : inner;\n\n const refs = useRef<RadioRefMap>(new Map());\n const orderRef = useRef<string[]>([]);\n\n const register = useCallback((v: string, ref: RefObject<HTMLElement | null>) => {\n refs.current.set(v, ref);\n if (!orderRef.current.includes(v)) {\n orderRef.current.push(v);\n }\n }, []);\n\n const unregister = useCallback((v: string) => {\n refs.current.delete(v);\n orderRef.current = orderRef.current.filter((x) => x !== v);\n }, []);\n\n const select = useCallback(\n (next: string) => {\n if (disabled) {\n return;\n }\n if (!isControlled) {\n setInner(next);\n }\n onChange?.(next);\n },\n [disabled, isControlled, onChange]\n );\n\n const focusValue = useCallback((next: string) => {\n const ref = refs.current.get(next);\n ref?.current?.focus?.();\n }, []);\n\n const moveBy = useCallback(\n (offset: 1 | -1) => {\n const order = orderRef.current;\n if (order.length === 0) {\n return;\n }\n const idx = current ? order.indexOf(current) : -1;\n const start = idx === -1 ? (offset === 1 ? -1 : 0) : idx;\n const len = order.length;\n const next = order[(start + offset + len) % len];\n if (!next) {\n return;\n }\n select(next);\n focusValue(next);\n },\n [current, focusValue, select]\n );\n\n const handleKeyDown = useCallback(\n (event: KeyboardEvent<HTMLDivElement>) => {\n const order = orderRef.current;\n if (order.length === 0) {\n return;\n }\n switch (event.key) {\n case 'ArrowDown':\n case 'ArrowRight': {\n event.preventDefault();\n moveBy(1);\n return;\n }\n case 'ArrowUp':\n case 'ArrowLeft': {\n event.preventDefault();\n moveBy(-1);\n return;\n }\n case 'Home': {\n event.preventDefault();\n const first = order[0];\n if (first) {\n select(first);\n focusValue(first);\n }\n return;\n }\n case 'End': {\n event.preventDefault();\n const last = order[order.length - 1];\n if (last) {\n select(last);\n focusValue(last);\n }\n return;\n }\n }\n },\n [focusValue, moveBy, select]\n );\n\n const ctxValue = useMemo<RadioGroupContextValue>(\n () => ({ value: current, select, disabled, orientation, name, register, unregister }),\n [current, select, disabled, orientation, name, register, unregister]\n );\n\n // RN's View doesn't model onKeyDown in its TS surface but RN-Web passes\n // it through to the underlying div. Cast at the spread boundary.\n const groupProps: Record<string, unknown> = {\n role: 'radiogroup',\n accessibilityRole: 'radiogroup',\n 'aria-orientation': orientation,\n 'aria-disabled': disabled || undefined,\n onKeyDown: handleKeyDown,\n ...(testID !== undefined ? { testID } : {}),\n ...(id !== undefined ? { id } : {}),\n ...(nativeID !== undefined ? { nativeID } : {}),\n ...(ariaLabelledBy !== undefined ? { 'aria-labelledby': ariaLabelledBy } : {}),\n ...(accessibilityLabelledBy !== undefined ? { accessibilityLabelledBy } : {}),\n ...(ariaDescribedBy !== undefined ? { 'aria-describedby': ariaDescribedBy } : {}),\n ...(accessibilityDescribedBy !== undefined ? { accessibilityDescribedBy } : {}),\n ...(ariaInvalid ? { 'aria-invalid': true } : {}),\n ...(ariaRequired ? { 'aria-required': true } : {}),\n };\n\n return (\n <RadioGroupContext.Provider value={ctxValue}>\n <RadioGroupViewport\n groupProps={groupProps}\n orientation={orientation}\n disabled={disabled}\n {...(className !== undefined ? { className } : {})}\n >\n {children}\n </RadioGroupViewport>\n </RadioGroupContext.Provider>\n );\n};\n\n// Inner view so we can call useThemeColors() to source the orientation\n// gap from the spacing token scale (the parent owns hooks for state).\nconst RadioGroupViewport = ({\n groupProps,\n orientation,\n disabled,\n className,\n children,\n}: {\n groupProps: Record<string, unknown>;\n orientation: RadioGroupOrientation;\n disabled: boolean;\n className?: string;\n children?: ReactNode;\n}) => {\n const colors = useThemeColors();\n return (\n <View\n {...groupProps}\n className={cn(\n orientation === 'horizontal' ? 'flex-row gap-4' : 'flex-col gap-3',\n disabled ? 'opacity-60' : undefined,\n className\n )}\n style={[\n orientation === 'horizontal'\n ? { flexDirection: 'row', gap: px(colors.spacing['4']) }\n : { flexDirection: 'column', gap: px(colors.spacing['3']) },\n disabled ? { opacity: 0.6 } : null,\n ]}\n >\n {children}\n </View>\n );\n};\n\n/**\n * One option inside a `<Radio.Group>`. Must be rendered inside one — throws\n * with a clear message if not.\n */\nconst RadioOption = ({ value, label, disabled, children, className, testID }: RadioProps) => {\n const ctx = useRadioGroupContext();\n const colors = useThemeColors();\n const ownRef = useRef<HTMLElement | null>(null);\n const selected = ctx.value === value;\n const isDisabled = disabled || ctx.disabled;\n\n useEffect(() => {\n ctx.register(value, ownRef);\n return () => ctx.unregister(value);\n }, [ctx, value]);\n\n const onPress = useCallback(() => {\n if (isDisabled) {\n return;\n }\n ctx.select(value);\n }, [ctx, value, isDisabled]);\n\n // Roving tabindex: only the selected option (or the first when nothing\n // is selected) participates in the tab order.\n const tabIndex = selected || (ctx.value === undefined && isFirstOption(ctx, value)) ? 0 : -1;\n\n const accessibilityLabel = label ?? value;\n\n const radioProps: Record<string, unknown> = {\n ref: (node: HTMLElement | null) => {\n ownRef.current = node;\n },\n role: 'radio',\n accessibilityRole: 'radio',\n 'aria-checked': selected,\n accessibilityState: { checked: selected, disabled: Boolean(isDisabled) },\n accessibilityLabel,\n 'aria-label': accessibilityLabel,\n tabIndex,\n onPress,\n ...(isDisabled ? { 'aria-disabled': true, disabled: true } : {}),\n ...(testID !== undefined ? { testID } : {}),\n ...(ctx.name ? { name: ctx.name } : {}),\n };\n\n const dotOuterStyle: ViewStyle = {\n ...DOT_OUTER_BASE,\n backgroundColor: colors.semantic.background.elevated,\n borderColor: selected ? colors.semantic.interactive.primary : colors.color.neutral['400'],\n };\n const dotInnerStyle: ViewStyle = { ...DOT_INNER_BASE, backgroundColor: colors.semantic.interactive.primary };\n\n const rowStyle: ViewStyle = { ...ROW_LAYOUT_BASE, gap: px(colors.spacing['2']) };\n\n return (\n <Pressable\n {...radioProps}\n className={cn('flex-row items-center gap-2', isDisabled ? 'opacity-60' : undefined, className)}\n style={[rowStyle, isDisabled ? { opacity: 0.6 } : null]}\n >\n <View style={dotOuterStyle}>{selected ? <View style={dotInnerStyle} /> : null}</View>\n {children ??\n (label !== undefined ? (\n <RNText\n style={{\n color: colors.semantic.text.default,\n fontFamily: colors.fontFamily.body,\n fontSize: px(colors.fontSize.md),\n }}\n >\n {label}\n </RNText>\n ) : null)}\n </Pressable>\n );\n};\n\n// Tiny helper: when no value is selected yet, the first registered Radio is\n// the tabbable one. This is computed inside Radio (not the context) so we\n// don't have to re-render every Radio whenever the order changes.\nfunction isFirstOption(ctx: RadioGroupContextValue, value: string): boolean {\n // We only have access to register/unregister; Radio doesn't get a peek\n // at the order list. The simple-but-correct fallback: every Radio renders\n // tabIndex=0 when value is undefined, which is harmless for one-radio\n // groups and equivalent to the standard \"tab into the first\" for\n // multi-radio groups (browsers honor the first tabIndex=0 they hit).\n void ctx;\n void value;\n return true;\n}\n\n/**\n * Public `Radio` value — the per-option component plus its `.Group` static\n * member (the cluster). Use `<Radio.Group>` to wrap a list of `<Radio />`s.\n *\n * `Object.assign` produces a value whose inferred type carries the static\n * properties, so `.d.ts` consumers can write `<Radio.Group>` without a\n * separate import.\n */\nexport const Radio = Object.assign(RadioOption, {\n Group: RadioGroup,\n});\n"]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Slot } from './chunk-ZIBNLXIV.js';
|
|
2
|
-
import { px } from './chunk-5A2QOOVN.js';
|
|
3
2
|
import { cn } from './chunk-CHXHRJNZ.js';
|
|
3
|
+
import { px } from './chunk-5A2QOOVN.js';
|
|
4
4
|
import { useThemeColors } from './chunk-R5JMDDCB.js';
|
|
5
5
|
import { __name } from './chunk-WCQVDF3K.js';
|
|
6
6
|
import { createContext, useState, useCallback, useRef, useEffect, useId, isValidElement, useContext } from 'react';
|
|
@@ -406,5 +406,5 @@ var Tooltip = Object.assign(TooltipRoot, {
|
|
|
406
406
|
});
|
|
407
407
|
|
|
408
408
|
export { Tooltip };
|
|
409
|
-
//# sourceMappingURL=chunk-
|
|
410
|
-
//# sourceMappingURL=chunk-
|
|
409
|
+
//# sourceMappingURL=chunk-CGQIVFCN.js.map
|
|
410
|
+
//# sourceMappingURL=chunk-CGQIVFCN.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/Tooltip/Tooltip.tsx"],"names":["RNText"],"mappings":";;;;;;;;;AA0CA,IAAM,cAAA,GAAiB,cAA0C,IAAI,CAAA;AAErE,IAAM,iBAAA,2BAAqB,KAAA,KAAuC;AAC9D,EAAA,MAAM,GAAA,GAAM,WAAW,cAAc,CAAA;AACrC,EAAA,IAAI,CAAC,GAAA,EAAK;AACN,IAAA,MAAM,IA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AA,MACC,GAAI,MAAA,KAAW,MAAA,GAAY,EAAE,MAAA,KAAW,EAAC;AAAA,MAC1C,SAAA,EAAW,EAAA,CAAG,YAAA,EAAc,SAAS,CAAA;AAAA,MACrC,KAAA,EAAO,CAAC,gBAAA,EAAkB,eAAe,CAAA;AAAA,MAEzC,QAAA,kBAAA,GAAA;AAAA,QAACA,IAAA;AAAA,QAAA;AAAA,UACG,SAAA,EAAU,SAAA;AAAA,UACV,KAAA,EAAO;AAAA,YACH,KAAA,EAAO,MAAA,CAAO,QAAA,CAAS,IAAA,CAAK,QAAA;AAAA,YAC5B,UAAA,EAAY,OAAO,UAAA,CAAW,IAAA;AAAA,YAC9B,QAAA,EAAU,EAAA,CAAG,MAAA,CAAO,QAAA,CAAS,EAAE,CAAA;AAAA,YAC/B,UAAA,EAAY,GAAG,MAAA,CAAO,QAAA,CAAS,EAAE,CAAA,GAAI,MAAA,CAAO,MAAA,CAAO,UAAA,CAAW,KAAK;AAAA,WACvE;AAAA,UAEC;AAAA;AAAA;AACL;AAAA,GACJ;AAER,CAAA,EAlM8B,gBAAA,CAAA;AA0MvB,IAAM,OAAA,GAAU,MAAA,CAAO,MAAA,CAAO,WAAA,EAAa;AAAA,EAC9C,OAAA,EAAS,cAAA;AAAA,EACT,OAAA,EAAS;AACb,CAAC","file":"chunk-NRYWNOG5.js","sourcesContent":["'use client';\n\nimport {\n createContext,\n isValidElement,\n type ReactElement,\n type ReactNode,\n useCallback,\n useContext,\n useEffect,\n useId,\n useRef,\n useState,\n} from 'react';\nimport type { ViewStyle } from 'react-native';\nimport { Platform, Pressable, Text as RNText, View } from 'react-native';\nimport { Slot } from '../../slot';\nimport { px } from '../../theme/px';\nimport { useThemeColors } from '../../theme/use-theme-colors';\nimport { cn } from '../../utils/cn';\n\nexport type TooltipSide = 'top' | 'right' | 'bottom' | 'left';\nexport type TooltipAlign = 'start' | 'center' | 'end';\n\ntype TriggerRect = { top: number; left: number; width: number; height: number };\n\ntype TooltipContextValue = {\n open: boolean;\n setOpen: (next: boolean) => void;\n /** Open after `delayMs` if still hovered/focused. */\n requestOpen: () => void;\n /** Close after `closeDelayMs`; cancellable. */\n requestClose: () => void;\n /** Cancel any pending open/close timers (e.g. when re-entering). */\n cancelTimers: () => void;\n contentId: string;\n triggerRef: { current: HTMLElement | null };\n contentRef: { current: HTMLDivElement | null };\n triggerRect: TriggerRect | null;\n measureTrigger: () => void;\n};\n\nconst TooltipContext = createContext<TooltipContextValue | null>(null);\n\nconst useTooltipContext = (label: string): TooltipContextValue => {\n const ctx = useContext(TooltipContext);\n if (!ctx) {\n throw new Error(`<${label}> must be rendered inside a <Tooltip>.`);\n }\n return ctx;\n};\n\nconst DEFAULT_OPEN_DELAY_MS = 500;\nconst DEFAULT_CLOSE_DELAY_MS = 0;\n/** Long-press duration on native — matches platform defaults (iOS ~500ms). */\nconst LONG_PRESS_MS = 500;\n\nexport type TooltipProps = {\n /** Controlled open state. */\n open?: boolean;\n /** Uncontrolled initial open state. @defaultValue false */\n defaultOpen?: boolean;\n /** Fires with the new open state. */\n onOpenChange?: (open: boolean) => void;\n /**\n * Delay before the tooltip opens after hover/focus.\n * @defaultValue 500\n */\n delayMs?: number;\n /**\n * Delay before the tooltip closes after hover-out / blur. Useful for\n * giving users time to move into the tooltip if it ever becomes\n * interactive (it shouldn't — use Popover for that — but the knob is\n * here so the API matches Radix).\n * @defaultValue 0\n */\n closeDelayMs?: number;\n children?: ReactNode;\n};\n\n/**\n * Small floating label triggered by hover (web) or long-press (native).\n * Use for short contextual hints — most often on icon-only buttons. NOT\n * for rich interactive content; reach for `Popover` when the surface\n * needs to hold buttons, inputs, or links.\n *\n * Composition: `Tooltip` (root, owns open state and timers),\n * `TooltipTrigger` (forwards events to its child via Slot when\n * `asChild`), `TooltipContent` (the floating label).\n *\n * Accessibility: the trigger gets `aria-describedby` pointing at the\n * content id — tooltips augment the trigger's accessible name, they do\n * NOT replace it. The icon-only button still needs an `aria-label`.\n *\n * Behavior:\n * - Open on hover (web mouseover) or focus, after `delayMs`.\n * - Close on hover-out, blur, or Escape.\n * - Native: long-press the trigger (500ms) to reveal; tap-anywhere or\n * re-press to dismiss.\n *\n * Cross-platform: web renders the content inline with `position: fixed`\n * + a measured trigger rect so it escapes any ancestor `overflow:\n * hidden`. Native renders inline with `position: absolute` — the parent\n * needs to allow overflow for the chip to peek out.\n */\nconst TooltipRoot = ({\n open,\n defaultOpen = false,\n onOpenChange,\n delayMs = DEFAULT_OPEN_DELAY_MS,\n closeDelayMs = DEFAULT_CLOSE_DELAY_MS,\n children,\n}: TooltipProps) => {\n const [inner, setInner] = useState<boolean>(defaultOpen);\n const isControlled = open !== undefined;\n const current = isControlled ? open : inner;\n\n const setOpen = useCallback(\n (next: boolean) => {\n if (!isControlled) {\n setInner(next);\n }\n onOpenChange?.(next);\n },\n [isControlled, onOpenChange]\n );\n\n // Open / close timers. Both are cleared on unmount and on every new\n // request — so rapid hover-in / hover-out doesn't leave a stale timer\n // about to flip state after the user has moved on.\n const openTimer = useRef<ReturnType<typeof setTimeout> | null>(null);\n const closeTimer = useRef<ReturnType<typeof setTimeout> | null>(null);\n\n const cancelTimers = useCallback(() => {\n if (openTimer.current) {\n clearTimeout(openTimer.current);\n openTimer.current = null;\n }\n if (closeTimer.current) {\n clearTimeout(closeTimer.current);\n closeTimer.current = null;\n }\n }, []);\n\n const requestOpen = useCallback(() => {\n if (closeTimer.current) {\n clearTimeout(closeTimer.current);\n closeTimer.current = null;\n }\n if (openTimer.current) {\n return;\n }\n if (delayMs <= 0) {\n setOpen(true);\n return;\n }\n openTimer.current = setTimeout(() => {\n openTimer.current = null;\n setOpen(true);\n }, delayMs);\n }, [delayMs, setOpen]);\n\n const requestClose = useCallback(() => {\n if (openTimer.current) {\n clearTimeout(openTimer.current);\n openTimer.current = null;\n }\n if (closeTimer.current) {\n return;\n }\n if (closeDelayMs <= 0) {\n setOpen(false);\n return;\n }\n closeTimer.current = setTimeout(() => {\n closeTimer.current = null;\n setOpen(false);\n }, closeDelayMs);\n }, [closeDelayMs, setOpen]);\n\n useEffect(() => () => cancelTimers(), [cancelTimers]);\n\n const baseId = useId();\n const triggerRef = useRef<HTMLElement | null>(null);\n const contentRef = useRef<HTMLDivElement | null>(null);\n\n // Measure the trigger so the content can render with `position: fixed` +\n // computed coords. position:fixed escapes any ancestor's overflow:hidden\n // (e.g. fumadocs Tabs panes, our Preview frame), which is the single\n // biggest source of \"the tooltip got cut off\" bugs.\n const [triggerRect, setTriggerRect] = useState<TriggerRect | null>(null);\n const measureTrigger = useCallback(() => {\n const node = triggerRef.current;\n if (!node || typeof node.getBoundingClientRect !== 'function') {\n return;\n }\n const rect = node.getBoundingClientRect();\n setTriggerRect({ top: rect.top, left: rect.left, width: rect.width, height: rect.height });\n }, []);\n\n const ctxValue: TooltipContextValue = {\n open: current,\n setOpen,\n requestOpen,\n requestClose,\n cancelTimers,\n contentId: `${baseId}-content`,\n triggerRef,\n contentRef,\n triggerRect,\n measureTrigger,\n };\n\n return <TooltipContext.Provider value={ctxValue}>{children}</TooltipContext.Provider>;\n};\n\nexport type TooltipTriggerProps = {\n /** Render the child as the trigger (Slot pattern). Default true — pass `false` for an inline pressable. */\n asChild?: boolean;\n children?: ReactNode;\n className?: string;\n testID?: string;\n};\n\n/**\n * Element that reveals the tooltip. Uses `asChild` by default so any\n * element (Button, IconButton, custom Pressable) becomes the trigger.\n *\n * Wires `aria-describedby` to the content's id — assistive tech reads\n * the tooltip text in addition to the trigger's own accessible name.\n *\n * Web: opens on `mouseEnter` and `focus`; closes on `mouseLeave` and\n * `blur`, both honoring the configured delays. Native: opens on\n * `onLongPress` (500ms hold) and closes on the next press anywhere.\n */\nexport const TooltipTrigger = ({ asChild = true, children, className, testID }: TooltipTriggerProps) => {\n const ctx = useTooltipContext('TooltipTrigger');\n\n const handleMouseEnter = useCallback(() => {\n ctx.measureTrigger();\n ctx.requestOpen();\n }, [ctx]);\n const handleMouseLeave = useCallback(() => {\n ctx.requestClose();\n }, [ctx]);\n const handleFocus = useCallback(() => {\n ctx.measureTrigger();\n ctx.requestOpen();\n }, [ctx]);\n const handleBlur = useCallback(() => {\n ctx.requestClose();\n }, [ctx]);\n const handleLongPress = useCallback(() => {\n ctx.measureTrigger();\n ctx.setOpen(true);\n }, [ctx]);\n const handlePress = useCallback(() => {\n // Native: tap (after a long-press has revealed it) dismisses.\n if (Platform.OS !== 'web' && ctx.open) {\n ctx.setOpen(false);\n }\n }, [ctx]);\n\n if (asChild && isValidElement(children)) {\n const child = children as ReactElement<Record<string, unknown>>;\n // Compose the wrapped child's existing handlers with ours so any\n // app-level onClick / onFocus / onPress still fires. The tooltip\n // event runs AFTER the child's so consumer code wins on conflict.\n const compose =\n <T,>(existing: ((e: T) => void) | undefined, next: (e: T) => void) =>\n (event: T) => {\n existing?.(event);\n next(event);\n };\n return (\n <Slot\n ref={(node: HTMLElement | null) => {\n ctx.triggerRef.current = node;\n }}\n onMouseEnter={compose(child.props.onMouseEnter as ((e: unknown) => void) | undefined, handleMouseEnter)}\n onMouseLeave={compose(child.props.onMouseLeave as ((e: unknown) => void) | undefined, handleMouseLeave)}\n onFocus={compose(child.props.onFocus as ((e: unknown) => void) | undefined, handleFocus)}\n onBlur={compose(child.props.onBlur as ((e: unknown) => void) | undefined, handleBlur)}\n {...(Platform.OS !== 'web'\n ? {\n onLongPress: compose(\n child.props.onLongPress as ((e: unknown) => void) | undefined,\n handleLongPress\n ),\n onPress: compose(child.props.onPress as ((e: unknown) => void) | undefined, handlePress),\n delayLongPress: LONG_PRESS_MS,\n }\n : {})}\n aria-describedby={ctx.open ? ctx.contentId : undefined}\n {...(testID !== undefined ? { 'data-testid': testID } : {})}\n {...(className !== undefined ? { className } : {})}\n >\n {child}\n </Slot>\n );\n }\n\n return (\n <Pressable\n ref={(node) => {\n ctx.triggerRef.current = node as unknown as HTMLElement | null;\n }}\n {...(Platform.OS !== 'web'\n ? { onLongPress: handleLongPress, onPress: handlePress, delayLongPress: LONG_PRESS_MS }\n : {})}\n {...({\n onMouseEnter: handleMouseEnter,\n onMouseLeave: handleMouseLeave,\n onFocus: handleFocus,\n onBlur: handleBlur,\n 'aria-describedby': ctx.open ? ctx.contentId : undefined,\n } as Record<string, unknown>)}\n {...(testID !== undefined ? { testID } : {})}\n {...(className !== undefined ? { className } : {})}\n >\n {wrapStringChildren(children)}\n </Pressable>\n );\n};\n\n// On native, raw strings rendered as children of a non-Text component\n// throw \"Text strings must be rendered within a <Text> component\". On\n// web, react-native-web silently tolerates it. Wrap any string/number\n// children in an RNText so the same JSX renders cleanly on both\n// platforms. Non-string children are passed through unchanged.\nfunction wrapStringChildren(children: ReactNode): ReactNode {\n if (typeof children === 'string' || typeof children === 'number') {\n return <RNText>{children}</RNText>;\n }\n return children;\n}\n\nconst GAP = 4; // visual gap between trigger and content\nconst MIN_WIDTH = 0; // tooltips hug their text — no enforced minimum\n\nfunction computePosition(\n rect: TriggerRect,\n side: TooltipSide,\n align: TooltipAlign,\n contentSize: { width: number; height: number } | null\n): { top: number; left: number } {\n const cw = contentSize?.width ?? MIN_WIDTH;\n const ch = contentSize?.height ?? 0;\n\n let top = 0;\n let left = 0;\n\n switch (side) {\n case 'top':\n top = rect.top - GAP - ch;\n break;\n case 'bottom':\n top = rect.top + rect.height + GAP;\n break;\n case 'left':\n left = rect.left - GAP - cw;\n break;\n case 'right':\n left = rect.left + rect.width + GAP;\n break;\n }\n\n if (side === 'top' || side === 'bottom') {\n switch (align) {\n case 'start':\n left = rect.left;\n break;\n case 'center':\n left = rect.left + rect.width / 2 - cw / 2;\n break;\n case 'end':\n left = rect.left + rect.width - cw;\n break;\n }\n } else {\n switch (align) {\n case 'start':\n top = rect.top;\n break;\n case 'center':\n top = rect.top + rect.height / 2 - ch / 2;\n break;\n case 'end':\n top = rect.top + rect.height - ch;\n break;\n }\n }\n\n return { top, left };\n}\n\nexport type TooltipContentProps = {\n /** Side of the trigger to anchor on. @defaultValue 'top' */\n side?: TooltipSide;\n /** Alignment along the trigger edge. @defaultValue 'center' */\n align?: TooltipAlign;\n children?: ReactNode;\n className?: string;\n testID?: string;\n};\n\n/**\n * The floating tooltip surface. Renders only while open. On web uses\n * `position: fixed` with a measured trigger rect so it escapes any\n * ancestor `overflow: hidden`.\n *\n * ARIA: `role=\"tooltip\"` plus a unique id that the trigger's\n * `aria-describedby` points at.\n */\nexport const TooltipContent = ({\n side = 'top',\n align = 'center',\n children,\n className,\n testID,\n}: TooltipContentProps) => {\n const ctx = useTooltipContext('TooltipContent');\n const colors = useThemeColors();\n\n // Measure content size after first paint so we can anchor `top`-side\n // tooltips (which need to know content height to render above the trigger).\n const [contentSize, setContentSize] = useState<{ width: number; height: number } | null>(null);\n\n // Direct DOM ref for the entrance animation. We poke `transform`,\n // `opacity`, and `transition` straight onto node.style instead of\n // passing them through `<View style>`, because rn-web's style filter\n // drops keys it doesn't recognize as RN style props (`transitionProperty`,\n // `transitionDuration`, etc.) — so any style fragment containing them\n // gets discarded entirely. Same pattern as the Dialog backdrop-blur fix.\n const domRef = useRef<HTMLDivElement | null>(null);\n const [entered, setEntered] = useState(false);\n\n // Web-only: Escape closes. Re-measure trigger on resize/scroll so the\n // chip stays anchored during page motion.\n useEffect(() => {\n if (!ctx.open) {\n return;\n }\n if (Platform.OS !== 'web') {\n return;\n }\n if (typeof document === 'undefined') {\n return;\n }\n\n ctx.measureTrigger();\n\n const onKeyDown = (event: KeyboardEvent) => {\n if (event.key === 'Escape') {\n event.preventDefault();\n ctx.setOpen(false);\n }\n };\n const onResize = () => ctx.measureTrigger();\n const onScroll = () => ctx.measureTrigger();\n\n document.addEventListener('keydown', onKeyDown);\n window.addEventListener('resize', onResize);\n window.addEventListener('scroll', onScroll, true);\n return () => {\n document.removeEventListener('keydown', onKeyDown);\n window.removeEventListener('resize', onResize);\n window.removeEventListener('scroll', onScroll, true);\n };\n }, [ctx.open, ctx.measureTrigger, ctx.setOpen]);\n\n // Reset measured size and entrance flag when tooltip closes so a\n // reopen re-measures and re-animates fresh.\n useEffect(() => {\n if (!ctx.open) {\n setContentSize(null);\n setEntered(false);\n }\n }, [ctx.open]);\n\n // Entrance animation. On the first paint we render at scale(0.95) +\n // opacity 0; the next frame we flip the styles to scale(1) + opacity\n // 1, and the CSS transition handles the in-between. Web only —\n // native renders without animation (an animated mount on RN would\n // require Reanimated for negligible visual gain on a hint chip).\n useEffect(() => {\n if (Platform.OS !== 'web') {\n return;\n }\n if (!ctx.open) {\n return;\n }\n const node = domRef.current;\n if (!node) {\n return;\n }\n // Initial values — explicitly set so the first frame is at the\n // pre-entrance state regardless of inherited styles.\n node.style.transformOrigin = 'center';\n node.style.transitionProperty = 'opacity, transform';\n node.style.transitionDuration = '100ms';\n node.style.transitionTimingFunction = 'ease-out';\n node.style.opacity = entered ? '1' : '0';\n node.style.transform = entered ? 'scale(1)' : 'scale(0.95)';\n }, [ctx.open, entered]);\n\n // Kick off the transition on the next frame after mount.\n useEffect(() => {\n if (Platform.OS !== 'web') {\n return;\n }\n if (!ctx.open) {\n return;\n }\n const id = requestAnimationFrame(() => setEntered(true));\n return () => cancelAnimationFrame(id);\n }, [ctx.open]);\n\n if (!ctx.open) {\n return null;\n }\n\n const position = ctx.triggerRect ? computePosition(ctx.triggerRect, side, align, contentSize) : null;\n\n const contentBaseStyle: ViewStyle = {\n borderRadius: px(colors.radius.md),\n backgroundColor: colors.semantic.text.default,\n paddingVertical: px(colors.spacing['2']) - 2, // closest theme-rooted approximation of legacy 6\n paddingHorizontal: px(colors.spacing['2']),\n ...(Platform.OS === 'web'\n ? ({\n boxShadow: '0 4px 6px -2px rgba(0,0,0,0.1), 0 2px 4px -2px rgba(0,0,0,0.06)',\n } as ViewStyle)\n : { elevation: 4 }),\n };\n\n const positionedStyle: ViewStyle =\n Platform.OS === 'web'\n ? position\n ? ({\n position: 'fixed' as unknown as 'absolute',\n top: position.top,\n left: position.left,\n zIndex: 60,\n } as ViewStyle)\n : ({\n // Trigger not yet measured — render off-screen for a\n // frame to avoid a flash at (0,0).\n position: 'fixed' as unknown as 'absolute',\n top: -9999,\n left: -9999,\n zIndex: 60,\n } as ViewStyle)\n : ({\n // Native: rely on the parent allowing overflow. We anchor\n // by absolute positioning relative to wherever the\n // tooltip is mounted in the tree (typically right next\n // to the trigger).\n position: 'absolute',\n top: position?.top ?? 0,\n left: position?.left ?? 0,\n } as ViewStyle);\n\n return (\n <View\n ref={(node) => {\n ctx.contentRef.current = node as unknown as HTMLDivElement | null;\n domRef.current = node as unknown as HTMLDivElement | null;\n if (Platform.OS !== 'web') {\n return;\n }\n if (!node) {\n return;\n }\n if (typeof (node as unknown as HTMLDivElement).getBoundingClientRect !== 'function') {\n return;\n }\n const rect = (node as unknown as HTMLDivElement).getBoundingClientRect();\n if (!contentSize || contentSize.width !== rect.width || contentSize.height !== rect.height) {\n setContentSize({ width: rect.width, height: rect.height });\n }\n }}\n {...({\n role: 'tooltip',\n id: ctx.contentId,\n // Don't soak up pointer events — hovering the tooltip\n // itself should NOT block the trigger's mouse-leave from\n // firing. Tooltips are presentational; if you need\n // interactivity, reach for Popover.\n pointerEvents: 'none',\n } as Record<string, unknown>)}\n {...(testID !== undefined ? { testID } : {})}\n className={cn('rounded-md', className)}\n style={[contentBaseStyle, positionedStyle]}\n >\n <RNText\n className=\"text-xs\"\n style={{\n color: colors.semantic.text.inverted,\n fontFamily: colors.fontFamily.body,\n fontSize: px(colors.fontSize.sm),\n lineHeight: px(colors.fontSize.sm) * Number(colors.lineHeight.tight),\n }}\n >\n {children}\n </RNText>\n </View>\n );\n};\n\n/**\n * Public `Tooltip` value — the root function plus its `.Trigger` and\n * `.Content` static members. `Object.assign` produces a value whose inferred\n * type carries the static properties, so `.d.ts` consumers can write\n * `<Tooltip.Trigger>` without a separate import.\n */\nexport const Tooltip = Object.assign(TooltipRoot, {\n Trigger: TooltipTrigger,\n Content: TooltipContent,\n});\n"]}
|
|
1
|
+
{"version":3,"sources":["../src/components/Tooltip/Tooltip.tsx"],"names":["RNText"],"mappings":";;;;;;;;;AA0CA,IAAM,cAAA,GAAiB,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7D;AAAA,MACJ,CAAA;AAAA,MACC,GAAI;AAAA,QACD,IAAA,EAAM,SAAA;AAAA,QACN,IAAI,GAAA,CAAI,SAAA;AAAA;AAAA;AAAA;AAAA;AAAA,QAKR,aAAA,EAAe;AAAA,OACnB;AAAA,MACC,GAAI,MAAA,KAAW,MAAA,GAAY,EAAE,MAAA,KAAW,EAAC;AAAA,MAC1C,SAAA,EAAW,EAAA,CAAG,YAAA,EAAc,SAAS,CAAA;AAAA,MACrC,KAAA,EAAO,CAAC,gBAAA,EAAkB,eAAe,CAAA;AAAA,MAEzC,QAAA,kBAAA,GAAA;AAAA,QAACA,IAAA;AAAA,QAAA;AAAA,UACG,SAAA,EAAU,SAAA;AAAA,UACV,KAAA,EAAO;AAAA,YACH,KAAA,EAAO,MAAA,CAAO,QAAA,CAAS,IAAA,CAAK,QAAA;AAAA,YAC5B,UAAA,EAAY,OAAO,UAAA,CAAW,IAAA;AAAA,YAC9B,QAAA,EAAU,EAAA,CAAG,MAAA,CAAO,QAAA,CAAS,EAAE,CAAA;AAAA,YAC/B,UAAA,EAAY,GAAG,MAAA,CAAO,QAAA,CAAS,EAAE,CAAA,GAAI,MAAA,CAAO,MAAA,CAAO,UAAA,CAAW,KAAK;AAAA,WACvE;AAAA,UAEC;AAAA;AAAA;AACL;AAAA,GACJ;AAER,CAAA,EAlM8B,gBAAA,CAAA;AA0MvB,IAAM,OAAA,GAAU,MAAA,CAAO,MAAA,CAAO,WAAA,EAAa;AAAA,EAC9C,OAAA,EAAS,cAAA;AAAA,EACT,OAAA,EAAS;AACb,CAAC","file":"chunk-CGQIVFCN.js","sourcesContent":["'use client';\n\nimport {\n createContext,\n isValidElement,\n type ReactElement,\n type ReactNode,\n useCallback,\n useContext,\n useEffect,\n useId,\n useRef,\n useState,\n} from 'react';\nimport type { ViewStyle } from 'react-native';\nimport { Platform, Pressable, Text as RNText, View } from 'react-native';\nimport { Slot } from '../../slot';\nimport { px } from '../../theme/px';\nimport { useThemeColors } from '../../theme/use-theme-colors';\nimport { cn } from '../../utils/cn';\n\nexport type TooltipSide = 'top' | 'right' | 'bottom' | 'left';\nexport type TooltipAlign = 'start' | 'center' | 'end';\n\ntype TriggerRect = { top: number; left: number; width: number; height: number };\n\ntype TooltipContextValue = {\n open: boolean;\n setOpen: (next: boolean) => void;\n /** Open after `delayMs` if still hovered/focused. */\n requestOpen: () => void;\n /** Close after `closeDelayMs`; cancellable. */\n requestClose: () => void;\n /** Cancel any pending open/close timers (e.g. when re-entering). */\n cancelTimers: () => void;\n contentId: string;\n triggerRef: { current: HTMLElement | null };\n contentRef: { current: HTMLDivElement | null };\n triggerRect: TriggerRect | null;\n measureTrigger: () => void;\n};\n\nconst TooltipContext = createContext<TooltipContextValue | null>(null);\n\nconst useTooltipContext = (label: string): TooltipContextValue => {\n const ctx = useContext(TooltipContext);\n if (!ctx) {\n throw new Error(`<${label}> must be rendered inside a <Tooltip>.`);\n }\n return ctx;\n};\n\nconst DEFAULT_OPEN_DELAY_MS = 500;\nconst DEFAULT_CLOSE_DELAY_MS = 0;\n/** Long-press duration on native — matches platform defaults (iOS ~500ms). */\nconst LONG_PRESS_MS = 500;\n\nexport type TooltipProps = {\n /** Controlled open state. */\n open?: boolean;\n /** Uncontrolled initial open state. @defaultValue false */\n defaultOpen?: boolean;\n /** Fires with the new open state. */\n onOpenChange?: (open: boolean) => void;\n /**\n * Delay before the tooltip opens after hover/focus.\n * @defaultValue 500\n */\n delayMs?: number;\n /**\n * Delay before the tooltip closes after hover-out / blur. Useful for\n * giving users time to move into the tooltip if it ever becomes\n * interactive (it shouldn't — use Popover for that — but the knob is\n * here so the API matches Radix).\n * @defaultValue 0\n */\n closeDelayMs?: number;\n children?: ReactNode;\n};\n\n/**\n * Small floating label triggered by hover (web) or long-press (native).\n * Use for short contextual hints — most often on icon-only buttons. NOT\n * for rich interactive content; reach for `Popover` when the surface\n * needs to hold buttons, inputs, or links.\n *\n * Composition: `Tooltip` (root, owns open state and timers),\n * `TooltipTrigger` (forwards events to its child via Slot when\n * `asChild`), `TooltipContent` (the floating label).\n *\n * Accessibility: the trigger gets `aria-describedby` pointing at the\n * content id — tooltips augment the trigger's accessible name, they do\n * NOT replace it. The icon-only button still needs an `aria-label`.\n *\n * Behavior:\n * - Open on hover (web mouseover) or focus, after `delayMs`.\n * - Close on hover-out, blur, or Escape.\n * - Native: long-press the trigger (500ms) to reveal; tap-anywhere or\n * re-press to dismiss.\n *\n * Cross-platform: web renders the content inline with `position: fixed`\n * + a measured trigger rect so it escapes any ancestor `overflow:\n * hidden`. Native renders inline with `position: absolute` — the parent\n * needs to allow overflow for the chip to peek out.\n */\nconst TooltipRoot = ({\n open,\n defaultOpen = false,\n onOpenChange,\n delayMs = DEFAULT_OPEN_DELAY_MS,\n closeDelayMs = DEFAULT_CLOSE_DELAY_MS,\n children,\n}: TooltipProps) => {\n const [inner, setInner] = useState<boolean>(defaultOpen);\n const isControlled = open !== undefined;\n const current = isControlled ? open : inner;\n\n const setOpen = useCallback(\n (next: boolean) => {\n if (!isControlled) {\n setInner(next);\n }\n onOpenChange?.(next);\n },\n [isControlled, onOpenChange]\n );\n\n // Open / close timers. Both are cleared on unmount and on every new\n // request — so rapid hover-in / hover-out doesn't leave a stale timer\n // about to flip state after the user has moved on.\n const openTimer = useRef<ReturnType<typeof setTimeout> | null>(null);\n const closeTimer = useRef<ReturnType<typeof setTimeout> | null>(null);\n\n const cancelTimers = useCallback(() => {\n if (openTimer.current) {\n clearTimeout(openTimer.current);\n openTimer.current = null;\n }\n if (closeTimer.current) {\n clearTimeout(closeTimer.current);\n closeTimer.current = null;\n }\n }, []);\n\n const requestOpen = useCallback(() => {\n if (closeTimer.current) {\n clearTimeout(closeTimer.current);\n closeTimer.current = null;\n }\n if (openTimer.current) {\n return;\n }\n if (delayMs <= 0) {\n setOpen(true);\n return;\n }\n openTimer.current = setTimeout(() => {\n openTimer.current = null;\n setOpen(true);\n }, delayMs);\n }, [delayMs, setOpen]);\n\n const requestClose = useCallback(() => {\n if (openTimer.current) {\n clearTimeout(openTimer.current);\n openTimer.current = null;\n }\n if (closeTimer.current) {\n return;\n }\n if (closeDelayMs <= 0) {\n setOpen(false);\n return;\n }\n closeTimer.current = setTimeout(() => {\n closeTimer.current = null;\n setOpen(false);\n }, closeDelayMs);\n }, [closeDelayMs, setOpen]);\n\n useEffect(() => () => cancelTimers(), [cancelTimers]);\n\n const baseId = useId();\n const triggerRef = useRef<HTMLElement | null>(null);\n const contentRef = useRef<HTMLDivElement | null>(null);\n\n // Measure the trigger so the content can render with `position: fixed` +\n // computed coords. position:fixed escapes any ancestor's overflow:hidden\n // (e.g. fumadocs Tabs panes, our Preview frame), which is the single\n // biggest source of \"the tooltip got cut off\" bugs.\n const [triggerRect, setTriggerRect] = useState<TriggerRect | null>(null);\n const measureTrigger = useCallback(() => {\n const node = triggerRef.current;\n if (!node || typeof node.getBoundingClientRect !== 'function') {\n return;\n }\n const rect = node.getBoundingClientRect();\n setTriggerRect({ top: rect.top, left: rect.left, width: rect.width, height: rect.height });\n }, []);\n\n const ctxValue: TooltipContextValue = {\n open: current,\n setOpen,\n requestOpen,\n requestClose,\n cancelTimers,\n contentId: `${baseId}-content`,\n triggerRef,\n contentRef,\n triggerRect,\n measureTrigger,\n };\n\n return <TooltipContext.Provider value={ctxValue}>{children}</TooltipContext.Provider>;\n};\n\nexport type TooltipTriggerProps = {\n /** Render the child as the trigger (Slot pattern). Default true — pass `false` for an inline pressable. */\n asChild?: boolean;\n children?: ReactNode;\n className?: string;\n testID?: string;\n};\n\n/**\n * Element that reveals the tooltip. Uses `asChild` by default so any\n * element (Button, IconButton, custom Pressable) becomes the trigger.\n *\n * Wires `aria-describedby` to the content's id — assistive tech reads\n * the tooltip text in addition to the trigger's own accessible name.\n *\n * Web: opens on `mouseEnter` and `focus`; closes on `mouseLeave` and\n * `blur`, both honoring the configured delays. Native: opens on\n * `onLongPress` (500ms hold) and closes on the next press anywhere.\n */\nexport const TooltipTrigger = ({ asChild = true, children, className, testID }: TooltipTriggerProps) => {\n const ctx = useTooltipContext('TooltipTrigger');\n\n const handleMouseEnter = useCallback(() => {\n ctx.measureTrigger();\n ctx.requestOpen();\n }, [ctx]);\n const handleMouseLeave = useCallback(() => {\n ctx.requestClose();\n }, [ctx]);\n const handleFocus = useCallback(() => {\n ctx.measureTrigger();\n ctx.requestOpen();\n }, [ctx]);\n const handleBlur = useCallback(() => {\n ctx.requestClose();\n }, [ctx]);\n const handleLongPress = useCallback(() => {\n ctx.measureTrigger();\n ctx.setOpen(true);\n }, [ctx]);\n const handlePress = useCallback(() => {\n // Native: tap (after a long-press has revealed it) dismisses.\n if (Platform.OS !== 'web' && ctx.open) {\n ctx.setOpen(false);\n }\n }, [ctx]);\n\n if (asChild && isValidElement(children)) {\n const child = children as ReactElement<Record<string, unknown>>;\n // Compose the wrapped child's existing handlers with ours so any\n // app-level onClick / onFocus / onPress still fires. The tooltip\n // event runs AFTER the child's so consumer code wins on conflict.\n const compose =\n <T,>(existing: ((e: T) => void) | undefined, next: (e: T) => void) =>\n (event: T) => {\n existing?.(event);\n next(event);\n };\n return (\n <Slot\n ref={(node: HTMLElement | null) => {\n ctx.triggerRef.current = node;\n }}\n onMouseEnter={compose(child.props.onMouseEnter as ((e: unknown) => void) | undefined, handleMouseEnter)}\n onMouseLeave={compose(child.props.onMouseLeave as ((e: unknown) => void) | undefined, handleMouseLeave)}\n onFocus={compose(child.props.onFocus as ((e: unknown) => void) | undefined, handleFocus)}\n onBlur={compose(child.props.onBlur as ((e: unknown) => void) | undefined, handleBlur)}\n {...(Platform.OS !== 'web'\n ? {\n onLongPress: compose(\n child.props.onLongPress as ((e: unknown) => void) | undefined,\n handleLongPress\n ),\n onPress: compose(child.props.onPress as ((e: unknown) => void) | undefined, handlePress),\n delayLongPress: LONG_PRESS_MS,\n }\n : {})}\n aria-describedby={ctx.open ? ctx.contentId : undefined}\n {...(testID !== undefined ? { 'data-testid': testID } : {})}\n {...(className !== undefined ? { className } : {})}\n >\n {child}\n </Slot>\n );\n }\n\n return (\n <Pressable\n ref={(node) => {\n ctx.triggerRef.current = node as unknown as HTMLElement | null;\n }}\n {...(Platform.OS !== 'web'\n ? { onLongPress: handleLongPress, onPress: handlePress, delayLongPress: LONG_PRESS_MS }\n : {})}\n {...({\n onMouseEnter: handleMouseEnter,\n onMouseLeave: handleMouseLeave,\n onFocus: handleFocus,\n onBlur: handleBlur,\n 'aria-describedby': ctx.open ? ctx.contentId : undefined,\n } as Record<string, unknown>)}\n {...(testID !== undefined ? { testID } : {})}\n {...(className !== undefined ? { className } : {})}\n >\n {wrapStringChildren(children)}\n </Pressable>\n );\n};\n\n// On native, raw strings rendered as children of a non-Text component\n// throw \"Text strings must be rendered within a <Text> component\". On\n// web, react-native-web silently tolerates it. Wrap any string/number\n// children in an RNText so the same JSX renders cleanly on both\n// platforms. Non-string children are passed through unchanged.\nfunction wrapStringChildren(children: ReactNode): ReactNode {\n if (typeof children === 'string' || typeof children === 'number') {\n return <RNText>{children}</RNText>;\n }\n return children;\n}\n\nconst GAP = 4; // visual gap between trigger and content\nconst MIN_WIDTH = 0; // tooltips hug their text — no enforced minimum\n\nfunction computePosition(\n rect: TriggerRect,\n side: TooltipSide,\n align: TooltipAlign,\n contentSize: { width: number; height: number } | null\n): { top: number; left: number } {\n const cw = contentSize?.width ?? MIN_WIDTH;\n const ch = contentSize?.height ?? 0;\n\n let top = 0;\n let left = 0;\n\n switch (side) {\n case 'top':\n top = rect.top - GAP - ch;\n break;\n case 'bottom':\n top = rect.top + rect.height + GAP;\n break;\n case 'left':\n left = rect.left - GAP - cw;\n break;\n case 'right':\n left = rect.left + rect.width + GAP;\n break;\n }\n\n if (side === 'top' || side === 'bottom') {\n switch (align) {\n case 'start':\n left = rect.left;\n break;\n case 'center':\n left = rect.left + rect.width / 2 - cw / 2;\n break;\n case 'end':\n left = rect.left + rect.width - cw;\n break;\n }\n } else {\n switch (align) {\n case 'start':\n top = rect.top;\n break;\n case 'center':\n top = rect.top + rect.height / 2 - ch / 2;\n break;\n case 'end':\n top = rect.top + rect.height - ch;\n break;\n }\n }\n\n return { top, left };\n}\n\nexport type TooltipContentProps = {\n /** Side of the trigger to anchor on. @defaultValue 'top' */\n side?: TooltipSide;\n /** Alignment along the trigger edge. @defaultValue 'center' */\n align?: TooltipAlign;\n children?: ReactNode;\n className?: string;\n testID?: string;\n};\n\n/**\n * The floating tooltip surface. Renders only while open. On web uses\n * `position: fixed` with a measured trigger rect so it escapes any\n * ancestor `overflow: hidden`.\n *\n * ARIA: `role=\"tooltip\"` plus a unique id that the trigger's\n * `aria-describedby` points at.\n */\nexport const TooltipContent = ({\n side = 'top',\n align = 'center',\n children,\n className,\n testID,\n}: TooltipContentProps) => {\n const ctx = useTooltipContext('TooltipContent');\n const colors = useThemeColors();\n\n // Measure content size after first paint so we can anchor `top`-side\n // tooltips (which need to know content height to render above the trigger).\n const [contentSize, setContentSize] = useState<{ width: number; height: number } | null>(null);\n\n // Direct DOM ref for the entrance animation. We poke `transform`,\n // `opacity`, and `transition` straight onto node.style instead of\n // passing them through `<View style>`, because rn-web's style filter\n // drops keys it doesn't recognize as RN style props (`transitionProperty`,\n // `transitionDuration`, etc.) — so any style fragment containing them\n // gets discarded entirely. Same pattern as the Dialog backdrop-blur fix.\n const domRef = useRef<HTMLDivElement | null>(null);\n const [entered, setEntered] = useState(false);\n\n // Web-only: Escape closes. Re-measure trigger on resize/scroll so the\n // chip stays anchored during page motion.\n useEffect(() => {\n if (!ctx.open) {\n return;\n }\n if (Platform.OS !== 'web') {\n return;\n }\n if (typeof document === 'undefined') {\n return;\n }\n\n ctx.measureTrigger();\n\n const onKeyDown = (event: KeyboardEvent) => {\n if (event.key === 'Escape') {\n event.preventDefault();\n ctx.setOpen(false);\n }\n };\n const onResize = () => ctx.measureTrigger();\n const onScroll = () => ctx.measureTrigger();\n\n document.addEventListener('keydown', onKeyDown);\n window.addEventListener('resize', onResize);\n window.addEventListener('scroll', onScroll, true);\n return () => {\n document.removeEventListener('keydown', onKeyDown);\n window.removeEventListener('resize', onResize);\n window.removeEventListener('scroll', onScroll, true);\n };\n }, [ctx.open, ctx.measureTrigger, ctx.setOpen]);\n\n // Reset measured size and entrance flag when tooltip closes so a\n // reopen re-measures and re-animates fresh.\n useEffect(() => {\n if (!ctx.open) {\n setContentSize(null);\n setEntered(false);\n }\n }, [ctx.open]);\n\n // Entrance animation. On the first paint we render at scale(0.95) +\n // opacity 0; the next frame we flip the styles to scale(1) + opacity\n // 1, and the CSS transition handles the in-between. Web only —\n // native renders without animation (an animated mount on RN would\n // require Reanimated for negligible visual gain on a hint chip).\n useEffect(() => {\n if (Platform.OS !== 'web') {\n return;\n }\n if (!ctx.open) {\n return;\n }\n const node = domRef.current;\n if (!node) {\n return;\n }\n // Initial values — explicitly set so the first frame is at the\n // pre-entrance state regardless of inherited styles.\n node.style.transformOrigin = 'center';\n node.style.transitionProperty = 'opacity, transform';\n node.style.transitionDuration = '100ms';\n node.style.transitionTimingFunction = 'ease-out';\n node.style.opacity = entered ? '1' : '0';\n node.style.transform = entered ? 'scale(1)' : 'scale(0.95)';\n }, [ctx.open, entered]);\n\n // Kick off the transition on the next frame after mount.\n useEffect(() => {\n if (Platform.OS !== 'web') {\n return;\n }\n if (!ctx.open) {\n return;\n }\n const id = requestAnimationFrame(() => setEntered(true));\n return () => cancelAnimationFrame(id);\n }, [ctx.open]);\n\n if (!ctx.open) {\n return null;\n }\n\n const position = ctx.triggerRect ? computePosition(ctx.triggerRect, side, align, contentSize) : null;\n\n const contentBaseStyle: ViewStyle = {\n borderRadius: px(colors.radius.md),\n backgroundColor: colors.semantic.text.default,\n paddingVertical: px(colors.spacing['2']) - 2, // closest theme-rooted approximation of legacy 6\n paddingHorizontal: px(colors.spacing['2']),\n ...(Platform.OS === 'web'\n ? ({\n boxShadow: '0 4px 6px -2px rgba(0,0,0,0.1), 0 2px 4px -2px rgba(0,0,0,0.06)',\n } as ViewStyle)\n : { elevation: 4 }),\n };\n\n const positionedStyle: ViewStyle =\n Platform.OS === 'web'\n ? position\n ? ({\n position: 'fixed' as unknown as 'absolute',\n top: position.top,\n left: position.left,\n zIndex: 60,\n } as ViewStyle)\n : ({\n // Trigger not yet measured — render off-screen for a\n // frame to avoid a flash at (0,0).\n position: 'fixed' as unknown as 'absolute',\n top: -9999,\n left: -9999,\n zIndex: 60,\n } as ViewStyle)\n : ({\n // Native: rely on the parent allowing overflow. We anchor\n // by absolute positioning relative to wherever the\n // tooltip is mounted in the tree (typically right next\n // to the trigger).\n position: 'absolute',\n top: position?.top ?? 0,\n left: position?.left ?? 0,\n } as ViewStyle);\n\n return (\n <View\n ref={(node) => {\n ctx.contentRef.current = node as unknown as HTMLDivElement | null;\n domRef.current = node as unknown as HTMLDivElement | null;\n if (Platform.OS !== 'web') {\n return;\n }\n if (!node) {\n return;\n }\n if (typeof (node as unknown as HTMLDivElement).getBoundingClientRect !== 'function') {\n return;\n }\n const rect = (node as unknown as HTMLDivElement).getBoundingClientRect();\n if (!contentSize || contentSize.width !== rect.width || contentSize.height !== rect.height) {\n setContentSize({ width: rect.width, height: rect.height });\n }\n }}\n {...({\n role: 'tooltip',\n id: ctx.contentId,\n // Don't soak up pointer events — hovering the tooltip\n // itself should NOT block the trigger's mouse-leave from\n // firing. Tooltips are presentational; if you need\n // interactivity, reach for Popover.\n pointerEvents: 'none',\n } as Record<string, unknown>)}\n {...(testID !== undefined ? { testID } : {})}\n className={cn('rounded-md', className)}\n style={[contentBaseStyle, positionedStyle]}\n >\n <RNText\n className=\"text-xs\"\n style={{\n color: colors.semantic.text.inverted,\n fontFamily: colors.fontFamily.body,\n fontSize: px(colors.fontSize.sm),\n lineHeight: px(colors.fontSize.sm) * Number(colors.lineHeight.tight),\n }}\n >\n {children}\n </RNText>\n </View>\n );\n};\n\n/**\n * Public `Tooltip` value — the root function plus its `.Trigger` and\n * `.Content` static members. `Object.assign` produces a value whose inferred\n * type carries the static properties, so `.d.ts` consumers can write\n * `<Tooltip.Trigger>` without a separate import.\n */\nexport const Tooltip = Object.assign(TooltipRoot, {\n Trigger: TooltipTrigger,\n Content: TooltipContent,\n});\n"]}
|