@jbpark/ui-kit 10.3.0 → 10.4.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/README.ko.md +97 -76
- package/README.md +91 -70
- package/dist/AutoComplete.mjs +1 -1
- package/dist/Breadcrumb.mjs +1 -1
- package/dist/Cascader.mjs +2 -2
- package/dist/Checkbox.d.mts +10 -0
- package/dist/Checkbox.d.mts.map +1 -0
- package/dist/Checkbox.mjs +9 -0
- package/dist/Checkbox.mjs.map +1 -0
- package/dist/CodeEditor.d.mts +8 -2
- package/dist/CodeEditor.d.mts.map +1 -1
- package/dist/CodeEditor.mjs +9 -4
- package/dist/CodeEditor.mjs.map +1 -1
- package/dist/{components/molecules/collapse.d.mts → Collapse.d.mts} +1 -1
- package/dist/Collapse.d.mts.map +1 -0
- package/dist/{components/molecules/collapse.mjs → Collapse.mjs} +3 -3
- package/dist/Collapse.mjs.map +1 -0
- package/dist/{components/atoms/color-picker.d.mts → ColorPicker.d.mts} +1 -1
- package/dist/ColorPicker.d.mts.map +1 -0
- package/dist/{components/atoms/color-picker.mjs → ColorPicker.mjs} +3 -3
- package/dist/ColorPicker.mjs.map +1 -0
- package/dist/{components/templates/container.d.mts → Container.d.mts} +1 -1
- package/dist/Container.d.mts.map +1 -0
- package/dist/{components/templates/container.mjs → Container.mjs} +2 -2
- package/dist/Container.mjs.map +1 -0
- package/dist/{components/atoms/date-picker.d.mts → DatePicker.d.mts} +1 -1
- package/dist/DatePicker.d.mts.map +1 -0
- package/dist/{components/atoms/date-picker.mjs → DatePicker.mjs} +6 -6
- package/dist/DatePicker.mjs.map +1 -0
- package/dist/{components/organisms/drawer.d.mts → Drawer.d.mts} +1 -1
- package/dist/Drawer.d.mts.map +1 -0
- package/dist/{components/organisms/drawer.mjs → Drawer.mjs} +5 -5
- package/dist/Drawer.mjs.map +1 -0
- package/dist/{components/molecules/dropdown.d.mts → Dropdown.d.mts} +2 -2
- package/dist/Dropdown.d.mts.map +1 -0
- package/dist/{components/molecules/dropdown.mjs → Dropdown.mjs} +4 -4
- package/dist/Dropdown.mjs.map +1 -0
- package/dist/{components/templates/empty.d.mts → Empty.d.mts} +2 -2
- package/dist/Empty.d.mts.map +1 -0
- package/dist/{components/templates/empty.mjs → Empty.mjs} +3 -3
- package/dist/Empty.mjs.map +1 -0
- package/dist/FloatButton.d.mts +10 -0
- package/dist/FloatButton.d.mts.map +1 -0
- package/dist/FloatButton.mjs +9 -0
- package/dist/FloatButton.mjs.map +1 -0
- package/dist/Input.d.mts +16 -0
- package/dist/Input.d.mts.map +1 -0
- package/dist/Input.mjs +15 -0
- package/dist/Input.mjs.map +1 -0
- package/dist/{components/organisms/list/index.d.mts → List.d.mts} +3 -3
- package/dist/List.d.mts.map +1 -0
- package/dist/List.mjs +9 -0
- package/dist/List.mjs.map +1 -0
- package/dist/Marquees.d.mts +10 -0
- package/dist/Marquees.d.mts.map +1 -0
- package/dist/Marquees.mjs +9 -0
- package/dist/Marquees.mjs.map +1 -0
- package/dist/Mentions.d.mts.map +1 -1
- package/dist/Mentions.mjs +8 -7
- package/dist/Mentions.mjs.map +1 -1
- package/dist/{components/organisms/modal.d.mts → Modal.d.mts} +1 -1
- package/dist/Modal.d.mts.map +1 -0
- package/dist/{components/organisms/modal.mjs → Modal.mjs} +6 -6
- package/dist/Modal.mjs.map +1 -0
- package/dist/{components/templates/page-header.d.mts → PageHeader.d.mts} +1 -1
- package/dist/PageHeader.d.mts.map +1 -0
- package/dist/{components/templates/page-header.mjs → PageHeader.mjs} +4 -4
- package/dist/PageHeader.mjs.map +1 -0
- package/dist/Pagination.mjs +2 -2
- package/dist/Popconfirm.d.mts +1 -1
- package/dist/Popconfirm.mjs +1 -1
- package/dist/{components/atoms/popover.d.mts → Popover.d.mts} +1 -1
- package/dist/Popover.d.mts.map +1 -0
- package/dist/{components/atoms/popover.mjs → Popover.mjs} +4 -4
- package/dist/Popover.mjs.map +1 -0
- package/dist/{components/atoms/progress.d.mts → Progress.d.mts} +1 -1
- package/dist/Progress.d.mts.map +1 -0
- package/dist/{components/atoms/progress.mjs → Progress.mjs} +3 -3
- package/dist/Progress.mjs.map +1 -0
- package/dist/Radio.d.mts +10 -0
- package/dist/Radio.d.mts.map +1 -0
- package/dist/Radio.mjs +9 -0
- package/dist/Radio.mjs.map +1 -0
- package/dist/{components/templates/result.d.mts → Result.d.mts} +1 -1
- package/dist/Result.d.mts.map +1 -0
- package/dist/{components/templates/result.mjs → Result.mjs} +2 -2
- package/dist/Result.mjs.map +1 -0
- package/dist/RichTextEditor.d.mts +3 -0
- package/dist/RichTextEditor.mjs +1 -0
- package/dist/{components/atoms/select.d.mts → Select.d.mts} +5 -5
- package/dist/Select.d.mts.map +1 -0
- package/dist/{components/atoms/select.mjs → Select.mjs} +5 -5
- package/dist/Select.mjs.map +1 -0
- package/dist/Skeleton.d.mts +12 -0
- package/dist/Skeleton.d.mts.map +1 -0
- package/dist/Skeleton.mjs +11 -0
- package/dist/Skeleton.mjs.map +1 -0
- package/dist/Slider.d.mts +2 -0
- package/dist/{components/atoms/slider/index.mjs → Slider.mjs} +2 -2
- package/dist/Slider.mjs.map +1 -0
- package/dist/Space.d.mts +3 -2
- package/dist/Space.d.mts.map +1 -1
- package/dist/Space.mjs +13 -4
- package/dist/Space.mjs.map +1 -1
- package/dist/{components/atoms/spin.d.mts → Spin.d.mts} +1 -1
- package/dist/Spin.d.mts.map +1 -0
- package/dist/{components/atoms/spin.mjs → Spin.mjs} +3 -3
- package/dist/Spin.mjs.map +1 -0
- package/dist/Splitter.d.mts +10 -0
- package/dist/Splitter.d.mts.map +1 -0
- package/dist/Splitter.mjs +9 -0
- package/dist/Splitter.mjs.map +1 -0
- package/dist/Statistic.mjs +1 -1
- package/dist/Swiper.d.mts +10 -0
- package/dist/Swiper.d.mts.map +1 -0
- package/dist/Swiper.mjs +9 -0
- package/dist/Swiper.mjs.map +1 -0
- package/dist/{components/atoms/switch.d.mts → Switch.d.mts} +2 -2
- package/dist/Switch.d.mts.map +1 -0
- package/dist/{components/atoms/switch.mjs → Switch.mjs} +4 -4
- package/dist/Switch.mjs.map +1 -0
- package/dist/Table.mjs +2 -2
- package/dist/Table.mjs.map +1 -1
- package/dist/{components/molecules/tabs.d.mts → Tabs.d.mts} +3 -3
- package/dist/Tabs.d.mts.map +1 -0
- package/dist/{components/molecules/tabs.mjs → Tabs.mjs} +3 -3
- package/dist/Tabs.mjs.map +1 -0
- package/dist/TimePicker.mjs +1 -1
- package/dist/{components/organisms/toast.d.mts → Toast.d.mts} +12 -2
- package/dist/Toast.d.mts.map +1 -0
- package/dist/Toast.mjs +198 -0
- package/dist/Toast.mjs.map +1 -0
- package/dist/ToggleGroup.d.mts +28 -0
- package/dist/ToggleGroup.d.mts.map +1 -0
- package/dist/ToggleGroup.mjs +58 -0
- package/dist/ToggleGroup.mjs.map +1 -0
- package/dist/{components/atoms/tooltip.d.mts → Tooltip.d.mts} +1 -1
- package/dist/Tooltip.d.mts.map +1 -0
- package/dist/{components/atoms/tooltip.mjs → Tooltip.mjs} +2 -2
- package/dist/Tooltip.mjs.map +1 -0
- package/dist/Tour.d.mts.map +1 -1
- package/dist/Tour.mjs +47 -64
- package/dist/Tour.mjs.map +1 -1
- package/dist/Transfer.mjs +2 -2
- package/dist/Tree.mjs +1 -1
- package/dist/{components/molecules/upload.d.mts → Upload.d.mts} +1 -1
- package/dist/Upload.d.mts.map +1 -0
- package/dist/{components/molecules/upload.mjs → Upload.mjs} +7 -7
- package/dist/Upload.mjs.map +1 -0
- package/dist/components/atoms/index.d.mts +34 -27
- package/dist/components/atoms/input/input.d.mts +2 -1
- package/dist/components/atoms/input/input.d.mts.map +1 -1
- package/dist/components/atoms/input/input.mjs.map +1 -1
- package/dist/components/atoms/rich-text-editor/toolbar-presets.mjs +4 -4
- package/dist/components/atoms/select-multiple.mjs +1 -1
- package/dist/components/atoms/select-searchable.mjs +1 -1
- package/dist/components/molecules/index.d.mts +22 -21
- package/dist/components/organisms/form/control.mjs +1 -1
- package/dist/components/organisms/imperative-stack.mjs +16 -1
- package/dist/components/organisms/imperative-stack.mjs.map +1 -1
- package/dist/components/organisms/index.d.mts +15 -15
- package/dist/components/organisms/list/list.d.mts +1 -1
- package/dist/components/organisms/list/list.mjs +1 -1
- package/dist/components/organisms/swiper/swiper.d.mts +6 -0
- package/dist/components/organisms/swiper/swiper.d.mts.map +1 -1
- package/dist/components/organisms/swiper/swiper.mjs +1 -1
- package/dist/components/templates/index.d.mts +11 -12
- package/dist/components/templates/layout/sider.d.mts.map +1 -1
- package/dist/components/templates/layout/sider.mjs +4 -6
- package/dist/components/templates/layout/sider.mjs.map +1 -1
- package/dist/core/badge.d.mts +1 -1
- package/dist/core/button.d.mts +2 -2
- package/dist/index.d.mts +81 -74
- package/dist/index.mjs +31 -30
- package/dist/style.css +21 -0
- package/package.json +157 -2
- package/dist/components/atoms/checkbox/index.d.mts +0 -10
- package/dist/components/atoms/checkbox/index.d.mts.map +0 -1
- package/dist/components/atoms/checkbox/index.mjs +0 -9
- package/dist/components/atoms/checkbox/index.mjs.map +0 -1
- package/dist/components/atoms/color-picker.d.mts.map +0 -1
- package/dist/components/atoms/color-picker.mjs.map +0 -1
- package/dist/components/atoms/date-picker.d.mts.map +0 -1
- package/dist/components/atoms/date-picker.mjs.map +0 -1
- package/dist/components/atoms/float-button/index.d.mts +0 -10
- package/dist/components/atoms/float-button/index.d.mts.map +0 -1
- package/dist/components/atoms/float-button/index.mjs +0 -9
- package/dist/components/atoms/float-button/index.mjs.map +0 -1
- package/dist/components/atoms/input/index.d.mts +0 -16
- package/dist/components/atoms/input/index.d.mts.map +0 -1
- package/dist/components/atoms/input/index.mjs +0 -15
- package/dist/components/atoms/input/index.mjs.map +0 -1
- package/dist/components/atoms/popover.d.mts.map +0 -1
- package/dist/components/atoms/popover.mjs.map +0 -1
- package/dist/components/atoms/progress.d.mts.map +0 -1
- package/dist/components/atoms/progress.mjs.map +0 -1
- package/dist/components/atoms/radio/index.d.mts +0 -10
- package/dist/components/atoms/radio/index.d.mts.map +0 -1
- package/dist/components/atoms/radio/index.mjs +0 -9
- package/dist/components/atoms/radio/index.mjs.map +0 -1
- package/dist/components/atoms/rich-text-editor/index.d.mts +0 -3
- package/dist/components/atoms/select.d.mts.map +0 -1
- package/dist/components/atoms/select.mjs.map +0 -1
- package/dist/components/atoms/skeleton/index.d.mts +0 -12
- package/dist/components/atoms/skeleton/index.d.mts.map +0 -1
- package/dist/components/atoms/skeleton/index.mjs +0 -11
- package/dist/components/atoms/skeleton/index.mjs.map +0 -1
- package/dist/components/atoms/slider/index.mjs.map +0 -1
- package/dist/components/atoms/spin.d.mts.map +0 -1
- package/dist/components/atoms/spin.mjs.map +0 -1
- package/dist/components/atoms/switch.d.mts.map +0 -1
- package/dist/components/atoms/switch.mjs.map +0 -1
- package/dist/components/atoms/tooltip.d.mts.map +0 -1
- package/dist/components/atoms/tooltip.mjs.map +0 -1
- package/dist/components/molecules/collapse.d.mts.map +0 -1
- package/dist/components/molecules/collapse.mjs.map +0 -1
- package/dist/components/molecules/dropdown.d.mts.map +0 -1
- package/dist/components/molecules/dropdown.mjs.map +0 -1
- package/dist/components/molecules/marquees/index.d.mts +0 -10
- package/dist/components/molecules/marquees/index.d.mts.map +0 -1
- package/dist/components/molecules/marquees/index.mjs +0 -9
- package/dist/components/molecules/marquees/index.mjs.map +0 -1
- package/dist/components/molecules/splitter/index.d.mts +0 -10
- package/dist/components/molecules/splitter/index.d.mts.map +0 -1
- package/dist/components/molecules/splitter/index.mjs +0 -9
- package/dist/components/molecules/splitter/index.mjs.map +0 -1
- package/dist/components/molecules/tabs.d.mts.map +0 -1
- package/dist/components/molecules/tabs.mjs.map +0 -1
- package/dist/components/molecules/upload.d.mts.map +0 -1
- package/dist/components/molecules/upload.mjs.map +0 -1
- package/dist/components/organisms/drawer.d.mts.map +0 -1
- package/dist/components/organisms/drawer.mjs.map +0 -1
- package/dist/components/organisms/list/index.d.mts.map +0 -1
- package/dist/components/organisms/list/index.mjs +0 -9
- package/dist/components/organisms/list/index.mjs.map +0 -1
- package/dist/components/organisms/modal.d.mts.map +0 -1
- package/dist/components/organisms/modal.mjs.map +0 -1
- package/dist/components/organisms/swiper/index.d.mts +0 -10
- package/dist/components/organisms/swiper/index.d.mts.map +0 -1
- package/dist/components/organisms/swiper/index.mjs +0 -9
- package/dist/components/organisms/swiper/index.mjs.map +0 -1
- package/dist/components/organisms/toast.d.mts.map +0 -1
- package/dist/components/organisms/toast.mjs +0 -126
- package/dist/components/organisms/toast.mjs.map +0 -1
- package/dist/components/templates/container.d.mts.map +0 -1
- package/dist/components/templates/container.mjs.map +0 -1
- package/dist/components/templates/empty.d.mts.map +0 -1
- package/dist/components/templates/empty.mjs.map +0 -1
- package/dist/components/templates/page-header.d.mts.map +0 -1
- package/dist/components/templates/page-header.mjs.map +0 -1
- package/dist/components/templates/result.d.mts.map +0 -1
- package/dist/components/templates/result.mjs.map +0 -1
package/dist/CodeEditor.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CodeEditor.mjs","names":[],"sources":["../src/components/atoms/code-editor.tsx"],"sourcesContent":["'use client';\n\n// Subpath-only component (`@jbpark/ui-kit/CodeEditor`). Deliberately NOT\n// re-exported from `atoms/index.ts` — CodeMirror is an *optional* peer\n// dependency, and an ESM re-export from the root barrel is eager, so\n// `import { Button } from '@jbpark/ui-kit'` would fail to resolve for every\n// consumer that never asked for an editor. Keeping it behind its own subpath\n// is what makes the peer set genuinely opt-in (#346).\nimport { useCallback, useMemo, useRef } from 'react';\n\nimport { javascript } from '@codemirror/lang-javascript';\nimport { unifiedMergeView } from '@codemirror/merge';\nimport { vscodeDark, vscodeLight } from '@uiw/codemirror-theme-vscode';\nimport CodeMirror, {\n type Extension,\n type ReactCodeMirrorRef,\n} from '@uiw/react-codemirror';\nimport { EditorView } from 'codemirror';\n\nimport { cn } from '@repo/ui/utils';\n\n// Relative rather than `@repo/ui/providers`, because this hook is deliberately\n// absent from that barrel — it is a published subpath, and the hook is internal.\n// Both specifiers resolve to the same files, so there is still one Config\n// context.\nimport { useIsDarkActive } from '../../providers/config';\n\nexport interface Props extends Omit<\n React.ComponentProps<typeof CodeMirror>,\n 'value' | 'extensions' | 'onChange' | 'ref' | 'theme'\n> {\n value: string;\n /** Passed through to CodeMirror; `'100%'` fills the wrapper. */\n height?: string;\n /**\n * `'light'`/`'dark'` pick the VSCode theme pair, `'auto'` (the default)\n * follows the nearest `Config`'s `theme.dark`, and an `Extension` is any\n * CodeMirror theme of your own.\n *\n * This narrows CodeMirror's own meaning for two of the strings — upstream,\n * `'light'`/`'dark'` are *its* built-in themes — so that the two named\n * options match what the component actually renders by default. `'none'`\n * still means what it does upstream: no theme extension, style it yourself.\n */\n theme?: 'light' | 'dark' | 'auto' | 'none' | Extension;\n
|
|
1
|
+
{"version":3,"file":"CodeEditor.mjs","names":[],"sources":["../src/components/atoms/code-editor.tsx"],"sourcesContent":["'use client';\n\n// Subpath-only component (`@jbpark/ui-kit/CodeEditor`). Deliberately NOT\n// re-exported from `atoms/index.ts` — CodeMirror is an *optional* peer\n// dependency, and an ESM re-export from the root barrel is eager, so\n// `import { Button } from '@jbpark/ui-kit'` would fail to resolve for every\n// consumer that never asked for an editor. Keeping it behind its own subpath\n// is what makes the peer set genuinely opt-in (#346).\nimport { useCallback, useMemo, useRef } from 'react';\n\nimport { javascript } from '@codemirror/lang-javascript';\nimport { unifiedMergeView } from '@codemirror/merge';\nimport { vscodeDark, vscodeLight } from '@uiw/codemirror-theme-vscode';\nimport CodeMirror, {\n type Extension,\n type ReactCodeMirrorRef,\n} from '@uiw/react-codemirror';\nimport { EditorView } from 'codemirror';\n\nimport { cn } from '@repo/ui/utils';\n\n// Relative rather than `@repo/ui/providers`, because this hook is deliberately\n// absent from that barrel — it is a published subpath, and the hook is internal.\n// Both specifiers resolve to the same files, so there is still one Config\n// context.\nimport { useIsDarkActive } from '../../providers/config';\n\nexport interface Props extends Omit<\n React.ComponentProps<typeof CodeMirror>,\n 'value' | 'extensions' | 'onChange' | 'ref' | 'theme'\n> {\n value: string;\n /** Passed through to CodeMirror; `'100%'` fills the wrapper. */\n height?: string;\n /**\n * `'light'`/`'dark'` pick the VSCode theme pair, `'auto'` (the default)\n * follows the nearest `Config`'s `theme.dark`, and an `Extension` is any\n * CodeMirror theme of your own.\n *\n * This narrows CodeMirror's own meaning for two of the strings — upstream,\n * `'light'`/`'dark'` are *its* built-in themes — so that the two named\n * options match what the component actually renders by default. `'none'`\n * still means what it does upstream: no theme extension, style it yourself.\n */\n theme?: 'light' | 'dark' | 'auto' | 'none' | Extension;\n /**\n * The language extension. Omitted, it is the built-in JS/TS/JSX mode; an\n * `Extension` replaces it (e.g. `json()` from `@codemirror/lang-json`, which\n * the caller installs), and `null` leaves the document as plain text.\n */\n language?: Extension | null;\n /** Appended after the language and line-wrapping extensions. */\n extensions?: Extension[];\n /**\n * Renders a read-through unified diff against `original` instead of a plain\n * document. `mergeControls` defaults to `false` (display-only review, no\n * accept/reject gutters).\n */\n diff?: {\n original: string;\n mergeControls?: boolean;\n };\n /**\n * Formatter run on the Cmd/Ctrl+S value before it is written back. Omitted,\n * the shortcut still fires `onSave` — it just doesn't reformat. Kept as an\n * injected function so this package carries no formatter dependency of its\n * own (prettier is ~9.6 MB); pass the one your app already owns.\n */\n formatCode?: (code: string) => Promise<string>;\n className?: string;\n onChange?: (value: string) => void;\n /** Fires on Cmd/Ctrl+S with the value that was written back. */\n onSave?: (value: string) => void;\n /**\n * `null` on a clean save; a string carries the message a failed `formatCode`\n * threw. Named `onFormatError` rather than `onError` because the base props\n * already carry the DOM `onError` handler, and silently shadowing it would\n * be worse than the extra word.\n */\n onFormatError?: (error: string | null) => void;\n}\n\nconst CodeEditor = ({\n value,\n theme = 'auto',\n height,\n className,\n language,\n extensions: extraExtensions,\n diff,\n formatCode,\n onChange,\n onSave,\n onFormatError,\n ...props\n}: Props) => {\n const editorRef = useRef<ReactCodeMirrorRef>(null);\n const isDarkActive = useIsDarkActive();\n\n const resolvedTheme = useMemo(() => {\n if (theme === 'auto') {\n return isDarkActive ? vscodeDark : vscodeLight;\n }\n if (theme === 'light') {\n return vscodeLight;\n }\n if (theme === 'dark') {\n return vscodeDark;\n }\n\n // `'none'` and a caller-supplied Extension both mean what they mean\n // upstream, so hand them straight to CodeMirror.\n return theme;\n }, [theme, isDarkActive]);\n\n const extensions = useMemo(() => {\n const languageExtension =\n language === undefined\n ? javascript({ jsx: true, typescript: true })\n : language;\n const base: Extension[] = languageExtension\n ? [languageExtension, EditorView.lineWrapping]\n : [EditorView.lineWrapping];\n\n if (diff) {\n base.push(\n unifiedMergeView({\n original: diff.original,\n mergeControls: diff.mergeControls ?? false,\n }),\n );\n }\n\n return [...base, ...(extraExtensions ?? [])];\n }, [language, diff, extraExtensions]);\n\n const save = useCallback(\n async (val: string) => {\n const view = editorRef.current?.view;\n if (!view) {\n return;\n }\n\n try {\n const currentLength = view.state.doc.length;\n const cursorPos = view.state.selection.main.head;\n const next = formatCode ? await formatCode(val) : val;\n\n // Formatting is async, so the document may have moved on while it ran\n // — writing back then would clobber keystrokes typed in the meantime.\n if (currentLength !== view.state.doc.length) {\n onFormatError?.(null);\n return;\n }\n\n // Skip the transaction when the text is unchanged (the common case\n // without a `formatCode`): replacing the doc with itself would push a\n // pointless undo entry. The callbacks still fire, so a save handler\n // sees every Cmd+S.\n if (next !== val) {\n view.dispatch(\n view.state.update({\n changes: { from: 0, to: currentLength, insert: next },\n selection: { anchor: Math.min(cursorPos, next.length) },\n }),\n );\n }\n\n onChange?.(next);\n onSave?.(next);\n onFormatError?.(null);\n } catch (e) {\n onFormatError?.(e instanceof Error ? e.message : String(e));\n }\n },\n [formatCode, onChange, onSave, onFormatError],\n );\n\n const onKeyDown = useCallback(\n (e: React.KeyboardEvent<HTMLDivElement>) => {\n if ((e.metaKey || e.ctrlKey) && e.key === 's') {\n e.preventDefault();\n save(editorRef.current?.view?.state.doc.toString() ?? value);\n }\n },\n [save, value],\n );\n\n return (\n <div\n data-slot=\"code-editor\"\n className={cn(\n className,\n // ...\n )}\n onKeyDown={onKeyDown}\n >\n <CodeMirror\n ref={editorRef}\n theme={resolvedTheme}\n height={height || '100%'}\n value={value}\n extensions={extensions}\n onChange={onChange}\n {...props}\n />\n </div>\n );\n};\n\nexport default CodeEditor;\n"],"mappings":";;;;;;;;;;;AAkFA,MAAM,cAAc,EAClB,OACA,QAAQ,QACR,QACA,WACA,UACA,YAAY,iBACZ,MACA,YACA,UACA,QACA,eACA,GAAG,YACQ;CACX,MAAM,YAAY,OAA2B,IAAI;CACjD,MAAM,eAAe,gBAAgB;CAErC,MAAM,gBAAgB,cAAc;EAClC,IAAI,UAAU,QACZ,OAAO,eAAe,aAAa;EAErC,IAAI,UAAU,SACZ,OAAO;EAET,IAAI,UAAU,QACZ,OAAO;EAKT,OAAO;CACT,GAAG,CAAC,OAAO,YAAY,CAAC;CAExB,MAAM,aAAa,cAAc;EAC/B,MAAM,oBACJ,aAAa,KAAA,IACT,WAAW;GAAE,KAAK;GAAM,YAAY;EAAK,CAAC,IAC1C;EACN,MAAM,OAAoB,oBACtB,CAAC,mBAAmB,WAAW,YAAY,IAC3C,CAAC,WAAW,YAAY;EAE5B,IAAI,MACF,KAAK,KACH,iBAAiB;GACf,UAAU,KAAK;GACf,eAAe,KAAK,iBAAiB;EACvC,CAAC,CACH;EAGF,OAAO,CAAC,GAAG,MAAM,GAAI,mBAAmB,CAAC,CAAE;CAC7C,GAAG;EAAC;EAAU;EAAM;CAAe,CAAC;CAEpC,MAAM,OAAO,YACX,OAAO,QAAgB;EACrB,MAAM,OAAO,UAAU,SAAS;EAChC,IAAI,CAAC,MACH;EAGF,IAAI;GACF,MAAM,gBAAgB,KAAK,MAAM,IAAI;GACrC,MAAM,YAAY,KAAK,MAAM,UAAU,KAAK;GAC5C,MAAM,OAAO,aAAa,MAAM,WAAW,GAAG,IAAI;GAIlD,IAAI,kBAAkB,KAAK,MAAM,IAAI,QAAQ;IAC3C,gBAAgB,IAAI;IACpB;GACF;GAMA,IAAI,SAAS,KACX,KAAK,SACH,KAAK,MAAM,OAAO;IAChB,SAAS;KAAE,MAAM;KAAG,IAAI;KAAe,QAAQ;IAAK;IACpD,WAAW,EAAE,QAAQ,KAAK,IAAI,WAAW,KAAK,MAAM,EAAE;GACxD,CAAC,CACH;GAGF,WAAW,IAAI;GACf,SAAS,IAAI;GACb,gBAAgB,IAAI;EACtB,SAAS,GAAG;GACV,gBAAgB,aAAa,QAAQ,EAAE,UAAU,OAAO,CAAC,CAAC;EAC5D;CACF,GACA;EAAC;EAAY;EAAU;EAAQ;CAAa,CAC9C;CAEA,MAAM,YAAY,aACf,MAA2C;EAC1C,KAAK,EAAE,WAAW,EAAE,YAAY,EAAE,QAAQ,KAAK;GAC7C,EAAE,eAAe;GACjB,KAAK,UAAU,SAAS,MAAM,MAAM,IAAI,SAAS,KAAK,KAAK;EAC7D;CACF,GACA,CAAC,MAAM,KAAK,CACd;CAEA,OACE,oBAAC,OAAD;EACE,aAAU;EACV,WAAW,GACT,SAEF;EACW;EAEX,UAAA,oBAAC,YAAD;GACE,KAAK;GACL,OAAO;GACP,QAAQ,UAAU;GACX;GACK;GACF;GACV,GAAI;EACL,CAAA;CACE,CAAA;AAET"}
|
|
@@ -22,4 +22,4 @@ export interface Props<Key extends React.Key = string> extends Omit<React.Compon
|
|
|
22
22
|
declare const Collapse: <Key extends React.Key = string>({ expandIcon, accordion, items, className, classNames, defaultActiveKey, activeKey: _activeKey, onChange: _onChange, ...props }: Props<Key>) => React.JSX.Element;
|
|
23
23
|
//#endregion
|
|
24
24
|
export { Collapse as default };
|
|
25
|
-
//# sourceMappingURL=
|
|
25
|
+
//# sourceMappingURL=Collapse.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Collapse.d.mts","names":[],"sources":["../src/components/molecules/collapse.tsx"],"mappings":";;UAWU,KAAK,YAAY,MAAM;EAC/B,KAAK;EACL,OAAO,MAAM;EACb;EACA,UAAU,MAAM;;iBAGD,MAAM,YAAY,MAAM,sBAAsB,KAC7D,MAAM;EAGN,QAAQ,KAAK;EACb;EACA,aAAa,MAAM;EACnB;IACE;IACA;IACA;;EAEF,mBAAmB;EACnB,YAAY;EACZ,YAAY,MAAM;;cAGd,WAAY,YAAY,MAAM,gBAAc,YAAA,WAAA,OAAA,WAAA,YAAA,kBAAA,WAAA,YAAA,UAAA,cAAA,SAU/C,MAAM,SAAI,MAAA,IAAA"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { cn } from "
|
|
3
|
-
import { accordion_exports } from "
|
|
2
|
+
import { cn } from "./utils.mjs";
|
|
3
|
+
import { accordion_exports } from "./core/accordion.mjs";
|
|
4
4
|
import "react";
|
|
5
5
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
6
6
|
//#region src/components/molecules/collapse.tsx
|
|
@@ -45,4 +45,4 @@ const Collapse = ({ expandIcon, accordion = false, items = [], className, classN
|
|
|
45
45
|
//#endregion
|
|
46
46
|
export { Collapse as default };
|
|
47
47
|
|
|
48
|
-
//# sourceMappingURL=
|
|
48
|
+
//# sourceMappingURL=Collapse.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Collapse.mjs","names":["accordion"],"sources":["../src/components/molecules/collapse.tsx"],"sourcesContent":["'use client';\n\nimport React from 'react';\n\nimport { cn } from '@repo/ui/utils';\n\nimport { accordion } from '../../core';\n\nconst { Accordion, AccordionItem, AccordionTrigger, AccordionContent } =\n accordion;\n\ninterface Item<Key extends React.Key = string> {\n key: Key;\n label: React.ReactNode;\n disabled?: boolean;\n children: React.ReactNode;\n}\n\nexport interface Props<Key extends React.Key = string> extends Omit<\n React.ComponentPropsWithoutRef<'div'>,\n 'onChange' | 'defaultValue' | 'value' | 'dir'\n> {\n items?: Item<Key>[];\n accordion?: boolean;\n expandIcon?: React.ReactNode;\n classNames?: {\n item?: string;\n header?: string;\n body?: string;\n };\n defaultActiveKey?: Key[];\n activeKey?: Key[];\n onChange?: (keys: Key[]) => void;\n}\n\nconst Collapse = <Key extends React.Key = string>({\n expandIcon,\n accordion = false,\n items = [],\n className,\n classNames,\n defaultActiveKey,\n activeKey: _activeKey,\n onChange: _onChange,\n ...props\n}: Props<Key>) => {\n const controlled = _activeKey !== undefined;\n const keysByValue = new Map<string, Key>(\n [\n ...(defaultActiveKey ?? []),\n ...(_activeKey ?? []),\n ...items.map(item => item.key),\n ].map(key => [String(key), key]),\n );\n\n // Base UI's accordion has no `type` and always models the open set as an\n // array; `multiple` (default false) is the only single-vs-multiple switch.\n // `accordion` here means \"one panel open at a time\", so `multiple = !accordion`.\n const accordionProps = {\n multiple: !accordion,\n onValueChange: (values: string[]) => {\n _onChange?.(\n values.flatMap(value => {\n const key = keysByValue.get(value);\n\n return key === undefined ? [] : [key];\n }),\n );\n },\n ...(controlled\n ? { value: (_activeKey ?? []).map(key => String(key)) }\n : { defaultValue: (defaultActiveKey ?? []).map(key => String(key)) }),\n };\n\n return (\n <Accordion {...props} className={className} {...accordionProps}>\n {items.map(({ key, label, children, disabled }) => (\n <AccordionItem\n key={key}\n value={String(key)}\n className={cn(\n 'border-none',\n classNames?.item,\n //\n )}\n disabled={disabled}\n >\n <AccordionTrigger\n className={cn(\n 'hover:no-underline',\n classNames?.header,\n disabled && 'cursor-no-drop opacity-50',\n //\n )}\n expandIcon={expandIcon}\n disabled={disabled}\n >\n {label}\n </AccordionTrigger>\n <AccordionContent\n className={cn(\n classNames?.body,\n //\n )}\n >\n {children}\n </AccordionContent>\n </AccordionItem>\n ))}\n </Accordion>\n );\n};\n\nexport default Collapse;\n"],"mappings":";;;;;;AAQA,MAAM,EAAE,WAAW,eAAe,kBAAkB,qBAClDA;AA0BF,MAAM,YAA4C,EAChD,YACA,YAAY,OACZ,QAAQ,CAAC,GACT,WACA,YACA,kBACA,WAAW,YACX,UAAU,WACV,GAAG,YACa;CAChB,MAAM,aAAa,eAAe,KAAA;CAClC,MAAM,cAAc,IAAI,IACtB;EACE,GAAI,oBAAoB,CAAC;EACzB,GAAI,cAAc,CAAC;EACnB,GAAG,MAAM,KAAI,SAAQ,KAAK,GAAG;CAC/B,CAAC,CAAC,KAAI,QAAO,CAAC,OAAO,GAAG,GAAG,GAAG,CAAC,CACjC;CAKA,MAAM,iBAAiB;EACrB,UAAU,CAAC;EACX,gBAAgB,WAAqB;GACnC,YACE,OAAO,SAAQ,UAAS;IACtB,MAAM,MAAM,YAAY,IAAI,KAAK;IAEjC,OAAO,QAAQ,KAAA,IAAY,CAAC,IAAI,CAAC,GAAG;GACtC,CAAC,CACH;EACF;EACA,GAAI,aACA,EAAE,QAAQ,cAAc,CAAC,EAAA,CAAG,KAAI,QAAO,OAAO,GAAG,CAAC,EAAE,IACpD,EAAE,eAAe,oBAAoB,CAAC,EAAA,CAAG,KAAI,QAAO,OAAO,GAAG,CAAC,EAAE;CACvE;CAEA,OACE,oBAAC,WAAD;EAAW,GAAI;EAAkB;EAAW,GAAI;EAC7C,UAAA,MAAM,KAAK,EAAE,KAAK,OAAO,UAAU,eAClC,qBAAC,eAAD;GAEE,OAAO,OAAO,GAAG;GACjB,WAAW,GACT,eACA,YAAY,IAEd;GACU;GARZ,UAAA,CAUE,oBAAC,kBAAD;IACE,WAAW,GACT,sBACA,YAAY,QACZ,YAAY,2BAEd;IACY;IACF;IAET,UAAA;GACe,CAAA,GAClB,oBAAC,kBAAD;IACE,WAAW,GACT,YAAY,IAEd;IAEC;GACe,CAAA,CACL;EA7BR,GAAA,GA6BQ,CAChB;CACQ,CAAA;AAEf"}
|
|
@@ -12,4 +12,4 @@ export interface Props extends Omit<React.ComponentPropsWithoutRef<'div'>, 'onCh
|
|
|
12
12
|
declare const ColorPicker: ({ defaultValue, value: _value, showText, disabled, className, onChange: _onChange, open: _open, defaultOpen, onOpenChange, ...props }: Props) => import("react").JSX.Element;
|
|
13
13
|
//#endregion
|
|
14
14
|
export { ColorPicker as default };
|
|
15
|
-
//# sourceMappingURL=
|
|
15
|
+
//# sourceMappingURL=ColorPicker.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ColorPicker.d.mts","names":[],"sources":["../src/components/atoms/color-picker.tsx"],"mappings":";iBAUiB,cAAc,KAC7B,MAAM;EAGN;EACA;EACA;EACA;EACA,YAAY;EACZ;EACA;EACA,gBAAgB;;cAGZ,gBAAe,cAAA,OAAA,QAAA,UAAA,UAAA,WAAA,UAAA,WAAA,MAAA,OAAA,aAAA,iBAAA,SAWlB,0BAAK,IAAA"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { cn } from "
|
|
3
|
-
import Popover from "./
|
|
2
|
+
import { cn } from "./utils.mjs";
|
|
3
|
+
import Popover from "./Popover.mjs";
|
|
4
4
|
import { useControllableState } from "@jbpark/use-hooks";
|
|
5
5
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
6
6
|
import { HexColorPicker } from "react-colorful";
|
|
@@ -57,4 +57,4 @@ const ColorPicker = ({ defaultValue, value: _value, showText, disabled, classNam
|
|
|
57
57
|
//#endregion
|
|
58
58
|
export { ColorPicker as default };
|
|
59
59
|
|
|
60
|
-
//# sourceMappingURL=
|
|
60
|
+
//# sourceMappingURL=ColorPicker.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ColorPicker.mjs","names":[],"sources":["../src/components/atoms/color-picker.tsx"],"sourcesContent":["'use client';\n\nimport { HexColorPicker } from 'react-colorful';\n\nimport { useControllableState } from '@jbpark/use-hooks';\n\nimport { cn } from '@repo/ui/utils';\n\nimport Popover from './popover';\n\nexport interface Props extends Omit<\n React.ComponentPropsWithoutRef<'div'>,\n 'onChange' | 'defaultValue' | 'value' | 'onClick' | 'onKeyDown' | 'open'\n> {\n defaultValue?: string;\n value?: string;\n showText?: boolean;\n disabled?: boolean;\n onChange?: (color: string) => void;\n open?: boolean;\n defaultOpen?: boolean;\n onOpenChange?: (open: boolean) => void;\n}\n\nconst ColorPicker = ({\n defaultValue,\n value: _value,\n showText,\n disabled,\n className,\n onChange: _onChange = () => {},\n open: _open,\n defaultOpen,\n onOpenChange,\n ...props\n}: Props) => {\n const [value, setValue] = useControllableState<string>({\n value: _value,\n defaultValue: defaultValue ?? '#fff',\n onChange: _onChange,\n });\n const [open, setOpen] = useControllableState<boolean>({\n value: _open,\n defaultValue: defaultOpen ?? false,\n onChange: onOpenChange,\n });\n\n const onChange = (color: string) => {\n if (disabled) {\n return;\n }\n setValue(color);\n };\n\n return (\n <Popover\n placement=\"bottomLeft\"\n open={open}\n onOpenChange={setOpen}\n content={<HexColorPicker color={value} onChange={onChange} />}\n >\n <div\n role=\"button\"\n tabIndex={disabled ? -1 : 0}\n aria-disabled={disabled}\n className={cn(\n 'inline-flex items-center',\n 'rounded border p-0.5',\n disabled && 'cursor-not-allowed opacity-50',\n className,\n )}\n {...props}\n onClick={e => {\n if (disabled) {\n e.preventDefault();\n }\n }}\n onKeyDown={e => {\n if (disabled) {\n return;\n }\n if (e.key === 'Enter' || e.key === ' ') {\n e.preventDefault();\n e.currentTarget.click();\n }\n }}\n >\n <div\n className={cn(\n 'size-6 rounded border',\n 'shadow-sm',\n disabled ? 'cursor-not-allowed' : 'cursor-pointer',\n )}\n style={{ backgroundColor: value }}\n />\n {showText && (\n <span className=\"px-1 font-mono text-sm font-medium\">\n {value.toUpperCase()}\n </span>\n )}\n </div>\n </Popover>\n );\n};\n\nexport default ColorPicker;\n"],"mappings":";;;;;;;AAwBA,MAAM,eAAe,EACnB,cACA,OAAO,QACP,UACA,UACA,WACA,UAAU,kBAAkB,CAAC,GAC7B,MAAM,OACN,aACA,cACA,GAAG,YACQ;CACX,MAAM,CAAC,OAAO,YAAY,qBAA6B;EACrD,OAAO;EACP,cAAc,gBAAgB;EAC9B,UAAU;CACZ,CAAC;CACD,MAAM,CAAC,MAAM,WAAW,qBAA8B;EACpD,OAAO;EACP,cAAc,eAAe;EAC7B,UAAU;CACZ,CAAC;CAED,MAAM,YAAY,UAAkB;EAClC,IAAI,UACF;EAEF,SAAS,KAAK;CAChB;CAEA,OACE,oBAAC,SAAD;EACE,WAAU;EACJ;EACN,cAAc;EACd,SAAS,oBAAC,gBAAD;GAAgB,OAAO;GAAiB;EAAW,CAAA;EAE5D,UAAA,qBAAC,OAAD;GACE,MAAK;GACL,UAAU,WAAW,KAAK;GAC1B,iBAAe;GACf,WAAW,GACT,4BACA,wBACA,YAAY,iCACZ,SACF;GACA,GAAI;GACJ,UAAS,MAAK;IACZ,IAAI,UACF,EAAE,eAAe;GAErB;GACA,YAAW,MAAK;IACd,IAAI,UACF;IAEF,IAAI,EAAE,QAAQ,WAAW,EAAE,QAAQ,KAAK;KACtC,EAAE,eAAe;KACjB,EAAE,cAAc,MAAM;IACxB;GACF;GAxBF,UAAA,CA0BE,oBAAC,OAAD;IACE,WAAW,GACT,yBACA,aACA,WAAW,uBAAuB,gBACpC;IACA,OAAO,EAAE,iBAAiB,MAAM;GACjC,CAAA,GACA,YACC,oBAAC,QAAD;IAAM,WAAU;IACb,UAAA,MAAM,YAAY;GACf,CAAA,CAEL;;CACE,CAAA;AAEb"}
|
|
@@ -9,4 +9,4 @@ export interface Props extends Omit<useRender.ComponentProps<'div'>, 'className'
|
|
|
9
9
|
declare const Container: ({ className, maxWidth, padded, render, ...props }: Props) => import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>>;
|
|
10
10
|
//#endregion
|
|
11
11
|
export { Container as default };
|
|
12
|
-
//# sourceMappingURL=
|
|
12
|
+
//# sourceMappingURL=Container.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Container.d.mts","names":[],"sources":["../src/components/templates/container.tsx"],"mappings":";;KAMK;iBAmCY,cAAc,KAC7B,UAAU;EAGV,WAAW;EACX;EACA;;cAMI,cAAa,WAAA,UAAA,QAAA,WAAA,SAMhB,0BAAK,+CAAA"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { cn } from "
|
|
2
|
+
import { cn } from "./utils.mjs";
|
|
3
3
|
import { useRender } from "@base-ui/react/use-render";
|
|
4
4
|
//#region src/components/templates/container.tsx
|
|
5
5
|
const MAX_WIDTH_CLASSES = {
|
|
@@ -32,4 +32,4 @@ const Container = ({ className, maxWidth = "7xl", padded = true, render, ...prop
|
|
|
32
32
|
//#endregion
|
|
33
33
|
export { Container as default };
|
|
34
34
|
|
|
35
|
-
//# sourceMappingURL=
|
|
35
|
+
//# sourceMappingURL=Container.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Container.mjs","names":[],"sources":["../src/components/templates/container.tsx"],"sourcesContent":["'use client';\n\nimport { useRender } from '@base-ui/react/use-render';\n\nimport { cn } from '@repo/ui/utils';\n\ntype MaxWidth =\n | '3xs'\n | '2xs'\n | 'xs'\n | 'sm'\n | 'md'\n | 'lg'\n | 'xl'\n | '2xl'\n | '3xl'\n | '4xl'\n | '5xl'\n | '6xl'\n | '7xl'\n | 'full'\n | 'none';\n\nconst MAX_WIDTH_CLASSES: Record<MaxWidth, string> = {\n '3xs': 'max-w-3xs',\n '2xs': 'max-w-2xs',\n xs: 'max-w-xs',\n sm: 'max-w-sm',\n md: 'max-w-md',\n lg: 'max-w-lg',\n xl: 'max-w-xl',\n '2xl': 'max-w-2xl',\n '3xl': 'max-w-3xl',\n '4xl': 'max-w-4xl',\n '5xl': 'max-w-5xl',\n '6xl': 'max-w-6xl',\n '7xl': 'max-w-7xl',\n full: 'max-w-full',\n none: 'max-w-none',\n};\n\nexport interface Props extends Omit<\n useRender.ComponentProps<'div'>,\n 'className'\n> {\n maxWidth?: MaxWidth;\n padded?: boolean;\n className?: string;\n}\n\n// Standardizes the `mx-auto max-w-7xl px-4` wrapper every app in this\n// monorepo was rewriting by hand inside Content — one place to change the\n// page's content width/gutters instead of N call sites.\nconst Container = ({\n className,\n maxWidth = '7xl',\n padded = true,\n render,\n ...props\n}: Props) => {\n return useRender({\n defaultTagName: 'div',\n render,\n props: {\n ...props,\n className: cn(\n 'mx-auto w-full',\n MAX_WIDTH_CLASSES[maxWidth],\n padded && 'px-4 sm:px-6 lg:px-8',\n className,\n //\n ),\n },\n });\n};\n\nexport default Container;\n"],"mappings":";;;;AAuBA,MAAM,oBAA8C;CAClD,OAAO;CACP,OAAO;CACP,IAAI;CACJ,IAAI;CACJ,IAAI;CACJ,IAAI;CACJ,IAAI;CACJ,OAAO;CACP,OAAO;CACP,OAAO;CACP,OAAO;CACP,OAAO;CACP,OAAO;CACP,MAAM;CACN,MAAM;AACR;AAcA,MAAM,aAAa,EACjB,WACA,WAAW,OACX,SAAS,MACT,QACA,GAAG,YACQ;CACX,OAAO,UAAU;EACf,gBAAgB;EAChB;EACA,OAAO;GACL,GAAG;GACH,WAAW,GACT,kBACA,kBAAkB,WAClB,UAAU,wBACV,SAEF;EACF;CACF,CAAC;AACH"}
|
|
@@ -14,4 +14,4 @@ interface Props {
|
|
|
14
14
|
declare const DatePicker: ({ defaultValue, value: _value, placeholder, className, disabled, showTime, onChange: _onChange }: Props) => import("react").JSX.Element;
|
|
15
15
|
//#endregion
|
|
16
16
|
export { type Props, DatePicker as default };
|
|
17
|
-
//# sourceMappingURL=
|
|
17
|
+
//# sourceMappingURL=DatePicker.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DatePicker.d.mts","names":[],"sources":["../src/components/atoms/date-picker.tsx"],"mappings":";UAiBU;EACR,eAAe;EACf,QAAQ;EACR;EACA;EACA;;EAEA;IAAuB;;EACvB,YAAY,MAAM;;cAQd,eAAc,cAAA,OAAA,QAAA,aAAA,WAAA,UAAA,UAAA,UAAA,aAQjB,0BAAK,IAAA"}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { cn } from "
|
|
3
|
-
import { calendar_exports } from "
|
|
4
|
-
import Button from "
|
|
5
|
-
import Popover from "./
|
|
6
|
-
import TimePicker from "
|
|
2
|
+
import { cn } from "./utils.mjs";
|
|
3
|
+
import { calendar_exports } from "./core/calendar.mjs";
|
|
4
|
+
import Button from "./Button.mjs";
|
|
5
|
+
import Popover from "./Popover.mjs";
|
|
6
|
+
import TimePicker from "./TimePicker.mjs";
|
|
7
7
|
import { useState } from "react";
|
|
8
8
|
import { useControllableState } from "@jbpark/use-hooks";
|
|
9
9
|
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
@@ -85,4 +85,4 @@ const DatePicker = ({ defaultValue, value: _value, placeholder = "Pick a date",
|
|
|
85
85
|
//#endregion
|
|
86
86
|
export { DatePicker as default };
|
|
87
87
|
|
|
88
|
-
//# sourceMappingURL=
|
|
88
|
+
//# sourceMappingURL=DatePicker.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DatePicker.mjs","names":["calendar"],"sources":["../src/components/atoms/date-picker.tsx"],"sourcesContent":["'use client';\n\nimport { useState } from 'react';\n\nimport { useControllableState } from '@jbpark/use-hooks';\nimport { format } from 'date-fns';\nimport { CalendarIcon } from 'lucide-react';\n\nimport { cn } from '@repo/ui/utils';\n\nimport { calendar } from '../../core';\nimport Button from './button';\nimport Popover from './popover';\nimport TimePicker from './time-picker';\n\nconst { Calendar } = calendar;\n\ninterface Props {\n defaultValue?: Date;\n value?: Date;\n placeholder?: string;\n className?: string;\n disabled?: boolean;\n /** Pick a local date and time together. Optionally configure the minute interval. */\n showTime?: boolean | { minuteStep?: number };\n onChange?: (date: Date | undefined) => void;\n}\n\nconst toTimeValue = (date?: Date) =>\n date\n ? `${String(date.getHours()).padStart(2, '0')}:${String(date.getMinutes()).padStart(2, '0')}`\n : '00:00';\n\nconst DatePicker = ({\n defaultValue,\n value: _value,\n placeholder = 'Pick a date',\n className,\n disabled,\n showTime = false,\n onChange: _onChange = () => {},\n}: Props) => {\n const [value, onChange] = useControllableState<Date | undefined>({\n value: _value,\n defaultValue,\n onChange: _onChange,\n });\n const [open, setOpen] = useState(false);\n const [draftDate, setDraftDate] = useState<Date | undefined>(value);\n const [draftTime, setDraftTime] = useState(toTimeValue(value));\n const minuteStep =\n typeof showTime === 'object' ? showTime.minuteStep : undefined;\n\n const handleOpenChange = (nextOpen: boolean) => {\n if (nextOpen && showTime) {\n setDraftDate(value);\n setDraftTime(toTimeValue(value));\n }\n\n setOpen(nextOpen);\n };\n\n const handleConfirm = () => {\n if (!draftDate || !draftTime) return;\n\n const [hours, minutes] = draftTime.split(':').map(Number);\n\n onChange(\n new Date(\n draftDate.getFullYear(),\n draftDate.getMonth(),\n draftDate.getDate(),\n hours,\n minutes,\n ),\n );\n setOpen(false);\n };\n\n return (\n <Popover\n placement=\"bottomLeft\"\n open={open}\n onOpenChange={handleOpenChange}\n content={\n <>\n <Calendar\n mode=\"single\"\n selected={showTime ? draftDate : value}\n onSelect={date => {\n if (showTime) {\n setDraftDate(date);\n } else {\n onChange(date);\n setOpen(false);\n }\n }}\n />\n {showTime && (\n <div className=\"border-border flex flex-col gap-3 border-t p-3\">\n <TimePicker\n label=\"Time\"\n value={draftTime}\n onChange={time => setDraftTime(time ?? '')}\n minuteStep={minuteStep}\n allowClear={false}\n size=\"small\"\n />\n <div className=\"flex justify-end gap-2\">\n <Button size=\"small\" onClick={() => setOpen(false)}>\n Cancel\n </Button>\n <Button\n type=\"primary\"\n size=\"small\"\n disabled={!draftDate || !draftTime}\n onClick={handleConfirm}\n >\n OK\n </Button>\n </div>\n </div>\n )}\n </>\n }\n >\n <Button\n icon={<CalendarIcon />}\n data-empty={!value}\n disabled={disabled}\n className={cn(\n 'w-full justify-start text-left font-normal',\n 'data-[empty=true]:text-muted-foreground',\n className,\n //\n )}\n >\n {value ? format(value, showTime ? 'PPP HH:mm' : 'PPP') : placeholder}\n </Button>\n </Popover>\n );\n};\n\nexport default DatePicker;\nexport type { Props };\n"],"mappings":";;;;;;;;;;;;AAeA,MAAM,EAAE,aAAaA;AAarB,MAAM,eAAe,SACnB,OACI,GAAG,OAAO,KAAK,SAAS,CAAC,CAAC,CAAC,SAAS,GAAG,GAAG,EAAE,GAAG,OAAO,KAAK,WAAW,CAAC,CAAC,CAAC,SAAS,GAAG,GAAG,MACxF;AAEN,MAAM,cAAc,EAClB,cACA,OAAO,QACP,cAAc,eACd,WACA,UACA,WAAW,OACX,UAAU,kBAAkB,CAAC,QAClB;CACX,MAAM,CAAC,OAAO,YAAY,qBAAuC;EAC/D,OAAO;EACP;EACA,UAAU;CACZ,CAAC;CACD,MAAM,CAAC,MAAM,WAAW,SAAS,KAAK;CACtC,MAAM,CAAC,WAAW,gBAAgB,SAA2B,KAAK;CAClE,MAAM,CAAC,WAAW,gBAAgB,SAAS,YAAY,KAAK,CAAC;CAC7D,MAAM,aACJ,OAAO,aAAa,WAAW,SAAS,aAAa,KAAA;CAEvD,MAAM,oBAAoB,aAAsB;EAC9C,IAAI,YAAY,UAAU;GACxB,aAAa,KAAK;GAClB,aAAa,YAAY,KAAK,CAAC;EACjC;EAEA,QAAQ,QAAQ;CAClB;CAEA,MAAM,sBAAsB;EAC1B,IAAI,CAAC,aAAa,CAAC,WAAW;EAE9B,MAAM,CAAC,OAAO,WAAW,UAAU,MAAM,GAAG,CAAC,CAAC,IAAI,MAAM;EAExD,SACE,IAAI,KACF,UAAU,YAAY,GACtB,UAAU,SAAS,GACnB,UAAU,QAAQ,GAClB,OACA,OACF,CACF;EACA,QAAQ,KAAK;CACf;CAEA,OACE,oBAAC,SAAD;EACE,WAAU;EACJ;EACN,cAAc;EACd,SACE,qBAAA,YAAA,EAAA,UAAA,CACE,oBAAC,UAAD;GACE,MAAK;GACL,UAAU,WAAW,YAAY;GACjC,WAAU,SAAQ;IAChB,IAAI,UACF,aAAa,IAAI;SACZ;KACL,SAAS,IAAI;KACb,QAAQ,KAAK;IACf;GACF;EACD,CAAA,GACA,YACC,qBAAC,OAAD;GAAK,WAAU;GAAf,UAAA,CACE,oBAAC,YAAD;IACE,OAAM;IACN,OAAO;IACP,WAAU,SAAQ,aAAa,QAAQ,EAAE;IAC7B;IACZ,YAAY;IACZ,MAAK;GACN,CAAA,GACD,qBAAC,OAAD;IAAK,WAAU;IAAf,UAAA,CACE,oBAAC,QAAD;KAAQ,MAAK;KAAQ,eAAe,QAAQ,KAAK;KAAG,UAAA;IAE5C,CAAA,GACR,oBAAC,QAAD;KACE,MAAK;KACL,MAAK;KACL,UAAU,CAAC,aAAa,CAAC;KACzB,SAAS;KACV,UAAA;IAEO,CAAA,CACL;GACF,CAAA,CAAA;EAEP,CAAA,CAAA,EAAA,CAAA;EAGJ,UAAA,oBAAC,QAAD;GACE,MAAM,oBAAC,cAAD,CAAe,CAAA;GACrB,cAAY,CAAC;GACH;GACV,WAAW,GACT,8CACA,2CACA,SAEF;GAEC,UAAA,QAAQ,OAAO,OAAO,WAAW,cAAc,KAAK,IAAI;EACnD,CAAA;CACD,CAAA;AAEb"}
|
|
@@ -32,4 +32,4 @@ export interface Props {
|
|
|
32
32
|
declare const Drawer: ({ open, title, extra, footer, closable, closeIcon, direction, size, maskClosable, handlebar, rounded, mask, className, classNames, style, children, container, onClose, ...props }: Props) => import("react").JSX.Element;
|
|
33
33
|
//#endregion
|
|
34
34
|
export { Drawer as default };
|
|
35
|
-
//# sourceMappingURL=
|
|
35
|
+
//# sourceMappingURL=Drawer.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Drawer.d.mts","names":[],"sources":["../src/components/organisms/drawer.tsx"],"mappings":";iBA2CiB;EACf;EACA,WAAW,MAAM;EACjB,QAAQ,MAAM;EACd,QAAQ,MAAM;EACd,SAAS,MAAM;EACf;EACA,YAAY,MAAM;EAClB;EACA;EACA;EACA;EACA;EACA;EACA;EACA,QAAQ,MAAM;EACd;IACE;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;;EAEF,YAAY;EACZ;;cA+CI,WAAU,MAAA,OAAA,OAAA,QAAA,UAAA,WAAA,WAAA,MAAA,cAAA,WAAA,SAAA,MAAA,WAAA,YAAA,OAAA,UAAA,WAAA,YAAA,SAoBb,0BAAK,IAAA"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { cn } from "
|
|
3
|
-
import { DEFAULT_LOCALE, useConfig } from "
|
|
4
|
-
import Button from "
|
|
5
|
-
import { drawer_exports } from "
|
|
2
|
+
import { cn } from "./utils.mjs";
|
|
3
|
+
import { DEFAULT_LOCALE, useConfig } from "./providers/config/context.mjs";
|
|
4
|
+
import Button from "./Button.mjs";
|
|
5
|
+
import { drawer_exports } from "./core/drawer.mjs";
|
|
6
6
|
import { useEffect } from "react";
|
|
7
7
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
8
8
|
import { X } from "lucide-react";
|
|
@@ -130,4 +130,4 @@ const Drawer = ({ open, title, extra, footer, closable = true, closeIcon, direct
|
|
|
130
130
|
//#endregion
|
|
131
131
|
export { Drawer as default };
|
|
132
132
|
|
|
133
|
-
//# sourceMappingURL=
|
|
133
|
+
//# sourceMappingURL=Drawer.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Drawer.mjs","names":["drawer"],"sources":["../src/components/organisms/drawer.tsx"],"sourcesContent":["'use client';\n\nimport { useEffect } from 'react';\n\nimport { X } from 'lucide-react';\n\nimport { DEFAULT_LOCALE, useConfig } from '@repo/ui/providers';\nimport { cn } from '@repo/ui/utils';\n\nimport { drawer } from '../../core';\nimport Button from '../atoms/button';\n\nconst {\n DrawerContent,\n Drawer: DrawerCore,\n DrawerDescription,\n DrawerFooter,\n DrawerHeader,\n DrawerTitle,\n} = drawer;\n\n// `body.style.pointerEvents` is global state (per document), so several\n// mask-less overlays opening at once would otherwise race: each instance\n// would capture whatever the previous one had already written and the\n// last cleanup would restore a stale value. Reference counting makes only\n// the first instance capture the original value and only the last one\n// restore it. Keyed by document (not a single module-level counter) so\n// drawers portaled into different documents — e.g. live-editor's iframe\n// Renderer — don't share state with the host document.\ntype MaskLessState = { count: number; originalPointerEvents: string | null };\nconst maskLessStates = new WeakMap<Document, MaskLessState>();\n\nconst getMaskLessState = (doc: Document): MaskLessState => {\n let state = maskLessStates.get(doc);\n\n if (!state) {\n state = { count: 0, originalPointerEvents: null };\n maskLessStates.set(doc, state);\n }\n\n return state;\n};\n\nexport interface Props {\n open: boolean;\n children?: React.ReactNode;\n title?: React.ReactNode;\n extra?: React.ReactNode;\n footer?: React.ReactNode;\n closable?: boolean;\n closeIcon?: React.ReactNode;\n direction?: 'top' | 'bottom' | 'left' | 'right';\n size?: 'small' | 'middle' | 'medium' | 'large' | 'full' | string;\n maskClosable?: boolean;\n handlebar?: boolean;\n rounded?: boolean;\n mask?: boolean;\n className?: string;\n style?: React.CSSProperties;\n classNames?: {\n mask?: string;\n content?: string;\n handlebar?: string;\n header?: string;\n title?: string;\n close?: string;\n extra?: string;\n body?: string;\n footer?: string;\n };\n container?: HTMLElement;\n onClose: () => void;\n}\n\nconst SIZES: Record<string, string> = {\n small: '30%',\n middle: '50%',\n medium: '50%',\n large: '75%',\n full: '90%',\n};\n\n// Rounds the edge facing into the viewport — the opposite edge from\n// whichever side the drawer is anchored to.\nconst ROUNDED_CLASSES: Record<'top' | 'bottom' | 'left' | 'right', string> = {\n top: 'rounded-b-[30px]!',\n bottom: 'rounded-t-[30px]!',\n left: 'rounded-r-[30px]!',\n right: 'rounded-l-[30px]!',\n};\n\n// A side drawer sized by a preset is sized by a percentage of the viewport,\n// which collapses on a phone: `small` is 30%, so it lands at ~112px on a 375px\n// screen — a sliver too narrow to read. Floor the preset widths so they stay\n// usable on small screens. A custom `size` is passed through untouched; an\n// explicit value is the caller's decision, not something to second-guess.\nconst SIDE_MIN_WIDTH = '20rem';\n\nconst getSizeStyles = (\n direction: 'top' | 'bottom' | 'left' | 'right',\n size: string,\n): React.CSSProperties => {\n if (direction === 'top' || direction === 'bottom') {\n return { height: SIZES[size] || size };\n }\n\n const preset = SIZES[size];\n\n return {\n width: preset ? `max(${preset}, ${SIDE_MIN_WIDTH})` : size,\n // Set inline so it beats `core/drawer`'s `sm:max-w-sm`, which would\n // otherwise hold every side drawer at 24rem from the `sm` breakpoint up\n // and leave `size` with no effect on anything wider than a phone. It also\n // keeps the floor above from overflowing a container narrower than it.\n maxWidth: '100%',\n };\n};\n\nconst Drawer = ({\n open,\n title,\n extra,\n footer,\n closable = true,\n closeIcon,\n direction = 'bottom',\n size = 'middle',\n maskClosable = true,\n handlebar = true,\n rounded = false,\n mask = true,\n className,\n classNames,\n style,\n children,\n container,\n onClose,\n ...props\n}: Props) => {\n const { locale } = useConfig();\n\n useEffect(() => {\n if (!open || mask) {\n return;\n }\n\n const targetDocument = container?.ownerDocument ?? document;\n const targetWindow = targetDocument.defaultView ?? window;\n const body = targetDocument.body;\n const state = getMaskLessState(targetDocument);\n\n if (state.count === 0) {\n state.originalPointerEvents = body.style.pointerEvents;\n }\n state.count += 1;\n\n const raf = targetWindow.requestAnimationFrame(() => {\n body.style.pointerEvents = 'auto';\n });\n\n return () => {\n targetWindow.cancelAnimationFrame(raf);\n state.count -= 1;\n\n if (state.count === 0) {\n body.style.pointerEvents = state.originalPointerEvents ?? '';\n state.originalPointerEvents = null;\n }\n };\n }, [open, mask, container]);\n\n return (\n <DrawerCore\n open={open}\n // antd's mask ⇒ Base UI's modal (focus trap + scroll lock); maskClosable\n // gates outside-press dismissal at the root, replacing vaul's\n // Content-level onPointerDownOutside handler.\n modal={mask}\n disablePointerDismissal={!maskClosable}\n onOpenChange={open => {\n if (!open) {\n onClose();\n }\n }}\n {...props}\n >\n <DrawerContent\n direction={direction}\n container={container}\n className={cn(\n 'border-none outline-none',\n rounded ? ROUNDED_CLASSES[direction] : 'rounded-none!',\n classNames?.content,\n className,\n //\n )}\n handlebar={handlebar}\n mask={mask}\n classNames={{\n mask: classNames?.mask || '',\n handlebar: classNames?.handlebar || '',\n }}\n style={{\n ...getSizeStyles(direction, size),\n ...style,\n }}\n >\n <DrawerHeader\n className={cn(\n classNames?.header,\n !title && 'p-0',\n //\n )}\n >\n <div className=\"flex items-start gap-2\">\n {closable && (\n <Button\n variant=\"text\"\n shape=\"circle\"\n size=\"small\"\n aria-label={locale.close ?? DEFAULT_LOCALE.close}\n icon={closeIcon || <X />}\n onClick={onClose}\n className={cn(classNames?.close)}\n />\n )}\n <div className=\"flex flex-1 items-start justify-between gap-2\">\n <DrawerTitle className={cn(classNames?.title)}>\n {title}\n </DrawerTitle>\n {extra != null && (\n <div className={cn('shrink-0', classNames?.extra)}>{extra}</div>\n )}\n </div>\n </div>\n <DrawerDescription className=\"hidden\" />\n </DrawerHeader>\n <div\n className={cn(\n 'overflow-auto p-5',\n classNames?.body,\n //\n )}\n >\n {children}\n </div>\n {footer != null && (\n <DrawerFooter className={cn(classNames?.footer)}>\n {footer}\n </DrawerFooter>\n )}\n </DrawerContent>\n </DrawerCore>\n );\n};\n\nexport default Drawer;\n"],"mappings":";;;;;;;;;AAYA,MAAM,EACJ,eACA,QAAQ,YACR,mBACA,cACA,cACA,gBACEA;AAWJ,MAAM,iCAAiB,IAAI,QAAiC;AAE5D,MAAM,oBAAoB,QAAiC;CACzD,IAAI,QAAQ,eAAe,IAAI,GAAG;CAElC,IAAI,CAAC,OAAO;EACV,QAAQ;GAAE,OAAO;GAAG,uBAAuB;EAAK;EAChD,eAAe,IAAI,KAAK,KAAK;CAC/B;CAEA,OAAO;AACT;AAiCA,MAAM,QAAgC;CACpC,OAAO;CACP,QAAQ;CACR,QAAQ;CACR,OAAO;CACP,MAAM;AACR;AAIA,MAAM,kBAAuE;CAC3E,KAAK;CACL,QAAQ;CACR,MAAM;CACN,OAAO;AACT;AAOA,MAAM,iBAAiB;AAEvB,MAAM,iBACJ,WACA,SACwB;CACxB,IAAI,cAAc,SAAS,cAAc,UACvC,OAAO,EAAE,QAAQ,MAAM,SAAS,KAAK;CAGvC,MAAM,SAAS,MAAM;CAErB,OAAO;EACL,OAAO,SAAS,OAAO,OAAO,IAAI,eAAe,KAAK;EAKtD,UAAU;CACZ;AACF;AAEA,MAAM,UAAU,EACd,MACA,OACA,OACA,QACA,WAAW,MACX,WACA,YAAY,UACZ,OAAO,UACP,eAAe,MACf,YAAY,MACZ,UAAU,OACV,OAAO,MACP,WACA,YACA,OACA,UACA,WACA,SACA,GAAG,YACQ;CACX,MAAM,EAAE,WAAW,UAAU;CAE7B,gBAAgB;EACd,IAAI,CAAC,QAAQ,MACX;EAGF,MAAM,iBAAiB,WAAW,iBAAiB;EACnD,MAAM,eAAe,eAAe,eAAe;EACnD,MAAM,OAAO,eAAe;EAC5B,MAAM,QAAQ,iBAAiB,cAAc;EAE7C,IAAI,MAAM,UAAU,GAClB,MAAM,wBAAwB,KAAK,MAAM;EAE3C,MAAM,SAAS;EAEf,MAAM,MAAM,aAAa,4BAA4B;GACnD,KAAK,MAAM,gBAAgB;EAC7B,CAAC;EAED,aAAa;GACX,aAAa,qBAAqB,GAAG;GACrC,MAAM,SAAS;GAEf,IAAI,MAAM,UAAU,GAAG;IACrB,KAAK,MAAM,gBAAgB,MAAM,yBAAyB;IAC1D,MAAM,wBAAwB;GAChC;EACF;CACF,GAAG;EAAC;EAAM;EAAM;CAAS,CAAC;CAE1B,OACE,oBAAC,YAAD;EACQ;EAIN,OAAO;EACP,yBAAyB,CAAC;EAC1B,eAAc,SAAQ;GACpB,IAAI,CAAC,MACH,QAAQ;EAEZ;EACA,GAAI;EAEJ,UAAA,qBAAC,eAAD;GACa;GACA;GACX,WAAW,GACT,4BACA,UAAU,gBAAgB,aAAa,iBACvC,YAAY,SACZ,SAEF;GACW;GACL;GACN,YAAY;IACV,MAAM,YAAY,QAAQ;IAC1B,WAAW,YAAY,aAAa;GACtC;GACA,OAAO;IACL,GAAG,cAAc,WAAW,IAAI;IAChC,GAAG;GACL;GAnBF,UAAA;IAqBE,qBAAC,cAAD;KACE,WAAW,GACT,YAAY,QACZ,CAAC,SAAS,KAEZ;KALF,UAAA,CAOE,qBAAC,OAAD;MAAK,WAAU;MAAf,UAAA,CACG,YACC,oBAAC,QAAD;OACE,SAAQ;OACR,OAAM;OACN,MAAK;OACL,cAAY,OAAO,SAAS,eAAe;OAC3C,MAAM,aAAa,oBAAC,GAAD,CAAI,CAAA;OACvB,SAAS;OACT,WAAW,GAAG,YAAY,KAAK;MAChC,CAAA,GAEH,qBAAC,OAAD;OAAK,WAAU;OAAf,UAAA,CACE,oBAAC,aAAD;QAAa,WAAW,GAAG,YAAY,KAAK;QACzC,UAAA;OACU,CAAA,GACZ,SAAS,QACR,oBAAC,OAAD;QAAK,WAAW,GAAG,YAAY,YAAY,KAAK;QAAI,UAAA;OAAW,CAAA,CAE9D;MACF,CAAA,CAAA;KACL,CAAA,GAAA,oBAAC,mBAAD,EAAmB,WAAU,SAAU,CAAA,CAC3B;;IACd,oBAAC,OAAD;KACE,WAAW,GACT,qBACA,YAAY,IAEd;KAEC;IACE,CAAA;IACJ,UAAU,QACT,oBAAC,cAAD;KAAc,WAAW,GAAG,YAAY,MAAM;KAC3C,UAAA;IACW,CAAA;GAEH;;CACL,CAAA;AAEhB"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { MenuProps } from "./menu/menu.mjs";
|
|
1
|
+
import { MenuProps } from "./components/molecules/menu/menu.mjs";
|
|
2
2
|
//#region src/components/molecules/dropdown.d.ts
|
|
3
3
|
type ChangeEventHandler = (open: boolean) => void;
|
|
4
4
|
export interface Props extends React.ComponentPropsWithoutRef<'div'> {
|
|
@@ -10,4 +10,4 @@ export interface Props extends React.ComponentPropsWithoutRef<'div'> {
|
|
|
10
10
|
declare const Dropdown: ({ children, menu, trigger, open: _open, onOpenChange: _onOpenChange, className, onMouseEnter, onMouseLeave, ...props }: Props) => import("react").JSX.Element;
|
|
11
11
|
//#endregion
|
|
12
12
|
export { Dropdown as default };
|
|
13
|
-
//# sourceMappingURL=
|
|
13
|
+
//# sourceMappingURL=Dropdown.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Dropdown.d.mts","names":[],"sources":["../src/components/molecules/dropdown.tsx"],"mappings":";;KAYK,sBAAsB;iBAEV,cAAc,MAAM;EACnC;EACA;EACA,OAAO;EACP,eAAe;;cAGX,aAAY,UAAA,MAAA,SAAA,MAAA,OAAA,cAAA,eAAA,WAAA,cAAA,iBAAA,SAUf,0BAAK,IAAA"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { cn } from "
|
|
3
|
-
import "
|
|
4
|
-
import Menu from "./menu/menu.mjs";
|
|
2
|
+
import { cn } from "./utils.mjs";
|
|
3
|
+
import "./lib/z-layers.mjs";
|
|
4
|
+
import Menu from "./components/molecules/menu/menu.mjs";
|
|
5
5
|
import { useId, useRef } from "react";
|
|
6
6
|
import { useControllableState, useKeyPress } from "@jbpark/use-hooks";
|
|
7
7
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
@@ -88,4 +88,4 @@ const Dropdown = ({ children, menu, trigger = "hover", open: _open, onOpenChange
|
|
|
88
88
|
//#endregion
|
|
89
89
|
export { Dropdown as default };
|
|
90
90
|
|
|
91
|
-
//# sourceMappingURL=
|
|
91
|
+
//# sourceMappingURL=Dropdown.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Dropdown.mjs","names":[],"sources":["../src/components/molecules/dropdown.tsx"],"sourcesContent":["'use client';\n\nimport { useId, useRef } from 'react';\n\nimport { useControllableState, useKeyPress } from '@jbpark/use-hooks';\nimport { AnimatePresence, motion } from 'motion/react';\n\nimport { cn } from '@repo/ui/utils';\n\nimport { OVERLAY_LAYER } from '../../lib/z-layers';\nimport Menu, { MenuProps } from './menu';\n\ntype ChangeEventHandler = (open: boolean) => void;\n\nexport interface Props extends React.ComponentPropsWithoutRef<'div'> {\n open?: boolean;\n trigger?: 'hover' | 'click';\n menu?: MenuProps;\n onOpenChange?: ChangeEventHandler;\n}\n\nconst Dropdown = ({\n children,\n menu,\n trigger = 'hover',\n open: _open,\n onOpenChange: _onOpenChange = () => {},\n className,\n onMouseEnter,\n onMouseLeave,\n ...props\n}: Props) => {\n const [open, onOpenChange] = useControllableState<boolean>({\n value: _open,\n defaultValue: false,\n onChange: _onOpenChange,\n });\n\n const isClickTrigger = trigger === 'click';\n const menuId = useId();\n const containerRef = useRef<HTMLDivElement>(null);\n const triggerRef = useRef<HTMLDivElement>(null);\n\n useKeyPress(\n 'esc',\n () => {\n onOpenChange(false);\n },\n { target: triggerRef },\n );\n\n useKeyPress(\n ['Enter', 'space'],\n event => {\n event.preventDefault();\n onOpenChange(!open);\n },\n { target: triggerRef, enabled: isClickTrigger },\n );\n\n return (\n <div\n {...props}\n ref={containerRef}\n className={cn(\n 'relative',\n 'inline-block cursor-pointer',\n className,\n //\n )}\n onMouseEnter={event => {\n onMouseEnter?.(event);\n if (isClickTrigger) {\n return;\n }\n onOpenChange(true);\n }}\n onMouseLeave={event => {\n onMouseLeave?.(event);\n if (isClickTrigger) {\n return;\n }\n onOpenChange(false);\n }}\n >\n <div\n ref={triggerRef}\n role={isClickTrigger ? 'button' : undefined}\n tabIndex={isClickTrigger ? 0 : undefined}\n aria-haspopup=\"menu\"\n aria-expanded={open}\n aria-controls={open ? menuId : undefined}\n onClick={() => {\n if (!isClickTrigger) {\n return;\n }\n onOpenChange(!open);\n }}\n onFocus={() => {\n if (isClickTrigger) {\n return;\n }\n onOpenChange(true);\n }}\n onBlur={e => {\n // Without this check, moving focus from the trigger into the\n // menu itself (e.g. via Tab) closed the dropdown before the\n // user could ever reach it — the mouse path avoided the same\n // bug only by way of onMouseDown's preventDefault below, which\n // does nothing for keyboard focus. Mirrors the containment\n // check menu/item/item.tsx already uses for the same reason.\n if (!containerRef.current?.contains(e.relatedTarget as Node)) {\n onOpenChange(false);\n }\n }}\n >\n {children}\n </div>\n <AnimatePresence>\n {open && (\n <motion.div\n className={cn(\n 'absolute top-full pt-2',\n OVERLAY_LAYER,\n //\n )}\n initial={{ opacity: 0, y: -10 }}\n animate={{ opacity: 1, y: 0 }}\n exit={{ opacity: 0, y: -10 }}\n transition={{ duration: 0.1 }}\n >\n <Menu\n {...menu}\n id={menuId}\n onMouseDown={e => {\n e.preventDefault();\n }}\n />\n </motion.div>\n )}\n </AnimatePresence>\n </div>\n );\n};\n\nexport default Dropdown;\n"],"mappings":";;;;;;;;;AAqBA,MAAM,YAAY,EAChB,UACA,MACA,UAAU,SACV,MAAM,OACN,cAAc,sBAAsB,CAAC,GACrC,WACA,cACA,cACA,GAAG,YACQ;CACX,MAAM,CAAC,MAAM,gBAAgB,qBAA8B;EACzD,OAAO;EACP,cAAc;EACd,UAAU;CACZ,CAAC;CAED,MAAM,iBAAiB,YAAY;CACnC,MAAM,SAAS,MAAM;CACrB,MAAM,eAAe,OAAuB,IAAI;CAChD,MAAM,aAAa,OAAuB,IAAI;CAE9C,YACE,aACM;EACJ,aAAa,KAAK;CACpB,GACA,EAAE,QAAQ,WAAW,CACvB;CAEA,YACE,CAAC,SAAS,OAAO,IACjB,UAAS;EACP,MAAM,eAAe;EACrB,aAAa,CAAC,IAAI;CACpB,GACA;EAAE,QAAQ;EAAY,SAAS;CAAe,CAChD;CAEA,OACE,qBAAC,OAAD;EACE,GAAI;EACJ,KAAK;EACL,WAAW,GACT,YACA,+BACA,SAEF;EACA,eAAc,UAAS;GACrB,eAAe,KAAK;GACpB,IAAI,gBACF;GAEF,aAAa,IAAI;EACnB;EACA,eAAc,UAAS;GACrB,eAAe,KAAK;GACpB,IAAI,gBACF;GAEF,aAAa,KAAK;EACpB;EAtBF,UAAA,CAwBE,oBAAC,OAAD;GACE,KAAK;GACL,MAAM,iBAAiB,WAAW,KAAA;GAClC,UAAU,iBAAiB,IAAI,KAAA;GAC/B,iBAAc;GACd,iBAAe;GACf,iBAAe,OAAO,SAAS,KAAA;GAC/B,eAAe;IACb,IAAI,CAAC,gBACH;IAEF,aAAa,CAAC,IAAI;GACpB;GACA,eAAe;IACb,IAAI,gBACF;IAEF,aAAa,IAAI;GACnB;GACA,SAAQ,MAAK;IAOX,IAAI,CAAC,aAAa,SAAS,SAAS,EAAE,aAAqB,GACzD,aAAa,KAAK;GAEtB;GAEC;EACE,CAAA,GACL,oBAAC,iBAAD,EAAA,UACG,QACC,oBAAC,OAAO,KAAR;GACE,WAAW,GACT,0BAAA,QAGF;GACA,SAAS;IAAE,SAAS;IAAG,GAAG;GAAI;GAC9B,SAAS;IAAE,SAAS;IAAG,GAAG;GAAE;GAC5B,MAAM;IAAE,SAAS;IAAG,GAAG;GAAI;GAC3B,YAAY,EAAE,UAAU,GAAI;GAE5B,UAAA,oBAAC,MAAD;IACE,GAAI;IACJ,IAAI;IACJ,cAAa,MAAK;KAChB,EAAE,eAAe;IACnB;GACD,CAAA;EACS,CAAA,EAEC,CAAA,CACd;;AAET"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
//#region src/components/
|
|
1
|
+
//#region src/components/molecules/empty.d.ts
|
|
2
2
|
export interface Props extends Omit<React.ComponentProps<'div'>, 'title'> {
|
|
3
3
|
icon?: React.ReactNode;
|
|
4
4
|
title?: React.ReactNode;
|
|
@@ -8,4 +8,4 @@ export interface Props extends Omit<React.ComponentProps<'div'>, 'title'> {
|
|
|
8
8
|
declare const Empty: ({ icon, title, description, action, className, ...props }: Props) => import("react").JSX.Element;
|
|
9
9
|
//#endregion
|
|
10
10
|
export { Empty as default };
|
|
11
|
-
//# sourceMappingURL=
|
|
11
|
+
//# sourceMappingURL=Empty.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Empty.d.mts","names":[],"sources":["../src/components/molecules/empty.tsx"],"mappings":";iBAIiB,cAAc,KAAK,MAAM;EACxC,OAAO,MAAM;EACb,QAAQ,MAAM;EACd,cAAc,MAAM;EACpB,SAAS,MAAM;;cAQX,UAAS,MAAA,OAAA,aAAA,QAAA,cAAA,SAOZ,0BAAK,IAAA"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { cn } from "
|
|
1
|
+
import { cn } from "./utils.mjs";
|
|
2
2
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
3
|
import { Inbox } from "lucide-react";
|
|
4
|
-
//#region src/components/
|
|
4
|
+
//#region src/components/molecules/empty.tsx
|
|
5
5
|
const Empty = ({ icon, title, description = "No data", action, className, ...props }) => {
|
|
6
6
|
return /* @__PURE__ */ jsxs("div", {
|
|
7
7
|
"data-slot": "empty",
|
|
@@ -31,4 +31,4 @@ const Empty = ({ icon, title, description = "No data", action, className, ...pro
|
|
|
31
31
|
//#endregion
|
|
32
32
|
export { Empty as default };
|
|
33
33
|
|
|
34
|
-
//# sourceMappingURL=
|
|
34
|
+
//# sourceMappingURL=Empty.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Empty.mjs","names":[],"sources":["../src/components/molecules/empty.tsx"],"sourcesContent":["import { Inbox } from 'lucide-react';\n\nimport { cn } from '@repo/ui/utils';\n\nexport interface Props extends Omit<React.ComponentProps<'div'>, 'title'> {\n icon?: React.ReactNode;\n title?: React.ReactNode;\n description?: React.ReactNode;\n action?: React.ReactNode;\n}\n\n// The counterpart List's `empty` prop was asking for — List/Upload/Swiper\n// each render arbitrary content for their empty state today with nothing\n// in the library actually meant to go there. Pairs with Skeleton the same\n// way Skeleton pairs with real content: one placeholder for \"nothing\n// loaded yet\", one for \"loaded, and there's nothing\".\nconst Empty = ({\n icon,\n title,\n description = 'No data',\n action,\n className,\n ...props\n}: Props) => {\n return (\n <div\n data-slot=\"empty\"\n role=\"status\"\n className={cn(\n 'flex flex-col items-center justify-center gap-3 py-12 text-center',\n className,\n //\n )}\n {...props}\n >\n <div className=\"text-muted-foreground [&_svg]:size-12\">\n {icon ?? <Inbox />}\n </div>\n {title && <p className=\"text-sm font-medium\">{title}</p>}\n {description && (\n <p className=\"text-muted-foreground text-sm\">{description}</p>\n )}\n {action && <div className=\"mt-1\">{action}</div>}\n </div>\n );\n};\n\nexport default Empty;\n"],"mappings":";;;;AAgBA,MAAM,SAAS,EACb,MACA,OACA,cAAc,WACd,QACA,WACA,GAAG,YACQ;CACX,OACE,qBAAC,OAAD;EACE,aAAU;EACV,MAAK;EACL,WAAW,GACT,qEACA,SAEF;EACA,GAAI;EARN,UAAA;GAUE,oBAAC,OAAD;IAAK,WAAU;IACZ,UAAA,QAAQ,oBAAC,OAAD,CAAQ,CAAA;GACd,CAAA;GACJ,SAAS,oBAAC,KAAD;IAAG,WAAU;IAAuB,UAAA;GAAS,CAAA;GACtD,eACC,oBAAC,KAAD;IAAG,WAAU;IAAiC,UAAA;GAAe,CAAA;GAE9D,UAAU,oBAAC,OAAD;IAAK,WAAU;IAAQ,UAAA;GAAY,CAAA;EAC3C;;AAET"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import BackTop from "./components/atoms/float-button/back-top.mjs";
|
|
2
|
+
import FloatButton$1, { Props } from "./components/atoms/float-button/float-button.mjs";
|
|
3
|
+
//#region src/components/atoms/float-button/index.d.ts
|
|
4
|
+
type FloatButtonComponent = typeof FloatButton$1 & {
|
|
5
|
+
BackTop: typeof BackTop;
|
|
6
|
+
};
|
|
7
|
+
declare const FloatButton: FloatButtonComponent;
|
|
8
|
+
//#endregion
|
|
9
|
+
export { type Props, FloatButton as default };
|
|
10
|
+
//# sourceMappingURL=FloatButton.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FloatButton.d.mts","names":["FloatButtonImpl"],"sources":["../src/components/atoms/float-button/index.ts"],"mappings":";;;KAGK,8BAA8BA;EACjC,gBAAgB;;cAGZ,aAAiC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import FloatButton$1 from "./components/atoms/float-button/float-button.mjs";
|
|
2
|
+
import BackTop from "./components/atoms/float-button/back-top.mjs";
|
|
3
|
+
//#region src/components/atoms/float-button/index.ts
|
|
4
|
+
const FloatButton = FloatButton$1;
|
|
5
|
+
FloatButton.BackTop = BackTop;
|
|
6
|
+
//#endregion
|
|
7
|
+
export { FloatButton as default };
|
|
8
|
+
|
|
9
|
+
//# sourceMappingURL=FloatButton.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FloatButton.mjs","names":["FloatButtonImpl"],"sources":["../src/components/atoms/float-button/index.ts"],"sourcesContent":["import BackTop from './back-top';\nimport FloatButtonImpl, { type Props } from './float-button';\n\ntype FloatButtonComponent = typeof FloatButtonImpl & {\n BackTop: typeof BackTop;\n};\n\nconst FloatButton = FloatButtonImpl as FloatButtonComponent;\n\nFloatButton.BackTop = BackTop;\n\nexport default FloatButton;\nexport type { Props };\n"],"mappings":";;;AAOA,MAAM,cAAcA;AAEpB,YAAY,UAAU"}
|
package/dist/Input.d.mts
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import Input$1, { Props as Props$2 } from "./components/atoms/input/input.mjs";
|
|
2
|
+
import Number, { Props } from "./components/atoms/input/number.mjs";
|
|
3
|
+
import OTP, { Props as Props$1 } from "./components/atoms/input/otp.mjs";
|
|
4
|
+
import Search from "./components/atoms/input/search.mjs";
|
|
5
|
+
import TextArea from "./components/atoms/input/text-area.mjs";
|
|
6
|
+
//#region src/components/atoms/input/index.d.ts
|
|
7
|
+
type InputComponent = typeof Input$1 & {
|
|
8
|
+
Search: typeof Search;
|
|
9
|
+
Number: typeof Number;
|
|
10
|
+
OTP: typeof OTP;
|
|
11
|
+
TextArea: typeof TextArea;
|
|
12
|
+
};
|
|
13
|
+
declare const Input: InputComponent;
|
|
14
|
+
//#endregion
|
|
15
|
+
export { Number, type Props as NumberProps, OTP, type Props$1 as OTPProps, type Props$2 as Props, Search, TextArea, Input as default };
|
|
16
|
+
//# sourceMappingURL=Input.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Input.d.mts","names":["InputImpl"],"sources":["../src/components/atoms/input/index.ts"],"mappings":";;;;;;KAMK,wBAAwBA;EAC3B,eAAe;EACf,eAAe;EACf,YAAY;EACZ,iBAAiB;;cAGb,OAAqB"}
|
package/dist/Input.mjs
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import Input$1 from "./components/atoms/input/input.mjs";
|
|
2
|
+
import Number from "./components/atoms/input/number.mjs";
|
|
3
|
+
import OTP from "./components/atoms/input/otp.mjs";
|
|
4
|
+
import Search from "./components/atoms/input/search.mjs";
|
|
5
|
+
import TextArea from "./components/atoms/input/text-area.mjs";
|
|
6
|
+
//#region src/components/atoms/input/index.ts
|
|
7
|
+
const Input = Input$1;
|
|
8
|
+
Input.Search = Search;
|
|
9
|
+
Input.Number = Number;
|
|
10
|
+
Input.OTP = OTP;
|
|
11
|
+
Input.TextArea = TextArea;
|
|
12
|
+
//#endregion
|
|
13
|
+
export { Number, OTP, Search, TextArea, Input as default };
|
|
14
|
+
|
|
15
|
+
//# sourceMappingURL=Input.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Input.mjs","names":["InputImpl"],"sources":["../src/components/atoms/input/index.ts"],"sourcesContent":["import InputImpl, { type Props } from './input';\nimport Number from './number';\nimport OTP from './otp';\nimport Search from './search';\nimport TextArea from './text-area';\n\ntype InputComponent = typeof InputImpl & {\n Search: typeof Search;\n Number: typeof Number;\n OTP: typeof OTP;\n TextArea: typeof TextArea;\n};\n\nconst Input = InputImpl as InputComponent;\n\nInput.Search = Search;\nInput.Number = Number;\nInput.OTP = OTP;\nInput.TextArea = TextArea;\n\nexport { Number, OTP, Search, TextArea };\nexport type { Props as OTPProps } from './otp';\nexport type { Props as NumberProps } from './number';\nexport default Input;\nexport type { Props };\n"],"mappings":";;;;;;AAaA,MAAM,QAAQA;AAEd,MAAM,SAAS;AACf,MAAM,SAAS;AACf,MAAM,MAAM;AACZ,MAAM,WAAW"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import Item from "./item.mjs";
|
|
2
|
-
import List$1, { Props } from "./list.mjs";
|
|
1
|
+
import Item from "./components/organisms/list/item.mjs";
|
|
2
|
+
import List$1, { Props } from "./components/organisms/list/list.mjs";
|
|
3
3
|
//#region src/components/organisms/list/index.d.ts
|
|
4
4
|
type ListComponent = typeof List$1 & {
|
|
5
5
|
Item: typeof Item;
|
|
@@ -7,4 +7,4 @@ type ListComponent = typeof List$1 & {
|
|
|
7
7
|
declare const List: ListComponent;
|
|
8
8
|
//#endregion
|
|
9
9
|
export { type Props as ListProps, List as default };
|
|
10
|
-
//# sourceMappingURL=
|
|
10
|
+
//# sourceMappingURL=List.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"List.d.mts","names":["ListImpl"],"sources":["../src/components/organisms/list/index.ts"],"mappings":";;;KAGK,uBAAuBA;EAAa,aAAa;;cAEhD,MAAmB"}
|
package/dist/List.mjs
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import Item from "./components/organisms/list/item.mjs";
|
|
2
|
+
import List$1 from "./components/organisms/list/list.mjs";
|
|
3
|
+
//#region src/components/organisms/list/index.ts
|
|
4
|
+
const List = List$1;
|
|
5
|
+
List.Item = Item;
|
|
6
|
+
//#endregion
|
|
7
|
+
export { List as default };
|
|
8
|
+
|
|
9
|
+
//# sourceMappingURL=List.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"List.mjs","names":["ListImpl"],"sources":["../src/components/organisms/list/index.ts"],"sourcesContent":["import Item from './item';\nimport ListImpl from './list';\n\ntype ListComponent = typeof ListImpl & { Item: typeof Item };\n\nconst List = ListImpl as ListComponent;\n\nList.Item = Item;\n\nexport default List;\nexport type { Props as ListProps } from './list';\n"],"mappings":";;;AAKA,MAAM,OAAOA;AAEb,KAAK,OAAO"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import Item, { ItemProps } from "./components/molecules/marquees/item.mjs";
|
|
2
|
+
import Marquees$1, { Props } from "./components/molecules/marquees/marquees.mjs";
|
|
3
|
+
//#region src/components/molecules/marquees/index.d.ts
|
|
4
|
+
type MarqueesComponent = typeof Marquees$1 & {
|
|
5
|
+
Item: typeof Item;
|
|
6
|
+
};
|
|
7
|
+
declare const Marquees: MarqueesComponent;
|
|
8
|
+
//#endregion
|
|
9
|
+
export { Item, type ItemProps, type Props as MarqueesProps, type Props, Marquees as default };
|
|
10
|
+
//# sourceMappingURL=Marquees.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Marquees.d.mts","names":["MarqueesImpl"],"sources":["../src/components/molecules/marquees/index.ts"],"mappings":";;;KAGK,2BAA2BA;EAAiB,aAAa;;cAExD,UAA2B"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import Item from "./components/molecules/marquees/item.mjs";
|
|
2
|
+
import Marquees$1 from "./components/molecules/marquees/marquees.mjs";
|
|
3
|
+
//#region src/components/molecules/marquees/index.ts
|
|
4
|
+
const Marquees = Marquees$1;
|
|
5
|
+
Marquees.Item = Item;
|
|
6
|
+
//#endregion
|
|
7
|
+
export { Item, Marquees as default };
|
|
8
|
+
|
|
9
|
+
//# sourceMappingURL=Marquees.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Marquees.mjs","names":["MarqueesImpl"],"sources":["../src/components/molecules/marquees/index.ts"],"sourcesContent":["import Item from './item';\nimport MarqueesImpl, { type Props } from './marquees';\n\ntype MarqueesComponent = typeof MarqueesImpl & { Item: typeof Item };\n\nconst Marquees = MarqueesImpl as MarqueesComponent;\n\nMarquees.Item = Item;\n\nexport default Marquees;\nexport { Item };\nexport type { ItemProps } from './item';\nexport type { Props, Props as MarqueesProps };\n"],"mappings":";;;AAKA,MAAM,WAAWA;AAEjB,SAAS,OAAO"}
|
package/dist/Mentions.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Mentions.d.mts","names":[],"sources":["../src/components/atoms/mentions.tsx"],"mappings":";;
|
|
1
|
+
{"version":3,"file":"Mentions.d.mts","names":[],"sources":["../src/components/atoms/mentions.tsx"],"mappings":";;iBAwBiB;;EAEf;EACA;EACA;EACA;;iBAGe,cAAc,KAC7B;EAGA,kBAAkB;EAClB;EACA;EACA,YAAY;EACZ,YAAY,QAAQ,QAAQ;EAC5B,YAAY,eAAe;EAC3B;EACA,yBAAyB,eAAe,QAAQ;EAChD;EACA,cAAc;EACd,YAAY;EACZ,YAAY;EACZ;IACE;IACA;IACA;IACA;IACA;;;cAkBE,aAAY,SAAA,OAAA,cAAA,UAAA,UAAA,UAAA,UAAA,cAAA,SAAA,aAAA,WAAA,WAAA,UAAA,UAAA,MAAA,MAAA,WAAA,YAAA,KAAA,KAAA,SAAA,QAAA,SAAA,WAAA,SAAA,oBAAA,qBAAA,SA6Bf,0BAAK,IAAA"}
|
package/dist/Mentions.mjs
CHANGED
|
@@ -2,10 +2,10 @@
|
|
|
2
2
|
import { cn } from "./utils.mjs";
|
|
3
3
|
import { useConfig } from "./providers/config/context.mjs";
|
|
4
4
|
import { autocomplete_exports } from "./core/autocomplete.mjs";
|
|
5
|
-
import Input from "./
|
|
5
|
+
import Input from "./Input.mjs";
|
|
6
6
|
import { findToken, insertToken } from "./components/atoms/mentions-token.mjs";
|
|
7
7
|
import { useEffect, useRef, useState } from "react";
|
|
8
|
-
import { useControllableState, useMergedRef } from "@jbpark/use-hooks";
|
|
8
|
+
import { useControllableState, useLatest, useMergedRef } from "@jbpark/use-hooks";
|
|
9
9
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
10
10
|
//#region src/components/atoms/mentions.tsx
|
|
11
11
|
const DEFAULT_PREFIXES = ["@"];
|
|
@@ -45,13 +45,14 @@ const Mentions = ({ options, value, defaultValue = "", onChange, onSelect, onSea
|
|
|
45
45
|
const open = token !== null && !dismissed.includes(signature);
|
|
46
46
|
const query = token?.query;
|
|
47
47
|
const prefix = token?.prefix;
|
|
48
|
-
const searchRef =
|
|
49
|
-
useEffect(() => {
|
|
50
|
-
searchRef.current = onSearch;
|
|
51
|
-
}, [onSearch]);
|
|
48
|
+
const searchRef = useLatest(onSearch);
|
|
52
49
|
useEffect(() => {
|
|
53
50
|
if (query !== void 0 && prefix !== void 0) searchRef.current?.(query, prefix);
|
|
54
|
-
}, [
|
|
51
|
+
}, [
|
|
52
|
+
query,
|
|
53
|
+
prefix,
|
|
54
|
+
searchRef
|
|
55
|
+
]);
|
|
55
56
|
useEffect(() => {
|
|
56
57
|
const pending = pendingCaret.current;
|
|
57
58
|
const textarea = textareaRef.current;
|