@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,274 +0,0 @@
|
|
|
1
|
-
import { tv, twJoin, twMerge } from '@xjur-ui/util'
|
|
2
|
-
import { useMemo, type ComponentProps } from 'react'
|
|
3
|
-
import * as RadixPopover from '@radix-ui/react-popover'
|
|
4
|
-
import { Icon, type IconType } from '../icon'
|
|
5
|
-
import { Typography } from '../typography'
|
|
6
|
-
import {
|
|
7
|
-
ListHeaderTitle,
|
|
8
|
-
ListHeader,
|
|
9
|
-
ListContent,
|
|
10
|
-
ListItem,
|
|
11
|
-
ListRoot
|
|
12
|
-
} from '../list'
|
|
13
|
-
import {
|
|
14
|
-
FieldContext,
|
|
15
|
-
useFieldContext,
|
|
16
|
-
type FieldContextValue
|
|
17
|
-
} from './context/field.context'
|
|
18
|
-
import { FloatingLabel } from './floating-label'
|
|
19
|
-
|
|
20
|
-
export const select = tv({
|
|
21
|
-
slots: {
|
|
22
|
-
wrapper: 'group flex w-full flex-col gap-small-2x',
|
|
23
|
-
trigger: [
|
|
24
|
-
'h-large-4x w-full cursor-pointer relative',
|
|
25
|
-
'flex items-center gap-small rounded-small-1x justify-between',
|
|
26
|
-
'py-small_1x-alt px-small',
|
|
27
|
-
'bg-layer-2-idle border border-border-layer-2',
|
|
28
|
-
'group-has-[div[data-slot=input-action-slot]]:rounded-r-none',
|
|
29
|
-
'transition-all duration-200'
|
|
30
|
-
],
|
|
31
|
-
content: [
|
|
32
|
-
'group z-10 max-h-[var(--radix-popover-content-available-height)] max-w-[var(--radix-popover-content-available-width)] min-w-[var(--radix-popover-trigger-width)]'
|
|
33
|
-
],
|
|
34
|
-
icon: 'size-large text-icon-neutral-3 flex items-center justify-center',
|
|
35
|
-
slotText:
|
|
36
|
-
'size-large flex items-center justify-center !text-size-label-md text-neutral-placeholder',
|
|
37
|
-
caption: '!text-size-body-sm font-normal'
|
|
38
|
-
},
|
|
39
|
-
variants: {
|
|
40
|
-
state: {
|
|
41
|
-
normal: {
|
|
42
|
-
trigger:
|
|
43
|
-
'hover:border-border-layer-3 data-[state=open]:border-primary-idle data-[state=open]:hover:border-primary-idle'
|
|
44
|
-
},
|
|
45
|
-
error: {
|
|
46
|
-
trigger:
|
|
47
|
-
'border-danger-idle hover:border-danger-idle data-[state=open]:border-danger-idle data-[state=open]:hover:border-danger-idle',
|
|
48
|
-
caption: 'text-danger-label-idle'
|
|
49
|
-
},
|
|
50
|
-
disabled: {
|
|
51
|
-
trigger: 'pointer-events-none border-transparent bg-layer-2-idle'
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
})
|
|
56
|
-
|
|
57
|
-
const { wrapper, trigger, icon, caption, slotText, content } = select()
|
|
58
|
-
|
|
59
|
-
export function SelectRoot({
|
|
60
|
-
className,
|
|
61
|
-
state = 'normal',
|
|
62
|
-
defaultOpen,
|
|
63
|
-
variant = 'normal',
|
|
64
|
-
modal,
|
|
65
|
-
open,
|
|
66
|
-
onOpenChange: handleOpenChange,
|
|
67
|
-
...props
|
|
68
|
-
}: ComponentProps<'div'> &
|
|
69
|
-
FieldContextValue &
|
|
70
|
-
ComponentProps<typeof RadixPopover.Root>) {
|
|
71
|
-
return (
|
|
72
|
-
<RadixPopover.Root
|
|
73
|
-
defaultOpen={defaultOpen}
|
|
74
|
-
modal={modal}
|
|
75
|
-
open={open}
|
|
76
|
-
onOpenChange={handleOpenChange}
|
|
77
|
-
>
|
|
78
|
-
<FieldContext.Provider value={{ state, variant }}>
|
|
79
|
-
<div className={wrapper({ className, state })} {...props} />
|
|
80
|
-
</FieldContext.Provider>
|
|
81
|
-
</RadixPopover.Root>
|
|
82
|
-
)
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
export function SelectTrigger({
|
|
86
|
-
className,
|
|
87
|
-
...props
|
|
88
|
-
}: ComponentProps<typeof RadixPopover.Trigger>) {
|
|
89
|
-
const { state, variant } = useFieldContext()
|
|
90
|
-
|
|
91
|
-
const filterTrigger = tv({
|
|
92
|
-
base: ['group bg-layer-2-idle'],
|
|
93
|
-
variants: {
|
|
94
|
-
state: {
|
|
95
|
-
normal: [
|
|
96
|
-
'border-border-layer-2 hover:border-border-layer-3 has-[input:not(:placeholder-shown)]:border-primary-idle'
|
|
97
|
-
],
|
|
98
|
-
error: ['border-danger-idle hover:border-danger-idle'],
|
|
99
|
-
disabled: ['border border-border-layer-2 opacity-60']
|
|
100
|
-
}
|
|
101
|
-
}
|
|
102
|
-
})
|
|
103
|
-
|
|
104
|
-
const mergedClassName = twMerge(
|
|
105
|
-
trigger({ state, className }),
|
|
106
|
-
variant === 'filter' && filterTrigger({ state, className })
|
|
107
|
-
)
|
|
108
|
-
|
|
109
|
-
return (
|
|
110
|
-
<RadixPopover.Trigger
|
|
111
|
-
className={mergedClassName}
|
|
112
|
-
disabled={state === 'disabled'}
|
|
113
|
-
{...props}
|
|
114
|
-
/>
|
|
115
|
-
)
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
export function SelectIcon({
|
|
119
|
-
className,
|
|
120
|
-
name,
|
|
121
|
-
...props
|
|
122
|
-
}: ComponentProps<'div'> & {
|
|
123
|
-
name: IconType
|
|
124
|
-
}) {
|
|
125
|
-
const { state } = useFieldContext()
|
|
126
|
-
|
|
127
|
-
return (
|
|
128
|
-
<div className={icon({ className, state })} {...props}>
|
|
129
|
-
<Icon name={name} />
|
|
130
|
-
</div>
|
|
131
|
-
)
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
export function SelectLabel(props: ComponentProps<typeof FloatingLabel>) {
|
|
135
|
-
return <FloatingLabel {...props} />
|
|
136
|
-
}
|
|
137
|
-
|
|
138
|
-
export function SelectValue({
|
|
139
|
-
className,
|
|
140
|
-
displayValue = '',
|
|
141
|
-
value,
|
|
142
|
-
placeholder,
|
|
143
|
-
...props
|
|
144
|
-
}: ComponentProps<'input'> & { displayValue?: string }) {
|
|
145
|
-
const { variant } = useFieldContext()
|
|
146
|
-
|
|
147
|
-
const valueOrPlaceholder = useMemo(() => {
|
|
148
|
-
if (variant === 'filter') return displayValue
|
|
149
|
-
return displayValue || placeholder
|
|
150
|
-
}, [displayValue, placeholder, variant])
|
|
151
|
-
|
|
152
|
-
return (
|
|
153
|
-
<div className="flex w-full">
|
|
154
|
-
<Typography className="text-neutral-dark group-has-[div[data-slot=date-picker-left-slot]]:pl-large-1x">
|
|
155
|
-
{valueOrPlaceholder}
|
|
156
|
-
</Typography>
|
|
157
|
-
|
|
158
|
-
<input
|
|
159
|
-
{...props}
|
|
160
|
-
aria-readonly={true}
|
|
161
|
-
className={twJoin('pointer-events-none', className)}
|
|
162
|
-
hidden={true}
|
|
163
|
-
placeholder={' '}
|
|
164
|
-
readOnly={true}
|
|
165
|
-
value={value ?? ''}
|
|
166
|
-
/>
|
|
167
|
-
</div>
|
|
168
|
-
)
|
|
169
|
-
}
|
|
170
|
-
|
|
171
|
-
export function SelectMultiValue({
|
|
172
|
-
className,
|
|
173
|
-
value,
|
|
174
|
-
placeholder,
|
|
175
|
-
children,
|
|
176
|
-
...props
|
|
177
|
-
}: ComponentProps<'input'>) {
|
|
178
|
-
const { variant } = useFieldContext()
|
|
179
|
-
|
|
180
|
-
const shouldShowPlaceholder = useMemo(() => {
|
|
181
|
-
if (variant === 'filter') return false
|
|
182
|
-
return Array.isArray(value) && value.length === 0 && placeholder
|
|
183
|
-
}, [value, placeholder, variant])
|
|
184
|
-
|
|
185
|
-
return (
|
|
186
|
-
<div
|
|
187
|
-
className={twMerge(
|
|
188
|
-
className,
|
|
189
|
-
'gap-small-1x scrollbar-hide flex w-full overflow-x-hidden',
|
|
190
|
-
'group-disabled:!pl-0'
|
|
191
|
-
)}
|
|
192
|
-
>
|
|
193
|
-
{shouldShowPlaceholder && (
|
|
194
|
-
<Typography className="text-neutral-dark group-has-[div[data-slot=date-picker-left-slot]]:pl-large-1x">
|
|
195
|
-
{placeholder}
|
|
196
|
-
</Typography>
|
|
197
|
-
)}
|
|
198
|
-
|
|
199
|
-
{children}
|
|
200
|
-
|
|
201
|
-
<input
|
|
202
|
-
{...props}
|
|
203
|
-
aria-readonly={true}
|
|
204
|
-
className={twMerge(className, 'pointer-events-none')}
|
|
205
|
-
hidden={true}
|
|
206
|
-
placeholder={' '}
|
|
207
|
-
readOnly={true}
|
|
208
|
-
value={value}
|
|
209
|
-
/>
|
|
210
|
-
</div>
|
|
211
|
-
)
|
|
212
|
-
}
|
|
213
|
-
|
|
214
|
-
export function SelectContent({
|
|
215
|
-
className,
|
|
216
|
-
sideOffset = 5,
|
|
217
|
-
side = 'bottom',
|
|
218
|
-
align = 'start',
|
|
219
|
-
children,
|
|
220
|
-
...props
|
|
221
|
-
}: ComponentProps<typeof RadixPopover.Content>) {
|
|
222
|
-
const { state } = useFieldContext()
|
|
223
|
-
|
|
224
|
-
return (
|
|
225
|
-
<RadixPopover.Portal>
|
|
226
|
-
<RadixPopover.Content
|
|
227
|
-
align={align}
|
|
228
|
-
className={content({ className, state })}
|
|
229
|
-
side={side}
|
|
230
|
-
sideOffset={sideOffset}
|
|
231
|
-
{...props}
|
|
232
|
-
>
|
|
233
|
-
<ListRoot>{children}</ListRoot>
|
|
234
|
-
</RadixPopover.Content>
|
|
235
|
-
</RadixPopover.Portal>
|
|
236
|
-
)
|
|
237
|
-
}
|
|
238
|
-
|
|
239
|
-
export function SelectCaption({ className, ...props }: ComponentProps<'p'>) {
|
|
240
|
-
const { state } = useFieldContext()
|
|
241
|
-
return <p className={caption({ className, state })} {...props} />
|
|
242
|
-
}
|
|
243
|
-
|
|
244
|
-
export function SelectSlot({ className, ...props }: ComponentProps<'span'>) {
|
|
245
|
-
const { state } = useFieldContext()
|
|
246
|
-
return <span className={slotText({ className, state })} {...props} />
|
|
247
|
-
}
|
|
248
|
-
|
|
249
|
-
export function SelectOptions(props: ComponentProps<typeof ListContent>) {
|
|
250
|
-
return <ListContent {...props} />
|
|
251
|
-
}
|
|
252
|
-
|
|
253
|
-
export function SelectOption({
|
|
254
|
-
className,
|
|
255
|
-
...props
|
|
256
|
-
}: ComponentProps<typeof ListItem>) {
|
|
257
|
-
return (
|
|
258
|
-
<ListItem className={twMerge(className, 'cursor-pointer')} {...props} />
|
|
259
|
-
)
|
|
260
|
-
}
|
|
261
|
-
|
|
262
|
-
export function SelectOptionText(props: ComponentProps<typeof Typography>) {
|
|
263
|
-
return <Typography {...props} />
|
|
264
|
-
}
|
|
265
|
-
|
|
266
|
-
export function SelectHeader(props: ComponentProps<typeof ListHeader>) {
|
|
267
|
-
return <ListHeader {...props} />
|
|
268
|
-
}
|
|
269
|
-
|
|
270
|
-
export function SelectHeaderTitle(
|
|
271
|
-
props: ComponentProps<typeof ListHeaderTitle>
|
|
272
|
-
) {
|
|
273
|
-
return <ListHeaderTitle {...props} />
|
|
274
|
-
}
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import * as React from 'react'
|
|
2
|
-
import * as SwitchPrimitive from '@radix-ui/react-switch'
|
|
3
|
-
import { cx } from '@xjur-ui/util'
|
|
4
|
-
|
|
5
|
-
function Switch({
|
|
6
|
-
className,
|
|
7
|
-
...props
|
|
8
|
-
}: React.ComponentProps<typeof SwitchPrimitive.Root>) {
|
|
9
|
-
return (
|
|
10
|
-
<SwitchPrimitive.Root
|
|
11
|
-
className={cx(
|
|
12
|
-
'w-large-3x h-large rounded-circle inline-flex shrink-0 items-center border border-transparent',
|
|
13
|
-
'peer data-[state=checked]:bg-primary-idle data-[state=unchecked]:bg-alt-4',
|
|
14
|
-
'focus-visible:border-ring focus-visible:ring-ring/50 transition-all outline-none disabled:cursor-not-allowed disabled:opacity-50',
|
|
15
|
-
'hover:shadow-focus-primary p-[2px]',
|
|
16
|
-
className
|
|
17
|
-
)}
|
|
18
|
-
data-slot="switch"
|
|
19
|
-
{...props}
|
|
20
|
-
>
|
|
21
|
-
<SwitchPrimitive.Thumb
|
|
22
|
-
className={cx(
|
|
23
|
-
'bg-layer-2-idle size-medium pointer-events-none rounded-full ring-0 transition-transform data-[state=checked]:translate-x-[calc(100%-2px)] data-[state=unchecked]:translate-x-0'
|
|
24
|
-
)}
|
|
25
|
-
data-slot="switch-thumb"
|
|
26
|
-
/>
|
|
27
|
-
</SwitchPrimitive.Root>
|
|
28
|
-
)
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
export { Switch }
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { Button } from '../form/button'
|
|
2
|
-
import { Icon } from '../icon'
|
|
3
|
-
|
|
4
|
-
interface CalendarAddEventProps {
|
|
5
|
-
date: Date
|
|
6
|
-
onAddEvent: (date: Date) => void
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
export function CalendarAddEvent({ date, onAddEvent }: CalendarAddEventProps) {
|
|
10
|
-
return (
|
|
11
|
-
<Button size="icon_sm" variant="outlined" onClick={() => onAddEvent(date)}>
|
|
12
|
-
<Icon className="text-icon-neutral-3" name="add" />
|
|
13
|
-
</Button>
|
|
14
|
-
)
|
|
15
|
-
}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { cx } from '@xjur-ui/util'
|
|
2
|
-
import type { ComponentProps } from 'react'
|
|
3
|
-
|
|
4
|
-
export function CalendarBody({ className, ...props }: ComponentProps<'div'>) {
|
|
5
|
-
return (
|
|
6
|
-
<div
|
|
7
|
-
className={cx(className, 'gap-large-2x p-large flex flex-col')}
|
|
8
|
-
data-slot="calendar-body"
|
|
9
|
-
{...props}
|
|
10
|
-
/>
|
|
11
|
-
)
|
|
12
|
-
}
|
|
@@ -1,120 +0,0 @@
|
|
|
1
|
-
import { Fragment, useMemo } from 'react'
|
|
2
|
-
import { useDroppable } from '@dnd-kit/core'
|
|
3
|
-
import { cx, tv } from '@xjur-ui/util'
|
|
4
|
-
import { isPast } from 'date-fns'
|
|
5
|
-
import { Typography } from '../typography'
|
|
6
|
-
import { Button } from '../form/button'
|
|
7
|
-
import { Icon } from '../icon'
|
|
8
|
-
import { isToday } from './helpers/calendar'
|
|
9
|
-
import { useFullCalendar } from './calendar-root'
|
|
10
|
-
import type { ICalendarCell } from './types/calendar-cell'
|
|
11
|
-
import type { ICalendarEvent } from './types/calendar-event'
|
|
12
|
-
import { CalendarMoreEventsDropdown } from './calendar-more-events-dropdown'
|
|
13
|
-
|
|
14
|
-
interface CalendarCellProps {
|
|
15
|
-
events: ICalendarEvent[]
|
|
16
|
-
cell: ICalendarCell
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
const calendarCellVariants = tv({
|
|
20
|
-
base: 'group/calendar-cell p-small flex flex-col gap-small-1x w-full bg-layer-2-idle ',
|
|
21
|
-
variants: {
|
|
22
|
-
type: {
|
|
23
|
-
month: 'h-[212px]',
|
|
24
|
-
week: 'min-h-[64px] max-h-[212px]',
|
|
25
|
-
day: 'min-h-[64px] max-h-[212px]'
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
})
|
|
29
|
-
|
|
30
|
-
export function CalendarCell({ cell, events }: CalendarCellProps) {
|
|
31
|
-
const { date, type } = cell
|
|
32
|
-
|
|
33
|
-
const { renderEvent, activeEventId, onAddEvent, disableEventCreationInPast } =
|
|
34
|
-
useFullCalendar()
|
|
35
|
-
const eventsToShow = useMemo(() => events.slice(0, 2), [events])
|
|
36
|
-
const hasMore = events.length >= 3
|
|
37
|
-
|
|
38
|
-
const { isOver, setNodeRef } = useDroppable({
|
|
39
|
-
id: `calendar-cell-${type}-${date.toISOString()}`,
|
|
40
|
-
data: {
|
|
41
|
-
date,
|
|
42
|
-
type
|
|
43
|
-
}
|
|
44
|
-
})
|
|
45
|
-
|
|
46
|
-
const isDraggingInCell = useMemo(() => {
|
|
47
|
-
const cellEvent = events.find(event => event.id === activeEventId)
|
|
48
|
-
|
|
49
|
-
if (!cellEvent) return false
|
|
50
|
-
|
|
51
|
-
const formatDate = (date: Date) => {
|
|
52
|
-
return date.toLocaleDateString('pt-BR', {
|
|
53
|
-
year: 'numeric',
|
|
54
|
-
month: '2-digit',
|
|
55
|
-
day: '2-digit'
|
|
56
|
-
})
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
const cellDate = formatDate(date)
|
|
60
|
-
const cellEventDate = formatDate(cellEvent.eventDate)
|
|
61
|
-
|
|
62
|
-
return cellDate === cellEventDate
|
|
63
|
-
}, [activeEventId, date, events])
|
|
64
|
-
|
|
65
|
-
const calendarCellClassNames = calendarCellVariants({ type })
|
|
66
|
-
|
|
67
|
-
const disableEventCreation = useMemo(
|
|
68
|
-
() => disableEventCreationInPast && isPast(date) && !isToday(date),
|
|
69
|
-
[disableEventCreationInPast, date]
|
|
70
|
-
)
|
|
71
|
-
|
|
72
|
-
return (
|
|
73
|
-
<div
|
|
74
|
-
className={calendarCellClassNames}
|
|
75
|
-
data-slot="calendar-cell"
|
|
76
|
-
ref={setNodeRef}
|
|
77
|
-
>
|
|
78
|
-
{type === 'month' && (
|
|
79
|
-
<div className="flex items-center justify-center">
|
|
80
|
-
<div
|
|
81
|
-
className={cx(
|
|
82
|
-
'size-large-2x rounded-circle bg-layer-2-idle flex items-center justify-center',
|
|
83
|
-
isToday(date) && 'bg-primary-idle text-neutral-label'
|
|
84
|
-
)}
|
|
85
|
-
>
|
|
86
|
-
<Typography size="sm" variant="label" weight="medium">
|
|
87
|
-
{cell.date.getDate()}
|
|
88
|
-
</Typography>
|
|
89
|
-
</div>
|
|
90
|
-
</div>
|
|
91
|
-
)}
|
|
92
|
-
|
|
93
|
-
<div className="gap-small-1x flex flex-col">
|
|
94
|
-
{eventsToShow.map(event => (
|
|
95
|
-
<Fragment key={event.id}>{renderEvent(event)}</Fragment>
|
|
96
|
-
))}
|
|
97
|
-
|
|
98
|
-
{isOver && eventsToShow.length < 2 && !isDraggingInCell && (
|
|
99
|
-
<div className="border-border-layer-4 rounded-small-2x h-[68px] w-full border border-dashed" />
|
|
100
|
-
)}
|
|
101
|
-
</div>
|
|
102
|
-
|
|
103
|
-
<div className="mt-auto flex items-center justify-between">
|
|
104
|
-
{hasMore && <CalendarMoreEventsDropdown events={events.slice(2)} />}
|
|
105
|
-
|
|
106
|
-
{onAddEvent && !disableEventCreation && (
|
|
107
|
-
<div className="invisible ml-auto transition-opacity duration-100 ease-in-out group-hover/calendar-cell:visible">
|
|
108
|
-
<Button
|
|
109
|
-
size="icon_sm"
|
|
110
|
-
variant="outlined"
|
|
111
|
-
onClick={() => onAddEvent(date)}
|
|
112
|
-
>
|
|
113
|
-
<Icon className="text-icon-neutral-3" name="add" />
|
|
114
|
-
</Button>
|
|
115
|
-
</div>
|
|
116
|
-
)}
|
|
117
|
-
</div>
|
|
118
|
-
</div>
|
|
119
|
-
)
|
|
120
|
-
}
|
|
@@ -1,76 +0,0 @@
|
|
|
1
|
-
import { useCallback } from 'react'
|
|
2
|
-
import { cx } from '@xjur-ui/util'
|
|
3
|
-
import { setHours } from 'date-fns'
|
|
4
|
-
import { Typography } from '../typography'
|
|
5
|
-
import { WEEK_HOURS, getEventsForDayAndHour } from './helpers/calendar'
|
|
6
|
-
import { useFullCalendar } from './calendar-root'
|
|
7
|
-
import { CalendarWeekDay } from './calendar-week-day'
|
|
8
|
-
import { CalendarCell } from './calendar-cell'
|
|
9
|
-
import type { ICalendarCell } from './types/calendar-cell'
|
|
10
|
-
|
|
11
|
-
export function CalendarDayView() {
|
|
12
|
-
const { selectedDate, events } = useFullCalendar()
|
|
13
|
-
|
|
14
|
-
const getEventsForDayAndHourCallback = useCallback(
|
|
15
|
-
(date: Date, hour: number) => {
|
|
16
|
-
return getEventsForDayAndHour(events, date, hour)
|
|
17
|
-
},
|
|
18
|
-
[events]
|
|
19
|
-
)
|
|
20
|
-
|
|
21
|
-
const cellsWithHour = useCallback((cell: ICalendarCell, hour: number) => {
|
|
22
|
-
return {
|
|
23
|
-
...cell,
|
|
24
|
-
date: setHours(cell.date, hour)
|
|
25
|
-
}
|
|
26
|
-
}, [])
|
|
27
|
-
|
|
28
|
-
return (
|
|
29
|
-
<div className="bg-layer-2-hover rounded-small-1x border-border-layer-2 scrollbar-hide h-full w-full border">
|
|
30
|
-
<div className="flex flex-1 flex-col">
|
|
31
|
-
<div
|
|
32
|
-
className="bg-layer-2-hover sticky top-0 z-10 flex w-full"
|
|
33
|
-
data-slot="week-header"
|
|
34
|
-
>
|
|
35
|
-
<div className="w-[64px]" />
|
|
36
|
-
<CalendarWeekDay
|
|
37
|
-
className="border-border-layer-2 items-start border-l"
|
|
38
|
-
date={selectedDate}
|
|
39
|
-
/>
|
|
40
|
-
</div>
|
|
41
|
-
|
|
42
|
-
<div className="overflow-hidden">
|
|
43
|
-
{WEEK_HOURS.map(({ hour, label }) => (
|
|
44
|
-
<div className="flex items-start" key={hour}>
|
|
45
|
-
<div className="px-small flex h-full w-[64px] items-start justify-end">
|
|
46
|
-
<Typography size="sm-1x" variant="label" weight="medium">
|
|
47
|
-
{label}
|
|
48
|
-
</Typography>
|
|
49
|
-
</div>
|
|
50
|
-
|
|
51
|
-
<div
|
|
52
|
-
className={cx(
|
|
53
|
-
'flex flex-1',
|
|
54
|
-
'[&>*]:border-border-layer-2',
|
|
55
|
-
'[&>*]:border-t',
|
|
56
|
-
'[&>*]:border-l'
|
|
57
|
-
)}
|
|
58
|
-
>
|
|
59
|
-
<CalendarCell
|
|
60
|
-
cell={cellsWithHour(
|
|
61
|
-
{
|
|
62
|
-
date: selectedDate,
|
|
63
|
-
type: 'day'
|
|
64
|
-
},
|
|
65
|
-
hour
|
|
66
|
-
)}
|
|
67
|
-
events={getEventsForDayAndHourCallback(selectedDate, hour)}
|
|
68
|
-
/>
|
|
69
|
-
</div>
|
|
70
|
-
</div>
|
|
71
|
-
))}
|
|
72
|
-
</div>
|
|
73
|
-
</div>
|
|
74
|
-
</div>
|
|
75
|
-
)
|
|
76
|
-
}
|
|
@@ -1,178 +0,0 @@
|
|
|
1
|
-
import { cx, tv } from '@xjur-ui/util'
|
|
2
|
-
import type { ComponentProps } from 'react'
|
|
3
|
-
import { useDraggable } from '@dnd-kit/core'
|
|
4
|
-
import { Typography } from '../typography'
|
|
5
|
-
import { Tooltip, TooltipContent, TooltipTrigger } from '../tooltip'
|
|
6
|
-
import type {
|
|
7
|
-
ICalendarEvent,
|
|
8
|
-
ICalendarEventStatus
|
|
9
|
-
} from './types/calendar-event'
|
|
10
|
-
import { useFullCalendar } from './calendar-root'
|
|
11
|
-
|
|
12
|
-
const eventVariants = tv({
|
|
13
|
-
base: 'py-small_1x-alt pr-small pl-medium rounded-small-2x transition-colors duration-100 ease-out',
|
|
14
|
-
variants: {
|
|
15
|
-
status: {
|
|
16
|
-
pending:
|
|
17
|
-
'bg-layer-2-hover border-l-2 border-border-layer-4 hover:bg-layer-2-pressed active:bg-layer-2-active',
|
|
18
|
-
completed:
|
|
19
|
-
'bg-success-alt-idle border-l-2 border-success-idle hover:bg-success-alt-hover active:bg-success-alt-pressed',
|
|
20
|
-
cancelled:
|
|
21
|
-
'bg-danger-alt-idle border-l-2 border-danger-idle hover:bg-danger-alt-hover active:bg-danger-alt-pressed'
|
|
22
|
-
}
|
|
23
|
-
},
|
|
24
|
-
defaultVariants: {
|
|
25
|
-
status: 'pending'
|
|
26
|
-
}
|
|
27
|
-
})
|
|
28
|
-
|
|
29
|
-
interface CalendarEventProps extends ComponentProps<'div'> {
|
|
30
|
-
event: ICalendarEvent
|
|
31
|
-
disabled?: boolean
|
|
32
|
-
status?: ICalendarEventStatus
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
export function CalendarEvent({
|
|
36
|
-
event,
|
|
37
|
-
disabled = false,
|
|
38
|
-
status = 'pending',
|
|
39
|
-
className,
|
|
40
|
-
children,
|
|
41
|
-
...props
|
|
42
|
-
}: CalendarEventProps) {
|
|
43
|
-
const { onEventMove } = useFullCalendar()
|
|
44
|
-
const isDraggingDisabled = disabled || !onEventMove
|
|
45
|
-
|
|
46
|
-
const { attributes, listeners, setNodeRef, transform, isDragging } =
|
|
47
|
-
useDraggable({
|
|
48
|
-
id: event.id,
|
|
49
|
-
disabled: isDraggingDisabled,
|
|
50
|
-
data: {
|
|
51
|
-
event,
|
|
52
|
-
type: 'calendar-event'
|
|
53
|
-
}
|
|
54
|
-
})
|
|
55
|
-
|
|
56
|
-
const style = transform
|
|
57
|
-
? {
|
|
58
|
-
transform: `translate3d(${transform.x}px, ${transform.y}px, 0)`
|
|
59
|
-
}
|
|
60
|
-
: undefined
|
|
61
|
-
|
|
62
|
-
return (
|
|
63
|
-
<div
|
|
64
|
-
className={cx(
|
|
65
|
-
disabled && 'pointer-events-none',
|
|
66
|
-
'cursor-pointer active:cursor-grabbing',
|
|
67
|
-
isDragging && 'z-1000 -rotate-2',
|
|
68
|
-
eventVariants({ status }),
|
|
69
|
-
className
|
|
70
|
-
)}
|
|
71
|
-
data-draggable-event-id={event.id}
|
|
72
|
-
data-slot="calendar-event"
|
|
73
|
-
ref={setNodeRef}
|
|
74
|
-
style={style}
|
|
75
|
-
{...listeners}
|
|
76
|
-
{...attributes}
|
|
77
|
-
{...props}
|
|
78
|
-
>
|
|
79
|
-
{children}
|
|
80
|
-
</div>
|
|
81
|
-
)
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
export function CalendarEventTitle({
|
|
85
|
-
size = 'sm',
|
|
86
|
-
variant = 'label',
|
|
87
|
-
weight = 'medium',
|
|
88
|
-
className,
|
|
89
|
-
...props
|
|
90
|
-
}: ComponentProps<typeof Typography>) {
|
|
91
|
-
const { activeEventId } = useFullCalendar()
|
|
92
|
-
|
|
93
|
-
if (activeEventId !== null) {
|
|
94
|
-
return (
|
|
95
|
-
<Typography
|
|
96
|
-
className={cx(className, 'text-title-neutral truncate')}
|
|
97
|
-
size={size}
|
|
98
|
-
variant={variant}
|
|
99
|
-
weight={weight}
|
|
100
|
-
{...props}
|
|
101
|
-
/>
|
|
102
|
-
)
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
return (
|
|
106
|
-
<Tooltip delayDuration={500}>
|
|
107
|
-
<TooltipTrigger asChild={true}>
|
|
108
|
-
<Typography
|
|
109
|
-
className={cx(className, 'text-title-neutral truncate')}
|
|
110
|
-
size={size}
|
|
111
|
-
variant={variant}
|
|
112
|
-
weight={weight}
|
|
113
|
-
{...props}
|
|
114
|
-
/>
|
|
115
|
-
</TooltipTrigger>
|
|
116
|
-
<TooltipContent className="max-w-[320px]">
|
|
117
|
-
{props.children}
|
|
118
|
-
</TooltipContent>
|
|
119
|
-
</Tooltip>
|
|
120
|
-
)
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
export function CalendarEventDescription({
|
|
124
|
-
size = 'sm-1x',
|
|
125
|
-
variant = 'body',
|
|
126
|
-
weight = 'normal',
|
|
127
|
-
className,
|
|
128
|
-
...props
|
|
129
|
-
}: ComponentProps<typeof Typography>) {
|
|
130
|
-
const { activeEventId } = useFullCalendar()
|
|
131
|
-
|
|
132
|
-
if (activeEventId !== null) {
|
|
133
|
-
return (
|
|
134
|
-
<Typography
|
|
135
|
-
className={cx(className, 'truncate')}
|
|
136
|
-
size={size}
|
|
137
|
-
variant={variant}
|
|
138
|
-
weight={weight}
|
|
139
|
-
{...props}
|
|
140
|
-
/>
|
|
141
|
-
)
|
|
142
|
-
}
|
|
143
|
-
|
|
144
|
-
return (
|
|
145
|
-
<Tooltip delayDuration={500}>
|
|
146
|
-
<TooltipTrigger asChild={true}>
|
|
147
|
-
<Typography
|
|
148
|
-
className={cx(className, 'truncate')}
|
|
149
|
-
size={size}
|
|
150
|
-
variant={variant}
|
|
151
|
-
weight={weight}
|
|
152
|
-
{...props}
|
|
153
|
-
/>
|
|
154
|
-
</TooltipTrigger>
|
|
155
|
-
<TooltipContent className="max-w-[320px]">
|
|
156
|
-
{props.children}
|
|
157
|
-
</TooltipContent>
|
|
158
|
-
</Tooltip>
|
|
159
|
-
)
|
|
160
|
-
}
|
|
161
|
-
|
|
162
|
-
export function CalendarEventStatus({
|
|
163
|
-
variant = 'body',
|
|
164
|
-
size = 'sm-1x',
|
|
165
|
-
weight = 'normal',
|
|
166
|
-
className,
|
|
167
|
-
...props
|
|
168
|
-
}: ComponentProps<typeof Typography>) {
|
|
169
|
-
return (
|
|
170
|
-
<Typography
|
|
171
|
-
className={cx(className, 'truncate')}
|
|
172
|
-
size={size}
|
|
173
|
-
variant={variant}
|
|
174
|
-
weight={weight}
|
|
175
|
-
{...props}
|
|
176
|
-
/>
|
|
177
|
-
)
|
|
178
|
-
}
|