@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,107 +0,0 @@
|
|
|
1
|
-
import { Slot } from '@radix-ui/react-slot'
|
|
2
|
-
import type { ComponentProps } from 'react'
|
|
3
|
-
import { cva, cx, type ClassVariantProps } from '@xjur-ui/util'
|
|
4
|
-
|
|
5
|
-
export const buttonVariants = cva(
|
|
6
|
-
[
|
|
7
|
-
'outline-none inline-flex items-center justify-center rounded-circle gap-small cursor-pointer disabled:opacity-38 disabled:pointer-events-none transition-colors'
|
|
8
|
-
],
|
|
9
|
-
{
|
|
10
|
-
variants: {
|
|
11
|
-
size: {
|
|
12
|
-
md: 'py-small_1x-alt px-medium text-size-body-md',
|
|
13
|
-
sm: 'py-small-1x px-small text-size-label-sm',
|
|
14
|
-
icon_md: 'p-small text-size-body-md h-large-4x w-large-4x',
|
|
15
|
-
icon_sm: 'p-small-1x text-size-label-sm h-large-2x w-large-2x'
|
|
16
|
-
},
|
|
17
|
-
variant: {
|
|
18
|
-
primary: '',
|
|
19
|
-
secondary: '',
|
|
20
|
-
tertiary: '',
|
|
21
|
-
destructive: '',
|
|
22
|
-
outlined:
|
|
23
|
-
'bg-layer-2-idle border border-border-layer-2 hover:bg-layer-2-hover active:bg-layer-2-pressed'
|
|
24
|
-
},
|
|
25
|
-
appearance: {
|
|
26
|
-
solid: '',
|
|
27
|
-
ghost: 'bg-transparent'
|
|
28
|
-
}
|
|
29
|
-
},
|
|
30
|
-
compoundVariants: [
|
|
31
|
-
{
|
|
32
|
-
variant: 'primary',
|
|
33
|
-
appearance: 'solid',
|
|
34
|
-
class:
|
|
35
|
-
'bg-primary-idle text-neutral-label hover:bg-primary-hover active:bg-primary-pressed'
|
|
36
|
-
},
|
|
37
|
-
{
|
|
38
|
-
variant: 'primary',
|
|
39
|
-
appearance: 'ghost',
|
|
40
|
-
class:
|
|
41
|
-
'text-primary-idle hover:bg-primary-alt-idle active:bg-primary-alt-pressed'
|
|
42
|
-
},
|
|
43
|
-
{
|
|
44
|
-
variant: 'secondary',
|
|
45
|
-
appearance: 'solid',
|
|
46
|
-
class:
|
|
47
|
-
'bg-layer-1-hover text-neutral-dark hover:bg-layer-1-pressed active:bg-layer-1-active'
|
|
48
|
-
},
|
|
49
|
-
{
|
|
50
|
-
variant: 'secondary',
|
|
51
|
-
appearance: 'ghost',
|
|
52
|
-
class: 'hover:bg-layer-1-hover active:bg-layer-1-pressed'
|
|
53
|
-
},
|
|
54
|
-
{
|
|
55
|
-
variant: 'tertiary',
|
|
56
|
-
appearance: 'solid',
|
|
57
|
-
class:
|
|
58
|
-
'bg-layer-2-hover text-neutral-dark hover:bg-layer-2-pressed active:bg-layer-2-active'
|
|
59
|
-
},
|
|
60
|
-
{
|
|
61
|
-
variant: 'tertiary',
|
|
62
|
-
appearance: 'ghost',
|
|
63
|
-
class: 'hover:bg-layer-2-hover active:bg-layer-2-pressed'
|
|
64
|
-
},
|
|
65
|
-
{
|
|
66
|
-
variant: 'destructive',
|
|
67
|
-
appearance: 'solid',
|
|
68
|
-
class:
|
|
69
|
-
'bg-danger-idle text-neutral-label hover:bg-danger-hover active:bg-danger-pressed'
|
|
70
|
-
},
|
|
71
|
-
{
|
|
72
|
-
variant: 'destructive',
|
|
73
|
-
appearance: 'ghost',
|
|
74
|
-
class:
|
|
75
|
-
'text-danger-label-idle hover:bg-danger-alt-idle active:bg-danger-alt-pressed'
|
|
76
|
-
}
|
|
77
|
-
],
|
|
78
|
-
defaultVariants: {
|
|
79
|
-
size: 'md',
|
|
80
|
-
variant: 'primary',
|
|
81
|
-
appearance: 'solid'
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
|
-
)
|
|
85
|
-
|
|
86
|
-
export interface ButtonProps
|
|
87
|
-
extends ComponentProps<'button'>,
|
|
88
|
-
ClassVariantProps<typeof buttonVariants> {
|
|
89
|
-
asChild?: boolean
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
export function Button({
|
|
93
|
-
asChild,
|
|
94
|
-
className,
|
|
95
|
-
variant = 'primary',
|
|
96
|
-
size = 'md',
|
|
97
|
-
appearance = 'solid',
|
|
98
|
-
...props
|
|
99
|
-
}: ButtonProps) {
|
|
100
|
-
const Component = asChild ? Slot : 'button'
|
|
101
|
-
return (
|
|
102
|
-
<Component
|
|
103
|
-
className={cx(buttonVariants({ variant, appearance, size }), className)}
|
|
104
|
-
{...props}
|
|
105
|
-
/>
|
|
106
|
-
)
|
|
107
|
-
}
|
|
@@ -1,124 +0,0 @@
|
|
|
1
|
-
import 'react-day-picker/style.css'
|
|
2
|
-
import { ptBR } from 'date-fns/locale'
|
|
3
|
-
import { cx } from '@xjur-ui/util'
|
|
4
|
-
import {
|
|
5
|
-
type DayPickerProps,
|
|
6
|
-
type ClassNames,
|
|
7
|
-
DayPicker,
|
|
8
|
-
getDefaultClassNames
|
|
9
|
-
} from 'react-day-picker'
|
|
10
|
-
import { Icon, type IconType } from '../icon'
|
|
11
|
-
import { Button } from '../form/button'
|
|
12
|
-
|
|
13
|
-
function capitalize(str: string) {
|
|
14
|
-
return str.charAt(0).toUpperCase() + str.slice(1)
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
export { type DateRange } from 'react-day-picker'
|
|
18
|
-
|
|
19
|
-
export type CalendarProps = DayPickerProps & {
|
|
20
|
-
handleClear?: () => void
|
|
21
|
-
handleToday?: () => void
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
export function Calendar({
|
|
25
|
-
showOutsideDays = true,
|
|
26
|
-
locale = ptBR,
|
|
27
|
-
navLayout = 'around',
|
|
28
|
-
handleClear,
|
|
29
|
-
handleToday,
|
|
30
|
-
...props
|
|
31
|
-
}: CalendarProps) {
|
|
32
|
-
const defaultClassNames = getDefaultClassNames()
|
|
33
|
-
|
|
34
|
-
const classNames: Partial<ClassNames> = {
|
|
35
|
-
root: cx(
|
|
36
|
-
'bg-layer-2-idle shadow-elevation-2 rounded-[6px] p-small w-fit border border-border-layer-2 text-size-body-md text-neutral-dark font-inter',
|
|
37
|
-
defaultClassNames.root
|
|
38
|
-
),
|
|
39
|
-
day: cx('rounded-circle hover:bg-layer-2-hover'),
|
|
40
|
-
caption_label: cx(
|
|
41
|
-
'text-size-label-md text-neutral-dark font-medium',
|
|
42
|
-
defaultClassNames.caption_label
|
|
43
|
-
),
|
|
44
|
-
outside: cx('text-neutral-placeholder', defaultClassNames.outside),
|
|
45
|
-
selected: cx(
|
|
46
|
-
'text-size-body-md bg-primary-alt-active text-primary-label-active font-medium hover:!bg-primary-alt-active'
|
|
47
|
-
),
|
|
48
|
-
disabled: cx('opacity-60', defaultClassNames.disabled),
|
|
49
|
-
today: cx(
|
|
50
|
-
'text-neutral-dark font-medium bg-layer-2-active hover:!bg-layer-2-active'
|
|
51
|
-
),
|
|
52
|
-
range_start: cx(
|
|
53
|
-
'rounded-r-none text-size-body-md bg-primary-alt-active text-primary-label-active font-medium hover:!bg-primary-alt-active'
|
|
54
|
-
),
|
|
55
|
-
range_end: cx(
|
|
56
|
-
'rounded-l-none text-size-body-md bg-primary-alt-active text-primary-label-active font-medium hover:!bg-primary-alt-active'
|
|
57
|
-
),
|
|
58
|
-
range_middle: cx(
|
|
59
|
-
'!bg-primary-alt-active !text-primary-label-active rounded-none hover:!bg-primary-alt-active'
|
|
60
|
-
)
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
return (
|
|
64
|
-
<DayPicker
|
|
65
|
-
classNames={{ ...classNames, ...props.classNames }}
|
|
66
|
-
components={{
|
|
67
|
-
Chevron: ({ orientation }) => {
|
|
68
|
-
const icon = orientation === 'left' ? 'chevron_left' : 'chevron_right'
|
|
69
|
-
return (
|
|
70
|
-
<Icon
|
|
71
|
-
className="size-large text-icon-neutral-3"
|
|
72
|
-
name={icon as IconType}
|
|
73
|
-
/>
|
|
74
|
-
)
|
|
75
|
-
},
|
|
76
|
-
...props.components
|
|
77
|
-
}}
|
|
78
|
-
footer={
|
|
79
|
-
(handleClear || handleToday) && (
|
|
80
|
-
<div className="py-small border-border-layer-2 mt-small flex h-full w-full items-center justify-between border-t">
|
|
81
|
-
{handleToday && (
|
|
82
|
-
<Button
|
|
83
|
-
appearance="ghost"
|
|
84
|
-
variant="secondary"
|
|
85
|
-
onClick={handleToday}
|
|
86
|
-
>
|
|
87
|
-
Hoje
|
|
88
|
-
</Button>
|
|
89
|
-
)}
|
|
90
|
-
{handleClear && (
|
|
91
|
-
<Button
|
|
92
|
-
appearance="ghost"
|
|
93
|
-
variant="secondary"
|
|
94
|
-
onClick={handleClear}
|
|
95
|
-
>
|
|
96
|
-
Limpar
|
|
97
|
-
</Button>
|
|
98
|
-
)}
|
|
99
|
-
</div>
|
|
100
|
-
)
|
|
101
|
-
}
|
|
102
|
-
formatters={{
|
|
103
|
-
formatWeekdayName: date => {
|
|
104
|
-
const weekday = date.toLocaleDateString('pt-BR', { weekday: 'short' })
|
|
105
|
-
return (
|
|
106
|
-
weekday.charAt(0).toUpperCase() + weekday.slice(1).replace('.', '')
|
|
107
|
-
)
|
|
108
|
-
},
|
|
109
|
-
formatCaption(month) {
|
|
110
|
-
const monthName = month.toLocaleDateString('pt-BR', {
|
|
111
|
-
month: 'long'
|
|
112
|
-
})
|
|
113
|
-
return `${capitalize(monthName)} ${month.getFullYear()}`
|
|
114
|
-
},
|
|
115
|
-
...props.formatters
|
|
116
|
-
}}
|
|
117
|
-
locale={locale}
|
|
118
|
-
mode={props.mode ?? 'single'}
|
|
119
|
-
navLayout={navLayout}
|
|
120
|
-
showOutsideDays={showOutsideDays}
|
|
121
|
-
{...props}
|
|
122
|
-
/>
|
|
123
|
-
)
|
|
124
|
-
}
|
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
import * as CheckoxPrimitive from '@radix-ui/react-checkbox'
|
|
2
|
-
import { cx } from '@xjur-ui/util'
|
|
3
|
-
import { Icon } from '../icon'
|
|
4
|
-
import { Typography } from '../typography'
|
|
5
|
-
|
|
6
|
-
export function Checkbox({
|
|
7
|
-
label,
|
|
8
|
-
name,
|
|
9
|
-
className,
|
|
10
|
-
disabled = false,
|
|
11
|
-
...props
|
|
12
|
-
}: CheckoxPrimitive.CheckboxProps & {
|
|
13
|
-
label?: string
|
|
14
|
-
}) {
|
|
15
|
-
const fieldId = `field-checkbox-${name}`
|
|
16
|
-
|
|
17
|
-
return (
|
|
18
|
-
<div className="group gap-small flex items-center">
|
|
19
|
-
<CheckoxPrimitive.Root
|
|
20
|
-
disabled={disabled}
|
|
21
|
-
{...props}
|
|
22
|
-
className={cx(
|
|
23
|
-
// layout
|
|
24
|
-
'size-large-alt rounded-small-1x inline-flex items-center justify-center transition-[border-color,box-shadow,background-color] duration-200 outline-none',
|
|
25
|
-
// base
|
|
26
|
-
'border-border-layer-2 bg-layer-2-idle cursor-pointer border-2',
|
|
27
|
-
// hover/focus (desmarcado)
|
|
28
|
-
'hover:border-primary-idle focus:border-primary-idle focus:shadow-focus-primary',
|
|
29
|
-
// estado checked
|
|
30
|
-
'data-[state=checked]:bg-primary-active data-[state=checked]:border-primary-active',
|
|
31
|
-
// hover quando estiver checked (opcional)
|
|
32
|
-
'data-[state=checked]:hover:border-primary-idle',
|
|
33
|
-
// disabled
|
|
34
|
-
'disabled:hover:border-border-layer-2 disabled:cursor-not-allowed disabled:opacity-[38%]',
|
|
35
|
-
className
|
|
36
|
-
)}
|
|
37
|
-
id={fieldId}
|
|
38
|
-
name={name}
|
|
39
|
-
>
|
|
40
|
-
<CheckoxPrimitive.Indicator className="flex items-center justify-center">
|
|
41
|
-
<Icon className="text-neutral-label" name="check" />
|
|
42
|
-
</CheckoxPrimitive.Indicator>
|
|
43
|
-
</CheckoxPrimitive.Root>
|
|
44
|
-
|
|
45
|
-
{!!label && (
|
|
46
|
-
<Typography
|
|
47
|
-
asChild={true}
|
|
48
|
-
className="text-size-body-sm data-[disabled=true]:opacity-38"
|
|
49
|
-
data-disabled={disabled}
|
|
50
|
-
weight="medium"
|
|
51
|
-
>
|
|
52
|
-
<label htmlFor={fieldId}>{label}</label>
|
|
53
|
-
</Typography>
|
|
54
|
-
)}
|
|
55
|
-
</div>
|
|
56
|
-
)
|
|
57
|
-
}
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import { createContext, useContext } from 'react'
|
|
2
|
-
import type { MaskOptions } from '@react-input/mask'
|
|
3
|
-
import type { InputMaskType } from '../../../resources/input-mask'
|
|
4
|
-
|
|
5
|
-
export interface FieldContextValue {
|
|
6
|
-
state?: 'normal' | 'error' | 'disabled'
|
|
7
|
-
variant?: 'normal' | 'filter'
|
|
8
|
-
customMask?: MaskOptions
|
|
9
|
-
mask?: InputMaskType
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
export const FieldContext = createContext<FieldContextValue>({
|
|
13
|
-
state: 'normal',
|
|
14
|
-
variant: 'normal',
|
|
15
|
-
customMask: undefined,
|
|
16
|
-
mask: undefined
|
|
17
|
-
})
|
|
18
|
-
|
|
19
|
-
export function useFieldContext() {
|
|
20
|
-
const context = useContext(FieldContext)
|
|
21
|
-
if (!context) {
|
|
22
|
-
throw new Error(
|
|
23
|
-
'useFieldContext must be used within a InputRoot, SelectRoot, DatePickerRoot, etc.'
|
|
24
|
-
)
|
|
25
|
-
}
|
|
26
|
-
return context
|
|
27
|
-
}
|
|
@@ -1,199 +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
|
-
FieldContext,
|
|
8
|
-
useFieldContext,
|
|
9
|
-
type FieldContextValue
|
|
10
|
-
} from './context/field.context'
|
|
11
|
-
import { FloatingLabel } from './floating-label'
|
|
12
|
-
|
|
13
|
-
export const datePicker = tv({
|
|
14
|
-
slots: {
|
|
15
|
-
wrapper: 'group flex w-full flex-col gap-small-2x',
|
|
16
|
-
trigger: [
|
|
17
|
-
'h-large-4x w-full cursor-pointer relative',
|
|
18
|
-
'flex items-center gap-small rounded-small-1x',
|
|
19
|
-
'py-small_1x-alt px-small',
|
|
20
|
-
'bg-layer-2-hover border border-transparent',
|
|
21
|
-
'group-has-[div[data-slot=input-action-slot]]:rounded-r-none',
|
|
22
|
-
'transition-all duration-200'
|
|
23
|
-
],
|
|
24
|
-
content: [
|
|
25
|
-
'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)]'
|
|
26
|
-
],
|
|
27
|
-
icon: 'size-large text-icon-neutral-3 flex items-center justify-center',
|
|
28
|
-
slotText:
|
|
29
|
-
'size-large flex items-center justify-center !text-size-label-md text-neutral-placeholder',
|
|
30
|
-
caption: '!text-size-body-sm font-normal'
|
|
31
|
-
},
|
|
32
|
-
variants: {
|
|
33
|
-
state: {
|
|
34
|
-
normal: {
|
|
35
|
-
trigger:
|
|
36
|
-
'hover:border-border-layer-1 data-[state=open]:border-primary-idle data-[state=open]:hover:border-primary-idle'
|
|
37
|
-
},
|
|
38
|
-
error: {
|
|
39
|
-
trigger:
|
|
40
|
-
'border-danger-idle hover:border-danger-idle data-[state=open]:border-danger-idle data-[state=open]:hover:border-danger-idle',
|
|
41
|
-
caption: 'text-danger-label-idle'
|
|
42
|
-
},
|
|
43
|
-
disabled: {
|
|
44
|
-
trigger: 'pointer-events-none border-transparent bg-layer-2-idle'
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
})
|
|
49
|
-
|
|
50
|
-
const { wrapper, trigger, icon, caption, slotText, content } = datePicker()
|
|
51
|
-
|
|
52
|
-
export function DatePickerRoot({
|
|
53
|
-
className,
|
|
54
|
-
state = 'normal',
|
|
55
|
-
defaultOpen,
|
|
56
|
-
variant = 'normal',
|
|
57
|
-
modal,
|
|
58
|
-
open,
|
|
59
|
-
onOpenChange: handleOpenChange,
|
|
60
|
-
...props
|
|
61
|
-
}: ComponentProps<'div'> &
|
|
62
|
-
FieldContextValue &
|
|
63
|
-
ComponentProps<typeof RadixPopover.Root>) {
|
|
64
|
-
return (
|
|
65
|
-
<RadixPopover.Root
|
|
66
|
-
defaultOpen={defaultOpen}
|
|
67
|
-
modal={modal}
|
|
68
|
-
open={open}
|
|
69
|
-
onOpenChange={handleOpenChange}
|
|
70
|
-
>
|
|
71
|
-
<FieldContext.Provider value={{ state, variant }}>
|
|
72
|
-
<div className={wrapper({ className, state })} {...props} />
|
|
73
|
-
</FieldContext.Provider>
|
|
74
|
-
</RadixPopover.Root>
|
|
75
|
-
)
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
export function DatePickerTrigger({
|
|
79
|
-
className,
|
|
80
|
-
...props
|
|
81
|
-
}: ComponentProps<typeof RadixPopover.Trigger>) {
|
|
82
|
-
const { state, variant } = useFieldContext()
|
|
83
|
-
|
|
84
|
-
const filterTrigger = tv({
|
|
85
|
-
base: ['group bg-layer-2-idle relative'],
|
|
86
|
-
variants: {
|
|
87
|
-
state: {
|
|
88
|
-
normal: [
|
|
89
|
-
'border-border-layer-2 hover:border-border-layer-3 has-[input:not(:placeholder-shown)]:border-primary-idle'
|
|
90
|
-
],
|
|
91
|
-
error: ['border-danger-idle hover:border-danger-idle'],
|
|
92
|
-
disabled: ['border border-border-layer-2 opacity-60']
|
|
93
|
-
}
|
|
94
|
-
}
|
|
95
|
-
})
|
|
96
|
-
|
|
97
|
-
const mergedClassName = twMerge(
|
|
98
|
-
trigger({ state, className }),
|
|
99
|
-
variant === 'filter' && filterTrigger({ state, className })
|
|
100
|
-
)
|
|
101
|
-
|
|
102
|
-
return (
|
|
103
|
-
<RadixPopover.Trigger
|
|
104
|
-
className={mergedClassName}
|
|
105
|
-
disabled={state === 'disabled'}
|
|
106
|
-
{...props}
|
|
107
|
-
/>
|
|
108
|
-
)
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
export function DatePickerLabel(props: ComponentProps<typeof FloatingLabel>) {
|
|
112
|
-
return <FloatingLabel {...props} />
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
export function DatePickerIcon({
|
|
116
|
-
className,
|
|
117
|
-
name,
|
|
118
|
-
...props
|
|
119
|
-
}: ComponentProps<'div'> & {
|
|
120
|
-
name: IconType
|
|
121
|
-
}) {
|
|
122
|
-
const { state } = useFieldContext()
|
|
123
|
-
|
|
124
|
-
return (
|
|
125
|
-
<div className={icon({ className, state })} {...props}>
|
|
126
|
-
<Icon name={name} />
|
|
127
|
-
</div>
|
|
128
|
-
)
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
export function DatePickerSlot({
|
|
132
|
-
className,
|
|
133
|
-
...props
|
|
134
|
-
}: ComponentProps<'span'>) {
|
|
135
|
-
const { state } = useFieldContext()
|
|
136
|
-
return <span className={slotText({ className, state })} {...props} />
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
export function DatePickerValue({
|
|
140
|
-
className,
|
|
141
|
-
displayValue = '',
|
|
142
|
-
value,
|
|
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 || props.placeholder
|
|
150
|
-
}, [displayValue, props.placeholder, variant])
|
|
151
|
-
|
|
152
|
-
return (
|
|
153
|
-
<>
|
|
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
|
-
</>
|
|
168
|
-
)
|
|
169
|
-
}
|
|
170
|
-
|
|
171
|
-
export function DatePickerContent({
|
|
172
|
-
className,
|
|
173
|
-
sideOffset = 5,
|
|
174
|
-
side = 'bottom',
|
|
175
|
-
align = 'start',
|
|
176
|
-
...props
|
|
177
|
-
}: ComponentProps<typeof RadixPopover.Content>) {
|
|
178
|
-
const { state } = useFieldContext()
|
|
179
|
-
|
|
180
|
-
return (
|
|
181
|
-
<RadixPopover.Portal>
|
|
182
|
-
<RadixPopover.Content
|
|
183
|
-
align={align}
|
|
184
|
-
className={content({ className, state })}
|
|
185
|
-
side={side}
|
|
186
|
-
sideOffset={sideOffset}
|
|
187
|
-
{...props}
|
|
188
|
-
/>
|
|
189
|
-
</RadixPopover.Portal>
|
|
190
|
-
)
|
|
191
|
-
}
|
|
192
|
-
|
|
193
|
-
export function DatePickerCaption({
|
|
194
|
-
className,
|
|
195
|
-
...props
|
|
196
|
-
}: ComponentProps<'p'>) {
|
|
197
|
-
const { state } = useFieldContext()
|
|
198
|
-
return <p className={caption({ className, state })} {...props} />
|
|
199
|
-
}
|
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
import type { ComponentProps } from 'react'
|
|
2
|
-
import { tv } from '@xjur-ui/util'
|
|
3
|
-
import { useFieldContext } from './context/field.context'
|
|
4
|
-
|
|
5
|
-
export function FloatingLabel({
|
|
6
|
-
className,
|
|
7
|
-
htmlFor,
|
|
8
|
-
children,
|
|
9
|
-
...props
|
|
10
|
-
}: ComponentProps<'label'>) {
|
|
11
|
-
const { state } = useFieldContext()
|
|
12
|
-
|
|
13
|
-
const label = tv({
|
|
14
|
-
base: [
|
|
15
|
-
'group inline-block max-w-full truncate text-left',
|
|
16
|
-
'ease animate-in left-small right-small pointer-events-none absolute top-1/2 -translate-y-1/2 transition-all duration-250',
|
|
17
|
-
'text-size-body-md',
|
|
18
|
-
// Filled
|
|
19
|
-
'group-focus-within:-top-[3px]',
|
|
20
|
-
'group-data-[state=open]:-top-[3px]',
|
|
21
|
-
|
|
22
|
-
'group-focus-within:text-size-label-sm-1x group-focus-within:font-medium',
|
|
23
|
-
'group-data-[state=open]:text-size-label-sm-1x group-data-[state=open]:font-medium',
|
|
24
|
-
|
|
25
|
-
'group-has-[input:not(:placeholder-shown)]:-top-[3px]',
|
|
26
|
-
'group-has-[input:not(:placeholder-shown)]:text-size-label-sm-1x',
|
|
27
|
-
'group-has-[input:not(:placeholder-shown)]:font-medium',
|
|
28
|
-
// If has left slot
|
|
29
|
-
'group-has-[div[data-slot=control-slot]]:left-large-4x',
|
|
30
|
-
'group-has-[div[data-slot=control-slot]]:group-focus-within:left-small',
|
|
31
|
-
'group-has-[div[data-slot=control-slot]]:group-has-[input:not(:placeholder-shown)]:left-small',
|
|
32
|
-
'group-has-[div[data-slot=control-slot]]:group-data-[state=open]:left-small',
|
|
33
|
-
// Animate
|
|
34
|
-
'group-focus-within:animate-in',
|
|
35
|
-
'group-has-[input:not(:placeholder-shown)]:animate-out',
|
|
36
|
-
'data-[disabled=true]:hidden'
|
|
37
|
-
],
|
|
38
|
-
variants: {
|
|
39
|
-
state: {
|
|
40
|
-
normal: [
|
|
41
|
-
'group-focus-within:!text-primary-idle group-data-[state=open]:!text-primary-idle',
|
|
42
|
-
'group-has-[input:not(:placeholder-shown)]:!text-primary-idle'
|
|
43
|
-
],
|
|
44
|
-
error: [
|
|
45
|
-
'group-focus-within:!text-danger-label-active group-data-[state=open]:!text-danger-label-active',
|
|
46
|
-
'group-has-[input:not(:placeholder-shown)]:!text-danger-label-active'
|
|
47
|
-
],
|
|
48
|
-
disabled: []
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
})
|
|
52
|
-
|
|
53
|
-
return (
|
|
54
|
-
<label className={label({ className, state })} htmlFor={htmlFor} {...props}>
|
|
55
|
-
<span className="rounded-small-1x bg-layer-2-idle max-w-full">
|
|
56
|
-
{children}
|
|
57
|
-
</span>
|
|
58
|
-
</label>
|
|
59
|
-
)
|
|
60
|
-
}
|