@medway-ui/core 1.30.0 → 1.31.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/COMPONENTS.md +2058 -0
- package/COMPONENTS_SUMMARY.md +66 -0
- package/README.md +1 -1
- package/dist/COMPONENTS.md +2058 -0
- package/dist/COMPONENTS_SUMMARY.md +66 -0
- package/dist/assets/js/tokens.d.mts +0 -1
- package/dist/assets/js/tokens.d.mts.map +1 -1
- package/dist/assets/js/tokens.d.ts +0 -1
- package/dist/assets/js/tokens.d.ts.map +1 -1
- package/dist/assets/js/tokens.js +1 -1
- package/dist/assets/js/tokens.mjs +1 -1
- package/dist/assets/js/tokens.mjs.map +1 -1
- package/dist/assets/js/tokens.ts +0 -1
- package/dist/components/Alert.d.mts +7 -6
- package/dist/components/Alert.d.mts.map +1 -1
- package/dist/components/Alert.d.ts +7 -6
- package/dist/components/Alert.d.ts.map +1 -1
- package/dist/components/Alert.js +1 -1
- package/dist/components/Alert.mjs +1 -1
- package/dist/components/AlertDialog.d.mts +5 -4
- package/dist/components/AlertDialog.d.mts.map +1 -1
- package/dist/components/AlertDialog.d.ts +5 -4
- package/dist/components/AlertDialog.d.ts.map +1 -1
- package/dist/components/AlertDialog.js +1 -1
- package/dist/components/AlertDialog.mjs +1 -1
- package/dist/components/Autocomplete.d.mts.map +1 -1
- package/dist/components/Autocomplete.d.ts.map +1 -1
- package/dist/components/Autocomplete.js +1 -1
- package/dist/components/Autocomplete.mjs +1 -1
- package/dist/components/Avatar.d.mts +2 -2
- package/dist/components/Avatar.d.mts.map +1 -1
- package/dist/components/Avatar.d.ts +2 -2
- package/dist/components/Avatar.d.ts.map +1 -1
- package/dist/components/Avatar.js +1 -1
- package/dist/components/Avatar.mjs +1 -1
- package/dist/components/Badge.d.mts +3 -3
- package/dist/components/Badge.d.mts.map +1 -1
- package/dist/components/Badge.d.ts +3 -3
- package/dist/components/Badge.d.ts.map +1 -1
- package/dist/components/Badge.js +1 -1
- package/dist/components/Badge.mjs +1 -1
- package/dist/components/Breadcrumb.d.mts +1 -1
- package/dist/components/Breadcrumb.d.mts.map +1 -1
- package/dist/components/Breadcrumb.d.ts +1 -1
- package/dist/components/Breadcrumb.d.ts.map +1 -1
- package/dist/components/Breadcrumb.js +1 -1
- package/dist/components/Breadcrumb.mjs +1 -1
- package/dist/components/Button.d.mts +3 -3
- package/dist/components/Button.d.mts.map +1 -1
- package/dist/components/Button.d.ts +3 -3
- package/dist/components/Button.d.ts.map +1 -1
- package/dist/components/Button.js +1 -1
- package/dist/components/Button.mjs +1 -1
- package/dist/components/CardContinue.d.mts.map +1 -1
- package/dist/components/CardContinue.d.ts.map +1 -1
- package/dist/components/CardContinue.js +1 -1
- package/dist/components/CardContinue.mjs +1 -1
- package/dist/components/CardLesson.d.mts +1 -1
- package/dist/components/CardLesson.d.mts.map +1 -1
- package/dist/components/CardLesson.d.ts +1 -1
- package/dist/components/CardLesson.d.ts.map +1 -1
- package/dist/components/CardLesson.js +1 -1
- package/dist/components/CardLesson.mjs +1 -1
- package/dist/components/CardModule.d.mts +2 -2
- package/dist/components/CardModule.d.ts +2 -2
- package/dist/components/CardModule.js +1 -1
- package/dist/components/CardModule.mjs +1 -1
- package/dist/components/CardNews.d.mts +1 -1
- package/dist/components/CardNews.d.mts.map +1 -1
- package/dist/components/CardNews.d.ts +1 -1
- package/dist/components/CardNews.d.ts.map +1 -1
- package/dist/components/CardNews.js +1 -1
- package/dist/components/CardNews.mjs +1 -1
- package/dist/components/CardTopic.d.mts +2 -2
- package/dist/components/CardTopic.d.mts.map +1 -1
- package/dist/components/CardTopic.d.ts +2 -2
- package/dist/components/CardTopic.d.ts.map +1 -1
- package/dist/components/CardTopic.js +1 -1
- package/dist/components/CardTopic.mjs +1 -1
- package/dist/components/CardWeek.d.mts.map +1 -1
- package/dist/components/CardWeek.d.ts.map +1 -1
- package/dist/components/CardWeek.js +1 -1
- package/dist/components/CardWeek.mjs +1 -1
- package/dist/components/Checkbox.d.mts +2 -2
- package/dist/components/Checkbox.d.mts.map +1 -1
- package/dist/components/Checkbox.d.ts +2 -2
- package/dist/components/Checkbox.d.ts.map +1 -1
- package/dist/components/Checkbox.js +1 -1
- package/dist/components/Checkbox.mjs +1 -1
- package/dist/components/Chip.d.mts +3 -3
- package/dist/components/Chip.d.mts.map +1 -1
- package/dist/components/Chip.d.ts +3 -3
- package/dist/components/Chip.d.ts.map +1 -1
- package/dist/components/Chip.js +1 -1
- package/dist/components/Chip.mjs +1 -1
- package/dist/components/Collapsible.d.mts +1 -1
- package/dist/components/Collapsible.d.mts.map +1 -1
- package/dist/components/Collapsible.d.ts +1 -1
- package/dist/components/Collapsible.d.ts.map +1 -1
- package/dist/components/Collapsible.js +1 -1
- package/dist/components/Collapsible.mjs +1 -1
- package/dist/components/Command.d.mts +4 -1
- package/dist/components/Command.d.mts.map +1 -1
- package/dist/components/Command.d.ts +4 -1
- package/dist/components/Command.d.ts.map +1 -1
- package/dist/components/Command.js +1 -1
- package/dist/components/Command.mjs +1 -1
- package/dist/components/DatePicker.d.mts +3 -3
- package/dist/components/DatePicker.d.mts.map +1 -1
- package/dist/components/DatePicker.d.ts +3 -3
- package/dist/components/DatePicker.d.ts.map +1 -1
- package/dist/components/DatePicker.js +1 -1
- package/dist/components/DatePicker.mjs +1 -1
- package/dist/components/Dialog.d.mts +4 -3
- package/dist/components/Dialog.d.mts.map +1 -1
- package/dist/components/Dialog.d.ts +4 -3
- package/dist/components/Dialog.d.ts.map +1 -1
- package/dist/components/Dialog.js +1 -1
- package/dist/components/Dialog.mjs +1 -1
- package/dist/components/DropdownMenu.d.mts +9 -9
- package/dist/components/DropdownMenu.d.mts.map +1 -1
- package/dist/components/DropdownMenu.d.ts +9 -9
- package/dist/components/DropdownMenu.d.ts.map +1 -1
- package/dist/components/DropdownMenu.js +1 -1
- package/dist/components/DropdownMenu.mjs +1 -1
- package/dist/components/FallbackImage.d.mts.map +1 -1
- package/dist/components/FallbackImage.d.ts.map +1 -1
- package/dist/components/FallbackImage.js +1 -1
- package/dist/components/FallbackImage.mjs +1 -1
- package/dist/components/IndexLevel.d.mts +3 -3
- package/dist/components/IndexLevel.d.mts.map +1 -1
- package/dist/components/IndexLevel.d.ts +3 -3
- package/dist/components/IndexLevel.d.ts.map +1 -1
- package/dist/components/IndexLevel.js +1 -1
- package/dist/components/IndexLevel.mjs +1 -1
- package/dist/components/IndexLevelAnimated.d.mts +2 -2
- package/dist/components/IndexLevelAnimated.d.mts.map +1 -1
- package/dist/components/IndexLevelAnimated.d.ts +2 -2
- package/dist/components/IndexLevelAnimated.d.ts.map +1 -1
- package/dist/components/IndexLevelAnimated.js +1 -1
- package/dist/components/IndexLevelAnimated.mjs +1 -1
- package/dist/components/Input.d.mts +8 -4
- package/dist/components/Input.d.mts.map +1 -1
- package/dist/components/Input.d.ts +8 -4
- package/dist/components/Input.d.ts.map +1 -1
- package/dist/components/Input.js +1 -1
- package/dist/components/Input.mjs +1 -1
- package/dist/components/Label.d.mts +2 -2
- package/dist/components/Label.d.mts.map +1 -1
- package/dist/components/Label.d.ts +2 -2
- package/dist/components/Label.d.ts.map +1 -1
- package/dist/components/Label.js +1 -1
- package/dist/components/Label.mjs +1 -1
- package/dist/components/Logo.d.mts +5 -7
- package/dist/components/Logo.d.mts.map +1 -1
- package/dist/components/Logo.d.ts +5 -7
- package/dist/components/Logo.d.ts.map +1 -1
- package/dist/components/Logo.js +1 -2
- package/dist/components/Logo.js.map +1 -1
- package/dist/components/Logo.mjs +1 -2
- package/dist/components/Logo.mjs.map +1 -1
- package/dist/components/NoteEditor.d.mts +8 -3
- package/dist/components/NoteEditor.d.mts.map +1 -1
- package/dist/components/NoteEditor.d.ts +8 -3
- package/dist/components/NoteEditor.d.ts.map +1 -1
- package/dist/components/NoteEditor.js +1 -1
- package/dist/components/NoteEditor.mjs +1 -1
- package/dist/components/Offcanvas.d.mts +7 -7
- package/dist/components/Offcanvas.d.mts.map +1 -1
- package/dist/components/Offcanvas.d.ts +7 -7
- package/dist/components/Offcanvas.d.ts.map +1 -1
- package/dist/components/Offcanvas.js +1 -1
- package/dist/components/Offcanvas.mjs +1 -1
- package/dist/components/Pagination.d.mts +4 -4
- package/dist/components/Pagination.d.mts.map +1 -1
- package/dist/components/Pagination.d.ts +4 -4
- package/dist/components/Pagination.d.ts.map +1 -1
- package/dist/components/Pagination.js +1 -1
- package/dist/components/Pagination.mjs +1 -1
- package/dist/components/Popover.d.mts +2 -2
- package/dist/components/Popover.d.mts.map +1 -1
- package/dist/components/Popover.d.ts +2 -2
- package/dist/components/Popover.d.ts.map +1 -1
- package/dist/components/Popover.js +1 -1
- package/dist/components/Popover.mjs +1 -1
- package/dist/components/Progress.d.mts.map +1 -1
- package/dist/components/Progress.d.ts.map +1 -1
- package/dist/components/Progress.js +1 -1
- package/dist/components/Progress.mjs +1 -1
- package/dist/components/ProgressCircle.d.mts +1 -1
- package/dist/components/ProgressCircle.d.mts.map +1 -1
- package/dist/components/ProgressCircle.d.ts +1 -1
- package/dist/components/ProgressCircle.d.ts.map +1 -1
- package/dist/components/ProgressCircle.js +1 -1
- package/dist/components/ProgressCircle.mjs +1 -1
- package/dist/components/RadioGroup.d.mts +2 -2
- package/dist/components/RadioGroup.d.mts.map +1 -1
- package/dist/components/RadioGroup.d.ts +2 -2
- package/dist/components/RadioGroup.d.ts.map +1 -1
- package/dist/components/RadioGroup.js +1 -1
- package/dist/components/RadioGroup.mjs +1 -1
- package/dist/components/Ranking.d.mts.map +1 -1
- package/dist/components/Ranking.d.ts.map +1 -1
- package/dist/components/Ranking.js +1 -1
- package/dist/components/Ranking.mjs +1 -1
- package/dist/components/Rating.d.mts +6 -4
- package/dist/components/Rating.d.mts.map +1 -1
- package/dist/components/Rating.d.ts +6 -4
- package/dist/components/Rating.d.ts.map +1 -1
- package/dist/components/Rating.js +1 -1
- package/dist/components/Rating.mjs +1 -1
- package/dist/components/SegmentControl.d.mts +2 -2
- package/dist/components/SegmentControl.d.mts.map +1 -1
- package/dist/components/SegmentControl.d.ts +2 -2
- package/dist/components/SegmentControl.d.ts.map +1 -1
- package/dist/components/SegmentControl.js +1 -1
- package/dist/components/SegmentControl.mjs +1 -1
- package/dist/components/Select.d.mts +2 -2
- package/dist/components/Select.d.mts.map +1 -1
- package/dist/components/Select.d.ts +2 -2
- package/dist/components/Select.d.ts.map +1 -1
- package/dist/components/Select.js +1 -1
- package/dist/components/Select.mjs +1 -1
- package/dist/components/Sheet.d.mts +4 -3
- package/dist/components/Sheet.d.mts.map +1 -1
- package/dist/components/Sheet.d.ts +4 -3
- package/dist/components/Sheet.d.ts.map +1 -1
- package/dist/components/Sheet.js +1 -1
- package/dist/components/Sheet.mjs +1 -1
- package/dist/components/Sidebar.d.mts +21 -18
- package/dist/components/Sidebar.d.mts.map +1 -1
- package/dist/components/Sidebar.d.ts +21 -18
- package/dist/components/Sidebar.d.ts.map +1 -1
- package/dist/components/Sidebar.js +1 -1
- package/dist/components/Sidebar.mjs +1 -1
- package/dist/components/Skeleton.d.mts.map +1 -1
- package/dist/components/Skeleton.d.ts.map +1 -1
- package/dist/components/Skeleton.js +1 -1
- package/dist/components/Skeleton.mjs +1 -1
- package/dist/components/Switch.d.mts +2 -2
- package/dist/components/Switch.d.mts.map +1 -1
- package/dist/components/Switch.d.ts +2 -2
- package/dist/components/Switch.d.ts.map +1 -1
- package/dist/components/Switch.js +1 -1
- package/dist/components/Switch.mjs +1 -1
- package/dist/components/Switcher.d.mts +2 -1
- package/dist/components/Switcher.d.mts.map +1 -1
- package/dist/components/Switcher.d.ts +2 -1
- package/dist/components/Switcher.d.ts.map +1 -1
- package/dist/components/Switcher.js +1 -1
- package/dist/components/Switcher.mjs +1 -1
- package/dist/components/Tabs.d.mts +4 -4
- package/dist/components/Tabs.d.mts.map +1 -1
- package/dist/components/Tabs.d.ts +4 -4
- package/dist/components/Tabs.d.ts.map +1 -1
- package/dist/components/Tabs.js +1 -1
- package/dist/components/Tabs.mjs +1 -1
- package/dist/components/Tag.d.mts +3 -3
- package/dist/components/Tag.d.mts.map +1 -1
- package/dist/components/Tag.d.ts +3 -3
- package/dist/components/Tag.d.ts.map +1 -1
- package/dist/components/Tag.js +1 -1
- package/dist/components/Tag.mjs +1 -1
- package/dist/components/Tile.d.mts +3 -3
- package/dist/components/Tile.d.mts.map +1 -1
- package/dist/components/Tile.d.ts +3 -3
- package/dist/components/Tile.d.ts.map +1 -1
- package/dist/components/Tile.js +1 -1
- package/dist/components/Tile.mjs +1 -1
- package/dist/components/Toast.d.mts +2 -2
- package/dist/components/Toast.d.mts.map +1 -1
- package/dist/components/Toast.d.ts +2 -2
- package/dist/components/Toast.d.ts.map +1 -1
- package/dist/components/Toast.js +1 -1
- package/dist/components/Toast.mjs +1 -1
- package/dist/components/Tooltip.d.mts +1 -1
- package/dist/components/Tooltip.d.mts.map +1 -1
- package/dist/components/Tooltip.d.ts +1 -1
- package/dist/components/Tooltip.d.ts.map +1 -1
- package/dist/components/Tooltip.js +1 -1
- package/dist/components/Tooltip.mjs +1 -1
- package/dist/hooks/use-composed-refs.d.mts +3 -0
- package/dist/hooks/use-composed-refs.d.mts.map +1 -0
- package/dist/hooks/use-composed-refs.d.ts +3 -0
- package/dist/hooks/use-composed-refs.d.ts.map +1 -0
- package/dist/hooks/use-composed-refs.js +3 -0
- package/dist/hooks/use-composed-refs.js.map +1 -0
- package/dist/hooks/use-composed-refs.mjs +3 -0
- package/dist/hooks/use-composed-refs.mjs.map +1 -0
- package/dist/hooks/use-mobile.d.mts.map +1 -1
- package/dist/hooks/use-mobile.d.ts.map +1 -1
- package/dist/hooks/use-mobile.js +1 -1
- package/dist/hooks/use-mobile.mjs +1 -1
- package/dist/index.d.mts +5 -7
- package/dist/index.d.mts.map +1 -1
- package/dist/index.d.ts +5 -7
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.mjs +1 -1
- package/dist/lib/cmdk.d.mts +4 -4
- package/dist/lib/cmdk.d.mts.map +1 -1
- package/dist/lib/cmdk.d.ts +4 -4
- package/dist/lib/cmdk.d.ts.map +1 -1
- package/dist/lib/cmdk.js +1 -1
- package/dist/lib/cmdk.mjs +1 -1
- package/dist/lib/utils.d.mts +1 -0
- package/dist/lib/utils.d.mts.map +1 -1
- package/dist/lib/utils.d.ts +1 -0
- package/dist/lib/utils.d.ts.map +1 -1
- package/dist/lib/utils.js +1 -1
- package/dist/lib/utils.mjs +1 -1
- package/dist/note-editor.d.mts +1 -1
- package/dist/note-editor.d.mts.map +1 -1
- package/dist/note-editor.d.ts +1 -1
- package/dist/note-editor.d.ts.map +1 -1
- package/package.json +17 -7
- package/dist/node_modules/lucide-react/dist/esm/Icon.js +0 -7
- package/dist/node_modules/lucide-react/dist/esm/Icon.js.map +0 -1
- package/dist/node_modules/lucide-react/dist/esm/Icon.mjs +0 -7
- package/dist/node_modules/lucide-react/dist/esm/Icon.mjs.map +0 -1
- package/dist/node_modules/lucide-react/dist/esm/createLucideIcon.js +0 -7
- package/dist/node_modules/lucide-react/dist/esm/createLucideIcon.js.map +0 -1
- package/dist/node_modules/lucide-react/dist/esm/createLucideIcon.mjs +0 -7
- package/dist/node_modules/lucide-react/dist/esm/createLucideIcon.mjs.map +0 -1
- package/dist/node_modules/lucide-react/dist/esm/defaultAttributes.js +0 -7
- package/dist/node_modules/lucide-react/dist/esm/defaultAttributes.js.map +0 -1
- package/dist/node_modules/lucide-react/dist/esm/defaultAttributes.mjs +0 -7
- package/dist/node_modules/lucide-react/dist/esm/defaultAttributes.mjs.map +0 -1
- package/dist/node_modules/lucide-react/dist/esm/icons/x.js +0 -7
- package/dist/node_modules/lucide-react/dist/esm/icons/x.js.map +0 -1
- package/dist/node_modules/lucide-react/dist/esm/icons/x.mjs +0 -7
- package/dist/node_modules/lucide-react/dist/esm/icons/x.mjs.map +0 -1
- package/dist/node_modules/lucide-react/dist/esm/shared/src/utils.js +0 -7
- package/dist/node_modules/lucide-react/dist/esm/shared/src/utils.js.map +0 -1
- package/dist/node_modules/lucide-react/dist/esm/shared/src/utils.mjs +0 -7
- package/dist/node_modules/lucide-react/dist/esm/shared/src/utils.mjs.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Chip.d.ts","sourceRoot":"","sources":["../../src/components/Chip.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,cAAc,EAAE,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAC5D,OAAO,EAAO,KAAK,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAKlE,KAAK,QAAQ,GAAG,MAAM,OAAO,SAAS,CAAC;AAEvC,UAAU,SACR,SAAQ,IAAI,CAAC,cAAc,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC,EAC5C,YAAY,CAAC,OAAO,YAAY,CAAC;IACnC,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAED,UAAU,mBACR,SAAQ,IAAI,CAAC,cAAc,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC,EAC5C,YAAY,CAAC,OAAO,sBAAsB,CAAC;IAC7C,IAAI,CAAC,EAAE,SAAS,CAAC;IACjB,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AAED,UAAU,eAAgB,SAAQ,mBAAmB;IACnD,QAAQ,CAAC,EAAE,SAAS,CAAC;CACtB;AAED,KAAK,eAAe,GAAG,mBAAmB,CAAC;AAE3C,KAAK,cAAc,GAAG,IAAI,CAAC,cAAc,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC,GAC1D,YAAY,CAAC,OAAO,iBAAiB,CAAC,CAAC;AAEzC,QAAA,MAAM,SAAS;;;;CAId,CAAC;AAUF,QAAA,MAAM,YAAY;;8EAMjB,CAAC;AAEF,QAAA,MAAM,sBAAsB;;8EAM3B,CAAC;AAEF,QAAA,MAAM,iBAAiB;;8EAMtB,CAAC;AAQF,iBAAS,IAAI,CAAC,EACZ,SAAS,EACT,IAAI,EACJ,YAAwB,EACxB,QAAQ,EACR,GAAG,KAAK,EACT,EAAE,SAAS,2CAiBX;AAED,iBAAS,UAAU,CAAC,EAClB,SAAS,EACT,IAAI,EACJ,IAAI,EACJ,QAAQ,EACR,OAAe,EACf,QAAQ,EACR,GAAG,KAAK,EACT,EAAE,eAAe,
|
|
1
|
+
{"version":3,"file":"Chip.d.ts","sourceRoot":"","sources":["../../src/components/Chip.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,cAAc,EAAE,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAC5D,OAAO,EAAO,KAAK,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAKlE,KAAK,QAAQ,GAAG,MAAM,OAAO,SAAS,CAAC;AAEvC,UAAU,SACR,SAAQ,IAAI,CAAC,cAAc,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC,EAC5C,YAAY,CAAC,OAAO,YAAY,CAAC;IACnC,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAED,UAAU,mBACR,SAAQ,IAAI,CAAC,cAAc,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC,EAC5C,YAAY,CAAC,OAAO,sBAAsB,CAAC;IAC7C,IAAI,CAAC,EAAE,SAAS,CAAC;IACjB,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AAED,UAAU,eAAgB,SAAQ,mBAAmB;IACnD,QAAQ,CAAC,EAAE,SAAS,CAAC;CACtB;AAED,KAAK,eAAe,GAAG,mBAAmB,CAAC;AAE3C,KAAK,cAAc,GAAG,IAAI,CAAC,cAAc,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC,GAC1D,YAAY,CAAC,OAAO,iBAAiB,CAAC,CAAC;AAEzC,QAAA,MAAM,SAAS;;;;CAId,CAAC;AAUF,QAAA,MAAM,YAAY;;8EAMjB,CAAC;AAEF,QAAA,MAAM,sBAAsB;;8EAM3B,CAAC;AAEF,QAAA,MAAM,iBAAiB;;8EAMtB,CAAC;AAQF,iBAAS,IAAI,CAAC,EACZ,SAAS,EACT,IAAI,EACJ,YAAwB,EACxB,QAAQ,EACR,GAAG,KAAK,EACT,EAAE,SAAS,2CAiBX;AAED,iBAAS,UAAU,CAAC,EAClB,SAAS,EACT,IAAI,EACJ,IAAI,EACJ,QAAQ,EACR,OAAe,EACf,QAAQ,EACR,GAAG,KAAK,EACT,EAAE,eAAe,2CAmCjB;AAED,iBAAS,UAAU,CAAC,EAClB,SAAS,EACT,IAAI,EACJ,IAAI,EACJ,OAAe,EACf,QAAQ,EACR,GAAG,KAAK,EACT,EAAE,eAAe,2CA0BjB;AAED,iBAAS,SAAS,CAAC,EACjB,SAAS,EACT,IAAI,EACJ,QAAmB,EACnB,GAAG,KAAK,EACT,EAAE,cAAc,2CAYhB;AAED,OAAO,EACL,IAAI,EACJ,UAAU,EACV,SAAS,EACT,UAAU,EACV,iBAAiB,EACjB,sBAAsB,EACtB,YAAY,GACb,CAAC;AACF,YAAY,EACV,eAAe,EACf,cAAc,EACd,eAAe,EACf,SAAS,EACT,QAAQ,GACT,CAAC"}
|
package/dist/components/Chip.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
"use client";
|
|
3
|
-
"use strict";var s=require("react/jsx-runtime"),
|
|
3
|
+
"use strict";var s=require("react/jsx-runtime"),f=require("class-variance-authority"),c=require("@medway-ui/icons"),o=require("../lib/utils.js"),C=Object.defineProperty,O=Object.defineProperties,V=Object.getOwnPropertyDescriptors,l=Object.getOwnPropertySymbols,x=Object.prototype.hasOwnProperty,y=Object.prototype.propertyIsEnumerable,j=(a,e,r)=>e in a?C(a,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):a[e]=r,u=(a,e)=>{for(var r in e||(e={}))x.call(e,r)&&j(a,r,e[r]);if(l)for(var r of l(e))y.call(e,r)&&j(a,r,e[r]);return a},h=(a,e)=>O(a,V(e)),m=(a,e)=>{var r={};for(var t in a)x.call(a,t)&&e.indexOf(t)<0&&(r[t]=a[t]);if(a!=null&&l)for(var t of l(a))e.indexOf(t)<0&&y.call(a,t)&&(r[t]=a[t]);return r};const P={sm:"gap-2 px-3 py-2 text-xs leading-xs [&_svg:not([class*='size-'])]:size-4",md:"gap-2.5 px-3.5 py-2.5 text-sm leading-sm [&_svg:not([class*='size-'])]:size-5",lg:"gap-3 px-4 py-3 text-md leading-md [&_svg:not([class*='size-'])]:size-6"},p={variants:{size:P},defaultVariants:{size:"md"}},g="relative isolate inline-flex w-fit min-w-0 max-w-full shrink-0 items-center justify-center whitespace-nowrap transition-colors hover:cursor-pointer disabled:pointer-events-none [&_svg]:shrink-0",k=f.cva([g,"group/chip rounded-sm bg-surface-elevated font-semibold text-primary-foreground shadow-level-1-subtle disabled:bg-gray-background-soft-muted disabled:font-medium disabled:text-gray-foreground-muted disabled:shadow-none"],p),v=f.cva([g,"group/chip rounded-md bg-gray-background-soft font-medium text-gray-foreground [@media(hover:hover)]:data-[checked=false]:hover:bg-gray-background-soft-emphasis [@media(hover:hover)]:data-[checked=false]:hover:text-gray-foreground-emphasis enabled:data-[checked=true]:font-semibold enabled:data-[checked=true]:text-primary-foreground enabled:data-[checked=true]:before:absolute enabled:data-[checked=true]:before:inset-0.5 enabled:data-[checked=true]:before:-z-10 enabled:data-[checked=true]:before:rounded-[calc(var(--radius-md)-2px)] enabled:data-[checked=true]:before:bg-surface-card enabled:data-[checked=true]:before:shadow-level-1-subtle disabled:bg-gray-background-soft-muted disabled:text-gray-foreground-muted"],p),N=f.cva([g,"rounded-md bg-transparent font-semibold text-primary-foreground [@media(hover:hover)]:hover:bg-gray-background-soft-emphasis disabled:text-gray-foreground-muted"],p),M={sm:"w-[5px]",md:"w-[6px]",lg:"w-[7px]"};function q(a){var e=a,{className:r,size:t,dismissLabel:n="Remover",children:i}=e,d=m(e,["className","size","dismissLabel","children"]);return s.jsxs("button",h(u({"data-slot":"chip",className:o.cn(k({size:t}),r)},d),{type:"button",children:[s.jsx("span",{className:"truncate",children:i}),s.jsx("span",{className:"sr-only",children:n}),s.jsx(c.CloseMd,{"aria-hidden":"true","data-slot":"chip-dismiss",className:"text-gray-foreground-muted [@media(hover:hover)]:group-hover/chip:text-primary-foreground"})]}))}function F(a){var e=a,{className:r,size:t,icon:n,criteria:i,checked:d=!1,children:b}=e,z=m(e,["className","size","icon","criteria","checked","children"]);const w=i!=null&&typeof i!="boolean"&&i!=="";return s.jsxs("button",h(u({"data-slot":"chip-filter","data-checked":d,className:o.cn(v({size:t}),r)},z),{type:"button",children:[n,s.jsxs("span",{className:"inline-flex min-w-0",children:[s.jsx("span",{className:"truncate",children:b}),w&&s.jsxs(s.Fragment,{children:[s.jsx("span",{"aria-hidden":"true",className:o.cn("inline-flex shrink-0 justify-center",M[t!=null?t:p.defaultVariants.size]),children:":"}),s.jsx("span",{className:"truncate",children:i})]})]}),s.jsx(c.ChevronDown,{"aria-hidden":"true"})]}))}function L(a){var e=a,{className:r,size:t,icon:n,checked:i=!1,children:d}=e,b=m(e,["className","size","icon","checked","children"]);return s.jsxs("button",h(u({"data-slot":"chip-choice","data-checked":i,"aria-pressed":i,className:o.cn(v({size:t}),r)},b),{type:"button",children:[n,s.jsx("span",{className:"truncate",children:d}),i&&s.jsxs(s.Fragment,{children:[s.jsx(c.CheckMedium,{"aria-hidden":"true",className:"text-secondary-foreground group-disabled/chip:text-gray-foreground-muted [@media(hover:hover)]:group-hover/chip:hidden"}),s.jsx(c.CloseMd,{"aria-hidden":"true",className:"hidden text-primary-foreground [@media(hover:hover)]:group-hover/chip:block"})]})]}))}function _(a){var e=a,{className:r,size:t,children:n="Limpar"}=e,i=m(e,["className","size","children"]);return s.jsxs("button",h(u({"data-slot":"chip-clear",className:o.cn(N({size:t}),r)},i),{type:"button",children:[s.jsx("span",{className:"truncate",children:n}),s.jsx(c.CloseMd,{"aria-hidden":"true"})]}))}exports.Chip=q,exports.ChipChoice=L,exports.ChipClear=_,exports.ChipFilter=F,exports.chipClearVariants=N,exports.chipSelectableVariants=v,exports.chipVariants=k;
|
|
4
4
|
//# sourceMappingURL=Chip.js.map
|
package/dist/components/Chip.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
"use client";
|
|
3
|
-
import{jsxs as n,jsx as i,Fragment as x}from"react/jsx-runtime";import{cva as
|
|
3
|
+
import{jsxs as n,jsx as i,Fragment as x}from"react/jsx-runtime";import{cva as f}from"class-variance-authority";import{CloseMd as g,CheckMedium as P,ChevronDown as V}from"@medway-ui/icons";import{cn as c}from"../lib/utils.mjs";var L=Object.defineProperty,_=Object.defineProperties,D=Object.getOwnPropertyDescriptors,l=Object.getOwnPropertySymbols,k=Object.prototype.hasOwnProperty,N=Object.prototype.propertyIsEnumerable,z=(a,e,r)=>e in a?L(a,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):a[e]=r,h=(a,e)=>{for(var r in e||(e={}))k.call(e,r)&&z(a,r,e[r]);if(l)for(var r of l(e))N.call(e,r)&&z(a,r,e[r]);return a},u=(a,e)=>_(a,D(e)),m=(a,e)=>{var r={};for(var t in a)k.call(a,t)&&e.indexOf(t)<0&&(r[t]=a[t]);if(a!=null&&l)for(var t of l(a))e.indexOf(t)<0&&N.call(a,t)&&(r[t]=a[t]);return r};const F={sm:"gap-2 px-3 py-2 text-xs leading-xs [&_svg:not([class*='size-'])]:size-4",md:"gap-2.5 px-3.5 py-2.5 text-sm leading-sm [&_svg:not([class*='size-'])]:size-5",lg:"gap-3 px-4 py-3 text-md leading-md [&_svg:not([class*='size-'])]:size-6"},p={variants:{size:F},defaultVariants:{size:"md"}},v="relative isolate inline-flex w-fit min-w-0 max-w-full shrink-0 items-center justify-center whitespace-nowrap transition-colors hover:cursor-pointer disabled:pointer-events-none [&_svg]:shrink-0",w=f([v,"group/chip rounded-sm bg-surface-elevated font-semibold text-primary-foreground shadow-level-1-subtle disabled:bg-gray-background-soft-muted disabled:font-medium disabled:text-gray-foreground-muted disabled:shadow-none"],p),y=f([v,"group/chip rounded-md bg-gray-background-soft font-medium text-gray-foreground [@media(hover:hover)]:data-[checked=false]:hover:bg-gray-background-soft-emphasis [@media(hover:hover)]:data-[checked=false]:hover:text-gray-foreground-emphasis enabled:data-[checked=true]:font-semibold enabled:data-[checked=true]:text-primary-foreground enabled:data-[checked=true]:before:absolute enabled:data-[checked=true]:before:inset-0.5 enabled:data-[checked=true]:before:-z-10 enabled:data-[checked=true]:before:rounded-[calc(var(--radius-md)-2px)] enabled:data-[checked=true]:before:bg-surface-card enabled:data-[checked=true]:before:shadow-level-1-subtle disabled:bg-gray-background-soft-muted disabled:text-gray-foreground-muted"],p),j=f([v,"rounded-md bg-transparent font-semibold text-primary-foreground [@media(hover:hover)]:hover:bg-gray-background-soft-emphasis disabled:text-gray-foreground-muted"],p),M={sm:"w-[5px]",md:"w-[6px]",lg:"w-[7px]"};function R(a){var e=a,{className:r,size:t,dismissLabel:d="Remover",children:s}=e,o=m(e,["className","size","dismissLabel","children"]);return n("button",u(h({"data-slot":"chip",className:c(w({size:t}),r)},o),{type:"button",children:[i("span",{className:"truncate",children:s}),i("span",{className:"sr-only",children:d}),i(g,{"aria-hidden":"true","data-slot":"chip-dismiss",className:"text-gray-foreground-muted [@media(hover:hover)]:group-hover/chip:text-primary-foreground"})]}))}function S(a){var e=a,{className:r,size:t,icon:d,criteria:s,checked:o=!1,children:b}=e,C=m(e,["className","size","icon","criteria","checked","children"]);const O=s!=null&&typeof s!="boolean"&&s!=="";return n("button",u(h({"data-slot":"chip-filter","data-checked":o,className:c(y({size:t}),r)},C),{type:"button",children:[d,n("span",{className:"inline-flex min-w-0",children:[i("span",{className:"truncate",children:b}),O&&n(x,{children:[i("span",{"aria-hidden":"true",className:c("inline-flex shrink-0 justify-center",M[t!=null?t:p.defaultVariants.size]),children:":"}),i("span",{className:"truncate",children:s})]})]}),i(V,{"aria-hidden":"true"})]}))}function B(a){var e=a,{className:r,size:t,icon:d,checked:s=!1,children:o}=e,b=m(e,["className","size","icon","checked","children"]);return n("button",u(h({"data-slot":"chip-choice","data-checked":s,"aria-pressed":s,className:c(y({size:t}),r)},b),{type:"button",children:[d,i("span",{className:"truncate",children:o}),s&&n(x,{children:[i(P,{"aria-hidden":"true",className:"text-secondary-foreground group-disabled/chip:text-gray-foreground-muted [@media(hover:hover)]:group-hover/chip:hidden"}),i(g,{"aria-hidden":"true",className:"hidden text-primary-foreground [@media(hover:hover)]:group-hover/chip:block"})]})]}))}function E(a){var e=a,{className:r,size:t,children:d="Limpar"}=e,s=m(e,["className","size","children"]);return n("button",u(h({"data-slot":"chip-clear",className:c(j({size:t}),r)},s),{type:"button",children:[i("span",{className:"truncate",children:d}),i(g,{"aria-hidden":"true"})]}))}export{R as Chip,B as ChipChoice,E as ChipClear,S as ChipFilter,j as chipClearVariants,y as chipSelectableVariants,w as chipVariants};
|
|
4
4
|
//# sourceMappingURL=Chip.mjs.map
|
|
@@ -8,7 +8,7 @@ interface CollapsibleProps extends ComponentProps<typeof CollapsiblePrimitive.Ro
|
|
|
8
8
|
animation?: AnimationType;
|
|
9
9
|
}
|
|
10
10
|
declare function Collapsible({ animation, ...props }: CollapsibleProps): import("react/jsx-runtime").JSX.Element;
|
|
11
|
-
declare
|
|
11
|
+
declare const CollapsibleTrigger: import("react").ForwardRefExoticComponent<Omit<CollapsiblePrimitive.CollapsibleTriggerProps & import("react").RefAttributes<HTMLButtonElement>, "ref"> & import("react").RefAttributes<HTMLButtonElement>>;
|
|
12
12
|
declare function CollapsibleContent({ className, ...props }: CollapsibleContentProps): import("react/jsx-runtime").JSX.Element;
|
|
13
13
|
export { Collapsible, CollapsibleTrigger, CollapsibleContent };
|
|
14
14
|
export type { AnimationType, CollapsibleProps, CollapsibleContentProps };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Collapsible.d.ts","sourceRoot":"","sources":["../../src/components/Collapsible.tsx"],"names":[],"mappings":"AAEA,OAAO,
|
|
1
|
+
{"version":3,"file":"Collapsible.d.ts","sourceRoot":"","sources":["../../src/components/Collapsible.tsx"],"names":[],"mappings":"AAEA,OAAO,EAKL,KAAK,cAAc,EAGpB,MAAM,OAAO,CAAC;AACf,OAAO,EAAE,WAAW,IAAI,oBAAoB,EAAE,MAAM,UAAU,CAAC;AAG/D,KAAK,aAAa,GAAG,WAAW,GAAG,MAAM,CAAC;AAM1C,UAAU,uBACR,SAAQ,cAAc,CAAC,OAAO,oBAAoB,CAAC,OAAO,CAAC;IAC3D,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAMD,UAAU,gBACR,SAAQ,cAAc,CAAC,OAAO,oBAAoB,CAAC,IAAI,CAAC;IACxD,SAAS,CAAC,EAAE,aAAa,CAAC;CAC3B;AAED,iBAAS,WAAW,CAAC,EAAE,SAAS,EAAE,GAAG,KAAK,EAAE,EAAE,gBAAgB,2CAQ7D;AAED,QAAA,MAAM,kBAAkB,4MAWtB,CAAC;AAEH,iBAAS,kBAAkB,CAAC,EAAE,SAAS,EAAE,GAAG,KAAK,EAAE,EAAE,uBAAuB,2CAgB3E;AAED,OAAO,EAAE,WAAW,EAAE,kBAAkB,EAAE,kBAAkB,EAAE,CAAC;AAC/D,YAAY,EAAE,aAAa,EAAE,gBAAgB,EAAE,uBAAuB,EAAE,CAAC"}
|
|
@@ -8,7 +8,7 @@ interface CollapsibleProps extends ComponentProps<typeof CollapsiblePrimitive.Ro
|
|
|
8
8
|
animation?: AnimationType;
|
|
9
9
|
}
|
|
10
10
|
declare function Collapsible({ animation, ...props }: CollapsibleProps): import("react/jsx-runtime").JSX.Element;
|
|
11
|
-
declare
|
|
11
|
+
declare const CollapsibleTrigger: import("react").ForwardRefExoticComponent<Omit<CollapsiblePrimitive.CollapsibleTriggerProps & import("react").RefAttributes<HTMLButtonElement>, "ref"> & import("react").RefAttributes<HTMLButtonElement>>;
|
|
12
12
|
declare function CollapsibleContent({ className, ...props }: CollapsibleContentProps): import("react/jsx-runtime").JSX.Element;
|
|
13
13
|
export { Collapsible, CollapsibleTrigger, CollapsibleContent };
|
|
14
14
|
export type { AnimationType, CollapsibleProps, CollapsibleContentProps };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Collapsible.d.ts","sourceRoot":"","sources":["../../src/components/Collapsible.tsx"],"names":[],"mappings":"AAEA,OAAO,
|
|
1
|
+
{"version":3,"file":"Collapsible.d.ts","sourceRoot":"","sources":["../../src/components/Collapsible.tsx"],"names":[],"mappings":"AAEA,OAAO,EAKL,KAAK,cAAc,EAGpB,MAAM,OAAO,CAAC;AACf,OAAO,EAAE,WAAW,IAAI,oBAAoB,EAAE,MAAM,UAAU,CAAC;AAG/D,KAAK,aAAa,GAAG,WAAW,GAAG,MAAM,CAAC;AAM1C,UAAU,uBACR,SAAQ,cAAc,CAAC,OAAO,oBAAoB,CAAC,OAAO,CAAC;IAC3D,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAMD,UAAU,gBACR,SAAQ,cAAc,CAAC,OAAO,oBAAoB,CAAC,IAAI,CAAC;IACxD,SAAS,CAAC,EAAE,aAAa,CAAC;CAC3B;AAED,iBAAS,WAAW,CAAC,EAAE,SAAS,EAAE,GAAG,KAAK,EAAE,EAAE,gBAAgB,2CAQ7D;AAED,QAAA,MAAM,kBAAkB,4MAWtB,CAAC;AAEH,iBAAS,kBAAkB,CAAC,EAAE,SAAS,EAAE,GAAG,KAAK,EAAE,EAAE,uBAAuB,2CAgB3E;AAED,OAAO,EAAE,WAAW,EAAE,kBAAkB,EAAE,kBAAkB,EAAE,CAAC;AAC/D,YAAY,EAAE,aAAa,EAAE,gBAAgB,EAAE,uBAAuB,EAAE,CAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
"use client";
|
|
3
|
-
"use strict";var l=require("react/jsx-runtime"),n=require("react"),o=require("radix-ui"),m=require("../lib/utils.js"),x=Object.defineProperty,i=Object.getOwnPropertySymbols,
|
|
3
|
+
"use strict";var l=require("react/jsx-runtime"),n=require("react"),o=require("radix-ui"),m=require("../lib/utils.js"),x=Object.defineProperty,i=Object.getOwnPropertySymbols,u=Object.prototype.hasOwnProperty,d=Object.prototype.propertyIsEnumerable,p=(e,a,r)=>a in e?x(e,a,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[a]=r,s=(e,a)=>{for(var r in a||(a={}))u.call(a,r)&&p(e,r,a[r]);if(i)for(var r of i(a))d.call(a,r)&&p(e,r,a[r]);return e},f=(e,a)=>{var r={};for(var t in e)u.call(e,t)&&a.indexOf(t)<0&&(r[t]=e[t]);if(e!=null&&i)for(var t of i(e))a.indexOf(t)<0&&d.call(e,t)&&(r[t]=e[t]);return r};const v=n.createContext({animation:void 0});function C(e){var a=e,{animation:r}=a,t=f(a,["animation"]);return l.jsx(v.Provider,{value:n.useMemo(()=>({animation:r}),[r]),children:l.jsx(o.Collapsible.Root,s({"data-slot":"collapsible"},t))})}const j=n.forwardRef(function(e,a){return l.jsx(o.Collapsible.Trigger,s({ref:a,"data-slot":"collapsible-trigger"},e))});function g(e){var a=e,{className:r}=a,t=f(a,["className"]);const{animation:c}=n.useContext(v),b={accordion:"overflow-hidden data-[state=closed]:animate-collapsible-up data-[state=open]:animate-collapsible-down",fade:"data-[state=closed]:animate-fade-out data-[state=open]:animate-fade-in"};return l.jsx(o.Collapsible.Content,s({"data-slot":"collapsible-content",className:m.cn(c&&b[c],r)},t))}exports.Collapsible=C,exports.CollapsibleContent=g,exports.CollapsibleTrigger=j;
|
|
4
4
|
//# sourceMappingURL=Collapsible.js.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
"use client";
|
|
3
|
-
import{jsx as o}from"react/jsx-runtime";import{createContext as b,
|
|
3
|
+
import{jsx as o}from"react/jsx-runtime";import{createContext as b,forwardRef as v,useMemo as C,useContext as g}from"react";import{Collapsible as l}from"radix-ui";import{cn as O}from"../lib/utils.mjs";var x=Object.defineProperty,n=Object.getOwnPropertySymbols,c=Object.prototype.hasOwnProperty,f=Object.prototype.propertyIsEnumerable,p=(t,a,e)=>a in t?x(t,a,{enumerable:!0,configurable:!0,writable:!0,value:e}):t[a]=e,i=(t,a)=>{for(var e in a||(a={}))c.call(a,e)&&p(t,e,a[e]);if(n)for(var e of n(a))f.call(a,e)&&p(t,e,a[e]);return t},m=(t,a)=>{var e={};for(var r in t)c.call(t,r)&&a.indexOf(r)<0&&(e[r]=t[r]);if(t!=null&&n)for(var r of n(t))a.indexOf(r)<0&&f.call(t,r)&&(e[r]=t[r]);return e};const d=b({animation:void 0});function y(t){var a=t,{animation:e}=a,r=m(a,["animation"]);return o(d.Provider,{value:C(()=>({animation:e}),[e]),children:o(l.Root,i({"data-slot":"collapsible"},r))})}const w=v(function(t,a){return o(l.Trigger,i({ref:a,"data-slot":"collapsible-trigger"},t))});function j(t){var a=t,{className:e}=a,r=m(a,["className"]);const{animation:s}=g(d),u={accordion:"overflow-hidden data-[state=closed]:animate-collapsible-up data-[state=open]:animate-collapsible-down",fade:"data-[state=closed]:animate-fade-out data-[state=open]:animate-fade-in"};return o(l.Content,i({"data-slot":"collapsible-content",className:O(s&&u[s],e)},r))}export{y as Collapsible,j as CollapsibleContent,w as CollapsibleTrigger};
|
|
4
4
|
//# sourceMappingURL=Collapsible.mjs.map
|
|
@@ -6,7 +6,10 @@ declare function CommandDialog({ title, description, children, ...props }: Compo
|
|
|
6
6
|
title?: string;
|
|
7
7
|
description?: string;
|
|
8
8
|
}): import("react/jsx-runtime").JSX.Element;
|
|
9
|
-
declare
|
|
9
|
+
declare const CommandInput: import("react").ForwardRefExoticComponent<Omit<Omit<import("react").InputHTMLAttributes<HTMLInputElement>, "onChange" | "value" | "type"> & {
|
|
10
|
+
value?: string;
|
|
11
|
+
onValueChange?: (search: string) => void;
|
|
12
|
+
} & import("react").RefAttributes<HTMLInputElement>, "ref"> & import("react").RefAttributes<HTMLInputElement>>;
|
|
10
13
|
declare function CommandList({ className, ...props }: ComponentProps<typeof CommandPrimitive.List>): import("react/jsx-runtime").JSX.Element;
|
|
11
14
|
declare function CommandEmpty({ ...props }: ComponentProps<typeof CommandPrimitive.Empty>): import("react/jsx-runtime").JSX.Element;
|
|
12
15
|
declare function CommandGroup({ className, ...props }: ComponentProps<typeof CommandPrimitive.Group>): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Command.d.ts","sourceRoot":"","sources":["../../src/components/Command.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,OAAO,IAAI,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAGzD,OAAO,EACL,MAAM,EAKP,MAAM,qBAAqB,CAAC;AAC7B,OAAO,
|
|
1
|
+
{"version":3,"file":"Command.d.ts","sourceRoot":"","sources":["../../src/components/Command.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,OAAO,IAAI,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAGzD,OAAO,EACL,MAAM,EAKP,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAEL,KAAK,cAAc,EAGpB,MAAM,OAAO,CAAC;AAEf,iBAAS,OAAO,CAAC,EACf,SAAS,EACT,GAAG,KAAK,EACT,EAAE,cAAc,CAAC,OAAO,gBAAgB,CAAC,2CAWzC;AAED,iBAAS,aAAa,CAAC,EACrB,KAA4B,EAC5B,WAAkD,EAClD,QAAQ,EACR,GAAG,KAAK,EACT,EAAE,cAAc,CAAC,OAAO,MAAM,CAAC,GAAG;IACjC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB,2CAiBA;AAED,QAAA,MAAM,YAAY;;;8GAsBhB,CAAC;AAEH,iBAAS,WAAW,CAAC,EACnB,SAAS,EACT,GAAG,KAAK,EACT,EAAE,cAAc,CAAC,OAAO,gBAAgB,CAAC,IAAI,CAAC,2CAY9C;AAED,iBAAS,YAAY,CAAC,EACpB,GAAG,KAAK,EACT,EAAE,cAAc,CAAC,OAAO,gBAAgB,CAAC,KAAK,CAAC,2CAQ/C;AAED,iBAAS,YAAY,CAAC,EACpB,SAAS,EACT,GAAG,KAAK,EACT,EAAE,cAAc,CAAC,OAAO,gBAAgB,CAAC,KAAK,CAAC,2CAW/C;AAED,iBAAS,gBAAgB,CAAC,EACxB,SAAS,EACT,GAAG,KAAK,EACT,EAAE,cAAc,CAAC,OAAO,gBAAgB,CAAC,SAAS,CAAC,2CAQnD;AAED,iBAAS,WAAW,CAAC,EACnB,SAAS,EACT,GAAG,KAAK,EACT,EAAE,cAAc,CAAC,OAAO,gBAAgB,CAAC,IAAI,CAAC,2CAW9C;AAED,iBAAS,eAAe,CAAC,EAAE,SAAS,EAAE,GAAG,KAAK,EAAE,EAAE,cAAc,CAAC,MAAM,CAAC,2CAWvE;AAED,OAAO,EACL,OAAO,EACP,aAAa,EACb,YAAY,EACZ,YAAY,EACZ,YAAY,EACZ,WAAW,EACX,WAAW,EACX,gBAAgB,EAChB,eAAe,GAChB,CAAC"}
|
|
@@ -6,7 +6,10 @@ declare function CommandDialog({ title, description, children, ...props }: Compo
|
|
|
6
6
|
title?: string;
|
|
7
7
|
description?: string;
|
|
8
8
|
}): import("react/jsx-runtime").JSX.Element;
|
|
9
|
-
declare
|
|
9
|
+
declare const CommandInput: import("react").ForwardRefExoticComponent<Omit<Omit<import("react").InputHTMLAttributes<HTMLInputElement>, "onChange" | "value" | "type"> & {
|
|
10
|
+
value?: string;
|
|
11
|
+
onValueChange?: (search: string) => void;
|
|
12
|
+
} & import("react").RefAttributes<HTMLInputElement>, "ref"> & import("react").RefAttributes<HTMLInputElement>>;
|
|
10
13
|
declare function CommandList({ className, ...props }: ComponentProps<typeof CommandPrimitive.List>): import("react/jsx-runtime").JSX.Element;
|
|
11
14
|
declare function CommandEmpty({ ...props }: ComponentProps<typeof CommandPrimitive.Empty>): import("react/jsx-runtime").JSX.Element;
|
|
12
15
|
declare function CommandGroup({ className, ...props }: ComponentProps<typeof CommandPrimitive.Group>): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Command.d.ts","sourceRoot":"","sources":["../../src/components/Command.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,OAAO,IAAI,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAGzD,OAAO,EACL,MAAM,EAKP,MAAM,qBAAqB,CAAC;AAC7B,OAAO,
|
|
1
|
+
{"version":3,"file":"Command.d.ts","sourceRoot":"","sources":["../../src/components/Command.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,OAAO,IAAI,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAGzD,OAAO,EACL,MAAM,EAKP,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAEL,KAAK,cAAc,EAGpB,MAAM,OAAO,CAAC;AAEf,iBAAS,OAAO,CAAC,EACf,SAAS,EACT,GAAG,KAAK,EACT,EAAE,cAAc,CAAC,OAAO,gBAAgB,CAAC,2CAWzC;AAED,iBAAS,aAAa,CAAC,EACrB,KAA4B,EAC5B,WAAkD,EAClD,QAAQ,EACR,GAAG,KAAK,EACT,EAAE,cAAc,CAAC,OAAO,MAAM,CAAC,GAAG;IACjC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB,2CAiBA;AAED,QAAA,MAAM,YAAY;;;8GAsBhB,CAAC;AAEH,iBAAS,WAAW,CAAC,EACnB,SAAS,EACT,GAAG,KAAK,EACT,EAAE,cAAc,CAAC,OAAO,gBAAgB,CAAC,IAAI,CAAC,2CAY9C;AAED,iBAAS,YAAY,CAAC,EACpB,GAAG,KAAK,EACT,EAAE,cAAc,CAAC,OAAO,gBAAgB,CAAC,KAAK,CAAC,2CAQ/C;AAED,iBAAS,YAAY,CAAC,EACpB,SAAS,EACT,GAAG,KAAK,EACT,EAAE,cAAc,CAAC,OAAO,gBAAgB,CAAC,KAAK,CAAC,2CAW/C;AAED,iBAAS,gBAAgB,CAAC,EACxB,SAAS,EACT,GAAG,KAAK,EACT,EAAE,cAAc,CAAC,OAAO,gBAAgB,CAAC,SAAS,CAAC,2CAQnD;AAED,iBAAS,WAAW,CAAC,EACnB,SAAS,EACT,GAAG,KAAK,EACT,EAAE,cAAc,CAAC,OAAO,gBAAgB,CAAC,IAAI,CAAC,2CAW9C;AAED,iBAAS,eAAe,CAAC,EAAE,SAAS,EAAE,GAAG,KAAK,EAAE,EAAE,cAAc,CAAC,MAAM,CAAC,2CAWvE;AAED,OAAO,EACL,OAAO,EACP,aAAa,EACb,YAAY,EACZ,YAAY,EACZ,YAAY,EACZ,WAAW,EACX,WAAW,EACX,gBAAgB,EAChB,eAAe,GAChB,CAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
"use client";
|
|
3
|
-
"use strict";var n=require("react/jsx-runtime"),o=require("../lib/cmdk.js"),
|
|
3
|
+
"use strict";var n=require("react/jsx-runtime"),o=require("../lib/cmdk.js"),f=require("@medway-ui/icons"),d=require("../lib/utils.js");require("./Dialog.js");var x=require("react"),v=Object.defineProperty,l=Object.getOwnPropertySymbols,c=Object.prototype.hasOwnProperty,u=Object.prototype.propertyIsEnumerable,i=(a,e,r)=>e in a?v(a,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):a[e]=r,s=(a,e)=>{for(var r in e||(e={}))c.call(e,r)&&i(a,r,e[r]);if(l)for(var r of l(e))u.call(e,r)&&i(a,r,e[r]);return a},m=(a,e)=>{var r={};for(var t in a)c.call(a,t)&&e.indexOf(t)<0&&(r[t]=a[t]);if(a!=null&&l)for(var t of l(a))e.indexOf(t)<0&&u.call(a,t)&&(r[t]=a[t]);return r};function g(a){var e=a,{className:r}=e,t=m(e,["className"]);return n.jsx(o.Command,s({className:d.cn("flex size-full flex-col overflow-hidden rounded-md bg-surface-card text-gray-foreground",r),"data-slot":"command"},t))}const y=x.forwardRef(function(a,e){var r=a,{className:t}=r,p=m(r,["className"]);return n.jsxs("div",{className:"flex items-center border-b border-gray-stroke-muted px-4","cmdk-input-wrapper":"","data-slot":"command-input-wrapper",children:[n.jsx(o.Command.Input,s({ref:e,className:d.cn("flex h-12 w-full bg-transparent py-3 text-md font-medium outline-none placeholder:text-gray-foreground-muted disabled:cursor-not-allowed disabled:opacity-50",t),"data-slot":"command-input"},p)),n.jsx(f.SearchMagnifyingGlass,{className:"text-gray-foreground-muted",size:24})]})});function b(a){var e=a,{className:r}=e,t=m(e,["className"]);return n.jsx(o.Command.List,s({className:d.cn("max-h-80 flex-1 overflow-y-auto overflow-x-hidden",r),"data-slot":"command-list","data-radix-scroll-area":""},t))}function N(a){var e=m(a,[]);return n.jsx(o.Command.Empty,s({className:"py-6 text-center text-sm","data-slot":"command-empty"},e))}function h(a){var e=a,{className:r}=e,t=m(e,["className"]);return n.jsx(o.Command.Group,s({className:d.cn("overflow-hidden p-2 text-gray-foreground [&_[cmdk-group-heading]]:px-3 [&_[cmdk-group-heading]]:py-2 [&_[cmdk-group-heading]]:text-xs [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-gray-foreground-muted",r),"data-slot":"command-group"},t))}function j(a){var e=a,{className:r}=e,t=m(e,["className"]);return n.jsx(o.Command.Item,s({className:d.cn("relative flex cursor-default select-none items-center gap-3 rounded-md px-2 py-1.5 text-sm outline-none data-[disabled=true]:pointer-events-none data-[disabled=true]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0",r),"data-slot":"command-item"},t))}exports.Command=g,exports.CommandEmpty=N,exports.CommandGroup=h,exports.CommandInput=y,exports.CommandItem=j,exports.CommandList=b;
|
|
4
4
|
//# sourceMappingURL=Command.js.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
"use client";
|
|
3
|
-
import{
|
|
3
|
+
import{jsxs as f,jsx as o}from"react/jsx-runtime";import{Command as n}from"../lib/cmdk.mjs";import{SearchMagnifyingGlass as g}from"@medway-ui/icons";import{cn as d}from"../lib/utils.mjs";import"./Dialog.mjs";import{forwardRef as x}from"react";var v=Object.defineProperty,l=Object.getOwnPropertySymbols,c=Object.prototype.hasOwnProperty,i=Object.prototype.propertyIsEnumerable,u=(a,e,r)=>e in a?v(a,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):a[e]=r,m=(a,e)=>{for(var r in e||(e={}))c.call(e,r)&&u(a,r,e[r]);if(l)for(var r of l(e))i.call(e,r)&&u(a,r,e[r]);return a},s=(a,e)=>{var r={};for(var t in a)c.call(a,t)&&e.indexOf(t)<0&&(r[t]=a[t]);if(a!=null&&l)for(var t of l(a))e.indexOf(t)<0&&i.call(a,t)&&(r[t]=a[t]);return r};function y(a){var e=a,{className:r}=e,t=s(e,["className"]);return o(n,m({className:d("flex size-full flex-col overflow-hidden rounded-md bg-surface-card text-gray-foreground",r),"data-slot":"command"},t))}const b=x(function(a,e){var r=a,{className:t}=r,p=s(r,["className"]);return f("div",{className:"flex items-center border-b border-gray-stroke-muted px-4","cmdk-input-wrapper":"","data-slot":"command-input-wrapper",children:[o(n.Input,m({ref:e,className:d("flex h-12 w-full bg-transparent py-3 text-md font-medium outline-none placeholder:text-gray-foreground-muted disabled:cursor-not-allowed disabled:opacity-50",t),"data-slot":"command-input"},p)),o(g,{className:"text-gray-foreground-muted",size:24})]})});function N(a){var e=a,{className:r}=e,t=s(e,["className"]);return o(n.List,m({className:d("max-h-80 flex-1 overflow-y-auto overflow-x-hidden",r),"data-slot":"command-list","data-radix-scroll-area":""},t))}function h(a){var e=s(a,[]);return o(n.Empty,m({className:"py-6 text-center text-sm","data-slot":"command-empty"},e))}function w(a){var e=a,{className:r}=e,t=s(e,["className"]);return o(n.Group,m({className:d("overflow-hidden p-2 text-gray-foreground [&_[cmdk-group-heading]]:px-3 [&_[cmdk-group-heading]]:py-2 [&_[cmdk-group-heading]]:text-xs [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-gray-foreground-muted",r),"data-slot":"command-group"},t))}function k(a){var e=a,{className:r}=e,t=s(e,["className"]);return o(n.Item,m({className:d("relative flex cursor-default select-none items-center gap-3 rounded-md px-2 py-1.5 text-sm outline-none data-[disabled=true]:pointer-events-none data-[disabled=true]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0",r),"data-slot":"command-item"},t))}export{y as Command,h as CommandEmpty,w as CommandGroup,b as CommandInput,k as CommandItem,N as CommandList};
|
|
4
4
|
//# sourceMappingURL=Command.mjs.map
|
|
@@ -2,7 +2,7 @@ import { type VariantProps } from "class-variance-authority";
|
|
|
2
2
|
import { type ComponentPropsWithoutRef, type HTMLAttributes } from "react";
|
|
3
3
|
declare const datePickerTriggerVariants: (props?: ({
|
|
4
4
|
size?: "md" | "lg" | null | undefined;
|
|
5
|
-
} & import("class
|
|
5
|
+
} & ({ class: import("clsx").ClassValue; className?: never } | { class?: never; className: import("clsx").ClassValue } | { class?: never; className?: never })) | undefined) => string;
|
|
6
6
|
type DatePickerValue = Date | null;
|
|
7
7
|
type DateRangeValue = {
|
|
8
8
|
start: Date | null;
|
|
@@ -50,8 +50,8 @@ interface DateRangePickerProps extends Omit<ComponentPropsWithoutRef<"button">,
|
|
|
50
50
|
declare function DatePickerWrapper({ className, ...props }: HTMLAttributes<HTMLDivElement>): import("react/jsx-runtime").JSX.Element;
|
|
51
51
|
declare function DatePickerLabel({ className, children, ...props }: DatePickerLabelProps): import("react/jsx-runtime").JSX.Element;
|
|
52
52
|
declare function DatePickerText({ className, ...props }: HTMLAttributes<HTMLSpanElement>): import("react/jsx-runtime").JSX.Element;
|
|
53
|
-
declare function DatePicker({ value, defaultValue, onValueChange, placeholder, disabled, min, max, format, className, inputClassName, contentClassName, size, yearRange, showYearSelector, invalid, children, ...props }: DatePickerProps): import("react/jsx-runtime").JSX.Element;
|
|
54
|
-
declare function DateRangePicker({ value, defaultValue, onValueChange, placeholder, disabled, min, max, format, className, inputClassName, contentClassName, size, yearRange, showYearSelector, invalid, children, ...props }: DateRangePickerProps): import("react/jsx-runtime").JSX.Element;
|
|
53
|
+
declare function DatePicker({ value, defaultValue, onValueChange, placeholder, disabled, min, max, format, className, inputClassName, contentClassName, size, yearRange, showYearSelector, invalid, children, onClick, ...props }: DatePickerProps): import("react/jsx-runtime").JSX.Element;
|
|
54
|
+
declare function DateRangePicker({ value, defaultValue, onValueChange, placeholder, disabled, min, max, format, className, inputClassName, contentClassName, size, yearRange, showYearSelector, invalid, children, onClick, ...props }: DateRangePickerProps): import("react/jsx-runtime").JSX.Element;
|
|
55
55
|
export { DatePicker, DatePickerLabel, DatePickerText, DatePickerWrapper, DateRangePicker, datePickerTriggerVariants, };
|
|
56
56
|
export type { DatePickerLabelProps, DatePickerProps, DatePickerValue, DateRangePickerProps, DateRangeValue, };
|
|
57
57
|
//# sourceMappingURL=DatePicker.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DatePicker.d.ts","sourceRoot":"","sources":["../../src/components/DatePicker.tsx"],"names":[],"mappings":"AASA,OAAO,EAAO,KAAK,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAClE,OAAO,
|
|
1
|
+
{"version":3,"file":"DatePicker.d.ts","sourceRoot":"","sources":["../../src/components/DatePicker.tsx"],"names":[],"mappings":"AASA,OAAO,EAAO,KAAK,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAClE,OAAO,EASL,KAAK,wBAAwB,EAC7B,KAAK,cAAc,EAGpB,MAAM,OAAO,CAAC;AAqBf,QAAA,MAAM,yBAAyB;;8EAgB9B,CAAC;AAEF,KAAK,eAAe,GAAG,IAAI,GAAG,IAAI,CAAC;AAEnC,KAAK,cAAc,GAAG;IAAE,KAAK,EAAE,IAAI,GAAG,IAAI,CAAC;IAAC,GAAG,EAAE,IAAI,GAAG,IAAI,CAAA;CAAE,GAAG,IAAI,CAAC;AAEtE,UAAU,oBAAqB,SAAQ,cAAc,CAAC,gBAAgB,CAAC;IACrE,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,UAAU,eACR,SAAQ,IAAI,CACR,wBAAwB,CAAC,QAAQ,CAAC,EAClC,OAAO,GAAG,cAAc,GAAG,UAAU,CACtC,EACD,YAAY,CAAC,OAAO,yBAAyB,CAAC;IAChD,KAAK,CAAC,EAAE,eAAe,CAAC;IACxB,YAAY,CAAC,EAAE,eAAe,CAAC;IAC/B,aAAa,CAAC,EAAE,CAAC,KAAK,EAAE,eAAe,KAAK,IAAI,CAAC;IACjD,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,GAAG,CAAC,EAAE,IAAI,CAAC;IACX,GAAG,CAAC,EAAE,IAAI,CAAC;IACX,MAAM,CAAC,EAAE,CAAC,IAAI,EAAE,IAAI,KAAK,MAAM,CAAC;IAChC,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,SAAS,CAAC,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,GAAG,EAAE,MAAM,CAAA;KAAE,CAAC;IAC3C,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AAED,UAAU,oBACR,SAAQ,IAAI,CACR,wBAAwB,CAAC,QAAQ,CAAC,EAClC,OAAO,GAAG,cAAc,GAAG,UAAU,CACtC,EACD,YAAY,CAAC,OAAO,yBAAyB,CAAC;IAChD,KAAK,CAAC,EAAE,cAAc,CAAC;IACvB,YAAY,CAAC,EAAE,cAAc,CAAC;IAC9B,aAAa,CAAC,EAAE,CAAC,KAAK,EAAE,cAAc,KAAK,IAAI,CAAC;IAChD,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,GAAG,CAAC,EAAE,IAAI,CAAC;IACX,GAAG,CAAC,EAAE,IAAI,CAAC;IACX,MAAM,CAAC,EAAE,CAAC,IAAI,EAAE,IAAI,KAAK,MAAM,CAAC;IAChC,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,SAAS,CAAC,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,GAAG,EAAE,MAAM,CAAA;KAAE,CAAC;IAC3C,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AAED,iBAAS,iBAAiB,CAAC,EACzB,SAAS,EACT,GAAG,KAAK,EACT,EAAE,cAAc,CAAC,cAAc,CAAC,2CAQhC;AAED,iBAAS,eAAe,CAAC,EACvB,SAAS,EACT,QAAQ,EACR,GAAG,KAAK,EACT,EAAE,oBAAoB,2CAetB;AAED,iBAAS,cAAc,CAAC,EACtB,SAAS,EACT,GAAG,KAAK,EACT,EAAE,cAAc,CAAC,eAAe,CAAC,2CAcjC;AAiKD,iBAAS,UAAU,CAAC,EAClB,KAAK,EACL,YAAmB,EACnB,aAAa,EACb,WAAkC,EAClC,QAAQ,EACR,GAAG,EACH,GAAG,EACH,MAAsB,EACtB,SAAS,EACT,cAAc,EACd,gBAAgB,EAChB,IAAW,EACX,SAA8B,EAC9B,gBAAuB,EACvB,OAAe,EACf,QAAQ,EACR,OAAO,EACP,GAAG,KAAK,EACT,EAAE,eAAe,2CAsUjB;AAED,iBAAS,eAAe,CAAC,EACvB,KAAK,EACL,YAAmB,EACnB,aAAa,EACb,WAAkC,EAClC,QAAQ,EACR,GAAG,EACH,GAAG,EACH,MAAsB,EACtB,SAAS,EACT,cAAc,EACd,gBAAgB,EAChB,IAAW,EACX,SAA8B,EAC9B,gBAAuB,EACvB,OAAe,EACf,QAAQ,EACR,OAAO,EACP,GAAG,KAAK,EACT,EAAE,oBAAoB,2CAuWtB;AAED,OAAO,EACL,UAAU,EACV,eAAe,EACf,cAAc,EACd,iBAAiB,EACjB,eAAe,EACf,yBAAyB,GAC1B,CAAC;AACF,YAAY,EACV,oBAAoB,EACpB,eAAe,EACf,eAAe,EACf,oBAAoB,EACpB,cAAc,GACf,CAAC"}
|
|
@@ -2,7 +2,7 @@ import { type VariantProps } from "class-variance-authority";
|
|
|
2
2
|
import { type ComponentPropsWithoutRef, type HTMLAttributes } from "react";
|
|
3
3
|
declare const datePickerTriggerVariants: (props?: ({
|
|
4
4
|
size?: "md" | "lg" | null | undefined;
|
|
5
|
-
} & import("class
|
|
5
|
+
} & ({ class: import("clsx").ClassValue; className?: never } | { class?: never; className: import("clsx").ClassValue } | { class?: never; className?: never })) | undefined) => string;
|
|
6
6
|
type DatePickerValue = Date | null;
|
|
7
7
|
type DateRangeValue = {
|
|
8
8
|
start: Date | null;
|
|
@@ -50,8 +50,8 @@ interface DateRangePickerProps extends Omit<ComponentPropsWithoutRef<"button">,
|
|
|
50
50
|
declare function DatePickerWrapper({ className, ...props }: HTMLAttributes<HTMLDivElement>): import("react/jsx-runtime").JSX.Element;
|
|
51
51
|
declare function DatePickerLabel({ className, children, ...props }: DatePickerLabelProps): import("react/jsx-runtime").JSX.Element;
|
|
52
52
|
declare function DatePickerText({ className, ...props }: HTMLAttributes<HTMLSpanElement>): import("react/jsx-runtime").JSX.Element;
|
|
53
|
-
declare function DatePicker({ value, defaultValue, onValueChange, placeholder, disabled, min, max, format, className, inputClassName, contentClassName, size, yearRange, showYearSelector, invalid, children, ...props }: DatePickerProps): import("react/jsx-runtime").JSX.Element;
|
|
54
|
-
declare function DateRangePicker({ value, defaultValue, onValueChange, placeholder, disabled, min, max, format, className, inputClassName, contentClassName, size, yearRange, showYearSelector, invalid, children, ...props }: DateRangePickerProps): import("react/jsx-runtime").JSX.Element;
|
|
53
|
+
declare function DatePicker({ value, defaultValue, onValueChange, placeholder, disabled, min, max, format, className, inputClassName, contentClassName, size, yearRange, showYearSelector, invalid, children, onClick, ...props }: DatePickerProps): import("react/jsx-runtime").JSX.Element;
|
|
54
|
+
declare function DateRangePicker({ value, defaultValue, onValueChange, placeholder, disabled, min, max, format, className, inputClassName, contentClassName, size, yearRange, showYearSelector, invalid, children, onClick, ...props }: DateRangePickerProps): import("react/jsx-runtime").JSX.Element;
|
|
55
55
|
export { DatePicker, DatePickerLabel, DatePickerText, DatePickerWrapper, DateRangePicker, datePickerTriggerVariants, };
|
|
56
56
|
export type { DatePickerLabelProps, DatePickerProps, DatePickerValue, DateRangePickerProps, DateRangeValue, };
|
|
57
57
|
//# sourceMappingURL=DatePicker.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DatePicker.d.ts","sourceRoot":"","sources":["../../src/components/DatePicker.tsx"],"names":[],"mappings":"AASA,OAAO,EAAO,KAAK,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAClE,OAAO,
|
|
1
|
+
{"version":3,"file":"DatePicker.d.ts","sourceRoot":"","sources":["../../src/components/DatePicker.tsx"],"names":[],"mappings":"AASA,OAAO,EAAO,KAAK,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAClE,OAAO,EASL,KAAK,wBAAwB,EAC7B,KAAK,cAAc,EAGpB,MAAM,OAAO,CAAC;AAqBf,QAAA,MAAM,yBAAyB;;8EAgB9B,CAAC;AAEF,KAAK,eAAe,GAAG,IAAI,GAAG,IAAI,CAAC;AAEnC,KAAK,cAAc,GAAG;IAAE,KAAK,EAAE,IAAI,GAAG,IAAI,CAAC;IAAC,GAAG,EAAE,IAAI,GAAG,IAAI,CAAA;CAAE,GAAG,IAAI,CAAC;AAEtE,UAAU,oBAAqB,SAAQ,cAAc,CAAC,gBAAgB,CAAC;IACrE,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,UAAU,eACR,SAAQ,IAAI,CACR,wBAAwB,CAAC,QAAQ,CAAC,EAClC,OAAO,GAAG,cAAc,GAAG,UAAU,CACtC,EACD,YAAY,CAAC,OAAO,yBAAyB,CAAC;IAChD,KAAK,CAAC,EAAE,eAAe,CAAC;IACxB,YAAY,CAAC,EAAE,eAAe,CAAC;IAC/B,aAAa,CAAC,EAAE,CAAC,KAAK,EAAE,eAAe,KAAK,IAAI,CAAC;IACjD,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,GAAG,CAAC,EAAE,IAAI,CAAC;IACX,GAAG,CAAC,EAAE,IAAI,CAAC;IACX,MAAM,CAAC,EAAE,CAAC,IAAI,EAAE,IAAI,KAAK,MAAM,CAAC;IAChC,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,SAAS,CAAC,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,GAAG,EAAE,MAAM,CAAA;KAAE,CAAC;IAC3C,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AAED,UAAU,oBACR,SAAQ,IAAI,CACR,wBAAwB,CAAC,QAAQ,CAAC,EAClC,OAAO,GAAG,cAAc,GAAG,UAAU,CACtC,EACD,YAAY,CAAC,OAAO,yBAAyB,CAAC;IAChD,KAAK,CAAC,EAAE,cAAc,CAAC;IACvB,YAAY,CAAC,EAAE,cAAc,CAAC;IAC9B,aAAa,CAAC,EAAE,CAAC,KAAK,EAAE,cAAc,KAAK,IAAI,CAAC;IAChD,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,GAAG,CAAC,EAAE,IAAI,CAAC;IACX,GAAG,CAAC,EAAE,IAAI,CAAC;IACX,MAAM,CAAC,EAAE,CAAC,IAAI,EAAE,IAAI,KAAK,MAAM,CAAC;IAChC,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,SAAS,CAAC,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,GAAG,EAAE,MAAM,CAAA;KAAE,CAAC;IAC3C,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AAED,iBAAS,iBAAiB,CAAC,EACzB,SAAS,EACT,GAAG,KAAK,EACT,EAAE,cAAc,CAAC,cAAc,CAAC,2CAQhC;AAED,iBAAS,eAAe,CAAC,EACvB,SAAS,EACT,QAAQ,EACR,GAAG,KAAK,EACT,EAAE,oBAAoB,2CAetB;AAED,iBAAS,cAAc,CAAC,EACtB,SAAS,EACT,GAAG,KAAK,EACT,EAAE,cAAc,CAAC,eAAe,CAAC,2CAcjC;AAiKD,iBAAS,UAAU,CAAC,EAClB,KAAK,EACL,YAAmB,EACnB,aAAa,EACb,WAAkC,EAClC,QAAQ,EACR,GAAG,EACH,GAAG,EACH,MAAsB,EACtB,SAAS,EACT,cAAc,EACd,gBAAgB,EAChB,IAAW,EACX,SAA8B,EAC9B,gBAAuB,EACvB,OAAe,EACf,QAAQ,EACR,OAAO,EACP,GAAG,KAAK,EACT,EAAE,eAAe,2CAsUjB;AAED,iBAAS,eAAe,CAAC,EACvB,KAAK,EACL,YAAmB,EACnB,aAAa,EACb,WAAkC,EAClC,QAAQ,EACR,GAAG,EACH,GAAG,EACH,MAAsB,EACtB,SAAS,EACT,cAAc,EACd,gBAAgB,EAChB,IAAW,EACX,SAA8B,EAC9B,gBAAuB,EACvB,OAAe,EACf,QAAQ,EACR,OAAO,EACP,GAAG,KAAK,EACT,EAAE,oBAAoB,2CAuWtB;AAED,OAAO,EACL,UAAU,EACV,eAAe,EACf,cAAc,EACd,iBAAiB,EACjB,eAAe,EACf,yBAAyB,GAC1B,CAAC;AACF,YAAY,EACV,oBAAoB,EACpB,eAAe,EACf,eAAe,EACf,oBAAoB,EACpB,cAAc,GACf,CAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
"use client";
|
|
3
|
-
"use strict";var e=require("react/jsx-runtime"),w=require("../lib/utils.js"),N=require("@medway-ui/icons"),Re=require("class-variance-authority"),l=require("react"),xe=require("react-dom"),Le=Object.defineProperty,Me=Object.defineProperties,Pe=Object.getOwnPropertyDescriptors,G=Object.getOwnPropertySymbols,he=Object.prototype.hasOwnProperty,fe=Object.prototype.propertyIsEnumerable,ve=(t,a,s)=>a in t?Le(t,a,{enumerable:!0,configurable:!0,writable:!0,value:s}):t[a]=s,S=(t,a)=>{for(var s in a||(a={}))he.call(a,s)&&ve(t,s,a[s]);if(G)for(var s of G(a))fe.call(a,s)&&ve(t,s,a[s]);return t},T=(t,a)=>Me(t,Pe(a)),Q=(t,a)=>{var s={};for(var d in t)he.call(t,d)&&a.indexOf(d)<0&&(s[d]=t[d]);if(t!=null&&G)for(var d of G(t))a.indexOf(d)<0&&fe.call(t,d)&&(s[d]=t[d]);return s};const me=l.createContext({invalid:!1}),be={start:1950,end:new Date().getFullYear()};function J(t,a){const s=t.getFullYear();return s<a.start?new Date(a.start,0,1):s>a.end?new Date(a.end,11,31):t}const ge=Re.cva(["shadow-xs flex w-full items-center justify-between gap-2 rounded-md border-2 border-gray-stroke-muted bg-surface-card px-4 py-3 text-left text-gray-foreground outline-none transition-[color,box-shadow] enabled:hover:border-gray-stroke-emphasis enabled:hover:ring-[3px] enabled:hover:ring-state-focus disabled:pointer-events-none disabled:bg-gray-background-soft-muted disabled:text-gray-foreground-muted data-[invalid]:border-feedback-error-stroke data-[invalid]:enabled:hover:border-feedback-error-stroke data-[invalid]:enabled:hover:ring-[3px] data-[invalid]:enabled:hover:ring-state-error","group-has-[[data-slot=date-picker-label]]:data-[placeholder]:text-transparent"],{variants:{size:{lg:["h-12 max-h-12 text-md","max-sm:h-14 max-sm:text-base"],md:["h-10 max-h-10 text-sm","max-sm:h-11"]}},defaultVariants:{size:"lg"}});function Ae(t){var a=t,{className:s}=a,d=Q(a,["className"]);return e.jsx("div",S({className:w.cn("group relative flex flex-col gap-2",s),"data-slot":"date-picker-wrapper"},d))}function Fe(t){var a=t,{className:s,children:d}=a,g=Q(a,["className","children"]);return e.jsx("label",T(S({className:w.cn("pointer-events-none absolute start-3 top-0 z-10 origin-left -translate-y-1/2 bg-surface-card px-1 text-xs font-medium text-gray-foreground transition-all duration-200 ease-out","group-has-[[data-slot=date-picker-trigger][data-placeholder]:not([data-state=open])]:start-4 group-has-[[data-slot=date-picker-trigger][data-placeholder]:not([data-state=open])]:top-6 group-has-[[data-slot=date-picker-trigger][data-placeholder]:not([data-state=open])]:bg-transparent group-has-[[data-slot=date-picker-trigger][data-placeholder]:not([data-state=open])]:px-0 group-has-[[data-slot=date-picker-trigger][data-placeholder]:not([data-state=open])]:text-md group-has-[[data-slot=date-picker-trigger][data-placeholder]:not([data-state=open])]:font-normal group-has-[[data-slot=date-picker-trigger][data-placeholder]:not([data-state=open])]:text-gray-foreground max-sm:group-has-[[data-slot=date-picker-trigger][data-placeholder]:not([data-state=open])]:top-7","group-has-[[data-slot=date-picker-trigger][data-size=md]]:group-has-[[data-slot=date-picker-trigger][data-placeholder]:not([data-state=open])]:top-5 group-has-[[data-slot=date-picker-trigger][data-size=md]]:group-has-[[data-slot=date-picker-trigger][data-placeholder]:not([data-state=open])]:!text-sm max-sm:group-has-[[data-slot=date-picker-trigger][data-size=md]]:group-has-[[data-slot=date-picker-trigger][data-placeholder]:not([data-state=open])]:top-[22px]",s),"data-slot":"date-picker-label"},g),{children:d}))}function We(t){var a=t,{className:s}=a,d=Q(a,["className"]);const{invalid:g}=l.useContext(me);return e.jsx("span",S({className:w.cn("-mt-1 text-xs",g?"text-feedback-error-foreground":"text-gray-foreground",s),"data-slot":"date-picker-text"},d))}function O(t){return new Date(t.getFullYear(),t.getMonth(),t.getDate())}function $(t,a){return t.getFullYear()===a.getFullYear()&&t.getMonth()===a.getMonth()&&t.getDate()===a.getDate()}function U(t,a){return new Date(t.getFullYear(),t.getMonth()+a,1)}function K(t){return new Date(t.getFullYear(),t.getMonth(),1)}function pe(t,a){return O(t).getTime()<O(a).getTime()}function ye(t,a){return O(t).getTime()>O(a).getTime()}function _(t,a,s){return!!(a&&pe(t,a)||s&&ye(t,s))}function ke(t){return new Intl.DateTimeFormat("pt-BR",{year:"numeric",month:"2-digit",day:"2-digit"}).format(t)}const we=20,je=18,Ne=8,Ce=8,Ye=290,Te=330;function Oe(t,a){const s=window.innerHeight-t.bottom<a,d=window.innerWidth,g=window.matchMedia("(max-width: 639px)").matches?Math.min(512,d-16):Math.min(320,d),C=Ce,c=d-g-Ce;let p=t.left;return p<C?p=C:p>c&&(p=c),T(S({position:"fixed"},s?{bottom:window.innerHeight-t.top+Ne}:{top:t.bottom+Ne}),{left:p,width:g,maxWidth:360})}function De({open:t,estimatedHeight:a,triggerRef:s,rootRef:d}){const[g,C]=l.useState(null),c=l.useRef(null),p=l.useCallback(()=>{var z,A,F;const W=(F=(z=s.current)==null?void 0:z.getBoundingClientRect())!=null?F:(A=d.current)==null?void 0:A.getBoundingClientRect();W&&C(Oe(W,a))},[a,d,s]),v=l.useCallback(()=>{c.current===null&&(c.current=window.requestAnimationFrame(()=>{c.current=null,p()}))},[p]);return l.useEffect(()=>{if(!t){C(null);return}return window.addEventListener("scroll",v,{passive:!0,capture:!0}),window.addEventListener("resize",v),()=>{window.removeEventListener("scroll",v,{capture:!0}),window.removeEventListener("resize",v),c.current!==null&&(window.cancelAnimationFrame(c.current),c.current=null)}},[t,v]),{style:g,updatePosition:p}}function Ve(t){var a=t,{value:s,defaultValue:d=null,onValueChange:g,placeholder:C="Pick a date",disabled:c,min:p,max:v,format:z=ke,className:A,inputClassName:F,contentClassName:W,size:R="lg",yearRange:x=be,showYearSelector:X=!0,invalid:b=!1,children:Z}=a,ee=Q(a,["value","defaultValue","onValueChange","placeholder","disabled","min","max","format","className","inputClassName","contentClassName","size","yearRange","showYearSelector","invalid","children"]);const L=s!==void 0,[te,ae]=l.useState(d),n=L?s:te,[u,h]=l.useState(!1),[V,y]=l.useState(()=>K(J(n!=null?n:new Date,x))),M=l.useRef(null),I=l.useRef(null),q=l.useRef(null),H=l.useId(),{style:B,updatePosition:re}=De({open:u,estimatedHeight:Ye,triggerRef:I,rootRef:M}),D=l.useCallback(o=>{L||ae(o),g==null||g(o)},[L,g]);l.useEffect(()=>{u&&y(K(J(n!=null?n:new Date,x)))},[u,n,x]),l.useEffect(()=>{if(!u)return;const o=i=>{const m=M.current,j=q.current;m&&i.target instanceof Node&&!m.contains(i.target)&&!(j!=null&&j.contains(i.target))&&h(!1)},r=i=>{i.key==="Escape"&&h(!1)};return window.addEventListener("pointerdown",o,{capture:!0}),window.addEventListener("keydown",r),()=>{window.removeEventListener("pointerdown",o,{capture:!0}),window.removeEventListener("keydown",r)}},[u]);const ne=()=>{if(u){h(!1);return}re(),h(!0)},E=O(new Date),f=V.getFullYear(),k=V.getMonth(),se=new Date(f,k,1),oe=new Date(f,k+1,0).getDate(),ie=se.getDay(),Y=n?z(n):"",le=Array.from({length:12},(o,r)=>({value:r,label:new Intl.DateTimeFormat("pt-BR",{month:"long"}).format(new Date(2e3,r,1))})),de=Array.from({length:x.end-x.start+1},(o,r)=>x.start+r),ue=o=>{y(new Date(f,o,1))},ce=o=>{y(new Date(o,k,1))};return e.jsxs(me.Provider,{value:l.useMemo(()=>({invalid:b}),[b]),children:[e.jsxs("div",{ref:M,className:w.cn("relative inline-flex w-full",A),children:[e.jsxs("button",T(S(T(S({ref:I,type:"button",disabled:c,"aria-haspopup":"dialog","aria-expanded":u,"aria-controls":u?H:void 0,"data-invalid":b||void 0,"data-slot":"date-picker-trigger","data-size":R,"data-state":u?"open":"closed"},!Y&&{"data-placeholder":""}),{className:w.cn(ge({size:R}),u&&"border-gray-stroke-emphasis ring-[3px] ring-state-focus",Y&&!b&&"border-gray-stroke-emphasis ring-[3px] ring-state-focus",Y&&b&&"border-feedback-error-stroke ring-[3px] ring-state-error",F),onClick:ne}),ee),{children:[e.jsx("span",{className:"truncate",children:Y||C}),e.jsx(N.Calendar,{size:R==="md"?je:we,strokeWidth:1.6,className:"shrink-0 !text-gray-foreground","aria-hidden":"true"})]})),u&&xe.createPortal(e.jsxs("div",{ref:q,id:H,role:"dialog","aria-label":"Calend\xE1rio","data-slot":"date-picker-content",style:B!=null?B:void 0,className:w.cn("z-50 overflow-hidden rounded-md border border-gray-stroke-muted bg-surface-elevated p-3 shadow-md",W),children:[e.jsxs("div",{className:"mb-3 flex items-center justify-center gap-2",children:[e.jsx("button",{type:"button",className:"inline-flex size-8 items-center justify-center rounded-md hover:bg-secondary-background-soft-emphasis max-sm:size-10",onClick:()=>y(o=>U(o,-1)),"aria-label":"M\xEAs anterior",children:e.jsx(N.ChevronLeftMd,{size:18,strokeWidth:1.8})}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("div",{className:"relative",children:[e.jsx("select",{value:k,onChange:o=>ue(Number(o.target.value)),className:"min-w-[7rem] appearance-none rounded-md border border-gray-stroke-muted bg-surface-card py-1 pl-2 pr-7 text-sm font-medium capitalize text-gray-foreground outline-none hover:border-gray-stroke-emphasis focus:border-gray-stroke-emphasis focus:ring-2 focus:ring-state-focus max-sm:min-w-[8rem] max-sm:py-2 max-sm:text-base","aria-label":"Selecionar m\xEAs",children:le.map(o=>e.jsx("option",{value:o.value,className:"capitalize",children:o.label},o.value))}),e.jsx(N.ChevronDown,{size:14,strokeWidth:1.8,className:"pointer-events-none absolute right-2 top-1/2 -translate-y-1/2 text-gray-foreground","aria-hidden":!0})]}),X?e.jsxs("div",{className:"relative",children:[e.jsx("select",{value:f,onChange:o=>ce(Number(o.target.value)),className:"min-w-[5rem] appearance-none rounded-md border border-gray-stroke-muted bg-surface-card py-1 pl-2 pr-7 text-sm font-medium text-gray-foreground outline-none hover:border-gray-stroke-emphasis focus:border-gray-stroke-emphasis focus:ring-2 focus:ring-state-focus max-sm:min-w-[5.5rem] max-sm:py-2 max-sm:text-base","aria-label":"Selecionar ano",children:de.map(o=>e.jsx("option",{value:o,children:o},o))}),e.jsx(N.ChevronDown,{size:14,strokeWidth:1.8,className:"pointer-events-none absolute right-2 top-1/2 -translate-y-1/2 text-gray-foreground","aria-hidden":!0})]}):e.jsx("div",{className:"text-sm font-semibold text-gray-foreground",children:f})]}),e.jsx("button",{type:"button",className:"inline-flex size-8 items-center justify-center rounded-md hover:bg-secondary-background-soft-emphasis max-sm:size-10",onClick:()=>y(o=>U(o,1)),"aria-label":"Pr\xF3ximo m\xEAs",children:e.jsx(N.ChevronRightMd,{size:18,strokeWidth:1.8})})]}),e.jsxs("div",{className:"grid grid-cols-7 gap-1 text-center text-xs font-medium text-gray-foreground-muted max-sm:text-sm",children:[e.jsx("div",{children:"Dom"}),e.jsx("div",{children:"Seg"}),e.jsx("div",{children:"Ter"}),e.jsx("div",{children:"Qua"}),e.jsx("div",{children:"Qui"}),e.jsx("div",{children:"Sex"}),e.jsx("div",{children:"S\xE1b"})]}),e.jsxs("div",{className:"mt-2 grid grid-cols-7 gap-1",children:[Array.from({length:ie}).map((o,r)=>e.jsx("div",{},`empty-${r}`)),Array.from({length:oe}).map((o,r)=>{const i=new Date(f,k,r+1),m=n?$(i,n):!1,j=$(i,E),P=c||_(i,p,v);return e.jsx("button",{type:"button",disabled:P,onClick:()=>{D(i),h(!1)},className:w.cn("inline-flex h-9 w-full items-center justify-center rounded-md text-sm font-medium outline-none transition-colors hover:bg-secondary-background-soft-emphasis disabled:pointer-events-none disabled:opacity-50 max-sm:h-11 max-sm:text-base",j&&"ring-1 ring-gray-stroke-emphasis",m&&"bg-primary-background-fill text-primary-foreground-onfill hover:bg-primary-background-fill-emphasis"),"aria-pressed":m,children:r+1},i.toISOString())})]}),e.jsxs("div",{className:"mt-3 flex items-center justify-between gap-2",children:[e.jsx("button",{type:"button",className:"rounded-md px-2 py-1 text-xs font-medium text-gray-foreground hover:bg-secondary-background-soft-emphasis max-sm:px-3 max-sm:py-2 max-sm:text-sm",onClick:()=>{D(E),h(!1)},disabled:c||_(E,p,v),children:"Hoje"}),e.jsx("button",{type:"button",className:"rounded-md px-2 py-1 text-xs font-medium text-gray-foreground hover:bg-secondary-background-soft-emphasis max-sm:px-3 max-sm:py-2 max-sm:text-sm",onClick:()=>D(null),disabled:c||!n,children:"Limpar"})]})]}),document.body)]}),Z]})}function Ie(t){var a=t,{value:s,defaultValue:d=null,onValueChange:g,placeholder:C="Selecionar per\xEDodo",disabled:c,min:p,max:v,format:z=ke,className:A,inputClassName:F,contentClassName:W,size:R="lg",yearRange:x=be,showYearSelector:X=!0,invalid:b=!1,children:Z}=a,ee=Q(a,["value","defaultValue","onValueChange","placeholder","disabled","min","max","format","className","inputClassName","contentClassName","size","yearRange","showYearSelector","invalid","children"]);const L=s!==void 0,[te,ae]=l.useState(d),n=L?s:te,[u,h]=l.useState(!1),[V,y]=l.useState(()=>{var r,i;return K(J((i=(r=n==null?void 0:n.start)!=null?r:n==null?void 0:n.end)!=null?i:new Date,x))}),M=l.useRef(null),I=l.useRef(null),q=l.useRef(null),H=l.useId(),{style:B,updatePosition:re}=De({open:u,estimatedHeight:Te,triggerRef:I,rootRef:M}),D=l.useCallback(r=>{L||ae(r),g==null||g(r)},[L,g]);l.useEffect(()=>{var r,i;u&&y(K(J((i=(r=n==null?void 0:n.start)!=null?r:n==null?void 0:n.end)!=null?i:new Date,x)))},[u,n,x]),l.useEffect(()=>{if(!u)return;const r=m=>{const j=M.current,P=q.current;j&&m.target instanceof Node&&!j.contains(m.target)&&!(P!=null&&P.contains(m.target))&&h(!1)},i=m=>{m.key==="Escape"&&h(!1)};return window.addEventListener("pointerdown",r,{capture:!0}),window.addEventListener("keydown",i),()=>{window.removeEventListener("pointerdown",r,{capture:!0}),window.removeEventListener("keydown",i)}},[u]);const ne=()=>{if(u){h(!1);return}re(),h(!0)},E=O(new Date),f=V.getFullYear(),k=V.getMonth(),se=new Date(f,k,1),oe=new Date(f,k+1,0).getDate(),ie=se.getDay(),Y=Array.from({length:12},(r,i)=>({value:i,label:new Intl.DateTimeFormat("pt-BR",{month:"long"}).format(new Date(2e3,i,1))})),le=Array.from({length:x.end-x.start+1},(r,i)=>x.start+i),de=r=>{y(new Date(f,r,1))},ue=r=>{y(new Date(r,k,1))},ce=r=>{c||_(r,p,v)||(!n||!n.start||n.end?D({start:r,end:null}):(pe(r,n.start)?D({start:r,end:n.start}):D({start:n.start,end:r}),h(!1)))},o=n!=null&&n.start&&n!=null&&n.end?`${z(n.start)} - ${z(n.end)}`:n!=null&&n.start?z(n.start):"";return e.jsxs(me.Provider,{value:l.useMemo(()=>({invalid:b}),[b]),children:[e.jsxs("div",{ref:M,className:w.cn("relative inline-flex w-full",A),children:[e.jsxs("button",T(S(T(S({ref:I,type:"button",disabled:c,"aria-haspopup":"dialog","aria-expanded":u,"aria-controls":u?H:void 0,"data-invalid":b||void 0,"data-slot":"date-picker-trigger","data-size":R,"data-state":u?"open":"closed"},!o&&{"data-placeholder":""}),{className:w.cn(ge({size:R}),u&&"border-gray-stroke-emphasis ring-[3px] ring-state-focus",o&&!b&&"border-gray-stroke-emphasis ring-[3px] ring-state-focus",o&&b&&"border-feedback-error-stroke ring-[3px] ring-state-error",F),onClick:ne}),ee),{children:[e.jsx("span",{className:"truncate",children:o||C}),e.jsx(N.Calendar,{size:R==="md"?je:we,strokeWidth:1.6,className:"shrink-0 !text-gray-foreground","aria-hidden":"true"})]})),u&&xe.createPortal(e.jsxs("div",{ref:q,id:H,role:"dialog","aria-label":"Calend\xE1rio","data-slot":"date-picker-content",style:B!=null?B:void 0,className:w.cn("z-50 overflow-hidden rounded-md border border-gray-stroke-muted bg-surface-elevated p-3 shadow-md",W),children:[e.jsxs("div",{className:"mb-3 flex items-center justify-center gap-2",children:[e.jsx("button",{type:"button",className:"inline-flex size-8 items-center justify-center rounded-md hover:bg-secondary-background-soft-emphasis max-sm:size-10",onClick:()=>y(r=>U(r,-1)),"aria-label":"M\xEAs anterior",children:e.jsx(N.ChevronLeftMd,{size:18,strokeWidth:1.8})}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("div",{className:"relative",children:[e.jsx("select",{value:k,onChange:r=>de(Number(r.target.value)),className:"min-w-[7rem] appearance-none rounded-md border border-gray-stroke-muted bg-surface-card py-1 pl-2 pr-7 text-sm font-medium capitalize text-gray-foreground outline-none hover:border-gray-stroke-emphasis focus:border-gray-stroke-emphasis focus:ring-2 focus:ring-state-focus max-sm:min-w-[8rem] max-sm:py-2 max-sm:text-base","aria-label":"Selecionar m\xEAs",children:Y.map(r=>e.jsx("option",{value:r.value,className:"capitalize",children:r.label},r.value))}),e.jsx(N.ChevronDown,{size:14,strokeWidth:1.8,className:"pointer-events-none absolute right-2 top-1/2 -translate-y-1/2 text-gray-foreground","aria-hidden":!0})]}),X?e.jsxs("div",{className:"relative",children:[e.jsx("select",{value:f,onChange:r=>ue(Number(r.target.value)),className:"min-w-[5rem] appearance-none rounded-md border border-gray-stroke-muted bg-surface-card py-1 pl-2 pr-7 text-sm font-medium text-gray-foreground outline-none hover:border-gray-stroke-emphasis focus:border-gray-stroke-emphasis focus:ring-2 focus:ring-state-focus max-sm:min-w-[5.5rem] max-sm:py-2 max-sm:text-base","aria-label":"Selecionar ano",children:le.map(r=>e.jsx("option",{value:r,children:r},r))}),e.jsx(N.ChevronDown,{size:14,strokeWidth:1.8,className:"pointer-events-none absolute right-2 top-1/2 -translate-y-1/2 text-gray-foreground","aria-hidden":!0})]}):e.jsx("div",{className:"text-sm font-semibold text-gray-foreground",children:f})]}),e.jsx("button",{type:"button",className:"inline-flex size-8 items-center justify-center rounded-md hover:bg-secondary-background-soft-emphasis max-sm:size-10",onClick:()=>y(r=>U(r,1)),"aria-label":"Pr\xF3ximo m\xEAs",children:e.jsx(N.ChevronRightMd,{size:18,strokeWidth:1.8})})]}),e.jsxs("div",{className:"grid grid-cols-7 gap-1 text-center text-xs font-medium text-gray-foreground-muted max-sm:text-sm",children:[e.jsx("div",{children:"Dom"}),e.jsx("div",{children:"Seg"}),e.jsx("div",{children:"Ter"}),e.jsx("div",{children:"Qua"}),e.jsx("div",{children:"Qui"}),e.jsx("div",{children:"Sex"}),e.jsx("div",{children:"S\xE1b"})]}),e.jsxs("div",{className:"mt-2 grid grid-cols-7 gap-1",children:[Array.from({length:ie}).map((r,i)=>e.jsx("div",{},`empty-${i}`)),Array.from({length:oe}).map((r,i)=>{const m=new Date(f,k,i+1),j=(n==null?void 0:n.start)&&$(m,n.start),P=(n==null?void 0:n.end)&&$(m,n.end),ze=(n==null?void 0:n.start)&&(n==null?void 0:n.end)&&ye(m,n.start)&&pe(m,n.end),Ee=$(m,E),Se=c||_(m,p,v);return e.jsx("button",{type:"button",disabled:Se,onClick:()=>ce(m),className:w.cn("inline-flex h-9 w-full items-center justify-center rounded-md text-sm font-medium outline-none transition-colors hover:bg-secondary-background-soft-emphasis disabled:pointer-events-none disabled:opacity-50",Ee&&"ring-1 ring-gray-stroke-emphasis",ze&&"bg-primary-background-soft",(j||P)&&"bg-primary-background-fill text-primary-foreground-onfill hover:bg-primary-background-fill-emphasis"),"aria-pressed":j||P||void 0,children:i+1},m.toISOString())})]}),e.jsxs("div",{className:"mt-3 flex items-center justify-between gap-2",children:[e.jsx("button",{type:"button",className:"rounded-md px-2 py-1 text-xs font-medium text-gray-foreground hover:bg-secondary-background-soft-emphasis",onClick:()=>{D({start:E,end:E}),h(!1)},disabled:c||_(E,p,v),children:"Hoje"}),e.jsx("button",{type:"button",className:"rounded-md px-2 py-1 text-xs font-medium text-gray-foreground hover:bg-secondary-background-soft-emphasis",onClick:()=>D(null),disabled:c||!n,children:"Limpar"})]})]}),document.body)]}),Z]})}exports.DatePicker=Ve,exports.DatePickerLabel=Fe,exports.DatePickerText=We,exports.DatePickerWrapper=Ae,exports.DateRangePicker=Ie,exports.datePickerTriggerVariants=ge;
|
|
3
|
+
"use strict";var e=require("react/jsx-runtime"),w=require("../lib/utils.js"),N=require("@medway-ui/icons"),Le=require("class-variance-authority"),d=require("react"),be=require("react-dom"),ve=require("../hooks/use-id.js"),Oe=Object.defineProperty,We=Object.defineProperties,Ye=Object.getOwnPropertyDescriptors,J=Object.getOwnPropertySymbols,ye=Object.prototype.hasOwnProperty,ke=Object.prototype.propertyIsEnumerable,we=(t,a,s)=>a in t?Oe(t,a,{enumerable:!0,configurable:!0,writable:!0,value:s}):t[a]=s,R=(t,a)=>{for(var s in a||(a={}))ye.call(a,s)&&we(t,s,a[s]);if(J)for(var s of J(a))ke.call(a,s)&&we(t,s,a[s]);return t},Y=(t,a)=>We(t,Ye(a)),G=(t,a)=>{var s={};for(var i in t)ye.call(t,i)&&a.indexOf(i)<0&&(s[i]=t[i]);if(t!=null&&J)for(var i of J(t))a.indexOf(i)<0&&ke.call(t,i)&&(s[i]=t[i]);return s};const fe=d.createContext({invalid:!1}),je={start:1950,end:new Date().getFullYear()};function X(t,a){const s=t.getFullYear();return s<a.start?new Date(a.start,0,1):s>a.end?new Date(a.end,11,31):t}const xe=Le.cva(["flex w-full min-w-0 items-center justify-between gap-2 rounded-md border-2 border-gray-stroke-muted bg-surface-card px-4 py-3 text-left text-gray-foreground outline-none transition-[color,box-shadow] enabled:hover:border-gray-stroke-emphasis enabled:hover:ring-[3px] enabled:hover:ring-state-focus focus-visible:border-gray-stroke-emphasis focus-visible:ring-[3px] focus-visible:ring-state-focus data-[invalid]:focus-visible:border-feedback-error-stroke data-[invalid]:focus-visible:ring-state-error disabled:pointer-events-none disabled:bg-gray-background-soft-muted disabled:text-gray-foreground-muted data-[invalid]:border-feedback-error-stroke data-[invalid]:enabled:hover:border-feedback-error-stroke data-[invalid]:enabled:hover:ring-[3px] data-[invalid]:enabled:hover:ring-state-error","group-has-[[data-slot=date-picker-label]]:data-[placeholder]:text-transparent"],{variants:{size:{lg:["h-12 max-h-12 text-md","max-sm:h-14 max-sm:text-base"],md:["h-10 max-h-10 text-sm","max-sm:h-11"]}},defaultVariants:{size:"lg"}});function Ve(t){var a=t,{className:s}=a,i=G(a,["className"]);return e.jsx("div",R({className:w.cn("group relative flex flex-col gap-2",s),"data-slot":"date-picker-wrapper"},i))}function qe(t){var a=t,{className:s,children:i}=a,f=G(a,["className","children"]);return e.jsx("label",Y(R({className:w.cn("pointer-events-none absolute start-3 top-0 z-10 max-w-[calc(100%-1.5rem)] origin-left -translate-y-1/2 truncate bg-surface-card px-1 text-xs font-medium text-gray-foreground transition-all duration-200 ease-out","group-has-[[data-slot=date-picker-trigger][data-placeholder]:not([data-state=open])]:start-4 group-has-[[data-slot=date-picker-trigger][data-placeholder]:not([data-state=open])]:top-6 group-has-[[data-slot=date-picker-trigger][data-placeholder]:not([data-state=open])]:max-w-[calc(100%-4rem)] group-has-[[data-slot=date-picker-trigger][data-placeholder]:not([data-state=open])]:bg-transparent group-has-[[data-slot=date-picker-trigger][data-placeholder]:not([data-state=open])]:px-0 group-has-[[data-slot=date-picker-trigger][data-placeholder]:not([data-state=open])]:text-md group-has-[[data-slot=date-picker-trigger][data-placeholder]:not([data-state=open])]:font-normal group-has-[[data-slot=date-picker-trigger][data-placeholder]:not([data-state=open])]:text-gray-foreground max-sm:group-has-[[data-slot=date-picker-trigger][data-placeholder]:not([data-state=open])]:top-7","group-has-[[data-slot=date-picker-trigger][data-size=md]]:group-has-[[data-slot=date-picker-trigger][data-placeholder]:not([data-state=open])]:top-5 group-has-[[data-slot=date-picker-trigger][data-size=md]]:group-has-[[data-slot=date-picker-trigger][data-placeholder]:not([data-state=open])]:!text-sm max-sm:group-has-[[data-slot=date-picker-trigger][data-size=md]]:group-has-[[data-slot=date-picker-trigger][data-placeholder]:not([data-state=open])]:top-[22px]",s),"data-slot":"date-picker-label"},f),{children:i}))}function He(t){var a=t,{className:s}=a,i=G(a,["className"]);const{invalid:f}=d.useContext(fe);return e.jsx("span",R({className:w.cn("-mt-1 text-xs",f?"text-feedback-error-foreground":"text-gray-foreground",s),"data-slot":"date-picker-text"},i))}function V(t){return new Date(t.getFullYear(),t.getMonth(),t.getDate())}function K(t,a){return t.getFullYear()===a.getFullYear()&&t.getMonth()===a.getMonth()&&t.getDate()===a.getDate()}function _(t,a){return new Date(t.getFullYear(),t.getMonth()+a,1)}function q(t){return new Date(t.getFullYear(),t.getMonth(),1)}function he(t,a){return V(t).getTime()<V(a).getTime()}function Ne(t,a){return V(t).getTime()>V(a).getTime()}function Ce(t,a){const s=new Date(t.start,0,1);if(!a)return s;const i=q(a);return i>s?i:s}function De(t,a){const s=new Date(t.end,11,1);if(!a)return s;const i=q(a);return i<s?i:s}function Z(t,a,s){return!!(a&&he(t,a)||s&&Ne(t,s))}function ze(t){return new Intl.DateTimeFormat("pt-BR",{year:"numeric",month:"2-digit",day:"2-digit"}).format(t)}const Ee=20,Se=18,Re=8,Pe=8,Ie=290,Be=330;function $e(t,a){const s=window.innerHeight-t.bottom<a,i=window.innerWidth,f=window.matchMedia("(max-width: 639px)").matches?Math.min(512,i-16):Math.min(320,i),C=Pe,u=i-f-Pe;let g=t.left;return g<C?g=C:g>u&&(g=u),Y(R({position:"fixed"},s?{bottom:window.innerHeight-t.top+Re}:{top:t.bottom+Re}),{left:g,width:f,maxWidth:360})}function Me({open:t,estimatedHeight:a,triggerRef:s,rootRef:i}){const[f,C]=d.useState(null),u=d.useRef(null),g=d.useCallback(()=>{var E,F,L;const O=(L=(E=s.current)==null?void 0:E.getBoundingClientRect())!=null?L:(F=i.current)==null?void 0:F.getBoundingClientRect();O&&C($e(O,a))},[a,i,s]),x=d.useCallback(()=>{u.current===null&&(u.current=window.requestAnimationFrame(()=>{u.current=null,g()}))},[g]);return d.useEffect(()=>{if(!t){C(null);return}return window.addEventListener("scroll",x,{passive:!0,capture:!0}),window.addEventListener("resize",x),()=>{window.removeEventListener("scroll",x,{capture:!0}),window.removeEventListener("resize",x),u.current!==null&&(window.cancelAnimationFrame(u.current),u.current=null)}},[t,x]),{style:f,updatePosition:g}}function Qe(t){var a=t,{value:s,defaultValue:i=null,onValueChange:f,placeholder:C="Selecione uma data",disabled:u,min:g,max:x,format:E=ze,className:F,inputClassName:L,contentClassName:O,size:P="lg",yearRange:p=je,showYearSelector:U=!0,invalid:v=!1,children:ee,onClick:H}=a,te=G(a,["value","defaultValue","onValueChange","placeholder","disabled","min","max","format","className","inputClassName","contentClassName","size","yearRange","showYearSelector","invalid","children","onClick"]);const M=s!==void 0,[ae,re]=d.useState(i),n=M?s:ae,[c,h]=d.useState(!1),[D,y]=d.useState(()=>q(X(n!=null?n:new Date,p))),T=d.useRef(null),I=d.useRef(null),B=d.useRef(null),$=ve.useId(),{style:Q,updatePosition:ne}=Me({open:c,estimatedHeight:Ie,triggerRef:I,rootRef:T}),z=d.useCallback(o=>{M||re(o),f==null||f(o)},[M,f]);d.useEffect(()=>{c&&y(q(X(n!=null?n:new Date,p)))},[c,n,p]),d.useEffect(()=>{if(!c)return;const o=l=>{const m=T.current,j=B.current;m&&l.target instanceof Node&&!m.contains(l.target)&&!(j!=null&&j.contains(l.target))&&h(!1)},r=l=>{l.key==="Escape"&&h(!1)};return window.addEventListener("pointerdown",o,{capture:!0}),window.addEventListener("keydown",r),()=>{window.removeEventListener("pointerdown",o,{capture:!0}),window.removeEventListener("keydown",r)}},[c]);const se=o=>{if(H==null||H(o),!o.defaultPrevented){if(c){h(!1);return}ne(),h(!0)}},S=V(new Date),b=D.getFullYear(),k=D.getMonth(),oe=new Date(b,k,1),ie=new Date(b,k+1,0).getDate(),le=oe.getDay(),W=n?E(n):"",de=Array.from({length:12},(o,r)=>({value:r,label:new Intl.DateTimeFormat("pt-BR",{month:"long"}).format(new Date(2e3,r,1))})),ce=Array.from({length:p.end-p.start+1},(o,r)=>p.start+r),ue=D.getTime()<=Ce(p,g).getTime(),me=D.getTime()>=De(p,x).getTime(),ge=o=>{y(new Date(b,o,1))},pe=o=>{y(new Date(o,k,1))};return e.jsxs(fe.Provider,{value:d.useMemo(()=>({invalid:v}),[v]),children:[e.jsxs("div",{ref:T,className:w.cn("relative inline-flex w-full min-w-0",F),children:[e.jsxs("button",Y(R(Y(R({ref:I,type:"button",disabled:u,"aria-haspopup":"dialog","aria-expanded":c,"aria-controls":c?$:void 0,"data-invalid":v||void 0,"data-slot":"date-picker-trigger","data-size":P,"data-state":c?"open":"closed"},!W&&{"data-placeholder":""}),{className:w.cn(xe({size:P}),c&&"border-gray-stroke-emphasis ring-[3px] ring-state-focus",W&&!v&&"border-gray-stroke-emphasis ring-[3px] ring-state-focus",W&&v&&"border-feedback-error-stroke ring-[3px] ring-state-error",L)}),te),{onClick:se,children:[e.jsx("span",{className:"truncate",children:W||C}),e.jsx(N.Calendar,{size:P==="md"?Se:Ee,strokeWidth:1.6,className:"shrink-0 !text-gray-foreground","aria-hidden":"true"})]})),c&&be.createPortal(e.jsxs("div",{ref:B,id:$,role:"dialog","aria-label":"Calend\xE1rio","data-slot":"date-picker-content",style:Q!=null?Q:void 0,className:w.cn("z-50 overflow-hidden rounded-md border border-gray-stroke-muted bg-surface-elevated p-3 shadow-md",O),children:[e.jsxs("div",{className:"mb-3 flex items-center justify-center gap-2",children:[e.jsx("button",{type:"button",className:"inline-flex size-8 items-center justify-center rounded-md hover:bg-secondary-background-soft-emphasis disabled:pointer-events-none disabled:opacity-50 max-sm:size-10",onClick:()=>y(o=>_(o,-1)),disabled:ue,"aria-label":"M\xEAs anterior",children:e.jsx(N.ChevronLeftMd,{size:18,strokeWidth:1.8})}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("div",{className:"relative",children:[e.jsx("select",{value:k,onChange:o=>ge(Number(o.target.value)),className:"min-w-[7rem] appearance-none rounded-md border border-gray-stroke-muted bg-surface-card py-1 pl-2 pr-7 text-sm font-medium capitalize text-gray-foreground outline-none hover:border-gray-stroke-emphasis focus:border-gray-stroke-emphasis focus:ring-2 focus:ring-state-focus max-sm:min-w-[8rem] max-sm:py-2 max-sm:text-base","aria-label":"Selecionar m\xEAs",children:de.map(o=>e.jsx("option",{value:o.value,className:"capitalize",children:o.label},o.value))}),e.jsx(N.ChevronDown,{size:14,strokeWidth:1.8,className:"pointer-events-none absolute right-2 top-1/2 -translate-y-1/2 text-gray-foreground","aria-hidden":!0})]}),U?e.jsxs("div",{className:"relative",children:[e.jsx("select",{value:b,onChange:o=>pe(Number(o.target.value)),className:"min-w-[5rem] appearance-none rounded-md border border-gray-stroke-muted bg-surface-card py-1 pl-2 pr-7 text-sm font-medium text-gray-foreground outline-none hover:border-gray-stroke-emphasis focus:border-gray-stroke-emphasis focus:ring-2 focus:ring-state-focus max-sm:min-w-[5.5rem] max-sm:py-2 max-sm:text-base","aria-label":"Selecionar ano",children:ce.map(o=>e.jsx("option",{value:o,children:o},o))}),e.jsx(N.ChevronDown,{size:14,strokeWidth:1.8,className:"pointer-events-none absolute right-2 top-1/2 -translate-y-1/2 text-gray-foreground","aria-hidden":!0})]}):e.jsx("div",{className:"text-sm font-semibold text-gray-foreground",children:b})]}),e.jsx("button",{type:"button",className:"inline-flex size-8 items-center justify-center rounded-md hover:bg-secondary-background-soft-emphasis disabled:pointer-events-none disabled:opacity-50 max-sm:size-10",onClick:()=>y(o=>_(o,1)),disabled:me,"aria-label":"Pr\xF3ximo m\xEAs",children:e.jsx(N.ChevronRightMd,{size:18,strokeWidth:1.8})})]}),e.jsxs("div",{className:"grid grid-cols-7 gap-1 text-center text-xs font-medium text-gray-foreground-muted max-sm:text-sm",children:[e.jsx("div",{children:"Dom"}),e.jsx("div",{children:"Seg"}),e.jsx("div",{children:"Ter"}),e.jsx("div",{children:"Qua"}),e.jsx("div",{children:"Qui"}),e.jsx("div",{children:"Sex"}),e.jsx("div",{children:"S\xE1b"})]}),e.jsxs("div",{className:"mt-2 grid grid-cols-7 gap-1",children:[Array.from({length:le}).map((o,r)=>e.jsx("div",{},`empty-${r}`)),Array.from({length:ie}).map((o,r)=>{const l=new Date(b,k,r+1),m=n?K(l,n):!1,j=K(l,S),A=u||Z(l,g,x);return e.jsx("button",{type:"button",disabled:A,onClick:()=>{z(l),h(!1)},className:w.cn("inline-flex h-9 w-full items-center justify-center rounded-md text-sm font-medium outline-none transition-colors hover:bg-secondary-background-soft-emphasis focus-visible:ring-2 focus-visible:ring-state-focus disabled:pointer-events-none disabled:opacity-50 max-sm:h-11 max-sm:text-base",j&&"ring-1 ring-gray-stroke-emphasis",m&&"bg-primary-background-fill text-primary-foreground-onfill hover:bg-primary-background-fill-emphasis"),"aria-pressed":m,children:r+1},l.toISOString())})]}),e.jsxs("div",{className:"mt-3 flex items-center justify-between gap-2",children:[e.jsx("button",{type:"button",className:"rounded-md px-2 py-1 text-xs font-medium text-gray-foreground hover:bg-secondary-background-soft-emphasis max-sm:px-3 max-sm:py-2 max-sm:text-sm",onClick:()=>{z(S),h(!1)},disabled:u||Z(S,g,x),children:"Hoje"}),e.jsx("button",{type:"button",className:"rounded-md px-2 py-1 text-xs font-medium text-gray-foreground hover:bg-secondary-background-soft-emphasis max-sm:px-3 max-sm:py-2 max-sm:text-sm",onClick:()=>z(null),disabled:u||!n,children:"Limpar"})]})]}),document.body)]}),ee]})}function Ge(t){var a=t,{value:s,defaultValue:i=null,onValueChange:f,placeholder:C="Selecionar per\xEDodo",disabled:u,min:g,max:x,format:E=ze,className:F,inputClassName:L,contentClassName:O,size:P="lg",yearRange:p=je,showYearSelector:U=!0,invalid:v=!1,children:ee,onClick:H}=a,te=G(a,["value","defaultValue","onValueChange","placeholder","disabled","min","max","format","className","inputClassName","contentClassName","size","yearRange","showYearSelector","invalid","children","onClick"]);const M=s!==void 0,[ae,re]=d.useState(i),n=M?s:ae,[c,h]=d.useState(!1),[D,y]=d.useState(()=>{var r,l;return q(X((l=(r=n==null?void 0:n.start)!=null?r:n==null?void 0:n.end)!=null?l:new Date,p))}),T=d.useRef(null),I=d.useRef(null),B=d.useRef(null),$=ve.useId(),{style:Q,updatePosition:ne}=Me({open:c,estimatedHeight:Be,triggerRef:I,rootRef:T}),z=d.useCallback(r=>{M||re(r),f==null||f(r)},[M,f]);d.useEffect(()=>{var r,l;c&&y(q(X((l=(r=n==null?void 0:n.start)!=null?r:n==null?void 0:n.end)!=null?l:new Date,p)))},[c,n,p]),d.useEffect(()=>{if(!c)return;const r=m=>{const j=T.current,A=B.current;j&&m.target instanceof Node&&!j.contains(m.target)&&!(A!=null&&A.contains(m.target))&&h(!1)},l=m=>{m.key==="Escape"&&h(!1)};return window.addEventListener("pointerdown",r,{capture:!0}),window.addEventListener("keydown",l),()=>{window.removeEventListener("pointerdown",r,{capture:!0}),window.removeEventListener("keydown",l)}},[c]);const se=r=>{if(H==null||H(r),!r.defaultPrevented){if(c){h(!1);return}ne(),h(!0)}},S=V(new Date),b=D.getFullYear(),k=D.getMonth(),oe=new Date(b,k,1),ie=new Date(b,k+1,0).getDate(),le=oe.getDay(),W=Array.from({length:12},(r,l)=>({value:l,label:new Intl.DateTimeFormat("pt-BR",{month:"long"}).format(new Date(2e3,l,1))})),de=Array.from({length:p.end-p.start+1},(r,l)=>p.start+l),ce=D.getTime()<=Ce(p,g).getTime(),ue=D.getTime()>=De(p,x).getTime(),me=r=>{y(new Date(b,r,1))},ge=r=>{y(new Date(r,k,1))},pe=r=>{u||Z(r,g,x)||(!n||!n.start||n.end?z({start:r,end:null}):(he(r,n.start)?z({start:r,end:n.start}):z({start:n.start,end:r}),h(!1)))},o=n!=null&&n.start&&n!=null&&n.end?`${E(n.start)} - ${E(n.end)}`:n!=null&&n.start?E(n.start):"";return e.jsxs(fe.Provider,{value:d.useMemo(()=>({invalid:v}),[v]),children:[e.jsxs("div",{ref:T,className:w.cn("relative inline-flex w-full min-w-0",F),children:[e.jsxs("button",Y(R(Y(R({ref:I,type:"button",disabled:u,"aria-haspopup":"dialog","aria-expanded":c,"aria-controls":c?$:void 0,"data-invalid":v||void 0,"data-slot":"date-picker-trigger","data-size":P,"data-state":c?"open":"closed"},!o&&{"data-placeholder":""}),{className:w.cn(xe({size:P}),c&&"border-gray-stroke-emphasis ring-[3px] ring-state-focus",o&&!v&&"border-gray-stroke-emphasis ring-[3px] ring-state-focus",o&&v&&"border-feedback-error-stroke ring-[3px] ring-state-error",L)}),te),{onClick:se,children:[e.jsx("span",{className:"truncate",children:o||C}),e.jsx(N.Calendar,{size:P==="md"?Se:Ee,strokeWidth:1.6,className:"shrink-0 !text-gray-foreground","aria-hidden":"true"})]})),c&&be.createPortal(e.jsxs("div",{ref:B,id:$,role:"dialog","aria-label":"Calend\xE1rio","data-slot":"date-picker-content",style:Q!=null?Q:void 0,className:w.cn("z-50 overflow-hidden rounded-md border border-gray-stroke-muted bg-surface-elevated p-3 shadow-md",O),children:[e.jsxs("div",{className:"mb-3 flex items-center justify-center gap-2",children:[e.jsx("button",{type:"button",className:"inline-flex size-8 items-center justify-center rounded-md hover:bg-secondary-background-soft-emphasis disabled:pointer-events-none disabled:opacity-50 max-sm:size-10",onClick:()=>y(r=>_(r,-1)),disabled:ce,"aria-label":"M\xEAs anterior",children:e.jsx(N.ChevronLeftMd,{size:18,strokeWidth:1.8})}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("div",{className:"relative",children:[e.jsx("select",{value:k,onChange:r=>me(Number(r.target.value)),className:"min-w-[7rem] appearance-none rounded-md border border-gray-stroke-muted bg-surface-card py-1 pl-2 pr-7 text-sm font-medium capitalize text-gray-foreground outline-none hover:border-gray-stroke-emphasis focus:border-gray-stroke-emphasis focus:ring-2 focus:ring-state-focus max-sm:min-w-[8rem] max-sm:py-2 max-sm:text-base","aria-label":"Selecionar m\xEAs",children:W.map(r=>e.jsx("option",{value:r.value,className:"capitalize",children:r.label},r.value))}),e.jsx(N.ChevronDown,{size:14,strokeWidth:1.8,className:"pointer-events-none absolute right-2 top-1/2 -translate-y-1/2 text-gray-foreground","aria-hidden":!0})]}),U?e.jsxs("div",{className:"relative",children:[e.jsx("select",{value:b,onChange:r=>ge(Number(r.target.value)),className:"min-w-[5rem] appearance-none rounded-md border border-gray-stroke-muted bg-surface-card py-1 pl-2 pr-7 text-sm font-medium text-gray-foreground outline-none hover:border-gray-stroke-emphasis focus:border-gray-stroke-emphasis focus:ring-2 focus:ring-state-focus max-sm:min-w-[5.5rem] max-sm:py-2 max-sm:text-base","aria-label":"Selecionar ano",children:de.map(r=>e.jsx("option",{value:r,children:r},r))}),e.jsx(N.ChevronDown,{size:14,strokeWidth:1.8,className:"pointer-events-none absolute right-2 top-1/2 -translate-y-1/2 text-gray-foreground","aria-hidden":!0})]}):e.jsx("div",{className:"text-sm font-semibold text-gray-foreground",children:b})]}),e.jsx("button",{type:"button",className:"inline-flex size-8 items-center justify-center rounded-md hover:bg-secondary-background-soft-emphasis disabled:pointer-events-none disabled:opacity-50 max-sm:size-10",onClick:()=>y(r=>_(r,1)),disabled:ue,"aria-label":"Pr\xF3ximo m\xEAs",children:e.jsx(N.ChevronRightMd,{size:18,strokeWidth:1.8})})]}),e.jsxs("div",{className:"grid grid-cols-7 gap-1 text-center text-xs font-medium text-gray-foreground-muted max-sm:text-sm",children:[e.jsx("div",{children:"Dom"}),e.jsx("div",{children:"Seg"}),e.jsx("div",{children:"Ter"}),e.jsx("div",{children:"Qua"}),e.jsx("div",{children:"Qui"}),e.jsx("div",{children:"Sex"}),e.jsx("div",{children:"S\xE1b"})]}),e.jsxs("div",{className:"mt-2 grid grid-cols-7 gap-1",children:[Array.from({length:le}).map((r,l)=>e.jsx("div",{},`empty-${l}`)),Array.from({length:ie}).map((r,l)=>{const m=new Date(b,k,l+1),j=(n==null?void 0:n.start)&&K(m,n.start),A=(n==null?void 0:n.end)&&K(m,n.end),Te=(n==null?void 0:n.start)&&(n==null?void 0:n.end)&&Ne(m,n.start)&&he(m,n.end),Ae=K(m,S),Fe=u||Z(m,g,x);return e.jsx("button",{type:"button",disabled:Fe,onClick:()=>pe(m),className:w.cn("inline-flex h-9 w-full items-center justify-center rounded-md text-sm font-medium outline-none transition-colors hover:bg-secondary-background-soft-emphasis focus-visible:ring-2 focus-visible:ring-state-focus disabled:pointer-events-none disabled:opacity-50",Ae&&"ring-1 ring-gray-stroke-emphasis",Te&&"bg-primary-background-soft",(j||A)&&"bg-primary-background-fill text-primary-foreground-onfill hover:bg-primary-background-fill-emphasis"),"aria-pressed":j||A||void 0,children:l+1},m.toISOString())})]}),e.jsxs("div",{className:"mt-3 flex items-center justify-between gap-2",children:[e.jsx("button",{type:"button",className:"rounded-md px-2 py-1 text-xs font-medium text-gray-foreground hover:bg-secondary-background-soft-emphasis",onClick:()=>{z({start:S,end:S}),h(!1)},disabled:u||Z(S,g,x),children:"Hoje"}),e.jsx("button",{type:"button",className:"rounded-md px-2 py-1 text-xs font-medium text-gray-foreground hover:bg-secondary-background-soft-emphasis",onClick:()=>z(null),disabled:u||!n,children:"Limpar"})]})]}),document.body)]}),ee]})}exports.DatePicker=Qe,exports.DatePickerLabel=qe,exports.DatePickerText=He,exports.DatePickerWrapper=Ve,exports.DateRangePicker=Ge,exports.datePickerTriggerVariants=xe;
|
|
4
4
|
//# sourceMappingURL=DatePicker.js.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
"use client";
|
|
3
|
-
import{jsxs as c,jsx as r}from"react/jsx-runtime";import{cn as w}from"../lib/utils.mjs";import{Calendar as xe,ChevronLeftMd as ye,ChevronDown as U,ChevronRightMd as ke}from"@medway-ui/icons";import{cva as Oe}from"class-variance-authority";import{createContext as Ve,useState as A,useRef as F,useId as we,useCallback as K,useEffect as _,useMemo as Ne,useContext as Ie}from"react";import{createPortal as De}from"react-dom";var He=Object.defineProperty,Be=Object.defineProperties,Qe=Object.getOwnPropertyDescriptors,X=Object.getOwnPropertySymbols,ze=Object.prototype.hasOwnProperty,Ce=Object.prototype.propertyIsEnumerable,Ee=(e,t,o)=>t in e?He(e,t,{enumerable:!0,configurable:!0,writable:!0,value:o}):e[t]=o,j=(e,t)=>{for(var o in t||(t={}))ze.call(t,o)&&Ee(e,o,t[o]);if(X)for(var o of X(t))Ce.call(t,o)&&Ee(e,o,t[o]);return e},O=(e,t)=>Be(e,Qe(t)),G=(e,t)=>{var o={};for(var d in e)ze.call(e,d)&&t.indexOf(d)<0&&(o[d]=e[d]);if(e!=null&&X)for(var d of X(e))t.indexOf(d)<0&&Ce.call(e,d)&&(o[d]=e[d]);return o};const fe=Ve({invalid:!1}),je={start:1950,end:new Date().getFullYear()};function Z(e,t){const o=e.getFullYear();return o<t.start?new Date(t.start,0,1):o>t.end?new Date(t.end,11,31):e}const be=Oe(["shadow-xs flex w-full items-center justify-between gap-2 rounded-md border-2 border-gray-stroke-muted bg-surface-card px-4 py-3 text-left text-gray-foreground outline-none transition-[color,box-shadow] enabled:hover:border-gray-stroke-emphasis enabled:hover:ring-[3px] enabled:hover:ring-state-focus disabled:pointer-events-none disabled:bg-gray-background-soft-muted disabled:text-gray-foreground-muted data-[invalid]:border-feedback-error-stroke data-[invalid]:enabled:hover:border-feedback-error-stroke data-[invalid]:enabled:hover:ring-[3px] data-[invalid]:enabled:hover:ring-state-error","group-has-[[data-slot=date-picker-label]]:data-[placeholder]:text-transparent"],{variants:{size:{lg:["h-12 max-h-12 text-md","max-sm:h-14 max-sm:text-base"],md:["h-10 max-h-10 text-sm","max-sm:h-11"]}},defaultVariants:{size:"lg"}});function $e(e){var t=e,{className:o}=t,d=G(t,["className"]);return r("div",j({className:w("group relative flex flex-col gap-2",o),"data-slot":"date-picker-wrapper"},d))}function _e(e){var t=e,{className:o,children:d}=t,g=G(t,["className","children"]);return r("label",O(j({className:w("pointer-events-none absolute start-3 top-0 z-10 origin-left -translate-y-1/2 bg-surface-card px-1 text-xs font-medium text-gray-foreground transition-all duration-200 ease-out","group-has-[[data-slot=date-picker-trigger][data-placeholder]:not([data-state=open])]:start-4 group-has-[[data-slot=date-picker-trigger][data-placeholder]:not([data-state=open])]:top-6 group-has-[[data-slot=date-picker-trigger][data-placeholder]:not([data-state=open])]:bg-transparent group-has-[[data-slot=date-picker-trigger][data-placeholder]:not([data-state=open])]:px-0 group-has-[[data-slot=date-picker-trigger][data-placeholder]:not([data-state=open])]:text-md group-has-[[data-slot=date-picker-trigger][data-placeholder]:not([data-state=open])]:font-normal group-has-[[data-slot=date-picker-trigger][data-placeholder]:not([data-state=open])]:text-gray-foreground max-sm:group-has-[[data-slot=date-picker-trigger][data-placeholder]:not([data-state=open])]:top-7","group-has-[[data-slot=date-picker-trigger][data-size=md]]:group-has-[[data-slot=date-picker-trigger][data-placeholder]:not([data-state=open])]:top-5 group-has-[[data-slot=date-picker-trigger][data-size=md]]:group-has-[[data-slot=date-picker-trigger][data-placeholder]:not([data-state=open])]:!text-sm max-sm:group-has-[[data-slot=date-picker-trigger][data-size=md]]:group-has-[[data-slot=date-picker-trigger][data-placeholder]:not([data-state=open])]:top-[22px]",o),"data-slot":"date-picker-label"},g),{children:d}))}function Ge(e){var t=e,{className:o}=t,d=G(t,["className"]);const{invalid:g}=Ie(fe);return r("span",j({className:w("-mt-1 text-xs",g?"text-feedback-error-foreground":"text-gray-foreground",o),"data-slot":"date-picker-text"},d))}function V(e){return new Date(e.getFullYear(),e.getMonth(),e.getDate())}function q(e,t){return e.getFullYear()===t.getFullYear()&&e.getMonth()===t.getMonth()&&e.getDate()===t.getDate()}function ee(e,t){return new Date(e.getFullYear(),e.getMonth()+t,1)}function te(e){return new Date(e.getFullYear(),e.getMonth(),1)}function ve(e,t){return V(e).getTime()<V(t).getTime()}function Se(e,t){return V(e).getTime()>V(t).getTime()}function J(e,t,o){return!!(t&&ve(e,t)||o&&Se(e,o))}function Re(e){return new Intl.DateTimeFormat("pt-BR",{year:"numeric",month:"2-digit",day:"2-digit"}).format(e)}const Le=20,Pe=18,Ae=8,Fe=8,qe=290,Je=330;function Ue(e,t){const o=window.innerHeight-e.bottom<t,d=window.innerWidth,g=window.matchMedia("(max-width: 639px)").matches?Math.min(512,d-16):Math.min(320,d),D=Fe,u=d-g-Fe;let p=e.left;return p<D?p=D:p>u&&(p=u),O(j({position:"fixed"},o?{bottom:window.innerHeight-e.top+Ae}:{top:e.bottom+Ae}),{left:p,width:g,maxWidth:360})}function Me({open:e,estimatedHeight:t,triggerRef:o,rootRef:d}){const[g,D]=A(null),u=F(null),p=K(()=>{var C,M,W;const Y=(W=(C=o.current)==null?void 0:C.getBoundingClientRect())!=null?W:(M=d.current)==null?void 0:M.getBoundingClientRect();Y&&D(Ue(Y,t))},[t,d,o]),v=K(()=>{u.current===null&&(u.current=window.requestAnimationFrame(()=>{u.current=null,p()}))},[p]);return _(()=>{if(!e){D(null);return}return window.addEventListener("scroll",v,{passive:!0,capture:!0}),window.addEventListener("resize",v),()=>{window.removeEventListener("scroll",v,{capture:!0}),window.removeEventListener("resize",v),u.current!==null&&(window.cancelAnimationFrame(u.current),u.current=null)}},[e,v]),{style:g,updatePosition:p}}function Ke(e){var t=e,{value:o,defaultValue:d=null,onValueChange:g,placeholder:D="Pick a date",disabled:u,min:p,max:v,format:C=Re,className:M,inputClassName:W,contentClassName:Y,size:S="lg",yearRange:h=je,showYearSelector:ae=!0,invalid:x=!1,children:re}=t,ne=G(t,["value","defaultValue","onValueChange","placeholder","disabled","min","max","format","className","inputClassName","contentClassName","size","yearRange","showYearSelector","invalid","children"]);const R=o!==void 0,[oe,se]=A(d),n=R?o:oe,[l,f]=A(!1),[I,y]=A(()=>te(Z(n!=null?n:new Date,h))),L=F(null),H=F(null),B=F(null),Q=we(),{style:$,updatePosition:ie}=Me({open:l,estimatedHeight:qe,triggerRef:H,rootRef:L}),z=K(s=>{R||se(s),g==null||g(s)},[R,g]);_(()=>{l&&y(te(Z(n!=null?n:new Date,h)))},[l,n,h]),_(()=>{if(!l)return;const s=i=>{const m=L.current,N=B.current;m&&i.target instanceof Node&&!m.contains(i.target)&&!(N!=null&&N.contains(i.target))&&f(!1)},a=i=>{i.key==="Escape"&&f(!1)};return window.addEventListener("pointerdown",s,{capture:!0}),window.addEventListener("keydown",a),()=>{window.removeEventListener("pointerdown",s,{capture:!0}),window.removeEventListener("keydown",a)}},[l]);const de=()=>{if(l){f(!1);return}ie(),f(!0)},E=V(new Date),b=I.getFullYear(),k=I.getMonth(),le=new Date(b,k,1),ce=new Date(b,k+1,0).getDate(),ue=le.getDay(),T=n?C(n):"",me=Array.from({length:12},(s,a)=>({value:a,label:new Intl.DateTimeFormat("pt-BR",{month:"long"}).format(new Date(2e3,a,1))})),ge=Array.from({length:h.end-h.start+1},(s,a)=>h.start+a),pe=s=>{y(new Date(b,s,1))},he=s=>{y(new Date(s,k,1))};return c(fe.Provider,{value:Ne(()=>({invalid:x}),[x]),children:[c("div",{ref:L,className:w("relative inline-flex w-full",M),children:[c("button",O(j(O(j({ref:H,type:"button",disabled:u,"aria-haspopup":"dialog","aria-expanded":l,"aria-controls":l?Q:void 0,"data-invalid":x||void 0,"data-slot":"date-picker-trigger","data-size":S,"data-state":l?"open":"closed"},!T&&{"data-placeholder":""}),{className:w(be({size:S}),l&&"border-gray-stroke-emphasis ring-[3px] ring-state-focus",T&&!x&&"border-gray-stroke-emphasis ring-[3px] ring-state-focus",T&&x&&"border-feedback-error-stroke ring-[3px] ring-state-error",W),onClick:de}),ne),{children:[r("span",{className:"truncate",children:T||D}),r(xe,{size:S==="md"?Pe:Le,strokeWidth:1.6,className:"shrink-0 !text-gray-foreground","aria-hidden":"true"})]})),l&&De(c("div",{ref:B,id:Q,role:"dialog","aria-label":"Calend\xE1rio","data-slot":"date-picker-content",style:$!=null?$:void 0,className:w("z-50 overflow-hidden rounded-md border border-gray-stroke-muted bg-surface-elevated p-3 shadow-md",Y),children:[c("div",{className:"mb-3 flex items-center justify-center gap-2",children:[r("button",{type:"button",className:"inline-flex size-8 items-center justify-center rounded-md hover:bg-secondary-background-soft-emphasis max-sm:size-10",onClick:()=>y(s=>ee(s,-1)),"aria-label":"M\xEAs anterior",children:r(ye,{size:18,strokeWidth:1.8})}),c("div",{className:"flex items-center gap-2",children:[c("div",{className:"relative",children:[r("select",{value:k,onChange:s=>pe(Number(s.target.value)),className:"min-w-[7rem] appearance-none rounded-md border border-gray-stroke-muted bg-surface-card py-1 pl-2 pr-7 text-sm font-medium capitalize text-gray-foreground outline-none hover:border-gray-stroke-emphasis focus:border-gray-stroke-emphasis focus:ring-2 focus:ring-state-focus max-sm:min-w-[8rem] max-sm:py-2 max-sm:text-base","aria-label":"Selecionar m\xEAs",children:me.map(s=>r("option",{value:s.value,className:"capitalize",children:s.label},s.value))}),r(U,{size:14,strokeWidth:1.8,className:"pointer-events-none absolute right-2 top-1/2 -translate-y-1/2 text-gray-foreground","aria-hidden":!0})]}),ae?c("div",{className:"relative",children:[r("select",{value:b,onChange:s=>he(Number(s.target.value)),className:"min-w-[5rem] appearance-none rounded-md border border-gray-stroke-muted bg-surface-card py-1 pl-2 pr-7 text-sm font-medium text-gray-foreground outline-none hover:border-gray-stroke-emphasis focus:border-gray-stroke-emphasis focus:ring-2 focus:ring-state-focus max-sm:min-w-[5.5rem] max-sm:py-2 max-sm:text-base","aria-label":"Selecionar ano",children:ge.map(s=>r("option",{value:s,children:s},s))}),r(U,{size:14,strokeWidth:1.8,className:"pointer-events-none absolute right-2 top-1/2 -translate-y-1/2 text-gray-foreground","aria-hidden":!0})]}):r("div",{className:"text-sm font-semibold text-gray-foreground",children:b})]}),r("button",{type:"button",className:"inline-flex size-8 items-center justify-center rounded-md hover:bg-secondary-background-soft-emphasis max-sm:size-10",onClick:()=>y(s=>ee(s,1)),"aria-label":"Pr\xF3ximo m\xEAs",children:r(ke,{size:18,strokeWidth:1.8})})]}),c("div",{className:"grid grid-cols-7 gap-1 text-center text-xs font-medium text-gray-foreground-muted max-sm:text-sm",children:[r("div",{children:"Dom"}),r("div",{children:"Seg"}),r("div",{children:"Ter"}),r("div",{children:"Qua"}),r("div",{children:"Qui"}),r("div",{children:"Sex"}),r("div",{children:"S\xE1b"})]}),c("div",{className:"mt-2 grid grid-cols-7 gap-1",children:[Array.from({length:ue}).map((s,a)=>r("div",{},`empty-${a}`)),Array.from({length:ce}).map((s,a)=>{const i=new Date(b,k,a+1),m=n?q(i,n):!1,N=q(i,E),P=u||J(i,p,v);return r("button",{type:"button",disabled:P,onClick:()=>{z(i),f(!1)},className:w("inline-flex h-9 w-full items-center justify-center rounded-md text-sm font-medium outline-none transition-colors hover:bg-secondary-background-soft-emphasis disabled:pointer-events-none disabled:opacity-50 max-sm:h-11 max-sm:text-base",N&&"ring-1 ring-gray-stroke-emphasis",m&&"bg-primary-background-fill text-primary-foreground-onfill hover:bg-primary-background-fill-emphasis"),"aria-pressed":m,children:a+1},i.toISOString())})]}),c("div",{className:"mt-3 flex items-center justify-between gap-2",children:[r("button",{type:"button",className:"rounded-md px-2 py-1 text-xs font-medium text-gray-foreground hover:bg-secondary-background-soft-emphasis max-sm:px-3 max-sm:py-2 max-sm:text-sm",onClick:()=>{z(E),f(!1)},disabled:u||J(E,p,v),children:"Hoje"}),r("button",{type:"button",className:"rounded-md px-2 py-1 text-xs font-medium text-gray-foreground hover:bg-secondary-background-soft-emphasis max-sm:px-3 max-sm:py-2 max-sm:text-sm",onClick:()=>z(null),disabled:u||!n,children:"Limpar"})]})]}),document.body)]}),re]})}function Xe(e){var t=e,{value:o,defaultValue:d=null,onValueChange:g,placeholder:D="Selecionar per\xEDodo",disabled:u,min:p,max:v,format:C=Re,className:M,inputClassName:W,contentClassName:Y,size:S="lg",yearRange:h=je,showYearSelector:ae=!0,invalid:x=!1,children:re}=t,ne=G(t,["value","defaultValue","onValueChange","placeholder","disabled","min","max","format","className","inputClassName","contentClassName","size","yearRange","showYearSelector","invalid","children"]);const R=o!==void 0,[oe,se]=A(d),n=R?o:oe,[l,f]=A(!1),[I,y]=A(()=>{var a,i;return te(Z((i=(a=n==null?void 0:n.start)!=null?a:n==null?void 0:n.end)!=null?i:new Date,h))}),L=F(null),H=F(null),B=F(null),Q=we(),{style:$,updatePosition:ie}=Me({open:l,estimatedHeight:Je,triggerRef:H,rootRef:L}),z=K(a=>{R||se(a),g==null||g(a)},[R,g]);_(()=>{var a,i;l&&y(te(Z((i=(a=n==null?void 0:n.start)!=null?a:n==null?void 0:n.end)!=null?i:new Date,h)))},[l,n,h]),_(()=>{if(!l)return;const a=m=>{const N=L.current,P=B.current;N&&m.target instanceof Node&&!N.contains(m.target)&&!(P!=null&&P.contains(m.target))&&f(!1)},i=m=>{m.key==="Escape"&&f(!1)};return window.addEventListener("pointerdown",a,{capture:!0}),window.addEventListener("keydown",i),()=>{window.removeEventListener("pointerdown",a,{capture:!0}),window.removeEventListener("keydown",i)}},[l]);const de=()=>{if(l){f(!1);return}ie(),f(!0)},E=V(new Date),b=I.getFullYear(),k=I.getMonth(),le=new Date(b,k,1),ce=new Date(b,k+1,0).getDate(),ue=le.getDay(),T=Array.from({length:12},(a,i)=>({value:i,label:new Intl.DateTimeFormat("pt-BR",{month:"long"}).format(new Date(2e3,i,1))})),me=Array.from({length:h.end-h.start+1},(a,i)=>h.start+i),ge=a=>{y(new Date(b,a,1))},pe=a=>{y(new Date(a,k,1))},he=a=>{u||J(a,p,v)||(!n||!n.start||n.end?z({start:a,end:null}):(ve(a,n.start)?z({start:a,end:n.start}):z({start:n.start,end:a}),f(!1)))},s=n!=null&&n.start&&n!=null&&n.end?`${C(n.start)} - ${C(n.end)}`:n!=null&&n.start?C(n.start):"";return c(fe.Provider,{value:Ne(()=>({invalid:x}),[x]),children:[c("div",{ref:L,className:w("relative inline-flex w-full",M),children:[c("button",O(j(O(j({ref:H,type:"button",disabled:u,"aria-haspopup":"dialog","aria-expanded":l,"aria-controls":l?Q:void 0,"data-invalid":x||void 0,"data-slot":"date-picker-trigger","data-size":S,"data-state":l?"open":"closed"},!s&&{"data-placeholder":""}),{className:w(be({size:S}),l&&"border-gray-stroke-emphasis ring-[3px] ring-state-focus",s&&!x&&"border-gray-stroke-emphasis ring-[3px] ring-state-focus",s&&x&&"border-feedback-error-stroke ring-[3px] ring-state-error",W),onClick:de}),ne),{children:[r("span",{className:"truncate",children:s||D}),r(xe,{size:S==="md"?Pe:Le,strokeWidth:1.6,className:"shrink-0 !text-gray-foreground","aria-hidden":"true"})]})),l&&De(c("div",{ref:B,id:Q,role:"dialog","aria-label":"Calend\xE1rio","data-slot":"date-picker-content",style:$!=null?$:void 0,className:w("z-50 overflow-hidden rounded-md border border-gray-stroke-muted bg-surface-elevated p-3 shadow-md",Y),children:[c("div",{className:"mb-3 flex items-center justify-center gap-2",children:[r("button",{type:"button",className:"inline-flex size-8 items-center justify-center rounded-md hover:bg-secondary-background-soft-emphasis max-sm:size-10",onClick:()=>y(a=>ee(a,-1)),"aria-label":"M\xEAs anterior",children:r(ye,{size:18,strokeWidth:1.8})}),c("div",{className:"flex items-center gap-2",children:[c("div",{className:"relative",children:[r("select",{value:k,onChange:a=>ge(Number(a.target.value)),className:"min-w-[7rem] appearance-none rounded-md border border-gray-stroke-muted bg-surface-card py-1 pl-2 pr-7 text-sm font-medium capitalize text-gray-foreground outline-none hover:border-gray-stroke-emphasis focus:border-gray-stroke-emphasis focus:ring-2 focus:ring-state-focus max-sm:min-w-[8rem] max-sm:py-2 max-sm:text-base","aria-label":"Selecionar m\xEAs",children:T.map(a=>r("option",{value:a.value,className:"capitalize",children:a.label},a.value))}),r(U,{size:14,strokeWidth:1.8,className:"pointer-events-none absolute right-2 top-1/2 -translate-y-1/2 text-gray-foreground","aria-hidden":!0})]}),ae?c("div",{className:"relative",children:[r("select",{value:b,onChange:a=>pe(Number(a.target.value)),className:"min-w-[5rem] appearance-none rounded-md border border-gray-stroke-muted bg-surface-card py-1 pl-2 pr-7 text-sm font-medium text-gray-foreground outline-none hover:border-gray-stroke-emphasis focus:border-gray-stroke-emphasis focus:ring-2 focus:ring-state-focus max-sm:min-w-[5.5rem] max-sm:py-2 max-sm:text-base","aria-label":"Selecionar ano",children:me.map(a=>r("option",{value:a,children:a},a))}),r(U,{size:14,strokeWidth:1.8,className:"pointer-events-none absolute right-2 top-1/2 -translate-y-1/2 text-gray-foreground","aria-hidden":!0})]}):r("div",{className:"text-sm font-semibold text-gray-foreground",children:b})]}),r("button",{type:"button",className:"inline-flex size-8 items-center justify-center rounded-md hover:bg-secondary-background-soft-emphasis max-sm:size-10",onClick:()=>y(a=>ee(a,1)),"aria-label":"Pr\xF3ximo m\xEAs",children:r(ke,{size:18,strokeWidth:1.8})})]}),c("div",{className:"grid grid-cols-7 gap-1 text-center text-xs font-medium text-gray-foreground-muted max-sm:text-sm",children:[r("div",{children:"Dom"}),r("div",{children:"Seg"}),r("div",{children:"Ter"}),r("div",{children:"Qua"}),r("div",{children:"Qui"}),r("div",{children:"Sex"}),r("div",{children:"S\xE1b"})]}),c("div",{className:"mt-2 grid grid-cols-7 gap-1",children:[Array.from({length:ue}).map((a,i)=>r("div",{},`empty-${i}`)),Array.from({length:ce}).map((a,i)=>{const m=new Date(b,k,i+1),N=(n==null?void 0:n.start)&&q(m,n.start),P=(n==null?void 0:n.end)&&q(m,n.end),We=(n==null?void 0:n.start)&&(n==null?void 0:n.end)&&Se(m,n.start)&&ve(m,n.end),Ye=q(m,E),Te=u||J(m,p,v);return r("button",{type:"button",disabled:Te,onClick:()=>he(m),className:w("inline-flex h-9 w-full items-center justify-center rounded-md text-sm font-medium outline-none transition-colors hover:bg-secondary-background-soft-emphasis disabled:pointer-events-none disabled:opacity-50",Ye&&"ring-1 ring-gray-stroke-emphasis",We&&"bg-primary-background-soft",(N||P)&&"bg-primary-background-fill text-primary-foreground-onfill hover:bg-primary-background-fill-emphasis"),"aria-pressed":N||P||void 0,children:i+1},m.toISOString())})]}),c("div",{className:"mt-3 flex items-center justify-between gap-2",children:[r("button",{type:"button",className:"rounded-md px-2 py-1 text-xs font-medium text-gray-foreground hover:bg-secondary-background-soft-emphasis",onClick:()=>{z({start:E,end:E}),f(!1)},disabled:u||J(E,p,v),children:"Hoje"}),r("button",{type:"button",className:"rounded-md px-2 py-1 text-xs font-medium text-gray-foreground hover:bg-secondary-background-soft-emphasis",onClick:()=>z(null),disabled:u||!n,children:"Limpar"})]})]}),document.body)]}),re]})}export{Ke as DatePicker,_e as DatePickerLabel,Ge as DatePickerText,$e as DatePickerWrapper,Xe as DateRangePicker,be as datePickerTriggerVariants};
|
|
3
|
+
import{jsxs as c,jsx as r}from"react/jsx-runtime";import{cn as w}from"../lib/utils.mjs";import{Calendar as we,ChevronLeftMd as Ne,ChevronDown as _,ChevronRightMd as De}from"@medway-ui/icons";import{cva as Qe}from"class-variance-authority";import{createContext as $e,useState as A,useRef as M,useCallback as U,useEffect as K,useMemo as Ce,useContext as qe}from"react";import{createPortal as ze}from"react-dom";import{useId as Ee}from"../hooks/use-id.mjs";var Ge=Object.defineProperty,Ke=Object.defineProperties,Ze=Object.getOwnPropertyDescriptors,ee=Object.getOwnPropertySymbols,Pe=Object.prototype.hasOwnProperty,Se=Object.prototype.propertyIsEnumerable,je=(e,t,o)=>t in e?Ge(e,t,{enumerable:!0,configurable:!0,writable:!0,value:o}):e[t]=o,S=(e,t)=>{for(var o in t||(t={}))Pe.call(t,o)&&je(e,o,t[o]);if(ee)for(var o of ee(t))Se.call(t,o)&&je(e,o,t[o]);return e},V=(e,t)=>Ke(e,Ze(t)),Z=(e,t)=>{var o={};for(var s in e)Pe.call(e,s)&&t.indexOf(s)<0&&(o[s]=e[s]);if(e!=null&&ee)for(var s of ee(e))t.indexOf(s)<0&&Se.call(e,s)&&(o[s]=e[s]);return o};const xe=$e({invalid:!1}),Re={start:1950,end:new Date().getFullYear()};function te(e,t){const o=e.getFullYear();return o<t.start?new Date(t.start,0,1):o>t.end?new Date(t.end,11,31):e}const ye=Qe(["flex w-full min-w-0 items-center justify-between gap-2 rounded-md border-2 border-gray-stroke-muted bg-surface-card px-4 py-3 text-left text-gray-foreground outline-none transition-[color,box-shadow] enabled:hover:border-gray-stroke-emphasis enabled:hover:ring-[3px] enabled:hover:ring-state-focus focus-visible:border-gray-stroke-emphasis focus-visible:ring-[3px] focus-visible:ring-state-focus data-[invalid]:focus-visible:border-feedback-error-stroke data-[invalid]:focus-visible:ring-state-error disabled:pointer-events-none disabled:bg-gray-background-soft-muted disabled:text-gray-foreground-muted data-[invalid]:border-feedback-error-stroke data-[invalid]:enabled:hover:border-feedback-error-stroke data-[invalid]:enabled:hover:ring-[3px] data-[invalid]:enabled:hover:ring-state-error","group-has-[[data-slot=date-picker-label]]:data-[placeholder]:text-transparent"],{variants:{size:{lg:["h-12 max-h-12 text-md","max-sm:h-14 max-sm:text-base"],md:["h-10 max-h-10 text-sm","max-sm:h-11"]}},defaultVariants:{size:"lg"}});function Je(e){var t=e,{className:o}=t,s=Z(t,["className"]);return r("div",S({className:w("group relative flex flex-col gap-2",o),"data-slot":"date-picker-wrapper"},s))}function Xe(e){var t=e,{className:o,children:s}=t,f=Z(t,["className","children"]);return r("label",V(S({className:w("pointer-events-none absolute start-3 top-0 z-10 max-w-[calc(100%-1.5rem)] origin-left -translate-y-1/2 truncate bg-surface-card px-1 text-xs font-medium text-gray-foreground transition-all duration-200 ease-out","group-has-[[data-slot=date-picker-trigger][data-placeholder]:not([data-state=open])]:start-4 group-has-[[data-slot=date-picker-trigger][data-placeholder]:not([data-state=open])]:top-6 group-has-[[data-slot=date-picker-trigger][data-placeholder]:not([data-state=open])]:max-w-[calc(100%-4rem)] group-has-[[data-slot=date-picker-trigger][data-placeholder]:not([data-state=open])]:bg-transparent group-has-[[data-slot=date-picker-trigger][data-placeholder]:not([data-state=open])]:px-0 group-has-[[data-slot=date-picker-trigger][data-placeholder]:not([data-state=open])]:text-md group-has-[[data-slot=date-picker-trigger][data-placeholder]:not([data-state=open])]:font-normal group-has-[[data-slot=date-picker-trigger][data-placeholder]:not([data-state=open])]:text-gray-foreground max-sm:group-has-[[data-slot=date-picker-trigger][data-placeholder]:not([data-state=open])]:top-7","group-has-[[data-slot=date-picker-trigger][data-size=md]]:group-has-[[data-slot=date-picker-trigger][data-placeholder]:not([data-state=open])]:top-5 group-has-[[data-slot=date-picker-trigger][data-size=md]]:group-has-[[data-slot=date-picker-trigger][data-placeholder]:not([data-state=open])]:!text-sm max-sm:group-has-[[data-slot=date-picker-trigger][data-size=md]]:group-has-[[data-slot=date-picker-trigger][data-placeholder]:not([data-state=open])]:top-[22px]",o),"data-slot":"date-picker-label"},f),{children:s}))}function _e(e){var t=e,{className:o}=t,s=Z(t,["className"]);const{invalid:f}=qe(xe);return r("span",S({className:w("-mt-1 text-xs",f?"text-feedback-error-foreground":"text-gray-foreground",o),"data-slot":"date-picker-text"},s))}function H(e){return new Date(e.getFullYear(),e.getMonth(),e.getDate())}function J(e,t){return e.getFullYear()===t.getFullYear()&&e.getMonth()===t.getMonth()&&e.getDate()===t.getDate()}function ae(e,t){return new Date(e.getFullYear(),e.getMonth()+t,1)}function I(e){return new Date(e.getFullYear(),e.getMonth(),1)}function ke(e,t){return H(e).getTime()<H(t).getTime()}function Te(e,t){return H(e).getTime()>H(t).getTime()}function Fe(e,t){const o=new Date(e.start,0,1);if(!t)return o;const s=I(t);return s>o?s:o}function Ae(e,t){const o=new Date(e.end,11,1);if(!t)return o;const s=I(t);return s<o?s:o}function X(e,t,o){return!!(t&&ke(e,t)||o&&Te(e,o))}function Me(e){return new Intl.DateTimeFormat("pt-BR",{year:"numeric",month:"2-digit",day:"2-digit"}).format(e)}const Le=20,Oe=18,We=8,Ye=8,Ue=290,et=330;function tt(e,t){const o=window.innerHeight-e.bottom<t,s=window.innerWidth,f=window.matchMedia("(max-width: 639px)").matches?Math.min(512,s-16):Math.min(320,s),D=Ye,u=s-f-Ye;let g=e.left;return g<D?g=D:g>u&&(g=u),V(S({position:"fixed"},o?{bottom:window.innerHeight-e.top+We}:{top:e.bottom+We}),{left:g,width:f,maxWidth:360})}function Ve({open:e,estimatedHeight:t,triggerRef:o,rootRef:s}){const[f,D]=A(null),u=M(null),g=U(()=>{var E,L,O;const W=(O=(E=o.current)==null?void 0:E.getBoundingClientRect())!=null?O:(L=s.current)==null?void 0:L.getBoundingClientRect();W&&D(tt(W,t))},[t,s,o]),h=U(()=>{u.current===null&&(u.current=window.requestAnimationFrame(()=>{u.current=null,g()}))},[g]);return K(()=>{if(!e){D(null);return}return window.addEventListener("scroll",h,{passive:!0,capture:!0}),window.addEventListener("resize",h),()=>{window.removeEventListener("scroll",h,{capture:!0}),window.removeEventListener("resize",h),u.current!==null&&(window.cancelAnimationFrame(u.current),u.current=null)}},[e,h]),{style:f,updatePosition:g}}function at(e){var t=e,{value:o,defaultValue:s=null,onValueChange:f,placeholder:D="Selecione uma data",disabled:u,min:g,max:h,format:E=Me,className:L,inputClassName:O,contentClassName:W,size:j="lg",yearRange:p=Re,showYearSelector:re=!0,invalid:x=!1,children:ne,onClick:B}=t,oe=Z(t,["value","defaultValue","onValueChange","placeholder","disabled","min","max","format","className","inputClassName","contentClassName","size","yearRange","showYearSelector","invalid","children","onClick"]);const R=o!==void 0,[ie,se]=A(s),n=R?o:ie,[l,b]=A(!1),[C,y]=A(()=>I(te(n!=null?n:new Date,p))),T=M(null),Q=M(null),$=M(null),q=Ee(),{style:G,updatePosition:de}=Ve({open:l,estimatedHeight:Ue,triggerRef:Q,rootRef:T}),z=U(i=>{R||se(i),f==null||f(i)},[R,f]);K(()=>{l&&y(I(te(n!=null?n:new Date,p)))},[l,n,p]),K(()=>{if(!l)return;const i=d=>{const m=T.current,N=$.current;m&&d.target instanceof Node&&!m.contains(d.target)&&!(N!=null&&N.contains(d.target))&&b(!1)},a=d=>{d.key==="Escape"&&b(!1)};return window.addEventListener("pointerdown",i,{capture:!0}),window.addEventListener("keydown",a),()=>{window.removeEventListener("pointerdown",i,{capture:!0}),window.removeEventListener("keydown",a)}},[l]);const le=i=>{if(B==null||B(i),!i.defaultPrevented){if(l){b(!1);return}de(),b(!0)}},P=H(new Date),v=C.getFullYear(),k=C.getMonth(),ce=new Date(v,k,1),ue=new Date(v,k+1,0).getDate(),me=ce.getDay(),Y=n?E(n):"",ge=Array.from({length:12},(i,a)=>({value:a,label:new Intl.DateTimeFormat("pt-BR",{month:"long"}).format(new Date(2e3,a,1))})),pe=Array.from({length:p.end-p.start+1},(i,a)=>p.start+a),fe=C.getTime()<=Fe(p,g).getTime(),he=C.getTime()>=Ae(p,h).getTime(),be=i=>{y(new Date(v,i,1))},ve=i=>{y(new Date(i,k,1))};return c(xe.Provider,{value:Ce(()=>({invalid:x}),[x]),children:[c("div",{ref:T,className:w("relative inline-flex w-full min-w-0",L),children:[c("button",V(S(V(S({ref:Q,type:"button",disabled:u,"aria-haspopup":"dialog","aria-expanded":l,"aria-controls":l?q:void 0,"data-invalid":x||void 0,"data-slot":"date-picker-trigger","data-size":j,"data-state":l?"open":"closed"},!Y&&{"data-placeholder":""}),{className:w(ye({size:j}),l&&"border-gray-stroke-emphasis ring-[3px] ring-state-focus",Y&&!x&&"border-gray-stroke-emphasis ring-[3px] ring-state-focus",Y&&x&&"border-feedback-error-stroke ring-[3px] ring-state-error",O)}),oe),{onClick:le,children:[r("span",{className:"truncate",children:Y||D}),r(we,{size:j==="md"?Oe:Le,strokeWidth:1.6,className:"shrink-0 !text-gray-foreground","aria-hidden":"true"})]})),l&&ze(c("div",{ref:$,id:q,role:"dialog","aria-label":"Calend\xE1rio","data-slot":"date-picker-content",style:G!=null?G:void 0,className:w("z-50 overflow-hidden rounded-md border border-gray-stroke-muted bg-surface-elevated p-3 shadow-md",W),children:[c("div",{className:"mb-3 flex items-center justify-center gap-2",children:[r("button",{type:"button",className:"inline-flex size-8 items-center justify-center rounded-md hover:bg-secondary-background-soft-emphasis disabled:pointer-events-none disabled:opacity-50 max-sm:size-10",onClick:()=>y(i=>ae(i,-1)),disabled:fe,"aria-label":"M\xEAs anterior",children:r(Ne,{size:18,strokeWidth:1.8})}),c("div",{className:"flex items-center gap-2",children:[c("div",{className:"relative",children:[r("select",{value:k,onChange:i=>be(Number(i.target.value)),className:"min-w-[7rem] appearance-none rounded-md border border-gray-stroke-muted bg-surface-card py-1 pl-2 pr-7 text-sm font-medium capitalize text-gray-foreground outline-none hover:border-gray-stroke-emphasis focus:border-gray-stroke-emphasis focus:ring-2 focus:ring-state-focus max-sm:min-w-[8rem] max-sm:py-2 max-sm:text-base","aria-label":"Selecionar m\xEAs",children:ge.map(i=>r("option",{value:i.value,className:"capitalize",children:i.label},i.value))}),r(_,{size:14,strokeWidth:1.8,className:"pointer-events-none absolute right-2 top-1/2 -translate-y-1/2 text-gray-foreground","aria-hidden":!0})]}),re?c("div",{className:"relative",children:[r("select",{value:v,onChange:i=>ve(Number(i.target.value)),className:"min-w-[5rem] appearance-none rounded-md border border-gray-stroke-muted bg-surface-card py-1 pl-2 pr-7 text-sm font-medium text-gray-foreground outline-none hover:border-gray-stroke-emphasis focus:border-gray-stroke-emphasis focus:ring-2 focus:ring-state-focus max-sm:min-w-[5.5rem] max-sm:py-2 max-sm:text-base","aria-label":"Selecionar ano",children:pe.map(i=>r("option",{value:i,children:i},i))}),r(_,{size:14,strokeWidth:1.8,className:"pointer-events-none absolute right-2 top-1/2 -translate-y-1/2 text-gray-foreground","aria-hidden":!0})]}):r("div",{className:"text-sm font-semibold text-gray-foreground",children:v})]}),r("button",{type:"button",className:"inline-flex size-8 items-center justify-center rounded-md hover:bg-secondary-background-soft-emphasis disabled:pointer-events-none disabled:opacity-50 max-sm:size-10",onClick:()=>y(i=>ae(i,1)),disabled:he,"aria-label":"Pr\xF3ximo m\xEAs",children:r(De,{size:18,strokeWidth:1.8})})]}),c("div",{className:"grid grid-cols-7 gap-1 text-center text-xs font-medium text-gray-foreground-muted max-sm:text-sm",children:[r("div",{children:"Dom"}),r("div",{children:"Seg"}),r("div",{children:"Ter"}),r("div",{children:"Qua"}),r("div",{children:"Qui"}),r("div",{children:"Sex"}),r("div",{children:"S\xE1b"})]}),c("div",{className:"mt-2 grid grid-cols-7 gap-1",children:[Array.from({length:me}).map((i,a)=>r("div",{},`empty-${a}`)),Array.from({length:ue}).map((i,a)=>{const d=new Date(v,k,a+1),m=n?J(d,n):!1,N=J(d,P),F=u||X(d,g,h);return r("button",{type:"button",disabled:F,onClick:()=>{z(d),b(!1)},className:w("inline-flex h-9 w-full items-center justify-center rounded-md text-sm font-medium outline-none transition-colors hover:bg-secondary-background-soft-emphasis focus-visible:ring-2 focus-visible:ring-state-focus disabled:pointer-events-none disabled:opacity-50 max-sm:h-11 max-sm:text-base",N&&"ring-1 ring-gray-stroke-emphasis",m&&"bg-primary-background-fill text-primary-foreground-onfill hover:bg-primary-background-fill-emphasis"),"aria-pressed":m,children:a+1},d.toISOString())})]}),c("div",{className:"mt-3 flex items-center justify-between gap-2",children:[r("button",{type:"button",className:"rounded-md px-2 py-1 text-xs font-medium text-gray-foreground hover:bg-secondary-background-soft-emphasis max-sm:px-3 max-sm:py-2 max-sm:text-sm",onClick:()=>{z(P),b(!1)},disabled:u||X(P,g,h),children:"Hoje"}),r("button",{type:"button",className:"rounded-md px-2 py-1 text-xs font-medium text-gray-foreground hover:bg-secondary-background-soft-emphasis max-sm:px-3 max-sm:py-2 max-sm:text-sm",onClick:()=>z(null),disabled:u||!n,children:"Limpar"})]})]}),document.body)]}),ne]})}function rt(e){var t=e,{value:o,defaultValue:s=null,onValueChange:f,placeholder:D="Selecionar per\xEDodo",disabled:u,min:g,max:h,format:E=Me,className:L,inputClassName:O,contentClassName:W,size:j="lg",yearRange:p=Re,showYearSelector:re=!0,invalid:x=!1,children:ne,onClick:B}=t,oe=Z(t,["value","defaultValue","onValueChange","placeholder","disabled","min","max","format","className","inputClassName","contentClassName","size","yearRange","showYearSelector","invalid","children","onClick"]);const R=o!==void 0,[ie,se]=A(s),n=R?o:ie,[l,b]=A(!1),[C,y]=A(()=>{var a,d;return I(te((d=(a=n==null?void 0:n.start)!=null?a:n==null?void 0:n.end)!=null?d:new Date,p))}),T=M(null),Q=M(null),$=M(null),q=Ee(),{style:G,updatePosition:de}=Ve({open:l,estimatedHeight:et,triggerRef:Q,rootRef:T}),z=U(a=>{R||se(a),f==null||f(a)},[R,f]);K(()=>{var a,d;l&&y(I(te((d=(a=n==null?void 0:n.start)!=null?a:n==null?void 0:n.end)!=null?d:new Date,p)))},[l,n,p]),K(()=>{if(!l)return;const a=m=>{const N=T.current,F=$.current;N&&m.target instanceof Node&&!N.contains(m.target)&&!(F!=null&&F.contains(m.target))&&b(!1)},d=m=>{m.key==="Escape"&&b(!1)};return window.addEventListener("pointerdown",a,{capture:!0}),window.addEventListener("keydown",d),()=>{window.removeEventListener("pointerdown",a,{capture:!0}),window.removeEventListener("keydown",d)}},[l]);const le=a=>{if(B==null||B(a),!a.defaultPrevented){if(l){b(!1);return}de(),b(!0)}},P=H(new Date),v=C.getFullYear(),k=C.getMonth(),ce=new Date(v,k,1),ue=new Date(v,k+1,0).getDate(),me=ce.getDay(),Y=Array.from({length:12},(a,d)=>({value:d,label:new Intl.DateTimeFormat("pt-BR",{month:"long"}).format(new Date(2e3,d,1))})),ge=Array.from({length:p.end-p.start+1},(a,d)=>p.start+d),pe=C.getTime()<=Fe(p,g).getTime(),fe=C.getTime()>=Ae(p,h).getTime(),he=a=>{y(new Date(v,a,1))},be=a=>{y(new Date(a,k,1))},ve=a=>{u||X(a,g,h)||(!n||!n.start||n.end?z({start:a,end:null}):(ke(a,n.start)?z({start:a,end:n.start}):z({start:n.start,end:a}),b(!1)))},i=n!=null&&n.start&&n!=null&&n.end?`${E(n.start)} - ${E(n.end)}`:n!=null&&n.start?E(n.start):"";return c(xe.Provider,{value:Ce(()=>({invalid:x}),[x]),children:[c("div",{ref:T,className:w("relative inline-flex w-full min-w-0",L),children:[c("button",V(S(V(S({ref:Q,type:"button",disabled:u,"aria-haspopup":"dialog","aria-expanded":l,"aria-controls":l?q:void 0,"data-invalid":x||void 0,"data-slot":"date-picker-trigger","data-size":j,"data-state":l?"open":"closed"},!i&&{"data-placeholder":""}),{className:w(ye({size:j}),l&&"border-gray-stroke-emphasis ring-[3px] ring-state-focus",i&&!x&&"border-gray-stroke-emphasis ring-[3px] ring-state-focus",i&&x&&"border-feedback-error-stroke ring-[3px] ring-state-error",O)}),oe),{onClick:le,children:[r("span",{className:"truncate",children:i||D}),r(we,{size:j==="md"?Oe:Le,strokeWidth:1.6,className:"shrink-0 !text-gray-foreground","aria-hidden":"true"})]})),l&&ze(c("div",{ref:$,id:q,role:"dialog","aria-label":"Calend\xE1rio","data-slot":"date-picker-content",style:G!=null?G:void 0,className:w("z-50 overflow-hidden rounded-md border border-gray-stroke-muted bg-surface-elevated p-3 shadow-md",W),children:[c("div",{className:"mb-3 flex items-center justify-center gap-2",children:[r("button",{type:"button",className:"inline-flex size-8 items-center justify-center rounded-md hover:bg-secondary-background-soft-emphasis disabled:pointer-events-none disabled:opacity-50 max-sm:size-10",onClick:()=>y(a=>ae(a,-1)),disabled:pe,"aria-label":"M\xEAs anterior",children:r(Ne,{size:18,strokeWidth:1.8})}),c("div",{className:"flex items-center gap-2",children:[c("div",{className:"relative",children:[r("select",{value:k,onChange:a=>he(Number(a.target.value)),className:"min-w-[7rem] appearance-none rounded-md border border-gray-stroke-muted bg-surface-card py-1 pl-2 pr-7 text-sm font-medium capitalize text-gray-foreground outline-none hover:border-gray-stroke-emphasis focus:border-gray-stroke-emphasis focus:ring-2 focus:ring-state-focus max-sm:min-w-[8rem] max-sm:py-2 max-sm:text-base","aria-label":"Selecionar m\xEAs",children:Y.map(a=>r("option",{value:a.value,className:"capitalize",children:a.label},a.value))}),r(_,{size:14,strokeWidth:1.8,className:"pointer-events-none absolute right-2 top-1/2 -translate-y-1/2 text-gray-foreground","aria-hidden":!0})]}),re?c("div",{className:"relative",children:[r("select",{value:v,onChange:a=>be(Number(a.target.value)),className:"min-w-[5rem] appearance-none rounded-md border border-gray-stroke-muted bg-surface-card py-1 pl-2 pr-7 text-sm font-medium text-gray-foreground outline-none hover:border-gray-stroke-emphasis focus:border-gray-stroke-emphasis focus:ring-2 focus:ring-state-focus max-sm:min-w-[5.5rem] max-sm:py-2 max-sm:text-base","aria-label":"Selecionar ano",children:ge.map(a=>r("option",{value:a,children:a},a))}),r(_,{size:14,strokeWidth:1.8,className:"pointer-events-none absolute right-2 top-1/2 -translate-y-1/2 text-gray-foreground","aria-hidden":!0})]}):r("div",{className:"text-sm font-semibold text-gray-foreground",children:v})]}),r("button",{type:"button",className:"inline-flex size-8 items-center justify-center rounded-md hover:bg-secondary-background-soft-emphasis disabled:pointer-events-none disabled:opacity-50 max-sm:size-10",onClick:()=>y(a=>ae(a,1)),disabled:fe,"aria-label":"Pr\xF3ximo m\xEAs",children:r(De,{size:18,strokeWidth:1.8})})]}),c("div",{className:"grid grid-cols-7 gap-1 text-center text-xs font-medium text-gray-foreground-muted max-sm:text-sm",children:[r("div",{children:"Dom"}),r("div",{children:"Seg"}),r("div",{children:"Ter"}),r("div",{children:"Qua"}),r("div",{children:"Qui"}),r("div",{children:"Sex"}),r("div",{children:"S\xE1b"})]}),c("div",{className:"mt-2 grid grid-cols-7 gap-1",children:[Array.from({length:me}).map((a,d)=>r("div",{},`empty-${d}`)),Array.from({length:ue}).map((a,d)=>{const m=new Date(v,k,d+1),N=(n==null?void 0:n.start)&&J(m,n.start),F=(n==null?void 0:n.end)&&J(m,n.end),He=(n==null?void 0:n.start)&&(n==null?void 0:n.end)&&Te(m,n.start)&&ke(m,n.end),Ie=J(m,P),Be=u||X(m,g,h);return r("button",{type:"button",disabled:Be,onClick:()=>ve(m),className:w("inline-flex h-9 w-full items-center justify-center rounded-md text-sm font-medium outline-none transition-colors hover:bg-secondary-background-soft-emphasis focus-visible:ring-2 focus-visible:ring-state-focus disabled:pointer-events-none disabled:opacity-50",Ie&&"ring-1 ring-gray-stroke-emphasis",He&&"bg-primary-background-soft",(N||F)&&"bg-primary-background-fill text-primary-foreground-onfill hover:bg-primary-background-fill-emphasis"),"aria-pressed":N||F||void 0,children:d+1},m.toISOString())})]}),c("div",{className:"mt-3 flex items-center justify-between gap-2",children:[r("button",{type:"button",className:"rounded-md px-2 py-1 text-xs font-medium text-gray-foreground hover:bg-secondary-background-soft-emphasis",onClick:()=>{z({start:P,end:P}),b(!1)},disabled:u||X(P,g,h),children:"Hoje"}),r("button",{type:"button",className:"rounded-md px-2 py-1 text-xs font-medium text-gray-foreground hover:bg-secondary-background-soft-emphasis",onClick:()=>z(null),disabled:u||!n,children:"Limpar"})]})]}),document.body)]}),ne]})}export{at as DatePicker,Xe as DatePickerLabel,_e as DatePickerText,Je as DatePickerWrapper,rt as DateRangePicker,ye as datePickerTriggerVariants};
|
|
4
4
|
//# sourceMappingURL=DatePicker.mjs.map
|
|
@@ -1,15 +1,16 @@
|
|
|
1
1
|
import { Dialog as DialogPrimitive } from "radix-ui";
|
|
2
2
|
import { type ComponentProps, type ReactNode } from "react";
|
|
3
3
|
declare function Dialog({ ...props }: ComponentProps<typeof DialogPrimitive.Root>): import("react/jsx-runtime").JSX.Element;
|
|
4
|
-
declare
|
|
4
|
+
declare const DialogTrigger: import("react").ForwardRefExoticComponent<Omit<DialogPrimitive.DialogTriggerProps & import("react").RefAttributes<HTMLButtonElement>, "ref"> & import("react").RefAttributes<HTMLButtonElement>>;
|
|
5
5
|
declare function DialogPortal({ ...props }: ComponentProps<typeof DialogPrimitive.Portal>): import("react/jsx-runtime").JSX.Element;
|
|
6
|
-
declare
|
|
6
|
+
declare const DialogClose: import("react").ForwardRefExoticComponent<Omit<DialogPrimitive.DialogCloseProps & import("react").RefAttributes<HTMLButtonElement>, "ref"> & import("react").RefAttributes<HTMLButtonElement>>;
|
|
7
7
|
declare function DialogOverlay({ className, ...props }: ComponentProps<typeof DialogPrimitive.Overlay>): import("react/jsx-runtime").JSX.Element;
|
|
8
8
|
interface DialogContainerProps extends ComponentProps<typeof DialogPrimitive.Content> {
|
|
9
9
|
showCloseButton?: boolean;
|
|
10
10
|
overlayClassName?: string;
|
|
11
|
+
closeLabel?: string;
|
|
11
12
|
}
|
|
12
|
-
declare function DialogContainer({ className, overlayClassName, children, showCloseButton, ...props }: DialogContainerProps): import("react/jsx-runtime").JSX.Element;
|
|
13
|
+
declare function DialogContainer({ className, overlayClassName, children, showCloseButton, closeLabel, ...props }: DialogContainerProps): import("react/jsx-runtime").JSX.Element;
|
|
13
14
|
declare function DialogContent({ containerClassName, className, children, }: {
|
|
14
15
|
containerClassName?: string;
|
|
15
16
|
className?: string;
|