@viasat/beam-react 2.53.0 → 2.54.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +10 -0
- package/assets/DateField.css +1 -1
- package/lib/wip/DateField/DateField.Segments.cjs.js +1 -1
- package/lib/wip/DateField/DateField.Segments.d.ts +4 -3
- package/lib/wip/DateField/DateField.Segments.es.js +39 -45
- package/lib/wip/DateField/DateField.cjs.js +1 -1
- package/lib/wip/DateField/DateField.es.js +175 -170
- package/lib/wip/DateField/DateField.types.d.ts +8 -1
- package/lib/wip/DateField/DateField.utils.cjs.js +1 -1
- package/lib/wip/DateField/DateField.utils.d.ts +15 -0
- package/lib/wip/DateField/DateField.utils.es.js +120 -77
- package/lib/wip/DateField/useDateFieldFocus.d.ts +1 -1
- package/lib/wip/DateField/useDateFieldKeyboard.d.ts +2 -2
- package/package.json +7 -7
package/CHANGELOG.md
CHANGED
package/assets/DateField.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
:root,:host,.bm-light,.bm-dark .bm-inverse,.bm-dark.bm-inverse,[data-bm-theme~=bm-dark] .bm-inverse,[data-bm-theme~=bm-dark].bm-inverse,.bm-enterprise,.bm-consumer,[data-bm-theme~=bm-light]{--bm-comp-input-color-bg:var(--bm-sem-color-surface-01,#fff);--bm-comp-input-color-bg-disabled:var(--bm-sem-color-surface-highlight,#9fafbc29);--bm-comp-input-color-border:var(--bm-sem-color-border-strong,#8697a5);--bm-comp-input-color-border-error:var(--bm-sem-color-border-negative-strong,#cc2429);--bm-comp-input-color-border-disabled:#8697a566;--bm-comp-input-color-text:var(--bm-sem-color-text-primary,#141d24);--bm-comp-input-color-text-placeholder:var(--bm-sem-color-text-secondary,#576775);--bm-comp-input-color-text-disabled:var(--bm-sem-color-text-disabled,#57677566);--bm-comp-input-color-icon-disabled:var(--bm-sem-color-text-disabled,#57677566);--bm-comp-input-color-icon:var(--bm-sem-color-icon-secondary,#576775);--bm-comp-input-color-icon-error:var(--bm-sem-color-icon-negative-strong,#cc2429);--bm-comp-input-color-divider:var(--bm-sem-color-border-02,#d1dae0);--bm-comp-input-color-choice-checkbox-selected-bg:var(--bm-alias-color-brand-primary-default,#00768f);--bm-comp-input-color-choice-checkbox-selected-icon:var(--bm-sem-color-icon-primary-inverse,#fff);--bm-comp-input-color-choice-checkbox-selected-bg-error:var(--bm-sem-color-surface-negative-strong,#cc2429);--bm-comp-input-color-choice-checkbox-selected-border:var(--bm-sem-color-none,#fff0);--bm-comp-input-color-choice-switch-selected-bg:var(--bm-alias-color-brand-primary-default,#00768f);--bm-comp-input-color-choice-switch-selected-icon:var(--bm-sem-color-icon-primary-inverse,#fff);--bm-comp-input-color-choice-switch-selected-border:var(--bm-sem-color-none,#fff0);--bm-comp-input-color-choice-radio-selected-bg:var(--bm-sem-color-surface-01,#fff);--bm-comp-input-color-choice-radio-selected-border:var(--bm-alias-color-brand-primary-default,#00768f);--bm-comp-input-color-choice-radio-selected-inner-circle:var(--bm-alias-color-brand-primary-default,#00768f);--bm-comp-input-color-choice-radio-selected-bg-error:var(--bm-sem-color-surface-01,#fff);--bm-comp-input-color-choice-radio-selected-border-error:var(--bm-sem-color-surface-negative-strong,#cc2429);--bm-comp-input-color-choice-radio-selected-inner-circle-error:var(--bm-sem-color-surface-negative-strong,#cc2429);--bm-comp-input-typo-sm:var(--bm-sem-typo-compact-body-sm,400 .875rem/1rem "Source Sans Pro");--bm-comp-input-typo-md:var(--bm-sem-typo-compact-body-md,400 1rem/1.25rem "Source Sans Pro");--bm-comp-input-typo-lg:var(--bm-sem-typo-compact-body-md,400 1rem/1.25rem "Source Sans Pro");--bm-comp-input-typo-character-count:var(--bm-sem-typo-body-sm,400 .875rem/1.25rem "Source Sans Pro");--bm-comp-input-typo-label-choice:var(--bm-sem-typo-body-md,400 1rem/1.5rem "Source Sans Pro");--bm-comp-input-space-field-x-sm:var(--bm-sem-space-75,.75rem);--bm-comp-input-space-field-x-md:var(--bm-sem-space-100,1rem);--bm-comp-input-space-field-x-lg:var(--bm-sem-space-125,1.25rem);--bm-comp-input-space-field-y-sm:var(--bm-sem-space-25,.25rem);--bm-comp-input-space-field-y-md:var(--bm-sem-space-50,.5rem);--bm-comp-input-space-field-y-lg:var(--bm-sem-space-75,.75rem);--bm-comp-input-space-field-gap:var(--bm-sem-space-50,.5rem);--bm-comp-input-space-choice-gap-inside:var(--bm-sem-space-50,.5rem);--bm-comp-input-space-choice-gap-items-y:var(--bm-sem-space-50,.5rem);--bm-comp-input-space-choice-gap-items-x:var(--bm-sem-space-100,1rem);--bm-comp-input-space-choice-nudge:var(--bm-primitive-dimension-12,.125rem);--bm-comp-input-size-field-height-sm:var(--bm-sem-size-height-sm,2rem);--bm-comp-input-size-field-height-md:var(--bm-sem-size-height-md,2.5rem);--bm-comp-input-size-field-height-lg:var(--bm-sem-size-height-lg,3rem);--bm-comp-input-size-field-width:var(--bm-primitive-dimension-1800,18rem);--bm-comp-input-size-field-icon-sm:var(--bm-sem-size-icon-sm,1rem);--bm-comp-input-size-field-icon-md:var(--bm-sem-size-icon-md,1.25rem);--bm-comp-input-size-field-icon-lg:var(--bm-sem-size-icon-md,1.25rem);--bm-comp-input-size-field-text-area-height:var(--bm-primitive-dimension-475,4.75rem);--bm-comp-input-size-choice-checkbox:var(--bm-sem-size-icon-sm,1rem);--bm-comp-input-size-choice-radio:var(--bm-sem-size-icon-sm,1rem);--bm-comp-input-size-choice-radio-inside:var(--bm-primitive-dimension-50,.5rem);--bm-comp-input-size-choice-switch-height:var(--bm-sem-size-icon-md,1.25rem);--bm-comp-input-size-choice-switch-width:var(--bm-primitive-dimension-250,2.5rem);--bm-comp-input-size-choice-switch-knob:var(--bm-primitive-dimension-87,.875rem);--bm-comp-input-radius-field:var(--bm-sem-radius-input-md,.25rem);--bm-comp-input-radius-choice-checkbox:var(--bm-sem-radius-input-sm,.125rem);--bm-comp-input-radius-choice-radio:var(--bm-sem-radius-input-lg,624.938rem);--bm-comp-input-radius-choice-switch:var(--bm-sem-radius-input-lg,624.938rem);--bm-comp-input-border-width-field-default:var(--bm-sem-border-width-input,.063rem);--bm-comp-input-border-width-field-error:var(--bm-sem-border-width-lg,.125rem);--bm-comp-input-border-width-choice:var(--bm-sem-border-width-input,.063rem);--bm-comp-input-shadow-field:var(--bm-sem-shadow-none,0 0 0 0 #0000)}:host,.bm-dark,.bm-light .bm-inverse,.bm-light.bm-inverse,[data-bm-theme~=bm-light] .bm-inverse,[data-bm-theme~=bm-light].bm-inverse,.bm-enterprise,.bm-consumer,[data-bm-theme~=bm-dark]{--bm-comp-input-color-bg:var(--bm-sem-color-surface-01,#202e39);--bm-comp-input-color-bg-disabled:var(--bm-sem-color-surface-highlight,#8697a529);--bm-comp-input-color-border:var(--bm-sem-color-border-strong,#9fafbc);--bm-comp-input-color-border-error:var(--bm-sem-color-border-negative-strong,#f67378);--bm-comp-input-color-border-disabled:#9fafbc66;--bm-comp-input-color-text:var(--bm-sem-color-text-primary,#fff);--bm-comp-input-color-text-placeholder:var(--bm-sem-color-text-secondary,#c3cdd5);--bm-comp-input-color-text-disabled:var(--bm-sem-color-text-disabled,#c3cdd566);--bm-comp-input-color-icon-disabled:var(--bm-sem-color-text-disabled,#c3cdd566);--bm-comp-input-color-icon:var(--bm-sem-color-icon-secondary,#c3cdd5);--bm-comp-input-color-icon-error:var(--bm-sem-color-icon-negative-strong,#f67378);--bm-comp-input-color-divider:var(--bm-sem-color-border-02,#465967);--bm-comp-input-color-choice-checkbox-selected-bg:var(--bm-alias-color-brand-primary-default,#43bfd6);--bm-comp-input-color-choice-checkbox-selected-icon:var(--bm-sem-color-icon-primary-inverse,#141d24);--bm-comp-input-color-choice-checkbox-selected-bg-error:var(--bm-sem-color-surface-negative-strong,#f67378);--bm-comp-input-color-choice-checkbox-selected-border:var(--bm-sem-color-none,#fff0);--bm-comp-input-color-choice-switch-selected-bg:var(--bm-alias-color-brand-primary-default,#43bfd6);--bm-comp-input-color-choice-switch-selected-icon:var(--bm-sem-color-icon-primary-inverse,#141d24);--bm-comp-input-color-choice-switch-selected-border:var(--bm-sem-color-none,#fff0);--bm-comp-input-color-choice-radio-selected-bg:var(--bm-sem-color-surface-01,#202e39);--bm-comp-input-color-choice-radio-selected-border:var(--bm-alias-color-brand-primary-default,#43bfd6);--bm-comp-input-color-choice-radio-selected-inner-circle:var(--bm-alias-color-brand-primary-default,#43bfd6);--bm-comp-input-color-choice-radio-selected-bg-error:var(--bm-sem-color-surface-01,#202e39);--bm-comp-input-color-choice-radio-selected-border-error:var(--bm-sem-color-surface-negative-strong,#f67378);--bm-comp-input-color-choice-radio-selected-inner-circle-error:var(--bm-sem-color-surface-negative-strong,#f67378);--bm-comp-input-typo-sm:var(--bm-sem-typo-compact-body-sm,400 .875rem/1rem "Source Sans Pro");--bm-comp-input-typo-md:var(--bm-sem-typo-compact-body-md,400 1rem/1.25rem "Source Sans Pro");--bm-comp-input-typo-lg:var(--bm-sem-typo-compact-body-md,400 1rem/1.25rem "Source Sans Pro");--bm-comp-input-typo-character-count:var(--bm-sem-typo-body-sm,400 .875rem/1.25rem "Source Sans Pro");--bm-comp-input-typo-label-choice:var(--bm-sem-typo-body-md,400 1rem/1.5rem "Source Sans Pro");--bm-comp-input-space-field-x-sm:var(--bm-sem-space-75,.75rem);--bm-comp-input-space-field-x-md:var(--bm-sem-space-100,1rem);--bm-comp-input-space-field-x-lg:var(--bm-sem-space-125,1.25rem);--bm-comp-input-space-field-y-sm:var(--bm-sem-space-25,.25rem);--bm-comp-input-space-field-y-md:var(--bm-sem-space-50,.5rem);--bm-comp-input-space-field-y-lg:var(--bm-sem-space-75,.75rem);--bm-comp-input-space-field-gap:var(--bm-sem-space-50,.5rem);--bm-comp-input-space-choice-gap-inside:var(--bm-sem-space-50,.5rem);--bm-comp-input-space-choice-gap-items-y:var(--bm-sem-space-50,.5rem);--bm-comp-input-space-choice-gap-items-x:var(--bm-sem-space-100,1rem);--bm-comp-input-space-choice-nudge:var(--bm-primitive-dimension-12,.125rem);--bm-comp-input-size-field-height-sm:var(--bm-sem-size-height-sm,2rem);--bm-comp-input-size-field-height-md:var(--bm-sem-size-height-md,2.5rem);--bm-comp-input-size-field-height-lg:var(--bm-sem-size-height-lg,3rem);--bm-comp-input-size-field-width:var(--bm-primitive-dimension-1800,18rem);--bm-comp-input-size-field-icon-sm:var(--bm-sem-size-icon-sm,1rem);--bm-comp-input-size-field-icon-md:var(--bm-sem-size-icon-md,1.25rem);--bm-comp-input-size-field-icon-lg:var(--bm-sem-size-icon-md,1.25rem);--bm-comp-input-size-field-text-area-height:var(--bm-primitive-dimension-475,4.75rem);--bm-comp-input-size-choice-checkbox:var(--bm-sem-size-icon-sm,1rem);--bm-comp-input-size-choice-radio:var(--bm-sem-size-icon-sm,1rem);--bm-comp-input-size-choice-radio-inside:var(--bm-primitive-dimension-50,.5rem);--bm-comp-input-size-choice-switch-height:var(--bm-sem-size-icon-md,1.25rem);--bm-comp-input-size-choice-switch-width:var(--bm-primitive-dimension-250,2.5rem);--bm-comp-input-size-choice-switch-knob:var(--bm-primitive-dimension-87,.875rem);--bm-comp-input-radius-field:var(--bm-sem-radius-input-md,.25rem);--bm-comp-input-radius-choice-checkbox:var(--bm-sem-radius-input-sm,.125rem);--bm-comp-input-radius-choice-radio:var(--bm-sem-radius-input-lg,624.938rem);--bm-comp-input-radius-choice-switch:var(--bm-sem-radius-input-lg,624.938rem);--bm-comp-input-border-width-field-default:var(--bm-sem-border-width-input,.063rem);--bm-comp-input-border-width-field-error:var(--bm-sem-border-width-lg,.125rem);--bm-comp-input-border-width-choice:var(--bm-sem-border-width-input,.063rem);--bm-comp-input-shadow-field:var(--bm-sem-shadow-none,0 0 0 0 #0000)}.bm-date-field{--bm-label-cursor:pointer;max-width:var(--bm-comp-input-size-field-width);--bm-label-space-bottom:var(--bm-comp-label-space-bottom);--bm-helper-text-space-top:var(--bm-comp-helper-text-space-top)}.bm-date-field--disabled{--bm-label-cursor:not-allowed;--bm-label-pointer-events:auto;--bm-text-field-cursor:not-allowed;--bm-text-field-input-cursor:not-allowed}.bm-date-field--error .bm-date-field__field{border-color:var(--bm-comp-input-color-border-error);background-color:var(--bm-comp-input-color-bg);outline-offset:calc(0px - var(--bm-comp-input-border-width-field-error));outline:var(--bm-comp-input-border-width-field-error)solid var(--bm-comp-input-color-border-error)}.bm-date-field--error .bm-date-field__field .bm-date-field__segment{color:var(--bm-comp-input-color-text)}.bm-date-field--error .bm-date-field__field .bm-date-field__segment[data-placeholder=true]{color:var(--bm-comp-input-color-text-placeholder)}.bm-date-field--read-only .bm-date-field__field{border-color:var(--bm-comp-input-color-border-disabled);background-color:var(--bm-comp-input-color-bg-disabled)}.bm-date-field--read-only .bm-date-field__field .bm-date-field__segment{color:var(--bm-comp-input-color-text)}.bm-date-field--read-only .bm-date-field__field .bm-date-field__segment[data-placeholder=true]{color:var(--bm-comp-input-color-text-placeholder)}.bm-date-field--disabled .bm-date-field__field{border-color:var(--bm-comp-input-color-border-disabled);background-color:var(--bm-comp-input-color-bg-disabled)}.bm-date-field--disabled .bm-date-field__field .bm-date-field__segment,.bm-date-field--disabled .bm-date-field__field .bm-date-field__segment[data-placeholder=true]{color:var(--bm-comp-input-color-text-disabled)}.bm-date-field--fluid{max-width:100%}.bm-date-field__field{box-sizing:border-box;border-style:solid;border-color:var(--bm-comp-input-color-border);border-radius:var(--bm-comp-input-radius-field);border-width:var(--bm-comp-input-border-width-field-default);align-items:center;gap:var(--bm-comp-input-space-field-gap);box-shadow:var(--bm-comp-input-shadow-field);background-color:var(--bm-comp-input-color-bg);height:var(--bm-comp-input-size-field-height-md);padding-block:var(--bm-comp-input-space-field-y-md);padding-inline:var(--bm-comp-input-space-field-x-md);flex-wrap:nowrap;display:flex;position:relative}.bm-date-field__field:focus-within{outline-offset:calc(0px - var(--bm-sem-size-focus-offset));outline:var(--bm-sem-border-width-focus)solid var(--bm-sem-color-border-focus)}.bm-date-field__field .bm-date-field__segments{color:var(--bm-comp-input-color-text);font:var(--bm-comp-input-typo-md);font-variant-numeric:tabular-nums;align-items:baseline;gap:var(--bm-sem-space-12);display:inline-flex}.bm-date-field__field .bm-date-field__segment{box-sizing:border-box;text-align:center;border-bottom:var(--bm-sem-border-width-focus)solid transparent;outline:none;min-inline-size:2ch;display:inline-block}.bm-date-field__field .bm-date-field__segment[data-segment=year]{min-inline-size:4ch}.bm-date-field__field .bm-date-field__segment[data-placeholder=true]{color:var(--bm-comp-input-color-text-placeholder)}.bm-date-field__field .bm-date-field__segment[data-active=true]{border-bottom-color:var(--bm-sem-color-border-focus)}.bm-date-field__field .bm-date-field__segment:focus-visible{border-bottom-color:var(--bm-sem-color-border-focus)}.bm-date-field__field .bm-date-field__segment::selection{background-color:var(--bm-sem-color-surface-info-primary)}.bm-date-field__field .bm-date-field__separator{color:var(--bm-comp-input-color-text);font:var(--bm-comp-input-typo-md);-webkit-user-select:none;user-select:none}.bm-date-field__sr-status{clip:rect(0,0,0,0);border:0;width:1px;height:1px;margin:-1px;padding:0;position:absolute;overflow:hidden}
|
|
1
|
+
:root,:host,.bm-light,.bm-dark .bm-inverse,.bm-dark.bm-inverse,[data-bm-theme~=bm-dark] .bm-inverse,[data-bm-theme~=bm-dark].bm-inverse,.bm-enterprise,.bm-consumer,[data-bm-theme~=bm-light]{--bm-comp-input-color-bg:var(--bm-sem-color-surface-01,#fff);--bm-comp-input-color-bg-disabled:var(--bm-sem-color-surface-highlight,#9fafbc29);--bm-comp-input-color-border:var(--bm-sem-color-border-strong,#8697a5);--bm-comp-input-color-border-error:var(--bm-sem-color-border-negative-strong,#cc2429);--bm-comp-input-color-border-disabled:#8697a566;--bm-comp-input-color-text:var(--bm-sem-color-text-primary,#141d24);--bm-comp-input-color-text-placeholder:var(--bm-sem-color-text-secondary,#576775);--bm-comp-input-color-text-disabled:var(--bm-sem-color-text-disabled,#57677566);--bm-comp-input-color-icon-disabled:var(--bm-sem-color-text-disabled,#57677566);--bm-comp-input-color-icon:var(--bm-sem-color-icon-secondary,#576775);--bm-comp-input-color-icon-error:var(--bm-sem-color-icon-negative-strong,#cc2429);--bm-comp-input-color-divider:var(--bm-sem-color-border-02,#d1dae0);--bm-comp-input-color-choice-checkbox-selected-bg:var(--bm-alias-color-brand-primary-default,#00768f);--bm-comp-input-color-choice-checkbox-selected-icon:var(--bm-sem-color-icon-primary-inverse,#fff);--bm-comp-input-color-choice-checkbox-selected-bg-error:var(--bm-sem-color-surface-negative-strong,#cc2429);--bm-comp-input-color-choice-checkbox-selected-border:var(--bm-sem-color-none,#fff0);--bm-comp-input-color-choice-switch-selected-bg:var(--bm-alias-color-brand-primary-default,#00768f);--bm-comp-input-color-choice-switch-selected-icon:var(--bm-sem-color-icon-primary-inverse,#fff);--bm-comp-input-color-choice-switch-selected-border:var(--bm-sem-color-none,#fff0);--bm-comp-input-color-choice-radio-selected-bg:var(--bm-sem-color-surface-01,#fff);--bm-comp-input-color-choice-radio-selected-border:var(--bm-alias-color-brand-primary-default,#00768f);--bm-comp-input-color-choice-radio-selected-inner-circle:var(--bm-alias-color-brand-primary-default,#00768f);--bm-comp-input-color-choice-radio-selected-bg-error:var(--bm-sem-color-surface-01,#fff);--bm-comp-input-color-choice-radio-selected-border-error:var(--bm-sem-color-surface-negative-strong,#cc2429);--bm-comp-input-color-choice-radio-selected-inner-circle-error:var(--bm-sem-color-surface-negative-strong,#cc2429);--bm-comp-input-typo-sm:var(--bm-sem-typo-compact-body-sm,400 .875rem/1rem "Source Sans Pro");--bm-comp-input-typo-md:var(--bm-sem-typo-compact-body-md,400 1rem/1.25rem "Source Sans Pro");--bm-comp-input-typo-lg:var(--bm-sem-typo-compact-body-md,400 1rem/1.25rem "Source Sans Pro");--bm-comp-input-typo-character-count:var(--bm-sem-typo-body-sm,400 .875rem/1.25rem "Source Sans Pro");--bm-comp-input-typo-label-choice:var(--bm-sem-typo-body-md,400 1rem/1.5rem "Source Sans Pro");--bm-comp-input-space-field-x-sm:var(--bm-sem-space-75,.75rem);--bm-comp-input-space-field-x-md:var(--bm-sem-space-100,1rem);--bm-comp-input-space-field-x-lg:var(--bm-sem-space-125,1.25rem);--bm-comp-input-space-field-y-sm:var(--bm-sem-space-25,.25rem);--bm-comp-input-space-field-y-md:var(--bm-sem-space-50,.5rem);--bm-comp-input-space-field-y-lg:var(--bm-sem-space-75,.75rem);--bm-comp-input-space-field-gap:var(--bm-sem-space-50,.5rem);--bm-comp-input-space-choice-gap-inside:var(--bm-sem-space-50,.5rem);--bm-comp-input-space-choice-gap-items-y:var(--bm-sem-space-50,.5rem);--bm-comp-input-space-choice-gap-items-x:var(--bm-sem-space-100,1rem);--bm-comp-input-space-choice-nudge:var(--bm-primitive-dimension-12,.125rem);--bm-comp-input-size-field-height-sm:var(--bm-sem-size-height-sm,2rem);--bm-comp-input-size-field-height-md:var(--bm-sem-size-height-md,2.5rem);--bm-comp-input-size-field-height-lg:var(--bm-sem-size-height-lg,3rem);--bm-comp-input-size-field-width:var(--bm-primitive-dimension-1800,18rem);--bm-comp-input-size-field-icon-sm:var(--bm-sem-size-icon-sm,1rem);--bm-comp-input-size-field-icon-md:var(--bm-sem-size-icon-md,1.25rem);--bm-comp-input-size-field-icon-lg:var(--bm-sem-size-icon-md,1.25rem);--bm-comp-input-size-field-text-area-height:var(--bm-primitive-dimension-475,4.75rem);--bm-comp-input-size-choice-checkbox:var(--bm-sem-size-icon-sm,1rem);--bm-comp-input-size-choice-radio:var(--bm-sem-size-icon-sm,1rem);--bm-comp-input-size-choice-radio-inside:var(--bm-primitive-dimension-50,.5rem);--bm-comp-input-size-choice-switch-height:var(--bm-sem-size-icon-md,1.25rem);--bm-comp-input-size-choice-switch-width:var(--bm-primitive-dimension-250,2.5rem);--bm-comp-input-size-choice-switch-knob:var(--bm-primitive-dimension-87,.875rem);--bm-comp-input-radius-field:var(--bm-sem-radius-input-md,.25rem);--bm-comp-input-radius-choice-checkbox:var(--bm-sem-radius-input-sm,.125rem);--bm-comp-input-radius-choice-radio:var(--bm-sem-radius-input-lg,624.938rem);--bm-comp-input-radius-choice-switch:var(--bm-sem-radius-input-lg,624.938rem);--bm-comp-input-border-width-field-default:var(--bm-sem-border-width-input,.063rem);--bm-comp-input-border-width-field-error:var(--bm-sem-border-width-lg,.125rem);--bm-comp-input-border-width-choice:var(--bm-sem-border-width-input,.063rem);--bm-comp-input-shadow-field:var(--bm-sem-shadow-none,0 0 0 0 #0000)}:host,.bm-dark,.bm-light .bm-inverse,.bm-light.bm-inverse,[data-bm-theme~=bm-light] .bm-inverse,[data-bm-theme~=bm-light].bm-inverse,.bm-enterprise,.bm-consumer,[data-bm-theme~=bm-dark]{--bm-comp-input-color-bg:var(--bm-sem-color-surface-01,#202e39);--bm-comp-input-color-bg-disabled:var(--bm-sem-color-surface-highlight,#8697a529);--bm-comp-input-color-border:var(--bm-sem-color-border-strong,#9fafbc);--bm-comp-input-color-border-error:var(--bm-sem-color-border-negative-strong,#f67378);--bm-comp-input-color-border-disabled:#9fafbc66;--bm-comp-input-color-text:var(--bm-sem-color-text-primary,#fff);--bm-comp-input-color-text-placeholder:var(--bm-sem-color-text-secondary,#c3cdd5);--bm-comp-input-color-text-disabled:var(--bm-sem-color-text-disabled,#c3cdd566);--bm-comp-input-color-icon-disabled:var(--bm-sem-color-text-disabled,#c3cdd566);--bm-comp-input-color-icon:var(--bm-sem-color-icon-secondary,#c3cdd5);--bm-comp-input-color-icon-error:var(--bm-sem-color-icon-negative-strong,#f67378);--bm-comp-input-color-divider:var(--bm-sem-color-border-02,#465967);--bm-comp-input-color-choice-checkbox-selected-bg:var(--bm-alias-color-brand-primary-default,#43bfd6);--bm-comp-input-color-choice-checkbox-selected-icon:var(--bm-sem-color-icon-primary-inverse,#141d24);--bm-comp-input-color-choice-checkbox-selected-bg-error:var(--bm-sem-color-surface-negative-strong,#f67378);--bm-comp-input-color-choice-checkbox-selected-border:var(--bm-sem-color-none,#fff0);--bm-comp-input-color-choice-switch-selected-bg:var(--bm-alias-color-brand-primary-default,#43bfd6);--bm-comp-input-color-choice-switch-selected-icon:var(--bm-sem-color-icon-primary-inverse,#141d24);--bm-comp-input-color-choice-switch-selected-border:var(--bm-sem-color-none,#fff0);--bm-comp-input-color-choice-radio-selected-bg:var(--bm-sem-color-surface-01,#202e39);--bm-comp-input-color-choice-radio-selected-border:var(--bm-alias-color-brand-primary-default,#43bfd6);--bm-comp-input-color-choice-radio-selected-inner-circle:var(--bm-alias-color-brand-primary-default,#43bfd6);--bm-comp-input-color-choice-radio-selected-bg-error:var(--bm-sem-color-surface-01,#202e39);--bm-comp-input-color-choice-radio-selected-border-error:var(--bm-sem-color-surface-negative-strong,#f67378);--bm-comp-input-color-choice-radio-selected-inner-circle-error:var(--bm-sem-color-surface-negative-strong,#f67378);--bm-comp-input-typo-sm:var(--bm-sem-typo-compact-body-sm,400 .875rem/1rem "Source Sans Pro");--bm-comp-input-typo-md:var(--bm-sem-typo-compact-body-md,400 1rem/1.25rem "Source Sans Pro");--bm-comp-input-typo-lg:var(--bm-sem-typo-compact-body-md,400 1rem/1.25rem "Source Sans Pro");--bm-comp-input-typo-character-count:var(--bm-sem-typo-body-sm,400 .875rem/1.25rem "Source Sans Pro");--bm-comp-input-typo-label-choice:var(--bm-sem-typo-body-md,400 1rem/1.5rem "Source Sans Pro");--bm-comp-input-space-field-x-sm:var(--bm-sem-space-75,.75rem);--bm-comp-input-space-field-x-md:var(--bm-sem-space-100,1rem);--bm-comp-input-space-field-x-lg:var(--bm-sem-space-125,1.25rem);--bm-comp-input-space-field-y-sm:var(--bm-sem-space-25,.25rem);--bm-comp-input-space-field-y-md:var(--bm-sem-space-50,.5rem);--bm-comp-input-space-field-y-lg:var(--bm-sem-space-75,.75rem);--bm-comp-input-space-field-gap:var(--bm-sem-space-50,.5rem);--bm-comp-input-space-choice-gap-inside:var(--bm-sem-space-50,.5rem);--bm-comp-input-space-choice-gap-items-y:var(--bm-sem-space-50,.5rem);--bm-comp-input-space-choice-gap-items-x:var(--bm-sem-space-100,1rem);--bm-comp-input-space-choice-nudge:var(--bm-primitive-dimension-12,.125rem);--bm-comp-input-size-field-height-sm:var(--bm-sem-size-height-sm,2rem);--bm-comp-input-size-field-height-md:var(--bm-sem-size-height-md,2.5rem);--bm-comp-input-size-field-height-lg:var(--bm-sem-size-height-lg,3rem);--bm-comp-input-size-field-width:var(--bm-primitive-dimension-1800,18rem);--bm-comp-input-size-field-icon-sm:var(--bm-sem-size-icon-sm,1rem);--bm-comp-input-size-field-icon-md:var(--bm-sem-size-icon-md,1.25rem);--bm-comp-input-size-field-icon-lg:var(--bm-sem-size-icon-md,1.25rem);--bm-comp-input-size-field-text-area-height:var(--bm-primitive-dimension-475,4.75rem);--bm-comp-input-size-choice-checkbox:var(--bm-sem-size-icon-sm,1rem);--bm-comp-input-size-choice-radio:var(--bm-sem-size-icon-sm,1rem);--bm-comp-input-size-choice-radio-inside:var(--bm-primitive-dimension-50,.5rem);--bm-comp-input-size-choice-switch-height:var(--bm-sem-size-icon-md,1.25rem);--bm-comp-input-size-choice-switch-width:var(--bm-primitive-dimension-250,2.5rem);--bm-comp-input-size-choice-switch-knob:var(--bm-primitive-dimension-87,.875rem);--bm-comp-input-radius-field:var(--bm-sem-radius-input-md,.25rem);--bm-comp-input-radius-choice-checkbox:var(--bm-sem-radius-input-sm,.125rem);--bm-comp-input-radius-choice-radio:var(--bm-sem-radius-input-lg,624.938rem);--bm-comp-input-radius-choice-switch:var(--bm-sem-radius-input-lg,624.938rem);--bm-comp-input-border-width-field-default:var(--bm-sem-border-width-input,.063rem);--bm-comp-input-border-width-field-error:var(--bm-sem-border-width-lg,.125rem);--bm-comp-input-border-width-choice:var(--bm-sem-border-width-input,.063rem);--bm-comp-input-shadow-field:var(--bm-sem-shadow-none,0 0 0 0 #0000)}.bm-date-field{--bm-label-cursor:pointer;max-width:var(--bm-comp-input-size-field-width);--bm-label-space-bottom:var(--bm-comp-label-space-bottom);--bm-helper-text-space-top:var(--bm-comp-helper-text-space-top)}.bm-date-field--disabled{--bm-label-cursor:not-allowed;--bm-label-pointer-events:auto;--bm-text-field-cursor:not-allowed;--bm-text-field-input-cursor:not-allowed}.bm-date-field--error .bm-date-field__field{border-color:var(--bm-comp-input-color-border-error);background-color:var(--bm-comp-input-color-bg);outline-offset:calc(0px - var(--bm-comp-input-border-width-field-error));outline:var(--bm-comp-input-border-width-field-error)solid var(--bm-comp-input-color-border-error)}.bm-date-field--error .bm-date-field__field .bm-date-field__segment{color:var(--bm-comp-input-color-text)}.bm-date-field--error .bm-date-field__field .bm-date-field__segment[data-placeholder=true]{color:var(--bm-comp-input-color-text-placeholder)}.bm-date-field--read-only .bm-date-field__field{border-color:var(--bm-comp-input-color-border-disabled);background-color:var(--bm-comp-input-color-bg-disabled)}.bm-date-field--read-only .bm-date-field__field .bm-date-field__segment{color:var(--bm-comp-input-color-text)}.bm-date-field--read-only .bm-date-field__field .bm-date-field__segment[data-placeholder=true]{color:var(--bm-comp-input-color-text-placeholder)}.bm-date-field--disabled .bm-date-field__field{border-color:var(--bm-comp-input-color-border-disabled);background-color:var(--bm-comp-input-color-bg-disabled)}.bm-date-field--disabled .bm-date-field__field .bm-date-field__segment,.bm-date-field--disabled .bm-date-field__field .bm-date-field__segment[data-placeholder=true]{color:var(--bm-comp-input-color-text-disabled)}.bm-date-field--fluid{max-width:100%}.bm-date-field__field{box-sizing:border-box;border-style:solid;border-color:var(--bm-comp-input-color-border);border-radius:var(--bm-comp-input-radius-field);border-width:var(--bm-comp-input-border-width-field-default);align-items:center;gap:var(--bm-comp-input-space-field-gap);box-shadow:var(--bm-comp-input-shadow-field);background-color:var(--bm-comp-input-color-bg);height:var(--bm-comp-input-size-field-height-md);padding-block:var(--bm-comp-input-space-field-y-md);padding-inline:var(--bm-comp-input-space-field-x-md);flex-wrap:nowrap;display:flex;position:relative}.bm-date-field__field:focus-within{outline-offset:calc(0px - var(--bm-sem-size-focus-offset));outline:var(--bm-sem-border-width-focus)solid var(--bm-sem-color-border-focus)}.bm-date-field__field .bm-date-field__segments{color:var(--bm-comp-input-color-text);font:var(--bm-comp-input-typo-md);font-variant-numeric:tabular-nums;align-items:baseline;gap:var(--bm-sem-space-12);display:inline-flex}.bm-date-field__field .bm-date-field__segment{box-sizing:border-box;text-align:center;border-block:var(--bm-sem-border-width-focus)solid transparent;outline:none;min-inline-size:2ch;display:inline-block}.bm-date-field__field .bm-date-field__segment[data-segment=year]{min-inline-size:4ch}.bm-date-field__field .bm-date-field__segment[data-placeholder=true]{color:var(--bm-comp-input-color-text-placeholder)}.bm-date-field__field .bm-date-field__segment[data-active=true]{border-bottom-color:var(--bm-sem-color-border-focus)}.bm-date-field__field .bm-date-field__segment:focus-visible{border-bottom-color:var(--bm-sem-color-border-focus)}.bm-date-field__field .bm-date-field__segment::selection{background-color:var(--bm-sem-color-surface-info-primary)}.bm-date-field__field .bm-date-field__separator{color:var(--bm-comp-input-color-text);font:var(--bm-comp-input-typo-md);-webkit-user-select:none;user-select:none}.bm-date-field__sr-status{clip:rect(0,0,0,0);border:0;width:1px;height:1px;margin:-1px;padding:0;position:absolute;overflow:hidden}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("react/jsx-runtime"),n=require("../../../chunks/DateField.Segment.CqFLhMYA.js"),t=require("./DateField.utils.cjs.js"),Y={month:"MM",day:"DD",year:"YYYY"},j=({parts:o,segmentText:r,segmentValues:a,focusedSegment:m,disabled:c,readOnly:d,invalid:u,role:y,onSegmentFocus:D,onSegmentBlur:h,onSegmentInput:p,onSegmentKeyDown:M,registerSegmentRef:x})=>{const _={day:{min:1,max:t.getDaysInMonth(a.year,a.month)},month:{min:1,max:t.MONTH_MAX},year:{min:t.YEAR_MIN,max:t.YEAR_MAX}};return i.jsx("span",{className:n.styles[n.staticDateFieldClassNames.segments],children:o.map((s,g)=>{if(s.type==="literal")return i.jsx("span",{"aria-hidden":"true",className:n.styles[n.staticDateFieldClassNames.separator],children:s.value},`literal-${g}`);const e=s.type,F=Y[e],{displayValue:l,isPlaceholder:S}=t.getSegmentDisplay(e,r[e],F),{min:v,max:N}=_[e],A=e==="month"&&a.month!=null?t.getMonthName(a.month):l;return i.jsx(n.DateFieldSegment,{type:e,value:a[e],valueMin:v,valueMax:N,displayValue:l,isPlaceholder:S,valueText:A,invalid:u,role:y,isActive:m===e,disabled:c,readOnly:d,onFocus:()=>D(e),onBlur:h,onInput:p,onKeyDown:M,segmentRef:x(e)},e)})})};exports.DateFieldSegments=j;
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { FocusEvent, KeyboardEvent } from 'react';
|
|
2
|
-
import { FocusTarget, SegmentRole, SegmentText, SegmentType, SegmentValues } from './DateField.types';
|
|
3
|
-
export declare const PARTS_ORDER: ReadonlyArray<SegmentType>;
|
|
2
|
+
import { DateFieldPart, FocusTarget, SegmentRole, SegmentText, SegmentType, SegmentValues } from './DateField.types';
|
|
4
3
|
export interface DateFieldSegmentsProps {
|
|
4
|
+
/** Locale-derived ordered parts (segments + literal separators) to render. */
|
|
5
|
+
parts: ReadonlyArray<DateFieldPart>;
|
|
5
6
|
/** Per-segment raw strings — the single source of truth for display. */
|
|
6
7
|
segmentText: SegmentText;
|
|
7
8
|
/** Derived per-segment numbers for `aria-valuenow`. */
|
|
@@ -23,4 +24,4 @@ export interface DateFieldSegmentsProps {
|
|
|
23
24
|
onSegmentKeyDown: (segment: SegmentType, event: KeyboardEvent<HTMLSpanElement>) => void;
|
|
24
25
|
registerSegmentRef: (segment: SegmentType) => (element: HTMLSpanElement | null) => void;
|
|
25
26
|
}
|
|
26
|
-
export declare const DateFieldSegments: ({ segmentText, segmentValues, focusedSegment, disabled, readOnly, invalid, role, onSegmentFocus, onSegmentBlur, onSegmentInput, onSegmentKeyDown, registerSegmentRef, }: DateFieldSegmentsProps) => import("react/jsx-runtime").JSX.Element;
|
|
27
|
+
export declare const DateFieldSegments: ({ parts, segmentText, segmentValues, focusedSegment, disabled, readOnly, invalid, role, onSegmentFocus, onSegmentBlur, onSegmentInput, onSegmentKeyDown, registerSegmentRef, }: DateFieldSegmentsProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,70 +1,65 @@
|
|
|
1
1
|
import { jsx as n } from "react/jsx-runtime";
|
|
2
|
-
import { s, a as
|
|
3
|
-
import {
|
|
4
|
-
const
|
|
5
|
-
{ type: "month", value: "" },
|
|
6
|
-
{ type: "literal", value: "/" },
|
|
7
|
-
{ type: "day", value: "" },
|
|
8
|
-
{ type: "literal", value: "/" },
|
|
9
|
-
{ type: "year", value: "" }
|
|
10
|
-
], B = {
|
|
2
|
+
import { s, a as m, D as F } from "../../../chunks/DateField.Segment.CwhRnhtq.js";
|
|
3
|
+
import { getDaysInMonth as R, getSegmentDisplay as S, YEAR_MAX as I, YEAR_MIN as T, MONTH_MAX as _, getMonthName as B } from "./DateField.utils.es.js";
|
|
4
|
+
const C = {
|
|
11
5
|
month: "MM",
|
|
12
6
|
day: "DD",
|
|
13
7
|
year: "YYYY"
|
|
14
|
-
},
|
|
15
|
-
|
|
8
|
+
}, X = ({
|
|
9
|
+
parts: r,
|
|
10
|
+
segmentText: i,
|
|
16
11
|
segmentValues: t,
|
|
17
|
-
focusedSegment:
|
|
18
|
-
disabled:
|
|
19
|
-
readOnly:
|
|
20
|
-
invalid:
|
|
21
|
-
role:
|
|
22
|
-
onSegmentFocus:
|
|
23
|
-
onSegmentBlur:
|
|
24
|
-
onSegmentInput:
|
|
25
|
-
onSegmentKeyDown:
|
|
12
|
+
focusedSegment: l,
|
|
13
|
+
disabled: c,
|
|
14
|
+
readOnly: y,
|
|
15
|
+
invalid: d,
|
|
16
|
+
role: p,
|
|
17
|
+
onSegmentFocus: h,
|
|
18
|
+
onSegmentBlur: M,
|
|
19
|
+
onSegmentInput: u,
|
|
20
|
+
onSegmentKeyDown: x,
|
|
26
21
|
registerSegmentRef: D
|
|
27
22
|
}) => {
|
|
28
|
-
const
|
|
29
|
-
day: { min: 1, max:
|
|
30
|
-
month: { min: 1, max:
|
|
31
|
-
year: { min:
|
|
23
|
+
const g = {
|
|
24
|
+
day: { min: 1, max: R(t.year, t.month) },
|
|
25
|
+
month: { min: 1, max: _ },
|
|
26
|
+
year: { min: T, max: I }
|
|
32
27
|
};
|
|
33
|
-
return /* @__PURE__ */ n("span", { className: s[
|
|
28
|
+
return /* @__PURE__ */ n("span", { className: s[m.segments], children: r.map((a, v) => {
|
|
34
29
|
if (a.type === "literal")
|
|
35
30
|
return /* @__PURE__ */ n(
|
|
36
31
|
"span",
|
|
37
32
|
{
|
|
38
33
|
"aria-hidden": "true",
|
|
39
|
-
className: s[
|
|
34
|
+
className: s[m.separator],
|
|
40
35
|
children: a.value
|
|
41
36
|
},
|
|
42
|
-
`literal-${
|
|
37
|
+
`literal-${v}`
|
|
43
38
|
);
|
|
44
|
-
const e = a.type, A =
|
|
39
|
+
const e = a.type, A = C[e], { displayValue: o, isPlaceholder: N } = S(
|
|
45
40
|
e,
|
|
46
|
-
|
|
41
|
+
i[e],
|
|
47
42
|
A
|
|
48
|
-
), { min:
|
|
43
|
+
), { min: Y, max: f } = g[e], E = e === "month" && t.month != null ? B(t.month) : o;
|
|
49
44
|
return /* @__PURE__ */ n(
|
|
50
|
-
|
|
45
|
+
F,
|
|
51
46
|
{
|
|
52
47
|
type: e,
|
|
53
48
|
value: t[e],
|
|
54
|
-
valueMin:
|
|
55
|
-
valueMax:
|
|
49
|
+
valueMin: Y,
|
|
50
|
+
valueMax: f,
|
|
56
51
|
displayValue: o,
|
|
57
|
-
isPlaceholder:
|
|
52
|
+
isPlaceholder: N,
|
|
58
53
|
valueText: E,
|
|
59
|
-
invalid:
|
|
60
|
-
role:
|
|
61
|
-
isActive:
|
|
62
|
-
disabled:
|
|
63
|
-
readOnly:
|
|
64
|
-
onFocus: () =>
|
|
65
|
-
onBlur:
|
|
66
|
-
onInput:
|
|
67
|
-
onKeyDown:
|
|
54
|
+
invalid: d,
|
|
55
|
+
role: p,
|
|
56
|
+
isActive: l === e,
|
|
57
|
+
disabled: c,
|
|
58
|
+
readOnly: y,
|
|
59
|
+
onFocus: () => h(e),
|
|
60
|
+
onBlur: M,
|
|
61
|
+
onInput: u,
|
|
62
|
+
onKeyDown: x,
|
|
68
63
|
segmentRef: D(e)
|
|
69
64
|
},
|
|
70
65
|
e
|
|
@@ -72,6 +67,5 @@ const m = [
|
|
|
72
67
|
}) });
|
|
73
68
|
};
|
|
74
69
|
export {
|
|
75
|
-
|
|
76
|
-
j as PARTS_ORDER
|
|
70
|
+
X as DateFieldSegments
|
|
77
71
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("react/jsx-runtime"),qe=require("clsx"),r=require("react"),e=require("../../../chunks/DateField.Segment.CqFLhMYA.js"),we=require("../../../chunks/constants.CgMu0_1M.js"),Ie=require("../../../chunks/helpers.BIckGIbP.js"),Me=require("../../../chunks/form.context.CkC0TwMb.js"),Ne=require("../../Form/contexts/label.context.cjs.js"),Oe=require("../../Form/contexts/helperText.context.cjs.js"),Ve=require("../../Form/hooks/useUniversalRef.hook.cjs.js"),je=require("../../../utils/hooks/useIsMounted.cjs.js"),Pe=require("./DateField.Segments.cjs.js"),i=require("./DateField.utils.cjs.js"),Re=require("./useDateFieldFocus.cjs.js"),Ce=require("./useDateFieldForm.cjs.js"),Te=require("./useDateFieldKeyboard.cjs.js"),Be=require("./useDateFieldSegments.cjs.js"),Ee=require("./useDateFieldValidity.cjs.js"),Ke=require("./useDateFieldValue.cjs.js"),He=require("./useInvalidState.cjs.js"),Le=r.forwardRef(function({value:N,defaultValue:O,onChange:V,minDate:d,maxDate:n,getClampAnnouncement:j,locale:P,label:F=null,helperText:f=null,error:_,hideRequiredMarker:R=!1,validationRules:C,width:T,theme:m,fluid:B=!1,disabled:E=!1,readOnly:K=!1,required:H=!1,name:D,id:L,className:k,style:$,"aria-label":U,"aria-describedby":W,"aria-labelledby":A,...z},G){const{disabled:s,readOnly:o,required:p,invalid:J,errorMessageProvided:g,defaultValue:Q,errorId:x,helperTextId:X,validationErrorsId:Y,labelId:v,ariaDescribedBy:Z,ariaLabelledBy:ee,showErrors:se}=Ce.useDateFieldForm({name:D,disabled:E,readOnly:K,required:H,defaultValue:O,error:_,hasHelperText:!!f,hasLabel:!!F,validationRules:C,ariaDescribedBy:W,ariaLabelledBy:A});r.useEffect(()=>{process.env.NODE_ENV!=="production"&&i.isMinMaxMisconfigured(d,n)&&console.warn("DateField: `minDate` is after `maxDate` — no date satisfies both, so the blur clamp is disabled and values are left as typed.")},[i.dateKeyOrNull(d),i.dateKeyOrNull(n)]);const{refFn:ae,ref:y}=Ve.useUniversalRef(G),{segmentRefs:ie,registerSegmentRef:le}=Be.useDateFieldSegments(),te=P??"en-US",u=i.getDateParts(te),S=r.useMemo(()=>i.getSegmentOrder(u),[u]),{segmentText:re,segmentValues:h,currentValue:q,wasTouched:de,appendDigit:w,adjustSegment:ne,clearSegment:oe,beginSegmentEdit:ue,commitOnBlur:ce,clampAnnouncement:be}=Ke.useDateFieldValue({value:N,defaultValue:Q,onChange:V,minDate:d,maxDate:n,getClampAnnouncement:j}),{focusedSegment:I,fieldTabIndex:Fe,handleSegmentFocus:M,handleFieldFocus:fe,handleFieldBlur:_e,handleFieldMouseDown:me,focusNext:c,focusPrevious:De}=Re.useDateFieldFocus({disabled:s,fieldRef:y,segmentRefs:ie,partsOrder:S,onSegmentFocusChange:ue,onFieldBlur:ce}),pe=Te.useDateFieldKeyboard({disabled:s,readOnly:o,fieldRef:y,focusNext:c,focusPrevious:De,adjustSegment:ne,clearSegment:oe}),{isInvalid:ge}=Ee.useDateFieldValidity({segments:h,currentValue:q,wasTouched:de,isFocused:I!==null}),xe=r.useCallback((l,t)=>{const{advanced:he}=w(l,t);he&&c(l)},[w,c]),b=He.useInvalidState({formInvalid:J,valueInvalid:ge}),ve=je.useIsMounted()&&Ie.isIOS()?"textbox":"spinbutton",ye=l=>{if(s)return;const t=l.target.closest("label");!t||t.id!==v||(l.preventDefault(),M(S[0]))},Se=qe(e.styles[e.baseClassNamePrefix],m&&we.themeClassName(m),B&&e.styles[`${e.classModifierPrefix}fluid`],b&&e.styles[`${e.classModifierPrefix}error`],s&&e.styles[`${e.classModifierPrefix}disabled`],o&&e.styles[`${e.classModifierPrefix}read-only`],k);return a.jsxs("div",{className:Se,style:{...$,maxWidth:T},onMouseDownCapture:ye,children:[a.jsx(Ne.LabelProvider,{ctxId:v,ctxDisabled:s,ctxRequired:p&&!R,children:F}),a.jsx("div",{...z,ref:ae,id:L,role:"group","aria-label":U,"aria-labelledby":ee,"aria-disabled":s||void 0,"aria-required":p||void 0,"aria-invalid":b||void 0,"aria-describedby":Z,"aria-errormessage":g?x:void 0,tabIndex:Fe,className:e.styles[e.staticDateFieldClassNames.field],onMouseDown:me,onFocus:fe,children:a.jsx(Pe.DateFieldSegments,{parts:u,segmentText:re,segmentValues:h,focusedSegment:I,disabled:s,readOnly:o,invalid:b,role:ve,onSegmentFocus:M,onSegmentBlur:_e,onSegmentInput:xe,onSegmentKeyDown:pe,registerSegmentRef:le})}),a.jsx("span",{role:"status","aria-live":"polite","aria-atomic":"true",className:e.styles[e.staticDateFieldClassNames.srStatus],children:be}),a.jsx("input",{type:"hidden",name:D,value:i.toISODateString(q),disabled:s}),a.jsxs(Oe.HelperTextProvider,{ctxId:X,ctxDisabled:s,children:[f,g&&a.jsx(Me.HelperText,{id:x,appearance:"negative",children:_})]}),se(Y)]})});exports.DateField=Le;
|
|
@@ -1,198 +1,203 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import
|
|
3
|
-
import { forwardRef as
|
|
4
|
-
import { s as a, b as
|
|
1
|
+
import { jsxs as O, jsx as r } from "react/jsx-runtime";
|
|
2
|
+
import Ne from "clsx";
|
|
3
|
+
import { forwardRef as we, useEffect as Oe, useMemo as Ve, useCallback as Ce } from "react";
|
|
4
|
+
import { s as a, b as Be, c as i, a as V } from "../../../chunks/DateField.Segment.CwhRnhtq.js";
|
|
5
5
|
import { t as Re } from "../../../chunks/constants.Cruz2A1w.js";
|
|
6
|
-
import { i as
|
|
7
|
-
import { H as
|
|
8
|
-
import { LabelProvider as
|
|
9
|
-
import { HelperTextProvider as
|
|
10
|
-
import { useUniversalRef as
|
|
11
|
-
import { useIsMounted as
|
|
12
|
-
import { DateFieldSegments as
|
|
13
|
-
import { isMinMaxMisconfigured as
|
|
14
|
-
import { useDateFieldFocus as
|
|
15
|
-
import { useDateFieldForm as
|
|
16
|
-
import { useDateFieldKeyboard as
|
|
17
|
-
import { useDateFieldSegments as
|
|
18
|
-
import { useDateFieldValidity as
|
|
19
|
-
import { useDateFieldValue as
|
|
20
|
-
import { useInvalidState as
|
|
21
|
-
const
|
|
6
|
+
import { i as Pe } from "../../../chunks/helpers.CiQfGwdc.js";
|
|
7
|
+
import { H as Ee } from "../../../chunks/form.context.BDYA2JQs.js";
|
|
8
|
+
import { LabelProvider as Le } from "../../Form/contexts/label.context.es.js";
|
|
9
|
+
import { HelperTextProvider as Te } from "../../Form/contexts/helperText.context.es.js";
|
|
10
|
+
import { useUniversalRef as qe } from "../../Form/hooks/useUniversalRef.hook.es.js";
|
|
11
|
+
import { useIsMounted as He } from "../../../utils/hooks/useIsMounted.es.js";
|
|
12
|
+
import { DateFieldSegments as Ke } from "./DateField.Segments.es.js";
|
|
13
|
+
import { isMinMaxMisconfigured as $e, dateKeyOrNull as C, getDateParts as je, getSegmentOrder as Ue, toISODateString as We } from "./DateField.utils.es.js";
|
|
14
|
+
import { useDateFieldFocus as ke } from "./useDateFieldFocus.es.js";
|
|
15
|
+
import { useDateFieldForm as Ae } from "./useDateFieldForm.es.js";
|
|
16
|
+
import { useDateFieldKeyboard as _e } from "./useDateFieldKeyboard.es.js";
|
|
17
|
+
import { useDateFieldSegments as ze } from "./useDateFieldSegments.es.js";
|
|
18
|
+
import { useDateFieldValidity as Ge } from "./useDateFieldValidity.es.js";
|
|
19
|
+
import { useDateFieldValue as Je } from "./useDateFieldValue.es.js";
|
|
20
|
+
import { useInvalidState as Qe } from "./useInvalidState.es.js";
|
|
21
|
+
const ha = we(
|
|
22
22
|
function({
|
|
23
|
-
value:
|
|
24
|
-
defaultValue:
|
|
25
|
-
onChange:
|
|
26
|
-
minDate:
|
|
23
|
+
value: B,
|
|
24
|
+
defaultValue: R,
|
|
25
|
+
onChange: P,
|
|
26
|
+
minDate: l,
|
|
27
27
|
maxDate: o,
|
|
28
|
-
getClampAnnouncement:
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
28
|
+
getClampAnnouncement: E,
|
|
29
|
+
locale: L,
|
|
30
|
+
label: c = null,
|
|
31
|
+
helperText: f = null,
|
|
32
|
+
error: p,
|
|
33
|
+
hideRequiredMarker: T = !1,
|
|
34
|
+
validationRules: q,
|
|
35
|
+
width: H,
|
|
36
|
+
theme: b,
|
|
37
|
+
fluid: K = !1,
|
|
38
|
+
disabled: $ = !1,
|
|
39
|
+
readOnly: j = !1,
|
|
40
|
+
required: U = !1,
|
|
41
|
+
name: g,
|
|
42
|
+
id: W,
|
|
43
|
+
className: k,
|
|
43
44
|
style: A,
|
|
44
|
-
"aria-label":
|
|
45
|
-
"aria-describedby":
|
|
46
|
-
"aria-labelledby":
|
|
47
|
-
...
|
|
48
|
-
},
|
|
45
|
+
"aria-label": _,
|
|
46
|
+
"aria-describedby": z,
|
|
47
|
+
"aria-labelledby": G,
|
|
48
|
+
...J
|
|
49
|
+
}, Q) {
|
|
49
50
|
const {
|
|
50
51
|
disabled: e,
|
|
51
52
|
readOnly: d,
|
|
52
|
-
required:
|
|
53
|
-
invalid:
|
|
54
|
-
errorMessageProvided:
|
|
55
|
-
defaultValue:
|
|
56
|
-
errorId:
|
|
57
|
-
helperTextId:
|
|
58
|
-
validationErrorsId:
|
|
59
|
-
labelId:
|
|
60
|
-
ariaDescribedBy:
|
|
61
|
-
ariaLabelledBy:
|
|
62
|
-
showErrors:
|
|
63
|
-
} =
|
|
64
|
-
name:
|
|
65
|
-
disabled:
|
|
66
|
-
readOnly:
|
|
67
|
-
required:
|
|
68
|
-
defaultValue:
|
|
69
|
-
error:
|
|
70
|
-
hasHelperText: !!
|
|
71
|
-
hasLabel: !!
|
|
72
|
-
validationRules:
|
|
73
|
-
ariaDescribedBy:
|
|
74
|
-
ariaLabelledBy:
|
|
53
|
+
required: v,
|
|
54
|
+
invalid: X,
|
|
55
|
+
errorMessageProvided: F,
|
|
56
|
+
defaultValue: Y,
|
|
57
|
+
errorId: D,
|
|
58
|
+
helperTextId: Z,
|
|
59
|
+
validationErrorsId: ee,
|
|
60
|
+
labelId: h,
|
|
61
|
+
ariaDescribedBy: ae,
|
|
62
|
+
ariaLabelledBy: re,
|
|
63
|
+
showErrors: se
|
|
64
|
+
} = Ae({
|
|
65
|
+
name: g,
|
|
66
|
+
disabled: $,
|
|
67
|
+
readOnly: j,
|
|
68
|
+
required: U,
|
|
69
|
+
defaultValue: R,
|
|
70
|
+
error: p,
|
|
71
|
+
hasHelperText: !!f,
|
|
72
|
+
hasLabel: !!c,
|
|
73
|
+
validationRules: q,
|
|
74
|
+
ariaDescribedBy: z,
|
|
75
|
+
ariaLabelledBy: G
|
|
75
76
|
});
|
|
76
|
-
|
|
77
|
-
process.env.NODE_ENV !== "production" &&
|
|
77
|
+
Oe(() => {
|
|
78
|
+
process.env.NODE_ENV !== "production" && $e(l, o) && console.warn(
|
|
78
79
|
"DateField: `minDate` is after `maxDate` — no date satisfies both, so the blur clamp is disabled and values are left as typed."
|
|
79
80
|
);
|
|
80
|
-
}, [
|
|
81
|
-
const { refFn:
|
|
82
|
-
segmentText:
|
|
83
|
-
segmentValues:
|
|
84
|
-
currentValue:
|
|
85
|
-
wasTouched:
|
|
86
|
-
appendDigit:
|
|
87
|
-
adjustSegment:
|
|
88
|
-
clearSegment:
|
|
89
|
-
beginSegmentEdit:
|
|
90
|
-
commitOnBlur:
|
|
91
|
-
clampAnnouncement:
|
|
92
|
-
} =
|
|
93
|
-
value:
|
|
94
|
-
defaultValue:
|
|
95
|
-
onChange:
|
|
96
|
-
minDate:
|
|
81
|
+
}, [C(l), C(o)]);
|
|
82
|
+
const { refFn: te, ref: S } = qe(Q), { segmentRefs: ie, registerSegmentRef: le } = ze(), n = je(L ?? "en-US"), x = Ve(() => Ue(n), [n]), {
|
|
83
|
+
segmentText: oe,
|
|
84
|
+
segmentValues: y,
|
|
85
|
+
currentValue: I,
|
|
86
|
+
wasTouched: de,
|
|
87
|
+
appendDigit: M,
|
|
88
|
+
adjustSegment: ne,
|
|
89
|
+
clearSegment: ue,
|
|
90
|
+
beginSegmentEdit: me,
|
|
91
|
+
commitOnBlur: ce,
|
|
92
|
+
clampAnnouncement: fe
|
|
93
|
+
} = Je({
|
|
94
|
+
value: B,
|
|
95
|
+
defaultValue: Y,
|
|
96
|
+
onChange: P,
|
|
97
|
+
minDate: l,
|
|
97
98
|
maxDate: o,
|
|
98
|
-
getClampAnnouncement:
|
|
99
|
+
getClampAnnouncement: E
|
|
99
100
|
}), {
|
|
100
|
-
focusedSegment:
|
|
101
|
-
fieldTabIndex:
|
|
102
|
-
handleSegmentFocus:
|
|
103
|
-
handleFieldFocus:
|
|
104
|
-
handleFieldBlur:
|
|
105
|
-
handleFieldMouseDown:
|
|
106
|
-
focusNext:
|
|
107
|
-
focusPrevious:
|
|
108
|
-
} =
|
|
101
|
+
focusedSegment: N,
|
|
102
|
+
fieldTabIndex: pe,
|
|
103
|
+
handleSegmentFocus: w,
|
|
104
|
+
handleFieldFocus: be,
|
|
105
|
+
handleFieldBlur: ge,
|
|
106
|
+
handleFieldMouseDown: ve,
|
|
107
|
+
focusNext: u,
|
|
108
|
+
focusPrevious: Fe
|
|
109
|
+
} = ke({
|
|
109
110
|
disabled: e,
|
|
110
|
-
fieldRef:
|
|
111
|
-
segmentRefs:
|
|
112
|
-
partsOrder:
|
|
113
|
-
onSegmentFocusChange:
|
|
114
|
-
onFieldBlur:
|
|
115
|
-
}),
|
|
111
|
+
fieldRef: S,
|
|
112
|
+
segmentRefs: ie,
|
|
113
|
+
partsOrder: x,
|
|
114
|
+
onSegmentFocusChange: me,
|
|
115
|
+
onFieldBlur: ce
|
|
116
|
+
}), De = _e({
|
|
116
117
|
disabled: e,
|
|
117
118
|
readOnly: d,
|
|
118
|
-
fieldRef:
|
|
119
|
-
focusNext:
|
|
120
|
-
focusPrevious:
|
|
121
|
-
adjustSegment:
|
|
122
|
-
clearSegment:
|
|
123
|
-
}), { isInvalid:
|
|
124
|
-
segments:
|
|
125
|
-
currentValue:
|
|
126
|
-
wasTouched:
|
|
127
|
-
isFocused:
|
|
128
|
-
}),
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
119
|
+
fieldRef: S,
|
|
120
|
+
focusNext: u,
|
|
121
|
+
focusPrevious: Fe,
|
|
122
|
+
adjustSegment: ne,
|
|
123
|
+
clearSegment: ue
|
|
124
|
+
}), { isInvalid: he } = Ge({
|
|
125
|
+
segments: y,
|
|
126
|
+
currentValue: I,
|
|
127
|
+
wasTouched: de,
|
|
128
|
+
isFocused: N !== null
|
|
129
|
+
}), Se = Ce(
|
|
130
|
+
(s, t) => {
|
|
131
|
+
const { advanced: Me } = M(s, t);
|
|
132
|
+
Me && u(s);
|
|
133
|
+
},
|
|
134
|
+
[M, u]
|
|
135
|
+
), m = Qe({
|
|
136
|
+
formInvalid: X,
|
|
137
|
+
valueInvalid: he
|
|
138
|
+
}), xe = He() && Pe() ? "textbox" : "spinbutton", ye = (s) => {
|
|
135
139
|
if (e) return;
|
|
136
|
-
const
|
|
137
|
-
!
|
|
138
|
-
},
|
|
139
|
-
a[
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
e && a[`${
|
|
144
|
-
d && a[`${
|
|
145
|
-
|
|
140
|
+
const t = s.target.closest("label");
|
|
141
|
+
!t || t.id !== h || (s.preventDefault(), w(x[0]));
|
|
142
|
+
}, Ie = Ne(
|
|
143
|
+
a[Be],
|
|
144
|
+
b && Re(b),
|
|
145
|
+
K && a[`${i}fluid`],
|
|
146
|
+
m && a[`${i}error`],
|
|
147
|
+
e && a[`${i}disabled`],
|
|
148
|
+
d && a[`${i}read-only`],
|
|
149
|
+
k
|
|
146
150
|
);
|
|
147
|
-
return /* @__PURE__ */
|
|
151
|
+
return /* @__PURE__ */ O(
|
|
148
152
|
"div",
|
|
149
153
|
{
|
|
150
|
-
className:
|
|
151
|
-
style: { ...A, maxWidth:
|
|
152
|
-
onMouseDownCapture:
|
|
154
|
+
className: Ie,
|
|
155
|
+
style: { ...A, maxWidth: H },
|
|
156
|
+
onMouseDownCapture: ye,
|
|
153
157
|
children: [
|
|
154
158
|
/* @__PURE__ */ r(
|
|
155
|
-
|
|
159
|
+
Le,
|
|
156
160
|
{
|
|
157
|
-
ctxId:
|
|
161
|
+
ctxId: h,
|
|
158
162
|
ctxDisabled: e,
|
|
159
|
-
ctxRequired:
|
|
160
|
-
children:
|
|
163
|
+
ctxRequired: v && !T,
|
|
164
|
+
children: c
|
|
161
165
|
}
|
|
162
166
|
),
|
|
163
167
|
/* @__PURE__ */ r(
|
|
164
168
|
"div",
|
|
165
169
|
{
|
|
166
|
-
...
|
|
167
|
-
ref:
|
|
168
|
-
id:
|
|
170
|
+
...J,
|
|
171
|
+
ref: te,
|
|
172
|
+
id: W,
|
|
169
173
|
role: "group",
|
|
170
|
-
"aria-label":
|
|
171
|
-
"aria-labelledby":
|
|
174
|
+
"aria-label": _,
|
|
175
|
+
"aria-labelledby": re,
|
|
172
176
|
"aria-disabled": e || void 0,
|
|
173
|
-
"aria-required":
|
|
174
|
-
"aria-invalid":
|
|
175
|
-
"aria-describedby":
|
|
176
|
-
"aria-errormessage":
|
|
177
|
-
tabIndex:
|
|
178
|
-
className: a[
|
|
179
|
-
onMouseDown:
|
|
180
|
-
onFocus:
|
|
177
|
+
"aria-required": v || void 0,
|
|
178
|
+
"aria-invalid": m || void 0,
|
|
179
|
+
"aria-describedby": ae,
|
|
180
|
+
"aria-errormessage": F ? D : void 0,
|
|
181
|
+
tabIndex: pe,
|
|
182
|
+
className: a[V.field],
|
|
183
|
+
onMouseDown: ve,
|
|
184
|
+
onFocus: be,
|
|
181
185
|
children: /* @__PURE__ */ r(
|
|
182
|
-
|
|
186
|
+
Ke,
|
|
183
187
|
{
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
188
|
+
parts: n,
|
|
189
|
+
segmentText: oe,
|
|
190
|
+
segmentValues: y,
|
|
191
|
+
focusedSegment: N,
|
|
187
192
|
disabled: e,
|
|
188
193
|
readOnly: d,
|
|
189
|
-
invalid:
|
|
190
|
-
role:
|
|
191
|
-
onSegmentFocus:
|
|
192
|
-
onSegmentBlur:
|
|
193
|
-
onSegmentInput:
|
|
194
|
-
onSegmentKeyDown:
|
|
195
|
-
registerSegmentRef:
|
|
194
|
+
invalid: m,
|
|
195
|
+
role: xe,
|
|
196
|
+
onSegmentFocus: w,
|
|
197
|
+
onSegmentBlur: ge,
|
|
198
|
+
onSegmentInput: Se,
|
|
199
|
+
onSegmentKeyDown: De,
|
|
200
|
+
registerSegmentRef: le
|
|
196
201
|
}
|
|
197
202
|
)
|
|
198
203
|
}
|
|
@@ -203,29 +208,29 @@ const fa = Ne(
|
|
|
203
208
|
role: "status",
|
|
204
209
|
"aria-live": "polite",
|
|
205
210
|
"aria-atomic": "true",
|
|
206
|
-
className: a[
|
|
207
|
-
children:
|
|
211
|
+
className: a[V.srStatus],
|
|
212
|
+
children: fe
|
|
208
213
|
}
|
|
209
214
|
),
|
|
210
215
|
/* @__PURE__ */ r(
|
|
211
216
|
"input",
|
|
212
217
|
{
|
|
213
218
|
type: "hidden",
|
|
214
|
-
name:
|
|
215
|
-
value:
|
|
219
|
+
name: g,
|
|
220
|
+
value: We(I),
|
|
216
221
|
disabled: e
|
|
217
222
|
}
|
|
218
223
|
),
|
|
219
|
-
/* @__PURE__ */
|
|
220
|
-
|
|
221
|
-
|
|
224
|
+
/* @__PURE__ */ O(Te, { ctxId: Z, ctxDisabled: e, children: [
|
|
225
|
+
f,
|
|
226
|
+
F && /* @__PURE__ */ r(Ee, { id: D, appearance: "negative", children: p })
|
|
222
227
|
] }),
|
|
223
|
-
ee
|
|
228
|
+
se(ee)
|
|
224
229
|
]
|
|
225
230
|
}
|
|
226
231
|
);
|
|
227
232
|
}
|
|
228
233
|
);
|
|
229
234
|
export {
|
|
230
|
-
|
|
235
|
+
ha as DateField
|
|
231
236
|
};
|
|
@@ -26,7 +26,7 @@ export interface AppendDigitResult {
|
|
|
26
26
|
/** True when the digit was refused (invalid char, out-of-range, or full). */
|
|
27
27
|
rejected: boolean;
|
|
28
28
|
}
|
|
29
|
-
/** Shape mirrors `Intl.DateTimeFormatPart`
|
|
29
|
+
/** Shape mirrors `Intl.DateTimeFormatPart`; `getDateParts` derives this directly from `formatToParts()`. */
|
|
30
30
|
export type DateFieldPart = {
|
|
31
31
|
type: SegmentType | 'literal';
|
|
32
32
|
value: string;
|
|
@@ -106,6 +106,13 @@ export interface DateFieldProps extends DateFieldInputAttributes {
|
|
|
106
106
|
* message announced politely to screen readers. Omit → no announcement.
|
|
107
107
|
*/
|
|
108
108
|
getClampAnnouncement?: (clampedDate: Date) => string;
|
|
109
|
+
/**
|
|
110
|
+
* BCP-47 locale tag driving segment order + separators (e.g. `en-GB` →
|
|
111
|
+
* DD/MM/YYYY, `de-DE` → DD.MM.YYYY). A future `DatesProvider` will supply the
|
|
112
|
+
* default.
|
|
113
|
+
* @default en-US
|
|
114
|
+
*/
|
|
115
|
+
locale?: string;
|
|
109
116
|
}
|
|
110
117
|
/**
|
|
111
118
|
* Internal props for the segment subcomponent. Not part of the public API.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require("../../../chunks/constants.CgMu0_1M.js");const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require("../../../chunks/constants.CgMu0_1M.js");const D=require("../../../chunks/helpers.BIckGIbP.js"),g=require("./DateField.validation.cjs.js"),E=new Intl.DateTimeFormat("en-US",{month:"long"}),p=e=>E.format(new Date(2e3,e-1,1)),c=31,l=12,S=1,m=9999,M=(e,t,n)=>Math.min(n,Math.max(t,e)),T=(e,t)=>((e-1)%t+t)%t+1,w=2024,P=(e,t)=>t==null?31:new Date(e??w,t,0).getDate(),R=()=>{const e=new Date;return{day:e.getDate(),month:e.getMonth()+1,year:e.getFullYear()}},o=e=>e instanceof Date&&!Number.isNaN(e.getTime()),I=(e,t,n,r)=>{if(n==="min")return e==="year"?null:1;if(n==="max")return e==="year"?null:e==="day"?r.daysInMonth:l;if(t==null){if(e==="year")return r.today.year;const A=e==="day"?c:l;return n>0?1:A}if(e==="year")return M(t+n,S,m);const s=e==="day"?c:l;return T(t+n,s)},F={day:"",month:"",year:""},f=e=>{const{day:t,month:n,year:r}=e;if(t==null||n==null||r==null)return null;const s=new Date(r,n-1,t);return s.setFullYear(r),Number.isNaN(s.getTime())||s.getFullYear()!==r||s.getMonth()!==n-1||s.getDate()!==t?null:s},Y=(e,t)=>e==null&&t==null?!0:e==null||t==null?!1:e.getTime()===t.getTime(),a=D.dateToDayKey,V=e=>o(e)?a(e):null,O=(e,t,n)=>{const r=a(e);return!(o(t)&&r<a(t)||o(n)&&r>a(n))},h=(e,t)=>o(e)&&o(t)&&a(e)>a(t),C=(e,t,n)=>{if(h(t,n))return e;const r=a(e);return o(t)&&r<a(t)?new Date(t.getFullYear(),t.getMonth(),t.getDate()):o(n)&&r>a(n)?new Date(n.getFullYear(),n.getMonth(),n.getDate()):e},L=e=>{if(!o(e))return"";const t=String(e.getFullYear()).padStart(4,"0"),n=String(e.getMonth()+1).padStart(2,"0"),r=String(e.getDate()).padStart(2,"0");return`${t}-${n}-${r}`},_=e=>e.type==="literal",N=e=>e.filter(t=>!_(t)).map(t=>t.type),X=new Date(2020,0,2),b=new Set([8206,8207,8234,8235,8236,8237,8238,8294,8295,8296,8297]),G=e=>[...e].filter(t=>!b.has(t.codePointAt(0)??-1)).join(""),H=new Set(["day","month","year","literal"]),d=3,y=e=>{try{const t=new Intl.DateTimeFormat(e,{year:"numeric",month:"2-digit",day:"2-digit",calendar:"gregory"}).formatToParts(X).filter(r=>H.has(r.type)).map(r=>({type:r.type,value:r.type==="literal"?G(r.value):""})),n=N(t);return n.length===d&&new Set(n).size===d?t:null}catch{return null}},u=new Map,K=e=>{let t=e;try{t=new Intl.Locale(e).toString()}catch{t=e.toLowerCase()}const n=u.get(t);if(n)return n;const r=y(e)??y("en-US");if(!r)throw new Error("DateField: Intl cannot resolve en-US date parts");return u.set(t,r),r},j=()=>u.clear(),k=e=>o(e)?{day:String(e.getDate()).padStart(2,"0"),month:String(e.getMonth()+1).padStart(2,"0"),year:String(e.getFullYear()).padStart(4,"0")}:F,i=(e,t)=>{if(t===""||e==="year"&&t.length<g.SEGMENT_MAX_LENGTH.year)return null;const n=parseInt(t,10);return Number.isNaN(n)||n===0?null:n},U=e=>f({day:i("day",e.day),month:i("month",e.month),year:i("year",e.year)}),q=(e,t)=>t===""?"":t.padStart(g.SEGMENT_MAX_LENGTH[e],"0"),z=(e,t,n)=>t===""?{displayValue:n,isPlaceholder:!0}:{displayValue:t.padStart(g.SEGMENT_MAX_LENGTH[e],"0"),isPlaceholder:!1},B=e=>{const t=window.getSelection();if(!t)return;const n=document.createRange();n.selectNodeContents(e),t.removeAllRanges(),t.addRange(n)},$=e=>{var n;if(!e)return;const t=(n=window.getSelection)==null?void 0:n.call(window);t&&t.rangeCount>0&&e.contains(t.anchorNode)&&t.removeAllRanges()};exports.DAY_SPIN_MAX=c;exports.MONTH_MAX=l;exports.YEAR_MAX=m;exports.YEAR_MIN=S;exports.__clearDatePartsCache=j;exports.adjustSegmentValue=I;exports.clamp=M;exports.clampDateToRange=C;exports.clearSelectionWithin=$;exports.dateKeyOrNull=V;exports.deriveValue=f;exports.deriveValueFromText=U;exports.getDateParts=K;exports.getDaysInMonth=P;exports.getMonthName=p;exports.getSegmentDisplay=z;exports.getSegmentOrder=N;exports.isDateInRange=O;exports.isLiteralPart=_;exports.isMinMaxMisconfigured=h;exports.isSameDateValue=Y;exports.normalizeSegmentText=q;exports.segmentNumber=i;exports.segmentTextFromValue=k;exports.selectElementContents=B;exports.toISODateString=L;exports.todayParts=R;exports.wrapInRange=T;
|
|
@@ -116,8 +116,23 @@ export declare const isMinMaxMisconfigured: (minDate?: Nullable<Date>, maxDate?:
|
|
|
116
116
|
*/
|
|
117
117
|
export declare const clampDateToRange: (value: Date, minDate?: Nullable<Date>, maxDate?: Nullable<Date>) => Date;
|
|
118
118
|
export declare const toISODateString: (value: Nullable<Date>) => string;
|
|
119
|
+
/** Type guard: a literal separator (`/`, `.`, `年`, …) rather than a segment. */
|
|
120
|
+
export declare const isLiteralPart: (part: DateFieldPart) => part is DateFieldPart & {
|
|
121
|
+
type: "literal";
|
|
122
|
+
};
|
|
119
123
|
/** Ordered segment types from a parts array (literals stripped). */
|
|
120
124
|
export declare const getSegmentOrder: (parts: ReadonlyArray<DateFieldPart>) => ReadonlyArray<SegmentType>;
|
|
125
|
+
/**
|
|
126
|
+
* Locale-derived segment order + separators (DF-8), memoized per locale. Falls
|
|
127
|
+
* back to en-US for any locale Intl can't resolve to the three date segments —
|
|
128
|
+
* en-US being the ECMAScript-guaranteed baseline (Intl's own ultimate fallback).
|
|
129
|
+
* Resolved lazily on first use, so a broken Intl (which can't render the field
|
|
130
|
+
* anyway — `getMonthName` needs it too) surfaces at render, catchable by an
|
|
131
|
+
* error boundary, instead of crashing the bundle at import.
|
|
132
|
+
*/
|
|
133
|
+
export declare const getDateParts: (locale: string) => ReadonlyArray<DateFieldPart>;
|
|
134
|
+
/** @internal — test-only. Clears the per-locale parts cache for Intl isolation. */
|
|
135
|
+
export declare const __clearDatePartsCache: () => void;
|
|
121
136
|
/** Per-segment zero-padded strings from a Date. All-empty for null/invalid. */
|
|
122
137
|
export declare const segmentTextFromValue: (value: Nullable<Date>) => SegmentText;
|
|
123
138
|
/** The number a segment string contributes to the date / `aria-valuenow`, or
|
|
@@ -1,89 +1,132 @@
|
|
|
1
1
|
import "../../../chunks/constants.Cruz2A1w.js";
|
|
2
|
-
import { a as
|
|
2
|
+
import { a as S } from "../../../chunks/helpers.CiQfGwdc.js";
|
|
3
3
|
import { SEGMENT_MAX_LENGTH as u } from "./DateField.validation.es.js";
|
|
4
|
-
const
|
|
5
|
-
const
|
|
6
|
-
return { day:
|
|
7
|
-
}, o = (
|
|
8
|
-
if (n === "min") return
|
|
4
|
+
const m = new Intl.DateTimeFormat("en-US", { month: "long" }), L = (t) => m.format(new Date(2e3, t - 1, 1)), g = 31, l = 12, h = 1, T = 9999, M = (t, e, n) => Math.min(n, Math.max(e, t)), p = (t, e) => ((t - 1) % e + e) % e + 1, w = 2024, O = (t, e) => e == null ? 31 : new Date(t ?? w, e, 0).getDate(), K = () => {
|
|
5
|
+
const t = /* @__PURE__ */ new Date();
|
|
6
|
+
return { day: t.getDate(), month: t.getMonth() + 1, year: t.getFullYear() };
|
|
7
|
+
}, o = (t) => t instanceof Date && !Number.isNaN(t.getTime()), X = (t, e, n, r) => {
|
|
8
|
+
if (n === "min") return t === "year" ? null : 1;
|
|
9
9
|
if (n === "max")
|
|
10
|
-
return
|
|
11
|
-
if (
|
|
12
|
-
if (
|
|
13
|
-
const
|
|
14
|
-
return n > 0 ? 1 :
|
|
10
|
+
return t === "year" ? null : t === "day" ? r.daysInMonth : l;
|
|
11
|
+
if (e == null) {
|
|
12
|
+
if (t === "year") return r.today.year;
|
|
13
|
+
const f = t === "day" ? g : l;
|
|
14
|
+
return n > 0 ? 1 : f;
|
|
15
15
|
}
|
|
16
|
-
if (
|
|
17
|
-
const
|
|
18
|
-
return
|
|
19
|
-
},
|
|
20
|
-
const { day:
|
|
21
|
-
if (
|
|
22
|
-
const
|
|
23
|
-
return
|
|
24
|
-
},
|
|
25
|
-
const r = a(
|
|
26
|
-
return !(o(
|
|
27
|
-
},
|
|
28
|
-
if (
|
|
29
|
-
const r = a(
|
|
30
|
-
return o(
|
|
31
|
-
},
|
|
32
|
-
if (!o(
|
|
33
|
-
const
|
|
34
|
-
return `${
|
|
35
|
-
},
|
|
36
|
-
(
|
|
37
|
-
).map((
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
16
|
+
if (t === "year") return M(e + n, h, T);
|
|
17
|
+
const s = t === "day" ? g : l;
|
|
18
|
+
return p(e + n, s);
|
|
19
|
+
}, A = { day: "", month: "", year: "" }, N = (t) => {
|
|
20
|
+
const { day: e, month: n, year: r } = t;
|
|
21
|
+
if (e == null || n == null || r == null) return null;
|
|
22
|
+
const s = new Date(r, n - 1, e);
|
|
23
|
+
return s.setFullYear(r), Number.isNaN(s.getTime()) || s.getFullYear() !== r || s.getMonth() !== n - 1 || s.getDate() !== e ? null : s;
|
|
24
|
+
}, k = (t, e) => t == null && e == null ? !0 : t == null || e == null ? !1 : t.getTime() === e.getTime(), a = S, H = (t) => o(t) ? a(t) : null, U = (t, e, n) => {
|
|
25
|
+
const r = a(t);
|
|
26
|
+
return !(o(e) && r < a(e) || o(n) && r > a(n));
|
|
27
|
+
}, _ = (t, e) => o(t) && o(e) && a(t) > a(e), b = (t, e, n) => {
|
|
28
|
+
if (_(e, n)) return t;
|
|
29
|
+
const r = a(t);
|
|
30
|
+
return o(e) && r < a(e) ? new Date(e.getFullYear(), e.getMonth(), e.getDate()) : o(n) && r > a(n) ? new Date(n.getFullYear(), n.getMonth(), n.getDate()) : t;
|
|
31
|
+
}, B = (t) => {
|
|
32
|
+
if (!o(t)) return "";
|
|
33
|
+
const e = String(t.getFullYear()).padStart(4, "0"), n = String(t.getMonth() + 1).padStart(2, "0"), r = String(t.getDate()).padStart(2, "0");
|
|
34
|
+
return `${e}-${n}-${r}`;
|
|
35
|
+
}, E = (t) => t.type === "literal", D = (t) => t.filter(
|
|
36
|
+
(e) => !E(e)
|
|
37
|
+
).map((e) => e.type), P = new Date(2020, 0, 2), R = /* @__PURE__ */ new Set([
|
|
38
|
+
8206,
|
|
39
|
+
8207,
|
|
40
|
+
8234,
|
|
41
|
+
8235,
|
|
42
|
+
8236,
|
|
43
|
+
8237,
|
|
44
|
+
8238,
|
|
45
|
+
8294,
|
|
46
|
+
8295,
|
|
47
|
+
8296,
|
|
48
|
+
8297
|
|
49
|
+
]), F = (t) => [...t].filter((e) => !R.has(e.codePointAt(0) ?? -1)).join(""), I = /* @__PURE__ */ new Set(["day", "month", "year", "literal"]), d = 3, y = (t) => {
|
|
50
|
+
try {
|
|
51
|
+
const e = new Intl.DateTimeFormat(t, {
|
|
52
|
+
year: "numeric",
|
|
53
|
+
month: "2-digit",
|
|
54
|
+
day: "2-digit",
|
|
55
|
+
calendar: "gregory"
|
|
56
|
+
}).formatToParts(P).filter((r) => I.has(r.type)).map((r) => ({
|
|
57
|
+
type: r.type,
|
|
58
|
+
value: r.type === "literal" ? F(r.value) : ""
|
|
59
|
+
})), n = D(e);
|
|
60
|
+
return n.length === d && new Set(n).size === d ? e : null;
|
|
61
|
+
} catch {
|
|
62
|
+
return null;
|
|
63
|
+
}
|
|
64
|
+
}, c = /* @__PURE__ */ new Map(), G = (t) => {
|
|
65
|
+
let e = t;
|
|
66
|
+
try {
|
|
67
|
+
e = new Intl.Locale(t).toString();
|
|
68
|
+
} catch {
|
|
69
|
+
e = t.toLowerCase();
|
|
70
|
+
}
|
|
71
|
+
const n = c.get(e);
|
|
72
|
+
if (n) return n;
|
|
73
|
+
const r = y(t) ?? y("en-US");
|
|
74
|
+
if (!r)
|
|
75
|
+
throw new Error("DateField: Intl cannot resolve en-US date parts");
|
|
76
|
+
return c.set(e, r), r;
|
|
77
|
+
}, $ = () => c.clear(), j = (t) => o(t) ? {
|
|
78
|
+
day: String(t.getDate()).padStart(2, "0"),
|
|
79
|
+
month: String(t.getMonth() + 1).padStart(2, "0"),
|
|
80
|
+
year: String(t.getFullYear()).padStart(4, "0")
|
|
81
|
+
} : A, i = (t, e) => {
|
|
82
|
+
if (e === "" || t === "year" && e.length < u.year) return null;
|
|
83
|
+
const n = parseInt(e, 10);
|
|
44
84
|
return Number.isNaN(n) || n === 0 ? null : n;
|
|
45
|
-
},
|
|
46
|
-
day: i("day",
|
|
47
|
-
month: i("month",
|
|
48
|
-
year: i("year",
|
|
49
|
-
}),
|
|
50
|
-
displayValue:
|
|
85
|
+
}, z = (t) => N({
|
|
86
|
+
day: i("day", t.day),
|
|
87
|
+
month: i("month", t.month),
|
|
88
|
+
year: i("year", t.year)
|
|
89
|
+
}), W = (t, e) => e === "" ? "" : e.padStart(u[t], "0"), q = (t, e, n) => e === "" ? { displayValue: n, isPlaceholder: !0 } : {
|
|
90
|
+
displayValue: e.padStart(u[t], "0"),
|
|
51
91
|
isPlaceholder: !1
|
|
52
|
-
},
|
|
53
|
-
const
|
|
54
|
-
if (!
|
|
92
|
+
}, J = (t) => {
|
|
93
|
+
const e = window.getSelection();
|
|
94
|
+
if (!e) return;
|
|
55
95
|
const n = document.createRange();
|
|
56
|
-
n.selectNodeContents(
|
|
57
|
-
},
|
|
96
|
+
n.selectNodeContents(t), e.removeAllRanges(), e.addRange(n);
|
|
97
|
+
}, Q = (t) => {
|
|
58
98
|
var n;
|
|
59
|
-
if (!
|
|
60
|
-
const
|
|
61
|
-
|
|
99
|
+
if (!t) return;
|
|
100
|
+
const e = (n = window.getSelection) == null ? void 0 : n.call(window);
|
|
101
|
+
e && e.rangeCount > 0 && t.contains(e.anchorNode) && e.removeAllRanges();
|
|
62
102
|
};
|
|
63
103
|
export {
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
b as
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
104
|
+
g as DAY_SPIN_MAX,
|
|
105
|
+
l as MONTH_MAX,
|
|
106
|
+
T as YEAR_MAX,
|
|
107
|
+
h as YEAR_MIN,
|
|
108
|
+
$ as __clearDatePartsCache,
|
|
109
|
+
X as adjustSegmentValue,
|
|
110
|
+
M as clamp,
|
|
111
|
+
b as clampDateToRange,
|
|
112
|
+
Q as clearSelectionWithin,
|
|
113
|
+
H as dateKeyOrNull,
|
|
114
|
+
N as deriveValue,
|
|
115
|
+
z as deriveValueFromText,
|
|
116
|
+
G as getDateParts,
|
|
117
|
+
O as getDaysInMonth,
|
|
118
|
+
L as getMonthName,
|
|
119
|
+
q as getSegmentDisplay,
|
|
120
|
+
D as getSegmentOrder,
|
|
121
|
+
U as isDateInRange,
|
|
122
|
+
E as isLiteralPart,
|
|
123
|
+
_ as isMinMaxMisconfigured,
|
|
124
|
+
k as isSameDateValue,
|
|
125
|
+
W as normalizeSegmentText,
|
|
83
126
|
i as segmentNumber,
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
127
|
+
j as segmentTextFromValue,
|
|
128
|
+
J as selectElementContents,
|
|
129
|
+
B as toISODateString,
|
|
130
|
+
K as todayParts,
|
|
131
|
+
p as wrapInRange
|
|
89
132
|
};
|
|
@@ -4,7 +4,7 @@ export interface UseDateFieldFocusArgs {
|
|
|
4
4
|
disabled: boolean;
|
|
5
5
|
fieldRef: RefObject<HTMLDivElement>;
|
|
6
6
|
segmentRefs: MutableRefObject<Map<SegmentType, HTMLSpanElement>>;
|
|
7
|
-
/** Ordered segment types (literals stripped)
|
|
7
|
+
/** Ordered segment types (literals stripped), derived from the active locale. */
|
|
8
8
|
partsOrder: ReadonlyArray<SegmentType>;
|
|
9
9
|
/** Called when focus enters a segment (any path). */
|
|
10
10
|
onSegmentFocusChange?: (segment: SegmentType) => void;
|
|
@@ -28,9 +28,9 @@ export interface UseDateFieldKeyboardArgs {
|
|
|
28
28
|
readOnly: boolean;
|
|
29
29
|
/** Field root ref, used to detect RTL direction. */
|
|
30
30
|
fieldRef: RefObject<HTMLDivElement>;
|
|
31
|
-
/** Move focus to the next segment in `
|
|
31
|
+
/** Move focus to the next segment in the locale-derived `partsOrder`. */
|
|
32
32
|
focusNext: (segment: SegmentType) => void;
|
|
33
|
-
/** Move focus to the previous segment in `
|
|
33
|
+
/** Move focus to the previous segment in the locale-derived `partsOrder`. */
|
|
34
34
|
focusPrevious: (segment: SegmentType) => void;
|
|
35
35
|
/**
|
|
36
36
|
* Increment, decrement, or jump a segment to its min/max boundary.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@viasat/beam-react",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.54.0",
|
|
4
4
|
"description": "React component library for the Beam design system",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Viasat",
|
|
@@ -60,12 +60,12 @@
|
|
|
60
60
|
"access": "public"
|
|
61
61
|
},
|
|
62
62
|
"dependencies": {
|
|
63
|
-
"@viasat/beam-fonts": "2.
|
|
64
|
-
"@viasat/beam-shared": "2.
|
|
65
|
-
"@viasat/beam-styles": "2.
|
|
66
|
-
"@viasat/beam-tokens": "2.
|
|
67
|
-
"@viasat/beam-icons": "2.
|
|
68
|
-
"@viasat/beam-react-claude-plugin": "2.
|
|
63
|
+
"@viasat/beam-fonts": "2.54.0",
|
|
64
|
+
"@viasat/beam-shared": "2.54.0",
|
|
65
|
+
"@viasat/beam-styles": "2.54.0",
|
|
66
|
+
"@viasat/beam-tokens": "2.54.0",
|
|
67
|
+
"@viasat/beam-icons": "2.54.0",
|
|
68
|
+
"@viasat/beam-react-claude-plugin": "2.54.0",
|
|
69
69
|
"clsx": "^1.2.1",
|
|
70
70
|
"@floating-ui/react": "^0.26.18",
|
|
71
71
|
"@stepperize/react": "^5.1.5",
|