@wistia/ui 0.6.3 → 0.6.4-beta.64ad51b3.cce4025
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/index.cjs +103 -81
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.mts +22 -19
- package/dist/index.d.ts +22 -19
- package/dist/index.mjs +102 -81
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -1
package/dist/index.cjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
|
|
2
2
|
/*
|
|
3
|
-
* @license @wistia/ui v0.6.
|
|
3
|
+
* @license @wistia/ui v0.6.4-beta.64ad51b3.cce4025
|
|
4
4
|
*
|
|
5
5
|
* Copyright (c) 2024-2025, Wistia, Inc. and its affiliates.
|
|
6
6
|
*
|
|
@@ -61,6 +61,9 @@ __export(index_exports, {
|
|
|
61
61
|
Divider: () => Divider,
|
|
62
62
|
EditableHeading: () => EditableHeading,
|
|
63
63
|
Ellipsis: () => Ellipsis,
|
|
64
|
+
FileAmountLimitValidator: () => import_validators.FileAmountLimitValidator,
|
|
65
|
+
FileSizeValidator: () => import_validators.FileSizeValidator,
|
|
66
|
+
FileTypeValidator: () => import_validators.FileTypeValidator,
|
|
64
67
|
Form: () => Form,
|
|
65
68
|
FormErrorSummary: () => FormErrorSummary,
|
|
66
69
|
FormField: () => FormField,
|
|
@@ -69,6 +72,7 @@ __export(index_exports, {
|
|
|
69
72
|
Icon: () => Icon,
|
|
70
73
|
IconButton: () => IconButton,
|
|
71
74
|
Image: () => Image,
|
|
75
|
+
ImageDimensionsValidator: () => import_validators.ImageDimensionsValidator,
|
|
72
76
|
Input: () => Input,
|
|
73
77
|
Label: () => Label,
|
|
74
78
|
Link: () => Link,
|
|
@@ -79,6 +83,7 @@ __export(index_exports, {
|
|
|
79
83
|
MenuLabel: () => MenuLabel,
|
|
80
84
|
MenuRadioGroup: () => MenuRadioGroup,
|
|
81
85
|
Modal: () => Modal,
|
|
86
|
+
PersistentFileAmountLimitValidator: () => import_validators.PersistentFileAmountLimitValidator,
|
|
82
87
|
Popover: () => Popover,
|
|
83
88
|
Radio: () => Radio,
|
|
84
89
|
RadioGroup: () => RadioGroup,
|
|
@@ -108,7 +113,9 @@ __export(index_exports, {
|
|
|
108
113
|
useActiveMq: () => useActiveMq,
|
|
109
114
|
useAriaLive: () => useAriaLive,
|
|
110
115
|
useBoolean: () => useBoolean,
|
|
116
|
+
useFilePicker: () => import_use_file_picker.useFilePicker,
|
|
111
117
|
useFormState: () => useFormState,
|
|
118
|
+
useImperativeFilePicker: () => import_use_file_picker.useImperativeFilePicker,
|
|
112
119
|
useKey: () => useKey,
|
|
113
120
|
useMq: () => useMq,
|
|
114
121
|
useToast: () => useToast,
|
|
@@ -1300,7 +1307,7 @@ var typographyTokens = import_styled_components7.css`
|
|
|
1300
1307
|
--wui-typography-heading-2-family: var(--wui-typography-family-brand);
|
|
1301
1308
|
--wui-typography-heading-2-line-height: 38px;
|
|
1302
1309
|
--wui-typography-heading-2-size: 32px;
|
|
1303
|
-
--wui-typography-heading-2-weight: var(--wui-typography-weight-brand-
|
|
1310
|
+
--wui-typography-heading-2-weight: var(--wui-typography-weight-brand-black);
|
|
1304
1311
|
|
|
1305
1312
|
/* Heading 3 */
|
|
1306
1313
|
--wui-typography-heading-3-family: var(--wui-typography-family-brand);
|
|
@@ -2005,82 +2012,30 @@ var mq = {
|
|
|
2005
2012
|
xlAndDown
|
|
2006
2013
|
};
|
|
2007
2014
|
|
|
2008
|
-
// src/hooks/
|
|
2015
|
+
// src/hooks/useAriaLive/useAriaLive.tsx
|
|
2009
2016
|
var import_react3 = require("react");
|
|
2010
|
-
var useBoolean = (initialValue = false) => {
|
|
2011
|
-
const [value, setValue] = (0, import_react3.useState)(initialValue);
|
|
2012
|
-
const toggle = (0, import_react3.useCallback)(() => setValue((val) => !val), []);
|
|
2013
|
-
const setTrue = (0, import_react3.useCallback)(() => setValue(true), []);
|
|
2014
|
-
const setFalse = (0, import_react3.useCallback)(() => setValue(false), []);
|
|
2015
|
-
return [value, toggle, setTrue, setFalse, setValue];
|
|
2016
|
-
};
|
|
2017
|
-
|
|
2018
|
-
// src/hooks/useMq/useMq.ts
|
|
2019
2017
|
var import_type_guards5 = require("@wistia/type-guards");
|
|
2018
|
+
var useAriaLive = () => {
|
|
2019
|
+
const context = (0, import_react3.useContext)(AriaLiveContext);
|
|
2020
|
+
if ((0, import_type_guards5.isNil)(context)) {
|
|
2021
|
+
throw new Error("useAriaLive must be used within an AriaLiveProvider");
|
|
2022
|
+
}
|
|
2023
|
+
return context;
|
|
2024
|
+
};
|
|
2020
2025
|
|
|
2021
|
-
// src/hooks/
|
|
2026
|
+
// src/hooks/useBoolean/useBoolean.ts
|
|
2022
2027
|
var import_react4 = require("react");
|
|
2023
|
-
var
|
|
2024
|
-
|
|
2025
|
-
|
|
2026
|
-
|
|
2027
|
-
|
|
2028
|
-
|
|
2029
|
-
var useWindowSize = (interval = 0) => {
|
|
2030
|
-
const [dimensions, setDimensions] = (0, import_react4.useState)({
|
|
2031
|
-
width: isClient() ? window.innerWidth : 0,
|
|
2032
|
-
height: isClient() ? window.innerHeight : 0
|
|
2033
|
-
});
|
|
2034
|
-
(0, import_react4.useLayoutEffect)(() => {
|
|
2035
|
-
const handleResize = (0, import_throttle_debounce.debounce)(
|
|
2036
|
-
interval,
|
|
2037
|
-
() => setDimensions({
|
|
2038
|
-
width: window.innerWidth,
|
|
2039
|
-
height: window.innerHeight
|
|
2040
|
-
})
|
|
2041
|
-
);
|
|
2042
|
-
window.addEventListener("resize", handleResize);
|
|
2043
|
-
return () => window.removeEventListener("resize", handleResize);
|
|
2044
|
-
}, [interval]);
|
|
2045
|
-
return dimensions;
|
|
2028
|
+
var useBoolean = (initialValue = false) => {
|
|
2029
|
+
const [value, setValue] = (0, import_react4.useState)(initialValue);
|
|
2030
|
+
const toggle = (0, import_react4.useCallback)(() => setValue((val) => !val), []);
|
|
2031
|
+
const setTrue = (0, import_react4.useCallback)(() => setValue(true), []);
|
|
2032
|
+
const setFalse = (0, import_react4.useCallback)(() => setValue(false), []);
|
|
2033
|
+
return [value, toggle, setTrue, setFalse, setValue];
|
|
2046
2034
|
};
|
|
2047
2035
|
|
|
2048
|
-
// src/hooks/
|
|
2049
|
-
var
|
|
2050
|
-
var
|
|
2051
|
-
const { width } = useWindowSize();
|
|
2052
|
-
const viewportWidth = width / REM_SIZE;
|
|
2053
|
-
const isXsAndUp = true;
|
|
2054
|
-
const isSmAndUp = viewportWidth >= Number.parseFloat(breakpoints.sm);
|
|
2055
|
-
const isMdAndUp = viewportWidth >= Number.parseFloat(breakpoints.md);
|
|
2056
|
-
const isLgAndUp = viewportWidth >= Number.parseFloat(breakpoints.lg);
|
|
2057
|
-
const isXlAndUp = viewportWidth >= Number.parseFloat(breakpoints.xl);
|
|
2058
|
-
const isXsAndDown = viewportWidth < Number.parseFloat(breakpoints.sm);
|
|
2059
|
-
const isSmAndDown = viewportWidth < Number.parseFloat(breakpoints.md);
|
|
2060
|
-
const isMdAndDown = viewportWidth < Number.parseFloat(breakpoints.lg);
|
|
2061
|
-
const isLgAndDown = viewportWidth < Number.parseFloat(breakpoints.xl);
|
|
2062
|
-
const isXlAndDown = true;
|
|
2063
|
-
return {
|
|
2064
|
-
isXlAndUp,
|
|
2065
|
-
isLgAndUp,
|
|
2066
|
-
isMdAndUp,
|
|
2067
|
-
isSmAndUp,
|
|
2068
|
-
isXsAndUp,
|
|
2069
|
-
isXsAndDown,
|
|
2070
|
-
isSmAndDown,
|
|
2071
|
-
isMdAndDown,
|
|
2072
|
-
isLgAndDown,
|
|
2073
|
-
isXlAndDown
|
|
2074
|
-
};
|
|
2075
|
-
};
|
|
2076
|
-
var useActiveMq = () => {
|
|
2077
|
-
const mq2 = useMq();
|
|
2078
|
-
const keys = Object.keys(mq2);
|
|
2079
|
-
return keys.filter((key) => {
|
|
2080
|
-
const value = mq2[key];
|
|
2081
|
-
return (0, import_type_guards5.isBoolean)(value) && value;
|
|
2082
|
-
});
|
|
2083
|
-
};
|
|
2036
|
+
// src/hooks/useFilePicker/index.ts
|
|
2037
|
+
var import_use_file_picker = require("use-file-picker");
|
|
2038
|
+
var import_validators = require("use-file-picker/validators");
|
|
2084
2039
|
|
|
2085
2040
|
// src/hooks/useKey/useKey.ts
|
|
2086
2041
|
var import_react6 = require("react");
|
|
@@ -2154,15 +2109,71 @@ var useKey = (key, eventHandler, { eventName = "keydown", eventTarget, eventOpti
|
|
|
2154
2109
|
useEvent(eventName, memoizedEventHandler, eventTarget, eventOptions);
|
|
2155
2110
|
};
|
|
2156
2111
|
|
|
2157
|
-
// src/hooks/
|
|
2158
|
-
var import_react7 = require("react");
|
|
2112
|
+
// src/hooks/useMq/useMq.ts
|
|
2159
2113
|
var import_type_guards7 = require("@wistia/type-guards");
|
|
2160
|
-
|
|
2161
|
-
|
|
2162
|
-
|
|
2163
|
-
|
|
2164
|
-
|
|
2165
|
-
|
|
2114
|
+
|
|
2115
|
+
// src/hooks/useWindowSize/useWindowSize.ts
|
|
2116
|
+
var import_react7 = require("react");
|
|
2117
|
+
var import_throttle_debounce = require("throttle-debounce");
|
|
2118
|
+
|
|
2119
|
+
// src/private/helpers/isClient/isClient.ts
|
|
2120
|
+
var isClient = () => typeof window !== "undefined" && typeof document !== "undefined";
|
|
2121
|
+
|
|
2122
|
+
// src/hooks/useWindowSize/useWindowSize.ts
|
|
2123
|
+
var useWindowSize = (interval = 0) => {
|
|
2124
|
+
const [dimensions, setDimensions] = (0, import_react7.useState)({
|
|
2125
|
+
width: isClient() ? window.innerWidth : 0,
|
|
2126
|
+
height: isClient() ? window.innerHeight : 0
|
|
2127
|
+
});
|
|
2128
|
+
(0, import_react7.useLayoutEffect)(() => {
|
|
2129
|
+
const handleResize = (0, import_throttle_debounce.debounce)(
|
|
2130
|
+
interval,
|
|
2131
|
+
() => setDimensions({
|
|
2132
|
+
width: window.innerWidth,
|
|
2133
|
+
height: window.innerHeight
|
|
2134
|
+
})
|
|
2135
|
+
);
|
|
2136
|
+
window.addEventListener("resize", handleResize);
|
|
2137
|
+
return () => window.removeEventListener("resize", handleResize);
|
|
2138
|
+
}, [interval]);
|
|
2139
|
+
return dimensions;
|
|
2140
|
+
};
|
|
2141
|
+
|
|
2142
|
+
// src/hooks/useMq/useMq.ts
|
|
2143
|
+
var REM_SIZE = 16;
|
|
2144
|
+
var useMq = () => {
|
|
2145
|
+
const { width } = useWindowSize();
|
|
2146
|
+
const viewportWidth = width / REM_SIZE;
|
|
2147
|
+
const isXsAndUp = true;
|
|
2148
|
+
const isSmAndUp = viewportWidth >= Number.parseFloat(breakpoints.sm);
|
|
2149
|
+
const isMdAndUp = viewportWidth >= Number.parseFloat(breakpoints.md);
|
|
2150
|
+
const isLgAndUp = viewportWidth >= Number.parseFloat(breakpoints.lg);
|
|
2151
|
+
const isXlAndUp = viewportWidth >= Number.parseFloat(breakpoints.xl);
|
|
2152
|
+
const isXsAndDown = viewportWidth < Number.parseFloat(breakpoints.sm);
|
|
2153
|
+
const isSmAndDown = viewportWidth < Number.parseFloat(breakpoints.md);
|
|
2154
|
+
const isMdAndDown = viewportWidth < Number.parseFloat(breakpoints.lg);
|
|
2155
|
+
const isLgAndDown = viewportWidth < Number.parseFloat(breakpoints.xl);
|
|
2156
|
+
const isXlAndDown = true;
|
|
2157
|
+
return {
|
|
2158
|
+
isXlAndUp,
|
|
2159
|
+
isLgAndUp,
|
|
2160
|
+
isMdAndUp,
|
|
2161
|
+
isSmAndUp,
|
|
2162
|
+
isXsAndUp,
|
|
2163
|
+
isXsAndDown,
|
|
2164
|
+
isSmAndDown,
|
|
2165
|
+
isMdAndDown,
|
|
2166
|
+
isLgAndDown,
|
|
2167
|
+
isXlAndDown
|
|
2168
|
+
};
|
|
2169
|
+
};
|
|
2170
|
+
var useActiveMq = () => {
|
|
2171
|
+
const mq2 = useMq();
|
|
2172
|
+
const keys = Object.keys(mq2);
|
|
2173
|
+
return keys.filter((key) => {
|
|
2174
|
+
const value = mq2[key];
|
|
2175
|
+
return (0, import_type_guards7.isBoolean)(value) && value;
|
|
2176
|
+
});
|
|
2166
2177
|
};
|
|
2167
2178
|
|
|
2168
2179
|
// src/hooks/useToast/useToast.tsx
|
|
@@ -5967,13 +5978,17 @@ var Link = (0, import_react11.forwardRef)(
|
|
|
5967
5978
|
} catch (error) {
|
|
5968
5979
|
console.error(error);
|
|
5969
5980
|
} finally {
|
|
5970
|
-
if (
|
|
5981
|
+
if ((0, import_type_guards12.isFunction)(props.onClick)) {
|
|
5982
|
+
props.onClick(event);
|
|
5983
|
+
} else if (routingCallback !== null) {
|
|
5971
5984
|
routingCallback();
|
|
5972
5985
|
} else if ((0, import_type_guards12.isNotNil)(to)) {
|
|
5973
5986
|
window.location.assign(to);
|
|
5974
5987
|
} else {
|
|
5975
5988
|
}
|
|
5976
5989
|
}
|
|
5990
|
+
} else if ((0, import_type_guards12.isFunction)(props.onClick)) {
|
|
5991
|
+
props.onClick(event);
|
|
5977
5992
|
} else {
|
|
5978
5993
|
}
|
|
5979
5994
|
};
|
|
@@ -10648,6 +10663,9 @@ Image.displayName = "Image";
|
|
|
10648
10663
|
Divider,
|
|
10649
10664
|
EditableHeading,
|
|
10650
10665
|
Ellipsis,
|
|
10666
|
+
FileAmountLimitValidator,
|
|
10667
|
+
FileSizeValidator,
|
|
10668
|
+
FileTypeValidator,
|
|
10651
10669
|
Form,
|
|
10652
10670
|
FormErrorSummary,
|
|
10653
10671
|
FormField,
|
|
@@ -10656,6 +10674,7 @@ Image.displayName = "Image";
|
|
|
10656
10674
|
Icon,
|
|
10657
10675
|
IconButton,
|
|
10658
10676
|
Image,
|
|
10677
|
+
ImageDimensionsValidator,
|
|
10659
10678
|
Input,
|
|
10660
10679
|
Label,
|
|
10661
10680
|
Link,
|
|
@@ -10666,6 +10685,7 @@ Image.displayName = "Image";
|
|
|
10666
10685
|
MenuLabel,
|
|
10667
10686
|
MenuRadioGroup,
|
|
10668
10687
|
Modal,
|
|
10688
|
+
PersistentFileAmountLimitValidator,
|
|
10669
10689
|
Popover,
|
|
10670
10690
|
Radio,
|
|
10671
10691
|
RadioGroup,
|
|
@@ -10695,7 +10715,9 @@ Image.displayName = "Image";
|
|
|
10695
10715
|
useActiveMq,
|
|
10696
10716
|
useAriaLive,
|
|
10697
10717
|
useBoolean,
|
|
10718
|
+
useFilePicker,
|
|
10698
10719
|
useFormState,
|
|
10720
|
+
useImperativeFilePicker,
|
|
10699
10721
|
useKey,
|
|
10700
10722
|
useMq,
|
|
10701
10723
|
useToast,
|