@refraktor/dates 0.0.4 → 0.0.5
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/build/style.css +2 -2
- package/package.json +33 -4
- package/.turbo/turbo-build.log +0 -4
- package/refraktor-dates-0.0.1-alpha.0.tgz +0 -0
- package/src/components/date-input/date-input.tsx +0 -379
- package/src/components/date-input/date-input.types.ts +0 -161
- package/src/components/date-input/index.ts +0 -13
- package/src/components/date-picker/date-picker.tsx +0 -649
- package/src/components/date-picker/date-picker.types.ts +0 -145
- package/src/components/date-picker/index.ts +0 -15
- package/src/components/dates-provider/context.ts +0 -18
- package/src/components/dates-provider/dates-provider.tsx +0 -136
- package/src/components/dates-provider/index.ts +0 -10
- package/src/components/dates-provider/types.ts +0 -33
- package/src/components/dates-provider/use-dates.ts +0 -5
- package/src/components/index.ts +0 -9
- package/src/components/month-input/index.ts +0 -13
- package/src/components/month-input/month-input.tsx +0 -366
- package/src/components/month-input/month-input.types.ts +0 -139
- package/src/components/month-picker/index.ts +0 -14
- package/src/components/month-picker/month-picker.tsx +0 -458
- package/src/components/month-picker/month-picker.types.ts +0 -117
- package/src/components/picker-shared/index.ts +0 -7
- package/src/components/picker-shared/picker-header.tsx +0 -178
- package/src/components/picker-shared/picker-header.types.ts +0 -49
- package/src/components/picker-shared/picker.styles.ts +0 -69
- package/src/components/picker-shared/picker.types.ts +0 -4
- package/src/components/time-input/index.ts +0 -6
- package/src/components/time-input/time-input.tsx +0 -48
- package/src/components/time-input/time-input.types.ts +0 -30
- package/src/components/time-picker/index.ts +0 -10
- package/src/components/time-picker/time-picker.tsx +0 -1088
- package/src/components/time-picker/time-picker.types.ts +0 -166
- package/src/components/year-input/index.ts +0 -13
- package/src/components/year-input/year-input.tsx +0 -350
- package/src/components/year-input/year-input.types.ts +0 -118
- package/src/components/year-picker/index.ts +0 -15
- package/src/components/year-picker/year-picker.tsx +0 -504
- package/src/components/year-picker/year-picker.types.ts +0 -108
- package/src/index.ts +0 -3
- package/src/style.css +0 -1
- package/tsconfig.json +0 -13
package/build/style.css
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
/*! tailwindcss v4.1
|
|
2
|
-
@layer properties{@supports (((-webkit-hyphens:none)) and (not (margin-trim:inline))) or ((-moz-orient:inline) and (not (color:rgb(from red r g b)))){*,:before,:after,::backdrop{--tw-divide-x-reverse:0;--tw-border-style:solid;--tw-leading:initial;--tw-font-weight:initial;--tw-shadow:0 0 #0000;--tw-shadow-color:initial;--tw-shadow-alpha:100%;--tw-inset-shadow:0 0 #0000;--tw-inset-shadow-color:initial;--tw-inset-shadow-alpha:100%;--tw-ring-color:initial;--tw-ring-shadow:0 0 #0000;--tw-inset-ring-color:initial;--tw-inset-ring-shadow:0 0 #0000;--tw-ring-inset:initial;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-offset-shadow:0 0 #0000;--tw-outline-style:solid}}}@layer theme{:root,:host{--font-sans:ui-sans-serif,system-ui,sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol","Noto Color Emoji";--font-mono:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono","Courier New",monospace;--spacing:.25rem;--text-xs:.75rem;--text-xs--line-height:calc(1/.75);--text-sm:.875rem;--text-sm--line-height:calc(1.25/.875);--text-base:1rem;--text-base--line-height:calc(1.5/1);--text-lg:1.125rem;--text-lg--line-height:calc(1.75/1.125);--font-weight-medium:500;--default-transition-duration:.15s;--default-transition-timing-function:cubic-bezier(.4,0,.2,1);--default-font-family:var(--font-sans);--default-mono-font-family:var(--font-mono)}}@layer base{*,:after,:before,::backdrop{box-sizing:border-box;border:0 solid;margin:0;padding:0}::file-selector-button{box-sizing:border-box;border:0 solid;margin:0;padding:0}html,:host{-webkit-text-size-adjust:100%;tab-size:4;line-height:1.5;font-family:var(--default-font-family,ui-sans-serif,system-ui,sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol","Noto Color Emoji");font-feature-settings:var(--default-font-feature-settings,normal);font-variation-settings:var(--default-font-variation-settings,normal);-webkit-tap-highlight-color:transparent}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;-webkit-text-decoration:inherit;-webkit-text-decoration:inherit;-webkit-text-decoration:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:var(--default-mono-font-family,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono","Courier New",monospace);font-feature-settings:var(--default-mono-font-feature-settings,normal);font-variation-settings:var(--default-mono-font-variation-settings,normal);font-size:1em}small{font-size:80%}sub,sup{vertical-align:baseline;font-size:75%;line-height:0;position:relative}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}:-moz-focusring{outline:auto}progress{vertical-align:baseline}summary{display:list-item}ol,ul,menu{list-style:none}img,svg,video,canvas,audio,iframe,embed,object{vertical-align:middle;display:block}img,video{max-width:100%;height:auto}button,input,select,optgroup,textarea{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}::file-selector-button{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}:where(select:is([multiple],[size])) optgroup{font-weight:bolder}:where(select:is([multiple],[size])) optgroup option{padding-inline-start:20px}::file-selector-button{margin-inline-end:4px}::placeholder{opacity:1}@supports (not ((-webkit-appearance:-apple-pay-button))) or (contain-intrinsic-size:1px){::placeholder{color:currentColor}@supports (color:color-mix(in lab, red, red)){::placeholder{color:color-mix(in oklab,currentcolor 50%,transparent)}}}textarea{resize:vertical}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-date-and-time-value{min-height:1lh;text-align:inherit}::-webkit-datetime-edit{display:inline-flex}::-webkit-datetime-edit-fields-wrapper{padding:0}::-webkit-datetime-edit{padding-block:0}::-webkit-datetime-edit-year-field{padding-block:0}::-webkit-datetime-edit-month-field{padding-block:0}::-webkit-datetime-edit-day-field{padding-block:0}::-webkit-datetime-edit-hour-field{padding-block:0}::-webkit-datetime-edit-minute-field{padding-block:0}::-webkit-datetime-edit-second-field{padding-block:0}::-webkit-datetime-edit-millisecond-field{padding-block:0}::-webkit-datetime-edit-meridiem-field{padding-block:0}::-webkit-calendar-picker-indicator{line-height:1}:-moz-ui-invalid{box-shadow:none}button,input:where([type=button],[type=reset],[type=submit]){appearance:button}::file-selector-button{appearance:button}::-webkit-inner-spin-button{height:auto}::-webkit-outer-spin-button{height:auto}[hidden]:where(:not([hidden=until-found])){display:none!important}}@layer components;@layer utilities{.pointer-events-none{pointer-events:none}.visible{visibility:visible}.fixed{position:fixed}.relative{position:relative}.z-50{z-index:50}.ml-1{margin-left:calc(var(--spacing)*1)}.flex{display:flex}.grid{display:grid}.inline{display:inline}.inline-flex{display:inline-flex}.size-3\.5{width:calc(var(--spacing)*3.5);height:calc(var(--spacing)*3.5)}.size-6{width:calc(var(--spacing)*6);height:calc(var(--spacing)*6)}.size-7{width:calc(var(--spacing)*7);height:calc(var(--spacing)*7)}.size-8{width:calc(var(--spacing)*8);height:calc(var(--spacing)*8)}.size-9{width:calc(var(--spacing)*9);height:calc(var(--spacing)*9)}.size-10{width:calc(var(--spacing)*10);height:calc(var(--spacing)*10)}.h-5{height:calc(var(--spacing)*5)}.h-6{height:calc(var(--spacing)*6)}.h-7{height:calc(var(--spacing)*7)}.h-8{height:calc(var(--spacing)*8)}.h-9{height:calc(var(--spacing)*9)}.h-10{height:calc(var(--spacing)*10)}.h-11{height:calc(var(--spacing)*11)}.h-12{height:calc(var(--spacing)*12)}.h-full{height:100%}.max-h-52{max-height:calc(var(--spacing)*52)}.w-60{width:calc(var(--spacing)*60)}.w-72{width:calc(var(--spacing)*72)}.w-80{width:calc(var(--spacing)*80)}.w-\[1\.5rem\]{width:1.5rem}.w-\[1\.25rem\]{width:1.25rem}.w-\[1\.75rem\]{width:1.75rem}.w-\[2\.5rem\]{width:2.5rem}.w-\[2\.25rem\]{width:2.25rem}.w-\[2\.75rem\]{width:2.75rem}.w-\[2rem\]{width:2rem}.w-\[3\.25rem\]{width:3.25rem}.w-full{width:100%}.min-w-0{min-width:calc(var(--spacing)*0)}.flex-1{flex:1}.shrink-0{flex-shrink:0}.rotate-180{rotate:180deg}.cursor-default{cursor:default}.cursor-not-allowed{cursor:not-allowed}.cursor-pointer{cursor:pointer}.grid-cols-1{grid-template-columns:repeat(1,minmax(0,1fr))}.grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.grid-cols-4{grid-template-columns:repeat(4,minmax(0,1fr))}.grid-cols-5{grid-template-columns:repeat(5,minmax(0,1fr))}.grid-cols-6{grid-template-columns:repeat(6,minmax(0,1fr))}.grid-cols-7{grid-template-columns:repeat(7,minmax(0,1fr))}.flex-col{flex-direction:column}.items-center{align-items:center}.justify-between{justify-content:space-between}.justify-center{justify-content:center}.gap-0\.5{gap:calc(var(--spacing)*.5)}.gap-1{gap:calc(var(--spacing)*1)}.gap-1\.5{gap:calc(var(--spacing)*1.5)}.gap-2{gap:calc(var(--spacing)*2)}:where(.divide-x>:not(:last-child)){--tw-divide-x-reverse:0;border-inline-style:var(--tw-border-style);border-inline-start-width:calc(1px*var(--tw-divide-x-reverse));border-inline-end-width:calc(1px*calc(1 - var(--tw-divide-x-reverse)))}:where(.divide-\[var\(--refraktor-border\)\]>:not(:last-child)){border-color:var(--refraktor-border)}.truncate{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.overflow-hidden{overflow:hidden}.overflow-y-auto{overflow-y:auto}.border{border-style:var(--tw-border-style);border-width:1px}.border-b{border-bottom-style:var(--tw-border-style);border-bottom-width:1px}.border-none{--tw-border-style:none;border-style:none}.border-\[var\(--refraktor-border\)\]{border-color:var(--refraktor-border)}.border-\[var\(--refraktor-colors-red-6\)\]{border-color:var(--refraktor-colors-red-6)}.bg-\[var\(--refraktor-bg\)\]{background-color:var(--refraktor-bg)}.bg-\[var\(--refraktor-bg-subtle\)\]{background-color:var(--refraktor-bg-subtle)}.bg-\[var\(--refraktor-primary\)\]{background-color:var(--refraktor-primary)}.bg-transparent{background-color:#0000}.p-0{padding:calc(var(--spacing)*0)}.p-1{padding:calc(var(--spacing)*1)}.p-2{padding:calc(var(--spacing)*2)}.px-1{padding-inline:calc(var(--spacing)*1)}.px-1\.5{padding-inline:calc(var(--spacing)*1.5)}.px-2{padding-inline:calc(var(--spacing)*2)}.px-2\.5{padding-inline:calc(var(--spacing)*2.5)}.px-3{padding-inline:calc(var(--spacing)*3)}.px-3\.5{padding-inline:calc(var(--spacing)*3.5)}.px-4{padding-inline:calc(var(--spacing)*4)}.py-0\.5{padding-block:calc(var(--spacing)*.5)}.py-1{padding-block:calc(var(--spacing)*1)}.py-1\.5{padding-block:calc(var(--spacing)*1.5)}.text-center{text-align:center}.text-base{font-size:var(--text-base);line-height:var(--tw-leading,var(--text-base--line-height))}.text-lg{font-size:var(--text-lg);line-height:var(--tw-leading,var(--text-lg--line-height))}.text-sm{font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height))}.text-xs{font-size:var(--text-xs);line-height:var(--tw-leading,var(--text-xs--line-height))}.text-\[8px\]{font-size:8px}.text-\[10px\]{font-size:10px}.leading-none{--tw-leading:1;line-height:1}.font-medium{--tw-font-weight:var(--font-weight-medium);font-weight:var(--font-weight-medium)}.text-\[var\(--refraktor-primary-text\)\]{color:var(--refraktor-primary-text)}.text-\[var\(--refraktor-text\)\]{color:var(--refraktor-text)}.text-\[var\(--refraktor-text-secondary\)\]{color:var(--refraktor-text-secondary)}.opacity-50{opacity:.5}.shadow-md{--tw-shadow:0 4px 6px -1px var(--tw-shadow-color,#0000001a),0 2px 4px -2px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.ring-1{--tw-ring-shadow:var(--tw-ring-inset,)0 0 0 calc(1px + var(--tw-ring-offset-width))var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.ring-\[var\(--refraktor-primary\)\]{--tw-ring-color:var(--refraktor-primary)}.outline{outline-style:var(--tw-outline-style);outline-width:1px}.transition{transition-property:color,background-color,border-color,outline-color,text-decoration-color,fill,stroke,--tw-gradient-from,--tw-gradient-via,--tw-gradient-to,opacity,box-shadow,transform,translate,scale,rotate,filter,-webkit-backdrop-filter,backdrop-filter,display,content-visibility,overlay,pointer-events;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-all{transition-property:all;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-colors{transition-property:color,background-color,border-color,outline-color,text-decoration-color,fill,stroke,--tw-gradient-from,--tw-gradient-via,--tw-gradient-to;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.outline-none{--tw-outline-style:none;outline-style:none}.select-all{-webkit-user-select:all;user-select:all}.select-none{-webkit-user-select:none;user-select:none}.placeholder\:text-\[var\(--refraktor-text-tertiary\)\]::placeholder{color:var(--refraktor-text-tertiary)}.focus-within\:border-\[var\(--refraktor-primary\)\]:focus-within{border-color:var(--refraktor-primary)}@media (hover:hover){.hover\:bg-\[var\(--refraktor-bg-hover\)\]:hover{background-color:var(--refraktor-bg-hover)}.hover\:bg-\[var\(--refraktor-primary\)\]:hover{background-color:var(--refraktor-primary)}.hover\:text-\[var\(--refraktor-text\)\]:hover{color:var(--refraktor-text)}}.focus-visible\:outline:focus-visible{outline-style:var(--tw-outline-style);outline-width:1px}.focus-visible\:outline-2:focus-visible{outline-style:var(--tw-outline-style);outline-width:2px}.focus-visible\:outline-offset-2:focus-visible{outline-offset:2px}.focus-visible\:outline-\[var\(--refraktor-primary\)\]:focus-visible{outline-color:var(--refraktor-primary)}.data-\[disabled\=true\]\:pointer-events-none[data-disabled=true]{pointer-events:none}.data-\[disabled\=true\]\:cursor-not-allowed[data-disabled=true]{cursor:not-allowed}.data-\[disabled\=true\]\:opacity-50[data-disabled=true]{opacity:.5}}@property --tw-divide-x-reverse{syntax:"*";inherits:false;initial-value:0}@property --tw-border-style{syntax:"*";inherits:false;initial-value:solid}@property --tw-leading{syntax:"*";inherits:false}@property --tw-font-weight{syntax:"*";inherits:false}@property --tw-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-shadow-color{syntax:"*";inherits:false}@property --tw-shadow-alpha{syntax:"<percentage>";inherits:false;initial-value:100%}@property --tw-inset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-shadow-color{syntax:"*";inherits:false}@property --tw-inset-shadow-alpha{syntax:"<percentage>";inherits:false;initial-value:100%}@property --tw-ring-color{syntax:"*";inherits:false}@property --tw-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-ring-color{syntax:"*";inherits:false}@property --tw-inset-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-ring-inset{syntax:"*";inherits:false}@property --tw-ring-offset-width{syntax:"<length>";inherits:false;initial-value:0}@property --tw-ring-offset-color{syntax:"*";inherits:false;initial-value:#fff}@property --tw-ring-offset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-outline-style{syntax:"*";inherits:false;initial-value:solid}
|
|
1
|
+
/*! tailwindcss v4.2.1 | MIT License | https://tailwindcss.com */
|
|
2
|
+
@layer properties{@supports (((-webkit-hyphens:none)) and (not (margin-trim:inline))) or ((-moz-orient:inline) and (not (color:rgb(from red r g b)))){*,:before,:after,::backdrop{--tw-divide-x-reverse:0;--tw-border-style:solid;--tw-leading:initial;--tw-font-weight:initial;--tw-shadow:0 0 #0000;--tw-shadow-color:initial;--tw-shadow-alpha:100%;--tw-inset-shadow:0 0 #0000;--tw-inset-shadow-color:initial;--tw-inset-shadow-alpha:100%;--tw-ring-color:initial;--tw-ring-shadow:0 0 #0000;--tw-inset-ring-color:initial;--tw-inset-ring-shadow:0 0 #0000;--tw-ring-inset:initial;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-offset-shadow:0 0 #0000;--tw-outline-style:solid}}}@layer theme{:root,:host{--font-sans:ui-sans-serif, system-ui, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";--font-mono:ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;--spacing:.25rem;--text-xs:.75rem;--text-xs--line-height:calc(1 / .75);--text-sm:.875rem;--text-sm--line-height:calc(1.25 / .875);--text-base:1rem;--text-base--line-height:calc(1.5 / 1);--text-lg:1.125rem;--text-lg--line-height:calc(1.75 / 1.125);--font-weight-medium:500;--default-transition-duration:.15s;--default-transition-timing-function:cubic-bezier(.4, 0, .2, 1);--default-font-family:var(--font-sans);--default-mono-font-family:var(--font-mono)}}@layer base{*,:after,:before,::backdrop{box-sizing:border-box;border:0 solid;margin:0;padding:0}::file-selector-button{box-sizing:border-box;border:0 solid;margin:0;padding:0}html,:host{-webkit-text-size-adjust:100%;tab-size:4;line-height:1.5;font-family:var(--default-font-family,ui-sans-serif, system-ui, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji");font-feature-settings:var(--default-font-feature-settings,normal);font-variation-settings:var(--default-font-variation-settings,normal);-webkit-tap-highlight-color:transparent}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;-webkit-text-decoration:inherit;-webkit-text-decoration:inherit;-webkit-text-decoration:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:var(--default-mono-font-family,ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace);font-feature-settings:var(--default-mono-font-feature-settings,normal);font-variation-settings:var(--default-mono-font-variation-settings,normal);font-size:1em}small{font-size:80%}sub,sup{vertical-align:baseline;font-size:75%;line-height:0;position:relative}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}:-moz-focusring{outline:auto}progress{vertical-align:baseline}summary{display:list-item}ol,ul,menu{list-style:none}img,svg,video,canvas,audio,iframe,embed,object{vertical-align:middle;display:block}img,video{max-width:100%;height:auto}button,input,select,optgroup,textarea{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}::file-selector-button{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}:where(select:is([multiple],[size])) optgroup{font-weight:bolder}:where(select:is([multiple],[size])) optgroup option{padding-inline-start:20px}::file-selector-button{margin-inline-end:4px}::placeholder{opacity:1}@supports (not ((-webkit-appearance:-apple-pay-button))) or (contain-intrinsic-size:1px){::placeholder{color:currentColor}@supports (color:color-mix(in lab, red, red)){::placeholder{color:color-mix(in oklab, currentcolor 50%, transparent)}}}textarea{resize:vertical}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-date-and-time-value{min-height:1lh;text-align:inherit}::-webkit-datetime-edit{display:inline-flex}::-webkit-datetime-edit-fields-wrapper{padding:0}::-webkit-datetime-edit{padding-block:0}::-webkit-datetime-edit-year-field{padding-block:0}::-webkit-datetime-edit-month-field{padding-block:0}::-webkit-datetime-edit-day-field{padding-block:0}::-webkit-datetime-edit-hour-field{padding-block:0}::-webkit-datetime-edit-minute-field{padding-block:0}::-webkit-datetime-edit-second-field{padding-block:0}::-webkit-datetime-edit-millisecond-field{padding-block:0}::-webkit-datetime-edit-meridiem-field{padding-block:0}::-webkit-calendar-picker-indicator{line-height:1}:-moz-ui-invalid{box-shadow:none}button,input:where([type=button],[type=reset],[type=submit]){appearance:button}::file-selector-button{appearance:button}::-webkit-inner-spin-button{height:auto}::-webkit-outer-spin-button{height:auto}[hidden]:where(:not([hidden=until-found])){display:none!important}}@layer components;@layer utilities{.pointer-events-none{pointer-events:none}.visible{visibility:visible}.fixed{position:fixed}.relative{position:relative}.start{inset-inline-start:var(--spacing)}.end{inset-inline-end:var(--spacing)}.z-50{z-index:50}.ml-1{margin-left:calc(var(--spacing) * 1)}.flex{display:flex}.grid{display:grid}.inline{display:inline}.inline-flex{display:inline-flex}.size-3\.5{width:calc(var(--spacing) * 3.5);height:calc(var(--spacing) * 3.5)}.size-6{width:calc(var(--spacing) * 6);height:calc(var(--spacing) * 6)}.size-7{width:calc(var(--spacing) * 7);height:calc(var(--spacing) * 7)}.size-8{width:calc(var(--spacing) * 8);height:calc(var(--spacing) * 8)}.size-9{width:calc(var(--spacing) * 9);height:calc(var(--spacing) * 9)}.size-10{width:calc(var(--spacing) * 10);height:calc(var(--spacing) * 10)}.h-5{height:calc(var(--spacing) * 5)}.h-6{height:calc(var(--spacing) * 6)}.h-7{height:calc(var(--spacing) * 7)}.h-8{height:calc(var(--spacing) * 8)}.h-9{height:calc(var(--spacing) * 9)}.h-10{height:calc(var(--spacing) * 10)}.h-11{height:calc(var(--spacing) * 11)}.h-12{height:calc(var(--spacing) * 12)}.h-full{height:100%}.max-h-52{max-height:calc(var(--spacing) * 52)}.w-60{width:calc(var(--spacing) * 60)}.w-72{width:calc(var(--spacing) * 72)}.w-80{width:calc(var(--spacing) * 80)}.w-\[1\.5rem\]{width:1.5rem}.w-\[1\.25rem\]{width:1.25rem}.w-\[1\.75rem\]{width:1.75rem}.w-\[2\.5rem\]{width:2.5rem}.w-\[2\.25rem\]{width:2.25rem}.w-\[2\.75rem\]{width:2.75rem}.w-\[2rem\]{width:2rem}.w-\[3\.25rem\]{width:3.25rem}.w-full{width:100%}.min-w-0{min-width:calc(var(--spacing) * 0)}.flex-1{flex:1}.shrink-0{flex-shrink:0}.rotate-180{rotate:180deg}.cursor-default{cursor:default}.cursor-not-allowed{cursor:not-allowed}.cursor-pointer{cursor:pointer}.grid-cols-1{grid-template-columns:repeat(1,minmax(0,1fr))}.grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.grid-cols-4{grid-template-columns:repeat(4,minmax(0,1fr))}.grid-cols-5{grid-template-columns:repeat(5,minmax(0,1fr))}.grid-cols-6{grid-template-columns:repeat(6,minmax(0,1fr))}.grid-cols-7{grid-template-columns:repeat(7,minmax(0,1fr))}.flex-col{flex-direction:column}.items-center{align-items:center}.justify-between{justify-content:space-between}.justify-center{justify-content:center}.gap-0\.5{gap:calc(var(--spacing) * .5)}.gap-1{gap:calc(var(--spacing) * 1)}.gap-1\.5{gap:calc(var(--spacing) * 1.5)}.gap-2{gap:calc(var(--spacing) * 2)}:where(.divide-x>:not(:last-child)){--tw-divide-x-reverse:0;border-inline-style:var(--tw-border-style);border-inline-start-width:calc(1px * var(--tw-divide-x-reverse));border-inline-end-width:calc(1px * calc(1 - var(--tw-divide-x-reverse)))}:where(.divide-\[var\(--refraktor-border\)\]>:not(:last-child)){border-color:var(--refraktor-border)}.truncate{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.overflow-hidden{overflow:hidden}.overflow-y-auto{overflow-y:auto}.border{border-style:var(--tw-border-style);border-width:1px}.border-b{border-bottom-style:var(--tw-border-style);border-bottom-width:1px}.border-none{--tw-border-style:none;border-style:none}.border-\[var\(--refraktor-border\)\]{border-color:var(--refraktor-border)}.border-\[var\(--refraktor-colors-red-6\)\]{border-color:var(--refraktor-colors-red-6)}.bg-\[var\(--refraktor-bg\)\]{background-color:var(--refraktor-bg)}.bg-\[var\(--refraktor-bg-subtle\)\]{background-color:var(--refraktor-bg-subtle)}.bg-\[var\(--refraktor-primary\)\]{background-color:var(--refraktor-primary)}.bg-transparent{background-color:#0000}.p-0{padding:calc(var(--spacing) * 0)}.p-1{padding:calc(var(--spacing) * 1)}.p-2{padding:calc(var(--spacing) * 2)}.px-1{padding-inline:calc(var(--spacing) * 1)}.px-1\.5{padding-inline:calc(var(--spacing) * 1.5)}.px-2{padding-inline:calc(var(--spacing) * 2)}.px-2\.5{padding-inline:calc(var(--spacing) * 2.5)}.px-3{padding-inline:calc(var(--spacing) * 3)}.px-3\.5{padding-inline:calc(var(--spacing) * 3.5)}.px-4{padding-inline:calc(var(--spacing) * 4)}.py-0\.5{padding-block:calc(var(--spacing) * .5)}.py-1{padding-block:calc(var(--spacing) * 1)}.py-1\.5{padding-block:calc(var(--spacing) * 1.5)}.text-center{text-align:center}.text-base{font-size:var(--text-base);line-height:var(--tw-leading,var(--text-base--line-height))}.text-lg{font-size:var(--text-lg);line-height:var(--tw-leading,var(--text-lg--line-height))}.text-sm{font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height))}.text-xs{font-size:var(--text-xs);line-height:var(--tw-leading,var(--text-xs--line-height))}.text-\[8px\]{font-size:8px}.text-\[10px\]{font-size:10px}.leading-none{--tw-leading:1;line-height:1}.font-medium{--tw-font-weight:var(--font-weight-medium);font-weight:var(--font-weight-medium)}.text-\[var\(--refraktor-primary-text\)\]{color:var(--refraktor-primary-text)}.text-\[var\(--refraktor-text\)\]{color:var(--refraktor-text)}.text-\[var\(--refraktor-text-secondary\)\]{color:var(--refraktor-text-secondary)}.opacity-50{opacity:.5}.shadow-md{--tw-shadow:0 4px 6px -1px var(--tw-shadow-color,#0000001a), 0 2px 4px -2px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.ring-1{--tw-ring-shadow:var(--tw-ring-inset,) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.ring-\[var\(--refraktor-primary\)\]{--tw-ring-color:var(--refraktor-primary)}.outline{outline-style:var(--tw-outline-style);outline-width:1px}.transition{transition-property:color,background-color,border-color,outline-color,text-decoration-color,fill,stroke,--tw-gradient-from,--tw-gradient-via,--tw-gradient-to,opacity,box-shadow,transform,translate,scale,rotate,filter,-webkit-backdrop-filter,backdrop-filter,display,content-visibility,overlay,pointer-events;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-all{transition-property:all;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-colors{transition-property:color,background-color,border-color,outline-color,text-decoration-color,fill,stroke,--tw-gradient-from,--tw-gradient-via,--tw-gradient-to;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.outline-none{--tw-outline-style:none;outline-style:none}.select-all{-webkit-user-select:all;user-select:all}.select-none{-webkit-user-select:none;user-select:none}.placeholder\:text-\[var\(--refraktor-text-tertiary\)\]::placeholder{color:var(--refraktor-text-tertiary)}.focus-within\:border-\[var\(--refraktor-primary\)\]:focus-within{border-color:var(--refraktor-primary)}@media (hover:hover){.hover\:bg-\[var\(--refraktor-bg-hover\)\]:hover{background-color:var(--refraktor-bg-hover)}.hover\:bg-\[var\(--refraktor-primary\)\]:hover{background-color:var(--refraktor-primary)}.hover\:text-\[var\(--refraktor-text\)\]:hover{color:var(--refraktor-text)}}.focus-visible\:outline:focus-visible{outline-style:var(--tw-outline-style);outline-width:1px}.focus-visible\:outline-2:focus-visible{outline-style:var(--tw-outline-style);outline-width:2px}.focus-visible\:outline-offset-2:focus-visible{outline-offset:2px}.focus-visible\:outline-\[var\(--refraktor-primary\)\]:focus-visible{outline-color:var(--refraktor-primary)}.data-\[disabled\=true\]\:pointer-events-none[data-disabled=true]{pointer-events:none}.data-\[disabled\=true\]\:cursor-not-allowed[data-disabled=true]{cursor:not-allowed}.data-\[disabled\=true\]\:opacity-50[data-disabled=true]{opacity:.5}}@property --tw-divide-x-reverse{syntax:"*";inherits:false;initial-value:0}@property --tw-border-style{syntax:"*";inherits:false;initial-value:solid}@property --tw-leading{syntax:"*";inherits:false}@property --tw-font-weight{syntax:"*";inherits:false}@property --tw-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-shadow-color{syntax:"*";inherits:false}@property --tw-shadow-alpha{syntax:"<percentage>";inherits:false;initial-value:100%}@property --tw-inset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-shadow-color{syntax:"*";inherits:false}@property --tw-inset-shadow-alpha{syntax:"<percentage>";inherits:false;initial-value:100%}@property --tw-ring-color{syntax:"*";inherits:false}@property --tw-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-ring-color{syntax:"*";inherits:false}@property --tw-inset-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-ring-inset{syntax:"*";inherits:false}@property --tw-ring-offset-width{syntax:"<length>";inherits:false;initial-value:0}@property --tw-ring-offset-color{syntax:"*";inherits:false;initial-value:#fff}@property --tw-ring-offset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-outline-style{syntax:"*";inherits:false;initial-value:solid}
|
package/package.json
CHANGED
|
@@ -1,10 +1,39 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@refraktor/dates",
|
|
3
|
-
"
|
|
3
|
+
"description": "React UI component library for date and time management",
|
|
4
|
+
"version": "0.0.5",
|
|
4
5
|
"license": "MIT",
|
|
6
|
+
"repository": {
|
|
7
|
+
"type": "git",
|
|
8
|
+
"url": "https://github.com/refraktorui/refraktor.git",
|
|
9
|
+
"directory": "packages/dates"
|
|
10
|
+
},
|
|
11
|
+
"bugs": {
|
|
12
|
+
"url": "https://github.com/refraktorui/refraktor/issues"
|
|
13
|
+
},
|
|
14
|
+
"keywords": [
|
|
15
|
+
"react",
|
|
16
|
+
"ui",
|
|
17
|
+
"ui-kit",
|
|
18
|
+
"component",
|
|
19
|
+
"design",
|
|
20
|
+
"frontend",
|
|
21
|
+
"tailwindcss",
|
|
22
|
+
"tailwind",
|
|
23
|
+
"date",
|
|
24
|
+
"time"
|
|
25
|
+
],
|
|
5
26
|
"publishConfig": {
|
|
6
27
|
"access": "public"
|
|
7
28
|
},
|
|
29
|
+
"sideEffects": [
|
|
30
|
+
"*.css"
|
|
31
|
+
],
|
|
32
|
+
"files": [
|
|
33
|
+
"build",
|
|
34
|
+
"README.md",
|
|
35
|
+
"LICENSE"
|
|
36
|
+
],
|
|
8
37
|
"main": "./build/index.js",
|
|
9
38
|
"module": "./build/index.js",
|
|
10
39
|
"types": "./build/index.d.ts",
|
|
@@ -24,14 +53,14 @@
|
|
|
24
53
|
"react": ">=18.0.0",
|
|
25
54
|
"react-dom": ">=18.0.0",
|
|
26
55
|
"dayjs": "^1.11.19",
|
|
27
|
-
"@refraktor/core": "0.0.
|
|
28
|
-
"@refraktor/utils": "0.0.
|
|
56
|
+
"@refraktor/core": "0.0.5",
|
|
57
|
+
"@refraktor/utils": "0.0.5"
|
|
29
58
|
},
|
|
30
59
|
"devDependencies": {
|
|
31
60
|
"typescript": "^5.9.3"
|
|
32
61
|
},
|
|
33
62
|
"dependencies": {
|
|
34
|
-
"@floating-ui/react": "^0.27.
|
|
63
|
+
"@floating-ui/react": "^0.27.18",
|
|
35
64
|
"clsx": "^2.1.1",
|
|
36
65
|
"tailwind-merge": "^3.4.0"
|
|
37
66
|
}
|
package/.turbo/turbo-build.log
DELETED
|
Binary file
|
|
@@ -1,379 +0,0 @@
|
|
|
1
|
-
import { useId, useUncontrolled } from "@refraktor/utils";
|
|
2
|
-
import { useCallback, useMemo } from "react";
|
|
3
|
-
import {
|
|
4
|
-
createClassNamesConfig,
|
|
5
|
-
createComponentConfig,
|
|
6
|
-
factory,
|
|
7
|
-
Input,
|
|
8
|
-
Transition,
|
|
9
|
-
useClassNames,
|
|
10
|
-
useProps,
|
|
11
|
-
useTheme
|
|
12
|
-
} from "@refraktor/core";
|
|
13
|
-
import {
|
|
14
|
-
autoUpdate,
|
|
15
|
-
flip,
|
|
16
|
-
FloatingFocusManager,
|
|
17
|
-
FloatingPortal,
|
|
18
|
-
inline,
|
|
19
|
-
Middleware,
|
|
20
|
-
offset,
|
|
21
|
-
shift,
|
|
22
|
-
useDismiss,
|
|
23
|
-
useFloating,
|
|
24
|
-
useFocus,
|
|
25
|
-
useInteractions,
|
|
26
|
-
useRole
|
|
27
|
-
} from "@floating-ui/react";
|
|
28
|
-
import { useDates } from "../dates-provider";
|
|
29
|
-
import { DatePicker } from "../date-picker";
|
|
30
|
-
import {
|
|
31
|
-
DateInputClassNames,
|
|
32
|
-
DateInputFactoryPayload,
|
|
33
|
-
DateInputProps
|
|
34
|
-
} from "./date-input.types";
|
|
35
|
-
|
|
36
|
-
const DEFAULT_MONTH_PICKER_COLUMNS = 3;
|
|
37
|
-
const DEFAULT_YEAR_PICKER_YEARS_PER_PAGE = 9;
|
|
38
|
-
const DEFAULT_YEAR_PICKER_COLUMNS = 3;
|
|
39
|
-
const DEFAULT_VALUE_FORMAT = "MMMM D, YYYY";
|
|
40
|
-
|
|
41
|
-
const defaultProps = {
|
|
42
|
-
monthPickerColumns: DEFAULT_MONTH_PICKER_COLUMNS,
|
|
43
|
-
yearPickerYearsPerPage: DEFAULT_YEAR_PICKER_YEARS_PER_PAGE,
|
|
44
|
-
yearPickerColumns: DEFAULT_YEAR_PICKER_COLUMNS,
|
|
45
|
-
valueFormat: DEFAULT_VALUE_FORMAT,
|
|
46
|
-
disabled: false,
|
|
47
|
-
size: "md",
|
|
48
|
-
radius: "default",
|
|
49
|
-
positioning: {
|
|
50
|
-
placement: "bottom-start",
|
|
51
|
-
offset: 4
|
|
52
|
-
},
|
|
53
|
-
middlewares: {
|
|
54
|
-
flip: true,
|
|
55
|
-
shift: true
|
|
56
|
-
},
|
|
57
|
-
withinPortal: true,
|
|
58
|
-
closeOnClickOutside: true,
|
|
59
|
-
closeOnEscape: true
|
|
60
|
-
} satisfies Partial<DateInputProps>;
|
|
61
|
-
|
|
62
|
-
const isValidDate = (value: unknown): value is Date =>
|
|
63
|
-
value instanceof Date && !Number.isNaN(value.getTime());
|
|
64
|
-
|
|
65
|
-
const normalizeDateValue = (value: Date | undefined) => {
|
|
66
|
-
if (!isValidDate(value)) {
|
|
67
|
-
return undefined;
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
const normalizedValue = new Date(value);
|
|
71
|
-
normalizedValue.setHours(0, 0, 0, 0);
|
|
72
|
-
return normalizedValue;
|
|
73
|
-
};
|
|
74
|
-
|
|
75
|
-
const DateInput = factory<DateInputFactoryPayload>((_props, ref) => {
|
|
76
|
-
const { cx, getRadius } = useTheme();
|
|
77
|
-
const { createDate } = useDates();
|
|
78
|
-
const {
|
|
79
|
-
id,
|
|
80
|
-
value,
|
|
81
|
-
defaultValue,
|
|
82
|
-
onChange,
|
|
83
|
-
opened,
|
|
84
|
-
defaultOpened,
|
|
85
|
-
onOpenedChange,
|
|
86
|
-
minDate,
|
|
87
|
-
maxDate,
|
|
88
|
-
monthPickerColumns,
|
|
89
|
-
yearPickerYearsPerPage,
|
|
90
|
-
yearPickerColumns,
|
|
91
|
-
getWeekdayLabel,
|
|
92
|
-
getDayLabel,
|
|
93
|
-
getDayAriaLabel,
|
|
94
|
-
getHeaderLabel,
|
|
95
|
-
getNavigationAriaLabel,
|
|
96
|
-
getMonthLabel,
|
|
97
|
-
getMonthAriaLabel,
|
|
98
|
-
getMonthHeaderLabel,
|
|
99
|
-
getMonthNavigationAriaLabel,
|
|
100
|
-
valueFormat,
|
|
101
|
-
disabled,
|
|
102
|
-
size,
|
|
103
|
-
radius,
|
|
104
|
-
positioning,
|
|
105
|
-
middlewares,
|
|
106
|
-
withinPortal,
|
|
107
|
-
closeOnClickOutside,
|
|
108
|
-
closeOnEscape,
|
|
109
|
-
transitionProps,
|
|
110
|
-
inputClassNames,
|
|
111
|
-
className,
|
|
112
|
-
classNames,
|
|
113
|
-
onFocus,
|
|
114
|
-
onBlur,
|
|
115
|
-
onClick,
|
|
116
|
-
onKeyDown,
|
|
117
|
-
...inputProps
|
|
118
|
-
} = useProps("DateInput", defaultProps, _props);
|
|
119
|
-
const classes = useClassNames("DateInput", classNames);
|
|
120
|
-
|
|
121
|
-
const _id = useId(id);
|
|
122
|
-
const dropdownId = `${_id}-dropdown`;
|
|
123
|
-
|
|
124
|
-
const [selectedDateState, setSelectedDate] = useUncontrolled<Date | undefined>({
|
|
125
|
-
value,
|
|
126
|
-
defaultValue,
|
|
127
|
-
finalValue: undefined,
|
|
128
|
-
onChange: (nextDate) => {
|
|
129
|
-
if (nextDate !== undefined) {
|
|
130
|
-
onChange?.(nextDate);
|
|
131
|
-
}
|
|
132
|
-
}
|
|
133
|
-
});
|
|
134
|
-
|
|
135
|
-
const [isOpenState, setIsOpen] = useUncontrolled<boolean>({
|
|
136
|
-
value: opened,
|
|
137
|
-
defaultValue: defaultOpened,
|
|
138
|
-
finalValue: false,
|
|
139
|
-
onChange: onOpenedChange
|
|
140
|
-
});
|
|
141
|
-
|
|
142
|
-
const isOpen = isOpenState && !disabled;
|
|
143
|
-
|
|
144
|
-
const middleware = useMemo(() => {
|
|
145
|
-
const middlewareList: Middleware[] = [];
|
|
146
|
-
|
|
147
|
-
middlewareList.push(offset(positioning?.offset ?? 4));
|
|
148
|
-
|
|
149
|
-
if (middlewares?.flip ?? true) {
|
|
150
|
-
middlewareList.push(
|
|
151
|
-
flip(
|
|
152
|
-
typeof middlewares?.flip === "boolean"
|
|
153
|
-
? undefined
|
|
154
|
-
: middlewares.flip
|
|
155
|
-
)
|
|
156
|
-
);
|
|
157
|
-
}
|
|
158
|
-
|
|
159
|
-
if (middlewares?.shift ?? true) {
|
|
160
|
-
middlewareList.push(
|
|
161
|
-
shift(
|
|
162
|
-
typeof middlewares?.shift === "boolean"
|
|
163
|
-
? undefined
|
|
164
|
-
: middlewares.shift
|
|
165
|
-
)
|
|
166
|
-
);
|
|
167
|
-
}
|
|
168
|
-
|
|
169
|
-
if (middlewares?.inline) {
|
|
170
|
-
middlewareList.push(
|
|
171
|
-
inline(
|
|
172
|
-
typeof middlewares.inline === "boolean"
|
|
173
|
-
? undefined
|
|
174
|
-
: middlewares.inline
|
|
175
|
-
)
|
|
176
|
-
);
|
|
177
|
-
}
|
|
178
|
-
|
|
179
|
-
return middlewareList;
|
|
180
|
-
}, [middlewares, positioning?.offset]);
|
|
181
|
-
|
|
182
|
-
const handleOpenChange = useCallback(
|
|
183
|
-
(nextOpen: boolean) => {
|
|
184
|
-
if (disabled && nextOpen) {
|
|
185
|
-
return;
|
|
186
|
-
}
|
|
187
|
-
|
|
188
|
-
setIsOpen(nextOpen);
|
|
189
|
-
},
|
|
190
|
-
[disabled, setIsOpen]
|
|
191
|
-
);
|
|
192
|
-
|
|
193
|
-
const floating = useFloating({
|
|
194
|
-
placement: positioning?.placement ?? "bottom-start",
|
|
195
|
-
open: isOpen,
|
|
196
|
-
onOpenChange: handleOpenChange,
|
|
197
|
-
middleware,
|
|
198
|
-
whileElementsMounted: autoUpdate,
|
|
199
|
-
strategy: "fixed"
|
|
200
|
-
});
|
|
201
|
-
|
|
202
|
-
const focus = useFocus(floating.context, {
|
|
203
|
-
enabled: !disabled
|
|
204
|
-
});
|
|
205
|
-
|
|
206
|
-
const dismiss = useDismiss(floating.context, {
|
|
207
|
-
outsidePress: closeOnClickOutside,
|
|
208
|
-
escapeKey: closeOnEscape
|
|
209
|
-
});
|
|
210
|
-
|
|
211
|
-
const role = useRole(floating.context, {
|
|
212
|
-
role: "dialog"
|
|
213
|
-
});
|
|
214
|
-
|
|
215
|
-
const { getReferenceProps, getFloatingProps } = useInteractions([
|
|
216
|
-
focus,
|
|
217
|
-
dismiss,
|
|
218
|
-
role
|
|
219
|
-
]);
|
|
220
|
-
|
|
221
|
-
const setInputRef = useCallback(
|
|
222
|
-
(node: HTMLInputElement | null) => {
|
|
223
|
-
floating.refs.setReference(node);
|
|
224
|
-
|
|
225
|
-
if (typeof ref === "function") {
|
|
226
|
-
ref(node);
|
|
227
|
-
} else if (ref) {
|
|
228
|
-
ref.current = node;
|
|
229
|
-
}
|
|
230
|
-
},
|
|
231
|
-
[floating.refs, ref]
|
|
232
|
-
);
|
|
233
|
-
|
|
234
|
-
const handleInputKeyDown = useCallback(
|
|
235
|
-
(event: React.KeyboardEvent<HTMLInputElement>) => {
|
|
236
|
-
onKeyDown?.(event);
|
|
237
|
-
|
|
238
|
-
if (event.defaultPrevented || disabled) {
|
|
239
|
-
return;
|
|
240
|
-
}
|
|
241
|
-
|
|
242
|
-
if (
|
|
243
|
-
event.key === "ArrowDown" ||
|
|
244
|
-
event.key === "Enter" ||
|
|
245
|
-
event.key === " "
|
|
246
|
-
) {
|
|
247
|
-
event.preventDefault();
|
|
248
|
-
setIsOpen(true);
|
|
249
|
-
return;
|
|
250
|
-
}
|
|
251
|
-
|
|
252
|
-
if (event.key === "Escape") {
|
|
253
|
-
event.preventDefault();
|
|
254
|
-
setIsOpen(false);
|
|
255
|
-
}
|
|
256
|
-
},
|
|
257
|
-
[disabled, onKeyDown, setIsOpen]
|
|
258
|
-
);
|
|
259
|
-
|
|
260
|
-
const handleDateChange = useCallback(
|
|
261
|
-
(nextDate: Date) => {
|
|
262
|
-
const normalizedDate = normalizeDateValue(nextDate);
|
|
263
|
-
|
|
264
|
-
if (normalizedDate === undefined) {
|
|
265
|
-
return;
|
|
266
|
-
}
|
|
267
|
-
|
|
268
|
-
setSelectedDate(normalizedDate);
|
|
269
|
-
setIsOpen(false);
|
|
270
|
-
},
|
|
271
|
-
[setIsOpen, setSelectedDate]
|
|
272
|
-
);
|
|
273
|
-
|
|
274
|
-
const selectedDate = normalizeDateValue(selectedDateState);
|
|
275
|
-
const inputValue =
|
|
276
|
-
selectedDate === undefined ? "" : createDate(selectedDate).format(valueFormat);
|
|
277
|
-
|
|
278
|
-
const mergedReferenceProps = getReferenceProps({
|
|
279
|
-
onFocus,
|
|
280
|
-
onBlur,
|
|
281
|
-
onClick,
|
|
282
|
-
onKeyDown: handleInputKeyDown
|
|
283
|
-
});
|
|
284
|
-
|
|
285
|
-
const dropdownContent = (
|
|
286
|
-
<Transition
|
|
287
|
-
transition="fade"
|
|
288
|
-
duration={150}
|
|
289
|
-
mounted={isOpen}
|
|
290
|
-
style={{ position: "relative", zIndex: 1000 }}
|
|
291
|
-
{...transitionProps}
|
|
292
|
-
>
|
|
293
|
-
<div
|
|
294
|
-
ref={floating.refs.setFloating}
|
|
295
|
-
id={dropdownId}
|
|
296
|
-
style={{
|
|
297
|
-
...floating.floatingStyles,
|
|
298
|
-
zIndex: 1000
|
|
299
|
-
}}
|
|
300
|
-
className={cx(
|
|
301
|
-
"w-80 z-50 border border-[var(--refraktor-border)] bg-[var(--refraktor-bg)] p-2 text-[var(--refraktor-text)] shadow-md",
|
|
302
|
-
getRadius(radius),
|
|
303
|
-
classes.dropdown
|
|
304
|
-
)}
|
|
305
|
-
{...getFloatingProps()}
|
|
306
|
-
>
|
|
307
|
-
<DatePicker
|
|
308
|
-
value={selectedDate}
|
|
309
|
-
onChange={handleDateChange}
|
|
310
|
-
minDate={minDate}
|
|
311
|
-
maxDate={maxDate}
|
|
312
|
-
monthPickerColumns={monthPickerColumns}
|
|
313
|
-
yearPickerYearsPerPage={yearPickerYearsPerPage}
|
|
314
|
-
yearPickerColumns={yearPickerColumns}
|
|
315
|
-
disabled={disabled}
|
|
316
|
-
size={size}
|
|
317
|
-
radius={radius}
|
|
318
|
-
getWeekdayLabel={getWeekdayLabel}
|
|
319
|
-
getDayLabel={getDayLabel}
|
|
320
|
-
getDayAriaLabel={getDayAriaLabel}
|
|
321
|
-
getHeaderLabel={getHeaderLabel}
|
|
322
|
-
getNavigationAriaLabel={getNavigationAriaLabel}
|
|
323
|
-
getMonthLabel={getMonthLabel}
|
|
324
|
-
getMonthAriaLabel={getMonthAriaLabel}
|
|
325
|
-
getMonthHeaderLabel={getMonthHeaderLabel}
|
|
326
|
-
getMonthNavigationAriaLabel={getMonthNavigationAriaLabel}
|
|
327
|
-
className={cx("bg-transparent p-0", classes.datePicker)}
|
|
328
|
-
/>
|
|
329
|
-
</div>
|
|
330
|
-
</Transition>
|
|
331
|
-
);
|
|
332
|
-
|
|
333
|
-
const wrappedContent = isOpen ? (
|
|
334
|
-
<FloatingFocusManager
|
|
335
|
-
context={floating.context}
|
|
336
|
-
modal={false}
|
|
337
|
-
initialFocus={-1}
|
|
338
|
-
returnFocus={false}
|
|
339
|
-
>
|
|
340
|
-
{dropdownContent}
|
|
341
|
-
</FloatingFocusManager>
|
|
342
|
-
) : (
|
|
343
|
-
dropdownContent
|
|
344
|
-
);
|
|
345
|
-
|
|
346
|
-
return (
|
|
347
|
-
<>
|
|
348
|
-
<Input
|
|
349
|
-
ref={setInputRef}
|
|
350
|
-
id={_id}
|
|
351
|
-
readOnly
|
|
352
|
-
value={inputValue}
|
|
353
|
-
disabled={disabled}
|
|
354
|
-
size={size}
|
|
355
|
-
radius={radius}
|
|
356
|
-
role="combobox"
|
|
357
|
-
aria-haspopup="dialog"
|
|
358
|
-
aria-expanded={isOpen}
|
|
359
|
-
aria-controls={isOpen ? dropdownId : undefined}
|
|
360
|
-
className={cx(classes.input, className)}
|
|
361
|
-
classNames={inputClassNames}
|
|
362
|
-
{...inputProps}
|
|
363
|
-
{...(mergedReferenceProps as any)}
|
|
364
|
-
/>
|
|
365
|
-
|
|
366
|
-
{withinPortal ? (
|
|
367
|
-
<FloatingPortal>{wrappedContent}</FloatingPortal>
|
|
368
|
-
) : (
|
|
369
|
-
wrappedContent
|
|
370
|
-
)}
|
|
371
|
-
</>
|
|
372
|
-
);
|
|
373
|
-
});
|
|
374
|
-
|
|
375
|
-
DateInput.displayName = "@refraktor/dates/DateInput";
|
|
376
|
-
DateInput.configure = createComponentConfig<DateInputProps>();
|
|
377
|
-
DateInput.classNames = createClassNamesConfig<DateInputClassNames>();
|
|
378
|
-
|
|
379
|
-
export default DateInput;
|
|
@@ -1,161 +0,0 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
FlipOptions,
|
|
3
|
-
InlineOptions,
|
|
4
|
-
Placement,
|
|
5
|
-
ShiftOptions
|
|
6
|
-
} from "@floating-ui/react";
|
|
7
|
-
import {
|
|
8
|
-
createClassNamesConfig,
|
|
9
|
-
createComponentConfig,
|
|
10
|
-
FactoryPayload,
|
|
11
|
-
InputFieldClassNames,
|
|
12
|
-
InputProps,
|
|
13
|
-
RefraktorRadius,
|
|
14
|
-
RefraktorSize,
|
|
15
|
-
TransitionProps
|
|
16
|
-
} from "@refraktor/core";
|
|
17
|
-
import type {
|
|
18
|
-
DatePickerGetDayAriaLabel,
|
|
19
|
-
DatePickerGetDayLabel,
|
|
20
|
-
DatePickerGetHeaderLabel,
|
|
21
|
-
DatePickerGetNavigationAriaLabel,
|
|
22
|
-
DatePickerGetWeekdayLabel
|
|
23
|
-
} from "../date-picker";
|
|
24
|
-
import type {
|
|
25
|
-
MonthPickerGetHeaderLabel,
|
|
26
|
-
MonthPickerGetMonthAriaLabel,
|
|
27
|
-
MonthPickerGetMonthLabel,
|
|
28
|
-
MonthPickerGetNavigationAriaLabel
|
|
29
|
-
} from "../month-picker";
|
|
30
|
-
|
|
31
|
-
export type DateInputValue = Date;
|
|
32
|
-
export type DateInputSize = RefraktorSize;
|
|
33
|
-
export type DateInputRadius = RefraktorRadius;
|
|
34
|
-
export type DateInputOnChange = (value: DateInputValue) => void;
|
|
35
|
-
export type DateInputValueFormat = string;
|
|
36
|
-
|
|
37
|
-
export type DateInputPositioning = {
|
|
38
|
-
/** The placement of the dropdown relative to the input @default `bottom-start` */
|
|
39
|
-
placement?: Placement;
|
|
40
|
-
|
|
41
|
-
/** Offset distance from the input in pixels @default `4` */
|
|
42
|
-
offset?: number;
|
|
43
|
-
};
|
|
44
|
-
|
|
45
|
-
export type DateInputMiddlewares = {
|
|
46
|
-
shift?: boolean | ShiftOptions;
|
|
47
|
-
flip?: boolean | FlipOptions;
|
|
48
|
-
inline?: boolean | InlineOptions;
|
|
49
|
-
};
|
|
50
|
-
|
|
51
|
-
export type DateInputClassNames = {
|
|
52
|
-
input?: string;
|
|
53
|
-
dropdown?: string;
|
|
54
|
-
datePicker?: string;
|
|
55
|
-
};
|
|
56
|
-
|
|
57
|
-
interface _DateInputProps {
|
|
58
|
-
/** Selected date (controlled). */
|
|
59
|
-
value?: DateInputValue;
|
|
60
|
-
|
|
61
|
-
/** Initial selected date (uncontrolled). */
|
|
62
|
-
defaultValue?: DateInputValue;
|
|
63
|
-
|
|
64
|
-
/** Callback called when selected date changes. */
|
|
65
|
-
onChange?: DateInputOnChange;
|
|
66
|
-
|
|
67
|
-
/** Dropdown open state (controlled). */
|
|
68
|
-
opened?: boolean;
|
|
69
|
-
|
|
70
|
-
/** Initial dropdown open state (uncontrolled). */
|
|
71
|
-
defaultOpened?: boolean;
|
|
72
|
-
|
|
73
|
-
/** Callback called when dropdown open state changes. */
|
|
74
|
-
onOpenedChange?: (opened: boolean) => void;
|
|
75
|
-
|
|
76
|
-
/** Minimum selectable date. */
|
|
77
|
-
minDate?: Date;
|
|
78
|
-
|
|
79
|
-
/** Maximum selectable date. */
|
|
80
|
-
maxDate?: Date;
|
|
81
|
-
|
|
82
|
-
/** Month picker columns @default `3` */
|
|
83
|
-
monthPickerColumns?: number;
|
|
84
|
-
|
|
85
|
-
/** Year picker years rendered in one page @default `9` */
|
|
86
|
-
yearPickerYearsPerPage?: number;
|
|
87
|
-
|
|
88
|
-
/** Year picker columns @default `3` */
|
|
89
|
-
yearPickerColumns?: number;
|
|
90
|
-
|
|
91
|
-
/** Custom weekday label renderer. */
|
|
92
|
-
getWeekdayLabel?: DatePickerGetWeekdayLabel;
|
|
93
|
-
|
|
94
|
-
/** Custom day label renderer. */
|
|
95
|
-
getDayLabel?: DatePickerGetDayLabel;
|
|
96
|
-
|
|
97
|
-
/** Custom aria-label generator for day buttons. */
|
|
98
|
-
getDayAriaLabel?: DatePickerGetDayAriaLabel;
|
|
99
|
-
|
|
100
|
-
/** Custom header label renderer for visible month. */
|
|
101
|
-
getHeaderLabel?: DatePickerGetHeaderLabel;
|
|
102
|
-
|
|
103
|
-
/** Custom aria-label generator for previous/next controls. */
|
|
104
|
-
getNavigationAriaLabel?: DatePickerGetNavigationAriaLabel;
|
|
105
|
-
|
|
106
|
-
/** Custom month label renderer in month view. */
|
|
107
|
-
getMonthLabel?: MonthPickerGetMonthLabel;
|
|
108
|
-
|
|
109
|
-
/** Custom aria-label generator for month buttons in month view. */
|
|
110
|
-
getMonthAriaLabel?: MonthPickerGetMonthAriaLabel;
|
|
111
|
-
|
|
112
|
-
/** Custom header label renderer in month view. */
|
|
113
|
-
getMonthHeaderLabel?: MonthPickerGetHeaderLabel;
|
|
114
|
-
|
|
115
|
-
/** Custom aria-label generator for month view navigation controls. */
|
|
116
|
-
getMonthNavigationAriaLabel?: MonthPickerGetNavigationAriaLabel;
|
|
117
|
-
|
|
118
|
-
/** Dayjs format used to render selected date in the input @default `MMMM D, YYYY` */
|
|
119
|
-
valueFormat?: DateInputValueFormat;
|
|
120
|
-
|
|
121
|
-
/** Positioning settings for the dropdown. */
|
|
122
|
-
positioning?: DateInputPositioning;
|
|
123
|
-
|
|
124
|
-
/** Floating middleware settings. */
|
|
125
|
-
middlewares?: DateInputMiddlewares;
|
|
126
|
-
|
|
127
|
-
/** Whether to render dropdown in a portal @default `true` */
|
|
128
|
-
withinPortal?: boolean;
|
|
129
|
-
|
|
130
|
-
/** Whether to close on click outside @default `true` */
|
|
131
|
-
closeOnClickOutside?: boolean;
|
|
132
|
-
|
|
133
|
-
/** Whether to close on Escape key @default `true` */
|
|
134
|
-
closeOnEscape?: boolean;
|
|
135
|
-
|
|
136
|
-
/** Transition props for dropdown, uses Transition internally */
|
|
137
|
-
transitionProps?: Omit<TransitionProps, "children" | "mounted">;
|
|
138
|
-
|
|
139
|
-
/** Used for styling the core Input field parts. */
|
|
140
|
-
inputClassNames?: InputFieldClassNames;
|
|
141
|
-
|
|
142
|
-
/** Used for styling DateInput parts. */
|
|
143
|
-
classNames?: DateInputClassNames;
|
|
144
|
-
}
|
|
145
|
-
|
|
146
|
-
export type DateInputProps = _DateInputProps &
|
|
147
|
-
Omit<
|
|
148
|
-
InputProps,
|
|
149
|
-
"value" | "defaultValue" | "onChange" | "readOnly" | "classNames"
|
|
150
|
-
>;
|
|
151
|
-
|
|
152
|
-
export interface DateInputFactoryPayload extends FactoryPayload {
|
|
153
|
-
props: DateInputProps;
|
|
154
|
-
ref: HTMLInputElement;
|
|
155
|
-
compound: {
|
|
156
|
-
configure: ReturnType<typeof createComponentConfig<DateInputProps>>;
|
|
157
|
-
classNames: ReturnType<
|
|
158
|
-
typeof createClassNamesConfig<DateInputClassNames>
|
|
159
|
-
>;
|
|
160
|
-
};
|
|
161
|
-
}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
export { default as DateInput } from "./date-input";
|
|
2
|
-
export type {
|
|
3
|
-
DateInputClassNames,
|
|
4
|
-
DateInputFactoryPayload,
|
|
5
|
-
DateInputMiddlewares,
|
|
6
|
-
DateInputOnChange,
|
|
7
|
-
DateInputPositioning,
|
|
8
|
-
DateInputProps,
|
|
9
|
-
DateInputRadius,
|
|
10
|
-
DateInputSize,
|
|
11
|
-
DateInputValue,
|
|
12
|
-
DateInputValueFormat
|
|
13
|
-
} from "./date-input.types";
|