@react-ui-org/react-ui 0.64.1 → 0.65.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 +3 -6
- package/dist/react-ui.css +16 -16
- package/dist/react-ui.d.ts +1928 -0
- package/dist/react-ui.development.css +2916 -2915
- package/dist/react-ui.development.js +2019 -1051
- package/dist/react-ui.js +1 -1
- package/package.json +74 -70
- package/src/components/Alert/{Alert.jsx → Alert.tsx} +8 -43
- package/src/components/Alert/Alert.types.ts +34 -0
- package/src/components/Alert/README.md +1 -1
- package/src/components/Alert/index.ts +2 -0
- package/src/components/Badge/Badge.tsx +30 -0
- package/src/components/Badge/Badge.types.ts +24 -0
- package/src/components/Badge/README.md +1 -1
- package/src/components/Badge/index.ts +5 -0
- package/src/components/Button/Button.tsx +110 -0
- package/src/components/Button/Button.types.ts +93 -0
- package/src/components/Button/README.md +1 -1
- package/src/components/Button/helpers/{getRootLabelVisibilityClassName.js → getRootLabelVisibilityClassName.ts} +4 -1
- package/src/components/Button/index.ts +6 -0
- package/src/components/ButtonGroup/{ButtonGroup.jsx → ButtonGroup.tsx} +9 -40
- package/src/components/ButtonGroup/ButtonGroup.types.ts +45 -0
- package/src/components/ButtonGroup/ButtonGroupContext.ts +4 -0
- package/src/components/ButtonGroup/README.md +1 -1
- package/src/components/ButtonGroup/{index.js → index.ts} +4 -0
- package/src/components/Card/Card.tsx +33 -0
- package/src/components/Card/Card.types.ts +46 -0
- package/src/components/Card/{CardBody.jsx → CardBody.tsx} +4 -11
- package/src/components/Card/{CardFooter.jsx → CardFooter.tsx} +4 -15
- package/src/components/Card/README.md +6 -7
- package/src/components/Card/{index.js → index.ts} +5 -0
- package/src/components/CheckboxField/CheckboxField.tsx +81 -0
- package/src/components/CheckboxField/CheckboxField.types.ts +63 -0
- package/src/components/CheckboxField/README.md +67 -42
- package/src/components/CheckboxField/index.ts +5 -0
- package/src/components/FileInputField/{FileInputField.jsx → FileInputField.tsx} +42 -128
- package/src/components/FileInputField/FileInputField.types.ts +100 -0
- package/src/components/FileInputField/README.md +1 -1
- package/src/components/FileInputField/index.ts +6 -0
- package/src/components/FormLayout/FormLayout.module.scss +1 -1
- package/src/components/FormLayout/{FormLayout.jsx → FormLayout.tsx} +15 -50
- package/src/components/FormLayout/FormLayout.types.ts +55 -0
- package/src/components/FormLayout/FormLayoutContext.ts +4 -0
- package/src/components/FormLayout/{FormLayoutCustomField.jsx → FormLayoutCustomField.tsx} +10 -65
- package/src/components/FormLayout/FormLayoutCustomField.types.ts +59 -0
- package/src/components/FormLayout/FormLayoutCustomFieldContext.ts +4 -0
- package/src/components/FormLayout/README.md +4 -6
- package/src/components/FormLayout/index.ts +14 -0
- package/src/components/Grid/Grid.module.scss +1 -1
- package/src/components/Grid/Grid.tsx +50 -0
- package/src/components/Grid/Grid.types.ts +108 -0
- package/src/components/Grid/GridSpan.tsx +36 -0
- package/src/components/Grid/README.md +2 -2
- package/src/components/Grid/_helpers/generateResponsiveCustomProperties.ts +32 -0
- package/src/components/Grid/index.ts +9 -0
- package/src/components/InputGroup/{InputGroup.jsx → InputGroup.tsx} +25 -89
- package/src/components/InputGroup/InputGroup.types.ts +80 -0
- package/src/components/InputGroup/InputGroupContext.ts +4 -0
- package/src/components/InputGroup/README.md +5 -1
- package/src/components/InputGroup/{index.js → index.ts} +4 -0
- package/src/components/Modal/Modal.tsx +172 -0
- package/src/components/Modal/Modal.types.ts +181 -0
- package/src/components/Modal/ModalBody.tsx +34 -0
- package/src/components/Modal/{ModalCloseButton.jsx → ModalCloseButton.tsx} +6 -19
- package/src/components/Modal/{ModalContent.jsx → ModalContent.tsx} +4 -15
- package/src/components/Modal/ModalFooter.tsx +27 -0
- package/src/components/Modal/ModalHeader.tsx +27 -0
- package/src/components/Modal/ModalTitle.tsx +29 -0
- package/src/components/Modal/README.md +9 -9
- package/src/components/Modal/_helpers/{dialogOnCancelHandler.js → dialogOnCancelHandler.ts} +11 -1
- package/src/components/Modal/_helpers/{dialogOnClickHandler.js → dialogOnClickHandler.ts} +13 -7
- package/src/components/Modal/_helpers/{dialogOnCloseHandler.js → dialogOnCloseHandler.ts} +11 -1
- package/src/components/Modal/_helpers/{dialogOnKeyDownHandler.js → dialogOnKeyDownHandler.ts} +19 -6
- package/src/components/Modal/_helpers/{getJustifyClassName.js → getJustifyClassName.ts} +4 -1
- package/src/components/Modal/_helpers/getPositionClassName.ts +10 -0
- package/src/components/Modal/_helpers/getScrollingClassName.ts +14 -0
- package/src/components/Modal/_helpers/{getSizeClassName.js → getSizeClassName.ts} +4 -1
- package/src/components/Modal/_hooks/{useModalFocus.js → useModalFocus.ts} +9 -5
- package/src/components/Modal/_hooks/{useModalScrollPrevention.js → useModalScrollPrevention.ts} +4 -1
- package/src/components/Modal/{index.js → index.ts} +14 -0
- package/src/components/Paper/{Paper.jsx → Paper.tsx} +6 -26
- package/src/components/Paper/Paper.types.ts +19 -0
- package/src/components/Paper/README.md +3 -4
- package/src/components/Paper/index.ts +2 -0
- package/src/components/Popover/Popover.module.scss +1 -1
- package/src/components/Popover/Popover.tsx +61 -0
- package/src/components/Popover/Popover.types.ts +75 -0
- package/src/components/Popover/PopoverWrapper.tsx +27 -0
- package/src/components/Popover/README.md +34 -22
- package/src/components/Popover/_helpers/{cleanPlacementStyle.js → cleanPlacementStyle.ts} +4 -1
- package/src/components/Popover/_helpers/{getRootAlignmentClassName.js → getRootAlignmentClassName.ts} +4 -1
- package/src/components/Popover/_helpers/{getRootSideClassName.js → getRootSideClassName.ts} +4 -1
- package/src/components/Popover/index.ts +8 -0
- package/src/components/Radio/README.md +85 -45
- package/src/components/Radio/{Radio.jsx → Radio.tsx} +11 -107
- package/src/components/Radio/Radio.types.ts +90 -0
- package/src/components/Radio/index.ts +5 -0
- package/src/components/ScrollView/README.md +1 -1
- package/src/components/ScrollView/ScrollView.module.scss +5 -0
- package/src/components/ScrollView/{ScrollView.jsx → ScrollView.tsx} +55 -166
- package/src/components/ScrollView/ScrollView.types.ts +121 -0
- package/src/components/ScrollView/_helpers/getElementsPositionDifference.ts +17 -0
- package/src/components/ScrollView/_hooks/{useLoadResizeHook.js → useLoadResizeHook.ts} +14 -3
- package/src/components/ScrollView/_hooks/{useScrollPositionHook.js → useScrollPositionHook.ts} +11 -4
- package/src/components/ScrollView/index.ts +6 -0
- package/src/components/SelectField/README.md +84 -45
- package/src/components/SelectField/SelectField.tsx +139 -0
- package/src/components/SelectField/SelectField.types.ts +120 -0
- package/src/components/SelectField/_components/Option/Option.tsx +19 -0
- package/src/components/SelectField/_components/Option/Option.types.ts +21 -0
- package/src/components/SelectField/_components/Option/index.ts +2 -0
- package/src/components/SelectField/index.ts +7 -0
- package/src/components/Table/README.md +1 -1
- package/src/components/Table/{Table.jsx → Table.tsx} +4 -43
- package/src/components/Table/Table.types.ts +51 -0
- package/src/components/Table/_components/TableBodyCell/TableBodyCell.tsx +20 -0
- package/src/components/Table/_components/TableBodyCell/TableBodyCell.types.ts +20 -0
- package/src/components/Table/_components/TableBodyCell/index.ts +2 -0
- package/src/components/Table/_components/TableHeaderCell/{TableHeaderCell.jsx → TableHeaderCell.tsx} +3 -34
- package/src/components/Table/_components/TableHeaderCell/TableHeaderCell.types.ts +20 -0
- package/src/components/Table/_components/TableHeaderCell/index.ts +2 -0
- package/src/components/Table/index.ts +8 -0
- package/src/components/Tabs/README.md +2 -2
- package/src/components/Tabs/{Tabs.jsx → Tabs.tsx} +4 -20
- package/src/components/Tabs/Tabs.types.ts +19 -0
- package/src/components/Tabs/TabsItem.tsx +49 -0
- package/src/components/Tabs/TabsItem.types.ts +42 -0
- package/src/components/Tabs/index.ts +4 -0
- package/src/components/Text/README.md +1 -1
- package/src/components/Text/Text.module.scss +5 -7
- package/src/components/Text/Text.tsx +46 -0
- package/src/components/Text/Text.types.ts +31 -0
- package/src/components/Text/_helpers/getRootClampClassName.ts +13 -0
- package/src/components/Text/_helpers/getRootHyphensClassName.ts +14 -0
- package/src/components/Text/_helpers/getRootWordWrappingClassName.ts +14 -0
- package/src/components/Text/index.ts +6 -0
- package/src/components/TextArea/README.md +5 -8
- package/src/components/TextArea/TextArea.tsx +95 -0
- package/src/components/TextArea/TextArea.types.ts +75 -0
- package/src/components/TextArea/index.ts +5 -0
- package/src/components/TextField/README.md +5 -7
- package/src/components/TextField/TextField.tsx +112 -0
- package/src/components/TextField/TextField.types.ts +94 -0
- package/src/components/TextField/index.ts +6 -0
- package/src/components/TextLink/README.md +1 -1
- package/src/components/TextLink/{TextLink.jsx → TextLink.tsx} +4 -15
- package/src/components/TextLink/TextLink.types.ts +12 -0
- package/src/components/TextLink/index.ts +2 -0
- package/src/components/Toggle/README.md +67 -42
- package/src/components/Toggle/Toggle.tsx +82 -0
- package/src/components/Toggle/Toggle.types.ts +58 -0
- package/src/components/Toggle/index.ts +5 -0
- package/src/components/Toolbar/README.md +3 -3
- package/src/components/Toolbar/Toolbar.tsx +41 -0
- package/src/components/Toolbar/Toolbar.types.ts +74 -0
- package/src/components/Toolbar/ToolbarGroup.tsx +38 -0
- package/src/components/Toolbar/{ToolbarItem.jsx → ToolbarItem.tsx} +5 -21
- package/src/components/Toolbar/_helpers/{getAlignClassName.js → getAlignClassName.ts} +8 -1
- package/src/components/Toolbar/_helpers/{getJustifyClassName.js → getJustifyClassName.ts} +4 -1
- package/src/components/Toolbar/{index.js → index.ts} +7 -0
- package/src/components/_helpers/{getRootColorClassName.js → getRootColorClassName.ts} +6 -1
- package/src/components/_helpers/{getRootPriorityClassName.js → getRootPriorityClassName.ts} +6 -1
- package/src/components/_helpers/{getRootSizeClassName.js → getRootSizeClassName.ts} +6 -1
- package/src/components/_helpers/{getRootValidationStateClassName.js → getRootValidationStateClassName.ts} +6 -1
- package/src/components/_helpers/resolveContextOrProp.ts +13 -0
- package/src/helpers/classNames/{classNames.js → classNames.ts} +2 -2
- package/src/helpers/isChildrenEmpty/isChildrenEmpty.ts +5 -0
- package/src/helpers/transferProps/transferProps.ts +50 -0
- package/src/helpers/transferProps/transferProps.types.ts +11 -0
- package/src/index.ts +211 -0
- package/src/providers/globalProps/GlobalProps.types.ts +30 -0
- package/src/providers/globalProps/GlobalPropsContext.ts +6 -0
- package/src/providers/globalProps/{GlobalPropsProvider.jsx → GlobalPropsProvider.tsx} +8 -15
- package/src/providers/globalProps/{index.js → index.ts} +4 -0
- package/src/providers/globalProps/withGlobalProps.tsx +36 -0
- package/src/providers/translations/Translations.types.ts +26 -0
- package/src/providers/translations/TranslationsContext.ts +7 -0
- package/src/providers/translations/{TranslationsProvider.jsx → TranslationsProvider.tsx} +8 -15
- package/src/providers/translations/{index.js → index.ts} +5 -0
- package/src/styles/tools/_accessibility.scss +2 -2
- package/src/translations/{en.js → en.ts} +3 -1
- package/src/types/breakpoints.ts +1 -0
- package/src/types/colors.ts +7 -0
- package/src/types/index.ts +13 -0
- package/src/types/labelPositions.ts +1 -0
- package/src/types/layouts.ts +1 -0
- package/src/types/modules.d.ts +16 -0
- package/src/types/priorities.ts +1 -0
- package/src/types/sizes.ts +1 -0
- package/src/types/styles.ts +4 -0
- package/src/types/validationStates.ts +1 -0
- package/src/utils/mergeDeep.ts +34 -0
- package/src/utils/mergeDeep.types.ts +4 -0
- package/.claude/agents/code-reviewer.md +0 -122
- package/.claude/rules/code.md +0 -22
- package/.claude/rules/docs.md +0 -35
- package/.claude/rules/frontend.md +0 -72
- package/.claude/rules/git.md +0 -13
- package/.claude/rules/safety-guards.md +0 -9
- package/.claude/rules/styling.md +0 -32
- package/.claude/rules/testing.md +0 -59
- package/.claude/settings.json +0 -32
- package/.claude/skills/commit/SKILL.md +0 -54
- package/.devcontainer/devcontainer.json +0 -23
- package/.eslintrc-ts +0 -40
- package/.mcp.json +0 -8
- package/.nvmrc +0 -1
- package/CLAUDE.md +0 -82
- package/docker-compose.base.yml +0 -93
- package/docker-compose.yml.dist +0 -41
- package/jest.config-ts.js +0 -34
- package/opencode.json +0 -10
- package/playwright-ct.config.ts +0 -68
- package/scripts/auto-start-mkdocs.sh +0 -5
- package/scripts/auto-start-node.sh +0 -33
- package/scripts/mcps/chrome-host/README.md +0 -118
- package/scripts/mcps/chrome-host/cdp_proxy.py +0 -90
- package/scripts/mcps/chrome-host/mcp-entry.sh +0 -33
- package/scripts/mcps/chrome-host/mcp-launch.sh +0 -36
- package/scripts/mcps/chrome-host/mcp-setup.sh +0 -70
- package/scripts/mcps/chrome-host/start-host-chrome.sh +0 -267
- package/setup.sh +0 -107
- package/src/CNAME +0 -1
- package/src/components/Alert/index.js +0 -1
- package/src/components/Badge/Badge.jsx +0 -51
- package/src/components/Badge/index.js +0 -1
- package/src/components/Button/Button.jsx +0 -203
- package/src/components/Button/helpers/getRootPriorityClassName.js +0 -15
- package/src/components/Button/index.js +0 -1
- package/src/components/ButtonGroup/ButtonGroupContext.js +0 -3
- package/src/components/Card/Card.jsx +0 -67
- package/src/components/CheckboxField/CheckboxField.jsx +0 -144
- package/src/components/CheckboxField/index.js +0 -1
- package/src/components/FileInputField/index.js +0 -1
- package/src/components/FormLayout/FormLayoutContext.js +0 -3
- package/src/components/FormLayout/FormLayoutCustomFieldContext.js +0 -3
- package/src/components/FormLayout/index.js +0 -4
- package/src/components/Grid/Grid.jsx +0 -225
- package/src/components/Grid/GridSpan.jsx +0 -88
- package/src/components/Grid/_helpers/generateResponsiveCustomProperties.js +0 -22
- package/src/components/Grid/index.js +0 -2
- package/src/components/InputGroup/InputGroupContext.js +0 -3
- package/src/components/Modal/Modal.jsx +0 -262
- package/src/components/Modal/ModalBody.jsx +0 -60
- package/src/components/Modal/ModalFooter.jsx +0 -42
- package/src/components/Modal/ModalHeader.jsx +0 -42
- package/src/components/Modal/ModalTitle.jsx +0 -42
- package/src/components/Modal/_helpers/getPositionClassName.js +0 -7
- package/src/components/Modal/_helpers/getScrollingClassName.js +0 -11
- package/src/components/Paper/index.js +0 -1
- package/src/components/Popover/Popover.jsx +0 -124
- package/src/components/Popover/PopoverWrapper.jsx +0 -38
- package/src/components/Popover/index.js +0 -2
- package/src/components/Radio/index.js +0 -1
- package/src/components/ScrollView/_helpers/getElementsPositionDifference.js +0 -11
- package/src/components/ScrollView/index.js +0 -1
- package/src/components/SelectField/SelectField.jsx +0 -272
- package/src/components/SelectField/_components/Option/Option.jsx +0 -46
- package/src/components/SelectField/_components/Option/index.js +0 -1
- package/src/components/SelectField/index.js +0 -1
- package/src/components/Table/_components/TableBodyCell/TableBodyCell.jsx +0 -46
- package/src/components/Table/_components/TableBodyCell/index.js +0 -1
- package/src/components/Table/_components/TableHeaderCell/index.js +0 -1
- package/src/components/Table/index.js +0 -1
- package/src/components/Tabs/TabsItem.jsx +0 -91
- package/src/components/Tabs/index.js +0 -2
- package/src/components/Text/Text.jsx +0 -76
- package/src/components/Text/_helpers/getRootClampClassName.js +0 -11
- package/src/components/Text/_helpers/getRootHyphensClassName.js +0 -11
- package/src/components/Text/_helpers/getRootWordWrappingClassName.js +0 -11
- package/src/components/Text/index.js +0 -1
- package/src/components/TextArea/TextArea.jsx +0 -174
- package/src/components/TextArea/index.js +0 -1
- package/src/components/TextField/TextField.jsx +0 -208
- package/src/components/TextField/index.js +0 -1
- package/src/components/TextLink/index.js +0 -1
- package/src/components/Toggle/Toggle.jsx +0 -144
- package/src/components/Toggle/index.js +0 -1
- package/src/components/Toolbar/Toolbar.jsx +0 -76
- package/src/components/Toolbar/ToolbarGroup.jsx +0 -64
- package/src/components/_helpers/resolveContextOrProp.js +0 -10
- package/src/helpers/isChildrenEmpty/isChildrenEmpty.js +0 -3
- package/src/helpers/transferProps/transferProps.js +0 -38
- package/src/index.js +0 -67
- package/src/providers/globalProps/GlobalPropsContext.jsx +0 -5
- package/src/providers/globalProps/withGlobalProps.jsx +0 -38
- package/src/providers/translations/TranslationsContext.jsx +0 -6
- package/src/utils/mergeDeep.js +0 -28
- package/tsconfig.json +0 -27
- /package/src/helpers/classNames/{index.js → index.ts} +0 -0
- /package/src/helpers/isChildrenEmpty/{index.js → index.ts} +0 -0
- /package/src/helpers/transferProps/{index.js → index.ts} +0 -0
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
#!/bin/sh
|
|
2
|
-
|
|
3
|
-
# Run on the HOST during project setup (called from setup.sh).
|
|
4
|
-
#
|
|
5
|
-
# Native Docker Engine on Linux doesn't inject `host.docker.internal`, so the
|
|
6
|
-
# proxy container can't reach host Chrome. This adds the host-gateway mapping to
|
|
7
|
-
# the node service -- but only there. On Docker Desktop/macOS it's a no-op:
|
|
8
|
-
# the name already works, and adding the mapping would repoint it to the bridge
|
|
9
|
-
# gateway and break Desktop.
|
|
10
|
-
#
|
|
11
|
-
# Idempotent; after patching a running setup, recreate the service:
|
|
12
|
-
# `docker compose up -d node`.
|
|
13
|
-
|
|
14
|
-
set -eu
|
|
15
|
-
|
|
16
|
-
ROOT="$(CDPATH= cd -- "$(dirname -- "$0")/../../.." && pwd)"
|
|
17
|
-
COMPOSE_FILE="$ROOT/docker-compose.yml"
|
|
18
|
-
DOCKER_SERVICE_NAME=node
|
|
19
|
-
MAPPING="host.docker.internal:host-gateway"
|
|
20
|
-
|
|
21
|
-
# Only native Docker Engine on Linux needs the mapping. macOS is always Desktop.
|
|
22
|
-
if [ "$(uname -s)" = "Darwin" ]; then
|
|
23
|
-
exit 0
|
|
24
|
-
fi
|
|
25
|
-
|
|
26
|
-
DOCKER_OS="$(docker info --format '{{.OperatingSystem}}' 2>/dev/null || true)"
|
|
27
|
-
if [ -z "$DOCKER_OS" ]; then
|
|
28
|
-
echo "chrome-host: warning: could not query Docker (is it running?); skipping host-gateway setup." >&2
|
|
29
|
-
exit 0
|
|
30
|
-
fi
|
|
31
|
-
case "$DOCKER_OS" in
|
|
32
|
-
*"Docker Desktop"*) exit 0 ;;
|
|
33
|
-
esac
|
|
34
|
-
|
|
35
|
-
# Native Docker Engine from here on.
|
|
36
|
-
|
|
37
|
-
# The host launcher forwards Chrome's loopback CDP port to the bridge gateway
|
|
38
|
-
# with ncat (headed Chrome only binds loopback). Warn now rather than failing at
|
|
39
|
-
# first browser launch; don't auto-install -- that needs sudo plus distro
|
|
40
|
-
# detection, and adding host packages requires explicit approval.
|
|
41
|
-
if ! command -v ncat >/dev/null 2>&1; then
|
|
42
|
-
echo "chrome-host: warning: 'ncat' not found; install it (package 'nmap-ncat' or 'nmap'," >&2
|
|
43
|
-
echo "chrome-host: depending on your distro) so start-host-chrome.sh can expose Chrome's" >&2
|
|
44
|
-
echo "chrome-host: CDP port on the bridge gateway for the container." >&2
|
|
45
|
-
fi
|
|
46
|
-
|
|
47
|
-
[ -f "$COMPOSE_FILE" ] || exit 0
|
|
48
|
-
if grep -q "$MAPPING" "$COMPOSE_FILE"; then
|
|
49
|
-
exit 0
|
|
50
|
-
fi
|
|
51
|
-
|
|
52
|
-
# Insert extra_hosts under the `<service>:` block (sibling of `extends:`).
|
|
53
|
-
TMP_FILE="$COMPOSE_FILE.tmp"
|
|
54
|
-
awk -v service="$DOCKER_SERVICE_NAME" '
|
|
55
|
-
{ print }
|
|
56
|
-
$0 ~ ("^ " service ":[[:space:]]*$") && !done {
|
|
57
|
-
print " extra_hosts:"
|
|
58
|
-
print " - \"host.docker.internal:host-gateway\""
|
|
59
|
-
done = 1
|
|
60
|
-
}
|
|
61
|
-
' "$COMPOSE_FILE" > "$TMP_FILE"
|
|
62
|
-
|
|
63
|
-
if grep -q "$MAPPING" "$TMP_FILE"; then
|
|
64
|
-
mv "$TMP_FILE" "$COMPOSE_FILE"
|
|
65
|
-
echo "chrome-host: native Docker Engine detected -- added '$MAPPING' to the '$DOCKER_SERVICE_NAME' service in $COMPOSE_FILE."
|
|
66
|
-
echo "chrome-host: if the '$DOCKER_SERVICE_NAME' container is already running, recreate it: docker compose up -d $DOCKER_SERVICE_NAME"
|
|
67
|
-
else
|
|
68
|
-
rm -f "$TMP_FILE"
|
|
69
|
-
echo "chrome-host: warning: could not locate the '$DOCKER_SERVICE_NAME' service in $COMPOSE_FILE; add '$MAPPING' to its extra_hosts manually." >&2
|
|
70
|
-
fi
|
|
@@ -1,267 +0,0 @@
|
|
|
1
|
-
#!/bin/sh
|
|
2
|
-
|
|
3
|
-
# Run on the HOST (macOS or Linux). Launches a dedicated, isolated Chrome with
|
|
4
|
-
# the DevTools (CDP) endpoint enabled so a containerized assistant can drive it.
|
|
5
|
-
#
|
|
6
|
-
# It uses its own dedicated --user-data-dir, so your everyday Chrome and logins
|
|
7
|
-
# are untouched. A separate profile is also required: Chrome only opens a debug
|
|
8
|
-
# port for a fresh instance, not for an already-running default profile.
|
|
9
|
-
#
|
|
10
|
-
# That profile is persistent (reused across runs, kept under $HOME) -- not
|
|
11
|
-
# ephemeral or sandboxed. Anything you sign in to here stays on disk and is
|
|
12
|
-
# reachable over the unauthenticated CDP port, so avoid logging in to sensitive
|
|
13
|
-
# accounts in this browser.
|
|
14
|
-
#
|
|
15
|
-
# Overrides (shell wins over the repo's .env); see README -> Platform support
|
|
16
|
-
# for the bind/platform details:
|
|
17
|
-
# CHROME_DEBUG_PORT CDP port (default 9333)
|
|
18
|
-
# CHROME_BIN explicit browser binary (else auto-detected)
|
|
19
|
-
# CHROME_DEBUG_BIND bind address (else auto-detected: loopback on Docker
|
|
20
|
-
# Desktop, docker bridge gateway on native Engine).
|
|
21
|
-
# SECURITY: a non-loopback bind exposes the port -- firewall it.
|
|
22
|
-
#
|
|
23
|
-
# Profile is always ~/.chrome-debug-profile-<COMPOSE_PROJECT_NAME> (not configurable).
|
|
24
|
-
|
|
25
|
-
set -eu
|
|
26
|
-
|
|
27
|
-
# Opens a real browser window, so it must run on the HOST, not in a container
|
|
28
|
-
# (/.dockerenv exists only inside one).
|
|
29
|
-
if [ -f /.dockerenv ]; then
|
|
30
|
-
echo "chrome-host: error: run start-host-chrome.sh on your HOST, not in a container." >&2
|
|
31
|
-
echo "chrome-host: it launches a Chrome window on your desktop for the containerized" >&2
|
|
32
|
-
echo "chrome-host: assistant to drive. Open a host terminal and run it there." >&2
|
|
33
|
-
exit 1
|
|
34
|
-
fi
|
|
35
|
-
|
|
36
|
-
# Fall back to the repo's .env (the file Docker Compose reads) so this launcher
|
|
37
|
-
# and the in-container proxy share one source of truth. Precedence: shell > .env
|
|
38
|
-
# > the defaults below.
|
|
39
|
-
env_root="$(CDPATH= cd -- "$(dirname -- "$0")" && pwd)"
|
|
40
|
-
while [ "$env_root" != "/" ] && [ ! -f "$env_root/docker-compose.yml" ]; do
|
|
41
|
-
env_root="$(dirname "$env_root")"
|
|
42
|
-
done
|
|
43
|
-
ENV_FILE="$env_root/.env"
|
|
44
|
-
# For each host knob, keep a value already set in the shell; otherwise eval the
|
|
45
|
-
# matching .env line. Letting the shell run the assignment strips quotes and
|
|
46
|
-
# inline comments for free. Values containing spaces must be quoted in .env.
|
|
47
|
-
if [ -f "$ENV_FILE" ]; then
|
|
48
|
-
for env_key in CHROME_DEBUG_PORT CHROME_BIN CHROME_DEBUG_BIND COMPOSE_PROJECT_NAME COMPOSE_DOCS_SERVER_PORT; do
|
|
49
|
-
eval "[ -n \"\${$env_key+x}\" ]" && continue
|
|
50
|
-
eval "$(grep -E "^[[:space:]]*$env_key=" "$ENV_FILE" | tail -n 1 || true)"
|
|
51
|
-
done
|
|
52
|
-
fi
|
|
53
|
-
|
|
54
|
-
PORT="${CHROME_DEBUG_PORT:-9333}"
|
|
55
|
-
|
|
56
|
-
# Preflight: curl drives every CDP readiness probe below, on every platform.
|
|
57
|
-
if ! command -v curl >/dev/null 2>&1; then
|
|
58
|
-
echo "chrome-host: error: 'curl' is required to probe Chrome's CDP endpoint but is not installed." >&2
|
|
59
|
-
exit 1
|
|
60
|
-
fi
|
|
61
|
-
|
|
62
|
-
# Bind address. Explicit CHROME_DEBUG_BIND wins; otherwise auto-detect: loopback
|
|
63
|
-
# on Docker Desktop (incl. macOS), else the docker bridge gateway for native
|
|
64
|
-
# Engine. Binding to the gateway (not 0.0.0.0) keeps the port off your wider
|
|
65
|
-
# network. See README -> Platform support.
|
|
66
|
-
detect_bind() {
|
|
67
|
-
if [ "$(uname -s)" = "Darwin" ]; then
|
|
68
|
-
printf '127.0.0.1\n'
|
|
69
|
-
return 0
|
|
70
|
-
fi
|
|
71
|
-
case "$(docker info --format '{{.OperatingSystem}}' 2>/dev/null || true)" in
|
|
72
|
-
*"Docker Desktop"*)
|
|
73
|
-
printf '127.0.0.1\n'
|
|
74
|
-
return 0
|
|
75
|
-
;;
|
|
76
|
-
esac
|
|
77
|
-
# println each gateway on its own line, then take the first IPv4 -- an
|
|
78
|
-
# IPv6-enabled bridge would otherwise concatenate the v4 and v6 gateways into
|
|
79
|
-
# one malformed token that ncat cannot bind.
|
|
80
|
-
gateway_ip="$(docker network inspect bridge --format '{{range .IPAM.Config}}{{println .Gateway}}{{end}}' 2>/dev/null | grep -E '^[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+$' | head -n1 || true)"
|
|
81
|
-
if [ -n "$gateway_ip" ]; then
|
|
82
|
-
printf '%s\n' "$gateway_ip"
|
|
83
|
-
return 0
|
|
84
|
-
fi
|
|
85
|
-
return 1
|
|
86
|
-
}
|
|
87
|
-
# Preflight: auto-detecting the bind address shells out to the docker CLI. Skip
|
|
88
|
-
# the check when the bind is supplied explicitly, or on macOS (always loopback).
|
|
89
|
-
if [ -z "${CHROME_DEBUG_BIND:-}" ] && [ "$(uname -s)" != "Darwin" ] && ! command -v docker >/dev/null 2>&1; then
|
|
90
|
-
echo "chrome-host: error: auto-detecting the CDP bind address needs the 'docker' CLI, but it is" >&2
|
|
91
|
-
echo "chrome-host: not installed. Install Docker, or set CHROME_DEBUG_BIND (e.g. 127.0.0.1 for" >&2
|
|
92
|
-
echo "chrome-host: Docker Desktop) to skip detection." >&2
|
|
93
|
-
exit 1
|
|
94
|
-
fi
|
|
95
|
-
if [ -n "${CHROME_DEBUG_BIND:-}" ]; then
|
|
96
|
-
BIND="$CHROME_DEBUG_BIND"
|
|
97
|
-
else
|
|
98
|
-
BIND="$(detect_bind)" || true
|
|
99
|
-
if [ -z "$BIND" ]; then
|
|
100
|
-
echo "chrome-host: error: could not determine the Docker bridge gateway for the CDP forwarder" >&2
|
|
101
|
-
echo "chrome-host: (is the Docker daemon running?). Set CHROME_DEBUG_BIND to your docker bridge" >&2
|
|
102
|
-
echo "chrome-host: gateway IP to override, and retry." >&2
|
|
103
|
-
exit 1
|
|
104
|
-
fi
|
|
105
|
-
fi
|
|
106
|
-
case "$BIND" in
|
|
107
|
-
127.0.0.1 | ::1) ;;
|
|
108
|
-
*)
|
|
109
|
-
echo "chrome-host: warning: native Docker detected — exposing the CDP port on $BIND so the" >&2
|
|
110
|
-
echo "chrome-host: container can reach it. This exposes browser control beyond" >&2
|
|
111
|
-
echo "chrome-host: loopback; firewall the port. Native Docker also needs" >&2
|
|
112
|
-
echo "chrome-host: 'host.docker.internal:host-gateway' in the node service's" >&2
|
|
113
|
-
echo "chrome-host: extra_hosts. Set CHROME_DEBUG_BIND to override." >&2
|
|
114
|
-
;;
|
|
115
|
-
esac
|
|
116
|
-
|
|
117
|
-
# Preflight: a concrete non-loopback bind needs an ncat forwarder (see
|
|
118
|
-
# ensure_forwarder). Check ncat now, before launching Chrome, so a missing tool
|
|
119
|
-
# fails fast instead of orphaning a browser window. Skip it if a forwarder from
|
|
120
|
-
# a previous run is already serving the bind.
|
|
121
|
-
case "$BIND" in
|
|
122
|
-
127.0.0.1 | ::1 | 0.0.0.0 | ::) ;;
|
|
123
|
-
*)
|
|
124
|
-
if ! curl -s -m 2 "http://${BIND}:${PORT}/json/version" >/dev/null 2>&1 \
|
|
125
|
-
&& ! command -v ncat >/dev/null 2>&1; then
|
|
126
|
-
echo "chrome-host: error: this run must expose Chrome's CDP port ${PORT} on ${BIND} via an" >&2
|
|
127
|
-
echo "chrome-host: ncat forwarder, but 'ncat' is not installed. Install ncat (the 'nmap-ncat'" >&2
|
|
128
|
-
echo "chrome-host: or 'nmap' package, depending on your distro)." >&2
|
|
129
|
-
exit 1
|
|
130
|
-
fi
|
|
131
|
-
;;
|
|
132
|
-
esac
|
|
133
|
-
|
|
134
|
-
# Profile is always per-project and not configurable. COMPOSE_PROJECT_NAME comes
|
|
135
|
-
# from .env (or your shell); fall back to the repo directory name, like Compose.
|
|
136
|
-
PROJECT="${COMPOSE_PROJECT_NAME:-$(basename "$env_root")}"
|
|
137
|
-
PROFILE="$HOME/.chrome-debug-profile-$PROJECT"
|
|
138
|
-
|
|
139
|
-
find_chrome() {
|
|
140
|
-
if [ -n "${CHROME_BIN:-}" ]; then
|
|
141
|
-
printf '%s\n' "$CHROME_BIN"
|
|
142
|
-
return 0
|
|
143
|
-
fi
|
|
144
|
-
case "$(uname -s)" in
|
|
145
|
-
Darwin)
|
|
146
|
-
for candidate in \
|
|
147
|
-
"/Applications/Google Chrome.app/Contents/MacOS/Google Chrome" \
|
|
148
|
-
"/Applications/Google Chrome Beta.app/Contents/MacOS/Google Chrome Beta" \
|
|
149
|
-
"/Applications/Chromium.app/Contents/MacOS/Chromium" \
|
|
150
|
-
"/Applications/Microsoft Edge.app/Contents/MacOS/Microsoft Edge"; do
|
|
151
|
-
if [ -x "$candidate" ]; then
|
|
152
|
-
printf '%s\n' "$candidate"
|
|
153
|
-
return 0
|
|
154
|
-
fi
|
|
155
|
-
done
|
|
156
|
-
;;
|
|
157
|
-
*)
|
|
158
|
-
for candidate in google-chrome google-chrome-stable chromium chromium-browser microsoft-edge brave-browser; do
|
|
159
|
-
resolved="$(command -v "$candidate" 2>/dev/null || true)"
|
|
160
|
-
if [ -n "$resolved" ]; then
|
|
161
|
-
printf '%s\n' "$resolved"
|
|
162
|
-
return 0
|
|
163
|
-
fi
|
|
164
|
-
done
|
|
165
|
-
;;
|
|
166
|
-
esac
|
|
167
|
-
return 1
|
|
168
|
-
}
|
|
169
|
-
|
|
170
|
-
# Headed Chromium pins DevTools to 127.0.0.1 and silently ignores
|
|
171
|
-
# --remote-debugging-address (Fedora's build, among others), so the launcher no
|
|
172
|
-
# longer passes that flag: Chrome always binds loopback, and ensure_forwarder
|
|
173
|
-
# spawns an ncat hop on $BIND:$PORT to expose it for the container. Loopback and
|
|
174
|
-
# wildcard binds need no hop -- loopback is already reachable, and a wildcard
|
|
175
|
-
# would collide with Chrome's own loopback port.
|
|
176
|
-
ensure_forwarder() {
|
|
177
|
-
bind=$1
|
|
178
|
-
port=$2
|
|
179
|
-
pidfile=$3
|
|
180
|
-
|
|
181
|
-
case "$bind" in 127.0.0.1 | ::1 | 0.0.0.0 | ::) return 0 ;; esac
|
|
182
|
-
|
|
183
|
-
mkdir -p "$(dirname "$pidfile")"
|
|
184
|
-
|
|
185
|
-
# A reachable bind:port means a forwarder from a previous run still serves it
|
|
186
|
-
# (Chrome itself only binds loopback), so reuse it.
|
|
187
|
-
if curl -s -m 2 "http://${bind}:${port}/json/version" >/dev/null 2>&1; then
|
|
188
|
-
echo "chrome-host: forwarder already serving ${bind}:${port}"
|
|
189
|
-
return 0
|
|
190
|
-
fi
|
|
191
|
-
|
|
192
|
-
if ! command -v ncat >/dev/null 2>&1; then
|
|
193
|
-
echo "chrome-host: error: Chrome bound CDP to loopback only and 'ncat' is not installed." >&2
|
|
194
|
-
echo "chrome-host: install ncat (the 'nmap-ncat' or 'nmap' package, depending on your distro)" >&2
|
|
195
|
-
echo "chrome-host: so a host-side forwarder can expose ${port} on ${bind} for the container." >&2
|
|
196
|
-
return 1
|
|
197
|
-
fi
|
|
198
|
-
|
|
199
|
-
if [ -f "$pidfile" ]; then
|
|
200
|
-
kill "$(cat "$pidfile")" 2>/dev/null || true
|
|
201
|
-
rm -f "$pidfile"
|
|
202
|
-
fi
|
|
203
|
-
|
|
204
|
-
log=${pidfile%.pid}.log
|
|
205
|
-
nohup ncat -k -l "$bind" "$port" --sh-exec "ncat 127.0.0.1 $port" >"$log" 2>&1 &
|
|
206
|
-
echo $! >"$pidfile"
|
|
207
|
-
|
|
208
|
-
j=0
|
|
209
|
-
while [ "$j" -lt 20 ]; do
|
|
210
|
-
if curl -s -m 2 "http://${bind}:${port}/json/version" >/dev/null 2>&1; then
|
|
211
|
-
echo "chrome-host: forwarder ${bind}:${port} -> 127.0.0.1:${port} (pid $(cat "$pidfile"))"
|
|
212
|
-
return 0
|
|
213
|
-
fi
|
|
214
|
-
j=$((j + 1))
|
|
215
|
-
sleep 0.5
|
|
216
|
-
done
|
|
217
|
-
|
|
218
|
-
echo "chrome-host: error: forwarder failed to bind ${bind}:${port}; see $log" >&2
|
|
219
|
-
return 1
|
|
220
|
-
}
|
|
221
|
-
|
|
222
|
-
if curl -s -m 2 "http://127.0.0.1:${PORT}/json/version" >/dev/null 2>&1; then
|
|
223
|
-
echo "chrome-host: debug Chrome already running on 127.0.0.1:${PORT}"
|
|
224
|
-
ensure_forwarder "$BIND" "$PORT" "$PROFILE/forwarder.pid" || exit 1
|
|
225
|
-
exit 0
|
|
226
|
-
fi
|
|
227
|
-
|
|
228
|
-
CHROME="$(find_chrome || true)"
|
|
229
|
-
if [ -z "${CHROME:-}" ]; then
|
|
230
|
-
echo "chrome-host: error: no Chrome/Chromium found. Set CHROME_BIN=/path/to/browser and retry." >&2
|
|
231
|
-
exit 1
|
|
232
|
-
fi
|
|
233
|
-
|
|
234
|
-
mkdir -p "$PROFILE"
|
|
235
|
-
|
|
236
|
-
# Build the argument list (quote the glob so the shell doesn't expand '*').
|
|
237
|
-
# --ignore-certificate-errors skips the "Your connection is not private"
|
|
238
|
-
# interstitial for local HTTPS dev servers with a self-signed/absent cert.
|
|
239
|
-
# Acceptable here: this is a dedicated, isolated debug profile, not your
|
|
240
|
-
# everyday browser.
|
|
241
|
-
set -- \
|
|
242
|
-
--remote-debugging-port="$PORT" \
|
|
243
|
-
'--remote-allow-origins=*' \
|
|
244
|
-
--user-data-dir="$PROFILE" \
|
|
245
|
-
--no-first-run \
|
|
246
|
-
--no-default-browser-check \
|
|
247
|
-
--ignore-certificate-errors
|
|
248
|
-
set -- "$@" --new-window "http://localhost:${COMPOSE_DOCS_SERVER_PORT:-8000}"
|
|
249
|
-
|
|
250
|
-
nohup "$CHROME" "$@" >"$PROFILE/chrome-debug.log" 2>&1 &
|
|
251
|
-
|
|
252
|
-
i=0
|
|
253
|
-
while [ "$i" -lt 30 ]; do
|
|
254
|
-
if curl -s -m 2 "http://127.0.0.1:${PORT}/json/version" >/dev/null 2>&1; then
|
|
255
|
-
echo "chrome-host: debug Chrome ready on 127.0.0.1:${PORT}"
|
|
256
|
-
echo "chrome-host: binary: $CHROME"
|
|
257
|
-
echo "chrome-host: profile: $PROFILE"
|
|
258
|
-
echo "chrome-host: log: $PROFILE/chrome-debug.log"
|
|
259
|
-
ensure_forwarder "$BIND" "$PORT" "$PROFILE/forwarder.pid" || exit 1
|
|
260
|
-
exit 0
|
|
261
|
-
fi
|
|
262
|
-
i=$((i + 1))
|
|
263
|
-
sleep 0.5
|
|
264
|
-
done
|
|
265
|
-
|
|
266
|
-
echo "chrome-host: error: Chrome did not expose CDP on 127.0.0.1:${PORT}; see $PROFILE/chrome-debug.log" >&2
|
|
267
|
-
exit 1
|
package/setup.sh
DELETED
|
@@ -1,107 +0,0 @@
|
|
|
1
|
-
#!/bin/bash
|
|
2
|
-
|
|
3
|
-
DEFAULT_PROJECT_NAME="react-ui"
|
|
4
|
-
DEFAULT_USER_ID=1000
|
|
5
|
-
DEFAULT_GROUP_ID=1000
|
|
6
|
-
|
|
7
|
-
set -e
|
|
8
|
-
trap 'echo "Failed to set up project"; rm -f .env.temp; exit 1' ERR
|
|
9
|
-
|
|
10
|
-
# Function to handle sed command with cross-platform compatibility
|
|
11
|
-
sed_cmd() {
|
|
12
|
-
if [[ "$OSTYPE" == "darwin"* ]]; then
|
|
13
|
-
sed -i '' "$@"
|
|
14
|
-
else
|
|
15
|
-
sed -i "$@"
|
|
16
|
-
fi
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
cd "$(dirname "$0")"
|
|
20
|
-
|
|
21
|
-
echo "Setting up project..."
|
|
22
|
-
|
|
23
|
-
# Create and configure .env file if it doesn't exist
|
|
24
|
-
if [ ! -f .env ]; then
|
|
25
|
-
echo "Creating .env file..."
|
|
26
|
-
cp .env.dist .env.temp
|
|
27
|
-
|
|
28
|
-
echo "Configuring .env file..."
|
|
29
|
-
|
|
30
|
-
PROJECT_PATH=$(pwd)
|
|
31
|
-
PROJECT_NAME=$(basename "$PROJECT_PATH")
|
|
32
|
-
|
|
33
|
-
if [[ "$OSTYPE" == "darwin"* ]]; then
|
|
34
|
-
# MacOS
|
|
35
|
-
USER_ID=$DEFAULT_USER_ID
|
|
36
|
-
GROUP_ID=$DEFAULT_GROUP_ID
|
|
37
|
-
else
|
|
38
|
-
# Linux
|
|
39
|
-
USER_ID=$(id -u)
|
|
40
|
-
GROUP_ID=$(id -g)
|
|
41
|
-
fi
|
|
42
|
-
|
|
43
|
-
sed_cmd "s|^COMPOSE_PROJECT_NAME=.*|COMPOSE_PROJECT_NAME=$PROJECT_NAME|" .env.temp
|
|
44
|
-
sed_cmd "s|^COMPOSE_UID=.*|COMPOSE_UID=$USER_ID|" .env.temp
|
|
45
|
-
sed_cmd "s|^COMPOSE_GID=.*|COMPOSE_GID=$GROUP_ID|" .env.temp
|
|
46
|
-
|
|
47
|
-
LOCAL_SHELL=
|
|
48
|
-
if [ -n "$SHELL" ]; then
|
|
49
|
-
sed_cmd "s|^SHELL=.*|SHELL=$SHELL|" .env.temp
|
|
50
|
-
LOCAL_SHELL=$SHELL
|
|
51
|
-
fi
|
|
52
|
-
|
|
53
|
-
LOCAL_EDITOR=
|
|
54
|
-
if [ -n "$EDITOR" ]; then
|
|
55
|
-
sed_cmd "s|^EDITOR=.*|EDITOR=$EDITOR|" .env.temp
|
|
56
|
-
LOCAL_EDITOR=$EDITOR
|
|
57
|
-
fi
|
|
58
|
-
|
|
59
|
-
LOCAL_VISUAL=
|
|
60
|
-
if [ -n "$VISUAL" ]; then
|
|
61
|
-
sed_cmd "s|^VISUAL=.*|VISUAL=$VISUAL|" .env.temp
|
|
62
|
-
LOCAL_VISUAL=$VISUAL
|
|
63
|
-
fi
|
|
64
|
-
|
|
65
|
-
cp .env.temp .env
|
|
66
|
-
rm .env.temp
|
|
67
|
-
|
|
68
|
-
echo "Configured .env file with the following values:"
|
|
69
|
-
echo "Project name: $PROJECT_NAME"
|
|
70
|
-
echo "Project path: $PROJECT_PATH"
|
|
71
|
-
echo "User ID: $USER_ID"
|
|
72
|
-
echo "Group ID: $GROUP_ID"
|
|
73
|
-
|
|
74
|
-
if [ -n "$LOCAL_SHELL" ]; then
|
|
75
|
-
echo "Shell: $LOCAL_SHELL"
|
|
76
|
-
fi
|
|
77
|
-
if [ -n "$LOCAL_EDITOR" ]; then
|
|
78
|
-
echo "Editor: $LOCAL_EDITOR"
|
|
79
|
-
fi
|
|
80
|
-
if [ -n "$LOCAL_VISUAL" ]; then
|
|
81
|
-
echo "Visual: $LOCAL_VISUAL"
|
|
82
|
-
fi
|
|
83
|
-
else
|
|
84
|
-
echo ".env file already exists, skipping creation."
|
|
85
|
-
fi
|
|
86
|
-
|
|
87
|
-
# Create docker-compose.yml if it doesn't exist
|
|
88
|
-
if [ ! -f docker-compose.yml ]; then
|
|
89
|
-
echo "Creating and configuring docker-compose.yml file..."
|
|
90
|
-
cp docker-compose.yml.dist docker-compose.yml
|
|
91
|
-
|
|
92
|
-
DEFAULT_PROJECT_DEVCONTAINER_IMAGE="${DEFAULT_PROJECT_NAME}_devcontainer"
|
|
93
|
-
PROJECT_NAME=$(grep -E '^COMPOSE_PROJECT_NAME=' .env | cut -d '=' -f 2-)
|
|
94
|
-
PROJECT_DEVCONTAINER_IMAGE="${PROJECT_NAME}_devcontainer"
|
|
95
|
-
|
|
96
|
-
sed_cmd "s|image: $DEFAULT_PROJECT_DEVCONTAINER_IMAGE|image: $PROJECT_DEVCONTAINER_IMAGE|" docker-compose.yml
|
|
97
|
-
else
|
|
98
|
-
echo "docker-compose.yml file already exists, skipping creation."
|
|
99
|
-
fi
|
|
100
|
-
|
|
101
|
-
# Configure the Chrome-host bridge networking (native Docker Engine only)
|
|
102
|
-
sh ./scripts/mcps/chrome-host/mcp-setup.sh
|
|
103
|
-
|
|
104
|
-
# Build Docker images
|
|
105
|
-
sh ./docker/build-docker-images.sh
|
|
106
|
-
|
|
107
|
-
echo "Project setup completed successfully!"
|
package/src/CNAME
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
react-ui.io
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { default as Alert } from './Alert';
|
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
import PropTypes from 'prop-types';
|
|
2
|
-
import React from 'react';
|
|
3
|
-
import { withGlobalProps } from '../../providers/globalProps';
|
|
4
|
-
import { classNames } from '../../helpers/classNames/classNames';
|
|
5
|
-
import { transferProps } from '../../helpers/transferProps';
|
|
6
|
-
import { getRootColorClassName } from '../_helpers/getRootColorClassName';
|
|
7
|
-
import { getRootPriorityClassName } from '../_helpers/getRootPriorityClassName';
|
|
8
|
-
import styles from './Badge.module.scss';
|
|
9
|
-
|
|
10
|
-
export const Badge = ({
|
|
11
|
-
color,
|
|
12
|
-
label,
|
|
13
|
-
priority,
|
|
14
|
-
...restProps
|
|
15
|
-
}) => (
|
|
16
|
-
<div
|
|
17
|
-
{...transferProps(restProps)}
|
|
18
|
-
className={classNames(
|
|
19
|
-
styles.root,
|
|
20
|
-
getRootPriorityClassName(priority, styles),
|
|
21
|
-
getRootColorClassName(color, styles),
|
|
22
|
-
)}
|
|
23
|
-
>
|
|
24
|
-
{label}
|
|
25
|
-
</div>
|
|
26
|
-
);
|
|
27
|
-
|
|
28
|
-
Badge.defaultProps = {
|
|
29
|
-
color: 'note',
|
|
30
|
-
priority: 'filled',
|
|
31
|
-
};
|
|
32
|
-
|
|
33
|
-
Badge.propTypes = {
|
|
34
|
-
/**
|
|
35
|
-
* Color to clarify importance and meaning of the badge. Implements
|
|
36
|
-
* [Feedback and Neutral color collections](/docs/foundation/collections#colors).
|
|
37
|
-
*/
|
|
38
|
-
color: PropTypes.oneOf(['success', 'warning', 'danger', 'help', 'info', 'note', 'light', 'dark']),
|
|
39
|
-
/**
|
|
40
|
-
* Text to be displayed.
|
|
41
|
-
*/
|
|
42
|
-
label: PropTypes.string.isRequired,
|
|
43
|
-
/**
|
|
44
|
-
* Visual priority to highlight or suppress the badge.
|
|
45
|
-
*/
|
|
46
|
-
priority: PropTypes.oneOf(['filled', 'outline']),
|
|
47
|
-
};
|
|
48
|
-
|
|
49
|
-
export const BadgeWithGlobalProps = withGlobalProps(Badge, 'Badge');
|
|
50
|
-
|
|
51
|
-
export default BadgeWithGlobalProps;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { default as Badge } from './Badge';
|