@narmi/design_system 6.15.0 → 6.15.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (54) hide show
  1. package/dist/index.js +12 -12
  2. package/dist/index.js.map +1 -1
  3. package/dist/tokens/css/rgbColors.css +1 -1
  4. package/dist/tokens/css/rgbColors.scss +1 -1
  5. package/dist/tokens/css/tokens.css +1 -1
  6. package/dist/tokens/css/tokens.scss +1 -1
  7. package/dist/tokens/js/colors.esm.js +1 -1
  8. package/dist/tokens/js/colors.js +1 -1
  9. package/dist/tokens/js/manifest.esm.js +1 -1
  10. package/dist/tokens/js/manifest.js +1 -1
  11. package/dist/tokens/js/reactNativeWeb.js +1 -1
  12. package/dist/types/Error/index.d.ts +20 -0
  13. package/dist/types/Error/index.d.ts.map +1 -0
  14. package/dist/types/Field/FauxInput/index.d.ts +20 -0
  15. package/dist/types/Field/FauxInput/index.d.ts.map +1 -0
  16. package/dist/types/Field/Select/SelectItem.d.ts +15 -0
  17. package/dist/types/Field/Select/SelectItem.d.ts.map +1 -0
  18. package/dist/types/Field/Select/index.d.ts +24 -0
  19. package/dist/types/Field/Select/index.d.ts.map +1 -0
  20. package/dist/types/Field/Text/index.d.ts +14 -0
  21. package/dist/types/Field/Text/index.d.ts.map +1 -0
  22. package/dist/types/FieldToken/index.d.ts +23 -0
  23. package/dist/types/FieldToken/index.d.ts.map +1 -0
  24. package/dist/types/FormSection/index.d.ts +21 -0
  25. package/dist/types/FormSection/index.d.ts.map +1 -0
  26. package/dist/types/IconButton/index.d.ts +72 -0
  27. package/dist/types/IconButton/index.d.ts.map +1 -0
  28. package/dist/types/LoadingShim/index.d.ts +31 -0
  29. package/dist/types/LoadingShim/index.d.ts.map +1 -0
  30. package/dist/types/Pagination/index.d.ts +69 -0
  31. package/dist/types/Pagination/index.d.ts.map +1 -0
  32. package/dist/types/Pagination/usePagination.d.ts +39 -0
  33. package/dist/types/Pagination/usePagination.d.ts.map +1 -0
  34. package/dist/types/ResponsiveFlex/index.d.ts +52 -0
  35. package/dist/types/ResponsiveFlex/index.d.ts.map +1 -0
  36. package/dist/types/Table/util/pinning.d.ts +7 -0
  37. package/dist/types/Table/util/pinning.d.ts.map +1 -0
  38. package/dist/types/TimelineEvent/index.d.ts +75 -0
  39. package/dist/types/TimelineEvent/index.d.ts.map +1 -0
  40. package/dist/types/Toggle/index.d.ts +40 -0
  41. package/dist/types/Toggle/index.d.ts.map +1 -0
  42. package/dist/types/formatters/formatDate.d.ts +17 -0
  43. package/dist/types/formatters/formatDate.d.ts.map +1 -0
  44. package/dist/types/formatters/formatNumber.d.ts +22 -0
  45. package/dist/types/formatters/formatNumber.d.ts.map +1 -0
  46. package/dist/types/hooks/useLockBodyScroll/index.d.ts +7 -0
  47. package/dist/types/hooks/useLockBodyScroll/index.d.ts.map +1 -0
  48. package/dist/types/hooks/useSupportsAnchorPositioning/index.d.ts +12 -2
  49. package/dist/types/hooks/useSupportsAnchorPositioning/index.d.ts.map +1 -1
  50. package/dist/types/icons/iconNames.d.ts +3 -0
  51. package/dist/types/icons/iconNames.d.ts.map +1 -0
  52. package/dist/types/util/AsElement.d.ts +44 -0
  53. package/dist/types/util/AsElement.d.ts.map +1 -0
  54. package/package.json +1 -1
@@ -0,0 +1,40 @@
1
+ import { default as React } from 'react';
2
+ export interface ToggleProps {
3
+ /**
4
+ * Callback invoked with current active state (bool) as the function argument
5
+ * when user changes the active state of the Toggle
6
+ */
7
+ onChange?: (isActive: boolean) => void;
8
+ /** When set to `true`, the toggle will initially render as active */
9
+ defaultActive?: boolean;
10
+ /**
11
+ * Sets active state of toggle; makes the component fully controlled.
12
+ * When using `isActive` you **must** use the `onChange` callback
13
+ * to update the active state of the toggle.
14
+ */
15
+ isActive?: boolean;
16
+ /**
17
+ * Shows a disabled state for the toggle when set to `true`.
18
+ */
19
+ disabled?: boolean;
20
+ /**
21
+ * Shows a loading state for the toggle when set to `true`.
22
+ */
23
+ isLoading?: boolean;
24
+ /** Label element to render to the right of the toggle */
25
+ label?: string;
26
+ /** ID of element that labels the toggle control (e.g. `my-label-element`)*/
27
+ labelledBy?: string;
28
+ /** Optional value for `data-testid` attribute */
29
+ testId?: string;
30
+ /** Label for enabled state. Not displayed, used for screen readers. */
31
+ enabledLabel?: string;
32
+ /** Label for disabled state. Not displayed, used for screen readers. */
33
+ disabledLabel?: string;
34
+ }
35
+ /**
36
+ * Checkbox behavior with the visual treatment of a physical toggle switch.
37
+ */
38
+ declare const Toggle: ({ defaultActive, isActive, disabled, isLoading, onChange, labelledBy, label, testId, enabledLabel, disabledLabel, }: ToggleProps) => React.JSX.Element;
39
+ export default Toggle;
40
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/Toggle/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA8B,MAAM,OAAO,CAAC;AAInD,MAAM,WAAW,WAAW;IAC1B;;;OAGG;IACH,QAAQ,CAAC,EAAE,CAAC,QAAQ,EAAE,OAAO,KAAK,IAAI,CAAC;IACvC,qEAAqE;IACrE,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB;;;;OAIG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB;;OAEG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB;;OAEG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,yDAAyD;IACzD,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,4EAA4E;IAC5E,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,iDAAiD;IACjD,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,uEAAuE;IACvE,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,wEAAwE;IACxE,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AAED;;GAEG;AACH,QAAA,MAAM,MAAM,GAAI,qHAWb,WAAW,sBA8Db,CAAC;AAEF,eAAe,MAAM,CAAC"}
@@ -0,0 +1,17 @@
1
+ /**
2
+ * Wrapper for `Intl.DateTimeFormat` with options configured for Narmi applications.
3
+ *
4
+ * @example
5
+ * import { formatDate } from '@narmi/design_system';
6
+ *
7
+ * formatDate(new Date('July 4, 2022'), 'short'); // '7/4/22'
8
+ * formatDate(new Date('7/4/2022'), 'long'); // 'July 4, 2022'
9
+ *
10
+ * @param date native date object
11
+ * @param style formatting style (`short` or `long`)
12
+ * @returns date string formatted for display
13
+ */
14
+ export type FormatDateStyle = "short" | "long";
15
+ declare const formatDate: (date: Date, style?: FormatDateStyle) => string;
16
+ export default formatDate;
17
+ //# sourceMappingURL=formatDate.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"formatDate.d.ts","sourceRoot":"","sources":["../../../src/formatters/formatDate.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AACH,MAAM,MAAM,eAAe,GAAG,OAAO,GAAG,MAAM,CAAC;AAE/C,QAAA,MAAM,UAAU,GAAI,MAAM,IAAI,EAAE,QAAO,eAAyB,KAAG,MAelE,CAAC;AAEF,eAAe,UAAU,CAAC"}
@@ -0,0 +1,22 @@
1
+ /**
2
+ * Wrapper for `Intl.NumberFormat` with options configured for Narmi applications.
3
+ *
4
+ * @example
5
+ * import { formatNumber } from '@narmi/design_system';
6
+ *
7
+ * formatNumber(1234.56, 'currency'); // '$1,234.56'
8
+ * formatNumber(34.4, 'currency'); // '$34.40'
9
+ * formatNumber(-12, 'currency'); // '-$12.00'
10
+ * formatNumber('0.0342', 'percent'); // '3.42%'
11
+ * formatNumber(0.0023, 'percent'); // '0.23%'
12
+ * formatNumber(0.215555, 'percent'); // '21.56%'
13
+ *
14
+ * @param input string or number to format into a number string
15
+ * @param style format style (`currency` or `percent`)
16
+ * @returns number string formatted for display
17
+ */
18
+ export type FormatNumberStyle = "currency" | "percent";
19
+ export type FormatNumberSignDisplay = "auto" | "never" | "always" | "exceptZero";
20
+ declare const formatNumber: (input: string | number, style?: FormatNumberStyle, signDisplay?: FormatNumberSignDisplay, showCents?: boolean) => string;
21
+ export default formatNumber;
22
+ //# sourceMappingURL=formatNumber.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"formatNumber.d.ts","sourceRoot":"","sources":["../../../src/formatters/formatNumber.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,MAAM,iBAAiB,GAAG,UAAU,GAAG,SAAS,CAAC;AACvD,MAAM,MAAM,uBAAuB,GAC/B,MAAM,GACN,OAAO,GACP,QAAQ,GACR,YAAY,CAAC;AAEjB,QAAA,MAAM,YAAY,GAChB,OAAO,MAAM,GAAG,MAAM,EACtB,QAAO,iBAA8B,EACrC,cAAa,uBAAgC,EAC7C,YAAW,OAAc,KACxB,MA+CF,CAAC;AAEF,eAAe,YAAY,CAAC"}
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Hook for locking body scrolling while a component is mounted
3
+ * @param isActive - applies scroll locking when `true`
4
+ */
5
+ declare const useLockBodyScroll: (isActive: boolean) => void;
6
+ export default useLockBodyScroll;
7
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/hooks/useLockBodyScroll/index.ts"],"names":[],"mappings":"AAEA;;;GAGG;AACH,QAAA,MAAM,iBAAiB,GAAI,UAAU,OAAO,KAAG,IAS9C,CAAC;AAEF,eAAe,iBAAiB,CAAC"}
@@ -4,12 +4,22 @@
4
4
  * Detection strategy:
5
5
  * 1. CSS.supports() checks for property/value support (fast path).
6
6
  * 2. A separate exported constant `HAS_SCROLL_CONTAINER_BUG` runs a runtime
7
- * test to detect Safari's broken anchor-size/position-try-fallbacks inside
8
- * scroll containers. Components opt into this check via
7
+ * test to detect Safari's broken anchor sizing and placement inside scroll
8
+ * containers. Components opt into this check via
9
9
  * `polyfillScrollBug: true` on useDropdownLayer.
10
10
  *
11
11
  * Both checks run once at module load and are cached.
12
12
  */
13
+ /**
14
+ * Runtime check for Safari's specific scroll container bug.
15
+ *
16
+ * Creates 3 hidden elements (scroll container + anchor + positioned layer),
17
+ * measures the anchor and layer, and cleans up. If the layer doesn't match the
18
+ * anchor's width and position, the browser has the bug.
19
+ *
20
+ * Only called when cssChecksPass() is true (browser claims support).
21
+ */
22
+ export declare const isAnchorLayoutValid: (anchorRect: Pick<DOMRect, "width" | "left" | "bottom">, layerRect: Pick<DOMRect, "width" | "left" | "top">) => boolean;
13
23
  /**
14
24
  * Whether the browser has the Safari scroll-container bug where
15
25
  * anchor-size() and position-try-fallbacks fail inside overflow:auto ancestors.
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/hooks/useSupportsAnchorPositioning/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAkDH;;;;;GAKG;AACH,eAAO,MAAM,wBAAwB,EAAE,OACoB,CAAC;AAE5D;;;GAGG;AACH,QAAA,MAAM,4BAA4B,QAAO,OAAsC,CAAC;AAEhF,eAAe,4BAA4B,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/hooks/useSupportsAnchorPositioning/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAgBH;;;;;;;;GAQG;AACH,eAAO,MAAM,mBAAmB,GAC9B,YAAY,IAAI,CAAC,OAAO,EAAE,OAAO,GAAG,MAAM,GAAG,QAAQ,CAAC,EACtD,WAAW,IAAI,CAAC,OAAO,EAAE,OAAO,GAAG,MAAM,GAAG,KAAK,CAAC,KACjD,OAOF,CAAC;AA4BF;;;;;GAKG;AACH,eAAO,MAAM,wBAAwB,EAAE,OACoB,CAAC;AAE5D;;;GAGG;AACH,QAAA,MAAM,4BAA4B,QAAO,OAAsC,CAAC;AAEhF,eAAe,4BAA4B,CAAC"}
@@ -0,0 +1,3 @@
1
+ export declare const VALID_ICON_NAMES: string[];
2
+ export default VALID_ICON_NAMES;
3
+ //# sourceMappingURL=iconNames.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"iconNames.d.ts","sourceRoot":"","sources":["../../../src/icons/iconNames.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,gBAAgB,EAAE,MAAM,EAsVpC,CAAC;AAEF,eAAe,gBAAgB,CAAC"}
@@ -0,0 +1,44 @@
1
+ import { default as React } from 'react';
2
+ import { default as PropTypes } from 'prop-types';
3
+ /**
4
+ * Returns the href if it uses a safe protocol, or undefined if it
5
+ * uses a potentially dangerous scheme (javascript:, data:, etc).
6
+ *
7
+ * Accepts `unknown` rather than `string` on purpose: this is a security
8
+ * guard, and it must keep rejecting non-string input that reaches it from
9
+ * untyped call sites at runtime.
10
+ */
11
+ export declare const getSafeHref: (href?: unknown) => string | null | undefined;
12
+ /**
13
+ * This is not a complete list of HTML elements;
14
+ * only the elements we want to support in `as` props.
15
+ */
16
+ export declare const VALID_ELEMENTS: string[];
17
+ export interface AsElementProps {
18
+ /** element to render */
19
+ elementType?: React.ElementType;
20
+ children?: React.ReactNode;
21
+ /**
22
+ * Any additional props are spread onto the rendered element.
23
+ * `AsElement` is a passthrough, so this is intentionally open-ended.
24
+ */
25
+ [key: string]: unknown;
26
+ }
27
+ /**
28
+ * Utility to conditionally render different HTML elements
29
+ * in our components. Useful for exposing `as` props:
30
+ *
31
+ * `<Row as="ul"><Row.Item as="li" /></Row>
32
+ *
33
+ * @usage <AsElement elementName="ul" otherProp="this gets passed through">
34
+ */
35
+ declare const AsElement: {
36
+ ({ elementType, children, ...rest }: AsElementProps): React.JSX.Element;
37
+ propTypes: {
38
+ /** element to render */
39
+ elementType: PropTypes.Validator<NonNullable<NonNullable<string | ((...args: any[]) => any)>>>;
40
+ children: PropTypes.Requireable<NonNullable<PropTypes.ReactNodeLike>>;
41
+ };
42
+ };
43
+ export default AsElement;
44
+ //# sourceMappingURL=AsElement.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AsElement.d.ts","sourceRoot":"","sources":["../../../src/util/AsElement.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,SAAS,MAAM,YAAY,CAAC;AAInC;;;;;;;GAOG;AACH,eAAO,MAAM,WAAW,GAAI,OAAO,OAAO,KAAG,MAAM,GAAG,IAAI,GAAG,SAU5D,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,cAAc,UAkB1B,CAAC;AAEF,MAAM,WAAW,cAAc;IAC7B,yBAAyB;IACzB,WAAW,CAAC,EAAE,KAAK,CAAC,WAAW,CAAC;IAChC,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC3B;;;OAGG;IACH,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CACxB;AAED;;;;;;;GAOG;AACH,QAAA,MAAM,SAAS;yCAIZ,cAAc;;QA6Bf,yBAAyB;;;;CAH1B,CAAC;AAcF,eAAe,SAAS,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@narmi/design_system",
3
- "version": "6.15.0",
3
+ "version": "6.15.2",
4
4
  "description": "⚡ A consistent look-and-feel and extensible interface for Narmi experiences 🔥",
5
5
  "main": "dist/index.js",
6
6
  "style": "dist/style.css",