@bikdotai/bik-component-library 0.0.802-beta.1 → 0.0.802-beta.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (31) hide show
  1. package/dist/cjs/editor/BikEditor.js +1 -1
  2. package/dist/cjs/editor/BikEditor.js.map +1 -1
  3. package/dist/cjs/editor/BikEditor.styles.js +0 -2
  4. package/dist/cjs/editor/BikEditor.styles.js.map +1 -1
  5. package/dist/cjs/editor/BikEditor.types.js.map +1 -1
  6. package/dist/cjs/editor/extensions/editorDropdown.styles.js +17 -5
  7. package/dist/cjs/editor/extensions/editorDropdown.styles.js.map +1 -1
  8. package/dist/cjs/editor/extensions/mention/MentionDropdown.js +1 -1
  9. package/dist/cjs/editor/extensions/mention/MentionDropdown.js.map +1 -1
  10. package/dist/cjs/editor/extensions/plainClipboard/PlainClipboardExtension.js +1 -1
  11. package/dist/cjs/editor/extensions/plainClipboard/PlainClipboardExtension.js.map +1 -1
  12. package/dist/cjs/editor/extensions/slashCommand/SlashCommandMenu.js +1 -1
  13. package/dist/cjs/editor/extensions/slashCommand/SlashCommandMenu.js.map +1 -1
  14. package/dist/cjs/src/editor/BikEditor.types.d.ts +2 -2
  15. package/dist/cjs/src/editor/extensions/editorDropdown.styles.d.ts +1 -0
  16. package/dist/esm/editor/BikEditor.js +1 -1
  17. package/dist/esm/editor/BikEditor.js.map +1 -1
  18. package/dist/esm/editor/BikEditor.styles.js +0 -2
  19. package/dist/esm/editor/BikEditor.styles.js.map +1 -1
  20. package/dist/esm/editor/BikEditor.types.js.map +1 -1
  21. package/dist/esm/editor/extensions/editorDropdown.styles.js +27 -15
  22. package/dist/esm/editor/extensions/editorDropdown.styles.js.map +1 -1
  23. package/dist/esm/editor/extensions/mention/MentionDropdown.js +1 -1
  24. package/dist/esm/editor/extensions/mention/MentionDropdown.js.map +1 -1
  25. package/dist/esm/editor/extensions/plainClipboard/PlainClipboardExtension.js +1 -1
  26. package/dist/esm/editor/extensions/plainClipboard/PlainClipboardExtension.js.map +1 -1
  27. package/dist/esm/editor/extensions/slashCommand/SlashCommandMenu.js +1 -1
  28. package/dist/esm/editor/extensions/slashCommand/SlashCommandMenu.js.map +1 -1
  29. package/dist/esm/src/editor/BikEditor.types.d.ts +2 -2
  30. package/dist/esm/src/editor/extensions/editorDropdown.styles.d.ts +1 -0
  31. package/package.json +1 -1
@@ -1,2 +1,2 @@
1
- import{jsx as e,Fragment as r,jsxs as n}from"react/jsx-runtime";import{forwardRef as t,useState as o,useImperativeHandle as i,useEffect as l}from"react";import{DropdownContainer as c,DropdownItem as d,SlashLabel as m,SlashDescription as s}from"../editorDropdown.styles.js";const a=t(((t,a)=>{let{items:h,query:p,command:u,renderItem:y,renderDropdown:w}=t;const[g,k]=o(0),D=e=>{h[e]&&u(h[e])};return i(a,(()=>({onKeyDown:e=>{let{event:r}=e;return"ArrowUp"===r.key?(k((e=>(e+h.length-1)%h.length)),!0):"ArrowDown"===r.key?(k((e=>(e+1)%h.length)),!0):"Enter"===r.key&&(D(g),!0)}}))),l((()=>k(0)),[h]),h.length?w?e(r,{children:w({items:h,query:p,activeIndex:g,onSelect:e=>u(e)})}):e(c,{children:h.map(((t,o)=>e(d,Object.assign({$isActive:o===g,onMouseEnter:()=>k(o),onClick:()=>D(o)},{children:y?y(t,o===g):n(r,{children:[e(m,{children:t.label}),t.description&&e(s,{children:t.description})]})}),t.id)))}):null}));a.displayName="SlashCommandMenu";export{a as SlashCommandMenu};
1
+ import{jsx as e,Fragment as n,jsxs as r}from"react/jsx-runtime";import{forwardRef as t,useState as o,useRef as l,useCallback as i,useImperativeHandle as c,useEffect as s}from"react";import{DropdownContainer as d,DropdownItem as m,SlashLabel as u,SlashDescription as a}from"../editorDropdown.styles.js";const h=t(((t,h)=>{let{items:p,query:y,command:w,renderItem:g,renderDropdown:f}=t;const[k,b]=o(0),j=l(null),D=i((e=>{const n=j.current;if(!n)return;const r=n.children[e];null==r||r.scrollIntoView({block:"nearest"})}),[]),v=e=>{p[e]&&w(p[e])};return c(h,(()=>({onKeyDown:e=>{let{event:n}=e;return"ArrowUp"===n.key?(b((e=>{const n=(e+p.length-1)%p.length;return D(n),n})),!0):"ArrowDown"===n.key?(b((e=>{const n=(e+1)%p.length;return D(n),n})),!0):"Enter"===n.key&&(v(k),!0)}}))),s((()=>b(0)),[p]),p.length?f?e(n,{children:f({items:p,query:y,activeIndex:k,onSelect:e=>w(e)})}):e(d,Object.assign({ref:j},{children:p.map(((t,o)=>e(m,Object.assign({$isActive:o===k,onMouseEnter:()=>b(o),onClick:()=>v(o)},{children:g?g(t,o===k):r(n,{children:[e(u,{children:t.label}),t.description&&e(a,{children:t.description})]})}),t.id)))})):null}));h.displayName="SlashCommandMenu";export{h as SlashCommandMenu};
2
2
  //# sourceMappingURL=SlashCommandMenu.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"SlashCommandMenu.js","sources":["../../../../../src/editor/extensions/slashCommand/SlashCommandMenu.tsx"],"sourcesContent":["import React, {\n\tforwardRef,\n\tuseEffect,\n\tuseImperativeHandle,\n\tuseState,\n} from 'react';\nimport type {\n\tSlashCommandDropdownRenderProps,\n\tSlashCommandItem,\n} from '../../BikEditor.types';\nimport {\n\tDropdownContainer,\n\tDropdownItem,\n\tSlashDescription,\n\tSlashLabel,\n} from '../editorDropdown.styles';\n\ninterface Props {\n\titems: SlashCommandItem[];\n\tquery: string;\n\tcommand: (item: SlashCommandItem) => void;\n\t/** Custom per-row renderer. Receives the item and whether it is the active row. */\n\trenderItem?: (item: SlashCommandItem, isActive: boolean) => React.ReactNode;\n\t/**\n\t * Full custom dropdown renderer. Takes priority over renderItem.\n\t * The editor passes activeIndex and onSelect — you handle all the visual rendering.\n\t */\n\trenderDropdown?: (props: SlashCommandDropdownRenderProps) => React.ReactNode;\n}\n\nexport const SlashCommandMenu = forwardRef<any, Props>(\n\t({ items, query, command, renderItem, renderDropdown }, ref) => {\n\t\tconst [selectedIndex, setSelectedIndex] = useState(0);\n\n\t\tconst select = (i: number) => {\n\t\t\tif (items[i]) command(items[i]);\n\t\t};\n\n\t\tuseImperativeHandle(ref, () => ({\n\t\t\tonKeyDown: ({ event }: { event: KeyboardEvent }) => {\n\t\t\t\tif (event.key === 'ArrowUp') {\n\t\t\t\t\tsetSelectedIndex((i) => (i + items.length - 1) % items.length);\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t\t\tif (event.key === 'ArrowDown') {\n\t\t\t\t\tsetSelectedIndex((i) => (i + 1) % items.length);\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t\t\tif (event.key === 'Enter') {\n\t\t\t\t\tselect(selectedIndex);\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t\t\treturn false;\n\t\t\t},\n\t\t}));\n\n\t\tuseEffect(() => setSelectedIndex(0), [items]);\n\n\t\tif (!items.length) return null;\n\n\t\t// Full custom dropdown — editor still manages keyboard nav via selectedIndex\n\t\tif (renderDropdown) {\n\t\t\treturn (\n\t\t\t\t<>\n\t\t\t\t\t{renderDropdown({\n\t\t\t\t\t\titems,\n\t\t\t\t\t\tquery,\n\t\t\t\t\t\tactiveIndex: selectedIndex,\n\t\t\t\t\t\tonSelect: (item) => command(item),\n\t\t\t\t\t})}\n\t\t\t\t</>\n\t\t\t);\n\t\t}\n\n\t\treturn (\n\t\t\t<DropdownContainer>\n\t\t\t\t{items.map((item, i) => (\n\t\t\t\t\t<DropdownItem\n\t\t\t\t\t\tkey={item.id}\n\t\t\t\t\t\t$isActive={i === selectedIndex}\n\t\t\t\t\t\tonMouseEnter={() => setSelectedIndex(i)}\n\t\t\t\t\t\tonClick={() => select(i)}\n\t\t\t\t\t>\n\t\t\t\t\t\t{renderItem ? (\n\t\t\t\t\t\t\trenderItem(item, i === selectedIndex)\n\t\t\t\t\t\t) : (\n\t\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t\t<SlashLabel>{item.label}</SlashLabel>\n\t\t\t\t\t\t\t\t{item.description && (\n\t\t\t\t\t\t\t\t\t<SlashDescription>{item.description}</SlashDescription>\n\t\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t\t</>\n\t\t\t\t\t\t)}\n\t\t\t\t\t</DropdownItem>\n\t\t\t\t))}\n\t\t\t</DropdownContainer>\n\t\t);\n\t},\n);\nSlashCommandMenu.displayName = 'SlashCommandMenu';\n"],"names":["SlashCommandMenu","forwardRef","_ref","ref","items","query","command","renderItem","renderDropdown","selectedIndex","setSelectedIndex","useState","select","i","useImperativeHandle","onKeyDown","_ref2","event","key","length","useEffect","_jsx","_Fragment","children","activeIndex","onSelect","item","DropdownContainer","map","DropdownItem","Object","assign","$isActive","onMouseEnter","onClick","_jsxs","SlashLabel","label","description","SlashDescription","id","displayName"],"mappings":"iRA8BO,MAAMA,EAAmBC,GAC/B,CAAAC,EAAwDC,KAAO,IAA9DC,MAAEA,EAAKC,MAAEA,EAAKC,QAAEA,EAAOC,WAAEA,EAAUC,eAAEA,GAAgBN,EACrD,MAAOO,EAAeC,GAAoBC,EAAS,GAE7CC,EAAUC,IACXT,EAAMS,IAAIP,EAAQF,EAAMS,GAAG,EAuBhC,OApBAC,EAAoBX,GAAK,KAAO,CAC/BY,UAAWC,IAAwC,IAAvCC,MAAEA,GAAiCD,EAC9C,MAAkB,YAAdC,EAAMC,KACTR,GAAkBG,IAAOA,EAAIT,EAAMe,OAAS,GAAKf,EAAMe,UAChD,GAEU,cAAdF,EAAMC,KACTR,GAAkBG,IAAOA,EAAI,GAAKT,EAAMe,UACjC,GAEU,UAAdF,EAAMC,MACTN,EAAOH,IACA,EAEI,MAIdW,GAAU,IAAMV,EAAiB,IAAI,CAACN,IAEjCA,EAAMe,OAGPX,EAEFa,EACEC,EAAA,CAAAC,SAAAf,EAAe,CACfJ,QACAC,QACAmB,YAAaf,EACbgB,SAAWC,GAASpB,EAAQoB,OAO/BL,EAACM,EAAiB,CAAAJ,SAChBnB,EAAMwB,KAAI,CAACF,EAAMb,IACjBQ,EAACQ,EAAYC,OAAAC,OAAA,CAAAC,UAEDnB,IAAMJ,EACjBwB,aAAcA,IAAMvB,EAAiBG,GACrCqB,QAASA,IAAMtB,EAAOC,IAAE,CAAAU,SAEvBhB,EACAA,EAAWmB,EAAMb,IAAMJ,GAEvB0B,EAAAb,EAAA,CAAAC,SAAA,CACCF,EAACe,EAAU,CAAAb,SAAEG,EAAKW,QACjBX,EAAKY,aACLjB,EAACkB,YAAkBb,EAAKY,mBAXtBZ,EAAKc,QApBY,IAqCL,IAIvBxC,EAAiByC,YAAc"}
1
+ {"version":3,"file":"SlashCommandMenu.js","sources":["../../../../../src/editor/extensions/slashCommand/SlashCommandMenu.tsx"],"sourcesContent":["import React, {\n\tforwardRef,\n\tuseCallback,\n\tuseEffect,\n\tuseImperativeHandle,\n\tuseRef,\n\tuseState,\n} from 'react';\nimport type {\n\tSlashCommandDropdownRenderProps,\n\tSlashCommandItem,\n} from '../../BikEditor.types';\nimport {\n\tDropdownContainer,\n\tDropdownItem,\n\tSlashDescription,\n\tSlashLabel,\n} from '../editorDropdown.styles';\n\ninterface Props {\n\titems: SlashCommandItem[];\n\tquery: string;\n\tcommand: (item: SlashCommandItem) => void;\n\t/** Custom per-row renderer. Receives the item and whether it is the active row. */\n\trenderItem?: (item: SlashCommandItem, isActive: boolean) => React.ReactNode;\n\t/**\n\t * Full custom dropdown renderer. Takes priority over renderItem.\n\t * The editor passes activeIndex and onSelect — you handle all the visual rendering.\n\t */\n\trenderDropdown?: (props: SlashCommandDropdownRenderProps) => React.ReactNode;\n}\n\nexport const SlashCommandMenu = forwardRef<any, Props>(\n\t({ items, query, command, renderItem, renderDropdown }, ref) => {\n\t\tconst [selectedIndex, setSelectedIndex] = useState(0);\n\t\tconst containerRef = useRef<HTMLDivElement>(null);\n\n\t\tconst scrollToIndex = useCallback((index: number) => {\n\t\t\tconst container = containerRef.current;\n\t\t\tif (!container) return;\n\t\t\tconst item = container.children[index] as HTMLElement | undefined;\n\t\t\titem?.scrollIntoView({ block: 'nearest' });\n\t\t}, []);\n\n\t\tconst select = (i: number) => {\n\t\t\tif (items[i]) command(items[i]);\n\t\t};\n\n\t\tuseImperativeHandle(ref, () => ({\n\t\t\tonKeyDown: ({ event }: { event: KeyboardEvent }) => {\n\t\t\t\tif (event.key === 'ArrowUp') {\n\t\t\t\t\tsetSelectedIndex((prev) => {\n\t\t\t\t\t\tconst next = (prev + items.length - 1) % items.length;\n\t\t\t\t\t\tscrollToIndex(next);\n\t\t\t\t\t\treturn next;\n\t\t\t\t\t});\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t\t\tif (event.key === 'ArrowDown') {\n\t\t\t\t\tsetSelectedIndex((prev) => {\n\t\t\t\t\t\tconst next = (prev + 1) % items.length;\n\t\t\t\t\t\tscrollToIndex(next);\n\t\t\t\t\t\treturn next;\n\t\t\t\t\t});\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t\t\tif (event.key === 'Enter') {\n\t\t\t\t\tselect(selectedIndex);\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t\t\treturn false;\n\t\t\t},\n\t\t}));\n\n\t\tuseEffect(() => setSelectedIndex(0), [items]);\n\n\t\tif (!items.length) return null;\n\n\t\t// Full custom dropdown — editor still manages keyboard nav via selectedIndex\n\t\tif (renderDropdown) {\n\t\t\treturn (\n\t\t\t\t<>\n\t\t\t\t\t{renderDropdown({\n\t\t\t\t\t\titems,\n\t\t\t\t\t\tquery,\n\t\t\t\t\t\tactiveIndex: selectedIndex,\n\t\t\t\t\t\tonSelect: (item) => command(item),\n\t\t\t\t\t})}\n\t\t\t\t</>\n\t\t\t);\n\t\t}\n\n\t\treturn (\n\t\t\t<DropdownContainer ref={containerRef}>\n\t\t\t\t{items.map((item, i) => (\n\t\t\t\t\t<DropdownItem\n\t\t\t\t\t\tkey={item.id}\n\t\t\t\t\t\t$isActive={i === selectedIndex}\n\t\t\t\t\t\tonMouseEnter={() => setSelectedIndex(i)}\n\t\t\t\t\t\tonClick={() => select(i)}\n\t\t\t\t\t>\n\t\t\t\t\t\t{renderItem ? (\n\t\t\t\t\t\t\trenderItem(item, i === selectedIndex)\n\t\t\t\t\t\t) : (\n\t\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t\t<SlashLabel>{item.label}</SlashLabel>\n\t\t\t\t\t\t\t\t{item.description && (\n\t\t\t\t\t\t\t\t\t<SlashDescription>{item.description}</SlashDescription>\n\t\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t\t</>\n\t\t\t\t\t\t)}\n\t\t\t\t\t</DropdownItem>\n\t\t\t\t))}\n\t\t\t</DropdownContainer>\n\t\t);\n\t},\n);\nSlashCommandMenu.displayName = 'SlashCommandMenu';\n"],"names":["SlashCommandMenu","forwardRef","_ref","ref","items","query","command","renderItem","renderDropdown","selectedIndex","setSelectedIndex","useState","containerRef","useRef","scrollToIndex","useCallback","index","container","current","item","children","scrollIntoView","block","select","i","useImperativeHandle","onKeyDown","_ref2","event","key","prev","next","length","useEffect","_jsx","_Fragment","activeIndex","onSelect","DropdownContainer","Object","assign","map","DropdownItem","$isActive","onMouseEnter","onClick","_jsxs","SlashLabel","label","description","SlashDescription","id","displayName"],"mappings":"8SAgCO,MAAMA,EAAmBC,GAC/B,CAAAC,EAAwDC,KAAO,IAA9DC,MAAEA,EAAKC,MAAEA,EAAKC,QAAEA,EAAOC,WAAEA,EAAUC,eAAEA,GAAgBN,EACrD,MAAOO,EAAeC,GAAoBC,EAAS,GAC7CC,EAAeC,EAAuB,MAEtCC,EAAgBC,GAAaC,IAClC,MAAMC,EAAYL,EAAaM,QAC/B,IAAKD,EAAW,OAChB,MAAME,EAAOF,EAAUG,SAASJ,GAChCG,SAAAA,EAAME,eAAe,CAAEC,MAAO,WAAY,GACxC,IAEGC,EAAUC,IACXpB,EAAMoB,IAAIlB,EAAQF,EAAMoB,GAAG,EA+BhC,OA5BAC,EAAoBtB,GAAK,KAAO,CAC/BuB,UAAWC,IAAwC,IAAvCC,MAAEA,GAAiCD,EAC9C,MAAkB,YAAdC,EAAMC,KACTnB,GAAkBoB,IACjB,MAAMC,GAAQD,EAAO1B,EAAM4B,OAAS,GAAK5B,EAAM4B,OAE/C,OADAlB,EAAciB,GACPA,CAAI,KAEL,GAEU,cAAdH,EAAMC,KACTnB,GAAkBoB,IACjB,MAAMC,GAAQD,EAAO,GAAK1B,EAAM4B,OAEhC,OADAlB,EAAciB,GACPA,CAAI,KAEL,GAEU,UAAdH,EAAMC,MACTN,EAAOd,IACA,EAEI,MAIdwB,GAAU,IAAMvB,EAAiB,IAAI,CAACN,IAEjCA,EAAM4B,OAGPxB,EAEF0B,EACEC,EAAA,CAAAf,SAAAZ,EAAe,CACfJ,QACAC,QACA+B,YAAa3B,EACb4B,SAAWlB,GAASb,EAAQa,OAO/Be,EAACI,EAAiBC,OAAAC,OAAA,CAACrC,IAAKS,aACtBR,EAAMqC,KAAI,CAACtB,EAAMK,IACjBU,EAACQ,EAAYH,OAAAC,OAAA,CAAAG,UAEDnB,IAAMf,EACjBmC,aAAcA,IAAMlC,EAAiBc,GACrCqB,QAASA,IAAMtB,EAAOC,IAAE,CAAAJ,SAEvBb,EACAA,EAAWY,EAAMK,IAAMf,GAEvBqC,EACCX,EAAA,CAAAf,SAAA,CAAAc,EAACa,EAAY,CAAA3B,SAAAD,EAAK6B,QACjB7B,EAAK8B,aACLf,EAACgB,EAAkB,CAAA9B,SAAAD,EAAK8B,mBAXtB9B,EAAKgC,SApBY,IAqCL,IAIvBnD,EAAiBoD,YAAc"}
@@ -399,8 +399,8 @@ export interface LinkTooltipProps {
399
399
  * ref.current?.actions.toggleBold();
400
400
  */
401
401
  export interface BikEditorRef {
402
- /** Moves focus into the editor. */
403
- focus: () => void;
402
+ /** Moves focus into the editor. Optionally pass a position: 'start', 'end', 'all', or a numeric offset. */
403
+ focus: (position?: 'start' | 'end' | 'all' | number | boolean | null) => void;
404
404
  /** Removes focus from the editor. */
405
405
  blur: () => void;
406
406
  /** Clears the entire document and fires onChange. */
@@ -3,6 +3,7 @@ export declare const DropdownItem: import("styled-components").StyledComponent<"
3
3
  $isActive?: boolean | undefined;
4
4
  }, never>;
5
5
  export declare const MentionAvatar: import("styled-components").StyledComponent<"img", any, {}, never>;
6
+ export declare const MentionAvatarFallback: import("styled-components").StyledComponent<"div", any, {}, never>;
6
7
  export declare const MentionLabel: import("styled-components").StyledComponent<"span", any, {}, never>;
7
8
  export declare const MentionPresenceDot: import("styled-components").StyledComponent<"span", any, {
8
9
  $online?: boolean | undefined;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bikdotai/bik-component-library",
3
- "version": "0.0.802-beta.1",
3
+ "version": "0.0.802-beta.3",
4
4
  "description": "Bik Component Library",
5
5
  "repository": {
6
6
  "type": "git",