globuswebcomponents 2.18.5 → 2.18.6

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 (55) hide show
  1. package/dist/cjs/gb-accordion-card_78.cjs.entry.js +296 -200
  2. package/dist/cjs/globuscomponents.cjs.js +1 -1
  3. package/dist/cjs/loader.cjs.js +1 -1
  4. package/dist/cjs/reusableModels-_LRAKnsh.js.map +1 -1
  5. package/dist/collection/components/gb-input-field/gb-input-field.css +5 -5
  6. package/dist/collection/components/gb-rich-text/gb-rich-text.css +30 -6
  7. package/dist/collection/components/gb-rich-text/gb-rich-text.js +4 -4
  8. package/dist/collection/components/gb-rich-text/gb-rich-text.js.map +1 -1
  9. package/dist/collection/components/gb-rich-text/resizable-image.js +84 -0
  10. package/dist/collection/components/gb-rich-text/resizable-image.js.map +1 -0
  11. package/dist/collection/components/gb-sidebar/gb-sidebar.js +81 -28
  12. package/dist/collection/components/gb-sidebar/gb-sidebar.js.map +1 -1
  13. package/dist/collection/models/reusableModels.js.map +1 -1
  14. package/dist/components/gb-header.js +1 -1
  15. package/dist/components/gb-input-dropdown-test.js +1 -1
  16. package/dist/components/gb-input-dropdown.js +1 -1
  17. package/dist/components/gb-input-field.js +1 -1
  18. package/dist/components/gb-pagination.js +1 -1
  19. package/dist/components/gb-rich-text.js +260 -177
  20. package/dist/components/gb-rich-text.js.map +1 -1
  21. package/dist/components/gb-sidebar.js +41 -27
  22. package/dist/components/gb-sidebar.js.map +1 -1
  23. package/dist/components/gb-table-header.js +1 -1
  24. package/dist/components/gb-table.js +1 -1
  25. package/dist/components/gb-wysiwyg-toolbar.js +1 -1
  26. package/dist/components/{p-JNQBEWGY.js → p-BiVW1b5P.js} +3 -3
  27. package/dist/components/{p-JNQBEWGY.js.map → p-BiVW1b5P.js.map} +1 -1
  28. package/dist/components/{p-BD74vctU.js → p-CI0hL2FD.js} +4 -4
  29. package/dist/components/{p-BD74vctU.js.map → p-CI0hL2FD.js.map} +1 -1
  30. package/dist/components/{p-DQyU_YBJ.js → p-D9DcC7pf.js} +6 -6
  31. package/dist/components/{p-DQyU_YBJ.js.map → p-D9DcC7pf.js.map} +1 -1
  32. package/dist/components/{p-C2nwKlIB.js → p-DTmhoRrl.js} +4 -4
  33. package/dist/components/{p-C2nwKlIB.js.map → p-DTmhoRrl.js.map} +1 -1
  34. package/dist/components/p-cHn6O-Kf.js.map +1 -1
  35. package/dist/components/{p-q1BXlX2S.js → p-dJxSwAlJ.js} +3 -3
  36. package/dist/components/p-dJxSwAlJ.js.map +1 -0
  37. package/dist/components/{p-DYpvfQik.js → p-gCnf8M-P.js} +3 -3
  38. package/dist/components/{p-DYpvfQik.js.map → p-gCnf8M-P.js.map} +1 -1
  39. package/dist/components/test-wrapper.js +5 -5
  40. package/dist/docs.json +62 -4
  41. package/dist/esm/gb-accordion-card_78.entry.js +296 -200
  42. package/dist/esm/globuscomponents.js +1 -1
  43. package/dist/esm/loader.js +1 -1
  44. package/dist/esm/reusableModels-cHn6O-Kf.js.map +1 -1
  45. package/dist/globuscomponents/globuscomponents.esm.js +1 -1
  46. package/dist/globuscomponents/{p-9a44bc13.entry.js → p-72b3be60.entry.js} +2 -2
  47. package/dist/globuscomponents/p-72b3be60.entry.js.map +1 -0
  48. package/dist/globuscomponents/p-cHn6O-Kf.js.map +1 -1
  49. package/dist/types/components/gb-rich-text/resizable-image.d.ts +1 -0
  50. package/dist/types/components/gb-sidebar/gb-sidebar.d.ts +3 -2
  51. package/dist/types/components.d.ts +18 -2
  52. package/dist/types/models/reusableModels.d.ts +1 -1
  53. package/package.json +1 -1
  54. package/dist/components/p-q1BXlX2S.js.map +0 -1
  55. package/dist/globuscomponents/p-9a44bc13.entry.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"reusableModels-_LRAKnsh.js","sources":["src/models/reusableModels.ts"],"sourcesContent":["export type GeneralSizes = 'xxxxl' | 'xxxl' | 'xxl' | 'xl' | 'lg' | 'md' | 'sm' | 'xs' | 'xxs' | 'profile_lg' | 'profile_md' | 'profile_sm';\r\n\r\nexport type GeneralHierarchies = 'primary' | 'secondary_gray' | 'secondary_color' | 'tertiary_gray' | 'tertiary_color' | 'link_gray' | 'link_color';\r\n\r\nexport enum StateEnum {\r\n Default = 'default',\r\n Disabled = 'disabled',\r\n}\r\n\r\nexport type ArrowPositions = 'bottom_center' | 'bottom_left' | 'bottom_right' | 'top_center' | 'left' | 'right' | 'none' | 'center';\r\n\r\nexport type CheckBoxVariants = 'checkbox' | 'check_circle' | 'radio';\r\n\r\nexport enum BorderWeights {\r\n VeryLight = 'very_light',\r\n Light = 'light',\r\n Regular = 'regular',\r\n Heavy = 'heavy',\r\n}\r\n\r\nexport enum OnlineIndicatorStates {\r\n Online = 'online',\r\n Offline = 'offline',\r\n}\r\n\r\nexport type BreakPoints = 'desktop' | 'mobile';\r\n\r\nexport type FileUploadIconType = 'solid' | 'outline';\r\n\r\nexport type FileUploadStates = 'default' | 'in_progress' | 'complete' | 'hover' | 'disabled' | 'error';\r\n\r\nexport type GeneralColors = 'default' | 'gray' | 'primary' | 'error' | 'warning' | 'success' | 'discovery' | 'information' | 'pink' | 'purple' | 'white';\r\n\r\nexport type PaginationNumberShapes = 'square' | 'circle';\r\n\r\nexport type PaginationTypes =\r\n | 'page_default'\r\n | 'page_minimal_center_aligned'\r\n | 'card_default'\r\n | 'card_minimal_right_aligned'\r\n | 'card_minimal_left_aligned'\r\n | 'card_minimal_center_aligned'\r\n | 'card_button_group_right_aligned'\r\n | 'card_button_group_left_aligned'\r\n | 'card_button_group_center_aligned';\r\n\r\nexport type TabTypes =\r\n | 'button_primary'\r\n | 'button_gray'\r\n | 'button_white'\r\n | 'rounded_button_white'\r\n | 'underline'\r\n | 'underline_filled'\r\n | 'line'\r\n | 'button_white_border'\r\n | 'rounded_button_white_border'\r\n | 'button_gray_border';\r\n\r\nexport type GeneralBackgroundCategories = 'plain_background' | 'colored_background';\r\n\r\nexport type InputFieldTypes =\r\n | 'default'\r\n | 'icon_leading'\r\n | 'leading_dropdown'\r\n | 'trailing_dropdown'\r\n | 'leading_text'\r\n | 'payment_input'\r\n | 'tags'\r\n | 'trailing_button'\r\n | 'password'\r\n | 'password_icon_leading'\r\n | 'count';\r\n\r\nexport type DropdownTypes = 'default' | 'icon_leading' | 'avatar_leading' | 'dot_leading' | 'checkbox' | 'search' | 'tags';\r\n\r\nexport type ColorTypes = 'gray' | 'blue' | 'cyan' | 'pink' | 'purple' | 'green' | 'yellow' | 'red' | 'white';\r\n\r\nexport type DropdownItemTypes = string | number | { name: string | number; username: string; selected?: boolean };\r\n\r\nexport type PaginationDotTypes = 'dot' | 'line';\r\n\r\nexport type FileIconStyles = 'default' | 'gray' | 'solid';\r\n\r\nexport type FileIconTypes = 'pdf' | 'csv' | 'jpg' | 'jpeg' | 'ppt' | 'pptx' | 'doc' | 'docx' | 'xls' | 'xlsx' | 'svg' | 'txt' | 'zip' | 'rar' | 'mp3' | 'mp4' | 'png' | 'empty';\r\n\r\nexport type TableCellTypes = 'text' | 'lead_text' | 'lead_checkbox' | 'badge';\r\n\r\nexport type ProgressStepStatus = 'incomplete' | 'current' | 'complete';\r\n\r\nexport type ProgressStepTypes = 'icon_only' | 'icon_left' | 'icon_top' | 'text_line' | 'featured_icon_left' | 'featured_icon_top';\r\n\r\nexport type ProgressStepStates = 'default' | 'destructive';\r\n\r\nexport type BadgeTypes = 'pill_color' | 'pill_outline' | 'badge_color' | 'badge_modern';\r\n\r\nexport type GeneralStyles = 'standard' | 'compact';\r\n\r\nexport type StateType = 'default' | 'disabled' | 'applied' | 'loading' | 'open';\r\n\r\nexport type ButtonGroupTypes = 'false' | 'leading' | 'only' | 'dot' | 'checkbox';\r\n\r\nexport type ThemeTypes = 'system' | 'light' | 'dark';\r\n\r\nexport type BadgeIconTypes = 'dot' | 'avatar' | 'icon_leading' | 'icon_trailing' | 'country' | 'only' | 'false';\r\n\r\nexport type DropdownRoles = { badgeLabel: string; badgeColor: GeneralColors; badgeType: BadgeTypes };\r\n\r\nexport type StepperType = {\r\n state: ProgressStepStates;\r\n status: ProgressStepStatus;\r\n label?: string;\r\n supportingText?: string;\r\n};\r\n\r\nexport type DetailCellType = 'information' | 'document' | 'status' | 'button';\r\n\r\nexport type MetricFeaturedIconTypes = 'glassmorphism' | 'circular_filled';\r\n\r\nexport interface DropdownListGroup {\r\n icon: string;\r\n label: string;\r\n shortcut: string;\r\n}\r\n\r\nexport type CloseButtonPositions = 'left' | 'right';\r\n\r\nexport interface Notification {\r\n label: string;\r\n time: string;\r\n desc: string;\r\n icon: string;\r\n}\r\n\r\nexport type IllustrationTypes = 'cloud' | 'box' | 'documents' | 'credit_card';\r\n\r\nexport type PatternTypes = 'circles' | 'grid' | 'grid_dot' | 'squares';\r\n\r\nexport type MobilePosition = 'top_left' | 'top_right' | 'bottom_left' | 'bottom_right';\r\n\r\nexport interface TableColumn {\r\n key: string;\r\n label: string;\r\n value?: (row: any) => any;\r\n supportingText?: string | ((row: any) => string);\r\n width?: string;\r\n align?: 'left' | 'center' | 'right';\r\n helpIcon?: boolean;\r\n sortable?: boolean;\r\n sortType?: 'string' | 'number' | 'date';\r\n visible?: boolean;\r\n cellComponent?: string;\r\n searchable?: boolean;\r\n cellProps?: ((row: any) => { [key: string]: any }) | { [key: string]: any };\r\n cellEvent?: string | string[];\r\n hasAvatar?: boolean;\r\n cellAvatar?: {\r\n props?: {};\r\n slots?: {\r\n initials?: string | ((row: any) => string | any);\r\n image?: string | ((row: any) => string | any);\r\n };\r\n };\r\n cellSlots?: {\r\n default?: {\r\n tag?: string; // e.g., 'p', 'span' to wrap content\r\n content: (row: any) => string | any; // Function to get slot content\r\n };\r\n named?: {\r\n [slotName: string]: {\r\n tag: string; // e.g., 'p', 'h1', 'span'\r\n content: (row: any) => string | any; // Function to get slot content\r\n };\r\n };\r\n };\r\n cellClass?: string | ((row: any) => string);\r\n cellStyle?: { [key: string]: string } | ((row: any) => { [key: string]: string });\r\n truncate?: boolean;\r\n splitCell?: {\r\n left: (row: any) => string | number;\r\n right: (row: any) => string | number;\r\n separator?: string;\r\n leftStyle?: (row: any) => { [key: string]: string };\r\n rightStyle?: (row: any) => { [key: string]: string };\r\n };\r\n mobile?: {\r\n position?: MobilePosition;\r\n };\r\n gridCard?: {\r\n buttonIcon?: string;\r\n buttonText?: string;\r\n };\r\n}\r\n\r\nexport interface RowAction {\r\n label?: string;\r\n icon?: string;\r\n action: string; // emitted event name\r\n disabled?: boolean;\r\n destructive?: boolean;\r\n type?: 'button' | 'dropdown' | 'custom';\r\n}\r\n\r\nexport interface DropdownOption {\r\n label: string;\r\n icon?: string;\r\n action: string; // emitted event name\r\n disabled?: boolean;\r\n}\r\n\r\nexport type PortalPlacement =\r\n | 'top'\r\n | 'top-start'\r\n | 'top-end'\r\n | 'bottom'\r\n | 'bottom-start'\r\n | 'bottom-end'\r\n | 'left'\r\n | 'left-start'\r\n | 'left-end'\r\n | 'right'\r\n | 'right-start'\r\n | 'right-end';\r\n\r\nexport interface FilterField {\r\n tag: string;\r\n columnKey?: string; // ← the actual row property to filter on\r\n key: string | { start: string; end: string }; // date ranges need two keys\r\n event: string | { start: string; end: string }; // date ranges need two events\r\n label?: string;\r\n props?: any;\r\n default?: any;\r\n}\r\n\r\nexport interface FilterConfig {\r\n mode?: 'internal' | 'external';\r\n title?: string;\r\n showClearButton?: boolean;\r\n fields?: FilterField[];\r\n initialValues?: {\r\n pageNumber: number;\r\n pageSize: number;\r\n };\r\n appliedValues?: Record<string, any>;\r\n}\r\n\r\nexport type IconStyles = 'stroke' | 'two-tone' | 'duotone' | 'solid' | 'bulk';\r\n\r\nexport type IconTypes = 'rounded' | 'sharp';\r\n\r\nexport type SubMenuChild = {\r\n label: string;\r\n icon: string;\r\n};\r\n\r\nexport type SubMenuItem = {\r\n label: string;\r\n icon: string;\r\n children?: SubMenuChild[];\r\n};\r\n"],"names":["StateEnum","BorderWeights","OnlineIndicatorStates"],"mappings":";;AAIYA;AAAZ,CAAA,UAAY,SAAS,EAAA;AACnB,IAAA,SAAA,CAAA,SAAA,CAAA,GAAA,SAAmB;AACnB,IAAA,SAAA,CAAA,UAAA,CAAA,GAAA,UAAqB;AACvB,CAAC,EAHWA,iBAAS,KAATA,iBAAS,GAGpB,EAAA,CAAA,CAAA;AAMWC;AAAZ,CAAA,UAAY,aAAa,EAAA;AACvB,IAAA,aAAA,CAAA,WAAA,CAAA,GAAA,YAAwB;AACxB,IAAA,aAAA,CAAA,OAAA,CAAA,GAAA,OAAe;AACf,IAAA,aAAA,CAAA,SAAA,CAAA,GAAA,SAAmB;AACnB,IAAA,aAAA,CAAA,OAAA,CAAA,GAAA,OAAe;AACjB,CAAC,EALWA,qBAAa,KAAbA,qBAAa,GAKxB,EAAA,CAAA,CAAA;AAEWC;AAAZ,CAAA,UAAY,qBAAqB,EAAA;AAC/B,IAAA,qBAAA,CAAA,QAAA,CAAA,GAAA,QAAiB;AACjB,IAAA,qBAAA,CAAA,SAAA,CAAA,GAAA,SAAmB;AACrB,CAAC,EAHWA,6BAAqB,KAArBA,6BAAqB,GAGhC,EAAA,CAAA,CAAA;;"}
1
+ {"version":3,"file":"reusableModels-_LRAKnsh.js","sources":["src/models/reusableModels.ts"],"sourcesContent":["export type GeneralSizes = 'xxxxl' | 'xxxl' | 'xxl' | 'xl' | 'lg' | 'md' | 'sm' | 'xs' | 'xxs' | 'profile_lg' | 'profile_md' | 'profile_sm';\r\n\r\nexport type GeneralHierarchies = 'primary' | 'secondary_gray' | 'secondary_color' | 'tertiary_gray' | 'tertiary_color' | 'link_gray' | 'link_color';\r\n\r\nexport enum StateEnum {\r\n Default = 'default',\r\n Disabled = 'disabled',\r\n}\r\n\r\nexport type ArrowPositions = 'bottom_center' | 'bottom_left' | 'bottom_right' | 'top_center' | 'left' | 'right' | 'none' | 'center';\r\n\r\nexport type CheckBoxVariants = 'checkbox' | 'check_circle' | 'radio';\r\n\r\nexport enum BorderWeights {\r\n VeryLight = 'very_light',\r\n Light = 'light',\r\n Regular = 'regular',\r\n Heavy = 'heavy',\r\n}\r\n\r\nexport enum OnlineIndicatorStates {\r\n Online = 'online',\r\n Offline = 'offline',\r\n}\r\n\r\nexport type BreakPoints = 'desktop' | 'mobile';\r\n\r\nexport type FileUploadIconType = 'solid' | 'outline';\r\n\r\nexport type FileUploadStates = 'default' | 'in_progress' | 'complete' | 'hover' | 'disabled' | 'error';\r\n\r\nexport type GeneralColors = 'default' | 'gray' | 'primary' | 'error' | 'warning' | 'success' | 'discovery' | 'information' | 'pink' | 'purple' | 'white';\r\n\r\nexport type PaginationNumberShapes = 'square' | 'circle';\r\n\r\nexport type PaginationTypes =\r\n | 'page_default'\r\n | 'page_minimal_center_aligned'\r\n | 'card_default'\r\n | 'card_minimal_right_aligned'\r\n | 'card_minimal_left_aligned'\r\n | 'card_minimal_center_aligned'\r\n | 'card_button_group_right_aligned'\r\n | 'card_button_group_left_aligned'\r\n | 'card_button_group_center_aligned';\r\n\r\nexport type TabTypes =\r\n | 'button_primary'\r\n | 'button_gray'\r\n | 'button_white'\r\n | 'rounded_button_white'\r\n | 'underline'\r\n | 'underline_filled'\r\n | 'line'\r\n | 'button_white_border'\r\n | 'rounded_button_white_border'\r\n | 'button_gray_border';\r\n\r\nexport type GeneralBackgroundCategories = 'plain_background' | 'colored_background';\r\n\r\nexport type InputFieldTypes =\r\n | 'default'\r\n | 'icon_leading'\r\n | 'leading_dropdown'\r\n | 'trailing_dropdown'\r\n | 'leading_text'\r\n | 'payment_input'\r\n | 'tags'\r\n | 'trailing_button'\r\n | 'password'\r\n | 'password_icon_leading'\r\n | 'count';\r\n\r\nexport type DropdownTypes = 'default' | 'icon_leading' | 'avatar_leading' | 'dot_leading' | 'checkbox' | 'search' | 'tags';\r\n\r\nexport type ColorTypes = 'gray' | 'blue' | 'cyan' | 'pink' | 'purple' | 'green' | 'yellow' | 'red' | 'white';\r\n\r\nexport type DropdownItemTypes = string | number | { name: string | number; username: string; selected?: boolean };\r\n\r\nexport type PaginationDotTypes = 'dot' | 'line';\r\n\r\nexport type FileIconStyles = 'default' | 'gray' | 'solid';\r\n\r\nexport type FileIconTypes = 'pdf' | 'csv' | 'jpg' | 'jpeg' | 'ppt' | 'pptx' | 'doc' | 'docx' | 'xls' | 'xlsx' | 'svg' | 'txt' | 'zip' | 'rar' | 'mp3' | 'mp4' | 'png' | 'empty';\r\n\r\nexport type TableCellTypes = 'text' | 'lead_text' | 'lead_checkbox' | 'badge';\r\n\r\nexport type ProgressStepStatus = 'incomplete' | 'current' | 'complete';\r\n\r\nexport type ProgressStepTypes = 'icon_only' | 'icon_left' | 'icon_top' | 'text_line' | 'featured_icon_left' | 'featured_icon_top';\r\n\r\nexport type ProgressStepStates = 'default' | 'destructive';\r\n\r\nexport type BadgeTypes = 'pill_color' | 'pill_outline' | 'badge_color' | 'badge_modern';\r\n\r\nexport type GeneralStyles = 'standard' | 'compact';\r\n\r\nexport type StateType = 'default' | 'disabled' | 'applied' | 'loading' | 'open';\r\n\r\nexport type ButtonGroupTypes = 'false' | 'leading' | 'only' | 'dot' | 'checkbox';\r\n\r\nexport type ThemeTypes = 'system' | 'light' | 'dark';\r\n\r\nexport type BadgeIconTypes = 'dot' | 'avatar' | 'icon_leading' | 'icon_trailing' | 'country' | 'only' | 'false';\r\n\r\nexport type DropdownRoles = { badgeLabel: string; badgeColor: GeneralColors; badgeType: BadgeTypes };\r\n\r\nexport type StepperType = {\r\n state: ProgressStepStates;\r\n status: ProgressStepStatus;\r\n label?: string;\r\n supportingText?: string;\r\n};\r\n\r\nexport type DetailCellType = 'information' | 'document' | 'status' | 'button';\r\n\r\nexport type MetricFeaturedIconTypes = 'glassmorphism' | 'circular_filled';\r\n\r\nexport interface DropdownListGroup {\r\n icon: string;\r\n label: string;\r\n shortcut: string;\r\n}\r\n\r\nexport type CloseButtonPositions = 'left' | 'right';\r\n\r\nexport interface Notification {\r\n label: string;\r\n time: string;\r\n desc: string;\r\n icon: string;\r\n}\r\n\r\nexport type IllustrationTypes = 'cloud' | 'box' | 'documents' | 'credit_card';\r\n\r\nexport type PatternTypes = 'circles' | 'grid' | 'grid_dot' | 'squares';\r\n\r\nexport type MobilePosition = 'top_left' | 'top_right' | 'bottom_left' | 'bottom_right';\r\n\r\nexport interface TableColumn {\r\n key: string;\r\n label: string;\r\n value?: (row: any) => any;\r\n supportingText?: string | ((row: any) => string);\r\n width?: string;\r\n align?: 'left' | 'center' | 'right';\r\n helpIcon?: boolean;\r\n sortable?: boolean;\r\n sortType?: 'string' | 'number' | 'date';\r\n visible?: boolean;\r\n cellComponent?: string;\r\n searchable?: boolean;\r\n cellProps?: ((row: any) => { [key: string]: any }) | { [key: string]: any };\r\n cellEvent?: string | string[];\r\n hasAvatar?: boolean;\r\n cellAvatar?: {\r\n props?: {};\r\n slots?: {\r\n initials?: string | ((row: any) => string | any);\r\n image?: string | ((row: any) => string | any);\r\n };\r\n };\r\n cellSlots?: {\r\n default?: {\r\n tag?: string; // e.g., 'p', 'span' to wrap content\r\n content: (row: any) => string | any; // Function to get slot content\r\n };\r\n named?: {\r\n [slotName: string]: {\r\n tag: string; // e.g., 'p', 'h1', 'span'\r\n content: (row: any) => string | any; // Function to get slot content\r\n };\r\n };\r\n };\r\n cellClass?: string | ((row: any) => string);\r\n cellStyle?: { [key: string]: string } | ((row: any) => { [key: string]: string });\r\n truncate?: boolean;\r\n splitCell?: {\r\n left: (row: any) => string | number;\r\n right: (row: any) => string | number;\r\n separator?: string;\r\n leftStyle?: (row: any) => { [key: string]: string };\r\n rightStyle?: (row: any) => { [key: string]: string };\r\n };\r\n mobile?: {\r\n position?: MobilePosition;\r\n };\r\n gridCard?: {\r\n buttonIcon?: string;\r\n buttonText?: string;\r\n };\r\n}\r\n\r\nexport interface RowAction {\r\n label?: string;\r\n icon?: string;\r\n action: string; // emitted event name\r\n disabled?: boolean;\r\n destructive?: boolean;\r\n type?: 'button' | 'dropdown' | 'custom';\r\n}\r\n\r\nexport interface DropdownOption {\r\n label: string;\r\n icon?: string;\r\n action: string; // emitted event name\r\n disabled?: ((row: any) => boolean) | boolean;\r\n}\r\n\r\nexport type PortalPlacement =\r\n | 'top'\r\n | 'top-start'\r\n | 'top-end'\r\n | 'bottom'\r\n | 'bottom-start'\r\n | 'bottom-end'\r\n | 'left'\r\n | 'left-start'\r\n | 'left-end'\r\n | 'right'\r\n | 'right-start'\r\n | 'right-end';\r\n\r\nexport interface FilterField {\r\n tag: string;\r\n columnKey?: string; // ← the actual row property to filter on\r\n key: string | { start: string; end: string }; // date ranges need two keys\r\n event: string | { start: string; end: string }; // date ranges need two events\r\n label?: string;\r\n props?: any;\r\n default?: any;\r\n}\r\n\r\nexport interface FilterConfig {\r\n mode?: 'internal' | 'external';\r\n title?: string;\r\n showClearButton?: boolean;\r\n fields?: FilterField[];\r\n initialValues?: {\r\n pageNumber: number;\r\n pageSize: number;\r\n };\r\n appliedValues?: Record<string, any>;\r\n}\r\n\r\nexport type IconStyles = 'stroke' | 'two-tone' | 'duotone' | 'solid' | 'bulk';\r\n\r\nexport type IconTypes = 'rounded' | 'sharp';\r\n\r\nexport type SubMenuChild = {\r\n label: string;\r\n icon: string;\r\n};\r\n\r\nexport type SubMenuItem = {\r\n label: string;\r\n icon: string;\r\n children?: SubMenuChild[];\r\n};\r\n"],"names":["StateEnum","BorderWeights","OnlineIndicatorStates"],"mappings":";;AAIYA;AAAZ,CAAA,UAAY,SAAS,EAAA;AACnB,IAAA,SAAA,CAAA,SAAA,CAAA,GAAA,SAAmB;AACnB,IAAA,SAAA,CAAA,UAAA,CAAA,GAAA,UAAqB;AACvB,CAAC,EAHWA,iBAAS,KAATA,iBAAS,GAGpB,EAAA,CAAA,CAAA;AAMWC;AAAZ,CAAA,UAAY,aAAa,EAAA;AACvB,IAAA,aAAA,CAAA,WAAA,CAAA,GAAA,YAAwB;AACxB,IAAA,aAAA,CAAA,OAAA,CAAA,GAAA,OAAe;AACf,IAAA,aAAA,CAAA,SAAA,CAAA,GAAA,SAAmB;AACnB,IAAA,aAAA,CAAA,OAAA,CAAA,GAAA,OAAe;AACjB,CAAC,EALWA,qBAAa,KAAbA,qBAAa,GAKxB,EAAA,CAAA,CAAA;AAEWC;AAAZ,CAAA,UAAY,qBAAqB,EAAA;AAC/B,IAAA,qBAAA,CAAA,QAAA,CAAA,GAAA,QAAiB;AACjB,IAAA,qBAAA,CAAA,SAAA,CAAA,GAAA,SAAmB;AACrB,CAAC,EAHWA,6BAAqB,KAArBA,6BAAqB,GAGhC,EAAA,CAAA,CAAA;;"}
@@ -2664,11 +2664,11 @@ input:-webkit-autofill:hover,
2664
2664
  input:-webkit-autofill:focus,
2665
2665
  input:-webkit-autofill:active {
2666
2666
  /* Make the text use your normal color */
2667
- -webkit-text-fill-color: var(--color-text, #4b5565);
2667
+ -webkit-text-fill-color: var(--color-text, #4b5565) !important;
2668
2668
 
2669
2669
  /* Remove the yellow background Chrome applies by covering it */
2670
- -webkit-transition: background-color 9999s ease-in-out 0s;
2671
- transition: background-color 9999s ease-in-out 0s;
2670
+ -webkit-transition: background-color 9999s ease-in-out 0s !important;
2671
+ transition: background-color 9999s ease-in-out 0s !important;
2672
2672
 
2673
2673
  /* Or explicitly paint your own background */
2674
2674
  box-shadow: 0 0 0 1000px transparent inset !important;
@@ -2676,11 +2676,11 @@ input:-webkit-autofill:active {
2676
2676
  /* Firefox */
2677
2677
  input:-webkit-autofill {
2678
2678
  background-color: transparent !important;
2679
- color: var(--color-text, #4b5565);
2679
+ color: var(--color-text, #4b5565) !important;
2680
2680
  }
2681
2681
  input:autofill {
2682
2682
  background-color: transparent !important;
2683
- color: var(--color-text, #4b5565);
2683
+ color: var(--color-text, #4b5565) !important;
2684
2684
  }
2685
2685
  .input_container,
2686
2686
  .input_with_label {
@@ -2785,10 +2785,34 @@
2785
2785
  background: var(--color-background-gray-subtler, #eef2f6);
2786
2786
  color: var(--color-icon-default, #364152);
2787
2787
  }
2788
- .ProseMirror-selectednode,
2789
- .ProseMirror-focused img{
2790
- max-width: 100%; /* never wider than the editor */
2791
- max-height: 300px; /* cap the height so tall portraits don't take over */
2792
- width: auto; /* let width scale naturally */
2793
- height: auto;
2788
+ .gb-rich-text__content .ProseMirror img {
2789
+ max-width: 100%; /* never wider than the editor, still overridable by the resize handle's inline width */
2790
+ height: auto; /* preserve aspect ratio as width changes */
2791
+ }
2792
+ /* === Resizable image (see resizable-image.ts) === */
2793
+ .gb-rich-text__content .ProseMirror .gb-resizable-image {
2794
+ position: relative;
2795
+ display: inline-block;
2796
+ max-width: 100%;
2797
+ line-height: 0;
2798
+ }
2799
+ .gb-rich-text__content .ProseMirror .gb-resizable-image img {
2800
+ display: block;
2801
+ }
2802
+ .gb-rich-text__content .ProseMirror .gb-resizable-image__handle {
2803
+ position: absolute;
2804
+ right: -4px;
2805
+ bottom: -4px;
2806
+ width: 10px;
2807
+ height: 10px;
2808
+ border: 1.5px solid var(--color-background-card, #ffffff);
2809
+ border-radius: 2px;
2810
+ background: var(--color-border-selected, #075db2);
2811
+ cursor: nwse-resize;
2812
+ opacity: 0;
2813
+ transition: opacity 0.15s;
2814
+ }
2815
+ .gb-rich-text__content .ProseMirror .gb-resizable-image:hover .gb-resizable-image__handle,
2816
+ .gb-rich-text__content .ProseMirror .gb-resizable-image.ProseMirror-selectednode .gb-resizable-image__handle {
2817
+ opacity: 1;
2794
2818
  }
@@ -1,11 +1,11 @@
1
1
  import { h, Fragment } from "@stencil/core";
2
2
  import { Editor } from "@tiptap/core";
3
- import Image from "@tiptap/extension-image";
4
3
  import Link from "@tiptap/extension-link";
5
4
  import Placeholder from "@tiptap/extension-placeholder";
6
5
  import Underline from "@tiptap/extension-underline";
7
6
  import StarterKit from "@tiptap/starter-kit";
8
7
  import FileHandler from "@tiptap/extension-file-handler";
8
+ import { ResizableImage } from "./resizable-image";
9
9
  export class GbRichText {
10
10
  constructor() {
11
11
  this.label = '';
@@ -38,7 +38,7 @@ export class GbRichText {
38
38
  StarterKit,
39
39
  Underline,
40
40
  Link.configure({ openOnClick: false }),
41
- Image,
41
+ ResizableImage,
42
42
  Placeholder.configure({ placeholder: this.placeholder }),
43
43
  FileHandler.configure({
44
44
  allowedMimeTypes: ['image/jpeg', 'image/png', 'image/gif'],
@@ -162,12 +162,12 @@ export class GbRichText {
162
162
  (_a = this.editor) === null || _a === void 0 ? void 0 : _a.destroy();
163
163
  }
164
164
  render() {
165
- return (h("div", { key: '9928f07fa557418f107fc8970a8a6d660c2eb664', class: {
165
+ return (h("div", { key: '8e35f372364f6b6e7423b3be278b025d65bf3329', class: {
166
166
  'gb-rich-text': true,
167
167
  'gb-rich-text--focused': this.isFocused,
168
168
  'gb-rich-text--error': this.destructive,
169
169
  'gb-rich-text--disabled': this.disabled,
170
- } }, this.label && h("label", { key: '0d092f589d34c35df40a7932055e5d61a666df30', class: "gb-rich-text__label text-sm-medium" }, this.label), h("div", { key: '6333cc24ecf0e4f52f870814ecf8d945e7953a76', class: "gb-rich-text__wrapper" }, h("gb-wysiwyg-toolbar", { key: 'bc9f60b4124bbff6bd9c7d728c18428f7d57cfc1', disabledIcons: this.disabledIcons, "is-bold": this.isBold, "is-italic": this.isItalic, "is-h1": this.isH1, "is-h2": this.isH2, "is-underline": this.isUnderline, "is-quote": this.isQuote, "is-link": this.isLink, "is-bullet-list": this.isBulletList, "is-ordered-list": this.isOrderedList, onToolbarAction: (ev) => this.handleToolbarAction(ev) }), this.destructive && (h("svg", { key: '18133040ecb1d5eaa5d92ee8b067a9303d260841', xmlns: "http://www.w3.org/2000/svg", width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", class: "alert_circle" }, h("path", { key: 'ebb0dce0726e0b7eda10429e44ee2f1c76fac057', d: "M7.99483 9.99998H8.00081M8.00016 7.99998V5.33331M14.6668 7.99998C14.6668 11.6819 11.6821 14.6666 8.00016 14.6666C4.31826 14.6666 1.3335 11.6819 1.3335 7.99998C1.3335 4.31808 4.31826 1.33331 8.00016 1.33331C11.6821 1.33331 14.6668 4.31808 14.6668 7.99998Z", stroke: "var(--color-icon-danger, #B51726)", "stroke-width": "1.33333", "stroke-linecap": "round", "stroke-linejoin": "round" }))), this.attachments.length > 0 && (h("div", { key: '23044031819bef9cd45f3533dc0f9b4d291d810d', class: "gb-rich-text__attachments" }, this.attachments.map((attachment, index) => (h("div", { class: "gb-rich-text__attachment-item", key: index }, h("span", { class: "gb-rich-text__attachment-icon" }, h("gb-file-type-icon", { "file-type": this.getFileExtension(attachment.name), "file-style": "default" })), h("div", { class: "gb-rich-text__attachment-info" }, h("span", { class: "gb-rich-text__attachment-name text-sm-medium" }, attachment.name), h("span", { class: "gb-rich-text__attachment-size text-xs-regular" }, this.formatFileSize(attachment.size))), h("gb-button-close", { color: "gray", size: "sm", onClick: () => this.removeAttachment(index) })))))), h("input", { key: '5843d797ed6ebb90db7aa4847eb295460ab7ff8a', ref: el => (this.fileInputEl = el), type: "file", accept: "image/*", style: { display: 'none' }, onChange: (e) => this.handleFileInput(e) }), h("input", { key: '210cceded9489a05a77b04df351c433f00bb844b', ref: el => (this.attachmentInputEl = el), type: "file", accept: ".pdf,.doc,.docx,.xls,.xlsx,.csv,.txt,.zip", style: { display: 'none' }, onChange: (e) => this.handleAttachmentInput(e) }), h("div", { key: 'cee6e40b4249eb5bcfc4f2f1fa9a791f6d09a52e', class: "gb-rich-text__content" })), this.showHintText && (h(Fragment, null, !this.destructive ? h("p", { class: "gb-rich-text__hint text-sm-regular" }, this.hintText) : h("p", { class: "error_text text-sm-regular" }, this.errorText)))));
170
+ } }, this.label && h("label", { key: '48fa31760874f4ba046f8bd1927b0e3ee478e8a9', class: "gb-rich-text__label text-sm-medium" }, this.label), h("div", { key: '4a8d857144b9d32e729bc529596a9179757aca2e', class: "gb-rich-text__wrapper" }, h("gb-wysiwyg-toolbar", { key: 'bb7a7cf92d4463f6b675c81378fc2f5ad44e636a', disabledIcons: this.disabledIcons, "is-bold": this.isBold, "is-italic": this.isItalic, "is-h1": this.isH1, "is-h2": this.isH2, "is-underline": this.isUnderline, "is-quote": this.isQuote, "is-link": this.isLink, "is-bullet-list": this.isBulletList, "is-ordered-list": this.isOrderedList, onToolbarAction: (ev) => this.handleToolbarAction(ev) }), this.destructive && (h("svg", { key: 'e98e952ce38dee168aaeed851be0b7264c3dd677', xmlns: "http://www.w3.org/2000/svg", width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", class: "alert_circle" }, h("path", { key: '5ed5812e747f848d6bacea85a65e5cc1241d940f', d: "M7.99483 9.99998H8.00081M8.00016 7.99998V5.33331M14.6668 7.99998C14.6668 11.6819 11.6821 14.6666 8.00016 14.6666C4.31826 14.6666 1.3335 11.6819 1.3335 7.99998C1.3335 4.31808 4.31826 1.33331 8.00016 1.33331C11.6821 1.33331 14.6668 4.31808 14.6668 7.99998Z", stroke: "var(--color-icon-danger, #B51726)", "stroke-width": "1.33333", "stroke-linecap": "round", "stroke-linejoin": "round" }))), this.attachments.length > 0 && (h("div", { key: 'd8f8bfb37e2ec6db50d26967bf5c0b4bf957a0cf', class: "gb-rich-text__attachments" }, this.attachments.map((attachment, index) => (h("div", { class: "gb-rich-text__attachment-item", key: index }, h("span", { class: "gb-rich-text__attachment-icon" }, h("gb-file-type-icon", { "file-type": this.getFileExtension(attachment.name), "file-style": "default" })), h("div", { class: "gb-rich-text__attachment-info" }, h("span", { class: "gb-rich-text__attachment-name text-sm-medium" }, attachment.name), h("span", { class: "gb-rich-text__attachment-size text-xs-regular" }, this.formatFileSize(attachment.size))), h("gb-button-close", { color: "gray", size: "sm", onClick: () => this.removeAttachment(index) })))))), h("input", { key: '29f63449b3e265aad6ffb9415de48768ac47e4a5', ref: el => (this.fileInputEl = el), type: "file", accept: "image/*", style: { display: 'none' }, onChange: (e) => this.handleFileInput(e) }), h("input", { key: '204ddc471af0da8d0f9388c729b792e59bcbcb6a', ref: el => (this.attachmentInputEl = el), type: "file", accept: ".pdf,.doc,.docx,.xls,.xlsx,.csv,.txt,.zip", style: { display: 'none' }, onChange: (e) => this.handleAttachmentInput(e) }), h("div", { key: '5e2aadf828780b43417670e05296279b12f921be', class: "gb-rich-text__content" })), this.showHintText && (h(Fragment, null, !this.destructive ? h("p", { class: "gb-rich-text__hint text-sm-regular" }, this.hintText) : h("p", { class: "error_text text-sm-regular" }, this.errorText)))));
171
171
  }
172
172
  static get is() { return "gb-rich-text"; }
173
173
  static get originalStyleUrls() {
@@ -1 +1 @@
1
- {"version":3,"file":"gb-rich-text.js","sourceRoot":"","sources":["../../../src/components/gb-rich-text/gb-rich-text.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,KAAK,EAAgB,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACjH,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AACtC,OAAO,KAAK,MAAM,yBAAyB,CAAC;AAC5C,OAAO,IAAI,MAAM,wBAAwB,CAAC;AAC1C,OAAO,WAAW,MAAM,+BAA+B,CAAC;AACxD,OAAO,SAAS,MAAM,6BAA6B,CAAC;AACpD,OAAO,UAAU,MAAM,qBAAqB,CAAC;AAC7C,OAAO,WAAW,MAAM,gCAAgC,CAAC;AAOzD,MAAM,OAAO,UAAU;IALvB;QAMU,UAAK,GAAW,EAAE,CAAC;QACnB,gBAAW,GAAW,EAAE,CAAC;QACzB,iBAAY,GAAY,IAAI,CAAC;QAC7B,aAAQ,GAAW,EAAE,CAAC;QAEtB,aAAQ,GAAY,KAAK,CAAC;QAC1B,gBAAW,GAAY,KAAK,CAAC;QAC7B,cAAS,GAAW,EAAE,CAAC;QAC/B,+FAA+F;QACvF,kBAAa,GAAsB,EAAE,CAAC;QAE9C,iDAAiD;QACxC,cAAS,GAAY,KAAK,CAAC;QAC3B,WAAM,GAAY,KAAK,CAAC;QACxB,aAAQ,GAAY,KAAK,CAAC;QAC1B,SAAI,GAAY,KAAK,CAAC;QACtB,SAAI,GAAY,KAAK,CAAC;QACtB,gBAAW,GAAY,KAAK,CAAC;QAC7B,YAAO,GAAY,KAAK,CAAC;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AY,IAAI,CACpB,kBAAG,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC,CAAC,SAAG,KAAK,EAAC,oCAAoC,IAAE,IAAI,CAAC,QAAQ,CAAK,CAAC,CAAC,CAAC,SAAG,KAAK,EAAC,4BAA4B,IAAE,IAAI,CAAC,SAAS,CAAK,CAAI,CAC1J,CACG,CACP,CAAC;IACJ,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["import { Component, Element, Event, EventEmitter, Method, Prop, State, Watch, h, Fragment } from '@stencil/core';\r\nimport { Editor } from '@tiptap/core';\r\nimport Image from '@tiptap/extension-image';\r\nimport Link from '@tiptap/extension-link';\r\nimport Placeholder from '@tiptap/extension-placeholder';\r\nimport Underline from '@tiptap/extension-underline';\r\nimport StarterKit from '@tiptap/starter-kit';\r\nimport FileHandler from '@tiptap/extension-file-handler';\r\n\r\n@Component({\r\n tag: 'gb-rich-text',\r\n styleUrl: 'gb-rich-text.css',\r\n shadow: false,\r\n})\r\nexport class GbRichText {\r\n @Prop() label: string = '';\r\n @Prop() placeholder: string = '';\r\n @Prop() showHintText: boolean = true;\r\n @Prop() hintText: string = '';\r\n @Prop() value: any;\r\n @Prop() disabled: boolean = false;\r\n @Prop() destructive: boolean = false;\r\n @Prop() errorText: string = '';\r\n // Toolbar icons to disable, e.g. disabled-icons=\"photo,attachment\" or ['photo', 'attachment'].\r\n @Prop() disabledIcons: string | string[] = [];\r\n\r\n // Active states tracked for toolbar highlighting\r\n @State() isFocused: boolean = false;\r\n @State() isBold: boolean = false;\r\n @State() isItalic: boolean = false;\r\n @State() isH1: boolean = false;\r\n @State() isH2: boolean = false;\r\n @State() isUnderline: boolean = false;\r\n @State() isQuote: boolean = false;\r\n @State() isLink: boolean = false;\r\n @State() isBulletList: boolean = false;\r\n @State() isOrderedList: boolean = false;\r\n @State() attachments: { file: File; name: string; size: number; type: string }[] = [];\r\n @Event() richTextValueChanged: EventEmitter<{ json: any; html: any }>;\r\n @Event() richTextAttachmentAdded: EventEmitter<{ file: File; name: string; size: number; type: string }>;\r\n @Event() gbBlur: EventEmitter<void>;\r\n @Event() gbFocus: EventEmitter<void>;\r\n\r\n @Element() el: HTMLElement;\r\n\r\n private editor: Editor;\r\n private fileInputEl: HTMLInputElement;\r\n private attachmentInputEl: HTMLInputElement;\r\n\r\n componentDidLoad() {\r\n const editorEl = this.el.querySelector('.gb-rich-text__content') as HTMLElement;\r\n\r\n this.editor = new Editor({\r\n element: editorEl,\r\n extensions: [\r\n StarterKit,\r\n Underline,\r\n Link.configure({ openOnClick: false }),\r\n Image,\r\n Placeholder.configure({ placeholder: this.placeholder }),\r\n FileHandler.configure({\r\n allowedMimeTypes: ['image/jpeg', 'image/png', 'image/gif'],\r\n }),\r\n ],\r\n content: this.value,\r\n onUpdate: ({ editor }) => {\r\n const json = editor.getJSON();\r\n const html = editor.getHTML();\r\n this.richTextValueChanged.emit({ json: json, html: html });\r\n this.syncActiveStates(editor);\r\n },\r\n onSelectionUpdate: ({ editor }) => {\r\n this.syncActiveStates(editor);\r\n },\r\n onFocus: () => {\r\n this.isFocused = true;\r\n this.gbFocus.emit();\r\n },\r\n onBlur: () => {\r\n this.isFocused = false;\r\n this.gbBlur.emit();\r\n },\r\n });\r\n }\r\n\r\n private handleFileInput(e: Event) {\r\n const file = (e.target as HTMLInputElement).files?.[0];\r\n if (!file) return;\r\n const reader = new FileReader();\r\n reader.onload = () => {\r\n const src = reader.result as string;\r\n this.editor.chain().focus().setImage({ src }).run();\r\n };\r\n reader.readAsDataURL(file);\r\n // Reset so same file can be picked again\r\n (e.target as HTMLInputElement).value = '';\r\n }\r\n\r\n private handleAttachmentInput(e: Event) {\r\n const file = (e.target as HTMLInputElement).files?.[0];\r\n if (!file) return;\r\n\r\n const attachment = { file, name: file.name, size: file.size, type: file.type };\r\n\r\n // Push to local state so UI renders it\r\n this.attachments = [...this.attachments, attachment];\r\n\r\n // Emit to Angular parent\r\n this.richTextAttachmentAdded.emit(attachment);\r\n\r\n // Reset so same file can be picked again\r\n (e.target as HTMLInputElement).value = '';\r\n }\r\n\r\n private removeAttachment(index: number) {\r\n this.attachments = this.attachments.filter((_, i) => i !== index);\r\n }\r\n\r\n private formatFileSize(bytes: number): string {\r\n if (bytes < 1024) return `${bytes} B`;\r\n if (bytes < 1024 * 1024) return `${(bytes / 1024).toFixed(1)} KB`;\r\n return `${(bytes / (1024 * 1024)).toFixed(1)} MB`;\r\n }\r\n\r\n private getFileExtension(name: string): string {\r\n const ext = name.split('.').pop()?.toLowerCase() ?? '';\r\n return ext;\r\n }\r\n\r\n // Syncs toolbar active states to current editor selection\r\n private syncActiveStates(editor: Editor) {\r\n this.isBold = editor.isActive('bold');\r\n this.isItalic = editor.isActive('italic');\r\n this.isUnderline = editor.isActive('underline');\r\n this.isH1 = editor.isActive('heading', { level: 1 });\r\n this.isH2 = editor.isActive('heading', { level: 2 });\r\n this.isQuote = editor.isActive('blockquote');\r\n this.isLink = editor.isActive('link');\r\n this.isBulletList = editor.isActive('bulletList');\r\n this.isOrderedList = editor.isActive('orderedList');\r\n }\r\n\r\n // Handles all toolbar action events from gb-wysiwyg-toolbar\r\n private handleToolbarAction(ev: CustomEvent<string>) {\r\n const e = this.editor;\r\n if (!e) return;\r\n\r\n const actionMap: Record<string, () => void> = {\r\n bold: () => e.chain().focus().toggleBold().run(),\r\n italic: () => e.chain().focus().toggleItalic().run(),\r\n underline: () => e.chain().focus().toggleUnderline().run(),\r\n h1: () => e.chain().focus().toggleHeading({ level: 1 }).run(),\r\n h2: () => e.chain().focus().toggleHeading({ level: 2 }).run(),\r\n quote: () => e.chain().focus().toggleBlockquote().run(),\r\n link: () => {\r\n const url = window.prompt('Enter URL');\r\n if (url) e.chain().focus().setLink({ href: url }).run();\r\n },\r\n bulletList: () => e.chain().focus().toggleBulletList().run(),\r\n orderedList: () => e.chain().focus().toggleOrderedList().run(),\r\n photo: () => this.fileInputEl?.click(),\r\n attachment: () => this.attachmentInputEl?.click(),\r\n };\r\n\r\n actionMap[ev.detail]?.();\r\n this.syncActiveStates(e);\r\n }\r\n\r\n @Watch('value')\r\n handleValueChange(newValue: string) {\r\n if (this.editor && newValue) {\r\n this.editor.commands.setContent(newValue);\r\n }\r\n }\r\n\r\n @Method()\r\n async getRichTextHTML(): Promise<string> {\r\n return this.editor?.getHTML() ?? '';\r\n }\r\n\r\n @Method()\r\n async clearContent(): Promise<void> {\r\n this.editor?.commands.clearContent();\r\n }\r\n\r\n disconnectedCallback() {\r\n this.editor?.destroy();\r\n }\r\n\r\n render() {\r\n return (\r\n <div\r\n class={{\r\n 'gb-rich-text': true,\r\n 'gb-rich-text--focused': this.isFocused,\r\n 'gb-rich-text--error': this.destructive,\r\n 'gb-rich-text--disabled': this.disabled,\r\n }}\r\n >\r\n {this.label && <label class=\"gb-rich-text__label text-sm-medium\">{this.label}</label>}\r\n\r\n <div class=\"gb-rich-text__wrapper\">\r\n <gb-wysiwyg-toolbar\r\n disabledIcons={this.disabledIcons}\r\n is-bold={this.isBold}\r\n is-italic={this.isItalic}\r\n is-h1={this.isH1}\r\n is-h2={this.isH2}\r\n is-underline={this.isUnderline}\r\n is-quote={this.isQuote}\r\n is-link={this.isLink}\r\n is-bullet-list={this.isBulletList}\r\n is-ordered-list={this.isOrderedList}\r\n onToolbarAction={(ev: CustomEvent<string>) => this.handleToolbarAction(ev)}\r\n ></gb-wysiwyg-toolbar>\r\n\r\n {this.destructive && (\r\n <svg xmlns=\"http://www.w3.org/2000/svg\" width=\"16\" height=\"16\" viewBox=\"0 0 16 16\" fill=\"none\" class=\"alert_circle\">\r\n <path\r\n d=\"M7.99483 9.99998H8.00081M8.00016 7.99998V5.33331M14.6668 7.99998C14.6668 11.6819 11.6821 14.6666 8.00016 14.6666C4.31826 14.6666 1.3335 11.6819 1.3335 7.99998C1.3335 4.31808 4.31826 1.33331 8.00016 1.33331C11.6821 1.33331 14.6668 4.31808 14.6668 7.99998Z\"\r\n stroke=\"var(--color-icon-danger, #B51726)\"\r\n stroke-width=\"1.33333\"\r\n stroke-linecap=\"round\"\r\n stroke-linejoin=\"round\"\r\n />\r\n </svg>\r\n )}\r\n {this.attachments.length > 0 && (\r\n <div class=\"gb-rich-text__attachments\">\r\n {this.attachments.map((attachment, index) => (\r\n <div class=\"gb-rich-text__attachment-item\" key={index}>\r\n {/* <span class=\"gb-rich-text__attachment-icon\">{this.getFileIcon(attachment.type)}</span> */}\r\n <span class=\"gb-rich-text__attachment-icon\">\r\n <gb-file-type-icon file-type={this.getFileExtension(attachment.name)} file-style=\"default\"></gb-file-type-icon>\r\n </span>\r\n <div class=\"gb-rich-text__attachment-info\">\r\n <span class=\"gb-rich-text__attachment-name text-sm-medium\">{attachment.name}</span>\r\n <span class=\"gb-rich-text__attachment-size text-xs-regular\">{this.formatFileSize(attachment.size)}</span>\r\n </div>\r\n {/* <button\r\n class=\"gb-rich-text__attachment-remove\"\r\n onMouseDown={(ev: MouseEvent) => {\r\n ev.preventDefault();\r\n this.removeAttachment(index);\r\n }}\r\n aria-label=\"Remove attachment\"\r\n >\r\n <svg xmlns=\"http://www.w3.org/2000/svg\" width=\"16\" height=\"16\" viewBox=\"0 0 16 16\" fill=\"none\">\r\n <path d=\"M12 4L4 12M4 4l8 8\" stroke=\"currentColor\" stroke-width=\"1.5\" stroke-linecap=\"round\" />\r\n </svg>\r\n </button> */}\r\n <gb-button-close color=\"gray\" size=\"sm\" onClick={() => this.removeAttachment(index)}></gb-button-close>\r\n </div>\r\n ))}\r\n </div>\r\n )}\r\n\r\n {/* Hidden file input for local image selection */}\r\n <input\r\n ref={el => (this.fileInputEl = el as HTMLInputElement)}\r\n type=\"file\"\r\n accept=\"image/*\"\r\n style={{ display: 'none' }}\r\n onChange={(e: Event) => this.handleFileInput(e)}\r\n />\r\n\r\n {/* Hidden file input for attachments */}\r\n <input\r\n ref={el => (this.attachmentInputEl = el as HTMLInputElement)}\r\n type=\"file\"\r\n accept=\".pdf,.doc,.docx,.xls,.xlsx,.csv,.txt,.zip\"\r\n style={{ display: 'none' }}\r\n onChange={(e: Event) => this.handleAttachmentInput(e)}\r\n />\r\n <div class=\"gb-rich-text__content\"></div>\r\n </div>\r\n\r\n {/* {(this.showHintText || this.errorText) && <span class=\"gb-rich-text__hint text-sm-regular\">{this.destructive ? this.errorText : this.hintText}</span>} */}\r\n {this.showHintText && (\r\n <>{!this.destructive ? <p class=\"gb-rich-text__hint text-sm-regular\">{this.hintText}</p> : <p class=\"error_text text-sm-regular\">{this.errorText}</p>}</>\r\n )}\r\n </div>\r\n );\r\n }\r\n}\r\n"]}
1
+ {"version":3,"file":"gb-rich-text.js","sourceRoot":"","sources":["../../../src/components/gb-rich-text/gb-rich-text.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,KAAK,EAAgB,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACjH,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AACtC,OAAO,IAAI,MAAM,wBAAwB,CAAC;AAC1C,OAAO,WAAW,MAAM,+BAA+B,CAAC;AACxD,OAAO,SAAS,MAAM,6BAA6B,CAAC;AACpD,OAAO,UAAU,MAAM,qBAAqB,CAAC;AAC7C,OAAO,WAAW,MAAM,gCAAgC,CAAC;AACzD,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAOnD,MAAM,OAAO,UA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EAAC,SAAS,EAChB,KAAK,EAAE,EAAE,OAAO,EAAE,MAAM,EAAE,EAC1B,QAAQ,EAAE,CAAC,CAAQ,EAAE,EAAE,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC,CAAC,GAC/C;gBAGF,8DACE,GAAG,EAAE,EAAE,CAAC,EAAE,CAAC,CAAC,IAAI,CAAC,iBAAiB,GAAG,EAAsB,CAAC,EAC5D,IAAI,EAAC,MAAM,EACX,MAAM,EAAC,2CAA2C,EAClD,KAAK,EAAE,EAAE,OAAO,EAAE,MAAM,EAAE,EAC1B,QAAQ,EAAE,CAAC,CAAQ,EAAE,EAAE,CAAC,IAAI,CAAC,qBAAqB,CAAC,CAAC,CAAC,GACrD;gBACF,4DAAK,KAAK,EAAC,uBAAuB,GAAO,CACrC;YAGL,IAAI,CAAC,YAAY,IAAI,CACpB,kBAAG,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC,CAAC,SAAG,KAAK,EAAC,oCAAoC,IAAE,IAAI,CAAC,QAAQ,CAAK,CAAC,CAAC,CAAC,SAAG,KAAK,EAAC,4BAA4B,IAAE,IAAI,CAAC,SAAS,CAAK,CAAI,CAC1J,CACG,CACP,CAAC;IACJ,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["import { Component, Element, Event, EventEmitter, Method, Prop, State, Watch, h, Fragment } from '@stencil/core';\r\nimport { Editor } from '@tiptap/core';\r\nimport Link from '@tiptap/extension-link';\r\nimport Placeholder from '@tiptap/extension-placeholder';\r\nimport Underline from '@tiptap/extension-underline';\r\nimport StarterKit from '@tiptap/starter-kit';\r\nimport FileHandler from '@tiptap/extension-file-handler';\r\nimport { ResizableImage } from './resizable-image';\r\n\r\n@Component({\r\n tag: 'gb-rich-text',\r\n styleUrl: 'gb-rich-text.css',\r\n shadow: false,\r\n})\r\nexport class GbRichText {\r\n @Prop() label: string = '';\r\n @Prop() placeholder: string = '';\r\n @Prop() showHintText: boolean = true;\r\n @Prop() hintText: string = '';\r\n @Prop() value: any;\r\n @Prop() disabled: boolean = false;\r\n @Prop() destructive: boolean = false;\r\n @Prop() errorText: string = '';\r\n // Toolbar icons to disable, e.g. disabled-icons=\"photo,attachment\" or ['photo', 'attachment'].\r\n @Prop() disabledIcons: string | string[] = [];\r\n\r\n // Active states tracked for toolbar highlighting\r\n @State() isFocused: boolean = false;\r\n @State() isBold: boolean = false;\r\n @State() isItalic: boolean = false;\r\n @State() isH1: boolean = false;\r\n @State() isH2: boolean = false;\r\n @State() isUnderline: boolean = false;\r\n @State() isQuote: boolean = false;\r\n @State() isLink: boolean = false;\r\n @State() isBulletList: boolean = false;\r\n @State() isOrderedList: boolean = false;\r\n @State() attachments: { file: File; name: string; size: number; type: string }[] = [];\r\n @Event() richTextValueChanged: EventEmitter<{ json: any; html: any }>;\r\n @Event() richTextAttachmentAdded: EventEmitter<{ file: File; name: string; size: number; type: string }>;\r\n @Event() gbBlur: EventEmitter<void>;\r\n @Event() gbFocus: EventEmitter<void>;\r\n\r\n @Element() el: HTMLElement;\r\n\r\n private editor: Editor;\r\n private fileInputEl: HTMLInputElement;\r\n private attachmentInputEl: HTMLInputElement;\r\n\r\n componentDidLoad() {\r\n const editorEl = this.el.querySelector('.gb-rich-text__content') as HTMLElement;\r\n\r\n this.editor = new Editor({\r\n element: editorEl,\r\n extensions: [\r\n StarterKit,\r\n Underline,\r\n Link.configure({ openOnClick: false }),\r\n ResizableImage,\r\n Placeholder.configure({ placeholder: this.placeholder }),\r\n FileHandler.configure({\r\n allowedMimeTypes: ['image/jpeg', 'image/png', 'image/gif'],\r\n }),\r\n ],\r\n content: this.value,\r\n onUpdate: ({ editor }) => {\r\n const json = editor.getJSON();\r\n const html = editor.getHTML();\r\n this.richTextValueChanged.emit({ json: json, html: html });\r\n this.syncActiveStates(editor);\r\n },\r\n onSelectionUpdate: ({ editor }) => {\r\n this.syncActiveStates(editor);\r\n },\r\n onFocus: () => {\r\n this.isFocused = true;\r\n this.gbFocus.emit();\r\n },\r\n onBlur: () => {\r\n this.isFocused = false;\r\n this.gbBlur.emit();\r\n },\r\n });\r\n }\r\n\r\n private handleFileInput(e: Event) {\r\n const file = (e.target as HTMLInputElement).files?.[0];\r\n if (!file) return;\r\n const reader = new FileReader();\r\n reader.onload = () => {\r\n const src = reader.result as string;\r\n this.editor.chain().focus().setImage({ src }).run();\r\n };\r\n reader.readAsDataURL(file);\r\n // Reset so same file can be picked again\r\n (e.target as HTMLInputElement).value = '';\r\n }\r\n\r\n private handleAttachmentInput(e: Event) {\r\n const file = (e.target as HTMLInputElement).files?.[0];\r\n if (!file) return;\r\n\r\n const attachment = { file, name: file.name, size: file.size, type: file.type };\r\n\r\n // Push to local state so UI renders it\r\n this.attachments = [...this.attachments, attachment];\r\n\r\n // Emit to Angular parent\r\n this.richTextAttachmentAdded.emit(attachment);\r\n\r\n // Reset so same file can be picked again\r\n (e.target as HTMLInputElement).value = '';\r\n }\r\n\r\n private removeAttachment(index: number) {\r\n this.attachments = this.attachments.filter((_, i) => i !== index);\r\n }\r\n\r\n private formatFileSize(bytes: number): string {\r\n if (bytes < 1024) return `${bytes} B`;\r\n if (bytes < 1024 * 1024) return `${(bytes / 1024).toFixed(1)} KB`;\r\n return `${(bytes / (1024 * 1024)).toFixed(1)} MB`;\r\n }\r\n\r\n private getFileExtension(name: string): string {\r\n const ext = name.split('.').pop()?.toLowerCase() ?? '';\r\n return ext;\r\n }\r\n\r\n // Syncs toolbar active states to current editor selection\r\n private syncActiveStates(editor: Editor) {\r\n this.isBold = editor.isActive('bold');\r\n this.isItalic = editor.isActive('italic');\r\n this.isUnderline = editor.isActive('underline');\r\n this.isH1 = editor.isActive('heading', { level: 1 });\r\n this.isH2 = editor.isActive('heading', { level: 2 });\r\n this.isQuote = editor.isActive('blockquote');\r\n this.isLink = editor.isActive('link');\r\n this.isBulletList = editor.isActive('bulletList');\r\n this.isOrderedList = editor.isActive('orderedList');\r\n }\r\n\r\n // Handles all toolbar action events from gb-wysiwyg-toolbar\r\n private handleToolbarAction(ev: CustomEvent<string>) {\r\n const e = this.editor;\r\n if (!e) return;\r\n\r\n const actionMap: Record<string, () => void> = {\r\n bold: () => e.chain().focus().toggleBold().run(),\r\n italic: () => e.chain().focus().toggleItalic().run(),\r\n underline: () => e.chain().focus().toggleUnderline().run(),\r\n h1: () => e.chain().focus().toggleHeading({ level: 1 }).run(),\r\n h2: () => e.chain().focus().toggleHeading({ level: 2 }).run(),\r\n quote: () => e.chain().focus().toggleBlockquote().run(),\r\n link: () => {\r\n const url = window.prompt('Enter URL');\r\n if (url) e.chain().focus().setLink({ href: url }).run();\r\n },\r\n bulletList: () => e.chain().focus().toggleBulletList().run(),\r\n orderedList: () => e.chain().focus().toggleOrderedList().run(),\r\n photo: () => this.fileInputEl?.click(),\r\n attachment: () => this.attachmentInputEl?.click(),\r\n };\r\n\r\n actionMap[ev.detail]?.();\r\n this.syncActiveStates(e);\r\n }\r\n\r\n @Watch('value')\r\n handleValueChange(newValue: string) {\r\n if (this.editor && newValue) {\r\n this.editor.commands.setContent(newValue);\r\n }\r\n }\r\n\r\n @Method()\r\n async getRichTextHTML(): Promise<string> {\r\n return this.editor?.getHTML() ?? '';\r\n }\r\n\r\n @Method()\r\n async clearContent(): Promise<void> {\r\n this.editor?.commands.clearContent();\r\n }\r\n\r\n disconnectedCallback() {\r\n this.editor?.destroy();\r\n }\r\n\r\n render() {\r\n return (\r\n <div\r\n class={{\r\n 'gb-rich-text': true,\r\n 'gb-rich-text--focused': this.isFocused,\r\n 'gb-rich-text--error': this.destructive,\r\n 'gb-rich-text--disabled': this.disabled,\r\n }}\r\n >\r\n {this.label && <label class=\"gb-rich-text__label text-sm-medium\">{this.label}</label>}\r\n\r\n <div class=\"gb-rich-text__wrapper\">\r\n <gb-wysiwyg-toolbar\r\n disabledIcons={this.disabledIcons}\r\n is-bold={this.isBold}\r\n is-italic={this.isItalic}\r\n is-h1={this.isH1}\r\n is-h2={this.isH2}\r\n is-underline={this.isUnderline}\r\n is-quote={this.isQuote}\r\n is-link={this.isLink}\r\n is-bullet-list={this.isBulletList}\r\n is-ordered-list={this.isOrderedList}\r\n onToolbarAction={(ev: CustomEvent<string>) => this.handleToolbarAction(ev)}\r\n ></gb-wysiwyg-toolbar>\r\n\r\n {this.destructive && (\r\n <svg xmlns=\"http://www.w3.org/2000/svg\" width=\"16\" height=\"16\" viewBox=\"0 0 16 16\" fill=\"none\" class=\"alert_circle\">\r\n <path\r\n d=\"M7.99483 9.99998H8.00081M8.00016 7.99998V5.33331M14.6668 7.99998C14.6668 11.6819 11.6821 14.6666 8.00016 14.6666C4.31826 14.6666 1.3335 11.6819 1.3335 7.99998C1.3335 4.31808 4.31826 1.33331 8.00016 1.33331C11.6821 1.33331 14.6668 4.31808 14.6668 7.99998Z\"\r\n stroke=\"var(--color-icon-danger, #B51726)\"\r\n stroke-width=\"1.33333\"\r\n stroke-linecap=\"round\"\r\n stroke-linejoin=\"round\"\r\n />\r\n </svg>\r\n )}\r\n {this.attachments.length > 0 && (\r\n <div class=\"gb-rich-text__attachments\">\r\n {this.attachments.map((attachment, index) => (\r\n <div class=\"gb-rich-text__attachment-item\" key={index}>\r\n {/* <span class=\"gb-rich-text__attachment-icon\">{this.getFileIcon(attachment.type)}</span> */}\r\n <span class=\"gb-rich-text__attachment-icon\">\r\n <gb-file-type-icon file-type={this.getFileExtension(attachment.name)} file-style=\"default\"></gb-file-type-icon>\r\n </span>\r\n <div class=\"gb-rich-text__attachment-info\">\r\n <span class=\"gb-rich-text__attachment-name text-sm-medium\">{attachment.name}</span>\r\n <span class=\"gb-rich-text__attachment-size text-xs-regular\">{this.formatFileSize(attachment.size)}</span>\r\n </div>\r\n {/* <button\r\n class=\"gb-rich-text__attachment-remove\"\r\n onMouseDown={(ev: MouseEvent) => {\r\n ev.preventDefault();\r\n this.removeAttachment(index);\r\n }}\r\n aria-label=\"Remove attachment\"\r\n >\r\n <svg xmlns=\"http://www.w3.org/2000/svg\" width=\"16\" height=\"16\" viewBox=\"0 0 16 16\" fill=\"none\">\r\n <path d=\"M12 4L4 12M4 4l8 8\" stroke=\"currentColor\" stroke-width=\"1.5\" stroke-linecap=\"round\" />\r\n </svg>\r\n </button> */}\r\n <gb-button-close color=\"gray\" size=\"sm\" onClick={() => this.removeAttachment(index)}></gb-button-close>\r\n </div>\r\n ))}\r\n </div>\r\n )}\r\n\r\n {/* Hidden file input for local image selection */}\r\n <input\r\n ref={el => (this.fileInputEl = el as HTMLInputElement)}\r\n type=\"file\"\r\n accept=\"image/*\"\r\n style={{ display: 'none' }}\r\n onChange={(e: Event) => this.handleFileInput(e)}\r\n />\r\n\r\n {/* Hidden file input for attachments */}\r\n <input\r\n ref={el => (this.attachmentInputEl = el as HTMLInputElement)}\r\n type=\"file\"\r\n accept=\".pdf,.doc,.docx,.xls,.xlsx,.csv,.txt,.zip\"\r\n style={{ display: 'none' }}\r\n onChange={(e: Event) => this.handleAttachmentInput(e)}\r\n />\r\n <div class=\"gb-rich-text__content\"></div>\r\n </div>\r\n\r\n {/* {(this.showHintText || this.errorText) && <span class=\"gb-rich-text__hint text-sm-regular\">{this.destructive ? this.errorText : this.hintText}</span>} */}\r\n {this.showHintText && (\r\n <>{!this.destructive ? <p class=\"gb-rich-text__hint text-sm-regular\">{this.hintText}</p> : <p class=\"error_text text-sm-regular\">{this.errorText}</p>}</>\r\n )}\r\n </div>\r\n );\r\n }\r\n}\r\n"]}
@@ -0,0 +1,84 @@
1
+ import Image from "@tiptap/extension-image";
2
+ // Extends the base Image node with a `width` attribute (persisted as inline
3
+ // style, so it round-trips through getHTML()/getJSON()) and a NodeView that
4
+ // renders a drag handle for resizing. Height is left to `auto` via CSS so
5
+ // the aspect ratio is preserved - only width is user-controlled.
6
+ export const ResizableImage = Image.extend({
7
+ addAttributes() {
8
+ var _a;
9
+ return Object.assign(Object.assign({}, (_a = this.parent) === null || _a === void 0 ? void 0 : _a.call(this)), { width: {
10
+ default: null,
11
+ parseHTML: (element) => {
12
+ const width = element.style.width || element.getAttribute('width');
13
+ return width ? parseInt(width, 10) : null;
14
+ },
15
+ renderHTML: (attributes) => {
16
+ if (!attributes.width)
17
+ return {};
18
+ return { style: `width: ${attributes.width}px` };
19
+ },
20
+ } });
21
+ },
22
+ addNodeView() {
23
+ return ({ node, getPos, editor }) => {
24
+ let currentNode = node;
25
+ const container = document.createElement('div');
26
+ container.className = 'gb-resizable-image';
27
+ const img = document.createElement('img');
28
+ img.src = currentNode.attrs.src;
29
+ if (currentNode.attrs.alt)
30
+ img.alt = currentNode.attrs.alt;
31
+ if (currentNode.attrs.title)
32
+ img.title = currentNode.attrs.title;
33
+ if (currentNode.attrs.width)
34
+ img.style.width = `${currentNode.attrs.width}px`;
35
+ const handle = document.createElement('span');
36
+ handle.className = 'gb-resizable-image__handle';
37
+ handle.contentEditable = 'false';
38
+ container.appendChild(img);
39
+ container.appendChild(handle);
40
+ let startX = 0;
41
+ let startWidth = 0;
42
+ const onMouseMove = (event) => {
43
+ const newWidth = Math.max(40, startWidth + (event.clientX - startX));
44
+ img.style.width = `${newWidth}px`;
45
+ };
46
+ const commitWidth = () => {
47
+ document.removeEventListener('mousemove', onMouseMove);
48
+ document.removeEventListener('mouseup', commitWidth);
49
+ if (typeof getPos !== 'function')
50
+ return;
51
+ const pos = getPos();
52
+ if (pos == null)
53
+ return;
54
+ const finalWidth = Math.round(img.getBoundingClientRect().width);
55
+ editor.view.dispatch(editor.view.state.tr.setNodeMarkup(pos, undefined, Object.assign(Object.assign({}, currentNode.attrs), { width: finalWidth })));
56
+ };
57
+ handle.addEventListener('mousedown', (event) => {
58
+ event.preventDefault();
59
+ event.stopPropagation();
60
+ startX = event.clientX;
61
+ startWidth = img.getBoundingClientRect().width;
62
+ document.addEventListener('mousemove', onMouseMove);
63
+ document.addEventListener('mouseup', commitWidth);
64
+ });
65
+ return {
66
+ dom: container,
67
+ update(updatedNode) {
68
+ if (updatedNode.type.name !== currentNode.type.name)
69
+ return false;
70
+ currentNode = updatedNode;
71
+ if (img.src !== updatedNode.attrs.src)
72
+ img.src = updatedNode.attrs.src;
73
+ if (updatedNode.attrs.width)
74
+ img.style.width = `${updatedNode.attrs.width}px`;
75
+ return true;
76
+ },
77
+ // Let the drag handle manage its own mouse events instead of ProseMirror
78
+ // treating them as a selection/drag gesture on the node.
79
+ stopEvent: event => handle.contains(event.target),
80
+ };
81
+ };
82
+ },
83
+ });
84
+ //# sourceMappingURL=resizable-image.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"resizable-image.js","sourceRoot":"","sources":["../../../src/components/gb-rich-text/resizable-image.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,yBAAyB,CAAC;AAE5C,4EAA4E;AAC5E,4EAA4E;AAC5E,0EAA0E;AAC1E,iEAAiE;AACjE,MAAM,CAAC,MAAM,cAAc,GAAG,KAAK,CAAC,MAAM,CAAC;IACzC,aAAa;;QACX,uCACK,MAAA,IAAI,CAAC,MAAM,oDAAI,KAClB,KAAK,EAAE;gBACL,OAAO,EAAE,IAAI;gBACb,SAAS,EAAE,CAAC,OAAoB,EAAE,EAAE;oBAClC,MAAM,KAAK,GAAG,OAAO,CAAC,KAAK,CAAC,KAAK,IAAI,OAAO,CAAC,YAAY,CAAC,OAAO,CAAC,CAAC;oBACnE,OAAO,KAAK,CAAC,CAAC,CAAC,QAAQ,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;gBAC5C,CAAC;gBACD,UAAU,EAAE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AAgB,CAAC,SAAS,EAAE,WAAW,CAAC,CAAC;YACpD,CAAC,CAAC,CAAC;YAEH,OAAO;gBACL,GAAG,EAAE,SAAS;gBACd,MAAM,CAAC,WAAW;oBAChB,IAAI,WAAW,CAAC,IAAI,CAAC,IAAI,KAAK,WAAW,CAAC,IAAI,CAAC,IAAI;wBAAE,OAAO,KAAK,CAAC;oBAClE,WAAW,GAAG,WAAW,CAAC;oBAC1B,IAAI,GAAG,CAAC,GAAG,KAAK,WAAW,CAAC,KAAK,CAAC,GAAG;wBAAE,GAAG,CAAC,GAAG,GAAG,WAAW,CAAC,KAAK,CAAC,GAAG,CAAC;oBACvE,IAAI,WAAW,CAAC,KAAK,CAAC,KAAK;wBAAE,GAAG,CAAC,KAAK,CAAC,KAAK,GAAG,GAAG,WAAW,CAAC,KAAK,CAAC,KAAK,IAAI,CAAC;oBAC9E,OAAO,IAAI,CAAC;gBACd,CAAC;gBACD,yEAAyE;gBACzE,yDAAyD;gBACzD,SAAS,EAAE,KAAK,CAAC,EAAE,CAAC,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,MAAc,CAAC;aAC1D,CAAC;QACJ,CAAC,CAAC;IACJ,CAAC;CACF,CAAC,CAAC","sourcesContent":["import Image from '@tiptap/extension-image';\n\n// Extends the base Image node with a `width` attribute (persisted as inline\n// style, so it round-trips through getHTML()/getJSON()) and a NodeView that\n// renders a drag handle for resizing. Height is left to `auto` via CSS so\n// the aspect ratio is preserved - only width is user-controlled.\nexport const ResizableImage = Image.extend({\n addAttributes() {\n return {\n ...this.parent?.(),\n width: {\n default: null,\n parseHTML: (element: HTMLElement) => {\n const width = element.style.width || element.getAttribute('width');\n return width ? parseInt(width, 10) : null;\n },\n renderHTML: (attributes: { width?: number | null }) => {\n if (!attributes.width) return {};\n return { style: `width: ${attributes.width}px` };\n },\n },\n };\n },\n\n addNodeView() {\n return ({ node, getPos, editor }) => {\n let currentNode = node;\n\n const container = document.createElement('div');\n container.className = 'gb-resizable-image';\n\n const img = document.createElement('img');\n img.src = currentNode.attrs.src;\n if (currentNode.attrs.alt) img.alt = currentNode.attrs.alt;\n if (currentNode.attrs.title) img.title = currentNode.attrs.title;\n if (currentNode.attrs.width) img.style.width = `${currentNode.attrs.width}px`;\n\n const handle = document.createElement('span');\n handle.className = 'gb-resizable-image__handle';\n handle.contentEditable = 'false';\n\n container.appendChild(img);\n container.appendChild(handle);\n\n let startX = 0;\n let startWidth = 0;\n\n const onMouseMove = (event: MouseEvent) => {\n const newWidth = Math.max(40, startWidth + (event.clientX - startX));\n img.style.width = `${newWidth}px`;\n };\n\n const commitWidth = () => {\n document.removeEventListener('mousemove', onMouseMove);\n document.removeEventListener('mouseup', commitWidth);\n\n if (typeof getPos !== 'function') return;\n const pos = getPos();\n if (pos == null) return;\n\n const finalWidth = Math.round(img.getBoundingClientRect().width);\n editor.view.dispatch(\n editor.view.state.tr.setNodeMarkup(pos, undefined, {\n ...currentNode.attrs,\n width: finalWidth,\n }),\n );\n };\n\n handle.addEventListener('mousedown', (event: MouseEvent) => {\n event.preventDefault();\n event.stopPropagation();\n startX = event.clientX;\n startWidth = img.getBoundingClientRect().width;\n document.addEventListener('mousemove', onMouseMove);\n document.addEventListener('mouseup', commitWidth);\n });\n\n return {\n dom: container,\n update(updatedNode) {\n if (updatedNode.type.name !== currentNode.type.name) return false;\n currentNode = updatedNode;\n if (img.src !== updatedNode.attrs.src) img.src = updatedNode.attrs.src;\n if (updatedNode.attrs.width) img.style.width = `${updatedNode.attrs.width}px`;\n return true;\n },\n // Let the drag handle manage its own mouse events instead of ProseMirror\n // treating them as a selection/drag gesture on the node.\n stopEvent: event => handle.contains(event.target as Node),\n };\n };\n },\n});\n"]}