@15gifts/back-office-kit 0.0.0-stage → 0.1.0-alpha.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 +39 -0
- package/README.md +46 -2
- package/bin/back-office-kit.js +35 -0
- package/dist/browser/back-office-kit.js +21469 -0
- package/dist/components/Alert/Alert.css.d.ts +32 -0
- package/dist/components/Alert/Alert.d.ts +14 -0
- package/dist/components/Alert/Alert.js +59 -0
- package/dist/components/Alert/Alert.js.map +1 -0
- package/dist/components/Alert/Alert.styles.js +17 -0
- package/dist/components/Alert/Alert.styles.js.map +1 -0
- package/dist/components/Alert/index.d.ts +2 -0
- package/dist/components/AppShell/AppShell.css.d.ts +7 -0
- package/dist/components/AppShell/AppShell.d.ts +20 -0
- package/dist/components/AppShell/AppShell.js +32 -0
- package/dist/components/AppShell/AppShell.js.map +1 -0
- package/dist/components/AppShell/AppShell.styles.js +6 -0
- package/dist/components/AppShell/AppShell.styles.js.map +1 -0
- package/dist/components/AppShell/index.d.ts +2 -0
- package/dist/components/Avatar/Avatar.css.d.ts +22 -0
- package/dist/components/Avatar/Avatar.d.ts +13 -0
- package/dist/components/Avatar/Avatar.js +30 -0
- package/dist/components/Avatar/Avatar.js.map +1 -0
- package/dist/components/Avatar/Avatar.styles.js +16 -0
- package/dist/components/Avatar/Avatar.styles.js.map +1 -0
- package/dist/components/Avatar/index.d.ts +2 -0
- package/dist/components/Badge/Badge.css.d.ts +11 -0
- package/dist/components/Badge/Badge.d.ts +11 -0
- package/dist/components/Badge/Badge.js +17 -0
- package/dist/components/Badge/Badge.js.map +1 -0
- package/dist/components/Badge/Badge.styles.js +86 -0
- package/dist/components/Badge/Badge.styles.js.map +1 -0
- package/dist/components/Badge/index.d.ts +2 -0
- package/dist/components/Breadcrumbs/Breadcrumbs.css.d.ts +5 -0
- package/dist/components/Breadcrumbs/Breadcrumbs.d.ts +22 -0
- package/dist/components/Breadcrumbs/Breadcrumbs.js +51 -0
- package/dist/components/Breadcrumbs/Breadcrumbs.js.map +1 -0
- package/dist/components/Breadcrumbs/Breadcrumbs.styles.js +7 -0
- package/dist/components/Breadcrumbs/Breadcrumbs.styles.js.map +1 -0
- package/dist/components/Breadcrumbs/index.d.ts +2 -0
- package/dist/components/Button/Button.css.d.ts +74 -0
- package/dist/components/Button/Button.d.ts +29 -0
- package/dist/components/Button/Button.js +54 -0
- package/dist/components/Button/Button.js.map +1 -0
- package/dist/components/Button/Button.styles.js +29 -0
- package/dist/components/Button/Button.styles.js.map +1 -0
- package/dist/components/Button/index.d.ts +2 -0
- package/dist/components/Card/Card.css.d.ts +35 -0
- package/dist/components/Card/Card.d.ts +12 -0
- package/dist/components/Card/Card.js +27 -0
- package/dist/components/Card/Card.js.map +1 -0
- package/dist/components/Card/Card.styles.js +18 -0
- package/dist/components/Card/Card.styles.js.map +1 -0
- package/dist/components/Card/index.d.ts +2 -0
- package/dist/components/ChatTranscript/ChatTranscript.css.d.ts +15 -0
- package/dist/components/ChatTranscript/ChatTranscript.d.ts +94 -0
- package/dist/components/ChatTranscript/ChatTranscript.js +159 -0
- package/dist/components/ChatTranscript/ChatTranscript.js.map +1 -0
- package/dist/components/ChatTranscript/ChatTranscript.styles.js +6 -0
- package/dist/components/ChatTranscript/ChatTranscript.styles.js.map +1 -0
- package/dist/components/ChatTranscript/index.d.ts +2 -0
- package/dist/components/Checkbox/Checkbox.css.d.ts +3 -0
- package/dist/components/Checkbox/Checkbox.d.ts +10 -0
- package/dist/components/Checkbox/Checkbox.js +50 -0
- package/dist/components/Checkbox/Checkbox.js.map +1 -0
- package/dist/components/Checkbox/Checkbox.styles.js +8 -0
- package/dist/components/Checkbox/Checkbox.styles.js.map +1 -0
- package/dist/components/Checkbox/index.d.ts +2 -0
- package/dist/components/Chip/Chip.css.d.ts +2 -0
- package/dist/components/Chip/Chip.d.ts +6 -0
- package/dist/components/Chip/Chip.js +21 -0
- package/dist/components/Chip/Chip.js.map +1 -0
- package/dist/components/Chip/Chip.styles.js +7 -0
- package/dist/components/Chip/Chip.styles.js.map +1 -0
- package/dist/components/Chip/index.d.ts +2 -0
- package/dist/components/ColorPicker/ColorPicker.css.d.ts +5 -0
- package/dist/components/ColorPicker/ColorPicker.d.ts +17 -0
- package/dist/components/ColorPicker/ColorPicker.js +80 -0
- package/dist/components/ColorPicker/ColorPicker.js.map +1 -0
- package/dist/components/ColorPicker/ColorPicker.styles.js +6 -0
- package/dist/components/ColorPicker/ColorPicker.styles.js.map +1 -0
- package/dist/components/ColorPicker/color.d.ts +14 -0
- package/dist/components/ColorPicker/color.js +39 -0
- package/dist/components/ColorPicker/color.js.map +1 -0
- package/dist/components/ColorPicker/index.d.ts +2 -0
- package/dist/components/Combobox/Combobox.d.ts +58 -0
- package/dist/components/Combobox/Combobox.js +156 -0
- package/dist/components/Combobox/Combobox.js.map +1 -0
- package/dist/components/Combobox/index.d.ts +2 -0
- package/dist/components/DateRangePicker/DateRangePicker.css.d.ts +31 -0
- package/dist/components/DateRangePicker/DateRangePicker.d.ts +51 -0
- package/dist/components/DateRangePicker/DateRangePicker.js +261 -0
- package/dist/components/DateRangePicker/DateRangePicker.js.map +1 -0
- package/dist/components/DateRangePicker/DateRangePicker.styles.js +8 -0
- package/dist/components/DateRangePicker/DateRangePicker.styles.js.map +1 -0
- package/dist/components/DateRangePicker/index.d.ts +4 -0
- package/dist/components/DateRangePicker/presets.d.ts +27 -0
- package/dist/components/DateRangePicker/presets.js +62 -0
- package/dist/components/DateRangePicker/presets.js.map +1 -0
- package/dist/components/DateTimeInput/DateTimeInput.css.d.ts +1 -0
- package/dist/components/DateTimeInput/DateTimeInput.d.ts +9 -0
- package/dist/components/DateTimeInput/DateTimeInput.js +37 -0
- package/dist/components/DateTimeInput/DateTimeInput.js.map +1 -0
- package/dist/components/DateTimeInput/DateTimeInput.styles.js +7 -0
- package/dist/components/DateTimeInput/DateTimeInput.styles.js.map +1 -0
- package/dist/components/DateTimeInput/index.d.ts +2 -0
- package/dist/components/DescriptionList/DescriptionList.css.d.ts +62 -0
- package/dist/components/DescriptionList/DescriptionList.d.ts +15 -0
- package/dist/components/DescriptionList/DescriptionList.js +26 -0
- package/dist/components/DescriptionList/DescriptionList.js.map +1 -0
- package/dist/components/DescriptionList/DescriptionList.styles.js +42 -0
- package/dist/components/DescriptionList/DescriptionList.styles.js.map +1 -0
- package/dist/components/DescriptionList/index.d.ts +2 -0
- package/dist/components/DetailsSummary/DetailsSummary.css.d.ts +4 -0
- package/dist/components/DetailsSummary/DetailsSummary.d.ts +7 -0
- package/dist/components/DetailsSummary/DetailsSummary.js +26 -0
- package/dist/components/DetailsSummary/DetailsSummary.js.map +1 -0
- package/dist/components/DetailsSummary/DetailsSummary.styles.js +7 -0
- package/dist/components/DetailsSummary/DetailsSummary.styles.js.map +1 -0
- package/dist/components/DetailsSummary/index.d.ts +2 -0
- package/dist/components/Drawer/Drawer.css.d.ts +11 -0
- package/dist/components/Drawer/Drawer.d.ts +21 -0
- package/dist/components/Drawer/Drawer.js +66 -0
- package/dist/components/Drawer/Drawer.js.map +1 -0
- package/dist/components/Drawer/Drawer.styles.js +12 -0
- package/dist/components/Drawer/Drawer.styles.js.map +1 -0
- package/dist/components/Drawer/index.d.ts +2 -0
- package/dist/components/EmptyLine/EmptyLine.css.d.ts +11 -0
- package/dist/components/EmptyLine/EmptyLine.d.ts +7 -0
- package/dist/components/EmptyLine/EmptyLine.js +19 -0
- package/dist/components/EmptyLine/EmptyLine.js.map +1 -0
- package/dist/components/EmptyLine/EmptyLine.styles.js +12 -0
- package/dist/components/EmptyLine/EmptyLine.styles.js.map +1 -0
- package/dist/components/EmptyLine/index.d.ts +2 -0
- package/dist/components/EnvironmentChip/EnvironmentChip.css.d.ts +19 -0
- package/dist/components/EnvironmentChip/EnvironmentChip.d.ts +9 -0
- package/dist/components/EnvironmentChip/EnvironmentChip.js +21 -0
- package/dist/components/EnvironmentChip/EnvironmentChip.js.map +1 -0
- package/dist/components/EnvironmentChip/EnvironmentChip.styles.js +16 -0
- package/dist/components/EnvironmentChip/EnvironmentChip.styles.js.map +1 -0
- package/dist/components/EnvironmentChip/index.d.ts +2 -0
- package/dist/components/Field/Field.css.d.ts +14 -0
- package/dist/components/Field/Field.d.ts +74 -0
- package/dist/components/Field/Field.js +69 -0
- package/dist/components/Field/Field.js.map +1 -0
- package/dist/components/Field/Field.styles.js +6 -0
- package/dist/components/Field/Field.styles.js.map +1 -0
- package/dist/components/Field/index.d.ts +2 -0
- package/dist/components/Fieldset/Fieldset.css.d.ts +6 -0
- package/dist/components/Fieldset/Fieldset.d.ts +10 -0
- package/dist/components/Fieldset/Fieldset.js +32 -0
- package/dist/components/Fieldset/Fieldset.js.map +1 -0
- package/dist/components/Fieldset/Fieldset.styles.js +6 -0
- package/dist/components/Fieldset/Fieldset.styles.js.map +1 -0
- package/dist/components/Fieldset/index.d.ts +2 -0
- package/dist/components/Heading/Heading.css.d.ts +21 -0
- package/dist/components/Heading/Heading.d.ts +11 -0
- package/dist/components/Heading/Heading.js +22 -0
- package/dist/components/Heading/Heading.js.map +1 -0
- package/dist/components/Heading/Heading.styles.js +18 -0
- package/dist/components/Heading/Heading.styles.js.map +1 -0
- package/dist/components/Heading/index.d.ts +2 -0
- package/dist/components/Icon/Icon.css.d.ts +1 -0
- package/dist/components/Icon/Icon.d.ts +24 -0
- package/dist/components/Icon/Icon.js +24 -0
- package/dist/components/Icon/Icon.js.map +1 -0
- package/dist/components/Icon/Icon.styles.js +6 -0
- package/dist/components/Icon/Icon.styles.js.map +1 -0
- package/dist/components/Icon/index.d.ts +2 -0
- package/dist/components/List/List.css.d.ts +4 -0
- package/dist/components/List/List.d.ts +12 -0
- package/dist/components/List/List.js +28 -0
- package/dist/components/List/List.js.map +1 -0
- package/dist/components/List/List.styles.js +6 -0
- package/dist/components/List/List.styles.js.map +1 -0
- package/dist/components/List/index.d.ts +2 -0
- package/dist/components/Loader/Loader.css.d.ts +1 -0
- package/dist/components/Loader/Loader.d.ts +12 -0
- package/dist/components/Loader/Loader.js +23 -0
- package/dist/components/Loader/Loader.js.map +1 -0
- package/dist/components/Loader/Loader.styles.js +7 -0
- package/dist/components/Loader/Loader.styles.js.map +1 -0
- package/dist/components/Loader/index.d.ts +2 -0
- package/dist/components/Menu/Menu.css.d.ts +9 -0
- package/dist/components/Menu/Menu.d.ts +90 -0
- package/dist/components/Menu/Menu.js +140 -0
- package/dist/components/Menu/Menu.js.map +1 -0
- package/dist/components/Menu/Menu.styles.js +6 -0
- package/dist/components/Menu/Menu.styles.js.map +1 -0
- package/dist/components/Menu/index.d.ts +2 -0
- package/dist/components/MetricBar/MetricBar.css.d.ts +5 -0
- package/dist/components/MetricBar/MetricBar.d.ts +20 -0
- package/dist/components/MetricBar/MetricBar.js +35 -0
- package/dist/components/MetricBar/MetricBar.js.map +1 -0
- package/dist/components/MetricBar/MetricBar.styles.js +15 -0
- package/dist/components/MetricBar/MetricBar.styles.js.map +1 -0
- package/dist/components/MetricBar/index.d.ts +2 -0
- package/dist/components/Modal/Modal.css.d.ts +24 -0
- package/dist/components/Modal/Modal.d.ts +16 -0
- package/dist/components/Modal/Modal.js +67 -0
- package/dist/components/Modal/Modal.js.map +1 -0
- package/dist/components/Modal/Modal.styles.js +16 -0
- package/dist/components/Modal/Modal.styles.js.map +1 -0
- package/dist/components/Modal/index.d.ts +2 -0
- package/dist/components/NavRail/HumaraLogo.d.ts +5 -0
- package/dist/components/NavRail/HumaraLogo.js +33 -0
- package/dist/components/NavRail/HumaraLogo.js.map +1 -0
- package/dist/components/NavRail/NavRail.css.d.ts +9 -0
- package/dist/components/NavRail/NavRail.d.ts +53 -0
- package/dist/components/NavRail/NavRail.js +108 -0
- package/dist/components/NavRail/NavRail.js.map +1 -0
- package/dist/components/NavRail/NavRail.styles.js +7 -0
- package/dist/components/NavRail/NavRail.styles.js.map +1 -0
- package/dist/components/NavRail/index.d.ts +2 -0
- package/dist/components/NumberInput/NumberInput.d.ts +13 -0
- package/dist/components/NumberInput/NumberInput.js +53 -0
- package/dist/components/NumberInput/NumberInput.js.map +1 -0
- package/dist/components/NumberInput/index.d.ts +2 -0
- package/dist/components/PageHeader/PageHeader.css.d.ts +8 -0
- package/dist/components/PageHeader/PageHeader.d.ts +13 -0
- package/dist/components/PageHeader/PageHeader.js +42 -0
- package/dist/components/PageHeader/PageHeader.js.map +1 -0
- package/dist/components/PageHeader/PageHeader.styles.js +6 -0
- package/dist/components/PageHeader/PageHeader.styles.js.map +1 -0
- package/dist/components/PageHeader/index.d.ts +2 -0
- package/dist/components/Pagination/Pagination.css.d.ts +3 -0
- package/dist/components/Pagination/Pagination.d.ts +14 -0
- package/dist/components/Pagination/Pagination.js +61 -0
- package/dist/components/Pagination/Pagination.js.map +1 -0
- package/dist/components/Pagination/Pagination.styles.js +6 -0
- package/dist/components/Pagination/Pagination.styles.js.map +1 -0
- package/dist/components/Pagination/index.d.ts +2 -0
- package/dist/components/Popover/Popover.css.d.ts +4 -0
- package/dist/components/Popover/Popover.d.ts +18 -0
- package/dist/components/Popover/Popover.js +43 -0
- package/dist/components/Popover/Popover.js.map +1 -0
- package/dist/components/Popover/Popover.styles.js +7 -0
- package/dist/components/Popover/Popover.styles.js.map +1 -0
- package/dist/components/Popover/index.d.ts +2 -0
- package/dist/components/PortalContainer/PortalContainer.d.ts +17 -0
- package/dist/components/PortalContainer/PortalContainer.js +17 -0
- package/dist/components/PortalContainer/PortalContainer.js.map +1 -0
- package/dist/components/PortalContainer/index.d.ts +2 -0
- package/dist/components/ProgressBar/ProgressBar.css.d.ts +5 -0
- package/dist/components/ProgressBar/ProgressBar.d.ts +18 -0
- package/dist/components/ProgressBar/ProgressBar.js +50 -0
- package/dist/components/ProgressBar/ProgressBar.js.map +1 -0
- package/dist/components/ProgressBar/ProgressBar.styles.js +11 -0
- package/dist/components/ProgressBar/ProgressBar.styles.js.map +1 -0
- package/dist/components/ProgressBar/index.d.ts +2 -0
- package/dist/components/RadioCards/RadioCards.css.d.ts +6 -0
- package/dist/components/RadioCards/RadioCards.d.ts +20 -0
- package/dist/components/RadioCards/RadioCards.js +69 -0
- package/dist/components/RadioCards/RadioCards.js.map +1 -0
- package/dist/components/RadioCards/RadioCards.styles.js +6 -0
- package/dist/components/RadioCards/RadioCards.styles.js.map +1 -0
- package/dist/components/RadioCards/index.d.ts +2 -0
- package/dist/components/SaveBar/SaveBar.css.d.ts +5 -0
- package/dist/components/SaveBar/SaveBar.d.ts +14 -0
- package/dist/components/SaveBar/SaveBar.js +45 -0
- package/dist/components/SaveBar/SaveBar.js.map +1 -0
- package/dist/components/SaveBar/SaveBar.styles.js +6 -0
- package/dist/components/SaveBar/SaveBar.styles.js.map +1 -0
- package/dist/components/SaveBar/index.d.ts +2 -0
- package/dist/components/Select/Select.css.d.ts +3 -0
- package/dist/components/Select/Select.d.ts +29 -0
- package/dist/components/Select/Select.js +89 -0
- package/dist/components/Select/Select.js.map +1 -0
- package/dist/components/Select/Select.styles.js +7 -0
- package/dist/components/Select/Select.styles.js.map +1 -0
- package/dist/components/Select/index.d.ts +2 -0
- package/dist/components/Skeleton/Skeleton.css.d.ts +16 -0
- package/dist/components/Skeleton/Skeleton.d.ts +14 -0
- package/dist/components/Skeleton/Skeleton.js +37 -0
- package/dist/components/Skeleton/Skeleton.js.map +1 -0
- package/dist/components/Skeleton/Skeleton.styles.js +17 -0
- package/dist/components/Skeleton/Skeleton.styles.js.map +1 -0
- package/dist/components/Skeleton/index.d.ts +2 -0
- package/dist/components/Stack/Stack.css.d.ts +51 -0
- package/dist/components/Stack/Stack.d.ts +12 -0
- package/dist/components/Stack/Stack.js +21 -0
- package/dist/components/Stack/Stack.js.map +1 -0
- package/dist/components/Stack/Stack.styles.js +46 -0
- package/dist/components/Stack/Stack.styles.js.map +1 -0
- package/dist/components/Stack/index.d.ts +2 -0
- package/dist/components/StatCard/StatCard.css.d.ts +4 -0
- package/dist/components/StatCard/StatCard.d.ts +8 -0
- package/dist/components/StatCard/StatCard.js +27 -0
- package/dist/components/StatCard/StatCard.js.map +1 -0
- package/dist/components/StatCard/StatCard.styles.js +6 -0
- package/dist/components/StatCard/StatCard.styles.js.map +1 -0
- package/dist/components/StatCard/index.d.ts +2 -0
- package/dist/components/StatsGrid/StatsGrid.css.d.ts +1 -0
- package/dist/components/StatsGrid/StatsGrid.d.ts +7 -0
- package/dist/components/StatsGrid/StatsGrid.js +17 -0
- package/dist/components/StatsGrid/StatsGrid.js.map +1 -0
- package/dist/components/StatsGrid/StatsGrid.styles.js +6 -0
- package/dist/components/StatsGrid/StatsGrid.styles.js.map +1 -0
- package/dist/components/StatsGrid/index.d.ts +2 -0
- package/dist/components/StatusBadge/StatusBadge.css.d.ts +53 -0
- package/dist/components/StatusBadge/StatusBadge.d.ts +9 -0
- package/dist/components/StatusBadge/StatusBadge.js +17 -0
- package/dist/components/StatusBadge/StatusBadge.js.map +1 -0
- package/dist/components/StatusBadge/StatusBadge.styles.js +19 -0
- package/dist/components/StatusBadge/StatusBadge.styles.js.map +1 -0
- package/dist/components/StatusBadge/index.d.ts +2 -0
- package/dist/components/Switch/Switch.css.d.ts +3 -0
- package/dist/components/Switch/Switch.d.ts +10 -0
- package/dist/components/Switch/Switch.js +41 -0
- package/dist/components/Switch/Switch.js.map +1 -0
- package/dist/components/Switch/Switch.styles.js +8 -0
- package/dist/components/Switch/Switch.styles.js.map +1 -0
- package/dist/components/Switch/index.d.ts +2 -0
- package/dist/components/Switcher/Switcher.css.d.ts +33 -0
- package/dist/components/Switcher/Switcher.d.ts +68 -0
- package/dist/components/Switcher/Switcher.js +158 -0
- package/dist/components/Switcher/Switcher.js.map +1 -0
- package/dist/components/Switcher/Switcher.styles.js +16 -0
- package/dist/components/Switcher/Switcher.styles.js.map +1 -0
- package/dist/components/Switcher/index.d.ts +2 -0
- package/dist/components/Table/Table.css.d.ts +16 -0
- package/dist/components/Table/Table.d.ts +66 -0
- package/dist/components/Table/Table.js +136 -0
- package/dist/components/Table/Table.js.map +1 -0
- package/dist/components/Table/Table.styles.js +11 -0
- package/dist/components/Table/Table.styles.js.map +1 -0
- package/dist/components/Table/index.d.ts +2 -0
- package/dist/components/TableAction/TableAction.d.ts +10 -0
- package/dist/components/TableAction/TableAction.js +19 -0
- package/dist/components/TableAction/TableAction.js.map +1 -0
- package/dist/components/TableAction/index.d.ts +2 -0
- package/dist/components/Tabs/Tabs.css.d.ts +6 -0
- package/dist/components/Tabs/Tabs.d.ts +54 -0
- package/dist/components/Tabs/Tabs.js +67 -0
- package/dist/components/Tabs/Tabs.js.map +1 -0
- package/dist/components/Tabs/Tabs.styles.js +7 -0
- package/dist/components/Tabs/Tabs.styles.js.map +1 -0
- package/dist/components/Tabs/index.d.ts +2 -0
- package/dist/components/Tag/Tag.css.d.ts +9 -0
- package/dist/components/Tag/Tag.d.ts +7 -0
- package/dist/components/Tag/Tag.js +13 -0
- package/dist/components/Tag/Tag.js.map +1 -0
- package/dist/components/Tag/Tag.styles.js +12 -0
- package/dist/components/Tag/Tag.styles.js.map +1 -0
- package/dist/components/Tag/index.d.ts +2 -0
- package/dist/components/TextInput/TextInput.css.d.ts +1 -0
- package/dist/components/TextInput/TextInput.d.ts +16 -0
- package/dist/components/TextInput/TextInput.js +62 -0
- package/dist/components/TextInput/TextInput.js.map +1 -0
- package/dist/components/TextInput/TextInput.styles.js +6 -0
- package/dist/components/TextInput/TextInput.styles.js.map +1 -0
- package/dist/components/TextInput/index.d.ts +2 -0
- package/dist/components/TextInput/useCharCount.d.ts +15 -0
- package/dist/components/TextInput/useCharCount.js +14 -0
- package/dist/components/TextInput/useCharCount.js.map +1 -0
- package/dist/components/Textarea/Textarea.css.d.ts +2 -0
- package/dist/components/Textarea/Textarea.d.ts +16 -0
- package/dist/components/Textarea/Textarea.js +59 -0
- package/dist/components/Textarea/Textarea.js.map +1 -0
- package/dist/components/Textarea/Textarea.styles.js +7 -0
- package/dist/components/Textarea/Textarea.styles.js.map +1 -0
- package/dist/components/Textarea/index.d.ts +2 -0
- package/dist/components/ThemePicker/ThemePicker.css.d.ts +10 -0
- package/dist/components/ThemePicker/ThemePicker.d.ts +18 -0
- package/dist/components/ThemePicker/ThemePicker.js +74 -0
- package/dist/components/ThemePicker/ThemePicker.js.map +1 -0
- package/dist/components/ThemePicker/ThemePicker.styles.js +7 -0
- package/dist/components/ThemePicker/ThemePicker.styles.js.map +1 -0
- package/dist/components/ThemePicker/index.d.ts +2 -0
- package/dist/components/ToggleGroup/ToggleGroup.css.d.ts +4 -0
- package/dist/components/ToggleGroup/ToggleGroup.d.ts +23 -0
- package/dist/components/ToggleGroup/ToggleGroup.js +68 -0
- package/dist/components/ToggleGroup/ToggleGroup.js.map +1 -0
- package/dist/components/ToggleGroup/ToggleGroup.styles.js +13 -0
- package/dist/components/ToggleGroup/ToggleGroup.styles.js.map +1 -0
- package/dist/components/ToggleGroup/index.d.ts +2 -0
- package/dist/components/Tooltip/Tooltip.css.d.ts +2 -0
- package/dist/components/Tooltip/Tooltip.d.ts +18 -0
- package/dist/components/Tooltip/Tooltip.js +33 -0
- package/dist/components/Tooltip/Tooltip.js.map +1 -0
- package/dist/components/Tooltip/Tooltip.styles.js +6 -0
- package/dist/components/Tooltip/Tooltip.styles.js.map +1 -0
- package/dist/components/Tooltip/index.d.ts +2 -0
- package/dist/components/TopBar/TopBar.css.d.ts +3 -0
- package/dist/components/TopBar/TopBar.d.ts +9 -0
- package/dist/components/TopBar/TopBar.js +20 -0
- package/dist/components/TopBar/TopBar.js.map +1 -0
- package/dist/components/TopBar/TopBar.styles.js +6 -0
- package/dist/components/TopBar/TopBar.styles.js.map +1 -0
- package/dist/components/TopBar/index.d.ts +2 -0
- package/dist/components/UserMenu/UserMenu.css.d.ts +5 -0
- package/dist/components/UserMenu/UserMenu.d.ts +26 -0
- package/dist/components/UserMenu/UserMenu.js +55 -0
- package/dist/components/UserMenu/UserMenu.js.map +1 -0
- package/dist/components/UserMenu/UserMenu.styles.js +7 -0
- package/dist/components/UserMenu/UserMenu.styles.js.map +1 -0
- package/dist/components/UserMenu/index.d.ts +2 -0
- package/dist/foundations/Foundations.css.d.ts +12 -0
- package/dist/index.d.ts +60 -0
- package/dist/index.js +61 -0
- package/dist/styles/input.css.d.ts +18 -0
- package/dist/styles/input.styles.js +6 -0
- package/dist/styles/input.styles.js.map +1 -0
- package/dist/styles/shared.css.d.ts +8 -0
- package/dist/styles/shared.styles.js +6 -0
- package/dist/styles/shared.styles.js.map +1 -0
- package/dist/styles.css +4 -0
- package/dist/theme/fontSize.d.ts +15 -0
- package/dist/theme/fontSize.js +31 -0
- package/dist/theme/fontSize.js.map +1 -0
- package/dist/theme/theme.d.ts +29 -0
- package/dist/theme/theme.js +52 -0
- package/dist/theme/theme.js.map +1 -0
- package/dist/tokens/contract.css.d.ts +120 -0
- package/dist/tokens/contract.styles.js +68 -0
- package/dist/tokens/contract.styles.js.map +1 -0
- package/dist/tokens/global.css.d.ts +0 -0
- package/dist/tokens/global.styles.js +2 -0
- package/dist/tokens/index.d.ts +9 -0
- package/dist/tokens/palette.d.ts +16 -0
- package/dist/tokens/palette.js +18 -0
- package/dist/tokens/palette.js.map +1 -0
- package/dist/tokens/scale.d.ts +51 -0
- package/dist/tokens/scale.js +47 -0
- package/dist/tokens/scale.js.map +1 -0
- package/dist/tokens/sprinkles.css.d.ts +38 -0
- package/dist/tokens/sprinkles.styles.js +349 -0
- package/dist/tokens/sprinkles.styles.js.map +1 -0
- package/dist/tokens/themes.css.d.ts +387 -0
- package/dist/tokens.js +5 -0
- package/package.json +107 -4
- package/skills/back-office-kit/SKILL.md +36 -0
- package/skills/back-office-kit/references/artifact-template.html +102 -0
- package/skills/back-office-kit/references/components.md +1239 -0
- package/skills/back-office-kit/references/install.md +187 -0
- package/skills/back-office-kit/references/migrate.md +86 -0
- package/skills/back-office-kit/references/patterns.md +198 -0
- package/skills/back-office-kit/references/testing.md +158 -0
|
@@ -0,0 +1,187 @@
|
|
|
1
|
+
# Installing @15gifts/back-office-kit
|
|
2
|
+
|
|
3
|
+
## Vite / React 19 app
|
|
4
|
+
|
|
5
|
+
```bash
|
|
6
|
+
npm install --save-exact @15gifts/back-office-kit
|
|
7
|
+
# Use the same lucide-react version as the library, so the app doesn't bundle two copies:
|
|
8
|
+
npm install --save-exact lucide-react@$(npm view @15gifts/back-office-kit dependencies.lucide-react)
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
The package is public on npm. In Humara repos whose `.npmrc` routes the `@15gifts` scope to our private registry, it comes through that registry's npm upstream, so no extra setup is needed. `react` and `react-dom` 19 are peer dependencies. No Vanilla Extract or bundler plugin is needed, because the package ships compiled CSS.
|
|
12
|
+
|
|
13
|
+
**index.html**: add the fonts to `<head>`:
|
|
14
|
+
|
|
15
|
+
```html
|
|
16
|
+
<link rel="preconnect" href="https://fonts.googleapis.com" />
|
|
17
|
+
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
|
|
18
|
+
<link
|
|
19
|
+
rel="stylesheet"
|
|
20
|
+
href="https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@400;500&family=Poppins:wght@400;500;600&display=swap"
|
|
21
|
+
/>
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
**src/main.tsx**: import the styles once and apply the saved theme and text size before rendering:
|
|
25
|
+
|
|
26
|
+
```tsx
|
|
27
|
+
import '@15gifts/back-office-kit/styles.css'
|
|
28
|
+
import { applyStoredFontSize, applyStoredTheme } from '@15gifts/back-office-kit'
|
|
29
|
+
import { createRoot } from 'react-dom/client'
|
|
30
|
+
import { App } from './App'
|
|
31
|
+
|
|
32
|
+
applyStoredTheme() // reads localStorage, defaults to 'system' (pass 'light' to default to light)
|
|
33
|
+
applyStoredFontSize() // reads localStorage, defaults to 'md' (14px body text)
|
|
34
|
+
createRoot(document.getElementById('root')!).render(<App />)
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
The library CSS lives in the `bok` cascade layer, so **unlayered** app CSS always wins without specificity battles. Delete any CSS reset or global body styles that fight it (the library sets `body` background, colour and font).
|
|
38
|
+
|
|
39
|
+
**If the app uses cascade layers** (Mantine's layered CSS, Tailwind v4, its own `@layer`), declare the order once, before any other CSS, with `bok` after resets and other UI libraries and before the app:
|
|
40
|
+
|
|
41
|
+
```css
|
|
42
|
+
@layer reset, mantine, bok, app;
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
Otherwise another library's element styles (e.g. Mantine's `button { font: inherit }`) override library components.
|
|
46
|
+
|
|
47
|
+
**Text size.** The library sets the root font size and sizes everything in rem/em, so one setting scales the whole UI: `md` (default, 14px body text, a 16px root), `sm` (about 6% smaller) or `lg` (about 6% larger). Use `setFontSize('sm' | 'md' | 'lg')` or `useFontSize()` for a user setting (saved in localStorage); `applyStoredFontSize()` restores it. Don't set `html { font-size }` in the app, and size your own UI in rem/em (never px, except 1px borders) so it scales too.
|
|
48
|
+
|
|
49
|
+
## Theming
|
|
50
|
+
|
|
51
|
+
- Themes: `light`, `dark`, `sand`, and `system` (follows the OS).
|
|
52
|
+
- `setTheme('dark')` sets `<html data-theme="dark">` and remembers it. `useTheme()` returns `[theme, setTheme]` for UI such as `ThemePicker`.
|
|
53
|
+
- To force a theme for a section, put `data-theme="dark"` on any wrapper element.
|
|
54
|
+
- `getColorScheme()` / `useColorScheme()` return the resolved `'light' | 'dark'` (`system` follows the OS and `sand` is light). Use them to drive another library's dark mode while both coexist, e.g. Mantine: `<MantineProvider forceColorScheme={useColorScheme()}>`.
|
|
55
|
+
- The choice is saved under `THEME_STORAGE_KEY` (`bok-theme`). To keep users' choices from an older theme setting, pass `migrate`: `applyStoredTheme({ migrate: () => readOldSetting() })`. It runs only when nothing is saved yet, and the result is saved.
|
|
56
|
+
|
|
57
|
+
## Popups inside native dialogs
|
|
58
|
+
|
|
59
|
+
Select, Combobox, Menu, Popover and Tooltip portal to `document.body`. Inside the library `Modal` or `Drawer` that's handled automatically. Inside an app's own `<dialog>` opened with `showModal()` (the top layer), wrap the dialog content so popups render inside it:
|
|
60
|
+
|
|
61
|
+
```tsx
|
|
62
|
+
<dialog ref={dialogRef}>
|
|
63
|
+
<PortalContainer container={dialogRef}>…</PortalContainer>
|
|
64
|
+
</dialog>
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
## Routing
|
|
68
|
+
|
|
69
|
+
Library components never import a router. Pass links through `render`:
|
|
70
|
+
|
|
71
|
+
```tsx
|
|
72
|
+
import { Link } from 'react-router'
|
|
73
|
+
|
|
74
|
+
export const ViewRuns = () => <Button render={<Link to="/runs" />}>View runs</Button>
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
## Your own styles
|
|
78
|
+
|
|
79
|
+
- **Colours, fonts, shadows:** CSS variables only, never raw values: `--bok-bg`, `--bok-surface`, `--bok-surface-sunken`, `--bok-border`, `--bok-ink`, `--bok-ink-muted`, `--bok-primary`, `--bok-accent`, `--bok-accent-ink`, `--bok-success`, `--bok-warning`, `--bok-danger`, `--bok-font-sans`, `--bok-font-mono`, `--bok-shadow-md`, and so on. The base tones (`--bok-accent`, `--bok-success`, …) are fills; text uses the `-ink` variants.
|
|
80
|
+
- **Sizes:** rem for layout (spacing on a 0.25rem grid: `0.5rem`, `0.75rem`, `1rem`, `1.5rem`, `2rem`; radius `0.5rem` for controls, `0.75rem`–`1rem` for cards), and em for things that should follow their own text (icon sizes `1em`, gaps inside a button). No px except 1px borders. This keeps the global text-size setting working.
|
|
81
|
+
|
|
82
|
+
Vanilla Extract apps can import typed tokens instead:
|
|
83
|
+
|
|
84
|
+
```ts
|
|
85
|
+
import { vars, space, radius } from '@15gifts/back-office-kit/tokens'
|
|
86
|
+
export const panel = style({
|
|
87
|
+
background: vars.color.surface,
|
|
88
|
+
padding: space['4'],
|
|
89
|
+
borderRadius: radius.xl,
|
|
90
|
+
})
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
## Linting
|
|
94
|
+
|
|
95
|
+
Use **ESLint** with our shared config, `@15gifts/eslint-config-humara`, not oxlint or Biome. The Vite React template now ships oxlint: remove it (its dependency, its config file and the `lint` script) and set up ESLint instead.
|
|
96
|
+
|
|
97
|
+
1. `@15gifts/*` packages come from our private registry. Copy the `@15gifts:registry=…` line from an existing Humara repo's `.npmrc` (e.g. `back-office-kit` or `indy-backoffice`) into the app's `.npmrc`, keep `registry=https://registry.npmjs.org/` for everything else, and log in with `aws codeartifact login` (needs the VPN).
|
|
98
|
+
2. `npm install --save-dev --save-exact eslint@9 @15gifts/eslint-config-humara @eslint/compat` (the shared config targets ESLint 9).
|
|
99
|
+
- **TypeScript version:** the shared config's typescript-eslint supports TypeScript up to 6.0, but the Vite template now installs TypeScript 7, which crashes ESLint. Pin TypeScript 6 (`npm install --save-dev --save-exact typescript@6.0.3`) _before_ installing the config, then check `npm ls typescript` shows one version. If you installed the config first, reinstall it after pinning.
|
|
100
|
+
- **Prettier:** the shared config runs Prettier as a lint rule. Add our house `.prettierrc` (below), or lint reports every line formatted differently.
|
|
101
|
+
3. `eslint.config.js`:
|
|
102
|
+
|
|
103
|
+
```js
|
|
104
|
+
import path from 'node:path'
|
|
105
|
+
import { base, react, typescript, vitest } from '@15gifts/eslint-config-humara'
|
|
106
|
+
import { includeIgnoreFile } from '@eslint/compat'
|
|
107
|
+
|
|
108
|
+
const dir = path.dirname(new URL(import.meta.url).pathname)
|
|
109
|
+
|
|
110
|
+
export default [
|
|
111
|
+
includeIgnoreFile(path.resolve(dir, '.gitignore')),
|
|
112
|
+
{ ignores: ['eslint.config.js'] },
|
|
113
|
+
...base,
|
|
114
|
+
...react,
|
|
115
|
+
...typescript,
|
|
116
|
+
...vitest,
|
|
117
|
+
{
|
|
118
|
+
files: ['**/*.{ts,tsx}'],
|
|
119
|
+
languageOptions: {
|
|
120
|
+
parserOptions: { project: ['tsconfig.app.json', 'tsconfig.node.json'], tsconfigRootDir: dir },
|
|
121
|
+
},
|
|
122
|
+
},
|
|
123
|
+
{
|
|
124
|
+
// Our components and recipes use named exports; the shared config prefers default exports.
|
|
125
|
+
rules: { 'import/prefer-default-export': 'off' },
|
|
126
|
+
},
|
|
127
|
+
]
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
4. `.prettierrc`:
|
|
131
|
+
|
|
132
|
+
```json
|
|
133
|
+
{
|
|
134
|
+
"endOfLine": "lf",
|
|
135
|
+
"semi": false,
|
|
136
|
+
"singleQuote": true,
|
|
137
|
+
"tabWidth": 2,
|
|
138
|
+
"trailingComma": "all",
|
|
139
|
+
"printWidth": 100
|
|
140
|
+
}
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
Vite's entry file `src/main.tsx` may trip the shared config's filename rule; turn `check-file/filename-naming-convention` off for that file only.
|
|
144
|
+
|
|
145
|
+
Add `...storybook` from the same package if the app has Storybook. The `"lint": "eslint ."` script replaces oxlint's.
|
|
146
|
+
|
|
147
|
+
## Claude artifacts
|
|
148
|
+
|
|
149
|
+
Artifacts are single HTML pages with no bundler. They can load scripts only from public CDNs (jsdelivr, unpkg, …) at an **exact version at least two weeks old**, and stylesheets only from Google Fonts. The package ships a browser build for exactly this: `dist/browser/back-office-kit.js` bundles everything **except React**, which the page provides once through an import map. It also includes the styles and adds them to the page when imported, so **don't fetch or paste `styles.css`**. Start from [artifact-template.html](artifact-template.html).
|
|
150
|
+
|
|
151
|
+
1. **Pick versions.** Use the newest `@15gifts/back-office-kit` release that's at least two weeks old (`npm view @15gifts/back-office-kit time --json`). Then find the React version jsdelivr pins inside React DOM:
|
|
152
|
+
|
|
153
|
+
```bash
|
|
154
|
+
curl -s https://cdn.jsdelivr.net/npm/react-dom@<react-version>/client/+esm | grep -o '/npm/react@[^/]*'
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
Use that same exact React version for `react`, `react/jsx-runtime`, `react-dom` and `react-dom/client` in the import map. If the versions differ, the page loads two Reacts and components crash with "Invalid hook call".
|
|
158
|
+
|
|
159
|
+
2. **Fonts.** Keep the Google Fonts `<link>` for Poppins and JetBrains Mono from the template. The component styles need nothing: importing the library adds them.
|
|
160
|
+
3. **Import map:**
|
|
161
|
+
|
|
162
|
+
```html
|
|
163
|
+
<script type="importmap">
|
|
164
|
+
{
|
|
165
|
+
"imports": {
|
|
166
|
+
"react": "https://cdn.jsdelivr.net/npm/react@19.3.1/+esm",
|
|
167
|
+
"react/jsx-runtime": "https://cdn.jsdelivr.net/npm/react@19.3.1/jsx-runtime/+esm",
|
|
168
|
+
"react-dom": "https://cdn.jsdelivr.net/npm/react-dom@19.3.1/+esm",
|
|
169
|
+
"react-dom/client": "https://cdn.jsdelivr.net/npm/react-dom@19.3.1/client/+esm",
|
|
170
|
+
"htm": "https://cdn.jsdelivr.net/npm/htm@3.1.1/+esm",
|
|
171
|
+
"lucide-react": "https://cdn.jsdelivr.net/npm/lucide-react@<library's lucide version>/+esm",
|
|
172
|
+
"@15gifts/back-office-kit": "https://cdn.jsdelivr.net/npm/@15gifts/back-office-kit@<version>/dist/browser/back-office-kit.js"
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
</script>
|
|
176
|
+
```
|
|
177
|
+
|
|
178
|
+
Use the lucide-react version from `npm view @15gifts/back-office-kit@<version> dependencies.lucide-react`. jsdelivr resolves its React to the same URL as above, so there's still one React.
|
|
179
|
+
|
|
180
|
+
4. **Write the UI with `htm`, not JSX.** There's no compiler. `htm` gives JSX-like templates: `` html`<${Button} variant="secondary">Cancel</${Button}>` `` (bind it with `htm.bind(createElement)`). Components, props, `render` links and theming all work exactly as in an app.
|
|
181
|
+
5. **Theme:** set `<html data-theme="light">` (or `dark`, `sand`, `system`), or call `setTheme`. Text size works too, via `data-font-size` or `setFontSize`.
|
|
182
|
+
|
|
183
|
+
Checked against the browser build: one React, styles injected on import, popups work inside Modal, light/dark switching, and lucide icons.
|
|
184
|
+
|
|
185
|
+
## Claude skill for this app
|
|
186
|
+
|
|
187
|
+
`npx back-office-kit skill` links this skill into the project's `.claude/skills/`, so it stays version-locked to the installed package.
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
# Migrating existing UI to @15gifts/back-office-kit
|
|
2
|
+
|
|
3
|
+
Work page by page. Keep each step shippable.
|
|
4
|
+
|
|
5
|
+
## Steps
|
|
6
|
+
|
|
7
|
+
1. **Install and wire up** ([install.md](install.md)). Import `@15gifts/back-office-kit/styles.css` once and add the fonts.
|
|
8
|
+
2. **Remove the conflicting globals:** CSS resets, `body` font/colour/background, and Tailwind preflight (`corePlugins: { preflight: false }`) if Tailwind stays for layout.
|
|
9
|
+
3. **Swap the shell first** (`AppShell`, `NavRail`, `TopBar`, `PageHeader`). It gives the biggest visual win.
|
|
10
|
+
4. **Swap leaf components** using the table below, one page at a time.
|
|
11
|
+
5. **Replace colours.** Search for hex/rgb literals and colour utility classes, and map them to tokens (below).
|
|
12
|
+
6. **Delete dead CSS**, and uninstall the old UI library once nothing imports it.
|
|
13
|
+
7. **Check** each migrated page in light and dark (`setTheme('dark')`), and tab through it with the keyboard.
|
|
14
|
+
|
|
15
|
+
## Component mapping
|
|
16
|
+
|
|
17
|
+
| From (shadcn / MUI / Mantine / hand-rolled) | To |
|
|
18
|
+
| --------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------- |
|
|
19
|
+
| `<button>`, `Button` (variant default/outline/ghost/destructive) | `Button` (`primary` / `secondary` / `ghost` / `danger`) |
|
|
20
|
+
| `<a className="btn">`, `Button asChild` + `Link`, `Button component={Link}` | `Button render={<Link to="…" />}` |
|
|
21
|
+
| `Card`, `Paper`, bordered `div` | `Card` (`heading`, `actions`) |
|
|
22
|
+
| `Badge`, `Chip` (status) | `StatusBadge` for run/job states, `Badge tone=…` otherwise |
|
|
23
|
+
| `Chip` / toggle pills (filters) | `Chip` (pressed state) |
|
|
24
|
+
| `Input` + `Label` + helper text, `TextField` | `TextInput label description error` |
|
|
25
|
+
| `Textarea`, `TextField multiline` | `Textarea` |
|
|
26
|
+
| `Select`, native `<select>`, `Autocomplete` | `Select` (fixed list), `Combobox` (filterable), `Autocomplete` (free text + suggestions) |
|
|
27
|
+
| `Switch`, `Checkbox`, `RadioGroup` | `Switch`, `Checkbox`, `RadioCards` (or `ToggleGroup` for 2–4 short options) |
|
|
28
|
+
| `Tabs` | `Tabs items=[…]` (supports `count`) |
|
|
29
|
+
| `Dialog`, `Modal` | `Modal` (centred, blocking) or `Drawer` (side panel) |
|
|
30
|
+
| `DropdownMenu`, `Menu` | `Menu` (`items`, `'separator'`) |
|
|
31
|
+
| `Popover`, `Tooltip` | `Popover`, `Tooltip` |
|
|
32
|
+
| `Table`, `DataGrid` (simple) | `Table columns rows getRowKey` (or `Table.Root/Row/Cell` parts) |
|
|
33
|
+
| `Progress`, `LinearProgress` | `ProgressBar` (done/running/failed/total) or `MetricBar` (a percentage with segments) |
|
|
34
|
+
| Spinner | `Loader`, or `Button loading`, or `Skeleton` for placeholders |
|
|
35
|
+
| `Alert`, toast-style inline banners | `Alert tone=…` |
|
|
36
|
+
| `Avatar` | `Avatar name src` |
|
|
37
|
+
| Pagination | `Pagination page pageCount onPageChange` |
|
|
38
|
+
| Stat / KPI tiles | `StatCard` inside `StatsGrid` |
|
|
39
|
+
| Flex/stack wrappers | `Stack direction gap` |
|
|
40
|
+
| Icon sets (heroicons, MUI icons, react-icons) | `lucide-react` equivalents |
|
|
41
|
+
|
|
42
|
+
## Colour mapping
|
|
43
|
+
|
|
44
|
+
| Was | Token |
|
|
45
|
+
| -------------------------------------- | ------------------------------------------------------------------ |
|
|
46
|
+
| page background (`gray-50`, `#f8f8f8`) | `--bok-bg` |
|
|
47
|
+
| card/panel background (`white`) | `--bok-surface` |
|
|
48
|
+
| subtle/inset background (`gray-100`) | `--bok-surface-sunken`, hover `--bok-surface-hover` |
|
|
49
|
+
| borders (`gray-200`) | `--bok-border` (strong: `--bok-border-strong`) |
|
|
50
|
+
| body text (`gray-900`) | `--bok-ink` |
|
|
51
|
+
| secondary text (`gray-500/600`) | `--bok-ink-muted` (tertiary: `--bok-ink-subtle`) |
|
|
52
|
+
| brand / primary actions | `--bok-primary`, text on it `--bok-on-primary` |
|
|
53
|
+
| highlights, selected states | `--bok-accent`, `--bok-accent-subtle`, `--bok-accent-ink` |
|
|
54
|
+
| green / amber / red / blue states | `--bok-success*`, `--bok-warning*`, `--bok-danger*`, `--bok-info*` |
|
|
55
|
+
| monospace | `--bok-font-mono` |
|
|
56
|
+
|
|
57
|
+
Never translate a colour to a palette hex. If nothing fits, the design probably needs a library component instead. Flag it to the user.
|
|
58
|
+
|
|
59
|
+
## Running alongside Mantine (or another UI library)
|
|
60
|
+
|
|
61
|
+
Migrate page by page with both libraries loaded:
|
|
62
|
+
|
|
63
|
+
1. Layer order: `@layer reset, mantine, bok, app;` (see install.md).
|
|
64
|
+
2. Theme: the library owns `data-theme`. Derive the other library's scheme from it: `forceColorScheme={useColorScheme()}`.
|
|
65
|
+
3. Old tokens: re-point the app's own CSS variables at `--bok-*` (e.g. `--app-text: var(--bok-ink)`), so unmigrated screens match in every theme.
|
|
66
|
+
4. Saved theme: `applyStoredTheme({ migrate })` carries over the old setting.
|
|
67
|
+
5. Remove the other library once nothing imports it. Bundle size peaks while both are loaded.
|
|
68
|
+
|
|
69
|
+
## Behaviour differences that affect tests
|
|
70
|
+
|
|
71
|
+
Library components follow ARIA patterns closely, so tests written against older components often need new queries:
|
|
72
|
+
|
|
73
|
+
| Component | Library behaviour | Update tests to |
|
|
74
|
+
| ----------------------------------- | --------------------------------------------------------------------------- | -------------------------------------------------------------------------- |
|
|
75
|
+
| Alert | `info`/`success` are `role="status"`; `warning`/`danger` are `role="alert"` | query by the role for the tone |
|
|
76
|
+
| Loader | `role="status"`, named "Loading" (or `label`) | `getByRole('status')`, not `progressbar` |
|
|
77
|
+
| Button `loading` | `aria-disabled="true"` + `aria-busy`, not native `disabled` (keeps focus) | `toHaveAttribute('aria-disabled', 'true')` |
|
|
78
|
+
| Switch | `role="switch"` plus a hidden native checkbox for forms | `getByRole('switch', { name })`, not `getByLabelText` |
|
|
79
|
+
| TextInput `maxLength` + `showCount` | hard limit: typing stops at the limit | for "allow over, show red" use `countLimit` (soft limit, sets `data-over`) |
|
|
80
|
+
| EnvironmentChip | includes visually hidden "Environment: " text | match with a regex or `getByText('staging')` |
|
|
81
|
+
| Select | `onValueChange` fires only when the value changes | |
|
|
82
|
+
| Badge | colour prop is `tone` (`color` is a type error) | |
|
|
83
|
+
|
|
84
|
+
## Tailwind apps
|
|
85
|
+
|
|
86
|
+
Tailwind can stay for layout (flex, grid, gap, padding). Replace colour, font, radius and shadow utilities with library components, or with arbitrary values over tokens (`bg-[var(--bok-surface)]`). Don't restyle library components with utility classes. Use their props.
|
|
@@ -0,0 +1,198 @@
|
|
|
1
|
+
# Page patterns
|
|
2
|
+
|
|
3
|
+
Compose these from library components. Check exact props in [components.md](components.md).
|
|
4
|
+
|
|
5
|
+
## 1. App shell (every internal app)
|
|
6
|
+
|
|
7
|
+
```tsx
|
|
8
|
+
import {
|
|
9
|
+
AppShell,
|
|
10
|
+
Breadcrumbs,
|
|
11
|
+
EnvironmentChip,
|
|
12
|
+
NavRail,
|
|
13
|
+
TopBar,
|
|
14
|
+
UserMenu,
|
|
15
|
+
type BreadcrumbItem,
|
|
16
|
+
} from '@15gifts/back-office-kit'
|
|
17
|
+
import { Activity, LayoutDashboard, Settings } from 'lucide-react'
|
|
18
|
+
import { Link, Outlet, useLocation } from 'react-router'
|
|
19
|
+
|
|
20
|
+
// `user`, `signOut` and `crumbs` come from your app (auth, route metadata).
|
|
21
|
+
export function Layout({
|
|
22
|
+
user,
|
|
23
|
+
signOut,
|
|
24
|
+
crumbs,
|
|
25
|
+
}: {
|
|
26
|
+
user: { name: string }
|
|
27
|
+
signOut: () => void
|
|
28
|
+
crumbs: BreadcrumbItem[]
|
|
29
|
+
}) {
|
|
30
|
+
const { pathname } = useLocation()
|
|
31
|
+
const nav = [
|
|
32
|
+
{ label: 'Dashboard', to: '/', icon: <LayoutDashboard size="1.43em" aria-hidden /> },
|
|
33
|
+
{ label: 'Runs', to: '/runs', icon: <Activity size="1.43em" aria-hidden /> },
|
|
34
|
+
{ label: 'Settings', to: '/settings', icon: <Settings size="1.43em" aria-hidden /> },
|
|
35
|
+
]
|
|
36
|
+
return (
|
|
37
|
+
<AppShell
|
|
38
|
+
rail={
|
|
39
|
+
<NavRail
|
|
40
|
+
appName="Persona Service"
|
|
41
|
+
brandRender={<Link to="/" />}
|
|
42
|
+
items={nav.map((n) => ({ ...n, render: <Link to={n.to} />, active: pathname === n.to }))}
|
|
43
|
+
footer={(expanded) => (
|
|
44
|
+
<UserMenu name={user.name} showName={expanded} onSignOut={signOut} />
|
|
45
|
+
)}
|
|
46
|
+
/>
|
|
47
|
+
}
|
|
48
|
+
topBar={
|
|
49
|
+
<TopBar
|
|
50
|
+
start={<Breadcrumbs items={crumbs} />}
|
|
51
|
+
end={<EnvironmentChip environment="staging" />}
|
|
52
|
+
/>
|
|
53
|
+
}
|
|
54
|
+
>
|
|
55
|
+
<Outlet />
|
|
56
|
+
</AppShell>
|
|
57
|
+
)
|
|
58
|
+
}
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
The rail starts collapsed and remembers the user's choice in localStorage (`persistKey`, default `'bok-rail-expanded'`; `null` turns it off). Pass `expanded` and `onExpandedChange` to control it yourself; nothing is stored then.
|
|
62
|
+
|
|
63
|
+
**Switchers in the trail.** A crumb's `label` can be any control. For a customer or branch switcher, pass a `Switcher` (`size="sm"`) as the label with `current: false`: `{ label: <Switcher label="Customer" size="sm" value={id} items={customers} onSelect={…} />, current: false }`.
|
|
64
|
+
|
|
65
|
+
**Side panel.** Pass `sidePanel` only on pages that have section navigation. Leave it `undefined` elsewhere (don't pass an empty component), and the content sits right next to the rail.
|
|
66
|
+
|
|
67
|
+
**Logo and app name.** The Humara logo is built into `NavRail` (the wordmark when expanded, the fan mark when collapsed) and follows the theme. Don't add your own logo. Set `appName` to the tool's name, e.g. `"Back Office"` or `"Persona Service"`: it shows under the wordmark and names the home link ("Persona Service home").
|
|
68
|
+
|
|
69
|
+
**No router?** Use `href` instead of `render`: `items={[{ label: 'Runs', href: '/runs', icon, active: true }]}`, `brandHref="/"`, and `{ label: 'Home', href: '/' }` in `Breadcrumbs`.
|
|
70
|
+
|
|
71
|
+
`AppShell` already spaces its direct children (24px gap) and caps the content width. Put page sections straight inside it, without a wrapping `Stack`. Pass `contained={false}` for full-width content.
|
|
72
|
+
|
|
73
|
+
Each page then starts with a `PageHeader` (one h1, an optional facts line, and the page's primary action at the top right).
|
|
74
|
+
|
|
75
|
+
## 2. Data table page
|
|
76
|
+
|
|
77
|
+
```tsx
|
|
78
|
+
<PageHeader title="Runs" facts={[`${runs.length} runs`]} actions={<Button icon={<Play size="1em" aria-hidden />}>Start run</Button>} />
|
|
79
|
+
<Stack direction="row" gap="4">{/* filters: Select / TextInput with labels */}</Stack>
|
|
80
|
+
<Table
|
|
81
|
+
columns={[
|
|
82
|
+
{ key: 'run', header: 'Run', render: (r) => <>{r.startedAt}<Table.Secondary>{r.id}</Table.Secondary></> },
|
|
83
|
+
{ key: 'status', header: 'Status', render: (r) => <StatusBadge status={r.status} /> },
|
|
84
|
+
{ key: 'duration', header: 'Duration', align: 'right' },
|
|
85
|
+
{ key: 'actions', header: 'Actions', align: 'right',
|
|
86
|
+
render: (r) => <TableAction aria-label="Open run" icon={<ExternalLink size="1em" aria-hidden />} onClick={() => open(r)} /> },
|
|
87
|
+
]}
|
|
88
|
+
rows={runs}
|
|
89
|
+
getRowKey={(r) => r.id}
|
|
90
|
+
loading={isLoading}
|
|
91
|
+
empty="No runs yet"
|
|
92
|
+
/>
|
|
93
|
+
<Pagination page={page} pageCount={pageCount} onPageChange={setPage} />
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
- Status always goes through `StatusBadge`. IDs and codes go in `Table.Secondary` (mono).
|
|
97
|
+
- Use `loading` for skeleton rows, never a spinner over the table.
|
|
98
|
+
|
|
99
|
+
## 3. Dashboard
|
|
100
|
+
|
|
101
|
+
```tsx
|
|
102
|
+
<PageHeader title="Overview" />
|
|
103
|
+
<StatsGrid>
|
|
104
|
+
<StatCard label="Objective achieved" value="64%" caption="7 of 11 judged" />
|
|
105
|
+
<StatCard label="Median duration" value="2m 12s" caption="Across loaded runs" />
|
|
106
|
+
</StatsGrid>
|
|
107
|
+
<Card heading="Progress">
|
|
108
|
+
<ProgressBar label="In progress" done={3} running={1} total={8} />
|
|
109
|
+
</Card>
|
|
110
|
+
<Card heading="Outcomes">
|
|
111
|
+
<MetricBar label="Achieved" value={83} tone="success" />
|
|
112
|
+
</Card>
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
## 4. Detail view
|
|
116
|
+
|
|
117
|
+
- Side detail without leaving the list: `Drawer` (right side), with `title`, `description` and `footer` actions.
|
|
118
|
+
- Grouped detail sections: `Tabs` with `count` for each section ("Conversation 13").
|
|
119
|
+
- Blocking confirmation: `Modal` with `footer` buttons. Put the destructive action in `variant="danger"`.
|
|
120
|
+
|
|
121
|
+
## 5. Settings form
|
|
122
|
+
|
|
123
|
+
```tsx
|
|
124
|
+
<PageHeader title="Recommendation settings" />
|
|
125
|
+
<Fieldset legend="Matching" description="How products are picked for a shopper.">
|
|
126
|
+
<Select
|
|
127
|
+
label="Strategy"
|
|
128
|
+
options={[{ value: 'best', label: 'Best match' }, { value: 'cheapest', label: 'Cheapest' }]}
|
|
129
|
+
value={strategy}
|
|
130
|
+
onValueChange={setStrategy}
|
|
131
|
+
/>
|
|
132
|
+
<NumberInput label="Results to show" min={1} max={10} />
|
|
133
|
+
<Switch label="Include out-of-stock products" />
|
|
134
|
+
<RadioCards
|
|
135
|
+
label="Tone"
|
|
136
|
+
options={[
|
|
137
|
+
{ value: 'friendly', label: 'Friendly', description: 'Warm, casual phrasing' },
|
|
138
|
+
{ value: 'expert', label: 'Expert', description: 'Precise and technical' },
|
|
139
|
+
]}
|
|
140
|
+
/>
|
|
141
|
+
</Fieldset>
|
|
142
|
+
<Fieldset legend="Copy">
|
|
143
|
+
<TextInput label="Greeting" maxLength={80} showCount error={errors.greeting?.message} />
|
|
144
|
+
<Textarea label="Disclaimer" description="Shown under every recommendation." />
|
|
145
|
+
</Fieldset>
|
|
146
|
+
<SaveBar changes={dirtyCount} onSave={save} onDiscard={reset} saving={isSaving} />
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
- Every input takes `label`, `description`, `error`, `required` and `disabled` directly. Don't wrap it in your own label.
|
|
150
|
+
- react-hook-form: `register` works on TextInput, Textarea, DateTimeInput and ColorPicker. Use `<Controller>` for the rest: `value`/`onValueChange` on Select, Combobox, RadioCards, NumberInput and ToggleGroup, and `checked`/`onCheckedChange` on Switch and Checkbox.
|
|
151
|
+
- `ToggleGroup` suits 2–4 short mutually exclusive options. Use `Select` for longer lists, and `Combobox` when the list needs filtering.
|
|
152
|
+
- **Where does Save go?**
|
|
153
|
+
- `SaveBar`: settings pages with many fields, where edits accumulate and Save/Discard must stay reachable while scrolling. Show the change count.
|
|
154
|
+
- A primary `Button` in `PageHeader` `actions`: short pages where Save is the page's one main action and is always visible.
|
|
155
|
+
- Footer buttons: forms inside a `Modal` or `Drawer`.
|
|
156
|
+
- Use one of these per page, never both.
|
|
157
|
+
|
|
158
|
+
## 6. Conversation view
|
|
159
|
+
|
|
160
|
+
Show a shopper ↔ assistant conversation with `ChatTranscript`. Don't hand-roll bubbles.
|
|
161
|
+
|
|
162
|
+
```tsx
|
|
163
|
+
import { Button, ChatTranscript, type ChatMessage } from '@15gifts/back-office-kit'
|
|
164
|
+
import { Info } from 'lucide-react'
|
|
165
|
+
|
|
166
|
+
const messages: ChatMessage[] = turns.map((turn) => ({
|
|
167
|
+
id: turn.id,
|
|
168
|
+
role: turn.speaker === 'shopper' ? 'user' : 'assistant', // or 'system' for events
|
|
169
|
+
content: turn.text, // any ReactNode: markdown, product cards, buttons
|
|
170
|
+
timestamp: formatTime(turn.at),
|
|
171
|
+
actions:
|
|
172
|
+
turn.speaker === 'assistant' ? (
|
|
173
|
+
<Button variant="ghost" size="sm" icon={<Info size="1em" aria-hidden />} onClick={() => openTurn(turn)}>
|
|
174
|
+
Turn details
|
|
175
|
+
</Button>
|
|
176
|
+
) : undefined,
|
|
177
|
+
}))
|
|
178
|
+
|
|
179
|
+
<ChatTranscript
|
|
180
|
+
label="Conversation with Tech enthusiast"
|
|
181
|
+
messages={messages}
|
|
182
|
+
assistantName="Sales assistant"
|
|
183
|
+
typing={run.status === 'running'}
|
|
184
|
+
live={run.status === 'running'} // announce new messages only while it's live
|
|
185
|
+
labels={{ user: 'Shopper', assistant: 'Assistant' }}
|
|
186
|
+
empty="No messages yet"
|
|
187
|
+
/>
|
|
188
|
+
```
|
|
189
|
+
|
|
190
|
+
- Consecutive messages from the same speaker group automatically. Use `role: 'system'` for events like "Conversation started".
|
|
191
|
+
- For custom layouts (e.g. turns with per-turn panels), compose `ChatTranscript.Root`, `.Message`, `.Bubble`, `.Meta`, `.Divider` and `.Typing`.
|
|
192
|
+
|
|
193
|
+
## Feedback and empty states
|
|
194
|
+
|
|
195
|
+
- Page-level messages: `Alert` (`tone` info, success, warning or danger). Danger and warning are announced.
|
|
196
|
+
- Inline empty lists: `EmptyLine`, or the `empty` prop of `Table`/`List`.
|
|
197
|
+
- Loading: `Skeleton` for content placeholders, `Loader` inside buttons and small regions, and `Button loading` while saving.
|
|
198
|
+
- Labels and filters: `Chip` for toggleable filters, `Tag` for small mono labels, and `Badge` for neutral or tone counts.
|