-
Notifications
You must be signed in to change notification settings - Fork 34
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
DES-6573 feat(odyssey-react-mui): adding DateTimePicker chore(odyssey-react-mui): abstracting more logic to hook chore(odyssey-react-mui): uodate story label chore(odyssey-react-mui): fix failing test refactor(odyssey-react-mui): move inputchange to hook refactor(odyssey-react-mui): use our icons for tabs feat(odyssey-react-mui): calendar styling updates refactor(odyssey-react-mui): adding tests feat(odyssey-react-mui): update padding feat(odyssey-react-mui): add some more basic tests fix(odyssey-react-mui): fix broken Button imports fix(odyssey-react-mui): remove commented code fix(odyssey-react-mui): remove commented code and fix clock style fix(odyssey-react-mui): remove forced use of mobile picker left in error chore(odyssey-react-mui): test commit fix(odyssey-react-mui): fix Ignored unknown option --loglevel=warn error fix(odyssey-react-mui): fix lint warnings fix(odyssey-react-mui): run prettier
- Loading branch information
1 parent
e8ee2be
commit 8fbca55
Showing
19 changed files
with
1,402 additions
and
162 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
65 changes: 65 additions & 0 deletions
65
packages/odyssey-react-mui/src/labs/DatePickers/DateFieldActionBar.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
/*! | ||
* Copyright (c) 2023-present, Okta, Inc. and/or its affiliates. All rights reserved. | ||
* The Okta software accompanied by this notice is provided pursuant to the Apache License, Version 2.0 (the "License.") | ||
* | ||
* You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0. | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT | ||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* | ||
* See the License for the specific language governing permissions and limitations under the License. | ||
*/ | ||
|
||
import { memo } from "react"; | ||
import { useTranslation } from "react-i18next"; | ||
import { PickersActionBarProps } from "@mui/x-date-pickers"; | ||
import styled from "@emotion/styled"; | ||
|
||
import { Button } from "../../Buttons"; | ||
import { | ||
useOdysseyDesignTokens, | ||
DesignTokens, | ||
} from "../../OdysseyDesignTokensContext"; | ||
|
||
const ActionContainer = styled.div<{ odysseyDesignTokens: DesignTokens }>( | ||
({ odysseyDesignTokens }) => ({ | ||
display: "flex", | ||
justifyContent: "flex-end", | ||
paddingInline: odysseyDesignTokens.Spacing4, | ||
paddingBlockEnd: odysseyDesignTokens.Spacing4, | ||
}), | ||
); | ||
|
||
const DateFieldActionBar = ({ | ||
actions, | ||
onAccept, | ||
onCancel, | ||
}: PickersActionBarProps) => { | ||
const { t } = useTranslation(); | ||
const odysseyDesignTokens = useOdysseyDesignTokens(); | ||
|
||
// actions will be [] or ["accept", "cancel"] | ||
if (actions && actions.length > 0) { | ||
return ( | ||
<ActionContainer odysseyDesignTokens={odysseyDesignTokens}> | ||
<Button | ||
label={t("picker.labels.action.cancel")} | ||
onClick={onCancel} | ||
variant="floating" | ||
/> | ||
<Button | ||
label={t("picker.labels.action.apply")} | ||
onClick={onAccept} | ||
variant="primary" | ||
/> | ||
</ActionContainer> | ||
); | ||
} | ||
|
||
return null; | ||
}; | ||
|
||
const MemoizedDateFieldActionBar = memo(DateFieldActionBar); | ||
MemoizedDateFieldActionBar.displayName = "DateFieldActionBar"; | ||
|
||
export { MemoizedDateFieldActionBar as DateFieldActionBar }; |
46 changes: 46 additions & 0 deletions
46
packages/odyssey-react-mui/src/labs/DatePickers/DateFieldLocalizationProvider.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
/*! | ||
* Copyright (c) 2023-present, Okta, Inc. and/or its affiliates. All rights reserved. | ||
* The Okta software accompanied by this notice is provided pursuant to the Apache License, Version 2.0 (the "License.") | ||
* | ||
* You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0. | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT | ||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* | ||
* See the License for the specific language governing permissions and limitations under the License. | ||
*/ | ||
|
||
import { memo, PropsWithChildren } from "react"; | ||
import { LocalizationProvider } from "@mui/x-date-pickers"; | ||
import { AdapterLuxon } from "@mui/x-date-pickers/AdapterLuxon"; | ||
|
||
import { DateFieldsTranslations } from "./useDateFieldsTranslations"; | ||
|
||
type DateFieldLocalizationProviderProps = { | ||
localeText: DateFieldsTranslations; | ||
defaultedLanguageCode: string; | ||
}; | ||
|
||
const DateFieldLocalizationProvider = ({ | ||
children, | ||
defaultedLanguageCode, | ||
localeText, | ||
}: PropsWithChildren<DateFieldLocalizationProviderProps>) => { | ||
return ( | ||
<LocalizationProvider | ||
dateAdapter={AdapterLuxon} | ||
adapterLocale={defaultedLanguageCode} | ||
localeText={localeText} | ||
> | ||
{children} | ||
</LocalizationProvider> | ||
); | ||
}; | ||
|
||
const MemoizedDateFieldLocalizationProvider = memo( | ||
DateFieldLocalizationProvider, | ||
); | ||
MemoizedDateFieldLocalizationProvider.displayName = | ||
"DateFieldLocalizationProvider"; | ||
|
||
export { MemoizedDateFieldLocalizationProvider as DateFieldLocalizationProvider }; |
Oops, something went wrong.