@gusnips/react 0.9.24 → 0.9.25
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/README.md +36 -36
- package/dist/api-client.d.ts +51 -51
- package/dist/api-client.d.ts.map +1 -1
- package/dist/api-client.js +3 -3
- package/dist/api-error.d.ts +11 -11
- package/dist/api-error.js +11 -11
- package/dist/auth-email.d.ts +40 -0
- package/dist/auth-email.d.ts.map +1 -0
- package/dist/auth-email.js +106 -0
- package/dist/auth-email.js.map +1 -0
- package/dist/auth-store.d.ts +23 -23
- package/dist/auth-store.js +13 -13
- package/dist/copy.d.ts +3 -3
- package/dist/copy.js +3 -3
- package/dist/deploy-recovery.d.ts +40 -40
- package/dist/deploy-recovery.js +40 -40
- package/dist/describe-error.d.ts +68 -68
- package/dist/describe-error.d.ts.map +1 -1
- package/dist/describe-error.js +5 -5
- package/dist/error-boundary.d.ts +12 -12
- package/dist/guards.d.ts +15 -15
- package/dist/guards.js +3 -3
- package/dist/hydrate.d.ts +15 -16
- package/dist/hydrate.d.ts.map +1 -1
- package/dist/hydrate.js +9 -9
- package/dist/hydrate.js.map +1 -1
- package/dist/i18n.d.ts +15 -16
- package/dist/i18n.d.ts.map +1 -1
- package/dist/i18n.js +5 -6
- package/dist/i18n.js.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/internal-path.d.ts +8 -7
- package/dist/internal-path.d.ts.map +1 -1
- package/dist/internal-path.js +8 -7
- package/dist/internal-path.js.map +1 -1
- package/dist/prerender-contract.d.ts +7 -7
- package/dist/prerender-contract.js +7 -7
- package/dist/query.d.ts +16 -17
- package/dist/query.d.ts.map +1 -1
- package/dist/query.js +2 -2
- package/dist/query.js.map +1 -1
- package/dist/sse.d.ts +19 -20
- package/dist/sse.d.ts.map +1 -1
- package/dist/sse.js +18 -19
- package/dist/sse.js.map +1 -1
- package/dist/states.d.ts +12 -12
- package/dist/states.d.ts.map +1 -1
- package/dist/supabase-session.d.ts +47 -48
- package/dist/supabase-session.d.ts.map +1 -1
- package/dist/supabase-session.js +35 -35
- package/dist/supabase-session.js.map +1 -1
- package/dist/theme.d.ts +4 -4
- package/dist/theme.js +4 -4
- package/dist/ui/class-name.d.ts +3 -4
- package/dist/ui/class-name.d.ts.map +1 -1
- package/dist/ui/class-name.js +3 -4
- package/dist/ui/class-name.js.map +1 -1
- package/dist/ui/combobox.d.ts +11 -11
- package/dist/ui/combobox.d.ts.map +1 -1
- package/dist/ui/dialog.d.ts +5 -5
- package/dist/ui/dialog.js +2 -2
- package/dist/ui/drawer.d.ts +10 -10
- package/dist/ui/drawer.d.ts.map +1 -1
- package/dist/ui/drawer.js +2 -2
- package/dist/ui/input.d.ts +2 -2
- package/dist/ui/input.js +2 -2
- package/dist/ui/menu.d.ts +8 -8
- package/dist/ui/menu.d.ts.map +1 -1
- package/dist/ui/menu.js +4 -4
- package/dist/ui/menu.js.map +1 -1
- package/dist/ui/select.d.ts +12 -12
- package/dist/ui/select.d.ts.map +1 -1
- package/dist/ui/select.js +3 -3
- package/dist/ui/tabs.d.ts +14 -15
- package/dist/ui/tabs.d.ts.map +1 -1
- package/dist/ui/tabs.js +13 -14
- package/dist/ui/tabs.js.map +1 -1
- package/package.json +1 -1
- package/src/api-client.ts +51 -51
- package/src/api-error.ts +11 -11
- package/src/auth-email.test.ts +145 -0
- package/src/auth-email.ts +112 -0
- package/src/auth-store.ts +23 -23
- package/src/copy.ts +3 -3
- package/src/deploy-recovery.ts +40 -40
- package/src/describe-error.ts +68 -68
- package/src/error-boundary.tsx +12 -12
- package/src/guards.tsx +15 -15
- package/src/hydrate.ts +15 -16
- package/src/i18n.ts +15 -16
- package/src/index.ts +2 -0
- package/src/internal-path.ts +8 -7
- package/src/prerender-contract.ts +7 -7
- package/src/query.ts +16 -17
- package/src/sse.ts +19 -20
- package/src/states.ts +12 -12
- package/src/supabase-session.ts +46 -47
- package/src/theme.ts +4 -4
- package/src/ui/class-name.ts +3 -4
- package/src/ui/combobox.tsx +11 -11
- package/src/ui/dialog.tsx +5 -5
- package/src/ui/drawer.tsx +10 -10
- package/src/ui/input.tsx +2 -2
- package/src/ui/menu.tsx +8 -8
- package/src/ui/select.tsx +12 -12
- package/src/ui/tabs.tsx +14 -15
|
@@ -32,33 +32,33 @@ export interface SupabaseSessionStorage {
|
|
|
32
32
|
* Auth FAILED rather than answered, so nothing is known about the credential it was handed:
|
|
33
33
|
* either the request never landed, or GoTrue failed on its own.
|
|
34
34
|
*
|
|
35
|
-
* This is the question every site that ends a session has to ask
|
|
36
|
-
*
|
|
37
|
-
*
|
|
38
|
-
*
|
|
39
|
-
*
|
|
35
|
+
* This is the question every site that ends a session has to ask: a token refresh, an API door, and
|
|
36
|
+
* a callback choosing between "try again" and "that link is spent". Without it one bad minute at
|
|
37
|
+
* GoTrue signs out everybody whose token happened to need refreshing, and tells everybody clicking
|
|
38
|
+
* a recovery link that it has expired, which sends them to ask the service that is down for a
|
|
39
|
+
* replacement.
|
|
40
40
|
*
|
|
41
41
|
* Both clauses carry weight, and the second is why this is a function rather than one call.
|
|
42
42
|
* `isAuthRetryableFetchError` is a NAME check, and the statuses that earn that name are a list
|
|
43
|
-
* auth-js owns. The list has drifted
|
|
44
|
-
*
|
|
45
|
-
*
|
|
46
|
-
*
|
|
47
|
-
*
|
|
48
|
-
*
|
|
49
|
-
*
|
|
50
|
-
*
|
|
51
|
-
* The same statuses with a body that is NOT JSON
|
|
52
|
-
* `AuthUnknownError`, which carries no status at any status, so nothing here can tell that 507
|
|
53
|
-
*
|
|
54
|
-
*
|
|
43
|
+
* auth-js owns. The list has drifted: 502, 503 and 504 at 2.91; those plus the 52x family and still
|
|
44
|
+
* no 500 at 2.106; 500 through 530 at 2.108. Code leaning on it alone is right at whichever version
|
|
45
|
+
* happens to be installed, which is not the same as being right, and a fleet installs several
|
|
46
|
+
* versions at once. It is also a LIST rather than a range, so it has holes at every version, drift
|
|
47
|
+
* or no drift: at 2.112 nothing covers 505 through 519 or 531 up, and a 507 or a 599 with a JSON
|
|
48
|
+
* body arrives as a plain `AuthApiError`. Pinning a recent SDK does not make the status clause
|
|
49
|
+
* redundant.
|
|
50
|
+
*
|
|
51
|
+
* The same statuses with a body that is NOT JSON, such as a proxy's HTML page, arrive as an
|
|
52
|
+
* `AuthUnknownError`, which carries no status at any status, so nothing here can tell that 507 from
|
|
53
|
+
* a malformed 400. It answers false for both, on purpose: reading an unreadable 4xx as an outage
|
|
54
|
+
* would leave a dead session retrying forever, which is the other half of the same bug.
|
|
55
55
|
*
|
|
56
56
|
* Read the version a tree really serves with `bun why @supabase/auth-js`, which prints one
|
|
57
57
|
* heading per RESOLVED version; `node_modules` keeps copies the resolver does not serve.
|
|
58
58
|
*
|
|
59
|
-
* Anything that is not an auth error at all answers true: a failure from outside auth-js is not
|
|
60
|
-
*
|
|
61
|
-
*
|
|
59
|
+
* Anything that is not an auth error at all answers true: a failure from outside auth-js is not a
|
|
60
|
+
* verdict on the credential either. Nothing at all answers false. `null` is what every supabase-js
|
|
61
|
+
* auth call returns on success, and success is not an outage.
|
|
62
62
|
*/
|
|
63
63
|
export declare function isAuthOutage(error: unknown): boolean;
|
|
64
64
|
/**
|
|
@@ -108,12 +108,12 @@ export declare function supabaseAuthStorage(supabaseUrl: string): SupabaseSessio
|
|
|
108
108
|
* 2.116.0 and 41–51 s at 2.106.2. Nobody at a shared computer waits that long, and a page that
|
|
109
109
|
* navigates away in the meantime takes the removal with it.
|
|
110
110
|
*
|
|
111
|
-
* It resolves once the stored session is gone. `error` is `null` when auth ended the session on
|
|
112
|
-
*
|
|
113
|
-
*
|
|
114
|
-
*
|
|
115
|
-
*
|
|
116
|
-
*
|
|
111
|
+
* It resolves once the stored session is gone. `error` is `null` when auth ended the session on the
|
|
112
|
+
* server too. Otherwise it is the reason auth did not: its error, a thrown value or the deadline.
|
|
113
|
+
* The session may still be live on the server and on other devices. `SIGNED_OUT` arrives once
|
|
114
|
+
* auth-js has finished with the first call: about 100 ms later from 2.108.2 on, and up to 22 s
|
|
115
|
+
* later at 2.106.2. If your screen does not reload, clear your own store when this resolves instead
|
|
116
|
+
* of waiting for the event.
|
|
117
117
|
*/
|
|
118
118
|
export declare function signOutEvenOffline(auth: Pick<SupabaseSessionAuth, "signOut">, { storage, storageKey }: SupabaseSessionStorage): Promise<{
|
|
119
119
|
error: unknown;
|
|
@@ -138,7 +138,7 @@ export declare function signOutEvenOffline(auth: Pick<SupabaseSessionAuth, "sign
|
|
|
138
138
|
*/
|
|
139
139
|
export declare function createSupabaseSessionAdapter(auth: SupabaseSessionAuth, stored?: SupabaseSessionStorage): SessionAdapter;
|
|
140
140
|
/**
|
|
141
|
-
* Every link type a GoTrue email can carry
|
|
141
|
+
* Every link type a GoTrue email can carry, including ones this app's templates do not send today.
|
|
142
142
|
* One donor rejected `invite` because "invites are never sent", which was true of the product and
|
|
143
143
|
* false of the deployment: an operator inviting somebody from Studio sent a branded email whose
|
|
144
144
|
* link then said it was invalid. A type the templates never emit costs nothing to accept: the hash
|
|
@@ -146,9 +146,9 @@ export declare function createSupabaseSessionAdapter(auth: SupabaseSessionAuth,
|
|
|
146
146
|
*
|
|
147
147
|
* Closed on purpose: auth-js's own `EmailOtpType` ends in `(string & {})`, so it cannot make a
|
|
148
148
|
* destination map name every case. `Record<EmailLinkType, string>` can, and that is where an app
|
|
149
|
-
* decides that `recovery` and `invite` both continue to the new-password screen
|
|
150
|
-
*
|
|
151
|
-
*
|
|
149
|
+
* decides that `recovery` and `invite` both continue to the new-password screen. GoTrue creates an
|
|
150
|
+
* invited account with NO password, so landing one "inside" signs them in once and locks them out
|
|
151
|
+
* after.
|
|
152
152
|
*/
|
|
153
153
|
export type EmailLinkType = "signup" | "invite" | "magiclink" | "recovery" | "email_change" | "email";
|
|
154
154
|
/** Everything an auth callback address can carry, decided from the address alone. */
|
|
@@ -161,10 +161,10 @@ export type AuthCallback =
|
|
|
161
161
|
}
|
|
162
162
|
/**
|
|
163
163
|
* A session arriving in the address: a PKCE `code`, or the implicit flow's tokens. In a browser
|
|
164
|
-
* with `detectSessionInUrl` on, the client has already taken it
|
|
165
|
-
*
|
|
166
|
-
*
|
|
167
|
-
*
|
|
164
|
+
* with `detectSessionInUrl` on, the client has already taken it. Wait for the session, and do not
|
|
165
|
+
* trade it again, which would be a second exchange racing the first. Where nothing reads the
|
|
166
|
+
* address for you (React Native), `credential` is what `exchangeCodeForSession` or `setSession`
|
|
167
|
+
* takes.
|
|
168
168
|
*/
|
|
169
169
|
| {
|
|
170
170
|
kind: "session";
|
|
@@ -177,10 +177,9 @@ export type AuthCallback =
|
|
|
177
177
|
};
|
|
178
178
|
}
|
|
179
179
|
/**
|
|
180
|
-
* GoTrue, or the provider behind it, reported a failure in the address. `code` is GoTrue's
|
|
181
|
-
*
|
|
182
|
-
* `error_description` is left out
|
|
183
|
-
* cause.
|
|
180
|
+
* GoTrue, or the provider behind it, reported a failure in the address. `code` is GoTrue's stable
|
|
181
|
+
* `error_code` (`otp_expired`, `bad_oauth_state`, …) and is what to choose words by;
|
|
182
|
+
* `error_description` is left out because it is English-only and often names the wrong cause.
|
|
184
183
|
*/
|
|
185
184
|
| {
|
|
186
185
|
kind: "error";
|
|
@@ -194,19 +193,19 @@ export type AuthCallback =
|
|
|
194
193
|
};
|
|
195
194
|
/**
|
|
196
195
|
* Reads an auth callback address. Pure, so every edge case is testable without a router or a
|
|
197
|
-
* client
|
|
196
|
+
* client. Pass `location.search` and `location.hash`, or the two halves of a deep link.
|
|
198
197
|
*
|
|
199
|
-
* GoTrue writes a failure into the FRAGMENT on every path and into the query only on some
|
|
200
|
-
*
|
|
201
|
-
*
|
|
198
|
+
* GoTrue writes a failure into the FRAGMENT on every path and into the query only on some. After a
|
|
199
|
+
* provider round trip, it writes both; after an implicit-flow email link, it writes the fragment
|
|
200
|
+
* alone. A callback reading one of the two misses a failure the other carries, and the person lands
|
|
202
201
|
* on a screen that says nothing. Both are read here.
|
|
203
202
|
*
|
|
204
|
-
* `cancelled` is the provider refusing on its own, which for Google is the person pressing Cancel
|
|
205
|
-
*
|
|
206
|
-
* that same value for an expired email link, a banned user and a disabled signup, each with
|
|
207
|
-
* `error_code` beside it, while a refusal relayed from the provider arrives with none. The
|
|
208
|
-
* test reads an expired link as a change of mind. And `error` itself is absent for a status
|
|
209
|
-
* outside GoTrue's OAuth mapping
|
|
203
|
+
* `cancelled` is the provider refusing on its own, which for Google is the person pressing Cancel.
|
|
204
|
+
* That is their choice, not a failure to report. It is NOT `error === "access_denied"`: GoTrue
|
|
205
|
+
* writes that same value for an expired email link, a banned user and a disabled signup, each with
|
|
206
|
+
* an `error_code` beside it, while a refusal relayed from the provider arrives with none. The
|
|
207
|
+
* obvious test reads an expired link as a change of mind. And `error` itself is absent for a status
|
|
208
|
+
* outside GoTrue's OAuth mapping. A rate-limited link arrives with `error_code` alone.
|
|
210
209
|
*/
|
|
211
210
|
export declare function parseAuthCallback(search: string | URLSearchParams, hash?: string): AuthCallback;
|
|
212
211
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"supabase-session.d.ts","sourceRoot":"","sources":["../src/supabase-session.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,KAAK,OAAO,EAGZ,KAAK,gBAAgB,EACtB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAuB,KAAK,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAE3E,UAAU,qBAAqB;IAC7B,IAAI,EAAE;QAAE,OAAO,EAAE;YAAE,YAAY,EAAE,MAAM,CAAA;SAAE,GAAG,IAAI,CAAA;KAAE,CAAC;CACpD;AAED,8FAA8F;AAC9F,MAAM,WAAW,mBAAmB;IAClC,UAAU,IAAI,OAAO,CAAC,qBAAqB,CAAC,CAAC;IAC7C,cAAc,IAAI,OAAO,CAAC,qBAAqB,GAAG;QAAE,KAAK,EAAE,OAAO,CAAA;KAAE,CAAC,CAAC;IACtE,OAAO,CAAC,OAAO,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A6B3F"}
|
package/dist/supabase-session.js
CHANGED
|
@@ -4,33 +4,33 @@ import { SIGN_OUT_TIMEOUT_MS } from "./api-client.js";
|
|
|
4
4
|
* Auth FAILED rather than answered, so nothing is known about the credential it was handed:
|
|
5
5
|
* either the request never landed, or GoTrue failed on its own.
|
|
6
6
|
*
|
|
7
|
-
* This is the question every site that ends a session has to ask
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
7
|
+
* This is the question every site that ends a session has to ask: a token refresh, an API door, and
|
|
8
|
+
* a callback choosing between "try again" and "that link is spent". Without it one bad minute at
|
|
9
|
+
* GoTrue signs out everybody whose token happened to need refreshing, and tells everybody clicking
|
|
10
|
+
* a recovery link that it has expired, which sends them to ask the service that is down for a
|
|
11
|
+
* replacement.
|
|
12
12
|
*
|
|
13
13
|
* Both clauses carry weight, and the second is why this is a function rather than one call.
|
|
14
14
|
* `isAuthRetryableFetchError` is a NAME check, and the statuses that earn that name are a list
|
|
15
|
-
* auth-js owns. The list has drifted
|
|
16
|
-
*
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
-
*
|
|
20
|
-
*
|
|
21
|
-
*
|
|
15
|
+
* auth-js owns. The list has drifted: 502, 503 and 504 at 2.91; those plus the 52x family and still
|
|
16
|
+
* no 500 at 2.106; 500 through 530 at 2.108. Code leaning on it alone is right at whichever version
|
|
17
|
+
* happens to be installed, which is not the same as being right, and a fleet installs several
|
|
18
|
+
* versions at once. It is also a LIST rather than a range, so it has holes at every version, drift
|
|
19
|
+
* or no drift: at 2.112 nothing covers 505 through 519 or 531 up, and a 507 or a 599 with a JSON
|
|
20
|
+
* body arrives as a plain `AuthApiError`. Pinning a recent SDK does not make the status clause
|
|
21
|
+
* redundant.
|
|
22
22
|
*
|
|
23
|
-
* The same statuses with a body that is NOT JSON
|
|
24
|
-
* `AuthUnknownError`, which carries no status at any status, so nothing here can tell that 507
|
|
25
|
-
*
|
|
26
|
-
*
|
|
23
|
+
* The same statuses with a body that is NOT JSON, such as a proxy's HTML page, arrive as an
|
|
24
|
+
* `AuthUnknownError`, which carries no status at any status, so nothing here can tell that 507 from
|
|
25
|
+
* a malformed 400. It answers false for both, on purpose: reading an unreadable 4xx as an outage
|
|
26
|
+
* would leave a dead session retrying forever, which is the other half of the same bug.
|
|
27
27
|
*
|
|
28
28
|
* Read the version a tree really serves with `bun why @supabase/auth-js`, which prints one
|
|
29
29
|
* heading per RESOLVED version; `node_modules` keeps copies the resolver does not serve.
|
|
30
30
|
*
|
|
31
|
-
* Anything that is not an auth error at all answers true: a failure from outside auth-js is not
|
|
32
|
-
*
|
|
33
|
-
*
|
|
31
|
+
* Anything that is not an auth error at all answers true: a failure from outside auth-js is not a
|
|
32
|
+
* verdict on the credential either. Nothing at all answers false. `null` is what every supabase-js
|
|
33
|
+
* auth call returns on success, and success is not an outage.
|
|
34
34
|
*/
|
|
35
35
|
export function isAuthOutage(error) {
|
|
36
36
|
// Nothing thrown is not an outage, and this clause exists because the function is exported.
|
|
@@ -131,12 +131,12 @@ function localStorageOrMemory() {
|
|
|
131
131
|
* 2.116.0 and 41–51 s at 2.106.2. Nobody at a shared computer waits that long, and a page that
|
|
132
132
|
* navigates away in the meantime takes the removal with it.
|
|
133
133
|
*
|
|
134
|
-
* It resolves once the stored session is gone. `error` is `null` when auth ended the session on
|
|
135
|
-
*
|
|
136
|
-
*
|
|
137
|
-
*
|
|
138
|
-
*
|
|
139
|
-
*
|
|
134
|
+
* It resolves once the stored session is gone. `error` is `null` when auth ended the session on the
|
|
135
|
+
* server too. Otherwise it is the reason auth did not: its error, a thrown value or the deadline.
|
|
136
|
+
* The session may still be live on the server and on other devices. `SIGNED_OUT` arrives once
|
|
137
|
+
* auth-js has finished with the first call: about 100 ms later from 2.108.2 on, and up to 22 s
|
|
138
|
+
* later at 2.106.2. If your screen does not reload, clear your own store when this resolves instead
|
|
139
|
+
* of waiting for the event.
|
|
140
140
|
*/
|
|
141
141
|
export async function signOutEvenOffline(auth, { storage, storageKey }) {
|
|
142
142
|
let timer;
|
|
@@ -220,19 +220,19 @@ function isEmailLinkType(value) {
|
|
|
220
220
|
}
|
|
221
221
|
/**
|
|
222
222
|
* Reads an auth callback address. Pure, so every edge case is testable without a router or a
|
|
223
|
-
* client
|
|
223
|
+
* client. Pass `location.search` and `location.hash`, or the two halves of a deep link.
|
|
224
224
|
*
|
|
225
|
-
* GoTrue writes a failure into the FRAGMENT on every path and into the query only on some
|
|
226
|
-
*
|
|
227
|
-
*
|
|
225
|
+
* GoTrue writes a failure into the FRAGMENT on every path and into the query only on some. After a
|
|
226
|
+
* provider round trip, it writes both; after an implicit-flow email link, it writes the fragment
|
|
227
|
+
* alone. A callback reading one of the two misses a failure the other carries, and the person lands
|
|
228
228
|
* on a screen that says nothing. Both are read here.
|
|
229
229
|
*
|
|
230
|
-
* `cancelled` is the provider refusing on its own, which for Google is the person pressing Cancel
|
|
231
|
-
*
|
|
232
|
-
* that same value for an expired email link, a banned user and a disabled signup, each with
|
|
233
|
-
* `error_code` beside it, while a refusal relayed from the provider arrives with none. The
|
|
234
|
-
* test reads an expired link as a change of mind. And `error` itself is absent for a status
|
|
235
|
-
* outside GoTrue's OAuth mapping
|
|
230
|
+
* `cancelled` is the provider refusing on its own, which for Google is the person pressing Cancel.
|
|
231
|
+
* That is their choice, not a failure to report. It is NOT `error === "access_denied"`: GoTrue
|
|
232
|
+
* writes that same value for an expired email link, a banned user and a disabled signup, each with
|
|
233
|
+
* an `error_code` beside it, while a refusal relayed from the provider arrives with none. The
|
|
234
|
+
* obvious test reads an expired link as a change of mind. And `error` itself is absent for a status
|
|
235
|
+
* outside GoTrue's OAuth mapping. A rate-limited link arrives with `error_code` alone.
|
|
236
236
|
*/
|
|
237
237
|
export function parseAuthCallback(search, hash = "") {
|
|
238
238
|
const query = new URLSearchParams(search);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"supabase-session.js","sourceRoot":"","sources":["../src/supabase-session.ts"],"names":[],"mapp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,CAAC,CAAC,IAAI,CAAC;IAEvD,MAAM,SAAS,GAAG,KAAK,CAAC,GAAG,CAAC,YAAY,CAAC,EAAE,IAAI,EAAE,CAAC;IAClD,IAAI,SAAS;QAAE,OAAO,IAAI,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,YAAY,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,SAAS,EAAE,CAAC;IAE3F,MAAM,QAAQ,GAAG,KAAK,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;IACnC,IAAI,QAAQ;QAAE,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,IAAI,EAAE,UAAU,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,EAAE,CAAC;IAE/E,MAAM,WAAW,GAAG,QAAQ,CAAC,GAAG,CAAC,cAAc,CAAC,CAAC;IACjD,MAAM,YAAY,GAAG,QAAQ,CAAC,GAAG,CAAC,eAAe,CAAC,CAAC;IACnD,IAAI,WAAW,IAAI,YAAY;QAC7B,OAAO;YACL,IAAI,EAAE,SAAS;YACf,IAAI;YACJ,UAAU,EAAE,EAAE,YAAY,EAAE,WAAW,EAAE,aAAa,EAAE,YAAY,EAAE;SACvE,CAAC;IAEJ,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,CAAC;AAC7B,CAAC"}
|
package/dist/theme.d.ts
CHANGED
|
@@ -65,10 +65,10 @@ declare global {
|
|
|
65
65
|
* "system" is stored as the word, not as an empty key. An empty key means the default, and the
|
|
66
66
|
* default is not always "system".
|
|
67
67
|
*
|
|
68
|
-
* **It writes to the page when the theme changes, and at no other time.** A page may override
|
|
69
|
-
*
|
|
70
|
-
* override until the theme really changes. Repainting on every resync would undo it a moment
|
|
71
|
-
*
|
|
68
|
+
* **It writes to the page when the theme changes, and at no other time.** A page may override the
|
|
69
|
+
* class for its own lifetime, as a public booking page that is always light does, and keeps that
|
|
70
|
+
* override until the theme really changes. Repainting on every resync would undo it a moment later,
|
|
71
|
+
* because `pageshow` fires on every load, not only on a back-forward restore.
|
|
72
72
|
*/
|
|
73
73
|
export declare function startTheme(options: ThemeOptions): ThemeController;
|
|
74
74
|
export interface Theme {
|
package/dist/theme.js
CHANGED
|
@@ -58,10 +58,10 @@ import { useSyncExternalStore } from "react";
|
|
|
58
58
|
* "system" is stored as the word, not as an empty key. An empty key means the default, and the
|
|
59
59
|
* default is not always "system".
|
|
60
60
|
*
|
|
61
|
-
* **It writes to the page when the theme changes, and at no other time.** A page may override
|
|
62
|
-
*
|
|
63
|
-
* override until the theme really changes. Repainting on every resync would undo it a moment
|
|
64
|
-
*
|
|
61
|
+
* **It writes to the page when the theme changes, and at no other time.** A page may override the
|
|
62
|
+
* class for its own lifetime, as a public booking page that is always light does, and keeps that
|
|
63
|
+
* override until the theme really changes. Repainting on every resync would undo it a moment later,
|
|
64
|
+
* because `pageshow` fires on every load, not only on a back-forward restore.
|
|
65
65
|
*/
|
|
66
66
|
export function startTheme(options) {
|
|
67
67
|
const running = window.__frontkitTheme;
|
package/dist/ui/class-name.d.ts
CHANGED
|
@@ -7,10 +7,9 @@ export type StateClassName<State> = string | ((state: State) => string | undefin
|
|
|
7
7
|
/**
|
|
8
8
|
* Merge a wrapper's own classes with the caller's, keeping BOTH forms working.
|
|
9
9
|
*
|
|
10
|
-
* `cn()` on its own silently DROPS the function form
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
* keeps one code path for both.
|
|
10
|
+
* `cn()` on its own silently DROPS the function form. clsx walks strings, arrays and plain objects,
|
|
11
|
+
* and a function is none of the three, so a caller styling by `open` or `transitionStatus` would
|
|
12
|
+
* get an empty class and no warning. Always returning a function keeps one code path for both.
|
|
14
13
|
*/
|
|
15
14
|
export declare function mergeClassName<State>(base: ClassValue, extra: StateClassName<State>): (state: State) => string;
|
|
16
15
|
//# sourceMappingURL=class-name.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"class-name.d.ts","sourceRoot":"","sources":["../../src/ui/class-name.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,MAAM,CAAC;AAGvC;;;GAGG;AACH,MAAM,MAAM,cAAc,CAAC,KAAK,IAAI,MAAM,GAAG,CAAC,CAAC,KAAK,EAAE,KAAK,KAAK,MAAM,GAAG,SAAS,CAAC,GAAG,SAAS,CAAC;AAEhG
|
|
1
|
+
{"version":3,"file":"class-name.d.ts","sourceRoot":"","sources":["../../src/ui/class-name.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,MAAM,CAAC;AAGvC;;;GAGG;AACH,MAAM,MAAM,cAAc,CAAC,KAAK,IAAI,MAAM,GAAG,CAAC,CAAC,KAAK,EAAE,KAAK,KAAK,MAAM,GAAG,SAAS,CAAC,GAAG,SAAS,CAAC;AAEhG;;;;;;GAMG;AACH,wBAAgB,cAAc,CAAC,KAAK,EAClC,IAAI,EAAE,UAAU,EAChB,KAAK,EAAE,cAAc,CAAC,KAAK,CAAC,GAC3B,CAAC,KAAK,EAAE,KAAK,KAAK,MAAM,CAE1B"}
|
package/dist/ui/class-name.js
CHANGED
|
@@ -2,10 +2,9 @@ import { cn } from "../cn.js";
|
|
|
2
2
|
/**
|
|
3
3
|
* Merge a wrapper's own classes with the caller's, keeping BOTH forms working.
|
|
4
4
|
*
|
|
5
|
-
* `cn()` on its own silently DROPS the function form
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
* keeps one code path for both.
|
|
5
|
+
* `cn()` on its own silently DROPS the function form. clsx walks strings, arrays and plain objects,
|
|
6
|
+
* and a function is none of the three, so a caller styling by `open` or `transitionStatus` would
|
|
7
|
+
* get an empty class and no warning. Always returning a function keeps one code path for both.
|
|
9
8
|
*/
|
|
10
9
|
export function mergeClassName(base, extra) {
|
|
11
10
|
return (state) => cn(base, typeof extra === "function" ? extra(state) : extra);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"class-name.js","sourceRoot":"","sources":["../../src/ui/class-name.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,EAAE,EAAE,MAAM,UAAU,CAAC;AAQ9B
|
|
1
|
+
{"version":3,"file":"class-name.js","sourceRoot":"","sources":["../../src/ui/class-name.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,EAAE,EAAE,MAAM,UAAU,CAAC;AAQ9B;;;;;;GAMG;AACH,MAAM,UAAU,cAAc,CAC5B,IAAgB,EAChB,KAA4B;IAE5B,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,KAAK,UAAU,CAAC,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC;AACjF,CAAC"}
|
package/dist/ui/combobox.d.ts
CHANGED
|
@@ -23,7 +23,7 @@ export declare const ComboboxGroupLabel: import("react").ForwardRefExoticCompone
|
|
|
23
23
|
* closed and the field goes blank the moment focus leaves, even though a value is set.
|
|
24
24
|
*/
|
|
25
25
|
export declare function comboboxInputValue<T>(open: boolean, query: string, value: T | null, getLabel: (item: T) => string): string;
|
|
26
|
-
/**
|
|
26
|
+
/** Pass text for the loading state. There is no default text or English fallback. */
|
|
27
27
|
type ComboboxLoadingState = {
|
|
28
28
|
loading: boolean;
|
|
29
29
|
loadingHint: ReactNode;
|
|
@@ -34,15 +34,15 @@ type ComboboxLoadingState = {
|
|
|
34
34
|
export type ComboboxProps<T> = Omit<Primitive.Root.Props<T, false, T>, "children" | "items" | "filteredItems" | "filter" | "value" | "defaultValue" | "multiple" | "open" | "defaultOpen" | "inputValue" | "defaultInputValue" | "onInputValueChange" | "itemToStringLabel" | "isItemEqualToValue"> & {
|
|
35
35
|
value: T | null;
|
|
36
36
|
/**
|
|
37
|
-
* Items for the current query. Filtering is yours: this passes `filter={null}` to Base UI,
|
|
38
|
-
*
|
|
39
|
-
* page. Bound it here if it needs bounding; there is no cap in the wrapper, because a cap
|
|
40
|
-
*
|
|
37
|
+
* Items for the current query. Filtering is yours: this passes `filter={null}` to Base UI, so the
|
|
38
|
+
* list shows exactly what you return, whether it is a server search, a fuzzy match or a bounded
|
|
39
|
+
* page. Bound it here if it needs bounding; there is no cap in the wrapper, because a cap would
|
|
40
|
+
* quietly truncate a list a caller meant to show whole.
|
|
41
41
|
*/
|
|
42
42
|
search: (query: string) => readonly T[];
|
|
43
43
|
/** Stable identity of an item: its React key, and how two items are compared. */
|
|
44
44
|
getKey: (item: T) => string;
|
|
45
|
-
/** The item's text
|
|
45
|
+
/** The item's text, shown in the input once it is picked and used for typeahead matches. */
|
|
46
46
|
getLabel: (item: T) => string;
|
|
47
47
|
renderItem?: (item: T) => ReactNode;
|
|
48
48
|
/**
|
|
@@ -50,7 +50,7 @@ export type ComboboxProps<T> = Omit<Primitive.Root.Props<T, false, T>, "children
|
|
|
50
50
|
* end, and this is the line that offers one.
|
|
51
51
|
*/
|
|
52
52
|
emptyHint: ReactNode;
|
|
53
|
-
/** Label for the clear button. Required
|
|
53
|
+
/** Label for the clear button. Required because the button has an icon and no text. */
|
|
54
54
|
clearLabel: string;
|
|
55
55
|
/** Label for the button that opens the list. Required, same reason. */
|
|
56
56
|
openLabel: string;
|
|
@@ -62,10 +62,10 @@ export type ComboboxProps<T> = Omit<Primitive.Root.Props<T, false, T>, "children
|
|
|
62
62
|
popupClassName?: StateClassName<Primitive.Popup.State>;
|
|
63
63
|
inputProps?: Primitive.Input.Props;
|
|
64
64
|
/**
|
|
65
|
-
* Positioner props
|
|
66
|
-
*
|
|
67
|
-
*
|
|
68
|
-
*
|
|
65
|
+
* Positioner props: `align`, `side`, `sideOffset`, `collisionPadding` and the stacking order. The
|
|
66
|
+
* default `z-[60]` puts the list above the overlay layer (z-50: dialog, drawer); raise it with
|
|
67
|
+
* `positionerProps={{ className: "z-[80]" }}` if the app stacks something higher than a dialog
|
|
68
|
+
* above it.
|
|
69
69
|
*/
|
|
70
70
|
positionerProps?: Primitive.Positioner.Props;
|
|
71
71
|
} & ComboboxLoadingState;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"combobox.d.ts","sourceRoot":"","sources":["../../src/ui/combobox.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,IAAI,SAAS,EAAE,MAAM,yBAAyB,CAAC;AAChE,OAAO,EAAqB,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAC1D,OAAO,EAAkB,KAAK,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAKtE,eAAO,MAAM,YAAY,uBAAiB,CAAC;AAC3C,eAAO,MAAM,aAAa,2JAAkB,CAAC;AAC7C,eAAO,MAAM,kBAAkB,0JAAuB,CAAC;AACvD,eAAO,MAAM,eAAe,0JAAoB,CAAC;AACjD,eAAO,MAAM,aAAa,4JAAkB,CAAC;AAC7C,eAAO,MAAM,cAAc,0JAAmB,CAAC;AAC/C,eAAO,MAAM,kBAAkB,8JAAuB,CAAC;AACvD,eAAO,MAAM,aAAa,yJAAkB,CAAC;AAC7C,eAAO,MAAM,YAAY,wJAAiB,CAAC;AAC3C,eAAO,MAAM,YAAY,+IAAiB,CAAC;AAC3C,eAAO,MAAM,aAAa,yJAAkB,CAAC;AAC7C,eAAO,MAAM,aAAa,yJAAkB,CAAC;AAC7C,eAAO,MAAM,kBAAkB,8JAAuB,CAAC;AAEvD;;;;;;;GAOG;AACH,wBAAgB,kBAAkB,CAAC,CAAC,EAClC,IAAI,EAAE,OAAO,EACb,KAAK,EAAE,MAAM,EACb,KAAK,EAAE,CAAC,GAAG,IAAI,EACf,QAAQ,EAAE,CAAC,IAAI,EAAE,CAAC,KAAK,MAAM,GAC5B,MAAM,CAGR;AAED,
|
|
1
|
+
{"version":3,"file":"combobox.d.ts","sourceRoot":"","sources":["../../src/ui/combobox.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,IAAI,SAAS,EAAE,MAAM,yBAAyB,CAAC;AAChE,OAAO,EAAqB,KAAK,SAAS,EAAE,MAAM,OAA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,EACR,EAAE,aAAa,CAAC,CAAC,CAAC,+BAyHlB"}
|
package/dist/ui/dialog.d.ts
CHANGED
|
@@ -16,9 +16,9 @@ export type DialogContentProps = Primitive.Popup.Props & {
|
|
|
16
16
|
*/
|
|
17
17
|
label?: string;
|
|
18
18
|
/**
|
|
19
|
-
* Label for the built-in close button
|
|
20
|
-
*
|
|
21
|
-
*
|
|
19
|
+
* Label for the built-in close button. REQUIRED to render the button: passing the label is the
|
|
20
|
+
* only way to render the button, so an unlabelled close button cannot be written. There is no
|
|
21
|
+
* default string, because a default would be English.
|
|
22
22
|
*/
|
|
23
23
|
closeLabel?: string;
|
|
24
24
|
backdropClassName?: StateClassName<Primitive.Backdrop.State>;
|
|
@@ -32,8 +32,8 @@ export type DialogContentProps = Primitive.Popup.Props & {
|
|
|
32
32
|
* page behind it) and is capped to the viewport, so a tall dialog is never taller than the
|
|
33
33
|
* screen it opens on.
|
|
34
34
|
*
|
|
35
|
-
*
|
|
36
|
-
*
|
|
35
|
+
* Padding, radius, shadow and type all belong to the product. What is here is what makes the
|
|
36
|
+
* primitive work.
|
|
37
37
|
*/
|
|
38
38
|
export declare function DialogContent({ className, backdropClassName, container, label, closeLabel, children, ...rest }: DialogContentProps): import("react").JSX.Element;
|
|
39
39
|
//# sourceMappingURL=dialog.d.ts.map
|
package/dist/ui/dialog.js
CHANGED
|
@@ -20,8 +20,8 @@ export const DialogPopup = Primitive.Popup;
|
|
|
20
20
|
* page behind it) and is capped to the viewport, so a tall dialog is never taller than the
|
|
21
21
|
* screen it opens on.
|
|
22
22
|
*
|
|
23
|
-
*
|
|
24
|
-
*
|
|
23
|
+
* Padding, radius, shadow and type all belong to the product. What is here is what makes the
|
|
24
|
+
* primitive work.
|
|
25
25
|
*/
|
|
26
26
|
export function DialogContent({ className, backdropClassName, container, label, closeLabel, children, ...rest }) {
|
|
27
27
|
return (_jsxs(Primitive.Portal, { container: container, children: [_jsx(Primitive.Backdrop, { className: mergeClassName("fixed inset-0 z-50 bg-scrim transition-opacity data-ending-style:opacity-0 data-starting-style:opacity-0", backdropClassName) }), _jsxs(Primitive.Popup, { "aria-label": label, ...rest, className: mergeClassName("fixed top-1/2 left-1/2 z-50 max-h-[calc(100dvh-2rem)] w-[calc(100%-2rem)] max-w-md -translate-x-1/2 -translate-y-1/2 overflow-y-auto overscroll-contain bg-popover text-popover-foreground outline-none transition-[scale,opacity] data-ending-style:scale-95 data-ending-style:opacity-0 data-starting-style:scale-95 data-starting-style:opacity-0", className), children: [children, closeLabel === undefined ? null : (_jsx(Primitive.Close, { "aria-label": closeLabel,
|
package/dist/ui/drawer.d.ts
CHANGED
|
@@ -17,9 +17,9 @@ export type DrawerSide = "left" | "right" | "bottom";
|
|
|
17
17
|
/**
|
|
18
18
|
* Where the portal mounts, and whether the drawer covers the page or a box inside it.
|
|
19
19
|
*
|
|
20
|
-
* A scoped drawer positions itself `absolute` against a container instead of `fixed` against
|
|
21
|
-
*
|
|
22
|
-
*
|
|
20
|
+
* A scoped drawer positions itself `absolute` against a container instead of `fixed` against the
|
|
21
|
+
* viewport, so it MUST be given that container, or it lands in `<body>` and positions against a box
|
|
22
|
+
* that is not there. The two travel together in the type.
|
|
23
23
|
*
|
|
24
24
|
* The container also needs a positioning context of its own (`relative`): `absolute` walks up
|
|
25
25
|
* to the nearest positioned ancestor, so a static container hands the drawer the whole page
|
|
@@ -34,20 +34,20 @@ type DrawerPortalTarget = {
|
|
|
34
34
|
};
|
|
35
35
|
export type DrawerProps<Payload = unknown> = Omit<Primitive.Root.Props<Payload>, "children" | "swipeDirection"> & DrawerPortalTarget & {
|
|
36
36
|
/**
|
|
37
|
-
* Which edge it comes from. This also sets `swipeDirection` on the root
|
|
38
|
-
*
|
|
39
|
-
*
|
|
37
|
+
* Which edge it comes from. This also sets `swipeDirection` on the root. The two must agree,
|
|
38
|
+
* and a mismatch is silent: the drawer looks right and dismisses on a swipe towards the screen
|
|
39
|
+
* it is attached to.
|
|
40
40
|
*/
|
|
41
41
|
side?: DrawerSide;
|
|
42
42
|
/** Accessible name, for a drawer with no visible `DrawerTitle`. */
|
|
43
43
|
label?: string;
|
|
44
44
|
children?: ReactNode;
|
|
45
|
-
/** Classes for the popup
|
|
45
|
+
/** Classes for the popup panel. */
|
|
46
46
|
className?: StateClassName<Primitive.Popup.State>;
|
|
47
47
|
backdropClassName?: StateClassName<Primitive.Backdrop.State>;
|
|
48
48
|
viewportClassName?: StateClassName<Primitive.Viewport.State>;
|
|
49
49
|
contentClassName?: StateClassName<Primitive.Content.State>;
|
|
50
|
-
/** Popup-level props the wrapper does not own
|
|
50
|
+
/** Popup-level props the wrapper does not own, such as `initialFocus`, `finalFocus` and `data-*`. */
|
|
51
51
|
popupProps?: Primitive.Popup.Props;
|
|
52
52
|
};
|
|
53
53
|
/**
|
|
@@ -55,8 +55,8 @@ export type DrawerProps<Payload = unknown> = Omit<Primitive.Root.Props<Payload>,
|
|
|
55
55
|
* composed once here because the parts have to be arranged in exactly this order to work at
|
|
56
56
|
* all, and because two of the four rules below cost someone a bug that no test would catch.
|
|
57
57
|
*
|
|
58
|
-
*
|
|
59
|
-
* `
|
|
58
|
+
* Every root prop passes straight through, including `open`, `onOpenChange`, `modal`, `snapPoints`,
|
|
59
|
+
* `actionsRef` and `data-*`.
|
|
60
60
|
*/
|
|
61
61
|
export declare function Drawer<Payload = unknown>({ side, label, scoped, container, className, backdropClassName, viewportClassName, contentClassName, popupProps, children, ...rest }: DrawerProps<Payload>): import("react").JSX.Element;
|
|
62
62
|
export {};
|
package/dist/ui/drawer.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"drawer.d.ts","sourceRoot":"","sources":["../../src/ui/drawer.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,IAAI,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACvC,OAAO,EAAkB,KAAK,cAAc,EAAE,MAAM,iBAA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;OAIG;IACH,IAAI,CAAC,EAAE,UAAU,CAAC;IAClB,mEAAmE;IACnE,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,SAAS,CAAC;IACrB,mCAAmC;IACnC,SAAS,CAAC,EAAE,cAAc,CAAC,SAAS,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;IAClD,iBAAiB,CAAC,EAAE,cAAc,CAAC,SAAS,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;IAC7D,iBAAiB,CAAC,EAAE,cAAc,CAAC,SAAS,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;IAC7D,gBAAgB,CAAC,EAAE,cAAc,CAAC,SAAS,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;IAC3D,qGAAqG;IACrG,UAAU,CAAC,EAAE,SAAS,CAAC,KAAK,CAAC,KAAK,CAAC;CACpC,CAAC;AAEJ;;;;;;;GAOG;AACH,wBAAgB,MAAM,CAAC,OAAO,GAAG,OAAO,EAAE,EACxC,IAAc,EACd,KAAK,EACL,MAAc,EACd,SAAS,EACT,SAAS,EACT,iBAAiB,EACjB,iBAAiB,EACjB,gBAAgB,EAChB,UAAU,EACV,QAAQ,EACR,GAAG,IAAI,EACR,EAAE,WAAW,CAAC,OAAO,CAAC,+BAiEtB"}
|
package/dist/ui/drawer.js
CHANGED
|
@@ -32,8 +32,8 @@ const popupSide = {
|
|
|
32
32
|
* composed once here because the parts have to be arranged in exactly this order to work at
|
|
33
33
|
* all, and because two of the four rules below cost someone a bug that no test would catch.
|
|
34
34
|
*
|
|
35
|
-
*
|
|
36
|
-
* `
|
|
35
|
+
* Every root prop passes straight through, including `open`, `onOpenChange`, `modal`, `snapPoints`,
|
|
36
|
+
* `actionsRef` and `data-*`.
|
|
37
37
|
*/
|
|
38
38
|
export function Drawer({ side = "right", label, scoped = false, container, className, backdropClassName, viewportClassName, contentClassName, popupProps, children, ...rest }) {
|
|
39
39
|
return (_jsx(Primitive.Root, { swipeDirection: side === "bottom" ? "down" : side, ...rest, children: _jsxs(Primitive.Portal, { container: container, children: [_jsx(Primitive.Backdrop, { className: mergeClassName([
|
package/dist/ui/input.d.ts
CHANGED
|
@@ -3,8 +3,8 @@ import * as React from "react";
|
|
|
3
3
|
/**
|
|
4
4
|
* The inline height an autosizing textarea should carry, or `""` for "leave it to CSS".
|
|
5
5
|
*
|
|
6
|
-
* ponytail: this whole observer is here only until `field-sizing: content` is baseline
|
|
7
|
-
*
|
|
6
|
+
* ponytail: this whole observer is here only until `field-sizing: content` is baseline. One CSS
|
|
7
|
+
* line does the same job. Ceiling: it does not exist in every browser we support yet.
|
|
8
8
|
*/
|
|
9
9
|
export declare function textareaHeight(clientWidth: number, scrollHeight: number): string;
|
|
10
10
|
type FieldChrome = {
|
package/dist/ui/input.js
CHANGED
|
@@ -11,8 +11,8 @@ const TEXTAREA_MAX_HEIGHT = 160;
|
|
|
11
11
|
/**
|
|
12
12
|
* The inline height an autosizing textarea should carry, or `""` for "leave it to CSS".
|
|
13
13
|
*
|
|
14
|
-
* ponytail: this whole observer is here only until `field-sizing: content` is baseline
|
|
15
|
-
*
|
|
14
|
+
* ponytail: this whole observer is here only until `field-sizing: content` is baseline. One CSS
|
|
15
|
+
* line does the same job. Ceiling: it does not exist in every browser we support yet.
|
|
16
16
|
*/
|
|
17
17
|
export function textareaHeight(clientWidth, scrollHeight) {
|
|
18
18
|
if (clientWidth < TEXTAREA_MIN_AUTO_WIDTH)
|