@fnd-platform/cms 1.0.0-alpha.3 → 1.0.0-alpha.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.
- package/lib/cms-project.d.ts +88 -86
- package/lib/cms-project.d.ts.map +1 -1
- package/lib/cms-project.js +22 -3
- package/lib/cms-project.js.map +1 -1
- package/lib/index.js +5 -10
- package/lib/templates/admin-content-edit-route.d.ts +9 -0
- package/lib/templates/admin-content-edit-route.d.ts.map +1 -0
- package/lib/templates/admin-content-edit-route.js +195 -0
- package/lib/templates/admin-content-edit-route.js.map +1 -0
- package/lib/templates/admin-content-new-route.d.ts +9 -0
- package/lib/templates/admin-content-new-route.d.ts.map +1 -0
- package/lib/templates/admin-content-new-route.js +160 -0
- package/lib/templates/admin-content-new-route.js.map +1 -0
- package/lib/templates/admin-content-type-route.d.ts +2 -2
- package/lib/templates/admin-content-type-route.d.ts.map +1 -1
- package/lib/templates/admin-content-type-route.js +67 -27
- package/lib/templates/admin-content-type-route.js.map +1 -1
- package/lib/templates/content-api.d.ts +9 -0
- package/lib/templates/content-api.d.ts.map +1 -0
- package/lib/templates/content-api.js +195 -0
- package/lib/templates/content-api.js.map +1 -0
- package/lib/templates/index.d.ts +4 -0
- package/lib/templates/index.d.ts.map +1 -1
- package/lib/templates/index.js +11 -1
- package/lib/templates/index.js.map +1 -1
- package/lib/templates/ui-select.d.ts +9 -0
- package/lib/templates/ui-select.d.ts.map +1 -0
- package/lib/templates/ui-select.js +172 -0
- package/lib/templates/ui-select.js.map +1 -0
- package/package.json +13 -13
- package/LICENSE +0 -21
|
@@ -0,0 +1,172 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getSelectTemplate = getSelectTemplate;
|
|
4
|
+
/**
|
|
5
|
+
* Generates the Select UI component template.
|
|
6
|
+
*
|
|
7
|
+
* This component provides a styled select dropdown using Radix UI primitives.
|
|
8
|
+
*
|
|
9
|
+
* @returns Template string for app/components/ui/select.tsx
|
|
10
|
+
*/
|
|
11
|
+
function getSelectTemplate() {
|
|
12
|
+
return `import * as React from 'react';
|
|
13
|
+
import * as SelectPrimitive from '@radix-ui/react-select';
|
|
14
|
+
import { Check, ChevronDown, ChevronUp } from 'lucide-react';
|
|
15
|
+
|
|
16
|
+
import { cn } from '~/lib/utils';
|
|
17
|
+
|
|
18
|
+
const Select = SelectPrimitive.Root;
|
|
19
|
+
|
|
20
|
+
const SelectGroup = SelectPrimitive.Group;
|
|
21
|
+
|
|
22
|
+
const SelectValue = SelectPrimitive.Value;
|
|
23
|
+
|
|
24
|
+
const SelectTrigger = React.forwardRef<
|
|
25
|
+
React.ElementRef<typeof SelectPrimitive.Trigger>,
|
|
26
|
+
React.ComponentPropsWithoutRef<typeof SelectPrimitive.Trigger>
|
|
27
|
+
>(({ className, children, ...props }, ref) => (
|
|
28
|
+
<SelectPrimitive.Trigger
|
|
29
|
+
ref={ref}
|
|
30
|
+
className={cn(
|
|
31
|
+
'flex h-10 w-full items-center justify-between rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1',
|
|
32
|
+
className
|
|
33
|
+
)}
|
|
34
|
+
{...props}
|
|
35
|
+
>
|
|
36
|
+
{children}
|
|
37
|
+
<SelectPrimitive.Icon asChild>
|
|
38
|
+
<ChevronDown className="h-4 w-4 opacity-50" />
|
|
39
|
+
</SelectPrimitive.Icon>
|
|
40
|
+
</SelectPrimitive.Trigger>
|
|
41
|
+
));
|
|
42
|
+
SelectTrigger.displayName = SelectPrimitive.Trigger.displayName;
|
|
43
|
+
|
|
44
|
+
const SelectScrollUpButton = React.forwardRef<
|
|
45
|
+
React.ElementRef<typeof SelectPrimitive.ScrollUpButton>,
|
|
46
|
+
React.ComponentPropsWithoutRef<typeof SelectPrimitive.ScrollUpButton>
|
|
47
|
+
>(({ className, ...props }, ref) => (
|
|
48
|
+
<SelectPrimitive.ScrollUpButton
|
|
49
|
+
ref={ref}
|
|
50
|
+
className={cn(
|
|
51
|
+
'flex cursor-default items-center justify-center py-1',
|
|
52
|
+
className
|
|
53
|
+
)}
|
|
54
|
+
{...props}
|
|
55
|
+
>
|
|
56
|
+
<ChevronUp className="h-4 w-4" />
|
|
57
|
+
</SelectPrimitive.ScrollUpButton>
|
|
58
|
+
));
|
|
59
|
+
SelectScrollUpButton.displayName = SelectPrimitive.ScrollUpButton.displayName;
|
|
60
|
+
|
|
61
|
+
const SelectScrollDownButton = React.forwardRef<
|
|
62
|
+
React.ElementRef<typeof SelectPrimitive.ScrollDownButton>,
|
|
63
|
+
React.ComponentPropsWithoutRef<typeof SelectPrimitive.ScrollDownButton>
|
|
64
|
+
>(({ className, ...props }, ref) => (
|
|
65
|
+
<SelectPrimitive.ScrollDownButton
|
|
66
|
+
ref={ref}
|
|
67
|
+
className={cn(
|
|
68
|
+
'flex cursor-default items-center justify-center py-1',
|
|
69
|
+
className
|
|
70
|
+
)}
|
|
71
|
+
{...props}
|
|
72
|
+
>
|
|
73
|
+
<ChevronDown className="h-4 w-4" />
|
|
74
|
+
</SelectPrimitive.ScrollDownButton>
|
|
75
|
+
));
|
|
76
|
+
SelectScrollDownButton.displayName =
|
|
77
|
+
SelectPrimitive.ScrollDownButton.displayName;
|
|
78
|
+
|
|
79
|
+
const SelectContent = React.forwardRef<
|
|
80
|
+
React.ElementRef<typeof SelectPrimitive.Content>,
|
|
81
|
+
React.ComponentPropsWithoutRef<typeof SelectPrimitive.Content>
|
|
82
|
+
>(({ className, children, position = 'popper', ...props }, ref) => (
|
|
83
|
+
<SelectPrimitive.Portal>
|
|
84
|
+
<SelectPrimitive.Content
|
|
85
|
+
ref={ref}
|
|
86
|
+
className={cn(
|
|
87
|
+
'relative z-50 max-h-96 min-w-[8rem] overflow-hidden rounded-md border bg-popover text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2',
|
|
88
|
+
position === 'popper' &&
|
|
89
|
+
'data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1',
|
|
90
|
+
className
|
|
91
|
+
)}
|
|
92
|
+
position={position}
|
|
93
|
+
{...props}
|
|
94
|
+
>
|
|
95
|
+
<SelectScrollUpButton />
|
|
96
|
+
<SelectPrimitive.Viewport
|
|
97
|
+
className={cn(
|
|
98
|
+
'p-1',
|
|
99
|
+
position === 'popper' &&
|
|
100
|
+
'h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]'
|
|
101
|
+
)}
|
|
102
|
+
>
|
|
103
|
+
{children}
|
|
104
|
+
</SelectPrimitive.Viewport>
|
|
105
|
+
<SelectScrollDownButton />
|
|
106
|
+
</SelectPrimitive.Content>
|
|
107
|
+
</SelectPrimitive.Portal>
|
|
108
|
+
));
|
|
109
|
+
SelectContent.displayName = SelectPrimitive.Content.displayName;
|
|
110
|
+
|
|
111
|
+
const SelectLabel = React.forwardRef<
|
|
112
|
+
React.ElementRef<typeof SelectPrimitive.Label>,
|
|
113
|
+
React.ComponentPropsWithoutRef<typeof SelectPrimitive.Label>
|
|
114
|
+
>(({ className, ...props }, ref) => (
|
|
115
|
+
<SelectPrimitive.Label
|
|
116
|
+
ref={ref}
|
|
117
|
+
className={cn('py-1.5 pl-8 pr-2 text-sm font-semibold', className)}
|
|
118
|
+
{...props}
|
|
119
|
+
/>
|
|
120
|
+
));
|
|
121
|
+
SelectLabel.displayName = SelectPrimitive.Label.displayName;
|
|
122
|
+
|
|
123
|
+
const SelectItem = React.forwardRef<
|
|
124
|
+
React.ElementRef<typeof SelectPrimitive.Item>,
|
|
125
|
+
React.ComponentPropsWithoutRef<typeof SelectPrimitive.Item>
|
|
126
|
+
>(({ className, children, ...props }, ref) => (
|
|
127
|
+
<SelectPrimitive.Item
|
|
128
|
+
ref={ref}
|
|
129
|
+
className={cn(
|
|
130
|
+
'relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50',
|
|
131
|
+
className
|
|
132
|
+
)}
|
|
133
|
+
{...props}
|
|
134
|
+
>
|
|
135
|
+
<span className="absolute left-2 flex h-3.5 w-3.5 items-center justify-center">
|
|
136
|
+
<SelectPrimitive.ItemIndicator>
|
|
137
|
+
<Check className="h-4 w-4" />
|
|
138
|
+
</SelectPrimitive.ItemIndicator>
|
|
139
|
+
</span>
|
|
140
|
+
|
|
141
|
+
<SelectPrimitive.ItemText>{children}</SelectPrimitive.ItemText>
|
|
142
|
+
</SelectPrimitive.Item>
|
|
143
|
+
));
|
|
144
|
+
SelectItem.displayName = SelectPrimitive.Item.displayName;
|
|
145
|
+
|
|
146
|
+
const SelectSeparator = React.forwardRef<
|
|
147
|
+
React.ElementRef<typeof SelectPrimitive.Separator>,
|
|
148
|
+
React.ComponentPropsWithoutRef<typeof SelectPrimitive.Separator>
|
|
149
|
+
>(({ className, ...props }, ref) => (
|
|
150
|
+
<SelectPrimitive.Separator
|
|
151
|
+
ref={ref}
|
|
152
|
+
className={cn('-mx-1 my-1 h-px bg-muted', className)}
|
|
153
|
+
{...props}
|
|
154
|
+
/>
|
|
155
|
+
));
|
|
156
|
+
SelectSeparator.displayName = SelectPrimitive.Separator.displayName;
|
|
157
|
+
|
|
158
|
+
export {
|
|
159
|
+
Select,
|
|
160
|
+
SelectGroup,
|
|
161
|
+
SelectValue,
|
|
162
|
+
SelectTrigger,
|
|
163
|
+
SelectContent,
|
|
164
|
+
SelectLabel,
|
|
165
|
+
SelectItem,
|
|
166
|
+
SelectSeparator,
|
|
167
|
+
SelectScrollUpButton,
|
|
168
|
+
SelectScrollDownButton,
|
|
169
|
+
};
|
|
170
|
+
`;
|
|
171
|
+
}
|
|
172
|
+
//# sourceMappingURL=ui-select.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ui-select.js","sourceRoot":"","sources":["../../src/templates/ui-select.ts"],"names":[],"mappings":";;AAOA,8CAgKC;AAvKD;;;;;;GAMG;AACH,SAAgB,iBAAiB;IAC/B,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA8JR,CAAC;AACF,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,17 +1,24 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fnd-platform/cms",
|
|
3
|
-
"version": "1.0.0-alpha.
|
|
3
|
+
"version": "1.0.0-alpha.4",
|
|
4
4
|
"description": "Projen project class for generating CMS admin packages in fnd-platform",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"types": "lib/index.d.ts",
|
|
7
7
|
"files": [
|
|
8
8
|
"lib/"
|
|
9
9
|
],
|
|
10
|
+
"scripts": {
|
|
11
|
+
"build": "tsc",
|
|
12
|
+
"test": "vitest run",
|
|
13
|
+
"test:watch": "vitest",
|
|
14
|
+
"test:coverage": "vitest run --coverage",
|
|
15
|
+
"lint": "eslint src/ test/"
|
|
16
|
+
},
|
|
10
17
|
"dependencies": {
|
|
11
|
-
"
|
|
12
|
-
"@fnd-platform/core": "
|
|
13
|
-
"@fnd-platform/
|
|
14
|
-
"
|
|
18
|
+
"@fnd-platform/api": "workspace:*",
|
|
19
|
+
"@fnd-platform/core": "workspace:*",
|
|
20
|
+
"@fnd-platform/frontend": "workspace:*",
|
|
21
|
+
"projen": "^0.91.0"
|
|
15
22
|
},
|
|
16
23
|
"peerDependencies": {
|
|
17
24
|
"projen": "^0.91.0"
|
|
@@ -41,12 +48,5 @@
|
|
|
41
48
|
"type": "git",
|
|
42
49
|
"url": "https://github.com/your-org/fnd-platform",
|
|
43
50
|
"directory": "packages/cms"
|
|
44
|
-
},
|
|
45
|
-
"scripts": {
|
|
46
|
-
"build": "tsc",
|
|
47
|
-
"test": "vitest run",
|
|
48
|
-
"test:watch": "vitest",
|
|
49
|
-
"test:coverage": "vitest run --coverage",
|
|
50
|
-
"lint": "eslint src/ test/"
|
|
51
51
|
}
|
|
52
|
-
}
|
|
52
|
+
}
|
package/LICENSE
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
MIT License
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2024 fnd-platform contributors
|
|
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.
|