@jiwambe/components 0.2.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.
Files changed (179) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +367 -0
  3. package/dist/client.d.ts +40 -0
  4. package/dist/client.d.ts.map +1 -0
  5. package/dist/client.js +46 -0
  6. package/dist/client.js.map +1 -0
  7. package/dist/components/Accordion/Accordion.d.ts +74 -0
  8. package/dist/components/Accordion/Accordion.d.ts.map +1 -0
  9. package/dist/components/Accordion/Accordion.js +297 -0
  10. package/dist/components/Accordion/Accordion.js.map +1 -0
  11. package/dist/components/Box/Box.d.ts +56 -0
  12. package/dist/components/Box/Box.d.ts.map +1 -0
  13. package/dist/components/Box/Box.js +51 -0
  14. package/dist/components/Box/Box.js.map +1 -0
  15. package/dist/components/Breadcrumb/Breadcrumb.d.ts +66 -0
  16. package/dist/components/Breadcrumb/Breadcrumb.d.ts.map +1 -0
  17. package/dist/components/Button/Button.d.ts +54 -0
  18. package/dist/components/Button/Button.d.ts.map +1 -0
  19. package/dist/components/Button/Button.js +92 -0
  20. package/dist/components/Button/Button.js.map +1 -0
  21. package/dist/components/Card/Card.d.ts +54 -0
  22. package/dist/components/Card/Card.d.ts.map +1 -0
  23. package/dist/components/Card/Card.js +98 -0
  24. package/dist/components/Card/Card.js.map +1 -0
  25. package/dist/components/CheckboxGroup/CheckboxGroup.d.ts +61 -0
  26. package/dist/components/CheckboxGroup/CheckboxGroup.d.ts.map +1 -0
  27. package/dist/components/CheckboxGroup/CheckboxGroup.js +205 -0
  28. package/dist/components/CheckboxGroup/CheckboxGroup.js.map +1 -0
  29. package/dist/components/Container/Container.d.ts +72 -0
  30. package/dist/components/Container/Container.d.ts.map +1 -0
  31. package/dist/components/Container/Container.js +69 -0
  32. package/dist/components/Container/Container.js.map +1 -0
  33. package/dist/components/DateInput/DateInput.d.ts +61 -0
  34. package/dist/components/DateInput/DateInput.d.ts.map +1 -0
  35. package/dist/components/DateInput/DateInput.js +234 -0
  36. package/dist/components/DateInput/DateInput.js.map +1 -0
  37. package/dist/components/Divider/Divider.d.ts +44 -0
  38. package/dist/components/Divider/Divider.d.ts.map +1 -0
  39. package/dist/components/Divider/Divider.js +35 -0
  40. package/dist/components/Divider/Divider.js.map +1 -0
  41. package/dist/components/Drawer/Drawer.d.ts +35 -0
  42. package/dist/components/Drawer/Drawer.d.ts.map +1 -0
  43. package/dist/components/Drawer/Drawer.js +37 -0
  44. package/dist/components/Drawer/Drawer.js.map +1 -0
  45. package/dist/components/FAQ/FAQ.d.ts +40 -0
  46. package/dist/components/FAQ/FAQ.d.ts.map +1 -0
  47. package/dist/components/FAQ/FAQ.js +161 -0
  48. package/dist/components/FAQ/FAQ.js.map +1 -0
  49. package/dist/components/Grid/Grid.d.ts +61 -0
  50. package/dist/components/Grid/Grid.d.ts.map +1 -0
  51. package/dist/components/Grid/Grid.js +95 -0
  52. package/dist/components/Grid/Grid.js.map +1 -0
  53. package/dist/components/Icon/Icon.d.ts +21 -0
  54. package/dist/components/Icon/Icon.d.ts.map +1 -0
  55. package/dist/components/Icon/Icon.js +167 -0
  56. package/dist/components/Icon/Icon.js.map +1 -0
  57. package/dist/components/Link/Link.d.ts +49 -0
  58. package/dist/components/Link/Link.d.ts.map +1 -0
  59. package/dist/components/Link/Link.js +70 -0
  60. package/dist/components/Link/Link.js.map +1 -0
  61. package/dist/components/List/List.d.ts +36 -0
  62. package/dist/components/List/List.d.ts.map +1 -0
  63. package/dist/components/List/List.js +42 -0
  64. package/dist/components/List/List.js.map +1 -0
  65. package/dist/components/List/index.d.ts +3 -0
  66. package/dist/components/List/index.d.ts.map +1 -0
  67. package/dist/components/Overlay/Overlay.d.ts +35 -0
  68. package/dist/components/Overlay/Overlay.d.ts.map +1 -0
  69. package/dist/components/Overlay/Overlay.js +51 -0
  70. package/dist/components/Overlay/Overlay.js.map +1 -0
  71. package/dist/components/PhoneInput/PhoneInput.d.ts +55 -0
  72. package/dist/components/PhoneInput/PhoneInput.d.ts.map +1 -0
  73. package/dist/components/PhoneInput/PhoneInput.js +255 -0
  74. package/dist/components/PhoneInput/PhoneInput.js.map +1 -0
  75. package/dist/components/Popover/Popover.d.ts +46 -0
  76. package/dist/components/Popover/Popover.d.ts.map +1 -0
  77. package/dist/components/Popover/Popover.js +57 -0
  78. package/dist/components/Popover/Popover.js.map +1 -0
  79. package/dist/components/ProductImage/ProductImage.d.ts +78 -0
  80. package/dist/components/ProductImage/ProductImage.d.ts.map +1 -0
  81. package/dist/components/ProductImage/ProductImage.js +220 -0
  82. package/dist/components/ProductImage/ProductImage.js.map +1 -0
  83. package/dist/components/RadioGroup/RadioGroup.d.ts +63 -0
  84. package/dist/components/RadioGroup/RadioGroup.d.ts.map +1 -0
  85. package/dist/components/RadioGroup/RadioGroup.js +233 -0
  86. package/dist/components/RadioGroup/RadioGroup.js.map +1 -0
  87. package/dist/components/Section/Section.d.ts +44 -0
  88. package/dist/components/Section/Section.d.ts.map +1 -0
  89. package/dist/components/Section/Section.js +48 -0
  90. package/dist/components/Section/Section.js.map +1 -0
  91. package/dist/components/Select/Select.d.ts +47 -0
  92. package/dist/components/Select/Select.d.ts.map +1 -0
  93. package/dist/components/Select/Select.js +153 -0
  94. package/dist/components/Select/Select.js.map +1 -0
  95. package/dist/components/SelectTab/SelectTab.d.ts +62 -0
  96. package/dist/components/SelectTab/SelectTab.d.ts.map +1 -0
  97. package/dist/components/SelectTab/SelectTab.js +192 -0
  98. package/dist/components/SelectTab/SelectTab.js.map +1 -0
  99. package/dist/components/Skeleton/Skeleton.d.ts +87 -0
  100. package/dist/components/Skeleton/Skeleton.d.ts.map +1 -0
  101. package/dist/components/Skeleton/Skeleton.js +97 -0
  102. package/dist/components/Skeleton/Skeleton.js.map +1 -0
  103. package/dist/components/Skeleton/index.d.ts +3 -0
  104. package/dist/components/Skeleton/index.d.ts.map +1 -0
  105. package/dist/components/Slider/Slider.d.ts +47 -0
  106. package/dist/components/Slider/Slider.d.ts.map +1 -0
  107. package/dist/components/Slider/Slider.js +147 -0
  108. package/dist/components/Slider/Slider.js.map +1 -0
  109. package/dist/components/Stack/Stack.d.ts +145 -0
  110. package/dist/components/Stack/Stack.d.ts.map +1 -0
  111. package/dist/components/Stack/Stack.js +80 -0
  112. package/dist/components/Stack/Stack.js.map +1 -0
  113. package/dist/components/Tab/Tab.d.ts +38 -0
  114. package/dist/components/Tab/Tab.d.ts.map +1 -0
  115. package/dist/components/Tab/Tab.js +146 -0
  116. package/dist/components/Tab/Tab.js.map +1 -0
  117. package/dist/components/TextArea/TextArea.d.ts +32 -0
  118. package/dist/components/TextArea/TextArea.d.ts.map +1 -0
  119. package/dist/components/TextArea/TextArea.js +118 -0
  120. package/dist/components/TextArea/TextArea.js.map +1 -0
  121. package/dist/components/TextInput/TextInput.d.ts +35 -0
  122. package/dist/components/TextInput/TextInput.d.ts.map +1 -0
  123. package/dist/components/TextInput/TextInput.js +128 -0
  124. package/dist/components/TextInput/TextInput.js.map +1 -0
  125. package/dist/components/Toggle/Toggle.d.ts +83 -0
  126. package/dist/components/Toggle/Toggle.d.ts.map +1 -0
  127. package/dist/components/Toggle/Toggle.js +121 -0
  128. package/dist/components/Toggle/Toggle.js.map +1 -0
  129. package/dist/components/Typography/Typography.d.ts +321 -0
  130. package/dist/components/Typography/Typography.d.ts.map +1 -0
  131. package/dist/components/Typography/Typography.js +21 -0
  132. package/dist/components/Typography/Typography.js.map +1 -0
  133. package/dist/components/UploadInput/UploadInput.d.ts +39 -0
  134. package/dist/components/UploadInput/UploadInput.d.ts.map +1 -0
  135. package/dist/components/UploadInput/UploadInput.js +297 -0
  136. package/dist/components/UploadInput/UploadInput.js.map +1 -0
  137. package/dist/components/index.d.ts +65 -0
  138. package/dist/components/index.d.ts.map +1 -0
  139. package/dist/index.d.ts +7 -0
  140. package/dist/index.d.ts.map +1 -0
  141. package/dist/index.js +69 -0
  142. package/dist/index.js.map +1 -0
  143. package/dist/plugin/jiwambe-plugin.d.ts +37 -0
  144. package/dist/plugin/jiwambe-plugin.d.ts.map +1 -0
  145. package/dist/plugin/jiwambe-plugin.js +640 -0
  146. package/dist/plugin/jiwambe-plugin.js.map +1 -0
  147. package/dist/server.d.ts +22 -0
  148. package/dist/server.d.ts.map +1 -0
  149. package/dist/server.js +23 -0
  150. package/dist/server.js.map +1 -0
  151. package/dist/types/index.d.ts +103 -0
  152. package/dist/types/index.d.ts.map +1 -0
  153. package/dist/types/layout.d.ts +138 -0
  154. package/dist/types/layout.d.ts.map +1 -0
  155. package/dist/types/list.d.ts +69 -0
  156. package/dist/types/list.d.ts.map +1 -0
  157. package/dist/types/list.js +9 -0
  158. package/dist/types/list.js.map +1 -0
  159. package/dist/types/skeleton.d.ts +38 -0
  160. package/dist/types/skeleton.d.ts.map +1 -0
  161. package/dist/types/skeleton.js +13 -0
  162. package/dist/types/skeleton.js.map +1 -0
  163. package/dist/types/spacing.d.ts +105 -0
  164. package/dist/types/spacing.d.ts.map +1 -0
  165. package/dist/utils/layoutClasses.d.ts +44 -0
  166. package/dist/utils/layoutClasses.d.ts.map +1 -0
  167. package/dist/utils/layoutClasses.js +88 -0
  168. package/dist/utils/layoutClasses.js.map +1 -0
  169. package/dist/utils/responsive-props.d.ts +60 -0
  170. package/dist/utils/responsive-props.d.ts.map +1 -0
  171. package/dist/utils/responsive-props.js +184 -0
  172. package/dist/utils/responsive-props.js.map +1 -0
  173. package/dist/utils/spacing.d.ts +52 -0
  174. package/dist/utils/spacing.d.ts.map +1 -0
  175. package/dist/utils/spacing.js +625 -0
  176. package/dist/utils/spacing.js.map +1 -0
  177. package/package.json +96 -0
  178. package/tailwind.preset.d.ts +3 -0
  179. package/tailwind.preset.ts +21 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2024 Jiwambe Components
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,367 @@
1
+ # @jiwambe/components
2
+
3
+ A production-ready, accessible React component library built with Tailwind CSS and a semantic token design system. Ships as ESM with full TypeScript support.
4
+
5
+ ## Installation
6
+
7
+ ```bash
8
+ pnpm add @jiwambe/components
9
+ ```
10
+
11
+ ### Peer Dependencies
12
+
13
+ Make sure you have the following installed in your project:
14
+
15
+ ```bash
16
+ pnpm add react react-dom tailwindcss
17
+ ```
18
+
19
+ ### Font Loading
20
+
21
+ The design system uses **Instrument Sans** and **Inter** fonts. Add them to your project (for example via Google Fonts):
22
+
23
+ ```html
24
+ <link rel="preconnect" href="https://fonts.googleapis.com" />
25
+ <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
26
+ <link
27
+ href="https://fonts.googleapis.com/css2?family=Instrument+Sans:wght@400;500;600;700&family=Inter:wght@400;500;600&display=swap"
28
+ rel="stylesheet"
29
+ />
30
+ ```
31
+
32
+ ---
33
+
34
+ ## Setup
35
+
36
+ ### 1. Install
37
+
38
+ ```bash
39
+ pnpm add @jiwambe/components
40
+ ```
41
+
42
+ Peer dependencies: react, react-dom, tailwindcss
43
+
44
+ ### 2. Configure Tailwind
45
+
46
+ In your project's `tailwind.config.ts`, use the Jiwambe preset. The preset includes the plugin (which injects all design token CSS variables) and the safelist (which ensures all spacing utility classes survive purging).
47
+
48
+ ```ts
49
+ import uiPreset from '@jiwambe/components/tailwind.preset';
50
+
51
+ export default {
52
+ presets: [uiPreset],
53
+ content: [
54
+ './src/**/*.{js,ts,jsx,tsx,mdx}',
55
+ // Recommended: prevents spacing classes from being purged
56
+ './node_modules/@jiwambe/components/dist/**/*.js',
57
+ ],
58
+ };
59
+ ```
60
+
61
+ If you need to add your own plugins, extend the preset:
62
+
63
+ ```ts
64
+ export default {
65
+ presets: [uiPreset],
66
+ plugins: [yourOtherPlugin],
67
+ content: [...],
68
+ };
69
+ ```
70
+
71
+ ### 3. Usage
72
+
73
+ ```tsx
74
+ import { Box, Stack, Container, Grid } from '@jiwambe/components';
75
+
76
+ // Spacing tokens match the Jiwambe design token vocabulary:
77
+ <Container>
78
+ <Stack spacing="space-4" mt="space-9" direction="column">
79
+ <Box p="space-4">Fixed padding</Box>
80
+ <Box px="fluid-4-9" py="space-6">Fluid horizontal padding</Box>
81
+ <Box m="auto" px="fluid-4-9">Centered box</Box>
82
+ </Stack>
83
+ </Container>
84
+
85
+ <Grid gap="space-4" p="space-2">
86
+ <Box>Cell 1</Box>
87
+ <Box>Cell 2</Box>
88
+ </Grid>
89
+
90
+ // Container gutters default to fluid-4-9 and can be overridden:
91
+ <Container /> // fluid-4-9 gutters (default)
92
+ <Container px="space-9" /> // custom gutters
93
+ <Container disableGutters /> // no gutters
94
+ ```
95
+
96
+ ### Spacing token reference
97
+
98
+ | Token | CSS variable | Resolved value |
99
+ |---------------|---------------------------|-----------------------------------|
100
+ | space-0 | var(--space-0) | 0rem |
101
+ | space-0-25 | var(--space-0-25) | 0.0625rem |
102
+ | space-1 | var(--space-1) | 0.25rem |
103
+ | space-2 | var(--space-2) | 0.5rem |
104
+ | space-3 | var(--space-3) | 0.75rem |
105
+ | space-4 | var(--space-4) | 1rem |
106
+ | space-5 | var(--space-5) | 1.25rem |
107
+ | space-6 | var(--space-6) | 1.5rem |
108
+ | space-9 | var(--space-9) | 2.25rem |
109
+ | space-12 | var(--space-12) | 3rem |
110
+ | space-16 | var(--space-16) | 4rem |
111
+ | space-18 | var(--space-18) | 4.5rem |
112
+ | space-24 | var(--space-24) | 6rem |
113
+ | space-30 | var(--space-30) | 7.5rem |
114
+ | space-36 | var(--space-36) | 9rem |
115
+ | space-48 | var(--space-48) | 12rem |
116
+ | space-72 | var(--space-72) | 18rem |
117
+ | fluid-1-2 | var(--space-fluid-1-2) | clamp(0.25rem, 0.1706rem + 0.3968vw, 0.5rem) |
118
+ | fluid-2-4 | var(--space-fluid-2-4) | clamp(0.5rem, 0.3413rem + 0.7937vw, 1rem) |
119
+ | fluid-4-5 | var(--space-fluid-4-5) | clamp(1rem, 0.9206rem + 0.3968vw, 1.25rem) |
120
+ | fluid-4-6 | var(--space-fluid-4-6) | clamp(1rem, 0.8413rem + 0.7937vw, 1.5rem) |
121
+ | fluid-4-8 | var(--space-fluid-4-8) | clamp(1rem, 0.6825rem + 1.5873vw, 2rem) |
122
+ | fluid-4-9 | var(--space-fluid-4-9) | clamp(1rem, 0.6825rem + 1.5873vw, 2.25rem) |
123
+ | fluid-5-6 | var(--space-fluid-5-6) | clamp(1.25rem, 1.1706rem + 0.3968vw, 1.5rem) |
124
+ | fluid-6-9 | var(--space-fluid-6-9) | clamp(1.5rem, 1.2619rem + 1.1905vw, 2.25rem) |
125
+ | fluid-8-16 | var(--space-fluid-8-16) | clamp(2rem, 1.3651rem + 3.1746vw, 4rem) |
126
+ | fluid-16-18 | var(--space-fluid-16-18) | clamp(4rem, 3.8413rem + 0.7937vw, 4.5rem) |
127
+ | fluid-30-36 | var(--space-fluid-30-36) | clamp(7.5rem, 7.0238rem + 2.381vw, 9rem) |
128
+ | fluid-48-72 | var(--space-fluid-48-72) | clamp(12rem, 10.0952rem + 9.5238vw, 18rem) |
129
+
130
+ ---
131
+
132
+ ## Components
133
+
134
+ ### Typography
135
+
136
+ Renders text with design-system typographic styles.
137
+
138
+ ```tsx
139
+ <Typography variant="title-xl" as="h1">Big Headline</Typography>
140
+ <Typography variant="text-md">Body copy here.</Typography>
141
+ <Typography variant="form-label" as="label">Email</Typography>
142
+ ```
143
+
144
+ **Props:**
145
+
146
+ | Prop | Type | Default | Description |
147
+ | --- | --- | --- | --- |
148
+ | `variant` | `TypographyVariant` | — | Required. One of `title-sm`, `title-md`, `title-lg`, `title-xl`, `text-xs`, `text-xs-bold`, `text-sm`, `text-sm-bold`, `text-md`, `text-md-bold`, `text-xl`, `form-text`, `form-label`, `btn-small`, `btn-reg`, `link-md`. |
149
+ | `as` | `string` | `"p"` | HTML element to render (`h1`–`h6`, `p`, `span`, `label`). |
150
+ | `className` | `string` | — | Additional CSS classes. |
151
+
152
+ ### Button
153
+
154
+ Interactive button with four variants and two sizes.
155
+
156
+ ```tsx
157
+ <Button variant="primary">Submit</Button>
158
+ <Button variant="secondary" size="small">Cancel</Button>
159
+ <Button variant="ghost" disabled>Disabled</Button>
160
+ ```
161
+
162
+ **Props:**
163
+
164
+ | Prop | Type | Default | Description |
165
+ | --- | --- | --- | --- |
166
+ | `variant` | `"primary" \| "secondary" \| "inverse" \| "ghost"` | — | Required. Visual style. |
167
+ | `size` | `"small" \| "regular"` | `"regular"` | Button size. |
168
+ | `disabled` | `boolean` | `false` | Disables the button. |
169
+
170
+ ### Link
171
+
172
+ Anchor element with variant-based styling.
173
+
174
+ ```tsx
175
+ <Link variant="primary" href="/about">About Us</Link>
176
+ <Link variant="inverse" href="/contact">Contact</Link>
177
+ ```
178
+
179
+ **Props:**
180
+
181
+ | Prop | Type | Default | Description |
182
+ | --- | --- | --- | --- |
183
+ | `variant` | `"primary" \| "secondary" \| "tertiary" \| "inverse"` | `"primary"` | Visual style. |
184
+ | `disabled` | `boolean` | `false` | Prevents navigation and applies disabled styles. |
185
+
186
+ ### Accordion
187
+
188
+ Single-expansion accordion with keyboard navigation.
189
+
190
+ ```tsx
191
+ <Accordion
192
+ items={[
193
+ { title: 'FAQ 1', content: <p>Answer to FAQ 1</p> },
194
+ { title: 'FAQ 2', content: <p>Answer to FAQ 2</p> },
195
+ { title: 'FAQ 3', content: <p>Answer to FAQ 3</p>, disabled: true },
196
+ ]}
197
+ defaultOpenIndex={0}
198
+ />
199
+ ```
200
+
201
+ **Props:**
202
+
203
+ | Prop | Type | Default | Description |
204
+ | --- | --- | --- | --- |
205
+ | `items` | `AccordionItem[]` | — | Required. Array of `{ title, content, disabled? }`. |
206
+ | `defaultOpenIndex` | `number` | — | Initially open item index (uncontrolled). |
207
+ | `value` | `number` | — | Open item index (controlled). |
208
+ | `onChange` | `(index: number) => void` | — | Called when the open item changes (controlled). |
209
+
210
+ ### Tab
211
+
212
+ Horizontal tabs with full ARIA support.
213
+
214
+ ```tsx
215
+ <Tab
216
+ tabs={[
217
+ { label: 'Overview', content: <p>Overview content</p> },
218
+ { label: 'Details', content: <p>Detail content</p> },
219
+ { label: 'Settings', content: <p>Settings content</p>, disabled: true },
220
+ ]}
221
+ defaultActiveIndex={0}
222
+ />
223
+ ```
224
+
225
+ **Props:**
226
+
227
+ | Prop | Type | Default | Description |
228
+ | --- | --- | --- | --- |
229
+ | `tabs` | `TabItem[]` | — | Required. Array of `{ label, content, disabled? }`. |
230
+ | `defaultActiveIndex` | `number` | `0` | Initially active tab (uncontrolled). |
231
+ | `activeIndex` | `number` | — | Active tab index (controlled). |
232
+ | `onTabChange` | `(index: number) => void` | — | Called when the active tab changes (controlled). |
233
+
234
+ ### Grid
235
+
236
+ CSS Grid layout with responsive column counts.
237
+
238
+ ```tsx
239
+ <Grid>
240
+ <div className="col-span-6">Left</div>
241
+ <div className="col-span-6">Right</div>
242
+ </Grid>
243
+ ```
244
+
245
+ **Props:**
246
+
247
+ | Prop | Type | Default | Description |
248
+ | --- | --- | --- | --- |
249
+ | `columns` | `number` | 9 (XS), 12 (SM+) | Override responsive column count. |
250
+ | `gap` | `string` | Fluid token | Override gap (e.g. `"space-4"` or any CSS value). |
251
+
252
+ ### Container
253
+
254
+ Width-constrained content wrapper with responsive padding.
255
+
256
+ ```tsx
257
+ <Container>
258
+ <Grid>
259
+ <div className="col-span-12">Full-width inside container</div>
260
+ </Grid>
261
+ </Container>
262
+ ```
263
+
264
+ **Props:**
265
+
266
+ | Prop | Type | Default | Description |
267
+ | --- | --- | --- | --- |
268
+ | `className` | `string` | — | Additional CSS classes. |
269
+
270
+ ---
271
+
272
+ ## Theming
273
+
274
+ The Jiwambe plugin registers all design tokens as Tailwind utilities. You can override semantic color mappings by passing options to the plugin:
275
+
276
+ ```js
277
+ import jiwambePlugin from '@jiwambe/components/plugin';
278
+
279
+ export default {
280
+ content: [
281
+ './src/**/*.{js,ts,jsx,tsx}',
282
+ './node_modules/@jiwambe/components/dist/**/*.js',
283
+ ],
284
+ plugins: [
285
+ jiwambePlugin({
286
+ colors: {
287
+ 'text-primary': '#005748',
288
+ 'link-primary': '#19AE8A',
289
+ 'fill-action-primary': '#19AE8A',
290
+ 'fill-action-primary-hover': '#109274',
291
+ },
292
+ }),
293
+ ],
294
+ };
295
+ ```
296
+
297
+ ### Available Token Categories
298
+
299
+ | Category | Example Tailwind Class | Description |
300
+ | --- | --- | --- |
301
+ | Text colors | `text-text-primary` | Semantic text color |
302
+ | Link colors | `text-link-primary` | Semantic link color |
303
+ | Fill colors | `bg-fill-action-primary` | Background fills |
304
+ | Border colors | `border-border-light` | Border colors |
305
+ | Icon colors | `text-icon-primary` | Icon colors |
306
+ | Typography | `text-title-lg` | Composite typography styles |
307
+ | Spacing | `p-space-4`, `gap-space-fluid-2-4` | Fixed and fluid spacing |
308
+ | Border radius | `rounded-rad-md` | Border radius |
309
+ | Box shadow | `shadow-elevation-low` | Elevation shadows |
310
+
311
+ ### CSS Custom Properties
312
+
313
+ All tokens are also available as CSS custom properties on `:root`:
314
+
315
+ ```css
316
+ .custom-element {
317
+ color: var(--color-text-primary);
318
+ padding: var(--space-4);
319
+ border-radius: var(--rad-md);
320
+ box-shadow: var(--elevation-low);
321
+ }
322
+ ```
323
+
324
+ ---
325
+
326
+ ## Design Tokens Reference
327
+
328
+ ### Breakpoints
329
+
330
+ | Name | Value |
331
+ | --- | --- |
332
+ | `xs` | 0px |
333
+ | `sm` | 600px |
334
+ | `md` | 800px |
335
+ | `lg` | 940px |
336
+ | `xl` | 1440px |
337
+
338
+ ### Grid
339
+
340
+ | Breakpoint | Columns | Gap |
341
+ | --- | --- | --- |
342
+ | XS (0+) | 9 | `space-2` (8px) |
343
+ | SM+ (600+) | 12 | `space-fluid-2-4` (8–16px) |
344
+
345
+ ### Container
346
+
347
+ | Breakpoint | Behaviour |
348
+ | --- | --- |
349
+ | XS–LG | Horizontal padding `space-fluid-4-9` (16–36px) |
350
+ | XL+ | Max width 83rem (1328px), centred, no padding |
351
+
352
+ ---
353
+
354
+ ## Development
355
+
356
+ ```bash
357
+ # Install dependencies
358
+ pnpm install
359
+
360
+ # Type-check
361
+ pnpm typecheck
362
+
363
+ # Build
364
+ pnpm build
365
+ ```
366
+
367
+ The build output lands in `dist/` as ESM with TypeScript declarations and source maps.
@@ -0,0 +1,40 @@
1
+ export { Button } from './components/Button/Button';
2
+ export type { ButtonProps } from './components/Button/Button';
3
+ export { Accordion, AccordionSpecs } from './components/Accordion/Accordion';
4
+ export type { AccordionProps, AccordionSpecsProps } from './components/Accordion/Accordion';
5
+ export { FAQ } from './components/FAQ/FAQ';
6
+ export type { FAQProps } from './components/FAQ/FAQ';
7
+ export { Tab } from './components/Tab/Tab';
8
+ export type { TabProps } from './components/Tab/Tab';
9
+ export { Overlay } from './components/Overlay/Overlay';
10
+ export type { OverlayProps } from './components/Overlay/Overlay';
11
+ export { Drawer } from './components/Drawer/Drawer';
12
+ export type { DrawerProps, DrawerAnchor } from './components/Drawer/Drawer';
13
+ export { Popover } from './components/Popover/Popover';
14
+ export type { PopoverProps, PopoverAlign } from './components/Popover/Popover';
15
+ export { TextInput } from './components/TextInput/TextInput';
16
+ export type { TextInputProps } from './components/TextInput/TextInput';
17
+ export { TextArea } from './components/TextArea/TextArea';
18
+ export type { TextAreaProps } from './components/TextArea/TextArea';
19
+ export { Select } from './components/Select/Select';
20
+ export type { SelectProps, SelectOption } from './components/Select/Select';
21
+ export { SelectTab } from './components/SelectTab/SelectTab';
22
+ export type { SelectTabProps, SelectTabOption } from './components/SelectTab/SelectTab';
23
+ export { DateInput } from './components/DateInput/DateInput';
24
+ export type { DateInputProps, DateValue } from './components/DateInput/DateInput';
25
+ export { PhoneInput, EAST_AFRICA_COUNTRIES } from './components/PhoneInput/PhoneInput';
26
+ export type { PhoneInputProps, PhoneCountry } from './components/PhoneInput/PhoneInput';
27
+ export { UploadInput } from './components/UploadInput/UploadInput';
28
+ export type { UploadInputProps } from './components/UploadInput/UploadInput';
29
+ export { RadioGroup } from './components/RadioGroup/RadioGroup';
30
+ export type { RadioGroupProps, RadioOption } from './components/RadioGroup/RadioGroup';
31
+ export { CheckboxGroup } from './components/CheckboxGroup/CheckboxGroup';
32
+ export type { CheckboxGroupProps, CheckboxOption } from './components/CheckboxGroup/CheckboxGroup';
33
+ export { Slider } from './components/Slider/Slider';
34
+ export type { SliderProps } from './components/Slider/Slider';
35
+ export { Toggle, ToggleButton } from './components/Toggle/Toggle';
36
+ export type { ToggleProps, ToggleButtonProps, ToggleOption, ToggleSize } from './components/Toggle/Toggle';
37
+ export { ProductImage, ProductImageGallery } from './components/ProductImage/ProductImage';
38
+ export type { ProductImageProps, ProductImageGalleryProps, GalleryImage } from './components/ProductImage/ProductImage';
39
+ export type { ButtonVariant, ButtonSize, AccordionItem, AccordionVariant, AccordionSpecItem, FAQItem, TabItem, } from './types';
40
+ //# sourceMappingURL=client.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,MAAM,EAAE,MAAM,4BAA4B,CAAC;AACpD,YAAY,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AAE9D,OAAO,EAAE,SAAS,EAAE,cAAc,EAAE,MAAM,kCAAkC,CAAC;AAC7E,YAAY,EAAE,cAAc,EAAE,mBAAmB,EAAE,MAAM,kCAAkC,CAAC;AAE5F,OAAO,EAAE,GAAG,EAAE,MAAM,sBAAsB,CAAC;AAC3C,YAAY,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAErD,OAAO,EAAE,GAAG,EAAE,MAAM,sBAAsB,CAAC;AAC3C,YAAY,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAErD,OAAO,EAAE,OAAO,EAAE,MAAM,8BAA8B,CAAC;AACvD,YAAY,EAAE,YAAY,EAAE,MAAM,8BAA8B,CAAC;AAEjE,OAAO,EAAE,MAAM,EAAE,MAAM,4BAA4B,CAAC;AACpD,YAAY,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAE5E,OAAO,EAAE,OAAO,EAAE,MAAM,8BAA8B,CAAC;AACvD,YAAY,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,8BAA8B,CAAC;AAE/E,OAAO,EAAE,SAAS,EAAE,MAAM,kCAAkC,CAAC;AAC7D,YAAY,EAAE,cAAc,EAAE,MAAM,kCAAkC,CAAC;AAEvE,OAAO,EAAE,QAAQ,EAAE,MAAM,gCAAgC,CAAC;AAC1D,YAAY,EAAE,aAAa,EAAE,MAAM,gCAAgC,CAAC;AAEpE,OAAO,EAAE,MAAM,EAAE,MAAM,4BAA4B,CAAC;AACpD,YAAY,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAE5E,OAAO,EAAE,SAAS,EAAE,MAAM,kCAAkC,CAAC;AAC7D,YAAY,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,kCAAkC,CAAC;AAExF,OAAO,EAAE,SAAS,EAAE,MAAM,kCAAkC,CAAC;AAC7D,YAAY,EAAE,cAAc,EAAE,SAAS,EAAE,MAAM,kCAAkC,CAAC;AAElF,OAAO,EAAE,UAAU,EAAE,qBAAqB,EAAE,MAAM,oCAAoC,CAAC;AACvF,YAAY,EAAE,eAAe,EAAE,YAAY,EAAE,MAAM,oCAAoC,CAAC;AAExF,OAAO,EAAE,WAAW,EAAE,MAAM,sCAAsC,CAAC;AACnE,YAAY,EAAE,gBAAgB,EAAE,MAAM,sCAAsC,CAAC;AAE7E,OAAO,EAAE,UAAU,EAAE,MAAM,oCAAoC,CAAC;AAChE,YAAY,EAAE,eAAe,EAAE,WAAW,EAAE,MAAM,oCAAoC,CAAC;AAEvF,OAAO,EAAE,aAAa,EAAE,MAAM,0CAA0C,CAAC;AACzE,YAAY,EAAE,kBAAkB,EAAE,cAAc,EAAE,MAAM,0CAA0C,CAAC;AAEnG,OAAO,EAAE,MAAM,EAAE,MAAM,4BAA4B,CAAC;AACpD,YAAY,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AAE9D,OAAO,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAClE,YAAY,EAAE,WAAW,EAAE,iBAAiB,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,4BAA4B,CAAC;AAE3G,OAAO,EAAE,YAAY,EAAE,mBAAmB,EAAE,MAAM,wCAAwC,CAAC;AAC3F,YAAY,EAAE,iBAAiB,EAAE,wBAAwB,EAAE,YAAY,EAAE,MAAM,wCAAwC,CAAC;AAExH,YAAY,EACV,aAAa,EACb,UAAU,EACV,aAAa,EACb,gBAAgB,EAChB,iBAAiB,EACjB,OAAO,EACP,OAAO,GACR,MAAM,SAAS,CAAC"}
package/dist/client.js ADDED
@@ -0,0 +1,46 @@
1
+ "use client";
2
+ import { Button } from "./components/Button/Button.js";
3
+ import { Accordion, AccordionSpecs } from "./components/Accordion/Accordion.js";
4
+ import { FAQ } from "./components/FAQ/FAQ.js";
5
+ import { Tab } from "./components/Tab/Tab.js";
6
+ import { Overlay } from "./components/Overlay/Overlay.js";
7
+ import { Drawer } from "./components/Drawer/Drawer.js";
8
+ import { Popover } from "./components/Popover/Popover.js";
9
+ import { TextInput } from "./components/TextInput/TextInput.js";
10
+ import { TextArea } from "./components/TextArea/TextArea.js";
11
+ import { Select } from "./components/Select/Select.js";
12
+ import { SelectTab } from "./components/SelectTab/SelectTab.js";
13
+ import { DateInput } from "./components/DateInput/DateInput.js";
14
+ import { EAST_AFRICA_COUNTRIES, PhoneInput } from "./components/PhoneInput/PhoneInput.js";
15
+ import { UploadInput } from "./components/UploadInput/UploadInput.js";
16
+ import { RadioGroup } from "./components/RadioGroup/RadioGroup.js";
17
+ import { CheckboxGroup } from "./components/CheckboxGroup/CheckboxGroup.js";
18
+ import { Slider } from "./components/Slider/Slider.js";
19
+ import { Toggle, ToggleButton } from "./components/Toggle/Toggle.js";
20
+ import { ProductImage, ProductImageGallery } from "./components/ProductImage/ProductImage.js";
21
+ export {
22
+ Accordion,
23
+ AccordionSpecs,
24
+ Button,
25
+ CheckboxGroup,
26
+ DateInput,
27
+ Drawer,
28
+ EAST_AFRICA_COUNTRIES,
29
+ FAQ,
30
+ Overlay,
31
+ PhoneInput,
32
+ Popover,
33
+ ProductImage,
34
+ ProductImageGallery,
35
+ RadioGroup,
36
+ Select,
37
+ SelectTab,
38
+ Slider,
39
+ Tab,
40
+ TextArea,
41
+ TextInput,
42
+ Toggle,
43
+ ToggleButton,
44
+ UploadInput
45
+ };
46
+ //# sourceMappingURL=client.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"client.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -0,0 +1,74 @@
1
+ import { default as React } from 'react';
2
+ import { AccordionItem, AccordionVariant, AccordionSpecItem } from '../../types';
3
+ /**
4
+ * Props for the Accordion component. Each item has title, content, and optional disabled.
5
+ */
6
+ export interface AccordionProps extends Omit<React.HTMLAttributes<HTMLDivElement>, 'onChange'> {
7
+ /**
8
+ * Array of accordion items. Each item: title (string), content (ReactNode), disabled? (boolean).
9
+ * @see AccordionItem
10
+ */
11
+ items: AccordionItem[];
12
+ /**
13
+ * Visual style of the accordion. 'primary' — neutral background, dividers; 'secondary' — filled
14
+ * trigger panels; 'inverse' — for use on dark backgrounds.
15
+ * @default 'primary'
16
+ */
17
+ variant?: AccordionVariant;
18
+ /** Index of the panel open by default (uncontrolled). -1 = none. @default undefined */
19
+ defaultOpenIndex?: number;
20
+ /** Controlled open index. When set, accordion is controlled; use with onChange. @default undefined */
21
+ value?: number;
22
+ /** Called when the open panel changes (controlled). Receives the new index or -1 when closed. @default undefined */
23
+ onChange?: (index: number) => void;
24
+ /** Forwarded ref for the root div. @default undefined */
25
+ ref?: React.Ref<HTMLDivElement>;
26
+ }
27
+ /**
28
+ * Accordion of expandable panels. Renders a list of triggers; each expands to show its
29
+ * content. Use for FAQs, disclosure sections, or any collapsible content. Supports
30
+ * controlled (value/onChange) or uncontrolled (defaultOpenIndex) usage.
31
+ *
32
+ * @example
33
+ * <Accordion items={[{ title: 'Section 1', content: <p>Content here.</p> }]} variant="primary" />
34
+ *
35
+ * @example
36
+ * <Accordion items={faqItems} defaultOpenIndex={0} variant="secondary" />
37
+ */
38
+ export declare function Accordion({ items, variant, defaultOpenIndex, value, onChange, className, style, ref, ...rest }: AccordionProps): import("react/jsx-runtime").JSX.Element;
39
+ /**
40
+ * Props for AccordionSpecs. Each item has title and an array of label-value specs.
41
+ */
42
+ export interface AccordionSpecsProps extends Omit<React.HTMLAttributes<HTMLDivElement>, 'onChange'> {
43
+ /**
44
+ * Array of spec items. Each item: title (string), specs (array of { label, value }), disabled? (boolean).
45
+ * @see AccordionSpecItem
46
+ */
47
+ items: AccordionSpecItem[];
48
+ /**
49
+ * Layout of label-value pairs when expanded. 'vertical' — stacked; 'horizontal' — grid row.
50
+ * @default 'vertical'
51
+ */
52
+ layout?: 'vertical' | 'horizontal';
53
+ /** Index of the panel open by default (uncontrolled). -1 = none. @default undefined */
54
+ defaultOpenIndex?: number;
55
+ /** Controlled open index. Use with onChange. @default undefined */
56
+ value?: number;
57
+ /** Called when the open panel changes. @default undefined */
58
+ onChange?: (index: number) => void;
59
+ /** Forwarded ref for the root div. @default undefined */
60
+ ref?: React.Ref<HTMLDivElement>;
61
+ }
62
+ /**
63
+ * Accordion that displays label-value pairs when expanded. Use for product specs, feature
64
+ * lists, or any key-value content. Same expand/collapse behaviour as Accordion; items
65
+ * use AccordionSpecItem (title + specs array) instead of raw content.
66
+ *
67
+ * @example
68
+ * <AccordionSpecs items={[{ title: 'Engine', specs: [{ label: 'Type', value: '1.2L' }] }]} />
69
+ *
70
+ * @example
71
+ * <AccordionSpecs items={specItems} layout="horizontal" defaultOpenIndex={0} />
72
+ */
73
+ export declare function AccordionSpecs({ items, layout, defaultOpenIndex, value, onChange, className, style, ref, ...rest }: AccordionSpecsProps): import("react/jsx-runtime").JSX.Element;
74
+ //# sourceMappingURL=Accordion.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Accordion.d.ts","sourceRoot":"","sources":["../../../src/components/Accordion/Accordion.tsx"],"names":[],"mappings":"AAEA,OAAO,KAA0D,MAAM,OAAO,CAAC;AAC/E,OAAO,KAAK,EAAE,aAAa,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AA6FtF;;GAEG;AACH,MAAM,WAAW,cAAe,SAAQ,IAAI,CAAC,KAAK,CAAC,cAAc,CAAC,cAAc,CAAC,EAAE,UAAU,CAAC;IAC5F;;;OAGG;IACH,KAAK,EAAE,aAAa,EAAE,CAAC;IACvB;;;;OAIG;IACH,OAAO,CAAC,EAAE,gBAAgB,CAAC;IAC3B,uFAAuF;IACvF,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,sGAAsG;IACtG,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,oHAAoH;IACpH,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACnC,yDAAyD;IACzD,GAAG,CAAC,EAAE,KAAK,CAAC,GAAG,CAAC,cAAc,CAAC,CAAC;CACjC;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,SAAS,CAAC,EAAE,KAAK,EAAE,OAAmB,EAAE,gBAAgB,EAAE,KAAK,EAAE,QAAQ,EAAE,SAAc,EAAE,KAAK,EAAE,GAAG,EAAE,GAAG,IAAI,EAAE,EAAE,cAAc,2CAgH/I;AAMD;;GAEG;AACH,MAAM,WAAW,mBAAoB,SAAQ,IAAI,CAAC,KAAK,CAAC,cAAc,CAAC,cAAc,CAAC,EAAE,UAAU,CAAC;IACjG;;;OAGG;IACH,KAAK,EAAE,iBAAiB,EAAE,CAAC;IAC3B;;;OAGG;IACH,MAAM,CAAC,EAAE,UAAU,GAAG,YAAY,CAAC;IACnC,uFAAuF;IACvF,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,mEAAmE;IACnE,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,6DAA6D;IAC7D,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACnC,yDAAyD;IACzD,GAAG,CAAC,EAAE,KAAK,CAAC,GAAG,CAAC,cAAc,CAAC,CAAC;CACjC;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,cAAc,CAAC,EAAE,KAAK,EAAE,MAAmB,EAAE,gBAAgB,EAAE,KAAK,EAAE,QAAQ,EAAE,SAAc,EAAE,KAAK,EAAE,GAAG,EAAE,GAAG,IAAI,EAAE,EAAE,mBAAmB,2CAsIzJ"}