@companycam/slab-web 0.0.23-beta.2 → 0.0.23-beta.20

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.
@@ -0,0 +1,2 @@
1
+ export declare const Avatar: () => import("react/jsx-runtime").JSX.Element;
2
+ export default Avatar;
@@ -0,0 +1,34 @@
1
+ import { CSSProperties, ReactNode } from 'react';
2
+ declare const BadgeColor: {
3
+ readonly add_on: "add_on";
4
+ readonly assigned: "assigned";
5
+ readonly caution: "caution";
6
+ readonly destroy: "destroy";
7
+ readonly info: "info";
8
+ readonly success: "success";
9
+ readonly upgrade: "upgrade";
10
+ };
11
+ declare const BadgeSize: {
12
+ readonly small: "small";
13
+ readonly medium: "medium";
14
+ };
15
+ type Size = (typeof BadgeSize)[keyof typeof BadgeSize];
16
+ type Color = (typeof BadgeColor)[keyof typeof BadgeColor];
17
+ export type BadgeProps = {
18
+ children: ReactNode;
19
+ color?: Color;
20
+ className?: string;
21
+ iconName?: string;
22
+ size?: Size;
23
+ style?: CSSProperties;
24
+ testId?: string;
25
+ };
26
+ /**
27
+ The most common application for a Badge is in a list item, to display the status of an asset, event, or user - or to denote that something is new or is behind an updgraded plan paywall.
28
+
29
+ - For longer text, use [Notice](http://future.docs.page).
30
+ - Use `outline` icons inside Badge where possible.
31
+ - Badge should not be clickable itself, but can be part of a clickable element containing other items.
32
+ */
33
+ export declare function Badge({ children, color, className, iconName, size, style, testId, }: BadgeProps): import("react/jsx-runtime").JSX.Element;
34
+ export default Badge;
@@ -0,0 +1,60 @@
1
+ import { CSSProperties } from 'react';
2
+ import { ButtonProps } from '../Button/Button';
3
+ type IconColor = 'success' | 'caution' | 'destroy' | 'info';
4
+ type Action = Omit<ButtonProps, 'children'> & {
5
+ label: string;
6
+ 'data-testid'?: string;
7
+ };
8
+ type Image = {
9
+ src: string;
10
+ alt: string;
11
+ imageContainerStyle?: CSSProperties;
12
+ };
13
+ export type BillboardProps = {
14
+ className?: string;
15
+ color?: IconColor;
16
+ iconName?: string;
17
+ message: string;
18
+ primaryAction?: Action;
19
+ secondaryAction?: Action;
20
+ style?: CSSProperties;
21
+ title?: string;
22
+ image?: Image;
23
+ };
24
+ /**
25
+ * Billboard renders any combination of an icon/image, title, message, and action buttons.
26
+ * - Use title case for the `title` (e.g., "Something Went Wrong", not "Something went wrong").
27
+ * - Use `outline` icon variants in Billboard where possible.
28
+ * - If the `message` is long enough, set a `max-width` by extending Billboard as a `styled-component`: `const StyledBillboard = styled(Billboard)({ maxWidth: '400px'; margin: 0 auto; });`
29
+ * - Images are sized to 128px by 128px. (Square images work best.)
30
+ *
31
+ *
32
+ * @param [alt] - A label for images used in billboard
33
+ * @param [color] - Determines the color of the icon (and primary button, if color is "destroy")
34
+ * @param [iconName] - Display a CompanyCam icon as the featured image
35
+ * @param [message] - The main text content
36
+ * @param [primaryAction] - Object with `label` and any property of type ButtonProps for primary action button that pulls types from ```<Button />```
37
+ * @param [secondaryAction] - Object with `label` and any property of type ButtonProps for secondary action button that pulls types from ```<Button />```
38
+ * @param [title] - The Billboard heading
39
+ *
40
+ * @example
41
+ *
42
+ * const clearError = () => {
43
+ * setError(null);
44
+ * };
45
+ *
46
+ *<Billboard
47
+ * title="Uh-Oh!"
48
+ * color="destroy"
49
+ * iconName="alert-circle"
50
+ * secondaryAction={{
51
+ * 'data-testid': "my_test_id",
52
+ * label: "Try, again",
53
+ * onClick: clearError,
54
+ * type: "button"
55
+ * }}
56
+ * message="Sorry, something seems to have happened on our end."
57
+ * />
58
+ */
59
+ export declare const Billboard: ({ image, className, color, iconName, message, primaryAction, secondaryAction, style, title, }: BillboardProps) => import("react/jsx-runtime").JSX.Element;
60
+ export default Billboard;
@@ -0,0 +1,28 @@
1
+ import React, { ComponentPropsWithRef } from 'react';
2
+ type ButtonColor = 'destroy' | 'primary' | 'secondary' | 'subtle' | 'success';
3
+ type ButtonSize = 'small' | 'medium' | 'large';
4
+ declare const ButtonDesign: {
5
+ readonly solid: "solid";
6
+ readonly outline: "outline";
7
+ readonly minimal: "minimal";
8
+ };
9
+ type Design = (typeof ButtonDesign)[keyof typeof ButtonDesign];
10
+ type BaseButtonProps = ComponentPropsWithRef<'button'> & ComponentPropsWithRef<'a'>;
11
+ export type ButtonProps = BaseButtonProps & {
12
+ children: React.ReactNode;
13
+ color?: ButtonColor;
14
+ design?: Design;
15
+ href?: string;
16
+ icon?: {
17
+ name?: string;
18
+ position?: 'before' | 'after';
19
+ };
20
+ loading?: boolean;
21
+ size?: ButtonSize;
22
+ props?: unknown;
23
+ };
24
+ /**
25
+ Defaults to rendering as a `<button type="button" />`, but will render as a link if an href prop is provided.
26
+ */
27
+ export declare const Button: ({ children, color, design, href, icon, loading, size, type, ...props }: ButtonProps) => import("react/jsx-runtime").JSX.Element;
28
+ export default Button;
@@ -0,0 +1,9 @@
1
+ import { ButtonProps } from '../Button/Button';
2
+ export type ButtonCondensedProps = Omit<ButtonProps, 'design'>;
3
+ /**
4
+ A minimal [Button](/docs/button--docs) with styles for situations where you don't need padding, such as inside a table cell.
5
+
6
+ ButtonCondensed accepts all of the same props as [Button](/docs/button--docs), but defaults to `design="minimal"`.
7
+ */
8
+ export declare const ButtonCondensed: ({ ...rest }: ButtonCondensedProps) => import("react/jsx-runtime").JSX.Element;
9
+ export default ButtonCondensed;
@@ -0,0 +1,25 @@
1
+ import { CSSProperties, ComponentPropsWithRef, ReactNode } from 'react';
2
+ type HTMLInputProps = ComponentPropsWithRef<'input'>;
3
+ type InputType = 'email' | 'search' | 'tel' | 'text' | 'url';
4
+ export type InputTextProps = HTMLInputProps & {
5
+ id: string;
6
+ label: ReactNode;
7
+ className?: string;
8
+ contentBefore?: ReactNode;
9
+ contentAfter?: ReactNode;
10
+ error?: boolean;
11
+ hideLabel?: boolean;
12
+ message?: ReactNode;
13
+ name?: string;
14
+ inputSize?: 'medium' | 'large';
15
+ style?: CSSProperties;
16
+ success?: boolean;
17
+ testId?: string;
18
+ type?: InputType;
19
+ };
20
+ /**
21
+ * - InputText is a controlled component: You must provide an `onChange` handler to update the value.
22
+ * - Use title case for the required `label` (e.g., "Project Name", not "Project name").
23
+ */
24
+ export declare function InputText({ className, contentBefore, contentAfter, error, hideLabel, id, label, message, name, inputSize, style, success, testId, type, ...props }: InputTextProps): import("react/jsx-runtime").JSX.Element;
25
+ export default InputText;
@@ -0,0 +1,42 @@
1
+ import { CSSProperties, ReactNode } from 'react';
2
+ declare const NoticeColor: {
3
+ readonly add_on: "add_on";
4
+ readonly assigned: "assigned";
5
+ readonly caution: "caution";
6
+ readonly destroy: "destroy";
7
+ readonly info: "info";
8
+ readonly success: "success";
9
+ readonly upgrade: "upgrade";
10
+ };
11
+ declare const NoticeSize: {
12
+ readonly small: "small";
13
+ readonly medium: "medium";
14
+ readonly large: "large";
15
+ };
16
+ type Color = (typeof NoticeColor)[keyof typeof NoticeColor];
17
+ type Size = (typeof NoticeSize)[keyof typeof NoticeSize];
18
+ export type NoticeProps = {
19
+ children: ReactNode;
20
+ color?: Color;
21
+ contentAfter?: ReactNode;
22
+ contentAlign?: string;
23
+ contentBefore?: ReactNode;
24
+ hideIcon?: boolean;
25
+ iconName?: string;
26
+ size?: Size;
27
+ style?: CSSProperties;
28
+ testId?: string;
29
+ };
30
+ export type IconProps = {
31
+ color?: Color;
32
+ size?: Size;
33
+ };
34
+ /**
35
+ - `Notice` accepts text or components/HTML as children. It supplies basic styles to format any text inside it, but any other formatting is up to you.
36
+
37
+ - `Notice` can have a call to action (see `contentAfter` example) or be purely informational.
38
+
39
+ - `Notice` will display pre-defined default icons depending on the `color` prop, but can be overridden with `iconName`, or hidden entirely with `hideIcon`.
40
+ */
41
+ export declare function Notice({ children, color, contentBefore, contentAfter, contentAlign, iconName, hideIcon, size, testId, }: NoticeProps): import("react/jsx-runtime").JSX.Element;
42
+ export default Notice;
@@ -0,0 +1,12 @@
1
+ /// <reference types="react" />
2
+ export type ScreenReaderContentProps = {
3
+ children: React.ReactNode;
4
+ };
5
+ /**
6
+
7
+ #### When you're designing or implementing a UI, ask yourself if it could be used if you couldn't see the screen.
8
+
9
+ For example, is being able to see an icon important for the user to understand context or functionality? If so, always add explanatory text for screen readers, wrapped inside a `<ScreenReaderContent />` component.
10
+ */
11
+ export declare const ScreenReaderContent: ({ children }: ScreenReaderContentProps) => import("react/jsx-runtime").JSX.Element;
12
+ export default ScreenReaderContent;
@@ -0,0 +1,17 @@
1
+ /// <reference types="react" />
2
+ type Layout = 'vertical' | 'horizontal';
3
+ type Size = number | 'small' | 'medium' | 'large' | 'xsmall';
4
+ export type SpinnerProps = {
5
+ accessibilityLabel: string;
6
+ className?: string;
7
+ testId?: string;
8
+ label?: string;
9
+ layout?: Layout;
10
+ meterColor?: string;
11
+ size?: Size;
12
+ style?: React.CSSProperties;
13
+ trackColor?: string;
14
+ };
15
+ /** Use Spinner when something's happening and the user needs to wait. Versatile and customizable. */
16
+ export declare const Spinner: ({ accessibilityLabel, testId, className, label, layout, meterColor, size, style, trackColor, }: SpinnerProps) => import("react/jsx-runtime").JSX.Element;
17
+ export default Spinner;
@@ -0,0 +1,25 @@
1
+ import { CSSProperties } from 'react';
2
+ type Color = 'default' | 'subtle' | 'nonessential' | 'inherit';
3
+ type Size = 'xxxl' | 'xxl' | 'xl' | 'l' | 'm' | 's' | 'xs' | 'xxs';
4
+ type AsProp = keyof HTMLElementTagNameMap;
5
+ type TextProps = {
6
+ as: AsProp;
7
+ forwardedAs?: string;
8
+ children?: React.ReactNode;
9
+ color?: Color;
10
+ size?: Size;
11
+ family?: 'heading' | 'system';
12
+ ccMargin?: string;
13
+ weight?: string | number;
14
+ display?: 'inline' | 'block';
15
+ className?: string;
16
+ style?: CSSProperties;
17
+ };
18
+ /**
19
+ - Sensible defaults based on size, with the flexibility to render as any HTML element.
20
+ - Automatically nudges sizes up 1px if heading font-family (Averta) is being used.
21
+ - Margins reset to 0 by default (we don't do a lot of long-form text in the app itself). Add margin when you need it via the `ccMargin` prop.
22
+ - Can be extended as a styled-component.
23
+ */
24
+ export declare function Text({ as, forwardedAs, children, color, size, family, ccMargin, weight, display, className, style, ...props }: TextProps): import("react/jsx-runtime").JSX.Element;
25
+ export default Text;
@@ -0,0 +1,21 @@
1
+ import { CSSProperties, ReactNode } from 'react';
2
+ declare const StatusColor: {
3
+ readonly default: "default";
4
+ readonly error: "error";
5
+ readonly success: "success";
6
+ };
7
+ type Status = (typeof StatusColor)[keyof typeof StatusColor];
8
+ export type FieldProps = {
9
+ children: ReactNode;
10
+ className?: string;
11
+ disabled?: boolean;
12
+ id: string;
13
+ message?: ReactNode;
14
+ status?: Status;
15
+ style?: CSSProperties;
16
+ };
17
+ /**
18
+ * Field is used inside forms components like InputText as a DRY way of rendering a message below the input / label UI.
19
+ * */
20
+ export declare function Field({ children, className, disabled, id, message, status, style, }: FieldProps): import("react/jsx-runtime").JSX.Element;
21
+ export default Field;
@@ -0,0 +1,20 @@
1
+ export declare const systemFontFamily = "font-family: system-ui, -apple-system, BlinkMacSystemFont,\n'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;";
2
+ export declare const headingFontFamily = "font-family: 'Averta', system-ui, -apple-system, BlinkMacSystemFont,\n'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;";
3
+ export declare const focusStyles: (error?: boolean, success?: boolean) => import("styled-components").RuleSet<object>;
4
+ export declare const baseButtonStyles: ({ disabled, readOnly }: {
5
+ disabled?: boolean | undefined;
6
+ readOnly?: boolean | undefined;
7
+ }) => string;
8
+ export declare const buttonSize: {
9
+ small: string;
10
+ medium: string;
11
+ large: string;
12
+ };
13
+ export declare const visuallyHidden: import("styled-components").RuleSet<object>;
14
+ export declare const spacingTokensToCSS: (spacing: string) => string;
15
+ export declare const avatarSizes: {
16
+ large: number;
17
+ medium: number;
18
+ small: number;
19
+ xsmall: number;
20
+ };
package/package.json CHANGED
@@ -1,7 +1,18 @@
1
1
  {
2
2
  "name": "@companycam/slab-web",
3
- "version": "0.0.23-beta.2",
4
- "module": "./index.esm.js",
5
- "type": "module",
6
- "main": "./index.esm.js"
3
+ "version": "0.0.23-beta.20",
4
+ "main": "./index.js",
5
+ "types": "./index.d.ts",
6
+ "exports": {
7
+ ".": {
8
+ "import": {
9
+ "types": "./index.d.ts",
10
+ "default": "./index.mjs"
11
+ },
12
+ "require": {
13
+ "types": "./index.d.ts",
14
+ "default": "./index.js"
15
+ }
16
+ }
17
+ }
7
18
  }
package/README.md DELETED
@@ -1,7 +0,0 @@
1
- # slab-web
2
-
3
- This library was generated with [Nx](https://nx.dev).
4
-
5
- ## Running unit tests
6
-
7
- Run `nx test slab-web` to execute the unit tests via [Jest](https://jestjs.io).
package/index.esm.d.ts DELETED
@@ -1 +0,0 @@
1
- export * from "./src/index";