@xjur-ui/react 2.1.0 → 2.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +18 -0
- package/dist/{chunk-IRHU7PDO.js → chunk-2JQVYVAT.js} +2 -2
- package/dist/chunk-2JQVYVAT.js.map +1 -0
- package/dist/chunk-2JU3PFV2.js +2 -0
- package/dist/chunk-2JU3PFV2.js.map +1 -0
- package/dist/chunk-3H75F4Y2.js +2 -0
- package/dist/chunk-3H75F4Y2.js.map +1 -0
- package/dist/{chunk-Z47R2CIM.js → chunk-3L772WC6.js} +2 -2
- package/dist/chunk-3L772WC6.js.map +1 -0
- package/dist/chunk-43DUEHUA.js +2 -0
- package/dist/chunk-43DUEHUA.js.map +1 -0
- package/dist/chunk-4BGAERSD.js +2 -0
- package/dist/chunk-4BGAERSD.js.map +1 -0
- package/dist/{chunk-5WLIDYZH.js → chunk-4PTFZTVU.js} +2 -2
- package/dist/{chunk-5WLIDYZH.js.map → chunk-4PTFZTVU.js.map} +1 -1
- package/dist/chunk-6PHXO2YA.js +2 -0
- package/dist/{chunk-RWMV7APX.js.map → chunk-6PHXO2YA.js.map} +1 -1
- package/dist/{chunk-2CTBH6VI.js → chunk-7HG6Y3VV.js} +2 -2
- package/dist/{chunk-2CTBH6VI.js.map → chunk-7HG6Y3VV.js.map} +1 -1
- package/dist/chunk-7HMMMRDA.js +2 -0
- package/dist/chunk-7HMMMRDA.js.map +1 -0
- package/dist/chunk-7QGN6XFA.js +2 -0
- package/dist/chunk-7QGN6XFA.js.map +1 -0
- package/dist/chunk-AKR2BJRB.js +2 -0
- package/dist/chunk-AKR2BJRB.js.map +1 -0
- package/dist/{chunk-BK6FP63A.js → chunk-ASZAHSU5.js} +2 -2
- package/dist/{chunk-BK6FP63A.js.map → chunk-ASZAHSU5.js.map} +1 -1
- package/dist/chunk-DOC3XTYC.js +2 -0
- package/dist/chunk-DOC3XTYC.js.map +1 -0
- package/dist/{chunk-IKL6PSXU.js → chunk-DT44JTXB.js} +2 -2
- package/dist/{chunk-IKL6PSXU.js.map → chunk-DT44JTXB.js.map} +1 -1
- package/dist/chunk-DVDHTP4C.js +2 -0
- package/dist/chunk-DVDHTP4C.js.map +1 -0
- package/dist/chunk-EITO7GZX.js +2 -0
- package/dist/chunk-EITO7GZX.js.map +1 -0
- package/dist/chunk-F7ANJ4HD.js +2 -0
- package/dist/chunk-F7ANJ4HD.js.map +1 -0
- package/dist/chunk-FQTUN47L.js +2 -0
- package/dist/chunk-FQTUN47L.js.map +1 -0
- package/dist/chunk-FUHASFGU.js +2 -0
- package/dist/chunk-FUHASFGU.js.map +1 -0
- package/dist/{chunk-CI3ZXWEX.js → chunk-G6NSC3FL.js} +2 -2
- package/dist/{chunk-CI3ZXWEX.js.map → chunk-G6NSC3FL.js.map} +1 -1
- package/dist/{chunk-6AD6O6II.js → chunk-GKILN5HI.js} +2 -2
- package/dist/chunk-GKILN5HI.js.map +1 -0
- package/dist/chunk-GVKH2BG2.js +2 -0
- package/dist/chunk-GVKH2BG2.js.map +1 -0
- package/dist/chunk-JF7JKJES.js +2 -0
- package/dist/chunk-JF7JKJES.js.map +1 -0
- package/dist/{chunk-TSVURBUY.js → chunk-JGPHBUVM.js} +2 -2
- package/dist/chunk-JGPHBUVM.js.map +1 -0
- package/dist/{chunk-PKCW37CJ.js → chunk-M6ZI7M3R.js} +2 -2
- package/dist/chunk-M6ZI7M3R.js.map +1 -0
- package/dist/{chunk-UXIVZWLB.js → chunk-MQ7YTZBI.js} +2 -2
- package/dist/{chunk-UXIVZWLB.js.map → chunk-MQ7YTZBI.js.map} +1 -1
- package/dist/chunk-O3JK6QF6.js +2 -0
- package/dist/chunk-O3JK6QF6.js.map +1 -0
- package/dist/{chunk-L4ET6GIZ.js → chunk-OKSGVAQQ.js} +2 -2
- package/dist/chunk-OKSGVAQQ.js.map +1 -0
- package/dist/chunk-OLWYBKQR.js +2 -0
- package/dist/chunk-OLWYBKQR.js.map +1 -0
- package/dist/chunk-PBR7SFWY.js +2 -0
- package/dist/chunk-PBR7SFWY.js.map +1 -0
- package/dist/chunk-Q2BZSHS2.js +2 -0
- package/dist/chunk-Q2BZSHS2.js.map +1 -0
- package/dist/{chunk-OS53BV63.js → chunk-RGKXZJJS.js} +3 -3
- package/dist/{chunk-OS53BV63.js.map → chunk-RGKXZJJS.js.map} +1 -1
- package/dist/chunk-SSTXFHNX.js +2 -0
- package/dist/chunk-SSTXFHNX.js.map +1 -0
- package/dist/chunk-TORICLEW.js +2 -0
- package/dist/chunk-TORICLEW.js.map +1 -0
- package/dist/chunk-TYWCS7GS.js +2 -0
- package/dist/chunk-TYWCS7GS.js.map +1 -0
- package/dist/chunk-URDL5OKH.js +2 -0
- package/dist/chunk-URDL5OKH.js.map +1 -0
- package/dist/chunk-V2FCP4FA.js +2 -0
- package/dist/chunk-V2FCP4FA.js.map +1 -0
- package/dist/chunk-VCNKCHFF.js +2 -0
- package/dist/chunk-VCNKCHFF.js.map +1 -0
- package/dist/chunk-WEGFAS5P.js +2 -0
- package/dist/chunk-WEGFAS5P.js.map +1 -0
- package/dist/chunk-X6SOSTUN.js +2 -0
- package/dist/chunk-X6SOSTUN.js.map +1 -0
- package/dist/chunk-XGPKBYDY.js +2 -0
- package/dist/chunk-XGPKBYDY.js.map +1 -0
- package/dist/chunk-YOLTIAFT.js +2 -0
- package/dist/{chunk-KIFR5VIE.js.map → chunk-YOLTIAFT.js.map} +1 -1
- package/dist/chunk-ZPQPJJQJ.js +2 -0
- package/dist/chunk-ZPQPJJQJ.js.map +1 -0
- package/dist/components/breadcrumb.js +1 -1
- package/dist/components/chip.d.ts +1 -1
- package/dist/components/chip.js +1 -1
- package/dist/components/controls/button.js +2 -0
- package/dist/components/{form → controls}/calendar.js +1 -1
- package/dist/components/controls/calendar.js.map +1 -0
- package/dist/components/{form → controls}/checkbox.js +1 -1
- package/dist/components/controls/checkbox.js.map +1 -0
- package/dist/components/{form → controls}/context/field.context.d.ts +1 -2
- package/dist/components/controls/context/field.context.js +2 -0
- package/dist/components/{form → controls}/date-picker.d.ts +2 -1
- package/dist/components/{form → controls}/date-picker.js +1 -1
- package/dist/components/controls/date-picker.js.map +1 -0
- package/dist/components/controls/floating-label.js +2 -0
- package/dist/components/{form → controls}/input.d.ts +3 -2
- package/dist/components/controls/input.js +2 -0
- package/dist/components/controls/otp-input.js.map +1 -0
- package/dist/components/controls/radio.js.map +1 -0
- package/dist/components/{form → controls}/rich-editor.js +1 -1
- package/dist/components/controls/rich-editor.js.map +1 -0
- package/dist/components/{form → controls}/search-input.d.ts +9 -1
- package/dist/components/controls/search-input.js +2 -0
- package/dist/components/controls/search-input.js.map +1 -0
- package/dist/components/controls/search-selector.d.ts +19 -0
- package/dist/components/controls/search-selector.js +2 -0
- package/dist/components/controls/search-selector.js.map +1 -0
- package/dist/components/{form → controls}/select.d.ts +2 -1
- package/dist/components/{form → controls}/select.js +1 -1
- package/dist/components/controls/switch.js +2 -0
- package/dist/components/custom/pessoa/index.d.ts +16 -0
- package/dist/components/custom/pessoa/index.js +2 -0
- package/dist/components/custom/pessoa/index.js.map +1 -0
- package/dist/components/custom/pessoa/pessoa-add-button.d.ts +9 -0
- package/dist/components/custom/pessoa/pessoa-add-button.js +2 -0
- package/dist/components/custom/pessoa/pessoa-add-button.js.map +1 -0
- package/dist/components/custom/pessoa/pessoa-body.d.ts +8 -0
- package/dist/components/custom/pessoa/pessoa-body.js +2 -0
- package/dist/components/custom/pessoa/pessoa-body.js.map +1 -0
- package/dist/components/custom/pessoa/pessoa-close-button.d.ts +8 -0
- package/dist/components/custom/pessoa/pessoa-close-button.js +2 -0
- package/dist/components/custom/pessoa/pessoa-close-button.js.map +1 -0
- package/dist/components/custom/pessoa/pessoa-content.d.ts +8 -0
- package/dist/components/custom/pessoa/pessoa-content.js +2 -0
- package/dist/components/custom/pessoa/pessoa-content.js.map +1 -0
- package/dist/components/custom/pessoa/pessoa-footer.d.ts +8 -0
- package/dist/components/custom/pessoa/pessoa-footer.js +2 -0
- package/dist/components/custom/pessoa/pessoa-footer.js.map +1 -0
- package/dist/components/custom/pessoa/pessoa-header.d.ts +10 -0
- package/dist/components/custom/pessoa/pessoa-header.js +2 -0
- package/dist/components/custom/pessoa/pessoa-header.js.map +1 -0
- package/dist/components/custom/pessoa/pessoa-trigger.d.ts +8 -0
- package/dist/components/custom/pessoa/pessoa-trigger.js +2 -0
- package/dist/components/custom/pessoa/pessoa-trigger.js.map +1 -0
- package/dist/components/custom/pessoa/pessoa.context.d.ts +25 -0
- package/dist/components/custom/pessoa/pessoa.context.js +2 -0
- package/dist/components/custom/pessoa/pessoa.context.js.map +1 -0
- package/dist/components/custom/pessoa/pessoa.d.ts +11 -0
- package/dist/components/custom/pessoa/pessoa.js +2 -0
- package/dist/components/custom/pessoa/pessoa.js.map +1 -0
- package/dist/components/dialog.js +1 -1
- package/dist/components/dialog.js.map +1 -1
- package/dist/components/drag-and-drop/index.js +1 -1
- package/dist/components/dropdown-menu.js +1 -1
- package/dist/components/full-calendar/calendar-add-event.js +1 -1
- package/dist/components/full-calendar/calendar-add-event.js.map +1 -1
- package/dist/components/full-calendar/calendar-cell.js +1 -1
- package/dist/components/full-calendar/calendar-day-view.js +1 -1
- package/dist/components/full-calendar/calendar-month-view.js +1 -1
- package/dist/components/full-calendar/calendar-more-events-dropdown.js +1 -1
- package/dist/components/full-calendar/calendar-navigator.js +1 -1
- package/dist/components/full-calendar/calendar-today-button.d.ts +1 -1
- package/dist/components/full-calendar/calendar-today-button.js +1 -1
- package/dist/components/full-calendar/calendar-toggle-view.js +1 -1
- package/dist/components/full-calendar/calendar-view-renderer.js +1 -1
- package/dist/components/full-calendar/calendar-week-view.js +1 -1
- package/dist/components/full-calendar/index.d.ts +1 -1
- package/dist/components/full-calendar/index.js +1 -1
- package/dist/components/horizontal-scroll.js +1 -1
- package/dist/components/horizontal-scroll.js.map +1 -1
- package/dist/components/icon.d.ts +2 -2
- package/dist/components/icon.js +1 -1
- package/dist/components/list.js +1 -1
- package/dist/components/selection-bar.d.ts +1 -1
- package/dist/components/selection-bar.js +1 -1
- package/dist/components/selection-bar.js.map +1 -1
- package/dist/components/sheet.js +1 -1
- package/dist/components/sheet.js.map +1 -1
- package/dist/components/steps/index.d.ts +11 -0
- package/dist/components/steps/index.js +2 -0
- package/dist/components/steps/index.js.map +1 -0
- package/dist/components/steps/step.d.ts +8 -0
- package/dist/components/steps/step.js +2 -0
- package/dist/components/steps/step.js.map +1 -0
- package/dist/components/steps/steps-action.d.ts +12 -0
- package/dist/components/steps/steps-action.js +2 -0
- package/dist/components/steps/steps-action.js.map +1 -0
- package/dist/components/steps/steps-content.d.ts +6 -0
- package/dist/components/steps/steps-content.js +2 -0
- package/dist/components/steps/steps-content.js.map +1 -0
- package/dist/components/steps/steps-context.d.ts +22 -0
- package/dist/components/steps/steps-context.js +2 -0
- package/dist/components/steps/steps-context.js.map +1 -0
- package/dist/components/steps/steps-navigation.d.ts +6 -0
- package/dist/components/steps/steps-navigation.js +2 -0
- package/dist/components/steps/steps-navigation.js.map +1 -0
- package/dist/components/steps/steps-root.d.ts +7 -0
- package/dist/components/steps/steps-root.js +2 -0
- package/dist/components/steps/steps-root.js.map +1 -0
- package/dist/components/table/index.d.ts +9 -0
- package/dist/components/table/index.js +2 -0
- package/dist/components/table/index.js.map +1 -0
- package/dist/components/table/table-body.d.ts +5 -0
- package/dist/components/table/table-body.js +2 -0
- package/dist/components/table/table-body.js.map +1 -0
- package/dist/components/table/table-cell.d.ts +5 -0
- package/dist/components/table/table-cell.js +2 -0
- package/dist/components/table/table-cell.js.map +1 -0
- package/dist/components/table/table-footer.d.ts +5 -0
- package/dist/components/table/table-footer.js +2 -0
- package/dist/components/table/table-footer.js.map +1 -0
- package/dist/components/table/table-head.d.ts +6 -0
- package/dist/components/table/table-head.js +2 -0
- package/dist/components/table/table-head.js.map +1 -0
- package/dist/components/table/table-header.d.ts +5 -0
- package/dist/components/table/table-header.js +2 -0
- package/dist/components/table/table-header.js.map +1 -0
- package/dist/components/table/table-row.d.ts +7 -0
- package/dist/components/table/table-row.js +2 -0
- package/dist/components/table/table-row.js.map +1 -0
- package/dist/components/table/table-sort.d.ts +7 -0
- package/dist/components/table/table-sort.js +2 -0
- package/dist/components/table/table-sort.js.map +1 -0
- package/dist/components/table/table.d.ts +5 -0
- package/dist/components/table/table.js +2 -0
- package/dist/components/table/table.js.map +1 -0
- package/dist/components/tag.d.ts +1 -1
- package/dist/components/tag.js +1 -1
- package/dist/components/upload.js +1 -1
- package/dist/components/upload.js.map +1 -1
- package/dist/icons-C-hGI45d.d.ts +4 -0
- package/dist/index.css +1 -1
- package/dist/index.css.map +1 -1
- package/dist/input-mask-DhbtCxF7.d.ts +3 -0
- package/package.json +22 -16
- package/.turbo/turbo-build.log +0 -288
- package/dist/chunk-2CM3SFOY.js +0 -2
- package/dist/chunk-2CM3SFOY.js.map +0 -1
- package/dist/chunk-6AD6O6II.js.map +0 -1
- package/dist/chunk-AA6V5YEC.js +0 -2
- package/dist/chunk-AA6V5YEC.js.map +0 -1
- package/dist/chunk-IRHU7PDO.js.map +0 -1
- package/dist/chunk-KIFR5VIE.js +0 -2
- package/dist/chunk-L4ET6GIZ.js.map +0 -1
- package/dist/chunk-PKCW37CJ.js.map +0 -1
- package/dist/chunk-RWMV7APX.js +0 -2
- package/dist/chunk-TSVURBUY.js.map +0 -1
- package/dist/chunk-WV7QV2PU.js +0 -2
- package/dist/chunk-WV7QV2PU.js.map +0 -1
- package/dist/chunk-Z47R2CIM.js.map +0 -1
- package/dist/components/form/button.js +0 -2
- package/dist/components/form/calendar.js.map +0 -1
- package/dist/components/form/checkbox.js.map +0 -1
- package/dist/components/form/context/field.context.js +0 -2
- package/dist/components/form/date-picker.js.map +0 -1
- package/dist/components/form/floating-label.js +0 -2
- package/dist/components/form/input.js +0 -2
- package/dist/components/form/otp-input.js.map +0 -1
- package/dist/components/form/radio.js.map +0 -1
- package/dist/components/form/rich-editor.js.map +0 -1
- package/dist/components/form/search-input.js +0 -2
- package/dist/components/form/search-input.js.map +0 -1
- package/dist/components/form/switch.js +0 -2
- package/dist/components/table.d.ts +0 -17
- package/dist/components/table.js +0 -2
- package/dist/components/table.js.map +0 -1
- package/dist/icons-CmDuL0gZ.d.ts +0 -4
- package/eslint.config.js +0 -10
- package/postcss.config.js +0 -5
- package/prettier.config.js +0 -7
- package/src/components/avatar-group.tsx +0 -76
- package/src/components/avatar.tsx +0 -54
- package/src/components/badge.tsx +0 -40
- package/src/components/breadcrumb.tsx +0 -119
- package/src/components/chip.tsx +0 -117
- package/src/components/collapsible.tsx +0 -35
- package/src/components/dialog.tsx +0 -242
- package/src/components/divider.tsx +0 -24
- package/src/components/drag-and-drop/drag-handle.tsx +0 -46
- package/src/components/drag-and-drop/drag-list-item.tsx +0 -91
- package/src/components/drag-and-drop/drag-list.tsx +0 -47
- package/src/components/drag-and-drop/drag-root.tsx +0 -30
- package/src/components/drag-and-drop/index.ts +0 -39
- package/src/components/drag-and-drop/types/drag-item.ts +0 -7
- package/src/components/dropdown-menu.tsx +0 -101
- package/src/components/form/button.tsx +0 -107
- package/src/components/form/calendar.tsx +0 -124
- package/src/components/form/checkbox.tsx +0 -57
- package/src/components/form/context/field.context.ts +0 -27
- package/src/components/form/date-picker.tsx +0 -199
- package/src/components/form/floating-label.tsx +0 -60
- package/src/components/form/input.tsx +0 -235
- package/src/components/form/otp-input.tsx +0 -45
- package/src/components/form/radio.tsx +0 -74
- package/src/components/form/rich-editor.tsx +0 -372
- package/src/components/form/search-input.tsx +0 -111
- package/src/components/form/select.tsx +0 -274
- package/src/components/form/switch.tsx +0 -31
- package/src/components/full-calendar/calendar-add-event.tsx +0 -15
- package/src/components/full-calendar/calendar-body.tsx +0 -12
- package/src/components/full-calendar/calendar-cell.tsx +0 -120
- package/src/components/full-calendar/calendar-day-view.tsx +0 -76
- package/src/components/full-calendar/calendar-event.tsx +0 -178
- package/src/components/full-calendar/calendar-header.tsx +0 -14
- package/src/components/full-calendar/calendar-month-view.tsx +0 -69
- package/src/components/full-calendar/calendar-more-events-dropdown.tsx +0 -39
- package/src/components/full-calendar/calendar-navigator.tsx +0 -86
- package/src/components/full-calendar/calendar-root.tsx +0 -165
- package/src/components/full-calendar/calendar-today-button.tsx +0 -21
- package/src/components/full-calendar/calendar-toggle-view.tsx +0 -61
- package/src/components/full-calendar/calendar-view-renderer.tsx +0 -19
- package/src/components/full-calendar/calendar-week-day.tsx +0 -49
- package/src/components/full-calendar/calendar-week-view.tsx +0 -88
- package/src/components/full-calendar/helpers/calendar.ts +0 -158
- package/src/components/full-calendar/index.ts +0 -16
- package/src/components/full-calendar/types/calendar-cell.ts +0 -4
- package/src/components/full-calendar/types/calendar-event.ts +0 -7
- package/src/components/full-calendar/types/calendar-view.ts +0 -1
- package/src/components/full-calendar/types/calendar-week-hour.ts +0 -4
- package/src/components/horizontal-scroll.tsx +0 -159
- package/src/components/icon.tsx +0 -29
- package/src/components/list.tsx +0 -111
- package/src/components/logo.tsx +0 -44
- package/src/components/selection-bar.tsx +0 -273
- package/src/components/sheet.tsx +0 -141
- package/src/components/skeleton.tsx +0 -12
- package/src/components/status.tsx +0 -43
- package/src/components/table.tsx +0 -160
- package/src/components/tabs.tsx +0 -72
- package/src/components/tag.tsx +0 -99
- package/src/components/tooltip.tsx +0 -63
- package/src/components/typography.tsx +0 -85
- package/src/components/upload.tsx +0 -647
- package/src/hooks/index.ts +0 -1
- package/src/hooks/use-os.ts +0 -32
- package/src/index.css +0 -5
- package/src/resources/icons.ts +0 -153
- package/src/resources/input-mask.ts +0 -91
- package/src/resources/logo/horizontal.tsx +0 -70
- package/src/resources/logo/icon.tsx +0 -54
- package/src/resources/logo/index.tsx +0 -33
- package/src/resources/logo/vertical.tsx +0 -70
- package/src/types.d.ts +0 -4
- package/tsconfig.json +0 -4
- package/tsup.config.ts +0 -30
- /package/dist/components/{form → controls}/button.d.ts +0 -0
- /package/dist/components/{form → controls}/button.js.map +0 -0
- /package/dist/components/{form → controls}/calendar.d.ts +0 -0
- /package/dist/components/{form → controls}/checkbox.d.ts +0 -0
- /package/dist/components/{form → controls}/context/field.context.js.map +0 -0
- /package/dist/components/{form → controls}/floating-label.d.ts +0 -0
- /package/dist/components/{form → controls}/floating-label.js.map +0 -0
- /package/dist/components/{form → controls}/input.js.map +0 -0
- /package/dist/components/{form → controls}/otp-input.d.ts +0 -0
- /package/dist/components/{form → controls}/otp-input.js +0 -0
- /package/dist/components/{form → controls}/radio.d.ts +0 -0
- /package/dist/components/{form → controls}/radio.js +0 -0
- /package/dist/components/{form → controls}/rich-editor.d.ts +0 -0
- /package/dist/components/{form → controls}/select.js.map +0 -0
- /package/dist/components/{form → controls}/switch.d.ts +0 -0
- /package/dist/components/{form → controls}/switch.js.map +0 -0
|
@@ -1,372 +0,0 @@
|
|
|
1
|
-
import { cx } from '@xjur-ui/util'
|
|
2
|
-
import { useCallback, useMemo, useState, type ComponentProps } from 'react'
|
|
3
|
-
import {
|
|
4
|
-
EditorContent,
|
|
5
|
-
EditorContext,
|
|
6
|
-
useCurrentEditor as useRichTextEditor,
|
|
7
|
-
useEditorState as useRichTextEditorState,
|
|
8
|
-
useEditor,
|
|
9
|
-
type EditorOptions
|
|
10
|
-
} from '@tiptap/react'
|
|
11
|
-
import type { Extension } from '@tiptap/core'
|
|
12
|
-
import { StarterKit } from '@tiptap/starter-kit'
|
|
13
|
-
import { Heading, type Level } from '@tiptap/extension-heading'
|
|
14
|
-
// Import specific extension instead of full extensions bundle
|
|
15
|
-
import { Placeholder } from '@tiptap/extension-placeholder'
|
|
16
|
-
import { useOS } from '../../hooks'
|
|
17
|
-
import { Icon, type IconType } from '../icon'
|
|
18
|
-
import { Button, type ButtonProps } from '../form/button'
|
|
19
|
-
import {
|
|
20
|
-
DropdownMenuContent,
|
|
21
|
-
DropdownMenuItem,
|
|
22
|
-
DropdownMenuItemText,
|
|
23
|
-
DropdownMenuList,
|
|
24
|
-
DropdownMenuRoot,
|
|
25
|
-
DropdownMenuTrigger
|
|
26
|
-
} from '../dropdown-menu'
|
|
27
|
-
import { Tooltip, TooltipTrigger, TooltipContent } from '../tooltip'
|
|
28
|
-
import { Typography } from '../typography'
|
|
29
|
-
|
|
30
|
-
const headingClasses: Partial<Record<Level, string>> = {
|
|
31
|
-
1: 'text-size-body-md',
|
|
32
|
-
2: 'text-size-title-lg',
|
|
33
|
-
3: 'text-size-headline-lg'
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
export function RichEditorRoot({
|
|
37
|
-
className,
|
|
38
|
-
editorOptions,
|
|
39
|
-
...props
|
|
40
|
-
}: ComponentProps<'div'> & {
|
|
41
|
-
editorOptions?: Partial<
|
|
42
|
-
Omit<EditorOptions, 'extensions'> & {
|
|
43
|
-
extensions?: Extension[]
|
|
44
|
-
}
|
|
45
|
-
>
|
|
46
|
-
}) {
|
|
47
|
-
const editor = useEditor({
|
|
48
|
-
...editorOptions,
|
|
49
|
-
extensions: [
|
|
50
|
-
StarterKit.configure({
|
|
51
|
-
bulletList: {
|
|
52
|
-
HTMLAttributes: {
|
|
53
|
-
class: 'list-disc list-outside pl-large-1x'
|
|
54
|
-
}
|
|
55
|
-
},
|
|
56
|
-
orderedList: {
|
|
57
|
-
HTMLAttributes: {
|
|
58
|
-
class: 'list-decimal list-outside pl-large-1x'
|
|
59
|
-
}
|
|
60
|
-
},
|
|
61
|
-
heading: false
|
|
62
|
-
}),
|
|
63
|
-
Placeholder.configure({
|
|
64
|
-
placeholder: ({ node, editor }) =>
|
|
65
|
-
node.type.name === 'paragraph' && editor.isEmpty
|
|
66
|
-
? 'Digite aqui…'
|
|
67
|
-
: '',
|
|
68
|
-
showOnlyWhenEditable: true,
|
|
69
|
-
includeChildren: false,
|
|
70
|
-
emptyNodeClass:
|
|
71
|
-
'before:content-[attr(data-placeholder)] before:absolute before:top-0 before:left-0 before:text-neutral-placeholder first:before:float-left first:before:content-[attr(data-placeholder)] first:before:pointer-events-none'
|
|
72
|
-
}),
|
|
73
|
-
Heading.configure({
|
|
74
|
-
levels: [1, 2, 3]
|
|
75
|
-
}).extend({
|
|
76
|
-
renderHTML({ node, HTMLAttributes }) {
|
|
77
|
-
const level: Level = node.attrs.level ?? 1
|
|
78
|
-
|
|
79
|
-
return [
|
|
80
|
-
'h',
|
|
81
|
-
{
|
|
82
|
-
...HTMLAttributes,
|
|
83
|
-
class: headingClasses[level]
|
|
84
|
-
},
|
|
85
|
-
0
|
|
86
|
-
]
|
|
87
|
-
}
|
|
88
|
-
}),
|
|
89
|
-
...(editorOptions?.extensions ?? [])
|
|
90
|
-
]
|
|
91
|
-
})
|
|
92
|
-
|
|
93
|
-
const value = useMemo(() => ({ editor }), [editor])
|
|
94
|
-
|
|
95
|
-
return (
|
|
96
|
-
<EditorContext.Provider value={value}>
|
|
97
|
-
<div
|
|
98
|
-
className={cx('gap-small flex w-full flex-col', className)}
|
|
99
|
-
data-slot="text-area-root"
|
|
100
|
-
{...props}
|
|
101
|
-
/>
|
|
102
|
-
</EditorContext.Provider>
|
|
103
|
-
)
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
export function RichEditorContent({
|
|
107
|
-
className,
|
|
108
|
-
...props
|
|
109
|
-
}: ComponentProps<'div'>) {
|
|
110
|
-
return (
|
|
111
|
-
<div
|
|
112
|
-
className={cx(
|
|
113
|
-
'bg-layer-2-hover py-small_1x-alt px-small rounded-small-1x min-h-[116px] w-full border border-transparent',
|
|
114
|
-
'hover:border-border-layer-2 transition-colors duration-200',
|
|
115
|
-
'[&_ul_ul]:list-[circle]',
|
|
116
|
-
'[&_ul_ul_ul]:list-[square]',
|
|
117
|
-
'[&_ol_ol]:list-[lower-alpha]',
|
|
118
|
-
'[&_ol_ol_ol]:list-[lower-roman]',
|
|
119
|
-
'gap-small flex flex-col overflow-x-hidden overflow-y-auto',
|
|
120
|
-
className
|
|
121
|
-
)}
|
|
122
|
-
data-slot="text-area-content"
|
|
123
|
-
{...props}
|
|
124
|
-
/>
|
|
125
|
-
)
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
export function RichEditorCaption({
|
|
129
|
-
className,
|
|
130
|
-
...props
|
|
131
|
-
}: ComponentProps<'p'>) {
|
|
132
|
-
return (
|
|
133
|
-
<p
|
|
134
|
-
{...props}
|
|
135
|
-
className={cx(
|
|
136
|
-
'text-size-body-sm text-neutral-dark font-normal',
|
|
137
|
-
className
|
|
138
|
-
)}
|
|
139
|
-
data-slot="text-area-caption"
|
|
140
|
-
/>
|
|
141
|
-
)
|
|
142
|
-
}
|
|
143
|
-
|
|
144
|
-
export function RichEditorAreaText({
|
|
145
|
-
className,
|
|
146
|
-
...props
|
|
147
|
-
}: Omit<ComponentProps<typeof EditorContent>, 'editor'>) {
|
|
148
|
-
const { editor } = useRichTextEditor()
|
|
149
|
-
|
|
150
|
-
return (
|
|
151
|
-
<EditorContent
|
|
152
|
-
className={cx(
|
|
153
|
-
'text-size-body-md text-neutral-dark max-h-[116px] *:h-full *:w-full *:outline-0',
|
|
154
|
-
className
|
|
155
|
-
)}
|
|
156
|
-
editor={editor}
|
|
157
|
-
{...props}
|
|
158
|
-
/>
|
|
159
|
-
)
|
|
160
|
-
}
|
|
161
|
-
|
|
162
|
-
export function RichEditorToolbar({
|
|
163
|
-
className,
|
|
164
|
-
...props
|
|
165
|
-
}: ComponentProps<'div'>) {
|
|
166
|
-
return (
|
|
167
|
-
<div
|
|
168
|
-
className={cx(
|
|
169
|
-
'h-large-4x gap-small-1x h-large-6px scrollbar-hide flex flex-nowrap items-center overflow-x-auto overflow-y-hidden',
|
|
170
|
-
className
|
|
171
|
-
)}
|
|
172
|
-
data-slot="text-area-toolbar"
|
|
173
|
-
{...props}
|
|
174
|
-
/>
|
|
175
|
-
)
|
|
176
|
-
}
|
|
177
|
-
|
|
178
|
-
export function ToolbarButton({
|
|
179
|
-
appearance = 'ghost',
|
|
180
|
-
variant = 'secondary',
|
|
181
|
-
onMouseDown,
|
|
182
|
-
onPointerDown,
|
|
183
|
-
...props
|
|
184
|
-
}: ButtonProps) {
|
|
185
|
-
return (
|
|
186
|
-
<Button
|
|
187
|
-
appearance={appearance}
|
|
188
|
-
size="icon_md"
|
|
189
|
-
tabIndex={-1}
|
|
190
|
-
type="button"
|
|
191
|
-
variant={variant}
|
|
192
|
-
onMouseDown={e => {
|
|
193
|
-
e.preventDefault()
|
|
194
|
-
onMouseDown?.(e)
|
|
195
|
-
}}
|
|
196
|
-
onPointerDown={e => {
|
|
197
|
-
e.preventDefault()
|
|
198
|
-
onPointerDown?.(e)
|
|
199
|
-
}}
|
|
200
|
-
{...props}
|
|
201
|
-
/>
|
|
202
|
-
)
|
|
203
|
-
}
|
|
204
|
-
|
|
205
|
-
type ToggleButtonName =
|
|
206
|
-
| 'bold'
|
|
207
|
-
| 'italic'
|
|
208
|
-
| 'underline'
|
|
209
|
-
| 'strike'
|
|
210
|
-
| 'bulletList'
|
|
211
|
-
| 'orderedList'
|
|
212
|
-
| 'undo'
|
|
213
|
-
| 'redo'
|
|
214
|
-
|
|
215
|
-
export function ToggleButton({
|
|
216
|
-
name,
|
|
217
|
-
...props
|
|
218
|
-
}: ButtonProps & { name: ToggleButtonName }) {
|
|
219
|
-
const { editor } = useRichTextEditor()
|
|
220
|
-
const { shortcut } = useOS()
|
|
221
|
-
|
|
222
|
-
const isActive = useRichTextEditorState({
|
|
223
|
-
editor,
|
|
224
|
-
selector: ctx => ctx.editor?.isActive(name) ?? false
|
|
225
|
-
})
|
|
226
|
-
|
|
227
|
-
const icon = useMemo(() => {
|
|
228
|
-
const iconsMap = new Map<ToggleButtonName, IconType>([
|
|
229
|
-
['bold', 'format_bold'],
|
|
230
|
-
['italic', 'format_italic'],
|
|
231
|
-
['underline', 'format_underlined'],
|
|
232
|
-
['strike', 'format_strikethrough'],
|
|
233
|
-
['bulletList', 'format_list_bulleted'],
|
|
234
|
-
['orderedList', 'format_list_numbered'],
|
|
235
|
-
['undo', 'undo'],
|
|
236
|
-
['redo', 'redo']
|
|
237
|
-
])
|
|
238
|
-
|
|
239
|
-
return iconsMap.get(name)
|
|
240
|
-
}, [name])
|
|
241
|
-
|
|
242
|
-
const description = useMemo(() => {
|
|
243
|
-
const descriptionsMap = new Map<ToggleButtonName, string>([
|
|
244
|
-
['bold', `Negrito (${shortcut} + B)`],
|
|
245
|
-
['italic', `Itálico (${shortcut} + I)`],
|
|
246
|
-
['underline', `Sublinhado (${shortcut} + U)`],
|
|
247
|
-
['strike', `Tachado (${shortcut} + S)`],
|
|
248
|
-
['bulletList', `Lista (${shortcut} + Shift + 7)`],
|
|
249
|
-
['orderedList', `Lista numerada (${shortcut} + Shift + 8)`],
|
|
250
|
-
['undo', `Desfazer (${shortcut} + Z)`],
|
|
251
|
-
['redo', `Refazer (${shortcut} + Y)`]
|
|
252
|
-
])
|
|
253
|
-
|
|
254
|
-
return descriptionsMap.get(name)
|
|
255
|
-
}, [name, shortcut])
|
|
256
|
-
|
|
257
|
-
const handleToggle = useCallback(() => {
|
|
258
|
-
if (!editor) throw new Error('Editor not found')
|
|
259
|
-
|
|
260
|
-
const commandsMap = new Map<ToggleButtonName, () => void>([
|
|
261
|
-
['bold', () => editor.chain().focus().toggleBold().run()],
|
|
262
|
-
['italic', () => editor.chain().focus().toggleItalic().run()],
|
|
263
|
-
['underline', () => editor.chain().focus().toggleUnderline().run()],
|
|
264
|
-
['strike', () => editor.chain().focus().toggleStrike().run()],
|
|
265
|
-
['bulletList', () => editor.chain().focus().toggleBulletList().run()],
|
|
266
|
-
['orderedList', () => editor.chain().focus().toggleOrderedList().run()],
|
|
267
|
-
['undo', () => editor.chain().focus().undo().run()],
|
|
268
|
-
['redo', () => editor.chain().focus().redo().run()]
|
|
269
|
-
])
|
|
270
|
-
|
|
271
|
-
commandsMap.get(name)?.()
|
|
272
|
-
}, [editor, name])
|
|
273
|
-
|
|
274
|
-
return (
|
|
275
|
-
<Tooltip>
|
|
276
|
-
<TooltipTrigger asChild={true}>
|
|
277
|
-
<ToolbarButton
|
|
278
|
-
onClick={handleToggle}
|
|
279
|
-
{...(isActive && { appearance: 'solid' })}
|
|
280
|
-
{...props}
|
|
281
|
-
>
|
|
282
|
-
{icon && <Icon className="text-icon-neutral-3" name={icon} />}
|
|
283
|
-
</ToolbarButton>
|
|
284
|
-
</TooltipTrigger>
|
|
285
|
-
|
|
286
|
-
<TooltipContent>
|
|
287
|
-
{description && <Typography size="sm">{description}</Typography>}
|
|
288
|
-
</TooltipContent>
|
|
289
|
-
</Tooltip>
|
|
290
|
-
)
|
|
291
|
-
}
|
|
292
|
-
|
|
293
|
-
export function HeadingButton({
|
|
294
|
-
appearance = 'ghost',
|
|
295
|
-
variant = 'secondary',
|
|
296
|
-
...props
|
|
297
|
-
}: ButtonProps) {
|
|
298
|
-
const [isOpen, setIsOpen] = useState(false)
|
|
299
|
-
const { editor } = useRichTextEditor()
|
|
300
|
-
|
|
301
|
-
const isActive = useRichTextEditorState({
|
|
302
|
-
editor,
|
|
303
|
-
selector: ctx => ctx.editor?.isActive('heading') ?? false
|
|
304
|
-
})
|
|
305
|
-
|
|
306
|
-
const isLevelActive = useCallback(
|
|
307
|
-
(level: Level) => {
|
|
308
|
-
if (!editor) throw new Error('Editor not found')
|
|
309
|
-
return editor.isActive('heading', { level })
|
|
310
|
-
},
|
|
311
|
-
[editor]
|
|
312
|
-
)
|
|
313
|
-
|
|
314
|
-
const toggleHeading = useCallback(
|
|
315
|
-
(level: Level) => {
|
|
316
|
-
if (!editor) throw new Error('Editor not found')
|
|
317
|
-
setIsOpen(false)
|
|
318
|
-
setTimeout(() => {
|
|
319
|
-
editor.chain().focus().toggleHeading({ level }).run()
|
|
320
|
-
}, 0)
|
|
321
|
-
},
|
|
322
|
-
[editor]
|
|
323
|
-
)
|
|
324
|
-
|
|
325
|
-
const levels: { level: Level; label: string; className?: string }[] = [
|
|
326
|
-
{ level: 1, label: 'Normal', className: headingClasses[1] },
|
|
327
|
-
{ level: 2, label: 'Grande', className: headingClasses[2] },
|
|
328
|
-
{ level: 3, label: 'Enorme', className: headingClasses[3] }
|
|
329
|
-
]
|
|
330
|
-
|
|
331
|
-
return (
|
|
332
|
-
<DropdownMenuRoot open={isOpen} onOpenChange={open => setIsOpen(open)}>
|
|
333
|
-
<DropdownMenuTrigger asChild={true}>
|
|
334
|
-
<Button
|
|
335
|
-
appearance={isActive ? 'solid' : appearance}
|
|
336
|
-
size="icon_md"
|
|
337
|
-
tabIndex={-1}
|
|
338
|
-
type="button"
|
|
339
|
-
variant={variant}
|
|
340
|
-
{...props}
|
|
341
|
-
>
|
|
342
|
-
<Tooltip>
|
|
343
|
-
<TooltipTrigger asChild={true}>
|
|
344
|
-
<Icon className="text-icon-neutral-3" name="format_size" />
|
|
345
|
-
</TooltipTrigger>
|
|
346
|
-
|
|
347
|
-
<TooltipContent>
|
|
348
|
-
<Typography size="sm">Tamanho</Typography>
|
|
349
|
-
</TooltipContent>
|
|
350
|
-
</Tooltip>
|
|
351
|
-
</Button>
|
|
352
|
-
</DropdownMenuTrigger>
|
|
353
|
-
<DropdownMenuContent>
|
|
354
|
-
<DropdownMenuList>
|
|
355
|
-
{levels.map(level => (
|
|
356
|
-
<DropdownMenuItem
|
|
357
|
-
isActive={isLevelActive(level.level)}
|
|
358
|
-
key={level.level}
|
|
359
|
-
onPointerDown={() => toggleHeading(level.level)}
|
|
360
|
-
>
|
|
361
|
-
<DropdownMenuItemText className={level.className}>
|
|
362
|
-
{level.label}
|
|
363
|
-
</DropdownMenuItemText>
|
|
364
|
-
</DropdownMenuItem>
|
|
365
|
-
))}
|
|
366
|
-
</DropdownMenuList>
|
|
367
|
-
</DropdownMenuContent>
|
|
368
|
-
</DropdownMenuRoot>
|
|
369
|
-
)
|
|
370
|
-
}
|
|
371
|
-
|
|
372
|
-
export { useRichTextEditorState, useRichTextEditor }
|
|
@@ -1,111 +0,0 @@
|
|
|
1
|
-
import { cva, cx } from '@xjur-ui/util'
|
|
2
|
-
import { createContext, type ComponentProps } from 'react'
|
|
3
|
-
import { Typography } from '../typography'
|
|
4
|
-
import { Button, type ButtonProps } from '../form/button'
|
|
5
|
-
|
|
6
|
-
export type SearchInputProps = {
|
|
7
|
-
variant?: 'outlined' | 'line' | 'action'
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
const SearchInputRootContext = createContext<SearchInputProps>({
|
|
11
|
-
variant: 'outlined'
|
|
12
|
-
})
|
|
13
|
-
|
|
14
|
-
export function SearchInputRoot({
|
|
15
|
-
className,
|
|
16
|
-
variant = 'outlined',
|
|
17
|
-
...props
|
|
18
|
-
}: ComponentProps<'div'> & SearchInputProps) {
|
|
19
|
-
return (
|
|
20
|
-
<SearchInputRootContext.Provider value={{ variant }}>
|
|
21
|
-
<div className={cx(className, 'relative flex w-full')} {...props} />
|
|
22
|
-
</SearchInputRootContext.Provider>
|
|
23
|
-
)
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
export function SearchInputContent({
|
|
27
|
-
className,
|
|
28
|
-
...props
|
|
29
|
-
}: ComponentProps<'div'>) {
|
|
30
|
-
const contentVarians = cva(
|
|
31
|
-
[
|
|
32
|
-
'gap-small py-small_1x-alt px-small flex items-center w-full',
|
|
33
|
-
'h-large-4x rounded-circle',
|
|
34
|
-
'border-border-layer-2 placeholder:placeholder-neutral-placeholder text-size-body-md text-neutral-dark border font-normal',
|
|
35
|
-
'group-hover:border-border-layer-3 transition-colors duration-200',
|
|
36
|
-
'disabled:opacity-60',
|
|
37
|
-
'focus-within:border-primary-idle'
|
|
38
|
-
],
|
|
39
|
-
{
|
|
40
|
-
variants: {
|
|
41
|
-
variant: {
|
|
42
|
-
outlined: 'rounded-circle focus-within:border-primary-idle ',
|
|
43
|
-
line: 'rounded-none border-t-0 border-b-1 border-x-0',
|
|
44
|
-
action: 'rounded-tr-none rounded-br-none border-r-0'
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
)
|
|
49
|
-
|
|
50
|
-
return (
|
|
51
|
-
<SearchInputRootContext.Consumer>
|
|
52
|
-
{({ variant }) => (
|
|
53
|
-
<div
|
|
54
|
-
className={cx(className, contentVarians({ variant }))}
|
|
55
|
-
data-variant={variant}
|
|
56
|
-
{...props}
|
|
57
|
-
/>
|
|
58
|
-
)}
|
|
59
|
-
</SearchInputRootContext.Consumer>
|
|
60
|
-
)
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
export function SearchInputLabel({
|
|
64
|
-
htmlFor,
|
|
65
|
-
...props
|
|
66
|
-
}: ComponentProps<'label'>) {
|
|
67
|
-
return (
|
|
68
|
-
<Typography
|
|
69
|
-
asChild={true}
|
|
70
|
-
className={cx('absolute -top-[22px] left-0')}
|
|
71
|
-
size="sm"
|
|
72
|
-
variant="label"
|
|
73
|
-
weight="medium"
|
|
74
|
-
>
|
|
75
|
-
<label htmlFor={htmlFor} {...props} />
|
|
76
|
-
</Typography>
|
|
77
|
-
)
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
export function SearchInputText({
|
|
81
|
-
className,
|
|
82
|
-
...props
|
|
83
|
-
}: ComponentProps<'input'>) {
|
|
84
|
-
return <input className={cx(className, 'flex-1 outline-none')} {...props} />
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
export function SearchInputSlot(props: ComponentProps<'div'>) {
|
|
88
|
-
return <div {...props} data-slot="search-input-slot" />
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
export function SearchInputAction({
|
|
92
|
-
className,
|
|
93
|
-
appearance = 'ghost',
|
|
94
|
-
variant = 'outlined',
|
|
95
|
-
...props
|
|
96
|
-
}: ButtonProps) {
|
|
97
|
-
return (
|
|
98
|
-
<Button
|
|
99
|
-
{...props}
|
|
100
|
-
appearance={appearance}
|
|
101
|
-
className={cx(
|
|
102
|
-
className,
|
|
103
|
-
'cursor-pointer',
|
|
104
|
-
'h-large-4x rounded-tr-circle rounded-br-circle px-small py-small_1x-alt flex items-center justify-center rounded-none',
|
|
105
|
-
'text-size-body-md text-neutral-dark gap-small-1x'
|
|
106
|
-
)}
|
|
107
|
-
data-slot="search-input-action"
|
|
108
|
-
variant={variant}
|
|
109
|
-
/>
|
|
110
|
-
)
|
|
111
|
-
}
|