@sarunyu/system-one 1.0.5 → 1.1.1

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/dist/index.js CHANGED
@@ -4,7 +4,7 @@ import * as React from "react";
4
4
  import React__default, { forwardRef, useState, useCallback, useRef, useEffect, useMemo, useLayoutEffect } from "react";
5
5
  import { clsx } from "clsx";
6
6
  import { twMerge } from "tailwind-merge";
7
- import { Lock, CalendarBlank, MapPin, Users, Minus, CaretLeft, CaretRight, CaretDoubleLeft, CaretDoubleRight, CaretUp, CaretDown, Check, X, MagnifyingGlass, Circle, Clock } from "@phosphor-icons/react";
7
+ import { Lock, CalendarBlank, MapPin, Users, Check, Plus, Minus, CaretLeft, CaretRight, CaretDoubleLeft, CaretDoubleRight, CaretUp, CaretDown, X, MagnifyingGlass, Circle, Clock } from "@phosphor-icons/react";
8
8
  import { DayPicker, useNavigation } from "react-day-picker";
9
9
  import * as Popover from "@radix-ui/react-popover";
10
10
  import { Drawer as Drawer$1 } from "vaul";
@@ -377,6 +377,68 @@ const Card = forwardRef(function Card2({
377
377
  );
378
378
  });
379
379
  Card.displayName = "Card";
380
+ const sizeStyles$1 = {
381
+ large: {
382
+ container: "h-9 px-3 gap-1",
383
+ text: "text-sm leading-5",
384
+ icon: "icon-lg"
385
+ },
386
+ medium: {
387
+ container: "h-8 px-3 gap-1",
388
+ text: "text-sm leading-5",
389
+ icon: "icon-lg"
390
+ },
391
+ small: {
392
+ container: "h-7 px-2.5 gap-0.5",
393
+ text: "text-xs leading-4",
394
+ icon: "icon-md"
395
+ }
396
+ };
397
+ const multiplePaddingBySize = {
398
+ large: "pl-[8px] pr-[12px]",
399
+ medium: "pl-[8px] pr-[12px]",
400
+ small: "pl-[6px] pr-[10px]"
401
+ };
402
+ const Chip = forwardRef(function Chip2({
403
+ label = "Chips Text",
404
+ type = "single",
405
+ size = "large",
406
+ selected = false,
407
+ disabled = false,
408
+ onClick,
409
+ className
410
+ }, ref) {
411
+ const s = sizeStyles$1[size];
412
+ const isMultiple = type === "multiple";
413
+ const state = disabled ? selected ? "selected-disabled" : "disabled" : selected ? "selected" : "default";
414
+ const containerClass = state === "selected" ? "bg-primary-action border border-primary-action" : state === "selected-disabled" ? "bg-selected-light-bg border border-transparent" : state === "disabled" ? "bg-disabled-bg border border-transparent" : "bg-background border border-border";
415
+ const textClass = state === "selected" ? "text-on-primary-action" : state === "selected-disabled" ? "text-primary-action/40" : state === "disabled" ? "text-disabled" : "text-subtle-text";
416
+ const iconClass = state === "selected" ? "text-on-primary-action" : state === "selected-disabled" ? "text-primary-action/40" : state === "disabled" ? "text-disabled" : "text-subtle-text";
417
+ const icon = isMultiple && selected ? /* @__PURE__ */ jsx(Check, { "aria-hidden": "true", weight: "regular", className: cn("shrink-0", s.icon, iconClass) }) : isMultiple ? /* @__PURE__ */ jsx(Plus, { "aria-hidden": "true", weight: "regular", className: cn("shrink-0", s.icon, iconClass) }) : null;
418
+ return /* @__PURE__ */ jsxs(
419
+ "button",
420
+ {
421
+ ref,
422
+ type: "button",
423
+ onClick: !disabled ? onClick : void 0,
424
+ disabled,
425
+ "aria-pressed": selected,
426
+ className: cn(
427
+ "inline-flex items-center justify-center rounded-full whitespace-nowrap border transition-colors",
428
+ s.container,
429
+ isMultiple && multiplePaddingBySize[size],
430
+ containerClass,
431
+ disabled ? "cursor-not-allowed" : "cursor-pointer",
432
+ className
433
+ ),
434
+ children: [
435
+ icon,
436
+ /* @__PURE__ */ jsx("span", { className: cn("font-normal", s.text, textClass), children: label })
437
+ ]
438
+ }
439
+ );
440
+ });
441
+ Chip.displayName = "Chip";
380
442
  const MOBILE_BREAKPOINT = 768;
381
443
  function useIsMobile() {
382
444
  const [isMobile, setIsMobile] = React.useState(
@@ -2957,6 +3019,44 @@ const Tag = forwardRef(function Tag2({
2957
3019
  );
2958
3020
  });
2959
3021
  Tag.displayName = "Tag";
3022
+ const statusTagStyles = {
3023
+ stop: {
3024
+ label: "Stop",
3025
+ dot: "var(--fill-gray-500)"
3026
+ },
3027
+ success: {
3028
+ label: "Success",
3029
+ dot: "var(--fill-emerald-500)"
3030
+ },
3031
+ hold: {
3032
+ label: "Hold",
3033
+ dot: "var(--fill-yellow-500)"
3034
+ },
3035
+ processing: {
3036
+ label: "Processing",
3037
+ dot: "var(--fill-blue-500)"
3038
+ },
3039
+ error: {
3040
+ label: "Error",
3041
+ dot: "var(--fill-rose-500)"
3042
+ }
3043
+ };
3044
+ function StatusTag({ type = "stop", text, className }) {
3045
+ const style = statusTagStyles[type] ?? statusTagStyles.stop;
3046
+ return /* @__PURE__ */ jsxs(
3047
+ "div",
3048
+ {
3049
+ className: cn(
3050
+ "inline-flex items-center justify-center gap-1 rounded-[8px] px-2 py-1",
3051
+ className
3052
+ ),
3053
+ children: [
3054
+ /* @__PURE__ */ jsx(Circle, { "aria-hidden": "true", weight: "fill", className: "size-[8px] shrink-0", color: style.dot }),
3055
+ /* @__PURE__ */ jsx("span", { className: "whitespace-nowrap text-[14px] leading-[20px] font-normal text-disabled", children: text ?? style.label })
3056
+ ]
3057
+ }
3058
+ );
3059
+ }
2960
3060
  const TextArea = forwardRef(
2961
3061
  function TextArea2({
2962
3062
  placeholder = "Text label",
@@ -3776,12 +3876,14 @@ TimeInput.displayName = "TimeInput";
3776
3876
  export {
3777
3877
  Button,
3778
3878
  Card,
3879
+ Chip,
3779
3880
  DateInput,
3780
3881
  Dropdown,
3781
3882
  DropdownMultiple,
3782
3883
  Input,
3783
3884
  OptionList,
3784
3885
  SearchInput,
3886
+ StatusTag,
3785
3887
  Tab,
3786
3888
  TabGroup,
3787
3889
  Tag,