@krapwoo/ds-viewer 0.1.0 → 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.
- package/README.md +100 -78
- package/dist/cli/config.js +26 -1
- package/dist/cli/dev.js +50 -5
- package/dist/cli/glob.js +8 -0
- package/dist/cli/init.js +148 -18
- package/dist/cli/main.js +102 -3
- package/dist/cli/props.js +166 -18
- package/dist/cli/sync.js +17 -1
- package/dist/cli/workspace.js +49 -21
- package/native/catalog/CatalogShell.tsx +6 -1
- package/native/catalog/CatalogSidebar.tsx +98 -5
- package/native/catalog/TokenRow.tsx +3 -2
- package/native/catalog/index.ts +6 -5
- package/native/catalog/logoLayout.ts +12 -0
- package/native/catalog/pageApi.ts +10 -1
- package/native/catalog/tokens.ts +5 -0
- package/package.json +11 -7
- package/starter-kit/WHEN_TO_USE.md +124 -0
- package/starter-kit/components/AnimatedChevron/AnimatedChevron.catalog.tsx +23 -0
- package/starter-kit/components/AnimatedChevron/AnimatedChevron.tsx +46 -0
- package/starter-kit/components/AnimatedChevron/index.ts +2 -0
- package/starter-kit/components/Avatar/Avatar.catalog.tsx +72 -0
- package/starter-kit/components/Avatar/Avatar.tsx +74 -0
- package/starter-kit/components/Avatar/index.ts +2 -0
- package/starter-kit/components/Badge/Badge.catalog.tsx +96 -0
- package/starter-kit/components/Badge/Badge.tsx +56 -0
- package/starter-kit/components/Badge/Badge.types.ts +18 -0
- package/starter-kit/components/Badge/index.ts +2 -0
- package/starter-kit/components/Banner/Banner.catalog.tsx +87 -0
- package/starter-kit/components/Banner/Banner.tsx +257 -0
- package/starter-kit/components/Banner/Banner.types.ts +38 -0
- package/starter-kit/components/Banner/index.ts +2 -0
- package/starter-kit/components/BottomSheet/BottomSheet.catalog.tsx +77 -0
- package/starter-kit/components/BottomSheet/BottomSheet.tsx +151 -0
- package/starter-kit/components/BottomSheet/index.ts +2 -0
- package/starter-kit/components/Button/Button.catalog.tsx +113 -0
- package/starter-kit/components/Button/Button.tsx +173 -0
- package/starter-kit/components/Button/Button.types.ts +52 -0
- package/starter-kit/components/Button/index.ts +2 -0
- package/starter-kit/components/ButtonGroup/ButtonGroup.catalog.tsx +39 -0
- package/starter-kit/components/ButtonGroup/ButtonGroup.tsx +84 -0
- package/starter-kit/components/ButtonGroup/index.ts +2 -0
- package/starter-kit/components/Card/Card.catalog.tsx +68 -0
- package/starter-kit/components/Card/Card.tsx +133 -0
- package/starter-kit/components/Card/index.ts +2 -0
- package/starter-kit/components/Checkbox/Checkbox.catalog.tsx +28 -0
- package/starter-kit/components/Checkbox/Checkbox.tsx +104 -0
- package/starter-kit/components/Checkbox/index.ts +2 -0
- package/starter-kit/components/Dialog/Dialog.catalog.tsx +41 -0
- package/starter-kit/components/Dialog/Dialog.tsx +82 -0
- package/starter-kit/components/Dialog/index.ts +2 -0
- package/starter-kit/components/Divider/Divider.catalog.tsx +35 -0
- package/starter-kit/components/Divider/Divider.tsx +20 -0
- package/starter-kit/components/Divider/index.ts +2 -0
- package/starter-kit/components/Dock/Dock.catalog.tsx +71 -0
- package/starter-kit/components/Dock/Dock.tsx +58 -0
- package/starter-kit/components/Dock/index.ts +2 -0
- package/starter-kit/components/Dropdown/Dropdown.catalog.tsx +69 -0
- package/starter-kit/components/Dropdown/Dropdown.tsx +162 -0
- package/starter-kit/components/Dropdown/index.ts +2 -0
- package/starter-kit/components/EmptyState/EmptyState.catalog.tsx +67 -0
- package/starter-kit/components/EmptyState/EmptyState.tsx +88 -0
- package/starter-kit/components/EmptyState/index.ts +2 -0
- package/starter-kit/components/FieldContainer/FieldContainer.catalog.tsx +76 -0
- package/starter-kit/components/FieldContainer/FieldContainer.tsx +99 -0
- package/starter-kit/components/FieldContainer/FieldContainer.types.ts +27 -0
- package/starter-kit/components/FieldContainer/index.ts +2 -0
- package/starter-kit/components/InputClearButton/InputClearButton.catalog.tsx +18 -0
- package/starter-kit/components/InputClearButton/InputClearButton.tsx +63 -0
- package/starter-kit/components/InputClearButton/index.ts +2 -0
- package/starter-kit/components/InputField/InputField.catalog.tsx +76 -0
- package/starter-kit/components/InputField/InputField.tsx +418 -0
- package/starter-kit/components/InputField/index.ts +2 -0
- package/starter-kit/components/List/List.catalog.tsx +30 -0
- package/starter-kit/components/List/List.tsx +36 -0
- package/starter-kit/components/List/index.ts +2 -0
- package/starter-kit/components/ListItem/ListItem.catalog.tsx +89 -0
- package/starter-kit/components/ListItem/ListItem.tsx +165 -0
- package/starter-kit/components/ListItem/index.ts +2 -0
- package/starter-kit/components/Loading/Loading.catalog.tsx +34 -0
- package/starter-kit/components/Loading/Loading.tsx +121 -0
- package/starter-kit/components/Loading/index.ts +2 -0
- package/starter-kit/components/Pill/Pill.catalog.tsx +93 -0
- package/starter-kit/components/Pill/Pill.tsx +181 -0
- package/starter-kit/components/Pill/Pill.types.ts +30 -0
- package/starter-kit/components/Pill/index.ts +2 -0
- package/starter-kit/components/PillRow/PillRow.catalog.tsx +91 -0
- package/starter-kit/components/PillRow/PillRow.tsx +140 -0
- package/starter-kit/components/PillRow/PillRow.types.ts +24 -0
- package/starter-kit/components/PillRow/index.ts +2 -0
- package/starter-kit/components/ProgressDots/ProgressDots.catalog.tsx +22 -0
- package/starter-kit/components/ProgressDots/ProgressDots.tsx +42 -0
- package/starter-kit/components/ProgressDots/index.ts +2 -0
- package/starter-kit/components/Radio/Radio.catalog.tsx +38 -0
- package/starter-kit/components/Radio/Radio.tsx +114 -0
- package/starter-kit/components/Radio/index.ts +2 -0
- package/starter-kit/components/Radio/usePressScale.ts +33 -0
- package/starter-kit/components/SearchField/SearchField.catalog.tsx +28 -0
- package/starter-kit/components/SearchField/SearchField.tsx +98 -0
- package/starter-kit/components/SearchField/index.ts +2 -0
- package/starter-kit/components/SectionHeader/SectionHeader.catalog.tsx +72 -0
- package/starter-kit/components/SectionHeader/SectionHeader.tsx +139 -0
- package/starter-kit/components/SectionHeader/index.ts +2 -0
- package/starter-kit/components/SegmentedToggle/SegmentedToggle.catalog.tsx +31 -0
- package/starter-kit/components/SegmentedToggle/SegmentedToggle.tsx +163 -0
- package/starter-kit/components/SegmentedToggle/index.ts +2 -0
- package/starter-kit/components/SegmentedToggle/useSlideAnim.ts +29 -0
- package/starter-kit/components/Shimmer/Breathing.catalog.tsx +29 -0
- package/starter-kit/components/Shimmer/Shimmer.catalog.tsx +89 -0
- package/starter-kit/components/Shimmer/Shimmer.tsx +158 -0
- package/starter-kit/components/Shimmer/Shimmer.types.ts +27 -0
- package/starter-kit/components/Shimmer/SkeletonGroup.catalog.tsx +39 -0
- package/starter-kit/components/Shimmer/index.ts +2 -0
- package/starter-kit/components/Surface/Surface.catalog.tsx +44 -0
- package/starter-kit/components/Surface/Surface.tsx +45 -0
- package/starter-kit/components/Surface/index.ts +2 -0
- package/starter-kit/components/Switch/Switch.catalog.tsx +33 -0
- package/starter-kit/components/Switch/Switch.tsx +129 -0
- package/starter-kit/components/Switch/index.ts +2 -0
- package/starter-kit/components/TextArea/TextArea.catalog.tsx +29 -0
- package/starter-kit/components/TextArea/TextArea.tsx +99 -0
- package/starter-kit/components/TextArea/index.ts +2 -0
- package/starter-kit/components/Toast/Toast.catalog.tsx +61 -0
- package/starter-kit/components/Toast/Toast.tsx +144 -0
- package/starter-kit/components/Toast/index.ts +2 -0
- package/starter-kit/components/Tooltip/Tooltip.catalog.tsx +121 -0
- package/starter-kit/components/Tooltip/Tooltip.tsx +195 -0
- package/starter-kit/components/Tooltip/index.ts +2 -0
- package/starter-kit/components/TopNav/TopNav.catalog.tsx +71 -0
- package/starter-kit/components/TopNav/TopNav.tsx +77 -0
- package/starter-kit/components/TopNav/index.ts +2 -0
- package/starter-kit/components/UnderlineTabs/UnderlineTabs.catalog.tsx +30 -0
- package/starter-kit/components/UnderlineTabs/UnderlineTabs.tsx +156 -0
- package/starter-kit/components/UnderlineTabs/index.ts +2 -0
- package/starter-kit/components/index.ts +36 -0
- package/starter-kit/components/statusColors.ts +27 -0
- package/starter-kit/icons/Icon.native.tsx +90 -0
- package/starter-kit/icons/index.ts +10 -0
- package/starter-kit/icons/paths.ts +623 -0
- package/starter-kit/icons/types.ts +69 -0
- package/starter-kit/pages/Colors.catalog.tsx +55 -0
- package/starter-kit/pages/Font.catalog.tsx +45 -0
- package/starter-kit/pages/Icons.catalog.tsx +51 -0
- package/starter-kit/pages/Manifest.catalog.tsx +24 -0
- package/starter-kit/pages/Motion.catalog.tsx +101 -0
- package/starter-kit/pages/Radius.catalog.tsx +35 -0
- package/starter-kit/pages/ReportIssue.catalog.tsx +148 -0
- package/starter-kit/pages/SavedTrips.catalog.tsx +247 -0
- package/starter-kit/pages/Shadow.catalog.tsx +34 -0
- package/starter-kit/pages/Spacing.catalog.tsx +12 -0
- package/starter-kit/pages/TripPlannerForm.catalog.tsx +48 -0
- package/starter-kit/pages/Typography.catalog.tsx +17 -0
- package/starter-kit/tokens/index.ts +50 -0
- package/starter-kit/tokens/motion.ts +90 -0
- package/starter-kit/tokens/palette.ts +111 -0
- package/starter-kit/tokens/scales.ts +106 -0
- package/starter-kit/tokens/semantic.ts +98 -0
- package/starter-kit/tokens/shadow.ts +36 -0
- package/starter-kit/tokens/typography.ts +72 -0
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* react-native-svg renderer for the shared icon data (`./paths`).
|
|
3
|
+
*
|
|
4
|
+
* Reads `ICON_PATHS[name]` and maps each primitive to the matching RN-SVG element. Stroke icons
|
|
5
|
+
* get round caps/joins in the Lucide style; fill icons render solid. Per-primitive `fill`/`stroke`
|
|
6
|
+
* overrides (used by the transit icons) win over the def-level mode.
|
|
7
|
+
*/
|
|
8
|
+
import React from 'react';
|
|
9
|
+
import Svg, { Path, Rect, Circle, Line, Polyline, Polygon } from 'react-native-svg';
|
|
10
|
+
import { DS_SEMANTIC, DS_ICON_SIZE } from '../tokens';
|
|
11
|
+
import { ICON_PATHS, type IconPrimitive } from './paths';
|
|
12
|
+
import type { IconRenderProps } from './types';
|
|
13
|
+
|
|
14
|
+
export type IconProps = IconRenderProps & { accessibilityLabel?: string };
|
|
15
|
+
|
|
16
|
+
/** Resolve a primitive's `'color' | 'none'` sentinel against the active icon color. */
|
|
17
|
+
function resolvePaint(value: 'color' | 'none' | undefined, color: string): string | undefined {
|
|
18
|
+
if (value === undefined) return undefined;
|
|
19
|
+
return value === 'color' ? color : 'none';
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export function Icon({
|
|
23
|
+
name,
|
|
24
|
+
size = DS_ICON_SIZE.sm,
|
|
25
|
+
color = DS_SEMANTIC.text.regular,
|
|
26
|
+
strokeWidth,
|
|
27
|
+
accessibilityLabel,
|
|
28
|
+
}: IconProps) {
|
|
29
|
+
const def = ICON_PATHS[name];
|
|
30
|
+
if (!def) return null;
|
|
31
|
+
|
|
32
|
+
const isStroke = def.mode === 'stroke';
|
|
33
|
+
const defStrokeWidth = strokeWidth ?? def.strokeWidth ?? 2;
|
|
34
|
+
|
|
35
|
+
return (
|
|
36
|
+
<Svg
|
|
37
|
+
width={size}
|
|
38
|
+
height={size}
|
|
39
|
+
viewBox={def.viewBox}
|
|
40
|
+
fill="none"
|
|
41
|
+
accessibilityLabel={accessibilityLabel}
|
|
42
|
+
>
|
|
43
|
+
{def.primitives.map((p, i) => {
|
|
44
|
+
// Per-primitive override wins; otherwise fall back to the def mode.
|
|
45
|
+
const fill = resolvePaint(p.fill, color) ?? (isStroke ? 'none' : color);
|
|
46
|
+
const stroke = resolvePaint(p.stroke, color) ?? (isStroke ? color : undefined);
|
|
47
|
+
const hasStroke = stroke !== undefined && stroke !== 'none';
|
|
48
|
+
|
|
49
|
+
const common: Record<string, unknown> = { fill, fillRule: p.fillRule };
|
|
50
|
+
if (hasStroke) {
|
|
51
|
+
common.stroke = stroke;
|
|
52
|
+
common.strokeWidth = p.strokeWidth ?? defStrokeWidth;
|
|
53
|
+
// Round caps/joins are the Lucide house style; only apply for stroke-mode icons.
|
|
54
|
+
if (isStroke) {
|
|
55
|
+
common.strokeLinecap = 'round';
|
|
56
|
+
common.strokeLinejoin = 'round';
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
// A `transform` string (not `translateX`/`translateY` props) — react-native-svg's web
|
|
60
|
+
// shim only folds `translateX`/`translateY` into the SVG `transform` attribute, it does not
|
|
61
|
+
// strip the original props first, so they would otherwise also reach the DOM unchanged and
|
|
62
|
+
// React would warn "does not recognize the `translateX` prop on a DOM element".
|
|
63
|
+
if (p.translateX !== undefined || p.translateY !== undefined) {
|
|
64
|
+
common.transform = `translate(${p.translateX ?? 0}, ${p.translateY ?? 0})`;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
return renderPrimitive(p, common, i);
|
|
68
|
+
})}
|
|
69
|
+
</Svg>
|
|
70
|
+
);
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
function renderPrimitive(p: IconPrimitive, common: Record<string, unknown>, key: number): React.ReactElement | null {
|
|
74
|
+
switch (p.tag) {
|
|
75
|
+
case 'path':
|
|
76
|
+
return <Path key={key} {...common} d={p.d} />;
|
|
77
|
+
case 'rect':
|
|
78
|
+
return <Rect key={key} {...common} x={p.x} y={p.y} width={p.width} height={p.height} rx={p.rx} ry={p.ry} />;
|
|
79
|
+
case 'circle':
|
|
80
|
+
return <Circle key={key} {...common} cx={p.cx} cy={p.cy} r={p.r} />;
|
|
81
|
+
case 'line':
|
|
82
|
+
return <Line key={key} {...common} x1={p.x1} y1={p.y1} x2={p.x2} y2={p.y2} />;
|
|
83
|
+
case 'polyline':
|
|
84
|
+
return <Polyline key={key} {...common} points={p.points} />;
|
|
85
|
+
case 'polygon':
|
|
86
|
+
return <Polygon key={key} {...common} points={p.points} />;
|
|
87
|
+
default:
|
|
88
|
+
return null;
|
|
89
|
+
}
|
|
90
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared icon layer barrel.
|
|
3
|
+
*
|
|
4
|
+
* Exposes the platform-neutral data + types only. Consumers import the renderer explicitly as
|
|
5
|
+
* `../icons/Icon.native` (the only renderer today — see the repo README for how a future platform
|
|
6
|
+
* port would add its own `Icon.<platform>.tsx` alongside it without touching this data).
|
|
7
|
+
*/
|
|
8
|
+
export { ICON_PATHS } from './paths';
|
|
9
|
+
export type { IconPrimitive, IconDef } from './paths';
|
|
10
|
+
export type { IconName, IconRenderProps } from './types';
|