@oaknational/oak-components 3.6.1 → 3.6.2
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/dist/npm/cjs/index.js +26 -22
- package/dist/npm/cjs/types.d.ts +83 -82
- package/dist/npm/es/components/images-and-icons/OakIcon/OakIcon.js +3 -24
- package/dist/npm/es/components/images-and-icons/OakIcon/helpers.js +29 -0
- package/dist/npm/es/index.js +2 -1
- package/dist/npm/es/types.d.ts +83 -82
- package/package.json +1 -1
package/dist/npm/cjs/index.js
CHANGED
|
@@ -1052,6 +1052,32 @@ var backgrounds = {
|
|
|
1052
1052
|
"line-mint": "v1715356384/pupil-journey/line-mint.svg",
|
|
1053
1053
|
};
|
|
1054
1054
|
|
|
1055
|
+
var oakIconNames = Object.keys(icons);
|
|
1056
|
+
/*
|
|
1057
|
+
* NOTE: This file is separated from OakIcon to allow server side usage in next.js apps
|
|
1058
|
+
*/
|
|
1059
|
+
/**
|
|
1060
|
+
* returns true if the given string is a valid `OakIconName`
|
|
1061
|
+
*/
|
|
1062
|
+
function isValidIconName(iconName) {
|
|
1063
|
+
return oakIconNames.includes(iconName);
|
|
1064
|
+
}
|
|
1065
|
+
/**
|
|
1066
|
+
* returns a Icon URL from Cloudinary if is a valid icon, otherwise returns undefined
|
|
1067
|
+
*/
|
|
1068
|
+
function generateOakIconURL(iconName) {
|
|
1069
|
+
var urlPath = "https://".concat(process.env.NEXT_PUBLIC_OAK_ASSETS_HOST, "/").concat(process.env.NEXT_PUBLIC_OAK_ASSETS_PATH);
|
|
1070
|
+
if (isValidIconName(iconName)) {
|
|
1071
|
+
return "".concat(urlPath, "/").concat(icons[iconName]);
|
|
1072
|
+
}
|
|
1073
|
+
else if (iconName.includes("subject")) {
|
|
1074
|
+
return "".concat(urlPath, "/").concat(icons["books"]);
|
|
1075
|
+
}
|
|
1076
|
+
else {
|
|
1077
|
+
return "".concat(urlPath, "/").concat(icons["question-mark"]);
|
|
1078
|
+
}
|
|
1079
|
+
}
|
|
1080
|
+
|
|
1055
1081
|
function useShowPlaceholder() {
|
|
1056
1082
|
// Default to false so that we don't show the placeholder if the image is already complete
|
|
1057
1083
|
var _a = tslib.__read(React.useState(false), 2), showPlaceholder = _a[0], setShowPlaceholder = _a[1];
|
|
@@ -1136,28 +1162,6 @@ var OakImage = function (_a) {
|
|
|
1136
1162
|
};
|
|
1137
1163
|
var templateObject_1$1O, templateObject_2$T, templateObject_3$B, templateObject_4$n, templateObject_5$f, templateObject_6$b, templateObject_7$5;
|
|
1138
1164
|
|
|
1139
|
-
var oakIconNames = Object.keys(icons);
|
|
1140
|
-
/**
|
|
1141
|
-
* returns true if the given string is a valid `OakIconName`
|
|
1142
|
-
*/
|
|
1143
|
-
function isValidIconName(iconName) {
|
|
1144
|
-
return oakIconNames.includes(iconName);
|
|
1145
|
-
}
|
|
1146
|
-
/**
|
|
1147
|
-
* returns a Icon URL from Cloudinary if is a valid icon, otherwise returns undefined
|
|
1148
|
-
*/
|
|
1149
|
-
function generateOakIconURL(iconName) {
|
|
1150
|
-
var urlPath = "https://".concat(process.env.NEXT_PUBLIC_OAK_ASSETS_HOST, "/").concat(process.env.NEXT_PUBLIC_OAK_ASSETS_PATH);
|
|
1151
|
-
if (isValidIconName(iconName)) {
|
|
1152
|
-
return "".concat(urlPath, "/").concat(icons[iconName]);
|
|
1153
|
-
}
|
|
1154
|
-
else if (iconName.includes("subject")) {
|
|
1155
|
-
return "".concat(urlPath, "/").concat(icons["books"]);
|
|
1156
|
-
}
|
|
1157
|
-
else {
|
|
1158
|
-
return "".concat(urlPath, "/").concat(icons["question-mark"]);
|
|
1159
|
-
}
|
|
1160
|
-
}
|
|
1161
1165
|
/**
|
|
1162
1166
|
* A wrapper around OakImage which uses the image-map.json file to map icon names to image paths.
|
|
1163
1167
|
*/
|
package/dist/npm/cjs/types.d.ts
CHANGED
|
@@ -599,78 +599,6 @@ type InternalButtonProps = StyledButtonProps & {
|
|
|
599
599
|
onHovered?: (event: React$1.MouseEvent<HTMLButtonElement, MouseEvent>, duration: number) => void;
|
|
600
600
|
};
|
|
601
601
|
|
|
602
|
-
declare const oakOpacityTokens: {
|
|
603
|
-
transparent: number;
|
|
604
|
-
"semi-transparent": number;
|
|
605
|
-
"semi-opaque": number;
|
|
606
|
-
opaque: number;
|
|
607
|
-
};
|
|
608
|
-
type OakOpacityToken = keyof typeof oakOpacityTokens;
|
|
609
|
-
|
|
610
|
-
declare const oakTransitionTokens: {
|
|
611
|
-
"standard-ease": string;
|
|
612
|
-
"standard-transform": string;
|
|
613
|
-
};
|
|
614
|
-
type OakTransitionToken = keyof typeof oakTransitionTokens;
|
|
615
|
-
|
|
616
|
-
declare const oakZIndexTokens: {
|
|
617
|
-
readonly behind: -1;
|
|
618
|
-
readonly neutral: 0;
|
|
619
|
-
readonly "in-front": 1;
|
|
620
|
-
readonly "mobile-filters": 2;
|
|
621
|
-
readonly "fixed-header": 100;
|
|
622
|
-
readonly "modal-close-button": 150;
|
|
623
|
-
readonly "modal-dialog": 300;
|
|
624
|
-
readonly banner: number;
|
|
625
|
-
};
|
|
626
|
-
type OakZIndexToken = keyof typeof oakZIndexTokens | null;
|
|
627
|
-
|
|
628
|
-
declare const oakDefaultTheme: OakTheme;
|
|
629
|
-
|
|
630
|
-
declare const oakDarkTheme: OakTheme;
|
|
631
|
-
|
|
632
|
-
declare const parseBorder: (value?: OakBorderWidthToken | null) => string | undefined;
|
|
633
|
-
|
|
634
|
-
/**
|
|
635
|
-
* - takes OakColorToken, OakUiRoleToken, null or undefined
|
|
636
|
-
* - if OakColorToken is passed, returns corresponding css value
|
|
637
|
-
* - if OakUiRoleToken is passed, returns a function that takes the current theme and returns the corresponding css value
|
|
638
|
-
* - if null or undefined is passed, returns undefined
|
|
639
|
-
*/
|
|
640
|
-
declare function parseColor(): undefined;
|
|
641
|
-
declare function parseColor(value?: OakColorToken | OakUiRoleToken | null): (props: PropsWithTheme) => string;
|
|
642
|
-
declare function parseColor(value?: OakUiRoleToken | null): ((props: PropsWithTheme) => string) | undefined;
|
|
643
|
-
|
|
644
|
-
/**
|
|
645
|
-
* - takes any of OakUiRoleToken or null/undefined
|
|
646
|
-
* - returns a function that takes the current theme and returns the corresponding css filter style for that token
|
|
647
|
-
* - returns undefined if no filter is found for the token
|
|
648
|
-
*/
|
|
649
|
-
declare function parseColorFilter(value?: OakUiRoleToken | null): (props: PropsWithTheme) => string;
|
|
650
|
-
declare function parseColorFilter(value?: OakUiRoleToken | null): ((props: PropsWithTheme) => string) | undefined;
|
|
651
|
-
|
|
652
|
-
declare const parseDropShadow: (variant?: OakDropShadowToken | null) => string | undefined;
|
|
653
|
-
|
|
654
|
-
declare const parseOpacity: (variant?: OakOpacityToken | null) => number | undefined;
|
|
655
|
-
|
|
656
|
-
declare const parseTransitions: (variant?: OakTransitionToken | null) => string | undefined;
|
|
657
|
-
|
|
658
|
-
/**
|
|
659
|
-
* - takes any of OakInnerPadding, OakSpaceBetween, OakAllSpacing, and other accepted values,
|
|
660
|
-
* - derives and returns the corresponding css value
|
|
661
|
-
* - converting to rem where necessary
|
|
662
|
-
*/
|
|
663
|
-
declare function parseSpacing(value?: OakCombinedSpacingToken | null): string | 0 | undefined;
|
|
664
|
-
|
|
665
|
-
declare const parseFontWeight: (font?: OakFontToken | null) => 300 | 400 | 500 | 600 | 700 | undefined;
|
|
666
|
-
declare const parseFontSize: (font?: OakFontToken | null) => string | null | undefined;
|
|
667
|
-
declare const parseLineHeight: (font?: OakFontToken | null) => string | null | undefined;
|
|
668
|
-
declare const parseLetterSpacing: (font?: OakFontToken | null) => "0.0115rem" | "-0.005rem" | undefined;
|
|
669
|
-
|
|
670
|
-
declare const parseBorderRadius: (value?: OakBorderRadiusToken | null) => string | undefined;
|
|
671
|
-
|
|
672
|
-
declare const parseZIndex: (value?: OakZIndexToken | number) => number | undefined;
|
|
673
|
-
|
|
674
602
|
declare const icons: {
|
|
675
603
|
readonly "question-mark": "v1706872277/icons/question-mark.svg";
|
|
676
604
|
readonly ai: "v1754063273/icons/ai_cqaksa.svg";
|
|
@@ -858,6 +786,89 @@ declare const icons: {
|
|
|
858
786
|
};
|
|
859
787
|
type IconName = keyof typeof icons;
|
|
860
788
|
|
|
789
|
+
type OakIconName = IconName;
|
|
790
|
+
declare const oakIconNames: IconName[];
|
|
791
|
+
/**
|
|
792
|
+
* returns true if the given string is a valid `OakIconName`
|
|
793
|
+
*/
|
|
794
|
+
declare function isValidIconName(iconName: string): iconName is OakIconName;
|
|
795
|
+
/**
|
|
796
|
+
* returns a Icon URL from Cloudinary if is a valid icon, otherwise returns undefined
|
|
797
|
+
*/
|
|
798
|
+
declare function generateOakIconURL(iconName: string): string;
|
|
799
|
+
|
|
800
|
+
declare const oakOpacityTokens: {
|
|
801
|
+
transparent: number;
|
|
802
|
+
"semi-transparent": number;
|
|
803
|
+
"semi-opaque": number;
|
|
804
|
+
opaque: number;
|
|
805
|
+
};
|
|
806
|
+
type OakOpacityToken = keyof typeof oakOpacityTokens;
|
|
807
|
+
|
|
808
|
+
declare const oakTransitionTokens: {
|
|
809
|
+
"standard-ease": string;
|
|
810
|
+
"standard-transform": string;
|
|
811
|
+
};
|
|
812
|
+
type OakTransitionToken = keyof typeof oakTransitionTokens;
|
|
813
|
+
|
|
814
|
+
declare const oakZIndexTokens: {
|
|
815
|
+
readonly behind: -1;
|
|
816
|
+
readonly neutral: 0;
|
|
817
|
+
readonly "in-front": 1;
|
|
818
|
+
readonly "mobile-filters": 2;
|
|
819
|
+
readonly "fixed-header": 100;
|
|
820
|
+
readonly "modal-close-button": 150;
|
|
821
|
+
readonly "modal-dialog": 300;
|
|
822
|
+
readonly banner: number;
|
|
823
|
+
};
|
|
824
|
+
type OakZIndexToken = keyof typeof oakZIndexTokens | null;
|
|
825
|
+
|
|
826
|
+
declare const oakDefaultTheme: OakTheme;
|
|
827
|
+
|
|
828
|
+
declare const oakDarkTheme: OakTheme;
|
|
829
|
+
|
|
830
|
+
declare const parseBorder: (value?: OakBorderWidthToken | null) => string | undefined;
|
|
831
|
+
|
|
832
|
+
/**
|
|
833
|
+
* - takes OakColorToken, OakUiRoleToken, null or undefined
|
|
834
|
+
* - if OakColorToken is passed, returns corresponding css value
|
|
835
|
+
* - if OakUiRoleToken is passed, returns a function that takes the current theme and returns the corresponding css value
|
|
836
|
+
* - if null or undefined is passed, returns undefined
|
|
837
|
+
*/
|
|
838
|
+
declare function parseColor(): undefined;
|
|
839
|
+
declare function parseColor(value?: OakColorToken | OakUiRoleToken | null): (props: PropsWithTheme) => string;
|
|
840
|
+
declare function parseColor(value?: OakUiRoleToken | null): ((props: PropsWithTheme) => string) | undefined;
|
|
841
|
+
|
|
842
|
+
/**
|
|
843
|
+
* - takes any of OakUiRoleToken or null/undefined
|
|
844
|
+
* - returns a function that takes the current theme and returns the corresponding css filter style for that token
|
|
845
|
+
* - returns undefined if no filter is found for the token
|
|
846
|
+
*/
|
|
847
|
+
declare function parseColorFilter(value?: OakUiRoleToken | null): (props: PropsWithTheme) => string;
|
|
848
|
+
declare function parseColorFilter(value?: OakUiRoleToken | null): ((props: PropsWithTheme) => string) | undefined;
|
|
849
|
+
|
|
850
|
+
declare const parseDropShadow: (variant?: OakDropShadowToken | null) => string | undefined;
|
|
851
|
+
|
|
852
|
+
declare const parseOpacity: (variant?: OakOpacityToken | null) => number | undefined;
|
|
853
|
+
|
|
854
|
+
declare const parseTransitions: (variant?: OakTransitionToken | null) => string | undefined;
|
|
855
|
+
|
|
856
|
+
/**
|
|
857
|
+
* - takes any of OakInnerPadding, OakSpaceBetween, OakAllSpacing, and other accepted values,
|
|
858
|
+
* - derives and returns the corresponding css value
|
|
859
|
+
* - converting to rem where necessary
|
|
860
|
+
*/
|
|
861
|
+
declare function parseSpacing(value?: OakCombinedSpacingToken | null): string | 0 | undefined;
|
|
862
|
+
|
|
863
|
+
declare const parseFontWeight: (font?: OakFontToken | null) => 300 | 400 | 500 | 600 | 700 | undefined;
|
|
864
|
+
declare const parseFontSize: (font?: OakFontToken | null) => string | null | undefined;
|
|
865
|
+
declare const parseLineHeight: (font?: OakFontToken | null) => string | null | undefined;
|
|
866
|
+
declare const parseLetterSpacing: (font?: OakFontToken | null) => "0.0115rem" | "-0.005rem" | undefined;
|
|
867
|
+
|
|
868
|
+
declare const parseBorderRadius: (value?: OakBorderRadiusToken | null) => string | undefined;
|
|
869
|
+
|
|
870
|
+
declare const parseZIndex: (value?: OakZIndexToken | number) => number | undefined;
|
|
871
|
+
|
|
861
872
|
type ColorFilterToken = ResponsiveValues<OakUiRoleToken | null>;
|
|
862
873
|
type ColorFilterStyleProps = {
|
|
863
874
|
/**
|
|
@@ -1138,8 +1149,6 @@ declare const placeholderStyles: styled_components.FlattenInterpolation<styled_c
|
|
|
1138
1149
|
*/
|
|
1139
1150
|
declare const OakImage: <C extends ElementType = typeof Image>({ ...props }: OakImageProps<C>) => React$1.JSX.Element;
|
|
1140
1151
|
|
|
1141
|
-
declare const oakIconNames: IconName[];
|
|
1142
|
-
type OakIconName = IconName;
|
|
1143
1152
|
type OakIconProps = Omit<OakImageProps, "alt" | "src"> & {
|
|
1144
1153
|
/**
|
|
1145
1154
|
* The name of the icon to display
|
|
@@ -1151,14 +1160,6 @@ type OakIconProps = Omit<OakImageProps, "alt" | "src"> & {
|
|
|
1151
1160
|
iconWidth?: OakAllSpacingToken;
|
|
1152
1161
|
iconHeight?: OakAllSpacingToken;
|
|
1153
1162
|
};
|
|
1154
|
-
/**
|
|
1155
|
-
* returns true if the given string is a valid `OakIconName`
|
|
1156
|
-
*/
|
|
1157
|
-
declare function isValidIconName(iconName: string): iconName is OakIconName;
|
|
1158
|
-
/**
|
|
1159
|
-
* returns a Icon URL from Cloudinary if is a valid icon, otherwise returns undefined
|
|
1160
|
-
*/
|
|
1161
|
-
declare function generateOakIconURL(iconName: string): string;
|
|
1162
1163
|
/**
|
|
1163
1164
|
* A wrapper around OakImage which uses the image-map.json file to map icon names to image paths.
|
|
1164
1165
|
*/
|
|
@@ -1,30 +1,9 @@
|
|
|
1
1
|
import { __rest, __assign } from 'tslib';
|
|
2
2
|
import React from 'react';
|
|
3
|
-
import {
|
|
3
|
+
import { generateOakIconURL } from './helpers.js';
|
|
4
|
+
export { isValidIconName, oakIconNames } from './helpers.js';
|
|
4
5
|
import { OakImage } from '../OakImage/OakImage.js';
|
|
5
6
|
|
|
6
|
-
var oakIconNames = Object.keys(icons);
|
|
7
|
-
/**
|
|
8
|
-
* returns true if the given string is a valid `OakIconName`
|
|
9
|
-
*/
|
|
10
|
-
function isValidIconName(iconName) {
|
|
11
|
-
return oakIconNames.includes(iconName);
|
|
12
|
-
}
|
|
13
|
-
/**
|
|
14
|
-
* returns a Icon URL from Cloudinary if is a valid icon, otherwise returns undefined
|
|
15
|
-
*/
|
|
16
|
-
function generateOakIconURL(iconName) {
|
|
17
|
-
var urlPath = "https://".concat(process.env.NEXT_PUBLIC_OAK_ASSETS_HOST, "/").concat(process.env.NEXT_PUBLIC_OAK_ASSETS_PATH);
|
|
18
|
-
if (isValidIconName(iconName)) {
|
|
19
|
-
return "".concat(urlPath, "/").concat(icons[iconName]);
|
|
20
|
-
}
|
|
21
|
-
else if (iconName.includes("subject")) {
|
|
22
|
-
return "".concat(urlPath, "/").concat(icons["books"]);
|
|
23
|
-
}
|
|
24
|
-
else {
|
|
25
|
-
return "".concat(urlPath, "/").concat(icons["question-mark"]);
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
7
|
/**
|
|
29
8
|
* A wrapper around OakImage which uses the image-map.json file to map icon names to image paths.
|
|
30
9
|
*/
|
|
@@ -35,4 +14,4 @@ var OakIcon = function (props) {
|
|
|
35
14
|
unoptimized: true }, rest)));
|
|
36
15
|
};
|
|
37
16
|
|
|
38
|
-
export { OakIcon, generateOakIconURL
|
|
17
|
+
export { OakIcon, generateOakIconURL };
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { icons } from '../../../image-map.js';
|
|
2
|
+
|
|
3
|
+
var oakIconNames = Object.keys(icons);
|
|
4
|
+
/*
|
|
5
|
+
* NOTE: This file is separated from OakIcon to allow server side usage in next.js apps
|
|
6
|
+
*/
|
|
7
|
+
/**
|
|
8
|
+
* returns true if the given string is a valid `OakIconName`
|
|
9
|
+
*/
|
|
10
|
+
function isValidIconName(iconName) {
|
|
11
|
+
return oakIconNames.includes(iconName);
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* returns a Icon URL from Cloudinary if is a valid icon, otherwise returns undefined
|
|
15
|
+
*/
|
|
16
|
+
function generateOakIconURL(iconName) {
|
|
17
|
+
var urlPath = "https://".concat(process.env.NEXT_PUBLIC_OAK_ASSETS_HOST, "/").concat(process.env.NEXT_PUBLIC_OAK_ASSETS_PATH);
|
|
18
|
+
if (isValidIconName(iconName)) {
|
|
19
|
+
return "".concat(urlPath, "/").concat(icons[iconName]);
|
|
20
|
+
}
|
|
21
|
+
else if (iconName.includes("subject")) {
|
|
22
|
+
return "".concat(urlPath, "/").concat(icons["books"]);
|
|
23
|
+
}
|
|
24
|
+
else {
|
|
25
|
+
return "".concat(urlPath, "/").concat(icons["question-mark"]);
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export { generateOakIconURL, isValidIconName, oakIconNames };
|
package/dist/npm/es/index.js
CHANGED
|
@@ -41,7 +41,7 @@ export { OakSearchFilterCheckBox } from './components/form-elements/OakSearchFil
|
|
|
41
41
|
export { OakCaptionCard } from './components/house-cat/OakCaptionCard/OakCaptionCard.js';
|
|
42
42
|
export { OakCaptionSearch } from './components/house-cat/OakCaptionSearch/OakCaptionSearch.js';
|
|
43
43
|
export { OakAspectRatio } from './components/images-and-icons/OakAspectRatio/OakAspectRatio.js';
|
|
44
|
-
export { OakIcon
|
|
44
|
+
export { OakIcon } from './components/images-and-icons/OakIcon/OakIcon.js';
|
|
45
45
|
export { OakImage, oakPlaceholder, placeholderStyles } from './components/images-and-icons/OakImage/OakImage.js';
|
|
46
46
|
export { OakSvg } from './components/images-and-icons/OakSvg/OakSvg.js';
|
|
47
47
|
export { OakRoundIcon } from './components/images-and-icons/OakRoundIcon/OakRoundIcon.js';
|
|
@@ -197,3 +197,4 @@ export { useMediaQuery } from './hooks/useMediaQuery.js';
|
|
|
197
197
|
export { useMounted } from './hooks/useMounted.js';
|
|
198
198
|
export { useIsScrolled } from './hooks/useIsScrolled.js';
|
|
199
199
|
export { useBreakpoint } from './hooks/useBreakpoint.js';
|
|
200
|
+
export { generateOakIconURL, isValidIconName, oakIconNames } from './components/images-and-icons/OakIcon/helpers.js';
|
package/dist/npm/es/types.d.ts
CHANGED
|
@@ -599,78 +599,6 @@ type InternalButtonProps = StyledButtonProps & {
|
|
|
599
599
|
onHovered?: (event: React$1.MouseEvent<HTMLButtonElement, MouseEvent>, duration: number) => void;
|
|
600
600
|
};
|
|
601
601
|
|
|
602
|
-
declare const oakOpacityTokens: {
|
|
603
|
-
transparent: number;
|
|
604
|
-
"semi-transparent": number;
|
|
605
|
-
"semi-opaque": number;
|
|
606
|
-
opaque: number;
|
|
607
|
-
};
|
|
608
|
-
type OakOpacityToken = keyof typeof oakOpacityTokens;
|
|
609
|
-
|
|
610
|
-
declare const oakTransitionTokens: {
|
|
611
|
-
"standard-ease": string;
|
|
612
|
-
"standard-transform": string;
|
|
613
|
-
};
|
|
614
|
-
type OakTransitionToken = keyof typeof oakTransitionTokens;
|
|
615
|
-
|
|
616
|
-
declare const oakZIndexTokens: {
|
|
617
|
-
readonly behind: -1;
|
|
618
|
-
readonly neutral: 0;
|
|
619
|
-
readonly "in-front": 1;
|
|
620
|
-
readonly "mobile-filters": 2;
|
|
621
|
-
readonly "fixed-header": 100;
|
|
622
|
-
readonly "modal-close-button": 150;
|
|
623
|
-
readonly "modal-dialog": 300;
|
|
624
|
-
readonly banner: number;
|
|
625
|
-
};
|
|
626
|
-
type OakZIndexToken = keyof typeof oakZIndexTokens | null;
|
|
627
|
-
|
|
628
|
-
declare const oakDefaultTheme: OakTheme;
|
|
629
|
-
|
|
630
|
-
declare const oakDarkTheme: OakTheme;
|
|
631
|
-
|
|
632
|
-
declare const parseBorder: (value?: OakBorderWidthToken | null) => string | undefined;
|
|
633
|
-
|
|
634
|
-
/**
|
|
635
|
-
* - takes OakColorToken, OakUiRoleToken, null or undefined
|
|
636
|
-
* - if OakColorToken is passed, returns corresponding css value
|
|
637
|
-
* - if OakUiRoleToken is passed, returns a function that takes the current theme and returns the corresponding css value
|
|
638
|
-
* - if null or undefined is passed, returns undefined
|
|
639
|
-
*/
|
|
640
|
-
declare function parseColor(): undefined;
|
|
641
|
-
declare function parseColor(value?: OakColorToken | OakUiRoleToken | null): (props: PropsWithTheme) => string;
|
|
642
|
-
declare function parseColor(value?: OakUiRoleToken | null): ((props: PropsWithTheme) => string) | undefined;
|
|
643
|
-
|
|
644
|
-
/**
|
|
645
|
-
* - takes any of OakUiRoleToken or null/undefined
|
|
646
|
-
* - returns a function that takes the current theme and returns the corresponding css filter style for that token
|
|
647
|
-
* - returns undefined if no filter is found for the token
|
|
648
|
-
*/
|
|
649
|
-
declare function parseColorFilter(value?: OakUiRoleToken | null): (props: PropsWithTheme) => string;
|
|
650
|
-
declare function parseColorFilter(value?: OakUiRoleToken | null): ((props: PropsWithTheme) => string) | undefined;
|
|
651
|
-
|
|
652
|
-
declare const parseDropShadow: (variant?: OakDropShadowToken | null) => string | undefined;
|
|
653
|
-
|
|
654
|
-
declare const parseOpacity: (variant?: OakOpacityToken | null) => number | undefined;
|
|
655
|
-
|
|
656
|
-
declare const parseTransitions: (variant?: OakTransitionToken | null) => string | undefined;
|
|
657
|
-
|
|
658
|
-
/**
|
|
659
|
-
* - takes any of OakInnerPadding, OakSpaceBetween, OakAllSpacing, and other accepted values,
|
|
660
|
-
* - derives and returns the corresponding css value
|
|
661
|
-
* - converting to rem where necessary
|
|
662
|
-
*/
|
|
663
|
-
declare function parseSpacing(value?: OakCombinedSpacingToken | null): string | 0 | undefined;
|
|
664
|
-
|
|
665
|
-
declare const parseFontWeight: (font?: OakFontToken | null) => 300 | 400 | 500 | 600 | 700 | undefined;
|
|
666
|
-
declare const parseFontSize: (font?: OakFontToken | null) => string | null | undefined;
|
|
667
|
-
declare const parseLineHeight: (font?: OakFontToken | null) => string | null | undefined;
|
|
668
|
-
declare const parseLetterSpacing: (font?: OakFontToken | null) => "0.0115rem" | "-0.005rem" | undefined;
|
|
669
|
-
|
|
670
|
-
declare const parseBorderRadius: (value?: OakBorderRadiusToken | null) => string | undefined;
|
|
671
|
-
|
|
672
|
-
declare const parseZIndex: (value?: OakZIndexToken | number) => number | undefined;
|
|
673
|
-
|
|
674
602
|
declare const icons: {
|
|
675
603
|
readonly "question-mark": "v1706872277/icons/question-mark.svg";
|
|
676
604
|
readonly ai: "v1754063273/icons/ai_cqaksa.svg";
|
|
@@ -858,6 +786,89 @@ declare const icons: {
|
|
|
858
786
|
};
|
|
859
787
|
type IconName = keyof typeof icons;
|
|
860
788
|
|
|
789
|
+
type OakIconName = IconName;
|
|
790
|
+
declare const oakIconNames: IconName[];
|
|
791
|
+
/**
|
|
792
|
+
* returns true if the given string is a valid `OakIconName`
|
|
793
|
+
*/
|
|
794
|
+
declare function isValidIconName(iconName: string): iconName is OakIconName;
|
|
795
|
+
/**
|
|
796
|
+
* returns a Icon URL from Cloudinary if is a valid icon, otherwise returns undefined
|
|
797
|
+
*/
|
|
798
|
+
declare function generateOakIconURL(iconName: string): string;
|
|
799
|
+
|
|
800
|
+
declare const oakOpacityTokens: {
|
|
801
|
+
transparent: number;
|
|
802
|
+
"semi-transparent": number;
|
|
803
|
+
"semi-opaque": number;
|
|
804
|
+
opaque: number;
|
|
805
|
+
};
|
|
806
|
+
type OakOpacityToken = keyof typeof oakOpacityTokens;
|
|
807
|
+
|
|
808
|
+
declare const oakTransitionTokens: {
|
|
809
|
+
"standard-ease": string;
|
|
810
|
+
"standard-transform": string;
|
|
811
|
+
};
|
|
812
|
+
type OakTransitionToken = keyof typeof oakTransitionTokens;
|
|
813
|
+
|
|
814
|
+
declare const oakZIndexTokens: {
|
|
815
|
+
readonly behind: -1;
|
|
816
|
+
readonly neutral: 0;
|
|
817
|
+
readonly "in-front": 1;
|
|
818
|
+
readonly "mobile-filters": 2;
|
|
819
|
+
readonly "fixed-header": 100;
|
|
820
|
+
readonly "modal-close-button": 150;
|
|
821
|
+
readonly "modal-dialog": 300;
|
|
822
|
+
readonly banner: number;
|
|
823
|
+
};
|
|
824
|
+
type OakZIndexToken = keyof typeof oakZIndexTokens | null;
|
|
825
|
+
|
|
826
|
+
declare const oakDefaultTheme: OakTheme;
|
|
827
|
+
|
|
828
|
+
declare const oakDarkTheme: OakTheme;
|
|
829
|
+
|
|
830
|
+
declare const parseBorder: (value?: OakBorderWidthToken | null) => string | undefined;
|
|
831
|
+
|
|
832
|
+
/**
|
|
833
|
+
* - takes OakColorToken, OakUiRoleToken, null or undefined
|
|
834
|
+
* - if OakColorToken is passed, returns corresponding css value
|
|
835
|
+
* - if OakUiRoleToken is passed, returns a function that takes the current theme and returns the corresponding css value
|
|
836
|
+
* - if null or undefined is passed, returns undefined
|
|
837
|
+
*/
|
|
838
|
+
declare function parseColor(): undefined;
|
|
839
|
+
declare function parseColor(value?: OakColorToken | OakUiRoleToken | null): (props: PropsWithTheme) => string;
|
|
840
|
+
declare function parseColor(value?: OakUiRoleToken | null): ((props: PropsWithTheme) => string) | undefined;
|
|
841
|
+
|
|
842
|
+
/**
|
|
843
|
+
* - takes any of OakUiRoleToken or null/undefined
|
|
844
|
+
* - returns a function that takes the current theme and returns the corresponding css filter style for that token
|
|
845
|
+
* - returns undefined if no filter is found for the token
|
|
846
|
+
*/
|
|
847
|
+
declare function parseColorFilter(value?: OakUiRoleToken | null): (props: PropsWithTheme) => string;
|
|
848
|
+
declare function parseColorFilter(value?: OakUiRoleToken | null): ((props: PropsWithTheme) => string) | undefined;
|
|
849
|
+
|
|
850
|
+
declare const parseDropShadow: (variant?: OakDropShadowToken | null) => string | undefined;
|
|
851
|
+
|
|
852
|
+
declare const parseOpacity: (variant?: OakOpacityToken | null) => number | undefined;
|
|
853
|
+
|
|
854
|
+
declare const parseTransitions: (variant?: OakTransitionToken | null) => string | undefined;
|
|
855
|
+
|
|
856
|
+
/**
|
|
857
|
+
* - takes any of OakInnerPadding, OakSpaceBetween, OakAllSpacing, and other accepted values,
|
|
858
|
+
* - derives and returns the corresponding css value
|
|
859
|
+
* - converting to rem where necessary
|
|
860
|
+
*/
|
|
861
|
+
declare function parseSpacing(value?: OakCombinedSpacingToken | null): string | 0 | undefined;
|
|
862
|
+
|
|
863
|
+
declare const parseFontWeight: (font?: OakFontToken | null) => 300 | 400 | 500 | 600 | 700 | undefined;
|
|
864
|
+
declare const parseFontSize: (font?: OakFontToken | null) => string | null | undefined;
|
|
865
|
+
declare const parseLineHeight: (font?: OakFontToken | null) => string | null | undefined;
|
|
866
|
+
declare const parseLetterSpacing: (font?: OakFontToken | null) => "0.0115rem" | "-0.005rem" | undefined;
|
|
867
|
+
|
|
868
|
+
declare const parseBorderRadius: (value?: OakBorderRadiusToken | null) => string | undefined;
|
|
869
|
+
|
|
870
|
+
declare const parseZIndex: (value?: OakZIndexToken | number) => number | undefined;
|
|
871
|
+
|
|
861
872
|
type ColorFilterToken = ResponsiveValues<OakUiRoleToken | null>;
|
|
862
873
|
type ColorFilterStyleProps = {
|
|
863
874
|
/**
|
|
@@ -1138,8 +1149,6 @@ declare const placeholderStyles: styled_components.FlattenInterpolation<styled_c
|
|
|
1138
1149
|
*/
|
|
1139
1150
|
declare const OakImage: <C extends ElementType = typeof Image>({ ...props }: OakImageProps<C>) => React$1.JSX.Element;
|
|
1140
1151
|
|
|
1141
|
-
declare const oakIconNames: IconName[];
|
|
1142
|
-
type OakIconName = IconName;
|
|
1143
1152
|
type OakIconProps = Omit<OakImageProps, "alt" | "src"> & {
|
|
1144
1153
|
/**
|
|
1145
1154
|
* The name of the icon to display
|
|
@@ -1151,14 +1160,6 @@ type OakIconProps = Omit<OakImageProps, "alt" | "src"> & {
|
|
|
1151
1160
|
iconWidth?: OakAllSpacingToken;
|
|
1152
1161
|
iconHeight?: OakAllSpacingToken;
|
|
1153
1162
|
};
|
|
1154
|
-
/**
|
|
1155
|
-
* returns true if the given string is a valid `OakIconName`
|
|
1156
|
-
*/
|
|
1157
|
-
declare function isValidIconName(iconName: string): iconName is OakIconName;
|
|
1158
|
-
/**
|
|
1159
|
-
* returns a Icon URL from Cloudinary if is a valid icon, otherwise returns undefined
|
|
1160
|
-
*/
|
|
1161
|
-
declare function generateOakIconURL(iconName: string): string;
|
|
1162
1163
|
/**
|
|
1163
1164
|
* A wrapper around OakImage which uses the image-map.json file to map icon names to image paths.
|
|
1164
1165
|
*/
|