@pickle-ui/react-native 1.0.0-beta.0 → 1.0.0-beta.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/README.md +70 -11
- package/dist/components/Badge.d.ts +6 -3
- package/dist/components/Badge.d.ts.map +1 -1
- package/dist/components/Badge.js +36 -7
- package/dist/components/Badge.js.map +1 -1
- package/dist/components/Button.d.ts +11 -4
- package/dist/components/Button.d.ts.map +1 -1
- package/dist/components/Button.js +100 -15
- package/dist/components/Button.js.map +1 -1
- package/dist/components/Card.d.ts +15 -5
- package/dist/components/Card.d.ts.map +1 -1
- package/dist/components/Card.js +28 -10
- package/dist/components/Card.js.map +1 -1
- package/dist/components/Flex.d.ts +25 -0
- package/dist/components/Flex.d.ts.map +1 -0
- package/dist/components/Flex.js +24 -0
- package/dist/components/Flex.js.map +1 -0
- package/dist/components/Grid.d.ts +36 -0
- package/dist/components/Grid.d.ts.map +1 -0
- package/dist/components/Grid.js +68 -0
- package/dist/components/Grid.js.map +1 -0
- package/dist/components/Separator.d.ts +11 -0
- package/dist/components/Separator.d.ts.map +1 -0
- package/dist/components/Separator.js +12 -0
- package/dist/components/Separator.js.map +1 -0
- package/dist/components/Spinner.d.ts +14 -0
- package/dist/components/Spinner.d.ts.map +1 -0
- package/dist/components/Spinner.js +41 -0
- package/dist/components/Spinner.js.map +1 -0
- package/dist/components/Text.d.ts +7 -3
- package/dist/components/Text.d.ts.map +1 -1
- package/dist/components/Text.js +23 -11
- package/dist/components/Text.js.map +1 -1
- package/dist/components/XStack.d.ts +4 -0
- package/dist/components/XStack.d.ts.map +1 -0
- package/dist/components/XStack.js +6 -0
- package/dist/components/XStack.js.map +1 -0
- package/dist/components/YStack.d.ts +4 -0
- package/dist/components/YStack.d.ts.map +1 -0
- package/dist/components/YStack.js +6 -0
- package/dist/components/YStack.js.map +1 -0
- package/dist/components/_internal/InputFrame.d.ts +13 -0
- package/dist/components/_internal/InputFrame.d.ts.map +1 -0
- package/dist/components/_internal/InputFrame.js +14 -0
- package/dist/components/_internal/InputFrame.js.map +1 -0
- package/dist/components/_internal/StoryItem.d.ts +6 -0
- package/dist/components/_internal/StoryItem.d.ts.map +1 -0
- package/dist/components/_internal/StoryItem.js +9 -0
- package/dist/components/_internal/StoryItem.js.map +1 -0
- package/dist/components/_internal/layout.d.ts +79 -0
- package/dist/components/_internal/layout.d.ts.map +1 -0
- package/dist/components/_internal/layout.js +73 -0
- package/dist/components/_internal/layout.js.map +1 -0
- package/dist/components/_internal/useControllableState.d.ts +7 -0
- package/dist/components/_internal/useControllableState.d.ts.map +1 -0
- package/dist/components/_internal/useControllableState.js +17 -0
- package/dist/components/_internal/useControllableState.js.map +1 -0
- package/dist/components/form/Checkbox.d.ts +26 -0
- package/dist/components/form/Checkbox.d.ts.map +1 -0
- package/dist/components/form/Checkbox.js +41 -0
- package/dist/components/form/Checkbox.js.map +1 -0
- package/dist/components/form/Form.context.d.ts +34 -0
- package/dist/components/form/Form.context.d.ts.map +1 -0
- package/dist/components/form/Form.context.js +53 -0
- package/dist/components/form/Form.context.js.map +1 -0
- package/dist/components/form/Form.d.ts +33 -0
- package/dist/components/form/Form.d.ts.map +1 -0
- package/dist/components/form/Form.js +36 -0
- package/dist/components/form/Form.js.map +1 -0
- package/dist/components/form/FormCheckbox.d.ts +7 -0
- package/dist/components/form/FormCheckbox.d.ts.map +1 -0
- package/dist/components/form/FormCheckbox.js +24 -0
- package/dist/components/form/FormCheckbox.js.map +1 -0
- package/dist/components/form/FormDescription.d.ts +4 -0
- package/dist/components/form/FormDescription.d.ts.map +1 -0
- package/dist/components/form/FormDescription.js +7 -0
- package/dist/components/form/FormDescription.js.map +1 -0
- package/dist/components/form/FormError.d.ts +5 -0
- package/dist/components/form/FormError.d.ts.map +1 -0
- package/dist/components/form/FormError.js +8 -0
- package/dist/components/form/FormError.js.map +1 -0
- package/dist/components/form/FormField.d.ts +17 -0
- package/dist/components/form/FormField.d.ts.map +1 -0
- package/dist/components/form/FormField.js +36 -0
- package/dist/components/form/FormField.js.map +1 -0
- package/dist/components/form/FormInput.d.ts +10 -0
- package/dist/components/form/FormInput.d.ts.map +1 -0
- package/dist/components/form/FormInput.js +36 -0
- package/dist/components/form/FormInput.js.map +1 -0
- package/dist/components/form/FormInputGroup.d.ts +8 -0
- package/dist/components/form/FormInputGroup.d.ts.map +1 -0
- package/dist/components/form/FormInputGroup.js +18 -0
- package/dist/components/form/FormInputGroup.js.map +1 -0
- package/dist/components/form/FormLabel.d.ts +4 -0
- package/dist/components/form/FormLabel.d.ts.map +1 -0
- package/dist/components/form/FormLabel.js +7 -0
- package/dist/components/form/FormLabel.js.map +1 -0
- package/dist/components/form/FormRadioGroup.d.ts +11 -0
- package/dist/components/form/FormRadioGroup.d.ts.map +1 -0
- package/dist/components/form/FormRadioGroup.js +24 -0
- package/dist/components/form/FormRadioGroup.js.map +1 -0
- package/dist/components/form/FormRoot.d.ts +13 -0
- package/dist/components/form/FormRoot.d.ts.map +1 -0
- package/dist/components/form/FormRoot.js +19 -0
- package/dist/components/form/FormRoot.js.map +1 -0
- package/dist/components/form/FormTextarea.d.ts +7 -0
- package/dist/components/form/FormTextarea.d.ts.map +1 -0
- package/dist/components/form/FormTextarea.js +27 -0
- package/dist/components/form/FormTextarea.js.map +1 -0
- package/dist/components/form/Input.d.ts +17 -0
- package/dist/components/form/Input.d.ts.map +1 -0
- package/dist/components/form/Input.js +32 -0
- package/dist/components/form/Input.js.map +1 -0
- package/dist/components/form/InputGroup.context.d.ts +10 -0
- package/dist/components/form/InputGroup.context.d.ts.map +1 -0
- package/dist/components/form/InputGroup.context.js +8 -0
- package/dist/components/form/InputGroup.context.js.map +1 -0
- package/dist/components/form/InputGroup.d.ts +31 -0
- package/dist/components/form/InputGroup.d.ts.map +1 -0
- package/dist/components/form/InputGroup.js +123 -0
- package/dist/components/form/InputGroup.js.map +1 -0
- package/dist/components/form/RadioGroup.d.ts +29 -0
- package/dist/components/form/RadioGroup.d.ts.map +1 -0
- package/dist/components/form/RadioGroup.js +42 -0
- package/dist/components/form/RadioGroup.js.map +1 -0
- package/dist/components/form/Textarea.d.ts +19 -0
- package/dist/components/form/Textarea.d.ts.map +1 -0
- package/dist/components/form/Textarea.js +26 -0
- package/dist/components/form/Textarea.js.map +1 -0
- package/dist/entries/card.d.ts +1 -1
- package/dist/entries/card.d.ts.map +1 -1
- package/dist/entries/checkbox.d.ts +3 -0
- package/dist/entries/checkbox.d.ts.map +1 -0
- package/dist/entries/checkbox.js +2 -0
- package/dist/entries/checkbox.js.map +1 -0
- package/dist/entries/flex.d.ts +3 -0
- package/dist/entries/flex.d.ts.map +1 -0
- package/dist/entries/flex.js +2 -0
- package/dist/entries/flex.js.map +1 -0
- package/dist/entries/form.d.ts +3 -0
- package/dist/entries/form.d.ts.map +1 -0
- package/dist/entries/form.js +2 -0
- package/dist/entries/form.js.map +1 -0
- package/dist/entries/grid.d.ts +3 -0
- package/dist/entries/grid.d.ts.map +1 -0
- package/dist/entries/grid.js +2 -0
- package/dist/entries/grid.js.map +1 -0
- package/dist/entries/input-group.d.ts +3 -0
- package/dist/entries/input-group.d.ts.map +1 -0
- package/dist/entries/input-group.js +2 -0
- package/dist/entries/input-group.js.map +1 -0
- package/dist/entries/input.d.ts +3 -0
- package/dist/entries/input.d.ts.map +1 -0
- package/dist/entries/input.js +2 -0
- package/dist/entries/input.js.map +1 -0
- package/dist/entries/radio-group.d.ts +3 -0
- package/dist/entries/radio-group.d.ts.map +1 -0
- package/dist/entries/radio-group.js +2 -0
- package/dist/entries/radio-group.js.map +1 -0
- package/dist/entries/separator.d.ts +3 -0
- package/dist/entries/separator.d.ts.map +1 -0
- package/dist/entries/separator.js +2 -0
- package/dist/entries/separator.js.map +1 -0
- package/dist/entries/spinner.d.ts +3 -0
- package/dist/entries/spinner.d.ts.map +1 -0
- package/dist/entries/spinner.js +2 -0
- package/dist/entries/spinner.js.map +1 -0
- package/dist/entries/textarea.d.ts +3 -0
- package/dist/entries/textarea.d.ts.map +1 -0
- package/dist/entries/textarea.js +2 -0
- package/dist/entries/textarea.js.map +1 -0
- package/dist/entries/theme.d.ts +3 -0
- package/dist/entries/theme.d.ts.map +1 -0
- package/dist/entries/theme.js +2 -0
- package/dist/entries/theme.js.map +1 -0
- package/dist/entries/x-stack.d.ts +3 -0
- package/dist/entries/x-stack.d.ts.map +1 -0
- package/dist/entries/x-stack.js +2 -0
- package/dist/entries/x-stack.js.map +1 -0
- package/dist/entries/y-stack.d.ts +3 -0
- package/dist/entries/y-stack.d.ts.map +1 -0
- package/dist/entries/y-stack.js +2 -0
- package/dist/entries/y-stack.js.map +1 -0
- package/dist/index.d.ts +13 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +13 -0
- package/dist/index.js.map +1 -1
- package/dist/lib/cn.d.ts.map +1 -1
- package/dist/lib/cn.js +13 -1
- package/dist/lib/cn.js.map +1 -1
- package/package.json +10 -3
- package/src/base.css +7 -2
- package/src/components/Badge.stories.tsx +51 -6
- package/src/components/Badge.test.tsx +15 -0
- package/src/components/Badge.tsx +73 -17
- package/src/components/Button.stories.tsx +96 -8
- package/src/components/Button.test.tsx +69 -0
- package/src/components/Button.tsx +159 -18
- package/src/components/Card.stories.tsx +17 -4
- package/src/components/Card.test.tsx +24 -1
- package/src/components/Card.tsx +71 -13
- package/src/components/Flex.stories.tsx +58 -0
- package/src/components/Flex.test.tsx +57 -0
- package/src/components/Flex.tsx +52 -0
- package/src/components/Grid.stories.tsx +55 -0
- package/src/components/Grid.test.tsx +140 -0
- package/src/components/Grid.tsx +166 -0
- package/src/components/Separator.stories.tsx +39 -0
- package/src/components/Separator.test.tsx +25 -0
- package/src/components/Separator.tsx +30 -0
- package/src/components/Spinner.stories.tsx +35 -0
- package/src/components/Spinner.test.tsx +30 -0
- package/src/components/Spinner.tsx +75 -0
- package/src/components/Text.stories.tsx +52 -2
- package/src/components/Text.test.tsx +35 -3
- package/src/components/Text.tsx +42 -12
- package/src/components/XStack.stories.tsx +46 -0
- package/src/components/XStack.test.tsx +13 -0
- package/src/components/XStack.tsx +7 -0
- package/src/components/YStack.stories.tsx +46 -0
- package/src/components/YStack.test.tsx +13 -0
- package/src/components/YStack.tsx +7 -0
- package/src/components/_internal/InputFrame.tsx +50 -0
- package/src/components/_internal/Story.tsx +34 -0
- package/src/components/_internal/StoryItem.tsx +24 -0
- package/src/components/_internal/layout.ts +103 -0
- package/src/components/_internal/useControllableState.ts +25 -0
- package/src/components/form/Checkbox.stories.tsx +67 -0
- package/src/components/form/Checkbox.test.tsx +88 -0
- package/src/components/form/Checkbox.tsx +141 -0
- package/src/components/form/Form.context.ts +91 -0
- package/src/components/form/Form.stories.tsx +152 -0
- package/src/components/form/Form.test.tsx +195 -0
- package/src/components/form/Form.tsx +51 -0
- package/src/components/form/FormCheckbox.tsx +42 -0
- package/src/components/form/FormDescription.tsx +14 -0
- package/src/components/form/FormError.tsx +17 -0
- package/src/components/form/FormField.tsx +82 -0
- package/src/components/form/FormInput.tsx +70 -0
- package/src/components/form/FormInputGroup.tsx +30 -0
- package/src/components/form/FormLabel.tsx +17 -0
- package/src/components/form/FormRadioGroup.tsx +48 -0
- package/src/components/form/FormRoot.tsx +41 -0
- package/src/components/form/FormTextarea.tsx +56 -0
- package/src/components/form/Input.stories.tsx +105 -0
- package/src/components/form/Input.test.tsx +76 -0
- package/src/components/form/Input.tsx +81 -0
- package/src/components/form/InputGroup.context.ts +11 -0
- package/src/components/form/InputGroup.stories.tsx +129 -0
- package/src/components/form/InputGroup.test.tsx +95 -0
- package/src/components/form/InputGroup.tsx +266 -0
- package/src/components/form/RadioGroup.stories.tsx +62 -0
- package/src/components/form/RadioGroup.test.tsx +98 -0
- package/src/components/form/RadioGroup.tsx +151 -0
- package/src/components/form/Textarea.stories.tsx +61 -0
- package/src/components/form/Textarea.test.tsx +35 -0
- package/src/components/form/Textarea.tsx +74 -0
- package/src/entries/card.ts +2 -0
- package/src/entries/checkbox.ts +2 -0
- package/src/entries/flex.ts +2 -0
- package/src/entries/form.ts +13 -0
- package/src/entries/grid.ts +2 -0
- package/src/entries/input-group.ts +8 -0
- package/src/entries/input.ts +2 -0
- package/src/entries/radio-group.ts +5 -0
- package/src/entries/separator.ts +2 -0
- package/src/entries/spinner.ts +2 -0
- package/src/entries/textarea.ts +2 -0
- package/src/entries/theme.ts +7 -0
- package/src/entries/x-stack.ts +2 -0
- package/src/entries/y-stack.ts +2 -0
- package/src/index.ts +13 -0
- package/src/lib/cn.test.ts +6 -0
- package/src/lib/cn.ts +14 -1
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { View } from 'react-native';
|
|
2
|
+
import { type LayoutAlign, type LayoutGap, type LayoutJustify } from './_internal/layout';
|
|
3
|
+
type GridFlow = 'column' | 'column-dense' | 'dense' | 'row' | 'row-dense';
|
|
4
|
+
type GridPlaceContent = 'baseline' | 'stretch' | LayoutJustify;
|
|
5
|
+
type GridTrackCount = 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12;
|
|
6
|
+
export type GridProps = React.ComponentProps<typeof View> & {
|
|
7
|
+
/**
|
|
8
|
+
* Places each item down its cell, like CSS `align-items`. `stretch` and
|
|
9
|
+
* `baseline` place it at the top: give the item `flex-1` to fill the cell.
|
|
10
|
+
*/
|
|
11
|
+
align?: LayoutAlign;
|
|
12
|
+
columns?: GridTrackCount;
|
|
13
|
+
/**
|
|
14
|
+
* Fills rows first (`row`) or columns first (`column`). Items can't span
|
|
15
|
+
* cells on native, so the `dense` flows place them like `row` and `column`.
|
|
16
|
+
*/
|
|
17
|
+
flow?: GridFlow;
|
|
18
|
+
gap?: LayoutGap;
|
|
19
|
+
gapX?: LayoutGap;
|
|
20
|
+
gapY?: LayoutGap;
|
|
21
|
+
/** Distributes the cells along each row, like CSS `justify-content`. */
|
|
22
|
+
justify?: LayoutJustify;
|
|
23
|
+
/** Distributes the rows and the cells, like CSS `place-content`. */
|
|
24
|
+
placeContent?: GridPlaceContent;
|
|
25
|
+
/** Places each item across and down its cell, like CSS `place-items`. */
|
|
26
|
+
placeItems?: LayoutAlign;
|
|
27
|
+
rows?: GridTrackCount;
|
|
28
|
+
};
|
|
29
|
+
/**
|
|
30
|
+
* Lays its children out in equal columns, like `Grid` in @pickle-ui/react.
|
|
31
|
+
* Items fill their cell's width by default and the cells of a row share its
|
|
32
|
+
* height.
|
|
33
|
+
*/
|
|
34
|
+
export declare function Grid({ align, children, className, columns, flow, gap, gapX, gapY, justify, placeContent, placeItems, rows, ...props }: GridProps): import("react").JSX.Element;
|
|
35
|
+
export {};
|
|
36
|
+
//# sourceMappingURL=Grid.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Grid.d.ts","sourceRoot":"","sources":["../../src/components/Grid.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AAGpC,OAAO,EAGL,KAAK,WAAW,EAChB,KAAK,SAAS,EACd,KAAK,aAAa,EACnB,MAAM,oBAAoB,CAAC;AAO5B,KAAK,QAAQ,GAAG,QAAQ,GAAG,cAAc,GAAG,OAAO,GAAG,KAAK,GAAG,WAAW,CAAC;AAC1E,KAAK,gBAAgB,GAAG,UAAU,GAAG,SAAS,GAAG,aAAa,CAAC;AAC/D,KAAK,cAAc,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC;AAqCvE,MAAM,MAAM,SAAS,GAAG,KAAK,CAAC,cAAc,CAAC,OAAO,IAAI,CAAC,GAAG;IAC1D;;;OAGG;IACH,KAAK,CAAC,EAAE,WAAW,CAAC;IACpB,OAAO,CAAC,EAAE,cAAc,CAAC;IACzB;;;OAGG;IACH,IAAI,CAAC,EAAE,QAAQ,CAAC;IAChB,GAAG,CAAC,EAAE,SAAS,CAAC;IAChB,IAAI,CAAC,EAAE,SAAS,CAAC;IACjB,IAAI,CAAC,EAAE,SAAS,CAAC;IACjB,wEAAwE;IACxE,OAAO,CAAC,EAAE,aAAa,CAAC;IACxB,oEAAoE;IACpE,YAAY,CAAC,EAAE,gBAAgB,CAAC;IAChC,yEAAyE;IACzE,UAAU,CAAC,EAAE,WAAW,CAAC;IACzB,IAAI,CAAC,EAAE,cAAc,CAAC;CACvB,CAAC;AAEF;;;;GAIG;AACH,wBAAgB,IAAI,CAAC,EACnB,KAAK,EACL,QAAQ,EACR,SAAS,EACT,OAAO,EACP,IAAY,EACZ,GAAG,EACH,IAAU,EACV,IAAU,EACV,OAAO,EACP,YAAY,EACZ,UAAU,EACV,IAAI,EACJ,GAAG,KAAK,EACT,EAAE,SAAS,+BAyDX"}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { Children, Fragment, isValidElement } from 'react';
|
|
3
|
+
import { View } from 'react-native';
|
|
4
|
+
import { cn } from '../lib/cn';
|
|
5
|
+
import { gapXClasses, gapYClasses, } from './_internal/layout';
|
|
6
|
+
// Cells are columns: `items-*` places an item across the cell's width and
|
|
7
|
+
// `justify-*` down its height. A cell can't stretch an item vertically, so
|
|
8
|
+
// `stretch` and `baseline` place it at the top; give the item `flex-1` to fill
|
|
9
|
+
// its cell's height.
|
|
10
|
+
const horizontalClasses = {
|
|
11
|
+
baseline: 'items-start',
|
|
12
|
+
center: 'items-center',
|
|
13
|
+
end: 'items-end',
|
|
14
|
+
start: 'items-start',
|
|
15
|
+
stretch: 'items-stretch',
|
|
16
|
+
};
|
|
17
|
+
const verticalClasses = {
|
|
18
|
+
baseline: 'justify-start',
|
|
19
|
+
center: 'justify-center',
|
|
20
|
+
end: 'justify-end',
|
|
21
|
+
start: 'justify-start',
|
|
22
|
+
stretch: 'justify-start',
|
|
23
|
+
};
|
|
24
|
+
// Distributes the rows down the grid and the cells along each row, like CSS
|
|
25
|
+
// `align-content` and `justify-content`. Cells share each row's width, so only
|
|
26
|
+
// a grid taller than its rows shows the difference; `stretch` grows the rows
|
|
27
|
+
// into that height instead.
|
|
28
|
+
const contentClasses = {
|
|
29
|
+
around: 'justify-around',
|
|
30
|
+
baseline: 'justify-start',
|
|
31
|
+
between: 'justify-between',
|
|
32
|
+
center: 'justify-center',
|
|
33
|
+
end: 'justify-end',
|
|
34
|
+
evenly: 'justify-evenly',
|
|
35
|
+
start: 'justify-start',
|
|
36
|
+
stretch: 'justify-start',
|
|
37
|
+
};
|
|
38
|
+
/**
|
|
39
|
+
* Lays its children out in equal columns, like `Grid` in @pickle-ui/react.
|
|
40
|
+
* Items fill their cell's width by default and the cells of a row share its
|
|
41
|
+
* height.
|
|
42
|
+
*/
|
|
43
|
+
export function Grid({ align, children, className, columns, flow = 'row', gap, gapX = gap, gapY = gap, justify, placeContent, placeItems, rows, ...props }) {
|
|
44
|
+
const items = flattenChildren(children);
|
|
45
|
+
const byColumn = flow === 'column' || flow === 'column-dense';
|
|
46
|
+
const rowCount = byColumn
|
|
47
|
+
? (rows ?? 1)
|
|
48
|
+
: Math.max(rows ?? 0, Math.ceil(items.length / (columns ?? 1)));
|
|
49
|
+
const columnCount = byColumn
|
|
50
|
+
? Math.max(columns ?? 1, Math.ceil(items.length / rowCount))
|
|
51
|
+
: (columns ?? 1);
|
|
52
|
+
const vertical = placeItems ?? align;
|
|
53
|
+
const distribution = placeContent ?? justify;
|
|
54
|
+
return (_jsx(View, { className: cn(gapY === undefined ? undefined : gapYClasses[gapY], placeContent === undefined ? undefined : contentClasses[placeContent], className), ...props, children: Array.from({ length: rowCount }, (_, row) => (_jsx(View, { className: cn('flex-row', gapX === undefined ? undefined : gapXClasses[gapX], distribution === undefined
|
|
55
|
+
? undefined
|
|
56
|
+
: contentClasses[distribution], placeContent === 'stretch' ? 'grow' : undefined), children: Array.from({ length: columnCount }, (_, column) => (_jsx(View, { className: cn('flex-1', placeItems === undefined
|
|
57
|
+
? undefined
|
|
58
|
+
: horizontalClasses[placeItems], vertical === undefined ? undefined : verticalClasses[vertical]), children: items[byColumn
|
|
59
|
+
? column * rowCount + row
|
|
60
|
+
: row * columnCount + column] }, column))) }, row))) }));
|
|
61
|
+
}
|
|
62
|
+
/** The grid items, with fragments opened up as on the web. */
|
|
63
|
+
function flattenChildren(children) {
|
|
64
|
+
return Children.toArray(children).flatMap((child) => isValidElement(child) && child.type === Fragment
|
|
65
|
+
? flattenChildren(child.props.children)
|
|
66
|
+
: [child]);
|
|
67
|
+
}
|
|
68
|
+
//# sourceMappingURL=Grid.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Grid.js","sourceRoot":"","sources":["../../src/components/Grid.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,cAAc,EAAkB,MAAM,OAAO,CAAC;AAC3E,OAAO,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AAEpC,OAAO,EAAE,EAAE,EAAE,MAAM,WAAW,CAAC;AAC/B,OAAO,EACL,WAAW,EACX,WAAW,GAIZ,MAAM,oBAAoB,CAAC;AAW5B,0EAA0E;AAC1E,2EAA2E;AAC3E,+EAA+E;AAC/E,qBAAqB;AACrB,MAAM,iBAAiB,GAAG;IACxB,QAAQ,EAAE,aAAa;IACvB,MAAM,EAAE,cAAc;IACtB,GAAG,EAAE,WAAW;IAChB,KAAK,EAAE,aAAa;IACpB,OAAO,EAAE,eAAe;CAChB,CAAC;AAEX,MAAM,eAAe,GAAG;IACtB,QAAQ,EAAE,eAAe;IACzB,MAAM,EAAE,gBAAgB;IACxB,GAAG,EAAE,aAAa;IAClB,KAAK,EAAE,eAAe;IACtB,OAAO,EAAE,eAAe;CAChB,CAAC;AAEX,4EAA4E;AAC5E,+EAA+E;AAC/E,6EAA6E;AAC7E,4BAA4B;AAC5B,MAAM,cAAc,GAAG;IACrB,MAAM,EAAE,gBAAgB;IACxB,QAAQ,EAAE,eAAe;IACzB,OAAO,EAAE,iBAAiB;IAC1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CAA2B,KAAK,CAAC,IAAI,KAAK,CAAC,IAAI,KAAK,QAAQ;QACxE,CAAC,CAAC,eAAe,CAAC,KAAK,CAAC,KAAK,CAAC,QAAQ,CAAC;QACvC,CAAC,CAAC,CAAC,KAAK,CAAC,CACZ,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { View } from 'react-native';
|
|
2
|
+
export type SeparatorProps = React.ComponentProps<typeof View> & {
|
|
3
|
+
orientation?: 'horizontal' | 'vertical';
|
|
4
|
+
};
|
|
5
|
+
/**
|
|
6
|
+
* A 1px rule in the border color, like `Separator` in @pickle-ui/react. Its
|
|
7
|
+
* `separator` role reaches screen readers on the web; iOS and Android have no
|
|
8
|
+
* separator trait, so they skip it like any non-focusable view.
|
|
9
|
+
*/
|
|
10
|
+
export declare function Separator({ className, orientation, ...props }: SeparatorProps): import("react").JSX.Element;
|
|
11
|
+
//# sourceMappingURL=Separator.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Separator.d.ts","sourceRoot":"","sources":["../../src/components/Separator.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AAIpC,MAAM,MAAM,cAAc,GAAG,KAAK,CAAC,cAAc,CAAC,OAAO,IAAI,CAAC,GAAG;IAC/D,WAAW,CAAC,EAAE,YAAY,GAAG,UAAU,CAAC;CACzC,CAAC;AAEF;;;;GAIG;AACH,wBAAgB,SAAS,CAAC,EACxB,SAAS,EACT,WAA0B,EAC1B,GAAG,KAAK,EACT,EAAE,cAAc,+BAYhB"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { View } from 'react-native';
|
|
3
|
+
import { cn } from '../lib/cn';
|
|
4
|
+
/**
|
|
5
|
+
* A 1px rule in the border color, like `Separator` in @pickle-ui/react. Its
|
|
6
|
+
* `separator` role reaches screen readers on the web; iOS and Android have no
|
|
7
|
+
* separator trait, so they skip it like any non-focusable view.
|
|
8
|
+
*/
|
|
9
|
+
export function Separator({ className, orientation = 'horizontal', ...props }) {
|
|
10
|
+
return (_jsx(View, { className: cn('bg-border shrink-0', orientation === 'horizontal' ? 'h-px w-full' : 'w-px self-stretch', className), role: "separator", ...props }));
|
|
11
|
+
}
|
|
12
|
+
//# sourceMappingURL=Separator.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Separator.js","sourceRoot":"","sources":["../../src/components/Separator.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AAEpC,OAAO,EAAE,EAAE,EAAE,MAAM,WAAW,CAAC;AAM/B;;;;GAIG;AACH,MAAM,UAAU,SAAS,CAAC,EACxB,SAAS,EACT,WAAW,GAAG,YAAY,EAC1B,GAAG,KAAK,EACO;IACf,OAAO,CACL,KAAC,IAAI,IACH,SAAS,EAAE,EAAE,CACX,oBAAoB,EACpB,WAAW,KAAK,YAAY,CAAC,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC,mBAAmB,EAClE,SAAS,CACV,EACD,IAAI,EAAC,WAAW,KACZ,KAAK,GACT,CACH,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { View } from 'react-native';
|
|
2
|
+
export type SpinnerProps = Omit<React.ComponentProps<typeof View>, 'children'> & {
|
|
3
|
+
/** Hides the spinner from screen readers, when visible text already says what is loading. */
|
|
4
|
+
'aria-hidden'?: boolean;
|
|
5
|
+
};
|
|
6
|
+
/**
|
|
7
|
+
* The web `Spinner`'s look on native: a three-quarter ring turning once a
|
|
8
|
+
* second, drawn inside a `size-6` box like the web icon. Size it with
|
|
9
|
+
* `size-*` and color it with `text-*`, as on the web. Announced as "Loading"
|
|
10
|
+
* by default; `accessibilityLabel` replaces the name and `aria-hidden` makes
|
|
11
|
+
* it decorative.
|
|
12
|
+
*/
|
|
13
|
+
export declare function Spinner({ accessibilityLabel, 'aria-hidden': ariaHidden, className, style, ...props }: SpinnerProps): import("react").JSX.Element;
|
|
14
|
+
//# sourceMappingURL=Spinner.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Spinner.d.ts","sourceRoot":"","sources":["../../src/components/Spinner.tsx"],"names":[],"mappings":"AACA,OAAO,EAA8B,IAAI,EAAE,MAAM,cAAc,CAAC;AAKhE,MAAM,MAAM,YAAY,GAAG,IAAI,CAC7B,KAAK,CAAC,cAAc,CAAC,OAAO,IAAI,CAAC,EACjC,UAAU,CACX,GAAG;IACF,6FAA6F;IAC7F,aAAa,CAAC,EAAE,OAAO,CAAC;CACzB,CAAC;AAEF;;;;;;GAMG;AACH,wBAAgB,OAAO,CAAC,EACtB,kBAA8B,EAC9B,aAAa,EAAE,UAAkB,EACjC,SAAS,EACT,KAAK,EACL,GAAG,KAAK,EACT,EAAE,YAAY,+BA+Cd"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useEffect, useState } from 'react';
|
|
3
|
+
import { Animated, Easing, Platform, View } from 'react-native';
|
|
4
|
+
import { useResolveClassNames } from 'uniwind';
|
|
5
|
+
import { cn } from '../lib/cn';
|
|
6
|
+
/**
|
|
7
|
+
* The web `Spinner`'s look on native: a three-quarter ring turning once a
|
|
8
|
+
* second, drawn inside a `size-6` box like the web icon. Size it with
|
|
9
|
+
* `size-*` and color it with `text-*`, as on the web. Announced as "Loading"
|
|
10
|
+
* by default; `accessibilityLabel` replaces the name and `aria-hidden` makes
|
|
11
|
+
* it decorative.
|
|
12
|
+
*/
|
|
13
|
+
export function Spinner({ accessibilityLabel = 'Loading', 'aria-hidden': ariaHidden = false, className, style, ...props }) {
|
|
14
|
+
const [turn] = useState(() => new Animated.Value(0));
|
|
15
|
+
const box = cn('text-foreground size-6', className);
|
|
16
|
+
// React Native has no `currentColor`: the ring reads the `text-*` color, and
|
|
17
|
+
// its stroke follows the box like the icon's (2px at 24px).
|
|
18
|
+
const { color, width } = useResolveClassNames(box);
|
|
19
|
+
const strokeWidth = typeof width === 'number' ? width / 12 : 2;
|
|
20
|
+
useEffect(() => {
|
|
21
|
+
const loop = Animated.loop(Animated.timing(turn, {
|
|
22
|
+
duration: 1000,
|
|
23
|
+
easing: Easing.linear,
|
|
24
|
+
toValue: 1,
|
|
25
|
+
// react-native-web has no native driver and warns when asked for it.
|
|
26
|
+
useNativeDriver: Platform.OS !== 'web',
|
|
27
|
+
}));
|
|
28
|
+
loop.start();
|
|
29
|
+
return () => loop.stop();
|
|
30
|
+
}, [turn]);
|
|
31
|
+
const rotate = turn.interpolate({
|
|
32
|
+
inputRange: [0, 1],
|
|
33
|
+
outputRange: ['0deg', '360deg'],
|
|
34
|
+
});
|
|
35
|
+
return (_jsx(Animated.View, { accessibilityLabel: ariaHidden ? undefined : accessibilityLabel, accessibilityRole: ariaHidden ? undefined : 'progressbar', accessible: !ariaHidden, "aria-hidden": ariaHidden, className: cn('items-center justify-center', box), style: [style, { transform: [{ rotate }] }], ...props, children: _jsx(View, { className: "size-3/4 rounded-full", style: {
|
|
36
|
+
borderColor: typeof color === 'string' ? color : undefined,
|
|
37
|
+
borderTopColor: 'transparent',
|
|
38
|
+
borderWidth: strokeWidth,
|
|
39
|
+
} }) }));
|
|
40
|
+
}
|
|
41
|
+
//# sourceMappingURL=Spinner.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Spinner.js","sourceRoot":"","sources":["../../src/components/Spinner.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAC5C,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AAChE,OAAO,EAAE,oBAAoB,EAAE,MAAM,SAAS,CAAC;AAE/C,OAAO,EAAE,EAAE,EAAE,MAAM,WAA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,EAAE,UAAU,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,kBAAkB,EAC/D,iBAAiB,EAAE,UAAU,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,aAAa,EACzD,UAAU,EAAE,CAAC,UAAU,iBACV,UAAU,EACvB,SAAS,EAAE,EAAE,CAAC,6BAA6B,EAAE,GAAG,CAAC,EACjD,KAAK,EAAE,CAAC,KAAK,EAAE,EAAE,SAAS,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,CAAC,KACvC,KAAK,YAET,KAAC,IAAI,IACH,SAAS,EAAC,uBAAuB,EACjC,KAAK,EAAE;gBACL,WAAW,EAAE,OAAO,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,SAAS;gBAC1D,cAAc,EAAE,aAAa;gBAC7B,WAAW,EAAE,WAAW;aACzB,GACD,GACY,CACjB,CAAC;AACJ,CAAC"}
|
|
@@ -2,9 +2,13 @@ import { type VariantProps } from 'class-variance-authority';
|
|
|
2
2
|
import { Text as NativeText } from 'react-native';
|
|
3
3
|
declare const textVariants: (props?: ({
|
|
4
4
|
tone?: "destructive" | "muted" | "primary" | null | undefined;
|
|
5
|
-
variant?: "body" | "h1" | "h2" | "h3" | "h4" | "
|
|
5
|
+
variant?: "body" | "code" | "h1" | "h2" | "h3" | "h4" | "lead" | "small" | null | undefined;
|
|
6
|
+
weight?: "bold" | "normal" | null | undefined;
|
|
6
7
|
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
7
|
-
export type TextProps = React.ComponentProps<typeof NativeText> & VariantProps<typeof textVariants
|
|
8
|
-
|
|
8
|
+
export type TextProps = React.ComponentProps<typeof NativeText> & VariantProps<typeof textVariants> & {
|
|
9
|
+
/** Cuts the text to one line with an ellipsis. */
|
|
10
|
+
truncate?: boolean;
|
|
11
|
+
};
|
|
12
|
+
export declare function Text({ className, style, tone, truncate, variant, weight, ...props }: TextProps): import("react").JSX.Element;
|
|
9
13
|
export {};
|
|
10
14
|
//# sourceMappingURL=Text.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Text.d.ts","sourceRoot":"","sources":["../../src/components/Text.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAO,KAAK,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAClE,OAAO,EAAE,IAAI,IAAI,UAAU,
|
|
1
|
+
{"version":3,"file":"Text.d.ts","sourceRoot":"","sources":["../../src/components/Text.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAO,KAAK,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAClE,OAAO,EAAE,IAAI,IAAI,UAAU,EAAwB,MAAM,cAAc,CAAC;AAMxE,QAAA,MAAM,YAAY;;;;8EAuBhB,CAAC;AAUH,MAAM,MAAM,SAAS,GAAG,KAAK,CAAC,cAAc,CAAC,OAAO,UAAU,CAAC,GAC7D,YAAY,CAAC,OAAO,YAAY,CAAC,GAAG;IAClC,kDAAkD;IAClD,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB,CAAC;AAEJ,wBAAgB,IAAI,CAAC,EACnB,SAAS,EACT,KAAK,EACL,IAAI,EACJ,QAAQ,EACR,OAAgB,EAChB,MAAM,EACN,GAAG,KAAK,EACT,EAAE,SAAS,+BAYX"}
|
package/dist/components/Text.js
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import { cva } from 'class-variance-authority';
|
|
3
|
-
import { Text as NativeText } from 'react-native';
|
|
3
|
+
import { Text as NativeText, Platform, StyleSheet } from 'react-native';
|
|
4
4
|
import { cn } from '../lib/cn';
|
|
5
|
-
// Same
|
|
5
|
+
// Same variants, tones and weights as `Text` in @pickle-ui/react, sized by the
|
|
6
|
+
// shared type scale (`@pickle-ui/tokens/typography.css`).
|
|
6
7
|
const textVariants = cva('text-foreground', {
|
|
7
8
|
defaultVariants: { variant: 'body' },
|
|
8
9
|
variants: {
|
|
@@ -12,17 +13,28 @@ const textVariants = cva('text-foreground', {
|
|
|
12
13
|
primary: 'text-primary',
|
|
13
14
|
},
|
|
14
15
|
variant: {
|
|
15
|
-
body: 'text-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
16
|
+
body: 'text-body',
|
|
17
|
+
code: 'text-code bg-muted self-start overflow-hidden rounded px-2 py-1',
|
|
18
|
+
h1: 'text-h1 font-semibold tracking-tight',
|
|
19
|
+
h2: 'text-h2 font-semibold tracking-tight',
|
|
20
|
+
h3: 'text-h3 font-semibold',
|
|
21
|
+
h4: 'text-h4 font-medium',
|
|
22
|
+
lead: 'text-lead',
|
|
23
|
+
small: 'text-small',
|
|
24
|
+
},
|
|
25
|
+
weight: {
|
|
26
|
+
bold: 'font-semibold',
|
|
27
|
+
normal: 'font-normal',
|
|
22
28
|
},
|
|
23
29
|
},
|
|
24
30
|
});
|
|
25
|
-
|
|
26
|
-
|
|
31
|
+
const HEADINGS = new Set(['h1', 'h2', 'h3', 'h4']);
|
|
32
|
+
// Uniwind passes `font-mono`'s web font stack through as is, which native
|
|
33
|
+
// fonts don't resolve, so `code` names each platform's monospace font.
|
|
34
|
+
const styles = StyleSheet.create({
|
|
35
|
+
code: { fontFamily: Platform.select({ default: 'monospace', ios: 'Menlo' }) },
|
|
36
|
+
});
|
|
37
|
+
export function Text({ className, style, tone, truncate, variant = 'body', weight, ...props }) {
|
|
38
|
+
return (_jsx(NativeText, { accessibilityRole: variant && HEADINGS.has(variant) ? 'header' : undefined, className: cn(textVariants({ tone, variant, weight }), className), numberOfLines: truncate ? 1 : undefined, style: variant === 'code' ? [styles.code, style] : style, ...props }));
|
|
27
39
|
}
|
|
28
40
|
//# sourceMappingURL=Text.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Text.js","sourceRoot":"","sources":["../../src/components/Text.tsx"],"names":[],"mappings":";AAAA,OAAO,EAA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,EAAE,CAAC,EAAE;CAC9E,CAAC,CAAC;AAQH,MAAM,UAAU,IAAI,CAAC,EACnB,SAAS,EACT,KAAK,EACL,IAAI,EACJ,QAAQ,EACR,OAAO,GAAG,MAAM,EAChB,MAAM,EACN,GAAG,KAAK,EACE;IACV,OAAO,CACL,KAAC,UAAU,IACT,iBAAiB,EACf,OAAO,IAAI,QAAQ,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,SAAS,EAEzD,SAAS,EAAE,EAAE,CAAC,YAAY,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,EAAE,CAAC,EAAE,SAAS,CAAC,EACjE,aAAa,EAAE,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,SAAS,EACvC,KAAK,EAAE,OAAO,KAAK,MAAM,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,KACpD,KAAK,GACT,CACH,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"XStack.d.ts","sourceRoot":"","sources":["../../src/components/XStack.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAQ,KAAK,SAAS,EAAE,MAAM,QAAQ,CAAC;AAE9C,MAAM,MAAM,WAAW,GAAG,IAAI,CAAC,SAAS,EAAE,WAAW,CAAC,CAAC;AAEvD,wBAAgB,MAAM,CAAC,KAAK,EAAE,WAAW,+BAExC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"XStack.js","sourceRoot":"","sources":["../../src/components/XStack.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,IAAI,EAAkB,MAAM,QAAQ,CAAC;AAI9C,MAAM,UAAU,MAAM,CAAC,KAAkB;IACvC,OAAO,KAAC,IAAI,IAAC,SAAS,EAAC,KAAK,KAAK,KAAK,GAAI,CAAC;AAC7C,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"YStack.d.ts","sourceRoot":"","sources":["../../src/components/YStack.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAQ,KAAK,SAAS,EAAE,MAAM,QAAQ,CAAC;AAE9C,MAAM,MAAM,WAAW,GAAG,IAAI,CAAC,SAAS,EAAE,WAAW,CAAC,CAAC;AAEvD,wBAAgB,MAAM,CAAC,KAAK,EAAE,WAAW,+BAExC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"YStack.js","sourceRoot":"","sources":["../../src/components/YStack.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,IAAI,EAAkB,MAAM,QAAQ,CAAC;AAI9C,MAAM,UAAU,MAAM,CAAC,KAAkB;IACvC,OAAO,KAAC,IAAI,IAAC,SAAS,EAAC,QAAQ,KAAK,KAAK,GAAI,CAAC;AAChD,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { View } from 'react-native';
|
|
2
|
+
export type InputFrameProps = React.ComponentProps<typeof View> & {
|
|
3
|
+
disabled?: boolean;
|
|
4
|
+
focused: boolean;
|
|
5
|
+
invalid?: boolean;
|
|
6
|
+
};
|
|
7
|
+
/**
|
|
8
|
+
* The border, background and focus ring the web's `Input`, `Textarea` and
|
|
9
|
+
* `InputGroup` draw around their field. React Native has no `ring`, so a
|
|
10
|
+
* 3pt outline sits outside the border while the field has focus.
|
|
11
|
+
*/
|
|
12
|
+
export declare function InputFrame({ children, className, disabled, focused, invalid, ...props }: InputFrameProps): import("react").JSX.Element;
|
|
13
|
+
//# sourceMappingURL=InputFrame.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"InputFrame.d.ts","sourceRoot":"","sources":["../../../src/components/_internal/InputFrame.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AAIpC,MAAM,MAAM,eAAe,GAAG,KAAK,CAAC,cAAc,CAAC,OAAO,IAAI,CAAC,GAAG;IAChE,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,OAAO,EAAE,OAAO,CAAC;IACjB,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB,CAAC;AAEF;;;;GAIG;AACH,wBAAgB,UAAU,CAAC,EACzB,QAAQ,EACR,SAAS,EACT,QAAQ,EACR,OAAO,EACP,OAAO,EACP,GAAG,KAAK,EACT,EAAE,eAAe,+BA2BjB"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { View } from 'react-native';
|
|
3
|
+
import { cn } from '../../lib/cn';
|
|
4
|
+
/**
|
|
5
|
+
* The border, background and focus ring the web's `Input`, `Textarea` and
|
|
6
|
+
* `InputGroup` draw around their field. React Native has no `ring`, so a
|
|
7
|
+
* 3pt outline sits outside the border while the field has focus.
|
|
8
|
+
*/
|
|
9
|
+
export function InputFrame({ children, className, disabled, focused, invalid, ...props }) {
|
|
10
|
+
return (_jsxs(View, { className: cn('border-input bg-background dark:bg-input/32 w-full flex-row rounded-lg border shadow-xs shadow-black/5', invalid && 'border-destructive/36', focused && (invalid ? 'border-destructive/64' : 'border-ring'), (disabled || focused || invalid) && 'shadow-none', disabled && 'opacity-64', className), ...props, children: [children, focused ? (_jsx(View, { className: cn('absolute -inset-1 rounded-[calc(var(--radius)+3px)] border-[3px]', invalid
|
|
11
|
+
? 'border-destructive/16 dark:border-destructive/24'
|
|
12
|
+
: 'border-ring/24'), pointerEvents: "none" })) : null] }));
|
|
13
|
+
}
|
|
14
|
+
//# sourceMappingURL=InputFrame.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"InputFrame.js","sourceRoot":"","sources":["../../../src/components/_internal/InputFrame.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AAEpC,OAAO,EAAE,EAAE,EAAE,MAAM,cAAc,CAAC;AAQlC;;;;GAIG;AACH,MAAM,UAAU,UAAU,CAAC,EACzB,QAAQ,EACR,SAAS,EACT,QAAQ,EACR,OAAO,EACP,OAAO,EACP,GAAG,KAAK,EACQ;IAChB,OAAO,CACL,MAAC,IAAI,IACH,SAAS,EAAE,EAAE,CACX,wGAAwG,EACxG,OAAO,IAAI,uBAAuB,EAClC,OAAO,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,uBAAuB,CAAC,CAAC,CAAC,aAAa,CAAC,EAC9D,CAAC,QAAQ,IAAI,OAAO,IAAI,OAAO,CAAC,IAAI,aAAa,EACjD,QAAQ,IAAI,YAAY,EACxB,SAAS,CACV,KACG,KAAK,aAER,QAAQ,EACR,OAAO,CAAC,CAAC,CAAC,CACT,KAAC,IAAI,IACH,SAAS,EAAE,EAAE,CACX,kEAAkE,EAClE,OAAO;oBACL,CAAC,CAAC,kDAAkD;oBACpD,CAAC,CAAC,gBAAgB,CACrB,EACD,aAAa,EAAC,MAAM,GACpB,CACH,CAAC,CAAC,CAAC,IAAI,IACH,CACR,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"StoryItem.d.ts","sourceRoot":"","sources":["../../../src/components/_internal/StoryItem.tsx"],"names":[],"mappings":"AAKA,6CAA6C;AAC7C,wBAAgB,SAAS,CAAC,EACxB,QAAQ,EACR,SAAS,GACV,EAAE;IACD,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,+BAWA"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { View } from 'react-native';
|
|
3
|
+
import { cn } from '../../lib/cn';
|
|
4
|
+
import { Text } from '../Text';
|
|
5
|
+
/** A labelled box for the layout stories. */
|
|
6
|
+
export function StoryItem({ children, className, }) {
|
|
7
|
+
return (_jsx(View, { className: cn('border-border bg-muted items-center justify-center rounded-md border px-4 py-3', className), children: _jsx(Text, { children: children }) }));
|
|
8
|
+
}
|
|
9
|
+
//# sourceMappingURL=StoryItem.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"StoryItem.js","sourceRoot":"","sources":["../../../src/components/_internal/StoryItem.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AAEpC,OAAO,EAAE,EAAE,EAAE,MAAM,cAAc,CAAC;AAClC,OAAO,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AAE/B,6CAA6C;AAC7C,MAAM,UAAU,SAAS,CAAC,EACxB,QAAQ,EACR,SAAS,GAIV;IACC,OAAO,CACL,KAAC,IAAI,IACH,SAAS,EAAE,EAAE,CACX,gFAAgF,EAChF,SAAS,CACV,YAED,KAAC,IAAI,cAAE,QAAQ,GAAQ,GAClB,CACR,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
declare const alignClasses: {
|
|
2
|
+
readonly baseline: "items-baseline";
|
|
3
|
+
readonly center: "items-center";
|
|
4
|
+
readonly end: "items-end";
|
|
5
|
+
readonly start: "items-start";
|
|
6
|
+
readonly stretch: "items-stretch";
|
|
7
|
+
};
|
|
8
|
+
declare const gapClasses: {
|
|
9
|
+
readonly 0: "gap-0";
|
|
10
|
+
readonly 0.5: "gap-0.5";
|
|
11
|
+
readonly 1: "gap-1";
|
|
12
|
+
readonly 1.5: "gap-1.5";
|
|
13
|
+
readonly 2: "gap-2";
|
|
14
|
+
readonly 2.5: "gap-2.5";
|
|
15
|
+
readonly 3: "gap-3";
|
|
16
|
+
readonly 3.5: "gap-3.5";
|
|
17
|
+
readonly 4: "gap-4";
|
|
18
|
+
readonly 5: "gap-5";
|
|
19
|
+
readonly 6: "gap-6";
|
|
20
|
+
readonly 8: "gap-8";
|
|
21
|
+
readonly 10: "gap-10";
|
|
22
|
+
readonly 12: "gap-12";
|
|
23
|
+
readonly 16: "gap-16";
|
|
24
|
+
};
|
|
25
|
+
export declare const gapXClasses: {
|
|
26
|
+
readonly 0: "gap-x-0";
|
|
27
|
+
readonly 0.5: "gap-x-0.5";
|
|
28
|
+
readonly 1: "gap-x-1";
|
|
29
|
+
readonly 1.5: "gap-x-1.5";
|
|
30
|
+
readonly 2: "gap-x-2";
|
|
31
|
+
readonly 2.5: "gap-x-2.5";
|
|
32
|
+
readonly 3: "gap-x-3";
|
|
33
|
+
readonly 3.5: "gap-x-3.5";
|
|
34
|
+
readonly 4: "gap-x-4";
|
|
35
|
+
readonly 5: "gap-x-5";
|
|
36
|
+
readonly 6: "gap-x-6";
|
|
37
|
+
readonly 8: "gap-x-8";
|
|
38
|
+
readonly 10: "gap-x-10";
|
|
39
|
+
readonly 12: "gap-x-12";
|
|
40
|
+
readonly 16: "gap-x-16";
|
|
41
|
+
};
|
|
42
|
+
export declare const gapYClasses: {
|
|
43
|
+
readonly 0: "gap-y-0";
|
|
44
|
+
readonly 0.5: "gap-y-0.5";
|
|
45
|
+
readonly 1: "gap-y-1";
|
|
46
|
+
readonly 1.5: "gap-y-1.5";
|
|
47
|
+
readonly 2: "gap-y-2";
|
|
48
|
+
readonly 2.5: "gap-y-2.5";
|
|
49
|
+
readonly 3: "gap-y-3";
|
|
50
|
+
readonly 3.5: "gap-y-3.5";
|
|
51
|
+
readonly 4: "gap-y-4";
|
|
52
|
+
readonly 5: "gap-y-5";
|
|
53
|
+
readonly 6: "gap-y-6";
|
|
54
|
+
readonly 8: "gap-y-8";
|
|
55
|
+
readonly 10: "gap-y-10";
|
|
56
|
+
readonly 12: "gap-y-12";
|
|
57
|
+
readonly 16: "gap-y-16";
|
|
58
|
+
};
|
|
59
|
+
declare const justifyClasses: {
|
|
60
|
+
readonly around: "justify-around";
|
|
61
|
+
readonly between: "justify-between";
|
|
62
|
+
readonly center: "justify-center";
|
|
63
|
+
readonly end: "justify-end";
|
|
64
|
+
readonly evenly: "justify-evenly";
|
|
65
|
+
readonly start: "justify-start";
|
|
66
|
+
};
|
|
67
|
+
export type LayoutAlign = keyof typeof alignClasses;
|
|
68
|
+
export type LayoutGap = keyof typeof gapClasses;
|
|
69
|
+
export type LayoutJustify = keyof typeof justifyClasses;
|
|
70
|
+
export type LayoutStyleProps = {
|
|
71
|
+
align?: LayoutAlign;
|
|
72
|
+
gap?: LayoutGap;
|
|
73
|
+
gapX?: LayoutGap;
|
|
74
|
+
gapY?: LayoutGap;
|
|
75
|
+
justify?: LayoutJustify;
|
|
76
|
+
};
|
|
77
|
+
export declare function getLayoutClasses({ align, gap, gapX, gapY, justify, }: LayoutStyleProps): string;
|
|
78
|
+
export {};
|
|
79
|
+
//# sourceMappingURL=layout.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"layout.d.ts","sourceRoot":"","sources":["../../../src/components/_internal/layout.ts"],"names":[],"mappings":"AAKA,QAAA,MAAM,YAAY;;;;;;CAMR,CAAC;AAEX,QAAA,MAAM,UAAU;;;;;;;;;;;;;;;;CAgBN,CAAC;AAEX,eAAO,MAAM,WAAW;;;;;;;;;;;;;;;;CAgBd,CAAC;AAEX,eAAO,MAAM,WAAW;;;;;;;;;;;;;;;;CAgBd,CAAC;AAEX,QAAA,MAAM,cAAc;;;;;;;CAOV,CAAC;AAEX,MAAM,MAAM,WAAW,GAAG,MAAM,OAAO,YAAY,CAAC;AACpD,MAAM,MAAM,SAAS,GAAG,MAAM,OAAO,UAAU,CAAC;AAChD,MAAM,MAAM,aAAa,GAAG,MAAM,OAAO,cAAc,CAAC;AAExD,MAAM,MAAM,gBAAgB,GAAG;IAC7B,KAAK,CAAC,EAAE,WAAW,CAAC;IACpB,GAAG,CAAC,EAAE,SAAS,CAAC;IAChB,IAAI,CAAC,EAAE,SAAS,CAAC;IACjB,IAAI,CAAC,EAAE,SAAS,CAAC;IACjB,OAAO,CAAC,EAAE,aAAa,CAAC;CACzB,CAAC;AAEF,wBAAgB,gBAAgB,CAAC,EAC/B,KAAK,EACL,GAAG,EACH,IAAI,EACJ,IAAI,EACJ,OAAO,GACR,EAAE,gBAAgB,UAQlB"}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import { cn } from '../../lib/cn';
|
|
2
|
+
// Same props and spacing scale as the layout helper of @pickle-ui/react. Each
|
|
3
|
+
// class is written out in full so Uniwind finds it in the source.
|
|
4
|
+
const alignClasses = {
|
|
5
|
+
baseline: 'items-baseline',
|
|
6
|
+
center: 'items-center',
|
|
7
|
+
end: 'items-end',
|
|
8
|
+
start: 'items-start',
|
|
9
|
+
stretch: 'items-stretch',
|
|
10
|
+
};
|
|
11
|
+
const gapClasses = {
|
|
12
|
+
0: 'gap-0',
|
|
13
|
+
0.5: 'gap-0.5',
|
|
14
|
+
1: 'gap-1',
|
|
15
|
+
1.5: 'gap-1.5',
|
|
16
|
+
2: 'gap-2',
|
|
17
|
+
2.5: 'gap-2.5',
|
|
18
|
+
3: 'gap-3',
|
|
19
|
+
3.5: 'gap-3.5',
|
|
20
|
+
4: 'gap-4',
|
|
21
|
+
5: 'gap-5',
|
|
22
|
+
6: 'gap-6',
|
|
23
|
+
8: 'gap-8',
|
|
24
|
+
10: 'gap-10',
|
|
25
|
+
12: 'gap-12',
|
|
26
|
+
16: 'gap-16',
|
|
27
|
+
};
|
|
28
|
+
export const gapXClasses = {
|
|
29
|
+
0: 'gap-x-0',
|
|
30
|
+
0.5: 'gap-x-0.5',
|
|
31
|
+
1: 'gap-x-1',
|
|
32
|
+
1.5: 'gap-x-1.5',
|
|
33
|
+
2: 'gap-x-2',
|
|
34
|
+
2.5: 'gap-x-2.5',
|
|
35
|
+
3: 'gap-x-3',
|
|
36
|
+
3.5: 'gap-x-3.5',
|
|
37
|
+
4: 'gap-x-4',
|
|
38
|
+
5: 'gap-x-5',
|
|
39
|
+
6: 'gap-x-6',
|
|
40
|
+
8: 'gap-x-8',
|
|
41
|
+
10: 'gap-x-10',
|
|
42
|
+
12: 'gap-x-12',
|
|
43
|
+
16: 'gap-x-16',
|
|
44
|
+
};
|
|
45
|
+
export const gapYClasses = {
|
|
46
|
+
0: 'gap-y-0',
|
|
47
|
+
0.5: 'gap-y-0.5',
|
|
48
|
+
1: 'gap-y-1',
|
|
49
|
+
1.5: 'gap-y-1.5',
|
|
50
|
+
2: 'gap-y-2',
|
|
51
|
+
2.5: 'gap-y-2.5',
|
|
52
|
+
3: 'gap-y-3',
|
|
53
|
+
3.5: 'gap-y-3.5',
|
|
54
|
+
4: 'gap-y-4',
|
|
55
|
+
5: 'gap-y-5',
|
|
56
|
+
6: 'gap-y-6',
|
|
57
|
+
8: 'gap-y-8',
|
|
58
|
+
10: 'gap-y-10',
|
|
59
|
+
12: 'gap-y-12',
|
|
60
|
+
16: 'gap-y-16',
|
|
61
|
+
};
|
|
62
|
+
const justifyClasses = {
|
|
63
|
+
around: 'justify-around',
|
|
64
|
+
between: 'justify-between',
|
|
65
|
+
center: 'justify-center',
|
|
66
|
+
end: 'justify-end',
|
|
67
|
+
evenly: 'justify-evenly',
|
|
68
|
+
start: 'justify-start',
|
|
69
|
+
};
|
|
70
|
+
export function getLayoutClasses({ align, gap, gapX, gapY, justify, }) {
|
|
71
|
+
return cn(align === undefined ? undefined : alignClasses[align], gap === undefined ? undefined : gapClasses[gap], gapX === undefined ? undefined : gapXClasses[gapX], gapY === undefined ? undefined : gapYClasses[gapY], justify === undefined ? undefined : justifyClasses[justify]);
|
|
72
|
+
}
|
|
73
|
+
//# sourceMappingURL=layout.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"layout.js","sourceRoot":"","sources":["../../../src/components/_internal/layout.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,EAAE,MAAM,cAAc,CAAC;AAElC,8EAA8E;AAC9E,kEAAkE;AAElE,MAAM,YAAY,GAAG;IACnB,QAAQ,EAAE,gBAAgB;IAC1B,MAAM,EAAE,cAAc;IACtB,GAAG,EAAE,WAAW;IAChB,KAAK,EAAE,aAAa;IACpB,OAAO,EAAE,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,GAAG;IACrB,MAAM,EAAE,gBAAgB;IACxB,OAAO,EAAE,iBAAiB;IAC1B,MAAM,EAAE,gBAAgB;IACxB,GAAG,EAAE,aAAa;IAClB,MAAM,EAAE,gBAAgB;IACxB,KAAK,EAAE,eAAe;CACd,CAAC;AAcX,MAAM,UAAU,gBAAgB,CAAC,EAC/B,KAAK,EACL,GAAG,EACH,IAAI,EACJ,IAAI,EACJ,OAAO,GACU;IACjB,OAAO,EAAE,CACP,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,YAAY,CAAC,KAAK,CAAC,EACrD,GAAG,KAAK,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,UAAU,CAAC,GAAG,CAAC,EAC/C,IAAI,KAAK,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,WAAW,CAAC,IAAI,CAAC,EAClD,IAAI,KAAK,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,WAAW,CAAC,IAAI,CAAC,EAClD,OAAO,KAAK,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,cAAc,CAAC,OAAO,CAAC,CAC5D,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* State a component owns unless its parent controls it, like Base UI's
|
|
3
|
+
* `checked` / `defaultChecked` / `onCheckedChange` trios: `value` wins when
|
|
4
|
+
* defined, and every change is reported through `onChange`.
|
|
5
|
+
*/
|
|
6
|
+
export declare function useControllableState<T>(value: T | undefined, defaultValue: T, onChange?: (value: T) => void): readonly [T, (next: T) => void];
|
|
7
|
+
//# sourceMappingURL=useControllableState.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useControllableState.d.ts","sourceRoot":"","sources":["../../../src/components/_internal/useControllableState.ts"],"names":[],"mappings":"AAEA;;;;GAIG;AACH,wBAAgB,oBAAoB,CAAC,CAAC,EACpC,KAAK,EAAE,CAAC,GAAG,SAAS,EACpB,YAAY,EAAE,CAAC,EACf,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,CAAC,KAAK,IAAI,uBAMpB,CAAC,WAQX"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { useCallback, useState } from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* State a component owns unless its parent controls it, like Base UI's
|
|
4
|
+
* `checked` / `defaultChecked` / `onCheckedChange` trios: `value` wins when
|
|
5
|
+
* defined, and every change is reported through `onChange`.
|
|
6
|
+
*/
|
|
7
|
+
export function useControllableState(value, defaultValue, onChange) {
|
|
8
|
+
const [uncontrolled, setUncontrolled] = useState(defaultValue);
|
|
9
|
+
const controlled = value !== undefined;
|
|
10
|
+
const setValue = useCallback((next) => {
|
|
11
|
+
if (!controlled)
|
|
12
|
+
setUncontrolled(next);
|
|
13
|
+
onChange?.(next);
|
|
14
|
+
}, [controlled, onChange]);
|
|
15
|
+
return [controlled ? value : uncontrolled, setValue];
|
|
16
|
+
}
|
|
17
|
+
//# sourceMappingURL=useControllableState.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useControllableState.js","sourceRoot":"","sources":["../../../src/components/_internal/useControllableState.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAE9C;;;;GAIG;AACH,MAAM,UAAU,oBAAoB,CAClC,KAAoB,EACpB,YAAe,EACf,QAA6B;IAE7B,MAAM,CAAC,YAAY,EAAE,eAAe,CAAC,GAAG,QAAQ,CAAC,YAAY,CAAC,CAAC;IAC/D,MAAM,UAAU,GAAG,KAAK,KAAK,SAAS,CAAC;IAEvC,MAAM,QAAQ,GAAG,WAAW,CAC1B,CAAC,IAAO,EAAE,EAAE;QACV,IAAI,CAAC,UAAU;YAAE,eAAe,CAAC,IAAI,CAAC,CAAC;QACvC,QAAQ,EAAE,CAAC,IAAI,CAAC,CAAC;IACnB,CAAC,EACD,CAAC,UAAU,EAAE,QAAQ,CAAC,CACvB,CAAC;IAEF,OAAO,CAAC,UAAU,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,YAAY,EAAE,QAAQ,CAAU,CAAC;AAChE,CAAC"}
|