@instructure/ui-date-input 9.6.0 → 9.6.1-pr-snapshot-1726659472372

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.
@@ -6,9 +6,11 @@ import type { FormMessage } from '@instructure/ui-form-field';
6
6
  ---
7
7
  category: components
8
8
  ---
9
+
10
+ @module experimental
9
11
  **/
10
12
  declare const DateInput2: {
11
- ({ renderLabel, screenReaderLabels, isRequired, interaction, size, isInline, value, messages, width, onChange, onBlur, withYearPicker, onRequestValidateDate, invalidDateErrorMessage, locale, timezone, placeholder, formatDate, ...rest }: DateInput2Props): jsx.JSX.Element;
13
+ ({ renderLabel, screenReaderLabels, isRequired, interaction, isInline, value, messages, width, onChange, onBlur, withYearPicker, invalidDateErrorMessage, locale, timezone, placeholder, dateFormat, onRequestValidateDate, ...rest }: DateInput2Props): jsx.JSX.Element;
12
14
  propTypes: import("@instructure/shared-types").PropValidators<keyof {
13
15
  renderLabel: import("@instructure/shared-types").Renderable;
14
16
  screenReaderLabels: {
@@ -17,18 +19,14 @@ declare const DateInput2: {
17
19
  nextMonthButton: string;
18
20
  };
19
21
  value?: string;
20
- size?: "small" | "medium" | "large";
21
22
  placeholder?: string;
22
- onChange?: (event: React.SyntheticEvent, inputValue: string, dateString: string) => void;
23
- onBlur?: (event: React.SyntheticEvent) => void;
23
+ onChange?: (event: React.SyntheticEvent, value: string, utcDateString: string) => void;
24
+ onBlur?: (event: React.SyntheticEvent, value: string, utcDateString: string) => void;
24
25
  interaction?: "enabled" | "disabled" | "readonly";
25
26
  isRequired?: boolean;
26
27
  isInline?: boolean;
27
28
  width?: string;
28
29
  messages?: FormMessage[];
29
- onRequestShowCalendar?: (event: SyntheticEvent) => void;
30
- onRequestHideCalendar?: (event: SyntheticEvent) => void;
31
- onRequestValidateDate?: (value?: string, internalValidationPassed?: boolean) => void | FormMessage[];
32
30
  invalidDateErrorMessage?: string;
33
31
  locale?: string;
34
32
  timezone?: string;
@@ -38,7 +36,11 @@ declare const DateInput2: {
38
36
  startYear: number;
39
37
  endYear: number;
40
38
  };
41
- formatDate?: (isoDate: string, locale: string, timezone: string) => string;
39
+ dateFormat?: {
40
+ parser: (input: string) => Date;
41
+ formatter: (date: Date) => string;
42
+ } | string;
43
+ onRequestValidateDate?: (event: React.SyntheticEvent, value: string, utcDateString: string) => void;
42
44
  }>;
43
45
  };
44
46
  export default DateInput2;
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/DateInput2/index.tsx"],"names":[],"mappings":"AA0BA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,OAAO,CAAA;AAa3C,OAAO,EAAE,GAAG,EAAE,MAAM,sBAAsB,CAAA;AAG1C,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,SAAS,CAAA;AAC9C,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAA;AAqB7D;;;;GAIG;AACH,QAAA,MAAM,UAAU;iPAqBb,eAAe;;;;;;;;;;;2BArChB,MAAM,cACJ;yBAMO,MAAO,cAIjB;;;;;;;;sCAiEa,CAAC,kCAAsC,CAAC;;;;;;+BAmE9B,CAAC;;;;;;CA8DxB,CAAA;AAID,eAAe,UAAU,CAAA;AACzB,OAAO,EAAE,UAAU,EAAE,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/DateInput2/index.tsx"],"names":[],"mappings":"AA0BA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,OAAO,CAAA;AAa3C,OAAO,EAAE,GAAG,EAAE,MAAM,sBAAsB,CAAA;AAG1C,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,SAAS,CAAA;AAC9C,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAA;AAyE7D;;;;;;GAMG;AACH,QAAA,MAAM,UAAU;2OAoBb,eAAe;;;;;;;;;;2BA/FA,MAAO,cAAc;yBAC4C,MAAO,cAAa;;;;;;;;;;;+BAsFlF,CAAC;;;;;;;;wCAyBZ,MAAO,cAAc;;CAsJ9B,CAAA;AAID,eAAe,UAAU,CAAA;AACzB,OAAO,EAAE,UAAU,EAAE,CAAA"}
@@ -12,13 +12,9 @@ type DateInput2OwnProps = {
12
12
  nextMonthButton: string;
13
13
  };
14
14
  /**
15
- * Specifies the input value.
15
+ * Specifies the input value *before* formatting. The `formatDate` will be applied to it before displaying. Should be a valid, parsable date.
16
16
  */
17
17
  value?: string;
18
- /**
19
- * Specifies the input size.
20
- */
21
- size?: 'small' | 'medium' | 'large';
22
18
  /**
23
19
  * Html placeholder text to display when the input has no value. This should
24
20
  * be hint text, not a label replacement.
@@ -27,11 +23,11 @@ type DateInput2OwnProps = {
27
23
  /**
28
24
  * Callback fired when the input changes.
29
25
  */
30
- onChange?: (event: React.SyntheticEvent, inputValue: string, dateString: string) => void;
26
+ onChange?: (event: React.SyntheticEvent, value: string, utcDateString: string) => void;
31
27
  /**
32
28
  * Callback executed when the input fires a blur event.
33
29
  */
34
- onBlur?: (event: React.SyntheticEvent) => void;
30
+ onBlur?: (event: React.SyntheticEvent, value: string, utcDateString: string) => void;
35
31
  /**
36
32
  * Specifies if interaction with the input is enabled, disabled, or readonly.
37
33
  * When "disabled", the input changes visibly to indicate that it cannot
@@ -61,21 +57,6 @@ type DateInput2OwnProps = {
61
57
  * }`
62
58
  */
63
59
  messages?: FormMessage[];
64
- /**
65
- * Callback fired requesting the calendar be shown.
66
- */
67
- onRequestShowCalendar?: (event: SyntheticEvent) => void;
68
- /**
69
- * Callback fired requesting the calendar be hidden.
70
- */
71
- onRequestHideCalendar?: (event: SyntheticEvent) => void;
72
- /**
73
- * Callback fired when the input is blurred. Feedback should be provided
74
- * to the user when this function is called if the selected date or input
75
- * value is invalid. The component has an internal check whether the date can
76
- * be parsed to a valid date.
77
- */
78
- onRequestValidateDate?: (value?: string, internalValidationPassed?: boolean) => void | FormMessage[];
79
60
  /**
80
61
  * The message shown to the user when the date is invalid. If this prop is not set, validation is bypassed.
81
62
  * If it's set to an empty string, validation happens and the input border changes to red if validation hasn't passed.
@@ -125,9 +106,16 @@ type DateInput2OwnProps = {
125
106
  endYear: number;
126
107
  };
127
108
  /**
128
- * Formatting function for how the date should be displayed inside the input field. It will be applied if the user clicks on a date in the date picker of after blur event from the input field.
109
+ * By default the date format is determined by the locale but can be changed via this prop to an alternate locale (passing it in as a string) or a custom parser and formatter (both as functions)
110
+ */
111
+ dateFormat?: {
112
+ parser: (input: string) => Date;
113
+ formatter: (date: Date) => string;
114
+ } | string;
115
+ /**
116
+ * Callback executed when the input fires a blur event or a date is selected from the picker.
129
117
  */
130
- formatDate?: (isoDate: string, locale: string, timezone: string) => string;
118
+ onRequestValidateDate?: (event: React.SyntheticEvent, value: string, utcDateString: string) => void;
131
119
  };
132
120
  type PropKeys = keyof DateInput2OwnProps;
133
121
  type DateInput2Props = DateInput2OwnProps & OtherHTMLAttributes<DateInput2OwnProps, InputHTMLAttributes<DateInput2OwnProps & Element>>;
@@ -1 +1 @@
1
- {"version":3,"file":"props.d.ts","sourceRoot":"","sources":["../../src/DateInput2/props.ts"],"names":[],"mappings":"AAyBA,OAAO,KAAK,EAAE,cAAc,EAAE,mBAAmB,EAAE,MAAM,OAAO,CAAA;AAIhE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAA;AAC7D,OAAO,KAAK,EACV,mBAAmB,EACnB,UAAU,EACV,cAAc,EACf,MAAM,2BAA2B,CAAA;AAElC,KAAK,kBAAkB,GAAG;IACxB;;OAEG;IACH,WAAW,EAAE,UAAU,CAAA;IACvB,kBAAkB,EAAE;QAClB,YAAY,EAAE,MAAM,CAAA;QACpB,eAAe,EAAE,MAAM,CAAA;QACvB,eAAe,EAAE,MAAM,CAAA;KACxB,CAAA;IACD;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAA;IACd;;OAEG;IACH,IAAI,CAAC,EAAE,OAAO,GAAG,QAAQ,GAAG,OAAO,CAAA;IACnC;;;OA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