@sigx/lynx-daisyui 0.1.3 → 0.4.0

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 CHANGED
@@ -42,6 +42,115 @@ import { daisyuiPreset } from '@sigx/lynx-daisyui/preset';
42
42
  export default { presets: [daisyuiPreset], /* … */ };
43
43
  ```
44
44
 
45
+ The preset also publishes a `.flex-fill` utility class (long-form
46
+ `flex-grow/shrink/basis: 0` + `display: flex; flexDirection: column`).
47
+ Use it instead of `flex-1` when a Lynx parent's height comes from
48
+ flex rather than an explicit percentage — `flex-1` expands to
49
+ `flex: 1 1 auto`, which sizes to content and collapses the chain.
50
+
51
+ ## Theme switching
52
+
53
+ The stylesheet ships two color themes (`daisy-light`, `daisy-dark`)
54
+ plus style-modifier themes (`daisy-rounded`, `daisy-flat`). Each is a
55
+ CSS class containing scoped `--color-*` / `--radius-*` variables; Lynx
56
+ has `enableCSSInheritance: true` in its layout-pipeline defaults so
57
+ the variables propagate to every descendant of an element with the
58
+ theme class.
59
+
60
+ `<ThemeProvider>` is a small wrapper that applies the active theme
61
+ class to a host view and exposes a controller via `useTheme()`:
62
+
63
+ ```tsx
64
+ import { ThemeProvider, useTheme } from '@sigx/lynx-daisyui';
65
+
66
+ defineApp(() => () => (
67
+ <ThemeProvider initial="daisy-light">
68
+ <App />
69
+ </ThemeProvider>
70
+ ));
71
+
72
+ // Anywhere inside:
73
+ const theme = useTheme();
74
+ theme.toggle(); // daisy-light ↔ daisy-dark
75
+ theme.set('daisy-dark'); // explicit
76
+ theme.name; // 'daisy-light' | 'daisy-dark' | custom string
77
+ ```
78
+
79
+ The provider's host view defaults to flex-fill long-form so it doesn't
80
+ collapse between a flex parent (`<SafeAreaProvider>`) and a flex child
81
+ (`<SafeAreaView>`). Override via `style={…}` if you want a different
82
+ layout role. For multi-class compositions (color + modifier),
83
+ `theme.set('daisy-light daisy-rounded')` works — the class string is
84
+ applied verbatim to the host view.
85
+
86
+ ## Navigation chrome
87
+
88
+ Two daisy-themed components that pair with
89
+ [`@sigx/lynx-navigation`](../lynx-navigation). Both read state via the
90
+ navigation package's hooks (no internal-module imports), so swapping
91
+ in custom designs later is a one-component change.
92
+
93
+ ### `<NavTabBar />`
94
+
95
+ Themed bottom tab bar. Drop it inside `<Tabs>` and it picks up the
96
+ active tab + tab list via `useTabs()`.
97
+
98
+ ```tsx
99
+ import { Tabs } from '@sigx/lynx-navigation';
100
+ import { NavTabBar } from '@sigx/lynx-daisyui';
101
+
102
+ <Tabs initialTab="trips">
103
+ <Tabs.Screen name="trips" label="Trips">…</Tabs.Screen>
104
+ <Tabs.Screen name="map" label="Map">…</Tabs.Screen>
105
+ <NavTabBar />
106
+ </Tabs>
107
+ ```
108
+
109
+ | Prop | Default | Notes |
110
+ |---|---|---|
111
+ | `position` | `'bottom'` | `'top'` flips the separator border to the bottom edge. |
112
+ | `background` | `'base-200'` | `'base-100' / 'base-200' / 'base-300' / 'transparent'`. |
113
+ | `bordered` | `true` | Show a 1px separator on the edge opposite `position`. |
114
+ | `renderTab` | — | `(info, ctx) => JSX` — replace per-tab rendering entirely. |
115
+
116
+ ### `<NavHeader />`
117
+
118
+ Themed header bar. Drop it inside a `<Stack>` (uses the Stack's
119
+ default slot, introduced in `@sigx/lynx-navigation` 1.0) so its
120
+ `useNav()` resolves to the per-stack nav:
121
+
122
+ ```tsx
123
+ import { Stack } from '@sigx/lynx-navigation';
124
+ import { NavHeader } from '@sigx/lynx-daisyui';
125
+
126
+ <Stack initialRoute="tripsHome">
127
+ <NavHeader />
128
+ </Stack>
129
+ ```
130
+
131
+ Reads everything it needs via `useScreenChrome()` — title, header-
132
+ shown, back-button visibility, and the screen's left/right slot fills.
133
+ Renders an ~48dp horizontal bar with the title centred, a "‹ Back"
134
+ button on the left when `canGoBack`, and the right slot flush-right.
135
+
136
+ | Prop | Default | Notes |
137
+ |---|---|---|
138
+ | `background` | `'base-200'` | Same colour tokens as `NavTabBar`. |
139
+ | `bordered` | `true` | Bottom separator line. |
140
+ | `renderBack` | — | `({ pop }) => JSX` — replace the default back button. |
141
+
142
+ For a fully-custom design, build directly on
143
+ `useScreenChrome()` from `@sigx/lynx-navigation` — `NavHeader` is just
144
+ one consumer of that hook.
145
+
146
+ ## Layout primitives
147
+
148
+ Daisy's flex primitives (`Center`, `Col`, `Row`) accept a `flex={n}`
149
+ prop. The preset rewrites that into the long-form `flex-grow/shrink/
150
+ basis: 0` triple, so `flex={1}` actually fills available space instead
151
+ of collapsing to content size — the standard Lynx `flex: 1` shorthand
152
+ expands to `flex: 1 1 auto` which doesn't do what most people expect.
153
+
45
154
  ## Status
46
155
 
47
156
  Initial release — APIs may shift as the Lynx styling story evolves.
package/dist/index.d.ts CHANGED
@@ -1,52 +1,58 @@
1
- export { Button } from './buttons/Button.js';
2
- export type { ButtonProps, ButtonVariant, ButtonSize } from './buttons/Button.js';
3
- export { Card } from './layout/Card.js';
4
- export type { CardProps } from './layout/Card.js';
5
- export { Row } from './layout/Row.js';
6
- export type { RowProps } from './layout/Row.js';
7
- export { Col } from './layout/Col.js';
8
- export type { ColProps } from './layout/Col.js';
9
- export { Center } from './layout/Center.js';
10
- export type { CenterProps } from './layout/Center.js';
11
- export { Spacer } from './layout/Spacer.js';
12
- export type { SpacerProps } from './layout/Spacer.js';
13
- export { ScrollView } from './layout/ScrollView.js';
14
- export type { ScrollViewProps } from './layout/ScrollView.js';
15
- export { Divider } from './layout/Divider.js';
16
- export type { DividerProps } from './layout/Divider.js';
17
- export { Input } from './forms/Input.js';
18
- export type { InputProps, InputSize, InputVariant, InputColor } from './forms/Input.js';
19
- export { Toggle } from './forms/Toggle.js';
20
- export type { ToggleProps, ToggleColor, ToggleSize } from './forms/Toggle.js';
21
- export { Checkbox } from './forms/Checkbox.js';
22
- export type { CheckboxProps, CheckboxColor, CheckboxSize } from './forms/Checkbox.js';
23
- export { Select } from './forms/Select.js';
24
- export type { SelectProps, SelectSize, SelectVariant, SelectColor, SelectOption } from './forms/Select.js';
25
- export { Radio } from './forms/Radio.js';
26
- export type { RadioGroupProps, RadioItemProps, RadioColor, RadioSize } from './forms/Radio.js';
27
- export { Textarea } from './forms/Textarea.js';
28
- export type { TextareaProps, TextareaSize, TextareaVariant, TextareaColor } from './forms/Textarea.js';
29
- export { FormField } from './forms/FormField.js';
30
- export type { FormFieldProps } from './forms/FormField.js';
31
- export { Badge } from './feedback/Badge.js';
32
- export type { BadgeProps, BadgeVariant, BadgeSize } from './feedback/Badge.js';
33
- export { Alert } from './feedback/Alert.js';
34
- export type { AlertProps, AlertVariant } from './feedback/Alert.js';
35
- export { Loading } from './feedback/Loading.js';
36
- export type { LoadingProps, LoadingType, LoadingSize, LoadingColor } from './feedback/Loading.js';
37
- export { Progress } from './feedback/Progress.js';
38
- export type { ProgressProps, ProgressColor } from './feedback/Progress.js';
39
- export { Modal } from './feedback/Modal.js';
40
- export type { ModalProps } from './feedback/Modal.js';
41
- export { Skeleton } from './feedback/Skeleton.js';
42
- export type { SkeletonProps } from './feedback/Skeleton.js';
43
- export { Steps } from './feedback/Steps.js';
44
- export type { StepsProps, StepProps, StepColor } from './feedback/Steps.js';
45
- export { Tabs } from './navigation/Tabs.js';
46
- export type { TabsProps, TabProps } from './navigation/Tabs.js';
47
- export { Avatar } from './data/Avatar.js';
48
- export type { AvatarProps, AvatarSize } from './data/Avatar.js';
49
- export { Text } from './typography/Text.js';
50
- export type { TextProps, TextSize, TextWeight, TextColor } from './typography/Text.js';
51
- export { Heading } from './typography/Heading.js';
52
- export type { HeadingProps, HeadingLevel } from './typography/Heading.js';
1
+ export { Button } from './buttons/Button';
2
+ export type { ButtonProps, ButtonVariant, ButtonSize } from './buttons/Button';
3
+ export { Card } from './layout/Card';
4
+ export type { CardProps } from './layout/Card';
5
+ export { Row } from './layout/Row';
6
+ export type { RowProps } from './layout/Row';
7
+ export { Col } from './layout/Col';
8
+ export type { ColProps } from './layout/Col';
9
+ export { Center } from './layout/Center';
10
+ export type { CenterProps } from './layout/Center';
11
+ export { Spacer } from './layout/Spacer';
12
+ export type { SpacerProps } from './layout/Spacer';
13
+ export { ScrollView } from './layout/ScrollView';
14
+ export type { ScrollViewProps } from './layout/ScrollView';
15
+ export { Divider } from './layout/Divider';
16
+ export type { DividerProps } from './layout/Divider';
17
+ export { Input } from './forms/Input';
18
+ export type { InputProps, InputSize, InputVariant, InputColor } from './forms/Input';
19
+ export { Toggle } from './forms/Toggle';
20
+ export type { ToggleProps, ToggleColor, ToggleSize } from './forms/Toggle';
21
+ export { Checkbox } from './forms/Checkbox';
22
+ export type { CheckboxProps, CheckboxColor, CheckboxSize } from './forms/Checkbox';
23
+ export { Select } from './forms/Select';
24
+ export type { SelectProps, SelectSize, SelectVariant, SelectColor, SelectOption } from './forms/Select';
25
+ export { Radio } from './forms/Radio';
26
+ export type { RadioGroupProps, RadioItemProps, RadioColor, RadioSize } from './forms/Radio';
27
+ export { Textarea } from './forms/Textarea';
28
+ export type { TextareaProps, TextareaSize, TextareaVariant, TextareaColor } from './forms/Textarea';
29
+ export { FormField } from './forms/FormField';
30
+ export type { FormFieldProps } from './forms/FormField';
31
+ export { Badge } from './feedback/Badge';
32
+ export type { BadgeProps, BadgeVariant, BadgeSize } from './feedback/Badge';
33
+ export { Alert } from './feedback/Alert';
34
+ export type { AlertProps, AlertVariant } from './feedback/Alert';
35
+ export { Loading } from './feedback/Loading';
36
+ export type { LoadingProps, LoadingType, LoadingSize, LoadingColor } from './feedback/Loading';
37
+ export { Progress } from './feedback/Progress';
38
+ export type { ProgressProps, ProgressColor } from './feedback/Progress';
39
+ export { Modal } from './feedback/Modal';
40
+ export type { ModalProps } from './feedback/Modal';
41
+ export { Skeleton } from './feedback/Skeleton';
42
+ export type { SkeletonProps } from './feedback/Skeleton';
43
+ export { Steps } from './feedback/Steps';
44
+ export type { StepsProps, StepProps, StepColor } from './feedback/Steps';
45
+ export { Tabs } from './navigation/Tabs';
46
+ export type { TabsProps, TabProps } from './navigation/Tabs';
47
+ export { NavTabBar } from './navigation/NavTabBar';
48
+ export type { NavTabBarProps, NavTabBarPosition, NavTabBarBackground, NavTabRenderContext, } from './navigation/NavTabBar';
49
+ export { NavHeader } from './navigation/NavHeader';
50
+ export type { NavHeaderProps, NavHeaderBackground, } from './navigation/NavHeader';
51
+ export { ThemeProvider, useTheme } from './theme/ThemeProvider';
52
+ export type { DaisyTheme, ThemeController, ThemeProviderProps, } from './theme/ThemeProvider';
53
+ export { Avatar } from './data/Avatar';
54
+ export type { AvatarProps, AvatarSize } from './data/Avatar';
55
+ export { Text } from './typography/Text';
56
+ export type { TextProps, TextSize, TextWeight, TextColor } from './typography/Text';
57
+ export { Heading } from './typography/Heading';
58
+ export type { HeadingProps, HeadingLevel } from './typography/Heading';