@tamagui/toggle-group 2.0.0-1768741592663 → 2.0.0-1768781784925
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/cjs/Toggle.cjs +61 -61
- package/dist/cjs/Toggle.js +87 -80
- package/dist/cjs/Toggle.js.map +2 -2
- package/dist/cjs/Toggle.native.js +61 -61
- package/dist/cjs/Toggle.native.js.map +1 -1
- package/dist/cjs/ToggleGroup.cjs +44 -66
- package/dist/cjs/ToggleGroup.js +18 -32
- package/dist/cjs/ToggleGroup.js.map +1 -1
- package/dist/cjs/ToggleGroup.native.js +44 -71
- package/dist/cjs/ToggleGroup.native.js.map +1 -1
- package/dist/cjs/ToggleStylesBase.cjs +16 -0
- package/dist/cjs/ToggleStylesBase.js +14 -0
- package/dist/cjs/ToggleStylesBase.js.map +6 -0
- package/dist/cjs/ToggleStylesBase.native.js +19 -0
- package/dist/cjs/ToggleStylesBase.native.js.map +1 -0
- package/dist/cjs/context.cjs +31 -0
- package/dist/cjs/context.js +26 -0
- package/dist/cjs/context.js.map +6 -0
- package/dist/cjs/context.native.js +34 -0
- package/dist/cjs/context.native.js.map +1 -0
- package/dist/cjs/index.cjs +12 -2
- package/dist/cjs/index.js +8 -1
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/index.native.js +11 -1
- package/dist/cjs/index.native.js.map +1 -1
- package/dist/cjs/types.cjs +16 -0
- package/dist/cjs/types.js +14 -0
- package/dist/cjs/types.js.map +6 -0
- package/dist/cjs/types.native.js +19 -0
- package/dist/cjs/types.native.js.map +1 -0
- package/dist/cjs/useToggleGroupItem.cjs +27 -0
- package/dist/cjs/useToggleGroupItem.js +22 -0
- package/dist/cjs/useToggleGroupItem.js.map +6 -0
- package/dist/cjs/useToggleGroupItem.native.js +30 -0
- package/dist/cjs/useToggleGroupItem.native.js.map +1 -0
- package/dist/esm/Toggle.js +88 -81
- package/dist/esm/Toggle.js.map +2 -2
- package/dist/esm/Toggle.mjs +61 -60
- package/dist/esm/Toggle.mjs.map +1 -1
- package/dist/esm/Toggle.native.js +62 -61
- package/dist/esm/Toggle.native.js.map +1 -1
- package/dist/esm/ToggleGroup.js +21 -36
- package/dist/esm/ToggleGroup.js.map +1 -1
- package/dist/esm/ToggleGroup.mjs +44 -66
- package/dist/esm/ToggleGroup.mjs.map +1 -1
- package/dist/esm/ToggleGroup.native.js +44 -71
- package/dist/esm/ToggleGroup.native.js.map +1 -1
- package/dist/esm/ToggleStylesBase.js +1 -0
- package/dist/esm/ToggleStylesBase.js.map +6 -0
- package/dist/esm/ToggleStylesBase.mjs +2 -0
- package/dist/esm/ToggleStylesBase.mjs.map +1 -0
- package/dist/esm/ToggleStylesBase.native.js +2 -0
- package/dist/esm/ToggleStylesBase.native.js.map +1 -0
- package/dist/esm/context.js +10 -0
- package/dist/esm/context.js.map +6 -0
- package/dist/esm/context.mjs +8 -0
- package/dist/esm/context.mjs.map +1 -0
- package/dist/esm/context.native.js +8 -0
- package/dist/esm/context.native.js.map +1 -0
- package/dist/esm/index.js +4 -0
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/index.mjs +2 -0
- package/dist/esm/index.mjs.map +1 -1
- package/dist/esm/index.native.js +2 -0
- package/dist/esm/index.native.js.map +1 -1
- package/dist/esm/types.js +1 -0
- package/dist/esm/types.js.map +6 -0
- package/dist/esm/types.mjs +2 -0
- package/dist/esm/types.mjs.map +1 -0
- package/dist/esm/types.native.js +2 -0
- package/dist/esm/types.native.js.map +1 -0
- package/dist/esm/useToggleGroupItem.js +6 -0
- package/dist/esm/useToggleGroupItem.js.map +6 -0
- package/dist/esm/useToggleGroupItem.mjs +4 -0
- package/dist/esm/useToggleGroupItem.mjs.map +1 -0
- package/dist/esm/useToggleGroupItem.native.js +4 -0
- package/dist/esm/useToggleGroupItem.native.js.map +1 -0
- package/dist/jsx/Toggle.js +88 -81
- package/dist/jsx/Toggle.js.map +2 -2
- package/dist/jsx/Toggle.mjs +61 -60
- package/dist/jsx/Toggle.mjs.map +1 -1
- package/dist/jsx/Toggle.native.js +61 -61
- package/dist/jsx/Toggle.native.js.map +1 -1
- package/dist/jsx/ToggleGroup.js +21 -36
- package/dist/jsx/ToggleGroup.js.map +1 -1
- package/dist/jsx/ToggleGroup.mjs +44 -66
- package/dist/jsx/ToggleGroup.mjs.map +1 -1
- package/dist/jsx/ToggleGroup.native.js +44 -71
- package/dist/jsx/ToggleGroup.native.js.map +1 -1
- package/dist/jsx/ToggleStylesBase.js +1 -0
- package/dist/jsx/ToggleStylesBase.js.map +6 -0
- package/dist/jsx/ToggleStylesBase.mjs +2 -0
- package/dist/jsx/ToggleStylesBase.mjs.map +1 -0
- package/dist/jsx/ToggleStylesBase.native.js +19 -0
- package/dist/jsx/ToggleStylesBase.native.js.map +1 -0
- package/dist/jsx/context.js +10 -0
- package/dist/jsx/context.js.map +6 -0
- package/dist/jsx/context.mjs +8 -0
- package/dist/jsx/context.mjs.map +1 -0
- package/dist/jsx/context.native.js +34 -0
- package/dist/jsx/context.native.js.map +1 -0
- package/dist/jsx/index.js +4 -0
- package/dist/jsx/index.js.map +1 -1
- package/dist/jsx/index.mjs +2 -0
- package/dist/jsx/index.mjs.map +1 -1
- package/dist/jsx/index.native.js +11 -1
- package/dist/jsx/index.native.js.map +1 -1
- package/dist/jsx/types.js +1 -0
- package/dist/jsx/types.js.map +6 -0
- package/dist/jsx/types.mjs +2 -0
- package/dist/jsx/types.mjs.map +1 -0
- package/dist/jsx/types.native.js +19 -0
- package/dist/jsx/types.native.js.map +1 -0
- package/dist/jsx/useToggleGroupItem.js +6 -0
- package/dist/jsx/useToggleGroupItem.js.map +6 -0
- package/dist/jsx/useToggleGroupItem.mjs +4 -0
- package/dist/jsx/useToggleGroupItem.mjs.map +1 -0
- package/dist/jsx/useToggleGroupItem.native.js +30 -0
- package/dist/jsx/useToggleGroupItem.native.js.map +1 -0
- package/package.json +16 -15
- package/src/Toggle.tsx +99 -93
- package/src/ToggleGroup.tsx +56 -94
- package/src/context.tsx +7 -0
- package/src/index.ts +1 -0
- package/src/types.tsx +3 -0
- package/src/useToggleGroupItem.ts +3 -0
- package/types/Toggle.d.ts +59 -81
- package/types/Toggle.d.ts.map +1 -1
- package/types/ToggleGroup.d.ts +123 -161
- package/types/ToggleGroup.d.ts.map +1 -1
- package/types/ToggleStylesBase.d.ts +5 -0
- package/types/ToggleStylesBase.d.ts.map +1 -0
- package/types/context.d.ts +7 -0
- package/types/context.d.ts.map +1 -0
- package/types/index.d.ts +1 -0
- package/types/index.d.ts.map +1 -1
- package/types/types.d.ts +5 -0
- package/types/types.d.ts.map +1 -0
- package/types/useToggleGroupItem.d.ts +6 -0
- package/types/useToggleGroupItem.d.ts.map +1 -0
package/src/ToggleGroup.tsx
CHANGED
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
import { isWeb } from '@tamagui/constants'
|
|
2
2
|
import { registerFocusable } from '@tamagui/focusable'
|
|
3
|
-
import { getFontSize } from '@tamagui/font-size'
|
|
4
|
-
import { getSize } from '@tamagui/get-token'
|
|
5
3
|
import type { GroupProps } from '@tamagui/group'
|
|
6
4
|
import { Group, useGroupItem } from '@tamagui/group'
|
|
7
5
|
import { withStaticProperties } from '@tamagui/helpers'
|
|
8
|
-
import { useGetThemedIcon } from '@tamagui/helpers-tamagui'
|
|
9
6
|
import { RovingFocusGroup } from '@tamagui/roving-focus'
|
|
7
|
+
import { SizableContext } from '@tamagui/sizable-context'
|
|
10
8
|
import { useControllableState } from '@tamagui/use-controllable-state'
|
|
11
9
|
import { useDirection } from '@tamagui/use-direction'
|
|
12
|
-
import type {
|
|
13
|
-
import { createStyledContext,
|
|
10
|
+
import type { GetProps, SizeTokens, TamaguiElement } from '@tamagui/web'
|
|
11
|
+
import { createStyledContext, styled } from '@tamagui/web'
|
|
14
12
|
import React from 'react'
|
|
15
13
|
|
|
16
|
-
import type { ToggleProps
|
|
17
|
-
import { Toggle, ToggleFrame
|
|
14
|
+
import type { ToggleProps } from './Toggle'
|
|
15
|
+
import { Toggle, ToggleFrame } from './Toggle'
|
|
16
|
+
import { context as ToggleContext } from './context'
|
|
17
|
+
import type { ToggleStylesBase } from './types'
|
|
18
18
|
|
|
19
19
|
const TOGGLE_GROUP_NAME = 'ToggleGroup'
|
|
20
20
|
|
|
@@ -32,7 +32,9 @@ const { Provider: ToggleGroupItemProvider } =
|
|
|
32
32
|
createStyledContext<ToggleGroupItemContextValue>()
|
|
33
33
|
|
|
34
34
|
const { Provider: ToggleGroupContext, useStyledContext: useToggleGroupContext } =
|
|
35
|
-
createStyledContext<ToggleGroupContextValue>(
|
|
35
|
+
createStyledContext<ToggleGroupContextValue>({
|
|
36
|
+
size: undefined,
|
|
37
|
+
})
|
|
36
38
|
|
|
37
39
|
type ToggleGroupItemProps = GetProps<typeof ToggleFrame> & {
|
|
38
40
|
value: string
|
|
@@ -43,7 +45,7 @@ type ToggleGroupItemProps = GetProps<typeof ToggleFrame> & {
|
|
|
43
45
|
* Used to disable passing styles down to children.
|
|
44
46
|
*/
|
|
45
47
|
disablePassStyles?: boolean
|
|
46
|
-
|
|
48
|
+
activeStyle?: ToggleStylesBase | null
|
|
47
49
|
color?: string
|
|
48
50
|
}
|
|
49
51
|
const ToggleGroupItem = ToggleFrame.styleable<ScopedProps<ToggleGroupItemProps>>(
|
|
@@ -51,70 +53,35 @@ const ToggleGroupItem = ToggleFrame.styleable<ScopedProps<ToggleGroupItemProps>>
|
|
|
51
53
|
const valueContext = useToggleGroupValueContext(props.__scopeToggleGroup)
|
|
52
54
|
const context = useToggleGroupContext(props.__scopeToggleGroup)
|
|
53
55
|
const toggleContext = ToggleContext.useStyledContext(props.__scopeToggleGroup)
|
|
54
|
-
const
|
|
55
|
-
const toggledStyle = props.toggledStyle || toggleContext.toggledStyle
|
|
56
|
+
const active = valueContext?.value.includes(props.value)
|
|
56
57
|
const color = (props as any).color || toggleContext.color
|
|
57
|
-
const { disablePassStyles,
|
|
58
|
+
const { disablePassStyles, ...rest } = props
|
|
58
59
|
const disabled = context.disabled || props.disabled || false
|
|
59
60
|
const groupItemProps = useGroupItem({ disabled })
|
|
60
61
|
const size = props.size ?? context.size
|
|
61
62
|
|
|
62
|
-
const sizeProps: Record<string, any> = props.unstyled
|
|
63
|
-
? {}
|
|
64
|
-
: {
|
|
65
|
-
width: undefined,
|
|
66
|
-
height: undefined,
|
|
67
|
-
padding: getVariableValue(size) * 0.6,
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
const iconSize =
|
|
71
|
-
(typeof size === 'number' ? size * 0.7 : getFontSize(size as FontSizeTokens)) * 1.2
|
|
72
|
-
|
|
73
|
-
const theme = useTheme()
|
|
74
|
-
const toggledColor = (toggledStyle as ToggleStylesBase)?.color
|
|
75
|
-
const activeColor = pressed && toggledColor ? toggledColor : color
|
|
76
|
-
const getThemedIcon = useGetThemedIcon({
|
|
77
|
-
size: iconSize,
|
|
78
|
-
color: activeColor || theme.color,
|
|
79
|
-
})
|
|
80
|
-
|
|
81
|
-
const childrens = React.Children.toArray(props.children)
|
|
82
|
-
const children = childrens.map((child) => {
|
|
83
|
-
if (props.disablePassStyles || !React.isValidElement(child)) {
|
|
84
|
-
return child
|
|
85
|
-
}
|
|
86
|
-
return React.cloneElement(getThemedIcon(child), { active: pressed } as any)
|
|
87
|
-
})
|
|
88
|
-
|
|
89
|
-
const commonProps = {
|
|
90
|
-
pressed,
|
|
91
|
-
disabled,
|
|
92
|
-
...sizeProps,
|
|
93
|
-
...rest,
|
|
94
|
-
children,
|
|
95
|
-
toggledStyle,
|
|
96
|
-
}
|
|
97
|
-
|
|
98
63
|
const inner = (
|
|
99
64
|
<ToggleGroupItemImpl
|
|
100
|
-
{...
|
|
65
|
+
{...groupItemProps}
|
|
101
66
|
ref={forwardedRef}
|
|
67
|
+
size={size}
|
|
102
68
|
// focusable={!disabled}
|
|
103
69
|
tabIndex={disabled ? -1 : 0}
|
|
70
|
+
{...rest}
|
|
104
71
|
disabled={disabled}
|
|
105
|
-
{
|
|
72
|
+
active={active}
|
|
106
73
|
/>
|
|
107
74
|
)
|
|
108
75
|
|
|
109
76
|
return (
|
|
110
77
|
<ToggleGroupItemProvider scope={props.__scopeToggleGroup}>
|
|
111
|
-
<ToggleContext.Provider color={color}
|
|
78
|
+
<ToggleContext.Provider size={size} color={color} active={active}>
|
|
112
79
|
{context.rovingFocus ? (
|
|
113
80
|
<RovingFocusGroup.Item
|
|
114
81
|
asChild="except-style"
|
|
115
82
|
__scopeRovingFocusGroup={props.__scopeToggleGroup || TOGGLE_GROUP_CONTEXT}
|
|
116
83
|
focusable={!disabled}
|
|
117
|
-
active={
|
|
84
|
+
active={active}
|
|
118
85
|
>
|
|
119
86
|
{inner}
|
|
120
87
|
</RovingFocusGroup.Item>
|
|
@@ -158,7 +125,7 @@ const ToggleGroupItemImpl = React.forwardRef<
|
|
|
158
125
|
{...typeProps}
|
|
159
126
|
{...itemProps}
|
|
160
127
|
ref={forwardedRef}
|
|
161
|
-
|
|
128
|
+
onActiveChange={(pressed) => {
|
|
162
129
|
if (pressed) {
|
|
163
130
|
valueContext.onItemActivate(value)
|
|
164
131
|
} else {
|
|
@@ -358,9 +325,9 @@ ToggleGroup.displayName = TOGGLE_GROUP_NAME
|
|
|
358
325
|
/* -----------------------------------------------------------------------------------------------*/
|
|
359
326
|
|
|
360
327
|
type ToggleGroupContextValue = {
|
|
361
|
-
rovingFocus
|
|
362
|
-
disabled
|
|
363
|
-
size
|
|
328
|
+
rovingFocus?: boolean
|
|
329
|
+
disabled?: boolean
|
|
330
|
+
size?: SizeTokens
|
|
364
331
|
}
|
|
365
332
|
|
|
366
333
|
type RovingFocusGroupProps = React.ComponentPropsWithoutRef<typeof RovingFocusGroup>
|
|
@@ -387,7 +354,7 @@ type ToggleGroupImplProps = GetProps<typeof ToggleGroupImplElementFrame> &
|
|
|
387
354
|
dir?: RovingFocusGroupProps['dir']
|
|
388
355
|
loop?: RovingFocusGroupProps['loop']
|
|
389
356
|
sizeAdjust?: number
|
|
390
|
-
|
|
357
|
+
activeStyle?: ToggleStylesBase | null
|
|
391
358
|
color?: string
|
|
392
359
|
}
|
|
393
360
|
|
|
@@ -405,7 +372,7 @@ const ToggleGroupImpl = ToggleGroupImplElementFrame.styleable<
|
|
|
405
372
|
unstyled = false,
|
|
406
373
|
size: sizeProp = '$true',
|
|
407
374
|
sizeAdjust = 0,
|
|
408
|
-
|
|
375
|
+
activeStyle,
|
|
409
376
|
color,
|
|
410
377
|
...toggleGroupProps
|
|
411
378
|
} = props
|
|
@@ -415,51 +382,46 @@ const ToggleGroupImpl = ToggleGroupImplElementFrame.styleable<
|
|
|
415
382
|
dir: direction,
|
|
416
383
|
...toggleGroupProps,
|
|
417
384
|
}
|
|
418
|
-
const adjustedSize = getVariableValue(
|
|
419
|
-
getSize(sizeProp, {
|
|
420
|
-
shift: sizeAdjust,
|
|
421
|
-
})
|
|
422
|
-
)
|
|
423
|
-
const size = Math.round(adjustedSize * 0.45)
|
|
424
385
|
|
|
425
386
|
return (
|
|
426
|
-
<
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
{
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
387
|
+
<SizableContext.Provider size={sizeProp}>
|
|
388
|
+
<ToggleGroupContext
|
|
389
|
+
scope={__scopeToggleGroup}
|
|
390
|
+
rovingFocus={rovingFocus}
|
|
391
|
+
disabled={disabled}
|
|
392
|
+
size={sizeProp}
|
|
393
|
+
>
|
|
394
|
+
<ToggleContext.Provider size={sizeProp} color={color}>
|
|
395
|
+
{rovingFocus ? (
|
|
396
|
+
<RovingFocusGroup
|
|
397
|
+
asChild="except-style"
|
|
398
|
+
__scopeRovingFocusGroup={__scopeToggleGroup || TOGGLE_GROUP_CONTEXT}
|
|
399
|
+
orientation={orientation}
|
|
400
|
+
dir={direction}
|
|
401
|
+
loop={loop}
|
|
402
|
+
>
|
|
403
|
+
<ToggleGroupImplElementFrame
|
|
404
|
+
aria-orientation={orientation}
|
|
405
|
+
orientation={orientation}
|
|
406
|
+
ref={forwardedRef}
|
|
407
|
+
data-disabled={disabled ? '' : undefined}
|
|
408
|
+
unstyled={unstyled}
|
|
409
|
+
{...commonProps}
|
|
410
|
+
/>
|
|
411
|
+
</RovingFocusGroup>
|
|
412
|
+
) : (
|
|
441
413
|
<ToggleGroupImplElementFrame
|
|
442
414
|
aria-orientation={orientation}
|
|
443
|
-
orientation={orientation}
|
|
444
|
-
// axis={orientation}
|
|
445
415
|
ref={forwardedRef}
|
|
416
|
+
orientation={orientation}
|
|
446
417
|
data-disabled={disabled ? '' : undefined}
|
|
447
418
|
unstyled={unstyled}
|
|
448
419
|
{...commonProps}
|
|
449
420
|
/>
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
ref={forwardedRef}
|
|
455
|
-
orientation={orientation}
|
|
456
|
-
data-disabled={disabled ? '' : undefined}
|
|
457
|
-
unstyled={unstyled}
|
|
458
|
-
{...commonProps}
|
|
459
|
-
/>
|
|
460
|
-
)}
|
|
461
|
-
</ToggleContext.Provider>
|
|
462
|
-
</ToggleGroupContext>
|
|
421
|
+
)}
|
|
422
|
+
</ToggleContext.Provider>
|
|
423
|
+
</ToggleGroupContext>
|
|
424
|
+
</SizableContext.Provider>
|
|
463
425
|
)
|
|
464
426
|
})
|
|
465
427
|
|
package/src/context.tsx
ADDED
package/src/index.ts
CHANGED
package/src/types.tsx
ADDED
package/types/Toggle.d.ts
CHANGED
|
@@ -1,95 +1,73 @@
|
|
|
1
|
-
import type { GetProps,
|
|
1
|
+
import type { GetProps, TamaguiElement, ViewStyle } from '@tamagui/web';
|
|
2
2
|
import * as React from 'react';
|
|
3
|
-
export
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
elevation?: number | import("@tamagui/web").SizeTokens | undefined;
|
|
12
|
-
transparent?: boolean | undefined;
|
|
13
|
-
fullscreen?: boolean | undefined;
|
|
14
|
-
circular?: boolean | undefined;
|
|
15
|
-
backgrounded?: boolean | undefined;
|
|
16
|
-
radiused?: boolean | undefined;
|
|
17
|
-
hoverTheme?: boolean | undefined;
|
|
18
|
-
pressTheme?: boolean | undefined;
|
|
19
|
-
focusTheme?: boolean | undefined;
|
|
20
|
-
padded?: boolean | undefined;
|
|
21
|
-
elevate?: boolean | undefined;
|
|
22
|
-
bordered?: number | boolean | undefined;
|
|
23
|
-
chromeless?: boolean | "all" | undefined;
|
|
24
|
-
toggledStyle?: ToggleStylesBase | null | undefined;
|
|
25
|
-
active?: boolean | undefined;
|
|
3
|
+
export declare const ToggleFrame: import("@tamagui/web").TamaguiComponent<import("@tamagui/web").TamaDefer, TamaguiElement, import("@tamagui/web").StackNonStyleProps, import("@tamagui/web").StackStyleBase & {
|
|
4
|
+
readonly activeStyle?: Partial<import("@tamagui/web").InferStyleProps<import("@tamagui/web").TamaguiComponent<import("@tamagui/web").StackProps, TamaguiElement, import("@tamagui/web").StackNonStyleProps, import("@tamagui/web").StackStyleBase, {}, {}>, {
|
|
5
|
+
accept: {
|
|
6
|
+
readonly activeStyle: "style";
|
|
7
|
+
};
|
|
8
|
+
}>> | undefined;
|
|
9
|
+
}, {
|
|
10
|
+
size?: number | import("@tamagui/web").SizeTokens | undefined;
|
|
26
11
|
unstyled?: boolean | undefined;
|
|
27
|
-
|
|
28
|
-
},
|
|
12
|
+
defaultActiveStyle?: boolean | undefined;
|
|
13
|
+
}, {
|
|
14
|
+
accept: {
|
|
15
|
+
readonly activeStyle: "style";
|
|
16
|
+
};
|
|
17
|
+
}>;
|
|
29
18
|
type ToggleFrameProps = GetProps<typeof ToggleFrame>;
|
|
30
19
|
type ToggleItemExtraProps = {
|
|
31
20
|
defaultValue?: string;
|
|
32
21
|
disabled?: boolean;
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
22
|
+
active?: boolean;
|
|
23
|
+
defaultActive?: boolean;
|
|
24
|
+
onActiveChange?(active: boolean): void;
|
|
25
|
+
activeStyle?: ViewStyle | null;
|
|
26
|
+
activeTheme?: string | null;
|
|
37
27
|
};
|
|
38
28
|
export type ToggleProps = ToggleFrameProps & ToggleItemExtraProps;
|
|
39
|
-
export declare const Toggle: React.ForwardRefExoticComponent<Omit<import("@tamagui/
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
pressTheme?: boolean | undefined;
|
|
48
|
-
focusTheme?: boolean | undefined;
|
|
49
|
-
padded?: boolean | undefined;
|
|
50
|
-
elevate?: boolean | undefined;
|
|
51
|
-
bordered?: number | boolean | undefined;
|
|
52
|
-
chromeless?: boolean | "all" | undefined;
|
|
53
|
-
toggledStyle?: ToggleStylesBase | null | undefined;
|
|
54
|
-
active?: boolean | undefined;
|
|
29
|
+
export declare const Toggle: React.ForwardRefExoticComponent<Omit<import("@tamagui/web").StackNonStyleProps, "size" | keyof import("@tamagui/web").StackStyleBase | "activeStyle" | "unstyled" | "defaultActiveStyle"> & import("@tamagui/web").WithThemeValues<import("@tamagui/web").StackStyleBase & {
|
|
30
|
+
readonly activeStyle?: Partial<import("@tamagui/web").InferStyleProps<import("@tamagui/web").TamaguiComponent<import("@tamagui/web").StackProps, TamaguiElement, import("@tamagui/web").StackNonStyleProps, import("@tamagui/web").StackStyleBase, {}, {}>, {
|
|
31
|
+
accept: {
|
|
32
|
+
readonly activeStyle: "style";
|
|
33
|
+
};
|
|
34
|
+
}>> | undefined;
|
|
35
|
+
}> & {
|
|
36
|
+
size?: number | import("@tamagui/web").SizeTokens | undefined;
|
|
55
37
|
unstyled?: boolean | undefined;
|
|
56
|
-
|
|
57
|
-
} & import("@tamagui/web").WithShorthands<import("@tamagui/web").WithThemeValues<
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
toggledStyle?: ToggleStylesBase | null | undefined;
|
|
72
|
-
active?: boolean | undefined;
|
|
38
|
+
defaultActiveStyle?: boolean | undefined;
|
|
39
|
+
} & import("@tamagui/web").WithShorthands<import("@tamagui/web").WithThemeValues<import("@tamagui/web").StackStyleBase & {
|
|
40
|
+
readonly activeStyle?: Partial<import("@tamagui/web").InferStyleProps<import("@tamagui/web").TamaguiComponent<import("@tamagui/web").StackProps, TamaguiElement, import("@tamagui/web").StackNonStyleProps, import("@tamagui/web").StackStyleBase, {}, {}>, {
|
|
41
|
+
accept: {
|
|
42
|
+
readonly activeStyle: "style";
|
|
43
|
+
};
|
|
44
|
+
}>> | undefined;
|
|
45
|
+
}>> & import("@tamagui/web").WithPseudoProps<import("@tamagui/web").WithThemeValues<import("@tamagui/web").StackStyleBase & {
|
|
46
|
+
readonly activeStyle?: Partial<import("@tamagui/web").InferStyleProps<import("@tamagui/web").TamaguiComponent<import("@tamagui/web").StackProps, TamaguiElement, import("@tamagui/web").StackNonStyleProps, import("@tamagui/web").StackStyleBase, {}, {}>, {
|
|
47
|
+
accept: {
|
|
48
|
+
readonly activeStyle: "style";
|
|
49
|
+
};
|
|
50
|
+
}>> | undefined;
|
|
51
|
+
}> & {
|
|
52
|
+
size?: number | import("@tamagui/web").SizeTokens | undefined;
|
|
73
53
|
unstyled?: boolean | undefined;
|
|
74
|
-
|
|
75
|
-
} & import("@tamagui/web").WithShorthands<import("@tamagui/web").WithThemeValues<
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
toggledStyle?: ToggleStylesBase | null | undefined;
|
|
90
|
-
active?: boolean | undefined;
|
|
54
|
+
defaultActiveStyle?: boolean | undefined;
|
|
55
|
+
} & import("@tamagui/web").WithShorthands<import("@tamagui/web").WithThemeValues<import("@tamagui/web").StackStyleBase & {
|
|
56
|
+
readonly activeStyle?: Partial<import("@tamagui/web").InferStyleProps<import("@tamagui/web").TamaguiComponent<import("@tamagui/web").StackProps, TamaguiElement, import("@tamagui/web").StackNonStyleProps, import("@tamagui/web").StackStyleBase, {}, {}>, {
|
|
57
|
+
accept: {
|
|
58
|
+
readonly activeStyle: "style";
|
|
59
|
+
};
|
|
60
|
+
}>> | undefined;
|
|
61
|
+
}>>> & import("@tamagui/web").WithMediaProps<import("@tamagui/web").WithThemeShorthandsAndPseudos<import("@tamagui/web").StackStyleBase & {
|
|
62
|
+
readonly activeStyle?: Partial<import("@tamagui/web").InferStyleProps<import("@tamagui/web").TamaguiComponent<import("@tamagui/web").StackProps, TamaguiElement, import("@tamagui/web").StackNonStyleProps, import("@tamagui/web").StackStyleBase, {}, {}>, {
|
|
63
|
+
accept: {
|
|
64
|
+
readonly activeStyle: "style";
|
|
65
|
+
};
|
|
66
|
+
}>> | undefined;
|
|
67
|
+
}, {
|
|
68
|
+
size?: number | import("@tamagui/web").SizeTokens | undefined;
|
|
91
69
|
unstyled?: boolean | undefined;
|
|
92
|
-
|
|
70
|
+
defaultActiveStyle?: boolean | undefined;
|
|
93
71
|
}>> & ToggleItemExtraProps & React.RefAttributes<TamaguiElement>>;
|
|
94
72
|
export {};
|
|
95
73
|
//# sourceMappingURL=Toggle.d.ts.map
|
package/types/Toggle.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Toggle.d.ts","sourceRoot":"","sources":["../src/Toggle.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Toggle.d.ts","sourceRoot":"","sources":["../src/Toggle.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,QAAQ,EAAE,cAAc,EAAE,SAAS,EAAE,MAAM,cAAc,CAAA;AAEvE,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAS9B,eAAO,MAAM,WAAW;;;;;;;;;;;;;;EAwEvB,CAAA;AAED,KAAK,gBAAgB,GAAG,QAAQ,CAAC,OAAO,WAAW,CAAC,CAAA;AAEpD,KAAK,oBAAoB,GAAG;IAC1B,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,MAAM,CAAC,EAAE,OAAO,CAAA;IAChB,aAAa,CAAC,EAAE,OAAO,CAAA;IACvB,cAAc,CAAC,CAAC,MAAM,EAAE,OAAO,GAAG,IAAI,CAAA;IACtC,WAAW,CAAC,EAAE,SAAS,GAAG,IAAI,CAAA;IAC9B,WAAW,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;CAC5B,CAAA;AAED,MAAM,MAAM,WAAW,GAAG,gBAAgB,GAAG,oBAAoB,CAAA;AAEjE,eAAO,MAAM,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iEA8ClB,CAAA"}
|