@nobak/design-system 1.0.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/LICENSE +73 -0
- package/README.md +142 -0
- package/lib/assets/icons.js +67 -0
- package/lib/components/AccountOverview/AccountOverview.js +122 -0
- package/lib/components/AdminPanel.js +58 -0
- package/lib/components/AssetExchange/AssetExchange.js +189 -0
- package/lib/components/AuthenticationFlow.js +216 -0
- package/lib/components/ConversationInterface/ConversationInterface.js +232 -0
- package/lib/components/DevFooter.js +38 -0
- package/lib/components/DevMenu.js +35 -0
- package/lib/components/DevSidebar.js +28 -0
- package/lib/components/DigitalDisplay.js +83 -0
- package/lib/components/Footer.js +45 -0
- package/lib/components/HeroContainer.js +10 -0
- package/lib/components/IntentRecognition/IntentRecognition.js +174 -0
- package/lib/components/Logo.js +259 -0
- package/lib/components/MenuBar.js +56 -0
- package/lib/components/NetworkSettings.js +223 -0
- package/lib/components/RecoverySetup/RecoverySetup.js +354 -0
- package/lib/components/RisingSun.js +122 -0
- package/lib/components/Symbol.js +226 -0
- package/lib/components/TransactionComposer/TransactionComposer.js +258 -0
- package/lib/components/TransactionConfirmation.js +184 -0
- package/lib/components/WalletMenu.js +33 -0
- package/lib/components/console/code/CodeBlock.js +150 -0
- package/lib/components/console/code/index.js +9 -0
- package/lib/components/console/data/DataTable.js +245 -0
- package/lib/components/console/data/MetricCard.js +79 -0
- package/lib/components/console/data/index.js +11 -0
- package/lib/components/console/documentation/index.js +10 -0
- package/lib/components/console/forms/APIKeyGenerator.js +261 -0
- package/lib/components/console/forms/SearchBar.js +210 -0
- package/lib/components/console/forms/index.js +10 -0
- package/lib/components/console/index.js +29 -0
- package/lib/components/console/layout/ConsoleCard.js +82 -0
- package/lib/components/console/layout/ConsoleLayout.js +86 -0
- package/lib/components/console/layout/index.js +10 -0
- package/lib/components/console/monitoring/StatusIndicator.js +128 -0
- package/lib/components/console/monitoring/index.js +9 -0
- package/lib/components/console/navigation/DevFooter.js +38 -0
- package/lib/components/console/navigation/DevMenu.js +35 -0
- package/lib/components/console/navigation/DevSidebar.js +28 -0
- package/lib/components/console/navigation/index.js +11 -0
- package/lib/components/console/settings/index.js +10 -0
- package/lib/components/index.js +12 -0
- package/lib/design/ColorPicker.stories.js +9 -0
- package/lib/design/HSLTool-V1.js +345 -0
- package/lib/design/HSLTool-V2.js +475 -0
- package/lib/design/HSLTool-V3.js +543 -0
- package/lib/design/HSLTool-V4.js +1139 -0
- package/lib/design/HSLTool.js +374 -0
- package/lib/design/OKLCHColorPicker.stories.js +24 -0
- package/lib/design/OKLCHTool.js +1014 -0
- package/lib/index.js +4 -0
- package/lib/shared/components/Avatar/Avatar.js +18 -0
- package/lib/shared/components/Avatar/index.js +1 -0
- package/lib/shared/components/Badge/Badge.js +34 -0
- package/lib/shared/components/Badge/index.js +1 -0
- package/lib/shared/components/Breadcrumb/Breadcrumb.js +13 -0
- package/lib/shared/components/Breadcrumb/index.js +1 -0
- package/lib/shared/components/Button/Button.js +184 -0
- package/lib/shared/components/Button/index.js +1 -0
- package/lib/shared/components/Calendar/Calendar.js +155 -0
- package/lib/shared/components/Calendar/CalendarDay.js +251 -0
- package/lib/shared/components/Calendar/CalendarHeader.js +88 -0
- package/lib/shared/components/Calendar/CalendarMonth.js +106 -0
- package/lib/shared/components/Calendar/CalendarWeek.js +267 -0
- package/lib/shared/components/Calendar/constants.js +73 -0
- package/lib/shared/components/Calendar/index.js +3 -0
- package/lib/shared/components/Calendar/types.d.js +0 -0
- package/lib/shared/components/Cartel/Cartel.js +44 -0
- package/lib/shared/components/Cartel/index.js +1 -0
- package/lib/shared/components/Cell/Cell.js +105 -0
- package/lib/shared/components/Cell/index.js +1 -0
- package/lib/shared/components/Checkbox/Checkbox.js +27 -0
- package/lib/shared/components/Checkbox/index.js +1 -0
- package/lib/shared/components/Clock/Clock.js +6 -0
- package/lib/shared/components/Clock/index.js +1 -0
- package/lib/shared/components/ColorChecker/ColorChecker.js +89 -0
- package/lib/shared/components/ColorChecker/index.js +2 -0
- package/lib/shared/components/ColorChecker/utils.js +159 -0
- package/lib/shared/components/Command/Command.js +95 -0
- package/lib/shared/components/Command/index.js +1 -0
- package/lib/shared/components/Container/Container.js +18 -0
- package/lib/shared/components/Container/index.js +1 -0
- package/lib/shared/components/Cover/Cover.js +17 -0
- package/lib/shared/components/Cover/index.js +1 -0
- package/lib/shared/components/DatePicker/DatePicker.js +52 -0
- package/lib/shared/components/DatePicker/components/Calendar.js +125 -0
- package/lib/shared/components/DatePicker/components/CalendarDay.js +23 -0
- package/lib/shared/components/DatePicker/components/DateWrapper.js +15 -0
- package/lib/shared/components/DatePicker/components/index.js +2 -0
- package/lib/shared/components/DatePicker/index.js +1 -0
- package/lib/shared/components/DateTime/DateTime.js +51 -0
- package/lib/shared/components/DateTime/index.js +1 -0
- package/lib/shared/components/Debug/Debug.js +12 -0
- package/lib/shared/components/Debug/index.js +1 -0
- package/lib/shared/components/Disclosure/Disclosure.js +31 -0
- package/lib/shared/components/Disclosure/index.js +1 -0
- package/lib/shared/components/Dropdown/Dropdown.js +91 -0
- package/lib/shared/components/Dropdown/index.js +1 -0
- package/lib/shared/components/EmptyState/EmptyState.js +40 -0
- package/lib/shared/components/EmptyState/index.js +1 -0
- package/lib/shared/components/Form/Form.js +41 -0
- package/lib/shared/components/Form/components/DynamicForm.js +66 -0
- package/lib/shared/components/Form/components/StepperForm.js +266 -0
- package/lib/shared/components/Form/components/index.js +2 -0
- package/lib/shared/components/Form/context/Form.js +164 -0
- package/lib/shared/components/Form/context/index.js +1 -0
- package/lib/shared/components/Form/index.js +1 -0
- package/lib/shared/components/Form/types.d.js +1 -0
- package/lib/shared/components/Form/utils/index.js +31 -0
- package/lib/shared/components/GroupItems/GroupItems.js +17 -0
- package/lib/shared/components/GroupItems/index.js +1 -0
- package/lib/shared/components/Header/Header.js +26 -0
- package/lib/shared/components/Header/index.js +1 -0
- package/lib/shared/components/Heading/Heading.js +5 -0
- package/lib/shared/components/Heading/index.js +1 -0
- package/lib/shared/components/Icon/Icon.js +28 -0
- package/lib/shared/components/Icon/index.js +1 -0
- package/lib/shared/components/Identicons/Identicons.js +6 -0
- package/lib/shared/components/Identicons/index.d.js +0 -0
- package/lib/shared/components/Identicons/index.js +1 -0
- package/lib/shared/components/Image/Image.js +22 -0
- package/lib/shared/components/Image/index.js +1 -0
- package/lib/shared/components/Input/Input.js +201 -0
- package/lib/shared/components/Input/components/CheckBoxInput.js +81 -0
- package/lib/shared/components/Input/components/DateInput.js +89 -0
- package/lib/shared/components/Input/components/DefaultInput.js +102 -0
- package/lib/shared/components/Input/components/FileReaderInput.js +88 -0
- package/lib/shared/components/Input/components/NumberInput.js +141 -0
- package/lib/shared/components/Input/components/PickerInput.js +122 -0
- package/lib/shared/components/Input/components/RCInput.js +112 -0
- package/lib/shared/components/Input/components/Radiobox/RadioboxBasic.js +56 -0
- package/lib/shared/components/Input/components/Radiobox/RadioboxCard.js +27 -0
- package/lib/shared/components/Input/components/Radiobox/RadioboxFull.js +44 -0
- package/lib/shared/components/Input/components/Radiobox/index.js +3 -0
- package/lib/shared/components/Input/components/RadioboxInput.js +102 -0
- package/lib/shared/components/Input/components/SelectInput.js +70 -0
- package/lib/shared/components/Input/components/TextAreaInput.js +67 -0
- package/lib/shared/components/Input/components/TextInput.js +139 -0
- package/lib/shared/components/Input/components/TimeInput.js +37 -0
- package/lib/shared/components/Input/components/UploadFileInput.js +123 -0
- package/lib/shared/components/Input/components/index.js +13 -0
- package/lib/shared/components/Input/components/types.d.js +0 -0
- package/lib/shared/components/Input/index.js +1 -0
- package/lib/shared/components/Input/types.d.js +0 -0
- package/lib/shared/components/Layout/Layout.js +13 -0
- package/lib/shared/components/Layout/index.js +1 -0
- package/lib/shared/components/List/List.js +30 -0
- package/lib/shared/components/List/index.js +1 -0
- package/lib/shared/components/Loader/Loader.js +27 -0
- package/lib/shared/components/Loader/index.js +1 -0
- package/lib/shared/components/Modal/Modal.js +102 -0
- package/lib/shared/components/Modal/index.js +1 -0
- package/lib/shared/components/Notification/Notification.js +39 -0
- package/lib/shared/components/Notification/index.js +1 -0
- package/lib/shared/components/Person/Person.js +81 -0
- package/lib/shared/components/Person/index.js +1 -0
- package/lib/shared/components/Popover/Popover.js +39 -0
- package/lib/shared/components/Popover/index.js +1 -0
- package/lib/shared/components/QRCode/QRCode.js +329 -0
- package/lib/shared/components/QRCode/index.js +1 -0
- package/lib/shared/components/RadioGroup/RadioGroup.js +35 -0
- package/lib/shared/components/RadioGroup/components/DefaultGroup.js +71 -0
- package/lib/shared/components/RadioGroup/components/VerticalGroup.js +83 -0
- package/lib/shared/components/RadioGroup/components/index.js +2 -0
- package/lib/shared/components/RadioGroup/index.js +1 -0
- package/lib/shared/components/Search/Search.js +12 -0
- package/lib/shared/components/Search/index.js +1 -0
- package/lib/shared/components/Select/Select.js +90 -0
- package/lib/shared/components/Select/index.js +1 -0
- package/lib/shared/components/Sidebar/Sidebar.js +42 -0
- package/lib/shared/components/Sidebar/index.js +1 -0
- package/lib/shared/components/SlideOver/SlideOver.js +81 -0
- package/lib/shared/components/SlideOver/index.js +1 -0
- package/lib/shared/components/Slider/Slider.js +80 -0
- package/lib/shared/components/Slider/index.js +1 -0
- package/lib/shared/components/Stepper/Stepper.js +32 -0
- package/lib/shared/components/Stepper/index.js +1 -0
- package/lib/shared/components/Steps/Steps.js +53 -0
- package/lib/shared/components/Steps/index.js +1 -0
- package/lib/shared/components/Switch/Switch.js +26 -0
- package/lib/shared/components/Switch/index.js +1 -0
- package/lib/shared/components/Tab/Tab.js +59 -0
- package/lib/shared/components/Tab/index.js +1 -0
- package/lib/shared/components/Table/Table.js +47 -0
- package/lib/shared/components/Table/index.js +1 -0
- package/lib/shared/components/Text/Text.js +11 -0
- package/lib/shared/components/Text/index.js +1 -0
- package/lib/shared/components/TextList/TextList.js +15 -0
- package/lib/shared/components/TextList/index.js +1 -0
- package/lib/shared/components/TimePicker/TimePicker.js +161 -0
- package/lib/shared/components/TimePicker/index.js +1 -0
- package/lib/shared/components/Tooltip/Tooltip.js +13 -0
- package/lib/shared/components/Tooltip/index.js +1 -0
- package/lib/shared/components/Uploader/Uploader.js +63 -0
- package/lib/shared/components/Uploader/index.js +1 -0
- package/lib/shared/components/Video/Video.js +20 -0
- package/lib/shared/components/Video/index.js +1 -0
- package/lib/shared/components/index.d.js +0 -0
- package/lib/shared/components/index.js +50 -0
- package/lib/shared/elements/Color/ColorPallet.js +20 -0
- package/lib/shared/elements/Color/index.js +1 -0
- package/lib/shared/elements/Text.js +37 -0
- package/lib/shared/elements/index.js +1 -0
- package/lib/shared/helpers/FakeLink.js +8 -0
- package/lib/shared/helpers/constants.js +359 -0
- package/lib/shared/helpers/index.js +2 -0
- package/lib/shared/helpers/isEqual.js +56 -0
- package/lib/shared/index.d.js +0 -0
- package/lib/shared/index.js +1 -0
- package/lib/shared/stories/components/Avatar.stories.js +17 -0
- package/lib/shared/stories/components/Badge.stories.dev.js +37 -0
- package/lib/shared/stories/components/Button.stories.js +553 -0
- package/lib/shared/stories/components/Calendar.stories.js +62 -0
- package/lib/shared/stories/components/Cartel.stories.js +32 -0
- package/lib/shared/stories/components/Checkbox.stories.js +15 -0
- package/lib/shared/stories/components/ColorChecker.stories.dev.js +16 -0
- package/lib/shared/stories/components/DateTime.stories.js +27 -0
- package/lib/shared/stories/components/Disclosure.stories.js +30 -0
- package/lib/shared/stories/components/Dropdown.stories.js +39 -0
- package/lib/shared/stories/components/Form/Default.stories.js +201 -0
- package/lib/shared/stories/components/Form/DummyForm.stories.js +48 -0
- package/lib/shared/stories/components/Form/DynamicForm.stories.js +155 -0
- package/lib/shared/stories/components/Form/StepperForm.stories.js +138 -0
- package/lib/shared/stories/components/Form/ValidateForm.stories.js +70 -0
- package/lib/shared/stories/components/Form/Validation.stories.js +184 -0
- package/lib/shared/stories/components/GroupItems.stories.js +23 -0
- package/lib/shared/stories/components/Header.stories.js +29 -0
- package/lib/shared/stories/components/Heading.stories.js +27 -0
- package/lib/shared/stories/components/Icon.stories.js +22 -0
- package/lib/shared/stories/components/Image.stories.js +23 -0
- package/lib/shared/stories/components/Input/Checkbox.stories.js +45 -0
- package/lib/shared/stories/components/Input/DatePicker.stories.js +23 -0
- package/lib/shared/stories/components/Input/Defaut.stories.js +24 -0
- package/lib/shared/stories/components/Input/Number.stories.js +24 -0
- package/lib/shared/stories/components/Input/RCI.stories.js +59 -0
- package/lib/shared/stories/components/Input/Radiobox.stories.dev.js +28 -0
- package/lib/shared/stories/components/Input/Select.stories.dev.js +27 -0
- package/lib/shared/stories/components/Input/SelectMultiple.stories.dev.js +510 -0
- package/lib/shared/stories/components/Input/Textarea.stories.js +24 -0
- package/lib/shared/stories/components/List.stories.js +34 -0
- package/lib/shared/stories/components/Loader.stories.js +15 -0
- package/lib/shared/stories/components/Modal.stories.js +50 -0
- package/lib/shared/stories/components/Notification.stories.js +22 -0
- package/lib/shared/stories/components/Person.stories.js +41 -0
- package/lib/shared/stories/components/Picker.stories.js +15 -0
- package/lib/shared/stories/components/Popover.stories.js +36 -0
- package/lib/shared/stories/components/QRCode.stories.js +20 -0
- package/lib/shared/stories/components/RadioGroup.stories.js +56 -0
- package/lib/shared/stories/components/Select.stories.js +50 -0
- package/lib/shared/stories/components/Sidebar.stories.js +35 -0
- package/lib/shared/stories/components/Slider.stories.dev.js +48 -0
- package/lib/shared/stories/components/Stepper/Stepper.stories.js +38 -0
- package/lib/shared/stories/components/Steps.stories.js +15 -0
- package/lib/shared/stories/components/Switch.stories.js +15 -0
- package/lib/shared/stories/components/Tab.stories.js +15 -0
- package/lib/shared/stories/components/Table.stories.js +95 -0
- package/lib/shared/stories/components/TextList.stories.js +23 -0
- package/lib/shared/stories/components/Tooltip.stories.dev.js +40 -0
- package/lib/shared/stories/elements/Color.stories.js +269 -0
- package/lib/shared/stories/elements/Text.stories.js +45 -0
- package/lib/shared/types/index.js +1 -0
- package/lib/stories/Foundation/BrandIdentity.prod.stories.js +510 -0
- package/lib/stories/Foundation/Logo.stories.js +19 -0
- package/lib/stories/Foundation/RisingSun.stories.js +16 -0
- package/lib/stories/Foundation/Shadows.stories.js +601 -0
- package/lib/stories/Foundation/Symbol.stories.js +18 -0
- package/lib/stories/HeroContainer.stories.js +18 -0
- package/lib/styles/accessibilityTokens.js +72 -0
- package/lib/styles/borderWidth.js +10 -0
- package/lib/styles/colors.js +303 -0
- package/lib/styles/elevation.js +240 -0
- package/lib/styles/icons.js +218 -0
- package/lib/styles/index.js +29 -0
- package/lib/styles/motion.js +668 -0
- package/lib/styles/opacity.js +10 -0
- package/lib/styles/radius.js +11 -0
- package/lib/styles/sizing.js +35 -0
- package/lib/styles/space.js +24 -0
- package/lib/styles/theme/darkTheme.js +471 -0
- package/lib/styles/theme/index.js +44 -0
- package/lib/styles/theme/lightTheme.js +480 -0
- package/lib/styles/theme/themeTypes.js +1 -0
- package/lib/styles/theme/themeUtils.js +63 -0
- package/lib/styles/typography-advanced.js +510 -0
- package/lib/styles/typography.js +1419 -0
- package/lib/styles/zIndex.js +19 -0
- package/lib/tokens/borders.js +161 -0
- package/lib/tokens/colors.js +426 -0
- package/lib/tokens/components.js +499 -0
- package/lib/tokens/index.js +84 -0
- package/lib/tokens/lighting.js +384 -0
- package/lib/tokens/motion.js +284 -0
- package/lib/tokens/semantic.js +367 -0
- package/lib/tokens/shadows.js +114 -0
- package/lib/tokens/spacing.js +189 -0
- package/lib/tokens/typography.js +268 -0
- package/package.json +176 -0
- package/styles/generated-tokens.css +677 -0
- package/styles/index.css +2 -0
- package/styles/main.css +610 -0
- package/tailwind.config.js +64 -0
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* MetricCard
|
|
3
|
+
*
|
|
4
|
+
* Display key metrics and KPIs with trend indicators.
|
|
5
|
+
* Perfect for dashboards and analytics displays.
|
|
6
|
+
*
|
|
7
|
+
* @example
|
|
8
|
+
* <MetricCard
|
|
9
|
+
* label="API Requests"
|
|
10
|
+
* value="1.2M"
|
|
11
|
+
* trend="+12%"
|
|
12
|
+
* trendDirection=": "
|
|
13
|
+
* icon=", "
|
|
14
|
+
* />
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
import React from 'react';
|
|
18
|
+
import clsx from 'clsx';
|
|
19
|
+
export var MetricCard = function MetricCard(_ref) {
|
|
20
|
+
var label = _ref.label,
|
|
21
|
+
value = _ref.value,
|
|
22
|
+
trend = _ref.trend,
|
|
23
|
+
_ref$trendDirection = _ref.trendDirection,
|
|
24
|
+
trendDirection = _ref$trendDirection === void 0 ? 'neutral' : _ref$trendDirection,
|
|
25
|
+
icon = _ref.icon,
|
|
26
|
+
comparison = _ref.comparison,
|
|
27
|
+
_ref$loading = _ref.loading,
|
|
28
|
+
loading = _ref$loading === void 0 ? false : _ref$loading,
|
|
29
|
+
_ref$variant = _ref.variant,
|
|
30
|
+
variant = _ref$variant === void 0 ? 'default' : _ref$variant,
|
|
31
|
+
className = _ref.className,
|
|
32
|
+
onClick = _ref.onClick;
|
|
33
|
+
var cardClasses = clsx('metric-card', 'bg-white', 'rounded-lg', 'border', 'border-gray-200', 'transition-all', 'duration-200', {
|
|
34
|
+
'p-6': variant === 'default' || variant === 'detailed',
|
|
35
|
+
'p-4': variant === 'compact',
|
|
36
|
+
'hover:shadow-md hover:border-primary-300 cursor-pointer': onClick,
|
|
37
|
+
'shadow-sm': !onClick
|
|
38
|
+
}, className);
|
|
39
|
+
var trendClasses = clsx('metric-card__trend', 'text-sm', 'font-medium', 'flex', 'items-center', 'gap-1', {
|
|
40
|
+
'text-green-600': trendDirection === 'up',
|
|
41
|
+
'text-red-600': trendDirection === 'down',
|
|
42
|
+
'text-gray-600': trendDirection === 'neutral'
|
|
43
|
+
});
|
|
44
|
+
var trendIcon = trendDirection === 'up' ? '↑' : trendDirection === 'down' ? '↓' : '→';
|
|
45
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
46
|
+
className: cardClasses,
|
|
47
|
+
onClick: onClick
|
|
48
|
+
}, loading ? /*#__PURE__*/React.createElement("div", {
|
|
49
|
+
className: "flex items-center justify-center py-8"
|
|
50
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
51
|
+
className: "animate-spin rounded-full h-6 w-6 border-b-2 border-primary-500"
|
|
52
|
+
})) : /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
|
|
53
|
+
className: "metric-card__header flex items-start justify-between mb-2"
|
|
54
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
55
|
+
className: "flex-1"
|
|
56
|
+
}, /*#__PURE__*/React.createElement("p", {
|
|
57
|
+
className: "text-sm font-medium text-gray-600 uppercase tracking-wide"
|
|
58
|
+
}, label)), icon && /*#__PURE__*/React.createElement("div", {
|
|
59
|
+
className: "metric-card__icon text-2xl ml-2"
|
|
60
|
+
}, icon)), /*#__PURE__*/React.createElement("div", {
|
|
61
|
+
className: "metric-card__value mb-2"
|
|
62
|
+
}, /*#__PURE__*/React.createElement("p", {
|
|
63
|
+
className: clsx('font-bold text-gray-900', {
|
|
64
|
+
'text-4xl': variant === 'default' || variant === 'detailed',
|
|
65
|
+
'text-2xl': variant === 'compact'
|
|
66
|
+
})
|
|
67
|
+
}, value)), (trend || comparison) && /*#__PURE__*/React.createElement("div", {
|
|
68
|
+
className: "metric-card__footer flex items-center gap-3"
|
|
69
|
+
}, trend && /*#__PURE__*/React.createElement("div", {
|
|
70
|
+
className: trendClasses
|
|
71
|
+
}, /*#__PURE__*/React.createElement("span", null, trendIcon), /*#__PURE__*/React.createElement("span", null, trend)), comparison && /*#__PURE__*/React.createElement("p", {
|
|
72
|
+
className: "text-xs text-gray-500"
|
|
73
|
+
}, comparison)), variant === 'detailed' && /*#__PURE__*/React.createElement("div", {
|
|
74
|
+
className: "metric-card__details mt-4 pt-4 border-t border-gray-100"
|
|
75
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
76
|
+
className: "flex items-center justify-between text-xs text-gray-600"
|
|
77
|
+
}, /*#__PURE__*/React.createElement("span", null, "View details"), /*#__PURE__*/React.createElement("span", null, "\u2192")))));
|
|
78
|
+
};
|
|
79
|
+
MetricCard.displayName = 'MetricCard';
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Console Data Components
|
|
3
|
+
*
|
|
4
|
+
* Data display components for the Nobak Developer Console
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
export { MetricCard } from "./MetricCard";
|
|
8
|
+
export { DataTable } from "./DataTable";
|
|
9
|
+
|
|
10
|
+
// export { ActivityFeed } from './ActivityFeed';
|
|
11
|
+
// export { LogViewer } from './LogViewer';
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Console Documentation Components
|
|
3
|
+
*
|
|
4
|
+
* Documentation and help components
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
// Export documentation components here
|
|
8
|
+
// export { DocumentationViewer } from './DocumentationViewer';
|
|
9
|
+
// export { TooltipHelp } from './TooltipHelp';
|
|
10
|
+
// export { OnboardingWizard } from './OnboardingWizard';
|
|
@@ -0,0 +1,261 @@
|
|
|
1
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
2
|
+
function _toConsumableArray(r) { return _arrayWithoutHoles(r) || _iterableToArray(r) || _unsupportedIterableToArray(r) || _nonIterableSpread(); }
|
|
3
|
+
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
4
|
+
function _iterableToArray(r) { if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r); }
|
|
5
|
+
function _arrayWithoutHoles(r) { if (Array.isArray(r)) return _arrayLikeToArray(r); }
|
|
6
|
+
function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return r; }; var t, r = {}, e = Object.prototype, n = e.hasOwnProperty, o = "function" == typeof Symbol ? Symbol : {}, i = o.iterator || "@@iterator", a = o.asyncIterator || "@@asyncIterator", u = o.toStringTag || "@@toStringTag"; function c(t, r, e, n) { return Object.defineProperty(t, r, { value: e, enumerable: !n, configurable: !n, writable: !n }); } try { c({}, ""); } catch (t) { c = function c(t, r, e) { return t[r] = e; }; } function h(r, e, n, o) { var i = e && e.prototype instanceof Generator ? e : Generator, a = Object.create(i.prototype); return c(a, "_invoke", function (r, e, n) { var o = 1; return function (i, a) { if (3 === o) throw Error("Generator is already running"); if (4 === o) { if ("throw" === i) throw a; return { value: t, done: !0 }; } for (n.method = i, n.arg = a;;) { var u = n.delegate; if (u) { var c = d(u, n); if (c) { if (c === f) continue; return c; } } if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) { if (1 === o) throw o = 4, n.arg; n.dispatchException(n.arg); } else "return" === n.method && n.abrupt("return", n.arg); o = 3; var h = s(r, e, n); if ("normal" === h.type) { if (o = n.done ? 4 : 2, h.arg === f) continue; return { value: h.arg, done: n.done }; } "throw" === h.type && (o = 4, n.method = "throw", n.arg = h.arg); } }; }(r, n, new Context(o || [])), !0), a; } function s(t, r, e) { try { return { type: "normal", arg: t.call(r, e) }; } catch (t) { return { type: "throw", arg: t }; } } r.wrap = h; var f = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var l = {}; c(l, i, function () { return this; }); var p = Object.getPrototypeOf, y = p && p(p(x([]))); y && y !== e && n.call(y, i) && (l = y); var v = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(l); function g(t) { ["next", "throw", "return"].forEach(function (r) { c(t, r, function (t) { return this._invoke(r, t); }); }); } function AsyncIterator(t, r) { function e(o, i, a, u) { var c = s(t[o], t, i); if ("throw" !== c.type) { var h = c.arg, f = h.value; return f && "object" == _typeof(f) && n.call(f, "__await") ? r.resolve(f.__await).then(function (t) { e("next", t, a, u); }, function (t) { e("throw", t, a, u); }) : r.resolve(f).then(function (t) { h.value = t, a(h); }, function (t) { return e("throw", t, a, u); }); } u(c.arg); } var o; c(this, "_invoke", function (t, n) { function i() { return new r(function (r, o) { e(t, n, r, o); }); } return o = o ? o.then(i, i) : i(); }, !0); } function d(r, e) { var n = e.method, o = r.i[n]; if (o === t) return e.delegate = null, "throw" === n && r.i["return"] && (e.method = "return", e.arg = t, d(r, e), "throw" === e.method) || "return" !== n && (e.method = "throw", e.arg = new TypeError("The iterator does not provide a '" + n + "' method")), f; var i = s(o, r.i, e.arg); if ("throw" === i.type) return e.method = "throw", e.arg = i.arg, e.delegate = null, f; var a = i.arg; return a ? a.done ? (e[r.r] = a.value, e.next = r.n, "return" !== e.method && (e.method = "next", e.arg = t), e.delegate = null, f) : a : (e.method = "throw", e.arg = new TypeError("iterator result is not an object"), e.delegate = null, f); } function w(t) { this.tryEntries.push(t); } function m(r) { var e = r[4] || {}; e.type = "normal", e.arg = t, r[4] = e; } function Context(t) { this.tryEntries = [[-1]], t.forEach(w, this), this.reset(!0); } function x(r) { if (null != r) { var e = r[i]; if (e) return e.call(r); if ("function" == typeof r.next) return r; if (!isNaN(r.length)) { var o = -1, a = function e() { for (; ++o < r.length;) if (n.call(r, o)) return e.value = r[o], e.done = !1, e; return e.value = t, e.done = !0, e; }; return a.next = a; } } throw new TypeError(_typeof(r) + " is not iterable"); } return GeneratorFunction.prototype = GeneratorFunctionPrototype, c(v, "constructor", GeneratorFunctionPrototype), c(GeneratorFunctionPrototype, "constructor", GeneratorFunction), GeneratorFunction.displayName = c(GeneratorFunctionPrototype, u, "GeneratorFunction"), r.isGeneratorFunction = function (t) { var r = "function" == typeof t && t.constructor; return !!r && (r === GeneratorFunction || "GeneratorFunction" === (r.displayName || r.name)); }, r.mark = function (t) { return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, c(t, u, "GeneratorFunction")), t.prototype = Object.create(v), t; }, r.awrap = function (t) { return { __await: t }; }, g(AsyncIterator.prototype), c(AsyncIterator.prototype, a, function () { return this; }), r.AsyncIterator = AsyncIterator, r.async = function (t, e, n, o, i) { void 0 === i && (i = Promise); var a = new AsyncIterator(h(t, e, n, o), i); return r.isGeneratorFunction(e) ? a : a.next().then(function (t) { return t.done ? t.value : a.next(); }); }, g(v), c(v, u, "Generator"), c(v, i, function () { return this; }), c(v, "toString", function () { return "[object Generator]"; }), r.keys = function (t) { var r = Object(t), e = []; for (var n in r) e.unshift(n); return function t() { for (; e.length;) if ((n = e.pop()) in r) return t.value = n, t.done = !1, t; return t.done = !0, t; }; }, r.values = x, Context.prototype = { constructor: Context, reset: function reset(r) { if (this.prev = this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = "next", this.arg = t, this.tryEntries.forEach(m), !r) for (var e in this) "t" === e.charAt(0) && n.call(this, e) && !isNaN(+e.slice(1)) && (this[e] = t); }, stop: function stop() { this.done = !0; var t = this.tryEntries[0][4]; if ("throw" === t.type) throw t.arg; return this.rval; }, dispatchException: function dispatchException(r) { if (this.done) throw r; var e = this; function n(t) { a.type = "throw", a.arg = r, e.next = t; } for (var o = e.tryEntries.length - 1; o >= 0; --o) { var i = this.tryEntries[o], a = i[4], u = this.prev, c = i[1], h = i[2]; if (-1 === i[0]) return n("end"), !1; if (!c && !h) throw Error("try statement without catch or finally"); if (null != i[0] && i[0] <= u) { if (u < c) return this.method = "next", this.arg = t, n(c), !0; if (u < h) return n(h), !1; } } }, abrupt: function abrupt(t, r) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var n = this.tryEntries[e]; if (n[0] > -1 && n[0] <= this.prev && this.prev < n[2]) { var o = n; break; } } o && ("break" === t || "continue" === t) && o[0] <= r && r <= o[2] && (o = null); var i = o ? o[4] : {}; return i.type = t, i.arg = r, o ? (this.method = "next", this.next = o[2], f) : this.complete(i); }, complete: function complete(t, r) { if ("throw" === t.type) throw t.arg; return "break" === t.type || "continue" === t.type ? this.next = t.arg : "return" === t.type ? (this.rval = this.arg = t.arg, this.method = "return", this.next = "end") : "normal" === t.type && r && (this.next = r), f; }, finish: function finish(t) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var e = this.tryEntries[r]; if (e[2] === t) return this.complete(e[4], e[3]), m(e), f; } }, "catch": function _catch(t) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var e = this.tryEntries[r]; if (e[0] === t) { var n = e[4]; if ("throw" === n.type) { var o = n.arg; m(e); } return o; } } throw Error("illegal catch attempt"); }, delegateYield: function delegateYield(r, e, n) { return this.delegate = { i: x(r), r: e, n: n }, "next" === this.method && (this.arg = t), f; } }, r; }
|
|
7
|
+
function asyncGeneratorStep(n, t, e, r, o, a, c) { try { var i = n[a](c), u = i.value; } catch (n) { return void e(n); } i.done ? t(u) : Promise.resolve(u).then(r, o); }
|
|
8
|
+
function _asyncToGenerator(n) { return function () { var t = this, e = arguments; return new Promise(function (r, o) { var a = n.apply(t, e); function _next(n) { asyncGeneratorStep(a, r, o, _next, _throw, "next", n); } function _throw(n) { asyncGeneratorStep(a, r, o, _next, _throw, "throw", n); } _next(void 0); }); }; }
|
|
9
|
+
function _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); }
|
|
10
|
+
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
11
|
+
function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
|
|
12
|
+
function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
|
|
13
|
+
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
|
14
|
+
function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
|
|
15
|
+
/**
|
|
16
|
+
* APIKeyGenerator
|
|
17
|
+
*
|
|
18
|
+
* Create and manage API keys with scope selection and expiration.
|
|
19
|
+
* Includes copy-to-clipboard functionality and key regeneration.
|
|
20
|
+
*
|
|
21
|
+
* @example
|
|
22
|
+
* <APIKeyGenerator
|
|
23
|
+
* onGenerate={handleGenerate}
|
|
24
|
+
* scopes={availableScopes}
|
|
25
|
+
* />
|
|
26
|
+
*/
|
|
27
|
+
|
|
28
|
+
import React, { useState } from 'react';
|
|
29
|
+
import clsx from 'clsx';
|
|
30
|
+
export var APIKeyGenerator = function APIKeyGenerator(_ref) {
|
|
31
|
+
var _ref$scopes = _ref.scopes,
|
|
32
|
+
scopes = _ref$scopes === void 0 ? [] : _ref$scopes,
|
|
33
|
+
onGenerate = _ref.onGenerate,
|
|
34
|
+
existingKey = _ref.existingKey,
|
|
35
|
+
_ref$loading = _ref.loading,
|
|
36
|
+
loading = _ref$loading === void 0 ? false : _ref$loading,
|
|
37
|
+
className = _ref.className;
|
|
38
|
+
var _useState = useState(''),
|
|
39
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
40
|
+
name = _useState2[0],
|
|
41
|
+
setName = _useState2[1];
|
|
42
|
+
var _useState3 = useState(''),
|
|
43
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
44
|
+
description = _useState4[0],
|
|
45
|
+
setDescription = _useState4[1];
|
|
46
|
+
var _useState5 = useState([]),
|
|
47
|
+
_useState6 = _slicedToArray(_useState5, 2),
|
|
48
|
+
selectedScopes = _useState6[0],
|
|
49
|
+
setSelectedScopes = _useState6[1];
|
|
50
|
+
var _useState7 = useState(''),
|
|
51
|
+
_useState8 = _slicedToArray(_useState7, 2),
|
|
52
|
+
expiresAt = _useState8[0],
|
|
53
|
+
setExpiresAt = _useState8[1];
|
|
54
|
+
var _useState9 = useState(existingKey || ''),
|
|
55
|
+
_useState0 = _slicedToArray(_useState9, 2),
|
|
56
|
+
generatedKey = _useState0[0],
|
|
57
|
+
setGeneratedKey = _useState0[1];
|
|
58
|
+
var _useState1 = useState(false),
|
|
59
|
+
_useState10 = _slicedToArray(_useState1, 2),
|
|
60
|
+
copied = _useState10[0],
|
|
61
|
+
setCopied = _useState10[1];
|
|
62
|
+
var _useState11 = useState(false),
|
|
63
|
+
_useState12 = _slicedToArray(_useState11, 2),
|
|
64
|
+
showKey = _useState12[0],
|
|
65
|
+
setShowKey = _useState12[1];
|
|
66
|
+
var handleGenerate = /*#__PURE__*/function () {
|
|
67
|
+
var _ref2 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
|
68
|
+
var result;
|
|
69
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
70
|
+
while (1) switch (_context.prev = _context.next) {
|
|
71
|
+
case 0:
|
|
72
|
+
if (!(!onGenerate || !name)) {
|
|
73
|
+
_context.next = 2;
|
|
74
|
+
break;
|
|
75
|
+
}
|
|
76
|
+
return _context.abrupt("return");
|
|
77
|
+
case 2:
|
|
78
|
+
_context.prev = 2;
|
|
79
|
+
_context.next = 5;
|
|
80
|
+
return onGenerate({
|
|
81
|
+
name: name,
|
|
82
|
+
description: description,
|
|
83
|
+
scopes: selectedScopes,
|
|
84
|
+
expiresAt: expiresAt || undefined
|
|
85
|
+
});
|
|
86
|
+
case 5:
|
|
87
|
+
result = _context.sent;
|
|
88
|
+
setGeneratedKey(result.key);
|
|
89
|
+
setShowKey(true);
|
|
90
|
+
_context.next = 13;
|
|
91
|
+
break;
|
|
92
|
+
case 10:
|
|
93
|
+
_context.prev = 10;
|
|
94
|
+
_context.t0 = _context["catch"](2);
|
|
95
|
+
console.error('Failed to generate API key:', _context.t0);
|
|
96
|
+
case 13:
|
|
97
|
+
case "end":
|
|
98
|
+
return _context.stop();
|
|
99
|
+
}
|
|
100
|
+
}, _callee, null, [[2, 10]]);
|
|
101
|
+
}));
|
|
102
|
+
return function handleGenerate() {
|
|
103
|
+
return _ref2.apply(this, arguments);
|
|
104
|
+
};
|
|
105
|
+
}();
|
|
106
|
+
var handleCopy = /*#__PURE__*/function () {
|
|
107
|
+
var _ref3 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
|
|
108
|
+
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
109
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
110
|
+
case 0:
|
|
111
|
+
if (generatedKey) {
|
|
112
|
+
_context2.next = 2;
|
|
113
|
+
break;
|
|
114
|
+
}
|
|
115
|
+
return _context2.abrupt("return");
|
|
116
|
+
case 2:
|
|
117
|
+
_context2.prev = 2;
|
|
118
|
+
_context2.next = 5;
|
|
119
|
+
return navigator.clipboard.writeText(generatedKey);
|
|
120
|
+
case 5:
|
|
121
|
+
setCopied(true);
|
|
122
|
+
setTimeout(function () {
|
|
123
|
+
return setCopied(false);
|
|
124
|
+
}, 2000);
|
|
125
|
+
_context2.next = 12;
|
|
126
|
+
break;
|
|
127
|
+
case 9:
|
|
128
|
+
_context2.prev = 9;
|
|
129
|
+
_context2.t0 = _context2["catch"](2);
|
|
130
|
+
console.error('Failed to copy:', _context2.t0);
|
|
131
|
+
case 12:
|
|
132
|
+
case "end":
|
|
133
|
+
return _context2.stop();
|
|
134
|
+
}
|
|
135
|
+
}, _callee2, null, [[2, 9]]);
|
|
136
|
+
}));
|
|
137
|
+
return function handleCopy() {
|
|
138
|
+
return _ref3.apply(this, arguments);
|
|
139
|
+
};
|
|
140
|
+
}();
|
|
141
|
+
var toggleScope = function toggleScope(scopeId) {
|
|
142
|
+
if (selectedScopes.includes(scopeId)) {
|
|
143
|
+
setSelectedScopes(selectedScopes.filter(function (id) {
|
|
144
|
+
return id !== scopeId;
|
|
145
|
+
}));
|
|
146
|
+
} else {
|
|
147
|
+
setSelectedScopes([].concat(_toConsumableArray(selectedScopes), [scopeId]));
|
|
148
|
+
}
|
|
149
|
+
};
|
|
150
|
+
var isValid = name.trim().length > 0 && selectedScopes.length > 0;
|
|
151
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
152
|
+
className: clsx('api-key-generator', 'space-y-6', className)
|
|
153
|
+
}, generatedKey && showKey && /*#__PURE__*/React.createElement("div", {
|
|
154
|
+
className: "bg-green-50 border border-green-200 rounded-lg p-6"
|
|
155
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
156
|
+
className: "flex items-start justify-between mb-4"
|
|
157
|
+
}, /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("h3", {
|
|
158
|
+
className: "text-lg font-semibold text-green-900 mb-1"
|
|
159
|
+
}, "\u2705 API Key Generated"), /*#__PURE__*/React.createElement("p", {
|
|
160
|
+
className: "text-sm text-green-700"
|
|
161
|
+
}, "Save this key securely. You won't be able to see it again.")), /*#__PURE__*/React.createElement("button", {
|
|
162
|
+
onClick: function onClick() {
|
|
163
|
+
return setShowKey(false);
|
|
164
|
+
},
|
|
165
|
+
className: "text-green-600 hover:text-green-800"
|
|
166
|
+
}, "\u2715")), /*#__PURE__*/React.createElement("div", {
|
|
167
|
+
className: "bg-white border border-green-300 rounded-lg p-4 font-mono text-sm break-all"
|
|
168
|
+
}, generatedKey), /*#__PURE__*/React.createElement("button", {
|
|
169
|
+
onClick: handleCopy,
|
|
170
|
+
className: "mt-4 w-full px-4 py-2 bg-green-600 text-white rounded-lg hover:bg-green-700 transition-colors"
|
|
171
|
+
}, copied ? '✓ Copied!' : '📋 Copy to Clipboard')), /*#__PURE__*/React.createElement("div", {
|
|
172
|
+
className: "space-y-4"
|
|
173
|
+
}, /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("label", {
|
|
174
|
+
className: "block text-sm font-medium text-gray-700 mb-2"
|
|
175
|
+
}, "Key Name ", /*#__PURE__*/React.createElement("span", {
|
|
176
|
+
className: "text-red-500"
|
|
177
|
+
}, "*")), /*#__PURE__*/React.createElement("input", {
|
|
178
|
+
type: "text",
|
|
179
|
+
value: name,
|
|
180
|
+
onChange: function onChange(e) {
|
|
181
|
+
return setName(e.target.value);
|
|
182
|
+
},
|
|
183
|
+
placeholder: "e.g., Production API Key",
|
|
184
|
+
className: "w-full px-4 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-primary-500 focus:border-primary-500",
|
|
185
|
+
disabled: loading
|
|
186
|
+
})), /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("label", {
|
|
187
|
+
className: "block text-sm font-medium text-gray-700 mb-2"
|
|
188
|
+
}, "Description (Optional)"), /*#__PURE__*/React.createElement("textarea", {
|
|
189
|
+
value: description,
|
|
190
|
+
onChange: function onChange(e) {
|
|
191
|
+
return setDescription(e.target.value);
|
|
192
|
+
},
|
|
193
|
+
placeholder: "What will this key be used for?",
|
|
194
|
+
rows: 3,
|
|
195
|
+
className: "w-full px-4 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-primary-500 focus:border-primary-500",
|
|
196
|
+
disabled: loading
|
|
197
|
+
})), scopes.length > 0 && /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("label", {
|
|
198
|
+
className: "block text-sm font-medium text-gray-700 mb-2"
|
|
199
|
+
}, "Permissions ", /*#__PURE__*/React.createElement("span", {
|
|
200
|
+
className: "text-red-500"
|
|
201
|
+
}, "*")), /*#__PURE__*/React.createElement("div", {
|
|
202
|
+
className: "space-y-2 border border-gray-200 rounded-lg p-4 max-h-64 overflow-y-auto"
|
|
203
|
+
}, scopes.map(function (scope) {
|
|
204
|
+
return /*#__PURE__*/React.createElement("label", {
|
|
205
|
+
key: scope.id,
|
|
206
|
+
className: "flex items-start gap-3 p-3 rounded-lg hover:bg-gray-50 cursor-pointer transition-colors"
|
|
207
|
+
}, /*#__PURE__*/React.createElement("input", {
|
|
208
|
+
type: "checkbox",
|
|
209
|
+
checked: selectedScopes.includes(scope.id),
|
|
210
|
+
onChange: function onChange() {
|
|
211
|
+
return toggleScope(scope.id);
|
|
212
|
+
},
|
|
213
|
+
className: "mt-1 rounded border-gray-300 text-primary-600 focus:ring-primary-500",
|
|
214
|
+
disabled: loading
|
|
215
|
+
}), /*#__PURE__*/React.createElement("div", {
|
|
216
|
+
className: "flex-1"
|
|
217
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
218
|
+
className: "font-medium text-gray-900"
|
|
219
|
+
}, scope.label), scope.description && /*#__PURE__*/React.createElement("div", {
|
|
220
|
+
className: "text-sm text-gray-600 mt-1"
|
|
221
|
+
}, scope.description)));
|
|
222
|
+
})), /*#__PURE__*/React.createElement("p", {
|
|
223
|
+
className: "text-xs text-gray-500 mt-2"
|
|
224
|
+
}, selectedScopes.length, " permission", selectedScopes.length !== 1 ? 's' : '', " selected")), /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("label", {
|
|
225
|
+
className: "block text-sm font-medium text-gray-700 mb-2"
|
|
226
|
+
}, "Expiration Date (Optional)"), /*#__PURE__*/React.createElement("input", {
|
|
227
|
+
type: "date",
|
|
228
|
+
value: expiresAt,
|
|
229
|
+
onChange: function onChange(e) {
|
|
230
|
+
return setExpiresAt(e.target.value);
|
|
231
|
+
},
|
|
232
|
+
min: new Date().toISOString().split('T')[0],
|
|
233
|
+
className: "w-full px-4 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-primary-500 focus:border-primary-500",
|
|
234
|
+
disabled: loading
|
|
235
|
+
}), /*#__PURE__*/React.createElement("p", {
|
|
236
|
+
className: "text-xs text-gray-500 mt-1"
|
|
237
|
+
}, "Leave empty for no expiration"))), /*#__PURE__*/React.createElement("div", {
|
|
238
|
+
className: "flex gap-3"
|
|
239
|
+
}, /*#__PURE__*/React.createElement("button", {
|
|
240
|
+
onClick: handleGenerate,
|
|
241
|
+
disabled: !isValid || loading,
|
|
242
|
+
className: clsx('flex-1 px-6 py-3 rounded-lg font-medium transition-colors', isValid && !loading ? 'bg-primary-500 text-white hover:bg-primary-600' : 'bg-gray-200 text-gray-400 cursor-not-allowed')
|
|
243
|
+
}, loading ? /*#__PURE__*/React.createElement("span", {
|
|
244
|
+
className: "flex items-center justify-center gap-2"
|
|
245
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
246
|
+
className: "animate-spin rounded-full h-4 w-4 border-b-2 border-white"
|
|
247
|
+
}), "Generating...") : '🔑 Generate API Key')), /*#__PURE__*/React.createElement("div", {
|
|
248
|
+
className: "bg-blue-50 border border-blue-200 rounded-lg p-4"
|
|
249
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
250
|
+
className: "flex gap-3"
|
|
251
|
+
}, /*#__PURE__*/React.createElement("span", {
|
|
252
|
+
className: "text-blue-600 text-xl"
|
|
253
|
+
}, "\u2139\uFE0F"), /*#__PURE__*/React.createElement("div", {
|
|
254
|
+
className: "flex-1"
|
|
255
|
+
}, /*#__PURE__*/React.createElement("h4", {
|
|
256
|
+
className: "font-medium text-blue-900 mb-1"
|
|
257
|
+
}, "Security Best Practices"), /*#__PURE__*/React.createElement("ul", {
|
|
258
|
+
className: "text-sm text-blue-800 space-y-1"
|
|
259
|
+
}, /*#__PURE__*/React.createElement("li", null, "\u2022 Store API keys securely (environment variables, secrets manager)"), /*#__PURE__*/React.createElement("li", null, "\u2022 Never commit keys to version control"), /*#__PURE__*/React.createElement("li", null, "\u2022 Use different keys for development and production"), /*#__PURE__*/React.createElement("li", null, "\u2022 Rotate keys regularly"), /*#__PURE__*/React.createElement("li", null, "\u2022 Grant minimum required permissions"))))));
|
|
260
|
+
};
|
|
261
|
+
APIKeyGenerator.displayName = 'APIKeyGenerator';
|
|
@@ -0,0 +1,210 @@
|
|
|
1
|
+
function _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); }
|
|
2
|
+
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
3
|
+
function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
|
|
4
|
+
function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
|
|
5
|
+
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
|
6
|
+
function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
|
|
7
|
+
/**
|
|
8
|
+
* SearchBar
|
|
9
|
+
*
|
|
10
|
+
* Global search component with autocomplete and keyboard shortcuts.
|
|
11
|
+
* Supports recent searches and quick filters.
|
|
12
|
+
*
|
|
13
|
+
* @example
|
|
14
|
+
* <SearchBar
|
|
15
|
+
* placeholder="Search API keys, logs, docs..."
|
|
16
|
+
* onSearch={handleSearch}
|
|
17
|
+
* suggestions={suggestions}
|
|
18
|
+
* />
|
|
19
|
+
*/
|
|
20
|
+
|
|
21
|
+
import React, { useState, useRef, useEffect } from 'react';
|
|
22
|
+
import clsx from 'clsx';
|
|
23
|
+
export var SearchBar = function SearchBar(_ref) {
|
|
24
|
+
var _ref$placeholder = _ref.placeholder,
|
|
25
|
+
placeholder = _ref$placeholder === void 0 ? 'Search...' : _ref$placeholder,
|
|
26
|
+
onSearch = _ref.onSearch,
|
|
27
|
+
_ref$suggestions = _ref.suggestions,
|
|
28
|
+
suggestions = _ref$suggestions === void 0 ? [] : _ref$suggestions,
|
|
29
|
+
_ref$recentSearches = _ref.recentSearches,
|
|
30
|
+
recentSearches = _ref$recentSearches === void 0 ? [] : _ref$recentSearches,
|
|
31
|
+
onClearRecent = _ref.onClearRecent,
|
|
32
|
+
_ref$loading = _ref.loading,
|
|
33
|
+
loading = _ref$loading === void 0 ? false : _ref$loading,
|
|
34
|
+
_ref$size = _ref.size,
|
|
35
|
+
size = _ref$size === void 0 ? 'medium' : _ref$size,
|
|
36
|
+
_ref$showShortcut = _ref.showShortcut,
|
|
37
|
+
showShortcut = _ref$showShortcut === void 0 ? true : _ref$showShortcut,
|
|
38
|
+
className = _ref.className;
|
|
39
|
+
var _useState = useState(''),
|
|
40
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
41
|
+
query = _useState2[0],
|
|
42
|
+
setQuery = _useState2[1];
|
|
43
|
+
var _useState3 = useState(false),
|
|
44
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
45
|
+
isFocused = _useState4[0],
|
|
46
|
+
setIsFocused = _useState4[1];
|
|
47
|
+
var _useState5 = useState(-1),
|
|
48
|
+
_useState6 = _slicedToArray(_useState5, 2),
|
|
49
|
+
selectedIndex = _useState6[0],
|
|
50
|
+
setSelectedIndex = _useState6[1];
|
|
51
|
+
var inputRef = useRef(null);
|
|
52
|
+
var dropdownRef = useRef(null);
|
|
53
|
+
var showDropdown = isFocused && (query.length > 0 || recentSearches.length > 0);
|
|
54
|
+
var filteredSuggestions = suggestions.filter(function (s) {
|
|
55
|
+
return s.label.toLowerCase().includes(query.toLowerCase());
|
|
56
|
+
});
|
|
57
|
+
|
|
58
|
+
// Keyboard shortcut (Cmd+K / Ctrl+K)
|
|
59
|
+
useEffect(function () {
|
|
60
|
+
var handleKeyDown = function handleKeyDown(e) {
|
|
61
|
+
if ((e.metaKey || e.ctrlKey) && e.key === 'k') {
|
|
62
|
+
var _inputRef$current;
|
|
63
|
+
e.preventDefault();
|
|
64
|
+
(_inputRef$current = inputRef.current) === null || _inputRef$current === void 0 || _inputRef$current.focus();
|
|
65
|
+
}
|
|
66
|
+
if (!isFocused) return;
|
|
67
|
+
|
|
68
|
+
// Arrow navigation
|
|
69
|
+
if (e.key === 'ArrowDown') {
|
|
70
|
+
e.preventDefault();
|
|
71
|
+
setSelectedIndex(function (i) {
|
|
72
|
+
return Math.min(i + 1, filteredSuggestions.length - 1);
|
|
73
|
+
});
|
|
74
|
+
} else if (e.key === 'ArrowUp') {
|
|
75
|
+
e.preventDefault();
|
|
76
|
+
setSelectedIndex(function (i) {
|
|
77
|
+
return Math.max(i - 1, -1);
|
|
78
|
+
});
|
|
79
|
+
} else if (e.key === 'Enter' && selectedIndex >= 0) {
|
|
80
|
+
e.preventDefault();
|
|
81
|
+
handleSelectSuggestion(filteredSuggestions[selectedIndex]);
|
|
82
|
+
} else if (e.key === 'Escape') {
|
|
83
|
+
var _inputRef$current2;
|
|
84
|
+
setIsFocused(false);
|
|
85
|
+
(_inputRef$current2 = inputRef.current) === null || _inputRef$current2 === void 0 || _inputRef$current2.blur();
|
|
86
|
+
}
|
|
87
|
+
};
|
|
88
|
+
window.addEventListener('keydown', handleKeyDown);
|
|
89
|
+
return function () {
|
|
90
|
+
return window.removeEventListener('keydown', handleKeyDown);
|
|
91
|
+
};
|
|
92
|
+
}, [isFocused, selectedIndex, filteredSuggestions]);
|
|
93
|
+
|
|
94
|
+
// Click outside to close
|
|
95
|
+
useEffect(function () {
|
|
96
|
+
var handleClickOutside = function handleClickOutside(e) {
|
|
97
|
+
var _inputRef$current3;
|
|
98
|
+
if (dropdownRef.current && !dropdownRef.current.contains(e.target) && !((_inputRef$current3 = inputRef.current) !== null && _inputRef$current3 !== void 0 && _inputRef$current3.contains(e.target))) {
|
|
99
|
+
setIsFocused(false);
|
|
100
|
+
}
|
|
101
|
+
};
|
|
102
|
+
document.addEventListener('mousedown', handleClickOutside);
|
|
103
|
+
return function () {
|
|
104
|
+
return document.removeEventListener('mousedown', handleClickOutside);
|
|
105
|
+
};
|
|
106
|
+
}, []);
|
|
107
|
+
var handleSearch = function handleSearch(searchQuery) {
|
|
108
|
+
onSearch === null || onSearch === void 0 || onSearch(searchQuery);
|
|
109
|
+
setIsFocused(false);
|
|
110
|
+
setQuery('');
|
|
111
|
+
};
|
|
112
|
+
var handleSelectSuggestion = function handleSelectSuggestion(suggestion) {
|
|
113
|
+
handleSearch(suggestion.label);
|
|
114
|
+
};
|
|
115
|
+
var handleSelectRecent = function handleSelectRecent(recent) {
|
|
116
|
+
setQuery(recent);
|
|
117
|
+
handleSearch(recent);
|
|
118
|
+
};
|
|
119
|
+
var inputClasses = clsx('w-full pl-10 pr-4 border border-gray-300 rounded-lg', 'focus:ring-2 focus:ring-primary-500 focus:border-primary-500', 'transition-all', {
|
|
120
|
+
'py-2 text-sm': size === 'small',
|
|
121
|
+
'py-3 text-base': size === 'medium',
|
|
122
|
+
'py-4 text-lg': size === 'large'
|
|
123
|
+
});
|
|
124
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
125
|
+
className: clsx('search-bar relative', className)
|
|
126
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
127
|
+
className: "relative"
|
|
128
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
129
|
+
className: "absolute left-3 top-1/2 -translate-y-1/2 text-gray-400"
|
|
130
|
+
}, loading ? /*#__PURE__*/React.createElement("div", {
|
|
131
|
+
className: "animate-spin rounded-full h-5 w-5 border-b-2 border-gray-400"
|
|
132
|
+
}) : /*#__PURE__*/React.createElement("span", {
|
|
133
|
+
className: "text-xl"
|
|
134
|
+
}, "\uD83D\uDD0D")), /*#__PURE__*/React.createElement("input", {
|
|
135
|
+
ref: inputRef,
|
|
136
|
+
type: "text",
|
|
137
|
+
value: query,
|
|
138
|
+
onChange: function onChange(e) {
|
|
139
|
+
return setQuery(e.target.value);
|
|
140
|
+
},
|
|
141
|
+
onFocus: function onFocus() {
|
|
142
|
+
return setIsFocused(true);
|
|
143
|
+
},
|
|
144
|
+
onKeyDown: function onKeyDown(e) {
|
|
145
|
+
if (e.key === 'Enter' && query.trim()) {
|
|
146
|
+
handleSearch(query);
|
|
147
|
+
}
|
|
148
|
+
},
|
|
149
|
+
placeholder: placeholder,
|
|
150
|
+
className: inputClasses
|
|
151
|
+
}), showShortcut && !isFocused && /*#__PURE__*/React.createElement("div", {
|
|
152
|
+
className: "absolute right-3 top-1/2 -translate-y-1/2"
|
|
153
|
+
}, /*#__PURE__*/React.createElement("kbd", {
|
|
154
|
+
className: "px-2 py-1 text-xs font-mono bg-gray-100 border border-gray-300 rounded"
|
|
155
|
+
}, "\u2318K")), query && /*#__PURE__*/React.createElement("button", {
|
|
156
|
+
onClick: function onClick() {
|
|
157
|
+
return setQuery('');
|
|
158
|
+
},
|
|
159
|
+
className: "absolute right-3 top-1/2 -translate-y-1/2 text-gray-400 hover:text-gray-600"
|
|
160
|
+
}, "\u2715")), showDropdown && /*#__PURE__*/React.createElement("div", {
|
|
161
|
+
ref: dropdownRef,
|
|
162
|
+
className: "absolute top-full left-0 right-0 mt-2 bg-white border border-gray-200 rounded-lg shadow-lg max-h-96 overflow-y-auto z-50"
|
|
163
|
+
}, query.length > 0 && filteredSuggestions.length > 0 && /*#__PURE__*/React.createElement("div", {
|
|
164
|
+
className: "py-2"
|
|
165
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
166
|
+
className: "px-4 py-2 text-xs font-medium text-gray-500 uppercase"
|
|
167
|
+
}, "Suggestions"), filteredSuggestions.map(function (suggestion, index) {
|
|
168
|
+
return /*#__PURE__*/React.createElement("button", {
|
|
169
|
+
key: suggestion.id,
|
|
170
|
+
onClick: function onClick() {
|
|
171
|
+
return handleSelectSuggestion(suggestion);
|
|
172
|
+
},
|
|
173
|
+
className: clsx('w-full px-4 py-2 text-left hover:bg-gray-50 flex items-center gap-3', {
|
|
174
|
+
'bg-primary-50': index === selectedIndex
|
|
175
|
+
})
|
|
176
|
+
}, suggestion.icon && /*#__PURE__*/React.createElement("span", {
|
|
177
|
+
className: "text-xl"
|
|
178
|
+
}, suggestion.icon), /*#__PURE__*/React.createElement("div", {
|
|
179
|
+
className: "flex-1"
|
|
180
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
181
|
+
className: "font-medium text-gray-900"
|
|
182
|
+
}, suggestion.label), suggestion.category && /*#__PURE__*/React.createElement("div", {
|
|
183
|
+
className: "text-xs text-gray-500"
|
|
184
|
+
}, suggestion.category)));
|
|
185
|
+
})), query.length === 0 && recentSearches.length > 0 && /*#__PURE__*/React.createElement("div", {
|
|
186
|
+
className: "py-2"
|
|
187
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
188
|
+
className: "px-4 py-2 flex items-center justify-between"
|
|
189
|
+
}, /*#__PURE__*/React.createElement("span", {
|
|
190
|
+
className: "text-xs font-medium text-gray-500 uppercase"
|
|
191
|
+
}, "Recent Searches"), onClearRecent && /*#__PURE__*/React.createElement("button", {
|
|
192
|
+
onClick: onClearRecent,
|
|
193
|
+
className: "text-xs text-gray-500 hover:text-gray-700"
|
|
194
|
+
}, "Clear")), recentSearches.map(function (recent, index) {
|
|
195
|
+
return /*#__PURE__*/React.createElement("button", {
|
|
196
|
+
key: index,
|
|
197
|
+
onClick: function onClick() {
|
|
198
|
+
return handleSelectRecent(recent);
|
|
199
|
+
},
|
|
200
|
+
className: "w-full px-4 py-2 text-left hover:bg-gray-50 flex items-center gap-3"
|
|
201
|
+
}, /*#__PURE__*/React.createElement("span", {
|
|
202
|
+
className: "text-gray-400"
|
|
203
|
+
}, "\uD83D\uDD50"), /*#__PURE__*/React.createElement("span", {
|
|
204
|
+
className: "text-gray-700"
|
|
205
|
+
}, recent));
|
|
206
|
+
})), query.length > 0 && filteredSuggestions.length === 0 && /*#__PURE__*/React.createElement("div", {
|
|
207
|
+
className: "px-4 py-8 text-center text-gray-500"
|
|
208
|
+
}, "No results found for \"", query, "\"")));
|
|
209
|
+
};
|
|
210
|
+
SearchBar.displayName = 'SearchBar';
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Console Form Components
|
|
3
|
+
*
|
|
4
|
+
* Form and input components for the Nobak Developer Console
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
export { APIKeyGenerator } from "./APIKeyGenerator";
|
|
8
|
+
export { SearchBar } from "./SearchBar";
|
|
9
|
+
|
|
10
|
+
// export { WebhookConfigurator } from './WebhookConfigurator';
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Nobak Developer Console Components
|
|
3
|
+
*
|
|
4
|
+
* Complete component library for the Nobak Developer Console
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
// Layout
|
|
8
|
+
export * from "./layout";
|
|
9
|
+
|
|
10
|
+
// Navigation
|
|
11
|
+
export * from "./navigation";
|
|
12
|
+
|
|
13
|
+
// Data
|
|
14
|
+
export * from "./data";
|
|
15
|
+
|
|
16
|
+
// Code
|
|
17
|
+
export * from "./code";
|
|
18
|
+
|
|
19
|
+
// Forms
|
|
20
|
+
export * from "./forms";
|
|
21
|
+
|
|
22
|
+
// Monitoring
|
|
23
|
+
export * from "./monitoring";
|
|
24
|
+
|
|
25
|
+
// Documentation
|
|
26
|
+
export * from "./documentation";
|
|
27
|
+
|
|
28
|
+
// Settings
|
|
29
|
+
export * from "./settings";
|