@bailaya/react 1.0.2 → 1.0.4

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 (44) hide show
  1. package/README.md +163 -163
  2. package/package.json +35 -35
  3. package/dist/components/ClassSchedule.d.ts +0 -40
  4. package/dist/components/ClassSchedule.d.ts.map +0 -1
  5. package/dist/components/ClassSchedule.js +0 -64
  6. package/dist/components/ClassScheduleByType.d.ts +0 -42
  7. package/dist/components/ClassScheduleByType.d.ts.map +0 -1
  8. package/dist/components/ClassScheduleByType.js +0 -67
  9. package/dist/components/InstructorList.d.ts +0 -34
  10. package/dist/components/InstructorList.d.ts.map +0 -1
  11. package/dist/components/InstructorList.js +0 -38
  12. package/dist/components/StudioProfileCard.d.ts +0 -47
  13. package/dist/components/StudioProfileCard.d.ts.map +0 -1
  14. package/dist/components/StudioProfileCard.js +0 -58
  15. package/dist/components/UserProfileCard.d.ts +0 -47
  16. package/dist/components/UserProfileCard.d.ts.map +0 -1
  17. package/dist/components/UserProfileCard.js +0 -60
  18. package/dist/components/ui/LoadingIcon.d.ts +0 -3
  19. package/dist/components/ui/LoadingIcon.d.ts.map +0 -1
  20. package/dist/components/ui/LoadingIcon.js +0 -13
  21. package/dist/context/BailayaProvider.d.ts +0 -8
  22. package/dist/context/BailayaProvider.d.ts.map +0 -1
  23. package/dist/context/BailayaProvider.js +0 -51
  24. package/dist/hooks/useClasses.d.ts +0 -15
  25. package/dist/hooks/useClasses.d.ts.map +0 -1
  26. package/dist/hooks/useClasses.js +0 -25
  27. package/dist/hooks/useClassesByType.d.ts +0 -16
  28. package/dist/hooks/useClassesByType.d.ts.map +0 -1
  29. package/dist/hooks/useClassesByType.js +0 -28
  30. package/dist/hooks/useInstructors.d.ts +0 -15
  31. package/dist/hooks/useInstructors.d.ts.map +0 -1
  32. package/dist/hooks/useInstructors.js +0 -23
  33. package/dist/hooks/useStudioProfile.d.ts +0 -10
  34. package/dist/hooks/useStudioProfile.d.ts.map +0 -1
  35. package/dist/hooks/useStudioProfile.js +0 -18
  36. package/dist/hooks/useUserProfile.d.ts +0 -12
  37. package/dist/hooks/useUserProfile.d.ts.map +0 -1
  38. package/dist/hooks/useUserProfile.js +0 -20
  39. package/dist/index.d.ts +0 -29
  40. package/dist/index.d.ts.map +0 -1
  41. package/dist/index.js +0 -56
  42. package/dist/types.d.ts +0 -9
  43. package/dist/types.d.ts.map +0 -1
  44. package/dist/types.js +0 -2
package/README.md CHANGED
@@ -1,163 +1,163 @@
1
- # @bailaya/react
2
-
3
- > A React component library and hooks for the BailaYa public API
4
-
5
- ## Overview
6
-
7
- `@bailaya/react` builds on top of **@bailaya/core** to provide:
8
-
9
- - A **`BailayaProvider`** + **`useBailayaClient`** context
10
- - React Query–powered **hooks** for fetching all core data
11
- - **Components** with sensible Tailwind defaults (and full styling slots)
12
- - Full TypeScript support, including localized text & date formatting
13
-
14
- Whether you need a quick `<StudioProfileCard />` or fine-grained hooks like `useClassesByType()`, this package has you covered.
15
-
16
- ## Features
17
-
18
- - **Context + client** (`BailayaProvider` + `useBailayaClient`)
19
- - **Hooks**
20
- - `useStudioProfile(overrideId?)`
21
- - `useUserProfile(userId)`
22
- - `useInstructors(overrideId?)`
23
- - `useClasses(from?, overrideId?)`
24
- - `useClassesByType(typeName, from?, overrideId?)`
25
- - **Components** (all props overridable)
26
- - `<StudioProfileCard />`
27
- - `<UserProfileCard />`
28
- - `<InstructorList />`
29
- - `<ClassSchedule />`
30
- - `<ClassScheduleByType />`
31
- - **Localization**
32
- - Select description by `locale` prop
33
- - Date formatting via Intl
34
- - Custom text labels
35
-
36
- ## Installation
37
-
38
- ```bash
39
- npm install @bailaya/react @tanstack/react-query
40
- ````
41
-
42
- or with Yarn:
43
-
44
- ```bash
45
- yarn add @bailaya/react @tanstack/react-query
46
- ```
47
-
48
- > **Peer Dependencies**
49
- >
50
- > * `"react": ">=17"`
51
- > * `"react-dom": ">=17"`
52
- > * `"@tanstack/react-query": ">=5"`
53
-
54
- ## Quick Start
55
-
56
- First, wrap your app with both **React Query** and **BailayaProvider**:
57
-
58
- ```tsx
59
- // App.tsx
60
- import React from "react";
61
- import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
62
- import { BailayaProvider } from "@bailaya/react";
63
-
64
- const queryClient = new QueryClient();
65
-
66
- export default function App() {
67
- return (
68
- <QueryClientProvider client={queryClient}>
69
- <BailayaProvider config={{ studioId: "YOUR_STUDIO_ID" }}>
70
- {/* ...your app */}
71
- </BailayaProvider>
72
- </QueryClientProvider>
73
- );
74
- }
75
- ```
76
-
77
- ---
78
-
79
- ### Using a Hook
80
-
81
- ```tsx
82
- import React from "react";
83
- import { useInstructors } from "@bailaya/react";
84
-
85
- export function TeamSection() {
86
- const { data: instructors, isLoading, error } = useInstructors();
87
-
88
- if (isLoading) return <p>Loading...</p>;
89
- if (error) return <p>Error: {error.message}</p>;
90
-
91
- return (
92
- <ul>
93
- {instructors.map((i) => (
94
- <li key={i.id}>{i.name} {i.lastname}</li>
95
- ))}
96
- </ul>
97
- );
98
- }
99
- ```
100
-
101
- ---
102
-
103
- ### Using a Component
104
-
105
- ```tsx
106
- import React from "react";
107
- import { StudioProfileCard } from "@bailaya/react";
108
-
109
- export function Dashboard() {
110
- return (
111
- <div className="max-w-md mx-auto">
112
- <StudioProfileCard
113
- locale="en"
114
- className="bg-white rounded-lg shadow p-6"
115
- />
116
- </div>
117
- );
118
- }
119
- ```
120
-
121
- ---
122
-
123
- ## API Reference
124
-
125
- ### `<BailayaProvider config>`
126
-
127
- Provides `useBailayaClient()` context.
128
-
129
- * `config.baseUrl?: string` – override default API URL
130
- * `config.studioId?: string` – default studio ID
131
-
132
- ### Hooks
133
-
134
- | Hook | Description |
135
- |--------------------------------------------------| -------------------------------------------------------------------- |
136
- | `useStudioProfile(overrideId?)` | Fetch & parse a studio’s profile. |
137
- | `useUserProfile(userId)` | Fetch & parse a user’s profile / bio. |
138
- | `useInstructors(overrideId?)` | Fetch & parse list of active instructors (owner, admin, instructor). |
139
- | `useClasses(from?, overrideId?)` | Fetch & parse next 7 days of classes (all types). |
140
- | `useClassesByType(typeName, from?, overrideId?)` | Fetch & parse next 7 days of classes filtered by `typeName`. |
141
-
142
- Each returns a **`UseQueryResult<..., Error>`**.
143
-
144
- ### Components
145
-
146
- All components share:
147
-
148
- * **Override props** for every styling slot
149
- * **`locale`** (where relevant)
150
- * **`labels`** object for custom text (e.g. instructor or business-hours labels)
151
- * **`renderItem`** for full JSX override
152
-
153
- | Component | Props |
154
- | ------------------------- | --------------------------------------------------------------------------------------------------------------------------------- |
155
- | `<StudioProfileCard />` | `overrideId?`, `locale?`, `labels?`, `className?`, `nameClassName?`, `descriptionClassName?`, `labelClassName?`, `renderProfile?` |
156
- | `<UserProfileCard />` | `userId`, `locale?`, `labels?`, `className?`, `nameClassName?`, `bioClassName?`, `renderProfile?` |
157
- | `<InstructorList />` | `overrideId?`, `renderItem?`, plus styling slots: `className?`, `itemClassName?`, `imageWrapperClassName?`, etc. |
158
- | `<ClassSchedule />` | `from?`, `overrideId?`, `locale?`, `labels?`, `renderItem?`, plus slots: `className?`, `itemClassName?`, etc. |
159
- | `<ClassScheduleByType />` | `typeName`, `from?`, `overrideId?`, `locale?`, `labels?`, `renderItem?`, plus same styling slots as `<ClassSchedule />`. |
160
-
161
- ## License
162
-
163
- ISC
1
+ # @bailaya/react
2
+
3
+ > A React component library and hooks for the BailaYa public API
4
+
5
+ ## Overview
6
+
7
+ `@bailaya/react` builds on top of **@bailaya/core** to provide:
8
+
9
+ - A **`BailayaProvider`** + **`useBailayaClient`** context
10
+ - React Query–powered **hooks** for fetching all core data
11
+ - **Components** with sensible Tailwind defaults (and full styling slots)
12
+ - Full TypeScript support, including localized text & date formatting
13
+
14
+ Whether you need a quick `<StudioProfileCard />` or fine-grained hooks like `useClassesByType()`, this package has you covered.
15
+
16
+ ## Features
17
+
18
+ - **Context + client** (`BailayaProvider` + `useBailayaClient`)
19
+ - **Hooks**
20
+ - `useStudioProfile(overrideId?)`
21
+ - `useUserProfile(userId)`
22
+ - `useInstructors(overrideId?)`
23
+ - `useClasses(from?, overrideId?)`
24
+ - `useClassesByType(typeName, from?, overrideId?)`
25
+ - **Components** (all props overridable)
26
+ - `<StudioProfileCard />`
27
+ - `<UserProfileCard />`
28
+ - `<InstructorList />`
29
+ - `<ClassSchedule />`
30
+ - `<ClassScheduleByType />`
31
+ - **Localization**
32
+ - Select description by `locale` prop
33
+ - Date formatting via Intl
34
+ - Custom text labels
35
+
36
+ ## Installation
37
+
38
+ ```bash
39
+ npm install @bailaya/react @tanstack/react-query
40
+ ````
41
+
42
+ or with Yarn:
43
+
44
+ ```bash
45
+ yarn add @bailaya/react @tanstack/react-query
46
+ ```
47
+
48
+ > **Peer Dependencies**
49
+ >
50
+ > * `"react": ">=17"`
51
+ > * `"react-dom": ">=17"`
52
+ > * `"@tanstack/react-query": ">=5"`
53
+
54
+ ## Quick Start
55
+
56
+ First, wrap your app with both **React Query** and **BailayaProvider**:
57
+
58
+ ```tsx
59
+ // App.tsx
60
+ import React from "react";
61
+ import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
62
+ import { BailayaProvider } from "@bailaya/react";
63
+
64
+ const queryClient = new QueryClient();
65
+
66
+ export default function App() {
67
+ return (
68
+ <QueryClientProvider client={queryClient}>
69
+ <BailayaProvider config={{ studioId: "YOUR_STUDIO_ID" }}>
70
+ {/* ...your app */}
71
+ </BailayaProvider>
72
+ </QueryClientProvider>
73
+ );
74
+ }
75
+ ```
76
+
77
+ ---
78
+
79
+ ### Using a Hook
80
+
81
+ ```tsx
82
+ import React from "react";
83
+ import { useInstructors } from "@bailaya/react";
84
+
85
+ export function TeamSection() {
86
+ const { data: instructors, isLoading, error } = useInstructors();
87
+
88
+ if (isLoading) return <p>Loading...</p>;
89
+ if (error) return <p>Error: {error.message}</p>;
90
+
91
+ return (
92
+ <ul>
93
+ {instructors.map((i) => (
94
+ <li key={i.id}>{i.name} {i.lastname}</li>
95
+ ))}
96
+ </ul>
97
+ );
98
+ }
99
+ ```
100
+
101
+ ---
102
+
103
+ ### Using a Component
104
+
105
+ ```tsx
106
+ import React from "react";
107
+ import { StudioProfileCard } from "@bailaya/react";
108
+
109
+ export function Dashboard() {
110
+ return (
111
+ <div className="max-w-md mx-auto">
112
+ <StudioProfileCard
113
+ locale="en"
114
+ className="bg-white rounded-lg shadow p-6"
115
+ />
116
+ </div>
117
+ );
118
+ }
119
+ ```
120
+
121
+ ---
122
+
123
+ ## API Reference
124
+
125
+ ### `<BailayaProvider config>`
126
+
127
+ Provides `useBailayaClient()` context.
128
+
129
+ * `config.baseUrl?: string` – override default API URL
130
+ * `config.studioId?: string` – default studio ID
131
+
132
+ ### Hooks
133
+
134
+ | Hook | Description |
135
+ |--------------------------------------------------| -------------------------------------------------------------------- |
136
+ | `useStudioProfile(overrideId?)` | Fetch & parse a studio’s profile. |
137
+ | `useUserProfile(userId)` | Fetch & parse a user’s profile / bio. |
138
+ | `useInstructors(overrideId?)` | Fetch & parse list of active instructors (owner, admin, instructor). |
139
+ | `useClasses(from?, overrideId?)` | Fetch & parse next 7 days of classes (all types). |
140
+ | `useClassesByType(typeName, from?, overrideId?)` | Fetch & parse next 7 days of classes filtered by `typeName`. |
141
+
142
+ Each returns a **`UseQueryResult<..., Error>`**.
143
+
144
+ ### Components
145
+
146
+ All components share:
147
+
148
+ * **Override props** for every styling slot
149
+ * **`locale`** (where relevant)
150
+ * **`labels`** object for custom text (e.g. instructor or business-hours labels)
151
+ * **`renderItem`** for full JSX override
152
+
153
+ | Component | Props |
154
+ | ------------------------- | --------------------------------------------------------------------------------------------------------------------------------- |
155
+ | `<StudioProfileCard />` | `overrideId?`, `locale?`, `labels?`, `className?`, `nameClassName?`, `descriptionClassName?`, `labelClassName?`, `renderProfile?` |
156
+ | `<UserProfileCard />` | `userId`, `locale?`, `labels?`, `className?`, `nameClassName?`, `bioClassName?`, `renderProfile?` |
157
+ | `<InstructorList />` | `overrideId?`, `renderItem?`, plus styling slots: `className?`, `itemClassName?`, `imageWrapperClassName?`, etc. |
158
+ | `<ClassSchedule />` | `from?`, `overrideId?`, `locale?`, `labels?`, `renderItem?`, plus slots: `className?`, `itemClassName?`, etc. |
159
+ | `<ClassScheduleByType />` | `typeName`, `from?`, `overrideId?`, `locale?`, `labels?`, `renderItem?`, plus same styling slots as `<ClassSchedule />`. |
160
+
161
+ ## License
162
+
163
+ ISC
package/package.json CHANGED
@@ -1,35 +1,35 @@
1
- {
2
- "name": "@bailaya/react",
3
- "version": "1.0.2",
4
- "description": "A React component library for the BailaYa public API",
5
- "main": "dist/index.js",
6
- "types": "dist/index.d.ts",
7
- "files": [
8
- "dist"
9
- ],
10
- "scripts": {
11
- "build": "tsc --build",
12
- "test": "jest"
13
- },
14
- "peerDependencies": {
15
- "react": ">=17.0.0 <20.0.0",
16
- "react-dom": ">=17.0.0 <20.0.0",
17
- "@tanstack/react-query": ">=5"
18
- },
19
- "devDependencies": {
20
- "@tanstack/react-query": "^5.84.1",
21
- "@types/jest": "^30.0.0",
22
- "@types/react": "^18.0.0",
23
- "@types/react-dom": "^18.0.0",
24
- "jest": "^30.0.5",
25
- "react": "^18.2.0",
26
- "react-dom": "^18.2.0",
27
- "ts-jest": "^29.4.0",
28
- "typescript": "^5.8.3"
29
- },
30
- "dependencies": {
31
- "@bailaya/core": "^1.0.3",
32
- "lucide-react": "^0.536.0"
33
- },
34
- "license": "ISC"
35
- }
1
+ {
2
+ "name": "@bailaya/react",
3
+ "version": "1.0.4",
4
+ "description": "A React component library for the BailaYa public API",
5
+ "main": "dist/index.js",
6
+ "types": "dist/index.d.ts",
7
+ "files": [
8
+ "dist"
9
+ ],
10
+ "scripts": {
11
+ "build": "tsc --build",
12
+ "test": "jest"
13
+ },
14
+ "peerDependencies": {
15
+ "react": ">=17.0.0 <20.0.0",
16
+ "react-dom": ">=17.0.0 <20.0.0",
17
+ "@tanstack/react-query": ">=5"
18
+ },
19
+ "devDependencies": {
20
+ "@tanstack/react-query": "^5.84.1",
21
+ "@types/jest": "^30.0.0",
22
+ "@types/react": "^18.0.0",
23
+ "@types/react-dom": "^18.0.0",
24
+ "jest": "^30.0.5",
25
+ "react": "^18.2.0",
26
+ "react-dom": "^18.2.0",
27
+ "ts-jest": "^29.4.0",
28
+ "typescript": "^5.8.3"
29
+ },
30
+ "dependencies": {
31
+ "@bailaya/core": "^1.0.4",
32
+ "lucide-react": "^0.536.0"
33
+ },
34
+ "license": "ISC"
35
+ }
@@ -1,40 +0,0 @@
1
- import React from 'react';
2
- import type { StudioClass } from '@bailaya/core';
3
- export interface ClassScheduleProps {
4
- /** Optional start date for the 7-day window; defaults to today */
5
- from?: Date;
6
- /** Optional studio ID to override the default configured ID */
7
- overrideId?: string;
8
- /** Locale code for date formatting (e.g. "en", "es"); falls back to browser default */
9
- locale?: string;
10
- /** Custom labels (e.g. for "Instructor:" text) */
11
- labels?: {
12
- /** Label text for the instructor line; defaults to "Instructor:" */
13
- instructor?: string;
14
- };
15
- /** Root container wrapper */
16
- className?: string;
17
- /** Each class "card" wrapper */
18
- itemClassName?: string;
19
- /** Class name element */
20
- nameClassName?: string;
21
- /** Details (date/time) element */
22
- detailsClassName?: string;
23
- /** Instructor line element */
24
- instructorClassName?: string;
25
- /**
26
- * Completely override the default renderItem
27
- */
28
- renderItem?: (cls: StudioClass) => React.ReactNode;
29
- }
30
- /**
31
- * Displays an upcoming-class schedule for a studio:
32
- * • name + level
33
- * • weekday, MM-DD, time
34
- * • optional instructor
35
- *
36
- * Uses sensible Tailwind defaults, but you can override
37
- * every slot via props or replace the layout entirely.
38
- */
39
- export declare const ClassSchedule: React.FC<ClassScheduleProps>;
40
- //# sourceMappingURL=ClassSchedule.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"ClassSchedule.d.ts","sourceRoot":"","sources":["../../src/components/ClassSchedule.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAGjD,MAAM,WAAW,kBAAkB;IACjC,kEAAkE;IAClE,IAAI,CAAC,EAAE,IAAI,CAAA;IACX,+DAA+D;IAC/D,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,uFAAuF;IACvF,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,kDAAkD;IAClD,MAAM,CAAC,EAAE;QACP,oEAAoE;QACpE,UAAU,CAAC,EAAE,MAAM,CAAA;KACpB,CAAA;IACD,6BAA6B;IAC7B,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,gCAAgC;IAChC,aAAa,CAAC,EAAE,MAAM,CAAA;IACtB,yBAAyB;IACzB,aAAa,CAAC,EAAE,MAAM,CAAA;IACtB,kCAAkC;IAClC,gBAAgB,CAAC,EAAE,MAAM,CAAA;IACzB,8BAA8B;IAC9B,mBAAmB,CAAC,EAAE,MAAM,CAAA;IAC5B;;OAEG;IACH,UAAU,CAAC,EAAE,CAAC,GAAG,EAAE,WAAW,KAAK,KAAK,CAAC,SAAS,CAAA;CACnD;AAED;;;;;;;;GAQG;AACH,eAAO,MAAM,aAAa,EAAE,KAAK,CAAC,EAAE,CAAC,kBAAkB,CA4DtD,CAAA"}
@@ -1,64 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.ClassSchedule = void 0;
7
- const react_1 = __importDefault(require("react"));
8
- const useClasses_1 = require("../hooks/useClasses");
9
- const LoadingIcon_1 = require("./ui/LoadingIcon");
10
- /**
11
- * Displays an upcoming-class schedule for a studio:
12
- * • name + level
13
- * • weekday, MM-DD, time
14
- * • optional instructor
15
- *
16
- * Uses sensible Tailwind defaults, but you can override
17
- * every slot via props or replace the layout entirely.
18
- */
19
- const ClassSchedule = ({ from, overrideId, locale, labels = {}, className = 'mt-6 md:mt-12 space-y-4', itemClassName = 'p-4 bg-white rounded-lg shadow', nameClassName = 'font-semibold text-lg', detailsClassName = 'text-sm text-gray-600', instructorClassName = 'text-sm text-gray-800 mt-1', renderItem, }) => {
20
- var _a;
21
- const { data: classes, isLoading, error } = (0, useClasses_1.useClasses)(from, overrideId);
22
- const weekdayFmt = new Intl.DateTimeFormat(locale !== null && locale !== void 0 ? locale : 'en', { weekday: 'long' });
23
- const dateFmt = new Intl.DateTimeFormat(locale !== null && locale !== void 0 ? locale : 'en', { month: 'short', day: 'numeric' });
24
- const instructorLabel = (_a = labels === null || labels === void 0 ? void 0 : labels.instructor) !== null && _a !== void 0 ? _a : 'Instructor:';
25
- if (isLoading) {
26
- return react_1.default.createElement("div", { className: className },
27
- react_1.default.createElement(LoadingIcon_1.LoadingIcon, null));
28
- }
29
- if (error) {
30
- return react_1.default.createElement("div", { className: className }, error.message);
31
- }
32
- return (react_1.default.createElement("ul", { className: className }, classes === null || classes === void 0 ? void 0 : classes.map((cls) => {
33
- const dateObj = cls.date;
34
- const dayName = weekdayFmt.format(dateObj);
35
- const shortDate = dateFmt.format(dateObj);
36
- if (renderItem) {
37
- return react_1.default.createElement("li", { key: cls.id }, renderItem(cls));
38
- }
39
- return (react_1.default.createElement("li", { key: cls.id, className: itemClassName },
40
- react_1.default.createElement("div", null,
41
- react_1.default.createElement("div", { className: nameClassName },
42
- cls.name,
43
- ' ',
44
- react_1.default.createElement("span", { className: "text-sm text-gray-500" },
45
- "(",
46
- cls.level,
47
- ")")),
48
- react_1.default.createElement("div", { className: detailsClassName },
49
- dayName,
50
- ", ",
51
- shortDate,
52
- " \u2014 ",
53
- cls.startTime,
54
- "\u2013",
55
- cls.endTime),
56
- cls.instructor && (react_1.default.createElement("div", { className: instructorClassName },
57
- instructorLabel,
58
- ' ',
59
- react_1.default.createElement("strong", null,
60
- cls.instructor.name,
61
- cls.instructor.lastname ? ` ${cls.instructor.lastname}` : ''))))));
62
- })));
63
- };
64
- exports.ClassSchedule = ClassSchedule;
@@ -1,42 +0,0 @@
1
- import React from 'react';
2
- import type { StudioClass } from '@bailaya/core';
3
- export interface ClassScheduleByTypeProps {
4
- /** The dance type to filter classes by (e.g., "salsa") */
5
- typeName: string;
6
- /** Optional start date for the 7-day window; defaults to today */
7
- from?: Date;
8
- /** Optional studio ID to override the default configured ID */
9
- overrideId?: string;
10
- /** Locale code for date formatting (e.g. "en", "es"); falls back to browser default */
11
- locale?: string;
12
- /** Custom labels (e.g. for "Instructor:" text) */
13
- labels?: {
14
- /** Label text for the instructor line; defaults to "Instructor:" */
15
- instructor?: string;
16
- };
17
- /** Root container wrapper */
18
- className?: string;
19
- /** Each class "card" wrapper */
20
- itemClassName?: string;
21
- /** Class name element */
22
- nameClassName?: string;
23
- /** Details (date/time) element */
24
- detailsClassName?: string;
25
- /** Instructor line element */
26
- instructorClassName?: string;
27
- /**
28
- * Completely override the default render for each item
29
- */
30
- renderItem?: (cls: StudioClass) => React.ReactNode;
31
- }
32
- /**
33
- * Displays a schedule of upcoming classes of a specific dance type:
34
- * • name + level
35
- * • weekday, MM-DD, time
36
- * • optional instructor
37
- *
38
- * Uses sensible Tailwind defaults but you can override
39
- * every slot via props or bypass with renderItem.
40
- */
41
- export declare const ClassScheduleByType: React.FC<ClassScheduleByTypeProps>;
42
- //# sourceMappingURL=ClassScheduleByType.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"ClassScheduleByType.d.ts","sourceRoot":"","sources":["../../src/components/ClassScheduleByType.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAEjD,MAAM,WAAW,wBAAwB;IACvC,0DAA0D;IAC1D,QAAQ,EAAE,MAAM,CAAA;IAEhB,kEAAkE;IAClE,IAAI,CAAC,EAAE,IAAI,CAAA;IAEX,+DAA+D;IAC/D,UAAU,CAAC,EAAE,MAAM,CAAA;IAEnB,uFAAuF;IACvF,MAAM,CAAC,EAAE,MAAM,CAAA;IAEf,kDAAkD;IAClD,MAAM,CAAC,EAAE;QACP,oEAAoE;QACpE,UAAU,CAAC,EAAE,MAAM,CAAA;KACpB,CAAA;IAED,6BAA6B;IAC7B,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,gCAAgC;IAChC,aAAa,CAAC,EAAE,MAAM,CAAA;IACtB,yBAAyB;IACzB,aAAa,CAAC,EAAE,MAAM,CAAA;IACtB,kCAAkC;IAClC,gBAAgB,CAAC,EAAE,MAAM,CAAA;IACzB,8BAA8B;IAC9B,mBAAmB,CAAC,EAAE,MAAM,CAAA;IAE5B;;OAEG;IACH,UAAU,CAAC,EAAE,CAAC,GAAG,EAAE,WAAW,KAAK,KAAK,CAAC,SAAS,CAAA;CACnD;AAED;;;;;;;;GAQG;AACH,eAAO,MAAM,mBAAmB,EAAE,KAAK,CAAC,EAAE,CAAC,wBAAwB,CAkElE,CAAA"}
@@ -1,67 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.ClassScheduleByType = void 0;
7
- const react_1 = __importDefault(require("react"));
8
- const useClassesByType_1 = require("../hooks/useClassesByType");
9
- /**
10
- * Displays a schedule of upcoming classes of a specific dance type:
11
- * • name + level
12
- * • weekday, MM-DD, time
13
- * • optional instructor
14
- *
15
- * Uses sensible Tailwind defaults but you can override
16
- * every slot via props or bypass with renderItem.
17
- */
18
- const ClassScheduleByType = ({ typeName, from, overrideId, locale, labels = {}, className = 'mt-6 md:mt-12 space-y-4', itemClassName = 'p-4 bg-white rounded-lg shadow', nameClassName = 'font-semibold text-lg', detailsClassName = 'text-sm text-gray-600', instructorClassName = 'text-sm text-gray-800 mt-1', renderItem, }) => {
19
- var _a;
20
- const { data: classes, isLoading, error } = (0, useClassesByType_1.useClassesByType)(typeName, from, overrideId);
21
- const weekdayFmt = new Intl.DateTimeFormat(locale !== null && locale !== void 0 ? locale : 'en', { weekday: 'long' });
22
- const dateFmt = new Intl.DateTimeFormat(locale !== null && locale !== void 0 ? locale : 'en', { month: 'short', day: 'numeric' });
23
- const instructorLabel = (_a = labels === null || labels === void 0 ? void 0 : labels.instructor) !== null && _a !== void 0 ? _a : 'Instructor:';
24
- if (isLoading) {
25
- return react_1.default.createElement("div", { className: className },
26
- "Loading ",
27
- typeName,
28
- " classes...");
29
- }
30
- if (error) {
31
- return react_1.default.createElement("div", { className: className },
32
- "Error: ",
33
- error.message);
34
- }
35
- return (react_1.default.createElement("ul", { className: className }, classes === null || classes === void 0 ? void 0 : classes.map((cls) => {
36
- const dateObj = cls.date;
37
- const weekday = weekdayFmt.format(dateObj);
38
- const dateStr = dateFmt.format(dateObj);
39
- if (renderItem) {
40
- return react_1.default.createElement("li", { key: cls.id }, renderItem(cls));
41
- }
42
- return (react_1.default.createElement("li", { key: cls.id, className: itemClassName },
43
- react_1.default.createElement("div", null,
44
- react_1.default.createElement("div", { className: nameClassName },
45
- cls.name,
46
- ' ',
47
- react_1.default.createElement("span", { className: "text-sm text-gray-500" },
48
- "(",
49
- cls.level,
50
- ")")),
51
- react_1.default.createElement("div", { className: detailsClassName },
52
- weekday,
53
- ", ",
54
- dateStr,
55
- " \u2014 ",
56
- cls.startTime,
57
- "\u2013",
58
- cls.endTime),
59
- cls.instructor && (react_1.default.createElement("div", { className: instructorClassName },
60
- instructorLabel,
61
- ' ',
62
- react_1.default.createElement("strong", null,
63
- cls.instructor.name,
64
- cls.instructor.lastname ? ` ${cls.instructor.lastname}` : ''))))));
65
- })));
66
- };
67
- exports.ClassScheduleByType = ClassScheduleByType;
@@ -1,34 +0,0 @@
1
- import React from 'react';
2
- import type { Instructor } from '@bailaya/core';
3
- export interface InstructorListProps {
4
- /** Optional studio ID to override the default configured ID */
5
- overrideId?: string;
6
- /** Root container wrapper */
7
- className?: string;
8
- /** Each instructor "card" wrapper */
9
- itemClassName?: string;
10
- /** Wrapper around the image */
11
- imageWrapperClassName?: string;
12
- /** The `<img>` element itself */
13
- imageClassName?: string;
14
- /** Container for the name + bio */
15
- bodyClassName?: string;
16
- /** Instructor name heading */
17
- nameClassName?: string;
18
- /** Instructor bio paragraph */
19
- bioClassName?: string;
20
- /**
21
- * Optional custom render function for each instructor.
22
- * If provided, will be used instead of the default layout.
23
- */
24
- renderItem?: (instr: Instructor) => React.ReactNode;
25
- }
26
- /**
27
- * Component to display a list of instructors for a studio.
28
- *
29
- * Fetches instructors via `useInstructors` and renders a list of
30
- * "cards." You can override any part of the styling via props
31
- * or completely replace the layout with `renderItem`.
32
- */
33
- export declare const InstructorList: React.FC<InstructorListProps>;
34
- //# sourceMappingURL=InstructorList.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"InstructorList.d.ts","sourceRoot":"","sources":["../../src/components/InstructorList.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAGhD,MAAM,WAAW,mBAAmB;IAClC,+DAA+D;IAC/D,UAAU,CAAC,EAAE,MAAM,CAAC;IAEpB,6BAA6B;IAC7B,SAAS,CAAC,EAAE,MAAM,CAAC;IAEnB,qCAAqC;IACrC,aAAa,CAAC,EAAE,MAAM,CAAC;IAEvB,+BAA+B;IAC/B,qBAAqB,CAAC,EAAE,MAAM,CAAC;IAE/B,iCAAiC;IACjC,cAAc,CAAC,EAAE,MAAM,CAAC;IAExB,mCAAmC;IACnC,aAAa,CAAC,EAAE,MAAM,CAAC;IAEvB,8BAA8B;IAC9B,aAAa,CAAC,EAAE,MAAM,CAAC;IAEvB,+BAA+B;IAC/B,YAAY,CAAC,EAAE,MAAM,CAAC;IAEtB;;;OAGG;IACH,UAAU,CAAC,EAAE,CAAC,KAAK,EAAE,UAAU,KAAK,KAAK,CAAC,SAAS,CAAC;CACrD;AAED;;;;;;GAMG;AACH,eAAO,MAAM,cAAc,EAAE,KAAK,CAAC,EAAE,CAAC,mBAAmB,CAqDxD,CAAC"}