@openwarelabs/ui 0.0.0-stage → 0.1.1

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 (144) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +100 -2
  3. package/dist/components/Accordion/Accordion.d.cts +54 -0
  4. package/dist/components/Accordion/Accordion.d.ts +54 -0
  5. package/dist/components/Alert/Alert.d.cts +18 -0
  6. package/dist/components/Alert/Alert.d.ts +18 -0
  7. package/dist/components/Avatar/Avatar.d.cts +14 -0
  8. package/dist/components/Avatar/Avatar.d.ts +14 -0
  9. package/dist/components/Avatar/AvatarGroup.d.cts +28 -0
  10. package/dist/components/Avatar/AvatarGroup.d.ts +28 -0
  11. package/dist/components/Badge/Badge.d.cts +13 -0
  12. package/dist/components/Badge/Badge.d.ts +13 -0
  13. package/dist/components/Breadcrumbs/Breadcrumbs.d.cts +33 -0
  14. package/dist/components/Breadcrumbs/Breadcrumbs.d.ts +33 -0
  15. package/dist/components/Button/Button.d.cts +42 -0
  16. package/dist/components/Button/Button.d.ts +42 -0
  17. package/dist/components/Button/ButtonGroup.d.cts +33 -0
  18. package/dist/components/Button/ButtonGroup.d.ts +33 -0
  19. package/dist/components/Calendar/Calendar.d.cts +31 -0
  20. package/dist/components/Calendar/Calendar.d.ts +31 -0
  21. package/dist/components/Calendar/DatePicker.d.cts +21 -0
  22. package/dist/components/Calendar/DatePicker.d.ts +21 -0
  23. package/dist/components/Calendar/dates.d.cts +15 -0
  24. package/dist/components/Calendar/dates.d.ts +15 -0
  25. package/dist/components/Card/Card.d.cts +18 -0
  26. package/dist/components/Card/Card.d.ts +18 -0
  27. package/dist/components/Checkbox/Checkbox.d.cts +59 -0
  28. package/dist/components/Checkbox/Checkbox.d.ts +59 -0
  29. package/dist/components/ChoiceCard/ChoiceCard.d.cts +14 -0
  30. package/dist/components/ChoiceCard/ChoiceCard.d.ts +14 -0
  31. package/dist/components/CodeBlock/CodeBlock.d.cts +50 -0
  32. package/dist/components/CodeBlock/CodeBlock.d.ts +50 -0
  33. package/dist/components/ColorPicker/ColorPicker.d.cts +62 -0
  34. package/dist/components/ColorPicker/ColorPicker.d.ts +62 -0
  35. package/dist/components/Combobox/Combobox.d.cts +42 -0
  36. package/dist/components/Combobox/Combobox.d.ts +42 -0
  37. package/dist/components/CommandPalette/CommandPalette.d.cts +27 -0
  38. package/dist/components/CommandPalette/CommandPalette.d.ts +27 -0
  39. package/dist/components/CommandPalette/filterCommands.d.cts +3 -0
  40. package/dist/components/CommandPalette/filterCommands.d.ts +3 -0
  41. package/dist/components/Dialog/Dialog.d.cts +42 -0
  42. package/dist/components/Dialog/Dialog.d.ts +42 -0
  43. package/dist/components/Drawer/Drawer.d.cts +23 -0
  44. package/dist/components/Drawer/Drawer.d.ts +23 -0
  45. package/dist/components/EmptyState/EmptyState.d.cts +18 -0
  46. package/dist/components/EmptyState/EmptyState.d.ts +18 -0
  47. package/dist/components/Field/Field.d.cts +18 -0
  48. package/dist/components/Field/Field.d.ts +18 -0
  49. package/dist/components/FileDropZone/FileDropZone.d.cts +29 -0
  50. package/dist/components/FileDropZone/FileDropZone.d.ts +29 -0
  51. package/dist/components/FileTree/FileTree.d.cts +29 -0
  52. package/dist/components/FileTree/FileTree.d.ts +29 -0
  53. package/dist/components/Input/Input.d.cts +18 -0
  54. package/dist/components/Input/Input.d.ts +18 -0
  55. package/dist/components/InputOTP/InputOTP.d.cts +31 -0
  56. package/dist/components/InputOTP/InputOTP.d.ts +31 -0
  57. package/dist/components/Kbd/Kbd.d.cts +5 -0
  58. package/dist/components/Kbd/Kbd.d.ts +5 -0
  59. package/dist/components/Layout/Layout.d.cts +50 -0
  60. package/dist/components/Layout/Layout.d.ts +50 -0
  61. package/dist/components/Marketing/Marketing.d.cts +39 -0
  62. package/dist/components/Marketing/Marketing.d.ts +39 -0
  63. package/dist/components/Menu/Menu.d.cts +43 -0
  64. package/dist/components/Menu/Menu.d.ts +43 -0
  65. package/dist/components/NavList/NavList.d.cts +27 -0
  66. package/dist/components/NavList/NavList.d.ts +27 -0
  67. package/dist/components/NumberField/NumberField.d.cts +23 -0
  68. package/dist/components/NumberField/NumberField.d.ts +23 -0
  69. package/dist/components/Pagination/Pagination.d.cts +24 -0
  70. package/dist/components/Pagination/Pagination.d.ts +24 -0
  71. package/dist/components/Popover/Popover.d.cts +30 -0
  72. package/dist/components/Popover/Popover.d.ts +30 -0
  73. package/dist/components/Progress/Progress.d.cts +41 -0
  74. package/dist/components/Progress/Progress.d.ts +41 -0
  75. package/dist/components/RadioGroup/RadioGroup.d.cts +36 -0
  76. package/dist/components/RadioGroup/RadioGroup.d.ts +36 -0
  77. package/dist/components/SearchField/SearchField.d.cts +17 -0
  78. package/dist/components/SearchField/SearchField.d.ts +17 -0
  79. package/dist/components/SegmentedControl/SegmentedControl.d.cts +32 -0
  80. package/dist/components/SegmentedControl/SegmentedControl.d.ts +32 -0
  81. package/dist/components/Select/Select.d.cts +40 -0
  82. package/dist/components/Select/Select.d.ts +40 -0
  83. package/dist/components/Skeleton/Skeleton.d.cts +26 -0
  84. package/dist/components/Skeleton/Skeleton.d.ts +26 -0
  85. package/dist/components/Slider/Slider.d.cts +33 -0
  86. package/dist/components/Slider/Slider.d.ts +33 -0
  87. package/dist/components/Spinner/Spinner.d.cts +14 -0
  88. package/dist/components/Spinner/Spinner.d.ts +14 -0
  89. package/dist/components/Stat/Stat.d.cts +20 -0
  90. package/dist/components/Stat/Stat.d.ts +20 -0
  91. package/dist/components/Steps/Steps.d.cts +27 -0
  92. package/dist/components/Steps/Steps.d.ts +27 -0
  93. package/dist/components/Switch/Switch.d.cts +9 -0
  94. package/dist/components/Switch/Switch.d.ts +9 -0
  95. package/dist/components/Table/Table.d.cts +55 -0
  96. package/dist/components/Table/Table.d.ts +55 -0
  97. package/dist/components/Tabs/Tabs.d.cts +35 -0
  98. package/dist/components/Tabs/Tabs.d.ts +35 -0
  99. package/dist/components/Tag/Tag.d.cts +40 -0
  100. package/dist/components/Tag/Tag.d.ts +40 -0
  101. package/dist/components/Textarea/Textarea.d.cts +12 -0
  102. package/dist/components/Textarea/Textarea.d.ts +12 -0
  103. package/dist/components/Toast/Toast.d.cts +41 -0
  104. package/dist/components/Toast/Toast.d.ts +41 -0
  105. package/dist/components/Tooltip/Tooltip.d.cts +19 -0
  106. package/dist/components/Tooltip/Tooltip.d.ts +19 -0
  107. package/dist/components.css +5236 -0
  108. package/dist/fonts.css +3 -0
  109. package/dist/hooks/useControllableState.d.cts +5 -0
  110. package/dist/hooks/useControllableState.d.ts +5 -0
  111. package/dist/hooks/useFloating.d.cts +26 -0
  112. package/dist/hooks/useFloating.d.ts +26 -0
  113. package/dist/hooks/useIndicator.d.cts +8 -0
  114. package/dist/hooks/useIndicator.d.ts +8 -0
  115. package/dist/hooks/useMenuKeyboard.d.cts +12 -0
  116. package/dist/hooks/useMenuKeyboard.d.ts +12 -0
  117. package/dist/hooks/useModalDialog.d.cts +9 -0
  118. package/dist/hooks/useModalDialog.d.ts +9 -0
  119. package/dist/hooks/usePresence.d.cts +13 -0
  120. package/dist/hooks/usePresence.d.ts +13 -0
  121. package/dist/icons.d.cts +33 -0
  122. package/dist/icons.d.ts +33 -0
  123. package/dist/index.cjs +4622 -0
  124. package/dist/index.cjs.map +7 -0
  125. package/dist/index.d.cts +114 -0
  126. package/dist/index.d.ts +114 -0
  127. package/dist/index.js +4650 -0
  128. package/dist/index.js.map +7 -0
  129. package/dist/openware-ui.iife.js +8 -0
  130. package/dist/styles.css +5664 -0
  131. package/dist/tailwind.css +145 -0
  132. package/dist/tokens.css +427 -0
  133. package/dist/tokens.json +1163 -0
  134. package/dist/utils/brand.d.cts +30 -0
  135. package/dist/utils/brand.d.ts +30 -0
  136. package/dist/utils/copyText.d.cts +2 -0
  137. package/dist/utils/copyText.d.ts +2 -0
  138. package/dist/utils/cx.d.cts +4 -0
  139. package/dist/utils/cx.d.ts +4 -0
  140. package/dist/utils/resizeTextArea.d.cts +2 -0
  141. package/dist/utils/resizeTextArea.d.ts +2 -0
  142. package/dist/utils/text.d.cts +4 -0
  143. package/dist/utils/text.d.ts +4 -0
  144. package/package.json +83 -4
@@ -0,0 +1,30 @@
1
+ import type { CSSProperties } from "react";
2
+ /** The eleven steps of a brand scale, as in --ow-brand-50 … --ow-brand-950. */
3
+ export declare const brandSteps: readonly [50, 100, 200, 300, 400, 500, 600, 700, 800, 900, 950];
4
+ export type BrandStep = (typeof brandSteps)[number];
5
+ export type BrandScale = Record<BrandStep, string>;
6
+ export interface BrandPreset {
7
+ id: string;
8
+ name: string;
9
+ scale: BrandScale;
10
+ }
11
+ /**
12
+ * Builds the eleven brand steps from one colour: its hue and colourfulness on Openware's lightness curve.
13
+ * The steps keep midnight's contrast in both themes, so your exact colour may land a little lighter or
14
+ * darker than given. A grey gives a neutral scale.
15
+ *
16
+ * `brandScale("#0d9488")` → `{ 50: "#ebf7f6", …, 600: "#00595a", …, 950: "#001414" }`
17
+ */
18
+ export declare function brandScale(color: string): BrandScale;
19
+ /** A colour or a scale as the --ow-brand-* custom properties, for a `style` prop or `element.style`. */
20
+ export declare function brandVariables(brand: string | BrandScale): CSSProperties;
21
+ /** A colour or a scale as CSS to paste into a stylesheet. */
22
+ export declare function brandCss(brand: string | BrandScale, selector?: string): string;
23
+ /**
24
+ * Rebrands everything inside `element` (the whole page by default) by setting the --ow-brand-* properties on
25
+ * it. Pass `null` to go back to midnight. Elements with their own data-theme set their own brand steps, so
26
+ * give those the same properties, or use brandCss with `:root, [data-theme]` in a stylesheet.
27
+ */
28
+ export declare function applyBrand(brand: string | BrandScale | null, element?: HTMLElement): void;
29
+ /** Seven ready-made scales, each checked for contrast in both themes. Midnight is the default. */
30
+ export declare const brandPresets: BrandPreset[];
@@ -0,0 +1,30 @@
1
+ import type { CSSProperties } from "react";
2
+ /** The eleven steps of a brand scale, as in --ow-brand-50 … --ow-brand-950. */
3
+ export declare const brandSteps: readonly [50, 100, 200, 300, 400, 500, 600, 700, 800, 900, 950];
4
+ export type BrandStep = (typeof brandSteps)[number];
5
+ export type BrandScale = Record<BrandStep, string>;
6
+ export interface BrandPreset {
7
+ id: string;
8
+ name: string;
9
+ scale: BrandScale;
10
+ }
11
+ /**
12
+ * Builds the eleven brand steps from one colour: its hue and colourfulness on Openware's lightness curve.
13
+ * The steps keep midnight's contrast in both themes, so your exact colour may land a little lighter or
14
+ * darker than given. A grey gives a neutral scale.
15
+ *
16
+ * `brandScale("#0d9488")` → `{ 50: "#ebf7f6", …, 600: "#00595a", …, 950: "#001414" }`
17
+ */
18
+ export declare function brandScale(color: string): BrandScale;
19
+ /** A colour or a scale as the --ow-brand-* custom properties, for a `style` prop or `element.style`. */
20
+ export declare function brandVariables(brand: string | BrandScale): CSSProperties;
21
+ /** A colour or a scale as CSS to paste into a stylesheet. */
22
+ export declare function brandCss(brand: string | BrandScale, selector?: string): string;
23
+ /**
24
+ * Rebrands everything inside `element` (the whole page by default) by setting the --ow-brand-* properties on
25
+ * it. Pass `null` to go back to midnight. Elements with their own data-theme set their own brand steps, so
26
+ * give those the same properties, or use brandCss with `:root, [data-theme]` in a stylesheet.
27
+ */
28
+ export declare function applyBrand(brand: string | BrandScale | null, element?: HTMLElement): void;
29
+ /** Seven ready-made scales, each checked for contrast in both themes. Midnight is the default. */
30
+ export declare const brandPresets: BrandPreset[];
@@ -0,0 +1,2 @@
1
+ /** Copies text to the clipboard, falling back to a hidden textarea where the Clipboard API is refused. */
2
+ export declare function copyText(text: string): Promise<boolean>;
@@ -0,0 +1,2 @@
1
+ /** Copies text to the clipboard, falling back to a hidden textarea where the Clipboard API is refused. */
2
+ export declare function copyText(text: string): Promise<boolean>;
@@ -0,0 +1,4 @@
1
+ type ClassValue = string | false | null | undefined | Record<string, boolean | undefined>;
2
+ /** Joins class names, skipping falsy ones; an object adds each key whose value is true. */
3
+ export declare function cx(...values: ClassValue[]): string;
4
+ export {};
@@ -0,0 +1,4 @@
1
+ type ClassValue = string | false | null | undefined | Record<string, boolean | undefined>;
2
+ /** Joins class names, skipping falsy ones; an object adds each key whose value is true. */
3
+ export declare function cx(...values: ClassValue[]): string;
4
+ export {};
@@ -0,0 +1,2 @@
1
+ /** Grows a textarea to fit its text, up to its CSS max-height, then scrolls. */
2
+ export declare function resizeTextArea(textArea: HTMLTextAreaElement): void;
@@ -0,0 +1,2 @@
1
+ /** Grows a textarea to fit its text, up to its CSS max-height, then scrolls. */
2
+ export declare function resizeTextArea(textArea: HTMLTextAreaElement): void;
@@ -0,0 +1,4 @@
1
+ /** "Alex Silver" → "AS", "alex" → "A". Empty input returns "". */
2
+ export declare function getInitials(name: string): string;
3
+ /** "⌘N" → "Meta+N", "Ctrl+O" → "Control+O", for aria-keyshortcuts. */
4
+ export declare function toAriaShortcut(shortcut: string): string;
@@ -0,0 +1,4 @@
1
+ /** "Alex Silver" → "AS", "alex" → "A". Empty input returns "". */
2
+ export declare function getInitials(name: string): string;
3
+ /** "⌘N" → "Meta+N", "Ctrl+O" → "Control+O", for aria-keyshortcuts. */
4
+ export declare function toAriaShortcut(shortcut: string): string;
package/package.json CHANGED
@@ -1,6 +1,85 @@
1
1
  {
2
2
  "name": "@openwarelabs/ui",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
3
+ "version": "0.1.1",
4
+ "description": "Openware UI: React components and design tokens — midnight and brass, tactile buttons and Inter, in light and dark.",
5
+ "license": "MIT",
6
+ "author": "Alexander Silver",
7
+ "homepage": "https://github.com/openwarelabs/ui#readme",
8
+ "bugs": {
9
+ "url": "https://github.com/openwarelabs/ui/issues"
10
+ },
11
+ "type": "module",
12
+ "sideEffects": [
13
+ "**/*.css"
14
+ ],
15
+ "main": "./dist/index.cjs",
16
+ "module": "./dist/index.js",
17
+ "types": "./dist/index.d.ts",
18
+ "exports": {
19
+ ".": {
20
+ "import": {
21
+ "types": "./dist/index.d.ts",
22
+ "default": "./dist/index.js"
23
+ },
24
+ "require": {
25
+ "types": "./dist/index.d.cts",
26
+ "default": "./dist/index.cjs"
27
+ }
28
+ },
29
+ "./styles.css": "./dist/styles.css",
30
+ "./tokens.css": "./dist/tokens.css",
31
+ "./fonts.css": "./dist/fonts.css",
32
+ "./tailwind.css": "./dist/tailwind.css",
33
+ "./tokens.json": "./dist/tokens.json",
34
+ "./package.json": "./package.json"
35
+ },
36
+ "files": [
37
+ "dist",
38
+ "README.md"
39
+ ],
40
+ "publishConfig": {
41
+ "access": "public"
42
+ },
43
+ "scripts": {
44
+ "dev": "node scripts/docs.mjs dev",
45
+ "build": "node scripts/build-tokens.mjs && node scripts/build.mjs && tsc -p tsconfig.build.json && node scripts/build-types.mjs",
46
+ "docs:build": "node scripts/docs.mjs build",
47
+ "tokens": "node scripts/build-tokens.mjs",
48
+ "typecheck": "tsc --noEmit && tsc -p docs/tsconfig.json",
49
+ "contrast": "node scripts/check-contrast.mjs",
50
+ "blocks:check": "node scripts/check-blocks.mjs",
51
+ "prepare": "npm run build",
52
+ "prepublishOnly": "npm run typecheck"
53
+ },
54
+ "peerDependencies": {
55
+ "react": ">=18",
56
+ "react-dom": ">=18"
57
+ },
58
+ "dependencies": {
59
+ "@fontsource-variable/geist-mono": "^5.3.0",
60
+ "@fontsource-variable/inter": "^5.3.0",
61
+ "react-colorful": "5.6.1",
62
+ "sonner": "^2.0.8"
63
+ },
64
+ "devDependencies": {
65
+ "@types/react": "^18.3.12",
66
+ "@types/react-dom": "^18.3.1",
67
+ "culori": "^4.0.1",
68
+ "esbuild": "^0.25.0",
69
+ "lucide-react": "^1.48.0",
70
+ "react": "^18.3.1",
71
+ "react-dom": "^18.3.1",
72
+ "shiki": "^4.4.3",
73
+ "typescript": "^5.6.3"
74
+ },
75
+ "repository": {
76
+ "type": "git",
77
+ "url": "https://github.com/openwarelabs/ui"
78
+ },
79
+ "keywords": [
80
+ "react",
81
+ "components",
82
+ "design-system",
83
+ "design-tokens"
84
+ ]
85
+ }