@react-types/provider 3.0.0-nightly-641446f65-240905

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.
Files changed (3) hide show
  1. package/README.md +3 -0
  2. package/package.json +21 -0
  3. package/src/index.d.ts +124 -0
package/README.md ADDED
@@ -0,0 +1,3 @@
1
+ # @react-types/provider
2
+
3
+ This package is part of [react-spectrum](https://github.com/adobe/react-spectrum). See the repo for more details.
package/package.json ADDED
@@ -0,0 +1,21 @@
1
+ {
2
+ "name": "@react-types/provider",
3
+ "version": "3.0.0-nightly-641446f65-240905",
4
+ "description": "Spectrum UI components in React",
5
+ "license": "Apache-2.0",
6
+ "types": "src/index.d.ts",
7
+ "repository": {
8
+ "type": "git",
9
+ "url": "https://github.com/adobe/react-spectrum"
10
+ },
11
+ "dependencies": {
12
+ "@react-types/shared": "^3.0.0-nightly-641446f65-240905"
13
+ },
14
+ "peerDependencies": {
15
+ "react": "^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0"
16
+ },
17
+ "publishConfig": {
18
+ "access": "public"
19
+ },
20
+ "stableVersion": "3.8.3"
21
+ }
package/src/index.d.ts ADDED
@@ -0,0 +1,124 @@
1
+ /*
2
+ * Copyright 2020 Adobe. All rights reserved.
3
+ * This file is licensed to you under the Apache License, Version 2.0 (the "License");
4
+ * you may not use this file except in compliance with the License. You may obtain a copy
5
+ * of the License at http://www.apache.org/licenses/LICENSE-2.0
6
+ *
7
+ * Unless required by applicable law or agreed to in writing, software distributed under
8
+ * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
9
+ * OF ANY KIND, either express or implied. See the License for the specific language
10
+ * governing permissions and limitations under the License.
11
+ */
12
+
13
+ import {DOMProps, Href, RouterOptions, StyleProps, ValidationState} from '@react-types/shared';
14
+ import {ReactNode} from 'react';
15
+
16
+ export type ColorScheme = 'light' | 'dark';
17
+ export type Scale = 'medium' | 'large';
18
+ export interface Breakpoints {
19
+ S?: number,
20
+ M?: number,
21
+ L?: number,
22
+ // Currently, it only deals with pixels, but we need to fix it to accept em or rem as well.
23
+ [custom: string]: number | undefined
24
+ }
25
+
26
+ export type CSSModule = {
27
+ [className: string]: string
28
+ };
29
+
30
+ /** A theme object defines CSS variables for a theme, across multiple color schemes and scales. */
31
+ export interface Theme {
32
+ /** CSS module defining the global variables, which do not change between color schemes/scales. */
33
+ global?: CSSModule,
34
+ /** CSS module defining the variables for the light color scheme. */
35
+ light?: CSSModule,
36
+ /** CSS module defining the variables for the dark color scheme. */
37
+ dark?: CSSModule,
38
+ /** CSS module defining the variables for the medium scale. */
39
+ medium?: CSSModule,
40
+ /** CSS module defining the variables for the large scale. */
41
+ large?: CSSModule
42
+ }
43
+
44
+ interface ContextProps {
45
+ /** Whether descendants should be displayed with the quiet style. */
46
+ isQuiet?: boolean,
47
+ /** Whether descendants should be displayed with the emphasized style. */
48
+ isEmphasized?: boolean,
49
+ /** Whether descendants should be disabled. */
50
+ isDisabled?: boolean,
51
+ /** Whether descendants should be displayed with the required style. */
52
+ isRequired?: boolean,
53
+ /** Whether descendants should be read only. */
54
+ isReadOnly?: boolean,
55
+ /** Whether descendants should be displayed with the validation state style. */
56
+ validationState?: ValidationState
57
+ }
58
+
59
+ interface Router {
60
+ navigate: (path: string, routerOptions: RouterOptions | undefined) => void,
61
+ useHref?: (href: Href) => string
62
+ }
63
+
64
+ export interface ProviderProps extends ContextProps, DOMProps, StyleProps {
65
+ /** The content of the Provider. */
66
+ children: ReactNode,
67
+ /**
68
+ * The theme for your application.
69
+ */
70
+ theme?: Theme,
71
+ /**
72
+ * The color scheme for your application.
73
+ * Defaults to operating system preferences.
74
+ */
75
+ colorScheme?: ColorScheme,
76
+ /**
77
+ * The default color scheme if no operating system setting is available.
78
+ * @default 'light'
79
+ */
80
+ defaultColorScheme?: ColorScheme,
81
+ /**
82
+ * Sets the scale for your applications. Defaults based on device pointer type.
83
+ */
84
+ scale?: Scale,
85
+ /**
86
+ * The locale for your application as a [BCP 47](https://www.ietf.org/rfc/bcp/bcp47.txt) language code.
87
+ * Defaults to the browser/OS language setting.
88
+ * @default 'en-US'
89
+ */
90
+ locale?: string,
91
+ /**
92
+ * The breakpoints for styleProps.
93
+ * Do not use `base` property.
94
+ * @default {S:380,M:768,L:1024}
95
+ */
96
+ breakpoints?: Breakpoints,
97
+ /**
98
+ * Provides a client side router to all nested React Spectrum links to enable client side navigation.
99
+ */
100
+ router?: Router
101
+ }
102
+
103
+ export interface ProviderContext extends ContextProps {
104
+ /**
105
+ * The package version number of the nearest parent Provider.
106
+ */
107
+ version: string,
108
+ /**
109
+ * The theme of the nearest parent Provider.
110
+ */
111
+ theme: Theme,
112
+ /**
113
+ * The color scheme of the nearest parent Provider.
114
+ */
115
+ colorScheme: ColorScheme,
116
+ /**
117
+ * The scale of the nearest parent Provider.
118
+ */
119
+ scale: Scale,
120
+ /**
121
+ * The breakpoints of the nearest parent Provider used for styleProps.
122
+ */
123
+ breakpoints: Breakpoints
124
+ }