Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Add missing props to Storybook #2313

Merged
merged 3 commits into from
Sep 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions packages/odyssey-react-mui/src/labs/DateField.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ export type DateFieldProps = {
| "errorMessage"
| "hasInitialFocus"
| "hint"
| "HintLinkComponent"
| "id"
| "isDisabled"
| "isOptional"
Expand Down Expand Up @@ -71,6 +72,7 @@ const DateField = ({
errorMessage,
hasInitialFocus,
hint,
HintLinkComponent,
id: idOverride,
inputRef,
isDisabled = false,
Expand Down Expand Up @@ -253,6 +255,7 @@ const DateField = ({
fieldType="single"
hasVisibleLabel
hint={hint}
HintLinkComponent={HintLinkComponent}
id={idOverride}
isDisabled={isDisabled}
isOptional={isOptional}
Expand Down
13 changes: 12 additions & 1 deletion packages/odyssey-react-mui/src/labs/DatePicker.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -154,15 +154,22 @@ export type DatePickerProps = {
} & OdysseyDateFieldProps &
Pick<
FieldComponentProps,
"errorMessage" | "hint" | "isDisabled" | "isReadOnly"
| "errorMessage"
| "hint"
| "HintLinkComponent"
| "isDisabled"
| "isReadOnly"
| "isOptional"
>;

const DatePicker = ({
defaultValue: defaultValueProp,
errorMessage,
hint,
HintLinkComponent,
isDateEnabled = () => true,
isDisabled,
isOptional,
isReadOnly,
isMonthEnabled = () => true,
isYearEnabled = () => true,
Expand Down Expand Up @@ -266,8 +273,10 @@ const DatePicker = ({
}
errorMessage={errorMessage}
hint={hint}
HintLinkComponent={HintLinkComponent}
inputRef={inputRef}
isDisabled={isDisabled}
isOptional={isOptional}
isReadOnly={isReadOnly}
label={label}
onBlur={onBlur}
Expand All @@ -282,8 +291,10 @@ const DatePicker = ({
[
errorMessage,
hint,
HintLinkComponent,
internalTimeZone,
isDisabled,
isOptional,
isReadOnly,
label,
onBlur,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,16 +42,10 @@ const storybookMeta: Meta<DatePickerProps> = {
},
},
errorMessage: fieldComponentPropsMetaData.errorMessage,
hint: {
control: "text",
description: "The hint text for the autocomplete input",
table: {
type: {
summary: "string",
},
},
},
hint: fieldComponentPropsMetaData.hint,
HintLinkComponent: fieldComponentPropsMetaData.HintLinkComponent,
isDisabled: fieldComponentPropsMetaData.isDisabled,
isOptional: fieldComponentPropsMetaData.isOptional,
isReadOnly: fieldComponentPropsMetaData.isReadOnly,
minDate: {
description: "the minimum selectable date enabled in the calendar",
Expand All @@ -69,6 +63,32 @@ const storybookMeta: Meta<DatePickerProps> = {
},
},
},
timeZone: {
description: "an IANA time zone applied to the DatePicker",
table: {
type: {
summary: "string",
},
},
},
timeZonePickerLabel: {
description:
"label applied to the `TimeZonePicker` field if `TimeZonePicker` field is rendered",
table: {
type: {
summary: "string",
},
},
},
timeZoneOptions: {
control: "none",
description: "an array of options for the TimeZonePicker",
table: {
type: {
summary: "[{label: string, value: string(valid IANA time zone)}]",
},
},
},
},
args: {
label: "Date picker label",
Expand Down Expand Up @@ -160,7 +180,7 @@ export const MaxDateWithError: StoryObj<DatePickerProps> = {

export const WithTimeZonePicker: StoryObj<DatePickerProps> = {
args: {
timeZonePickerLabel: "Timezone picker label",
timeZonePickerLabel: "Time zone picker label",
timeZoneOptions: [
{ label: "New York", value: "America/New_York" },
{ label: "Johannesburg", value: "Africa/Johannesburg" },
Expand All @@ -171,7 +191,7 @@ export const WithTimeZonePicker: StoryObj<DatePickerProps> = {

export const Controlled: StoryObj<DatePickerProps> = {
args: {
timeZonePickerLabel: "Timezone picker label",
timeZonePickerLabel: "Time zone picker label",
timeZone: "America/New_York",
timeZoneOptions: [
{ label: "LA", value: "America/Los_Angeles" },
Expand Down